I am getting the "An object with the same key already exists" on an update attempt while trying to attach an entity.Lazy loading is turned on. I googled, and found no real solution to this problem. My best solution would be to replace the entry in the object state manager, but I can not find anywhere how to replace it. Is it possible at all?
the problems occurs when I create an instance of object A (has a collection of Object B) in one context, and the B objects in another context. When I try to attach both of them it breaks. Is there a way to tell EF when to replace the entry that it is tracking. Could it maybe be possible that it would allow the replacement when I would set the duplicated entitykey entries objectstate to modified.