Assuming a Product class
public class Product
{
public String Name {get;set;}
public Decimal Price {get;set;}
public Int32 QuantityStock {get;set;}
}
Now assuming Two Clients who "Request" the same Product at the same time named "Product 1" with the following values
Name = "Product 1"
Price = 10
QuantityStock = 100
The first client increase the QuantityStock to 110
Then the second client decrease QuantityStock to 90
So I got a lack of 10 QuantityStock for this Product because the second client update quantityStock from original value "100" instead of the first client update "110" ...
Original Value = 100
First Client Update 100 => 110
Second Client Update 100 => 90
How can I prevent that behavior ?
Note : I'm in a 3-Tier Architecture with Repository Pattern and Entreprise Library.