JustSaying.Extensions.DependencyInjection.SimpleInjector 7.0.3

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

// Install JustSaying.Extensions.DependencyInjection.SimpleInjector as a Cake Tool
#tool nuget:?package=JustSaying.Extensions.DependencyInjection.SimpleInjector&version=7.0.3

JustSaying.Extensions.DependencyInjection.SimpleInjector

This package provides DI configuration for JustSaying v7 using SimpleInjector. Additionally it provides a middleware which can be used to resolve dependencies within a SimpleInjector async scope.

How to use

// Register all the bits JustSaying needs as its core, and return the builder
var builder = container.AddJustSayingReturnBuilder(
    new AwsConfig(null, null, "eu-west-1", "http://localhost.localstack.cloud:4566"),
    builder =>
    {
        builder.Subscriptions(
            x =>
            {
                x.ForTopic<TestMessage>(
                    cfg =>
                    {
                        cfg.WithMiddlewareConfiguration(m =>
                        {
                            m.UseSimpleInjectorScope();
                            m.UseDefaults<TestMessage>(typeof(TestMessageHandler)); // Add default middleware pipeline
                        });
                    });
            }
        );

        builder.Publications(
            x =>
            {
                x.WithTopic<TestMessage>();
            });
    });

// Register our handlers
container.Register<IHandlerAsync<TestMessage>, TestMessageHandler>(Lifestyle.Scoped);
// ...

// Finally builder the publisher/subscriber pipelines and register IMessagePublisher and IMessageBus to the container
// This is done outside the AddJustSaying extension as we might want to replace/extend these, or not build both.
container.RegisterSingleton(() => builder.BuildPublisher());
container.RegisterSingleton(() => builder.BuildSubscribers());

Additional Info

The SimpleInjector scope middleware should always be first, then additional middlewares can be added after, and when they are resolved they will be resolved within the scope.

This can allow extra middleware to be added for UoW DB transactions etc.

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.  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.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.1 is compatible. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
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
7.0.3 1,605 2/9/2024
7.0.2 94 2/8/2024
7.0.0 372 2/5/2024
0.0.3 88 2/2/2024
0.0.2 139 2/1/2024
0.0.1 76 1/31/2024