From 8cd11c9e6349f5ee5c89fe718b3ab442e178a335 Mon Sep 17 00:00:00 2001 From: rszn <645583145@qq.com> Date: Mon, 24 Jun 2024 22:19:27 +0800 Subject: [PATCH] =?UTF-8?q?sql=E6=97=A5=E5=BF=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- WebStarter/Program.cs | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/WebStarter/Program.cs b/WebStarter/Program.cs index 1a4dfe7..ddf6368 100644 --- a/WebStarter/Program.cs +++ b/WebStarter/Program.cs @@ -21,10 +21,17 @@ builder.Host.ConfigureContainer(cb => var db = new SqlSugarScope(new ConnectionConfig { ConfigId = AppSettingsConstVars.ConfigId, - ConnectionString = AppSettingsConstVars.DbSqlConnection, // �������ݿ������ַ��� + ConnectionString = AppSettingsConstVars.DbSqlConnection, DbType = AppSettingsConstVars.DbDbType == IocDbType.MySql.ToString() ? DbType.MySql : DbType.SqlServer, IsAutoCloseConnection = true, - InitKeyType = InitKeyType.Attribute // ���ʹ��ʵ��������Խ���������ʶ��������Ϊ InitKeyType.Attribute + InitKeyType = InitKeyType.Attribute + }, c => + { + c.Aop.OnLogExecuting = (sql, pars) => + { + string nativeSql = UtilMethods.GetNativeSql(sql, pars); + log.Info(nativeSql); + }; }); return db; }).As().InstancePerLifetimeScope();