Entity Framework Code First: how to map multiple self-referencing many-to-many relationships
- 阅读更多 关于 Entity Framework Code First: how to map multiple self-referencing many-to-many relationships
I have created an entity type that has multiple collection properties that reference items of the same type. In other words, it reflects a single database table in which the rows are arbitrarily grouped, such that a row may appear in multiple groups. In the following simplified example, the Person class has Brothers and Sisters collection properties that also reference Person entities: public class Person { public Person() { Brothers = new Collection<Person>(); Sisters = new Collection<Person>(); } [Key] public string Name { get; set; } public int Age { get; set; } public virtual ICollection