我有一个名为Content的类,它应该能够具有parentId以进行继承,但我还希望它具有与此继承树无关的子内容列表。
我基本上想要一个名为ChildContentRelationship的链接表,在其中具有父Content和子Content的Id,并且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; }
}
我该如何在EF中设置这个?