LicenseRepository

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

A license repository.

public class LicenseRepository : GenericRepository<License>, ILicenseRepository, IGenericRepository<License>

Inheritance

objectGenericRepository<License>LicenseRepository

Implements

ILicenseRepository, IGenericRepository<License>

Inherited Members

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

Constructors

LicenseRepository(BabelDbContext)

Initializes a new instance of the LicenseRepository class.

public LicenseRepository(BabelDbContext context)

Parameters

NameDescription

The database context.

Methods

Delete(IEnumerable<int>)

Deletes a list of licenses with the given primary key values. Begins tracking the given entities in the Detached state such that they will be deleted in the database when SaveChanges() is called.

public void Delete(IEnumerable<int> licenseIds)

Parameters

NameDescription

licenseIds IEnumerable<int>

The license primary key ids to delete.

FindByLicenseIdAsync(string)

Find a license by its license id.

public Task<List<License>> FindByLicenseIdAsync(string licenseId)

Parameters

NameDescription

licenseId string

The license id to search for.

Returns

NameDescription

A task that represents the asynchronous get operation.

GetByIdAsync(params object[])

Asynchronously gets an entity with the given primary key values. If an entity with the given primary key values exists in the context, then it is returned immediately without making a request to the store. Otherwise, a request is made to the store for an entity with the given primary key values and this entity, if found, is attached to the context and returned. If no entity is found in the context or the store, then null is returned.

public override Task<License> GetByIdAsync(params object[] ids)

Parameters

NameDescription

ids object[]

The values of the primary key for the entity to be found.

Returns

NameDescription

A task that represents the asynchronous get operation. The task result contains the entity found, or null.

InsertAsync(License, CancellationToken)

Asynchronously inserts the given entity in the repository. Begins tracking the given entity, and any other reachable entities that are not already being tracked, in the Added state such that they will be inserted into the database when SaveChanges() is called.

public override Task<EntityEntry<License>> InsertAsync(License license, CancellationToken cancellationToken = default)

Parameters

NameDescription

license License

The entity.

cancellationToken CancellationToken

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

Returns

NameDescription

An asynchronous result that yields the insert.

Update(License)

Updates the given license 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(License license)

Parameters

NameDescription

license License

The license to update.

Last updated