コード例 #1
0
        public SingleClientService(ServiceBase baseService)
        {
            if (baseService == null)
                throw new ArgumentNullException(nameof(baseService));

            this.BaseService = baseService;
        }
コード例 #2
0
ファイル: ClientService.cs プロジェクト: narqs/libvideo
        /// <summary>
        /// Initializes a new instance of the <see cref="ClientService"/> class with the specified base service.
        /// </summary>
        /// <param name="baseService">The base service on which to send requests.</param>
        public ClientService(ServiceBase baseService)
        {
            if (baseService == null)
                throw new ArgumentNullException(nameof(baseService));

            this.BaseService = baseService;

            var handler = new HttpClientHandler();

            // Be very careful because if any exceptions are 
            // thrown between here && the HttpClient ctor, 
            // we will leak resources.

            if (handler.SupportsAutomaticDecompression)
            {
                handler.AutomaticDecompression =
                    DecompressionMethods.GZip |
                    DecompressionMethods.Deflate;
            }

            this.Client = new HttpClient(handler);
        }