在同一个DbContext跟踪相同实体(主键)
1 | Theinstanceofentity type'CodingRule'cannotbetrackedbecauseanotherinstancewiththesamekeyvaluefor{ld'}isalreadybeingtracked.Whenattachingexistingentities,ensurethatonlyoneentityinstance with a givenkeyvalue is attached. Consider using'DbContextOptionsBuilder.EnableSensitiveDataLogging'toseetheconflictingkeyvalues. |
这个错误提示
The instance of entity type 'CodingRule' cannot be tracked because another instance with the same key value for '{ld}' is already being tracked意味着你的DbContext实例中已经有一个具有相同主键值的CodingRule实体在被跟踪,因此无法再次跟踪相同主键值的另一个CodingRule实体。
解决办法:
在后端更新时,重新刷新UI
1 | //重新刷新UI |
·········没用
———-2024.8.14更新
1 |
|
All articles in this blog are licensed under CC BY-NC-SA 4.0 unless stating additionally.





