ObjectContext.Refresh()? [英] ObjectContext.Refresh()?

查看:160
本文介绍了ObjectContext.Refresh()?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何从数据存储中更新所有脏实体,并将其更改的值重置为原始存储值?

How to update ALL the dirty entities from the data store, and reset their changed values to the original store value?

方法 ObjectContext.Refresh 需要作为要刷新的实体的参数。

The method ObjectContext.Refresh requires as a parameter the entities to be refreshed.

推荐答案

以下通常有效:

Context.Refresh(RefreshMode.StoreWins, _
    Context.ObjectStateManager.GetObjectStateEntries())

有时会导致问题EntityRelations。看看我的评论进一步的细节。

It sometimes causes problems with EntityRelations. look at my comment for further details.

这篇关于ObjectContext.Refresh()?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆