Persistence Tracking Columns are UTC
- Creation time
- Creation user
- Last write time
- Last writer user
By default creation time and last write time use GETDATE function (local date of the server). We think it’s a better practice to use UTC date for this kind of data. Two years ago, we wrote an aspect to replace GETDATE function by GETUTCDATE function: http://www.softfluent.com/forums/codefluent-entities/utc-date-times.
In the latest build of CodeFluent Entities (build 772) we introduce a new built-in setting at Project Level to use UTC date instead of local date:
This option is used by all persistence producers: Microsoft SQL Server, Microsoft SQL Azure, Oracle, MySQL and PostgreSQL.
For example with SQL Server:
CREATE TABLE [dbo].[Test] ( [Test_Id] [uniqueidentifier] NOT NULL, [_trackLastWriteTime] [datetime] NOT NULL CONSTRAINT [DF_Tes__tc] DEFAULT (GETUTCDATE()), -- instead of getdate() [_trackCreationTime] [datetime] NOT NULL CONSTRAINT [DF_Tes__tk] DEFAULT (GETUTCDATE()), -- instead of getdate() [_trackLastWriteUser] [nvarchar] (64) NOT NULL, [_trackCreationUser] [nvarchar] (64) NOT NULL, [_rowVersion] [rowversion] NOT NULL )
The R&D Team