EF6 CodeFirst My [Key] Id Column is not auto-incrementing as an identity column should

后端 未结 2 1006
星月不相逢
星月不相逢 2020-12-31 04:25

I have several classes that I need to derive from a common base class which holds an Id. Ignoring the all but one of these for the moment, let\'s say we have:



        
2条回答
  •  野趣味
    野趣味 (楼主)
    2020-12-31 05:20

    I believe the problem lies in the fact you are using EF6 Code First Migrations. When you are doing so you need to seed your DB using the .AddOrUpdate() method. This Stack Overflow Question covers it.

提交回复
热议问题