Class BusRegistrar
Triggers the IEventHandlerRegistrar and ICommandHandlerRegistrar if they are registered in the IDependencyResolver.
Inheritance
Inherited Members
Namespace: Cqrs.Configuration
Assembly: Cqrs.dll
Syntax
public class BusRegistrar
Constructors
BusRegistrar(IDependencyResolver)
Instantiates a new instance of BusRegistrar.
Declaration
public BusRegistrar(IDependencyResolver dependencyResolver)
Parameters
Type | Name | Description |
---|---|---|
IDependencyResolver | dependencyResolver |
Properties
DependencyResolver
Gets or set the IDependencyResolver.
Declaration
protected IDependencyResolver DependencyResolver { get; }
Property Value
Type | Description |
---|---|
IDependencyResolver |
GetCommandHandlerRegistrar
A System.Func<T1, T2, TResult> to use in-place of ICommandHandlerRegistrar
Declaration
public static Func<Type, Type, IHandlerRegistrar> GetCommandHandlerRegistrar { get; set; }
Property Value
Type | Description |
---|---|
System.Func<System.Type, System.Type, IHandlerRegistrar> |
GetEventHandlerRegistrar
A System.Func<T1, T2, TResult> to use in-place of IEventHandlerRegistrar
Declaration
public static Func<Type, Type, IHandlerRegistrar> GetEventHandlerRegistrar { get; set; }
Property Value
Type | Description |
---|---|
System.Func<System.Type, System.Type, IHandlerRegistrar> |
Methods
BuildDelegateAction(Type, Func<Type, IEnumerable<Type>>)
Builds a HandlerDelegate that will resolve the provided executorType
and invoke the Handle method, when executed.
Declaration
protected virtual HandlerDelegate BuildDelegateAction(Type executorType, Func<Type, IEnumerable<Type>> resolveMessageHandlerInterface)
Parameters
Type | Name | Description |
---|---|---|
System.Type | executorType | The type of IHandler to resolve.> |
System.Func<System.Type, System.Collections.Generic.IEnumerable<System.Type>> | resolveMessageHandlerInterface | Not used. |
Returns
Type | Description |
---|---|
HandlerDelegate |
BuildExecutorMethod(MethodInfo, Type, Type)
Builds a method replacing the generic type with commandType
.
Declaration
protected virtual MethodInfo BuildExecutorMethod(MethodInfo originalRegisterExecutorMethod, Type executorType, Type commandType)
Parameters
Type | Name | Description |
---|---|---|
System.Reflection.MethodInfo | originalRegisterExecutorMethod | |
System.Type | executorType | |
System.Type | commandType |
Returns
Type | Description |
---|---|
System.Reflection.MethodInfo |
InvokeHandler(Type, Boolean, Func<Type, IEnumerable<Type>>, Type)
Extract the RegisterHandler<TMessage>(Action<TMessage>, Type, Boolean) method of GetEventHandlerRegistrar or GetCommandHandlerRegistrar.
Create an System.Action around the provided executorType
Then register the created System.Action using the extracted RegisterHandler<TMessage>(Action<TMessage>, Type, Boolean) method
Declaration
protected virtual void InvokeHandler(Type interface, bool trueForEventsFalseForCommands, Func<Type, IEnumerable<Type>> resolveMessageHandlerInterface, Type executorType)
Parameters
Type | Name | Description |
---|---|---|
System.Type | interface | The System.Type of IHandler |
System.Boolean | trueForEventsFalseForCommands | Indicates if this is registers IEventHandler or ICommandHandler<TAuthenticationToken, TCommand>. |
System.Func<System.Type, System.Collections.Generic.IEnumerable<System.Type>> | resolveMessageHandlerInterface | ResolveEventHandlerInterface(Type) or ResolveCommandHandlerInterface(Type) |
System.Type | executorType | The System.Type of the event handler that will do the handling |
InvokeHandlerDelegate(MethodInfo, Boolean, HandlerDelegate)
Invokes handlerDelegate
, fetching the corresponding "HoldMessageLock" configuration setting
Declaration
protected virtual void InvokeHandlerDelegate(MethodInfo registerExecutorMethod, bool trueForEventsFalseForCommands, HandlerDelegate handlerDelegate)
Parameters
Type | Name | Description |
---|---|---|
System.Reflection.MethodInfo | registerExecutorMethod | The System.Reflection.MethodInfo to use to invoke |
System.Boolean | trueForEventsFalseForCommands | Indicates if this is registers IEventHandler or ICommandHandler<TAuthenticationToken, TCommand>. |
HandlerDelegate | handlerDelegate | The actual HandlerDelegate that gets executed. |
Register(Boolean, Func<Type, IEnumerable<Type>>, Boolean, Type[])
Registers all IHandler instances found in the System.Reflection.Assembly for each System.Type in typesFromAssemblyContainingMessages
.
Declaration
public virtual void Register(bool trueForEventsFalseForCommands, Func<Type, IEnumerable<Type>> resolveMessageHandlerInterface, bool skipCommandHandlers, params Type[] typesFromAssemblyContainingMessages)
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | trueForEventsFalseForCommands | Indicates if this is registers IEventHandler or ICommandHandler<TAuthenticationToken, TCommand>. |
System.Func<System.Type, System.Collections.Generic.IEnumerable<System.Type>> | resolveMessageHandlerInterface | ResolveEventHandlerInterface(Type) or ResolveCommandHandlerInterface(Type) |
System.Boolean | skipCommandHandlers | Indicates if registering of ICommandHandler<TAuthenticationToken, TCommand> is enabled. |
System.Type[] | typesFromAssemblyContainingMessages | A collection of System.Type to track back to their containing System.Reflection.Assembly and scan. |
Register(Type[])
Registers all IEventHandler and ICommandHandler<TAuthenticationToken, TCommand> instances found in the System.Reflection.Assembly for each System.Type in typesFromAssemblyContainingMessages
.
Declaration
public virtual void Register(params Type[] typesFromAssemblyContainingMessages)
Parameters
Type | Name | Description |
---|---|---|
System.Type[] | typesFromAssemblyContainingMessages | A collection of System.Type to track back to their containing System.Reflection.Assembly and scan. |
ResolveCommandHandlerInterface(Type)
Finds all System.Type that implement ICommandHandler<TAuthenticationToken, TCommand> that are implemented by type
.
Declaration
protected virtual IEnumerable<Type> ResolveCommandHandlerInterface(Type type)
Parameters
Type | Name | Description |
---|---|---|
System.Type | type | The System.Type to find all ICommandHandler<TAuthenticationToken, TCommand> of. |
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<System.Type> |
ResolveEventHandlerInterface(Type)
Finds all System.Type that implement IEventHandler<TAuthenticationToken, TEvent> that are implemented by type
.
Declaration
protected virtual IEnumerable<Type> ResolveEventHandlerInterface(Type type)
Parameters
Type | Name | Description |
---|---|---|
System.Type | type | The System.Type to find all IEventHandler<TAuthenticationToken, TEvent> of. |
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<System.Type> |