| | |
| | | /// </summary> |
| | | public static MutiDBOperate GetMainConnectionDb() |
| | | { |
| | | string dbType = AppSettings.GetValue("DBType"); |
| | | if (Enum.TryParse(typeof(DbType), dbType, out object? result) && result != null) |
| | | { |
| | | DbType dataBaseType = (DbType)result; |
| | | MutiDBOperate mainDb = new MutiDBOperate() |
| | | { |
| | | Connection = AppSettings.Get(MainDb.ConnectionString).DecryptDES(AppSecret.DB), |
| | | ConnId = MainDb.CurrentDbConnId, |
| | | DbType = DataBaseType.SqlServer |
| | | DbType = dataBaseType |
| | | }; |
| | | |
| | | return mainDb; |
| | | } |
| | | else |
| | | { |
| | | throw new Exception("数据库类型配置错误"); |
| | | } |
| | | } |
| | | /// <summary> |
| | | /// 连接字符串 |
| | | /// </summary> |