Class ValidationBehavior<TRequest, TResponse>
Валидация перед хэндлерами CQRS command/query
Implements
IPipelineBehavior<TRequest, TResponse>
Inherited Members
Namespace: NotifyHub.NotificationService.Infrastructure.Behaviours
Assembly: NotifyHub.NotificationService.Infrastructure.dll
Syntax
public class ValidationBehavior<TRequest, TResponse> : IPipelineBehavior<TRequest, TResponse> where TRequest : notnull
Type Parameters
Name | Description |
---|---|
TRequest | |
TResponse |
Constructors
| Edit this page View SourceValidationBehavior(IEnumerable<IValidator<TRequest>>)
Declaration
public ValidationBehavior(IEnumerable<IValidator<TRequest>> validators)
Parameters
Type | Name | Description |
---|---|---|
IEnumerable<IValidator<TRequest>> | validators |
Methods
| Edit this page View SourceHandle(TRequest, RequestHandlerDelegate<TResponse>, CancellationToken)
Pipeline handler. Perform any additional behavior and await the next
delegate as necessary
Declaration
public Task<TResponse> Handle(TRequest request, RequestHandlerDelegate<TResponse> next, CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
TRequest | request | Incoming request |
RequestHandlerDelegate<TResponse> | next | Awaitable delegate for the next action in the pipeline. Eventually this delegate represents the handler. |
CancellationToken | cancellationToken | Cancellation token |
Returns
Type | Description |
---|---|
Task<TResponse> | Awaitable task returning the |
Implements
MediatR.IPipelineBehavior<TRequest, TResponse>