From the course: Learning ASP.NET Core MVC
Unlock the full course today
Join today to access over 23,200 courses taught by industry experts.
Use custom configuration
From the course: Learning ASP.NET Core MVC
Use custom configuration
- [Instructor] Earlier I showed you this conditional statement right here on line 25 that determines whether or not to enable the developer diagnostics page. Currently, this conditional setting is driven off a special environment variable that ASP.NET Core looks for as I showed in the previous video. Now there's nothing wrong with this approach to turn things on and off based on whether we're in a development mode or not but personally I like to be able to turn specific features on and off using their own configuration setting. So, in this video, I'll use ASP.NET Core's configuration library to create a configuration setting just for this feature. In fact, ASP.NET Core has already created and populated a configuration object for me. I just need to access it. And the easiest way to access it is to request it in the Startup class's constructor. To do this, I'll first create the constructor and then I'll include a parameter of the type IConfiguration which lives in the…
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
-
-
-
-
-
-
-