title: How to configure One to Many relationship in Entity Framework
body: <p>I am creating API in ASP .NET Core that will retrieve posts with user Id. Post should contain text and Id of a user who posted it.</p>
  <p>I have two models Users and Posts and I need help on how to configure this relationship</p>
  <p>I want one User to have many posts</p>
  <p>Currently my user model contains</p>
  <pre><code>public class User
  {
      public int Id { get; set; }
      public string Username { get; set; }
  
      public List&lt;Post&gt; Posts { get; set; }
  }
  </code></pre>
  <p>And my Post model</p>
  <pre><code>public class Post
  {
      public int Id { get; set; }
      public string Text { get; set; }
  }
  </code></pre>
  <p>What is the best way to do this ?</p>