Show / Hide Table of Contents

# Interface IOpenIddictScopeStore<TScope>

Provides methods allowing to manage the scopes stored in a database.

###### Namespace: OpenIddict.Abstractions

###### Assembly: cs.temp.dll.dll

##### Syntax

    public interface IOpenIddictScopeStore<TScope>
        where TScope : class

##### Type Parameters

Name | Description
--- | ---
TScope | The type of the Scope entity.

### Methods

#### CountAsync(CancellationToken)

Determines the number of scopes that exist in the database.

##### Declaration

    ValueTask<long> CountAsync(CancellationToken cancellationToken)

##### Parameters

Type | Name | Description
--- | --- | ---
CancellationToken | cancellationToken | The that can be used to abort the operation.

##### Returns

Type | Description
--- | ---
ValueTask<System.Int64> | A 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.

##### Declaration

    ValueTask<long> CountAsync<TResult>(Func<IQueryable<TScope>, IQueryable<TResult>> query, CancellationToken cancellationToken)

##### Parameters

Type | Name | Description
--- | --- | ---
System.Func<IQueryable<TScope>, IQueryable<TResult>> | query | The query to execute.
CancellationToken | cancellationToken | The that can be used to abort the operation.

##### Returns

Type | Description
--- | ---
ValueTask<System.Int64> | A that can be used to monitor the asynchronous operation, whose result returns the number of scopes that match the specified query.

##### Type Parameters

Name | Description
--- | ---
TResult | The result type.

#### CreateAsync(TScope, CancellationToken)

Creates a new scope.

##### Declaration

    ValueTask CreateAsync(TScope scope, CancellationToken cancellationToken)

##### Parameters

Type | Name | Description
--- | --- | ---
TScope | scope | The scope to create.
CancellationToken | cancellationToken | The that can be used to abort the operation.

##### Returns

Type | Description
--- | ---
ValueTask | A that can be used to monitor the asynchronous operation.

#### DeleteAsync(TScope, CancellationToken)

Removes an existing scope.

##### Declaration

    ValueTask DeleteAsync(TScope scope, CancellationToken cancellationToken)

##### Parameters

Type | Name | Description
--- | --- | ---
TScope | scope | The scope to delete.
CancellationToken | cancellationToken | The that can be used to abort the operation.

##### Returns

Type | Description
--- | ---
ValueTask | A that can be used to monitor the asynchronous operation.

#### FindByIdAsync(String, CancellationToken)

Retrieves a scope using its unique identifier.

##### Declaration

    ValueTask<TScope> FindByIdAsync(string identifier, CancellationToken cancellationToken)

##### Parameters

Type | Name | Description
--- | --- | ---
System.String | identifier | The unique identifier associated with the scope.
CancellationToken | cancellationToken | The that can be used to abort the operation.

##### Returns

Type | Description
--- | ---
ValueTask<TScope> | A 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.

##### Declaration

    ValueTask<TScope> FindByNameAsync(string name, CancellationToken cancellationToken)

##### Parameters

Type | Name | Description
--- | --- | ---
System.String | name | The name associated with the scope.
CancellationToken | cancellationToken | The that can be used to abort the operation.

##### Returns

Type | Description
--- | ---
ValueTask<TScope> | A 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.

##### Declaration

    IAsyncEnumerable<TScope> FindByNamesAsync(ImmutableArray<string> names, CancellationToken cancellationToken)

##### Parameters

Type | Name | Description
--- | --- | ---
ImmutableArray<System.String> | names | The names associated with the scopes.
CancellationToken | cancellationToken | The that can be used to abort the operation.

##### Returns

Type | Description
--- | ---
IAsyncEnumerable<TScope> | The scopes corresponding to the specified names.

#### FindByResourceAsync(String, CancellationToken)

Retrieves all the scopes that contain the specified resource.

##### Declaration

    IAsyncEnumerable<TScope> FindByResourceAsync(string resource, CancellationToken cancellationToken)

##### Parameters

Type | Name | Description
--- | --- | ---
System.String | resource | The resource associated with the scopes.
CancellationToken | cancellationToken | The that can be used to abort the operation.

##### Returns

Type | Description
--- | ---
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.

##### Declaration

    ValueTask<TResult> GetAsync<TState, TResult>(Func<IQueryable<TScope>, TState, IQueryable<TResult>> query, TState state, CancellationToken cancellationToken)

##### Parameters

Type | Name | Description
--- | --- | ---
System.Func<IQueryable<TScope>, TState, IQueryable<TResult>> | query | The query to execute.
TState | state | The optional state.
CancellationToken | cancellationToken | The that can be used to abort the operation.

##### Returns

Type | Description
--- | ---
ValueTask<TResult> | A that can be used to monitor the asynchronous operation, whose result returns the first element returned when executing the query.

##### Type Parameters

Name | Description
--- | ---
TState | The state type.
TResult | The result type.

#### GetDescriptionAsync(TScope, CancellationToken)

Retrieves the description associated with a scope.

##### Declaration

    ValueTask<string> GetDescriptionAsync(TScope scope, CancellationToken cancellationToken)

##### Parameters

Type | Name | Description
--- | --- | ---
TScope | scope | The scope.
CancellationToken | cancellationToken | The that can be used to abort the operation.

##### Returns

Type | Description
--- | ---
ValueTask<System.String> | A 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.

##### Declaration

    ValueTask<ImmutableDictionary<CultureInfo, string>> GetDescriptionsAsync(TScope scope, CancellationToken cancellationToken)

##### Parameters

Type | Name | Description
--- | --- | ---
TScope | scope | The scope.
CancellationToken | cancellationToken | The that can be used to abort the operation.

##### Returns

Type | Description
--- | ---
ValueTask<ImmutableDictionary<CultureInfo, System.String>> | A 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.

##### Declaration

    ValueTask<string> GetDisplayNameAsync(TScope scope, CancellationToken cancellationToken)

##### Parameters

Type | Name | Description
--- | --- | ---
TScope | scope | The scope.
CancellationToken | cancellationToken | The that can be used to abort the operation.

##### Returns

Type | Description
--- | ---
ValueTask<System.String> | A 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.

##### Declaration

    ValueTask<ImmutableDictionary<CultureInfo, string>> GetDisplayNamesAsync(TScope scope, CancellationToken cancellationToken)

##### Parameters

Type | Name | Description
--- | --- | ---
TScope | scope | The scope.
CancellationToken | cancellationToken | The that can be used to abort the operation.

##### Returns

Type | Description
--- | ---
ValueTask<ImmutableDictionary<CultureInfo, System.String>> | A 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.

##### Declaration

    ValueTask<string> GetIdAsync(TScope scope, CancellationToken cancellationToken)

##### Parameters

Type | Name | Description
--- | --- | ---
TScope | scope | The scope.
CancellationToken | cancellationToken | The that can be used to abort the operation.

##### Returns

Type | Description
--- | ---
ValueTask<System.String> | A 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.

##### Declaration

    ValueTask<string> GetNameAsync(TScope scope, CancellationToken cancellationToken)

##### Parameters

Type | Name | Description
--- | --- | ---
TScope | scope | The scope.
CancellationToken | cancellationToken | The that can be used to abort the operation.

##### Returns

Type | Description
--- | ---
ValueTask<System.String> | A 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.

##### Declaration

    ValueTask<ImmutableDictionary<string, JsonElement>> GetPropertiesAsync(TScope scope, CancellationToken cancellationToken)

##### Parameters

Type | Name | Description
--- | --- | ---
TScope | scope | The scope.
CancellationToken | cancellationToken | The that can be used to abort the operation.

##### Returns

Type | Description
--- | ---
ValueTask<ImmutableDictionary<System.String, JsonElement>> | A 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.

##### Declaration

    ValueTask<ImmutableArray<string>> GetResourcesAsync(TScope scope, CancellationToken cancellationToken)

##### Parameters

Type | Name | Description
--- | --- | ---
TScope | scope | The scope.
CancellationToken | cancellationToken | The that can be used to abort the operation.

##### Returns

Type | Description
--- | ---
ValueTask<ImmutableArray<System.String>> | A 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.

##### Declaration

    ValueTask<TScope> InstantiateAsync(CancellationToken cancellationToken)

##### Parameters

Type | Name | Description
--- | --- | ---
CancellationToken | cancellationToken | The that can be used to abort the operation.

##### Returns

Type | Description
--- | ---
ValueTask<TScope> | A that can be used to monitor the asynchronous operation, whose result returns the instantiated scope, that can be persisted in the database.

#### ListAsync(Nullable<Int32>, Nullable<Int32>, CancellationToken)

Executes the specified query and returns all the corresponding elements.

##### Declaration

    IAsyncEnumerable<TScope> ListAsync(int? count, int? offset, CancellationToken cancellationToken)

##### Parameters

Type | Name | Description
--- | --- | ---
System.Nullable<System.Int32> | count | The number of results to return.
System.Nullable<System.Int32> | offset | The number of results to skip.
CancellationToken | cancellationToken | The that can be used to abort the operation.

##### Returns

Type | Description
--- | ---
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.

##### Declaration

    IAsyncEnumerable<TResult> ListAsync<TState, TResult>(Func<IQueryable<TScope>, TState, IQueryable<TResult>> query, TState state, CancellationToken cancellationToken)

##### Parameters

Type | Name | Description
--- | --- | ---
System.Func<IQueryable<TScope>, TState, IQueryable<TResult>> | query | The query to execute.
TState | state | The optional state.
CancellationToken | cancellationToken | The that can be used to abort the operation.

##### Returns

Type | Description
--- | ---
IAsyncEnumerable<TResult> | All the elements returned when executing the specified query.

##### Type Parameters

Name | Description
--- | ---
TState | The state type.
TResult | The result type.

#### SetDescriptionAsync(TScope, String, CancellationToken)

Sets the description associated with a scope.

##### Declaration

    ValueTask SetDescriptionAsync(TScope scope, string description, CancellationToken cancellationToken)

##### Parameters

Type | Name | Description
--- | --- | ---
TScope | scope | The scope.
System.String | description | The description associated with the authorization.
CancellationToken | cancellationToken | The that can be used to abort the operation.

##### Returns

Type | Description
--- | ---
ValueTask | A that can be used to monitor the asynchronous operation.

#### SetDescriptionsAsync(TScope, ImmutableDictionary<CultureInfo, String>, CancellationToken)

Sets the localized descriptions associated with a scope.

##### Declaration

    ValueTask SetDescriptionsAsync(TScope scope, ImmutableDictionary<CultureInfo, string> descriptions, CancellationToken cancellationToken)

##### Parameters

Type | Name | Description
--- | --- | ---
TScope | scope | The scope.
ImmutableDictionary<CultureInfo, System.String> | descriptions | The localized descriptions associated with the authorization.
CancellationToken | cancellationToken | The that can be used to abort the operation.

##### Returns

Type | Description
--- | ---
ValueTask | A that can be used to monitor the asynchronous operation.

#### SetDisplayNameAsync(TScope, String, CancellationToken)

Sets the display name associated with a scope.

##### Declaration

    ValueTask SetDisplayNameAsync(TScope scope, string name, CancellationToken cancellationToken)

##### Parameters

Type | Name | Description
--- | --- | ---
TScope | scope | The scope.
System.String | name | The display name associated with the scope.
CancellationToken | cancellationToken | The that can be used to abort the operation.

##### Returns

Type | Description
--- | ---
ValueTask | A that can be used to monitor the asynchronous operation.

#### SetDisplayNamesAsync(TScope, ImmutableDictionary<CultureInfo, String>, CancellationToken)

Sets the localized display names associated with a scope.

##### Declaration

    ValueTask SetDisplayNamesAsync(TScope scope, ImmutableDictionary<CultureInfo, string> names, CancellationToken cancellationToken)

##### Parameters

Type | Name | Description
--- | --- | ---
TScope | scope | The scope.
ImmutableDictionary<CultureInfo, System.String> | names | The localized display names associated with the scope.
CancellationToken | cancellationToken | The that can be used to abort the operation.

##### Returns

Type | Description
--- | ---
ValueTask | A that can be used to monitor the asynchronous operation.

#### SetNameAsync(TScope, String, CancellationToken)

Sets the name associated with a scope.

##### Declaration

    ValueTask SetNameAsync(TScope scope, string name, CancellationToken cancellationToken)

##### Parameters

Type | Name | Description
--- | --- | ---
TScope | scope | The scope.
System.String | name | The name associated with the authorization.
CancellationToken | cancellationToken | The that can be used to abort the operation.

##### Returns

Type | Description
--- | ---
ValueTask | A that can be used to monitor the asynchronous operation.

#### SetPropertiesAsync(TScope, ImmutableDictionary<String, JsonElement>, CancellationToken)

Sets the additional properties associated with a scope.

##### Declaration

    ValueTask SetPropertiesAsync(TScope scope, ImmutableDictionary<string, JsonElement> properties, CancellationToken cancellationToken)

##### Parameters

Type | Name | Description
--- | --- | ---
TScope | scope | The scope.
ImmutableDictionary<System.String, JsonElement> | properties | The additional properties associated with the scope.
CancellationToken | cancellationToken | The that can be used to abort the operation.

##### Returns

Type | Description
--- | ---
ValueTask | A that can be used to monitor the asynchronous operation.

#### SetResourcesAsync(TScope, ImmutableArray<String>, CancellationToken)

Sets the resources associated with a scope.

##### Declaration

    ValueTask SetResourcesAsync(TScope scope, ImmutableArray<string> resources, CancellationToken cancellationToken)

##### Parameters

Type | Name | Description
--- | --- | ---
TScope | scope | The scope.
ImmutableArray<System.String> | resources | The resources associated with the scope.
CancellationToken | cancellationToken | The that can be used to abort the operation.

##### Returns

Type | Description
--- | ---
ValueTask | A that can be used to monitor the asynchronous operation.

#### UpdateAsync(TScope, CancellationToken)

Updates an existing scope.

##### Declaration

    ValueTask UpdateAsync(TScope scope, CancellationToken cancellationToken)

##### Parameters

Type | Name | Description
--- | --- | ---
TScope | scope | The scope to update.
CancellationToken | cancellationToken | The that can be used to abort the operation.

##### Returns

Type | Description
--- | ---
ValueTask | A that can be used to monitor the asynchronous operation.