From the course: ASP.NET MVC: Building for Productivity and Maintainability

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Managing dependencies with dependency injection

Managing dependencies with dependency injection

From the course: ASP.NET MVC: Building for Productivity and Maintainability

Start my 1-month free trial

Managing dependencies with dependency injection

- [Instructor] As far as I'm concerned, there is no better way to maintain a strong separation of concerns then with dependency injection. And adding a dependency injection framework to your ASP.NET MVC application is pretty straightforward. Mostly because the ASP.NET MVC framework itself already employs dependency injection internally. All you need to do is install and configure your dependency injection container of choice and then tell ASP.NET MVC to use it when constructing objects like controllers and action filters. Now there are a variety of choices of dependency injection frameworks in .NET, and quite frankly they're all pretty much the same, so it really doesn't matter which one you pick. In this video I'll be showing you how to use Autofac, because it's arguably the most popular and it also happens to be my personal favorite. But feel free to do your own research and pick whichever framework works best for you. Your experience probably won't be much different with other…

Contents