Building a custom configuration provider
In the previous section, we looked at built-in or pre-existing configuration providers in .NET 5. There are scenarios where many systems maintain application configuration settings in a database. These could be managed by the admin from the portal or by the support engineer by running database scripts to create/update/delete application configuration settings as needed. .NET 5 doesn't come with a built-in provider to read configurations from a database. Let's see how to build a custom configuration provider to read from a database with the following steps:
- Implement configuration source: To create an instance of the configuration provider
- Implement configuration provider: To load the configuration from the appropriate source
- Implement configuration extension: To add the configuration source to the configuration builder
Let's begin with the configuration source.
Configuration source
The responsibility...