这段代码在小范围内展示了我的问题:
public class Person
{
public int ID { get; set; }
public string Name { get; set; }
public virtual Person Parent { get; set; }
public virtual ICollection<Person> Friends { get; set; }
}
当我在 Entity Framework (4.1) 场景中使用这个类时,系统会生成一个关系,认为 Parent 和 Friends 是同一个关系的两个方面。
我该如何表明语义上的不同,以便在 SQL Server 中生成两个不同的关系(因为我们可以看到 Friends 完全不同于 Parents :-))。
我尝试使用流畅接口,但我觉得我不知道正确的调用方法。
谢谢大家。
Andrea Bioli