Interface ICommandRegistry
Allows command handlers to be registered
Namespace: AzureFromTheTrenches.Commanding.Abstractions
Assembly: AzureFromTheTrenches.Commanding.Abstractions.dll
Syntax
public interface ICommandRegistry
Methods
| Improve this Doc View SourceDiscover(Assembly[])
Will search the specified assembly for command handlers and register them
Declaration
ICommandRegistry Discover(params Assembly[] assemblies)
Parameters
Type | Name | Description |
---|---|---|
Assembly[] | assemblies | The assemblies to search |
Returns
Type | Description |
---|---|
ICommandRegistry | The command registry for use in a fluent call style |
Discover<TTypeInAssembly>()
Will search the assemly that TTypeInAssembly belongs in for command handlers and register them
Declaration
ICommandRegistry Discover<TTypeInAssembly>()
Returns
Type | Description |
---|---|
ICommandRegistry | The command registery for use in a fluent call style |
Type Parameters
Name | Description |
---|---|
TTypeInAssembly |
GetCommandDispatcherFactory(ICommand)
Gets the command dispatcher for the command
Declaration
Func<ICommandDispatcher> GetCommandDispatcherFactory(ICommand command)
Parameters
Type | Name | Description |
---|---|---|
ICommand | command |
Returns
Type | Description |
---|---|
Func<ICommandDispatcher> | A function able to create a command dispatcher if one is registered, null if none is |
GetPrioritisedCommandHandlers(ICommand)
Returns the prioritised set of command actors (first to execute is first in the collection)
Declaration
IReadOnlyCollection<IPrioritisedCommandHandler> GetPrioritisedCommandHandlers(ICommand command)
Parameters
Type | Name | Description |
---|---|---|
ICommand | command |
Returns
Type | Description |
---|---|
IReadOnlyCollection<IPrioritisedCommandHandler> | Set of command actors |
Register(Type, Int32, Func<ICommandDispatcher>)
Register an handler against a command with no expected result
Declaration
ICommandRegistry Register(Type commandHandlerType, int order = null, Func<ICommandDispatcher> dispatcherFactoryFunc = null)
Parameters
Type | Name | Description |
---|---|---|
Type | commandHandlerType | The type of the command handler |
System.Int32 | order | Execution order of the handler |
Func<ICommandDispatcher> | dispatcherFactoryFunc | Optional command dispatcher factory function |
Returns
Type | Description |
---|---|
ICommandRegistry |
Register<TCommand>(Func<ICommandDispatcher>)
Register a command with a dispatcher but no handler. Typically this is used when the command actors are known to be deferred via a queue or that are remotely executed
Declaration
ICommandRegistry Register<TCommand>(Func<ICommandDispatcher> dispatcherFactoryFunc)
where TCommand : ICommand
Parameters
Type | Name | Description |
---|---|---|
Func<ICommandDispatcher> | dispatcherFactoryFunc | Command dispatcher factory function |
Returns
Type | Description |
---|---|
ICommandRegistry |
Type Parameters
Name | Description |
---|---|
TCommand | The type of the command |
Register<TCommandHandler>(Int32, Func<ICommandDispatcher>)
Register an handler against a command with no expected result
Declaration
ICommandRegistry Register<TCommandHandler>(int order = null, Func<ICommandDispatcher> dispatcherFactoryFunc = null)
where TCommandHandler : ICommandHandlerBase
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | order | Execution order of the handler |
Func<ICommandDispatcher> | dispatcherFactoryFunc | Optional command dispatcher factory function |
Returns
Type | Description |
---|---|
ICommandRegistry |
Type Parameters
Name | Description |
---|---|
TCommandHandler | The type of the command handler |
Register<TCommand, TResult>(Func<ICommandDispatcher>)
Register a command with a dispatcher but no handler. Typically this is used when the command actors are known to be deferred via a queue or that are remotely executed
Declaration
ICommandRegistry Register<TCommand, TResult>(Func<ICommandDispatcher> dispatcherFactoryFunc)
where TCommand : ICommand<TResult>
Parameters
Type | Name | Description |
---|---|---|
Func<ICommandDispatcher> | dispatcherFactoryFunc | Command dispatcher factory function |
Returns
Type | Description |
---|---|
ICommandRegistry |
Type Parameters
Name | Description |
---|---|
TCommand | The type of the command |
TResult | The type of the result |
Remove<TCommandHandler>()
Removes the registered command handler
Declaration
ICommandRegistry Remove<TCommandHandler>()
where TCommandHandler : ICommandHandler
Returns
Type | Description |
---|---|
ICommandRegistry | The command registry for use in a fluent call style |
Type Parameters
Name | Description |
---|---|
TCommandHandler | The type of the command handler |
RemoveDispatcher<TCommand>()
Removes any assigned dispatcher from a command
Declaration
ICommandRegistry RemoveDispatcher<TCommand>()
where TCommand : ICommand
Returns
Type | Description |
---|---|
ICommandRegistry | The command registry for use in a fluent call style |
Type Parameters
Name | Description |
---|---|
TCommand | The type of the command |
RemoveHandlers<TCommand>()
Removes all handlers for the registered command
Declaration
ICommandRegistry RemoveHandlers<TCommand>()
where TCommand : ICommand
Returns
Type | Description |
---|---|
ICommandRegistry | The command registry for use in a fluent call style |
Type Parameters
Name | Description |
---|---|
TCommand | The type of the command |