Previously, I have been fine by just using the implicitly injected HttpClient in my Xamarin.Forms typed clients app like below. Now I want to use the .AddHttpClient():
public HrService(HttpClient httpClient)
{
// Stuff
}
And this from app.xaml.cs
containerRegistry.RegisterSingleton<IHrService, HrService>();
However, I now find myself in a situation, where I need to setup my HttpClient from the App.Xaml.cs file, because I need to add a specific HttpMessageHandler.
I have no luck doing the usual .AddHttpClient(), as it simply doesn't resolve. I am using the following nuget package:
- Prism.DryIoC.Forms
I stumpled across this SO: DryIoc and IServiceProvider on Prism for Xamarin.Forms (DryIoc.Microsoft.DependencyInjection) but it didn't make a difference.
Any help is much appreciated.