-
Notifications
You must be signed in to change notification settings - Fork 37
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unable to inject reusable ConfigurationClient per recommendation of SDK guide. #380
Comments
When |
I'm working on a multi-tenanted project where a distinct With all due respect, I believe the response to your question is irrelevant, as a user should be able to specify whatever |
@zhenlan Had time to look at this? My PR went stale. Is it going to be ignored again if I update it? |
Hello?! @amerjusupovic Can you give this some love? |
Hi @goldsam, I'm sorry about the delayed response here. I think this looks like a valid point from the blog you linked and related issues I found. Right now, I'm just getting more context on this from the team to see if there was a reason for omitting that capability. If not, then I'll get back to you about the PR, but I'm working on it! |
@amerjusupovic Thank you. I had actually submitted a PR which now has I conflicts. I would be happed to update it if you are willing to give it some attention afterwards. If you would review my PR and provide feedback, I would be happy to do the work to get this ready. Just let me know. Thank you very much. |
@amerjusupovic Did you see that I had created a PR previously? |
@goldsam I saw your PR but from what I gathered so far from others, it's unfortunately not the way we want to implement this. We're keeping this in mind as a future improvement, but for now it's not supported. |
@amerjusupovic As an alternative to @goldsam 's PR, could the options class be modified to make the client setter public so that we can inject the client ourselves? It's a smaller change and allows us users to decide what to do. |
@zhenlan @amerjusupovic @zhiyuanliang-ms You guys are killing me. Please add support to customize the creation and lifetime of the client. I think this is a fairly basic capability. I created a working PR which you rejected without any justification beyond" that's not what we want to do". @carlin-q-scott also offered a simple, straightforward solution which you completely ignored. It's been well over a year. Time to up your game and be better open source denizens. |
Because of geo-replication support, the provider creates Here's another option that might fit the current provider usage: .AddAzureAppConfiguration(o =>
{
o.Connect(new Uri("https://foo.azconfig.io"), new MyConfigurationClientFactory());
}); class MyConfigurationClientFactory : IConfigurationClientFactory
{
public ConfigurationClient CreateClient(string endpoint)
{
...
}
} interface IConfigurationClientFactory
{
ConfigurationClient CreateClient(string endpoint);
} The Of course, it's only a suggestion but just want to throw this out there. |
Azure SDK client DI flow may be able to help here. |
@drago-draganov I don't think I understand what you're referencing. This library doesn't support inject of the client like most other Azure libraries do. That is another aspect of this issue. To be clear, this is not respected by this library: builder.Services.AddAzureClients(clientBuilder =>
{
clientBuilder.AddConfigurationClient(...);
}); |
@goldsam Appreciate your feedback! |
@drago-draganov I think we are in agreement😉 Supporting Azure SDK client DI would suffice for my needs just fine. Its unclear to me how this would work while maintaining backwards API compatibility. I think regardless of the solution, additions be necessary to class |
I am not sure that we need changes in AzureAppConfigurationOptions. Perhaps, if we try IAzureClientFactory, it may be OK. |
Just an update: we're looking into using the SDK DI pattern as mentioned, but as far as I know we don't have access to DI from the provider. I'm reaching out to some people who are involved with the SDK to see if they have any suggestions or alternative ways to get access to clients added this way. |
After discussion with the SDK team, it sounds like it would be difficult to unify the approach to add |
The design we plan to implement at the moment is adding: AzureAppConfigurationOptions.SetClientFactory(IAzureClientFactory<ConfigurationClient> factory) The provider would call |
@goldsam PR is merged. It'll be included in the next release. Closing this :) |
The SDK Guide, recommends reusing your ConfigurationClient, however the APIs of this library prevent this by disallowing injection of a custom
ConfigurationClient
instance. The library creates a new instance ofConfigurationClient
for each call toConfigurationBuilder.AddAzureAppConfiguration
, which is unduly restrictive.The text was updated successfully, but these errors were encountered: