/// <summary> /// 创建接口的代理实例 /// </summary> /// <returns></returns> public HttpApi CreateHttpApi() { var handler = this.lifeTimeHttpHandlerLazy.Value; var httpApiConfig = new LifetimeHttpApiConfig(handler); if (this.configOptions != null) { this.configOptions.Invoke(httpApiConfig); } if (this.keepCookieContainer == true) { Interlocked.CompareExchange(ref this.cookieContainer, httpApiConfig.HttpHandler.CookieContainer, null); if (object.ReferenceEquals(httpApiConfig.HttpHandler.CookieContainer, this.cookieContainer) == false) { httpApiConfig.HttpHandler.CookieContainer = this.cookieContainer; } } return(this.CreateHttpApi(httpApiConfig)); }
/// <summary> /// 创建接口的代理实例 /// </summary> /// <returns></returns> HttpApiClient IHttpApiFactory.CreateHttpApi() { var handler = this.lifeTimeHttpHandlerLazy.Value; var httpApiConfig = new LifetimeHttpApiConfig(handler); if (this.configOptions != null) { this.configOptions.Invoke(httpApiConfig); } if (this.keepCookieContainer == true) { Interlocked.CompareExchange(ref this.cookieContainer, httpApiConfig.HttpHandler.CookieContainer, null); if (httpApiConfig.HttpHandler.CookieContainer != this.cookieContainer) { httpApiConfig.HttpHandler.CookieContainer = this.cookieContainer; } } return(HttpApiClient.Create(typeof(TInterface), httpApiConfig)); }