This works with EF5. (.net 4.5) I do not see anything wrong with your code. Are you sure that you had a sequence of methods immediately during testing? Was the source type Iqueryable or Iqueryable?
public virtual IQueryable<TPoco> GetSortedPageList<TSortKey>(Expression<Func<TPoco, bool>> predicate, Expression<Func<TPoco, TSortKey>> sortBy, bool descending, int skipRecords, int takeRecords) { if (!descending) { return Context.Set<TPoco>() .Where<TPoco> predicate) .OrderBy(sortBy) .Skip(skipRecords) .Take(takeRecords); } return Context.Set<TPoco>() .Where<TPoco>(predicate) .OrderByDescending(sortBy) .Skip(skipRecords) .Take(takeRecords); }
source share