Skip to content

Provide a way to force ef to check ConcurrencyToken #18536

@crclz

Description

@crclz

problem

When saving changes, EFCore only checks the concurrency token of a row when the entity is modified. Consider the folowing situation:

First I fetch record p. I'm not going to modify record p, but I want to ensure record p is unchanged until savechanges(). (like a SHARE lock)

solution

Force efcore to check the ConcurrencyToken of an entity. Maybe by executing SELECT 1 FROM students WHERE student_id=11 AND concurrency_token=55 FOR SHARE and throw exception if null is returned.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions