I am running into the following error:
Store update, insert or delete statement affected an unexpected number of rows (0). Entities may have been modified or deleted since entities were loaded. Refresh objecstatemanager entries.
Basically what is happening is as follows:
I run a method that reapplies state to my database information. And sometimes this check sets values to values that already exist and I want that. But...now it won't let me save. I was using an older version of dotconnect for MySQL and never had this problem. Recently upgraded and I'm having all sorts of issues. So you can't do this for example, I need to be able to:
using(var db = new MyContext())
{
var address = db.Addresses.FirstOrDefault(x => x.Id == Id);
address.StreetAddress = StreetAddress; // if you are assigning
address.City = City; // all of the same values
address.State = State; // as they are
address.ZipCode = ZipCode; // in the database
db.SaveChanges(); // Then this will throw that exception
}
All of the columns in the entity model have concurrency:NONE
Concurrency violation, needs to turn it off
Re: Concurrency violation, needs to turn it off
Please specify "Found Rows=true;" in your connection string and try again.
The Found Rows connection string parameter determines whether the provider will return the number of rows matched by the WHERE condition of the UPDATE statement instead of the rows actually changed as the number of changed rows.
The Found Rows connection string parameter determines whether the provider will return the number of rows matched by the WHERE condition of the UPDATE statement instead of the rows actually changed as the number of changed rows.
Re: Concurrency violation, needs to turn it off
Seems to fix the issue. Thanks.
Re: Concurrency violation, needs to turn it off
Can you please give more details on why this happes and what side effects may the using of Found Rows have ?
Re: Concurrency violation, needs to turn it off
The Found Rows connection string parameter changes the behaviour of dotConnect for MySQL in the way we described at http://forums.devart.com/viewtopic.php?t=28529#p97236 (our previous message in this thread).
If you encounter any "side effect" (incorrect or unexpected behaviour), let us know so that we could investigate the issue.
If you encounter any "side effect" (incorrect or unexpected behaviour), let us know so that we could investigate the issue.