The ConcurrencyCheck Attribute

The ConcurrencyCheck attribute is used to specify that a property should be included in a WHERE clause in an UPDATE or DELETE statement as part of concurrency management.

public class Author
{
    public int AuthorId { get; set; }
    [ConcurrencyCheck]
    public string FirstName { get; set; }
    [ConcurrencyCheck]
    public string LastName { get; set; }
    public string Biography { get; set; }
    public ICollection<Book> Books { get; set; }
}

Fluent API

The Fluent API equivalent to the ConcurrencyCheck attribute is the IsConcurrencyToken method.

© 2019 - Learn Entity Framework Core.
All rights reserved.