Chapter 10. Service configuration with dependency injection

This chapter covers

  • Understanding the benefits of dependency injection
  • How ASP.NET Core uses dependency injection
  • Configuring your services to work with dependency injection
  • Choosing the correct lifetime for your services

In part 1 of this book, you saw the bare bones of how to build applications with ASP.NET Core. You learned how to compose middleware to create your application and how to use the MVC pattern to build traditional web applications and web APIs. This gave you the tools to start building simple applications.

In this chapter, you’ll see how to use dependency injection (DI) in your ASP.NET Core applications. DI is a design pattern that helps you develop loosely coupled ...

Get ASP.NET Core in Action now with the O’Reilly learning platform.

O’Reilly members experience live online training, plus books, videos, and digital content from nearly 200 publishers.