MediatRaptor 1.0.0

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

๐Ÿฆ– MediatRaptor


MediatRaptor is a lightweight and extensible implementation of the Mediator pattern with built-in support for CQRS (Command Query Responsibility Segregation). It is designed as a modern, minimal alternative to heavier mediator libraries, providing developers with a clean and structured way to implement Commands, Queries, Notifications, and Handlers.

The library emphasizes:

  • ๐Ÿ“ฆ Lightweight โ€“ No unnecessary dependencies, minimal overhead.
  • ๐Ÿฆ– Mediator-first โ€“ Core focus on mediator pattern with request/response pipelines.
  • โšก CQRS-ready โ€“ First-class support for commands and queries.
  • ๐Ÿ› ๏ธ Extensible โ€“ Add behaviors like logging, validation, or caching with pipeline decorators.
  • โœ… Test-friendly โ€“ Promotes separation of concerns and easy testing of handlers.

MediatRaptor is a lightweight implementation of the Mediator pattern with built-in support for CQRS (Command/Query Responsibility Segregation).
Inspired by MediatR, but built to be minimal, extensible, and fun.


โœจ Features

  • ๐Ÿฆ– Clean Mediator abstraction (IMediator)
  • โšก CQRS-ready (Commands, Queries, Notifications)
  • ๐Ÿ”— Pipeline behaviors (logging, validation, caching, etc.)
  • ๐Ÿ› ๏ธ No external dependencies โ€“ minimal and fast
  • โœ… Easy to test, extend, and integrate

๐Ÿš€ Getting Started

1. Define a Command

public record CreateUserCommand(string Username, string Email) : ICommand<Guid>;

2. Create a Handler

public class CreateUserHandler : ICommandHandler<CreateUserCommand, Guid>
{
    public Task<Guid> Handle(CreateUserCommand command, CancellationToken ct)
    {
        // business logic
        return Task.FromResult(Guid.NewGuid());
    }
}

3. Use the Mediator

var mediator = new MediatorRaptor(cfg =>
{
    cfg.RegisterHandlers(typeof(CreateUserHandler).Assembly);
});

var userId = await mediator.Send(new CreateUserCommand("hasan", "test@example.com"));

๐Ÿงช Examples

Check the examples/ folder for runnable projects:

  • ConsoleApp โ€“ basic CQRS setup with commands, queries, and handlers

๐Ÿ“œ License

MIT โ€“ free to use, modify, and share.

Product Compatible and additional computed target framework versions.
.NET 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 was computed.  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 228 9/10/2025