We have two databases. This exception gets thrown only when the connection string points to the second one and I'm doing an edit. It shouldn't be an issue with the code since it works as expected with the first database.
I've tried:
try
{
context.SaveChanges();
}
catch (OptimisticConcurrencyException)
{
context.Refresh(RefreshMode.ClientWins, db.Articles);
context.SaveChanges();
}
- Updating the entity's properties both by both mapping them one at a time and using EntityState.Modified
- https://msdn.microsoft.com/en-us/library/jj592904(v=vs.113).aspx
- Verifying all primary keys are in order