Document
、、、の3つのモデルがSection
ありParagraph
ます。それぞれがこのように見えます。
// Document
public class Document
{
public int Id { get; set; }
public string Name { get; set; }
public virtual ICollection<Section> Sections { get; set; }
}
// Section
public class Section
{
public int Id { get; set; }
public int DocumentId { get; set; }
public virtual Document Document { get; set; }
public virtual ICollection<Paragraph> Paragraphs { get; set; }
}
// Paragraph
public class Paragraph
{
public int Id { get; set; }
public int SectionId { get; set; }
public virtual Section Section { get; set; }
}
Section.Paragraphs
エンティティは、。のすべての段落を自動的に入力しSectionId == Id
ます。ただし、これは発生していませんDocument.Sections
。、がnullDocument.Sections
であるすべてのセクションが入力される代わりに、ああ!DocumentId == id
Document.Sections