I have the following code in my EF migrations Up()
method
AlterColumn("dbo.ActivityType", "Id", c => c.Int(nullable: false, identity: true));
This generates the following SQL:
ALTER TABLE [dbo].[ActivityType] ALTER COLUMN [Id] [int] NOT NULL
Which isn`t really setting my column as an identity, ideally it should drop the column and recreate it as an identity column. Any ideas on how to get around this?
It looks like this might be a limitation of the EF code migrations, as it does not handle identity columns properly. It works fine when I create a new column and mark it as identity, but seems to get confused when setting existing entities.