I'm trying to use already configured custom config-class to configure another service. Configuration gets data from local settings and Azure AppConfiguration store. This is my Startup code:
public void ConfigureServices(IServiceCollection services)
{
services.AddAzureAppConfiguration();
services.Configure<CustomConfig>(Configuration);
services.AddTransient<ISomeService, SomeService>((serviceProvider) =>
{
CustomConfig config = serviceProvider.GetRequiredService<IOptions<CustomConfig>>().Value;
return new SomeService(config);
});
//--------------------------------------------------------------------
services.AddRazorPages();
services.AddControllers();
}
But when SomeService is instantiated, my custom config-object doesn't contain data that should come from the Azure AppConfig. It has only data from the appsettings.json. What is wrong and what can I do here?