C#C
C#4mo ago
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
Was this page helpful?