Class RouteManager
Manages Route.
Inheritance
Inherited Members
Namespace: Cqrs.Bus
Assembly: Cqrs.dll
Syntax
public class RouteManager : IHandlerRegistrar
Constructors
RouteManager()
Instantiates a new instance of RouteManager.
Declaration
public RouteManager()
Properties
GlobalEventRoute
A Route to execute for all IEvent<TAuthenticationToken>
Declaration
public Route GlobalEventRoute { get; }
Property Value
Type | Description |
---|---|
Route |
Routes
The Route to execute per System.Type
Declaration
protected IDictionary<Type, Route> Routes { get; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.IDictionary<System.Type, Route> |
Methods
GetHandlers<TMessage>(TMessage, Boolean)
Gets the collection RouteHandlerDelegate that are expected for handling TMessage
.
Declaration
public IEnumerable<RouteHandlerDelegate> GetHandlers<TMessage>(TMessage message, bool throwExceptionOnNoRouteHandlers = true)where TMessage : IMessage
Parameters
Type | Name | Description |
---|---|---|
TMessage | message | The |
System.Boolean | throwExceptionOnNoRouteHandlers | If true will throw an System.Exception if no RouteHandlerDelegate found. |
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<RouteHandlerDelegate> |
Type Parameters
Name | Description |
---|---|
TMessage | The System.Type of IMessage to find a RouteHandlerDelegate for. |
Exceptions
Type | Condition |
---|---|
NoCommandHandlerRegisteredException | If no RouteHandlerDelegate is found and |
NoEventHandlerRegisteredException | If no RouteHandlerDelegate is found and |
NoHandlerRegisteredException | If no RouteHandlerDelegate is found and |
GetSingleHandler<TMessage>(TMessage, Boolean)
Gets the single RouteHandlerDelegate expected for handling TMessage
.
Declaration
public RouteHandlerDelegate GetSingleHandler<TMessage>(TMessage message, bool throwExceptionOnNoRouteHandlers = true)where TMessage : IMessage
Parameters
Type | Name | Description |
---|---|---|
TMessage | message | The |
System.Boolean | throwExceptionOnNoRouteHandlers | If true will throw an System.Exception if no RouteHandlerDelegate found. |
Returns
Type | Description |
---|---|
RouteHandlerDelegate |
Type Parameters
Name | Description |
---|---|
TMessage | The System.Type of IMessage to find a RouteHandlerDelegate for. |
Exceptions
Type | Condition |
---|---|
MultipleCommandHandlersRegisteredException | If more than one RouteHandlerDelegate is found and |
NoCommandHandlerRegisteredException | If no RouteHandlerDelegate is found and |
System.InvalidOperationException | If more than one RouteHandlerDelegate is found and |
GetSingleHandler<TMessage>(Boolean)
Gets the single RouteHandlerDelegate expected for handling TMessage
.
Declaration
public RouteHandlerDelegate GetSingleHandler<TMessage>(bool throwExceptionOnNoRouteHandlers = true)where TMessage : IMessage
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | throwExceptionOnNoRouteHandlers | If true will throw an System.Exception if no RouteHandlerDelegate found. |
Returns
Type | Description |
---|---|
RouteHandlerDelegate |
Type Parameters
Name | Description |
---|---|
TMessage | The System.Type of IMessage to find a RouteHandlerDelegate for. |
Exceptions
Type | Condition |
---|---|
MultipleCommandHandlersRegisteredException | If more than one RouteHandlerDelegate is found and |
NoCommandHandlerRegisteredException | If no RouteHandlerDelegate is found and |
System.InvalidOperationException | If more than one RouteHandlerDelegate is found and |
IsACommand(Type)
Checks if the provided messageType
implements ICommand<TAuthenticationToken>.
Declaration
protected virtual bool IsACommand(Type messageType)
Parameters
Type | Name | Description |
---|---|---|
System.Type | messageType | The System.Type of object to check. |
Returns
Type | Description |
---|---|
System.Boolean | true if |
IsACommand<TMessage>(TMessage)
Checks if the provided message
is an ICommand<TAuthenticationToken>.
Declaration
protected virtual bool IsACommand<TMessage>(TMessage message)
Parameters
Type | Name | Description |
---|---|---|
TMessage | message | The |
Returns
Type | Description |
---|---|
System.Boolean | true if |
Type Parameters
Name | Description |
---|---|
TMessage | The System.Type of IMessage to check. |
IsAnEvent(Type)
Checks if the provided messageType
implements IEvent<TAuthenticationToken>.
Declaration
protected virtual bool IsAnEvent(Type messageType)
Parameters
Type | Name | Description |
---|---|---|
System.Type | messageType | The System.Type of object to check. |
Returns
Type | Description |
---|---|
System.Boolean | true if |
IsAnEvent<TMessage>(TMessage)
Checks if the provided message
is an IEvent<TAuthenticationToken>.
Declaration
protected virtual bool IsAnEvent<TMessage>(TMessage message)
Parameters
Type | Name | Description |
---|---|---|
TMessage | message | The |
Returns
Type | Description |
---|---|
System.Boolean | true if |
Type Parameters
Name | Description |
---|---|
TMessage | The System.Type of IMessage to check. |
RegisterGlobalEventHandler<TMessage>(Action<TMessage>, Boolean)
Register an event handler that will listen and respond to all events.
Declaration
public void RegisterGlobalEventHandler<TMessage>(Action<TMessage> handler, bool holdMessageLock = true)where TMessage : IMessage
Parameters
Type | Name | Description |
---|---|---|
System.Action<TMessage> | handler | |
System.Boolean | holdMessageLock |
Type Parameters
Name | Description |
---|---|
TMessage |
RegisterHandler<TMessage>(Action<TMessage>, Boolean)
Register an event or command handler that will listen and respond to events or commands.
Declaration
public void RegisterHandler<TMessage>(Action<TMessage> handler, bool holdMessageLock = true)where TMessage : IMessage
Parameters
Type | Name | Description |
---|---|---|
System.Action<TMessage> | handler | |
System.Boolean | holdMessageLock |
Type Parameters
Name | Description |
---|---|
TMessage |
Implements
RegisterHandler<TMessage>(Action<TMessage>, Type, Boolean)
Register an event or command handler that will listen and respond to events or commands.
Declaration
public virtual void RegisterHandler<TMessage>(Action<TMessage> handler, Type targetedType, bool holdMessageLock = true)where TMessage : IMessage
Parameters
Type | Name | Description |
---|---|---|
System.Action<TMessage> | handler | |
System.Type | targetedType | |
System.Boolean | holdMessageLock |
Type Parameters
Name | Description |
---|---|
TMessage |