Axion.Extensions.DependencyInjection 9.0.0-rc.2.24473.5.0

This is a prerelease version of Axion.Extensions.DependencyInjection.
There is a newer version of this package available.
See the version list below for details.
dotnet add package Axion.Extensions.DependencyInjection --version 9.0.0-rc.2.24473.5.0                
NuGet\Install-Package Axion.Extensions.DependencyInjection -Version 9.0.0-rc.2.24473.5.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="Axion.Extensions.DependencyInjection" Version="9.0.0-rc.2.24473.5.0" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Axion.Extensions.DependencyInjection --version 9.0.0-rc.2.24473.5.0                
#r "nuget: Axion.Extensions.DependencyInjection, 9.0.0-rc.2.24473.5.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 Axion.Extensions.DependencyInjection as a Cake Addin
#addin nuget:?package=Axion.Extensions.DependencyInjection&version=9.0.0-rc.2.24473.5.0&prerelease

// Install Axion.Extensions.DependencyInjection as a Cake Tool
#tool nuget:?package=Axion.Extensions.DependencyInjection&version=9.0.0-rc.2.24473.5.0&prerelease                

Axion.Extensions.DependencyInjection

Helpers for Dependency Inection.

Using any delegate to create a service instance

There are cases when one DI service is dependent on some other so it's iniitialization requires getting each service from a container.

services.AddTransient<Service1>();

services.AddTransient<Service2>();

services.AddTransient<Service3>(provider => new DependentService(provider.GetRequiredService<Service1>(), provider.GetService<Service2>()));

Last line can be simplified with this nuget as:

services.AddTransient<Service3>((Service1 s1, Service2? s2) => new DependentService(s1, s2));

nullable notation is fully supported.

Keyed services are supported.

Executing a delegate in a service provider context

Instead of typing:


var s1 = provider.GetRequiredService<Service1>();
var s2 = provider.GetService<Service2>();
var s3 = provider.GetRequiredKeyedService<Service3>("key");

var a = DoSoething(s1, s2, s3);

with the helper can e rewritted as:

var a = provider.Execute((Service1 s1, Service2? s2, [FromKeyedServices("key")] Service3 s3) => DoSoething(s1, s2, s3));
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 is compatible.  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.  net9.0 is compatible. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 is compatible. 
.NET Framework net461 was computed.  net462 is compatible.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  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
9.0.0 149 11/12/2024
9.0.0-rc.2.24473.5.0 60 10/12/2024
9.0.0-rc.1.24431.7.0 73 9/15/2024
9.0.0-preview.7.24405.7.0 68 8/17/2024
9.0.0-preview.6.24327.7.1 34 7/31/2024
9.0.0-preview.6.24327.7.0 58 7/20/2024
8.0.1 394 7/31/2024
8.0.0 94 7/20/2024
6.0.1 78 7/31/2024
6.0.0 89 7/20/2024