concurrency for asp.net

A

angus

Hi all,

I would like to seek help on the topic about concurrency in asp.net web
application
for instance, my application is going to implement a online restaurant table
booking system

i have a db table to store all tables in the restaurant, lets call it
res_table

in res_table, there is a table_id field, as well as a flag called
is_available, if the table has been booked, is_available=0, otherwise,
is_available=1.

normally, when a customer is going to book a table, i have to validate if
the table is_available=1. right?

now, there are two customers are going to book the same table almost the
same time,

the timeline would be as follow:

customer a -> check if < res_table xxx > is_available=1
customer b -> check if < res_table xxx > is_available=1
customer a -> book table xxx
customer b -> book table xxx

so, the data is wrong.

how to solve the problem? any good article is talking about that issue?

Thank you.

Regards,
Angus
 
K

Kevin Spencer

I think you'll have to keep track of any customer considering a booking, and
disallow any other customer from trying to check the same booking until the
first has made a decision one way or the other. You could do this with
Application-level variables.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
Neither a follower nor a lender be.
 
G

Guest

One would not prefere to get locked until others decision.. It will be very
irritating for other customer if he has to wait for someone else to make
decision. and even someone can block the reservation for a long time...
What i would suggest is, to check the available flag each time you update
the record and you can through message if meanwhile someone has already
booked that seat.
 
A

angus

to check the available flag each time you update
what if, after i have checked the available flag, which return true, as a
mean time, another customer booked the table, and so, the old customer will
produce a wrong record.

i know that it maybe this chance is smaller than 1/100...00, but, how can i
prevent this from happening
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,226
Members
46,815
Latest member
treekmostly22

Latest Threads

Top