Title: Error: The query results cannot be enumerated more than once
Details: Ever tried using Linq DataContext model ( using the dbml file ) and try iterating from the return type ISingleResult ? If so, you might have got the error for sure. So, the simple way to do it is to obtain the results to a generic list as shown below.
Code: Consider that GetUserDetails returns a ISingleResult generic list type of GetUserDetailsResult
Details: Ever tried using Linq DataContext model ( using the dbml file ) and try iterating from the return type ISingleResult ? If so, you might have got the error for sure. So, the simple way to do it is to obtain the results to a generic list as shown below.
Code: Consider that GetUserDetails returns a ISingleResult generic list type of GetUserDetailsResult
List<GetUserDetailsResult> results = GetUserDetails().ToList();
foreach (GetUserDetailsResult result in results)
{
// Write your code here...
}
Comments