pan
2025-12-02 d89c4f466c0922287ff88d4f61bfba71461cdbf0
ÏîÄ¿´úÂë/WMSÎÞ²Ö´¢°æ/WIDESEA_WMSServer/WIDESEA_Core/Seed/DBContext.cs
@@ -1,4 +1,5 @@
using SqlSugar;
using Microsoft.Extensions.Logging;
using SqlSugar;
using System;
using System.Collections.Generic;
using System.Linq;
@@ -23,14 +24,31 @@
        /// </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>
        /// è¿žæŽ¥å­—符串