Application Configuration and the Options Pattern
This chapter delves into the Options pattern and the configuration of applications, using features provided by ASP.NET Core to simplify the management and implementation of configuration. We explore a range of tools and methodologies that allow us to divide our configuration into multiple smaller objects (Separation of Concerns), configure them during different stages of the startup flow, and validate them. Additionally, we cover a broad spectrum of scenarios, including watching for runtime changes with minimal effort and managing, injecting, and loading configurations into our ASP.NET Core applications.
The new options system repurposed the ConfigurationManager
class as an internal piece. We can no longer use it as the old .NET Framework-era static methods are gone. The new patterns and mechanisms help avoid useless coupling, add flexibility to our designs, and are DI-native. The system is also simpler to extend.