Browse Source

fix: Resolved #1444

pull/1449/head
colin 6 months ago
parent
commit
0fc4f8d0c3
  1. 4
      aspnet-core/modules/demo/LINGYUN.Abp.Demo.EntityFrameworkCore/LINGYUN/Abp/Demo/Authors/EfCoreAuthorRepository.cs
  2. 4
      aspnet-core/modules/localization-management/LINGYUN.Abp.LocalizationManagement.EntityFrameworkCore/LINGYUN/Abp/LocalizationManagement/EntityFrameworkCore/EfCoreLanguageRepository.cs
  3. 4
      aspnet-core/modules/localization-management/LINGYUN.Abp.LocalizationManagement.EntityFrameworkCore/LINGYUN/Abp/LocalizationManagement/EntityFrameworkCore/EfCoreResourceRepository.cs
  4. 5
      aspnet-core/modules/localization-management/LINGYUN.Abp.LocalizationManagement.EntityFrameworkCore/LINGYUN/Abp/LocalizationManagement/EntityFrameworkCore/EfCoreTextRepository.cs
  5. 4
      aspnet-core/modules/platform/LINGYUN.Platform.EntityFrameworkCore/LINGYUN/Platform/Datas/EfCoreDataRepository.cs
  6. 4
      aspnet-core/modules/platform/LINGYUN.Platform.EntityFrameworkCore/LINGYUN/Platform/Layouts/EfCoreLayoutRepository.cs
  7. 4
      aspnet-core/modules/platform/LINGYUN.Platform.EntityFrameworkCore/LINGYUN/Platform/Menus/EfCoreMenuRepository.cs
  8. 132
      aspnet-core/modules/platform/LINGYUN.Platform.EntityFrameworkCore/LINGYUN/Platform/Menus/EfCoreRoleMenuRepository.cs
  9. 4
      aspnet-core/modules/platform/LINGYUN.Platform.EntityFrameworkCore/LINGYUN/Platform/Menus/EfCoreUserFavoriteMenuRepository.cs
  10. 4
      aspnet-core/modules/platform/LINGYUN.Platform.EntityFrameworkCore/LINGYUN/Platform/Menus/EfCoreUserMenuRepository.cs
  11. 4
      aspnet-core/modules/platform/LINGYUN.Platform.EntityFrameworkCore/LINGYUN/Platform/Packages/EfCorePackageRepository.cs
  12. 4
      aspnet-core/modules/task-management/LINGYUN.Abp.TaskManagement.EntityFrameworkCore/LINGYUN/Abp/TaskManagement/EntityFrameworkCore/EfCoreBackgroundJobActionRepository.cs
  13. 4
      aspnet-core/modules/task-management/LINGYUN.Abp.TaskManagement.EntityFrameworkCore/LINGYUN/Abp/TaskManagement/EntityFrameworkCore/EfCoreBackgroundJobInfoRepository.cs
  14. 4
      aspnet-core/modules/task-management/LINGYUN.Abp.TaskManagement.EntityFrameworkCore/LINGYUN/Abp/TaskManagement/EntityFrameworkCore/EfCoreBackgroundJobLogRepository.cs
  15. 4
      aspnet-core/templates/aio/content/src/PackageName.CompanyName.ProjectName.EntityFrameworkCore/PackageName/CompanyName/ProjectName/Users/UserRepository.cs

4
aspnet-core/modules/demo/LINGYUN.Abp.Demo.EntityFrameworkCore/LINGYUN/Abp/Demo/Authors/EfCoreAuthorRepository.cs

@ -6,11 +6,11 @@ using Volo.Abp.EntityFrameworkCore;
namespace LINGYUN.Abp.Demo.Authors; namespace LINGYUN.Abp.Demo.Authors;
public class EfCoreAuthorRepository public class EfCoreAuthorRepository
: EfCoreRepository<DemoDbContext, Author, Guid>, : EfCoreRepository<IDemoDbContext, Author, Guid>,
IAuthorRepository IAuthorRepository
{ {
public EfCoreAuthorRepository( public EfCoreAuthorRepository(
IDbContextProvider<DemoDbContext> dbContextProvider) IDbContextProvider<IDemoDbContext> dbContextProvider)
: base(dbContextProvider) : base(dbContextProvider)
{ {
} }

4
aspnet-core/modules/localization-management/LINGYUN.Abp.LocalizationManagement.EntityFrameworkCore/LINGYUN/Abp/LocalizationManagement/EntityFrameworkCore/EfCoreLanguageRepository.cs

@ -9,11 +9,11 @@ using Volo.Abp.EntityFrameworkCore;
namespace LINGYUN.Abp.LocalizationManagement.EntityFrameworkCore; namespace LINGYUN.Abp.LocalizationManagement.EntityFrameworkCore;
public class EfCoreLanguageRepository : EfCoreRepository<LocalizationDbContext, Language, Guid>, public class EfCoreLanguageRepository : EfCoreRepository<ILocalizationDbContext, Language, Guid>,
ILanguageRepository ILanguageRepository
{ {
public EfCoreLanguageRepository( public EfCoreLanguageRepository(
IDbContextProvider<LocalizationDbContext> dbContextProvider) : base(dbContextProvider) IDbContextProvider<ILocalizationDbContext> dbContextProvider) : base(dbContextProvider)
{ {
} }

4
aspnet-core/modules/localization-management/LINGYUN.Abp.LocalizationManagement.EntityFrameworkCore/LINGYUN/Abp/LocalizationManagement/EntityFrameworkCore/EfCoreResourceRepository.cs

@ -9,11 +9,11 @@ using Volo.Abp.Threading;
namespace LINGYUN.Abp.LocalizationManagement.EntityFrameworkCore; namespace LINGYUN.Abp.LocalizationManagement.EntityFrameworkCore;
public class EfCoreResourceRepository : EfCoreRepository<LocalizationDbContext, Resource, Guid>, public class EfCoreResourceRepository : EfCoreRepository<ILocalizationDbContext, Resource, Guid>,
IResourceRepository IResourceRepository
{ {
public EfCoreResourceRepository( public EfCoreResourceRepository(
IDbContextProvider<LocalizationDbContext> dbContextProvider) : base(dbContextProvider) IDbContextProvider<ILocalizationDbContext> dbContextProvider) : base(dbContextProvider)
{ {
} }

5
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;
using Microsoft.EntityFrameworkCore.Metadata.Internal;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
@ -11,11 +10,11 @@ using Volo.Abp.EntityFrameworkCore;
namespace LINGYUN.Abp.LocalizationManagement.EntityFrameworkCore; namespace LINGYUN.Abp.LocalizationManagement.EntityFrameworkCore;
public class EfCoreTextRepository : EfCoreRepository<LocalizationDbContext, Text, int>, public class EfCoreTextRepository : EfCoreRepository<ILocalizationDbContext, Text, int>,
ITextRepository ITextRepository
{ {
public EfCoreTextRepository( public EfCoreTextRepository(
IDbContextProvider<LocalizationDbContext> dbContextProvider) : base(dbContextProvider) IDbContextProvider<ILocalizationDbContext> dbContextProvider) : base(dbContextProvider)
{ {
} }

4
aspnet-core/modules/platform/LINGYUN.Platform.EntityFrameworkCore/LINGYUN/Platform/Datas/EfCoreDataRepository.cs

@ -11,10 +11,10 @@ using Volo.Abp.EntityFrameworkCore;
namespace LINGYUN.Platform.Datas; namespace LINGYUN.Platform.Datas;
public class EfCoreDataRepository : EfCoreRepository<PlatformDbContext, Data, Guid>, IDataRepository public class EfCoreDataRepository : EfCoreRepository<IPlatformDbContext, Data, Guid>, IDataRepository
{ {
public EfCoreDataRepository( public EfCoreDataRepository(
IDbContextProvider<PlatformDbContext> dbContextProvider) : base(dbContextProvider) IDbContextProvider<IPlatformDbContext> dbContextProvider) : base(dbContextProvider)
{ {
} }

4
aspnet-core/modules/platform/LINGYUN.Platform.EntityFrameworkCore/LINGYUN/Platform/Layouts/EfCoreLayoutRepository.cs

@ -11,9 +11,9 @@ using Volo.Abp.EntityFrameworkCore;
namespace LINGYUN.Platform.Layouts; namespace LINGYUN.Platform.Layouts;
public class EfCoreLayoutRepository : EfCoreRepository<PlatformDbContext, Layout, Guid>, ILayoutRepository public class EfCoreLayoutRepository : EfCoreRepository<IPlatformDbContext, Layout, Guid>, ILayoutRepository
{ {
public EfCoreLayoutRepository(IDbContextProvider<PlatformDbContext> dbContextProvider) public EfCoreLayoutRepository(IDbContextProvider<IPlatformDbContext> dbContextProvider)
: base(dbContextProvider) : base(dbContextProvider)
{ {
} }

4
aspnet-core/modules/platform/LINGYUN.Platform.EntityFrameworkCore/LINGYUN/Platform/Menus/EfCoreMenuRepository.cs

@ -11,10 +11,10 @@ using Volo.Abp.EntityFrameworkCore;
namespace LINGYUN.Platform.Menus; namespace LINGYUN.Platform.Menus;
public class EfCoreMenuRepository : EfCoreRepository<PlatformDbContext, Menu, Guid>, IMenuRepository public class EfCoreMenuRepository : EfCoreRepository<IPlatformDbContext, Menu, Guid>, IMenuRepository
{ {
public EfCoreMenuRepository( public EfCoreMenuRepository(
IDbContextProvider<PlatformDbContext> dbContextProvider) IDbContextProvider<IPlatformDbContext> dbContextProvider)
: base(dbContextProvider) : base(dbContextProvider)
{ {
} }

132
aspnet-core/modules/platform/LINGYUN.Platform.EntityFrameworkCore/LINGYUN/Platform/Menus/EfCoreRoleMenuRepository.cs

@ -1,70 +1,70 @@
using LINGYUN.Platform.EntityFrameworkCore; using LINGYUN.Platform.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Linq.Dynamic.Core; using System.Linq.Dynamic.Core;
using System.Threading; using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
using Volo.Abp.Domain.Repositories.EntityFrameworkCore; using Volo.Abp.Domain.Repositories.EntityFrameworkCore;
using Volo.Abp.EntityFrameworkCore; using Volo.Abp.EntityFrameworkCore;
namespace LINGYUN.Platform.Menus; namespace LINGYUN.Platform.Menus;
public class EfCoreRoleMenuRepository : EfCoreRepository<PlatformDbContext, RoleMenu, Guid>, IRoleMenuRepository public class EfCoreRoleMenuRepository : EfCoreRepository<IPlatformDbContext, RoleMenu, Guid>, IRoleMenuRepository
{ {
public EfCoreRoleMenuRepository( public EfCoreRoleMenuRepository(
IDbContextProvider<PlatformDbContext> dbContextProvider) IDbContextProvider<IPlatformDbContext> dbContextProvider)
: base(dbContextProvider) : base(dbContextProvider)
{ {
} }
public async virtual Task<List<RoleMenu>> GetListByRoleNameAsync( public async virtual Task<List<RoleMenu>> GetListByRoleNameAsync(
string roleName, string roleName,
string framework = null, string framework = null,
CancellationToken cancellationToken = default) CancellationToken cancellationToken = default)
{ {
var dbContext = await GetDbContextAsync(); var dbContext = await GetDbContextAsync();
var menus = dbContext.Set<Menu>(); var menus = dbContext.Set<Menu>();
var roleMenus = dbContext.Set<RoleMenu>().Where(x => x.RoleName == roleName); var roleMenus = dbContext.Set<RoleMenu>().Where(x => x.RoleName == roleName);
IQueryable<RoleMenu> queryable; IQueryable<RoleMenu> queryable;
if (!framework.IsNullOrWhiteSpace()) if (!framework.IsNullOrWhiteSpace())
{ {
queryable = from menu in menus queryable = from menu in menus
join roleMenu in roleMenus join roleMenu in roleMenus
on menu.Id equals roleMenu.MenuId on menu.Id equals roleMenu.MenuId
where menu.Framework == framework where menu.Framework == framework
select roleMenu; select roleMenu;
} }
else else
{ {
queryable = roleMenus; queryable = roleMenus;
} }
return await queryable.ToListAsync(GetCancellationToken(cancellationToken)); return await queryable.ToListAsync(GetCancellationToken(cancellationToken));
} }
public async virtual Task<bool> RoleHasInMenuAsync( public async virtual Task<bool> RoleHasInMenuAsync(
string roleName, string roleName,
string menuName, string menuName,
CancellationToken cancellationToken = default) CancellationToken cancellationToken = default)
{ {
var menuQuery = (await GetDbContextAsync()).Set<Menu>().Where(x => x.Name == menuName); var menuQuery = (await GetDbContextAsync()).Set<Menu>().Where(x => x.Name == menuName);
return await return await
(from roleMenu in (await GetDbSetAsync()) (from roleMenu in (await GetDbSetAsync())
join menu in menuQuery join menu in menuQuery
on roleMenu.MenuId equals menu.Id on roleMenu.MenuId equals menu.Id
select roleMenu) select roleMenu)
.AnyAsync(x => x.RoleName == roleName, .AnyAsync(x => x.RoleName == roleName,
GetCancellationToken(cancellationToken)); GetCancellationToken(cancellationToken));
} }
public async virtual Task<Menu> FindStartupMenuAsync( public async virtual Task<Menu> FindStartupMenuAsync(
IEnumerable<string> roleNames, IEnumerable<string> roleNames,
string framework = null, string framework = null,
CancellationToken cancellationToken = default) CancellationToken cancellationToken = default)
{ {
var dbContext = await GetDbContextAsync(); var dbContext = await GetDbContextAsync();
@ -72,13 +72,13 @@ public class EfCoreRoleMenuRepository : EfCoreRepository<PlatformDbContext, Role
.Where(x => roleNames.Contains(x.RoleName)) .Where(x => roleNames.Contains(x.RoleName))
.Where(x => x.Startup); .Where(x => x.Startup);
return await return await
(from roleMenu in roleMenuQuery (from roleMenu in roleMenuQuery
join menu in dbContext.Set<Menu>() join menu in dbContext.Set<Menu>()
on roleMenu.MenuId equals menu.Id on roleMenu.MenuId equals menu.Id
select menu) select menu)
.WhereIf(!framework.IsNullOrWhiteSpace(), x => x.Framework == framework) .WhereIf(!framework.IsNullOrWhiteSpace(), x => x.Framework == framework)
.OrderByDescending(x => x.CreationTime) .OrderByDescending(x => x.CreationTime)
.FirstOrDefaultAsync(GetCancellationToken(cancellationToken)); .FirstOrDefaultAsync(GetCancellationToken(cancellationToken));
} }
} }

4
aspnet-core/modules/platform/LINGYUN.Platform.EntityFrameworkCore/LINGYUN/Platform/Menus/EfCoreUserFavoriteMenuRepository.cs

@ -10,11 +10,11 @@ using Volo.Abp.EntityFrameworkCore;
namespace LINGYUN.Platform.Menus; namespace LINGYUN.Platform.Menus;
public class EfCoreUserFavoriteMenuRepository : public class EfCoreUserFavoriteMenuRepository :
EfCoreRepository<PlatformDbContext, UserFavoriteMenu, Guid>, EfCoreRepository<IPlatformDbContext, UserFavoriteMenu, Guid>,
IUserFavoriteMenuRepository IUserFavoriteMenuRepository
{ {
public EfCoreUserFavoriteMenuRepository( public EfCoreUserFavoriteMenuRepository(
IDbContextProvider<PlatformDbContext> dbContextProvider) IDbContextProvider<IPlatformDbContext> dbContextProvider)
: base(dbContextProvider) : base(dbContextProvider)
{ {
} }

4
aspnet-core/modules/platform/LINGYUN.Platform.EntityFrameworkCore/LINGYUN/Platform/Menus/EfCoreUserMenuRepository.cs

@ -10,10 +10,10 @@ using Volo.Abp.EntityFrameworkCore;
namespace LINGYUN.Platform.Menus; namespace LINGYUN.Platform.Menus;
public class EfCoreUserMenuRepository : EfCoreRepository<PlatformDbContext, UserMenu, Guid>, IUserMenuRepository public class EfCoreUserMenuRepository : EfCoreRepository<IPlatformDbContext, UserMenu, Guid>, IUserMenuRepository
{ {
public EfCoreUserMenuRepository( public EfCoreUserMenuRepository(
IDbContextProvider<PlatformDbContext> dbContextProvider) IDbContextProvider<IPlatformDbContext> dbContextProvider)
: base(dbContextProvider) : base(dbContextProvider)
{ {
} }

4
aspnet-core/modules/platform/LINGYUN.Platform.EntityFrameworkCore/LINGYUN/Platform/Packages/EfCorePackageRepository.cs

@ -12,11 +12,11 @@ using Volo.Abp.Specifications;
namespace LINGYUN.Platform.Packages; namespace LINGYUN.Platform.Packages;
public class EfCorePackageRepository : public class EfCorePackageRepository :
EfCoreRepository<PlatformDbContext, Package, Guid>, EfCoreRepository<IPlatformDbContext, Package, Guid>,
IPackageRepository IPackageRepository
{ {
public EfCorePackageRepository( public EfCorePackageRepository(
IDbContextProvider<PlatformDbContext> dbContextProvider) IDbContextProvider<IPlatformDbContext> dbContextProvider)
: base(dbContextProvider) : base(dbContextProvider)
{ {
} }

4
aspnet-core/modules/task-management/LINGYUN.Abp.TaskManagement.EntityFrameworkCore/LINGYUN/Abp/TaskManagement/EntityFrameworkCore/EfCoreBackgroundJobActionRepository.cs

@ -9,11 +9,11 @@ using Volo.Abp.EntityFrameworkCore;
namespace LINGYUN.Abp.TaskManagement.EntityFrameworkCore; namespace LINGYUN.Abp.TaskManagement.EntityFrameworkCore;
public class EfCoreBackgroundJobActionRepository : public class EfCoreBackgroundJobActionRepository :
EfCoreRepository<TaskManagementDbContext, BackgroundJobAction, Guid>, EfCoreRepository<ITaskManagementDbContext, BackgroundJobAction, Guid>,
IBackgroundJobActionRepository IBackgroundJobActionRepository
{ {
public EfCoreBackgroundJobActionRepository( public EfCoreBackgroundJobActionRepository(
IDbContextProvider<TaskManagementDbContext> dbContextProvider) IDbContextProvider<ITaskManagementDbContext> dbContextProvider)
: base(dbContextProvider) : base(dbContextProvider)
{ {
} }

4
aspnet-core/modules/task-management/LINGYUN.Abp.TaskManagement.EntityFrameworkCore/LINGYUN/Abp/TaskManagement/EntityFrameworkCore/EfCoreBackgroundJobInfoRepository.cs

@ -14,14 +14,14 @@ using Volo.Abp.Timing;
namespace LINGYUN.Abp.TaskManagement.EntityFrameworkCore; namespace LINGYUN.Abp.TaskManagement.EntityFrameworkCore;
public class EfCoreBackgroundJobInfoRepository : public class EfCoreBackgroundJobInfoRepository :
EfCoreRepository<TaskManagementDbContext, BackgroundJobInfo, string>, EfCoreRepository<ITaskManagementDbContext, BackgroundJobInfo, string>,
IBackgroundJobInfoRepository IBackgroundJobInfoRepository
{ {
protected IClock Clock { get; } protected IClock Clock { get; }
public EfCoreBackgroundJobInfoRepository( public EfCoreBackgroundJobInfoRepository(
IClock clock, IClock clock,
IDbContextProvider<TaskManagementDbContext> dbContextProvider) IDbContextProvider<ITaskManagementDbContext> dbContextProvider)
: base(dbContextProvider) : base(dbContextProvider)
{ {
Clock = clock; Clock = clock;

4
aspnet-core/modules/task-management/LINGYUN.Abp.TaskManagement.EntityFrameworkCore/LINGYUN/Abp/TaskManagement/EntityFrameworkCore/EfCoreBackgroundJobLogRepository.cs

@ -12,11 +12,11 @@ using Volo.Abp.Specifications;
namespace LINGYUN.Abp.TaskManagement.EntityFrameworkCore; namespace LINGYUN.Abp.TaskManagement.EntityFrameworkCore;
public class EfCoreBackgroundJobLogRepository : public class EfCoreBackgroundJobLogRepository :
EfCoreRepository<TaskManagementDbContext, BackgroundJobLog, long>, EfCoreRepository<ITaskManagementDbContext, BackgroundJobLog, long>,
IBackgroundJobLogRepository IBackgroundJobLogRepository
{ {
public EfCoreBackgroundJobLogRepository( public EfCoreBackgroundJobLogRepository(
IDbContextProvider<TaskManagementDbContext> dbContextProvider) IDbContextProvider<ITaskManagementDbContext> dbContextProvider)
: base(dbContextProvider) : base(dbContextProvider)
{ {
} }

4
aspnet-core/templates/aio/content/src/PackageName.CompanyName.ProjectName.EntityFrameworkCore/PackageName/CompanyName/ProjectName/Users/UserRepository.cs

@ -8,9 +8,9 @@ using Volo.Abp.EntityFrameworkCore;
namespace PackageName.CompanyName.ProjectName.Users namespace PackageName.CompanyName.ProjectName.Users
{ {
public class UserRepository : EfCoreRepository<ProjectNameDbContext, User, Guid>, IUserRepository public class UserRepository : EfCoreRepository<IProjectNameDbContext, User, Guid>, IUserRepository
{ {
public UserRepository(IDbContextProvider<ProjectNameDbContext> dbContextProvider) : base(dbContextProvider) public UserRepository(IDbContextProvider<IProjectNameDbContext> dbContextProvider) : base(dbContextProvider)
{ {
} }

Loading…
Cancel
Save