public async Task <IEnumerable <TEntity> > GetAllAsync(Expression <Func <TEntity, bool> > predicate = null, params Expression <Func <TEntity, object> >[] includeProperties) { IQueryable <TEntity> query = _context.Set <TEntity>(); foreach (var includeProperty in includeProperties) { query = query.Include(includeProperty); } return(await query.Where(predicate).ToListAsync()); }
public Repository(MyLibraryDbContext context) { _context = context; _dbSet = context.Set <TEntity>(); }