private static void ConfigureDynamicConfiguration(IMvcBuilder mvcBuilder, ConfigurationManager configurationManager) { var redisOptions = new RedisConfigurationOptions(); configurationManager.GetSection(nameof(RedisConfigurationOptions)).Bind(redisOptions); if (!string.IsNullOrEmpty(redisOptions.ConnectionString)) { configurationManager.AddRedis(redisOptions); } var configurationRoot = configurationManager as IConfigurationRoot; var dynamicConfiguratioProviderType = configurationManager.GetValue <string>("DynamicConfigurationOptions:ProviderType"); if (!string.IsNullOrEmpty(dynamicConfiguratioProviderType)) { var providerType = Type.GetType(dynamicConfiguratioProviderType, true); var provider = configurationRoot.Providers.First(p => p.GetType() == providerType); mvcBuilder.AddConfigurationWebAPI(configurationRoot, options => options.Provider = provider); } }