orleans 使用ef的小问题

InvalidOperationException:
The instance of entity type ‘Category’ cannot be tracked because another instance with the same key value for {‘CategoryID’} is already being tracked.
When attaching existing entities,
ensure that only one entity instance with a given key value is attached.
Consider using ‘DbContextOptionsBuilder.EnableSensitiveDataLogging’ to see the conflicting key values.

翻译过来的内容大致是:实体 category不能被跟踪,因为有一个同样key categoryID已经被跟踪。

更新的实体已经存在,第二次你更新的实体不等于第一次的实体..但是key是一样的.则会出现这个问题..

orleans中传递数据..是序列化后又恢复的..所以是一个新的对象…

发表评论