Bondarukini.Mediator 10.0.0

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

Bondarukini.Mediator

A lightweight, dependency-free implementation of the Mediator pattern for .NET applications.
It allows clear separation between requests and their handlers and supports middleware-like pipeline behaviors.


✨ Features

  • Implements the Mediator pattern without any external dependencies
  • Supports IRequest<TResponse> and IRequestHandler<TRequest, TResponse>
  • Built-in support for Pipeline Behaviors
  • Fully compatible with Bondarukini.Validator
  • Extensible and easy to integrate into any .NET project

πŸš€ Installation

dotnet add package Bondarukini.Mediator

πŸ’‘ Example Usage

1) Define a Request

public class CreateProductCommand : IRequest<Product>
{
    public string Name { get; set; }
    public decimal Price { get; set; }
}

2) Create a Handler

public class CreateProductHandler : IRequestHandler<CreateProductCommand, Product>
{
    public Task<Product> Handle(CreateProductCommand request, CancellationToken cancellationToken)
    {
        var product = new Product { Name = request.Name, Price = request.Price };
        return Task.FromResult(product);
    }
}

3) Send the Request

var mediator = serviceProvider.GetRequiredService<IMediator>();
var result = await mediator.Send(new CreateProductCommand { Name = "Book", Price = 10m });

🧱 Pipeline Behaviors

The mediator supports middleware-style pipeline behaviors, which wrap request handling.
You can use them for validation, transactions, logging, and exception handling.

Example registration:

services.AddTransient(typeof(IPipelineBehavior<,>), typeof(ValidatorBehaviour<,>));
services.AddTransient(typeof(IPipelineBehavior<,>), typeof(TransactionBehaviour<,>));
services.AddTransient(typeof(IPipelineBehavior<,>), typeof(ExceptionBehaviour<,>));

Package Description
Bondarukini.Validator FluentValidation-style rule system
Bondarukini.Mediator.Behaviors Validation, Transaction, and Exception behaviors
Bondarukini.Mediator.DependencyInjection Easy registration of Mediator and Validators in DI

πŸ§‘β€πŸ’» Author

Yurii Bondaruk
Clean, extensible, and minimalistic architecture tools for .NET πŸ‡ΊπŸ‡¦

Product 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.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on Bondarukini.Mediator:

Package Downloads
Bondarukini.Mediator.DependencyInjection

Lightweight Mediator pattern implementation for .NET with no dependencies.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
10.0.0 131 3/11/2026
9.0.0 134 3/11/2026
8.1.0 376 10/6/2025