We have already explored Timestamp
-based concurrency tokens in the Introducing concurrency tokens section. We can jump directly into the configuration, consider the same scenario and see how the conflicts were handled using the Timestamp
concurrency token.
As we did with the non-timestamp based concurrency token, timestamp-based concurrency tokens could also be configured in the following ways:
- Data annotations
- Fluent API
We will see how the configurations were performed using both the approaches in our blogging system, and later we will see them in action.
We have already seen how data annotation configuration works. For timestamp-based tokens, we need a property that will have a byte array, and it should be marked using the Timestamp
data annotation. This is the only configuration required from our end; EF will take care of the rest:
public class Post
{
// Code removed for brevity
[Timestamp...