Use Identity for CreatedOn and Computed for ModifiedOn . Identity means that the value is set only during insertion and is returned back to the application. Computed installed during each modification (including insertion), and the value is returned back to the application after each performed insertion or update.
Just remember that none of these properties can be set in the application. Computed columns also cannot be part of the primary key or foreign key (this is not your case).
This will only work with an existing database. When using the first code, Computed can only be set for timestamp or rowversion .
timestamp used for optimistic concurrency. If you mark a column as a timestamp, each update will contain the WHERE timestampColum = @lastKnownValue . It will update the record only if the last known value matches the current value. If the value is different, you will get an exception. It is usually used with the timestamp SQL type. Using it with datatime will require some tests. The SQL datatime value does not match the value in .NET.
source share