问题
In my application I do the following
Read from database: I Fetch items from database (In parallel, with context per each Task).
Write to database: I Create a new Context and for each fetched item, I attach it to that new
contextI defined an Interceptor because I don't want that the EF will save the changes (I need to do it by myself, later, because of performance)
The problem - after I call SaveChanges() method, the Interceptor being invoked and I have the SQL statement and it's OK. BUT, after the code is executed in the Interceptor side, there is an exception on the Context.SaveChanges() method. Saying that: "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 ObjectStateManager entries."
anyone can help me solve this issue ?
thanks.
Hagai
来源:https://stackoverflow.com/questions/27437630/entity-framework-6-1-0-get-an-error-while-using-command-interceptor