开发者

Entity Framework serialization

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜