public static DBAct InitDBAct(DBTypeEnum.DBType dbtype, string connectstring) { DBAct dbact = new DBAct(); dbact.ConnectionStr = connectstring; dbact.DBType = Enum.GetName(dbtype.GetType(), dbtype); dbact.DBTypeValue = (int)dbtype; dbact.DBABase = new DBActBase(connectstring); return(dbact); }
/// <summary> /// 初始化配置 /// </summary> /// <param name="Type">数据库类型</param> public static void InitSetting(DBTypeEnum.DBType Type) { try { ConnectConfig = ConfigurationManager.ConnectionStrings; AppSetingConfig = ConfigurationManager.AppSettings; LogPath = ConfigurationManager.AppSettings["LogPath"];//日志文件路径不含文件名 DBType = Enum.GetName(Type.GetType(), Type); ConnectString = ConfigurationManager.ConnectionStrings[DBType].ToString(); KEY = ConfigurationManager.AppSettings["Key"]; } catch (System.Exception ex) { Log.LogInBatchExceptWrite(ex, "文件读取配置部分错误!"); } }
public DBActBase(DBTypeEnum.DBType dbtype, string connectstr) { this.ConnectionStr = connectstr; this.DBType = Enum.GetName(dbtype.GetType(), dbtype); this.DBTypeValue = (int)dbtype; }