An addictive Inversion of Control container for .NET
open sourceMITfree
Autofac is an inversion of control (dependency injection) container for .NET and ASP.NET Core. You register components with lambdas, types or ready-made instances, or scan assemblies for them, and Autofac builds each object with its constructor parameters filled in, with property and method injection too. It manages lifetimes and scopes, groups registrations into modules, and plugs into ASP.NET Core's built-in DI through Autofac.Extensions.DependencyInjection; Autofac.Extras.DynamicProxy adds interceptors.
Problems it solves
- wire up dependencies in a growing .NET app without newing everything by hand
- register all my repository classes automatically by naming convention in C#
- replace ASP.NET Core's built-in DI with a container that has modules and assembly scanning
Features
- dependency injection container for .NET and ASP.NET Core
- register by lambda, type, instance or assembly scanning
- constructor, property and method injection
- lifetime scopes and modules
- plugs into ASP.NET Core's built-in DI
- interceptors through DynamicProxy
Alternatives
The same job
These do what Autofac does.
- Scrutor Assembly scanning and decoration extensions for Microsoft.Extensions.DependencyInjection
- Simple Injector An easy, fast dependency injection library for .NET with strong diagnostics
