title: Using IList, List, ICollection for 1 to n relationships in EF Core
body: <p>What is the best practice to define a One-to-Many relationship in EF Core?</p>
  
  <p>Is it recommended to generally use lists, as these offer more functionalities? 
  Then rather the interface IList instead of List, as it does not define the implementation?
  If it does matter, on what criteria should I pick one or the other?</p>
  
  <p>Microsoft suggests the following
  <a href="https://docs.microsoft.com/en-us/ef/core/modeling/relationships" rel="noreferrer">https://docs.microsoft.com/en-us/ef/core/modeling/relationships</a></p>
  
  <pre><code>public class Blog
  {
      public int BlogId { get; set; }
      public List&lt;Post&gt; Posts { get; set; }
  }
  
  public class Post
  {
      public int PostId { get; set; }
      public int BlogId { get; set; }
      public Blog Blog { get; set; }
  }
  </code></pre>
  
  <p>Whereas </p>
  
  <p><a href="http://www.entityframeworktutorial.net/efcore/configure-one-to-many-relationship-using-fluent-api-in-ef-core.aspx" rel="noreferrer">http://www.entityframeworktutorial.net/efcore/configure-one-to-many-relationship-using-fluent-api-in-ef-core.aspx</a></p>
  
  <p><a href="https://www.learnentityframeworkcore.com/configuration/one-to-many-relationship-configuration" rel="noreferrer">https://www.learnentityframeworkcore.com/configuration/one-to-many-relationship-configuration</a>
  suggest ICollections</p>
  
  <p>Is the following answer of 2011 still valid in EF Core?</p>
  
  <p><a href="https://stackoverflow.com/a/7655974/10148774">https://stackoverflow.com/a/7655974/10148774</a></p>