refactor(DbRepository): implement create method for dtros
This commit is contained in:
parent
173c4fdbc4
commit
f544ea4887
@ -35,6 +35,11 @@ public class DbRepository<TDbContext, TEntity> : IRepository<TEntity> where TDbC
|
|||||||
return entities;
|
return entities;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Task<TEntity> CreateAsync<TDto>(TDto dto, CancellationToken cancel = default) => CreateAsync(Mapper.Map<TEntity>(dto), cancel);
|
||||||
|
|
||||||
|
public Task<IEnumerable<TEntity>> CreateAsync<TDto>(IEnumerable<TDto> dtos, CancellationToken cancel = default)
|
||||||
|
=> CreateAsync(Mapper.Map<IEnumerable<TEntity>>(dtos), cancel);
|
||||||
|
|
||||||
public IQueryable<TEntity> Where(Expression<Func<TEntity, bool>> expression) => Entities.AsNoTracking().Where(expression);
|
public IQueryable<TEntity> Where(Expression<Func<TEntity, bool>> expression) => Entities.AsNoTracking().Where(expression);
|
||||||
|
|
||||||
public IEnumerable<TEntity> GetAll() => Entities.AsNoTracking().ToList();
|
public IEnumerable<TEntity> GetAll() => Entities.AsNoTracking().ToList();
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user