The result of a query cannot be enumerated more than once

后端 未结 3 1719
佛祖请我去吃肉
佛祖请我去吃肉 2020-11-27 06:53

I am using the entity framework (ef) and am getting the following error:

\"The result of a query cannot be enumerated more than once.\".

3条回答
  •  南笙
    南笙 (楼主)
    2020-11-27 07:27

    Try replacing this

    var query = context.Search(id, searchText);
    

    with

    var query = context.Search(id, searchText).tolist();
    

    and everything will work well.

提交回复
热议问题