Trellis.Mediator.FluentValidation
3.0.0-alpha.342
See the version list below for details.
dotnet add package Trellis.Mediator.FluentValidation --version 3.0.0-alpha.342
NuGet\Install-Package Trellis.Mediator.FluentValidation -Version 3.0.0-alpha.342
<PackageReference Include="Trellis.Mediator.FluentValidation" Version="3.0.0-alpha.342" />
<PackageVersion Include="Trellis.Mediator.FluentValidation" Version="3.0.0-alpha.342" />
<PackageReference Include="Trellis.Mediator.FluentValidation" />
paket add Trellis.Mediator.FluentValidation --version 3.0.0-alpha.342
#r "nuget: Trellis.Mediator.FluentValidation, 3.0.0-alpha.342"
#:package Trellis.Mediator.FluentValidation@3.0.0-alpha.342
#addin nuget:?package=Trellis.Mediator.FluentValidation&version=3.0.0-alpha.342&prerelease
#tool nuget:?package=Trellis.Mediator.FluentValidation&version=3.0.0-alpha.342&prerelease
Trellis.Mediator.FluentValidation
Mediator pipeline adapter that plugs FluentValidation validators into the Trellis.Mediator validation stage.
Why this package exists
Trellis.FluentValidation is a Domain-layer concern — it converts FluentValidation ValidationResult to Result<T> for use in any application layer. Trellis.Mediator is an application / composition-layer concern — it provides the mediator pipeline behaviors (validation, authorization, logging, etc.).
This package bridges the two without forcing Domain projects to take a transitive Mediator dependency. Reference it from your Application (or composition root) project; keep Trellis.FluentValidation in your Domain project.
Installation
dotnet add package Trellis.Mediator.FluentValidation
Quick example
using FluentValidation;
using Trellis.Mediator;
using Trellis.Mediator.FluentValidation;
builder.Services.AddMediator(opts => opts.ServiceLifetime = ServiceLifetime.Scoped);
builder.Services.AddTrellisBehaviors();
builder.Services.AddTrellisFluentValidation();
builder.Services.AddScoped<IValidator<MyCommand>, MyCommandValidator>();
AddTrellisFluentValidation() registers FluentValidationMessageValidatorAdapter<TMessage> as the open-generic IMessageValidator<TMessage> implementation. Every IValidator<T> registered for the message in DI runs inside the existing ValidationBehavior<TMessage, TResponse> and contributes its failures to an aggregated Error.InvalidInput response. FluentValidation property names with member chains (Address.City) or indexers (Items[0].Sku) are translated to RFC 6901 JSON Pointers (/Address/City, /Items/0/Sku).
AOT / trim story
The parameterless AddTrellisFluentValidation() overload is AOT- and trim-safe — it uses open-generic DI registration with no reflection. Validators must be registered explicitly:
services.AddScoped<IValidator<CreateOrderCommand>, CreateOrderCommandValidator>();
The AddTrellisFluentValidation(params Assembly[]) overload scans assemblies for IValidator<T> implementations via reflection and is annotated [RequiresUnreferencedCode] / [RequiresDynamicCode] — use the parameterless form in AOT scenarios.
Documentation
Part of Trellis
This package is part of the Trellis framework.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net10.0
- FluentValidation (>= 12.1.1)
- Microsoft.Extensions.DependencyInjection (>= 10.0.7)
- Microsoft.Extensions.Logging.Abstractions (>= 10.0.7)
- Trellis.Core (>= 3.0.0-alpha.342)
- Trellis.FluentValidation (>= 3.0.0-alpha.342)
- Trellis.Mediator (>= 3.0.0-alpha.342)
NuGet packages (1)
Showing the top 1 NuGet packages that depend on Trellis.Mediator.FluentValidation:
| Package | Downloads |
|---|---|
|
Trellis.ServiceDefaults
Opinionated service composition defaults for Trellis web services. Provides a tiered builder that wires ASP integration, Mediator behaviors, FluentValidation, resource authorization, actor providers, and EF Core Unit of Work in canonical order. |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 3.0.0-alpha.360 | 54 | 6/7/2026 |
| 3.0.0-alpha.342 | 57 | 6/5/2026 |