BbQ.Cqrs.Outcome.FluentValidation 1.3.0

dotnet add package BbQ.Cqrs.Outcome.FluentValidation --version 1.3.0
                    
NuGet\Install-Package BbQ.Cqrs.Outcome.FluentValidation -Version 1.3.0
                    
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="BbQ.Cqrs.Outcome.FluentValidation" Version="1.3.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="BbQ.Cqrs.Outcome.FluentValidation" Version="1.3.0" />
                    
Directory.Packages.props
<PackageReference Include="BbQ.Cqrs.Outcome.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 BbQ.Cqrs.Outcome.FluentValidation --version 1.3.0
                    
#r "nuget: BbQ.Cqrs.Outcome.FluentValidation, 1.3.0"
                    
#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 BbQ.Cqrs.Outcome.FluentValidation@1.3.0
                    
#: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=BbQ.Cqrs.Outcome.FluentValidation&version=1.3.0
                    
Install as a Cake Addin
#tool nuget:?package=BbQ.Cqrs.Outcome.FluentValidation&version=1.3.0
                    
Install as a Cake Tool

BbQ.Cqrs.Outcome.FluentValidation

Optional FluentValidation 12 integration for .NET 8, 9, and 10. This dependency is not added to the base Outcome or CQRS packages.

Installation

This package ships with the CQRS family under the same cqrs-v* version.

dotnet add package BbQ.Cqrs.Outcome.FluentValidation --version 1.3.0
services.AddBbQMediatorWithOutcomeAndFluentValidationFromAssemblies(
    assemblies: [typeof(CreateUser).Assembly],
    configureValidation: validation => validation.MapIssuesTo<AppError>(issue =>
        new AppError(issue.Code, issue.Message, issue.MemberName)));

This composed call registers scoped mediator services, handlers, native request validators, FluentValidation IValidator<TRequest> implementations and Outcome validation. One closed asynchronous adapter per request aggregates its FluentValidation validators. No separate validator or adapter registration is required for discovered concrete closed validator classes. The supplied assemblies must include both requests/handlers and the validators to discover. Open generic validators require explicit registration.

Source-generated setup

Reference BbQ.Cqrs.SourceGenerators as an analyzer. For an assembly named Ordering:

services.AddOrderingMediatorWithOutcomeAndFluentValidation(
    configureValidation: validation => validation.MapIssuesTo<AppError>(issue =>
        new AppError(issue.Code, issue.Message, issue.MemberName)));

The method is emitted only when this optional FluentValidation adapter is referenced. It composes generated mediator/Outcome setup with direct registrations for accessible closed local FluentValidation validators and adapters. It emits no assembly scanning. Call each participating assembly's method for multiple projects. Inaccessible/open generic validator classes require explicit registration.

Both paths also add adapters for discovered Outcome request types, so validators registered through application factories can participate without a discoverable validator class. Native request validators run first; the FluentValidation adapter follows and runs all registered FluentValidation validators sequentially in deterministic type-name order for discovered classes. Repeated calls or mixing scanning, generated and explicit adapter registration does not duplicate identical registrations.

Referencing the package alone does not enable discovery: the existing AddBbQMediatorWithOutcomeValidationFromAssemblies and generated AddOrderingMediatorWithOutcomeValidation methods retain their native-validator behavior. Choose the explicitly named FluentValidation method.

Omit configuration for Outcome<T> or Outcome<T,ValidationIssue>. Domain error types need an explicit mapping or custom failure factory. validation.MapIssuesTo<AppError, AppErrorMapper>() supports scoped mapping dependencies. Custom factories and registrations remain available, and application dependencies must still be registered. The Outcome registration guide covers defaults, dependency validation and the distinction between generated registration and mediator dispatch reflection.

Explicit registration

Existing per-request registration remains available:

using BbQ.Cqrs.Validation.FluentValidation;
services.AddScoped<FluentValidation.IValidator<CreateUser>, CreateUserValidator>();
services.AddFluentValidationRequest<CreateUser>();
services.AddOutcomeValidation<CreateUser, User>();

The adapter runs ValidateAsync(request, cancellationToken) sequentially for each registered FluentValidation validator, so asynchronous rules are supported and shared scoped dependencies are not used concurrently. ErrorCode, ErrorMessage, and PropertyName become ValidationIssue.Code, Message, and MemberName. Cancellation and unexpected validator exceptions propagate. Attempted values and custom state are deliberately not copied into public errors.

For explicit per-request setup, register the response mapper (for arbitrary typed errors), handler, and mediator separately. This adapter does not use ASP.NET's synchronous automatic-validation pipeline.

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 is compatible.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  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

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.3.0 189 10/16/2026
1.3.0-preview.4 70 10/14/2026
1.3.0-preview.2 87 9/13/2026
1.3.0-preview.1 88 9/13/2026

General availability: composed mediator and Outcome validation registration through assembly scanning or source generation, optional asynchronous FluentValidation integration and scoped issue mapping. See https://github.com/JeanMarcMbouma/Outcome/blob/master/docs/release-cqrs-1.3.0.md