Skip to Main Content

ODP.NET

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

EntityFramework and Optimistic Concurrency detection

Andrew HarryJan 4 2017 — edited Jan 5 2017

I'm having an issue with Oracle 12c and EF6.  I have setup the entity to use optimistic concurrency detection on a field which is updated via store procedure.

In production we were seeing some strange behaviour, and on further digging I detected the concurrency detection was failing silently.

If the entity was changed on the database, my update would correctly not work (row versions mismatch in where clause)

BUT then entity framework would report that the update had succeeded. 

Upon further digging, oracle is reporting 1 row changed instead of reporting 0 row changes.

Entity framework interprets this as success.  In reality, the row is not changed because the row_versions are different.

Reproduction of the issue on github https://github.com/Certegy/Concurrency/

My Stackoverflow question - hopefully someone somewhere can help with this issue.

I attached a EF Profiler to see what was going over the wire (see below) this script when run manually reports an error regarding the open '' for select bit

declare
  
"ROW_VERSION" number(10,0);
  
"ROWID" char(18);
begin
update
  
"DB"."TEST"
  
set "NAME" = 'John Smith'
where (("ID" = 1) and ("ROW_VERSION" = 1))  
returning
"ROW_VERSION",
  
"ROWID" into
"ROW_VERSION",
  
"ROWID";
open
'' /* :p4 */ for select

"ROW_VERSION" as "ROW_VERSION",
  
"ROWID" as "ROWID"
from dual;
end;

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Feb 2 2017
Added on Jan 4 2017
5 comments
519 views