MediatorFlow.Generator
1.0.2
dotnet add package MediatorFlow.Generator --version 1.0.2
NuGet\Install-Package MediatorFlow.Generator -Version 1.0.2
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="MediatorFlow.Generator" Version="1.0.2" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="MediatorFlow.Generator" Version="1.0.2" />
<PackageReference Include="MediatorFlow.Generator" />
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 MediatorFlow.Generator --version 1.0.2
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: MediatorFlow.Generator, 1.0.2"
#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 MediatorFlow.Generator@1.0.2
#: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=MediatorFlow.Generator&version=1.0.2
#tool nuget:?package=MediatorFlow.Generator&version=1.0.2
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
MediatorFlow
A modern mediator pattern library for .NET with built-in pipeline behaviors and source generator for auto-registration.
Features
- Mediator Pattern: Clean separation of concerns with requests and notifications.
- Pipeline Behaviors: Built-in logging, metrics, retry, and validation behaviors.
- Source Generator: Automatic registration of handlers at compile-time.
- Clean Architecture: Modular design with separate core, application, and generator projects.
Installation
Install the main package:
dotnet add package MediatorFlow.Core
For the source generator:
dotnet add package MediatorFlow.Generator
Usage
- Define a request:
public record PingRequest() : IRequest<string>;
- Implement a handler:
public class PingHandler : IRequestHandler<PingRequest, string>
{
public Task<string> Handle(PingRequest request, CancellationToken cancellationToken)
=> Task.FromResult("Pong");
}
- Register in DI:
services.AddMediatorFlow();
services.AddMediatorFlowApplication(); // For source generator
- Use the mediator:
var result = await mediator.Send(new PingRequest());
Pipeline Behaviors
MediatorFlow includes several built-in behaviors:
- Validation: Validates requests using
IValidator<TRequest>. - Retry: Retries failed requests with configurable attempts and delay.
- Logging: Logs request handling.
- Metrics: Measures execution time.
Comparison to MediatR
MediatorFlow improves upon MediatR by:
- Automatic handler registration via source generator.
- Built-in pipeline behaviors for common cross-cutting concerns.
- Clean architecture with separation of concerns.
License
MIT
There are no supported framework assets in this package.
Learn more about Target Frameworks and .NET Standard.
-
.NETStandard 2.0
- No dependencies.
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.