title: How to Change the name of a primary key in EF Code First?
body: <p>I have a scenario where i would like to change the primary key name in an entity and be able to run update-database -force. See below for code and error getting when i try. </p>
  
  <p><strong>Entity was:</strong></p>
  
  <pre><code>public class Team
  {
      [Key]
      [HiddenInput(DisplayValue = false)]
      public virtual int Id { get; set; }
  
      [Display(Name = "Full Name:")]
      public virtual string Name { get; set; }
  }
  </code></pre>
  
  <p><strong>Entity Changed to:</strong></p>
  
  <pre><code>public class Team
  {
      [Key]
      [HiddenInput(DisplayValue = false)]
      public virtual int TeamId { get; set; }
  
      [Display(Name = "Full Name:")]
      public virtual string Name { get; set; }
  }
  </code></pre>
  
  <p>When i run <code>Update-database -Force</code> i get the following error.</p>
  
  <p><code>Multiple identity columns specified for table 'Teams'. Only one identity column per table is allowed.</code></p>
  
  <p>Its a matter of naming convention and i need this to be TeamId when i reference it latter, simply Id conflicts with child entity classes.</p>
  
  <p>Any ideas on how i can do this successfully?</p>