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
From the course: ASP.NET MVC: Building for Productivity and Maintainability
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…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
(Locked)
Enabling view compilation to detect errors at build time3m 15s
-
(Locked)
Reducing namespace references with global imports1m 58s
-
(Locked)
Customizing routes with attribute routing5m 10s
-
(Locked)
Reusing the same view for server-side and client-side rendering4m 48s
-
(Locked)
Better error logging with ELMAH5m 47s
-
(Locked)
Managing dependencies with dependency injection5m 53s
-
(Locked)
-
-
-
-
-
-