The query results cannot be enumerated more than once?

前端 未结 4 2001
广开言路
广开言路 2020-12-15 22:49

I\'m using LINQ to SQL to get a search result of a FullTextSearch stored procedure in Sql server 2008. I dragged the procedure from the server explorer to the designer, and

4条回答
  •  别那么骄傲
    2020-12-15 23:33

    What you can do is add a ToList() call after repository.FullTextSearch(searchText). This way, the results are retrieved from the server, after which you can do with them whatever you want (since they are now loaded in-memory).

    What you are trying to do now is run the same SQL query twice, which is rather inefficient.

提交回复
热议问题