I am trying to implement the solution given in Concurrency Handling using the Entity Framework in an ASP.NET MVC application .
The article says:
Adding a tracking property to a department object
In the \ Department.cs models, add the tracking property:
[Timestamp]
public Byte[] Timestamp { get; set; }
The Timestamp attribute indicates that this column will be included in the Where clause of the Update and Delete commands sent to the database.
Since I am using the first approach of the model , I followed steps 1-5 outlined in Creating a Timestamp Column with Entity Framework
- Add a property named "Timestamp" for the object in the EF model.
- Set type to binary
- Set nullable to false
- StoreGeneratedPattern
- ConcurrencyMode .
, \Department.cs
public virtual byte[] Timestamp
{
get;
set;
}
Timestamp:
public class DepartmentMetadata
{
[Timestamp]
public byte Timestamp { get; set; }
}
Q1. , Timestamp . .
1 - , SQL Server binary, Timestamp. , , Timestamp .
Q2. ( " " ), , OptimisticConcurrencyException. . ? , , .
