Linq Include not loading List
<p>I've been for a while trying to find out why the <code>Include</code> clause is not loading the related collection: I have two classes with a one-to-many relationship:</p>

<pre><code> public class AgencyNote : IAutId
    {
        [Key]
        public int aut_id { get; set; }
        public string Comment { get; set; }
        [DisplayName("Note Created Date")]
        public DateTime NoteDate { get; set; }
        [DisplayName("Contact Date")]
        public DateTime ContactDate { get; set; }
        [ForeignKey("tbl_agency")]        
        public int AgencyId { get; set; }
        [DisplayName("User")]
        public string RipsUser { get; set; }        
        public virtual ICollection&lt;AgencyNoteAttachment&gt; AgencyNoteAttachments { get; set; }
        public virtual tbl_agency tbl_agency { get; set; }
    }
</code></pre>

<p>and</p>

<pre><code> public class AgencyNoteAttachment
    {        
        [Key]
        public int aut_id { get; set; }
        public string Url { get; set; }
        public string FileName { get; set; }        
        public int AgencyNoteId { get; set; }
        [NotMapped]        
        [ForeignKey("AgencyNoteId")]
        public virtual AgencyNote AgencyNote { get; set; }        
    }
</code></pre>

<p>Context class:</p>

<pre><code>public DbSet&lt;AgencyNote&gt; AgencyNotes { get; set; } 

public DbSet&lt;AgencyNoteAttachment&gt; AgencyNoteAttachments { get; set; } 
</code></pre>

<p>This is the action where I'm using the <code>Include</code> clause:</p>

<pre><code>private IQueryable&lt;AgencyNote&gt; GetNotes(int agencyId)
{                
  return _ctx.AgencyNotes
    .Include(a =&gt; a.tbl_agency)
    .Include(a =&gt; a.AgencyNoteAttachments)
    .OrderByDescending(f =&gt; f.NoteDate)
    .Where(x =&gt; x.AgencyId == agencyId);   
}
</code></pre>

<p>I'm getting <code>AgencyNotesAttachments</code> always <code>null</code> from this action even if I know it's not null, what's going on? Any question let me know...</p>