Show / Hide Table of Contents

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

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

##### Inheritance

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

###### Namespace: OpenIddict.EntityFramework

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

##### Syntax

    public class OpenIddictEntityFrameworkTokenStore<TToken, TApplication, TAuthorization, TContext, TKey> : IOpenIddictTokenStore<TToken> where TToken : OpenIddictEntityFrameworkToken<TKey, TApplication, TAuthorization> where TApplication : OpenIddictEntityFrameworkApplication<TKey, TAuthorization, TToken> where TAuthorization : OpenIddictEntityFrameworkAuthorization<TKey, TApplication, TToken> where TContext : DbContext where TKey : IEquatable<TKey>

##### Type Parameters

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

### Constructors

#### OpenIddictEntityFrameworkTokenStore(IMemoryCache, TContext, IOptionsMonitor<OpenIddictEntityFrameworkOptions>)

##### Declaration

    public OpenIddictEntityFrameworkTokenStore(IMemoryCache cache, TContext context, IOptionsMonitor<OpenIddictEntityFrameworkOptions> options)

##### Parameters

Type | Name | Description
--- | --- | ---
IMemoryCache | cache |
TContext | context |
IOptionsMonitor<OpenIddictEntityFrameworkOptions> | 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<OpenIddictEntityFrameworkOptions> Options { get; }

##### Property Value

Type | Description
--- | ---
IOptionsMonitor<OpenIddictEntityFrameworkOptions> |

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

##### Declaration

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

##### Parameters

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

##### Returns

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

##### Type Parameters

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

#### CreateAsync(TToken, CancellationToken)

##### Declaration

    public virtual ValueTask CreateAsync(TToken token, CancellationToken cancellationToken)

##### Parameters

Type | Name | Description
--- | --- | ---
TToken | token |
CancellationToken | cancellationToken |

##### Returns

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

#### DeleteAsync(TToken, CancellationToken)

##### Declaration

    public virtual ValueTask DeleteAsync(TToken token, CancellationToken cancellationToken)

##### Parameters

Type | Name | Description
--- | --- | ---
TToken | token |
CancellationToken | cancellationToken |

##### Returns

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

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

##### Declaration

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

##### Parameters

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

##### Returns

Type | Description
--- | ---
IAsyncEnumerable<TToken> |

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

##### Declaration

    public virtual IAsyncEnumerable<TToken> 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<TToken> |

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

##### Declaration

    public virtual IAsyncEnumerable<TToken> 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<TToken> |

#### FindByApplicationIdAsync(String, CancellationToken)

##### Declaration

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

##### Parameters

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

##### Returns

Type | Description
--- | ---
IAsyncEnumerable<TToken> |

#### FindByAuthorizationIdAsync(String, CancellationToken)

##### Declaration

    public virtual IAsyncEnumerable<TToken> FindByAuthorizationIdAsync(string identifier, CancellationToken cancellationToken)

##### Parameters

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

##### Returns

Type | Description
--- | ---
IAsyncEnumerable<TToken> |

#### FindByIdAsync(String, CancellationToken)

##### Declaration

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

##### Parameters

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

##### Returns

Type | Description
--- | ---
ValueTask<TToken> |

#### FindByReferenceIdAsync(String, CancellationToken)

##### Declaration

    public virtual ValueTask<TToken> FindByReferenceIdAsync(string identifier, CancellationToken cancellationToken)

##### Parameters

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

##### Returns

Type | Description
--- | ---
ValueTask<TToken> |

#### FindBySubjectAsync(String, CancellationToken)

##### Declaration

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

##### Parameters

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

##### Returns

Type | Description
--- | ---
IAsyncEnumerable<TToken> |

#### GetApplicationIdAsync(TToken, CancellationToken)

##### Declaration

    public virtual ValueTask<string> GetApplicationIdAsync(TToken token, CancellationToken cancellationToken)

##### Parameters

Type | Name | Description
--- | --- | ---
TToken | token |
CancellationToken | cancellationToken |

##### Returns

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

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

##### Declaration

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

##### Parameters

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

##### Returns

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

##### Type Parameters

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

#### GetAuthorizationIdAsync(TToken, CancellationToken)

##### Declaration

    public virtual ValueTask<string> GetAuthorizationIdAsync(TToken token, CancellationToken cancellationToken)

##### Parameters

Type | Name | Description
--- | --- | ---
TToken | token |
CancellationToken | cancellationToken |

##### Returns

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

#### GetCreationDateAsync(TToken, CancellationToken)

##### Declaration

    public virtual ValueTask<DateTimeOffset?> GetCreationDateAsync(TToken token, CancellationToken cancellationToken)

##### Parameters

Type | Name | Description
--- | --- | ---
TToken | token |
CancellationToken | cancellationToken |

##### Returns

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

#### GetExpirationDateAsync(TToken, CancellationToken)

##### Declaration

    public virtual ValueTask<DateTimeOffset?> GetExpirationDateAsync(TToken token, CancellationToken cancellationToken)

##### Parameters

Type | Name | Description
--- | --- | ---
TToken | token |
CancellationToken | cancellationToken |

##### Returns

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

#### GetIdAsync(TToken, CancellationToken)

##### Declaration

    public virtual ValueTask<string> GetIdAsync(TToken token, CancellationToken cancellationToken)

##### Parameters

Type | Name | Description
--- | --- | ---
TToken | token |
CancellationToken | cancellationToken |

##### Returns

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

#### GetPayloadAsync(TToken, CancellationToken)

##### Declaration

    public virtual ValueTask<string> GetPayloadAsync(TToken token, CancellationToken cancellationToken)

##### Parameters

Type | Name | Description
--- | --- | ---
TToken | token |
CancellationToken | cancellationToken |

##### Returns

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

#### GetPropertiesAsync(TToken, CancellationToken)

##### Declaration

    public virtual ValueTask<ImmutableDictionary<string, JsonElement>> GetPropertiesAsync(TToken token, CancellationToken cancellationToken)

##### Parameters

Type | Name | Description
--- | --- | ---
TToken | token |
CancellationToken | cancellationToken |

##### Returns

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

#### GetRedemptionDateAsync(TToken, CancellationToken)

##### Declaration

    public virtual ValueTask<DateTimeOffset?> GetRedemptionDateAsync(TToken token, CancellationToken cancellationToken)

##### Parameters

Type | Name | Description
--- | --- | ---
TToken | token |
CancellationToken | cancellationToken |

##### Returns

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

#### GetReferenceIdAsync(TToken, CancellationToken)

##### Declaration

    public virtual ValueTask<string> GetReferenceIdAsync(TToken token, CancellationToken cancellationToken)

##### Parameters

Type | Name | Description
--- | --- | ---
TToken | token |
CancellationToken | cancellationToken |

##### Returns

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

#### GetStatusAsync(TToken, CancellationToken)

##### Declaration

    public virtual ValueTask<string> GetStatusAsync(TToken token, CancellationToken cancellationToken)

##### Parameters

Type | Name | Description
--- | --- | ---
TToken | token |
CancellationToken | cancellationToken |

##### Returns

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

#### GetSubjectAsync(TToken, CancellationToken)

##### Declaration

    public virtual ValueTask<string> GetSubjectAsync(TToken token, CancellationToken cancellationToken)

##### Parameters

Type | Name | Description
--- | --- | ---
TToken | token |
CancellationToken | cancellationToken |

##### Returns

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

#### GetTypeAsync(TToken, CancellationToken)

##### Declaration

    public virtual ValueTask<string> GetTypeAsync(TToken token, CancellationToken cancellationToken)

##### Parameters

Type | Name | Description
--- | --- | ---
TToken | token |
CancellationToken | cancellationToken |

##### Returns

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

#### InstantiateAsync(CancellationToken)

##### Declaration

    public virtual ValueTask<TToken> InstantiateAsync(CancellationToken cancellationToken)

##### Parameters

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

##### Returns

Type | Description
--- | ---
ValueTask<TToken> |

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

##### Declaration

    public virtual IAsyncEnumerable<TToken> 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<TToken> |

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

##### Declaration

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

##### Parameters

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

##### Declaration

    public virtual ValueTask SetApplicationIdAsync(TToken token, string identifier, CancellationToken cancellationToken)

##### Parameters

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

##### Returns

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

#### SetAuthorizationIdAsync(TToken, String, CancellationToken)

##### Declaration

    public virtual ValueTask SetAuthorizationIdAsync(TToken token, string identifier, CancellationToken cancellationToken)

##### Parameters

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

##### Returns

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

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

##### Declaration

    public virtual ValueTask SetCreationDateAsync(TToken token, DateTimeOffset? date, CancellationToken cancellationToken)

##### Parameters

Type | Name | Description
--- | --- | ---
TToken | token |
System.Nullable<System.DateTimeOffset> | date |
CancellationToken | cancellationToken |

##### Returns

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

#### SetExpirationDateAsync(TToken, Nullable<DateTimeOffset>, CancellationToken)

##### Declaration

    public virtual ValueTask SetExpirationDateAsync(TToken token, DateTimeOffset? date, CancellationToken cancellationToken)

##### Parameters

Type | Name | Description
--- | --- | ---
TToken | token |
System.Nullable<System.DateTimeOffset> | date |
CancellationToken | cancellationToken |

##### Returns

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

#### SetPayloadAsync(TToken, String, CancellationToken)

##### Declaration

    public virtual ValueTask SetPayloadAsync(TToken token, string payload, CancellationToken cancellationToken)

##### Parameters

Type | Name | Description
--- | --- | ---
TToken | token |
System.String | payload |
CancellationToken | cancellationToken |

##### Returns

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

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

##### Declaration

    public virtual ValueTask SetPropertiesAsync(TToken token, ImmutableDictionary<string, JsonElement> properties, CancellationToken cancellationToken)

##### Parameters

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

##### Returns

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

#### SetRedemptionDateAsync(TToken, Nullable<DateTimeOffset>, CancellationToken)

##### Declaration

    public virtual ValueTask SetRedemptionDateAsync(TToken token, DateTimeOffset? date, CancellationToken cancellationToken)

##### Parameters

Type | Name | Description
--- | --- | ---
TToken | token |
System.Nullable<System.DateTimeOffset> | date |
CancellationToken | cancellationToken |

##### Returns

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

#### SetReferenceIdAsync(TToken, String, CancellationToken)

##### Declaration

    public virtual ValueTask SetReferenceIdAsync(TToken token, string identifier, CancellationToken cancellationToken)

##### Parameters

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

##### Returns

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

#### SetStatusAsync(TToken, String, CancellationToken)

##### Declaration

    public virtual ValueTask SetStatusAsync(TToken token, string status, CancellationToken cancellationToken)

##### Parameters

Type | Name | Description
--- | --- | ---
TToken | token |
System.String | status |
CancellationToken | cancellationToken |

##### Returns

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

#### SetSubjectAsync(TToken, String, CancellationToken)

##### Declaration

    public virtual ValueTask SetSubjectAsync(TToken token, string subject, CancellationToken cancellationToken)

##### Parameters

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

##### Returns

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

#### SetTypeAsync(TToken, String, CancellationToken)

##### Declaration

    public virtual ValueTask SetTypeAsync(TToken token, string type, CancellationToken cancellationToken)

##### Parameters

Type | Name | Description
--- | --- | ---
TToken | token |
System.String | type |
CancellationToken | cancellationToken |

##### Returns

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

#### UpdateAsync(TToken, CancellationToken)

##### Declaration

    public virtual ValueTask UpdateAsync(TToken token, CancellationToken cancellationToken)

##### Parameters

Type | Name | Description
--- | --- | ---
TToken | token |
CancellationToken | cancellationToken |

##### Returns

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