title: Entity Framework - Load entities with child entity
body: <p>What I am trying is to load all the A entities in the database together with B entities. The relationship between them is Every A entitiy has one B entitiy.</p>
  
  <p>The project I am working on has a repository pattern and it has an All() method as below.</p>
  
  <pre><code>    public class EFRepository&lt;T&gt; : IRepository&lt;T&gt; where T : class, IObjectWithChangeTracker
          {
  private IObjectSet&lt;T&gt; objectset;
  
          private IObjectSet&lt;T&gt; ObjectSet
          {
              get
              {
                  if (objectset == null)
                  {
                      objectset = UnitOfWork.Context.GetObjectSet&lt;T&gt;();
                  }
                  return objectset;
              }
          }
      public virtual IQueryable&lt;T&gt; All()
              {
                  return ObjectSet.AsQueryable();
              }
      }
  </code></pre>
  
  <p>Is there any way that I can force B entities to eager load. What I've found is there there is no Include method on the IQueryable that returns from the All() method. I am happy to add a new member to repositroy so it can allow the client to use eager loading. But how can I do it?</p>