![]() |
VOOZH | about |
dotnet add package MediatR.Extensions.FluentValidation.AspNetCore --version 6.0.0
NuGet\Install-Package MediatR.Extensions.FluentValidation.AspNetCore -Version 6.0.0
<PackageReference Include="MediatR.Extensions.FluentValidation.AspNetCore" Version="6.0.0" />
<PackageVersion Include="MediatR.Extensions.FluentValidation.AspNetCore" Version="6.0.0" />Directory.Packages.props
<PackageReference Include="MediatR.Extensions.FluentValidation.AspNetCore" />Project file
paket add MediatR.Extensions.FluentValidation.AspNetCore --version 6.0.0
#r "nuget: MediatR.Extensions.FluentValidation.AspNetCore, 6.0.0"
#:package MediatR.Extensions.FluentValidation.AspNetCore@6.0.0
#addin nuget:?package=MediatR.Extensions.FluentValidation.AspNetCore&version=6.0.0Install as a Cake Addin
#tool nuget:?package=MediatR.Extensions.FluentValidation.AspNetCore&version=6.0.0Install as a Cake Tool
👁 GitHub Actions Status
👁 NuGet
👁 NuGet
👁 license
MediatR extension to the FluentValidation for .NET framework
First you need to install packages Mediatr and FluentValidation, then follow the instructions below
Install-Package MediatR.Extensions.FluentValidation.AspNetCore
dotnet add package MediatR.Extensions.FluentValidation.AspNetCore
public void ConfigureServices(IServiceCollection services)
{
// Add framework services etc.
services.AddMvc();
var domainAssembly = typeof(GenerateInvoiceHandler).GetTypeInfo().Assembly;
// Add MediatR
services.AddMediatR(cfg => cfg.RegisterServicesFromAssembly(domainAssembly));
//Add FluentValidation
services.AddFluentValidation(new[] {domainAssembly});
//Add other stuffs
...
}
Implement validator for your IRequest objects. 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 Handle(GenerateInvoiceRequest request, CancellationToken cancellationToken)
{
// request data has been validated
...
}
}
More examples check FluentValidation docs: https://fluentvalidation.net/start
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 net5.0 was computed. net5.0-windows net5.0-windows was computed. net6.0 net6.0 was computed. net6.0-android net6.0-android was computed. net6.0-ios net6.0-ios was computed. net6.0-maccatalyst net6.0-maccatalyst was computed. net6.0-macos net6.0-macos was computed. net6.0-tvos net6.0-tvos was computed. net6.0-windows net6.0-windows was computed. net7.0 net7.0 was computed. net7.0-android net7.0-android was computed. net7.0-ios net7.0-ios was computed. net7.0-maccatalyst net7.0-maccatalyst was computed. net7.0-macos net7.0-macos was computed. net7.0-tvos net7.0-tvos was computed. net7.0-windows net7.0-windows was computed. net8.0 net8.0 was computed. net8.0-android net8.0-android was computed. net8.0-browser net8.0-browser was computed. net8.0-ios net8.0-ios was computed. net8.0-maccatalyst net8.0-maccatalyst was computed. net8.0-macos net8.0-macos was computed. net8.0-tvos net8.0-tvos was computed. net8.0-windows net8.0-windows was computed. net9.0 net9.0 was computed. net9.0-android net9.0-android was computed. net9.0-browser net9.0-browser was computed. net9.0-ios net9.0-ios was computed. net9.0-maccatalyst net9.0-maccatalyst was computed. net9.0-macos net9.0-macos was computed. net9.0-tvos net9.0-tvos was computed. net9.0-windows net9.0-windows was computed. net10.0 net10.0 was computed. net10.0-android net10.0-android was computed. net10.0-browser net10.0-browser was computed. net10.0-ios net10.0-ios was computed. net10.0-maccatalyst net10.0-maccatalyst was computed. net10.0-macos net10.0-macos was computed. net10.0-tvos net10.0-tvos was computed. net10.0-windows net10.0-windows was computed. |
| .NET Core | netcoreapp3.0 netcoreapp3.0 was computed. netcoreapp3.1 netcoreapp3.1 was computed. |
| .NET Standard | netstandard2.1 netstandard2.1 is compatible. |
| MonoAndroid | monoandroid monoandroid was computed. |
| MonoMac | monomac monomac was computed. |
| MonoTouch | monotouch monotouch was computed. |
| Tizen | tizen60 tizen60 was computed. |
| Xamarin.iOS | xamarinios xamarinios was computed. |
| Xamarin.Mac | xamarinmac xamarinmac was computed. |
| Xamarin.TVOS | xamarintvos xamarintvos was computed. |
| Xamarin.WatchOS | xamarinwatchos xamarinwatchos was computed. |
Showing the top 5 NuGet packages that depend on MediatR.Extensions.FluentValidation.AspNetCore:
| Package | Downloads |
|---|---|
|
NeerCore.Application.MediatR
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. |
|
|
nArchCore.Application
Application layer for nArchCore infrastructure. Contains handlers, business rules, middleware behaviors and common services. |
|
|
Dimsi.Azure.Functions.Worker.Extensions.MediatR
This extension has the objective to simplify the use of MediatR with Microsoft Azure Function isolated worker |
|
|
Atlas.Framework.CleanArchitecture
Package Description |
|
|
EPS.SharedKernel.Application
EPS.SharedKernel.Application |
Showing the top 1 popular GitHub repositories that depend on MediatR.Extensions.FluentValidation.AspNetCore:
| Repository | Stars |
|---|---|
|
kamilbaczek/Modular-monolith-by-example
Modular monolith architecture example in .NET. Estimation Tool is tool to optimize estimation process in IT company.
|
| Version | Downloads | Last Updated |
|---|---|---|
| 6.0.0 | 282,641 | 4/12/2025 |
| 5.1.0 | 1,436,127 | 11/19/2023 |
| 5.0.0 | 61,772 | 10/14/2023 |
| 4.0.0 | 922,205 | 10/17/2022 |
| 3.0.0 | 331,715 | 5/9/2022 |
| 2.0.0 | 231,146 | 1/15/2022 |
| 1.2.0 | 374,264 | 5/13/2021 |
| 1.1.1 | 362,147 | 8/23/2020 |
| 1.1.0 | 32,538 | 8/5/2020 |
| 1.0.3 | 3,865 | 7/31/2020 |
| 1.0.2 | 22,589 | 6/18/2020 |
| 1.0.1 | 47,562 | 9/3/2019 |
| 1.0.0 | 9,224 | 9/3/2019 |