I use the following:
C# 4
Entity Framework 4
CSLA 4
dotConnect for Oracle 6.00.86
I try to do something similar:
try
{
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();
scope.Complete();
}
}
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.
Jozsef
Updating an entity twice in a transaction fails
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.
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.