我一直在尝试使用 SaveChangesAsync() 在 Entity Framework Core 中进行更新,但总是收到此错误:
DbUpdateConcurrencyException: Database operation expected to affect 1 row(s) but actually affected 0 row(s). Data may have been modified or deleted since entities were loaded. See http://go.microsoft.com/fwlink/?LinkId=527962 for information on understanding and handling optimistic concurrency exceptions.
Run Code Online (Sandbox Code Playgroud)
我可以毫无麻烦地添加一个新的Employee,方法基本相同。
当我调用 SaveChangesAsync() 时发生错误。
堆栈跟踪
DbUpdateConcurrencyException: Database operation expected to affect 1 row(s) but actually affected 0 row(s). Data may have been modified or deleted since entities were loaded. See http://go.microsoft.com/fwlink/?LinkId=527962 for information on understanding and handling optimistic …Run Code Online (Sandbox Code Playgroud) c# entity-framework-core asp.net-core-mvc .net-core asp.net-core