title: How do I implement "pessimistic locking" in an asp.net application?
body: <p>I would like some advice from anyone experienced with implementing something like "pessimistic locking" in an asp.net application.  This is the behavior I'm looking for:</p>
  
  <ol>
  <li>User A opens order #313</li>
  <li>User B attempts to open order #313 but is told that User A has had the order opened exclusively for X minutes.</li>
  </ol>
  
  <p>Since I haven't implemented this functionality before, I have a few design questions:</p>
  
  <ul>
  <li>What data should i attach to the order record?  I'm considering:
  
  <ul>
  <li>LockOwnedBy</li>
  <li>LockAcquiredTime</li>
  <li>LockRefreshedTime</li>
  </ul></li>
  </ul>
  
  <p>I would consider a record unlocked if the LockRefreshedTime &lt; (Now - 10 min).</p>
  
  <ul>
  <li>How do I guarantee that locks aren't held for longer than necessary but don't expire unexpectedly either?</li>
  </ul>
  
  <p>I'm pretty comfortable with jQuery so approaches which make use of client script are welcome.  This would be an internal web application so I can be rather liberal with my use of bandwidth/cycles.  I'm also wondering if "pessimistic locking" is an appropriate term for this concept.</p>