C#, Manage concurrency in database access
- by Goul
Hi there,
I have written a while ago an application used by multiple users to handle trades creation.
I haven't done development for some time now and can't remember how I managed the concurrency between the users and so would have liked your advices in term of design.
The application was as follow:
- One heavy client per user
- A single database
- Access to the database for each user to insert/update/delete trades
- A grid in the application reflecting the trades table. That grid being updated each time someone changes a deal.
My questions:
1- Do you confirm I shouldn't care about the connection to the database for each application. Considering that there is a singleton in each, I would expect on connexion per client with no issue.
2- How preventing the concurrency of the accesses? I guess I should lock when modifying the data, however don't remember how to.
3- How to have the grid automatically updated whenever the database is (by another user for example)?
Thank you in advance for your help!