From 0fc4f8d0c310682f58194ca4935917269dd41f44 Mon Sep 17 00:00:00 2001 From: colin Date: Tue, 24 Mar 2026 16:35:28 +0800 Subject: [PATCH] fix: Resolved #1444 --- .../Demo/Authors/EfCoreAuthorRepository.cs | 4 +- .../EfCoreLanguageRepository.cs | 4 +- .../EfCoreResourceRepository.cs | 4 +- .../EfCoreTextRepository.cs | 5 +- .../Platform/Datas/EfCoreDataRepository.cs | 4 +- .../Layouts/EfCoreLayoutRepository.cs | 4 +- .../Platform/Menus/EfCoreMenuRepository.cs | 4 +- .../Menus/EfCoreRoleMenuRepository.cs | 132 +++++++++--------- .../Menus/EfCoreUserFavoriteMenuRepository.cs | 4 +- .../Menus/EfCoreUserMenuRepository.cs | 4 +- .../Packages/EfCorePackageRepository.cs | 4 +- .../EfCoreBackgroundJobActionRepository.cs | 4 +- .../EfCoreBackgroundJobInfoRepository.cs | 4 +- .../EfCoreBackgroundJobLogRepository.cs | 4 +- .../ProjectName/Users/UserRepository.cs | 4 +- 15 files changed, 94 insertions(+), 95 deletions(-) diff --git a/aspnet-core/modules/demo/LINGYUN.Abp.Demo.EntityFrameworkCore/LINGYUN/Abp/Demo/Authors/EfCoreAuthorRepository.cs b/aspnet-core/modules/demo/LINGYUN.Abp.Demo.EntityFrameworkCore/LINGYUN/Abp/Demo/Authors/EfCoreAuthorRepository.cs index 4336e8e67..0866258db 100644 --- a/aspnet-core/modules/demo/LINGYUN.Abp.Demo.EntityFrameworkCore/LINGYUN/Abp/Demo/Authors/EfCoreAuthorRepository.cs +++ b/aspnet-core/modules/demo/LINGYUN.Abp.Demo.EntityFrameworkCore/LINGYUN/Abp/Demo/Authors/EfCoreAuthorRepository.cs @@ -6,11 +6,11 @@ namespace LINGYUN.Abp.Demo.Authors; public class EfCoreAuthorRepository - : EfCoreRepository, + : EfCoreRepository, IAuthorRepository { public EfCoreAuthorRepository( - IDbContextProvider dbContextProvider) + IDbContextProvider dbContextProvider) : base(dbContextProvider) { } diff --git a/aspnet-core/modules/localization-management/LINGYUN.Abp.LocalizationManagement.EntityFrameworkCore/LINGYUN/Abp/LocalizationManagement/EntityFrameworkCore/EfCoreLanguageRepository.cs b/aspnet-core/modules/localization-management/LINGYUN.Abp.LocalizationManagement.EntityFrameworkCore/LINGYUN/Abp/LocalizationManagement/EntityFrameworkCore/EfCoreLanguageRepository.cs index e1698ec03..649e2253b 100644 --- a/aspnet-core/modules/localization-management/LINGYUN.Abp.LocalizationManagement.EntityFrameworkCore/LINGYUN/Abp/LocalizationManagement/EntityFrameworkCore/EfCoreLanguageRepository.cs +++ b/aspnet-core/modules/localization-management/LINGYUN.Abp.LocalizationManagement.EntityFrameworkCore/LINGYUN/Abp/LocalizationManagement/EntityFrameworkCore/EfCoreLanguageRepository.cs @@ -9,11 +9,11 @@ namespace LINGYUN.Abp.LocalizationManagement.EntityFrameworkCore; -public class EfCoreLanguageRepository : EfCoreRepository, +public class EfCoreLanguageRepository : EfCoreRepository, ILanguageRepository { public EfCoreLanguageRepository( - IDbContextProvider dbContextProvider) : base(dbContextProvider) + IDbContextProvider dbContextProvider) : base(dbContextProvider) { } diff --git a/aspnet-core/modules/localization-management/LINGYUN.Abp.LocalizationManagement.EntityFrameworkCore/LINGYUN/Abp/LocalizationManagement/EntityFrameworkCore/EfCoreResourceRepository.cs b/aspnet-core/modules/localization-management/LINGYUN.Abp.LocalizationManagement.EntityFrameworkCore/LINGYUN/Abp/LocalizationManagement/EntityFrameworkCore/EfCoreResourceRepository.cs index 3291af769..269e308fe 100644 --- a/aspnet-core/modules/localization-management/LINGYUN.Abp.LocalizationManagement.EntityFrameworkCore/LINGYUN/Abp/LocalizationManagement/EntityFrameworkCore/EfCoreResourceRepository.cs +++ b/aspnet-core/modules/localization-management/LINGYUN.Abp.LocalizationManagement.EntityFrameworkCore/LINGYUN/Abp/LocalizationManagement/EntityFrameworkCore/EfCoreResourceRepository.cs @@ -9,11 +9,11 @@ namespace LINGYUN.Abp.LocalizationManagement.EntityFrameworkCore; -public class EfCoreResourceRepository : EfCoreRepository, +public class EfCoreResourceRepository : EfCoreRepository, IResourceRepository { public EfCoreResourceRepository( - IDbContextProvider dbContextProvider) : base(dbContextProvider) + IDbContextProvider dbContextProvider) : base(dbContextProvider) { } diff --git a/aspnet-core/modules/localization-management/LINGYUN.Abp.LocalizationManagement.EntityFrameworkCore/LINGYUN/Abp/LocalizationManagement/EntityFrameworkCore/EfCoreTextRepository.cs b/aspnet-core/modules/localization-management/LINGYUN.Abp.LocalizationManagement.EntityFrameworkCore/LINGYUN/Abp/LocalizationManagement/EntityFrameworkCore/EfCoreTextRepository.cs index 1834aff8f..af22207b1 100644 --- a/aspnet-core/modules/localization-management/LINGYUN.Abp.LocalizationManagement.EntityFrameworkCore/LINGYUN/Abp/LocalizationManagement/EntityFrameworkCore/EfCoreTextRepository.cs +++ b/aspnet-core/modules/localization-management/LINGYUN.Abp.LocalizationManagement.EntityFrameworkCore/LINGYUN/Abp/LocalizationManagement/EntityFrameworkCore/EfCoreTextRepository.cs @@ -1,5 +1,4 @@ using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Metadata.Internal; using System; using System.Collections.Generic; using System.Linq; @@ -11,11 +10,11 @@ namespace LINGYUN.Abp.LocalizationManagement.EntityFrameworkCore; -public class EfCoreTextRepository : EfCoreRepository, +public class EfCoreTextRepository : EfCoreRepository, ITextRepository { public EfCoreTextRepository( - IDbContextProvider dbContextProvider) : base(dbContextProvider) + IDbContextProvider dbContextProvider) : base(dbContextProvider) { } diff --git a/aspnet-core/modules/platform/LINGYUN.Platform.EntityFrameworkCore/LINGYUN/Platform/Datas/EfCoreDataRepository.cs b/aspnet-core/modules/platform/LINGYUN.Platform.EntityFrameworkCore/LINGYUN/Platform/Datas/EfCoreDataRepository.cs index 1b27973c0..cc66e8c9c 100644 --- a/aspnet-core/modules/platform/LINGYUN.Platform.EntityFrameworkCore/LINGYUN/Platform/Datas/EfCoreDataRepository.cs +++ b/aspnet-core/modules/platform/LINGYUN.Platform.EntityFrameworkCore/LINGYUN/Platform/Datas/EfCoreDataRepository.cs @@ -11,10 +11,10 @@ namespace LINGYUN.Platform.Datas; -public class EfCoreDataRepository : EfCoreRepository, IDataRepository +public class EfCoreDataRepository : EfCoreRepository, IDataRepository { public EfCoreDataRepository( - IDbContextProvider dbContextProvider) : base(dbContextProvider) + IDbContextProvider dbContextProvider) : base(dbContextProvider) { } diff --git a/aspnet-core/modules/platform/LINGYUN.Platform.EntityFrameworkCore/LINGYUN/Platform/Layouts/EfCoreLayoutRepository.cs b/aspnet-core/modules/platform/LINGYUN.Platform.EntityFrameworkCore/LINGYUN/Platform/Layouts/EfCoreLayoutRepository.cs index dd0cdb1c9..0a2379c2d 100644 --- a/aspnet-core/modules/platform/LINGYUN.Platform.EntityFrameworkCore/LINGYUN/Platform/Layouts/EfCoreLayoutRepository.cs +++ b/aspnet-core/modules/platform/LINGYUN.Platform.EntityFrameworkCore/LINGYUN/Platform/Layouts/EfCoreLayoutRepository.cs @@ -11,9 +11,9 @@ namespace LINGYUN.Platform.Layouts; -public class EfCoreLayoutRepository : EfCoreRepository, ILayoutRepository +public class EfCoreLayoutRepository : EfCoreRepository, ILayoutRepository { - public EfCoreLayoutRepository(IDbContextProvider dbContextProvider) + public EfCoreLayoutRepository(IDbContextProvider dbContextProvider) : base(dbContextProvider) { } diff --git a/aspnet-core/modules/platform/LINGYUN.Platform.EntityFrameworkCore/LINGYUN/Platform/Menus/EfCoreMenuRepository.cs b/aspnet-core/modules/platform/LINGYUN.Platform.EntityFrameworkCore/LINGYUN/Platform/Menus/EfCoreMenuRepository.cs index f88d7ec7f..950cf2bd0 100644 --- a/aspnet-core/modules/platform/LINGYUN.Platform.EntityFrameworkCore/LINGYUN/Platform/Menus/EfCoreMenuRepository.cs +++ b/aspnet-core/modules/platform/LINGYUN.Platform.EntityFrameworkCore/LINGYUN/Platform/Menus/EfCoreMenuRepository.cs @@ -11,10 +11,10 @@ namespace LINGYUN.Platform.Menus; -public class EfCoreMenuRepository : EfCoreRepository, IMenuRepository +public class EfCoreMenuRepository : EfCoreRepository, IMenuRepository { public EfCoreMenuRepository( - IDbContextProvider dbContextProvider) + IDbContextProvider dbContextProvider) : base(dbContextProvider) { } diff --git a/aspnet-core/modules/platform/LINGYUN.Platform.EntityFrameworkCore/LINGYUN/Platform/Menus/EfCoreRoleMenuRepository.cs b/aspnet-core/modules/platform/LINGYUN.Platform.EntityFrameworkCore/LINGYUN/Platform/Menus/EfCoreRoleMenuRepository.cs index 468b56f40..38e5b6fe2 100644 --- a/aspnet-core/modules/platform/LINGYUN.Platform.EntityFrameworkCore/LINGYUN/Platform/Menus/EfCoreRoleMenuRepository.cs +++ b/aspnet-core/modules/platform/LINGYUN.Platform.EntityFrameworkCore/LINGYUN/Platform/Menus/EfCoreRoleMenuRepository.cs @@ -1,70 +1,70 @@ -using LINGYUN.Platform.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Linq.Dynamic.Core; -using System.Threading; -using System.Threading.Tasks; -using Volo.Abp.Domain.Repositories.EntityFrameworkCore; -using Volo.Abp.EntityFrameworkCore; - -namespace LINGYUN.Platform.Menus; - -public class EfCoreRoleMenuRepository : EfCoreRepository, IRoleMenuRepository -{ - public EfCoreRoleMenuRepository( - IDbContextProvider dbContextProvider) - : base(dbContextProvider) - { - } - - public async virtual Task> GetListByRoleNameAsync( +using LINGYUN.Platform.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Linq.Dynamic.Core; +using System.Threading; +using System.Threading.Tasks; +using Volo.Abp.Domain.Repositories.EntityFrameworkCore; +using Volo.Abp.EntityFrameworkCore; + +namespace LINGYUN.Platform.Menus; + +public class EfCoreRoleMenuRepository : EfCoreRepository, IRoleMenuRepository +{ + public EfCoreRoleMenuRepository( + IDbContextProvider dbContextProvider) + : base(dbContextProvider) + { + } + + public async virtual Task> GetListByRoleNameAsync( string roleName, - string framework = null, - CancellationToken cancellationToken = default) - { - var dbContext = await GetDbContextAsync(); - - var menus = dbContext.Set(); - var roleMenus = dbContext.Set().Where(x => x.RoleName == roleName); - - IQueryable queryable; + string framework = null, + CancellationToken cancellationToken = default) + { + var dbContext = await GetDbContextAsync(); + + var menus = dbContext.Set(); + var roleMenus = dbContext.Set().Where(x => x.RoleName == roleName); + + IQueryable queryable; if (!framework.IsNullOrWhiteSpace()) { - queryable = from menu in menus - join roleMenu in roleMenus - on menu.Id equals roleMenu.MenuId - where menu.Framework == framework + queryable = from menu in menus + join roleMenu in roleMenus + on menu.Id equals roleMenu.MenuId + where menu.Framework == framework select roleMenu; - } + } else { queryable = roleMenus; } - return await queryable.ToListAsync(GetCancellationToken(cancellationToken)); - } - - public async virtual Task RoleHasInMenuAsync( - string roleName, - string menuName, - CancellationToken cancellationToken = default) - { - var menuQuery = (await GetDbContextAsync()).Set().Where(x => x.Name == menuName); - - return await - (from roleMenu in (await GetDbSetAsync()) - join menu in menuQuery - on roleMenu.MenuId equals menu.Id - select roleMenu) - .AnyAsync(x => x.RoleName == roleName, - GetCancellationToken(cancellationToken)); - } - - public async virtual Task FindStartupMenuAsync( + return await queryable.ToListAsync(GetCancellationToken(cancellationToken)); + } + + public async virtual Task RoleHasInMenuAsync( + string roleName, + string menuName, + CancellationToken cancellationToken = default) + { + var menuQuery = (await GetDbContextAsync()).Set().Where(x => x.Name == menuName); + + return await + (from roleMenu in (await GetDbSetAsync()) + join menu in menuQuery + on roleMenu.MenuId equals menu.Id + select roleMenu) + .AnyAsync(x => x.RoleName == roleName, + GetCancellationToken(cancellationToken)); + } + + public async virtual Task FindStartupMenuAsync( IEnumerable roleNames, - string framework = null, + string framework = null, CancellationToken cancellationToken = default) { var dbContext = await GetDbContextAsync(); @@ -72,13 +72,13 @@ public async virtual Task FindStartupMenuAsync( .Where(x => roleNames.Contains(x.RoleName)) .Where(x => x.Startup); - return await - (from roleMenu in roleMenuQuery - join menu in dbContext.Set() - on roleMenu.MenuId equals menu.Id - select menu) - .WhereIf(!framework.IsNullOrWhiteSpace(), x => x.Framework == framework) - .OrderByDescending(x => x.CreationTime) + return await + (from roleMenu in roleMenuQuery + join menu in dbContext.Set() + on roleMenu.MenuId equals menu.Id + select menu) + .WhereIf(!framework.IsNullOrWhiteSpace(), x => x.Framework == framework) + .OrderByDescending(x => x.CreationTime) .FirstOrDefaultAsync(GetCancellationToken(cancellationToken)); - } -} + } +} diff --git a/aspnet-core/modules/platform/LINGYUN.Platform.EntityFrameworkCore/LINGYUN/Platform/Menus/EfCoreUserFavoriteMenuRepository.cs b/aspnet-core/modules/platform/LINGYUN.Platform.EntityFrameworkCore/LINGYUN/Platform/Menus/EfCoreUserFavoriteMenuRepository.cs index f43af6609..0691d4956 100644 --- a/aspnet-core/modules/platform/LINGYUN.Platform.EntityFrameworkCore/LINGYUN/Platform/Menus/EfCoreUserFavoriteMenuRepository.cs +++ b/aspnet-core/modules/platform/LINGYUN.Platform.EntityFrameworkCore/LINGYUN/Platform/Menus/EfCoreUserFavoriteMenuRepository.cs @@ -10,11 +10,11 @@ namespace LINGYUN.Platform.Menus; public class EfCoreUserFavoriteMenuRepository : - EfCoreRepository, + EfCoreRepository, IUserFavoriteMenuRepository { public EfCoreUserFavoriteMenuRepository( - IDbContextProvider dbContextProvider) + IDbContextProvider dbContextProvider) : base(dbContextProvider) { } diff --git a/aspnet-core/modules/platform/LINGYUN.Platform.EntityFrameworkCore/LINGYUN/Platform/Menus/EfCoreUserMenuRepository.cs b/aspnet-core/modules/platform/LINGYUN.Platform.EntityFrameworkCore/LINGYUN/Platform/Menus/EfCoreUserMenuRepository.cs index fbe61f832..37a3dbd65 100644 --- a/aspnet-core/modules/platform/LINGYUN.Platform.EntityFrameworkCore/LINGYUN/Platform/Menus/EfCoreUserMenuRepository.cs +++ b/aspnet-core/modules/platform/LINGYUN.Platform.EntityFrameworkCore/LINGYUN/Platform/Menus/EfCoreUserMenuRepository.cs @@ -10,10 +10,10 @@ namespace LINGYUN.Platform.Menus; -public class EfCoreUserMenuRepository : EfCoreRepository, IUserMenuRepository +public class EfCoreUserMenuRepository : EfCoreRepository, IUserMenuRepository { public EfCoreUserMenuRepository( - IDbContextProvider dbContextProvider) + IDbContextProvider dbContextProvider) : base(dbContextProvider) { } diff --git a/aspnet-core/modules/platform/LINGYUN.Platform.EntityFrameworkCore/LINGYUN/Platform/Packages/EfCorePackageRepository.cs b/aspnet-core/modules/platform/LINGYUN.Platform.EntityFrameworkCore/LINGYUN/Platform/Packages/EfCorePackageRepository.cs index 9b7698f69..98c2fe4a7 100644 --- a/aspnet-core/modules/platform/LINGYUN.Platform.EntityFrameworkCore/LINGYUN/Platform/Packages/EfCorePackageRepository.cs +++ b/aspnet-core/modules/platform/LINGYUN.Platform.EntityFrameworkCore/LINGYUN/Platform/Packages/EfCorePackageRepository.cs @@ -12,11 +12,11 @@ namespace LINGYUN.Platform.Packages; public class EfCorePackageRepository : - EfCoreRepository, + EfCoreRepository, IPackageRepository { public EfCorePackageRepository( - IDbContextProvider dbContextProvider) + IDbContextProvider dbContextProvider) : base(dbContextProvider) { } diff --git a/aspnet-core/modules/task-management/LINGYUN.Abp.TaskManagement.EntityFrameworkCore/LINGYUN/Abp/TaskManagement/EntityFrameworkCore/EfCoreBackgroundJobActionRepository.cs b/aspnet-core/modules/task-management/LINGYUN.Abp.TaskManagement.EntityFrameworkCore/LINGYUN/Abp/TaskManagement/EntityFrameworkCore/EfCoreBackgroundJobActionRepository.cs index 5a5967f9f..f49c6cee8 100644 --- a/aspnet-core/modules/task-management/LINGYUN.Abp.TaskManagement.EntityFrameworkCore/LINGYUN/Abp/TaskManagement/EntityFrameworkCore/EfCoreBackgroundJobActionRepository.cs +++ b/aspnet-core/modules/task-management/LINGYUN.Abp.TaskManagement.EntityFrameworkCore/LINGYUN/Abp/TaskManagement/EntityFrameworkCore/EfCoreBackgroundJobActionRepository.cs @@ -9,11 +9,11 @@ namespace LINGYUN.Abp.TaskManagement.EntityFrameworkCore; public class EfCoreBackgroundJobActionRepository : - EfCoreRepository, + EfCoreRepository, IBackgroundJobActionRepository { public EfCoreBackgroundJobActionRepository( - IDbContextProvider dbContextProvider) + IDbContextProvider dbContextProvider) : base(dbContextProvider) { } diff --git a/aspnet-core/modules/task-management/LINGYUN.Abp.TaskManagement.EntityFrameworkCore/LINGYUN/Abp/TaskManagement/EntityFrameworkCore/EfCoreBackgroundJobInfoRepository.cs b/aspnet-core/modules/task-management/LINGYUN.Abp.TaskManagement.EntityFrameworkCore/LINGYUN/Abp/TaskManagement/EntityFrameworkCore/EfCoreBackgroundJobInfoRepository.cs index 7e1adcdac..0ca182810 100644 --- a/aspnet-core/modules/task-management/LINGYUN.Abp.TaskManagement.EntityFrameworkCore/LINGYUN/Abp/TaskManagement/EntityFrameworkCore/EfCoreBackgroundJobInfoRepository.cs +++ b/aspnet-core/modules/task-management/LINGYUN.Abp.TaskManagement.EntityFrameworkCore/LINGYUN/Abp/TaskManagement/EntityFrameworkCore/EfCoreBackgroundJobInfoRepository.cs @@ -14,14 +14,14 @@ namespace LINGYUN.Abp.TaskManagement.EntityFrameworkCore; public class EfCoreBackgroundJobInfoRepository : - EfCoreRepository, + EfCoreRepository, IBackgroundJobInfoRepository { protected IClock Clock { get; } public EfCoreBackgroundJobInfoRepository( IClock clock, - IDbContextProvider dbContextProvider) + IDbContextProvider dbContextProvider) : base(dbContextProvider) { Clock = clock; diff --git a/aspnet-core/modules/task-management/LINGYUN.Abp.TaskManagement.EntityFrameworkCore/LINGYUN/Abp/TaskManagement/EntityFrameworkCore/EfCoreBackgroundJobLogRepository.cs b/aspnet-core/modules/task-management/LINGYUN.Abp.TaskManagement.EntityFrameworkCore/LINGYUN/Abp/TaskManagement/EntityFrameworkCore/EfCoreBackgroundJobLogRepository.cs index a22494057..530c22930 100644 --- a/aspnet-core/modules/task-management/LINGYUN.Abp.TaskManagement.EntityFrameworkCore/LINGYUN/Abp/TaskManagement/EntityFrameworkCore/EfCoreBackgroundJobLogRepository.cs +++ b/aspnet-core/modules/task-management/LINGYUN.Abp.TaskManagement.EntityFrameworkCore/LINGYUN/Abp/TaskManagement/EntityFrameworkCore/EfCoreBackgroundJobLogRepository.cs @@ -12,11 +12,11 @@ namespace LINGYUN.Abp.TaskManagement.EntityFrameworkCore; public class EfCoreBackgroundJobLogRepository : - EfCoreRepository, + EfCoreRepository, IBackgroundJobLogRepository { public EfCoreBackgroundJobLogRepository( - IDbContextProvider dbContextProvider) + IDbContextProvider dbContextProvider) : base(dbContextProvider) { } diff --git a/aspnet-core/templates/aio/content/src/PackageName.CompanyName.ProjectName.EntityFrameworkCore/PackageName/CompanyName/ProjectName/Users/UserRepository.cs b/aspnet-core/templates/aio/content/src/PackageName.CompanyName.ProjectName.EntityFrameworkCore/PackageName/CompanyName/ProjectName/Users/UserRepository.cs index 72d1575bf..d30a28c24 100644 --- a/aspnet-core/templates/aio/content/src/PackageName.CompanyName.ProjectName.EntityFrameworkCore/PackageName/CompanyName/ProjectName/Users/UserRepository.cs +++ b/aspnet-core/templates/aio/content/src/PackageName.CompanyName.ProjectName.EntityFrameworkCore/PackageName/CompanyName/ProjectName/Users/UserRepository.cs @@ -8,9 +8,9 @@ namespace PackageName.CompanyName.ProjectName.Users { - public class UserRepository : EfCoreRepository, IUserRepository + public class UserRepository : EfCoreRepository, IUserRepository { - public UserRepository(IDbContextProvider dbContextProvider) : base(dbContextProvider) + public UserRepository(IDbContextProvider dbContextProvider) : base(dbContextProvider) { }