Beispiel #1
0
        /// <summary>
        /// Create an instance of ConfigCatClient and setup LazyLoad mode
        /// </summary>
        /// <param name="configuration">Configuration for LazyLoading mode</param>
        /// <exception cref="ArgumentException">When the configuration contains any invalid property</exception>
        /// <exception cref="ArgumentNullException">When the configuration is null</exception>
        public ConfigCatClient(LazyLoadConfiguration configuration)
            : this((ConfigurationBase)configuration)
        {
            var lazyLoadService = new LazyLoadConfigService(
                new HttpConfigFetcher(configuration.CreateUri(), "l-" + version, configuration.Logger, configuration.HttpClientHandler, this.configDeserializer, configuration.IsCustomBaseUrl),
                this.cacheParameters,
                configuration.Logger,
                TimeSpan.FromSeconds(configuration.CacheTimeToLiveSeconds));

            this.configService = lazyLoadService;
        }
        /// <summary>
        /// Create an instance of ConfigCatClient and setup LazyLoad mode
        /// </summary>
        /// <param name="configuration">Configuration for LazyLoading mode</param>
        /// <exception cref="ArgumentException">When the configuration contains any invalid property</exception>
        /// <exception cref="ArgumentNullException">When the configuration is null</exception>
        public ConfigCatClient(LazyLoadConfiguration configuration)
        {
            if (configuration == null)
            {
                throw new ArgumentNullException(nameof(configuration));
            }

            configuration.Validate();

            InitializeClient(configuration);

            var configService = new LazyLoadConfigService(
                new HttpConfigFetcher(configuration.Url, "l-" + version, configuration.LoggerFactory),
                new InMemoryConfigCache(),
                configuration.LoggerFactory,
                TimeSpan.FromSeconds(configuration.CacheTimeToLiveSeconds));

            this.configService = configService;
        }