MediatR.NotificationHandling.Extensions 1.0.0

Install-Package MediatR.NotificationHandling.Extensions -Version 1.0.0
dotnet add package MediatR.NotificationHandling.Extensions --version 1.0.0
<PackageReference Include="MediatR.NotificationHandling.Extensions" Version="1.0.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add MediatR.NotificationHandling.Extensions --version 1.0.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: MediatR.NotificationHandling.Extensions, 1.0.0"
#r directive can be used in F# Interactive, C# scripting and .NET Interactive. Copy this into the interactive tool or source code of the script to reference the package.
// Install MediatR.NotificationHandling.Extensions as a Cake Addin
#addin nuget:?package=MediatR.NotificationHandling.Extensions&version=1.0.0

// Install MediatR.NotificationHandling.Extensions as a Cake Tool
#tool nuget:?package=MediatR.NotificationHandling.Extensions&version=1.0.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.


Separate dependency scope notification handling extension for MediateR using with Microsoft.Extensions.DependencyInjection. By default MediatR handles every notification in just on IServiceScope, The one IMediatR resolved with.

By using this extension every notification will be handled in separate IServiceScope thus there will be no resource or thread conflicts and every dependencies injected in the hierarchy of INotificationHandler'1 will be disposed after Handle method called; whether successful or not.

Extensions tested with modified MediatR and MediatR.Extensions.Microsoft.DependencyInjection tests to ensure compatibility and performability.

You can use extension in two ways. in every cases there are three pre conditions: 1- IMediatR must be registered with scoped lifestyle.

services.AddMediatR(cfg => cfg.AsScoped(), typeof(Startup));

2- Microsoft runtime implemetation of IServiceProvider must be IServiceScope too. (This condition depends on microsoft .net team) 3- Extension methods must be called after all notification handlers registered.

Configuring MediatR immediately after AddMediatR registered handlers:

	.AddMediatR(cfg => cfg.AsScoped(), typeof(Startup))

Configuring MediatR after AddMediatR and some relevant registration like other handlers:

services.AddMediatR(cfg => cfg.AsScoped(), typeof(Startup));



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 3,600 6/9/2021