Example #1
0
        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());
        }
Example #2
0
 public Repository(MyLibraryDbContext context)
 {
     _context = context;
     _dbSet   = context.Set <TEntity>();
 }