![]() |
VOOZH | about |
dotnet add package Rougamo.Extensions.DependencyInjection.Microsoft --version 10.0.0
NuGet\Install-Package Rougamo.Extensions.DependencyInjection.Microsoft -Version 10.0.0
<PackageReference Include="Rougamo.Extensions.DependencyInjection.Microsoft" Version="10.0.0" />
<PackageVersion Include="Rougamo.Extensions.DependencyInjection.Microsoft" Version="10.0.0" />Directory.Packages.props
<PackageReference Include="Rougamo.Extensions.DependencyInjection.Microsoft" />Project file
paket add Rougamo.Extensions.DependencyInjection.Microsoft --version 10.0.0
#r "nuget: Rougamo.Extensions.DependencyInjection.Microsoft, 10.0.0"
#:package Rougamo.Extensions.DependencyInjection.Microsoft@10.0.0
#addin nuget:?package=Rougamo.Extensions.DependencyInjection.Microsoft&version=10.0.0Install as a Cake Addin
#tool nuget:?package=Rougamo.Extensions.DependencyInjection.Microsoft&version=10.0.0Install as a Cake Tool
| English
Rougamo.DI provides a set of IoC/DI extensions for Rougamo that enhance the IoC/DI interaction experience when using Rougamo.
| Package Name | Description |
|---|---|
| Rougamo.Extensions.DependencyInjection.Microsoft | Uses the official DependencyInjection and integrates with HttpContext to return the correct scoped IServiceProvider |
| Rougamo.Extensions.DependencyInjection.Autofac.AspNetCore | Uses Autofac and integrates with HttpContext to return the correct scoped ILifetimeScope |
| Rougamo.Extensions.DependencyInjection.Autofac | Uses Autofac, suitable for non-AspNetCore projects |
| Rougamo.Extensions.DependencyInjection.Abstractions | The base abstraction package for all other packages |
| Rougamo.Extensions.DependencyInjection.AspNetCore.Abstractions | The base abstraction package for all AspNetCore-related packages |
All version numbers follow the Semantic Versioning (SemVer) format
1.0.0 and increase incrementally:
Rougamo.Extensions.DependencyInjection.AbstractionsRougamo.Extensions.DependencyInjection.AspNetCore.AbstractionsMicrosoft.Extensions.*):
Rougamo.Extensions.DependencyInjection.MicrosoftAutofac package:
Rougamo.Extensions.DependencyInjection.Autofac.AspNetCoreRougamo.Extensions.DependencyInjection.AutofacRougamo.Extensions.DependencyInjection.Microsoft depends on DependencyInjection.StaticAccessor. The initialization of the startup project is completed via DependencyInjection.StaticAccessor. For different types of project initialization, please refer to DependencyInjection.StaticAccessor.
For the startup project, reference DependencyInjection.StaticAccessor.Hosting:
dotnet add package DependencyInjection.StaticAccessor.Hosting
For non-startup projects, reference Rougamo.Extensions.DependencyInjection.Microsoft:
dotnet add package Rougamo.Extensions.DependencyInjection.Microsoft
// Register Rougamo (Note: If you're not using IoC/DI functionality, Rougamo does not require registration by default)
public static void Main(string[] args)
{
// 1. Initialization. This example uses a generic host; for other project types, please refer to the readme of the DependencyInjection.StaticAccessor project.
var builder = Host.CreateDefaultBuilder();
builder.UsePinnedScopeServiceProvider(); // Initialization completed with this single step
var host = builder.Build();
host.Run();
}
// Retrieve and use an IServiceProvider instance in an aspect type
public class TestAttribute : MoAttribute
{
public override void OnEntry(MethodContext context)
{
var xxx = context.GetService<IXxx>();
}
}
// Register Rougamo (Note: Rougamo does not require registration if you do not need IoC/DI features)
public static void Main(string[] args)
{
var builder = WebApplication.CreateBuilder(args);
builder.Host
.UseServiceProviderFactory(new AutofacServiceProviderFactory())
.ConfigureContainer<ContainerBuilder>(builder =>
{
builder.RegisterRougamoAspNetCore();
});
// Registering IHttpContextAccessor is also required
builder.Services.AddHttpContextAccessor();
}
// Accessing ILifetimeScope in an aspect
public class TestAttribute : MoAttribute
{
public override void OnEntry(MethodContext context)
{
// Use the extension method GetAutofacCurrentScope to obtain the ILifetimeScope instance
var scope = context.GetAutofacCurrentScope();
// Utilize ILifetimeScope
var xxx = scope.Resolve<IXxx>();
}
}
// Register Rougamo (Note: Rougamo does not require registration if you do not need IoC/DI features)
public static void Main(string[] args)
{
var builder = Host.CreateDefaultBuilder();
builder
.UseServiceProviderFactory(new AutofacServiceProviderFactory())
.ConfigureContainer<ContainerBuilder>(builder =>
{
builder.RegisterRougamo();
});
}
// Accessing ILifetimeScope in an aspect
public class TestAttribute : MoAttribute
{
public override void OnEntry(MethodContext context)
{
// Use the extension method GetAutofacCurrentScope to obtain the ILifetimeScope instance
var scope = context.GetAutofacCurrentScope();
// Utilize ILifetimeScope
var xxx = scope.Resolve<IXxx>();
}
}
If your project is an older WebForm, WinForm, WPF, or similar project that does not use the Microsoft.Extensions.* packages, you can directly call the RegisterRougamo extension method when initializing the ContainerBuilder.
var builder = new ContainerBuilder();
builder.RegisterRougamo();
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 net5.0 was computed. net5.0-windows net5.0-windows was computed. net6.0 net6.0 was computed. net6.0-android net6.0-android was computed. net6.0-ios net6.0-ios was computed. net6.0-maccatalyst net6.0-maccatalyst was computed. net6.0-macos net6.0-macos was computed. net6.0-tvos net6.0-tvos was computed. net6.0-windows net6.0-windows was computed. net7.0 net7.0 was computed. net7.0-android net7.0-android was computed. net7.0-ios net7.0-ios was computed. net7.0-maccatalyst net7.0-maccatalyst was computed. net7.0-macos net7.0-macos was computed. net7.0-tvos net7.0-tvos was computed. net7.0-windows net7.0-windows was computed. net8.0 net8.0 was computed. net8.0-android net8.0-android was computed. net8.0-browser net8.0-browser was computed. net8.0-ios net8.0-ios was computed. net8.0-maccatalyst net8.0-maccatalyst was computed. net8.0-macos net8.0-macos was computed. net8.0-tvos net8.0-tvos was computed. net8.0-windows net8.0-windows was computed. net9.0 net9.0 was computed. net9.0-android net9.0-android was computed. net9.0-browser net9.0-browser was computed. net9.0-ios net9.0-ios was computed. net9.0-maccatalyst net9.0-maccatalyst was computed. net9.0-macos net9.0-macos was computed. net9.0-tvos net9.0-tvos was computed. net9.0-windows net9.0-windows was computed. net10.0 net10.0 was computed. net10.0-android net10.0-android was computed. net10.0-browser net10.0-browser was computed. net10.0-ios net10.0-ios was computed. net10.0-maccatalyst net10.0-maccatalyst was computed. net10.0-macos net10.0-macos was computed. net10.0-tvos net10.0-tvos was computed. net10.0-windows net10.0-windows was computed. |
| .NET Core | netcoreapp2.0 netcoreapp2.0 was computed. netcoreapp2.1 netcoreapp2.1 was computed. netcoreapp2.2 netcoreapp2.2 was computed. netcoreapp3.0 netcoreapp3.0 was computed. netcoreapp3.1 netcoreapp3.1 was computed. |
| .NET Standard | netstandard2.0 netstandard2.0 is compatible. netstandard2.1 netstandard2.1 was computed. |
| .NET Framework | net461 net461 was computed. net462 net462 was computed. net463 net463 was computed. net47 net47 was computed. net471 net471 was computed. net472 net472 was computed. net48 net48 was computed. net481 net481 was computed. |
| MonoAndroid | monoandroid monoandroid was computed. |
| MonoMac | monomac monomac was computed. |
| MonoTouch | monotouch monotouch was computed. |
| Tizen | tizen40 tizen40 was computed. tizen60 tizen60 was computed. |
| Xamarin.iOS | xamarinios xamarinios was computed. |
| Xamarin.Mac | xamarinmac xamarinmac was computed. |
| Xamarin.TVOS | xamarintvos xamarintvos was computed. |
| Xamarin.WatchOS | xamarinwatchos xamarinwatchos was computed. |
Showing the top 5 NuGet packages that depend on Rougamo.Extensions.DependencyInjection.Microsoft:
| Package | Downloads |
|---|---|
|
HZY.Framework.Aop
Aop 静态织入,AopMoAttribute拦截特性标记、TimeAttribute耗时拦截特性标记 |
|
|
Galosys.Foundation.Rougamo
Galosys.Foundation快速开发库 |
|
|
HQ.Aop
Aop 静态织入,AopMoAttribute拦截特性标记、TimeAttribute耗时拦截特性标记 |
|
|
Galosoft.IaaS.Rougamo
Galosoft.IaaS快速开发库 |
|
|
Li.CacheExtensions
Package Description |
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 10.0.0 | 762 | 11/13/2025 |
| 10.0.0-preview-1758426744 | 198 | 9/21/2025 |
| 9.0.0 | 7,174 | 12/14/2024 |
| 9.0.0-preview-1733591092 | 1,479 | 12/7/2024 |
| 8.0.1 | 1,518 | 9/18/2024 |
| 8.0.0-preview-1726686900 | 292 | 9/18/2024 |
| 7.0.1 | 217 | 9/18/2024 |
| 7.0.0-preview-1726686520 | 205 | 9/18/2024 |
| 6.0.1 | 236 | 9/18/2024 |
| 6.0.0-preview-1726686074 | 200 | 9/18/2024 |
| 3.0.1 | 213 | 9/18/2024 |
| 3.0.0-preview-1726685652 | 207 | 9/18/2024 |