The method 'Skip' is only supported for sorted input in LINQ to Entities. The method 'OrderBy' must be called before the method 'Skip'

情到浓时终转凉″ 提交于 2019-12-05 02:51:28

You must call .OrderBy' on your query if you use the .Skip method. For example if you were using something similar to the following:

results = results.Skip(pageNumber * size).Take(size);

In the case above you would have previously had to use the .OrderBy to order the query if you are planning on using paging methods or something of the like. If you have an Id field, adding this onto your original query expression should eliminate the error:

.OrderBy(x => x.Id);

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!