The timestamp attribute can be applied to the domain class, with only one byte array property above, this attribute, which sets the Tiemstamp type for the column. In a concurrent check, Code-first automatically uses this timestamp type of field.
Let's take a look at the code below:
usingSystem;usingSystem.Collections.Generic;usingSystem.ComponentModel.DataAnnotations;usingSystem.ComponentModel.DataAnnotations.Schema;usingSystem.Linq;usingSystem.Text;usingSystem.Threading.Tasks;namespaceef2{[Table ("Studentinfo")] Public classStudent {[Key] [Column (Order=1)] Public intStudentKey1 {Get;Set; } [Key] [Column (Order=2)] Public intStudentKey2 {Get;Set; } [Column ("Name", typename="ntext")] [MaxLength ( -)] Public stringStudentname {Get;Set; } [Notmapped ()] Public int? Age {Get;Set; } Public intStdId {Get;Set; } [ForeignKey ("StdId")] Public VirtualStandard Standard {Get;Set; } 1540644940 Public byte[] RowVersion {get; set; } }}
To run the program, the resulting database is:
Data Annotation Properties--timestamp Properties "Code-first series"