Cannot attach an entity with the key that already exists.
-
- Devart Team
- Posts: 1710
- Joined: Thu 03 Dec 2009 10:48
-
- Posts: 7
- Joined: Thu 03 Mar 2011 19:59
I ran into this exact same problem with DevArt blocking the object add when I was trying to follow the guidance here:
http://blogs.msdn.com/b/dinesh.kulkarni ... ached.aspx
Eventually I ran across these posts:
http://www.west-wind.com/weblog/posts/2 ... g-Entities
http://www.west-wind.com/weblog/posts/2 ... s-Followup
The second link describes a method by which three data contexts are required (one for update, two for select) where the "original" and "current" version can be provided to the "update".
In my case, I have an object which is selected, manipulated, and then persisted and is thus disconnected (DataContext1). This is my "current" object. I need to process this object in a web service. With this disconnected "current" I take a DataContext2 and select the "original" and then DataContext3.SomeTable.Attach(currentObj, originalObj) and it is working for me.
Just posting in case anyone else finds this thread and is stuck...
Regards,
Stuart
http://blogs.msdn.com/b/dinesh.kulkarni ... ached.aspx
Eventually I ran across these posts:
http://www.west-wind.com/weblog/posts/2 ... g-Entities
http://www.west-wind.com/weblog/posts/2 ... s-Followup
The second link describes a method by which three data contexts are required (one for update, two for select) where the "original" and "current" version can be provided to the "update".
In my case, I have an object which is selected, manipulated, and then persisted and is thus disconnected (DataContext1). This is my "current" object. I need to process this object in a web service. With this disconnected "current" I take a DataContext2 and select the "original" and then DataContext3.SomeTable.Attach(currentObj, originalObj) and it is working for me.
Just posting in case anyone else finds this thread and is stuck...
Regards,
Stuart
-
- Devart Team
- Posts: 1710
- Joined: Thu 03 Dec 2009 10:48