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" />
                    
Directory.Packages.props
<PackageReference Include="MediatorFlow.Generator" />
                    
Project file
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
                    
#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
                    
Install as a Cake Addin
#tool nuget:?package=MediatorFlow.Generator&version=1.0.2
                    
Install as a Cake Tool

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

  1. Define a request:
public record PingRequest() : IRequest<string>;
  1. Implement a handler:
public class PingHandler : IRequestHandler<PingRequest, string>
{
    public Task<string> Handle(PingRequest request, CancellationToken cancellationToken)
        => Task.FromResult("Pong");
}
  1. Register in DI:
services.AddMediatorFlow();
services.AddMediatorFlowApplication(); // For source generator
  1. 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.

Version Downloads Last Updated
1.0.2 115 4/2/2026
1.0.1 103 4/2/2026
1.0.0 111 4/2/2026