Class BehaviorDispatcher
เนื้อหานี้ยังไม่ได้แปลเป็นภาษาไทย แสดงเป็นภาษาอังกฤษแทน
Namespace: Cephalon.Behaviors.Services
Assembly: Cephalon.Behaviors.dll
Resolves behavior instances from the service provider and dispatches calls
to the appropriate
public sealed class BehaviorDispatcherInheritance
Section titled “Inheritance”Inherited Members
Section titled “Inherited Members”object.Equals(object?), object.Equals(object?, object?), object.GetHashCode(), object.GetType(), object.ReferenceEquals(object?, object?), object.ToString()
Constructors
Section titled “Constructors”BehaviorDispatcher(IBehaviorCatalog, IBehaviorTypeRegistry, IServiceProvider)
Section titled “ BehaviorDispatcher(IBehaviorCatalog, IBehaviorTypeRegistry, IServiceProvider)”Initializes the dispatcher by building its frozen dispatch table from the catalog and type registry. Only behaviors that appear in both the catalog and the type registry are dispatchable.
public BehaviorDispatcher(IBehaviorCatalog catalog, IBehaviorTypeRegistry typeRegistry, IServiceProvider services)Parameters
Section titled “Parameters”catalog IBehaviorCatalog
The behavior catalog that exposes topology descriptors.
typeRegistry IBehaviorTypeRegistry
The registry that maps behavior identifiers to concrete types.
services IServiceProvider
The service provider used to resolve behavior instances at dispatch time.
Methods
Section titled “Methods”DispatchAsync(string, object, IBehaviorContext, CancellationToken)
Section titled “ DispatchAsync(string, object, IBehaviorContext, CancellationToken)”Dispatches a call to the behavior identified by behaviorId.
The behavior instance is resolved from the service provider on every call.
public Task<object?> DispatchAsync(string behaviorId, object input, IBehaviorContext context, CancellationToken ct = default)Parameters
Section titled “Parameters”behaviorId string
The stable identifier of the behavior to invoke.
input object
The input message object.
context IBehaviorContext
The behavior execution context.
A token that cancels the dispatch.
Returns
Section titled “Returns”A task that resolves to the behavior output, boxed as
Exceptions
Section titled “Exceptions”BehaviorNotFoundException
Thrown when behaviorId is not present in the dispatch table.