Print Page | Close Window

Using pessimistic locking in DevForce entities and transaction UIs

Printed From: IdeaBlade
Category: DevForce
Forum Name: DevForce Classic
Forum Discription: For .NET 2.0
URL: http://www.ideablade.com/forum/forum_posts.asp?TID=90
Printed Date: 12-Jun-2026 at 9:59am


Topic: Using pessimistic locking in DevForce entities and transaction UIs
Posted By: Customer
Subject: Using pessimistic locking in DevForce entities and transaction UIs
Date Posted: 20-Jun-2007 at 9:39am
I’m not sure if I already asked this topic before, but we are planning to implement pessimistic locking approach on our transaction forms instead of the optimistic locking. Does IdeaBlade has some tips or discussions on using this approach? I only noticed the proper use of the optimistic locking using the ConcurrencyHandler and the RowVersion concurrency column.



Thanks a lot for the help.




Replies:
Posted By: IdeaBlade
Date Posted: 20-Jun-2007 at 9:41am

Michael, 

DevForce does not inherently support pessimistic concurrency, which is why our tutorials address only optimistic concurrency. 

DevForce is designed to support highly-scalable, high-performing applications.  Database connections are opened and closed as needed, but always for short durations.  This means that a single PM.GetEntities call opens a connection, fetches data, and closes the connection.  A single PM.SaveChanges call opens a connection, persists data, and then closes the connection.  This is true whether the application is client-server or uses a Business Object Server.  Since connections are always short-lived, any locks held are also short-lived, and there is no way to issue a lock spanning the boundaries of an individual get or save. 

We always advise that our customers not use pessimistic concurrency, since we believe optimistic concurrency is the better approach and can be used with most, if not all, applications.  For a kind of “checkout” pattern where you want a user to grab something and hold onto it until done, you have several options other than database locks.  One would be to use a flag of some sort on the record itself which could indicate availability/in use.  Another option might be to use an additional table that tracks “checkouts”.  I’m sure there are other options too, but what these have in common is that they do not rely on an open connection and database locks, but instead make the “locking” the responsibility of the application. 

Please let me know if you need any more information.  If so, I can try to give you a more detailed explanation or get you in touch with one of our architectural gurus.




Print Page | Close Window