I am using Entity Framework 4.1. What fluent api method is correspond to [Timestamp] attribute in Data Annotations API to check concurrency?
If you have class like this:
public class MyEntity
{
...
public byte[] Timestamp { get; set; }
}
You will use fluent mapping like this:
modelBuilder.Entity<MyEntity>()
.Property(e => e.Timestamp)
.IsConcurrencyToken()
.HasDatabaseGeneratedOption(DatabaseGeneratedOption.Computed);
Or:
modelBuilder.Entity<MyEntity>()
.Property(e => e.Timestamp)
.IsRowVersion();
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With