private static void AppendDatabaseConfig(DatabaseConfig dbConfig) { var dbKey = dbConfig.ConfigName.ToLower(); if (DbMap.ContainsKey(dbKey)) { Logging.LogManager.GetLogger(SqlHelper.SqlLogger).Warn("[DbMap]{0} are covered.", dbConfig.ConfigName); } DbMap[dbKey] = dbConfig; }
/// <summary> /// /// </summary> /// <param name="dbName"></param> /// <returns></returns> public static bool ExistDatabase(string dbName) { ArgumentAssertion.IsNotNull(dbName, "dbName"); if (null == DbMap) { Initialize(); } var dbKey = dbName.ToLower(); return(DbMap.ContainsKey(dbKey)); }
/// <summary> /// /// </summary> /// <param name="dbName"></param> /// <returns></returns> public static DatabaseConfig GetDatabase(string dbName) { Initialize(); ArgumentAssertion.IsNotNull(dbName, "dbName"); var dbKey = dbName.ToLower(); if (DbMap.ContainsKey(dbKey) == false) { throw new ArgumentOutOfRangeException("dbName", dbName, string.Format("没有定义数据库 - {0}", dbName)); } return(DbMap[dbKey]); }