Пример #1
0
 /// <summary> ctor </summary>
 public GeneralHttpClient(ApiServiceNames namedhttpClient, HttpClient httpClient)
 {
     _httpClient      = httpClient;
     _namedhttpClient = namedhttpClient;
     _logger          = GeneralContext.GetService <ILogger>();
     RequestUrl       = $"api/{_namedhttpClient}/";
 }
Пример #2
0
        public static GeneralHttpClient CreateRestClient(ApiServiceNames httpClientNamed = ApiServiceNames.DalApi)
        {
            IHttpClientFactory httpContextFactory = GetService <IHttpClientFactory>();
            var typedHttpClient = httpContextFactory.CreateClient(httpClientNamed.GetDisplayName());

            return(new GeneralHttpClient(httpClientNamed, typedHttpClient));
        }