Skip to content
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

Named client #427

Open
smolchanovsky opened this issue Mar 13, 2022 · 1 comment
Open

Named client #427

smolchanovsky opened this issue Mar 13, 2022 · 1 comment

Comments

@smolchanovsky
Copy link
Member

A named client will allow you to use named options when creating via DI:

services.Configure<JsonSerializerOptions>(name: "myClient", options =>
{
    options.JsonSerializerOptions.PropertyNameCaseInsensitive = true;
});
services.AddNClient<IFileClient>(name: "myClient", host: "http://localhost:5001");    // Use myClient JsonSerializerOptions
@Kingmidas74
Copy link
Member

Kingmidas74 commented Sep 3, 2022

I really don't sure that is a good opportunity.
First of all how many times do you re-use options? I think we can just create override AddNClient with options default parameter or extension method WithOptions (if it isn't exist)
Secondly, string const make me sad every time I've see this. Pure refactoring ability is breaking.
And last but not least... The "name" can be used for any different connections. So... How you suggest resolve the situation when we want to apply same options by name but for multiple clients?

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

No branches or pull requests

2 participants