Medino 3.0.2

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

Medino

A lightweight, high-performance in-process mediator for .NET 8+ that implements the mediator pattern for CQRS, commands, queries, events, and pipeline behaviors.

Features

  • Zero Dependencies: Core library has no external dependencies
  • Commands & Queries: Fire-and-forget commands and request/response queries
  • Events: Pub/sub notifications with multiple handlers
  • Pipeline Behaviors: Cross-cutting concerns like logging, validation, and caching
  • Context Behaviors: Transform and enrich requests before processing
  • Exception Handling: Graceful error handling with fallback responses
  • Explicit Async: All methods clearly indicate async behavior with *Async suffix
  • MediatR Migration: Simple migration path from MediatR 12.5

Installation

dotnet add package Medino
dotnet add package Medino.Extensions.DependencyInjection

Quick Start

1. Register Medino

services.AddMedino(typeof(Program).Assembly);

2. Define Commands

public record CreateUserCommand(string Name, string Email) : ICommand;

public class CreateUserCommandHandler : ICommandHandler<CreateUserCommand>
{
    public async Task HandleAsync(CreateUserCommand command, CancellationToken cancellationToken)
    {
        // Fire-and-forget command logic
        await _userRepository.CreateAsync(command.Name, command.Email);
    }
}

3. Define Queries

public record GetUserQuery(int Id) : IRequest<UserDto>;

public class GetUserQueryHandler : IRequestHandler<GetUserQuery, UserDto>
{
    public async Task<UserDto> HandleAsync(GetUserQuery request, CancellationToken cancellationToken)
    {
        return await _userRepository.GetByIdAsync(request.Id);
    }
}

4. Send Requests

// Send command
await mediator.SendAsync(new CreateUserCommand("John", "john@example.com"));

// Send query
var user = await mediator.SendAsync(new GetUserQuery(123));

Pipeline Behaviors

Add cross-cutting concerns that execute around your handlers:

public class LoggingBehavior<TRequest, TResponse> : IPipelineBehavior<TRequest, TResponse>
    where TRequest : IRequest<TResponse>
{
    public async Task<TResponse> HandleAsync(
        TRequest request,
        RequestHandlerDelegate<TResponse> next,
        CancellationToken cancellationToken)
    {
        _logger.LogInformation("Handling {RequestType}", typeof(TRequest).Name);
        var response = await next();
        _logger.LogInformation("Handled {RequestType}", typeof(TRequest).Name);
        return response;
    }
}

Events (Notifications)

Publish events to multiple handlers:

public record UserCreatedNotification(int UserId, string Email) : INotification;

public class SendWelcomeEmailHandler : INotificationHandler<UserCreatedNotification>
{
    public async Task HandleAsync(UserCreatedNotification notification, CancellationToken cancellationToken)
    {
        await _emailService.SendWelcomeEmailAsync(notification.Email);
    }
}

// Publish to all handlers
await mediator.PublishAsync(new UserCreatedNotification(123, "john@example.com"));

Documentation

License

MIT License - see LICENSE for details

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 is compatible.  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.
  • net10.0

    • No dependencies.
  • net8.0

    • No dependencies.
  • net9.0

    • No dependencies.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on Medino:

Package Downloads
Medino.Extensions.DependencyInjection

Microsoft.Extensions.DependencyInjection integration for Medino mediator

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
3.0.2 615 11/12/2025
3.0.1 286 11/12/2025
3.0.0 308 11/11/2025
2.0.7 1,982 10/21/2025
2.0.1 200 9/30/2025