.net - Restrict multiple edits on any objects, c# 2012 -


i have many objects pg, layout, sitepart etc., multiple users can edit these objects , can save them data base. @ time 1 user can save changes db, , let other users wait until member completes job if both updating same objects.

i have functionality building objects , saving them db. how implement locking, how other user know when object released.

please shed thoughts on how proceed.

thank in advance..

the type of behaviour describing called pessimistic concurrency. haven't said if need lock locked within single web request or across multiple requests. rather reinventing wheel, should use standard concurrency techniques, , read on how implement .net.

typically web applications use optimistic concurrency; if need pessimistic concurrency gets hard quickly. asp.net not offer out of box support pessimistic concurrency.

you haven't said how access database (e.g. if using ado.net, or ef), ef also has concurrency control. comes down using transaction objects such sqltransaction coordinate updates across tables, being able check see if user beat update, , if did deciding do.

with pessimistic concurrency have whole lot more worry - put global lock (e.g. in code) happens if goes wrong (e.g. recycling of application pools in iis can mean 2 users don't lock same object if lock in code-based singleton) , how deal timeouts if record locks in database. if want see question related pessimistic concurrency, see: how implement "pessimistic locking" in asp.net application?

edit. should have mentioned if building logic building objects , saving them db should aware of repository , unit of work patterns. if not, should read well. solving standard problem has standard patterns implement solutions in languages.


Comments

Popular posts from this blog

blackberry 10 - how to add multiple markers on the google map just by url? -

php - guestbook returning database data to flash -

delphi - Dynamic file type icon -