Fusonic.Extensions.Mediator
10.0.0
Prefix Reserved
dotnet add package Fusonic.Extensions.Mediator --version 10.0.0
NuGet\Install-Package Fusonic.Extensions.Mediator -Version 10.0.0
<PackageReference Include="Fusonic.Extensions.Mediator" Version="10.0.0" />
<PackageVersion Include="Fusonic.Extensions.Mediator" Version="10.0.0" />
<PackageReference Include="Fusonic.Extensions.Mediator" />
paket add Fusonic.Extensions.Mediator --version 10.0.0
#r "nuget: Fusonic.Extensions.Mediator, 10.0.0"
#:package Fusonic.Extensions.Mediator@10.0.0
#addin nuget:?package=Fusonic.Extensions.Mediator&version=10.0.0
#tool nuget:?package=Fusonic.Extensions.Mediator&version=10.0.0
Mediator
This project contains a simple implementation of the common mediator pattern. The implementation focused on simplifying version 11.1.0 of the MediatR package. The pipelining was removed (SimpleInjector has a powerful built-in decorator feature) and a pure mediator implementation based on SimleInjector remains.
ICommand, IQuery: Use those instead of directly using the IRequest interfaces to clearly distinguish between commands and queries.
OutOfBandAttribute: You can put this on your Handler-class. When used together with the Hangfire-Decorator, the execution of the handler will be queued as a background job automatically.
Registration with SimpleInjector
To register the mediator as well as your customer command/notification-handlers, use the following extension where you can provide all the assemblies you want to scan for handlers.
// When using SimpleInjector
container.RegisterMediator(services, [ typeof(Program).Assembly ]);
Note that SimpleInjector does not come as transient build dependency and must be referenced in the project.
Mediator transaction handling
By default all requests and notifications will run within a TransactionScope.
This feature can be disabled by setting the EnableTransactionalDecorators-property to false:
container.RegisterMediator(services, [ typeof(Program).Assembly ], configure =>
{
EnableTransactionalDecorators = false;
});
Custom IMediator implementation
When using the RegisterMediator method from above, our default DependencyInjectionMediator will be registered.
If you want to use your custom mediator, configure as following:
container.Options.AllowOverridingRegistrations = true;
container.RegisterTransient(typeof(IMediator), typeof(MyCustomMediator));
class MyCustomMediator : IMediator
{
...
}
Registration with Microsoft.Extensions.DependencyInjection and Scrutor
When using the default Microsoft DI container together with Scrutor, you can register the mediator and your handlers as follows:
services.AddTransient<IMediator>(sp => new ServiceProviderMediator(sp));
services.Scan(s => s.FromAssemblyOf<Program>()
.AddClasses(c => c.AssignableToAny(typeof(IRequestHandler<,>), typeof(INotificationHandler<>), typeof(IAsyncEnumerableRequestHandler<,>)))
.AsImplementedInterfaces()
.WithScopedLifetime());
// Optional: Run all requests and notifications within a TransactionScope
services.TryDecorate(typeof(IRequestHandler<,>), typeof(TransactionalRequestHandlerDecorator<,>));
services.TryDecorate(typeof(INotificationHandler<>), typeof(TransactionalNotificationHandlerDecorator<>));
services.AddSingleton<ITransactionScopeHandler, TransactionScopeHandler>();
| 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
- Fusonic.Extensions.Common (>= 10.0.0)
- Microsoft.Extensions.DependencyInjection (>= 10.0.0)
NuGet packages (3)
Showing the top 3 NuGet packages that depend on Fusonic.Extensions.Mediator:
| Package | Downloads |
|---|---|
|
Fusonic.Extensions.Hangfire
Provides Hangfire extensions, especially suited for CQRS development. (Out of band processing). |
|
|
Fusonic.Extensions.AspNetCore
Provides ASP.NET Core extensions (Middelwares, Utilities ...) |
|
|
Fusonic.Extensions.Email
Contains common functionality for rendering email templates using razor engine and sending emails via MailKit. |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 10.0.0 | 502 | 11/25/2025 |
| 10.0.0-rc.2 | 154 | 11/24/2025 |
| 10.0.0-rc.1 | 132 | 9/12/2025 |
| 9.5.4 | 594 | 8/20/2025 |
| 9.5.3 | 656 | 3/28/2025 |
| 9.5.2 | 651 | 1/16/2025 |
| 9.5.0 | 348 | 10/4/2024 |
| 9.4.0 | 404 | 9/23/2024 |
| 9.3.1 | 359 | 9/11/2024 |
| 9.3.0 | 246 | 9/11/2024 |
| 9.2.0 | 256 | 8/8/2024 |
| 9.2.0-rc.3 | 94 | 8/7/2024 |
| 9.2.0-rc.2 | 71 | 8/5/2024 |
| 9.2.0-rc.1 | 89 | 8/1/2024 |
| 9.1.0 | 202 | 7/29/2024 |
| 9.0.0 | 848 | 7/17/2024 |
| 9.0.0-preview.2 | 108 | 6/13/2024 |
| 9.0.0-preview.1 | 160 | 4/5/2024 |