相关疑难解决方法(0)

EF 4.1和"集合已被修改;枚举操作可能无法执行".例外

在过去的两天里,这让我疯狂.我有3个非常基本的类(好了,为了便于阅读而减少)

public class Employee 
{
    public string Name { set; get; }
    virtual public Employer Employer { set; get; }

    public Employee(string name)
    {
        this.Name = name;
    }
}
Run Code Online (Sandbox Code Playgroud)

,

// this basically ties Employee and his role in a company.
public class EmployeeRole{
    public int Id { set; get; }
    virtual public Employee Employee { set; get; }
    public string Role { set; get; }

    public EmployeeRole(Employee employee, string role){
        this.Employee = employee;
        this.Role = role;
    }
}
Run Code Online (Sandbox Code Playgroud)

和 …

c# entity-framework-4.1

15
推荐指数
2
解决办法
8838
查看次数

标签 统计

c# ×1

entity-framework-4.1 ×1