Skip to Main Content
ASP.NET Web API 2 Recipes: A Problem Solution Approach
book

ASP.NET Web API 2 Recipes: A Problem Solution Approach

by Filip Wojcieszyn
August 2014
Intermediate to advanced content levelIntermediate to advanced
408 pages
9h 54m
English
Apress
Content preview from ASP.NET Web API 2 Recipes: A Problem Solution Approach

CHAPTER 9

image

Dependency Injection

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

Problem

You would like to inject, through the constructor, dependencies into your ASP.NET Web API controllers.

Solution

ASP.NET Web API provides two primary ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Expert ASP.NET Web API 2 for MVC Developers

Expert ASP.NET Web API 2 for MVC Developers

Adam Freeman
Practical ASP.NET Web API

Practical ASP.NET Web API

Badrinarayanan Lakshmiraghavan
Pro ASP.NET Web API: HTTP Web Services in ASP.NET

Pro ASP.NET Web API: HTTP Web Services in ASP.NET

Tugberk Ugurlu, Alexander Zeitler, Ali Kheyrollahi

Publisher Resources

ISBN: 9781430259817Purchase book