Trellis.Mediator.FluentValidation 3.0.0-alpha.360

This is a prerelease version of Trellis.Mediator.FluentValidation.
dotnet add package Trellis.Mediator.FluentValidation --version 3.0.0-alpha.360
                    
NuGet\Install-Package Trellis.Mediator.FluentValidation -Version 3.0.0-alpha.360
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Trellis.Mediator.FluentValidation" Version="3.0.0-alpha.360" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Trellis.Mediator.FluentValidation" Version="3.0.0-alpha.360" />
                    
Directory.Packages.props
<PackageReference Include="Trellis.Mediator.FluentValidation" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Trellis.Mediator.FluentValidation --version 3.0.0-alpha.360
                    
#r "nuget: Trellis.Mediator.FluentValidation, 3.0.0-alpha.360"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Trellis.Mediator.FluentValidation@3.0.0-alpha.360
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Trellis.Mediator.FluentValidation&version=3.0.0-alpha.360&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=Trellis.Mediator.FluentValidation&version=3.0.0-alpha.360&prerelease
                    
Install as a Cake Tool

Trellis.Mediator.FluentValidation

NuGet Package

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 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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