Пример #1
0
        private Client()
        {
            IComponentProvider container = UrsaConfigurationSection.InitializeComponentProvider();

            _webRequestProvider = (from webRequestProvider in container.ResolveAll <IWebRequestProvider>()
                                   from supportedProtocol in webRequestProvider.SupportedProtocols
                                   join allowedProtocol in AllowedProtocols on supportedProtocol equals allowedProtocol
                                   select webRequestProvider).FirstOrDefault();
            if (_webRequestProvider == null)
            {
                throw new InvalidOperationException("Cannot create an HTTP client without proper web request provider.");
            }

            _converterProvider = container.Resolve <IConverterProvider>();
            _resultBinder      = container.Resolve <IResultBinder <RequestInfo> >();
        }