title: Using LINQ to query three entitites. - Include path expression must refer to a navigation property defined on the type
body: <p>I am trying to get data from 3 entities. Exam, Objective and Objective detail. I want to be able to select this by exam name. Here is the code I am using:</p>
  
  <pre><code>        var result = await db.Exams
              .Include(e =&gt; e.Objectives)
              .Include(e =&gt; e.Objectives.SelectMany(o =&gt; o.ObjectiveDetails))
              .Where(e =&gt; e.Name == name)
              .FirstOrDefaultAsync();
  </code></pre>
  
  <p>This is giving me an error message when I run it saying:</p>
  
  <blockquote>
    <p>exceptionMessage=The Include path expression must refer to a
    navigation property defined on the type. Use dotted paths for
    reference navigation properties and the Select operator for collection
    navigation properties. Parameter name: path</p>
  </blockquote>
  
  <p>Can someone advise me what I am doing wrong. Here's my classes:</p>
  
  <pre><code>public class Exam
  {
      public Exam()
      {
          this.Objectives = new HashSet&lt;Objective&gt;();
      }
      public int ExamId { get; set; }
      public int SubjectId { get; set; }
      public virtual ICollection&lt;Objective&gt; Objectives { get; set; }
  }
  
  public class Objective : AuditableTable
  {
      public Objective()
      {
          this.ObjectiveDetails = new HashSet&lt;ObjectiveDetail&gt;();
      }
      public int ObjectiveId { get; set; }
      public int ExamId { get; set; }
      public int Number { get; set; }
      public virtual Exam Exam { get; set; }
      public virtual ICollection&lt;ObjectiveDetail&gt; ObjectiveDetails { get; set; }
  
  }
  
  public partial class ObjectiveDetail
  {
      public int ObjectiveDetailId { get; set; }
      public int ObjectiveId { get; set; }
      public int Number { get; set; }
      public string Text { get; set; }
      public virtual Objective Objective { get; set; }
  }
  </code></pre>