internal static void GetConnectionInfo(string databaseName, out string connectionString, out ProviderType providerType) { if (!s_ConnStrMaps.ContainsKey(databaseName)) { throw new ApplicationException("Can't find the info of database '" + databaseName + "'. It hasn't been configurated."); } ConnStrSetting conn = s_ConnStrMaps[databaseName]; connectionString = conn.ConnectionString; providerType = conn.ProviderType; }
public static void SetConnectionString(string databaseName, string connStr, ProviderType providerType) { ConnStrSetting tmp = new ConnStrSetting(databaseName, connStr, providerType); if (s_ConnStrMaps.ContainsKey(databaseName)) { s_ConnStrMaps[databaseName] = tmp; } else { s_ConnStrMaps.Add(databaseName, tmp); } }
public static void SetConnectionString(string name, string connStr, ProviderType providerType) { ConnStrSetting tmp = new ConnStrSetting(name, connStr, providerType); if (m_ConnStrMaps.ContainsKey(name)) { m_ConnStrMaps[name] = tmp; } else { m_ConnStrMaps.Add(name, tmp); } }
public static ProviderType GetProviderType(string name) { if (m_ConnStrMaps.ContainsKey(name)) { return(m_ConnStrMaps[name].ProviderType); } if (ConfigurationManager.ConnectionStrings[name] != null) { ProviderType proType = ConvertProviderNameToType(ConfigurationManager.ConnectionStrings[name].ProviderName); ConnStrSetting tmp = new ConnStrSetting(name, ConfigurationManager.ConnectionStrings[name].ConnectionString, proType); lock (s_syncObject) { if (!m_ConnStrMaps.ContainsKey(name)) { m_ConnStrMaps.Add(name, tmp); } } return(proType); } throw new ApplicationException("Can't find the Connection String Key '" + name + "'. It hasn't been configurated."); }