From 1cc0ef916f09757ddd7727b42c4b01eeff9a38ca Mon Sep 17 00:00:00 2001 From: chenchun Date: Wed, 20 Nov 2024 16:11:33 +0800 Subject: [PATCH] =?UTF-8?q?feat:=E5=8E=BB=E9=99=A4SqlSugarDbContextFactory?= =?UTF-8?q?=E7=9A=84=E7=BC=93=E5=AD=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../SqlSugarDbContextFactory.cs | 20 +++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/Yi.Abp.Net8/framework/Yi.Framework.SqlSugarCore/SqlSugarDbContextFactory.cs b/Yi.Abp.Net8/framework/Yi.Framework.SqlSugarCore/SqlSugarDbContextFactory.cs index 3012a94c..1c7bcacf 100644 --- a/Yi.Abp.Net8/framework/Yi.Framework.SqlSugarCore/SqlSugarDbContextFactory.cs +++ b/Yi.Abp.Net8/framework/Yi.Framework.SqlSugarCore/SqlSugarDbContextFactory.cs @@ -37,14 +37,18 @@ namespace Yi.Framework.SqlSugarCore LazyServiceProvider = lazyServiceProvider; var connectionString = GetCurrentConnectionString(); - - //获取连接配置操作,需要进行缓存 - var connectionConfig = ConnectionConfigCache.GetOrAdd(connectionString, (_) => - BuildConnectionConfig(action: options => - { - options.ConnectionString = connectionString; - options.DbType = GetCurrentDbType(); - })); + + var connectionConfig =BuildConnectionConfig(action: options => + { + options.ConnectionString = connectionString; + options.DbType = GetCurrentDbType(); + }); + // var connectionConfig = ConnectionConfigCache.GetOrAdd(connectionString, (_) => + // BuildConnectionConfig(action: options => + // { + // options.ConnectionString = connectionString; + // options.DbType = GetCurrentDbType(); + // })); SqlSugarClient = new SqlSugarClient(connectionConfig); //生命周期,以下都可以直接使用sqlsugardb了