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
TScopeThe type of the Scope entity.
Methods
CountAsync(CancellationToken)
Determines the number of scopes that exist in the database.
ValueTask<long> CountAsync(CancellationToken cancellationToken)
Parameters
cancellationTokenCancellationTokenThe 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
queryFunc<IQueryable<TScope>, IQueryable<TResult>>The query to execute.
cancellationTokenCancellationTokenThe 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
TResultThe result type.
CreateAsync(TScope, CancellationToken)
Creates a new scope.
ValueTask CreateAsync(TScope scope, CancellationToken cancellationToken)
Parameters
scopeTScopeThe scope to create.
cancellationTokenCancellationTokenThe CancellationToken that can be used to abort the operation.
Returns
DeleteAsync(TScope, CancellationToken)
Removes an existing scope.
ValueTask DeleteAsync(TScope scope, CancellationToken cancellationToken)
Parameters
scopeTScopeThe scope to delete.
cancellationTokenCancellationTokenThe 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
identifierstringThe unique identifier associated with the scope.
cancellationTokenCancellationTokenThe 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
namestringThe name associated with the scope.
cancellationTokenCancellationTokenThe 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
namesImmutableArray<string>The names associated with the scopes.
cancellationTokenCancellationTokenThe 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
resourcestringThe resource associated with the scopes.
cancellationTokenCancellationTokenThe 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
queryFunc<IQueryable<TScope>, TState, IQueryable<TResult>>The query to execute.
stateTStateThe optional state.
cancellationTokenCancellationTokenThe 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
TStateThe state type.
TResultThe result type.
GetDescriptionAsync(TScope, CancellationToken)
Retrieves the description associated with a scope.
ValueTask<string?> GetDescriptionAsync(TScope scope, CancellationToken cancellationToken)
Parameters
scopeTScopeThe scope.
cancellationTokenCancellationTokenThe 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
scopeTScopeThe scope.
cancellationTokenCancellationTokenThe 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
scopeTScopeThe scope.
cancellationTokenCancellationTokenThe 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
scopeTScopeThe scope.
cancellationTokenCancellationTokenThe 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
scopeTScopeThe scope.
cancellationTokenCancellationTokenThe 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
scopeTScopeThe scope.
cancellationTokenCancellationTokenThe 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
scopeTScopeThe scope.
cancellationTokenCancellationTokenThe 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
scopeTScopeThe scope.
cancellationTokenCancellationTokenThe 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
cancellationTokenCancellationTokenThe 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
countint?The number of results to return.
offsetint?The number of results to skip.
cancellationTokenCancellationTokenThe 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
queryFunc<IQueryable<TScope>, TState, IQueryable<TResult>>The query to execute.
stateTStateThe optional state.
cancellationTokenCancellationTokenThe CancellationToken that can be used to abort the operation.
Returns
- IAsyncEnumerable<TResult>
All the elements returned when executing the specified query.
Type Parameters
TStateThe state type.
TResultThe result type.
SetDescriptionAsync(TScope, string?, CancellationToken)
Sets the description associated with a scope.
ValueTask SetDescriptionAsync(TScope scope, string? description, CancellationToken cancellationToken)
Parameters
scopeTScopeThe scope.
descriptionstringThe description associated with the authorization.
cancellationTokenCancellationTokenThe 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
scopeTScopeThe scope.
descriptionsImmutableDictionary<CultureInfo, string>The localized descriptions associated with the authorization.
cancellationTokenCancellationTokenThe 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
scopeTScopeThe scope.
namestringThe display name associated with the scope.
cancellationTokenCancellationTokenThe 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
scopeTScopeThe scope.
namesImmutableDictionary<CultureInfo, string>The localized display names associated with the scope.
cancellationTokenCancellationTokenThe 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
scopeTScopeThe scope.
namestringThe name associated with the authorization.
cancellationTokenCancellationTokenThe 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
scopeTScopeThe scope.
propertiesImmutableDictionary<string, JsonElement>The additional properties associated with the scope.
cancellationTokenCancellationTokenThe 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
scopeTScopeThe scope.
resourcesImmutableArray<string>The resources associated with the scope.
cancellationTokenCancellationTokenThe CancellationToken that can be used to abort the operation.
Returns
UpdateAsync(TScope, CancellationToken)
Updates an existing scope.
ValueTask UpdateAsync(TScope scope, CancellationToken cancellationToken)
Parameters
scopeTScopeThe scope to update.
cancellationTokenCancellationTokenThe CancellationToken that can be used to abort the operation.