Toarnbeike.Results.FluentValidation 2.1.0

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

CI .NET 10 License: MIT

Toarnbeike.Results.FluentValidation

Integrate fluent result handling from Toarnbeike.Results with expressive validation logic from FluentValidation, providing seamless validation support for Result<T> using one or more IValidator<T> instances.

Features

  • Extension methods to validate Result<T> with one or more FluentValidation validators.
  • Support for both synchronous and asynchronous validation (Validate / ValidateAsync).
  • Automatic conversion of FluentValidation's ValidationFailure to Toarnbeike.Results.Failures.ValidationFailure.
  • Useful for pipeline-based validation or standalone use in service or domain layers.

Contents

  1. Quick start
  2. Core concepts

Quick start

This example demonstrates how to use Toarnbeike.Results.FluentValidation to validate a dto using a FluentValidation validator and return a Result.

Result<RegisterUserCommand> result = new RegisterUserCommand("John", "john@email.com");

// Validate using one or more FluentValidation validators
var validated = result.Validate(new RegisterUserCommandValidator());

Core concepts

Installation

dotnet add package Toarnbeike.Results.FluentValidation

This package targets .NET 10 and depends on:

  • Toarnbeike.Results
  • FluentValidation

Usage

Validate the value of a Result<TValue> if the result is successful.

var result = Result.Success(new RegisterUserCommand("John", "john@email.com"));

// Validate using one or more FluentValidation validators
var validated = result.Validate(new RegisterUserCommandValidator());

Validate asynchronously

var result = Result.Success(new RegisterUserCommand("John", "john@email.com"));

var validated = result.ValidateAsync(new RegisterUserCommandValidator());

Validate using multiple validators (coming from DI)

public class CreateUserCommandHandler(IEnumerable<IValidator<CreateUserCommand>> validators) 
{
    public async Task<Result> Handle(CreateUserCommand command)
    {
        return await Result.Success(command)
            .ValidateAsync(validators);
            // other extensions methods that handle the command.
    }
}

When to use Validate vs. ValidateAsync

Use:

  • .Validate() when your validators are fully synchronous
  • .ValidateAsync() when any of your validators use asynchronous logic, such as MustAsync, or if you are not sure.

There is currently no automatic way to detect whether an IValidator<T> from FluentValidation uses async logic; when choosing the async method the full validation is always performed, even when the IValidator<T> does not contain async logic.

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 Toarnbeike.Results.FluentValidation:

Package Downloads
Toarnbeike.Results.Messaging

Lightweight CQRS request/response messaging built on top of Toarnbeike.Results

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
2.1.0 31 5/14/2026
2.0.0 97 4/14/2026
1.1.4 94 4/12/2026
1.1.3 87 4/11/2026
1.1.2 90 4/11/2026
1.1.1 99 4/10/2026
1.1.0 92 4/10/2026
1.0.2 245 11/4/2025
1.0.1 236 10/27/2025
1.0.0 318 8/28/2025