开发者

How Can i change Tracking Information of object from ObjectContext to another?

I have an object which is added to an objectContext ..

after some operation i need to pass it to another objectcont开发者_开发百科ext of the same database but i always face this message :


An entity object cannot be referenced by multiple instances of IEntityChangeTracker.


i need to change tracking information be detach it from the old object and attach it to the new objectcontext..

but in the new scope i doesn't own the old objectContext to detach it before

My question : How to change Tracking information of this object to the new ObjectContext?


You must Detach the entity from the first context while that context is still in scope. Since contexts are units of work, the fact that you need to do this at all and are having context scoping issues suggests you might want to take a broader look at your design.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜