Disabled LINQ Updates: rowversion vs. datetime with trigger?

We are using LINQ to SQL and WCF for the new middle tier, and we are using data transfer objects to pass through the wire, rather than using real LINQ classes. I will use one or the other of the methods described here - Linq Table Attach () based on timestamp or version string - in order for the updates to work correctly and that the concurrency is handled correctly.

To save you a bit of reading time, in fact, you can either use the timestamp / rowversion column in your table, or the datetime column with a default trigger and update trigger - in any case, it gets a column that receives a newly generated value every time insert or update occurs, and this column is used for LINQ to check for concurrency.

My question is which one is better? We already have datetime columns for β€œUpdateWhen” in many of our tables (but not all - don't ask), but will add default values ​​and triggers, or we could just add rowversion (we would have to use the timestamp syntax for now , since we still support SQL2005 for a while) for each table - in any case, we modify the database to make it work, so I would like to know if there is a difference in performance or any other important difference to note between the two alternatives. I tried searching the Internet and here on SO, but so far no luck. Thank.

+3
source share
2 answers

timestamp concurrency. - , - . DateTime SQL #.

MSDN:

datetime .000,.003 .007 ...

SO: DateTime # DateTime SQL-? MSDN: datetime (Transact-SQL) .

+3

.

.
, :

  • LINQ-to-SQL, []. .
  • rowversion 0, rowversion
  • Rowversion , , , . .

datetime2 , sysutcdatetime(). 100 ( 7 - 23: 59: 59.9999999)
. , . , . , , .

sysutcdatetime(), .

+4

All Articles