From 5d793344cd846793568a882bf530a1838a554ba8 Mon Sep 17 00:00:00 2001 From: chenchun Date: Wed, 20 Nov 2024 13:43:35 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E7=A7=BB=E9=99=A4?= =?UTF-8?q?=E5=B1=9E=E6=80=A7=E6=B3=A8=E5=85=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../DefaultSqlSugarDbContext.cs | 4 ++++ .../Yi.Framework.SqlSugarCore/SqlSugarDbContext.cs | 10 ++++++++-- .../Yi.Framework.Rbac.SqlSugarCore/YiRbacDbContext.cs | 5 +++++ Yi.Abp.Net8/src/Yi.Abp.SqlSugarCore/YiDbContext.cs | 3 +++ 4 files changed, 20 insertions(+), 2 deletions(-) diff --git a/Yi.Abp.Net8/framework/Yi.Framework.SqlSugarCore/DefaultSqlSugarDbContext.cs b/Yi.Abp.Net8/framework/Yi.Framework.SqlSugarCore/DefaultSqlSugarDbContext.cs index eadefe24..0c13e6bf 100644 --- a/Yi.Abp.Net8/framework/Yi.Framework.SqlSugarCore/DefaultSqlSugarDbContext.cs +++ b/Yi.Abp.Net8/framework/Yi.Framework.SqlSugarCore/DefaultSqlSugarDbContext.cs @@ -32,6 +32,9 @@ public class DefaultSqlSugarDbContext : SqlSugarDbContext protected IEntityChangeEventHelper EntityChangeEventHelper => LazyServiceProvider.LazyGetService(NullEntityChangeEventHelper.Instance); + public DefaultSqlSugarDbContext(IAbpLazyServiceProvider lazyServiceProvider) : base(lazyServiceProvider) + { + } protected override void CustomDataFilter(ISqlSugarClient sqlSugarClient) { if (IsSoftDeleteFilterEnabled) @@ -204,4 +207,5 @@ public class DefaultSqlSugarDbContext : SqlSugarDbContext entityColumnInfo.IsPrimarykey = true; } } + } \ No newline at end of file diff --git a/Yi.Abp.Net8/framework/Yi.Framework.SqlSugarCore/SqlSugarDbContext.cs b/Yi.Abp.Net8/framework/Yi.Framework.SqlSugarCore/SqlSugarDbContext.cs index d510aef3..579dba20 100644 --- a/Yi.Abp.Net8/framework/Yi.Framework.SqlSugarCore/SqlSugarDbContext.cs +++ b/Yi.Abp.Net8/framework/Yi.Framework.SqlSugarCore/SqlSugarDbContext.cs @@ -7,8 +7,14 @@ namespace Yi.Framework.SqlSugarCore; public abstract class SqlSugarDbContext : ISqlSugarDbContextDependencies { - //属性注入 - public IAbpLazyServiceProvider LazyServiceProvider { get; set; } + protected IAbpLazyServiceProvider LazyServiceProvider { get; } + + public SqlSugarDbContext(IAbpLazyServiceProvider lazyServiceProvider) + { + this.LazyServiceProvider = lazyServiceProvider; + } + + protected ISqlSugarClient SqlSugarClient { get;private set; } public int ExecutionOrder => 0; diff --git a/Yi.Abp.Net8/module/rbac/Yi.Framework.Rbac.SqlSugarCore/YiRbacDbContext.cs b/Yi.Abp.Net8/module/rbac/Yi.Framework.Rbac.SqlSugarCore/YiRbacDbContext.cs index 428aed15..eaa5c59b 100644 --- a/Yi.Abp.Net8/module/rbac/Yi.Framework.Rbac.SqlSugarCore/YiRbacDbContext.cs +++ b/Yi.Abp.Net8/module/rbac/Yi.Framework.Rbac.SqlSugarCore/YiRbacDbContext.cs @@ -1,6 +1,7 @@ using Microsoft.Extensions.DependencyInjection; using SqlSugar; using Volo.Abp.Data; +using Volo.Abp.DependencyInjection; using Volo.Abp.Users; using Yi.Framework.Rbac.Domain.Authorization; using Yi.Framework.Rbac.Domain.Entities; @@ -24,6 +25,9 @@ namespace Yi.Framework.Rbac.SqlSugarCore } + public YiRbacDbContext(IAbpLazyServiceProvider lazyServiceProvider) : base(lazyServiceProvider) + { + } /// /// 数据权限过滤 /// @@ -86,5 +90,6 @@ namespace Yi.Framework.Rbac.SqlSugarCore sqlSugarClient.QueryFilter.AddTableFilter(expUser.ToExpression()); sqlSugarClient.QueryFilter.AddTableFilter(expRole.ToExpression()); } + } } diff --git a/Yi.Abp.Net8/src/Yi.Abp.SqlSugarCore/YiDbContext.cs b/Yi.Abp.Net8/src/Yi.Abp.SqlSugarCore/YiDbContext.cs index 34aac630..ed2af8ad 100644 --- a/Yi.Abp.Net8/src/Yi.Abp.SqlSugarCore/YiDbContext.cs +++ b/Yi.Abp.Net8/src/Yi.Abp.SqlSugarCore/YiDbContext.cs @@ -8,5 +8,8 @@ namespace Yi.Abp.SqlSugarCore { public class YiDbContext : SqlSugarDbContext { + public YiDbContext(IAbpLazyServiceProvider lazyServiceProvider) : base(lazyServiceProvider) + { + } } }