MS SQL database table has timestamp field which value changing after update row. Before update I want to check if the row is changed from another service.
I can do it by comparing timestamp values from object in memory with value from database table.
Can I do it by linq2db in one atomic operation?
It works without checking:
db.Update(product);
These three queries do not work:
db.Products.Where(p => p.timestamp == product.timestamp).Update(p => p, product);
db.Products.Update(p => p.timestamp == product.timestamp, p => product );
db.Where<DB, Product, DB>(p => p.timestamp == product.timestamp).Update(product);
I want to execute sql-script like this:
update Products
set ...-- all fields
where Id = @id and Timestamp = @timestamp