cannot update identity column in Entity Framework Core

前端 未结 7 762
感情败类
感情败类 2021-01-04 00:52

I\'ve added a separate Identification to the AspNetUsers table called NumericId that will serve along with the GUID like ID that ASP has for default.

I\'ve added the

7条回答
  •  情歌与酒
    2021-01-04 01:25

    This was a bug with EF Core 1.0. See EF trying to Insert into Identity field.

    EF Core 1.2 has marked the issue as fixed, but the workaround without updating is to use

    modelBuilder.Entity().Property(u => u.Property).UseSqlServerIdentityColumn();
    

提交回复
热议问题