-
Notifications
You must be signed in to change notification settings - Fork 25.3k
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
Add named and typed clients section #32456
Add named and typed clients section #32456
Conversation
@IEvangelist I'll do the edit review after you do the technical review. |
@IEvangelist Hi David, can I ask you to please review my PR? |
I had a look, seems ok - but let's please have @CarnaViire review this for technical accuracy instead. |
...http-requests/samples/6.x/HttpRequestsSample/Pages/Consumption/NamedAndTypedClient.cshtml.cs
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for tagging me @IEvangelist!
While I appreciate your contribution @peter-csala I believe this is not a good guidance, see my comment #32456 (comment). If you strongly believe using multiple named clients should be highlighted in the docs, I'd propose to change the guidance to the one I provided in the comment.
I see that dotnet/docs#40359 was merged but I missed it -- @IEvangelist I think we would need to either revert it or substitute it with the guidance from #32456 (comment).
On a side note:
I also keep thinking that we need to make some effort to reduce duplications between the docs -- as HttpClientFactory belongs to BCL now, it would be better to have the conceptual docs there, and only leave ASP.NET Core related stuff here, and redirect to .NET docs otherwise. But this needs to be done carefully, not to disrupt the users flow. Let's discuss it later @IEvangelist
Thank you @CarnaViire for the review. I agree that my made up example is not the best. I wanted to create a simple example to showcase the usage of named and typed clients because (for some unknown reason) they are not listed on any of the documentation pages. Neither here nor on the dotnet docs. Do you have any idea what would be an ideal sample scenario for this? |
Thank you Natalia for your "constructive" suggestions... |
@peter-csala The main problem is not with the example, but with the approach in general.
I assume by "the usage of named and typed clients" you mean using several named clients within a service, which you wanted to register and construct via typed clients infrastructure. As I mentioned in my comment, typed clients are simply not designed to be used this way, and You can see the following remarks in the docs:
So, if your wish is to use several named clients within a service, I've given you several ways to do that; if for some reason neither of them suit your needs, or there are other problems you are trying to solve, please let me know. If there's a real-world scenario which is impossible or significantly complicated with the existing API shape, we'd love to know that. You can also check some of the issues (in dotnet/runtime) that are already known to us, e.g. this one dotnet/runtime#89755 could further simplify the use of multiple named clients. Please upvote if there's something you need, to help us prioritize. Thanks! |
This PR is basically a follow up of my other PR against the dotnet/docs repository.
It extends the Make HTTP requests using IHttpClientFactory in ASP.NET Core page with named and typed client capability.
Internal previews