Unity.Microsoft.DependencyInjection
2.0.2
Unity for Microsoft Dependency Injection framework.
There is a newer version of this package available.
See the version list below for details.
See the version list below for details.
Install-Package Unity.Microsoft.DependencyInjection -Version 2.0.2
dotnet add package Unity.Microsoft.DependencyInjection --version 2.0.2
<PackageReference Include="Unity.Microsoft.DependencyInjection" Version="2.0.2" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Unity.Microsoft.DependencyInjection --version 2.0.2
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Unity.Microsoft.DependencyInjection, 2.0.2"
#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 Unity.Microsoft.DependencyInjection as a Cake Addin
#addin nuget:?package=Unity.Microsoft.DependencyInjection&version=2.0.2
// Install Unity.Microsoft.DependencyInjection as a Cake Tool
#tool nuget:?package=Unity.Microsoft.DependencyInjection&version=2.0.2
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
Get Started
- Reference the
Unity.Microsoft.DependencyInjection
package from NuGet.
Install-Package Unity.Microsoft.DependencyInjection
Registration:
- In the
WebHostBuilder
addUseUnityServiceProvider(...)
method
public static IWebHost BuildWebHost(string[] args) =>
WebHost.CreateDefaultBuilder(args)
.UseUnityServiceProvider() <---- Add this line
.UseStartup<Startup>()
.Build();
- In case Unity container configured via application configuration or by convention this container could be used to initialize service provider.
public static IWebHost BuildWebHost(string[] args) =>
WebHost.CreateDefaultBuilder(args)
.UseUnityServiceProvider(_container) <---- or add this line
.UseStartup<Startup>()
.Build();
- Add optional method to your
Startup
class
public void ConfigureContainer(IUnityContainer container)
{
// Could be used to register more types
container.RegisterType<IMyService, MyService>();
}
Examples
For example of using Unity with Core 2.0 Web application follow this link
Get Started
- Reference the
Unity.Microsoft.DependencyInjection
package from NuGet.
Install-Package Unity.Microsoft.DependencyInjection
Registration:
- In the
WebHostBuilder
addUseUnityServiceProvider(...)
method
public static IWebHost BuildWebHost(string[] args) =>
WebHost.CreateDefaultBuilder(args)
.UseUnityServiceProvider() <---- Add this line
.UseStartup<Startup>()
.Build();
- In case Unity container configured via application configuration or by convention this container could be used to initialize service provider.
public static IWebHost BuildWebHost(string[] args) =>
WebHost.CreateDefaultBuilder(args)
.UseUnityServiceProvider(_container) <---- or add this line
.UseStartup<Startup>()
.Build();
- Add optional method to your
Startup
class
public void ConfigureContainer(IUnityContainer container)
{
// Could be used to register more types
container.RegisterType<IMyService, MyService>();
}
Examples
For example of using Unity with Core 2.0 Web application follow this link
Release Notes
This package is distributed as .NET Standard 2.0 package. It is compatible with Microsoft.Extensions.DependencyInjection v2 specification.
Dependencies
-
.NETStandard 2.0
- Microsoft.AspNetCore.Hosting.Abstractions (>= 2.0.1)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 2.0.0)
- Unity.Abstractions (>= 3.1.2)
- Unity.Container (>= 5.5.5)
Used By
NuGet packages (7)
Showing the top 5 NuGet packages that depend on Unity.Microsoft.DependencyInjection:
Package | Downloads |
---|---|
UnityAddon.Core
Package Description
|
|
IFramework.DependencyInjection.Unity
Supports netcore standard2.0
|
|
PSFiddle.Common
Package Description
|
|
S-Innovations.ServiceFabric.RegistrationMiddleware.AspNetCore
Package Description
|
|
Acv2.SharedKernel.Infraestructure
Package Description
|
GitHub repositories (2)
Showing the top 2 popular GitHub repositories that depend on Unity.Microsoft.DependencyInjection:
Repository | Stars |
---|---|
dotnet/runtime
.NET is a cross-platform runtime for cloud, mobile, desktop, and IoT apps.
|
|
danielpalme/IocPerformance
Performance comparison of .NET IoC containers
|
Version History
Version | Downloads | Last updated |
---|---|---|
5.11.5 | 373,513 | 12/12/2019 |
5.11.4 | 6,653 | 12/8/2019 |
5.11.3 | 1,322 | 12/8/2019 |
5.11.2 | 508 | 12/8/2019 |
5.11.1 | 7,033 | 12/6/2019 |
5.11.0 | 1,045 | 12/6/2019 |
5.10.2 | 224,767 | 4/10/2019 |
5.10.1 | 37,260 | 3/23/2019 |
5.10.0 | 52,034 | 3/18/2019 |
5.9.2 | 3,338 | 3/2/2019 |
5.9.1 | 10,438 | 2/6/2019 |
5.9.0 | 7,251 | 1/23/2019 |
2.1.3 | 178,055 | 12/9/2018 |
2.1.2.1 | 9,895 | 12/4/2018 |
2.1.1 | 31,341 | 8/29/2018 |
2.1.0 | 2,221 | 8/25/2018 |
2.0.12 | 545 | 8/24/2018 |
2.0.11 | 492 | 8/22/2018 |
2.0.10 | 175,225 | 3/27/2018 |
2.0.9 | 2,812 | 3/4/2018 |
2.0.8 | 842 | 3/4/2018 |
2.0.7 | 585 | 3/1/2018 |
2.0.6 | 1,727 | 1/29/2018 |
2.0.5 | 644 | 1/23/2018 |
2.0.4 | 604 | 1/23/2018 |
2.0.3 | 558 | 1/23/2018 |
2.0.2 | 802 | 1/11/2018 |
2.0.1 | 626 | 1/10/2018 |
2.0.0 | 760 | 1/9/2018 |
1.0.1 | 4,536 | 1/5/2018 |
1.0.0 | 785 | 1/4/2018 |