开发者

Entity Framework serialization

开发者 https://www.devze.com 2022-12-31 20:19 出处:网络
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 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 Att开发者_JAVA百科ach my entity to datacontext

How to achieve my goal?


You need to attach then add.

0

精彩评论

暂无评论...
验证码 换一张
取 消