/gas

Generic Assembly Scanner

Primary LanguageC#MIT LicenseMIT

NuGet Build Status GitHub license

Generic Assembly Scanner (aka Gas)

This simple library implements assembly scanning in a generic and reusable way.

Usage Examples

The generic nature of this library makes it suitable for multiple purposes, here are just a few examples.

.NET Core DI

using Gas;

public class Startup
{
    public void ConfigureServices(IServiceCollection services)
    {
        AssemblyScanner
            .Scan(Assembly.GetExecutingAssembly())
            .ForEachConcreteClassImplementing<IService>()
                .ForEachImplementedInterface()
                .Do((classType, interfaceType) => 
                    services.AddScoped(interfaceType, classType))
            .ForEachConcreteClassImplementing<ITextParser>()
                .Do(t => services.AddScoped(typeof(ITextParser), t));
    }
}