I am trying to do record inserts on a table where the Primary Key is an Identity field.
Identity
I have tried calling mycontext.ExecuteCommand("S
mycontext.ExecuteCommand("S
It should be enough to open the connection manually before executing commands. This makes the commands run in the same session:
context.Connection.Open(); context.ExecuteCommand("SET IDENTITY_INSERT MyTable ON"); // make changes // ... context.SubmitChanges();