Showing all posts tagged: 'Entity Framework'

A 9-post collection

An Object with the same key already exists in the ObjectStateManager, Entity Frawework

I have a generic repository which I use in my application to manage a large number of objects. I wrote the necessary unit tests to ensure that all methods work as expected and in isolation all was good. However, as soon as the application started implementing more complex operations, I came across the following error during updates: An object with the same key already exists in the ObjectStateManager. The ObjectStateManager cannot track multiple objects with the same key.” In my controller I do something along these lines: Nothing unusual here. Move on, nothing to see. I fetch the existing user …[read more]