MediatR.SimpleInjector.FlowingScope 1.1.0

dotnet add package MediatR.SimpleInjector.FlowingScope --version 1.1.0                
NuGet\Install-Package MediatR.SimpleInjector.FlowingScope -Version 1.1.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="MediatR.SimpleInjector.FlowingScope" Version="1.1.0" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add MediatR.SimpleInjector.FlowingScope --version 1.1.0                
#r "nuget: MediatR.SimpleInjector.FlowingScope, 1.1.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.
// Install MediatR.SimpleInjector.FlowingScope as a Cake Addin
#addin nuget:?package=MediatR.SimpleInjector.FlowingScope&version=1.1.0

// Install MediatR.SimpleInjector.FlowingScope as a Cake Tool
#tool nuget:?package=MediatR.SimpleInjector.FlowingScope&version=1.1.0                

MediatR.SimpleInjector.FlowingScope

Nuget Nuget GitHub

Adds support to use MediatR with SimpleInjector's ScopedLifestyle.Flowing.

📜Samples

  1. MediatRSimpleInjectorLab - Minimal getting started project.

🚀Getting Started

Register MediatR

You need register everything by yourself. There is no helper class for that, because some configuration is up to the user. Example:

var assemblies = AppDomain.CurrentDomain.GetAssemblies();

var container = new Container();
container.Options.DefaultScopedLifestyle = ScopedLifestyle.Flowing;
container.Register<IMediator, MediatRScoped>(Lifestyle.Scoped);
container.Register<ISender, MediatRScoped>(Lifestyle.Scoped);
container.Register<IPublisher, MediatRScoped>(Lifestyle.Scoped);

container.Register(typeof(IRequestHandler<,>), assemblies);

container.RegisterHandlers(typeof(INotificationHandler<>), assemblies);
container.RegisterHandlers(typeof(IRequestExceptionAction<,>), assemblies);
container.RegisterHandlers(typeof(IRequestExceptionHandler<,,>), assemblies);
container.RegisterHandlers(typeof(IStreamRequestHandler<,>), assemblies);

//Pipeline
container.Collection.Register(typeof(IPipelineBehavior<,>), new[]
{
	typeof(RequestExceptionProcessorBehaviorScoped<,>),
	typeof(RequestExceptionActionProcessorBehaviorScoped<,>),
	typeof(RequestPreProcessorBehavior<,>),
	typeof(RequestPostProcessorBehavior<,>),
}, Lifestyle.Scoped);
container.Collection.Register(typeof(IRequestPreProcessor<>), new[] { typeof(EmptyRequestPreProcessor<>) });
container.Collection.Register(typeof(IRequestPostProcessor<,>), new[] { typeof(EmptyRequestPostProcessor<,>) });

Resolving Scope

using Scope scope = new Scope(container);
// You will have to resolve directly from the scope.
var instance = scope.GetInstance<ScopedInstance>();

For more details refer to SimpleInjector documentation

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net6.0-windows7.0 is compatible.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
.NET Core netcoreapp3.1 is compatible. 
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.1.0 435 7/20/2022
1.0.0 413 6/22/2022