diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/Clients/IClientRepository.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/Clients/IClientRepository.cs index ed45d8a90c..ede17dd148 100644 --- a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/Clients/IClientRepository.cs +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/Clients/IClientRepository.cs @@ -1,4 +1,5 @@ using System; +using System.Collections.Generic; using System.Threading; using System.Threading.Tasks; using JetBrains.Annotations; @@ -13,5 +14,15 @@ namespace Volo.Abp.IdentityServer.Clients bool includeDetails = true, CancellationToken cancellationToken = default ); + + Task> GetListAsync( + string sorting, + int skipCount, + int maxResultCount, + bool includeDetails = false, + CancellationToken cancellationToken = default + ); + + Task GetTotalCount(); } } \ No newline at end of file diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/Clients/ClientRepository.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/Clients/ClientRepository.cs index 3006678edf..62043562e8 100644 --- a/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/Clients/ClientRepository.cs +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/Clients/ClientRepository.cs @@ -1,4 +1,5 @@ using System; +using System.Collections.Generic; using System.Linq; using System.Threading; using System.Threading.Tasks; @@ -6,6 +7,7 @@ using Microsoft.EntityFrameworkCore; using Volo.Abp.Domain.Repositories.EntityFrameworkCore; using Volo.Abp.EntityFrameworkCore; using Volo.Abp.IdentityServer.EntityFrameworkCore; +using System.Linq.Dynamic.Core; namespace Volo.Abp.IdentityServer.Clients { @@ -26,6 +28,20 @@ namespace Volo.Abp.IdentityServer.Clients .FirstOrDefaultAsync(x => x.ClientId == clientId, GetCancellationToken(cancellationToken)); } + public virtual async Task> GetListAsync(string sorting, int skipCount, int maxResultCount, bool includeDetails = false, + CancellationToken cancellationToken = default) + { + return await DbSet + .IncludeDetails(includeDetails).OrderBy(sorting ?? nameof(Client.ClientName) + " desc") + .PageBy(skipCount, maxResultCount) + .ToListAsync(GetCancellationToken(cancellationToken)); + } + + public virtual async Task GetTotalCount() + { + return await DbSet.CountAsync(); + } + public override IQueryable WithDetails() { return GetQueryable().IncludeDetails(); diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.MongoDB/Volo/Abp/IdentityServer/MongoDB/MongoClientRepository.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.MongoDB/Volo/Abp/IdentityServer/MongoDB/MongoClientRepository.cs index f3ebe4bb62..a946a97ff7 100644 --- a/modules/identityserver/src/Volo.Abp.IdentityServer.MongoDB/Volo/Abp/IdentityServer/MongoDB/MongoClientRepository.cs +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.MongoDB/Volo/Abp/IdentityServer/MongoDB/MongoClientRepository.cs @@ -1,8 +1,12 @@ using System; +using System.Collections.Generic; +using System.Linq; using System.Threading; using System.Threading.Tasks; +using MongoDB.Driver; using MongoDB.Driver.Linq; using Volo.Abp.Domain.Repositories.MongoDB; +using System.Linq.Dynamic.Core; using Volo.Abp.IdentityServer.Clients; using Volo.Abp.MongoDB; @@ -14,9 +18,24 @@ namespace Volo.Abp.IdentityServer.MongoDB { } - public async Task FindByCliendIdAsync(string clientId, bool includeDetails = true, CancellationToken cancellationToken = default) + public virtual async Task FindByCliendIdAsync(string clientId, bool includeDetails = true, CancellationToken cancellationToken = default) { return await GetMongoQueryable().FirstOrDefaultAsync(x => x.ClientId == clientId, GetCancellationToken(cancellationToken)); } + + public virtual async Task> GetListAsync(string sorting, int skipCount, int maxResultCount, bool includeDetails = false, + CancellationToken cancellationToken = default) + { + return await GetMongoQueryable() + .OrderBy(sorting ?? nameof(Client.ClientName)) + .As>() + .PageBy>(skipCount, maxResultCount) + .ToListAsync(GetCancellationToken(cancellationToken)); + } + + public virtual async Task GetTotalCount() + { + return await GetCountAsync(); + } } }