出现错误:The database operation was expected to affect 1 row(s), but actually affected 0 row(s); data may have been modified or deleted since entities were loaded。
由于我们用的是主从库,在新增完后,再立即去更新数据,这时候同步过程还没完成,导致查出来的数据是从从库里查出来的,还是原来的数据,就会导致这个原因。解决方案就是这个方法只从主库里读取和写入。当然还有其它原因,如并发。