From 66f17cf266e006da4dd9e30071813ce2d2f0016a Mon Sep 17 00:00:00 2001 From: rszn <645583145@qq.com> Date: Mon, 24 Jun 2024 22:20:51 +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 | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/WebStarter/Program.cs b/WebStarter/Program.cs index 1cf3737..fb46159 100644 --- a/WebStarter/Program.cs +++ b/WebStarter/Program.cs @@ -1,7 +1,6 @@ using System.Text; using Autofac; using Autofac.Extensions.DependencyInjection; -using Common.Util; using Entity.Dto.Resp; using HybirdFrameworkCore.Autofac; using HybirdFrameworkCore.AutoTask; @@ -34,6 +33,13 @@ builder.Host.ConfigureContainer(cb => IsAutoCloseConnection = true, InitKeyType = InitKeyType.Attribute // 如果使用实体类的属性进行主键标识,请设置为 InitKeyType.Attr + }, c => + { + c.Aop.OnLogExecuting = (sql, pars) => + { + string nativeSql = UtilMethods.GetNativeSql(sql, pars); + log.Info(nativeSql); + }; }); return db; }).As().SingleInstance(); @@ -161,4 +167,4 @@ if (AppSettingsHelper.GetBool("swap", "enable")) TaskInit.Init(); -app.Run(); \ No newline at end of file +app.Run();