VitreousValidationServiceCollectionExtensions class
Namespace: Vitreous.FluentValidation
Assembly: Vitreous.FluentValidation.dll
Extension methods to register the Vitreous FluentValidation pipeline behaviors.
public static class VitreousValidationServiceCollectionExtensionsInheritance
Section titled “Inheritance”object ← VitreousValidationServiceCollectionExtensions
Inherited Members
Section titled “Inherited Members”object.Equals(object?), object.Equals(object?, object?), object.GetHashCode(), object.GetType(), object.MemberwiseClone(), object.ReferenceEquals(object?, object?), object.ToString()
Methods
Section titled “Methods”AddVitreousValidation(IServiceCollection)
Section titled “ AddVitreousValidation(IServiceCollection)”Registers ValidationBehavior<TMessage, TResult> for commands and queries and
StreamValidationBehavior<TMessage, TResult> for stream queries. Each runs the
message’s IValidator<T> services before the handler and returns
Validation when they fail. Calling this more than once does nothing.
public static IServiceCollection AddVitreousValidation(this IServiceCollection services)Parameters
Section titled “Parameters”services IServiceCollection
Returns
Section titled “Returns”Remarks
Section titled “Remarks”Validators are not registered by this method. Register them yourself, for example with
services.AddValidatorsFromAssemblyContaining<Program>() from the
FluentValidation.DependencyInjectionExtensions package.
Behaviors run in registration order, outermost first. Call this before
AddVitreousCaching() so that invalid queries never reach the cache.