diff --git a/eng/Versions.props b/eng/Versions.props
index 5fd5f835..6e1a40b8 100644
--- a/eng/Versions.props
+++ b/eng/Versions.props
@@ -14,12 +14,13 @@
6.3.0-preview8-19405-04
3.0.0-preview8.19405.11
3.0.0-preview8.19405.4
- 2018.3.0
+ 2019.1.3
12.0.2
1.0.1
6.2.0-preview-60806030202
1.5.0
- 2.7.0
+ 4.0.0-preview.6.build.801
+ 2.9.0
4.7.63
5.2.2
4.0.0
diff --git a/src/OpenIddict.Abstractions/Caches/IOpenIddictApplicationCache.cs b/src/OpenIddict.Abstractions/Caches/IOpenIddictApplicationCache.cs
index 023d9d04..9d354295 100644
--- a/src/OpenIddict.Abstractions/Caches/IOpenIddictApplicationCache.cs
+++ b/src/OpenIddict.Abstractions/Caches/IOpenIddictApplicationCache.cs
@@ -4,6 +4,7 @@
* the license and the contributors participating to this project.
*/
+using System.Collections.Generic;
using System.Collections.Immutable;
using System.Threading;
using System.Threading.Tasks;
@@ -22,10 +23,8 @@ namespace OpenIddict.Abstractions
///
/// The application to add to the cache.
/// The that can be used to abort the operation.
- ///
- /// A that can be used to monitor the asynchronous operation.
- ///
- Task AddAsync([NotNull] TApplication application, CancellationToken cancellationToken);
+ /// A that can be used to monitor the asynchronous operation.
+ ValueTask AddAsync([NotNull] TApplication application, CancellationToken cancellationToken);
///
/// Retrieves an application using its client identifier.
@@ -54,11 +53,8 @@ namespace OpenIddict.Abstractions
///
/// The redirect_uri associated with the applications.
/// The that can be used to abort the operation.
- ///
- /// A that can be used to monitor the asynchronous operation,
- /// whose result returns the client applications corresponding to the specified redirect_uri.
- ///
- ValueTask> FindByPostLogoutRedirectUriAsync(
+ /// The client applications corresponding to the specified redirect_uri.
+ IAsyncEnumerable FindByPostLogoutRedirectUriAsync(
[NotNull] string address, CancellationToken cancellationToken);
///
@@ -66,11 +62,8 @@ namespace OpenIddict.Abstractions
///
/// The redirect_uri associated with the applications.
/// The that can be used to abort the operation.
- ///
- /// A that can be used to monitor the asynchronous operation,
- /// whose result returns the client applications corresponding to the specified redirect_uri.
- ///
- ValueTask> FindByRedirectUriAsync(
+ /// The client applications corresponding to the specified redirect_uri.
+ IAsyncEnumerable FindByRedirectUriAsync(
[NotNull] string address, CancellationToken cancellationToken);
///
@@ -78,9 +71,7 @@ namespace OpenIddict.Abstractions
///
/// The application to remove from the cache.
/// The that can be used to abort the operation.
- ///
- /// A that can be used to monitor the asynchronous operation.
- ///
- Task RemoveAsync([NotNull] TApplication application, CancellationToken cancellationToken);
+ /// A that can be used to monitor the asynchronous operation.
+ ValueTask RemoveAsync([NotNull] TApplication application, CancellationToken cancellationToken);
}
}
diff --git a/src/OpenIddict.Abstractions/Caches/IOpenIddictAuthorizationCache.cs b/src/OpenIddict.Abstractions/Caches/IOpenIddictAuthorizationCache.cs
index 779fccd3..e25fd5a7 100644
--- a/src/OpenIddict.Abstractions/Caches/IOpenIddictAuthorizationCache.cs
+++ b/src/OpenIddict.Abstractions/Caches/IOpenIddictAuthorizationCache.cs
@@ -4,6 +4,7 @@
* the license and the contributors participating to this project.
*/
+using System.Collections.Generic;
using System.Collections.Immutable;
using System.Threading;
using System.Threading.Tasks;
@@ -22,10 +23,8 @@ namespace OpenIddict.Abstractions
///
/// The authorization to add to the cache.
/// The that can be used to abort the operation.
- ///
- /// A that can be used to monitor the asynchronous operation.
- ///
- Task AddAsync([NotNull] TAuthorization authorization, CancellationToken cancellationToken);
+ /// A that can be used to monitor the asynchronous operation.
+ ValueTask AddAsync([NotNull] TAuthorization authorization, CancellationToken cancellationToken);
///
/// Retrieves the authorizations corresponding to the specified
@@ -34,11 +33,8 @@ namespace OpenIddict.Abstractions
/// The subject associated with the authorization.
/// The client associated with the authorization.
/// The that can be used to abort the operation.
- ///
- /// A that can be used to monitor the asynchronous operation,
- /// whose result returns the authorizations corresponding to the subject/client.
- ///
- ValueTask> FindAsync(
+ /// The authorizations corresponding to the subject/client.
+ IAsyncEnumerable FindAsync(
[NotNull] string subject, [NotNull] string client, CancellationToken cancellationToken);
///
@@ -48,11 +44,8 @@ namespace OpenIddict.Abstractions
/// The client associated with the authorization.
/// The authorization status.
/// The that can be used to abort the operation.
- ///
- /// A that can be used to monitor the asynchronous operation,
- /// whose result returns the authorizations corresponding to the criteria.
- ///
- ValueTask> FindAsync(
+ /// The authorizations corresponding to the criteria.
+ IAsyncEnumerable FindAsync(
[NotNull] string subject, [NotNull] string client, [NotNull] string status, CancellationToken cancellationToken);
///
@@ -63,11 +56,8 @@ namespace OpenIddict.Abstractions
/// The authorization status.
/// The authorization type.
/// The that can be used to abort the operation.
- ///
- /// A that can be used to monitor the asynchronous operation,
- /// whose result returns the authorizations corresponding to the criteria.
- ///
- ValueTask> FindAsync(
+ /// The authorizations corresponding to the criteria.
+ IAsyncEnumerable FindAsync(
[NotNull] string subject, [NotNull] string client, [NotNull] string status,
[NotNull] string type, CancellationToken cancellationToken);
@@ -80,11 +70,8 @@ namespace OpenIddict.Abstractions
/// The authorization type.
/// The minimal scopes associated with the authorization.
/// The that can be used to abort the operation.
- ///
- /// A that can be used to monitor the asynchronous operation,
- /// whose result returns the authorizations corresponding to the criteria.
- ///
- ValueTask> FindAsync(
+ /// The authorizations corresponding to the criteria.
+ IAsyncEnumerable FindAsync(
[NotNull] string subject, [NotNull] string client, [NotNull] string status,
[NotNull] string type, ImmutableArray scopes, CancellationToken cancellationToken);
@@ -93,11 +80,8 @@ namespace OpenIddict.Abstractions
///
/// The application identifier associated with the authorizations.
/// The that can be used to abort the operation.
- ///
- /// A that can be used to monitor the asynchronous operation,
- /// whose result returns the authorizations corresponding to the specified application.
- ///
- ValueTask> FindByApplicationIdAsync(
+ /// The authorizations corresponding to the specified application.
+ IAsyncEnumerable FindByApplicationIdAsync(
[NotNull] string identifier, CancellationToken cancellationToken);
///
@@ -116,20 +100,15 @@ namespace OpenIddict.Abstractions
///
/// The subject associated with the authorization.
/// The that can be used to abort the operation.
- ///
- /// A that can be used to monitor the asynchronous operation,
- /// whose result returns the authorizations corresponding to the specified subject.
- ///
- ValueTask> FindBySubjectAsync([NotNull] string subject, CancellationToken cancellationToken);
+ /// The authorizations corresponding to the specified subject.
+ IAsyncEnumerable FindBySubjectAsync([NotNull] string subject, CancellationToken cancellationToken);
///
/// Removes the specified authorization from the cache.
///
/// The authorization to remove from the cache.
/// The that can be used to abort the operation.
- ///
- /// A that can be used to monitor the asynchronous operation.
- ///
- Task RemoveAsync([NotNull] TAuthorization authorization, CancellationToken cancellationToken);
+ /// A that can be used to monitor the asynchronous operation.
+ ValueTask RemoveAsync([NotNull] TAuthorization authorization, CancellationToken cancellationToken);
}
}
diff --git a/src/OpenIddict.Abstractions/Caches/IOpenIddictScopeCache.cs b/src/OpenIddict.Abstractions/Caches/IOpenIddictScopeCache.cs
index 44dc3cfe..7cf3eb4d 100644
--- a/src/OpenIddict.Abstractions/Caches/IOpenIddictScopeCache.cs
+++ b/src/OpenIddict.Abstractions/Caches/IOpenIddictScopeCache.cs
@@ -4,6 +4,7 @@
* the license and the contributors participating to this project.
*/
+using System.Collections.Generic;
using System.Collections.Immutable;
using System.Threading;
using System.Threading.Tasks;
@@ -22,10 +23,8 @@ namespace OpenIddict.Abstractions
///
/// The scope to add to the cache.
/// The that can be used to abort the operation.
- ///
- /// A that can be used to monitor the asynchronous operation.
- ///
- Task AddAsync([NotNull] TScope scope, CancellationToken cancellationToken);
+ /// A that can be used to monitor the asynchronous operation.
+ ValueTask AddAsync([NotNull] TScope scope, CancellationToken cancellationToken);
///
/// Retrieves a scope using its unique identifier.
@@ -54,31 +53,23 @@ namespace OpenIddict.Abstractions
///
/// The names associated with the scopes.
/// The that can be used to abort the operation.
- ///
- /// A that can be used to monitor the asynchronous operation,
- /// whose result returns the scopes corresponding to the specified names.
- ///
- ValueTask> FindByNamesAsync(ImmutableArray names, CancellationToken cancellationToken);
+ /// The scopes corresponding to the specified names.
+ IAsyncEnumerable FindByNamesAsync(ImmutableArray names, CancellationToken cancellationToken);
///
/// Retrieves all the scopes that contain the specified resource.
///
/// The resource associated with the scopes.
/// The that can be used to abort the operation.
- ///
- /// A that can be used to monitor the asynchronous operation,
- /// whose result returns the scopes associated with the specified resource.
- ///
- ValueTask> FindByResourceAsync([NotNull] string resource, CancellationToken cancellationToken);
+ /// The scopes associated with the specified resource.
+ IAsyncEnumerable FindByResourceAsync([NotNull] string resource, CancellationToken cancellationToken);
///
/// Removes the specified scope from the cache.
///
/// The scope to remove from the cache.
/// The that can be used to abort the operation.
- ///
- /// A that can be used to monitor the asynchronous operation.
- ///
- Task RemoveAsync([NotNull] TScope scope, CancellationToken cancellationToken);
+ /// A that can be used to monitor the asynchronous operation.
+ ValueTask RemoveAsync([NotNull] TScope scope, CancellationToken cancellationToken);
}
}
diff --git a/src/OpenIddict.Abstractions/Caches/IOpenIddictTokenCache.cs b/src/OpenIddict.Abstractions/Caches/IOpenIddictTokenCache.cs
index 2b4aef2c..0c87e302 100644
--- a/src/OpenIddict.Abstractions/Caches/IOpenIddictTokenCache.cs
+++ b/src/OpenIddict.Abstractions/Caches/IOpenIddictTokenCache.cs
@@ -4,6 +4,7 @@
* the license and the contributors participating to this project.
*/
+using System.Collections.Generic;
using System.Collections.Immutable;
using System.Threading;
using System.Threading.Tasks;
@@ -22,10 +23,8 @@ namespace OpenIddict.Abstractions
///
/// The token to add to the cache.
/// The that can be used to abort the operation.
- ///
- /// A that can be used to monitor the asynchronous operation.
- ///
- Task AddAsync([NotNull] TToken token, CancellationToken cancellationToken);
+ /// A that can be used to monitor the asynchronous operation.
+ ValueTask AddAsync([NotNull] TToken token, CancellationToken cancellationToken);
///
/// Retrieves the tokens corresponding to the specified
@@ -34,11 +33,8 @@ namespace OpenIddict.Abstractions
/// The subject associated with the token.
/// The client associated with the token.
/// The that can be used to abort the operation.
- ///
- /// A that can be used to monitor the asynchronous operation,
- /// whose result returns the tokens corresponding to the subject/client.
- ///
- ValueTask> FindAsync([NotNull] string subject,
+ /// The tokens corresponding to the subject/client.
+ IAsyncEnumerable FindAsync([NotNull] string subject,
[NotNull] string client, CancellationToken cancellationToken);
///
@@ -48,11 +44,8 @@ namespace OpenIddict.Abstractions
/// The client associated with the token.
/// The token status.
/// The that can be used to abort the operation.
- ///
- /// A that can be used to monitor the asynchronous operation,
- /// whose result returns the tokens corresponding to the criteria.
- ///
- ValueTask> FindAsync(
+ /// The tokens corresponding to the criteria.
+ IAsyncEnumerable FindAsync(
[NotNull] string subject, [NotNull] string client,
[NotNull] string status, CancellationToken cancellationToken);
@@ -64,11 +57,8 @@ namespace OpenIddict.Abstractions
/// The token status.
/// The token type.
/// The that can be used to abort the operation.
- ///
- /// A that can be used to monitor the asynchronous operation,
- /// whose result returns the tokens corresponding to the criteria.
- ///
- ValueTask> FindAsync(
+ /// The tokens corresponding to the criteria.
+ IAsyncEnumerable FindAsync(
[NotNull] string subject, [NotNull] string client,
[NotNull] string status, [NotNull] string type, CancellationToken cancellationToken);
@@ -77,22 +67,16 @@ namespace OpenIddict.Abstractions
///
/// The application identifier associated with the tokens.
/// The that can be used to abort the operation.
- ///
- /// A that can be used to monitor the asynchronous operation,
- /// whose result returns the tokens corresponding to the specified application.
- ///
- ValueTask> FindByApplicationIdAsync([NotNull] string identifier, CancellationToken cancellationToken);
+ /// The tokens corresponding to the specified application.
+ IAsyncEnumerable FindByApplicationIdAsync([NotNull] string identifier, CancellationToken cancellationToken);
///
/// Retrieves the list of tokens corresponding to the specified authorization identifier.
///
/// The authorization identifier associated with the tokens.
/// The that can be used to abort the operation.
- ///
- /// A that can be used to monitor the asynchronous operation,
- /// whose result returns the tokens corresponding to the specified authorization.
- ///
- ValueTask> FindByAuthorizationIdAsync([NotNull] string identifier, CancellationToken cancellationToken);
+ /// The tokens corresponding to the specified authorization.
+ IAsyncEnumerable FindByAuthorizationIdAsync([NotNull] string identifier, CancellationToken cancellationToken);
///
/// Retrieves a token using its unique identifier.
@@ -122,20 +106,15 @@ namespace OpenIddict.Abstractions
///
/// The subject associated with the tokens.
/// The that can be used to abort the operation.
- ///
- /// A that can be used to monitor the asynchronous operation,
- /// whose result returns the tokens corresponding to the specified subject.
- ///
- ValueTask> FindBySubjectAsync([NotNull] string subject, CancellationToken cancellationToken);
+ /// The tokens corresponding to the specified subject.
+ IAsyncEnumerable FindBySubjectAsync([NotNull] string subject, CancellationToken cancellationToken);
///
/// Removes the specified token from the cache.
///
/// The token to remove from the cache.
/// The that can be used to abort the operation.
- ///
- /// A that can be used to monitor the asynchronous operation.
- ///
- Task RemoveAsync([NotNull] TToken token, CancellationToken cancellationToken);
+ /// A that can be used to monitor the asynchronous operation.
+ ValueTask RemoveAsync([NotNull] TToken token, CancellationToken cancellationToken);
}
}
diff --git a/src/OpenIddict.Abstractions/Managers/IOpenIddictApplicationManager.cs b/src/OpenIddict.Abstractions/Managers/IOpenIddictApplicationManager.cs
index 0436b149..b5d45d2b 100644
--- a/src/OpenIddict.Abstractions/Managers/IOpenIddictApplicationManager.cs
+++ b/src/OpenIddict.Abstractions/Managers/IOpenIddictApplicationManager.cs
@@ -1,4 +1,5 @@
using System;
+using System.Collections.Generic;
using System.Collections.Immutable;
using System.ComponentModel.DataAnnotations;
using System.Linq;
@@ -23,10 +24,10 @@ namespace OpenIddict.Abstractions
///
/// The that can be used to abort the operation.
///
- /// A that can be used to monitor the asynchronous operation,
+ /// A that can be used to monitor the asynchronous operation,
/// whose result returns the number of applications in the database.
///
- Task CountAsync(CancellationToken cancellationToken = default);
+ ValueTask CountAsync(CancellationToken cancellationToken = default);
///
/// Determines the number of applications that match the specified query.
@@ -35,10 +36,10 @@ namespace OpenIddict.Abstractions
/// The query to execute.
/// The that can be used to abort the operation.
///
- /// A that can be used to monitor the asynchronous operation,
+ /// A that can be used to monitor the asynchronous operation,
/// whose result returns the number of applications that match the specified query.
///
- Task CountAsync([NotNull] Func, IQueryable> query, CancellationToken cancellationToken = default);
+ ValueTask CountAsync([NotNull] Func, IQueryable> query, CancellationToken cancellationToken = default);
///
/// Creates a new application based on the specified descriptor.
@@ -48,10 +49,10 @@ namespace OpenIddict.Abstractions
/// The application descriptor.
/// The that can be used to abort the operation.
///
- /// A that can be used to monitor the asynchronous operation,
+ /// A that can be used to monitor the asynchronous operation,
/// whose result returns the unique identifier associated with the application.
///
- Task CreateAsync([NotNull] OpenIddictApplicationDescriptor descriptor, CancellationToken cancellationToken = default);
+ ValueTask CreateAsync([NotNull] OpenIddictApplicationDescriptor descriptor, CancellationToken cancellationToken = default);
///
/// Creates a new application.
@@ -59,9 +60,9 @@ namespace OpenIddict.Abstractions
/// The application to create.
/// The that can be used to abort the operation.
///
- /// A that can be used to monitor the asynchronous operation.
+ /// A that can be used to monitor the asynchronous operation.
///
- Task CreateAsync([NotNull] object application, CancellationToken cancellationToken = default);
+ ValueTask CreateAsync([NotNull] object application, CancellationToken cancellationToken = default);
///
/// Creates a new application.
@@ -72,9 +73,9 @@ namespace OpenIddict.Abstractions
/// The client secret associated with the application, if applicable.
/// The that can be used to abort the operation.
///
- /// A that can be used to monitor the asynchronous operation.
+ /// A that can be used to monitor the asynchronous operation.
///
- Task CreateAsync([NotNull] object application, [CanBeNull] string secret, CancellationToken cancellationToken = default);
+ ValueTask CreateAsync([NotNull] object application, [CanBeNull] string secret, CancellationToken cancellationToken = default);
///
/// Removes an existing application.
@@ -82,9 +83,9 @@ namespace OpenIddict.Abstractions
/// The application to delete.
/// The that can be used to abort the operation.
///
- /// A that can be used to monitor the asynchronous operation.
+ /// A that can be used to monitor the asynchronous operation.
///
- Task DeleteAsync([NotNull] object application, CancellationToken cancellationToken = default);
+ ValueTask DeleteAsync([NotNull] object application, CancellationToken cancellationToken = default);
///
/// Retrieves an application using its client identifier.
@@ -92,10 +93,10 @@ namespace OpenIddict.Abstractions
/// The client identifier associated with the application.
/// The that can be used to abort the operation.
///
- /// A that can be used to monitor the asynchronous operation,
+ /// A that can be used to monitor the asynchronous operation,
/// whose result returns the client application corresponding to the identifier.
///
- Task FindByClientIdAsync([NotNull] string identifier, CancellationToken cancellationToken = default);
+ ValueTask FindByClientIdAsync([NotNull] string identifier, CancellationToken cancellationToken = default);
///
/// Retrieves an application using its unique identifier.
@@ -103,32 +104,26 @@ namespace OpenIddict.Abstractions
/// The unique identifier associated with the application.
/// The that can be used to abort the operation.
///
- /// A that can be used to monitor the asynchronous operation,
+ /// A that can be used to monitor the asynchronous operation,
/// whose result returns the client application corresponding to the identifier.
///
- Task FindByIdAsync([NotNull] string identifier, CancellationToken cancellationToken = default);
+ ValueTask FindByIdAsync([NotNull] string identifier, CancellationToken cancellationToken = default);
///
/// Retrieves all the applications associated with the specified post_logout_redirect_uri.
///
/// The post_logout_redirect_uri associated with the applications.
/// The that can be used to abort the operation.
- ///
- /// A that can be used to monitor the asynchronous operation, whose result
- /// returns the client applications corresponding to the specified post_logout_redirect_uri.
- ///
- Task> FindByPostLogoutRedirectUriAsync([NotNull] string address, CancellationToken cancellationToken = default);
+ /// The client applications corresponding to the specified post_logout_redirect_uri.
+ IAsyncEnumerable FindByPostLogoutRedirectUriAsync([NotNull] string address, CancellationToken cancellationToken = default);
///
/// Retrieves all the applications associated with the specified redirect_uri.
///
/// The redirect_uri associated with the applications.
/// The that can be used to abort the operation.
- ///
- /// A that can be used to monitor the asynchronous operation, whose result
- /// returns the client applications corresponding to the specified redirect_uri.
- ///
- Task> FindByRedirectUriAsync([NotNull] string address, CancellationToken cancellationToken = default);
+ /// The client applications corresponding to the specified redirect_uri.
+ IAsyncEnumerable FindByRedirectUriAsync([NotNull] string address, CancellationToken cancellationToken = default);
///
/// Executes the specified query and returns the first element.
@@ -137,10 +132,10 @@ namespace OpenIddict.Abstractions
/// The query to execute.
/// The that can be used to abort the operation.
///
- /// A that can be used to monitor the asynchronous operation,
+ /// A that can be used to monitor the asynchronous operation,
/// whose result returns the first element returned when executing the query.
///
- Task GetAsync(
+ ValueTask GetAsync(
[NotNull] Func, IQueryable> query, CancellationToken cancellationToken = default);
///
@@ -152,10 +147,10 @@ namespace OpenIddict.Abstractions
/// The optional state.
/// The that can be used to abort the operation.
///
- /// A that can be used to monitor the asynchronous operation,
+ /// A that can be used to monitor the asynchronous operation,
/// whose result returns the first element returned when executing the query.
///
- Task GetAsync(
+ ValueTask GetAsync(
[NotNull] Func, TState, IQueryable> query,
[CanBeNull] TState state, CancellationToken cancellationToken = default);
@@ -254,7 +249,7 @@ namespace OpenIddict.Abstractions
/// The permission.
/// The that can be used to abort the operation.
/// true if the application has been granted the specified permission, false otherwise.
- Task HasPermissionAsync([NotNull] object application, [NotNull] string permission, CancellationToken cancellationToken = default);
+ ValueTask HasPermissionAsync([NotNull] object application, [NotNull] string permission, CancellationToken cancellationToken = default);
///
/// Determines whether an application is a confidential client.
@@ -262,7 +257,7 @@ namespace OpenIddict.Abstractions
/// The application.
/// The that can be used to abort the operation.
/// true if the application is a confidential client, false otherwise.
- Task IsConfidentialAsync([NotNull] object application, CancellationToken cancellationToken = default);
+ ValueTask IsConfidentialAsync([NotNull] object application, CancellationToken cancellationToken = default);
///
/// Determines whether an application is a hybrid client.
@@ -270,7 +265,7 @@ namespace OpenIddict.Abstractions
/// The application.
/// The that can be used to abort the operation.
/// true if the application is a hybrid client, false otherwise.
- Task IsHybridAsync([NotNull] object application, CancellationToken cancellationToken = default);
+ ValueTask IsHybridAsync([NotNull] object application, CancellationToken cancellationToken = default);
///
/// Determines whether an application is a public client.
@@ -278,7 +273,7 @@ namespace OpenIddict.Abstractions
/// The application.
/// The that can be used to abort the operation.
/// true if the application is a public client, false otherwise.
- Task IsPublicAsync([NotNull] object application, CancellationToken cancellationToken = default);
+ ValueTask IsPublicAsync([NotNull] object application, CancellationToken cancellationToken = default);
///
/// Executes the specified query and returns all the corresponding elements.
@@ -286,11 +281,8 @@ namespace OpenIddict.Abstractions
/// The number of results to return.
/// The number of results to skip.
/// The that can be used to abort the operation.
- ///
- /// A that can be used to monitor the asynchronous operation,
- /// whose result returns all the elements returned when executing the specified query.
- ///
- Task> ListAsync(
+ /// All the elements returned when executing the specified query.
+ IAsyncEnumerable ListAsync(
[CanBeNull] int? count = null, [CanBeNull] int? offset = null, CancellationToken cancellationToken = default);
///
@@ -299,11 +291,8 @@ namespace OpenIddict.Abstractions
/// The result type.
/// The query to execute.
/// The that can be used to abort the operation.
- ///
- /// A that can be used to monitor the asynchronous operation,
- /// whose result returns all the elements returned when executing the specified query.
- ///
- Task> ListAsync(
+ /// All the elements returned when executing the specified query.
+ IAsyncEnumerable ListAsync(
[NotNull] Func, IQueryable> query, CancellationToken cancellationToken = default);
///
@@ -314,11 +303,8 @@ namespace OpenIddict.Abstractions
/// 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 all the elements returned when executing the specified query.
- ///
- Task> ListAsync(
+ /// All the elements returned when executing the specified query.
+ IAsyncEnumerable ListAsync(
[NotNull] Func, TState, IQueryable> query,
[CanBeNull] TState state, CancellationToken cancellationToken = default);
@@ -329,9 +315,9 @@ namespace OpenIddict.Abstractions
/// The application.
/// The that can be used to abort the operation.
///
- /// A that can be used to monitor the asynchronous operation.
+ /// A that can be used to monitor the asynchronous operation.
///
- Task PopulateAsync([NotNull] OpenIddictApplicationDescriptor descriptor, [NotNull] object application, CancellationToken cancellationToken = default);
+ ValueTask PopulateAsync([NotNull] OpenIddictApplicationDescriptor descriptor, [NotNull] object application, CancellationToken cancellationToken = default);
///
/// Populates the application using the specified descriptor.
@@ -340,9 +326,9 @@ namespace OpenIddict.Abstractions
/// The descriptor.
/// The that can be used to abort the operation.
///
- /// A that can be used to monitor the asynchronous operation.
+ /// A that can be used to monitor the asynchronous operation.
///
- Task PopulateAsync([NotNull] object application, [NotNull] OpenIddictApplicationDescriptor descriptor, CancellationToken cancellationToken = default);
+ ValueTask PopulateAsync([NotNull] object application, [NotNull] OpenIddictApplicationDescriptor descriptor, CancellationToken cancellationToken = default);
///
/// Updates an existing application.
@@ -350,9 +336,9 @@ namespace OpenIddict.Abstractions
/// The application to update.
/// The that can be used to abort the operation.
///
- /// A that can be used to monitor the asynchronous operation.
+ /// A that can be used to monitor the asynchronous operation.
///
- Task UpdateAsync([NotNull] object application, CancellationToken cancellationToken = default);
+ ValueTask UpdateAsync([NotNull] object application, CancellationToken cancellationToken = default);
///
/// Updates an existing application.
@@ -361,9 +347,9 @@ namespace OpenIddict.Abstractions
/// The descriptor used to update the application.
/// The that can be used to abort the operation.
///
- /// A that can be used to monitor the asynchronous operation.
+ /// A that can be used to monitor the asynchronous operation.
///
- Task UpdateAsync([NotNull] object application, [NotNull] OpenIddictApplicationDescriptor descriptor, CancellationToken cancellationToken = default);
+ ValueTask UpdateAsync([NotNull] object application, [NotNull] OpenIddictApplicationDescriptor descriptor, CancellationToken cancellationToken = default);
///
/// Updates an existing application and replaces the existing secret.
@@ -374,20 +360,17 @@ namespace OpenIddict.Abstractions
/// The client secret associated with the application.
/// The that can be used to abort the operation.
///
- /// A that can be used to monitor the asynchronous operation.
+ /// A that can be used to monitor the asynchronous operation.
///
- Task UpdateAsync([NotNull] object application, [CanBeNull] string secret, CancellationToken cancellationToken = default);
+ ValueTask UpdateAsync([NotNull] object application, [CanBeNull] string secret, CancellationToken cancellationToken = default);
///
/// Validates the application to ensure it's in a consistent state.
///
/// The application.
/// The that can be used to abort the operation.
- ///
- /// A that can be used to monitor the asynchronous operation,
- /// whose result returns the validation error encountered when validating the application.
- ///
- Task> ValidateAsync([NotNull] object application, CancellationToken cancellationToken = default);
+ /// The validation error encountered when validating the application.
+ IAsyncEnumerable ValidateAsync([NotNull] object application, CancellationToken cancellationToken = default);
///
/// Validates the client_secret associated with an application.
@@ -395,12 +378,12 @@ namespace OpenIddict.Abstractions
/// The application.
/// The secret that should be compared to the client_secret stored in the database.
/// The that can be used to abort the operation.
- /// A that can be used to monitor the asynchronous operation.
+ /// A that can be used to monitor the asynchronous operation.
///
- /// A that can be used to monitor the asynchronous operation,
+ /// A that can be used to monitor the asynchronous operation,
/// whose result returns a boolean indicating whether the client secret was valid.
///
- Task ValidateClientSecretAsync([NotNull] object application, string secret, CancellationToken cancellationToken = default);
+ ValueTask ValidateClientSecretAsync([NotNull] object application, string secret, CancellationToken cancellationToken = default);
///
/// Validates the redirect_uri to ensure it's associated with an application.
@@ -409,9 +392,9 @@ namespace OpenIddict.Abstractions
/// The address that should be compared to one of the redirect_uri stored in the database.
/// The that can be used to abort the operation.
///
- /// A that can be used to monitor the asynchronous operation,
+ /// A that can be used to monitor the asynchronous operation,
/// whose result returns a boolean indicating whether the redirect_uri was valid.
///
- Task ValidateRedirectUriAsync([NotNull] object application, [NotNull] string address, CancellationToken cancellationToken = default);
+ ValueTask ValidateRedirectUriAsync([NotNull] object application, [NotNull] string address, CancellationToken cancellationToken = default);
}
}
diff --git a/src/OpenIddict.Abstractions/Managers/IOpenIddictAuthorizationManager.cs b/src/OpenIddict.Abstractions/Managers/IOpenIddictAuthorizationManager.cs
index 91ee6d57..4ffa9861 100644
--- a/src/OpenIddict.Abstractions/Managers/IOpenIddictAuthorizationManager.cs
+++ b/src/OpenIddict.Abstractions/Managers/IOpenIddictAuthorizationManager.cs
@@ -1,4 +1,5 @@
using System;
+using System.Collections.Generic;
using System.Collections.Immutable;
using System.ComponentModel.DataAnnotations;
using System.Linq;
@@ -23,10 +24,10 @@ namespace OpenIddict.Abstractions
///
/// The that can be used to abort the operation.
///
- /// A that can be used to monitor the asynchronous operation,
+ /// A that can be used to monitor the asynchronous operation,
/// whose result returns the number of authorizations in the database.
///
- Task CountAsync(CancellationToken cancellationToken = default);
+ ValueTask CountAsync(CancellationToken cancellationToken = default);
///
/// Determines the number of authorizations that match the specified query.
@@ -35,10 +36,10 @@ namespace OpenIddict.Abstractions
/// The query to execute.
/// The that can be used to abort the operation.
///
- /// A that can be used to monitor the asynchronous operation,
+ /// A that can be used to monitor the asynchronous operation,
/// whose result returns the number of authorizations that match the specified query.
///
- Task CountAsync(
+ ValueTask CountAsync(
[NotNull] Func, IQueryable> query, CancellationToken cancellationToken = default);
///
@@ -51,9 +52,9 @@ namespace OpenIddict.Abstractions
/// The minimal scopes associated with the authorization.
/// The that can be used to abort the operation.
///
- /// A that can be used to monitor the asynchronous operation, whose result returns the authorization.
+ /// A that can be used to monitor the asynchronous operation, whose result returns the authorization.
///
- Task CreateAsync(
+ ValueTask CreateAsync(
[NotNull] ImmutableDictionary claims, [NotNull] string subject, [NotNull] string client,
[NotNull] string type, ImmutableArray scopes, CancellationToken cancellationToken = default);
@@ -63,9 +64,9 @@ namespace OpenIddict.Abstractions
/// The authorization descriptor.
/// The that can be used to abort the operation.
///
- /// A that can be used to monitor the asynchronous operation, whose result returns the authorization.
+ /// A that can be used to monitor the asynchronous operation, whose result returns the authorization.
///
- Task CreateAsync([NotNull] OpenIddictAuthorizationDescriptor descriptor, CancellationToken cancellationToken = default);
+ ValueTask CreateAsync([NotNull] OpenIddictAuthorizationDescriptor descriptor, CancellationToken cancellationToken = default);
///
/// Creates a new authorization.
@@ -73,9 +74,9 @@ namespace OpenIddict.Abstractions
/// The application to create.
/// The that can be used to abort the operation.
///
- /// A that can be used to monitor the asynchronous operation.
+ /// A that can be used to monitor the asynchronous operation.
///
- Task CreateAsync([NotNull] object authorization, CancellationToken cancellationToken = default);
+ ValueTask CreateAsync([NotNull] object authorization, CancellationToken cancellationToken = default);
///
/// Removes an existing authorization.
@@ -83,9 +84,9 @@ namespace OpenIddict.Abstractions
/// The authorization to delete.
/// The that can be used to abort the operation.
///
- /// A that can be used to monitor the asynchronous operation.
+ /// A that can be used to monitor the asynchronous operation.
///
- Task DeleteAsync([NotNull] object authorization, CancellationToken cancellationToken = default);
+ ValueTask DeleteAsync([NotNull] object authorization, CancellationToken cancellationToken = default);
///
/// Retrieves the authorizations corresponding to the specified
@@ -94,11 +95,8 @@ namespace OpenIddict.Abstractions
/// The subject associated with the authorization.
/// The client associated with the authorization.
/// The that can be used to abort the operation.
- ///
- /// A that can be used to monitor the asynchronous operation,
- /// whose result returns the authorizations corresponding to the subject/client.
- ///
- Task> FindAsync([NotNull] string subject, [NotNull] string client, CancellationToken cancellationToken = default);
+ /// The authorizations corresponding to the subject/client.
+ IAsyncEnumerable FindAsync([NotNull] string subject, [NotNull] string client, CancellationToken cancellationToken = default);
///
/// Retrieves the authorizations matching the specified parameters.
@@ -107,11 +105,8 @@ namespace OpenIddict.Abstractions
/// The client associated with the authorization.
/// The authorization status.
/// The that can be used to abort the operation.
- ///
- /// A that can be used to monitor the asynchronous operation,
- /// whose result returns the authorizations corresponding to the criteria.
- ///
- Task> FindAsync(
+ /// The authorizations corresponding to the criteria.
+ IAsyncEnumerable FindAsync(
[NotNull] string subject, [NotNull] string client,
[NotNull] string status, CancellationToken cancellationToken = default);
@@ -123,11 +118,8 @@ namespace OpenIddict.Abstractions
/// The authorization status.
/// The authorization type.
/// The that can be used to abort the operation.
- ///
- /// A that can be used to monitor the asynchronous operation,
- /// whose result returns the authorizations corresponding to the criteria.
- ///
- Task> FindAsync(
+ /// The authorizations corresponding to the criteria.
+ IAsyncEnumerable FindAsync(
[NotNull] string subject, [NotNull] string client,
[NotNull] string status, [NotNull] string type, CancellationToken cancellationToken = default);
@@ -140,11 +132,8 @@ namespace OpenIddict.Abstractions
/// The authorization type.
/// The minimal scopes associated with the authorization.
/// The that can be used to abort the operation.
- ///
- /// A that can be used to monitor the asynchronous operation,
- /// whose result returns the authorizations corresponding to the criteria.
- ///
- Task> FindAsync(
+ /// The authorizations corresponding to the criteria.
+ IAsyncEnumerable FindAsync(
[NotNull] string subject, [NotNull] string client, [NotNull] string status,
[NotNull] string type, ImmutableArray scopes, CancellationToken cancellationToken = default);
@@ -153,11 +142,8 @@ namespace OpenIddict.Abstractions
///
/// The application identifier associated with the authorizations.
/// The that can be used to abort the operation.
- ///
- /// A that can be used to monitor the asynchronous operation,
- /// whose result returns the authorizations corresponding to the specified application.
- ///
- Task> FindByApplicationIdAsync([NotNull] string identifier, CancellationToken cancellationToken = default);
+ /// The authorizations corresponding to the specified application.
+ IAsyncEnumerable FindByApplicationIdAsync([NotNull] string identifier, CancellationToken cancellationToken = default);
///
/// Retrieves an authorization using its unique identifier.
@@ -165,21 +151,18 @@ namespace OpenIddict.Abstractions
/// The unique identifier associated with the authorization.
/// The that can be used to abort the operation.
///
- /// A that can be used to monitor the asynchronous operation,
+ /// A that can be used to monitor the asynchronous operation,
/// whose result returns the authorization corresponding to the identifier.
///
- Task FindByIdAsync([NotNull] string identifier, CancellationToken cancellationToken = default);
+ ValueTask FindByIdAsync([NotNull] string identifier, CancellationToken cancellationToken = default);
///
/// Retrieves all the authorizations corresponding to the specified subject.
///
/// The subject associated with the authorization.
/// The that can be used to abort the operation.
- ///
- /// A that can be used to monitor the asynchronous operation,
- /// whose result returns the authorizations corresponding to the specified subject.
- ///
- Task> FindBySubjectAsync([NotNull] string subject, CancellationToken cancellationToken = default);
+ /// The authorizations corresponding to the specified subject.
+ IAsyncEnumerable FindBySubjectAsync([NotNull] string subject, CancellationToken cancellationToken = default);
///
/// Retrieves the optional application identifier associated with an authorization.
@@ -199,10 +182,10 @@ namespace OpenIddict.Abstractions
/// The query to execute.
/// The that can be used to abort the operation.
///
- /// A that can be used to monitor the asynchronous operation,
+ /// A that can be used to monitor the asynchronous operation,
/// whose result returns the first element returned when executing the query.
///
- Task GetAsync(
+ ValueTask GetAsync(
[NotNull] Func, IQueryable> query, CancellationToken cancellationToken = default);
///
@@ -214,10 +197,10 @@ namespace OpenIddict.Abstractions
/// The optional state.
/// The that can be used to abort the operation.
///
- /// A that can be used to monitor the asynchronous operation,
+ /// A that can be used to monitor the asynchronous operation,
/// whose result returns the first element returned when executing the query.
///
- Task GetAsync(
+ ValueTask GetAsync(
[NotNull] Func, TState, IQueryable> query,
[CanBeNull] TState state, CancellationToken cancellationToken = default);
@@ -283,7 +266,7 @@ namespace OpenIddict.Abstractions
/// The scopes.
/// The that can be used to abort the operation.
/// true if the scopes are included in the authorization, false otherwise.
- Task HasScopesAsync([NotNull] object authorization, ImmutableArray scopes, CancellationToken cancellationToken = default);
+ ValueTask HasScopesAsync([NotNull] object authorization, ImmutableArray scopes, CancellationToken cancellationToken = default);
///
/// Determines whether a given authorization is ad hoc.
@@ -291,7 +274,7 @@ namespace OpenIddict.Abstractions
/// The authorization.
/// The that can be used to abort the operation.
/// true if the authorization is ad hoc, false otherwise.
- Task IsAdHocAsync([NotNull] object authorization, CancellationToken cancellationToken = default);
+ ValueTask IsAdHocAsync([NotNull] object authorization, CancellationToken cancellationToken = default);
///
/// Determines whether a given authorization is permanent.
@@ -299,7 +282,7 @@ namespace OpenIddict.Abstractions
/// The authorization.
/// The that can be used to abort the operation.
/// true if the authorization is permanent, false otherwise.
- Task IsPermanentAsync([NotNull] object authorization, CancellationToken cancellationToken = default);
+ ValueTask IsPermanentAsync([NotNull] object authorization, CancellationToken cancellationToken = default);
///
/// Determines whether a given authorization has been revoked.
@@ -307,7 +290,7 @@ namespace OpenIddict.Abstractions
/// The authorization.
/// The that can be used to abort the operation.
/// true if the authorization has been revoked, false otherwise.
- Task IsRevokedAsync([NotNull] object authorization, CancellationToken cancellationToken = default);
+ ValueTask IsRevokedAsync([NotNull] object authorization, CancellationToken cancellationToken = default);
///
/// Determines whether a given authorization is valid.
@@ -315,7 +298,7 @@ namespace OpenIddict.Abstractions
/// The authorization.
/// The that can be used to abort the operation.
/// true if the authorization is valid, false otherwise.
- Task IsValidAsync([NotNull] object authorization, CancellationToken cancellationToken = default);
+ ValueTask IsValidAsync([NotNull] object authorization, CancellationToken cancellationToken = default);
///
/// Executes the specified query and returns all the corresponding elements.
@@ -323,11 +306,8 @@ namespace OpenIddict.Abstractions
/// The number of results to return.
/// The number of results to skip.
/// The that can be used to abort the operation.
- ///
- /// A that can be used to monitor the asynchronous operation,
- /// whose result returns all the elements returned when executing the specified query.
- ///
- Task> ListAsync(
+ /// All the elements returned when executing the specified query.
+ IAsyncEnumerable ListAsync(
[CanBeNull] int? count = null, [CanBeNull] int? offset = null, CancellationToken cancellationToken = default);
///
@@ -336,11 +316,8 @@ namespace OpenIddict.Abstractions
/// The result type.
/// The query to execute.
/// The that can be used to abort the operation.
- ///
- /// A that can be used to monitor the asynchronous operation,
- /// whose result returns all the elements returned when executing the specified query.
- ///
- Task> ListAsync(
+ /// All the elements returned when executing the specified query.
+ IAsyncEnumerable ListAsync(
[NotNull] Func, IQueryable> query, CancellationToken cancellationToken = default);
///
@@ -351,11 +328,8 @@ namespace OpenIddict.Abstractions
/// 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 all the elements returned when executing the specified query.
- ///
- Task> ListAsync(
+ /// All the elements returned when executing the specified query.
+ IAsyncEnumerable ListAsync(
[NotNull] Func, TState, IQueryable> query,
[CanBeNull] TState state, CancellationToken cancellationToken = default);
@@ -366,9 +340,9 @@ namespace OpenIddict.Abstractions
/// The authorization.
/// The that can be used to abort the operation.
///
- /// A that can be used to monitor the asynchronous operation.
+ /// A that can be used to monitor the asynchronous operation.
///
- Task PopulateAsync([NotNull] OpenIddictAuthorizationDescriptor descriptor, [NotNull] object authorization, CancellationToken cancellationToken = default);
+ ValueTask PopulateAsync([NotNull] OpenIddictAuthorizationDescriptor descriptor, [NotNull] object authorization, CancellationToken cancellationToken = default);
///
/// Populates the authorization using the specified descriptor.
@@ -377,26 +351,26 @@ namespace OpenIddict.Abstractions
/// The descriptor.
/// The that can be used to abort the operation.
///
- /// A that can be used to monitor the asynchronous operation.
+ /// A that can be used to monitor the asynchronous operation.
///
- Task PopulateAsync([NotNull] object authorization, [NotNull] OpenIddictAuthorizationDescriptor descriptor, CancellationToken cancellationToken = default);
+ ValueTask PopulateAsync([NotNull] object authorization, [NotNull] OpenIddictAuthorizationDescriptor descriptor, CancellationToken cancellationToken = default);
///
/// Removes the authorizations that are marked as invalid and the ad-hoc ones that have no valid/nonexpired token attached.
///
/// The that can be used to abort the operation.
///
- /// A that can be used to monitor the asynchronous operation.
+ /// A that can be used to monitor the asynchronous operation.
///
- Task PruneAsync(CancellationToken cancellationToken = default);
+ ValueTask PruneAsync(CancellationToken cancellationToken = default);
///
/// Revokes an authorization.
///
/// The authorization to revoke.
/// The that can be used to abort the operation.
- /// A that can be used to monitor the asynchronous operation.
- Task RevokeAsync([NotNull] object authorization, CancellationToken cancellationToken = default);
+ /// A that can be used to monitor the asynchronous operation.
+ ValueTask RevokeAsync([NotNull] object authorization, CancellationToken cancellationToken = default);
///
/// Sets the application identifier associated with an authorization.
@@ -405,9 +379,9 @@ namespace OpenIddict.Abstractions
/// The unique identifier associated with the client application.
/// The that can be used to abort the operation.
///
- /// A that can be used to monitor the asynchronous operation.
+ /// A that can be used to monitor the asynchronous operation.
///
- Task SetApplicationIdAsync([NotNull] object authorization, [CanBeNull] string identifier, CancellationToken cancellationToken = default);
+ ValueTask SetApplicationIdAsync([NotNull] object authorization, [CanBeNull] string identifier, CancellationToken cancellationToken = default);
///
/// Updates an existing authorization.
@@ -415,9 +389,9 @@ namespace OpenIddict.Abstractions
/// The authorization to update.
/// The that can be used to abort the operation.
///
- /// A that can be used to monitor the asynchronous operation.
+ /// A that can be used to monitor the asynchronous operation.
///
- Task UpdateAsync([NotNull] object authorization, CancellationToken cancellationToken = default);
+ ValueTask UpdateAsync([NotNull] object authorization, CancellationToken cancellationToken = default);
///
/// Updates an existing authorization.
@@ -426,19 +400,16 @@ namespace OpenIddict.Abstractions
/// The descriptor used to update the authorization.
/// The that can be used to abort the operation.
///
- /// A that can be used to monitor the asynchronous operation.
+ /// A that can be used to monitor the asynchronous operation.
///
- Task UpdateAsync([NotNull] object authorization, [NotNull] OpenIddictAuthorizationDescriptor descriptor, CancellationToken cancellationToken = default);
+ ValueTask UpdateAsync([NotNull] object authorization, [NotNull] OpenIddictAuthorizationDescriptor descriptor, CancellationToken cancellationToken = default);
///
/// Validates the authorization to ensure it's in a consistent state.
///
/// The authorization.
/// The that can be used to abort the operation.
- ///
- /// A that can be used to monitor the asynchronous operation,
- /// whose result returns the validation error encountered when validating the authorization.
- ///
- Task> ValidateAsync([NotNull] object authorization, CancellationToken cancellationToken = default);
+ /// The validation error encountered when validating the authorization.
+ IAsyncEnumerable ValidateAsync([NotNull] object authorization, CancellationToken cancellationToken = default);
}
}
diff --git a/src/OpenIddict.Abstractions/Managers/IOpenIddictScopeManager.cs b/src/OpenIddict.Abstractions/Managers/IOpenIddictScopeManager.cs
index fd3dd2fa..7f6f8b03 100644
--- a/src/OpenIddict.Abstractions/Managers/IOpenIddictScopeManager.cs
+++ b/src/OpenIddict.Abstractions/Managers/IOpenIddictScopeManager.cs
@@ -1,4 +1,5 @@
using System;
+using System.Collections.Generic;
using System.Collections.Immutable;
using System.ComponentModel.DataAnnotations;
using System.Linq;
@@ -23,10 +24,10 @@ namespace OpenIddict.Abstractions
///
/// The that can be used to abort the operation.
///
- /// A that can be used to monitor the asynchronous operation,
+ /// A that can be used to monitor the asynchronous operation,
/// whose result returns the number of scopes in the database.
///
- Task CountAsync(CancellationToken cancellationToken = default);
+ ValueTask CountAsync(CancellationToken cancellationToken = default);
///
/// Determines the number of scopes that match the specified query.
@@ -35,10 +36,10 @@ namespace OpenIddict.Abstractions
/// The query to execute.
/// The that can be used to abort the operation.
///
- /// A that can be used to monitor the asynchronous operation,
+ /// A that can be used to monitor the asynchronous operation,
/// whose result returns the number of scopes that match the specified query.
///
- Task CountAsync([NotNull] Func, IQueryable> query, CancellationToken cancellationToken = default);
+ ValueTask CountAsync([NotNull] Func, IQueryable> query, CancellationToken cancellationToken = default);
///
/// Creates a new scope based on the specified descriptor.
@@ -46,9 +47,9 @@ namespace OpenIddict.Abstractions
/// The scope descriptor.
/// The that can be used to abort the operation.
///
- /// A that can be used to monitor the asynchronous operation, whose result returns the scope.
+ /// A that can be used to monitor the asynchronous operation, whose result returns the scope.
///
- Task CreateAsync([NotNull] OpenIddictScopeDescriptor descriptor, CancellationToken cancellationToken = default);
+ ValueTask CreateAsync([NotNull] OpenIddictScopeDescriptor descriptor, CancellationToken cancellationToken = default);
///
/// Creates a new scope.
@@ -56,9 +57,9 @@ namespace OpenIddict.Abstractions
/// The scope to create.
/// The that can be used to abort the operation.
///
- /// A that can be used to monitor the asynchronous operation.
+ /// A that can be used to monitor the asynchronous operation.
///
- Task CreateAsync([NotNull] object scope, CancellationToken cancellationToken = default);
+ ValueTask CreateAsync([NotNull] object scope, CancellationToken cancellationToken = default);
///
/// Removes an existing scope.
@@ -66,9 +67,9 @@ namespace OpenIddict.Abstractions
/// The scope to delete.
/// The that can be used to abort the operation.
///
- /// A that can be used to monitor the asynchronous operation.
+ /// A that can be used to monitor the asynchronous operation.
///
- Task DeleteAsync([NotNull] object scope, CancellationToken cancellationToken = default);
+ ValueTask DeleteAsync([NotNull] object scope, CancellationToken cancellationToken = default);
///
/// Retrieves a scope using its unique identifier.
@@ -76,10 +77,10 @@ namespace OpenIddict.Abstractions
/// The unique identifier associated with the scope.
/// The that can be used to abort the operation.
///
- /// A that can be used to monitor the asynchronous operation,
+ /// A that can be used to monitor the asynchronous operation,
/// whose result returns the scope corresponding to the identifier.
///
- Task FindByIdAsync([NotNull] string identifier, CancellationToken cancellationToken = default);
+ ValueTask FindByIdAsync([NotNull] string identifier, CancellationToken cancellationToken = default);
///
/// Retrieves a scope using its name.
@@ -87,32 +88,26 @@ namespace OpenIddict.Abstractions
/// The name associated with the scope.
/// The that can be used to abort the operation.
///
- /// A that can be used to monitor the asynchronous operation,
+ /// A that can be used to monitor the asynchronous operation,
/// whose result returns the scope corresponding to the specified name.
///
- Task FindByNameAsync([NotNull] string name, CancellationToken cancellationToken = default);
+ ValueTask FindByNameAsync([NotNull] string name, CancellationToken cancellationToken = default);
///
/// Retrieves a list of scopes using their name.
///
/// The names associated with the scopes.
/// The that can be used to abort the operation.
- ///
- /// A that can be used to monitor the asynchronous operation,
- /// whose result returns the scopes corresponding to the specified names.
- ///
- Task> FindByNamesAsync(ImmutableArray names, CancellationToken cancellationToken = default);
+ /// The scopes corresponding to the specified names.
+ IAsyncEnumerable FindByNamesAsync(ImmutableArray names, CancellationToken cancellationToken = default);
///
/// Retrieves all the scopes that contain the specified resource.
///
/// The resource associated with the scopes.
/// The that can be used to abort the operation.
- ///
- /// A that can be used to monitor the asynchronous operation,
- /// whose result returns the scopes associated with the specified resource.
- ///
- Task> FindByResourceAsync([NotNull] string resource, CancellationToken cancellationToken = default);
+ /// The scopes associated with the specified resource.
+ IAsyncEnumerable FindByResourceAsync([NotNull] string resource, CancellationToken cancellationToken = default);
///
/// Executes the specified query and returns the first element.
@@ -121,10 +116,10 @@ namespace OpenIddict.Abstractions
/// The query to execute.
/// The that can be used to abort the operation.
///
- /// A that can be used to monitor the asynchronous operation,
+ /// A that can be used to monitor the asynchronous operation,
/// whose result returns the first element returned when executing the query.
///
- Task GetAsync(
+ ValueTask GetAsync(
[NotNull] Func, IQueryable> query, CancellationToken cancellationToken = default);
///
@@ -136,10 +131,10 @@ namespace OpenIddict.Abstractions
/// The optional state.
/// The that can be used to abort the operation.
///
- /// A that can be used to monitor the asynchronous operation,
+ /// A that can be used to monitor the asynchronous operation,
/// whose result returns the first element returned when executing the query.
///
- Task GetAsync(
+ ValueTask GetAsync(
[NotNull] Func, TState, IQueryable> query,
[CanBeNull] TState state, CancellationToken cancellationToken = default);
@@ -204,11 +199,8 @@ namespace OpenIddict.Abstractions
/// The number of results to return.
/// The number of results to skip.
/// The that can be used to abort the operation.
- ///
- /// A that can be used to monitor the asynchronous operation,
- /// whose result returns all the elements returned when executing the specified query.
- ///
- Task> ListAsync(
+ /// All the elements returned when executing the specified query.
+ IAsyncEnumerable ListAsync(
[CanBeNull] int? count = null, [CanBeNull] int? offset = null, CancellationToken cancellationToken = default);
///
@@ -217,11 +209,8 @@ namespace OpenIddict.Abstractions
/// The result type.
/// The query to execute.
/// The that can be used to abort the operation.
- ///
- /// A that can be used to monitor the asynchronous operation,
- /// whose result returns all the elements returned when executing the specified query.
- ///
- Task> ListAsync(
+ /// All the elements returned when executing the specified query.
+ IAsyncEnumerable ListAsync(
[NotNull] Func, IQueryable> query, CancellationToken cancellationToken = default);
///
@@ -232,11 +221,8 @@ namespace OpenIddict.Abstractions
/// 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 all the elements returned when executing the specified query.
- ///
- Task> ListAsync(
+ /// All the elements returned when executing the specified query.
+ IAsyncEnumerable ListAsync(
[NotNull] Func, TState, IQueryable> query,
[CanBeNull] TState state, CancellationToken cancellationToken = default);
@@ -245,11 +231,8 @@ namespace OpenIddict.Abstractions
///
/// The scopes.
/// The that can be used to abort the operation.
- ///
- /// A that can be used to monitor the asynchronous operation,
- /// whose result returns all the resources associated with the specified scopes.
- ///
- Task> ListResourcesAsync(ImmutableArray scopes, CancellationToken cancellationToken = default);
+ /// All the resources associated with the specified scopes.
+ IAsyncEnumerable ListResourcesAsync(ImmutableArray scopes, CancellationToken cancellationToken = default);
///
/// Populates the specified descriptor using the properties exposed by the scope.
@@ -258,9 +241,9 @@ namespace OpenIddict.Abstractions
/// The scope.
/// The that can be used to abort the operation.
///
- /// A that can be used to monitor the asynchronous operation.
+ /// A that can be used to monitor the asynchronous operation.
///
- Task PopulateAsync([NotNull] OpenIddictScopeDescriptor descriptor, [NotNull] object scope, CancellationToken cancellationToken = default);
+ ValueTask PopulateAsync([NotNull] OpenIddictScopeDescriptor descriptor, [NotNull] object scope, CancellationToken cancellationToken = default);
///
/// Populates the scope using the specified descriptor.
@@ -269,9 +252,9 @@ namespace OpenIddict.Abstractions
/// The descriptor.
/// The that can be used to abort the operation.
///
- /// A that can be used to monitor the asynchronous operation.
+ /// A that can be used to monitor the asynchronous operation.
///
- Task PopulateAsync([NotNull] object scope, [NotNull] OpenIddictScopeDescriptor descriptor, CancellationToken cancellationToken = default);
+ ValueTask PopulateAsync([NotNull] object scope, [NotNull] OpenIddictScopeDescriptor descriptor, CancellationToken cancellationToken = default);
///
/// Updates an existing scope.
@@ -279,9 +262,9 @@ namespace OpenIddict.Abstractions
/// The scope to update.
/// The that can be used to abort the operation.
///
- /// A that can be used to monitor the asynchronous operation.
+ /// A that can be used to monitor the asynchronous operation.
///
- Task UpdateAsync([NotNull] object scope, CancellationToken cancellationToken = default);
+ ValueTask UpdateAsync([NotNull] object scope, CancellationToken cancellationToken = default);
///
/// Updates an existing scope.
@@ -290,19 +273,16 @@ namespace OpenIddict.Abstractions
/// The descriptor used to update the scope.
/// The that can be used to abort the operation.
///
- /// A that can be used to monitor the asynchronous operation.
+ /// A that can be used to monitor the asynchronous operation.
///
- Task UpdateAsync([NotNull] object scope, [NotNull] OpenIddictScopeDescriptor descriptor, CancellationToken cancellationToken = default);
+ ValueTask UpdateAsync([NotNull] object scope, [NotNull] OpenIddictScopeDescriptor descriptor, CancellationToken cancellationToken = default);
///
/// Validates the scope to ensure it's in a consistent state.
///
/// The scope.
/// The that can be used to abort the operation.
- ///
- /// A that can be used to monitor the asynchronous operation,
- /// whose result returns the validation error encountered when validating the scope.
- ///
- Task> ValidateAsync([NotNull] object scope, CancellationToken cancellationToken = default);
+ /// The validation error encountered when validating the scope.
+ IAsyncEnumerable ValidateAsync([NotNull] object scope, CancellationToken cancellationToken = default);
}
}
diff --git a/src/OpenIddict.Abstractions/Managers/IOpenIddictTokenManager.cs b/src/OpenIddict.Abstractions/Managers/IOpenIddictTokenManager.cs
index 37421f0c..f9e9868d 100644
--- a/src/OpenIddict.Abstractions/Managers/IOpenIddictTokenManager.cs
+++ b/src/OpenIddict.Abstractions/Managers/IOpenIddictTokenManager.cs
@@ -1,4 +1,5 @@
using System;
+using System.Collections.Generic;
using System.Collections.Immutable;
using System.ComponentModel.DataAnnotations;
using System.Linq;
@@ -23,10 +24,10 @@ namespace OpenIddict.Abstractions
///
/// The that can be used to abort the operation.
///
- /// A that can be used to monitor the asynchronous operation,
+ /// A that can be used to monitor the asynchronous operation,
/// whose result returns the number of tokens in the database.
///
- Task CountAsync(CancellationToken cancellationToken = default);
+ ValueTask CountAsync(CancellationToken cancellationToken = default);
///
/// Determines the number of tokens that match the specified query.
@@ -35,10 +36,10 @@ namespace OpenIddict.Abstractions
/// The query to execute.
/// The that can be used to abort the operation.
///
- /// A that can be used to monitor the asynchronous operation,
+ /// A that can be used to monitor the asynchronous operation,
/// whose result returns the number of tokens that match the specified query.
///
- Task CountAsync([NotNull] Func, IQueryable> query, CancellationToken cancellationToken = default);
+ ValueTask CountAsync([NotNull] Func, IQueryable> query, CancellationToken cancellationToken = default);
///
/// Creates a new token based on the specified descriptor.
@@ -46,9 +47,9 @@ namespace OpenIddict.Abstractions
/// The token descriptor.
/// The that can be used to abort the operation.
///
- /// A that can be used to monitor the asynchronous operation, whose result returns the token.
+ /// A that can be used to monitor the asynchronous operation, whose result returns the token.
///
- Task CreateAsync([NotNull] OpenIddictTokenDescriptor descriptor, CancellationToken cancellationToken = default);
+ ValueTask CreateAsync([NotNull] OpenIddictTokenDescriptor descriptor, CancellationToken cancellationToken = default);
///
/// Creates a new token.
@@ -56,9 +57,9 @@ namespace OpenIddict.Abstractions
/// The token.
/// The that can be used to abort the operation.
///
- /// A that can be used to monitor the asynchronous operation.
+ /// A that can be used to monitor the asynchronous operation.
///
- Task CreateAsync([NotNull] object token, CancellationToken cancellationToken = default);
+ ValueTask CreateAsync([NotNull] object token, CancellationToken cancellationToken = default);
///
/// Removes an existing token.
@@ -66,9 +67,9 @@ namespace OpenIddict.Abstractions
/// The token to delete.
/// The that can be used to abort the operation.
///
- /// A that can be used to monitor the asynchronous operation.
+ /// A that can be used to monitor the asynchronous operation.
///
- Task DeleteAsync([NotNull] object token, CancellationToken cancellationToken = default);
+ ValueTask DeleteAsync([NotNull] object token, CancellationToken cancellationToken = default);
///
/// Extends the specified token by replacing its expiration date.
@@ -77,9 +78,9 @@ namespace OpenIddict.Abstractions
/// The date on which the token will no longer be considered valid.
/// The that can be used to abort the operation.
///
- /// A that can be used to monitor the asynchronous operation.
+ /// A that can be used to monitor the asynchronous operation.
///
- Task ExtendAsync([NotNull] object token, [CanBeNull] DateTimeOffset? date, CancellationToken cancellationToken = default);
+ ValueTask ExtendAsync([NotNull] object token, [CanBeNull] DateTimeOffset? date, CancellationToken cancellationToken = default);
///
/// Retrieves the tokens corresponding to the specified
@@ -88,11 +89,8 @@ namespace OpenIddict.Abstractions
/// The subject associated with the token.
/// The client associated with the token.
/// The that can be used to abort the operation.
- ///
- /// A that can be used to monitor the asynchronous operation,
- /// whose result returns the tokens corresponding to the subject/client.
- ///
- Task> FindAsync([NotNull] string subject,
+ /// The tokens corresponding to the subject/client.
+ IAsyncEnumerable FindAsync([NotNull] string subject,
[NotNull] string client, CancellationToken cancellationToken = default);
///
@@ -102,11 +100,8 @@ namespace OpenIddict.Abstractions
/// The client associated with the token.
/// The token status.
/// The that can be used to abort the operation.
- ///
- /// A that can be used to monitor the asynchronous operation,
- /// whose result returns the tokens corresponding to the criteria.
- ///
- Task> FindAsync(
+ /// The tokens corresponding to the criteria.
+ IAsyncEnumerable FindAsync(
[NotNull] string subject, [NotNull] string client,
[NotNull] string status, CancellationToken cancellationToken = default);
@@ -118,11 +113,8 @@ namespace OpenIddict.Abstractions
/// The token status.
/// The token type.
/// The that can be used to abort the operation.
- ///
- /// A that can be used to monitor the asynchronous operation,
- /// whose result returns the tokens corresponding to the criteria.
- ///
- Task> FindAsync(
+ /// The tokens corresponding to the criteria.
+ IAsyncEnumerable FindAsync(
[NotNull] string subject, [NotNull] string client,
[NotNull] string status, [NotNull] string type, CancellationToken cancellationToken = default);
@@ -131,22 +123,16 @@ namespace OpenIddict.Abstractions
///
/// The application identifier associated with the tokens.
/// The that can be used to abort the operation.
- ///
- /// A that can be used to monitor the asynchronous operation,
- /// whose result returns the tokens corresponding to the specified application.
- ///
- Task> FindByApplicationIdAsync([NotNull] string identifier, CancellationToken cancellationToken = default);
+ /// The tokens corresponding to the specified application.
+ IAsyncEnumerable FindByApplicationIdAsync([NotNull] string identifier, CancellationToken cancellationToken = default);
///
/// Retrieves the list of tokens corresponding to the specified authorization identifier.
///
/// The authorization identifier associated with the tokens.
/// The that can be used to abort the operation.
- ///
- /// A that can be used to monitor the asynchronous operation,
- /// whose result returns the tokens corresponding to the specified authorization.
- ///
- Task> FindByAuthorizationIdAsync([NotNull] string identifier, CancellationToken cancellationToken = default);
+ /// The tokens corresponding to the specified authorization.
+ IAsyncEnumerable FindByAuthorizationIdAsync([NotNull] string identifier, CancellationToken cancellationToken = default);
///
/// Retrieves a token using its unique identifier.
@@ -154,10 +140,10 @@ namespace OpenIddict.Abstractions
/// The unique identifier associated with the token.
/// The that can be used to abort the operation.
///
- /// A that can be used to monitor the asynchronous operation,
+ /// A that can be used to monitor the asynchronous operation,
/// whose result returns the token corresponding to the unique identifier.
///
- Task FindByIdAsync([NotNull] string identifier, CancellationToken cancellationToken = default);
+ ValueTask FindByIdAsync([NotNull] string identifier, CancellationToken cancellationToken = default);
///
/// Retrieves the list of tokens corresponding to the specified reference identifier.
@@ -166,21 +152,18 @@ namespace OpenIddict.Abstractions
/// The reference identifier associated with the tokens.
/// The that can be used to abort the operation.
///
- /// A that can be used to monitor the asynchronous operation,
+ /// A that can be used to monitor the asynchronous operation,
/// whose result returns the tokens corresponding to the specified reference identifier.
///
- Task FindByReferenceIdAsync([NotNull] string identifier, CancellationToken cancellationToken = default);
+ ValueTask FindByReferenceIdAsync([NotNull] string identifier, CancellationToken cancellationToken = default);
///
/// Retrieves the list of tokens corresponding to the specified subject.
///
/// The subject associated with the tokens.
/// The that can be used to abort the operation.
- ///
- /// A that can be used to monitor the asynchronous operation,
- /// whose result returns the tokens corresponding to the specified subject.
- ///
- Task> FindBySubjectAsync([NotNull] string subject, CancellationToken cancellationToken = default);
+ /// The tokens corresponding to the specified subject.
+ IAsyncEnumerable FindBySubjectAsync([NotNull] string subject, CancellationToken cancellationToken = default);
///
/// Retrieves the optional application identifier associated with a token.
@@ -200,10 +183,10 @@ namespace OpenIddict.Abstractions
/// The query to execute.
/// The that can be used to abort the operation.
///
- /// A that can be used to monitor the asynchronous operation,
+ /// A that can be used to monitor the asynchronous operation,
/// whose result returns the first element returned when executing the query.
///
- Task GetAsync(
+ ValueTask GetAsync