© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
C#C
C#•6mo ago•
12 replies
Camster

Service Provider Question

I have a Blazor WASM intranet site with a backend API. I would like to have a really easy way of switching between dev/test/production api, where both the URI and the Name can be utilized in blazor.

I created an APIConnection class, which has three classes that implement for each of dev/test/production (1st screenshot).

Then I have added that class to service provider (2nd sceenshot). I can easily change the name of the class when I need to switch.

However, I'm having difficulty using that scoped instance to send the URI to the HttpClient. How do I access the scoped instance of the APIConnection inside the scoped instance of HttpClient (3rd sceenshot)?
image.png
image.png
image.png
C# banner
C#Join
We are a programming server aimed at coders discussing everything related to C# (CSharp) and .NET.
61,871Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

❔ Service provider, IDisposable
C#CC# / help
3y ago
How can I get service provider from service collection?
C#CC# / help
17mo ago
❔ Only a single database provider can be registered in a service provider
C#CC# / help
3y ago