Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1014697
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T10:17:18+00:00 2026-05-16T10:17:18+00:00

I have the necessity for a client application to lock (aka check-out certain business

  • 0

I have the necessity for a client application to “lock” (aka “check-out” certain business entities store in the database.

The workflow is such that:

  1. The user navigates to a page for some business object.

  2. The user hits “edit”.

  3. This locks the item from being edited by anyone else.

  4. Other users on other workstations will see a little “lock” icon by the item being edited and the “edit” button will be read-only.

  5. Admin users may click a button to “force” unlocking the item.

Pretty standard, right? I’ve done this a bunch of times in the past and I’m looking for some thoughts on the “right” way of doing this this time…

Namely, I guess there are two approaches:

  1. Have my business objects implement some ILockable interface which has a LockOwnerId property and have the corresponding table in the DB have that same LockOwnerId.

  2. Have a centralized “EntityLocks” table in the DB that manages all entity-type/primary key pairs of entities that are currently locked/checked out.

As for the API for acquiring a lock, I’m simply thinking of something along the lines of a CheckOut method:

// Returns true if the check-out was successful, 
// false if the check-out was not successful, becase the item was already locked. If 
// force is set to true, will check out the toCheckOut to the current user, regardless 
// of existing check-outs.
bool CheckOut(object toCheckOut, bool force)

Thoughts?

Thanks.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T10:17:19+00:00Added an answer on May 16, 2026 at 10:17 am

    Personally, I usually try to stay away from this pattern if I can, by requesting the business processes to be changed. This however, is not always possible and for this reason Martin Fowler described it as an actual pattern..

    The solution you described sounds fine. However, I rather let the CheckOut method throw an exception except returning a bool. This is much more explicit. When developers forget to handle this exceptional case (the item could not be checked out) the error will be much easier to spot (because the exception isn’t caught).

    Also, please take good care of the implementation of the CheckOut method. Make sure it is transactional. The last thing you want is the possibility that two users both got a lock on the same object, because the implementation isn’t implemented correctly.

    Good luck.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a server-client application and I've hit a weird speed bump with login
I'm making and tablet application to a store, and the application needs to have
I have programed a server-client application as a RPC (low-level). This is my server
I have both a client and server application using UDP port 25565. In order
I have an application that needs to make a SOAP client request to a
If I have a client application running on multiple internet connections (behind routers and
I have a client application which calls my WCF service (Security Token Service i.e.
I have an asp.net application developed. It uses LINQ to SQL to access database,
I have a necessity to sort a given HTML table of the following structure,
In Java I have the necessity of implementing a class that extends Thread within

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.