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:
I remember when I used to do EF I would create a table with Identity and in the class I would attribute the id column with
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
so I am assuming that your code should be
modelBuilder.Entity<MyBase>()
.Property(c => c.Id)
.HasDatabaseGeneratedOption(DatabaseGeneratedOption.Identity);
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.