MediatR.Extensions.FluentValidation.AspNetCore 2.0.0

.NET Standard 2.1
There is a newer version of this package available.
See the version list below for details.
dotnet add package MediatR.Extensions.FluentValidation.AspNetCore --version 2.0.0
NuGet\Install-Package MediatR.Extensions.FluentValidation.AspNetCore -Version 2.0.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="MediatR.Extensions.FluentValidation.AspNetCore" Version="2.0.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add MediatR.Extensions.FluentValidation.AspNetCore --version 2.0.0
#r "nuget: MediatR.Extensions.FluentValidation.AspNetCore, 2.0.0"
#r directive can be used in F# Interactive, C# scripting and .NET Interactive. Copy this into the interactive tool or source code of the script to reference the package.
// Install MediatR.Extensions.FluentValidation.AspNetCore as a Cake Addin
#addin nuget:?package=MediatR.Extensions.FluentValidation.AspNetCore&version=2.0.0

// Install MediatR.Extensions.FluentValidation.AspNetCore as a Cake Tool
#tool nuget:?package=MediatR.Extensions.FluentValidation.AspNetCore&version=2.0.0


GitHub Actions Status NuGet NuGet license

MediatR extension for FluentValidation using core


A priori you need to install packages Mediatr and FluentValidation then continue below

Install with nuget

Install-Package MediatR.Extensions.FluentValidation.AspNetCore

Install with .NET CLI

dotnet add package MediatR.Extensions.FluentValidation.AspNetCore

How to use

Setup - Add configuration in startup

public void ConfigureServices(IServiceCollection services)
    // Add framework services etc.
    var domainAssembly = typeof(GenerateInvoiceHandler).GetTypeInfo().Assembly;
    // Add MediatR

    //Add FluentValidation
    services.AddFluentValidation(new[] {domainAssembly});
    //Add other stuffs


Just to write down validators for IRequest implementation. Validation will be executed before handling IRequestHandler.

public class GenerateInvoiceValidator : AbstractValidator<GenerateInvoiceRequest>
    public GenerateInvoiceValidator()
        RuleFor(x => x.Month).LowerThan(13);
        // etc.

public class GenerateInvoiceRequest : IRequest
    public int Month { get; set; }
public class GenerateInvoiceRequestHandler : IRequestHandler<GenerateInvoiceRequest>
    public async Task<Unit> Handle(GenerateInvoiceRequest request, CancellationToken cancellationToken)
        // request data has been validated

More examples check FluentValidation docs:

Product Versions
.NET net5.0 net5.0-windows net6.0 net6.0-android net6.0-ios net6.0-maccatalyst net6.0-macos net6.0-tvos net6.0-windows net7.0 net7.0-android net7.0-ios net7.0-maccatalyst net7.0-macos net7.0-tvos net7.0-windows
.NET Core netcoreapp3.0 netcoreapp3.1
.NET Standard netstandard2.1
MonoAndroid monoandroid
MonoMac monomac
MonoTouch monotouch
Tizen tizen60
Xamarin.iOS xamarinios
Xamarin.Mac xamarinmac
Xamarin.TVOS xamarintvos
Xamarin.WatchOS xamarinwatchos
Compatible target framework(s)
Additional computed target framework(s)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (3)

Showing the top 3 NuGet packages that depend on MediatR.Extensions.FluentValidation.AspNetCore:

Package Downloads

The NeerCore.Application.MediatR package provides classes for simplified application configuration using the MediatR library. It is a library for simplified writing of .NET apps. It integrates a popular set of core libraries that are required for developing full-fledged apps, but they don't come out of the box in ASP.NET. NeerCore can be used as shown in the examples in the official repository, or separately in parts that you need. You can also use part of the code from the repository if you do not need to include "one more nuget package" or if your project is not support the version of .NET on which NeerCore was created.


Package Description


Package Description

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
4.0.0 49,584 10/17/2022
3.0.0 102,788 5/9/2022
2.0.0 147,799 1/15/2022
1.2.0 239,339 5/13/2021
1.1.1 265,475 8/23/2020
1.1.0 17,894 8/5/2020
1.0.3 2,618 7/31/2020
1.0.2 14,815 6/18/2020
1.0.1 37,656 9/3/2019
1.0.0 5,946 9/3/2019