| | |
| | | using SqlSugar; |
| | | using Microsoft.Extensions.Logging; |
| | | using SqlSugar; |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Linq; |
| | |
| | | /// </summary> |
| | | public static MutiDBOperate GetMainConnectionDb() |
| | | { |
| | | MutiDBOperate mainDb = new MutiDBOperate() |
| | | string dbType = AppSettings.GetValue("DBType"); |
| | | if(Enum.TryParse(typeof(DbType),dbType,out object? result) && result != null) |
| | | { |
| | | Connection = AppSettings.Get(MainDb.ConnectionString).DecryptDES(AppSecret.DB), |
| | | ConnId = MainDb.CurrentDbConnId, |
| | | DbType = DataBaseType.SqlServer |
| | | }; |
| | | DbType dataBaseType = (DbType)result; |
| | | MutiDBOperate mainDb = new MutiDBOperate() |
| | | { |
| | | Connection = AppSettings.Get(MainDb.ConnectionString).DecryptDES(AppSecret.DB), |
| | | ConnId = MainDb.CurrentDbConnId, |
| | | DbType = dataBaseType |
| | | }; |
| | | return mainDb; |
| | | } |
| | | else |
| | | { |
| | | throw new Exception("æ°æ®åºè¿æ¥é
ç½®é误"); |
| | | } |
| | | |
| | | return mainDb; |
| | | //MutiDBOperate mainDb = new MutiDBOperate() |
| | | //{ |
| | | // Connection = AppSettings.Get(MainDb.ConnectionString).DecryptDES(AppSecret.DB), |
| | | // ConnId = MainDb.CurrentDbConnId, |
| | | // DbType = DataBaseType.SqlServer |
| | | //}; |
| | | |
| | | //return mainDb; |
| | | } |
| | | /// <summary> |
| | | /// è¿æ¥å符串 |