Table of Contents

Interface IAotValidationDispatcher

Namespace
Excalibur.Dispatch.Validation.FluentValidation
Assembly
Excalibur.Dispatch.Validation.FluentValidation.dll

Dispatches validation to the correct strongly-typed FluentValidation validators without runtime reflection. Implementations are source-generated by Excalibur.Dispatch.SourceGenerators.

public interface IAotValidationDispatcher
Extension Methods

Remarks

Register the generated implementation via DI so that AotFluentValidatorResolver can discover it at runtime. When no implementation is registered, AotFluentValidatorResolver throws InvalidOperationException.

Methods

TryValidateAsync(IDispatchMessage, IServiceProvider, CancellationToken)

Validates the given message by dispatching to the appropriate strongly-typed IValidator<T> resolved from DI.

ValueTask<IValidationResult?> TryValidateAsync(IDispatchMessage message, IServiceProvider provider, CancellationToken cancellationToken = default)

Parameters

message IDispatchMessage

The message to validate.

provider IServiceProvider

The service provider for resolving validators.

cancellationToken CancellationToken

Cancellation forwarded to each validator.

Returns

ValueTask<IValidationResult>

A IValidationResult if validators exist for the message type; null if no validators are registered for this message type.

Remarks

The provider is borrowed. Implementations do not create or dispose scopes.