Wrapping up
In this chapter, we learned how the Options pattern helps enhance application flexibility and reliability when we need configurations. We explored multiple elements of the framework to use configuration, load configurations, and validate configurations. We learned about tools that can help us validate our objects, how to inject our settings directly into their consumers, and more.
Now, on top of that, let’s explore how the Options pattern helps us adhere to the SOLID principles:
- S: The Options pattern divides managing settings into multiple pieces where each has a single responsibility. Loading unmanaged settings into strongly typed classes is one responsibility, validating options using classes is another, and configuring options from multiple independent sources is one more.
- O: The different
IOptions*<TOptions>
interfaces break this principle by forcing the consumer to decide what lifetime and capabilities the options should have. To...