Implementing DI with Autofac

In this recipe, we will use Autofac as a DI container to compose our application's object graph. It is famous, performant, and has a lot of features.

ASP.NET Core has an out-of-the-box DI container. In this chapter, we'll use another DI container-Autofac. Autofac is very well-received by the community.

An inbuilt DI container is very lightweight and doesn't support every feature that full-fledged DI containers support.

Autofac is also very light, but it has almost every feature that you would expect from a complete DI container library.

Get ASP.NET Core MVC 2.0 Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.