注:これは前の質問を完全に書き直したものです。
私はモデルを持っています。
class Paragraph
{
public int Id { get; set; }
public int SectionId { get; set; }
public virtual Section Section { get; set; }
public int Major { get; set; }
public int Option { get; set; }
public ICollection<Paragraph> Options
{
get
{
// What I'm trying to return is:
//
// Section.Paragraphs
// .Where(p => p.Major == Major && p.Option != Option)
// .ToList()
}
}
}
それは関係に関与していone to many
ます。それぞれSection
に多くの がありParagraphs
ます。私が返そうとしているのMajor
は、エンティティと同じでMajor
同じでOption
はない段落のリストです。基本的。
Where(p => p.Major == Major && p.Option != Option)
これを達成する方法について何かアドバイスはありますか?ありがとうございました。