/// <summary> /// 获得数据库配置对象 /// </summary> /// <returns></returns> public static DBConfig GetDBConfig() { if (config == null) { config = (DBConfig)ConfigurationManager.GetSection("DBConfig"); } return(config); }
public static DBConfig GetDBConfig(string path, string dbType) { if (config == null) { ExeConfigurationFileMap ecfm = new ExeConfigurationFileMap(); ecfm.ExeConfigFilename = path; Configuration cf = ConfigurationManager.OpenMappedExeConfiguration(ecfm, ConfigurationUserLevel.None); config = (DBConfig)cf.GetSection("DBConfig"); DBType = cf.AppSettings.Settings[dbType].Value; } return(config); }
public static DBConfig GetDBConfig(string path,string dbType) { if (config == null) { ExeConfigurationFileMap ecfm = new ExeConfigurationFileMap(); ecfm.ExeConfigFilename = path; Configuration cf= ConfigurationManager.OpenMappedExeConfiguration(ecfm, ConfigurationUserLevel.None); config = (DBConfig)cf.GetSection("DBConfig"); DBType = cf.AppSettings.Settings[dbType].Value; } return config; }
/// <summary> /// 获得数据库配置对象 /// </summary> /// <returns></returns> public static DBConfig GetDBConfig() { if (config == null) { config = (DBConfig)ConfigurationManager.GetSection("DBConfig"); } return config; }