Configuring non-timestamp tokens through data annotation

The data annotation configuration is straightforward; we have already seen the annotation in the Introducing concurrency tokens section of this chapter and it is not something new to us. Let's see how the ConcurrencyCheck attribute is configured:

    public class Post    {      // Code removed for brevity      [ConcurrencyCheck]      public string Url { get; set; }      // Code removed for brevity    }

The preceding configuration will let EF Core consider the Url column as the concurrency check column, and any further update to this column will restrict users from performing parallel updates.

We have already seen the concurrency conflicts while trying to edit posts in different tabs, which is kind of a simulation ...

Get Mastering Entity Framework Core 2.0 now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.