Timestamp generates data type by code

I must have a data string of type timestamp inside my SQL Server database. I'm using a codes-based approach, so I want to generate this field from the my domain class.

So how do you declare this property to be generated as a timestamp in the database?

+3


source to share


2 answers


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

:

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

      



You can also check following article

.

+5


source


you can use this sample



...
       public byte[] TimeStamp { get; set; }
    }

     public class UserModelConfiguration: EntityTypeConfiguration<User> {
            public UserModelConfiguration() {
                Property(p => p.TimeStamp).IsRowVersion();            
            }
        }

      

0


source







All Articles