Skip to content

Make IConfigurationRefresher instance available via DI #167

Description

@zhenlan

It's useful for user code to obtain the instance of IConfigurationRefresher so they can refresh configuration synchronously or write their own middleware etc.

Proposal

Add extension method below that user can call in ConfigureServices(...)

public static IServiceCollection AddAzureAppConfiguration(this IServiceCollection services)

Under the cover, this API will add IConfigurationRefresherAccessor to the DI.

public interface IConfigurationRefresherAccessor
{
    IEnumerable<IConfigurationRefresher> Refreshers { get; set; }
}

User code can then get the instances of IConfigurationRefresher (via IConfigurationRefresherAccessor) from the DI.

Note: the implementation of IConfigurationRefresherAccessor will need to get IConfiguration from DI and cast it to IConfigurationRoot etc, just like what we do in the middleware today.

Other Considerations

  • We may need to consider exposing other properties in IConfigurationRefresher so users can differentiate instances from one to another.
  • We may consider changing our middleware to obtain instances of IConfigurationRefresher in the same way. This means users must call AddAzureAppConfiguration before they can call UseAzureAppConfiguration.

cc: AA (@abhilasharora) Jimmy Campbell (@jimmyca15) Drago Draganov (@drago-draganov)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions