I run this query:
context.Database.SqlCommand("SET IDENTITY_INSERT [Songs] ON;");
just before I do the .Add()
method from a DbSet
.
My data still is using the identity value instead of the ID that I'm supplying.
I only want this temporarily (for data migration) and then it should remain auto generated identity in the future.
I'm using SQL Server CE 4 for my database.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…