添加数据库上下文改为 services.Add() 方法,TryAdd() 让后面的 YiRbacDbContext 无法注入,导致数据权限过滤失效了

This commit is contained in:
JiangCYkk
2025-03-28 16:32:35 +08:00
parent b830317608
commit 3d704220f3

View File

@@ -26,7 +26,7 @@ public static class SqlSugarCoreExtensions
ServiceLifetime serviceLifetime = ServiceLifetime.Transient)
where TDbContext : class, ISqlSugarDbContextDependencies
{
services.TryAdd(new ServiceDescriptor(
services.Add(new ServiceDescriptor(
typeof(ISqlSugarDbContextDependencies),
typeof(TDbContext),
serviceLifetime));