title: How to set ef core foreign key field not null?
body: <p>I have two entities in ef core,</p>
  
  <pre><code>public class Post
  {
      // ... Some properties
  
      public Guid Id { get; set; }
  
      /// &lt;summary&gt;
      /// Gets or sets post platform.
      /// &lt;/summary&gt;
      public virtual Platform Platform { get; set; }
  
  
      //... More properties
  }
  
   public class Platform
  {
      public Guid Id { get; set; }
  
      /// &lt;summary&gt;
      /// Gets or sets platform name.
      /// &lt;/summary&gt;
      public string Name { get; set; }
  
      /// &lt;summary&gt;
      /// Gets or sets platform id.
      /// &lt;/summary&gt;
      public string Version { get; set; }
  
      /// &lt;summary&gt;
      /// Gets or sets platform logo url.
      /// &lt;/summary&gt;
      public string LogoUrl { get; set; }
  }
  </code></pre>
  
  <p>and then i added migrations to database ,</p>
  
  <p>The issue is in database it has relationship from post table to platform table via <code>PlatformId</code> but that column allows null,</p>
  
  <p>Can any one point me what is the issue with this , i need to avoid nulls for this relationship.</p>
  
  <p>Thanks.<a href="https://i.stack.imgur.com/NNyj8.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/NNyj8.png" alt="enter image description here"></a></p>