Entity Framework: Identity Errors
September 27, 2011 Leave a comment
If you create a table with a PK that is not identity and then create a EF class from that and then try and load in an empty value, you get a System.Data.Update exception:
If you go ahead and change the server to identity without updating EF on your client, you still get a System.Data.Update exception, but with a different inner exception:
What you need to do is to fix it by changing to identity and then updating the EF on the client:
Volia: the change will now persist
However, if you create a PK on an existing table where there used to be a Implied key, you get an error. You need to drop the table and re-create.