title: Lazy loading does not work in entity framework 5
body: <p>I have defined a (poco?) class in my domain project:</p>
  
  <pre><code>public class Club
  {
     public Club()
     {
        ContactPersons = new HashSet&lt;ContactPerson&gt;();
     }
  
     public int Id { get; set; }
  
     [Required]
     [StringLength(64)]
     public string Name { get; set; }
  
     public virtual ICollection&lt;ContactPerson&gt; ContactPersons { get; set; }
  }
  
  public class ContactPerson
  {
       public virtual int Id { get; set; }
  
       [StringLength(64)]
       public virtual string FirstName { get; set; }
  
       [StringLength(64)]
       public virtual string LastName { get; set; }
   }
  </code></pre>
  
  <p>In my MVC project I have my clubcontroller:</p>
  
  <pre><code>   public ActionResult Create(CreateClubViewModel model)
     {
        Club club = new Club();
        model.Initialize(club);
        IClubDb clubDb = DependencyResolverHelper.IClubDbService;
        clubDb.Create(club);  // create club in db
     }
  
      public ActionResult Display(string domain)
      {
          try
          {
              IClubDb clubDb = DependencyResolverHelper.IClubDbService;
              Club club = clubDb.Get(domain);
              return View(club);
          }
          catch (Exception)  // user is not logged iin
          {
              return View();
          }
      }
  </code></pre>
  
  <p>Finally, in my DB project I create and retrieve the club, </p>
  
  <pre><code>public Club Get(string name)
  {
     return DataContext.Clubs
     //.Include(x =&gt; x.ContactPersons)
     .Single(r =&gt; r.Name == name);
  }
  
   public int Create(Club club)
   {
           DataContext.Clubs.Add(club);
           return DataContext.SaveChanges();
   }
  </code></pre>
  
  <p>I have tried everything to get EF to lazy load the ContactPersons of my club object when I call the Get club in the Display method but ContactPersons has always a length of zero. However, if I eager load contact persons using the .include (I have commented this part out), then obviously ContactPersons contains a number of contacts.</p>
  
  <p>I am not sure what I am doing wrong:</p>
  
  <ol>
  <li>I have followed the guidelines for defining poco classes: <a href="http://msdn.microsoft.com/en-us/library/dd468057.aspx" rel="nofollow">http://msdn.microsoft.com/en-us/library/dd468057.aspx</a></li>
  <li>I have a public parameter less constructor (but not protected constructor)</li>
  <li>I have lazyloading enabled</li>
  </ol>
  
  <p>I think I am missing a concept, the poco club class is also my domain entity which I insert into DB. What am I doing wrong? Whay I can't get lazy loading to work?</p>