Skip to content

Add support for clearing ConfigurationManager sources (was possible in version 5) #61675

@fredjeck

Description

@fredjeck

Problem description

Prior to version 6.0 with the old style application startup it was possible for an application to define how configuration file should be loaded by clearing up the configuration sources and by adding the configuration items in the desired order.
A use case is for instance a shared library with a baseline configuration which needs to be "injected" into the Configuration before the appsettings.* files. so that developers just need to implement minimum overrides in their appsettings files.

With version 6 it is now impossible to

  • Set the Configuration of a WebApplicationBuilder instance (readonly property)
  • Access the Sources of the ConfigurationManager (IConfigurationBuilder.Sources) property as it is private

Proposal

As it is always possible to add new configuration sources to the ConfigurationManager class, the cleanest approach which would not break the current encapsulation would be to add a clear() method to the ConfigurationManager class.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions