title: How to name a foreign key in Entity Framework Core
body: <p>It seems that Entity Framework Core doesn't respect the custom name of the foreign key I specified as property attribute. I'm a bit concerned because I thought it initially worked..</p>
  <p>1-to-many relation between <code>CollectionModel</code> and <code>ItemModel</code> (over-simplified example):</p>
  <pre><code>[Table(&quot;Collections&quot;)]
  public class CollectionModel
  {
      [Key]
      public int Id { get; set; }
      
      public string name {get; set; }
      
      public List&lt;ItemModel&gt; Items { get; set; }
  }
  
  [Table(&quot;Items&quot;)]
  public class ItemModel
  {
      [Key]
      public int Id { get; set; }
      
      [ForeignKey(&quot;FK_Item_CollectionId&quot;)] // No sure if it actually respects the convention..
      public int CollectionId { get; set; }
  }
  </code></pre>
  <p>Basically, it corresponds to this <a href="https://entityframework.net/foreign-key" rel="nofollow noreferrer">exampel</a> (Entity Framework 6 though). I've already came across some stackoverflow threads which some Fluent API use, but would prefer avoiding them (ie I got some other issues..) When I migrate the domain (which is in a separate project from the Entity Framework one) I get the following name <code>FK_Items_Collections_ItemModelId</code> which is a bit too long.</p>
  <p>Am I missing something?</p>
  <p>Thanks for any insights.</p>