Call SP in EF 4.0 in following code:
public IQueryable<Employee> GetEmployeesByFollowup()
{
var results = from p in this.ObjectContext.SearchEmployeeFollowup()
select p;
foreach (Employee p in results)
{
p.DepaermentReference.Load();
}
return results.AsQueryable<Employee>();
}
Following error caused in For loop:
"The result of a query cannot be enumerated more than once."} System.SystemException {System.InvalidOperationException}
It seems it's working fine for sometime. Don't undertstand why.