Show / Hide Table of Contents

# Interface IOpenIddictScopeManager

Provides methods allowing to manage the scopes stored in the store. Note: this interface is not meant to be implemented by custom managers, that should inherit from the generic OpenIddictScopeManager class. It is primarily intended to be used by services that cannot easily depend on the generic scope manager. The actual scope entity type is automatically determined at runtime based on the OpenIddict core options.

###### Namespace: OpenIddict.Abstractions

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

##### Syntax

    public interface IOpenIddictScopeManager

### Methods

#### CountAsync(CancellationToken)

Determines the number of scopes that exist in the database.

##### Declaration

    ValueTask<long> CountAsync(CancellationToken cancellationToken = null)

##### 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<Object>, IQueryable<TResult>>, CancellationToken)

Determines the number of scopes that match the specified query.

##### Declaration

    ValueTask<long> CountAsync<TResult>(Func<IQueryable<object>, IQueryable<TResult>> query, CancellationToken cancellationToken = null)

##### Parameters

Type | Name | Description
--- | --- | ---
System.Func<IQueryable<System.Object>, 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(OpenIddictScopeDescriptor, CancellationToken)

Creates a new scope based on the specified descriptor.

##### Declaration

    ValueTask<object> CreateAsync(OpenIddictScopeDescriptor descriptor, CancellationToken cancellationToken = null)

##### Parameters

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

##### Returns

Type | Description
--- | ---
ValueTask<System.Object> | A that can be used to monitor the asynchronous operation, whose result returns the scope.

#### CreateAsync(Object, CancellationToken)

Creates a new scope.

##### Declaration

    ValueTask CreateAsync(object scope, CancellationToken cancellationToken = null)

##### Parameters

Type | Name | Description
--- | --- | ---
System.Object | 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(Object, CancellationToken)

Removes an existing scope.

##### Declaration

    ValueTask DeleteAsync(object scope, CancellationToken cancellationToken = null)

##### Parameters

Type | Name | Description
--- | --- | ---
System.Object | 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<object> FindByIdAsync(string identifier, CancellationToken cancellationToken = null)

##### 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<System.Object> | 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<object> FindByNameAsync(string name, CancellationToken cancellationToken = null)

##### 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<System.Object> | 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<object> FindByNamesAsync(ImmutableArray<string> names, CancellationToken cancellationToken = null)

##### 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<System.Object> | The scopes corresponding to the specified names.

#### FindByResourceAsync(String, CancellationToken)

Retrieves all the scopes that contain the specified resource.

##### Declaration

    IAsyncEnumerable<object> FindByResourceAsync(string resource, CancellationToken cancellationToken = null)

##### 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<System.Object> | The scopes associated with the specified resource.

#### GetAsync<TResult>(Func<IQueryable<Object>, IQueryable<TResult>>, CancellationToken)

Executes the specified query and returns the first element.

##### Declaration

    ValueTask<TResult> GetAsync<TResult>(Func<IQueryable<object>, IQueryable<TResult>> query, CancellationToken cancellationToken = null)

##### Parameters

Type | Name | Description
--- | --- | ---
System.Func<IQueryable<System.Object>, IQueryable<TResult>> | query | The query to execute.
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
--- | ---
TResult | The result type.

#### GetAsync<TState, TResult>(Func<IQueryable<Object>, TState, IQueryable<TResult>>, TState, CancellationToken)

Executes the specified query and returns the first element.

##### Declaration

    ValueTask<TResult> GetAsync<TState, TResult>(Func<IQueryable<object>, TState, IQueryable<TResult>> query, TState state, CancellationToken cancellationToken = null)

##### Parameters

Type | Name | Description
--- | --- | ---
System.Func<IQueryable<System.Object>, 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(Object, CancellationToken)

Retrieves the description associated with a scope.

##### Declaration

    ValueTask<string> GetDescriptionAsync(object scope, CancellationToken cancellationToken = null)

##### Parameters

Type | Name | Description
--- | --- | ---
System.Object | 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(Object, CancellationToken)

Retrieves the localized descriptions associated with an scope.

##### Declaration

    ValueTask<ImmutableDictionary<CultureInfo, string>> GetDescriptionsAsync(object scope, CancellationToken cancellationToken = null)

##### Parameters

Type | Name | Description
--- | --- | ---
System.Object | 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 scope.

#### GetDisplayNameAsync(Object, CancellationToken)

Retrieves the display name associated with a scope.

##### Declaration

    ValueTask<string> GetDisplayNameAsync(object scope, CancellationToken cancellationToken = null)

##### Parameters

Type | Name | Description
--- | --- | ---
System.Object | 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(Object, CancellationToken)

Retrieves the localized display names associated with an scope.

##### Declaration

    ValueTask<ImmutableDictionary<CultureInfo, string>> GetDisplayNamesAsync(object scope, CancellationToken cancellationToken = null)

##### Parameters

Type | Name | Description
--- | --- | ---
System.Object | 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(Object, CancellationToken)

Retrieves the unique identifier associated with a scope.

##### Declaration

    ValueTask<string> GetIdAsync(object scope, CancellationToken cancellationToken = null)

##### Parameters

Type | Name | Description
--- | --- | ---
System.Object | 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.

#### GetLocalizedDescriptionAsync(Object, CancellationToken)

Retrieves the localized description associated with an scope and corresponding to the current UI culture or one of its parents. If no matching value can be found, the non-localized value is returned.

##### Declaration

    ValueTask<string> GetLocalizedDescriptionAsync(object scope, CancellationToken cancellationToken = null)

##### Parameters

Type | Name | Description
--- | --- | ---
System.Object | 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 matching localized description associated with the scope.

#### GetLocalizedDescriptionAsync(Object, CultureInfo, CancellationToken)

Retrieves the localized description associated with an scope and corresponding to the specified culture or one of its parents. If no matching value can be found, the non-localized value is returned.

##### Declaration

    ValueTask<string> GetLocalizedDescriptionAsync(object scope, CultureInfo culture, CancellationToken cancellationToken = null)

##### Parameters

Type | Name | Description
--- | --- | ---
System.Object | scope | The scope.
CultureInfo | culture | The culture (typically ).
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 matching localized description associated with the scope.

#### GetLocalizedDisplayNameAsync(Object, CancellationToken)

Retrieves the localized display name associated with an scope and corresponding to the current UI culture or one of its parents. If no matching value can be found, the non-localized value is returned.

##### Declaration

    ValueTask<string> GetLocalizedDisplayNameAsync(object scope, CancellationToken cancellationToken = null)

##### Parameters

Type | Name | Description
--- | --- | ---
System.Object | 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.

#### GetLocalizedDisplayNameAsync(Object, CultureInfo, CancellationToken)

Retrieves the localized display name associated with an scope and corresponding to the specified culture or one of its parents. If no matching value can be found, the non-localized value is returned.

##### Declaration

    ValueTask<string> GetLocalizedDisplayNameAsync(object scope, CultureInfo culture, CancellationToken cancellationToken = null)

##### Parameters

Type | Name | Description
--- | --- | ---
System.Object | scope | The scope.
CultureInfo | culture | The culture (typically ).
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.

#### GetNameAsync(Object, CancellationToken)

Retrieves the name associated with a scope.

##### Declaration

    ValueTask<string> GetNameAsync(object scope, CancellationToken cancellationToken = null)

##### Parameters

Type | Name | Description
--- | --- | ---
System.Object | 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(Object, CancellationToken)

Retrieves the additional properties associated with a scope.

##### Declaration

    ValueTask<ImmutableDictionary<string, JsonElement>> GetPropertiesAsync(object scope, CancellationToken cancellationToken = null)

##### Parameters

Type | Name | Description
--- | --- | ---
System.Object | 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(Object, CancellationToken)

Retrieves the resources associated with a scope.

##### Declaration

    ValueTask<ImmutableArray<string>> GetResourcesAsync(object scope, CancellationToken cancellationToken = null)

##### Parameters

Type | Name | Description
--- | --- | ---
System.Object | 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.

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

Executes the specified query and returns all the corresponding elements.

##### Declaration

    IAsyncEnumerable<object> ListAsync(int? count = default(int? ), int? offset = default(int? ), CancellationToken cancellationToken = null)

##### 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<System.Object> | All the elements returned when executing the specified query.

#### ListAsync<TResult>(Func<IQueryable<Object>, IQueryable<TResult>>, CancellationToken)

Executes the specified query and returns all the corresponding elements.

##### Declaration

    IAsyncEnumerable<TResult> ListAsync<TResult>(Func<IQueryable<object>, IQueryable<TResult>> query, CancellationToken cancellationToken = null)

##### Parameters

Type | Name | Description
--- | --- | ---
System.Func<IQueryable<System.Object>, IQueryable<TResult>> | query | The query to execute.
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
--- | ---
TResult | The result type.

#### ListAsync<TState, TResult>(Func<IQueryable<Object>, TState, IQueryable<TResult>>, TState, CancellationToken)

Executes the specified query and returns all the corresponding elements.

##### Declaration

    IAsyncEnumerable<TResult> ListAsync<TState, TResult>(Func<IQueryable<object>, TState, IQueryable<TResult>> query, TState state, CancellationToken cancellationToken = null)

##### Parameters

Type | Name | Description
--- | --- | ---
System.Func<IQueryable<System.Object>, 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.

#### ListResourcesAsync(ImmutableArray<String>, CancellationToken)

Lists all the resources associated with the specified scopes.

##### Declaration

    IAsyncEnumerable<string> ListResourcesAsync(ImmutableArray<string> scopes, CancellationToken cancellationToken = null)

##### Parameters

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

##### Returns

Type | Description
--- | ---
IAsyncEnumerable<System.String> | All the resources associated with the specified scopes.

#### PopulateAsync(OpenIddictScopeDescriptor, Object, CancellationToken)

Populates the specified descriptor using the properties exposed by the scope.

##### Declaration

    ValueTask PopulateAsync(OpenIddictScopeDescriptor descriptor, object scope, CancellationToken cancellationToken = null)

##### Parameters

Type | Name | Description
--- | --- | ---
OpenIddictScopeDescriptor | descriptor | The descriptor.
System.Object | scope | 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.

#### PopulateAsync(Object, OpenIddictScopeDescriptor, CancellationToken)

Populates the scope using the specified descriptor.

##### Declaration

    ValueTask PopulateAsync(object scope, OpenIddictScopeDescriptor descriptor, CancellationToken cancellationToken = null)

##### Parameters

Type | Name | Description
--- | --- | ---
System.Object | scope | The scope.
OpenIddictScopeDescriptor | descriptor | The descriptor.
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(Object, CancellationToken)

Updates an existing scope.

##### Declaration

    ValueTask UpdateAsync(object scope, CancellationToken cancellationToken = null)

##### Parameters

Type | Name | Description
--- | --- | ---
System.Object | 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.

#### UpdateAsync(Object, OpenIddictScopeDescriptor, CancellationToken)

Updates an existing scope.

##### Declaration

    ValueTask UpdateAsync(object scope, OpenIddictScopeDescriptor descriptor, CancellationToken cancellationToken = null)

##### Parameters

Type | Name | Description
--- | --- | ---
System.Object | scope | The scope to update.
OpenIddictScopeDescriptor | descriptor | The descriptor used to update 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.

#### ValidateAsync(Object, CancellationToken)

Validates the scope to ensure it's in a consistent state.

##### Declaration

    IAsyncEnumerable<ValidationResult> ValidateAsync(object scope, CancellationToken cancellationToken = null)

##### Parameters

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

##### Returns

Type | Description
--- | ---
IAsyncEnumerable<ValidationResult> | The validation error encountered when validating the scope.