RMediator.Abstractions 1.0.0

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

RMediator

As the famous MediatR package has turned into commercial, like many other people I propose my lightweight version of what MediatR offered the best over time.

Nothing fancy here, just basic stuff with the key features I've used the most and I still need to use in my different projects.

Install

RMediator

The all-in-one package:

dotnet add package RMediator

RMediator.Abstractions

A no-dependency package only referencing usable interfaces in order to keep core domain as pure and clean as possible:

dotnet add package RMediator.Abstractions

How to use it

Registration

Registration go through Microsoft classic dependency injection via the method below:

services
    .AddMediator(o => o
    .ScanAssemblies(
        typeof(MyClass1).Assembly, 
        typeof(MyClass2).Assembly));

Middlewares can also be referenced in order here:

services
    .AddMediator(o => o
    .AddMiddlewares(
        typeof(MonitorQuery), 
        typeof(CommitAfterCommand)));

The method .AddMediator(options => ...) can be called multiple times during services registration to allow splitted configuration if needed.

Implementation

This package allows to split the mediator pattern into the two core concepts of CQRS: command and query

  • IDispatchQuery / IDispatchCommand to inject in order to dispatch corresponding IQuery<TResponse> / ICommand / ICommand<TResult>
  • IHandleQuery<TQuery, TResponse> / IHandleCommand<TCommand> / IHandleCommand<TCommand, TResult> to define the corresponding handlers
  • IPublishDomainEvent to inject in order to publish IDomainEvent
  • IListenToDomainEvent to handle synchronously published IDomainEvent.
  • IHandleMiddleware<TRequest> / IHandleMiddleware<TRequest, TResponse> to add specific behavior to given commands / queries / domain events.

All of the handlers support inheritance for more flexibility and behavior factorization. Middlewares also support genericity and constraints to fine-tune your pipelines.

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

    • No dependencies.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on RMediator.Abstractions:

Package Downloads
RMediator.DependencyInjection

A simple implementation of the Mediator pattern with commands, queries, events and pipeline handlers.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.0 264 8/5/2026