Minicon.Mediator 1.0.0

dotnet add package Minicon.Mediator --version 1.0.0
                    
NuGet\Install-Package Minicon.Mediator -Version 1.0.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="Minicon.Mediator" Version="1.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Minicon.Mediator" Version="1.0.0" />
                    
Directory.Packages.props
<PackageReference Include="Minicon.Mediator" />
                    
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 Minicon.Mediator --version 1.0.0
                    
#r "nuget: Minicon.Mediator, 1.0.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.
#:package Minicon.Mediator@1.0.0
                    
#: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=Minicon.Mediator&version=1.0.0
                    
Install as a Cake Addin
#tool nuget:?package=Minicon.Mediator&version=1.0.0
                    
Install as a Cake Tool

Minicon.Mediator

A lightweight, MediatR-API-compatible mediator for .NET — request/response, notifications and pipeline behaviors with exactly one runtime dependency (Microsoft.Extensions.DependencyInjection.Abstractions).

Independent reimplementation by minicon eG. Not affiliated with or endorsed by the MediatR project. "MediatR" is a trademark of its respective owner; the familiar type names (IRequest, INotification, …) are kept for an easy migration, but this package lives in its own Minicon.Mediator namespace.

Install

dotnet add package Minicon.Mediator

Targets net8.0 and net10.0.

Usage

using Minicon.Mediator;
using Microsoft.Extensions.DependencyInjection;

// 1) Register — scans the given assembly for handlers
services.AddMediator(cfg => cfg.RegisterServicesFromAssemblyContaining<Ping>());

// 2) Request / Response
public record Ping(string Message) : IRequest<string>;

public sealed class PingHandler : IRequestHandler<Ping, string>
{
    public Task<string> Handle(Ping request, CancellationToken ct)
        => Task.FromResult($"Pong: {request.Message}");
}

var answer = await mediator.Send(new Ping("hi"));   // "Pong: hi"

// 3) Notifications (fan-out to all handlers)
public record UserRegistered(string Email) : INotification;

public sealed class SendWelcome : INotificationHandler<UserRegistered>
{
    public Task Handle(UserRegistered n, CancellationToken ct) => /* ... */ Task.CompletedTask;
}

await mediator.Publish(new UserRegistered("a@b.de"));

// 4) Pipeline behaviors (logging, validation, transactions, …)
public sealed class LoggingBehavior<TReq, TRes> : IPipelineBehavior<TReq, TRes>
    where TReq : notnull
{
    public async Task<TRes> Handle(TReq req, RequestHandlerDelegate<TRes> next, CancellationToken ct)
    {
        // before
        var res = await next();
        // after
        return res;
    }
}

Migrating from MediatR

In most cases a single replacement is enough:

  • using MediatR;using Minicon.Mediator;
  • services.AddMediatR(...)services.AddMediator(...)
  • MediatRServiceConfigurationMediatorServiceConfiguration

All other type names (IRequest, IRequest<T>, INotification, IRequestHandler<,>, INotificationHandler<>, IPipelineBehavior<,>, ISender, IPublisher, IMediator, Unit) are unchanged.

License

MIT © minicon eG

Product 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.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  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.

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.0 71 6/8/2026