Class TenantDefaultCommandBehavior<TKey, TEntityModel, TResponse>
- Namespace
- Arbiter.CommandQuery.Behaviors
- Assembly
- Arbiter.CommandQuery.dll
A behavior for setting the default tenant id of a model.
public class TenantDefaultCommandBehavior<TKey, TEntityModel, TResponse> : PipelineBehaviorBase<EntityModelCommand<TEntityModel, TResponse>, TResponse>, IPipelineBehavior<EntityModelCommand<TEntityModel, TResponse>, TResponse> where TEntityModel : class
Type Parameters
TKey
The type of the model key
TEntityModel
The type of the model
TResponse
The type of the response
- Inheritance
-
PipelineBehaviorBase<EntityModelCommand<TEntityModel, TResponse>, TResponse>TenantDefaultCommandBehavior<TKey, TEntityModel, TResponse>
- Implements
-
IPipelineBehavior<EntityModelCommand<TEntityModel, TResponse>, TResponse>
- Inherited Members
Constructors
TenantDefaultCommandBehavior(ILoggerFactory, ITenantResolver<TKey>)
Initializes a new instance of the TenantDefaultCommandBehavior<TKey, TEntityModel, TResponse> class.
public TenantDefaultCommandBehavior(ILoggerFactory loggerFactory, ITenantResolver<TKey> tenantResolver)
Parameters
loggerFactory
ILoggerFactorytenantResolver
ITenantResolver<TKey>
Exceptions
- ArgumentNullException
When
tenantResolver
is null
Methods
Process(EntityModelCommand<TEntityModel, TResponse>, RequestHandlerDelegate<TResponse>, CancellationToken)
Processes the specified request with the additional behavior.
protected override ValueTask<TResponse?> Process(EntityModelCommand<TEntityModel, TResponse> request, RequestHandlerDelegate<TResponse> next, CancellationToken cancellationToken)
Parameters
request
EntityModelCommand<TEntityModel, TResponse>The incoming request.
next
RequestHandlerDelegate<TResponse>Awaitable delegate for the next action in the pipeline. Eventually this delegate represents the handler.
cancellationToken
CancellationTokenThe cancellation token.
Returns
- ValueTask<TResponse>
Awaitable task returning the
TResponse