Using the entity framework, should I add a timestamp to all my database tables?

I plan to use the MS entity framework for new web applications (go out on EF v2!).

. Does it make sense to plan ahead by adding timestamp columns to all entity tables in existing and future databases to support concurrency checks? Is there a reason why it would be a bad idea to have a timestamp column in each table?

Note that you need to add support for upbeat concurrency, not audit.

+4
source share
2 answers

I have used timestamp columns as a routine for many years. Another option is a version string, but then you need to update it, etc. I have never had a timestamp problem. One word of caution - if you ever select temp-table / table-var for processing, you need to use varbinary(8) , not timestamp , in the temp table, otherwise your temporary table will get its own unique timestamps after update; -p

As you acknowledge, timestamp only helps with concurrency. Despite the name, it has nothing to do with the time, so it will not help with the audit.

It is well supported in MS db clauses (LINQ-to-SQL / EF / etc)

+10
source

In previous projects, I used timestamps and I never had a bad experience. In addition, I completely exclude the Entity Framework from this solution, because some of them may change over time.

0
source

All Articles