private static void EnsureImplementation(SqlConfigurationData data) { if (!implementationByConnectionString.ContainsKey(data.ConnectionString)) { lock (lockObject) { SqlConfigurationSourceImplementation implementation = new SqlConfigurationSourceImplementation(data); implementationByConnectionString.Add(data.ConnectionString, implementation); } } }
/// <summary> /// <exclude>For unit testing purposes.</exclude> /// </summary> public static void ResetImplementation(SqlConfigurationData data, bool refreshing) { SqlConfigurationSourceImplementation currentImplementation = null; implementationByConnectionString.TryGetValue(data.ConnectionString, out currentImplementation); implementationByConnectionString[data.ConnectionString] = new SqlConfigurationSourceImplementation(data.ConnectionString, data.GetStoredProcedure, data.SetStoredProcedure, data.RefreshStoredProcedure, data.RemoveStoredProcedure, refreshing); if (currentImplementation != null) { currentImplementation.Dispose(); } }