ข้ามไปยังเนื้อหา

Class EngineBuilder

เนื้อหานี้ยังไม่ได้แปลเป็นภาษาไทย แสดงเป็นภาษาอังกฤษแทน

Namespace: Cephalon.Engine.Composition
Assembly: Cephalon.Engine.dll

Builds a Cephalon runtime by composing the application model, module set, and policy inputs into a single .

public sealed class EngineBuilder

objectEngineBuilder

object.Equals(object?), object.Equals(object?, object?), object.GetHashCode(), object.GetType(), object.ReferenceEquals(object?, object?), object.ToString()

AgenticEngineBuilderExtensions.AddAgentics(EngineBuilder, Action<AgenticRuntimeOptions>?), AuditEngineBuilderExtensions.AddAudit(EngineBuilder, Action<AuditRuntimeOptions>?), BehaviorEventingEngineBuilderExtensions.AddBehaviorEventingBridge(EngineBuilder), BehaviorEngineBuilderExtensions.AddBehaviors(EngineBuilder, Action<IBehaviorCollectionBuilder>?), BehaviorEngineBuilderExtensions.AddBehaviors(EngineBuilder, Action<BehaviorOptions>?, Action<IBehaviorCollectionBuilder>?), ClickHouseDataEngineBuilderExtensions.AddClickHouseData(EngineBuilder, string, string, Action<ClickHouseDataOptions>?), DataEngineBuilderExtensions.AddData(EngineBuilder, Action<DataRuntimeOptions>?), DebeziumDataEngineBuilderExtensions.AddDebeziumData(EngineBuilder, Action<DebeziumDataOptions>), EdgeEngineBuilderExtensions.AddEdge(EngineBuilder, Action<EdgeRuntimeOptions>?), ElasticsearchDataEngineBuilderExtensions.AddElasticsearchData(EngineBuilder, string, Action<ElasticsearchDataOptions>?), ElasticsearchDataEngineBuilderExtensions.AddElasticsearchData(EngineBuilder, Action<ElasticsearchDataOptions>), EntityFrameworkAuditHistoryEngineBuilderExtensions.AddEntityFrameworkAuditHistory<TDbContext>(EngineBuilder, Action<DbContextOptionsBuilder>, Action<EntityFrameworkAuditHistoryOptions>?), EntityFrameworkAuditHistoryEngineBuilderExtensions.AddEntityFrameworkAuditHistory<TDbContext>(EngineBuilder, Action<EntityFrameworkDatabaseRoleContext, DbContextOptionsBuilder>, Action<EntityFrameworkAuditHistoryOptions>?), EntityFrameworkDataEngineBuilderExtensions.AddEntityFrameworkData<TDbContext>(EngineBuilder, Action<DbContextOptionsBuilder>, Action<EntityFrameworkDataOptions>?), EntityFrameworkDataEngineBuilderExtensions.AddEntityFrameworkData<TDbContext>(EngineBuilder, Action<EntityFrameworkDatabaseRoleContext, DbContextOptionsBuilder>, Action<EntityFrameworkDataOptions>?), EntityFrameworkDataEngineBuilderExtensions.AddEntityFrameworkData<TReadDbContext, TWriteDbContext>(EngineBuilder, Action<DbContextOptionsBuilder>, Action<DbContextOptionsBuilder>, Action<EntityFrameworkDataOptions>?), EntityFrameworkDataEngineBuilderExtensions.AddEntityFrameworkData<TReadDbContext, TWriteDbContext>(EngineBuilder, Action<EntityFrameworkDatabaseRoleContext, DbContextOptionsBuilder>, Action<EntityFrameworkDataOptions>?), EntityFrameworkEventSourcingEngineBuilderExtensions.AddEntityFrameworkEventSourcing<TContext>(EngineBuilder), EventSourcingEngineBuilderExtensions.AddEventSourcing(EngineBuilder, Action<EventSourcingOptions>?), EventingEngineBuilderExtensions.AddEventing(EngineBuilder, Action<EventingOptions>?), IdentityEngineBuilderExtensions.AddIdentityAccess(EngineBuilder, Action<IdentityRuntimeOptions>?), KubernetesGatewayEngineBuilderExtensions.AddKubernetesGatewayTrafficMaterializer(EngineBuilder, Action<KubernetesGatewayTrafficMaterializerOptions>?), MongoDbDataEngineBuilderExtensions.AddMongoDbData(EngineBuilder, string, string, Action<MongoDbDataOptions>?), MongoDbDataEngineBuilderExtensions.AddMongoDbData(EngineBuilder, Action<MongoDbDataOptions>), MultiTenancyEngineBuilderExtensions.AddMultiTenancy(EngineBuilder, Action<MultiTenancyRuntimeOptions>?), MultiTenancyGovernanceEngineBuilderExtensions.AddMultiTenancyGovernance(EngineBuilder, Action<MultiTenancyGovernanceOptions>?), NatsDataEngineBuilderExtensions.AddNatsData(EngineBuilder, string, Action<NatsDataOptions>?), NatsDataEngineBuilderExtensions.AddNatsData(EngineBuilder, Action<NatsDataOptions>), Neo4jDataEngineBuilderExtensions.AddNeo4jData(EngineBuilder, string, string, string, Action<Neo4jDataOptions>?), Neo4jDataEngineBuilderExtensions.AddNeo4jData(EngineBuilder, Action<Neo4jDataOptions>), OpenSearchDataEngineBuilderExtensions.AddOpenSearchData(EngineBuilder, string, Action<OpenSearchDataOptions>?), OpenSearchDataEngineBuilderExtensions.AddOpenSearchData(EngineBuilder, Action<OpenSearchDataOptions>), PostgresDataEngineBuilderExtensions.AddPostgresData(EngineBuilder, string, string, Action<PostgresDataOptions>?), PostgresDataEngineBuilderExtensions.AddPostgresData(EngineBuilder, Action<PostgresDataOptions>), QdrantDataEngineBuilderExtensions.AddQdrantData(EngineBuilder, string, int, Action<QdrantDataOptions>?), RedisDataEngineBuilderExtensions.AddRedisData(EngineBuilder, string, Action<RedisDataOptions>?), RedisDataEngineBuilderExtensions.AddRedisData(EngineBuilder, Action<RedisDataOptions>), RetrievalEngineBuilderExtensions.AddRetrieval(EngineBuilder, Action<RetrievalOptions>?), SfidEngineBuilderExtensions.AddSfidIds(EngineBuilder, Action<SfidIdOptions>?), TraefikEngineBuilderExtensions.AddTraefikTrafficMaterializer(EngineBuilder, Action<TraefikTrafficMaterializerOptions>?), WolverineEventingEngineBuilderExtensions.AddWolverineEventing(EngineBuilder, Action<WolverineEventingOptions>?)

is the main code-first entry point for configuring Cephalon. It can be driven from configuration, composed in code, or use both approaches together.

At build time the builder resolves discovery inputs, package loading, application profile selection, localization, trust policy, failure policy, and capability filtering into a deterministic runtime snapshot.

Creates a new builder over the supplied service collection.

public EngineBuilder(IServiceCollection services)

services IServiceCollection

The service collection that receives runtime services, catalogs, policies, and module- or technology-provided registrations.

Gets the service collection that the builder mutates while composing the engine.

public IServiceCollection Services { get; }

IServiceCollection

AddBackendForFrontendClientBinding(BackendForFrontendClientBindingDescriptor)

Section titled “ AddBackendForFrontendClientBinding(BackendForFrontendClientBindingDescriptor)”

Adds a backend-for-frontend client binding to the current runtime composition.

public EngineBuilder AddBackendForFrontendClientBinding(BackendForFrontendClientBindingDescriptor binding)

binding BackendForFrontendClientBindingDescriptor

The client binding descriptor to add.

EngineBuilder

The same builder instance.

AddBackendForFrontendClientBindings(IEnumerable<BackendForFrontendClientBindingDescriptor>)

Section titled “ AddBackendForFrontendClientBindings(IEnumerable<BackendForFrontendClientBindingDescriptor>)”

Adds multiple backend-for-frontend client bindings to the current runtime composition.

public EngineBuilder AddBackendForFrontendClientBindings(IEnumerable<BackendForFrontendClientBindingDescriptor> bindings)

bindings IEnumerable<BackendForFrontendClientBindingDescriptor>

The client binding descriptors to add.

EngineBuilder

The same builder instance.

Adds a CDC capture to the current runtime composition.

public EngineBuilder AddCdcCapture(CdcCaptureDescriptor cdcCapture)

cdcCapture CdcCaptureDescriptor

The CDC capture descriptor to add.

EngineBuilder

The same builder instance.

AddCdcCaptures(IEnumerable<CdcCaptureDescriptor>)

Section titled “ AddCdcCaptures(IEnumerable<CdcCaptureDescriptor>)”

Adds multiple CDC captures to the current runtime composition.

public EngineBuilder AddCdcCaptures(IEnumerable<CdcCaptureDescriptor> cdcCaptures)

cdcCaptures IEnumerable<CdcCaptureDescriptor>

The CDC capture descriptors to add.

EngineBuilder

The same builder instance.

AddCellBoundaries(IEnumerable<CellBoundaryDescriptor>)

Section titled “ AddCellBoundaries(IEnumerable<CellBoundaryDescriptor>)”

Adds multiple cell boundaries to the current runtime composition.

public EngineBuilder AddCellBoundaries(IEnumerable<CellBoundaryDescriptor> cellBoundaries)

cellBoundaries IEnumerable<CellBoundaryDescriptor>

The cell-boundary descriptors to add.

EngineBuilder

The same builder instance.

Adds a cell boundary to the current runtime composition.

public EngineBuilder AddCellBoundary(CellBoundaryDescriptor cellBoundary)

cellBoundary CellBoundaryDescriptor

The cell-boundary descriptor to add.

EngineBuilder

The same builder instance.

AddCellHealthIsolation(CellHealthIsolationDescriptor)

Section titled “ AddCellHealthIsolation(CellHealthIsolationDescriptor)”

Adds a cell health-isolation answer to the current runtime composition.

public EngineBuilder AddCellHealthIsolation(CellHealthIsolationDescriptor healthIsolation)

healthIsolation CellHealthIsolationDescriptor

The cell health-isolation descriptor to add.

EngineBuilder

The same builder instance.

AddCellHealthIsolations(IEnumerable<CellHealthIsolationDescriptor>)

Section titled “ AddCellHealthIsolations(IEnumerable<CellHealthIsolationDescriptor>)”

Adds multiple cell health-isolation answers to the current runtime composition.

public EngineBuilder AddCellHealthIsolations(IEnumerable<CellHealthIsolationDescriptor> healthIsolations)

healthIsolations IEnumerable<CellHealthIsolationDescriptor>

The cell health-isolation descriptors to add.

EngineBuilder

The same builder instance.

Adds a cell route to the current runtime composition.

public EngineBuilder AddCellRoute(CellRouteDescriptor cellRoute)

cellRoute CellRouteDescriptor

The cell-route descriptor to add.

EngineBuilder

The same builder instance.

AddCellRoutes(IEnumerable<CellRouteDescriptor>)

Section titled “ AddCellRoutes(IEnumerable<CellRouteDescriptor>)”

Adds multiple cell routes to the current runtime composition.

public EngineBuilder AddCellRoutes(IEnumerable<CellRouteDescriptor> cellRoutes)

cellRoutes IEnumerable<CellRouteDescriptor>

The cell-route descriptors to add.

EngineBuilder

The same builder instance.

Adds a feature flag to the current runtime composition.

public EngineBuilder AddFeatureFlag(FeatureFlagDescriptor featureFlag)

featureFlag FeatureFlagDescriptor

The feature-flag descriptor to add.

EngineBuilder

The same builder instance.

Registers one feature-flag provider in the engine service collection.

public EngineBuilder AddFeatureFlagProvider<TProvider>() where TProvider : class, IFeatureFlagProvider

EngineBuilder

The same builder instance.

TProvider

The provider implementation type.

AddFeatureFlagProvider(IFeatureFlagProvider)

Section titled “ AddFeatureFlagProvider(IFeatureFlagProvider)”

Registers one feature-flag provider instance in the engine service collection.

public EngineBuilder AddFeatureFlagProvider(IFeatureFlagProvider provider)

provider IFeatureFlagProvider

The provider instance to register.

EngineBuilder

The same builder instance.

AddFeatureFlagProviders(IEnumerable<IFeatureFlagProvider>)

Section titled “ AddFeatureFlagProviders(IEnumerable<IFeatureFlagProvider>)”

Registers multiple feature-flag provider instances in the engine service collection.

public EngineBuilder AddFeatureFlagProviders(IEnumerable<IFeatureFlagProvider> providers)

providers IEnumerable<IFeatureFlagProvider>

The provider instances to register.

EngineBuilder

The same builder instance.

AddFeatureFlags(IEnumerable<FeatureFlagDescriptor>)

Section titled “ AddFeatureFlags(IEnumerable<FeatureFlagDescriptor>)”

Adds multiple feature flags to the current runtime composition.

public EngineBuilder AddFeatureFlags(IEnumerable<FeatureFlagDescriptor> featureFlags)

featureFlags IEnumerable<FeatureFlagDescriptor>

The feature-flag descriptors to add.

EngineBuilder

The same builder instance.

AddLanguageResources(string, IReadOnlyDictionary<string, string>)

Section titled “ AddLanguageResources(string, IReadOnlyDictionary<string, string>)”

Adds resource overrides for a specific culture without replacing the existing localization contract.

public EngineBuilder AddLanguageResources(string culture, IReadOnlyDictionary<string, string> resources)

culture string

The culture name to extend, such as en or th-TH.

resources IReadOnlyDictionary<string, string>

The key/value resource set to merge for that culture.

EngineBuilder

The same builder instance.

This method is typically used by hosts that want to layer project-owned localization on top of engine defaults and any package-provided language packs.

Adds a module by type using its parameterless constructor.

public EngineBuilder AddModule<TModule>() where TModule : class, IModule, new()

EngineBuilder

The same builder instance.

TModule

The concrete module type to instantiate and register.

Adds a concrete module instance to the runtime composition graph.

public EngineBuilder AddModule(IModule module)

module IModule

The module instance to register.

EngineBuilder

The same builder instance.

AddModulesFromAssemblies(IEnumerable<Assembly>, Func<Type, bool>?)

Section titled “ AddModulesFromAssemblies(IEnumerable<Assembly>, Func<Type, bool>?)”

Discovers and adds modules from a sequence of assemblies.

public EngineBuilder AddModulesFromAssemblies(IEnumerable<Assembly> assemblies, Func<Type, bool>? filter = null)

assemblies IEnumerable<Assembly>

The assemblies to scan for modules.

filter Func<Type, bool>?

An optional predicate that can opt specific candidate types in or out before they are instantiated.

EngineBuilder

The same builder instance.

AddModulesFromAssembly(Assembly, Func<Type, bool>?)

Section titled “ AddModulesFromAssembly(Assembly, Func<Type, bool>?)”

Discovers and adds modules from an assembly.

public EngineBuilder AddModulesFromAssembly(Assembly assembly, Func<Type, bool>? filter = null)

assembly Assembly

The assembly to scan.

filter Func<Type, bool>?

An optional predicate that can opt specific candidate types in or out before they are instantiated.

EngineBuilder

The same builder instance.

AddModulesFromAssemblyContaining<TMarker>(Func<Type, bool>?)

Section titled “ AddModulesFromAssemblyContaining<TMarker>(Func<Type, bool>?)”

Discovers and adds modules from the assembly that contains TMarker.

public EngineBuilder AddModulesFromAssemblyContaining<TMarker>(Func<Type, bool>? filter = null)

filter Func<Type, bool>?

An optional predicate that can opt specific candidate types in or out before they are instantiated.

EngineBuilder

The same builder instance.

TMarker

A type used only to identify the source assembly.

Adds an explicit package reference to the builder.

public EngineBuilder AddPackage(ModulePackageReference package)

package ModulePackageReference

The package reference to register.

EngineBuilder

The same builder instance.

Adds a package reference that points directly to a module assembly.

public EngineBuilder AddPackageAssembly(string path, string? id = null)

path string

The path to the package assembly.

id string?

An optional stable package identifier. When omitted, the identifier is derived from the reference.

EngineBuilder

The same builder instance.

AddPackageDirectories(IEnumerable<ModulePackageDirectory>)

Section titled “ AddPackageDirectories(IEnumerable<ModulePackageDirectory>)”

Adds multiple package-directory discovery rules.

public EngineBuilder AddPackageDirectories(IEnumerable<ModulePackageDirectory> directories)

directories IEnumerable<ModulePackageDirectory>

The package directories to register.

EngineBuilder

The same builder instance.

AddPackageDirectory(string, string?, bool)

Section titled “ AddPackageDirectory(string, string?, bool)”

Adds a directory that should be scanned for package manifests.

public EngineBuilder AddPackageDirectory(string path, string? manifestFileName = null, bool includeSubdirectories = true)

path string

The directory path to scan.

manifestFileName string?

The manifest file name to search for. When omitted, the engine uses the default package manifest name.

includeSubdirectories bool

true to recurse into child directories; otherwise only the top-level directory is scanned.

EngineBuilder

The same builder instance.

AddPackageDirectory(ModulePackageDirectory)

Section titled “ AddPackageDirectory(ModulePackageDirectory)”

Adds a package-directory discovery rule to the builder.

public EngineBuilder AddPackageDirectory(ModulePackageDirectory directory)

directory ModulePackageDirectory

The directory discovery descriptor to register.

EngineBuilder

The same builder instance.

Adds a package by its cephalon.package.json manifest file.

public EngineBuilder AddPackageManifest(string manifestPath, string? id = null)

manifestPath string

The path to the package manifest file.

id string?

An optional stable package identifier. When omitted, the identifier is resolved from the manifest.

EngineBuilder

The same builder instance.

AddPackages(IEnumerable<ModulePackageReference>)

Section titled “ AddPackages(IEnumerable<ModulePackageReference>)”

Adds multiple explicit package references.

public EngineBuilder AddPackages(IEnumerable<ModulePackageReference> packages)

packages IEnumerable<ModulePackageReference>

The package references to register.

EngineBuilder

The same builder instance.

Adds an application or design pattern to the current app profile.

public EngineBuilder AddPattern(PatternDescriptor pattern)

pattern PatternDescriptor

The pattern descriptor to add.

EngineBuilder

The same builder instance.

AddStranglerFigRoute(StranglerFigRouteDescriptor)

Section titled “ AddStranglerFigRoute(StranglerFigRouteDescriptor)”

Adds a strangler-fig route to the current runtime composition.

public EngineBuilder AddStranglerFigRoute(StranglerFigRouteDescriptor route)

route StranglerFigRouteDescriptor

The route descriptor to add.

EngineBuilder

The same builder instance.

AddStranglerFigRoutes(IEnumerable<StranglerFigRouteDescriptor>)

Section titled “ AddStranglerFigRoutes(IEnumerable<StranglerFigRouteDescriptor>)”

Adds multiple strangler-fig routes to the current runtime composition.

public EngineBuilder AddStranglerFigRoutes(IEnumerable<StranglerFigRouteDescriptor> routes)

routes IEnumerable<StranglerFigRouteDescriptor>

The route descriptors to add.

EngineBuilder

The same builder instance.

Selects a technology profile for the current app profile.

public EngineBuilder AddTechnology(TechnologyDescriptor technology)

technology TechnologyDescriptor

The technology descriptor to activate.

EngineBuilder

The same builder instance.

Adds a transport to the current app profile selection.

public EngineBuilder AddTransport(TransportDescriptor transport)

transport TransportDescriptor

The transport descriptor to add.

EngineBuilder

The same builder instance.

Materializes the configured engine into a runnable .

public EngineRuntime Build()

EngineRuntime

The fully built runtime.

Build is the point where Cephalon becomes deterministic. The builder validates duplicate modules, resolves package-loaded assemblies, orders modules by dependency, applies capability and trust policy, creates the runtime manifest, and registers the runtime-facing catalogs used by hosts and tooling.

InvalidOperationException

Thrown when the configured module graph, package inputs, trust policy, transport selection, or technology selection is invalid.

Registers a technology descriptor in the available catalog without implicitly selecting it.

public EngineBuilder RegisterTechnology(TechnologyDescriptor technology)

technology TechnologyDescriptor

The technology descriptor to register.

EngineBuilder

The same builder instance.

This is useful when a project wants to extend the catalog and let configuration decide whether the technology is active.

UseBackendForFrontendSettings(BackendForFrontendSettings)

Section titled “ UseBackendForFrontendSettings(BackendForFrontendSettings)”

Replaces the backend-for-frontend settings used by the runtime client-binding catalog.

public EngineBuilder UseBackendForFrontendSettings(BackendForFrontendSettings settings)

settings BackendForFrontendSettings

The backend-for-frontend settings to apply.

EngineBuilder

The same builder instance.

Selects the base application blueprint that should shape the runtime.

public EngineBuilder UseBlueprint(AppBlueprint blueprint)

blueprint AppBlueprint

The blueprint descriptor to activate.

EngineBuilder

The same builder instance.

Replaces the cell-based architecture settings used by the runtime cell catalogs.

public EngineBuilder UseCellSettings(CellSettings settings)

settings CellSettings

The cell settings to apply.

EngineBuilder

The same builder instance.

Reads engine settings from configuration and merges them into the current builder state.

public EngineBuilder UseConfiguration(IConfiguration configuration, string sectionPath = "Engine")

configuration IConfiguration

The root configuration that contains the engine section.

sectionPath string

The configuration path that should be interpreted as the engine settings section. The default value is .

EngineBuilder

The same builder instance.

This method is the preferred entry point when a host should stay configuration-driven. It binds the selected blueprint, transports, technologies, options, localization, trust policy, failure policy, and discovery settings before any code-level overrides are applied.

Replaces the failure policy used by the runtime lifecycle state machine.

public EngineBuilder UseFailurePolicy(FailurePolicy policy)

policy FailurePolicy

The lifecycle failure policy to apply.

EngineBuilder

The same builder instance.

Merges feature-flag settings into the current builder state.

public EngineBuilder UseFeatureSettings(FeatureSettings settings)

settings FeatureSettings

The feature-flag settings to merge.

EngineBuilder

The same builder instance.

Merges localization settings into the current builder state.

public EngineBuilder UseLocalization(LocalizationSettings settings)

settings LocalizationSettings

The localization settings to merge, including default culture, supported cultures, and per-culture resource overrides.

EngineBuilder

The same builder instance.

Replaces the migration-policy settings used by the runtime migration catalogs.

public EngineBuilder UseMigrationSettings(MigrationSettings migration)

migration MigrationSettings

The migration settings to apply.

EngineBuilder

The same builder instance.

Merges engine option overrides such as module enablement and capability toggles.

public EngineBuilder UseOptions(EngineOptions options)

options EngineOptions

The option overrides to merge.

EngineBuilder

The same builder instance.

Replaces the package-governance policy used when loading independently shipped module packages.

public EngineBuilder UsePackagePolicy(PackagePolicy policy)

policy PackagePolicy

The package policy to apply.

EngineBuilder

The same builder instance.

Applies a preconstructed instance to the builder.

public EngineBuilder UseSettings(EngineSettings settings)

settings EngineSettings

The settings object to merge into the current builder state.

EngineBuilder

The same builder instance.

Discovery settings are resolved eagerly, which means referenced assemblies or package manifests are validated before the runtime is built.

Merges trust and capability-governance settings into the builder.

public EngineBuilder UseTrustPolicy(TrustPolicy policy)

policy TrustPolicy

The trust policy to apply.

EngineBuilder

The same builder instance.