Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Timestamp generated datatype by code

Tags:

c#

sql-server

I should have timestamp datatype row inside my SQL Server database. I'm using code-first approach so I want to generate this field from my domain util class.

So, how to declare this property to be generated as timestamp in the database?

like image 586
user1765862 Avatar asked Jan 24 '26 15:01

user1765862


1 Answers

You could use a byte array decorated with the [Timestamp] attribute:

[Timestamp] 
public byte[] SomeTimestamp { get; set; }

You might also want to checkout the following article.

like image 54
Darin Dimitrov Avatar answered Jan 26 '26 05:01

Darin Dimitrov



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!