From the course: Learning ASP.NET Core MVC
Unlock the full course today
Join today to access over 22,600 courses taught by industry experts or purchase this course individually.
Increase maintainablility with dependency injection
From the course: Learning ASP.NET Core MVC
Increase maintainablility with dependency injection
- [Instructor] One of the tenets that drives the ASP.NET Core's framework design is a focus on being able to create applications composed of lightweight and modular components that each do one thing well. One of the main ways it does this is through built-in support for dependency injection, a development pattern which encourages loose coupling between components. To understand the value of dependency injection, let's use the example of the configuration settings that I introduced earlier. In its current state, this code is very tightly coupled to the configuration API since it has to know everything about where these configuration values come from and how to read them from the configuration object. However, all this method really needs is a flag to tell it whether or not to show that developer exception page. Why should it care that the value from this flag comes from an environment variable or a JSON file or even a configuration setting at all? What if this method depended on a…
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
-
-
-
Building blocks of ASP.NET Core applications5m 54s
-
Create a new project4m 44s
-
(Locked)
Respond to HTTP requests5m 32s
-
Serving static files2m 18s
-
(Locked)
Error handling and diagnostics4m 55s
-
(Locked)
Use custom configuration4m 21s
-
(Locked)
Populate configuration settings3m 9s
-
(Locked)
Increase maintainablility with dependency injection5m 53s
-
-
-
-
-
-
-