diff --git a/modules/openiddict/src/Volo.Abp.OpenIddict.Domain.Shared/Volo.Abp.OpenIddict.Domain.Shared.csproj b/modules/openiddict/src/Volo.Abp.OpenIddict.Domain.Shared/Volo.Abp.OpenIddict.Domain.Shared.csproj
index 1c1e681763..acdea8b0fb 100644
--- a/modules/openiddict/src/Volo.Abp.OpenIddict.Domain.Shared/Volo.Abp.OpenIddict.Domain.Shared.csproj
+++ b/modules/openiddict/src/Volo.Abp.OpenIddict.Domain.Shared/Volo.Abp.OpenIddict.Domain.Shared.csproj
@@ -16,6 +16,7 @@
+
diff --git a/modules/openiddict/src/Volo.Abp.OpenIddict.Domain/Volo/Abp/OpenIddict/AbpOpenIddictStoreBase.cs b/modules/openiddict/src/Volo.Abp.OpenIddict.Domain/Volo/Abp/OpenIddict/AbpOpenIddictStoreBase.cs
index 4602766f7e..4c90c3a083 100644
--- a/modules/openiddict/src/Volo.Abp.OpenIddict.Domain/Volo/Abp/OpenIddict/AbpOpenIddictStoreBase.cs
+++ b/modules/openiddict/src/Volo.Abp.OpenIddict.Domain/Volo/Abp/OpenIddict/AbpOpenIddictStoreBase.cs
@@ -39,9 +39,7 @@ public abstract class AbpOpenIddictStoreBase
{
return identifier.ToString("D");
}
-
-
-
+
protected virtual string WriteStream(Action action)
{
using (var stream = new MemoryStream())
diff --git a/modules/openiddict/src/Volo.Abp.OpenIddict.Domain/Volo/Abp/OpenIddict/Applications/IOpenIddictApplicationRepository.cs b/modules/openiddict/src/Volo.Abp.OpenIddict.Domain/Volo/Abp/OpenIddict/Applications/IOpenIddictApplicationRepository.cs
index 0941bc2c90..302f1fd5c7 100644
--- a/modules/openiddict/src/Volo.Abp.OpenIddict.Domain/Volo/Abp/OpenIddict/Applications/IOpenIddictApplicationRepository.cs
+++ b/modules/openiddict/src/Volo.Abp.OpenIddict.Domain/Volo/Abp/OpenIddict/Applications/IOpenIddictApplicationRepository.cs
@@ -8,6 +8,10 @@ namespace Volo.Abp.OpenIddict.Applications;
public interface IOpenIddictApplicationRepository : IBasicRepository
{
+ Task> GetListAsync(string sorting, int skipCount, int maxResultCount, string filter = null, CancellationToken cancellationToken = default);
+
+ Task GetCountAsync(string filter = null, CancellationToken cancellationToken = default);
+
Task FindByClientIdAsync(string clientId, CancellationToken cancellationToken = default);
Task> FindByPostLogoutRedirectUriAsync(string address, CancellationToken cancellationToken = default);
diff --git a/modules/openiddict/src/Volo.Abp.OpenIddict.Domain/Volo/Abp/OpenIddict/Scopes/IOpenIddictScopeRepository.cs b/modules/openiddict/src/Volo.Abp.OpenIddict.Domain/Volo/Abp/OpenIddict/Scopes/IOpenIddictScopeRepository.cs
index e7c58e7ba2..9ce92d0318 100644
--- a/modules/openiddict/src/Volo.Abp.OpenIddict.Domain/Volo/Abp/OpenIddict/Scopes/IOpenIddictScopeRepository.cs
+++ b/modules/openiddict/src/Volo.Abp.OpenIddict.Domain/Volo/Abp/OpenIddict/Scopes/IOpenIddictScopeRepository.cs
@@ -8,6 +8,10 @@ namespace Volo.Abp.OpenIddict.Scopes;
public interface IOpenIddictScopeRepository : IBasicRepository
{
+ Task> GetListAsync(string sorting, int skipCount, int maxResultCount, string filter = null, CancellationToken cancellationToken = default);
+
+ Task GetCountAsync(string filter = null, CancellationToken cancellationToken = default);
+
Task FindByIdAsync(Guid id, CancellationToken cancellationToken = default);
Task FindByNameAsync(string name, CancellationToken cancellationToken = default);
diff --git a/modules/openiddict/src/Volo.Abp.OpenIddict.EntityFrameworkCore/Volo/Abp/OpenIddict/Applications/EfCoreOpenIddictApplicationRepository.cs b/modules/openiddict/src/Volo.Abp.OpenIddict.EntityFrameworkCore/Volo/Abp/OpenIddict/Applications/EfCoreOpenIddictApplicationRepository.cs
index 8daa0094bb..c368045a71 100644
--- a/modules/openiddict/src/Volo.Abp.OpenIddict.EntityFrameworkCore/Volo/Abp/OpenIddict/Applications/EfCoreOpenIddictApplicationRepository.cs
+++ b/modules/openiddict/src/Volo.Abp.OpenIddict.EntityFrameworkCore/Volo/Abp/OpenIddict/Applications/EfCoreOpenIddictApplicationRepository.cs
@@ -7,6 +7,7 @@ using Microsoft.EntityFrameworkCore;
using Volo.Abp.Domain.Repositories.EntityFrameworkCore;
using Volo.Abp.EntityFrameworkCore;
using Volo.Abp.OpenIddict.EntityFrameworkCore;
+using System.Linq.Dynamic.Core;
namespace Volo.Abp.OpenIddict.Applications;
@@ -18,6 +19,23 @@ public class EfCoreOpenIddictApplicationRepository : EfCoreRepository> GetListAsync(string sorting, int skipCount, int maxResultCount, string filter = null,
+ CancellationToken cancellationToken = default)
+ {
+ return await (await GetDbSetAsync())
+ .WhereIf(!filter.IsNullOrWhiteSpace(), x => x.ClientId.Contains(filter))
+ .OrderBy(sorting.IsNullOrWhiteSpace() ? nameof(OpenIddictApplication.ClientId) : sorting)
+ .PageBy(skipCount, maxResultCount)
+ .ToListAsync(GetCancellationToken(cancellationToken));
+ }
+
+ public async Task GetCountAsync(string filter = null, CancellationToken cancellationToken = default)
+ {
+ return await (await GetDbSetAsync())
+ .WhereIf(!filter.IsNullOrWhiteSpace(), x => x.ClientId.Contains(filter))
+ .LongCountAsync(GetCancellationToken(cancellationToken));
+ }
+
public virtual async Task FindByClientIdAsync(string clientId, CancellationToken cancellationToken = default)
{
return await (await GetDbSetAsync())
diff --git a/modules/openiddict/src/Volo.Abp.OpenIddict.EntityFrameworkCore/Volo/Abp/OpenIddict/Scopes/EfCoreOpenIddictScopeRepository.cs b/modules/openiddict/src/Volo.Abp.OpenIddict.EntityFrameworkCore/Volo/Abp/OpenIddict/Scopes/EfCoreOpenIddictScopeRepository.cs
index 180213efc6..c61e21e21f 100644
--- a/modules/openiddict/src/Volo.Abp.OpenIddict.EntityFrameworkCore/Volo/Abp/OpenIddict/Scopes/EfCoreOpenIddictScopeRepository.cs
+++ b/modules/openiddict/src/Volo.Abp.OpenIddict.EntityFrameworkCore/Volo/Abp/OpenIddict/Scopes/EfCoreOpenIddictScopeRepository.cs
@@ -7,6 +7,7 @@ using Microsoft.EntityFrameworkCore;
using Volo.Abp.Domain.Repositories.EntityFrameworkCore;
using Volo.Abp.EntityFrameworkCore;
using Volo.Abp.OpenIddict.EntityFrameworkCore;
+using System.Linq.Dynamic.Core;
namespace Volo.Abp.OpenIddict.Scopes;
@@ -18,6 +19,27 @@ public class EfCoreOpenIddictScopeRepository : EfCoreRepository> GetListAsync(string sorting, int skipCount, int maxResultCount, string filter = null,
+ CancellationToken cancellationToken = default)
+ {
+ return await (await GetDbSetAsync())
+ .WhereIf(!filter.IsNullOrWhiteSpace(), x => x.Name.Contains(filter))
+ .WhereIf(!filter.IsNullOrWhiteSpace(), x => x.DisplayName.Contains(filter))
+ .WhereIf(!filter.IsNullOrWhiteSpace(), x => x.Description.Contains(filter))
+ .OrderBy(sorting.IsNullOrWhiteSpace() ? nameof(OpenIddictScope.Name) : sorting)
+ .PageBy(skipCount, maxResultCount)
+ .ToListAsync(GetCancellationToken(cancellationToken));
+ }
+
+ public async Task GetCountAsync(string filter = null, CancellationToken cancellationToken = default)
+ {
+ return await (await GetDbSetAsync())
+ .WhereIf(!filter.IsNullOrWhiteSpace(), x => x.Name.Contains(filter))
+ .WhereIf(!filter.IsNullOrWhiteSpace(), x => x.DisplayName.Contains(filter))
+ .WhereIf(!filter.IsNullOrWhiteSpace(), x => x.Description.Contains(filter))
+ .LongCountAsync(GetCancellationToken(cancellationToken));
+ }
+
public virtual async Task FindByIdAsync(Guid id, CancellationToken cancellationToken = default)
{
return await (await GetQueryableAsync()).FirstOrDefaultAsync(x => x.Id == id, GetCancellationToken(cancellationToken));
diff --git a/modules/openiddict/src/Volo.Abp.OpenIddict.MongoDB/Volo/Abp/OpenIddict/Applications/MongoOpenIddictApplicationRepository.cs b/modules/openiddict/src/Volo.Abp.OpenIddict.MongoDB/Volo/Abp/OpenIddict/Applications/MongoOpenIddictApplicationRepository.cs
index fdf7bf9195..b072bf8307 100644
--- a/modules/openiddict/src/Volo.Abp.OpenIddict.MongoDB/Volo/Abp/OpenIddict/Applications/MongoOpenIddictApplicationRepository.cs
+++ b/modules/openiddict/src/Volo.Abp.OpenIddict.MongoDB/Volo/Abp/OpenIddict/Applications/MongoOpenIddictApplicationRepository.cs
@@ -8,6 +8,7 @@ using MongoDB.Driver.Linq;
using Volo.Abp.Domain.Repositories.MongoDB;
using Volo.Abp.MongoDB;
using Volo.Abp.OpenIddict.MongoDB;
+using System.Linq.Dynamic.Core;
namespace Volo.Abp.OpenIddict.Applications;
@@ -16,6 +17,25 @@ public class MongoOpenIddictApplicationRepository : MongoDbRepository dbContextProvider) : base(dbContextProvider)
{
}
+
+ public async Task> GetListAsync(string sorting, int skipCount, int maxResultCount, string filter = null,
+ CancellationToken cancellationToken = default)
+ {
+ return await ((await GetMongoQueryableAsync(cancellationToken)))
+ .WhereIf(!filter.IsNullOrWhiteSpace(), x => x.ClientId.Contains(filter))
+ .OrderBy(sorting.IsNullOrWhiteSpace() ? nameof(OpenIddictApplication.ClientId) : sorting)
+ .PageBy(skipCount, maxResultCount)
+ .As>()
+ .ToListAsync(GetCancellationToken(cancellationToken));
+ }
+
+ public async Task GetCountAsync(string filter = null, CancellationToken cancellationToken = default)
+ {
+ return await ((await GetMongoQueryableAsync(cancellationToken)))
+ .WhereIf(!filter.IsNullOrWhiteSpace(), x => x.ClientId.Contains(filter))
+ .As>()
+ .LongCountAsync(GetCancellationToken(cancellationToken));
+ }
public async Task FindByClientIdAsync(string clientId, CancellationToken cancellationToken = default)
{
diff --git a/modules/openiddict/src/Volo.Abp.OpenIddict.MongoDB/Volo/Abp/OpenIddict/Scopes/MongoOpenIddictScopeRepository.cs b/modules/openiddict/src/Volo.Abp.OpenIddict.MongoDB/Volo/Abp/OpenIddict/Scopes/MongoOpenIddictScopeRepository.cs
index 413e1a0e4c..d72bb56962 100644
--- a/modules/openiddict/src/Volo.Abp.OpenIddict.MongoDB/Volo/Abp/OpenIddict/Scopes/MongoOpenIddictScopeRepository.cs
+++ b/modules/openiddict/src/Volo.Abp.OpenIddict.MongoDB/Volo/Abp/OpenIddict/Scopes/MongoOpenIddictScopeRepository.cs
@@ -8,6 +8,7 @@ using MongoDB.Driver.Linq;
using Volo.Abp.Domain.Repositories.MongoDB;
using Volo.Abp.MongoDB;
using Volo.Abp.OpenIddict.MongoDB;
+using System.Linq.Dynamic.Core;
namespace Volo.Abp.OpenIddict.Scopes;
@@ -16,6 +17,29 @@ public class MongoOpenIddictScopeRepository : MongoDbRepository dbContextProvider) : base(dbContextProvider)
{
}
+
+ public async Task> GetListAsync(string sorting, int skipCount, int maxResultCount, string filter = null,
+ CancellationToken cancellationToken = default)
+ {
+ return await (await GetMongoQueryableAsync(cancellationToken))
+ .WhereIf(!filter.IsNullOrWhiteSpace(), x => x.Name.Contains(filter))
+ .WhereIf(!filter.IsNullOrWhiteSpace(), x => x.DisplayName.Contains(filter))
+ .WhereIf(!filter.IsNullOrWhiteSpace(), x => x.Description.Contains(filter))
+ .OrderBy(sorting.IsNullOrWhiteSpace() ? nameof(OpenIddictScope.Name) : sorting)
+ .PageBy(skipCount, maxResultCount)
+ .As>()
+ .ToListAsync(GetCancellationToken(cancellationToken));
+ }
+
+ public async Task GetCountAsync(string filter = null, CancellationToken cancellationToken = default)
+ {
+ return await (await GetMongoQueryableAsync(cancellationToken))
+ .WhereIf(!filter.IsNullOrWhiteSpace(), x => x.Name.Contains(filter))
+ .WhereIf(!filter.IsNullOrWhiteSpace(), x => x.DisplayName.Contains(filter))
+ .WhereIf(!filter.IsNullOrWhiteSpace(), x => x.Description.Contains(filter))
+ .As>()
+ .LongCountAsync(GetCancellationToken(cancellationToken));
+ }
public virtual async Task FindByIdAsync(Guid id, CancellationToken cancellationToken = default)
{