Extensibility
Add your own configuration sources and providers.
Create a custom source or provider:
- Define a new provider class that implements
IConfigurationProvider(insrc/Providers/Interfaces/). - Add further sources to the same
IConfigurationBuilderyou passed toConfigurationLoader; the loader does not expose the builder, so extend the builder rather than the loader. - Respect precedence by adding sources in order.
Example sketch:
public static class ConfigurationBuilderExtensions
{
public static IConfigurationBuilder AddMySource(this IConfigurationBuilder builder, string endpoint)
{
// fetch data from endpoint and add it as a source, e.g. builder.AddInMemoryCollection(values)
// ...
return builder;
}
}