.net core 5.0操作Ef修改关联表报错
.net core 5.0操作Ef修改关联表时,向关联表中插入新数据报下面错误
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
原因是因为关联表的主键设置了默认值在插入的时候又进行了赋值,删除赋值即可