title: Entity Framework include Where
body: <p>If I have a query that looks like this:</p>
  
  <pre><code>var forms = repo.GetForms().Where(f =&gt; f.SubForms.Any(sf =&gt; sf.Classes.Any(c =&gt; c.TermId == termId)));
  </code></pre>
  
  <p>From this you can see my schema is as follows:</p>
  
  <p><code>SubForm</code> has many <code>Class</code> which has many <code>Term</code>.</p>
  
  <p>What I want:</p>
  
  <p>All <code>SubForms</code> with their <code>Classes</code> In a particular <code>Term</code>.</p>
  
  <p>What is happening now is that I get all the <code>SubForm</code> that has any <code>Class</code> in a particular <code>Term</code>. That means that <code>SubForm</code> comes back with <strong>ALL</strong> child <code>Class</code> and not just the ones related to the <code>Term</code>.</p>
  
  <p>For eg. I have 2 terms, a subform with 2 classes in each term. This query brings back 4 classes instead of the 2 in that particular term.</p>
  
  <p>Is there any <code>Include('Expression')</code> that I can use to say that I only want to include all classes based on a condition? Or is my query wrong?</p>