Class CommandingDependencies
Extension methods for registering commanding dependencies
Inheritance
Namespace: AzureFromTheTrenches.Commanding
Assembly: AzureFromTheTrenches.Commanding.dll
Syntax
public static class CommandingDependencies : object
Methods
| Improve this Doc View SourceAddAuditItemEnricher<TAuditItemEnricher>(ICommandingDependencyResolverAdapter)
Adds an audit item enricher
Declaration
public static ICommandingDependencyResolverAdapter AddAuditItemEnricher<TAuditItemEnricher>(this 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, 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 static ICommandRegistry AddCommanding(this ICommandingDependencyResolverAdapter dependencyResolver, Action<Type> commandHandlerContainerRegistration)
Parameters
Type | Name | Description |
---|---|---|
ICommandingDependencyResolverAdapter | dependencyResolver | The dependency resolver to register inside |
Action<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 |
AddCommanding(ICommandingDependencyResolverAdapter, Options)
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 static ICommandRegistry AddCommanding(this ICommandingDependencyResolverAdapter dependencyResolver, Options options = null)
Parameters
Type | Name | Description |
---|---|---|
ICommandingDependencyResolverAdapter | dependencyResolver | The dependency resolver to register inside |
Options | options | Configuration options for the commanding system |
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 static ICommandingDependencyResolverAdapter AddExecutionCommandingAuditor<TExecutionAuditorImpl>(this 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 static ICommandingDependencyResolverAdapter AddPostDispatchCommandingAuditor<TDispatchAuditorImpl>(this 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 static ICommandingDependencyResolverAdapter AddPreDispatchCommandingAuditor<TDispatchAuditorImpl>(this 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
public static ICommandingDependencyResolver UseAuditItemEnricher<TAuditItemEnricher>(this 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, 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 static ICommandRegistry UseCommanding(this ICommandingDependencyResolver dependencyResolver, Action<Type> commandHandlerContainerRegistration)
Parameters
Type | Name | Description |
---|---|---|
ICommandingDependencyResolver | dependencyResolver | The dependency resolver to register inside |
Action<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 |
UseCommanding(ICommandingDependencyResolver, Options)
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 static ICommandRegistry UseCommanding(this ICommandingDependencyResolver dependencyResolver, Options options = null)
Parameters
Type | Name | Description |
---|---|---|
ICommandingDependencyResolver | dependencyResolver | The dependency resolver to register inside |
Options | options | Configuration options for the commanding system |
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
public static ICommandingDependencyResolver UseExecutionCommandingAuditor<TExecutionAuditorImpl>(this 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
public static ICommandingDependencyResolver UsePostDispatchCommandingAuditor<TDispatchAuditorImpl>(this 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
public static ICommandingDependencyResolver UsePreDispatchCommandingAuditor<TDispatchAuditorImpl>(this 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 |