Browse Source

Remove unnecessary generic type parameter.

pull/21807/head
maliming 1 year ago
parent
commit
c2a5fa390c
No known key found for this signature in database GPG Key ID: A646B9CB645ECEA4
  1. 2
      docs/en/guides/microservice-mongodb.md
  2. 4
      modules/audit-logging/src/Volo.Abp.AuditLogging.MongoDB/Volo/Abp/AuditLogging/MongoDB/MongoAuditLogRepository.cs
  3. 12
      modules/cms-kit/src/Volo.CmsKit.MongoDB/Volo/CmsKit/MongoDB/Blogs/MongoBlogPostRepository.cs
  4. 2
      modules/cms-kit/src/Volo.CmsKit.MongoDB/Volo/CmsKit/MongoDB/Blogs/MongoBlogRepository.cs
  5. 2
      modules/cms-kit/src/Volo.CmsKit.MongoDB/Volo/CmsKit/MongoDB/Comments/MongoCommentRepository.cs
  6. 6
      modules/cms-kit/src/Volo.CmsKit.MongoDB/Volo/CmsKit/MongoDB/Pages/MongoPageRepository.cs
  7. 2
      modules/cms-kit/src/Volo.CmsKit.MongoDB/Volo/CmsKit/MongoDB/Tags/MongoTagRepository.cs
  8. 2
      modules/docs/src/Volo.Docs.MongoDB/Volo/Docs/Documents/MongoDocumentRepository.cs
  9. 2
      modules/docs/src/Volo.Docs.MongoDB/Volo/Docs/Projects/MongoProjectRepository.cs
  10. 6
      modules/identity/src/Volo.Abp.Identity.MongoDB/Volo/Abp/Identity/MongoDB/MongoIdentityClaimTypeRepository.cs
  11. 2
      modules/identity/src/Volo.Abp.Identity.MongoDB/Volo/Abp/Identity/MongoDB/MongoIdentityRoleRepository.cs
  12. 2
      modules/identity/src/Volo.Abp.Identity.MongoDB/Volo/Abp/Identity/MongoDB/MongoIdentitySecurityLogRepository.cs
  13. 34
      modules/identity/src/Volo.Abp.Identity.MongoDB/Volo/Abp/Identity/MongoDB/MongoIdentityUserRepository.cs
  14. 18
      modules/identity/src/Volo.Abp.Identity.MongoDB/Volo/Abp/Identity/MongoDB/MongoOrganizationUnitRepository.cs
  15. 4
      modules/identityserver/src/Volo.Abp.IdentityServer.MongoDB/Volo/Abp/IdentityServer/MongoDB/MongoApiResourceRepository.cs
  16. 4
      modules/identityserver/src/Volo.Abp.IdentityServer.MongoDB/Volo/Abp/IdentityServer/MongoDB/MongoApiScopeRepository.cs
  17. 4
      modules/identityserver/src/Volo.Abp.IdentityServer.MongoDB/Volo/Abp/IdentityServer/MongoDB/MongoClientRepository.cs
  18. 4
      modules/identityserver/src/Volo.Abp.IdentityServer.MongoDB/Volo/Abp/IdentityServer/MongoDB/MongoIdentityResourceRepository.cs
  19. 8
      modules/identityserver/src/Volo.Abp.IdentityServer.MongoDB/Volo/Abp/IdentityServer/MongoDB/MongoPersistentGrantRepository.cs
  20. 6
      modules/tenant-management/src/Volo.Abp.TenantManagement.MongoDB/Volo/Abp/TenantManagement/MongoDb/MongoTenantRepository.cs
  21. 6
      modules/users/src/Volo.Abp.Users.MongoDB/Volo/Abp/Users/MongoDB/MongoUserRepositoryBase.cs

2
docs/en/guides/microservice-mongodb.md

@ -99,7 +99,7 @@ Here we use `BookStore.ProductService` project as an example:
{ {
var query = ApplyFilter(await GetMongoQueryableAsync(cancellationToken), filterText, name, priceMin, priceMax); var query = ApplyFilter(await GetMongoQueryableAsync(cancellationToken), filterText, name, priceMin, priceMax);
query = query.OrderBy(string.IsNullOrWhiteSpace(sorting) ? ProductConsts.GetDefaultSorting(false) : sorting); query = query.OrderBy(string.IsNullOrWhiteSpace(sorting) ? ProductConsts.GetDefaultSorting(false) : sorting);
return await query.PageBy<Product, IQueryable<Product>>(skipCount, maxResultCount).ToListAsync(cancellationToken); return await query.PageBy(skipCount, maxResultCount).ToListAsync(cancellationToken);
} }
public async Task<long> GetCountAsync( public async Task<long> GetCountAsync(

4
modules/audit-logging/src/Volo.Abp.AuditLogging.MongoDB/Volo/Abp/AuditLogging/MongoDB/MongoAuditLogRepository.cs

@ -64,7 +64,7 @@ public class MongoAuditLogRepository : MongoDbRepository<IAuditLoggingMongoDbCon
return await query return await query
.OrderBy(sorting.IsNullOrWhiteSpace() ? (nameof(AuditLog.ExecutionTime) + " DESC") : sorting) .OrderBy(sorting.IsNullOrWhiteSpace() ? (nameof(AuditLog.ExecutionTime) + " DESC") : sorting)
.PageBy<AuditLog, IQueryable<AuditLog>>(skipCount, maxResultCount) .PageBy(skipCount, maxResultCount)
.ToListAsync(GetCancellationToken(cancellationToken)); .ToListAsync(GetCancellationToken(cancellationToken));
} }
@ -197,7 +197,7 @@ public class MongoAuditLogRepository : MongoDbRepository<IAuditLoggingMongoDbCon
return await query return await query
.OrderBy(sorting.IsNullOrWhiteSpace() ? (nameof(EntityChange.ChangeTime) + " DESC") : sorting) .OrderBy(sorting.IsNullOrWhiteSpace() ? (nameof(EntityChange.ChangeTime) + " DESC") : sorting)
.PageBy<EntityChange, IQueryable<EntityChange>>(skipCount, maxResultCount) .PageBy(skipCount, maxResultCount)
.ToListAsync(GetCancellationToken(cancellationToken)); .ToListAsync(GetCancellationToken(cancellationToken));
} }

12
modules/cms-kit/src/Volo.CmsKit.MongoDB/Volo/CmsKit/MongoDB/Blogs/MongoBlogPostRepository.cs

@ -65,12 +65,12 @@ public class MongoBlogPostRepository : MongoDbRepository<CmsKitMongoDbContext, B
var favoriteUserFilteredEntityIds = await GetFavoriteEntityIdsByUserId(favoriteUserId, cancellationToken); var favoriteUserFilteredEntityIds = await GetFavoriteEntityIdsByUserId(favoriteUserId, cancellationToken);
return await (await GetMongoQueryableAsync(cancellationToken)) return await (await GetMongoQueryableAsync(cancellationToken))
.WhereIf<BlogPost, IQueryable<BlogPost>>(tagFilteredEntityIds.Any(), x => tagFilteredEntityIds.Contains(x.Id)) .WhereIf(tagFilteredEntityIds.Any(), x => tagFilteredEntityIds.Contains(x.Id))
.WhereIf<BlogPost, IQueryable<BlogPost>>(favoriteUserFilteredEntityIds.Any(), x => favoriteUserFilteredEntityIds.Contains(x.Id)) .WhereIf(favoriteUserFilteredEntityIds.Any(), x => favoriteUserFilteredEntityIds.Contains(x.Id))
.WhereIf<BlogPost, IQueryable<BlogPost>>(!string.IsNullOrWhiteSpace(filter), x => x.Title.Contains(filter) || x.Slug.Contains(filter)) .WhereIf(!string.IsNullOrWhiteSpace(filter), x => x.Title.Contains(filter) || x.Slug.Contains(filter))
.WhereIf<BlogPost, IQueryable<BlogPost>>(blogId.HasValue, x => x.BlogId == blogId) .WhereIf(blogId.HasValue, x => x.BlogId == blogId)
.WhereIf<BlogPost, IQueryable<BlogPost>>(authorId.HasValue, x => x.AuthorId == authorId) .WhereIf(authorId.HasValue, x => x.AuthorId == authorId)
.WhereIf<BlogPost, IQueryable<BlogPost>>(statusFilter.HasValue, x => x.Status == statusFilter) .WhereIf(statusFilter.HasValue, x => x.Status == statusFilter)
.CountAsync(cancellationToken); .CountAsync(cancellationToken);
} }

2
modules/cms-kit/src/Volo.CmsKit.MongoDB/Volo/CmsKit/MongoDB/Blogs/MongoBlogRepository.cs

@ -44,7 +44,7 @@ public class MongoBlogRepository : MongoDbRepository<ICmsKitMongoDbContext, Blog
var query = await GetListQueryAsync(filter, token); var query = await GetListQueryAsync(filter, token);
return await query.OrderBy(sorting.IsNullOrEmpty() ? "creationTime desc" : sorting) return await query.OrderBy(sorting.IsNullOrEmpty() ? "creationTime desc" : sorting)
.PageBy<Blog, IQueryable<Blog>>(skipCount, maxResultCount) .PageBy(skipCount, maxResultCount)
.ToListAsync(token); .ToListAsync(token);
} }

2
modules/cms-kit/src/Volo.CmsKit.MongoDB/Volo/CmsKit/MongoDB/Comments/MongoCommentRepository.cs

@ -61,7 +61,7 @@ public class MongoCommentRepository : MongoDbRepository<ICmsKitMongoDbContext, C
token); token);
var comments = await query.OrderBy(sorting.IsNullOrEmpty() ? "creationTime desc" : sorting) var comments = await query.OrderBy(sorting.IsNullOrEmpty() ? "creationTime desc" : sorting)
.PageBy<Comment, IQueryable<Comment>>(skipCount, maxResultCount) .PageBy(skipCount, maxResultCount)
.ToListAsync(token); .ToListAsync(token);
var commentIds = comments.Select(x => x.Id).ToList(); var commentIds = comments.Select(x => x.Id).ToList();

6
modules/cms-kit/src/Volo.CmsKit.MongoDB/Volo/CmsKit/MongoDB/Pages/MongoPageRepository.cs

@ -27,7 +27,7 @@ public class MongoPageRepository : MongoDbRepository<ICmsKitMongoDbContext, Page
var cancellation = GetCancellationToken(cancellationToken); var cancellation = GetCancellationToken(cancellationToken);
return await (await GetMongoQueryableAsync(cancellation)) return await (await GetMongoQueryableAsync(cancellation))
.WhereIf<Page, IQueryable<Page>>( .WhereIf(
!filter.IsNullOrWhiteSpace(), !filter.IsNullOrWhiteSpace(),
u => u =>
u.Title.ToLower().Contains(filter.ToLower()) || u.Slug.Contains(filter) u.Title.ToLower().Contains(filter.ToLower()) || u.Slug.Contains(filter)
@ -44,11 +44,11 @@ public class MongoPageRepository : MongoDbRepository<ICmsKitMongoDbContext, Page
var cancellation = GetCancellationToken(cancellationToken); var cancellation = GetCancellationToken(cancellationToken);
return await (await GetMongoQueryableAsync(cancellation)) return await (await GetMongoQueryableAsync(cancellation))
.WhereIf<Page, IQueryable<Page>>( .WhereIf(
!filter.IsNullOrWhiteSpace(), !filter.IsNullOrWhiteSpace(),
u => u.Title.ToLower().Contains(filter) || u.Slug.Contains(filter)) u => u.Title.ToLower().Contains(filter) || u.Slug.Contains(filter))
.OrderBy(sorting.IsNullOrEmpty() ? nameof(Page.Title) : sorting) .OrderBy(sorting.IsNullOrEmpty() ? nameof(Page.Title) : sorting)
.PageBy<Page, IQueryable<Page>>(skipCount, maxResultCount) .PageBy(skipCount, maxResultCount)
.ToListAsync(cancellation); .ToListAsync(cancellation);
} }

2
modules/cms-kit/src/Volo.CmsKit.MongoDB/Volo/CmsKit/MongoDB/Tags/MongoTagRepository.cs

@ -116,7 +116,7 @@ public class MongoTagRepository : MongoDbRepository<ICmsKitMongoDbContext, Volo.
{ {
return await (await GetQueryableByFilterAsync(filter, cancellationToken)) return await (await GetQueryableByFilterAsync(filter, cancellationToken))
.OrderBy(sorting.IsNullOrEmpty() ? $"{nameof(Tag.CreationTime)}" : sorting) .OrderBy(sorting.IsNullOrEmpty() ? $"{nameof(Tag.CreationTime)}" : sorting)
.PageBy<Tag, IQueryable<Tag>>(skipCount, maxResultCount) .PageBy(skipCount, maxResultCount)
.ToListAsync(GetCancellationToken(cancellationToken)); .ToListAsync(GetCancellationToken(cancellationToken));
} }

2
modules/docs/src/Volo.Docs.MongoDB/Volo/Docs/Documents/MongoDocumentRepository.cs

@ -159,7 +159,7 @@ namespace Volo.Docs.Documents
lastSignificantUpdateTimeMax: lastSignificantUpdateTimeMax, lastSignificantUpdateTimeMax: lastSignificantUpdateTimeMax,
lastCachedTimeMin: lastCachedTimeMin, lastCachedTimeMax: lastCachedTimeMax, cancellationToken: cancellationToken)) lastCachedTimeMin: lastCachedTimeMin, lastCachedTimeMax: lastCachedTimeMax, cancellationToken: cancellationToken))
.OrderBy(string.IsNullOrWhiteSpace(sorting) ? "name asc" : sorting) .OrderBy(string.IsNullOrWhiteSpace(sorting) ? "name asc" : sorting)
.PageBy<DocumentWithoutContent, IQueryable<DocumentWithoutContent>>(skipCount, maxResultCount) .PageBy(skipCount, maxResultCount)
.ToListAsync(GetCancellationToken(cancellationToken)); .ToListAsync(GetCancellationToken(cancellationToken));
} }

2
modules/docs/src/Volo.Docs.MongoDB/Volo/Docs/Projects/MongoProjectRepository.cs

@ -22,7 +22,7 @@ namespace Volo.Docs.Projects
public virtual async Task<List<Project>> GetListAsync(string sorting, int maxResultCount, int skipCount, CancellationToken cancellationToken = default) public virtual async Task<List<Project>> GetListAsync(string sorting, int maxResultCount, int skipCount, CancellationToken cancellationToken = default)
{ {
var projects = await (await GetMongoQueryableAsync(cancellationToken)).OrderBy(sorting.IsNullOrEmpty() ? "Id desc" : sorting).PageBy<Project, IQueryable<Project>>(skipCount, maxResultCount) var projects = await (await GetMongoQueryableAsync(cancellationToken)).OrderBy(sorting.IsNullOrEmpty() ? "Id desc" : sorting).PageBy(skipCount, maxResultCount)
.ToListAsync(GetCancellationToken(cancellationToken)); .ToListAsync(GetCancellationToken(cancellationToken));
return projects; return projects;

6
modules/identity/src/Volo.Abp.Identity.MongoDB/Volo/Abp/Identity/MongoDB/MongoIdentityClaimTypeRepository.cs

@ -44,13 +44,13 @@ public class MongoIdentityClaimTypeRepository : MongoDbRepository<IAbpIdentityMo
CancellationToken cancellationToken = default) CancellationToken cancellationToken = default)
{ {
return await (await GetMongoQueryableAsync(cancellationToken)) return await (await GetMongoQueryableAsync(cancellationToken))
.WhereIf<IdentityClaimType, IQueryable<IdentityClaimType>>( .WhereIf(
!filter.IsNullOrWhiteSpace(), !filter.IsNullOrWhiteSpace(),
u => u =>
u.Name.Contains(filter) u.Name.Contains(filter)
) )
.OrderBy(sorting.IsNullOrWhiteSpace() ? nameof(IdentityClaimType.CreationTime) + " desc" : sorting) .OrderBy(sorting.IsNullOrWhiteSpace() ? nameof(IdentityClaimType.CreationTime) + " desc" : sorting)
.PageBy<IdentityClaimType, IQueryable<IdentityClaimType>>(skipCount, maxResultCount) .PageBy(skipCount, maxResultCount)
.ToListAsync(GetCancellationToken(cancellationToken)); .ToListAsync(GetCancellationToken(cancellationToken));
} }
@ -59,7 +59,7 @@ public class MongoIdentityClaimTypeRepository : MongoDbRepository<IAbpIdentityMo
CancellationToken cancellationToken = default) CancellationToken cancellationToken = default)
{ {
return await (await GetMongoQueryableAsync(cancellationToken)) return await (await GetMongoQueryableAsync(cancellationToken))
.WhereIf<IdentityClaimType, IQueryable<IdentityClaimType>>( .WhereIf(
!filter.IsNullOrWhiteSpace(), !filter.IsNullOrWhiteSpace(),
u => u =>
u.Name.Contains(filter) u.Name.Contains(filter)

2
modules/identity/src/Volo.Abp.Identity.MongoDB/Volo/Abp/Identity/MongoDB/MongoIdentityRoleRepository.cs

@ -125,7 +125,7 @@ public class MongoIdentityRoleRepository : MongoDbRepository<IAbpIdentityMongoDb
x => x.Name.Contains(filter) || x => x.Name.Contains(filter) ||
x.NormalizedName.Contains(filter)) x.NormalizedName.Contains(filter))
.OrderBy(sorting.IsNullOrWhiteSpace() ? nameof(IdentityRole.CreationTime) + " desc" : sorting) .OrderBy(sorting.IsNullOrWhiteSpace() ? nameof(IdentityRole.CreationTime) + " desc" : sorting)
.PageBy<IdentityRole, IQueryable<IdentityRole>>(skipCount, maxResultCount) .PageBy(skipCount, maxResultCount)
.ToListAsync(GetCancellationToken(cancellationToken)); .ToListAsync(GetCancellationToken(cancellationToken));
} }
} }

2
modules/identity/src/Volo.Abp.Identity.MongoDB/Volo/Abp/Identity/MongoDB/MongoIdentitySecurityLogRepository.cs

@ -51,7 +51,7 @@ public class MongoIdentitySecurityLogRepository :
); );
return await query.OrderBy(sorting.IsNullOrWhiteSpace() ? $"{nameof(IdentitySecurityLog.CreationTime)} desc" : sorting) return await query.OrderBy(sorting.IsNullOrWhiteSpace() ? $"{nameof(IdentitySecurityLog.CreationTime)} desc" : sorting)
.PageBy<IdentitySecurityLog, IQueryable<IdentitySecurityLog>>(skipCount, maxResultCount) .PageBy(skipCount, maxResultCount)
.ToListAsync(GetCancellationToken(cancellationToken)); .ToListAsync(GetCancellationToken(cancellationToken));
} }

34
modules/identity/src/Volo.Abp.Identity.MongoDB/Volo/Abp/Identity/MongoDB/MongoIdentityUserRepository.cs

@ -201,7 +201,7 @@ public class MongoIdentityUserRepository : MongoDbRepository<IAbpIdentityMongoDb
return await query return await query
.OrderBy(sorting.IsNullOrWhiteSpace() ? nameof(IdentityUser.CreationTime) + " desc" : sorting) .OrderBy(sorting.IsNullOrWhiteSpace() ? nameof(IdentityUser.CreationTime) + " desc" : sorting)
.PageBy<IdentityUser, IQueryable<IdentityUser>>(skipCount, maxResultCount) .PageBy(skipCount, maxResultCount)
.ToListAsync(GetCancellationToken(cancellationToken)); .ToListAsync(GetCancellationToken(cancellationToken));
} }
@ -454,7 +454,7 @@ public class MongoIdentityUserRepository : MongoDbRepository<IAbpIdentityMongoDb
} }
return query return query
.WhereIf<IdentityUser, IQueryable<IdentityUser>>( .WhereIf(
!filter.IsNullOrWhiteSpace(), !filter.IsNullOrWhiteSpace(),
u => u =>
u.NormalizedUserName.Contains(upperFilter) || u.NormalizedUserName.Contains(upperFilter) ||
@ -463,20 +463,20 @@ public class MongoIdentityUserRepository : MongoDbRepository<IAbpIdentityMongoDb
(u.Surname != null && u.Surname.Contains(filter)) || (u.Surname != null && u.Surname.Contains(filter)) ||
(u.PhoneNumber != null && u.PhoneNumber.Contains(filter)) (u.PhoneNumber != null && u.PhoneNumber.Contains(filter))
) )
.WhereIf<IdentityUser, IQueryable<IdentityUser>>(organizationUnitId.HasValue, identityUser => identityUser.OrganizationUnits.Any(x => x.OrganizationUnitId == organizationUnitId.Value)) .WhereIf(organizationUnitId.HasValue, identityUser => identityUser.OrganizationUnits.Any(x => x.OrganizationUnitId == organizationUnitId.Value))
.WhereIf<IdentityUser, IQueryable<IdentityUser>>(!string.IsNullOrWhiteSpace(userName), x => x.UserName == userName) .WhereIf(!string.IsNullOrWhiteSpace(userName), x => x.UserName == userName)
.WhereIf<IdentityUser, IQueryable<IdentityUser>>(!string.IsNullOrWhiteSpace(phoneNumber), x => x.PhoneNumber == phoneNumber) .WhereIf(!string.IsNullOrWhiteSpace(phoneNumber), x => x.PhoneNumber == phoneNumber)
.WhereIf<IdentityUser, IQueryable<IdentityUser>>(!string.IsNullOrWhiteSpace(emailAddress), x => x.Email == emailAddress) .WhereIf(!string.IsNullOrWhiteSpace(emailAddress), x => x.Email == emailAddress)
.WhereIf<IdentityUser, IQueryable<IdentityUser>>(!string.IsNullOrWhiteSpace(name), x => x.Name == name) .WhereIf(!string.IsNullOrWhiteSpace(name), x => x.Name == name)
.WhereIf<IdentityUser, IQueryable<IdentityUser>>(!string.IsNullOrWhiteSpace(surname), x => x.Surname == surname) .WhereIf(!string.IsNullOrWhiteSpace(surname), x => x.Surname == surname)
.WhereIf<IdentityUser, IQueryable<IdentityUser>>(isLockedOut.HasValue && isLockedOut.Value, x => x.LockoutEnabled && x.LockoutEnd != null && x.LockoutEnd > DateTimeOffset.UtcNow) .WhereIf(isLockedOut.HasValue && isLockedOut.Value, x => x.LockoutEnabled && x.LockoutEnd != null && x.LockoutEnd > DateTimeOffset.UtcNow)
.WhereIf<IdentityUser, IQueryable<IdentityUser>>(isLockedOut.HasValue && !isLockedOut.Value, x => !(x.LockoutEnabled && x.LockoutEnd != null && x.LockoutEnd > DateTimeOffset.UtcNow)) .WhereIf(isLockedOut.HasValue && !isLockedOut.Value, x => !(x.LockoutEnabled && x.LockoutEnd != null && x.LockoutEnd > DateTimeOffset.UtcNow))
.WhereIf<IdentityUser, IQueryable<IdentityUser>>(notActive.HasValue, x => x.IsActive == !notActive.Value) .WhereIf(notActive.HasValue, x => x.IsActive == !notActive.Value)
.WhereIf<IdentityUser, IQueryable<IdentityUser>>(emailConfirmed.HasValue, x => x.EmailConfirmed == emailConfirmed.Value) .WhereIf(emailConfirmed.HasValue, x => x.EmailConfirmed == emailConfirmed.Value)
.WhereIf<IdentityUser, IQueryable<IdentityUser>>(isExternal.HasValue, x => x.IsExternal == isExternal.Value) .WhereIf(isExternal.HasValue, x => x.IsExternal == isExternal.Value)
.WhereIf<IdentityUser, IQueryable<IdentityUser>>(maxCreationTime != null, p => p.CreationTime <= maxCreationTime) .WhereIf(maxCreationTime != null, p => p.CreationTime <= maxCreationTime)
.WhereIf<IdentityUser, IQueryable<IdentityUser>>(minCreationTime != null, p => p.CreationTime >= minCreationTime) .WhereIf(minCreationTime != null, p => p.CreationTime >= minCreationTime)
.WhereIf<IdentityUser, IQueryable<IdentityUser>>(maxModifitionTime != null, p => p.LastModificationTime <= maxModifitionTime) .WhereIf(maxModifitionTime != null, p => p.LastModificationTime <= maxModifitionTime)
.WhereIf<IdentityUser, IQueryable<IdentityUser>>(minModifitionTime != null, p => p.LastModificationTime >= minModifitionTime); .WhereIf(minModifitionTime != null, p => p.LastModificationTime >= minModifitionTime);
} }
} }

18
modules/identity/src/Volo.Abp.Identity.MongoDB/Volo/Abp/Identity/MongoDB/MongoOrganizationUnitRepository.cs

@ -72,7 +72,7 @@ public class MongoOrganizationUnitRepository
{ {
return await (await GetMongoQueryableAsync(cancellationToken)) return await (await GetMongoQueryableAsync(cancellationToken))
.OrderBy(sorting.IsNullOrEmpty() ? nameof(OrganizationUnit.CreationTime) + " desc" : sorting) .OrderBy(sorting.IsNullOrEmpty() ? nameof(OrganizationUnit.CreationTime) + " desc" : sorting)
.PageBy<OrganizationUnit, IQueryable<OrganizationUnit>>(skipCount, maxResultCount) .PageBy(skipCount, maxResultCount)
.ToListAsync(GetCancellationToken(cancellationToken)); .ToListAsync(GetCancellationToken(cancellationToken));
} }
@ -102,7 +102,7 @@ public class MongoOrganizationUnitRepository
return await (await GetMongoQueryableAsync<IdentityRole>(cancellationToken)) return await (await GetMongoQueryableAsync<IdentityRole>(cancellationToken))
.Where(r => roleIds.Contains(r.Id)) .Where(r => roleIds.Contains(r.Id))
.OrderBy(sorting.IsNullOrEmpty() ? nameof(IdentityRole.Name) : sorting) .OrderBy(sorting.IsNullOrEmpty() ? nameof(IdentityRole.Name) : sorting)
.PageBy<IdentityRole, IQueryable<IdentityRole>>(skipCount, maxResultCount) .PageBy(skipCount, maxResultCount)
.ToListAsync(GetCancellationToken(cancellationToken)); .ToListAsync(GetCancellationToken(cancellationToken));
} }
@ -123,7 +123,7 @@ public class MongoOrganizationUnitRepository
return await (await GetMongoQueryableAsync<IdentityRole>(cancellationToken)) return await (await GetMongoQueryableAsync<IdentityRole>(cancellationToken))
.Where(r => roleIds.Contains(r.Id)) .Where(r => roleIds.Contains(r.Id))
.OrderBy(sorting.IsNullOrEmpty() ? nameof(IdentityRole.Name) : sorting) .OrderBy(sorting.IsNullOrEmpty() ? nameof(IdentityRole.Name) : sorting)
.PageBy<IdentityRole, IQueryable<IdentityRole>>(skipCount, maxResultCount) .PageBy(skipCount, maxResultCount)
.ToListAsync(GetCancellationToken(cancellationToken)); .ToListAsync(GetCancellationToken(cancellationToken));
} }
@ -151,7 +151,7 @@ public class MongoOrganizationUnitRepository
.Where(r => !roleIds.Contains(r.Id)) .Where(r => !roleIds.Contains(r.Id))
.WhereIf(!filter.IsNullOrWhiteSpace(), r => r.Name.Contains(filter)) .WhereIf(!filter.IsNullOrWhiteSpace(), r => r.Name.Contains(filter))
.OrderBy(sorting.IsNullOrEmpty() ? nameof(IdentityRole.Name) : sorting) .OrderBy(sorting.IsNullOrEmpty() ? nameof(IdentityRole.Name) : sorting)
.PageBy<IdentityRole, IQueryable<IdentityRole>>(skipCount, maxResultCount) .PageBy(skipCount, maxResultCount)
.ToListAsync(GetCancellationToken(cancellationToken)); .ToListAsync(GetCancellationToken(cancellationToken));
} }
@ -181,7 +181,7 @@ public class MongoOrganizationUnitRepository
var query = await CreateGetMembersFilteredQueryAsync(organizationUnit, filter, cancellationToken); var query = await CreateGetMembersFilteredQueryAsync(organizationUnit, filter, cancellationToken);
return await query return await query
.OrderBy(sorting.IsNullOrEmpty() ? nameof(IdentityUser.UserName) : sorting) .OrderBy(sorting.IsNullOrEmpty() ? nameof(IdentityUser.UserName) : sorting)
.PageBy<IdentityUser, IQueryable<IdentityUser>>(skipCount, maxResultCount) .PageBy(skipCount, maxResultCount)
.ToListAsync(cancellationToken); .ToListAsync(cancellationToken);
} }
@ -215,7 +215,7 @@ public class MongoOrganizationUnitRepository
return await return await
(await GetMongoQueryableAsync<IdentityUser>(cancellationToken)) (await GetMongoQueryableAsync<IdentityUser>(cancellationToken))
.Where(u => !u.OrganizationUnits.Any(uou => uou.OrganizationUnitId == organizationUnit.Id)) .Where(u => !u.OrganizationUnits.Any(uou => uou.OrganizationUnitId == organizationUnit.Id))
.WhereIf<IdentityUser, IQueryable<IdentityUser>>( .WhereIf(
!filter.IsNullOrWhiteSpace(), !filter.IsNullOrWhiteSpace(),
u => u =>
u.UserName.Contains(filter) || u.UserName.Contains(filter) ||
@ -223,7 +223,7 @@ public class MongoOrganizationUnitRepository
(u.PhoneNumber != null && u.PhoneNumber.Contains(filter)) (u.PhoneNumber != null && u.PhoneNumber.Contains(filter))
) )
.OrderBy(sorting.IsNullOrEmpty() ? nameof(IdentityUser.UserName) : sorting) .OrderBy(sorting.IsNullOrEmpty() ? nameof(IdentityUser.UserName) : sorting)
.PageBy<IdentityUser, IQueryable<IdentityUser>>(skipCount, maxResultCount) .PageBy(skipCount, maxResultCount)
.ToListAsync(GetCancellationToken(cancellationToken)); .ToListAsync(GetCancellationToken(cancellationToken));
} }
@ -232,7 +232,7 @@ public class MongoOrganizationUnitRepository
{ {
return await (await GetMongoQueryableAsync<IdentityUser>(cancellationToken)) return await (await GetMongoQueryableAsync<IdentityUser>(cancellationToken))
.Where(u => !u.OrganizationUnits.Any(uou => uou.OrganizationUnitId == organizationUnit.Id)) .Where(u => !u.OrganizationUnits.Any(uou => uou.OrganizationUnitId == organizationUnit.Id))
.WhereIf<IdentityUser, IQueryable<IdentityUser>>( .WhereIf(
!filter.IsNullOrWhiteSpace(), !filter.IsNullOrWhiteSpace(),
u => u =>
u.UserName.Contains(filter) || u.UserName.Contains(filter) ||
@ -271,7 +271,7 @@ public class MongoOrganizationUnitRepository
{ {
return (await GetMongoQueryableAsync<IdentityUser>(cancellationToken)) return (await GetMongoQueryableAsync<IdentityUser>(cancellationToken))
.Where(u => u.OrganizationUnits.Any(uou => uou.OrganizationUnitId == organizationUnit.Id)) .Where(u => u.OrganizationUnits.Any(uou => uou.OrganizationUnitId == organizationUnit.Id))
.WhereIf<IdentityUser, IQueryable<IdentityUser>>( .WhereIf(
!filter.IsNullOrWhiteSpace(), !filter.IsNullOrWhiteSpace(),
u => u =>
u.UserName.Contains(filter) || u.UserName.Contains(filter) ||

4
modules/identityserver/src/Volo.Abp.IdentityServer.MongoDB/Volo/Abp/IdentityServer/MongoDB/MongoApiResourceRepository.cs

@ -50,14 +50,14 @@ public class MongoApiResourceRepository : MongoDbRepository<IAbpIdentityServerMo
x.Description.Contains(filter) || x.Description.Contains(filter) ||
x.DisplayName.Contains(filter)) x.DisplayName.Contains(filter))
.OrderBy(sorting.IsNullOrWhiteSpace() ? nameof(ApiResource.Name) : sorting) .OrderBy(sorting.IsNullOrWhiteSpace() ? nameof(ApiResource.Name) : sorting)
.PageBy<ApiResource, IQueryable<ApiResource>>(skipCount, maxResultCount) .PageBy(skipCount, maxResultCount)
.ToListAsync(GetCancellationToken(cancellationToken)); .ToListAsync(GetCancellationToken(cancellationToken));
} }
public virtual async Task<long> GetCountAsync(string filter = null, CancellationToken cancellationToken = default) public virtual async Task<long> GetCountAsync(string filter = null, CancellationToken cancellationToken = default)
{ {
return await (await GetMongoQueryableAsync(cancellationToken)) return await (await GetMongoQueryableAsync(cancellationToken))
.WhereIf<ApiResource, IQueryable<ApiResource>>(!filter.IsNullOrWhiteSpace(), .WhereIf(!filter.IsNullOrWhiteSpace(),
x => x.Name.Contains(filter) || x => x.Name.Contains(filter) ||
x.Description.Contains(filter) || x.Description.Contains(filter) ||
x.DisplayName.Contains(filter)) x.DisplayName.Contains(filter))

4
modules/identityserver/src/Volo.Abp.IdentityServer.MongoDB/Volo/Abp/IdentityServer/MongoDB/MongoApiScopeRepository.cs

@ -45,14 +45,14 @@ public class MongoApiScopeRepository : MongoDbRepository<IAbpIdentityServerMongo
x.Description.Contains(filter) || x.Description.Contains(filter) ||
x.DisplayName.Contains(filter)) x.DisplayName.Contains(filter))
.OrderBy(sorting.IsNullOrWhiteSpace() ? nameof(ApiScope.Name) : sorting) .OrderBy(sorting.IsNullOrWhiteSpace() ? nameof(ApiScope.Name) : sorting)
.PageBy<ApiScope, IQueryable<ApiScope>>(skipCount, maxResultCount) .PageBy(skipCount, maxResultCount)
.ToListAsync(GetCancellationToken(cancellationToken)); .ToListAsync(GetCancellationToken(cancellationToken));
} }
public virtual async Task<long> GetCountAsync(string filter = null, CancellationToken cancellationToken = default) public virtual async Task<long> GetCountAsync(string filter = null, CancellationToken cancellationToken = default)
{ {
return await (await GetMongoQueryableAsync(cancellationToken)) return await (await GetMongoQueryableAsync(cancellationToken))
.WhereIf<ApiScope, IQueryable<ApiScope>>(!filter.IsNullOrWhiteSpace(), .WhereIf(!filter.IsNullOrWhiteSpace(),
x => x.Name.Contains(filter) || x => x.Name.Contains(filter) ||
x.Description.Contains(filter) || x.Description.Contains(filter) ||
x.DisplayName.Contains(filter)) x.DisplayName.Contains(filter))

4
modules/identityserver/src/Volo.Abp.IdentityServer.MongoDB/Volo/Abp/IdentityServer/MongoDB/MongoClientRepository.cs

@ -42,14 +42,14 @@ public class MongoClientRepository : MongoDbRepository<IAbpIdentityServerMongoDb
return await (await GetMongoQueryableAsync(cancellationToken)) return await (await GetMongoQueryableAsync(cancellationToken))
.WhereIf(!filter.IsNullOrWhiteSpace(), x => x.ClientId.Contains(filter)) .WhereIf(!filter.IsNullOrWhiteSpace(), x => x.ClientId.Contains(filter))
.OrderBy(sorting.IsNullOrWhiteSpace() ? nameof(Client.ClientName) : sorting) .OrderBy(sorting.IsNullOrWhiteSpace() ? nameof(Client.ClientName) : sorting)
.PageBy<Client, IQueryable<Client>>(skipCount, maxResultCount) .PageBy(skipCount, maxResultCount)
.ToListAsync(GetCancellationToken(cancellationToken)); .ToListAsync(GetCancellationToken(cancellationToken));
} }
public virtual async Task<long> GetCountAsync(string filter = null, CancellationToken cancellationToken = default) public virtual async Task<long> GetCountAsync(string filter = null, CancellationToken cancellationToken = default)
{ {
return await (await GetMongoQueryableAsync(cancellationToken)) return await (await GetMongoQueryableAsync(cancellationToken))
.WhereIf<Client, IQueryable<Client>>(!filter.IsNullOrWhiteSpace(), .WhereIf(!filter.IsNullOrWhiteSpace(),
x => x.ClientId.Contains(filter)) x => x.ClientId.Contains(filter))
.LongCountAsync(GetCancellationToken(cancellationToken)); .LongCountAsync(GetCancellationToken(cancellationToken));
} }

4
modules/identityserver/src/Volo.Abp.IdentityServer.MongoDB/Volo/Abp/IdentityServer/MongoDB/MongoIdentityResourceRepository.cs

@ -25,14 +25,14 @@ public class MongoIdentityResourceRepository : MongoDbRepository<IAbpIdentitySer
x.Description.Contains(filter) || x.Description.Contains(filter) ||
x.DisplayName.Contains(filter)) x.DisplayName.Contains(filter))
.OrderBy(sorting.IsNullOrWhiteSpace() ? nameof(IdentityResource.Name) : sorting) .OrderBy(sorting.IsNullOrWhiteSpace() ? nameof(IdentityResource.Name) : sorting)
.PageBy<IdentityResource, IQueryable<IdentityResource>>(skipCount, maxResultCount) .PageBy(skipCount, maxResultCount)
.ToListAsync(GetCancellationToken(cancellationToken)); .ToListAsync(GetCancellationToken(cancellationToken));
} }
public virtual async Task<long> GetCountAsync(string filter = null, CancellationToken cancellationToken = default) public virtual async Task<long> GetCountAsync(string filter = null, CancellationToken cancellationToken = default)
{ {
return await (await GetMongoQueryableAsync(cancellationToken)) return await (await GetMongoQueryableAsync(cancellationToken))
.WhereIf<IdentityResource, IQueryable<IdentityResource>>(!filter.IsNullOrWhiteSpace(), .WhereIf(!filter.IsNullOrWhiteSpace(),
x => x.Name.Contains(filter) || x => x.Name.Contains(filter) ||
x.Description.Contains(filter) || x.Description.Contains(filter) ||
x.DisplayName.Contains(filter)) x.DisplayName.Contains(filter))

8
modules/identityserver/src/Volo.Abp.IdentityServer.MongoDB/Volo/Abp/IdentityServer/MongoDB/MongoPersistentGrantRepository.cs

@ -95,9 +95,9 @@ public class MongoPersistentGrantRepository : MongoDbRepository<IAbpIdentityServ
CancellationToken cancellationToken = default) CancellationToken cancellationToken = default)
{ {
return (await GetMongoQueryableAsync(cancellationToken)) return (await GetMongoQueryableAsync(cancellationToken))
.WhereIf<PersistedGrant, IQueryable<PersistedGrant>>(!subjectId.IsNullOrWhiteSpace(), x => x.SubjectId == subjectId) .WhereIf(!subjectId.IsNullOrWhiteSpace(), x => x.SubjectId == subjectId)
.WhereIf<PersistedGrant, IQueryable<PersistedGrant>>(!sessionId.IsNullOrWhiteSpace(), x => x.SessionId == sessionId) .WhereIf(!sessionId.IsNullOrWhiteSpace(), x => x.SessionId == sessionId)
.WhereIf<PersistedGrant, IQueryable<PersistedGrant>>(!clientId.IsNullOrWhiteSpace(), x => x.ClientId == clientId) .WhereIf(!clientId.IsNullOrWhiteSpace(), x => x.ClientId == clientId)
.WhereIf<PersistedGrant, IQueryable<PersistedGrant>>(!type.IsNullOrWhiteSpace(), x => x.Type == type); .WhereIf(!type.IsNullOrWhiteSpace(), x => x.Type == type);
} }
} }

6
modules/tenant-management/src/Volo.Abp.TenantManagement.MongoDB/Volo/Abp/TenantManagement/MongoDb/MongoTenantRepository.cs

@ -51,20 +51,20 @@ public class MongoTenantRepository : MongoDbRepository<ITenantManagementMongoDbC
CancellationToken cancellationToken = default) CancellationToken cancellationToken = default)
{ {
return await (await GetMongoQueryableAsync(cancellationToken)) return await (await GetMongoQueryableAsync(cancellationToken))
.WhereIf<Tenant, IQueryable<Tenant>>( .WhereIf(
!filter.IsNullOrWhiteSpace(), !filter.IsNullOrWhiteSpace(),
u => u =>
u.Name.Contains(filter) u.Name.Contains(filter)
) )
.OrderBy(sorting.IsNullOrEmpty() ? nameof(Tenant.Name) : sorting) .OrderBy(sorting.IsNullOrEmpty() ? nameof(Tenant.Name) : sorting)
.PageBy<Tenant, IQueryable<Tenant>>(skipCount, maxResultCount) .PageBy(skipCount, maxResultCount)
.ToListAsync(GetCancellationToken(cancellationToken)); .ToListAsync(GetCancellationToken(cancellationToken));
} }
public virtual async Task<long> GetCountAsync(string filter = null, CancellationToken cancellationToken = default) public virtual async Task<long> GetCountAsync(string filter = null, CancellationToken cancellationToken = default)
{ {
return await (await GetMongoQueryableAsync(cancellationToken)) return await (await GetMongoQueryableAsync(cancellationToken))
.WhereIf<Tenant, IQueryable<Tenant>>( .WhereIf(
!filter.IsNullOrWhiteSpace(), !filter.IsNullOrWhiteSpace(),
u => u =>
u.Name.Contains(filter) u.Name.Contains(filter)

6
modules/users/src/Volo.Abp.Users.MongoDB/Volo/Abp/Users/MongoDB/MongoUserRepositoryBase.cs

@ -46,7 +46,7 @@ public abstract class MongoUserRepositoryBase<TDbContext, TUser> : MongoDbReposi
{ {
cancellationToken = GetCancellationToken(cancellationToken); cancellationToken = GetCancellationToken(cancellationToken);
return await (await GetMongoQueryableAsync(cancellationToken)) return await (await GetMongoQueryableAsync(cancellationToken))
.WhereIf<TUser, IQueryable<TUser>>( .WhereIf(
!filter.IsNullOrWhiteSpace(), !filter.IsNullOrWhiteSpace(),
u => u =>
u.UserName.Contains(filter) || u.UserName.Contains(filter) ||
@ -55,7 +55,7 @@ public abstract class MongoUserRepositoryBase<TDbContext, TUser> : MongoDbReposi
(u.Surname != null && u.Surname.Contains(filter)) (u.Surname != null && u.Surname.Contains(filter))
) )
.OrderBy(sorting.IsNullOrEmpty() ? nameof(IUserData.UserName) : sorting) .OrderBy(sorting.IsNullOrEmpty() ? nameof(IUserData.UserName) : sorting)
.PageBy<TUser, IQueryable<TUser>>(skipCount, maxResultCount) .PageBy(skipCount, maxResultCount)
.ToListAsync(cancellationToken); .ToListAsync(cancellationToken);
} }
@ -63,7 +63,7 @@ public abstract class MongoUserRepositoryBase<TDbContext, TUser> : MongoDbReposi
{ {
cancellationToken = GetCancellationToken(cancellationToken); cancellationToken = GetCancellationToken(cancellationToken);
return await (await GetMongoQueryableAsync(cancellationToken)) return await (await GetMongoQueryableAsync(cancellationToken))
.WhereIf<TUser, IQueryable<TUser>>( .WhereIf(
!filter.IsNullOrWhiteSpace(), !filter.IsNullOrWhiteSpace(),
u => u =>
u.UserName.Contains(filter) || u.UserName.Contains(filter) ||

Loading…
Cancel
Save