Answer the question
In order to leave comments, you need to log in
Why is the wrong ID inserted in EFCore?
Good evening. Again I write a question, because no one let me know the reason for that.
Up to a certain point, everything goes fine. But then out of nowhere, even if you set the value to 0 in advance, it exits because on the image
The program crashes with the error "Cannot insert an explicit value for the identity column in the table \"Deals\" when the IDENTITY_INSERT parameter is OFF."
The code for pastbin
48 is an ID, which should generally be equal to zero, and the second 48 should be -2 plus million
Answer the question
In order to leave comments, you need to log in
Before line 213 put
db.Database.ExecuteSqlCommand("SET IDENTITY_INSERT dbo.Deals ON");
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question