Pessimistic locking with RepeatableRead ?

Pessimistic locking with RepeatableRead ?

Postby mer » Thu 25 Aug 2011 09:28

I tried the following, to enforce pessimistic locking:

Code: Select all
List orderLineIds = new List { 1441932, 1441933, 1441934, 1441935 };
using (TgwWcsDataContext dataContext = DataContextFactory.GetDataContext(this, true))  {
  using (TransactionScope ts = new TransactionScope(TransactionScopeOption.Required,
          new TransactionOptions() { IsolationLevel = System.Transactions.IsolationLevel.RepeatableRead}))
    {
       IQueryable existingOrderLines = from ol in dataContext.Orderlines
                                                               where orderLineIds.Contains(ol.OrderlineId)
                                                               select ol;
       foreach (Orderline existingOrderLine in existingOrderLines.ToList())
                    {
                        existingOrderLine.ChangedOn = DateTime.Now;
                        dataContext.SubmitChanges();
                    }
      ts.Complete();
      }
   }


I expectet, that this generates a select for update in oracle, but the "for update"-Clause is missing. What is going wrong ?

I am using Devart.Data.Oracle,Version=5.70.170.0.
mer
 
Posts: 1
Joined: Thu 25 Aug 2011 08:11

Postby StanislavK » Tue 30 Aug 2011 14:28

LinqConnect does not support pessimistic concurrency for Oracle. We will consider possible ways of supporting it, and will post here about the results.

At the moment, you can, e.g., explicitly lock rows with a 'select for update' statement called via the ExecuteQuery method.
StanislavK
Devart Team
 
Posts: 1710
Joined: Thu 03 Dec 2009 10:48


Return to dotConnect for Oracle