title: Self join not including children (entity framework 4.0)
body: <p>I am creating a sort of family tree in entity framework 4.0. I have come across an issue where the Entity Framework is only loading the immediate children. It does not load the children of the children even though i have an <code>include</code> specified.</p>
  
  <p>For example, this is my query :-</p>
  
  <pre><code>public IQueryable&lt;TreeMember&gt; GetTreeMembers(int userId)
          {
              return this.ObjectContext.TreeMembers.Include("RelatedTreeMembers").Where(u =&gt; u.UserId == userId &amp;&amp; u.RelatedTreeMemberId == null);
          }
  </code></pre>
  
  <p>This would load the 1st level of children. But it does not load the children of the children. If i have to include children of the children, i have to write :-</p>
  
  <pre><code>public IQueryable&lt;TreeMember&gt; GetTreeMembers(int userId)
          {
              return this.ObjectContext.TreeMembers.Include("RelatedTreeMembers.RelatedTreeMembers").Where(u =&gt; u.UserId == userId &amp;&amp; u.RelatedTreeMemberId == null);
          }
  </code></pre>
  
  <p>This is quickly getting to be frustrating because i don't know how many times should i have to write this <code>RelatedTreeMembers</code> as a family tree can extend upto N level. How do i get past this issue? If my question is not clear please let me know.</p>
  
  <p>Thanks in advance :)</p>