I first designed my database in SQL Server Management Studio.
Then used code to generate the entities.
For a table (say Product) the id column (say ProductID) is not set as identity, so in entity the id property (say ProductID) has an attribute like
[DatabaseGenerated(DatabaseGeneratedOption.None)]
.
I changed it to
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
That was the only change I made to the entity.
Now I added a migration and then when I Update-Database
, it throws an error
Error Number:3728,State:1,Class:16
'PK_dbo.****' is not a constraint.
Could not drop constraint. See previous errors.
Any idea on how to achieve this?