StreamValidationBehavior<TMessage, TResult> class
Namespace: Vitreous.FluentValidation.Behaviors
Assembly: Vitreous.FluentValidation.dll
Stream pipeline behavior that runs every registered IValidator<T> for a stream
query before the stream is opened. When validation fails the handler is not called, and
CreateStream returns Validation with the failures grouped by
property name.
public sealed class StreamValidationBehavior<TMessage, TResult> : IStreamPipelineBehavior<TMessage, TResult> where TMessage : IStreamQuery<TResult>Type Parameters
Section titled “Type Parameters”TMessage
TResult
Inheritance
Section titled “Inheritance”object ← StreamValidationBehavior<TMessage, TResult>
Implements
Section titled “Implements”IStreamPipelineBehavior<TMessage, TResult>
Inherited Members
Section titled “Inherited Members”object.Equals(object?), object.Equals(object?, object?), object.GetHashCode(), object.GetType(), object.ReferenceEquals(object?, object?), object.ToString()
Remarks
Section titled “Remarks”Queries without a validator pass straight through. Validation runs once, when the stream is created, not for each item.
Constructors
Section titled “Constructors”StreamValidationBehavior(IEnumerable<IValidator<TMessage>>)
Section titled “ StreamValidationBehavior(IEnumerable<IValidator<TMessage>>)”public StreamValidationBehavior(IEnumerable<IValidator<TMessage>> validators)Parameters
Section titled “Parameters”validators IEnumerable<IValidator<TMessage>>
Methods
Section titled “Methods”Handle(TMessage, StreamQueryHandlerDelegate<TMessage, TResult>, CancellationToken)
Section titled “ Handle(TMessage, StreamQueryHandlerDelegate<TMessage, TResult>, CancellationToken)”Executes this behavior step, calling next to continue the pipeline.
public ValueTask<Result<IAsyncEnumerable<TResult>>> Handle(TMessage message, StreamQueryHandlerDelegate<TMessage, TResult> next, CancellationToken ct = default)Parameters
Section titled “Parameters”message TMessage
next StreamQueryHandlerDelegate<TMessage, TResult>
Returns
Section titled “Returns”ValueTask<Result<IAsyncEnumerable<TResult>>>