I am using the entity framework (ef) and am getting the following error:
\"The result of a query cannot be enumerated more than once.\".
Try explicitly enumerating the results by calling ToList().
ToList()
Change
foreach (var item in query)
to
foreach (var item in query.ToList())