Browse Source

fix: Resolved #1444

pull/1449/head
colin 2 days 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;
public class EfCoreAuthorRepository
: EfCoreRepository<DemoDbContext, Author, Guid>,
: EfCoreRepository<IDemoDbContext, Author, Guid>,
IAuthorRepository
{
public EfCoreAuthorRepository(
IDbContextProvider<DemoDbContext> dbContextProvider)
IDbContextProvider<IDemoDbContext> 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;
public class EfCoreLanguageRepository : EfCoreRepository<LocalizationDbContext, Language, Guid>,
public class EfCoreLanguageRepository : EfCoreRepository<ILocalizationDbContext, Language, Guid>,
ILanguageRepository
{
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;
public class EfCoreResourceRepository : EfCoreRepository<LocalizationDbContext, Resource, Guid>,
public class EfCoreResourceRepository : EfCoreRepository<ILocalizationDbContext, Resource, Guid>,
IResourceRepository
{
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.Metadata.Internal;
using System;
using System.Collections.Generic;
using System.Linq;
@ -11,11 +10,11 @@ using Volo.Abp.EntityFrameworkCore;
namespace LINGYUN.Abp.LocalizationManagement.EntityFrameworkCore;
public class EfCoreTextRepository : EfCoreRepository<LocalizationDbContext, Text, int>,
public class EfCoreTextRepository : EfCoreRepository<ILocalizationDbContext, Text, int>,
ITextRepository
{
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;
public class EfCoreDataRepository : EfCoreRepository<PlatformDbContext, Data, Guid>, IDataRepository
public class EfCoreDataRepository : EfCoreRepository<IPlatformDbContext, Data, Guid>, IDataRepository
{
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;
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)
{
}

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;
public class EfCoreMenuRepository : EfCoreRepository<PlatformDbContext, Menu, Guid>, IMenuRepository
public class EfCoreMenuRepository : EfCoreRepository<IPlatformDbContext, Menu, Guid>, IMenuRepository
{
public EfCoreMenuRepository(
IDbContextProvider<PlatformDbContext> dbContextProvider)
IDbContextProvider<IPlatformDbContext> 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 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<PlatformDbContext, RoleMenu, Guid>, IRoleMenuRepository
{
public EfCoreRoleMenuRepository(
IDbContextProvider<PlatformDbContext> dbContextProvider)
: base(dbContextProvider)
{
}
public async virtual Task<List<RoleMenu>> 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<IPlatformDbContext, RoleMenu, Guid>, IRoleMenuRepository
{
public EfCoreRoleMenuRepository(
IDbContextProvider<IPlatformDbContext> dbContextProvider)
: base(dbContextProvider)
{
}
public async virtual Task<List<RoleMenu>> GetListByRoleNameAsync(
string roleName,
string framework = null,
CancellationToken cancellationToken = default)
{
var dbContext = await GetDbContextAsync();
var menus = dbContext.Set<Menu>();
var roleMenus = dbContext.Set<RoleMenu>().Where(x => x.RoleName == roleName);
IQueryable<RoleMenu> queryable;
string framework = null,
CancellationToken cancellationToken = default)
{
var dbContext = await GetDbContextAsync();
var menus = dbContext.Set<Menu>();
var roleMenus = dbContext.Set<RoleMenu>().Where(x => x.RoleName == roleName);
IQueryable<RoleMenu> 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<bool> RoleHasInMenuAsync(
string roleName,
string menuName,
CancellationToken cancellationToken = default)
{
var menuQuery = (await GetDbContextAsync()).Set<Menu>().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<Menu> FindStartupMenuAsync(
return await queryable.ToListAsync(GetCancellationToken(cancellationToken));
}
public async virtual Task<bool> RoleHasInMenuAsync(
string roleName,
string menuName,
CancellationToken cancellationToken = default)
{
var menuQuery = (await GetDbContextAsync()).Set<Menu>().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<Menu> FindStartupMenuAsync(
IEnumerable<string> roleNames,
string framework = null,
string framework = null,
CancellationToken cancellationToken = default)
{
var dbContext = await GetDbContextAsync();
@ -72,13 +72,13 @@ public class EfCoreRoleMenuRepository : EfCoreRepository<PlatformDbContext, Role
.Where(x => roleNames.Contains(x.RoleName))
.Where(x => x.Startup);
return await
(from roleMenu in roleMenuQuery
join menu in dbContext.Set<Menu>()
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<Menu>()
on roleMenu.MenuId equals menu.Id
select menu)
.WhereIf(!framework.IsNullOrWhiteSpace(), x => x.Framework == framework)
.OrderByDescending(x => x.CreationTime)
.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;
public class EfCoreUserFavoriteMenuRepository :
EfCoreRepository<PlatformDbContext, UserFavoriteMenu, Guid>,
EfCoreRepository<IPlatformDbContext, UserFavoriteMenu, Guid>,
IUserFavoriteMenuRepository
{
public EfCoreUserFavoriteMenuRepository(
IDbContextProvider<PlatformDbContext> dbContextProvider)
IDbContextProvider<IPlatformDbContext> 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;
public class EfCoreUserMenuRepository : EfCoreRepository<PlatformDbContext, UserMenu, Guid>, IUserMenuRepository
public class EfCoreUserMenuRepository : EfCoreRepository<IPlatformDbContext, UserMenu, Guid>, IUserMenuRepository
{
public EfCoreUserMenuRepository(
IDbContextProvider<PlatformDbContext> dbContextProvider)
IDbContextProvider<IPlatformDbContext> 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;
public class EfCorePackageRepository :
EfCoreRepository<PlatformDbContext, Package, Guid>,
EfCoreRepository<IPlatformDbContext, Package, Guid>,
IPackageRepository
{
public EfCorePackageRepository(
IDbContextProvider<PlatformDbContext> dbContextProvider)
IDbContextProvider<IPlatformDbContext> 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;
public class EfCoreBackgroundJobActionRepository :
EfCoreRepository<TaskManagementDbContext, BackgroundJobAction, Guid>,
EfCoreRepository<ITaskManagementDbContext, BackgroundJobAction, Guid>,
IBackgroundJobActionRepository
{
public EfCoreBackgroundJobActionRepository(
IDbContextProvider<TaskManagementDbContext> dbContextProvider)
IDbContextProvider<ITaskManagementDbContext> 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;
public class EfCoreBackgroundJobInfoRepository :
EfCoreRepository<TaskManagementDbContext, BackgroundJobInfo, string>,
EfCoreRepository<ITaskManagementDbContext, BackgroundJobInfo, string>,
IBackgroundJobInfoRepository
{
protected IClock Clock { get; }
public EfCoreBackgroundJobInfoRepository(
IClock clock,
IDbContextProvider<TaskManagementDbContext> dbContextProvider)
IDbContextProvider<ITaskManagementDbContext> dbContextProvider)
: base(dbContextProvider)
{
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;
public class EfCoreBackgroundJobLogRepository :
EfCoreRepository<TaskManagementDbContext, BackgroundJobLog, long>,
EfCoreRepository<ITaskManagementDbContext, BackgroundJobLog, long>,
IBackgroundJobLogRepository
{
public EfCoreBackgroundJobLogRepository(
IDbContextProvider<TaskManagementDbContext> dbContextProvider)
IDbContextProvider<ITaskManagementDbContext> 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
{
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