This chapter covers dealing with dependency injection in Web API services. You will learn how to do the following:
- Inject dependencies into Web API controllers, filters, message handlers, and formatters (Recipe 9-1 and 9-4)
- Add support for the common DI containers (Recipe 9-2)
- Deal with per-request dependency scope (Recipe 9-3)
- Write a custom dependency resolver for ASP.NET Web API applications (Recipe 9-5)
9-1. Inject Dependencies into ASP.NET Web API Controllers
You would like to inject, through the constructor, dependencies into your ASP.NET Web API controllers.
ASP.NET Web API provides two primary ...