Entity Fremework serialization

Posted by Alexandr on Stack Overflow See other posts from Stack Overflow or by Alexandr
Published on 2010-05-25T22:16:19Z Indexed on 2010/05/25 22:21 UTC
Read the original article Hit count: 344

Hello guys! I was confused with my problem. I'm using Entity Framework and want to save entities on hard disk and then to restore them. I have no problem with Serializing/Deserializing but i get an exception "The object cannot be added to the ObjectStateManager because it already has an EntityKey. Use ObjectContext.Attach to attach an object that has an existing key" when i try to add deserialized object to my datacontext. And nothing happens when i just Attach my entity to datacontext

How to achieve my goal? Thx in advance! -Alexandr-

© Stack Overflow or respective owner

Related posts about c#

Related posts about entity-framework