I have a question about the Behavior of Entity Framework when SaveChanges
method is executed.
I have an entity that has an Identity Column, and just realize that when if I call SaveChanges
(for a new insert), and it fails then my Identity Column in my DB is increased.
I used to have the Identity column value equals 7, and I was debugging my code and SaveChanges
method failed 5 times, because I missed to insert a required value, and when it worked out I noticed that my identity column value was now 13.
Is this a normal behavior? Is there a way to avoid increasing identity column value when Entity Framework fail to do a commit into my DB?