I'm trying to set up a multi-tenant application where the back-end talks to multiple environments of the same service based on the request locale. Because these environments each have their own client, I currently have a ClientProvider
class that returns the correct client for each locale. However, that leaves me with ClientProvider.ProvideForLocale()
calls everywhere, which are kind of bloating the code IMO.
Instead, I'd like to inject a request-scoped client based on the locale provided in the request using the DI framework, but I can't seem to figure out how to do it. Is this even possible?