Interface IOpenIddictScopeStore<TScope>
- Namespace
- OpenIddict.Abstractions
- Assembly
- OpenIddict.Abstractions.dll
Provides methods allowing to manage the scopes stored in a database.
public interface IOpenIddictScopeStore<TScope> where TScope : class
Type Parameters
TScope
The type of the Scope entity.
Methods
CountAsync(CancellationToken)
Determines the number of scopes that exist in the database.
ValueTask<long> CountAsync(CancellationToken cancellationToken)
Parameters
cancellationToken
CancellationTokenThe CancellationToken that can be used to abort the operation.
Returns
- ValueTask<long>
A ValueTask that can be used to monitor the asynchronous operation, whose result returns the number of scopes in the database.
CountAsync<TResult>(Func<IQueryable<TScope>, IQueryable<TResult>>, CancellationToken)
Determines the number of scopes that match the specified query.
ValueTask<long> CountAsync<TResult>(Func<IQueryable<TScope>, IQueryable<TResult>> query, CancellationToken cancellationToken)
Parameters
query
Func<IQueryable<TScope>, IQueryable<TResult>>The query to execute.
cancellationToken
CancellationTokenThe CancellationToken that can be used to abort the operation.
Returns
- ValueTask<long>
A ValueTask that can be used to monitor the asynchronous operation, whose result returns the number of scopes that match the specified query.
Type Parameters
TResult
The result type.
CreateAsync(TScope, CancellationToken)
Creates a new scope.
ValueTask CreateAsync(TScope scope, CancellationToken cancellationToken)
Parameters
scope
TScopeThe scope to create.
cancellationToken
CancellationTokenThe CancellationToken that can be used to abort the operation.
Returns
DeleteAsync(TScope, CancellationToken)
Removes an existing scope.
ValueTask DeleteAsync(TScope scope, CancellationToken cancellationToken)
Parameters
scope
TScopeThe scope to delete.
cancellationToken
CancellationTokenThe CancellationToken that can be used to abort the operation.
Returns
FindByIdAsync(string, CancellationToken)
Retrieves a scope using its unique identifier.
ValueTask<TScope?> FindByIdAsync(string identifier, CancellationToken cancellationToken)
Parameters
identifier
stringThe unique identifier associated with the scope.
cancellationToken
CancellationTokenThe CancellationToken that can be used to abort the operation.
Returns
- ValueTask<TScope>
A ValueTask that can be used to monitor the asynchronous operation, whose result returns the scope corresponding to the identifier.
FindByNameAsync(string, CancellationToken)
Retrieves a scope using its name.
ValueTask<TScope?> FindByNameAsync(string name, CancellationToken cancellationToken)
Parameters
name
stringThe name associated with the scope.
cancellationToken
CancellationTokenThe CancellationToken that can be used to abort the operation.
Returns
- ValueTask<TScope>
A ValueTask that can be used to monitor the asynchronous operation, whose result returns the scope corresponding to the specified name.
FindByNamesAsync(ImmutableArray<string>, CancellationToken)
Retrieves a list of scopes using their name.
IAsyncEnumerable<TScope> FindByNamesAsync(ImmutableArray<string> names, CancellationToken cancellationToken)
Parameters
names
ImmutableArray<string>The names associated with the scopes.
cancellationToken
CancellationTokenThe CancellationToken that can be used to abort the operation.
Returns
- IAsyncEnumerable<TScope>
The scopes corresponding to the specified names.
FindByResourceAsync(string, CancellationToken)
Retrieves all the scopes that contain the specified resource.
IAsyncEnumerable<TScope> FindByResourceAsync(string resource, CancellationToken cancellationToken)
Parameters
resource
stringThe resource associated with the scopes.
cancellationToken
CancellationTokenThe CancellationToken that can be used to abort the operation.
Returns
- IAsyncEnumerable<TScope>
The scopes associated with the specified resource.
GetAsync<TState, TResult>(Func<IQueryable<TScope>, TState, IQueryable<TResult>>, TState, CancellationToken)
Executes the specified query and returns the first element.
ValueTask<TResult?> GetAsync<TState, TResult>(Func<IQueryable<TScope>, TState, IQueryable<TResult>> query, TState state, CancellationToken cancellationToken)
Parameters
query
Func<IQueryable<TScope>, TState, IQueryable<TResult>>The query to execute.
state
TStateThe optional state.
cancellationToken
CancellationTokenThe CancellationToken that can be used to abort the operation.
Returns
- ValueTask<TResult>
A ValueTask that can be used to monitor the asynchronous operation, whose result returns the first element returned when executing the query.
Type Parameters
TState
The state type.
TResult
The result type.
GetDescriptionAsync(TScope, CancellationToken)
Retrieves the description associated with a scope.
ValueTask<string?> GetDescriptionAsync(TScope scope, CancellationToken cancellationToken)
Parameters
scope
TScopeThe scope.
cancellationToken
CancellationTokenThe CancellationToken that can be used to abort the operation.
Returns
- ValueTask<string>
A ValueTask<TResult> that can be used to monitor the asynchronous operation, whose result returns the description associated with the specified scope.
GetDescriptionsAsync(TScope, CancellationToken)
Retrieves the localized descriptions associated with a scope.
ValueTask<ImmutableDictionary<CultureInfo, string>> GetDescriptionsAsync(TScope scope, CancellationToken cancellationToken)
Parameters
scope
TScopeThe scope.
cancellationToken
CancellationTokenThe CancellationToken that can be used to abort the operation.
Returns
- ValueTask<ImmutableDictionary<CultureInfo, string>>
A ValueTask<TResult> that can be used to monitor the asynchronous operation, whose result returns all the localized descriptions associated with the specified scope.
GetDisplayNameAsync(TScope, CancellationToken)
Retrieves the display name associated with a scope.
ValueTask<string?> GetDisplayNameAsync(TScope scope, CancellationToken cancellationToken)
Parameters
scope
TScopeThe scope.
cancellationToken
CancellationTokenThe CancellationToken that can be used to abort the operation.
Returns
- ValueTask<string>
A ValueTask<TResult> that can be used to monitor the asynchronous operation, whose result returns the display name associated with the scope.
GetDisplayNamesAsync(TScope, CancellationToken)
Retrieves the localized display names associated with a scope.
ValueTask<ImmutableDictionary<CultureInfo, string>> GetDisplayNamesAsync(TScope scope, CancellationToken cancellationToken)
Parameters
scope
TScopeThe scope.
cancellationToken
CancellationTokenThe CancellationToken that can be used to abort the operation.
Returns
- ValueTask<ImmutableDictionary<CultureInfo, string>>
A ValueTask<TResult> that can be used to monitor the asynchronous operation, whose result returns all the localized display names associated with the scope.
GetIdAsync(TScope, CancellationToken)
Retrieves the unique identifier associated with a scope.
ValueTask<string?> GetIdAsync(TScope scope, CancellationToken cancellationToken)
Parameters
scope
TScopeThe scope.
cancellationToken
CancellationTokenThe CancellationToken that can be used to abort the operation.
Returns
- ValueTask<string>
A ValueTask<TResult> that can be used to monitor the asynchronous operation, whose result returns the unique identifier associated with the scope.
GetNameAsync(TScope, CancellationToken)
Retrieves the name associated with a scope.
ValueTask<string?> GetNameAsync(TScope scope, CancellationToken cancellationToken)
Parameters
scope
TScopeThe scope.
cancellationToken
CancellationTokenThe CancellationToken that can be used to abort the operation.
Returns
- ValueTask<string>
A ValueTask<TResult> that can be used to monitor the asynchronous operation, whose result returns the name associated with the specified scope.
GetPropertiesAsync(TScope, CancellationToken)
Retrieves the additional properties associated with a scope.
ValueTask<ImmutableDictionary<string, JsonElement>> GetPropertiesAsync(TScope scope, CancellationToken cancellationToken)
Parameters
scope
TScopeThe scope.
cancellationToken
CancellationTokenThe CancellationToken that can be used to abort the operation.
Returns
- ValueTask<ImmutableDictionary<string, JsonElement>>
A ValueTask<TResult> that can be used to monitor the asynchronous operation, whose result returns all the additional properties associated with the scope.
GetResourcesAsync(TScope, CancellationToken)
Retrieves the resources associated with a scope.
ValueTask<ImmutableArray<string>> GetResourcesAsync(TScope scope, CancellationToken cancellationToken)
Parameters
scope
TScopeThe scope.
cancellationToken
CancellationTokenThe CancellationToken that can be used to abort the operation.
Returns
- ValueTask<ImmutableArray<string>>
A ValueTask<TResult> that can be used to monitor the asynchronous operation, whose result returns all the resources associated with the scope.
InstantiateAsync(CancellationToken)
Instantiates a new scope.
ValueTask<TScope> InstantiateAsync(CancellationToken cancellationToken)
Parameters
cancellationToken
CancellationTokenThe CancellationToken that can be used to abort the operation.
Returns
- ValueTask<TScope>
A ValueTask<TResult> that can be used to monitor the asynchronous operation, whose result returns the instantiated scope, that can be persisted in the database.
ListAsync(int?, int?, CancellationToken)
Executes the specified query and returns all the corresponding elements.
IAsyncEnumerable<TScope> ListAsync(int? count, int? offset, CancellationToken cancellationToken)
Parameters
count
int?The number of results to return.
offset
int?The number of results to skip.
cancellationToken
CancellationTokenThe CancellationToken that can be used to abort the operation.
Returns
- IAsyncEnumerable<TScope>
All the elements returned when executing the specified query.
ListAsync<TState, TResult>(Func<IQueryable<TScope>, TState, IQueryable<TResult>>, TState, CancellationToken)
Executes the specified query and returns all the corresponding elements.
IAsyncEnumerable<TResult> ListAsync<TState, TResult>(Func<IQueryable<TScope>, TState, IQueryable<TResult>> query, TState state, CancellationToken cancellationToken)
Parameters
query
Func<IQueryable<TScope>, TState, IQueryable<TResult>>The query to execute.
state
TStateThe optional state.
cancellationToken
CancellationTokenThe CancellationToken that can be used to abort the operation.
Returns
- IAsyncEnumerable<TResult>
All the elements returned when executing the specified query.
Type Parameters
TState
The state type.
TResult
The result type.
SetDescriptionAsync(TScope, string?, CancellationToken)
Sets the description associated with a scope.
ValueTask SetDescriptionAsync(TScope scope, string? description, CancellationToken cancellationToken)
Parameters
scope
TScopeThe scope.
description
stringThe description associated with the authorization.
cancellationToken
CancellationTokenThe CancellationToken that can be used to abort the operation.
Returns
SetDescriptionsAsync(TScope, ImmutableDictionary<CultureInfo, string>, CancellationToken)
Sets the localized descriptions associated with a scope.
ValueTask SetDescriptionsAsync(TScope scope, ImmutableDictionary<CultureInfo, string> descriptions, CancellationToken cancellationToken)
Parameters
scope
TScopeThe scope.
descriptions
ImmutableDictionary<CultureInfo, string>The localized descriptions associated with the authorization.
cancellationToken
CancellationTokenThe CancellationToken that can be used to abort the operation.
Returns
SetDisplayNameAsync(TScope, string?, CancellationToken)
Sets the display name associated with a scope.
ValueTask SetDisplayNameAsync(TScope scope, string? name, CancellationToken cancellationToken)
Parameters
scope
TScopeThe scope.
name
stringThe display name associated with the scope.
cancellationToken
CancellationTokenThe CancellationToken that can be used to abort the operation.
Returns
SetDisplayNamesAsync(TScope, ImmutableDictionary<CultureInfo, string>, CancellationToken)
Sets the localized display names associated with a scope.
ValueTask SetDisplayNamesAsync(TScope scope, ImmutableDictionary<CultureInfo, string> names, CancellationToken cancellationToken)
Parameters
scope
TScopeThe scope.
names
ImmutableDictionary<CultureInfo, string>The localized display names associated with the scope.
cancellationToken
CancellationTokenThe CancellationToken that can be used to abort the operation.
Returns
SetNameAsync(TScope, string?, CancellationToken)
Sets the name associated with a scope.
ValueTask SetNameAsync(TScope scope, string? name, CancellationToken cancellationToken)
Parameters
scope
TScopeThe scope.
name
stringThe name associated with the authorization.
cancellationToken
CancellationTokenThe CancellationToken that can be used to abort the operation.
Returns
SetPropertiesAsync(TScope, ImmutableDictionary<string, JsonElement>, CancellationToken)
Sets the additional properties associated with a scope.
ValueTask SetPropertiesAsync(TScope scope, ImmutableDictionary<string, JsonElement> properties, CancellationToken cancellationToken)
Parameters
scope
TScopeThe scope.
properties
ImmutableDictionary<string, JsonElement>The additional properties associated with the scope.
cancellationToken
CancellationTokenThe CancellationToken that can be used to abort the operation.
Returns
SetResourcesAsync(TScope, ImmutableArray<string>, CancellationToken)
Sets the resources associated with a scope.
ValueTask SetResourcesAsync(TScope scope, ImmutableArray<string> resources, CancellationToken cancellationToken)
Parameters
scope
TScopeThe scope.
resources
ImmutableArray<string>The resources associated with the scope.
cancellationToken
CancellationTokenThe CancellationToken that can be used to abort the operation.
Returns
UpdateAsync(TScope, CancellationToken)
Updates an existing scope.
ValueTask UpdateAsync(TScope scope, CancellationToken cancellationToken)
Parameters
scope
TScopeThe scope to update.
cancellationToken
CancellationTokenThe CancellationToken that can be used to abort the operation.