How to configure an Identity column using Entity Framework Core?

前端 未结 5 723
借酒劲吻你
借酒劲吻你 2021-01-03 19:10

How do I create an Auto increment identity column in Entity Framework Core?

Obviously I can do it using fluent API for EF6 for example.

5条回答
  •  [愿得一人]
    2021-01-03 19:46

    With latest bits EF Core 1.0 and up you should use

    builder.Entity().Property(nameof(ApplicationUser.AccountNo))
                .UseSqlServerIdentityColumn()
    

提交回复
热议问题