示例#1
0
        public ServiceBase(IHttpClientFactory httpClientFactory, IProvideAccessTokens accessTokenProvider, IMemoryCache cache, string clientKey)
        {
            if (httpClientFactory == null)
            {
                throw new ArgumentNullException(nameof(httpClientFactory));
            }

            _accessTokenProvider = accessTokenProvider ?? throw new ArgumentNullException(nameof(accessTokenProvider));
            _cache     = cache ?? throw new ArgumentNullException(nameof(cache));
            _clientKey = clientKey;

            if (string.IsNullOrWhiteSpace(clientKey))
            {
                throw new ArgumentException(nameof(clientKey));
            }

            HttpClient = httpClientFactory.CreateClient(clientKey);
        }
示例#2
0
 public RestClientFactory(IMemoryCache cache, IProvideAccessTokens accessTokenProvider)
 {
     _accessTokenProvider = accessTokenProvider;
     _cache = cache;
 }
示例#3
0
 public UserServiceV1(IHttpClientFactory httpClientFactory, IProvideAccessTokens accessTokenProvider, IMemoryCache cache)
     : base(httpClientFactory, accessTokenProvider, cache, ClientKey)
 {
 }