LINQ to SQL: Issue with concurrency

Posted by Gib on Stack Overflow See other posts from Stack Overflow or by Gib
Published on 2010-05-24T11:02:55Z Indexed on 2010/05/24 21:01 UTC
Read the original article Hit count: 296

Filed under:
|
|

I’m working on a sandwich ordering app in ASP.NET MVC, C# and LINQ to SQL. The app revolves around the user creating multiple custom-made sandwiches from a selection of ingredients.

When it comes to confirming the order I need to know that there’s enough portions of each ingredient to fulfil all the sandwiches in the user’s order before I commit to the DB as it is possible that an ingredient will go out of stock between adding it to their basket and confirming the order.

A bit about the database:

Ingredient – Stores ingredient details including number of portions
Order – Header table for an order, simply stores the order time
OrderDetail – Stores a record of each sandwich in an order
OrderDetailItem – Stores each ingredient in each sandwich in an order

So basically I’m wondering what the best approach to ensuring that before I add records to Order, OrderDetail and OrderDetailItem I can ensure that the order can be met.

© Stack Overflow or respective owner

Related posts about sql

Related posts about LINQ