I have a table with DateCreated
and DateUpdated
columns and using Entity Framework to insert/update values to the database.
I need the DateCreated
column to get the SQL Server's GetDate()
value on insertion only.
DateUpdated
column value should always get updated with current GetDate()
value on insertion and update both.
For the DateCreated
column, I've set StoreGeneratedPattern="Computed"
and on SQL Server table I've set default value of the column to be GetDate(), which works nicely as expected.
For the DateUpdated
column I could not find a way to get the GetDate()
value automatically set each time an entry is updated. This value get's set only when an entry is inserted.
Could someone shed some light on this.