UserRepository

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

A user repository.

public class UserRepository : GenericRepository<User>, IUserRepository, IGenericRepository<User>

Inheritance

objectGenericRepository<User>UserRepository

Implements

IUserRepository, IGenericRepository<User>

Inherited Members

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

Constructors

UserRepository(BabelDbContext)

Initializes a new instance of the ProductRepository class.

public UserRepository(BabelDbContext context)

Parameters

NameDescription

The database context.

Methods

CountAsync(string, string, CancellationToken)

Asynchronously returns the number of elements in the repository.

public virtual Task<int> CountAsync(string filter = null, string roles = null, CancellationToken cancellationToken = default)

Parameters

NameDescription

filter string

(Optional) Specifies the filter.

roles string

(Optional) Specifies the list of roles the use belong.

cancellationToken CancellationToken

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

Returns

NameDescription

An asynchronous result that yields the number of elements in the repository.

Delete(IEnumerable<string>)

Deletes a list of user 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<string> usersIds)

Parameters

NameDescription

The users Identifiers to delete.

GetRolesAsync()

Asynchronously gets the list of user roles.

public Task<IEnumerable<IdentityRole>> GetRolesAsync()

Returns

NameDescription

An asynchronous result that yields the user roles.

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

Asynchronously query a list of users from this repository.

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

Parameters

NameDescription

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.

roles string

(Optional) Specifies the list of roles the use belong.

cancellationToken CancellationToken

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

Returns

NameDescription

A task that represents the asynchronous get operation.

Last updated