cboiam / ImplementationDiscovery

Discover your implementations automatically

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ImplementationDiscovery

Build Quality Gate Status

Implementation Discovery is a helper library that extends the options of Microsoft.Extensions.DependencyInjection with functions for discovering the implementations of your service and injecting it.

Example with simple interface

public void ConfigureServices(IServiceCollection services)
{
   //... other services
   service.MapImplementationsOf<IExampleInterface>().AsScoped();
}

Example with generic interface

public void ConfigureServices(IServiceCollection services)
{
   //... other services
   service.MapImplementationsOf(typeof(IExampleInterface<,>)).AsTransient();
}

You can inject them with AsTransient(), AsScoped() or AsSingleton().

About

Discover your implementations automatically


Languages

Language:C# 100.0%