I'm trying to create a generic paging method, I tried to do as the code below, however when using Skip
I need to have a orderby
and I'm not sure how to do it.
public IQueryable<TEntity> GetPaginacao(int PageStart, int PageSize)
{
return Db.Set<TEntity>()
.Take(PageSize)
.Skip(PageStart * PageSize)
.AsNoTracking();
}
Error:
The method 'OrderBy' should be called before the 'Skip' method