Updating an entity twice in a transaction fails

Discussion of open issues, suggestions and bugs regarding ADO.NET provider for Oracle
Post Reply
Posts: 1
Joined: Tue 25 Jan 2011 10:20
Location: 1b408e1b-30c8-4665-98bc-568373ff4c1d

Updating an entity twice in a transaction fails

Post by marmarosi » Tue 25 Jan 2011 10:45

I use the following:

C# 4
Entity Framework 4
dotConnect for Oracle 6.00.86

I try to do something similar:

using (TransactionScope scope = new TransactionScope())
Product product = Product.GetByCode("ABC");

product.ProductName = "Jancsi és Juliska";
product = product.Save();

product.ProductName = "Piroska és a farkas";
product = product.Save();

catch (Exception ex) { }

The product object has a property product.LastChanged that is used as timestamp, that I use in concurrency handling. The first update executes succesfully and returns the new LastChanged value. The second update uses this new value in the WHERE clause, however it does not find the product record with the changed timestamp value in the transaction scope.

If I use the LastChanged property as a normal one, i.e. its value is not included in the WHERE clause, then the update produces either a transaction timeout or an ORA-01002 error.

Do you have any idea how to solve this problem?

Thanks for yor help.


Devart Team
Posts: 2919
Joined: Mon 07 Jul 2008 13:16

Post by AndreyR » Wed 26 Jan 2011 15:20

I have sent a test project that is working on my machine to the e-mail address provided in your profile.
I have created a trigger updating Timestamp field before insert, set StoreGeneratedPattern to "Computed" in the SSDL part of the model, and set the ConcurrencyMode property to "Fixed" in the CSDL part of the model.

Post Reply