Closed cecilphillip-stripe closed 9 months ago
@pakrym-stripe what are your thoughts on using something like this to register all the Stripe services
I usually prefer explicit registrations but this should be fine. If we have any problems we can move to source-generation.
ServiceDescriptor.Transient(type, type))
SHould this be singleton?
@pakrym-stripe No, because the HttpClient the constructor receives would ended up being captured as a Singleton and then defeat the purpose of using the HttpClientFactory
I wonder if it would, the HttpClientFactory itself is registered as singleton (https://github.com/dotnet/runtime/blob/main/src/libraries/Microsoft.Extensions.Http/src/DependencyInjection/HttpClientFactoryServiceCollectionExtensions.cs#L35) and the HttpClient
instances all use the same set of pooled handlers.
we're going with source generators #7
@pakrym-stripe what are your thoughts on using something like this to register all the Stripe services
This ends up registering about 100+ of our services. I'm wondering if we need to register all of those up front or maybe we can use source generation? 🤔