我正在尝试在 EF 4.3 中创建这三个模型:
- Family
- Guid FamilyId
- ICollection< Person> Members
- Company
- Guid CompanyId
- ICollection< Person> Employees
- Person
- Guid PersonId
- String Name
A person can belong to multiple families and multiple companies, as well as doesn't belong to any.
运行代码后,数据库中的映射似乎有点奇怪。未映射家庭成员和公司员工。此外,Persons 表中有四列:PersonId、Name、Family_FamilyId 和 Company_CompanyId。
我认为我的代码意味着一个人将永远属于 1 个家庭和 1 个公司。我应该如何更改代码?