title: How to include a child object's child object in Entity Framework 5
body: <p>I am using <code>Entity Framework 5 code first</code> and <code>ASP.NET MVC 3</code>.</p>
  
  <p>I am struggling to get a child object's child object to populate.  Below are my classes..</p>
  
  <p>Application class;</p>
  
  <pre><code>public class Application
  {
       // Partial list of properties
  
       public virtual ICollection&lt;Child&gt; Children { get; set; }
  }
  </code></pre>
  
  <p>Child class:</p>
  
  <pre><code>public class Child
  {
       // Partial list of properties
  
       public int ChildRelationshipTypeId { get; set; }
  
       public virtual ChildRelationshipType ChildRelationshipType { get; set; }
  }
  </code></pre>
  
  <p>ChildRelationshipType class:</p>
  
  <pre><code>public class ChildRelationshipType
  {
       public int Id { get; set; }
  
       public string Name { get; set; }
  }
  </code></pre>
  
  <p>Part of GetAll method in the repository to return all the applications:</p>
  
  <pre><code>return DatabaseContext.Applications
       .Include("Children");
  </code></pre>
  
  <p>The Child class contains a reference to the ChildRelationshipType class.  To work with an application's children I would have something like this:</p>
  
  <pre><code>foreach (Child child in application.Children)
  {
       string childName = child.ChildRelationshipType.Name;
  }
  </code></pre>
  
  <p>I get an error here that the object context is already closed.</p>
  
  <p>How do I specify that each child object must include the <code>ChildRelationshipType</code> object like what I did above?</p>