title: Entity framework query to include child entities of entity collection
body: <p>I have a <code>ticket</code> entity that has <code>ticketNotes</code> (0 to many) and would like to pull back the user details for who created each note when I query tickets.</p>
  
  <p>I use the following code to query a ticket         </p>
  
  <pre><code>var ticket = (from t in context.Tickets
  .Include(t=&gt;t.Site)
  .Include(t=&gt;t.Caller)
  .Include(t=&gt;t.Caller.Site)
  .Include(t =&gt; t.Notes)
  .Include(t=&gt;t.OpenedByUser)
  select t).First(t =&gt; t.TicketId == ticketId);
  </code></pre>
  
  <p>My <code>TicketNote</code> Class is:</p>
  
  <pre><code>public class TicketNote
  {
      public Guid TicketNoteId { get; set; }
      public string NoteText { get; set; }
      public DateTime CreatedTime { get; set; }
      public Guid TicketId { get; set; }
      public virtual Ticket Ticket { get; set; }
      public bool ReadOnly { get; set; }
      public DateTime? DateTimeDeleted { get; set; }
      public Guid TenantId { get; set; }
  
      [Required]
      [DefaultValue(typeof(Guid), "00000000-0000-0000-0000-000000000000")]
      public Guid CreatedByUserId { get; set; }
      [ForeignKey("CreatedByUserId")]
      public virtual User CreatedByUser { get; set; }
   }
  </code></pre>
  
  <p>I would like to add</p>
  
  <p><code>.Include(t =&gt; t.Notes.CreatedByUser)</code></p>
  
  <p>However as notes is a collection I don't get the option.</p>
  
  <p>Please advise the best approach to achieve pulling back the CreatedByUser which is NULL at the moment.</p>
  
  <p>Thanks</p>