diff --git a/src/OpenIddict.Abstractions/Managers/IOpenIddictApplicationManager.cs b/src/OpenIddict.Abstractions/Managers/IOpenIddictApplicationManager.cs index 8099cce6..a1f5f0b9 100644 --- a/src/OpenIddict.Abstractions/Managers/IOpenIddictApplicationManager.cs +++ b/src/OpenIddict.Abstractions/Managers/IOpenIddictApplicationManager.cs @@ -48,6 +48,22 @@ public interface IOpenIddictApplicationManager /// ValueTask CountAsync(Func, IQueryable> query, CancellationToken cancellationToken = default); + /// + /// Determines the number of applications that match the specified query. + /// + /// The state type. + /// The result type. + /// The query to execute. + /// The optional state. + /// The that can be used to abort the operation. + /// + /// A that can be used to monitor the asynchronous operation, + /// whose result returns the number of applications that match the specified query. + /// + ValueTask CountAsync( + Func, TState, IQueryable> query, + TState state, CancellationToken cancellationToken = default); + /// /// Creates a new application based on the specified descriptor. /// Note: the default implementation automatically hashes the client diff --git a/src/OpenIddict.Abstractions/Managers/IOpenIddictAuthorizationManager.cs b/src/OpenIddict.Abstractions/Managers/IOpenIddictAuthorizationManager.cs index a5ad9310..ffa85785 100644 --- a/src/OpenIddict.Abstractions/Managers/IOpenIddictAuthorizationManager.cs +++ b/src/OpenIddict.Abstractions/Managers/IOpenIddictAuthorizationManager.cs @@ -46,6 +46,22 @@ public interface IOpenIddictAuthorizationManager ValueTask CountAsync( Func, IQueryable> query, CancellationToken cancellationToken = default); + /// + /// Determines the number of authorizations that match the specified query. + /// + /// The state type. + /// The result type. + /// The query to execute. + /// The optional state. + /// The that can be used to abort the operation. + /// + /// A that can be used to monitor the asynchronous operation, + /// whose result returns the number of authorizations that match the specified query. + /// + ValueTask CountAsync( + Func, TState, IQueryable> query, + TState state, CancellationToken cancellationToken = default); + /// /// Creates a new permanent authorization based on the specified parameters. /// diff --git a/src/OpenIddict.Abstractions/Managers/IOpenIddictScopeManager.cs b/src/OpenIddict.Abstractions/Managers/IOpenIddictScopeManager.cs index 65c4fc33..2479b67d 100644 --- a/src/OpenIddict.Abstractions/Managers/IOpenIddictScopeManager.cs +++ b/src/OpenIddict.Abstractions/Managers/IOpenIddictScopeManager.cs @@ -45,6 +45,22 @@ public interface IOpenIddictScopeManager /// ValueTask CountAsync(Func, IQueryable> query, CancellationToken cancellationToken = default); + /// + /// Determines the number of scopes that match the specified query. + /// + /// The state type. + /// The result type. + /// The query to execute. + /// The optional state. + /// The that can be used to abort the operation. + /// + /// A that can be used to monitor the asynchronous operation, + /// whose result returns the number of scopes that match the specified query. + /// + ValueTask CountAsync( + Func, TState, IQueryable> query, + TState state, CancellationToken cancellationToken = default); + /// /// Creates a new scope based on the specified descriptor. /// diff --git a/src/OpenIddict.Abstractions/Managers/IOpenIddictTokenManager.cs b/src/OpenIddict.Abstractions/Managers/IOpenIddictTokenManager.cs index 4b035d93..0f72aa1d 100644 --- a/src/OpenIddict.Abstractions/Managers/IOpenIddictTokenManager.cs +++ b/src/OpenIddict.Abstractions/Managers/IOpenIddictTokenManager.cs @@ -44,6 +44,22 @@ public interface IOpenIddictTokenManager /// ValueTask CountAsync(Func, IQueryable> query, CancellationToken cancellationToken = default); + /// + /// Determines the number of tokens that match the specified query. + /// + /// The state type. + /// The result type. + /// The query to execute. + /// The optional state. + /// The that can be used to abort the operation. + /// + /// A that can be used to monitor the asynchronous operation, + /// whose result returns the number of tokens that match the specified query. + /// + ValueTask CountAsync( + Func, TState, IQueryable> query, + TState state, CancellationToken cancellationToken = default); + /// /// Creates a new token based on the specified descriptor. /// diff --git a/src/OpenIddict.Abstractions/Stores/IOpenIddictApplicationStore.cs b/src/OpenIddict.Abstractions/Stores/IOpenIddictApplicationStore.cs index f0261aa5..3eabe594 100644 --- a/src/OpenIddict.Abstractions/Stores/IOpenIddictApplicationStore.cs +++ b/src/OpenIddict.Abstractions/Stores/IOpenIddictApplicationStore.cs @@ -31,14 +31,18 @@ public interface IOpenIddictApplicationStore where TApplication : /// /// Determines the number of applications that match the specified query. /// + /// The state type. /// The result type. /// The query to execute. + /// The optional state. /// The that can be used to abort the operation. /// /// A that can be used to monitor the asynchronous operation, /// whose result returns the number of applications that match the specified query. /// - ValueTask CountAsync(Func, IQueryable> query, CancellationToken cancellationToken); + ValueTask CountAsync( + Func, TState, IQueryable> query, + TState state, CancellationToken cancellationToken); /// /// Creates a new application. diff --git a/src/OpenIddict.Abstractions/Stores/IOpenIddictAuthorizationStore.cs b/src/OpenIddict.Abstractions/Stores/IOpenIddictAuthorizationStore.cs index fda5ce1d..b33b2b8e 100644 --- a/src/OpenIddict.Abstractions/Stores/IOpenIddictAuthorizationStore.cs +++ b/src/OpenIddict.Abstractions/Stores/IOpenIddictAuthorizationStore.cs @@ -28,14 +28,18 @@ public interface IOpenIddictAuthorizationStore where TAuthorizat /// /// Determines the number of authorizations that match the specified query. /// + /// The state type. /// The result type. /// The query to execute. + /// The optional state. /// The that can be used to abort the operation. /// /// A that can be used to monitor the asynchronous operation, /// whose result returns the number of authorizations that match the specified query. /// - ValueTask CountAsync(Func, IQueryable> query, CancellationToken cancellationToken); + ValueTask CountAsync( + Func, TState, IQueryable> query, + TState state, CancellationToken cancellationToken); /// /// Creates a new authorization. diff --git a/src/OpenIddict.Abstractions/Stores/IOpenIddictScopeStore.cs b/src/OpenIddict.Abstractions/Stores/IOpenIddictScopeStore.cs index a2f5c107..c1e2565f 100644 --- a/src/OpenIddict.Abstractions/Stores/IOpenIddictScopeStore.cs +++ b/src/OpenIddict.Abstractions/Stores/IOpenIddictScopeStore.cs @@ -29,14 +29,18 @@ public interface IOpenIddictScopeStore where TScope : class /// /// Determines the number of scopes that match the specified query. /// + /// The state type. /// The result type. /// The query to execute. + /// The optional state. /// The that can be used to abort the operation. /// /// A that can be used to monitor the asynchronous operation, /// whose result returns the number of scopes that match the specified query. /// - ValueTask CountAsync(Func, IQueryable> query, CancellationToken cancellationToken); + ValueTask CountAsync( + Func, TState, IQueryable> query, + TState state, CancellationToken cancellationToken); /// /// Creates a new scope. diff --git a/src/OpenIddict.Abstractions/Stores/IOpenIddictTokenStore.cs b/src/OpenIddict.Abstractions/Stores/IOpenIddictTokenStore.cs index 9f7856ab..1ac1ba68 100644 --- a/src/OpenIddict.Abstractions/Stores/IOpenIddictTokenStore.cs +++ b/src/OpenIddict.Abstractions/Stores/IOpenIddictTokenStore.cs @@ -28,14 +28,18 @@ public interface IOpenIddictTokenStore where TToken : class /// /// Determines the number of tokens that match the specified query. /// + /// The state type. /// The result type. /// The query to execute. + /// The optional state. /// The that can be used to abort the operation. /// /// A that can be used to monitor the asynchronous operation, /// whose result returns the number of tokens that match the specified query. /// - ValueTask CountAsync(Func, IQueryable> query, CancellationToken cancellationToken); + ValueTask CountAsync( + Func, TState, IQueryable> query, + TState state, CancellationToken cancellationToken); /// /// Creates a new token. diff --git a/src/OpenIddict.Core/Managers/OpenIddictApplicationManager.cs b/src/OpenIddict.Core/Managers/OpenIddictApplicationManager.cs index 9644e92d..151f62f3 100644 --- a/src/OpenIddict.Core/Managers/OpenIddictApplicationManager.cs +++ b/src/OpenIddict.Core/Managers/OpenIddictApplicationManager.cs @@ -96,7 +96,28 @@ public class OpenIddictApplicationManager : IOpenIddictApplication { ArgumentNullException.ThrowIfNull(query); - return Store.CountAsync(query, cancellationToken); + return CountAsync(static (applications, query) => query(applications), query, cancellationToken); + } + + /// + /// Determines the number of applications that match the specified query. + /// + /// The state type. + /// The result type. + /// The query to execute. + /// The optional state. + /// The that can be used to abort the operation. + /// + /// A that can be used to monitor the asynchronous operation, + /// whose result returns the number of applications that match the specified query. + /// + public virtual ValueTask CountAsync( + Func, TState, IQueryable> query, + TState state, CancellationToken cancellationToken = default) + { + ArgumentNullException.ThrowIfNull(query); + + return Store.CountAsync(query, state, cancellationToken); } /// @@ -1845,6 +1866,10 @@ public class OpenIddictApplicationManager : IOpenIddictApplication ValueTask IOpenIddictApplicationManager.CountAsync(Func, IQueryable> query, CancellationToken cancellationToken) => CountAsync(query, cancellationToken); + /// + ValueTask IOpenIddictApplicationManager.CountAsync(Func, TState, IQueryable> query, TState state, CancellationToken cancellationToken) + => CountAsync(query, state, cancellationToken); + /// async ValueTask IOpenIddictApplicationManager.CreateAsync(OpenIddictApplicationDescriptor descriptor, CancellationToken cancellationToken) => await CreateAsync(descriptor, cancellationToken); diff --git a/src/OpenIddict.Core/Managers/OpenIddictAuthorizationManager.cs b/src/OpenIddict.Core/Managers/OpenIddictAuthorizationManager.cs index 3aaa3063..6b5c7c36 100644 --- a/src/OpenIddict.Core/Managers/OpenIddictAuthorizationManager.cs +++ b/src/OpenIddict.Core/Managers/OpenIddictAuthorizationManager.cs @@ -92,7 +92,28 @@ public class OpenIddictAuthorizationManager : IOpenIddictAuthori { ArgumentNullException.ThrowIfNull(query); - return Store.CountAsync(query, cancellationToken); + return CountAsync(static (authorizations, query) => query(authorizations), query, cancellationToken); + } + + /// + /// Determines the number of authorizations that match the specified query. + /// + /// The state type. + /// The result type. + /// The query to execute. + /// The optional state. + /// The that can be used to abort the operation. + /// + /// A that can be used to monitor the asynchronous operation, + /// whose result returns the number of authorizations that match the specified query. + /// + public virtual ValueTask CountAsync( + Func, TState, IQueryable> query, + TState state, CancellationToken cancellationToken = default) + { + ArgumentNullException.ThrowIfNull(query); + + return Store.CountAsync(query, state, cancellationToken); } /// @@ -953,6 +974,10 @@ public class OpenIddictAuthorizationManager : IOpenIddictAuthori ValueTask IOpenIddictAuthorizationManager.CountAsync(Func, IQueryable> query, CancellationToken cancellationToken) => CountAsync(query, cancellationToken); + /// + ValueTask IOpenIddictAuthorizationManager.CountAsync(Func, TState, IQueryable> query, TState state, CancellationToken cancellationToken) + => CountAsync(query, state, cancellationToken); + /// async ValueTask IOpenIddictAuthorizationManager.CreateAsync(ClaimsIdentity identity, string subject, string client, string type, ImmutableArray scopes, CancellationToken cancellationToken) => await CreateAsync(identity, subject, client, type, scopes, cancellationToken); diff --git a/src/OpenIddict.Core/Managers/OpenIddictScopeManager.cs b/src/OpenIddict.Core/Managers/OpenIddictScopeManager.cs index 2b35cf8b..41d08e44 100644 --- a/src/OpenIddict.Core/Managers/OpenIddictScopeManager.cs +++ b/src/OpenIddict.Core/Managers/OpenIddictScopeManager.cs @@ -91,7 +91,28 @@ public class OpenIddictScopeManager : IOpenIddictScopeManager where TSco { ArgumentNullException.ThrowIfNull(query); - return Store.CountAsync(query, cancellationToken); + return CountAsync(static (scopes, query) => query(scopes), query, cancellationToken); + } + + /// + /// Determines the number of scopes that match the specified query. + /// + /// The state type. + /// The result type. + /// The query to execute. + /// The optional state. + /// The that can be used to abort the operation. + /// + /// A that can be used to monitor the asynchronous operation, + /// whose result returns the number of scopes that match the specified query. + /// + public virtual ValueTask CountAsync( + Func, TState, IQueryable> query, + TState state, CancellationToken cancellationToken = default) + { + ArgumentNullException.ThrowIfNull(query); + + return Store.CountAsync(query, state, cancellationToken); } /// @@ -879,6 +900,10 @@ public class OpenIddictScopeManager : IOpenIddictScopeManager where TSco ValueTask IOpenIddictScopeManager.CountAsync(Func, IQueryable> query, CancellationToken cancellationToken) => CountAsync(query, cancellationToken); + /// + ValueTask IOpenIddictScopeManager.CountAsync(Func, TState, IQueryable> query, TState state, CancellationToken cancellationToken) + => CountAsync(query, state, cancellationToken); + /// async ValueTask IOpenIddictScopeManager.CreateAsync(OpenIddictScopeDescriptor descriptor, CancellationToken cancellationToken) => await CreateAsync(descriptor, cancellationToken); diff --git a/src/OpenIddict.Core/Managers/OpenIddictTokenManager.cs b/src/OpenIddict.Core/Managers/OpenIddictTokenManager.cs index a74d3290..d1741a9e 100644 --- a/src/OpenIddict.Core/Managers/OpenIddictTokenManager.cs +++ b/src/OpenIddict.Core/Managers/OpenIddictTokenManager.cs @@ -92,7 +92,28 @@ public class OpenIddictTokenManager : IOpenIddictTokenManager where TTok { ArgumentNullException.ThrowIfNull(query); - return Store.CountAsync(query, cancellationToken); + return CountAsync(static (tokens, query) => query(tokens), query, cancellationToken); + } + + /// + /// Determines the number of tokens that match the specified query. + /// + /// The state type. + /// The result type. + /// The query to execute. + /// The optional state. + /// The that can be used to abort the operation. + /// + /// A that can be used to monitor the asynchronous operation, + /// whose result returns the number of tokens that match the specified query. + /// + public virtual ValueTask CountAsync( + Func, TState, IQueryable> query, + TState state, CancellationToken cancellationToken = default) + { + ArgumentNullException.ThrowIfNull(query); + + return Store.CountAsync(query, state, cancellationToken); } /// @@ -1169,6 +1190,10 @@ public class OpenIddictTokenManager : IOpenIddictTokenManager where TTok ValueTask IOpenIddictTokenManager.CountAsync(Func, IQueryable> query, CancellationToken cancellationToken) => CountAsync(query, cancellationToken); + /// + ValueTask IOpenIddictTokenManager.CountAsync(Func, TState, IQueryable> query, TState state, CancellationToken cancellationToken) + => CountAsync(query, state, cancellationToken); + /// async ValueTask IOpenIddictTokenManager.CreateAsync(OpenIddictTokenDescriptor descriptor, CancellationToken cancellationToken) => await CreateAsync(descriptor, cancellationToken); diff --git a/src/OpenIddict.EntityFramework/Stores/OpenIddictEntityFrameworkApplicationStore.cs b/src/OpenIddict.EntityFramework/Stores/OpenIddictEntityFrameworkApplicationStore.cs index d73108d4..839e25a8 100644 --- a/src/OpenIddict.EntityFramework/Stores/OpenIddictEntityFrameworkApplicationStore.cs +++ b/src/OpenIddict.EntityFramework/Stores/OpenIddictEntityFrameworkApplicationStore.cs @@ -90,13 +90,15 @@ public class OpenIddictEntityFrameworkApplicationStore< } /// - public virtual async ValueTask CountAsync(Func, IQueryable> query, CancellationToken cancellationToken) + public virtual async ValueTask CountAsync( + Func, TState, IQueryable> query, + TState state, CancellationToken cancellationToken) { ArgumentNullException.ThrowIfNull(query); var context = await Context.GetDbContextAsync(cancellationToken); - return await query(context.Set()).LongCountAsync(cancellationToken); + return await query(context.Set(), state).LongCountAsync(cancellationToken); } /// diff --git a/src/OpenIddict.EntityFramework/Stores/OpenIddictEntityFrameworkAuthorizationStore.cs b/src/OpenIddict.EntityFramework/Stores/OpenIddictEntityFrameworkAuthorizationStore.cs index c8b1dcef..02f8b3f9 100644 --- a/src/OpenIddict.EntityFramework/Stores/OpenIddictEntityFrameworkAuthorizationStore.cs +++ b/src/OpenIddict.EntityFramework/Stores/OpenIddictEntityFrameworkAuthorizationStore.cs @@ -88,13 +88,15 @@ public class OpenIddictEntityFrameworkAuthorizationStore< } /// - public virtual async ValueTask CountAsync(Func, IQueryable> query, CancellationToken cancellationToken) + public virtual async ValueTask CountAsync( + Func, TState, IQueryable> query, + TState state, CancellationToken cancellationToken) { ArgumentNullException.ThrowIfNull(query); var context = await Context.GetDbContextAsync(cancellationToken); - return await query(context.Set()).LongCountAsync(cancellationToken); + return await query(context.Set(), state).LongCountAsync(cancellationToken); } /// diff --git a/src/OpenIddict.EntityFramework/Stores/OpenIddictEntityFrameworkScopeStore.cs b/src/OpenIddict.EntityFramework/Stores/OpenIddictEntityFrameworkScopeStore.cs index 4c51e9f7..12af92af 100644 --- a/src/OpenIddict.EntityFramework/Stores/OpenIddictEntityFrameworkScopeStore.cs +++ b/src/OpenIddict.EntityFramework/Stores/OpenIddictEntityFrameworkScopeStore.cs @@ -80,13 +80,15 @@ public class OpenIddictEntityFrameworkScopeStore< } /// - public virtual async ValueTask CountAsync(Func, IQueryable> query, CancellationToken cancellationToken) + public virtual async ValueTask CountAsync( + Func, TState, IQueryable> query, + TState state, CancellationToken cancellationToken) { ArgumentNullException.ThrowIfNull(query); var context = await Context.GetDbContextAsync(cancellationToken); - return await query(context.Set()).LongCountAsync(cancellationToken); + return await query(context.Set(), state).LongCountAsync(cancellationToken); } /// diff --git a/src/OpenIddict.EntityFramework/Stores/OpenIddictEntityFrameworkTokenStore.cs b/src/OpenIddict.EntityFramework/Stores/OpenIddictEntityFrameworkTokenStore.cs index 63ebfcfe..c25826b1 100644 --- a/src/OpenIddict.EntityFramework/Stores/OpenIddictEntityFrameworkTokenStore.cs +++ b/src/OpenIddict.EntityFramework/Stores/OpenIddictEntityFrameworkTokenStore.cs @@ -88,13 +88,15 @@ public class OpenIddictEntityFrameworkTokenStore< } /// - public virtual async ValueTask CountAsync(Func, IQueryable> query, CancellationToken cancellationToken) + public virtual async ValueTask CountAsync( + Func, TState, IQueryable> query, + TState state, CancellationToken cancellationToken) { ArgumentNullException.ThrowIfNull(query); var context = await Context.GetDbContextAsync(cancellationToken); - return await query(context.Set()).LongCountAsync(cancellationToken); + return await query(context.Set(), state).LongCountAsync(cancellationToken); } /// diff --git a/src/OpenIddict.EntityFrameworkCore/Stores/OpenIddictEntityFrameworkCoreApplicationStore.cs b/src/OpenIddict.EntityFrameworkCore/Stores/OpenIddictEntityFrameworkCoreApplicationStore.cs index cec2cffd..48500742 100644 --- a/src/OpenIddict.EntityFrameworkCore/Stores/OpenIddictEntityFrameworkCoreApplicationStore.cs +++ b/src/OpenIddict.EntityFrameworkCore/Stores/OpenIddictEntityFrameworkCoreApplicationStore.cs @@ -109,13 +109,15 @@ public class OpenIddictEntityFrameworkCoreApplicationStore< } /// - public virtual async ValueTask CountAsync(Func, IQueryable> query, CancellationToken cancellationToken) + public virtual async ValueTask CountAsync( + Func, TState, IQueryable> query, + TState state, CancellationToken cancellationToken) { ArgumentNullException.ThrowIfNull(query); var context = await Context.GetDbContextAsync(cancellationToken); - return await query(context.Set()).LongCountAsync(cancellationToken); + return await query(context.Set(), state).LongCountAsync(cancellationToken); } /// diff --git a/src/OpenIddict.EntityFrameworkCore/Stores/OpenIddictEntityFrameworkCoreAuthorizationStore.cs b/src/OpenIddict.EntityFrameworkCore/Stores/OpenIddictEntityFrameworkCoreAuthorizationStore.cs index 6bc8397b..06613272 100644 --- a/src/OpenIddict.EntityFrameworkCore/Stores/OpenIddictEntityFrameworkCoreAuthorizationStore.cs +++ b/src/OpenIddict.EntityFrameworkCore/Stores/OpenIddictEntityFrameworkCoreAuthorizationStore.cs @@ -107,13 +107,15 @@ public class OpenIddictEntityFrameworkCoreAuthorizationStore< } /// - public virtual async ValueTask CountAsync(Func, IQueryable> query, CancellationToken cancellationToken) + public virtual async ValueTask CountAsync( + Func, TState, IQueryable> query, + TState state, CancellationToken cancellationToken) { ArgumentNullException.ThrowIfNull(query); var context = await Context.GetDbContextAsync(cancellationToken); - return await query(context.Set()).LongCountAsync(cancellationToken); + return await query(context.Set(), state).LongCountAsync(cancellationToken); } /// diff --git a/src/OpenIddict.EntityFrameworkCore/Stores/OpenIddictEntityFrameworkCoreScopeStore.cs b/src/OpenIddict.EntityFrameworkCore/Stores/OpenIddictEntityFrameworkCoreScopeStore.cs index 0bcb3723..d6aed5e2 100644 --- a/src/OpenIddict.EntityFrameworkCore/Stores/OpenIddictEntityFrameworkCoreScopeStore.cs +++ b/src/OpenIddict.EntityFrameworkCore/Stores/OpenIddictEntityFrameworkCoreScopeStore.cs @@ -95,13 +95,15 @@ public class OpenIddictEntityFrameworkCoreScopeStore< } /// - public virtual async ValueTask CountAsync(Func, IQueryable> query, CancellationToken cancellationToken) + public virtual async ValueTask CountAsync( + Func, TState, IQueryable> query, + TState state, CancellationToken cancellationToken) { ArgumentNullException.ThrowIfNull(query); var context = await Context.GetDbContextAsync(cancellationToken); - return await query(context.Set()).LongCountAsync(cancellationToken); + return await query(context.Set(), state).LongCountAsync(cancellationToken); } /// diff --git a/src/OpenIddict.EntityFrameworkCore/Stores/OpenIddictEntityFrameworkCoreTokenStore.cs b/src/OpenIddict.EntityFrameworkCore/Stores/OpenIddictEntityFrameworkCoreTokenStore.cs index 27a9462b..83dae68a 100644 --- a/src/OpenIddict.EntityFrameworkCore/Stores/OpenIddictEntityFrameworkCoreTokenStore.cs +++ b/src/OpenIddict.EntityFrameworkCore/Stores/OpenIddictEntityFrameworkCoreTokenStore.cs @@ -107,13 +107,15 @@ public class OpenIddictEntityFrameworkCoreTokenStore< } /// - public virtual async ValueTask CountAsync(Func, IQueryable> query, CancellationToken cancellationToken) + public virtual async ValueTask CountAsync( + Func, TState, IQueryable> query, + TState state, CancellationToken cancellationToken) { ArgumentNullException.ThrowIfNull(query); var context = await Context.GetDbContextAsync(cancellationToken); - return await query(context.Set()).LongCountAsync(cancellationToken); + return await query(context.Set(), state).LongCountAsync(cancellationToken); } /// diff --git a/src/OpenIddict.MongoDb/Stores/OpenIddictMongoDbApplicationStore.cs b/src/OpenIddict.MongoDb/Stores/OpenIddictMongoDbApplicationStore.cs index 2be96e02..8f35055b 100644 --- a/src/OpenIddict.MongoDb/Stores/OpenIddictMongoDbApplicationStore.cs +++ b/src/OpenIddict.MongoDb/Stores/OpenIddictMongoDbApplicationStore.cs @@ -67,15 +67,16 @@ public class OpenIddictMongoDbApplicationStore< } /// - public virtual async ValueTask CountAsync( - Func, IQueryable> query, CancellationToken cancellationToken) + public virtual async ValueTask CountAsync( + Func, TState, IQueryable> query, + TState state, CancellationToken cancellationToken) { ArgumentNullException.ThrowIfNull(query); var database = await Context.GetDatabaseAsync(cancellationToken); var collection = database.GetCollection(Options.CurrentValue.ApplicationsCollectionName); - return await query(collection.AsQueryable()).LongCountAsync(cancellationToken); + return await query(collection.AsQueryable(), state).LongCountAsync(cancellationToken); } /// diff --git a/src/OpenIddict.MongoDb/Stores/OpenIddictMongoDbAuthorizationStore.cs b/src/OpenIddict.MongoDb/Stores/OpenIddictMongoDbAuthorizationStore.cs index 58861e18..fc74098c 100644 --- a/src/OpenIddict.MongoDb/Stores/OpenIddictMongoDbAuthorizationStore.cs +++ b/src/OpenIddict.MongoDb/Stores/OpenIddictMongoDbAuthorizationStore.cs @@ -65,15 +65,16 @@ public class OpenIddictMongoDbAuthorizationStore< } /// - public virtual async ValueTask CountAsync( - Func, IQueryable> query, CancellationToken cancellationToken) + public virtual async ValueTask CountAsync( + Func, TState, IQueryable> query, + TState state, CancellationToken cancellationToken) { ArgumentNullException.ThrowIfNull(query); var database = await Context.GetDatabaseAsync(cancellationToken); var collection = database.GetCollection(Options.CurrentValue.AuthorizationsCollectionName); - return await query(collection.AsQueryable()).LongCountAsync(cancellationToken); + return await query(collection.AsQueryable(), state).LongCountAsync(cancellationToken); } /// diff --git a/src/OpenIddict.MongoDb/Stores/OpenIddictMongoDbScopeStore.cs b/src/OpenIddict.MongoDb/Stores/OpenIddictMongoDbScopeStore.cs index 38f36130..693ab921 100644 --- a/src/OpenIddict.MongoDb/Stores/OpenIddictMongoDbScopeStore.cs +++ b/src/OpenIddict.MongoDb/Stores/OpenIddictMongoDbScopeStore.cs @@ -66,15 +66,16 @@ public class OpenIddictMongoDbScopeStore< } /// - public virtual async ValueTask CountAsync( - Func, IQueryable> query, CancellationToken cancellationToken) + public virtual async ValueTask CountAsync( + Func, TState, IQueryable> query, + TState state, CancellationToken cancellationToken) { ArgumentNullException.ThrowIfNull(query); var database = await Context.GetDatabaseAsync(cancellationToken); var collection = database.GetCollection(Options.CurrentValue.ScopesCollectionName); - return await query(collection.AsQueryable()).LongCountAsync(cancellationToken); + return await query(collection.AsQueryable(), state).LongCountAsync(cancellationToken); } /// diff --git a/src/OpenIddict.MongoDb/Stores/OpenIddictMongoDbTokenStore.cs b/src/OpenIddict.MongoDb/Stores/OpenIddictMongoDbTokenStore.cs index af24f193..6e5b6599 100644 --- a/src/OpenIddict.MongoDb/Stores/OpenIddictMongoDbTokenStore.cs +++ b/src/OpenIddict.MongoDb/Stores/OpenIddictMongoDbTokenStore.cs @@ -65,15 +65,16 @@ public class OpenIddictMongoDbTokenStore< } /// - public virtual async ValueTask CountAsync( - Func, IQueryable> query, CancellationToken cancellationToken) + public virtual async ValueTask CountAsync( + Func, TState, IQueryable> query, + TState state, CancellationToken cancellationToken) { ArgumentNullException.ThrowIfNull(query); var database = await Context.GetDatabaseAsync(cancellationToken); var collection = database.GetCollection(Options.CurrentValue.TokensCollectionName); - return await query(collection.AsQueryable()).LongCountAsync(cancellationToken); + return await query(collection.AsQueryable(), state).LongCountAsync(cancellationToken); } ///