尽管我相信,它不附属于它,而且与另一个不同背景没有关系,但我还是没有加入反对。
I am using EF 4 with POCO objects.
如果是我,
_currentContext.ObjectStateManager.GetObjectStateEntry(entityIn)
然后,我发现错误。
The ObjectStateManager does not contain an ObjectStateEntry with a reference to an object of type System.Data.Entity.DynamicProxies.OrderItem_7D361CB49D75AA90681B4BA3F924139ECB0FC1426E38E90C7B884A4E9CD777DF .
做得不够。 因此,如果我试图随函附上它的话。
_currentContext.AttachTo("OrderItems", entityIn)
Then I get
An entity object cannot be referenced by multiple instances of IEntityChangeTracker.
我怎么会发现这两个错误。 难道他们不矛盾吗? 我如何看待这个问题?
<><>Edit>/strong>
There is only one context throughout the app. The pattern is
- All calls through repository objects.
- The objects get their objectcontext from a factory class.
- This factory class either creates a context or gets the context from the request object thus guaranteeing only one context is used for the page lifecycle
无论在什么时候,如果你对情况作两场即时表示反对,则每一方的散射代码相同。