Table of Contents

Class ValidateEntityModelCommandBehavior<TEntityModel, TResponse>

Namespace
Arbiter.CommandQuery.Behaviors
Assembly
Arbiter.CommandQuery.dll

A pipeline behavior that validates the entity model before processing the command.

public class ValidateEntityModelCommandBehavior<TEntityModel, TResponse> : PipelineBehaviorBase<EntityModelCommand<TEntityModel, TResponse>, TResponse>, IPipelineBehavior<EntityModelCommand<TEntityModel, TResponse>, TResponse> where TEntityModel : class

Type Parameters

TEntityModel

The type of the entity model to validate.

TResponse

The type of the response.

Inheritance
PipelineBehaviorBase<EntityModelCommand<TEntityModel, TResponse>, TResponse>
ValidateEntityModelCommandBehavior<TEntityModel, TResponse>
Implements
IPipelineBehavior<EntityModelCommand<TEntityModel, TResponse>, TResponse>
Inherited Members

Constructors

ValidateEntityModelCommandBehavior(ILoggerFactory, IValidator<TEntityModel>?)

Initializes a new instance of the ValidateEntityModelCommandBehavior<TEntityModel, TResponse> class.

public ValidateEntityModelCommandBehavior(ILoggerFactory loggerFactory, IValidator<TEntityModel>? validator = null)

Parameters

loggerFactory ILoggerFactory

The logger factory to create an ILogger from.

validator IValidator<TEntityModel>

The validator to use for the entity model.

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 CancellationToken

The cancellation token.

Returns

ValueTask<TResponse>

Awaitable task returning the TResponse