Table of Contents

Class FluentValidationServiceCollectionExtensions

Namespace
Microsoft.Extensions.DependencyInjection
Assembly
Excalibur.Dispatch.Validation.FluentValidation.dll

Extension methods for configuring FluentValidation with the Excalibur framework.

public static class FluentValidationServiceCollectionExtensions
Inheritance
FluentValidationServiceCollectionExtensions
Inherited Members

Methods

WithAotFluentValidation(IDispatchBuilder)

Adds AOT-compatible FluentValidation to the dispatch pipeline.

public static IDispatchBuilder WithAotFluentValidation(this IDispatchBuilder builder)

Parameters

builder IDispatchBuilder

The dispatch builder.

Returns

IDispatchBuilder

The dispatch builder for chaining.

Remarks

This method registers AotFluentValidatorResolver which is designed for Native AOT scenarios. Requires source-generated validator dispatch for full AOT support.

WithFluentValidation(IDispatchBuilder)

Adds FluentValidation-based validation to the dispatch pipeline.

[RequiresDynamicCode("FluentValidatorResolver uses MakeGenericType for IValidator<T> resolution. Use WithAotFluentValidation() for AOT scenarios.")]
[RequiresUnreferencedCode("FluentValidatorResolver uses runtime type creation. Use WithAotFluentValidation() for AOT scenarios.")]
public static IDispatchBuilder WithFluentValidation(this IDispatchBuilder builder)

Parameters

builder IDispatchBuilder

The dispatch builder.

Returns

IDispatchBuilder

The dispatch builder for chaining.

Remarks

This method registers FluentValidatorResolver as the IValidatorResolver implementation. Ensure your FluentValidation validators are registered with the service collection. For AOT scenarios, use WithAotFluentValidation(IDispatchBuilder) instead.