title: Cannot update identity column in Entity Framework Core since upgrading to .Net Core 3.1
body: <p>Since upgrading to .Net Core 3.1, one of my entities throws an error if I try to update it with the error 'cannot update identity column in Entity Framework Core'. This happens in the attached or the detached state.</p>
  
  <p>Here is my fluent config</p>
  
  <pre><code>modelBuilder.Entity&lt;OrderStatus&gt;(b =&gt;
              {
                  b.ToTable("OrderStatus");
                  b.HasKey(e =&gt; e.OrderStatusId);
                  b.HasKey(e =&gt; new { e.CompanyId, e.OrderId }); //CompositeKey
                  b.Property(e =&gt; e.OrderStatusId).UseIdentityColumn();
              });
  </code></pre>
  
  <p>I fetch the entity and update a value (not the OrderStatusId) and call save and thats when it blows up.</p>
  
  <pre><code>var orderStatus = _context.OrderStatus.FirstOrDefault();
  orderStatus.Total = 500;
  _context.Entry(OrderStatus).State = EntityState.Modified;
  await _context.SaveChangesAsync();
  </code></pre>
  
  <p>I came across this old thread <a href="https://stackoverflow.com/questions/39176018/cannot-update-identity-column-in-entity-framework-core/42907267">cannot update identity column in Entity Framework Core</a> which mentions a 'fix' of adding</p>
  
  <p><code>b.Property(e =&gt; e.OrderStatusId).Metadata.SetAfterSaveBehavior(PropertySaveBehavior.Ignore);</code></p>
  
  <p>This indeed does work, but I have no idea why this would be needed. This is the only Table in my application that seems to want this. </p>
  
  <p>FYI, I was previous running on EF core 3.0 and tried upgrading to 3.1.3 but this makes no difference. </p>
  
  <p>Should I be adding this to all of my fluent definitions now?</p>
  
  <p>Suggestions appreciated!</p>