RMediator.DependencyInjection
1.0.0
dotnet add package RMediator.DependencyInjection --version 1.0.0
NuGet\Install-Package RMediator.DependencyInjection -Version 1.0.0
<PackageReference Include="RMediator.DependencyInjection" Version="1.0.0" />
<PackageVersion Include="RMediator.DependencyInjection" Version="1.0.0" />
<PackageReference Include="RMediator.DependencyInjection" />
paket add RMediator.DependencyInjection --version 1.0.0
#r "nuget: RMediator.DependencyInjection, 1.0.0"
#:package RMediator.DependencyInjection@1.0.0
#addin nuget:?package=RMediator.DependencyInjection&version=1.0.0
#tool nuget:?package=RMediator.DependencyInjection&version=1.0.0
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.DependencyInjection
The all-in-one package:
dotnet add package RMediator.DependencyInjection
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 / IDispatchCommandto inject in order to dispatch correspondingIQuery<TResponse> / ICommand / ICommand<TResult>IHandleQuery<TQuery, TResponse> / IHandleCommand<TCommand> / IHandleCommand<TCommand, TResult>to define the corresponding handlersIPublishDomainEventto inject in order to publishIDomainEventIListenToDomainEventto handle synchronously publishedIDomainEvent.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 | Versions 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. |
-
net10.0
- Microsoft.Extensions.DependencyInjection (>= 10.0.10)
- RMediator.Abstractions (>= 1.0.0 && < 2.0.0)
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 | 240 | 8/5/2026 |