-
Notifications
You must be signed in to change notification settings - Fork 571
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
Putting HttpClientFactory back on the radar #2681
Comments
I agree that integrating with We have a prototype of one at https://github.com/cecilphillip-stripe/stripe-dotnet-extensions/tree/main/src but never got to productizing it. It is possible to have StripeClient use the HttpClientFactory without having client directly taking dependency on HttpClientFactory. I don't think we'll take a dependency on |
@pakrym-stripe, thanks for this. I didn't consider this possibility, tbh, and yes, that will allow us to use the HttpClientFactory with the current Stripe.NET implementation. From your referenced code: var clientFactory = s.GetRequiredService<IHttpClientFactory>();
var systemHttpClient = new SystemNetHttpClient(
httpClient: clientFactory.CreateClient(HttpClientName),
maxNetworkRetries: stripeOptions.MaxNetworkRetries,
appInfo: stripeOptions.AppInfo,
enableTelemetry: stripeOptions.EnableTelemetry); Also, I wasn't aware of the telemetry options. That'll be very useful!!! |
Also there are problems with that as well. For starters what can be problematic:
|
There's no need to drop .NET Framework support to add this; |
None of the Microsoft.Extensions packages including the Microsoft.Extensions.Http NuGet package does not integrate well with ASP.NET Framework MVC applications that many colleges in the United States uses for students due to the limitations they put in place where they do not allow Core to be used on their servers for student developer web applications. As much as I hate the fact that Microsoft does not shove the ASP.NET Core insertion package for IIS for servers even for them as well that would bypass their group policy on it 😂. |
Not sure where you've got that idea from. I'm using that package in multiple .NET Framework MVC 5 projects without any issues. |
In the nuget package link it mentions to use DI's |
It's not built-in, but it's not too difficult to implement. For example, here's the code I'm using: NBS.Core.Web.Mvc.DependencyInjection |
This really needs to be implemented. For example, because the SDK is directly creating its own
Anyone not already using these abstractions is doing so because their codebase is ancient. This isn't Stripe's problem, and nor should it be a problem for the rest of us who are working on codebases from this century. If you aren't willing to keep your codebase somewhat up to date with industry standards, you shouldn't be working in this industry.
Again, not Stripe's problem that American colleges are over a decade behind the curve. |
It is not just that, people tend to have requirements where they must only use code that comes from companies like Stripe and Microsoft as prime examples due to an enforced and strict security requirement. |
So how does Stripe taking a dependency on Microsoft's libraries cause a problem? |
Is your feature request related to a problem? Please describe.
As described before in #1918 (specifically, this comment: #1918 (comment)),
HttpClientFactory
should be supported after dropping backwards compat support for .NET Framework 4.5, as described in that article.Describe the solution you'd like
Refactor the code such that now we'd use an HttpClientFactory under-the-hood. This also adds the ability to provide (in the near future) DI middleware points and perhaps other extension-abilities.
Anyway, the main goal should first be to use an http client factory.
Describe alternatives you've considered
There are no alternatives, other than forking this codebase.
Additional context
Original issue: #1918
Dependency injection request: #1882
PS: I am willing to put in the work for this, however, I'd first like to have consensus on getting this in ;).
The text was updated successfully, but these errors were encountered: