Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add option to disable concurrency checking at the SaveChanges level #19056

Open
Tracked by #14496
rafaelvascc opened this issue Nov 25, 2019 · 4 comments
Open
Tracked by #14496

Comments

@rafaelvascc
Copy link

On our application we added optimistic concurrency using the [ConcurrencyCheck] annotation on our model classes. It is working fine, but there are some very specific cases where we would like to force an update without doing concurrency checking (yes, we know the risks).

We would like a built-in solution on EF Core DbContext that ignores concurrency checking for some entities when calling SaveChanges. Something like:

_context.IgnoreConcurrencyChecking(entity);
_context.SaveChanges();
//No DbConcurrencyException just a forced updated

Thanks.

@ajcvickers
Copy link
Member

Note for triage: very similar to #10443

@AndriySvyryd
Copy link
Member

#10443 is at the model level, while this one is at the SaveChanges level. It makes sense to track them separately.

Added to the epic.

@rafaelvascc
Copy link
Author

Thanks for having the time to take a look into it guys.

@ascott18
Copy link
Contributor

An opt-in would also be nice: the ability for a specific save operation to specify optimistic concurrency for some set of fields that are not otherwise declared for optimistic concurrency on the model.

_context.CheckConcurrency<Page>(p => new { p.ParentId, p.Order });
_context.SaveChanges();

@roji roji changed the title Add option to ignore concurrency checking for some entities Add option to disable concurrency checking at the SaveChanges level Oct 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants