public virtual List <TEntity> GetByIdList <TEntity>(List <int> idList, DbSet <TEntity> entities = null) where TEntity : class, new() { entities = entities ?? GetDbSet <TEntity>(); Expression <Func <TEntity, bool> > predicate = PageHelper.GetPredicateByIdList <TEntity>(idList); List <TEntity> entityList = entities.Where(predicate).ToList(); return(entityList); }
public virtual async Task <List <TEntity> > GetByIdListAsync <TEntity>(List <int> idList, IQueryable <TEntity> entities = null) where TEntity : class, new() { entities = entities ?? GetDbSet <TEntity>(); Expression <Func <TEntity, bool> > predicate = PageHelper.GetPredicateByIdList <TEntity>(idList); List <TEntity> entityList = await entities.Where(predicate).ToListAsync(); return(entityList); }