public override void Initialize(string name, System.Collections.Specialized.NameValueCollection config) { if (config == null) { throw new ArgumentNullException("config"); } if (name == null || name.Length == 0) { name = "MyCacheStore"; } if (String.IsNullOrEmpty(config["description"])) { config.Remove("description"); config.Add("description", "Redis as a session data store"); } base.Initialize(name, config); // If configuration exists then use it otherwise read from config file and create one if (configuration == null) { lock (configurationCreationLock) { if (configuration == null) { configuration = ProviderConfiguration.ProviderConfigurationForSessionState(config); } } } }
public void UseConnectionStringByName() { NameValueCollection config = new NameValueCollection(); config.Add("connectionString", "RedisSession"); Assert.Equal(ConfigurationManager.ConnectionStrings["RedisSession"].ConnectionString, ProviderConfiguration.ProviderConfigurationForSessionState(config).ConnectionString); }