我有一类内容,它应该能够有一个parentId用于继承,但我希望它有一个子内容列表,这与这个继承树无关.
我基本上想要一个链接表作为ChildContentRelationship与Id的parentContent和childContent在其中,Content类将有一个ChildContentRelationship列表.
这导致了很多错误.
我有点想做
public class Content
{
public int Id { get; set; }
public int? ParentContentId { get; set; }
public virtual Content ParentContent { get; set; }
public string Name { get; set; }
public int ContentTypeId { get; set; }
public virtual ContentType ContentType { get; set; }
public virtual ICollection<Property> Properties { get; set; }
public virtual ICollection<ChildContentRelationship> ChildContent { get; set; }
}
Run Code Online (Sandbox Code Playgroud)
我如何在EF中设置它?
sql entity-relationship entity-framework ef-code-first entity-framework-4.1