public ConfigServerClient(IHttpClientWrapper client, IClientCachingStrategy cache, IClientIdProvider clientIdProvider, IConfigurationRegistry collection, ConfigServerClientOptions options) { this.client = client; this.collection = collection; this.options = options; this.cache = cache; this.clientIdProvider = clientIdProvider; }
public ConfigServerClient(IHttpClientWrapper client, IMemoryCache memorycache, ConfigurationRegistry collection, ConfigServerClientOptions options) { this.client = client; this.collection = collection; this.options = options; if (memorycache == null && !options.CacheOptions.IsDisabled) { throw new ArgumentNullException(nameof(memorycache), "Caching is enabled, but IMemoryCache is not registered in service collection. Try adding \"services.AddMemoryCache()\" to startup file"); } this.cache = memorycache; }
public MemoryClientCachingStrategy(IMemoryCache memorycache, ConfigServerClientOptions options) { this.memorycache = memorycache; this.options = options; }
public ResourceServerClient(IHttpClientWrapper client, ConfigServerClientOptions options, IClientIdProvider clientIdProvider) { this.client = client; this.options = options; this.clientIdProvider = clientIdProvider; }
/// <summary> /// Adds ConfigServer client to specified ServiceCollection /// </summary> /// <param name="source">The IServiceCollection to add ConfigServer client to</param> /// <param name="options">Options for ConfigServer client</param> /// <returns>ConfigServer client builder for further configuration</returns> public static ConfigServerClientBuilder AddConfigServerClient(this IServiceCollection source, ConfigServerClientOptions options) { var configurationCollection = new ConfigurationRegistry(); var builder = new ConfigServerClientBuilder(source, configurationCollection); source.Add(ServiceDescriptor.Transient <IHttpClientWrapper>(r => new HttpClientWrapper(options.Authenticator))); source.Add(ServiceDescriptor.Transient <IConfigServerClient>(r => new ConfigServerClient(r.GetService <IHttpClientWrapper>(), r.GetService <IMemoryCache>(), r.GetService <ConfigurationRegistry>(), options))); return(builder); }
private static ConfigServerClientBuilder SetUpBuilder(ConfigServerClientBuilder builder, ConfigServerClientOptions options) { builder.AddSingleton(options); builder.AddSingleton <IHttpClientWrapper>(new HttpClientWrapper(options.Authenticator)); builder.AddTransient <IConfigServer, ConfigServerClient>(); builder.AddTransient <IResourceServer, ResourceServerClient>(); if (options.CacheOptions.IsDisabled) { builder.AddTransient <IClientCachingStrategy, NoCachingStrategy>(); } else { builder.AddTransient <IClientCachingStrategy, MemoryClientCachingStrategy>(); } return(builder); }
/// <summary> /// Adds ConfigServer client to specified ServiceCollection /// </summary> /// <param name="source">The IServiceCollection to add ConfigServer client to</param> /// <param name="options">Options for ConfigServer client</param> /// <returns>ConfigServer client builder for further configuration</returns> public static ConfigServerClientBuilder AddConfigServerClient(this IServiceCollectionWrapper source, ConfigServerClientOptions options) { return(SetUpBuilder(new ConfigServerClientBuilder(source), options)); }