From 46733989767272db7613f6c25958dd3297e48ec4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E6=B7=B3?= <454313500@qq.com> Date: Sat, 17 Feb 2024 17:37:24 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=AE=8C=E5=96=84sql=E8=80=97=E6=97=B6?= =?UTF-8?q?Aop?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../framework/Yi.Framework.SqlSugarCore/SqlSugarDbContext.cs | 5 +++++ Yi.Abp.Net8/src/Yi.Abp.SqlSugarCore/YiDbContext.cs | 4 +++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/Yi.Abp.Net8/framework/Yi.Framework.SqlSugarCore/SqlSugarDbContext.cs b/Yi.Abp.Net8/framework/Yi.Framework.SqlSugarCore/SqlSugarDbContext.cs index a2b5016c..96c1c765 100644 --- a/Yi.Abp.Net8/framework/Yi.Framework.SqlSugarCore/SqlSugarDbContext.cs +++ b/Yi.Abp.Net8/framework/Yi.Framework.SqlSugarCore/SqlSugarDbContext.cs @@ -242,6 +242,11 @@ namespace Yi.Framework.SqlSugarCore /// protected virtual void OnLogExecuted(string sql, SugarParameter[] pars) { + if (Options.EnabledSqlLog) + { + var sqllog = $"=========Yi-SQL耗时{SqlSugarClient.Ado.SqlExecutionTime.TotalMilliseconds}毫秒====="; + Logger.CreateLogger().LogDebug(sqllog.ToString()); + } } /// diff --git a/Yi.Abp.Net8/src/Yi.Abp.SqlSugarCore/YiDbContext.cs b/Yi.Abp.Net8/src/Yi.Abp.SqlSugarCore/YiDbContext.cs index 0e8404b5..28fd4436 100644 --- a/Yi.Abp.Net8/src/Yi.Abp.SqlSugarCore/YiDbContext.cs +++ b/Yi.Abp.Net8/src/Yi.Abp.SqlSugarCore/YiDbContext.cs @@ -1,6 +1,8 @@ -using SqlSugar; +using Microsoft.Extensions.Logging; +using SqlSugar; using Volo.Abp.DependencyInjection; using Yi.Framework.Rbac.SqlSugarCore; +using Yi.Framework.SqlSugarCore; namespace Yi.Abp.SqlSugarCore {