/Scrutor.AspNetCore

ASP.NET Core Scrutor extension for automatic registration of classes inherited from IScopedLifetime, ISelfScopedLifetime, ITransientLifetime, ISelfTransientLifetime, ISingletonLifetime, ISelfSingletonLifetime

Primary LanguageC#MIT LicenseMIT

Scrutor.AspNetCore

ASP.NET Core Scrutor extension for automatic registration of classes inherited from IScopedLifetime, ISelfScopedLifetime, ITransientLifetime, ISelfTransientLifetime, ISingletonLifetime, ISelfSingletonLifetime

Build Status

Build server Platform Status
Azure CI Pipelines All
Github Actions All
Travis CI Linux

Installation

Install the Scrutor.AspNetCore NuGet Package.

Package Manager Console

Install-Package Scrutor.AspNetCore

.NET Core CLI

dotnet add package Scrutor.AspNetCore

Usage

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>();