EF 4.1 and “Collection was modified; enumeration operation may not execute.” exception

前端 未结 4 1594
梦如初夏
梦如初夏 2020-12-09 10:27

This has been driving me nuts for the last 2 days. I have 3 pretty basic classes (well, reduced for readability)

public class Employee 
{
    public string N         


        
4条回答
  •  难免孤独
    2020-12-09 11:23

    I've just recently come across this problem myself. What I found is that EF hates indirect circular references. In your case it seems Employer should own the relationship to employee. So take out the reference back to employer from the employee class.

提交回复
热议问题