D
duppino
Guest
Hi,
Im trying a way to recognize if another client has changed a record on the database while I have it open.
Example:
http://www.binaryintellect.net/articles/58216146-d464-42cb-b60d-15215467b107.aspx
or
http://www.codeproject.com/Tips/743507/Detecting-concurrency-issues-with-Entity-Framework
So, I have a table sql server like this:
IdProduct(int)
Name(varchar)
Price (decimal)
Version(timestamp)
I also have a .edmx file that reflects the database.
So, I set Versions property (inside edmx diagram) ConcurrencyMode = fixed.
Then, I opened my product on the windows form.
Manually I changed products price (changing timestamp) in database.
Then click on savechanges() on winform, and it updated the record, although initial timestamp is changed...
code in class is this:
try
{
_oc.SaveChanges();
}
catch (OptimisticConcurrencyException ex)
{
return false;
} }
so, exception is never thrown!
Im forget something?
thanks
Continue reading...
Im trying a way to recognize if another client has changed a record on the database while I have it open.
Example:
http://www.binaryintellect.net/articles/58216146-d464-42cb-b60d-15215467b107.aspx
or
http://www.codeproject.com/Tips/743507/Detecting-concurrency-issues-with-Entity-Framework
So, I have a table sql server like this:
IdProduct(int)
Name(varchar)
Price (decimal)
Version(timestamp)
I also have a .edmx file that reflects the database.
So, I set Versions property (inside edmx diagram) ConcurrencyMode = fixed.
Then, I opened my product on the windows form.
Manually I changed products price (changing timestamp) in database.
Then click on savechanges() on winform, and it updated the record, although initial timestamp is changed...
code in class is this:
try
{
_oc.SaveChanges();
}
catch (OptimisticConcurrencyException ex)
{
return false;
} }
so, exception is never thrown!
Im forget something?
thanks
Continue reading...