title: EF Core ForeignKey attribute - how to make it nullable
body: <p>I'm using EF Core to create a &quot;MenuItem&quot; table, which may be linked to a parent (of &quot;MenuItem&quot;) like so ...</p>
  <pre><code>public class MenuItem
  {
      public int MenuItemId { get; set; }
  
      [ForeignKey(&quot;ParentMenuItemId&quot;)]
      public virtual MenuItem Parent { get; set; }
  }
  </code></pre>
  <p>ParentMenuItemId gets created as NOT NULL - how can I define it so Parent may be null (for root level MenuItem records)?</p>