The method 'Skip' is only supported for sorted input in LINQ to Entities

前端 未结 4 1105
暖寄归人
暖寄归人 2021-02-12 10:18

What could be causing this problem?

public ActionResult Index(int page = 0)
{
    const int pageSize = 3;
    var areas = repo.FindAllAreas();
    var paginatedA         


        
4条回答
  •  故里飘歌
    2021-02-12 10:34

    An IQueryable does not have an order, so saying "ignore the next x elements" doesn't make any sense.

    If you include an order by clause (or possibly an AsEnumerable() call - untested) then your data takes an order and Skip and Take are now sensible.

提交回复
热议问题