开发者

Change EntityState for Entity in Silverlight

I have an unchanged entity detached from one DomainContext and has been attached to another.

Wh开发者_运维知识库en the latter domain context submits it's changes it's trying to have the DomainService insert this unchanged entity. It's not new and it's not changed. It shouldn't be in the change set.

This enitity is around solely for displaying some of it's data. Can I change the EntityState somehow, so it doesn't try to insert?


If you use the EntitySet.Detach and EntitySet.Attach (instead of Remove/Add) methods, then it should treat the state as unchanged instead of new.


To the EntitySet, your Entity is new so it will try to insert it. I don't believe it's possible to change the state but you could always temporarily remove the Entity from the EntitySet, submit your changes and add it back.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜