Description
Describe the issue or suggestion
Follow-ups from #44533:
-
1. Simplify three main steps example description
HttpClientFactory Keyed DI docs #44533 (comment)
This sentence feels hard to read and interpret. Would it make sense to rewrite the beginning of the paragraph as following?
Consider the
IHttpClientFactory
-related code from the Basic Usage example. The code snippet illustrates the three main steps using the Keyed DI approach:- Registration
- Obtaining the configured
HttpClient
instance - Using the obtained client instance
services.AddHttpClient("github", /* ... */).AddAsKeyed(); // (1) app.MapGet("/", ([FromKeyedServices("github")] HttpClient httpClient) => // (2) //httpClient.Get.... // (3)
-
2. Link captive dependency term
HttpClientFactory Keyed DI docs #44533 (comment)
I see that the term captive dependency is defined later in the doc. Would it make sense to link that paragraph?
-
3. Use emojis in titles
HttpClientFactory Keyed DI docs #44533 (comment)
Not sure if it fits our guidelines but for me it would read better if we used emojis in the titles to raise attention instead of the nested
[!IMPORTANT]
sections.### ❌ Avoid captive dependency
-
4. Separate code blocks for better parsing
HttpClientFactory Keyed DI docs #44533 (comment)
For me the diff feels harder to parse than if we had two separate code blocks (preferably with detailed explanations in also comments rather then just in the text below).
-
5. Reduce overuse of highlighting
HttpClientFactory Keyed DI docs #44533 (comment)
I understand that HttpClientFactory is full of traps so all these sections are important, but it feels like highlighting is heavily overused in this paragraph, so it somewhat loses its purpose.
-
6. Present examples of traps
HttpClientFactory Keyed DI docs #44533 (comment)
Would it make sense to present examples of the traps?
-
7. Avoid feeling words
HttpClientFactory Keyed DI docs #44533 (comment)
-
I'd avoid feeling words like "unsurprisingly" here, and I saw "nasty" somewhere later in the doc.
-
What does this has to do with Keyed DI:
and the supporting infrastructure can also be a tangible overhead in certain scenarios (for example, on mobile platforms).
???
-
-
8. Clarify "request handler"
HttpClientFactory Keyed DI docs #44533 (comment)
What does "request handler" mean here? It's confusing because usually the handlers are put inside the client, not the other way around. So either I'm missing something or it's used here to mean something else, which I'm also missing.
-
9. Explicitly use "scoped"
HttpClientFactory Keyed DI docs #44533 (comment)
I know scoped is default, but I'd use it here explicitly or used a different name. Some people might get confused and think that the string "scoped" has any meaning appart from just being the name.
-
10. Add small example
HttpClientFactory Keyed DI docs #44533 (comment)
This is not related to the previous example, is it? It took me a while to understand what it's saying, so maybe another small example wouldn't hurt.
-
11. Define "reasonable" and link to API docs
HttpClientFactory Keyed DI docs #44533 (comment)
What does "reasonable" mean? "Small enough value to observe and react to DNS changes regularly"...
Also, I'd add a link toPooledConnectionLifetime
API ref docs. -
12. Link Singleton and Transient pitfalls
-
13. Remove "as expected"
HttpClientFactory Keyed DI docs #44533 (comment)
"as expected" is unnecessary here.
-
14. Remove "nasty", "unfortunately"
HttpClientFactory Keyed DI docs #44533 (comment)
Remove "nasty", "unfortunately".
-
15. Simplify "hidden" Named clients sentence
such "hidden" Named clients go by the linked Typed client's type name
-->
such hidden Named clients go by the Typed client's type name
-
The addition of "linked" confused me and I thought it has some special meaning. I don't think you need any adjective here to express that it's talking about the typed client from the beginning of the sentence.
-
Also, I see "Named client" and "Typed client" capitalized, but also not capitalized: "typed clients". Is there a reason for it?
-
-
16. Reduce quotes usage
Too much quotes and I don't think they are used here correctly. If you want to emphasize unwraps, hidden, exposed, make them bold.
-
17. Clarify "AnyKey" and conjunction usage
- Is "AnyKey" some constant? Does it have API docs that could be linked? It just appears here out of nowhere.
- However, as a result, - 2 conjunctions with commas, pick one and stick with it.
-
18. Avoid overusing —
I feel like you started overusing — instead of splitting into 2 sentences, or just using comma.
-
19. Call out differences in similar examples
This is very similar to the example from the beginning of the document and I'd explicitly call out the difference and why it doesn't throw here.
-
20. Remove unnecessary quotes and unfortunate
- Quotes for global are unnecessary. It's not so-called global, it is global.
- Remove unfortunate.
-
21. Describe scenarios for opting out
You just said that it's opt-in, so opting out might not make sense here.
I'd describe scenarios when one would want to use that. -
22. Fix typo "happen"
"happen" --> happen