The query results cannot be enumerated more than once

前端 未结 2 576
夕颜
夕颜 2020-12-21 13:29

Consider the following methods. I am getting exception as asked , while repeater binding.

Bindrepeater:

private void BindRepeater()
{
    var idx =          


        
2条回答
  •  佛祖请我去吃肉
    2020-12-21 14:01

    You may want to persist your results as a collection, not an IQueryable.

    var list = result.ToArray();
    
    itemcount = list.Length;
    return list.Skip(skip).Take(10);
    

    The above code may not be correct for paging. You likely will have to run the query twice.

提交回复
热议问题