Caravel.MediatR
0.16.0
There is a newer version of this package available.
See the version list below for details.
See the version list below for details.
dotnet add package Caravel.MediatR --version 0.16.0
NuGet\Install-Package Caravel.MediatR -Version 0.16.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="Caravel.MediatR" Version="0.16.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Caravel.MediatR --version 0.16.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Caravel.MediatR, 0.16.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.
// Install Caravel.MediatR as a Cake Addin #addin nuget:?package=Caravel.MediatR&version=0.16.0 // Install Caravel.MediatR as a Cake Tool #tool nuget:?package=Caravel.MediatR&version=0.16.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
Caravel.MediatR
This package contains reusable MediatR behaviours.
Logging Behaviour
Creates an entry Log for the start and failure of each request in the pipeline. It will log the error in case the request fails.
builder.Services.AddMediatR(cfg =>
{
cfg.RegisterServicesFromAssembly(Assembly.GetExecutingAssembly());
cfg.AddOpenBehavior(typeof(LoggingRequestBehaviour<,>));
});
Validation and ResultValidation Behaviour
Validates requests using FluentValidation.
It is recommended to use ResultValidationRequestBehaviour
when using the Result
pattern to avoid throwing unnecessary ValidationException
.
builder.Services.AddMediatR(cfg =>
{
cfg.RegisterServicesFromAssembly(Assembly.GetExecutingAssembly());
cfg.AddOpenBehavior(typeof(ValidationRequestBehaviour<,>));
cfg.AddOpenBehavior(typeof(ResultValidationRequestBehaviour<,>));
});
{
"code": "invalid_fields",
"title": "Invalid Fields",
"status": 400,
"errors": {
"field1": ["error_1", "error_2"]
}
}
Idempotent Behaviour
Ensures all requests implementing interface IIdempotentRequest
are idempotent.
builder.Services.AddMediatR(cfg =>
{
cfg.RegisterServicesFromAssembly(Assembly.GetExecutingAssembly());
cfg.AddOpenBehavior(typeof(IdempotentRequestBehaviour<,>));
});
{
"code": "duplicate_request",
"title": "Duplicate request",
"status": 204,
"detail": "Duplicate request with Idempotent Key 53655b3d-48d5-4ac1-ba73-4318b3b702e8."
}
Product | Versions 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. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
net8.0
- Caravel (>= 0.25.0)
- FluentValidation (>= 11.9.2)
- MediatR (>= 12.4.0)
- Microsoft.Extensions.Logging (>= 8.0.0)
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 |
---|---|---|
0.18.0 | 41 | 9/29/2024 |
0.17.0 | 37 | 9/28/2024 |
0.16.0 | 96 | 8/20/2024 |
0.14.0 | 213 | 12/10/2023 |
0.13.0 | 116 | 12/4/2023 |
0.12.0 | 375 | 10/2/2022 |
0.11.0 | 405 | 9/24/2022 |
0.10.0 | 127 | 9/24/2022 |
0.8.0 | 196 | 9/30/2021 |
0.7.0 | 189 | 9/27/2021 |
0.6.0 | 338 | 4/10/2021 |
0.5.0 | 381 | 11/21/2020 |
0.4.0 | 406 | 11/15/2020 |
0.3.0 | 390 | 10/27/2020 |
0.2.0 | 434 | 10/12/2020 |
0.1.1 | 395 | 9/5/2020 |
0.1.0 | 430 | 9/5/2020 |