title: How to implement Entity Framework Code First join
body: <p>I'm starting to use Entity Framework Code First. </p>
  
  <p>Suppose to have such POCO's (ultimately simplified): </p>
  
  <pre><code>public class BortStructure
  {
     public Guid Id { get; set; }
     public String Name { get; set; }
  }
  
  public class Slot
  {
     public Guid Id { get; set; }
     public String Name { get; set; }
     public BortStructure { get; set; }
  }
  
  public class SystemType
  {
     public Guid Id { get; set; }
     public String Name {get; set; }
  }
  
  public class SlotSystemType
  {
     public Guid Id { get; set; }
     public Slot Slot { get; set; }
     public SystemType SystemType {get; set; }
  }
  </code></pre>
  
  <p>and a context</p>
  
  <pre><code>public MyContext : DbContext
  {
     public DbSet&lt;BortStructure&gt; BortStructures { get; set; }
     public DbSet&lt;Slot&gt; Slots{ get; set; }
     public DbSet&lt;SystemType&gt; SystemTypes { get; set; }
     public DbSet&lt;SlotSystemType&gt; SlotSystemTypes { get; set; }
  }
  </code></pre>
  
  <p>I have a task to get BortStructure by Id with list of attached Slots, each one with list of systemTypes attached.</p>
  
  <p>Using SQL allowed me to do that with some JOIN's:</p>
  
  <pre><code>SELECT BortStructures.Id, BortStructures.Name, Slots.Id, 
  Slots.Name, SystemType.Id, SystemType.Name FROM
  ((BortStructures LEFT JOIN Slots ON BortStructures.Id = Slots.BortStructureId)
  LEFT JOIN SlotSystemTypes ON SlotSystemTypes.SlotId = Slots.Id)
  LEFT JOIN SystemTypes ON SystemTypes.Id = SlotSystemTypes.SystemTypeId
  WHERE BortStructures.Id='XXXXXX' ORDER BY Slots.Id, SystemType.Id
  </code></pre>
  
  <p>But with Entity Framework Code First I don't have any idea howto do that.</p>
  
  <p>If I use</p>
  
  <pre><code>var slotSystemTypes = from sl in MyContext.SlotSystemTypes
  where sl.Slot.BortStructure.Id = XXXXXX
  orderby sl.Slot.Id, sl.SystemType.Id
  select sl;
  </code></pre>
  
  <p>i, of course, will receive nothing if BortStructure consists of no Slots/Slots without any SystemTypes attached. </p>
  
  <p>Instead of getting BortStructure with empty list of Slots/with Slots, each one with empty list of SystemTypes attached as I expect to get.</p>
  
  <p>Is there any way to archive that with <strong>single</strong> LINQ query for my database configuration?</p>