Class CommandingRuntime
The commanding runtime allows an instance of the commanding runtime to be registered within a IoC container.
Generally the CommandingDependencies methods should be used for this as that allows for slightly simpler registration semantics however if you want an isolated commanding runtime to be configured on a per thread basis with different options (rather than shared) this class should be used.
Inheritance
Implements
Inherited Members
Namespace: AzureFromTheTrenches.Commanding
Assembly: AzureFromTheTrenches.Commanding.dll
Syntax
public class CommandingRuntime : ICommandingRuntime
Methods
| Improve this Doc View SourceAddAuditItemEnricher<TAuditItemEnricher>(ICommandingDependencyResolverAdapter)
Adds an audit item enricher
Declaration
public ICommandingDependencyResolverAdapter AddAuditItemEnricher<TAuditItemEnricher>(ICommandingDependencyResolverAdapter commandingDependencyResolver)
where TAuditItemEnricher : IAuditItemEnricher
Parameters
| Type | Name | Description |
|---|---|---|
| ICommandingDependencyResolverAdapter | commandingDependencyResolver | The commanding dependency resolver |
Returns
| Type | Description |
|---|---|
| ICommandingDependencyResolverAdapter | The commanding dependency resolver |
Type Parameters
| Name | Description |
|---|---|
| TAuditItemEnricher | The type of the enricher |
AddCommanding(ICommandingDependencyResolverAdapter, IOptions)
Registers the commanding system in an ioc container. If the container is not able to resolve unregistered types (for example the NetStandard Microsoft container) then the commandHandlerContainerRegistration should be used to perform the type registration for the handler
Declaration
public ICommandRegistry AddCommanding(ICommandingDependencyResolverAdapter dependencyResolver, IOptions options = null)
Parameters
| Type | Name | Description |
|---|---|---|
| ICommandingDependencyResolverAdapter | dependencyResolver | The dependency resolver to register inside |
| IOptions | options | Configuration options for the commanding system |
Returns
| Type | Description |
|---|---|
| ICommandRegistry | The dependency resolver |
AddCommanding(ICommandingDependencyResolverAdapter, Action<Type>)
Registers the commanding system in an ioc container. If the container is not able to resolve unregistered types (for example the NetStandard Microsoft container) then the commandHandlerContainerRegistration should be used to perform the type registration for the handler
Declaration
public ICommandRegistry AddCommanding(ICommandingDependencyResolverAdapter dependencyResolver, Action<Type> commandHandlerContainerRegistration)
Parameters
| Type | Name | Description |
|---|---|---|
| ICommandingDependencyResolverAdapter | dependencyResolver | The dependency resolver to register inside |
| System.Action<System.Type> | commandHandlerContainerRegistration | Unless an alternative implementation of ICommandHandlerFactory is supplied then actors are created through the dependency resolver but not all IoC containers can resolve unregistered concrete types (for example the built in ASP.Net Core IServiceCollection and IServiceProvider IoC cannot). Where this is the case supply an implementation for the CommandHandlerContainerRegistration action that registers the actors in the container. For example using an IServiceCollection instance of serviceCollection: resolver.UseCommanding(type => services.AddTransient(type, type)); |
Returns
| Type | Description |
|---|---|
| ICommandRegistry | The dependency resolver |
AddExecutionCommandingAuditor<TExecutionAuditorImpl>(ICommandingDependencyResolverAdapter, Boolean)
Registers an auditor that will be invoked directly after a command has been executed.
Declaration
public ICommandingDependencyResolverAdapter AddExecutionCommandingAuditor<TExecutionAuditorImpl>(ICommandingDependencyResolverAdapter dependencyResolver, bool auditRootCommandOnly = true)
where TExecutionAuditorImpl : ICommandAuditor
Parameters
| Type | Name | Description |
|---|---|---|
| ICommandingDependencyResolverAdapter | dependencyResolver | The dependency resolver |
| System.Boolean | auditRootCommandOnly | By default the built in auditor will audit every command that is dispatched however if using the audit as part of an event sourcing pipeline it can be useful to only audit the root command and exclude any commands dispatched as a result of that root command. Set this property to true to audit only the root commands, leave null or set to false to audit all commands. |
Returns
| Type | Description |
|---|---|
| ICommandingDependencyResolverAdapter | The dependency resolver |
Type Parameters
| Name | Description |
|---|---|
| TExecutionAuditorImpl | The type of the auditor |
AddPostDispatchCommandingAuditor<TDispatchAuditorImpl>(ICommandingDependencyResolverAdapter, Boolean)
Registers an auditor that will be invoked directly after a command has been dispatched.
Declaration
public ICommandingDependencyResolverAdapter AddPostDispatchCommandingAuditor<TDispatchAuditorImpl>(ICommandingDependencyResolverAdapter dependencyResolver, bool auditRootCommandOnly = true)
where TDispatchAuditorImpl : ICommandAuditor
Parameters
| Type | Name | Description |
|---|---|---|
| ICommandingDependencyResolverAdapter | dependencyResolver | The dependency resolver |
| System.Boolean | auditRootCommandOnly | By default the built in auditor will audit every command that is dispatched however if using the audit as part of an event sourcing pipeline it can be useful to only audit the root command and exclude any commands dispatched as a result of that root command. Set this property to true to audit only the root commands, leave null or set to false to audit all commands. |
Returns
| Type | Description |
|---|---|
| ICommandingDependencyResolverAdapter | The dependency resolver |
Type Parameters
| Name | Description |
|---|---|
| TDispatchAuditorImpl | The type of the auditor |
AddPreDispatchCommandingAuditor<TDispatchAuditorImpl>(ICommandingDependencyResolverAdapter, Boolean)
Registers an auditor that will be invoked directly before a command has been dispatched.
Declaration
public ICommandingDependencyResolverAdapter AddPreDispatchCommandingAuditor<TDispatchAuditorImpl>(ICommandingDependencyResolverAdapter dependencyResolver, bool auditRootCommandOnly = true)
where TDispatchAuditorImpl : ICommandAuditor
Parameters
| Type | Name | Description |
|---|---|---|
| ICommandingDependencyResolverAdapter | dependencyResolver | The dependency resolver |
| System.Boolean | auditRootCommandOnly | By default the built in auditor will audit every command that is dispatched however if using the audit as part of an event sourcing pipeline it can be useful to only audit the root command and exclude any commands dispatched as a result of that root command. Set this property to true to audit only the root commands, leave null or set to false to audit all commands. |
Returns
| Type | Description |
|---|---|
| ICommandingDependencyResolverAdapter | The dependency resolver |
Type Parameters
| Name | Description |
|---|---|
| TDispatchAuditorImpl | The type of the auditor |
UseAuditItemEnricher<TAuditItemEnricher>(ICommandingDependencyResolver)
Adds an audit item enricher
Declaration
[Obsolete("Please use AddAuditItemEnricher instead")]
public ICommandingDependencyResolver UseAuditItemEnricher<TAuditItemEnricher>(ICommandingDependencyResolver commandingDependencyResolver)
where TAuditItemEnricher : IAuditItemEnricher
Parameters
| Type | Name | Description |
|---|---|---|
| ICommandingDependencyResolver | commandingDependencyResolver | The commanding dependency resolver |
Returns
| Type | Description |
|---|---|
| ICommandingDependencyResolver | The commanding dependency resolver |
Type Parameters
| Name | Description |
|---|---|
| TAuditItemEnricher | The type of the enricher |
UseCommanding(ICommandingDependencyResolver, IOptions)
Registers the commanding system in an ioc container. If the container is not able to resolve unregistered types (for example the NetStandard Microsoft container) then the commandHandlerContainerRegistration should be used to perform the type registration for the handler
Declaration
[Obsolete("Please use AddCommanding instead")]
public ICommandRegistry UseCommanding(ICommandingDependencyResolver dependencyResolver, IOptions options = null)
Parameters
| Type | Name | Description |
|---|---|---|
| ICommandingDependencyResolver | dependencyResolver | The dependency resolver to register inside |
| IOptions | options | Configuration options for the commanding system |
Returns
| Type | Description |
|---|---|
| ICommandRegistry | The dependency resolver |
UseCommanding(ICommandingDependencyResolver, Action<Type>)
Registers the commanding system in an ioc container. If the container is not able to resolve unregistered types (for example the NetStandard Microsoft container) then the commandHandlerContainerRegistration should be used to perform the type registration for the handler
Declaration
[Obsolete("Please use AddCommanding instead")]
public ICommandRegistry UseCommanding(ICommandingDependencyResolver dependencyResolver, Action<Type> commandHandlerContainerRegistration)
Parameters
| Type | Name | Description |
|---|---|---|
| ICommandingDependencyResolver | dependencyResolver | The dependency resolver to register inside |
| System.Action<System.Type> | commandHandlerContainerRegistration | Unless an alternative implementation of ICommandHandlerFactory is supplied then actors are created through the dependency resolver but not all IoC containers can resolve unregistered concrete types (for example the built in ASP.Net Core IServiceCollection and IServiceProvider IoC cannot). Where this is the case supply an implementation for the CommandHandlerContainerRegistration action that registers the actors in the container. For example using an IServiceCollection instance of serviceCollection: resolver.UseCommanding(type => services.AddTransient(type, type)); |
Returns
| Type | Description |
|---|---|
| ICommandRegistry | The dependency resolver |
UseExecutionCommandingAuditor<TExecutionAuditorImpl>(ICommandingDependencyResolver, Boolean)
Registers an auditor that will be invoked directly after a command has been executed.
Declaration
[Obsolete("Please use AddExecutionCommandingAuditor instead")]
public ICommandingDependencyResolver UseExecutionCommandingAuditor<TExecutionAuditorImpl>(ICommandingDependencyResolver dependencyResolver, bool auditRootCommandOnly = true)
where TExecutionAuditorImpl : ICommandAuditor
Parameters
| Type | Name | Description |
|---|---|---|
| ICommandingDependencyResolver | dependencyResolver | The dependency resolver |
| System.Boolean | auditRootCommandOnly | By default the built in auditor will audit every command that is dispatched however if using the audit as part of an event sourcing pipeline it can be useful to only audit the root command and exclude any commands dispatched as a result of that root command. Set this property to true to audit only the root commands, leave null or set to false to audit all commands. |
Returns
| Type | Description |
|---|---|
| ICommandingDependencyResolver | The dependency resolver |
Type Parameters
| Name | Description |
|---|---|
| TExecutionAuditorImpl | The type of the auditor |
UsePostDispatchCommandingAuditor<TDispatchAuditorImpl>(ICommandingDependencyResolver, Boolean)
Registers an auditor that will be invoked directly after a command has been dispatched.
Declaration
[Obsolete("Please use AddPostDispatchCommandingAuditor instead")]
public ICommandingDependencyResolver UsePostDispatchCommandingAuditor<TDispatchAuditorImpl>(ICommandingDependencyResolver dependencyResolver, bool auditRootCommandOnly = true)
where TDispatchAuditorImpl : ICommandAuditor
Parameters
| Type | Name | Description |
|---|---|---|
| ICommandingDependencyResolver | dependencyResolver | The dependency resolver |
| System.Boolean | auditRootCommandOnly | By default the built in auditor will audit every command that is dispatched however if using the audit as part of an event sourcing pipeline it can be useful to only audit the root command and exclude any commands dispatched as a result of that root command. Set this property to true to audit only the root commands, leave null or set to false to audit all commands. |
Returns
| Type | Description |
|---|---|
| ICommandingDependencyResolver | The dependency resolver |
Type Parameters
| Name | Description |
|---|---|
| TDispatchAuditorImpl | The type of the auditor |
UsePreDispatchCommandingAuditor<TDispatchAuditorImpl>(ICommandingDependencyResolver, Boolean)
Registers an auditor that will be invoked directly before a command has been dispatched.
Declaration
[Obsolete("Please use AddPreDispatchCommandingAuditor instead")]
public ICommandingDependencyResolver UsePreDispatchCommandingAuditor<TDispatchAuditorImpl>(ICommandingDependencyResolver dependencyResolver, bool auditRootCommandOnly = true)
where TDispatchAuditorImpl : ICommandAuditor
Parameters
| Type | Name | Description |
|---|---|---|
| ICommandingDependencyResolver | dependencyResolver | The dependency resolver |
| System.Boolean | auditRootCommandOnly | By default the built in auditor will audit every command that is dispatched however if using the audit as part of an event sourcing pipeline it can be useful to only audit the root command and exclude any commands dispatched as a result of that root command. Set this property to true to audit only the root commands, leave null or set to false to audit all commands. |
Returns
| Type | Description |
|---|---|
| ICommandingDependencyResolver | The dependency resolver |
Type Parameters
| Name | Description |
|---|---|
| TDispatchAuditorImpl | The type of the auditor |