/// <summary>
        /// Builds <see cref="IServiceManager"/> instances.
        /// </summary>
        /// <returns>The instance of the <see cref="IServiceManager"/>.</returns>
        public IServiceManager Build()
        {
            _options.ValidateOptions();

            var productInfo = ProductInfo.GetProductInfo(_assembly);
            var context     = new ServiceManagerContext()
            {
                ProductInfo = productInfo
            };

            context.SetValueFromOptions(_options);
            var restClientBuilder = new RestClientFactory(productInfo);

            return(new ServiceManager(context, restClientBuilder));
        }
Beispiel #2
0
        internal ServiceManager(ServiceManagerContext context, RestClientFactory restClientFactory)
        {
            _endpoint = context.ServiceEndpoints.Single();//temp solution

            _serverNameProvider = new DefaultServerNameProvider();

            var serviceOptions = Options.Create(new ServiceOptions
            {
                ApplicationName = context.ApplicationName,
                Proxy           = context.Proxy
            }).Value;

            _endpointProvider = new ServiceEndpointProvider(_serverNameProvider, _endpoint, serviceOptions);

            _productInfo       = context.ProductInfo;
            _context           = context;
            _restClientFactory = restClientFactory;
        }