示例#1
0
        /// <summary>
        /// CustomerRepository constructor
        /// </summary>
        /// <param name="client"></param>
        /// <param name="customerApiSettings"></param>
        public CustomerRepository(IHttpClientFactory clientFactory, CustomerApiSettings customerApiSettings)
        {
            _clientFactory       = clientFactory;
            _client              = _clientFactory.CreateClient();
            _customerApiSettings = customerApiSettings;

            _client.BaseAddress = new Uri(customerApiSettings.BaseUrl);
            _client.DefaultRequestHeaders.Accept.Clear();
            _client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
        }
示例#2
0
 /// <summary>
 /// CustomerRepository constructor
 /// </summary>
 /// <param name="client"></param>
 /// <param name="customerApiSettings"></param>
 public CustomerApiRepository(CustomerApiSettings customerApiSettings)
 {
     ServicePointManager.SecurityProtocol = SecurityProtocolType.Ssl3 | SecurityProtocolType.Tls | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls12;
     _customerApiSettings = customerApiSettings;
 }