Get the App
SLTechnology News&Howtos  ›  Internet Technology  › 

How to solve the problem that multiple data updates in EFCore cannot be savechanges () at the same time.

Shulou Source: shulou.com Published: 2022-06-02 08:56:24 10月02日 Update

This article mainly explains "how to solve the problem that multiple data updates in EFCore can not be savechanges () at the same time". The content in the article is simple and clear, and it is easy to learn and understand. Please follow the editor's train of thought to study and learn "how to solve the problem that multiple data updates in EFCore cannot be savechanges () at the same time".

1 add var transaction = ctx.Database.BeginTransaction () under the definition of ModelContext

1.2 add transaction.Commit () after the last SaveChanges ()

3 add transaction.Rollback () to the if (sMsgCode! = "") branch of finally; add transaction.Dispose () at the end

Thank you for reading, the above is the content of "how to solve the problem that multiple data updates in EFCore cannot be savechanges () at the same time". After the study of this article, I believe you have a deeper understanding of how to solve the problem that multiple data updates in EFCore cannot be savechanges () at the same time, and the specific use needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!

Tags: Questions at the same time multiple data updates learning content branches that is ideas situations articles more knowledge knowledge points articles follow practice push research Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Xiaomi Microsoft NVidia OPPO Reno MariaDB