Show / Hide Table of Contents

# Class OpenIddictEntityFrameworkCoreAuthorizationStore<TAuthorization, TApplication, TToken, TContext, TKey>

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

##### Inheritance

System.Object
OpenIddictEntityFrameworkCoreAuthorizationStore<TAuthorization, TApplication, TToken, TContext, TKey>
OpenIddictEntityFrameworkCoreAuthorizationStore<TContext>
OpenIddictEntityFrameworkCoreAuthorizationStore<TContext, TKey>

###### Namespace: OpenIddict.EntityFrameworkCore

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

##### Syntax

    public class OpenIddictEntityFrameworkCoreAuthorizationStore<TAuthorization, TApplication, TToken, TContext, TKey> : IOpenIddictAuthorizationStore<TAuthorization> where TAuthorization : OpenIddictEntityFrameworkCoreAuthorization<TKey, TApplication, TToken> where TApplication : OpenIddictEntityFrameworkCoreApplication<TKey, TAuthorization, TToken> where TToken : OpenIddictEntityFrameworkCoreToken<TKey, TApplication, TAuthorization> where TContext : DbContext where TKey : IEquatable<TKey>

##### Type Parameters

Name | Description
--- | ---
TAuthorization | The type of the Authorization entity.
TApplication | The type of the Application entity.
TToken | The type of the Token entity.
TContext | The type of the Entity Framework database context.
TKey | The type of the entity primary keys.

### Constructors

#### OpenIddictEntityFrameworkCoreAuthorizationStore(IMemoryCache, TContext, IOptionsMonitor<OpenIddictEntityFrameworkCoreOptions>)

##### Declaration

    public OpenIddictEntityFrameworkCoreAuthorizationStore(IMemoryCache cache, TContext context, IOptionsMonitor<OpenIddictEntityFrameworkCoreOptions> options)

##### Parameters

Type | Name | Description
--- | --- | ---
IMemoryCache | cache |
TContext | context |
IOptionsMonitor<OpenIddictEntityFrameworkCoreOptions> | options |

### Properties

#### Cache

Gets the memory cache associated with the current store.

##### Declaration

    protected IMemoryCache Cache { get; }

##### Property Value

Type | Description
--- | ---
IMemoryCache |

#### Context

Gets the database context associated with the current store.

##### Declaration

    protected TContext Context { get; }

##### Property Value

Type | Description
--- | ---
TContext |

#### Options

Gets the options associated with the current store.

##### Declaration

    protected IOptionsMonitor<OpenIddictEntityFrameworkCoreOptions> Options { get; }

##### Property Value

Type | Description
--- | ---
IOptionsMonitor<OpenIddictEntityFrameworkCoreOptions> |

### Methods

#### ConvertIdentifierFromString(String)

Converts the provided identifier to a strongly typed key object.

##### Declaration

    public virtual TKey ConvertIdentifierFromString(string identifier)

##### Parameters

Type | Name | Description
--- | --- | ---
System.String | identifier | The identifier to convert.

##### Returns

Type | Description
--- | ---
TKey | An instance of `TKey` representing the provided identifier.

#### ConvertIdentifierToString(TKey)

Converts the provided identifier to its string representation.

##### Declaration

    public virtual string ConvertIdentifierToString(TKey identifier)

##### Parameters

Type | Name | Description
--- | --- | ---
TKey | identifier | The identifier to convert.

##### Returns

Type | Description
--- | ---
System.String | A System.String representation of the provided identifier.

#### CountAsync(CancellationToken)

##### Declaration

    public virtual ValueTask<long> CountAsync(CancellationToken cancellationToken)

##### Parameters

Type | Name | Description
--- | --- | ---
CancellationToken | cancellationToken |

##### Returns

Type | Description
--- | ---
ValueTask<System.Int64> |

#### CountAsync<TResult>(Func<IQueryable<TAuthorization>, IQueryable<TResult>>, CancellationToken)

##### Declaration

    public virtual ValueTask<long> CountAsync<TResult>(Func<IQueryable<TAuthorization>, IQueryable<TResult>> query, CancellationToken cancellationToken)

##### Parameters

Type | Name | Description
--- | --- | ---
System.Func<IQueryable<TAuthorization>, IQueryable<TResult>> | query |
CancellationToken | cancellationToken |

##### Returns

Type | Description
--- | ---
ValueTask<System.Int64> |

##### Type Parameters

Name | Description
--- | ---
TResult |

#### CreateAsync(TAuthorization, CancellationToken)

##### Declaration

    public virtual ValueTask CreateAsync(TAuthorization authorization, CancellationToken cancellationToken)

##### Parameters

Type | Name | Description
--- | --- | ---
TAuthorization | authorization |
CancellationToken | cancellationToken |

##### Returns

Type | Description
--- | ---
ValueTask |

#### DeleteAsync(TAuthorization, CancellationToken)

##### Declaration

    public virtual ValueTask DeleteAsync(TAuthorization authorization, CancellationToken cancellationToken)

##### Parameters

Type | Name | Description
--- | --- | ---
TAuthorization | authorization |
CancellationToken | cancellationToken |

##### Returns

Type | Description
--- | ---
ValueTask |

#### FindAsync(String, String, CancellationToken)

##### Declaration

    public virtual IAsyncEnumerable<TAuthorization> FindAsync(string subject, string client, CancellationToken cancellationToken)

##### Parameters

Type | Name | Description
--- | --- | ---
System.String | subject |
System.String | client |
CancellationToken | cancellationToken |

##### Returns

Type | Description
--- | ---
IAsyncEnumerable<TAuthorization> |

#### FindAsync(String, String, String, CancellationToken)

##### Declaration

    public virtual IAsyncEnumerable<TAuthorization> FindAsync(string subject, string client, string status, CancellationToken cancellationToken)

##### Parameters

Type | Name | Description
--- | --- | ---
System.String | subject |
System.String | client |
System.String | status |
CancellationToken | cancellationToken |

##### Returns

Type | Description
--- | ---
IAsyncEnumerable<TAuthorization> |

#### FindAsync(String, String, String, String, CancellationToken)

##### Declaration

    public virtual IAsyncEnumerable<TAuthorization> FindAsync(string subject, string client, string status, string type, CancellationToken cancellationToken)

##### Parameters

Type | Name | Description
--- | --- | ---
System.String | subject |
System.String | client |
System.String | status |
System.String | type |
CancellationToken | cancellationToken |

##### Returns

Type | Description
--- | ---
IAsyncEnumerable<TAuthorization> |

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

##### Declaration

    public virtual IAsyncEnumerable<TAuthorization> FindAsync(string subject, string client, string status, string type, ImmutableArray<string> scopes, CancellationToken cancellationToken)

##### Parameters

Type | Name | Description
--- | --- | ---
System.String | subject |
System.String | client |
System.String | status |
System.String | type |
ImmutableArray<System.String> | scopes |
CancellationToken | cancellationToken |

##### Returns

Type | Description
--- | ---
IAsyncEnumerable<TAuthorization> |

#### FindByApplicationIdAsync(String, CancellationToken)

##### Declaration

    public virtual IAsyncEnumerable<TAuthorization> FindByApplicationIdAsync(string identifier, CancellationToken cancellationToken)

##### Parameters

Type | Name | Description
--- | --- | ---
System.String | identifier |
CancellationToken | cancellationToken |

##### Returns

Type | Description
--- | ---
IAsyncEnumerable<TAuthorization> |

#### FindByIdAsync(String, CancellationToken)

##### Declaration

    public virtual ValueTask<TAuthorization> FindByIdAsync(string identifier, CancellationToken cancellationToken)

##### Parameters

Type | Name | Description
--- | --- | ---
System.String | identifier |
CancellationToken | cancellationToken |

##### Returns

Type | Description
--- | ---
ValueTask<TAuthorization> |

#### FindBySubjectAsync(String, CancellationToken)

##### Declaration

    public virtual IAsyncEnumerable<TAuthorization> FindBySubjectAsync(string subject, CancellationToken cancellationToken)

##### Parameters

Type | Name | Description
--- | --- | ---
System.String | subject |
CancellationToken | cancellationToken |

##### Returns

Type | Description
--- | ---
IAsyncEnumerable<TAuthorization> |

#### GetApplicationIdAsync(TAuthorization, CancellationToken)

##### Declaration

    public virtual ValueTask<string> GetApplicationIdAsync(TAuthorization authorization, CancellationToken cancellationToken)

##### Parameters

Type | Name | Description
--- | --- | ---
TAuthorization | authorization |
CancellationToken | cancellationToken |

##### Returns

Type | Description
--- | ---
ValueTask<System.String> |

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

##### Declaration

    public virtual ValueTask<TResult> GetAsync<TState, TResult>(Func<IQueryable<TAuthorization>, TState, IQueryable<TResult>> query, TState state, CancellationToken cancellationToken)

##### Parameters

Type | Name | Description
--- | --- | ---
System.Func<IQueryable<TAuthorization>, TState, IQueryable<TResult>> | query |
TState | state |
CancellationToken | cancellationToken |

##### Returns

Type | Description
--- | ---
ValueTask<TResult> |

##### Type Parameters

Name | Description
--- | ---
TState |
TResult |

#### GetCreationDateAsync(TAuthorization, CancellationToken)

##### Declaration

    public virtual ValueTask<DateTimeOffset?> GetCreationDateAsync(TAuthorization authorization, CancellationToken cancellationToken)

##### Parameters

Type | Name | Description
--- | --- | ---
TAuthorization | authorization |
CancellationToken | cancellationToken |

##### Returns

Type | Description
--- | ---
ValueTask<System.Nullable<System.DateTimeOffset>> |

#### GetIdAsync(TAuthorization, CancellationToken)

##### Declaration

    public virtual ValueTask<string> GetIdAsync(TAuthorization authorization, CancellationToken cancellationToken)

##### Parameters

Type | Name | Description
--- | --- | ---
TAuthorization | authorization |
CancellationToken | cancellationToken |

##### Returns

Type | Description
--- | ---
ValueTask<System.String> |

#### GetPropertiesAsync(TAuthorization, CancellationToken)

##### Declaration

    public virtual ValueTask<ImmutableDictionary<string, JsonElement>> GetPropertiesAsync(TAuthorization authorization, CancellationToken cancellationToken)

##### Parameters

Type | Name | Description
--- | --- | ---
TAuthorization | authorization |
CancellationToken | cancellationToken |

##### Returns

Type | Description
--- | ---
ValueTask<ImmutableDictionary<System.String, JsonElement>> |

#### GetScopesAsync(TAuthorization, CancellationToken)

##### Declaration

    public virtual ValueTask<ImmutableArray<string>> GetScopesAsync(TAuthorization authorization, CancellationToken cancellationToken)

##### Parameters

Type | Name | Description
--- | --- | ---
TAuthorization | authorization |
CancellationToken | cancellationToken |

##### Returns

Type | Description
--- | ---
ValueTask<ImmutableArray<System.String>> |

#### GetStatusAsync(TAuthorization, CancellationToken)

##### Declaration

    public virtual ValueTask<string> GetStatusAsync(TAuthorization authorization, CancellationToken cancellationToken)

##### Parameters

Type | Name | Description
--- | --- | ---
TAuthorization | authorization |
CancellationToken | cancellationToken |

##### Returns

Type | Description
--- | ---
ValueTask<System.String> |

#### GetSubjectAsync(TAuthorization, CancellationToken)

##### Declaration

    public virtual ValueTask<string> GetSubjectAsync(TAuthorization authorization, CancellationToken cancellationToken)

##### Parameters

Type | Name | Description
--- | --- | ---
TAuthorization | authorization |
CancellationToken | cancellationToken |

##### Returns

Type | Description
--- | ---
ValueTask<System.String> |

#### GetTypeAsync(TAuthorization, CancellationToken)

##### Declaration

    public virtual ValueTask<string> GetTypeAsync(TAuthorization authorization, CancellationToken cancellationToken)

##### Parameters

Type | Name | Description
--- | --- | ---
TAuthorization | authorization |
CancellationToken | cancellationToken |

##### Returns

Type | Description
--- | ---
ValueTask<System.String> |

#### InstantiateAsync(CancellationToken)

##### Declaration

    public virtual ValueTask<TAuthorization> InstantiateAsync(CancellationToken cancellationToken)

##### Parameters

Type | Name | Description
--- | --- | ---
CancellationToken | cancellationToken |

##### Returns

Type | Description
--- | ---
ValueTask<TAuthorization> |

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

##### Declaration

    public virtual IAsyncEnumerable<TAuthorization> ListAsync(int? count, int? offset, CancellationToken cancellationToken)

##### Parameters

Type | Name | Description
--- | --- | ---
System.Nullable<System.Int32> | count |
System.Nullable<System.Int32> | offset |
CancellationToken | cancellationToken |

##### Returns

Type | Description
--- | ---
IAsyncEnumerable<TAuthorization> |

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

##### Declaration

    public virtual IAsyncEnumerable<TResult> ListAsync<TState, TResult>(Func<IQueryable<TAuthorization>, TState, IQueryable<TResult>> query, TState state, CancellationToken cancellationToken)

##### Parameters

Type | Name | Description
--- | --- | ---
System.Func<IQueryable<TAuthorization>, TState, IQueryable<TResult>> | query |
TState | state |
CancellationToken | cancellationToken |

##### Returns

Type | Description
--- | ---
IAsyncEnumerable<TResult> |

##### Type Parameters

Name | Description
--- | ---
TState |
TResult |

#### PruneAsync(DateTimeOffset, CancellationToken)

##### Declaration

    public virtual ValueTask PruneAsync(DateTimeOffset threshold, CancellationToken cancellationToken)

##### Parameters

Type | Name | Description
--- | --- | ---
System.DateTimeOffset | threshold |
CancellationToken | cancellationToken |

##### Returns

Type | Description
--- | ---
ValueTask |

#### SetApplicationIdAsync(TAuthorization, String, CancellationToken)

##### Declaration

    public virtual ValueTask SetApplicationIdAsync(TAuthorization authorization, string identifier, CancellationToken cancellationToken)

##### Parameters

Type | Name | Description
--- | --- | ---
TAuthorization | authorization |
System.String | identifier |
CancellationToken | cancellationToken |

##### Returns

Type | Description
--- | ---
ValueTask |

#### SetCreationDateAsync(TAuthorization, Nullable<DateTimeOffset>, CancellationToken)

##### Declaration

    public virtual ValueTask SetCreationDateAsync(TAuthorization authorization, DateTimeOffset? date, CancellationToken cancellationToken)

##### Parameters

Type | Name | Description
--- | --- | ---
TAuthorization | authorization |
System.Nullable<System.DateTimeOffset> | date |
CancellationToken | cancellationToken |

##### Returns

Type | Description
--- | ---
ValueTask |

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

##### Declaration

    public virtual ValueTask SetPropertiesAsync(TAuthorization authorization, ImmutableDictionary<string, JsonElement> properties, CancellationToken cancellationToken)

##### Parameters

Type | Name | Description
--- | --- | ---
TAuthorization | authorization |
ImmutableDictionary<System.String, JsonElement> | properties |
CancellationToken | cancellationToken |

##### Returns

Type | Description
--- | ---
ValueTask |

#### SetScopesAsync(TAuthorization, ImmutableArray<String>, CancellationToken)

##### Declaration

    public virtual ValueTask SetScopesAsync(TAuthorization authorization, ImmutableArray<string> scopes, CancellationToken cancellationToken)

##### Parameters

Type | Name | Description
--- | --- | ---
TAuthorization | authorization |
ImmutableArray<System.String> | scopes |
CancellationToken | cancellationToken |

##### Returns

Type | Description
--- | ---
ValueTask |

#### SetStatusAsync(TAuthorization, String, CancellationToken)

##### Declaration

    public virtual ValueTask SetStatusAsync(TAuthorization authorization, string status, CancellationToken cancellationToken)

##### Parameters

Type | Name | Description
--- | --- | ---
TAuthorization | authorization |
System.String | status |
CancellationToken | cancellationToken |

##### Returns

Type | Description
--- | ---
ValueTask |

#### SetSubjectAsync(TAuthorization, String, CancellationToken)

##### Declaration

    public virtual ValueTask SetSubjectAsync(TAuthorization authorization, string subject, CancellationToken cancellationToken)

##### Parameters

Type | Name | Description
--- | --- | ---
TAuthorization | authorization |
System.String | subject |
CancellationToken | cancellationToken |

##### Returns

Type | Description
--- | ---
ValueTask |

#### SetTypeAsync(TAuthorization, String, CancellationToken)

##### Declaration

    public virtual ValueTask SetTypeAsync(TAuthorization authorization, string type, CancellationToken cancellationToken)

##### Parameters

Type | Name | Description
--- | --- | ---
TAuthorization | authorization |
System.String | type |
CancellationToken | cancellationToken |

##### Returns

Type | Description
--- | ---
ValueTask |

#### UpdateAsync(TAuthorization, CancellationToken)

##### Declaration

    public virtual ValueTask UpdateAsync(TAuthorization authorization, CancellationToken cancellationToken)

##### Parameters

Type | Name | Description
--- | --- | ---
TAuthorization | authorization |
CancellationToken | cancellationToken |

##### Returns

Type | Description
--- | ---
ValueTask |