I\'m creating a rewrite of an existing application in EF Code First, but I need to import some of the data from the existing application\'s database. Here\'s the definition
You can't. Executing a set identity_insert command changes the behavior of SQL Server, but not the behavior of Entity Framework.
You have three choices for importing records:
ExecuteSqlCommand.DbContext, in which you define the keys as non-generated.