title: Models with List<> in them .. How does this work with Entity Framework?
body: <p>I'm new to ASP.NET, and am wondering how to create CRUD pages for a Model which has Lists of other Models ? I followed <a href="http://www.asp.net/mvc/overview/getting-started/introduction/getting-started" rel="nofollow"><strong>this tutorial</strong></a>, which creates CRUD pages for a simple scenario in which the Model has primitive data types only. So as such, the DbContext created is only for that one Model used in the tutorial. But what if I have two Models which have a One-to-Many relationship between them, such as the following scenario ?</p>
  
  <pre><code>public class Player
  {
      public string name {get; set;}
      public int age {get; set;}
      public double salary {get; set;}
      public string gender {get; set;}
      public DateTime contractSignDate {get; set;}
  }
  
  public class Team
  {
      public string teamName {get; set;}
      public string sportPlayed {get; set;}
      public List&lt;Player&gt; players {get; set;}
  }
  </code></pre>
  
  <p>If I want to create CRUD pages for the Team Model, the DbContext I make for it refers to that Model only. In fact, VS2013's scaffolding engine doesn't even both with the <code>players</code> List and simply ignores it outright.</p>
  
  <p>How to solve this ?</p>
  
  <p>This is the DbContext I made for the Team Model:</p>
  
  <pre><code>public class TeamDBContext : DbContext
  {
      public DbSet&lt;Team&gt; Teams { get; set; }
  }
  </code></pre>