LINQ to SQL and Concurrency Issues

后端 未结 3 422
悲哀的现实
悲哀的现实 2020-12-19 07:48

We are trying to build a High-Volume Orders Record System. There are three primary tables: 1. Orders 2. OrderDetails 3. OrderShipment

The Shipment table contains n r

3条回答
  •  慢半拍i
    慢半拍i (楼主)
    2020-12-19 08:05

    For this kind of situations, i.e. where more than one user may want to make changes to the same record/customer/order/whatever it is better to build "locking" into the application logic rather than use database locks.

    Using DB locks to solve logical locking of data is going to present you with a heap of new issues. A better solution is to have columns and/or tables where you can indicate that an order/customer/etc is being edited [by a user], until when it is locked etc. Query that table (or columns) to check if the customer/order/thing is available for editing before allowing another user to edit it.

    See: http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=3984968&SiteID=1

提交回复
热议问题