MediatorFlow.Core
1.0.3
dotnet add package MediatorFlow.Core --version 1.0.3
NuGet\Install-Package MediatorFlow.Core -Version 1.0.3
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.Core" Version="1.0.3" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="MediatorFlow.Core" Version="1.0.3" />
<PackageReference Include="MediatorFlow.Core" />
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.Core --version 1.0.3
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: MediatorFlow.Core, 1.0.3"
#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.Core@1.0.3
#: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.Core&version=1.0.3
#tool nuget:?package=MediatorFlow.Core&version=1.0.3
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
| Product | Versions 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.
-
net10.0
- Microsoft.Extensions.DependencyInjection (>= 10.0.5)
- Microsoft.Extensions.Logging.Abstractions (>= 10.0.5)
NuGet packages (1)
Showing the top 1 NuGet packages that depend on MediatorFlow.Core:
| Package | Downloads |
|---|---|
|
MediatorFlow.Application
Package Description |
GitHub repositories
This package is not used by any popular GitHub repositories.