© The Author(s), under exclusive license to APress Media, LLC, part of Springer Nature 2022
A. FreemanPro ASP.NET Core 6https://doi.org/10.1007/978-1-4842-7957-1_14

14. Using Dependency Injection

Adam Freeman1  
(1)
London, UK
 

Services are objects that are shared between middleware components and endpoints. There are no restrictions on the features that services can provide, but they are usually used for tasks that are needed in multiple parts of the application, such as logging or database access.

The ASP.NET Core dependency injection feature is used to create and consume services. This is a topic that causes confusion and can be difficult to understand. In this chapter, I describe the problems that dependency injection solves and explain how dependency ...

Get Pro ASP.NET Core 6: Develop Cloud-Ready Web Applications Using MVC, Blazor, and Razor Pages 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.