Код: Выделить всё
services.AddHttpClient("myClient", client =>
{
client.BaseAddress = new Uri("https://test.com");
});
Код: Выделить всё
protected readonly HttpClient httpClient;
public Client(HttpClient httpClient)
{
this.httpClient = httpClient;
}
Код: Выделить всё
private readonly HttpClient _myClient;
public ServiceClass(IHttpClientFactory httpClientFactory) : base(//What should I pass here?)
{
_myClient = httpClientFactory.CraeteClient("myClient");
}
Подробнее здесь: https://stackoverflow.com/questions/660 ... ance-logic