【发布时间】:2014-02-12 13:05:13
【问题描述】:
我有一个这样的实体:
public class Course
{
public int Id { get; set; }
public string Name { get; set; }
public virtual ICollection<Course> Prerequisites { get; set; }
public virtual ICollection<Course> Equivalents { get; set; }
public Course()
{
Prerequisites = new HashSet<Course>();
Equivalents = new HashSet<Course>();
}
}
我想为“先决条件”和“等效项”创建不同的表。 如何配置?
【问题讨论】:
-
那你为什么要把它们做成相同类型的课程呢?如果您希望它们在不同的表中,我认为您遇到了设计问题。
-
感谢您的回复。你能写出你的建议吗?
标签: entity-framework ef-code-first self-referencing-table