I have a unique constraint on a Navigations
table's column called Index
. I have two Navigation
entities and I want to swap their Index
values.
When I call db.SaveChanges
it throws an exception indicating that a unique constraint was violated. It seems EF is updating one value and then the other, thus violating the constraint.
Shouldn't it be updating them both in a transaction and then trying to commit once the values are sorted out and not in violation of the constraint?
Is there a way around this without using temporary values?