title: Unable to track an entity of type 'Entity' because its primary key property 'Id' is null
body: <pre><code>public clase Book
  {
    [Key]
    public string Id{get;set;}
    public string Name{get;set;}
    ...
  }
  _dbContext.Books.Add(new Entity(){
     Name=&quot;C#10.0&quot;,
     ....
  })
  _dbContext.SaveChanges()
  </code></pre>
  <p>Exception message:
  System.InvalidOperationException: Unable to track an entity of type 'Book' because its primary key property 'Id' is null.</p>
  <p>at Microsoft.EntityFrameworkCore.ChangeTracking.Internal.NullableKeyIdentityMap`1.Add(InternalEntityEntry entry)
  at Microsoft.EntityFrameworkCore.ChangeTracking.Internal.StateManager.StartTracking(InternalEntityEntry entry)
  at Microsoft.EntityFrameworkCore.ChangeTracking.Internal.InternalEntityEntry.SetEntityState(EntityState oldState, EntityState newState, Boolean acceptChanges, Boolean modifyProperties)</p>
  <pre><code>When I use this DatabaseGeneratedAttribte, after assigning a value to the primary key in the application, call &quot;SaveChanges()&quot; an exception will be thrown and the trace will be modified.
  </code></pre>
  <p>I expect this value to prevail after assigning a value to the primary key. If it is not assigned, the value can be automatically generated.</p>