Class OpenIddictScopeManager<TScope>
Provides methods allowing to manage the scopes stored in the store.
Inheritance
Namespace: OpenIddict.Core
Assembly: cs.temp.dll.dll
Syntax
public class OpenIddictScopeManager<TScope> : IOpenIddictScopeManager where TScope : class
Type Parameters
Name | Description |
---|---|
TScope | The type of the Scope entity. |
Remarks
Applications that do not want to depend on a specific entity type can use the non-generic
Constructors
OpenIddictScopeManager(IOpenIddictScopeCache<TScope>, ILogger<OpenIddictScopeManager<TScope>>, IOptionsMonitor<OpenIddictCoreOptions>, IOpenIddictScopeStoreResolver)
Declaration
public OpenIddictScopeManager(IOpenIddictScopeCache<TScope> cache, ILogger<OpenIddictScopeManager<TScope>> logger, IOptionsMonitor<OpenIddictCoreOptions> options, IOpenIddictScopeStoreResolver resolver)
Parameters
Type | Name | Description |
---|---|---|
IOpenIddictScopeCache<TScope> | cache | |
ILogger<OpenIddictScopeManager<TScope>> | logger | |
IOptionsMonitor<OpenIddictCoreOptions> | options | |
IOpenIddictScopeStoreResolver | resolver |
Properties
Cache
Gets the cache associated with the current manager.
Declaration
protected IOpenIddictScopeCache<TScope> Cache { get; }
Property Value
Type | Description |
---|---|
IOpenIddictScopeCache<TScope> |
Logger
Gets the logger associated with the current manager.
Declaration
protected ILogger Logger { get; }
Property Value
Type | Description |
---|---|
ILogger |
Options
Gets the options associated with the current manager.
Declaration
protected IOptionsMonitor<OpenIddictCoreOptions> Options { get; }
Property Value
Type | Description |
---|---|
IOptionsMonitor<OpenIddictCoreOptions> |
Store
Gets the store associated with the current manager.
Declaration
protected IOpenIddictScopeStore<TScope> Store { get; }
Property Value
Type | Description |
---|---|
IOpenIddictScopeStore<TScope> |
Methods
CountAsync(CancellationToken)
Determines the number of scopes that exist in the database.
Declaration
public virtual ValueTask<long> CountAsync(CancellationToken cancellationToken = null)
Parameters
Type | Name | Description |
---|---|---|
CancellationToken | cancellationToken | The |
Returns
Type | Description |
---|---|
System.Threading.Tasks.ValueTask<System.Int64> | A System.Threading.Tasks.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.
Declaration
public virtual ValueTask<long> CountAsync<TResult>(Func<IQueryable<TScope>, IQueryable<TResult>> query, CancellationToken cancellationToken = null)
Parameters
Type | Name | Description |
---|---|---|
System.Func<IQueryable<TScope>, IQueryable<TResult>> | query | The query to execute. |
CancellationToken | cancellationToken | The |
Returns
Type | Description |
---|---|
System.Threading.Tasks.ValueTask<System.Int64> | A System.Threading.Tasks.ValueTask 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
public virtual ValueTask CreateAsync(TScope scope, CancellationToken cancellationToken = null)
Parameters
Type | Name | Description |
---|---|---|
TScope | scope | The scope to create. |
CancellationToken | cancellationToken | The |
Returns
Type | Description |
---|---|
System.Threading.Tasks.ValueTask | A System.Threading.Tasks.ValueTask that can be used to monitor the asynchronous operation. |
CreateAsync(OpenIddictScopeDescriptor, CancellationToken)
Creates a new scope based on the specified descriptor.
Declaration
public virtual ValueTask<TScope> CreateAsync(OpenIddictScopeDescriptor descriptor, CancellationToken cancellationToken = null)
Parameters
Type | Name | Description |
---|---|---|
OpenIddictScopeDescriptor | descriptor | The scope descriptor. |
CancellationToken | cancellationToken | The |
Returns
Type | Description |
---|---|
System.Threading.Tasks.ValueTask<TScope> | A System.Threading.Tasks.ValueTask that can be used to monitor the asynchronous operation, whose result returns the scope. |
DeleteAsync(TScope, CancellationToken)
Removes an existing scope.
Declaration
public virtual ValueTask DeleteAsync(TScope scope, CancellationToken cancellationToken = null)
Parameters
Type | Name | Description |
---|---|---|
TScope | scope | The scope to delete. |
CancellationToken | cancellationToken | The |
Returns
Type | Description |
---|---|
System.Threading.Tasks.ValueTask | A System.Threading.Tasks.ValueTask that can be used to monitor the asynchronous operation. |
FindByIdAsync(String, CancellationToken)
Retrieves a scope using its unique identifier.
Declaration
public virtual ValueTask<TScope> FindByIdAsync(string identifier, CancellationToken cancellationToken = null)
Parameters
Type | Name | Description |
---|---|---|
System.String | identifier | The unique identifier associated with the scope. |
CancellationToken | cancellationToken | The |
Returns
Type | Description |
---|---|
System.Threading.Tasks.ValueTask<TScope> | A System.Threading.Tasks.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.
Declaration
public virtual ValueTask<TScope> FindByNameAsync(string name, CancellationToken cancellationToken = null)
Parameters
Type | Name | Description |
---|---|---|
System.String | name | The name associated with the scope. |
CancellationToken | cancellationToken | The |
Returns
Type | Description |
---|---|
System.Threading.Tasks.ValueTask<TScope> | A System.Threading.Tasks.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.
Declaration
public virtual IAsyncEnumerable<TScope> FindByNamesAsync(ImmutableArray<string> names, CancellationToken cancellationToken = null)
Parameters
Type | Name | Description |
---|---|---|
ImmutableArray<System.String> | names | The names associated with the scopes. |
CancellationToken | cancellationToken | The |
Returns
Type | Description |
---|---|
System.Collections.Generic.IAsyncEnumerable<TScope> | The scopes corresponding to the specified names. |
FindByResourceAsync(String, CancellationToken)
Retrieves all the scopes that contain the specified resource.
Declaration
public virtual IAsyncEnumerable<TScope> FindByResourceAsync(string resource, CancellationToken cancellationToken = null)
Parameters
Type | Name | Description |
---|---|---|
System.String | resource | The resource associated with the scopes. |
CancellationToken | cancellationToken | The |
Returns
Type | Description |
---|---|
System.Collections.Generic.IAsyncEnumerable<TScope> | The scopes associated with the specified resource. |
GetAsync<TResult>(Func<IQueryable<TScope>, IQueryable<TResult>>, CancellationToken)
Executes the specified query and returns the first element.
Declaration
public virtual ValueTask<TResult> GetAsync<TResult>(Func<IQueryable<TScope>, IQueryable<TResult>> query, CancellationToken cancellationToken = null)
Parameters
Type | Name | Description |
---|---|---|
System.Func<IQueryable<TScope>, IQueryable<TResult>> | query | The query to execute. |
CancellationToken | cancellationToken | The |
Returns
Type | Description |
---|---|
System.Threading.Tasks.ValueTask<TResult> | A System.Threading.Tasks.ValueTask 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<TScope>, TState, IQueryable<TResult>>, TState, CancellationToken)
Executes the specified query and returns the first element.
Declaration
public virtual ValueTask<TResult> GetAsync<TState, TResult>(Func<IQueryable<TScope>, TState, IQueryable<TResult>> query, TState state, CancellationToken cancellationToken = null)
Parameters
Type | Name | Description |
---|---|---|
System.Func<IQueryable<TScope>, TState, IQueryable<TResult>> | query | The query to execute. |
TState | state | The optional state. |
CancellationToken | cancellationToken | The |
Returns
Type | Description |
---|---|
System.Threading.Tasks.ValueTask<TResult> | A System.Threading.Tasks.ValueTask 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
public virtual ValueTask<string> GetDescriptionAsync(TScope scope, CancellationToken cancellationToken = null)
Parameters
Type | Name | Description |
---|---|---|
TScope | scope | The scope. |
CancellationToken | cancellationToken | The |
Returns
Type | Description |
---|---|
System.Threading.Tasks.ValueTask<System.String> | A System.Threading.Tasks.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 an scope.
Declaration
public virtual ValueTask<ImmutableDictionary<CultureInfo, string>> GetDescriptionsAsync(TScope scope, CancellationToken cancellationToken = null)
Parameters
Type | Name | Description |
---|---|---|
TScope | scope | The scope. |
CancellationToken | cancellationToken | The |
Returns
Type | Description |
---|---|
System.Threading.Tasks.ValueTask<ImmutableDictionary<CultureInfo, System.String>> | A System.Threading.Tasks.ValueTask<TResult> that can be used to monitor the asynchronous operation, whose result returns all the localized descriptions associated with the scope. |
GetDisplayNameAsync(TScope, CancellationToken)
Retrieves the display name associated with a scope.
Declaration
public virtual ValueTask<string> GetDisplayNameAsync(TScope scope, CancellationToken cancellationToken = null)
Parameters
Type | Name | Description |
---|---|---|
TScope | scope | The scope. |
CancellationToken | cancellationToken | The |
Returns
Type | Description |
---|---|
System.Threading.Tasks.ValueTask<System.String> | A System.Threading.Tasks.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 an scope.
Declaration
public virtual ValueTask<ImmutableDictionary<CultureInfo, string>> GetDisplayNamesAsync(TScope scope, CancellationToken cancellationToken = null)
Parameters
Type | Name | Description |
---|---|---|
TScope | scope | The scope. |
CancellationToken | cancellationToken | The |
Returns
Type | Description |
---|---|
System.Threading.Tasks.ValueTask<ImmutableDictionary<CultureInfo, System.String>> | A System.Threading.Tasks.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.
Declaration
public virtual ValueTask<string> GetIdAsync(TScope scope, CancellationToken cancellationToken = null)
Parameters
Type | Name | Description |
---|---|---|
TScope | scope | The scope. |
CancellationToken | cancellationToken | The |
Returns
Type | Description |
---|---|
System.Threading.Tasks.ValueTask<System.String> | A System.Threading.Tasks.ValueTask<TResult> that can be used to monitor the asynchronous operation, whose result returns the unique identifier associated with the scope. |
GetLocalizedDescriptionAsync(TScope, 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
public virtual ValueTask<string> GetLocalizedDescriptionAsync(TScope scope, CancellationToken cancellationToken = null)
Parameters
Type | Name | Description |
---|---|---|
TScope | scope | The scope. |
CancellationToken | cancellationToken | The |
Returns
Type | Description |
---|---|
System.Threading.Tasks.ValueTask<System.String> | A System.Threading.Tasks.ValueTask<TResult> that can be used to monitor the asynchronous operation, whose result returns the matching localized description associated with the scope. |
GetLocalizedDescriptionAsync(TScope, 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
public virtual ValueTask<string> GetLocalizedDescriptionAsync(TScope scope, CultureInfo culture, CancellationToken cancellationToken = null)
Parameters
Type | Name | Description |
---|---|---|
TScope | scope | The scope. |
CultureInfo | culture | The culture (typically |
CancellationToken | cancellationToken | The |
Returns
Type | Description |
---|---|
System.Threading.Tasks.ValueTask<System.String> | A System.Threading.Tasks.ValueTask<TResult> that can be used to monitor the asynchronous operation, whose result returns the matching localized description associated with the scope. |
GetLocalizedDisplayNameAsync(TScope, 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
public virtual ValueTask<string> GetLocalizedDisplayNameAsync(TScope scope, CancellationToken cancellationToken = null)
Parameters
Type | Name | Description |
---|---|---|
TScope | scope | The scope. |
CancellationToken | cancellationToken | The |
Returns
Type | Description |
---|---|
System.Threading.Tasks.ValueTask<System.String> | A System.Threading.Tasks.ValueTask<TResult> that can be used to monitor the asynchronous operation, whose result returns the matching display name associated with the scope. |
GetLocalizedDisplayNameAsync(TScope, 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
public virtual ValueTask<string> GetLocalizedDisplayNameAsync(TScope scope, CultureInfo culture, CancellationToken cancellationToken = null)
Parameters
Type | Name | Description |
---|---|---|
TScope | scope | The scope. |
CultureInfo | culture | The culture (typically |
CancellationToken | cancellationToken | The |
Returns
Type | Description |
---|---|
System.Threading.Tasks.ValueTask<System.String> | A System.Threading.Tasks.ValueTask<TResult> that can be used to monitor the asynchronous operation, whose result returns the matching display name associated with the scope. |
GetNameAsync(TScope, CancellationToken)
Retrieves the name associated with a scope.
Declaration
public virtual ValueTask<string> GetNameAsync(TScope scope, CancellationToken cancellationToken = null)
Parameters
Type | Name | Description |
---|---|---|
TScope | scope | The scope. |
CancellationToken | cancellationToken | The |
Returns
Type | Description |
---|---|
System.Threading.Tasks.ValueTask<System.String> | A System.Threading.Tasks.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.
Declaration
public virtual ValueTask<ImmutableDictionary<string, JsonElement>> GetPropertiesAsync(TScope scope, CancellationToken cancellationToken = null)
Parameters
Type | Name | Description |
---|---|---|
TScope | scope | The scope. |
CancellationToken | cancellationToken | The |
Returns
Type | Description |
---|---|
System.Threading.Tasks.ValueTask<ImmutableDictionary<System.String, JsonElement>> | A System.Threading.Tasks.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.
Declaration
public virtual ValueTask<ImmutableArray<string>> GetResourcesAsync(TScope scope, CancellationToken cancellationToken = null)
Parameters
Type | Name | Description |
---|---|---|
TScope | scope | The scope. |
CancellationToken | cancellationToken | The |
Returns
Type | Description |
---|---|
System.Threading.Tasks.ValueTask<ImmutableArray<System.String>> | A System.Threading.Tasks.ValueTask<TResult> 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
public virtual IAsyncEnumerable<TScope> 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 |
Returns
Type | Description |
---|---|
System.Collections.Generic.IAsyncEnumerable<TScope> | All the elements returned when executing the specified query. |
ListAsync<TResult>(Func<IQueryable<TScope>, IQueryable<TResult>>, CancellationToken)
Executes the specified query and returns all the corresponding elements.
Declaration
public virtual IAsyncEnumerable<TResult> ListAsync<TResult>(Func<IQueryable<TScope>, IQueryable<TResult>> query, CancellationToken cancellationToken = null)
Parameters
Type | Name | Description |
---|---|---|
System.Func<IQueryable<TScope>, IQueryable<TResult>> | query | The query to execute. |
CancellationToken | cancellationToken | The |
Returns
Type | Description |
---|---|
System.Collections.Generic.IAsyncEnumerable<TResult> | All the elements returned when executing the specified query. |
Type Parameters
Name | Description |
---|---|
TResult | The result type. |
ListAsync<TState, TResult>(Func<IQueryable<TScope>, TState, IQueryable<TResult>>, TState, CancellationToken)
Executes the specified query and returns all the corresponding elements.
Declaration
public virtual IAsyncEnumerable<TResult> ListAsync<TState, TResult>(Func<IQueryable<TScope>, TState, IQueryable<TResult>> query, TState state, CancellationToken cancellationToken = null)
Parameters
Type | Name | Description |
---|---|---|
System.Func<IQueryable<TScope>, TState, IQueryable<TResult>> | query | The query to execute. |
TState | state | The optional state. |
CancellationToken | cancellationToken | The |
Returns
Type | Description |
---|---|
System.Collections.Generic.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
public virtual IAsyncEnumerable<string> ListResourcesAsync(ImmutableArray<string> scopes, CancellationToken cancellationToken = null)
Parameters
Type | Name | Description |
---|---|---|
ImmutableArray<System.String> | scopes | The scopes. |
CancellationToken | cancellationToken | The |
Returns
Type | Description |
---|---|
System.Collections.Generic.IAsyncEnumerable<System.String> | All the resources associated with the specified scopes. |
PopulateAsync(TScope, OpenIddictScopeDescriptor, CancellationToken)
Populates the scope using the specified descriptor.
Declaration
public virtual ValueTask PopulateAsync(TScope scope, OpenIddictScopeDescriptor descriptor, CancellationToken cancellationToken = null)
Parameters
Type | Name | Description |
---|---|---|
TScope | scope | The scope. |
OpenIddictScopeDescriptor | descriptor | The descriptor. |
CancellationToken | cancellationToken | The |
Returns
Type | Description |
---|---|
System.Threading.Tasks.ValueTask | A System.Threading.Tasks.ValueTask that can be used to monitor the asynchronous operation. |
PopulateAsync(OpenIddictScopeDescriptor, TScope, CancellationToken)
Populates the specified descriptor using the properties exposed by the scope.
Declaration
public virtual ValueTask PopulateAsync(OpenIddictScopeDescriptor descriptor, TScope scope, CancellationToken cancellationToken = null)
Parameters
Type | Name | Description |
---|---|---|
OpenIddictScopeDescriptor | descriptor | The descriptor. |
TScope | scope | The scope. |
CancellationToken | cancellationToken | The |
Returns
Type | Description |
---|---|
System.Threading.Tasks.ValueTask | A System.Threading.Tasks.ValueTask that can be used to monitor the asynchronous operation. |
UpdateAsync(TScope, CancellationToken)
Updates an existing scope.
Declaration
public virtual ValueTask UpdateAsync(TScope scope, CancellationToken cancellationToken = null)
Parameters
Type | Name | Description |
---|---|---|
TScope | scope | The scope to update. |
CancellationToken | cancellationToken | The |
Returns
Type | Description |
---|---|
System.Threading.Tasks.ValueTask | A System.Threading.Tasks.ValueTask that can be used to monitor the asynchronous operation. |
UpdateAsync(TScope, OpenIddictScopeDescriptor, CancellationToken)
Updates an existing scope.
Declaration
public virtual ValueTask UpdateAsync(TScope scope, OpenIddictScopeDescriptor descriptor, CancellationToken cancellationToken = null)
Parameters
Type | Name | Description |
---|---|---|
TScope | scope | The scope to update. |
OpenIddictScopeDescriptor | descriptor | The descriptor used to update the scope. |
CancellationToken | cancellationToken | The |
Returns
Type | Description |
---|---|
System.Threading.Tasks.ValueTask | A System.Threading.Tasks.ValueTask that can be used to monitor the asynchronous operation. |
ValidateAsync(TScope, CancellationToken)
Validates the scope to ensure it's in a consistent state.
Declaration
public virtual IAsyncEnumerable<ValidationResult> ValidateAsync(TScope scope, CancellationToken cancellationToken = null)
Parameters
Type | Name | Description |
---|---|---|
TScope | scope | The scope. |
CancellationToken | cancellationToken | The |
Returns
Type | Description |
---|---|
System.Collections.Generic.IAsyncEnumerable<ValidationResult> | The validation error encountered when validating the scope. |