LicenseTokenRepository

Namespace: Babel.Data Assembly: Babel.Data.dll

A license token repository.

public class LicenseTokenRepository : GenericRepository<LicenseToken>, ILicenseTokenRepository, IGenericRepository<LicenseToken>

Inheritance

objectGenericRepository<LicenseToken>LicenseTokenRepository

Implements

ILicenseTokenRepository, IGenericRepository<LicenseToken>

Inherited Members

GenericRepository<LicenseToken>.Get(Expression<Func<LicenseToken, bool>>, Func<IQueryable<LicenseToken>, IOrderedQueryable<LicenseToken>>, string, string, int?, int?), GenericRepository<LicenseToken>.GetAsync(Expression<Func<LicenseToken, bool>>, Func<IQueryable<LicenseToken>, IOrderedQueryable<LicenseToken>>, string, string, int?, int?, CancellationToken), GenericRepository<LicenseToken>.QueryAsync(string, string, string, string, int?, int?, CancellationToken), GenericRepository<LicenseToken>.GetById(params object[]), GenericRepository<LicenseToken>.GetByIdAsync(params object[]), GenericRepository<LicenseToken>.GetByIdAsync(object[], CancellationToken), GenericRepository<LicenseToken>.CountAsync(Expression<Func<LicenseToken, bool>>, CancellationToken), GenericRepository<LicenseToken>.CountAsync(string, CancellationToken), GenericRepository<LicenseToken>.Insert(LicenseToken), GenericRepository<LicenseToken>.InsertAsync(LicenseToken, CancellationToken), GenericRepository<LicenseToken>.Update(LicenseToken), GenericRepository<LicenseToken>.Delete(params object[]), GenericRepository<LicenseToken>.Delete(LicenseToken), GenericRepository<LicenseToken>.Save(), GenericRepository<LicenseToken>.SaveAsync(CancellationToken), GenericRepository<LicenseToken>.DbSet, GenericRepository<LicenseToken>.Context, object.GetType(), object.MemberwiseClone(), object.ToString(), object.Equals(object?), object.Equals(object?, object?), object.ReferenceEquals(object?, object?), object.GetHashCode()

Constructors

LicenseTokenRepository(BabelDbContext)

Initializes a new instance of the class.

public LicenseTokenRepository(BabelDbContext context)

Parameters

NameDescription

The database context.

Methods

CountActiveTokensAsync(int)

Returns the number of active tokens for a given license

public Task<int> CountActiveTokensAsync(int licenseId)

Parameters

NameDescription

licenseId int

The license id

Returns

NameDescription

The number of active tokens

Delete(IEnumerable<int>)

Deletes a list of license tokens with the given primary key values.

public void Delete(IEnumerable<int> licenseTokensIds)

Parameters

NameDescription

licenseTokensIds IEnumerable<int>

The license token primary key ids to delete.

DeleteExpiredTokensAsync(int)

Delete token that have expired for a given license

public Task DeleteExpiredTokensAsync(int licenseId)

Parameters

NameDescription

licenseId int

The license id

Returns

NameDescription

InsertAsync(LicenseToken, CancellationToken)

Inserts a new entity into the database.

public override Task<EntityEntry<LicenseToken>> InsertAsync(LicenseToken licenseToken, CancellationToken cancellationToken = default)

Parameters

NameDescription

licenseToken LicenseToken

The entity to insert.

cancellationToken CancellationToken

The cancellation token.

Returns

NameDescription

The for the newly inserted entity.

QueryAsync(int, string, string, string, string, int?, int?, CancellationToken)

Asynchronously queries a list of LicenseToken objects for a given license from this repository.

public Task<List<LicenseToken>> QueryAsync(int licenseId, string select = null, string filter = null, string orderBy = null, string includeProperties = "", int? skip = null, int? take = null, CancellationToken cancellationToken = default)

Parameters

NameDescription

licenseId int

The ID of the license to retrieve tokens for.

select string

(Optional) Specifies a select expression.

filter string

(Optional) Specifies the filter expression.

orderBy string

(Optional) Order by expression.

includeProperties string

(Optional) A comma separated list of nested entity names to retrieve.

skip int?

(Optional) The number of records to skip before the first record found.

take int?

(Optional) The number of records to take after the first record found.

cancellationToken CancellationToken

(Optional) A token that allows processing to be cancelled.

Returns

NameDescription

A task that represents the asynchronous get operation, containing a list of LicenseToken objects.

Update(LicenseToken)

Updates the given license token in the repository. Begins tracking the given entity in the Modified state such that it will be updated in the database when SaveChanges() is called.

public override void Update(LicenseToken licenseToken)

Parameters

NameDescription

licenseToken LicenseToken

The license token to update.

Last updated