Skip to content

TokenRepo

Namespace: Database.Repository.TokenRepo

Repository implementation for managing TokenInfo entities.

public class TokenRepo : ITokenRepo

Inheritance ObjectTokenRepo

Implements ITokenRepo

Constructors

TokenRepo(ApplicationDbContext)

Initializes a new instance of the TokenRepo class.

public TokenRepo(ApplicationDbContext context)

Parameters

context ApplicationDbContext

The database context.

Exceptions

ArgumentNullException

Thrown when context is null.

Methods

AddTokenInfoAsync(TokenInfo)

Adds a new token info.

public Task AddTokenInfoAsync(TokenInfo tokenInfo)

Parameters

tokenInfo TokenInfo

The token info to add.

Returns

A task representing the asynchronous operation.

GetTokenInfoByRefreshTokenAsync(String)

Gets a token info by refresh token.

public Task<TokenInfo> GetTokenInfoByRefreshTokenAsync(string refreshToken)

Parameters

refreshToken String

The refresh token to search for.

Returns

The token info if found; otherwise, null.

GetTokenInfoByUsernameAsync(String)

Gets a token info by username.

public Task<TokenInfo> GetTokenInfoByUsernameAsync(string username)

Parameters

username String

The username to search for.

Returns

The token info if found; otherwise, null.

GetTokenInfoByUsernameSync(String)

Gets the first token info for a user by username.

public TokenInfo GetTokenInfoByUsernameSync(string username)

Parameters

username String

The username to search for.

Returns

The first token info if found; otherwise, null.

SaveChangesAsync()

Saves changes to the database.

public Task SaveChangesAsync()

Returns

A task representing the asynchronous operation.

UpdateTokenInfoAsync(TokenInfo)

Updates an existing token info.

public Task UpdateTokenInfoAsync(TokenInfo tokenInfo)

Parameters

tokenInfo TokenInfo

The token info to update.

Returns

A task representing the asynchronous operation.