Email: Password:       Forgot Password 
    .netCodeSG
A Saarsha Group Online Community for dot net codes group like C#, Asp.NET, VB.NET, Sharepoint, JavaScript, JQuery, Ajax, SQL, WCF, WPF.
 
TECHNOLOGIES:
 

Entity Framework - The result of a query cannot be enumerated more than once

Article:
Viewed:  1058 
Posted On:  01/08/2015 04:35:19 
While working with Entity Framework: The result of a query cannot be enumerated more than once. 

 

While using Stored Procedure with Entity Framework if you get below error Message:

1.png

Image 1.

It simply means: Try explicitly enumerating the results by calling ToList().

Replace Your Code From

foreach (var item in query)

To #:

foreach (var item in query.ToList())

  Comment:
         HOME   |   Submit Article   |   Contact Us   |   About Us   |   Terms & Condition   |   Advertise With us