From a5a13f12970b4b8f1c2e9a8c86a180448b388311 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=B8=8D=E5=81=9A=E7=A0=81=E5=86=9C?= <599854767@qq.com> Date: Fri, 29 Oct 2021 13:38:41 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=95=B0=E6=8D=AE=E5=BA=93?= =?UTF-8?q?=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ZR.Admin.WebApi/Startup.cs | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/ZR.Admin.WebApi/Startup.cs b/ZR.Admin.WebApi/Startup.cs index 3de82bb..e14e98a 100644 --- a/ZR.Admin.WebApi/Startup.cs +++ b/ZR.Admin.WebApi/Startup.cs @@ -135,21 +135,19 @@ namespace ZR.Admin.WebApi int dbType = Convert.ToInt32(Configuration[OptionsSetting.ConnDbType]); int dbType_bus = Convert.ToInt32(Configuration[OptionsSetting.ConnBusDbType]); - IocConfig db1 = new IocConfig() - { + SugarIocServices.AddSqlSugar(new List() { + new IocConfig() { ConfigId = "0", //主数据库 ConnectionString = connStr, DbType = (IocDbType)dbType, IsAutoCloseConnection = true//自动释放 - }; - IocConfig db2 = new IocConfig() - { + }, new IocConfig() { ConfigId = "1", // 多租户用到 ConnectionString = connStrBus, DbType = (IocDbType)dbType_bus, IsAutoCloseConnection = true//自动释放 - }; - SugarIocServices.AddSqlSugar(new List() { db1, db2 }); + } + }); //调式代码 用来打印SQL DbScoped.SugarScope.GetConnection(0).Aop.OnLogExecuting = (sql, pars) =>