Skip to content
/ Scrutor Public
forked from khellang/Scrutor

Assembly scanning extensions for Microsoft.Extensions.DependencyInjection

License

Notifications You must be signed in to change notification settings

Kharos/Scrutor

 
 

Repository files navigation

Scrutor Build status

Scrutor - I search or examine thoroughly; I probe, investigate or scrutinize
From scrūta, as the original sense of the verb was to search through trash. - https://en.wiktionary.org/wiki/scrutor

Assembly scanning extensions for Microsoft.Extensions.DependencyInjection

Installation

Install the Scrutor NuGet Package.

Usage

The library adds a single extension method, Scan, to IServiceCollection. This is the entry point to set up your assembly scanning.

Example

var collection = new ServiceCollection();

collection.Scan(scan => scan
    .FromAssemblyOf<ITransientService>()
        .AddClasses(classes => classes.AssignableTo<ITransientService>())
            .AsImplementedInterfaces()
            .WithTransientLifetime()
        .AddClasses(classes => classes.AssignableTo<IScopedService>())
            .As<IScopedService>()
            .WithScopedLifetime());

About

Assembly scanning extensions for Microsoft.Extensions.DependencyInjection

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • C# 93.6%
  • PowerShell 6.4%