[FEATURE REQ] Provide access to IServiceProvider in AddAzureClients method.
See original GitHub issueLibrary or service name. Microsoft.Extensions.Azure
Is your feature request related to a problem? Please describe.
There is no way in the AddAzureClients
method to retrieve a class already registered (with the GetService
or GetRequiredService
methods of IServiceProvider
). That is preventing us to retrieve a registered IOptions configuration.
In an ASP.NET Core application, we are often grouping settings in IOptions configuration classes that are registered in depencency injection. But we can’t use them here and have to manually retrieve the expected settings from the Configuration object.
Moreover with Azure Functions DI, there is currently no direct access to IConfiguration in FunctionStartup class, so it’s not possible to use AddAzureClients.
What feature would you like to get added? What problem is it solving?
ServiceProvider
shoud be available as a property of AzureClientFactoryBuilder
or there should be an override to Add.AzureClients
that accept a Action<AzureClientFactoryBuilder, IServiceProvider>
.
Issue Analytics
- State:
- Created 3 years ago
- Reactions:4
- Comments:9 (5 by maintainers)
Top GitHub Comments
I was thinking about something like
It would work for client of any type and allow you to use service provider as part of client construction.
https://www.nuget.org/packages/Microsoft.Extensions.Azure/1.1.0-beta.3