ASP.NET Core Scrutor extension for automatic registration of classes inherited from IScopedLifetime, ISelfScopedLifetime, ITransientLifetime, ISelfTransientLifetime, ISingletonLifetime, ISelfSingletonLifetime
Build server | Platform | Status |
---|---|---|
Azure CI Pipelines | All | |
Github Actions | All | |
Travis CI | Linux |
Install the Scrutor.AspNetCore NuGet Package.
Install-Package Scrutor.AspNetCore
dotnet add package Scrutor.AspNetCore
public void ConfigureServices(IServiceCollection services)
{
//add to the end of the method
services.AddAdvancedDependencyInjection();
}
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
{
//add to the end of the method
app.UseAdvancedDependencyInjection();
}
//usage without constructor classes
var service = ServiceLocator.Context.GetService<MyClass>();