title: Why are my Entity Framework POCOs not loading the related entities correctly?
body: <p>I have a code first model:</p>
  
  <pre><code>namespace InternetComicsDatabase.Models
  {
      public class Issue
      {
          [Key]
          public int      IssueId     { get; set; }
          public int      Number      { get; set; }
          public string   Title       { get; set; }
          public DateTime Date        { get; set; }
  
          public virtual ICollection&lt;Creator&gt; Creators { get; set; }
      }
  
      public class Creator
      {
          [Key]
          public int      CreatorId   { get; set; }
          public string   FirstName   { get; set; }
          public string   MiddleName  { get; set; }
          public string   LastName    { get; set; }
  
          public virtual ICollection&lt;Issue&gt; Issues { get; set; }
      }
  
      public class Icbd : DbContext
      {
          public DbSet&lt;Issue&gt; Issues { get; set; }
          public DbSet&lt;Creator&gt; Creators { get; set; }
      }
  }
  </code></pre>
  
  <p>In the controller, I am trying to load all the <code>Creators</code> that are associated with a particular issue:</p>
  
  <pre><code>    public string CreatorTest()
      {
          string output = "";
          var issue = db.Issues.Where(x =&gt; x.IssueId == 8);
          foreach (var item in issue.Creators)
              output += item.FirstName;
          return output;
      }
  </code></pre>
  
  <p>But this won't compile... Why won't this compile?</p>
  
  <p>Specifically; the line that says:</p>
  
  <pre><code>        foreach (var item in issue.Creators)
  </code></pre>
  
  <p>won't compile because of an error that says:</p>
  
  <pre><code>Error   1   'System.Linq.IQueryable&lt;InternetComicsDatabase.Models.Issue&gt;' does not contain a definition for 'Creators' and no extension method 'Creators' accepting a first argument of type 'System.Linq.IQueryable&lt;InternetComicsDatabase.Models.Issue&gt;' could be found (are you missing a using directive or an assembly reference?) C:\Users\dropstuff\asp.net mvc\InternetComicsDatabase\InternetComicsDatabase\Controllers\HomeController.cs  19  31  InternetComicsDatabase
  </code></pre>
  
  <p>What's up with that? :-)</p>
  
  <p>I went back and doublechecked my controller (you can just scroll up) and, yep; there it is! <code>Creators</code> <b>is</b> a property of <code>Issues</code>. So what gives? Maybe it has something to do with lazy loading? </p>