I am trying to do record inserts on a table where the primary key is an Identity field.
I have tried calling mycontext.ExecuteCommand("SET identity_insert myTable ON") but this doesn't do any good.
I get an error saying that identity_insert is off when I submit changes.
How can I turn it ON from the c# code before I submit changes?
EDIT
I have read that this is because ExecuteCommand's code gets executed in a different session.
EDIT 2
Is there any way I can execute some DDL to remove the Identity Specification from my C# code, do the inserts, and then turn Identity Specification back on?