Packaging Configuration Data into Classes
Understand how to encapsulate configuration data in ASP.NET Core by using the options framework. Learn to bind specific configuration sections to C# classes, leverage dependency injection, and handle updates with IOptions, IOptionsSnapshot, and IOptionsMonitor for maintainable and scalable applications.
We'll cover the following...
It is not desirable that various application parts access the whole configuration as this may create hidden dependencies between application subparts. For instance, a controller might use a pager setting that was conceived for another section of the website, so changing the configuration for that section might unexpectedly change the behavior of other application sections as well.
Configuration sections help to organize data, but we need a way to inject data from a single section preventing access to other sections. It is best to have controllers and views receive data already converted into C# types so they don’t have to convert from strings. The ASP.NET Core options framework solves this problem.
The ASP.NET Core options framework solves this problem.
ASP.NET Core options framework
Thanks to the ...