移动系统liao
2024-10-15 94da0698c01915b1e340415e080aa03050700d97
CoreCms.Net.Core/Config/SqlSugarSetup.cs
@@ -12,6 +12,7 @@
using System;
using System.Collections.Generic;
using CoreCms.Net.Caching.SqlSugar;
using CoreCms.Net.Configuration;
using CoreCms.Net.Loging;
@@ -32,16 +33,34 @@
            if (services == null) throw new ArgumentNullException(nameof(services));
            //注入 ORM
            SugarIocServices.AddSqlSugar(new IocConfig()
            //SugarIocServices.AddSqlSugar(new IocConfig()
            //{
            //    //数据库连接
            //    ConnectionString = AppSettingsConstVars.DbSqlConnection,
            //    //判断数据库类型
            //    DbType = AppSettingsConstVars.DbDbType == IocDbType.MySql.ToString() ? IocDbType.MySql : IocDbType.SqlServer,
            //    //是否开启自动关闭数据库连接
            //    IsAutoCloseConnection = true
            //});
            SugarIocServices.AddSqlSugar(new List<IocConfig>
            {
                //数据库连接
               new   IocConfig{//数据库连接
                ConnectionString = AppSettingsConstVars.DbSqlConnection,
                //判断数据库类型
                DbType = AppSettingsConstVars.DbDbType == IocDbType.MySql.ToString() ? IocDbType.MySql : IocDbType.SqlServer,
                //是否开启自动关闭数据库连接
                IsAutoCloseConnection = true
            });
                },
               new IocConfig
               {
                    ConfigId=AppSettingsConstVars.CYDbDbID,
                    ConnectionString=AppSettingsConstVars.CyDbSqlConnection,
                       DbType = AppSettingsConstVars.CyDbDbType == IocDbType.MySql.ToString() ? IocDbType.MySql : IocDbType.SqlServer,
                       //是否开启自动关闭数据库连接
                IsAutoCloseConnection = true
               }
            });
            //设置参数
            services.ConfigurationSugar(db =>
            {