如何在客户端刷新集合?
我从服务器加载客户端数据:
var context = new WordsDomainContext();
context.LoadWords();
并且我根据需要在客户端上使用我的集合context.Words。 运作良好。 但由于某些原因我想刷新我的context.Words。 当我再次调用 context.LoadWords() 时,新记录只需附加到当前集合。
我尝试使用 MergeOption context.LoadWords(null, MergeOption.OverwriteCurrentValues, null)
但没有效果。
如何清理我的 Words 集合并从服务器加载新数据?
I loading data on client from server:
var context = new WordsDomainContext();
context.LoadWords();
And I using my collection context.Words on client as I need. It's working good.
But I want to refresh my context.Words for some reasons. When I call again context.LoadWords()
new record just append to current collection.
I tried use MergeOption context.LoadWords(null, MergeOption.OverwriteCurrentValues, null)
but no effect.
How I can clean my Words collection and load new data from server?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可能需要在使用
LoadWords()
之前调用此函数:You probably need to call this before you use the
LoadWords()
:您可以使用以下方法简单地从数据库刷新客户端上的集合:
顺便说一句 - 集合是
EntityCollection
类型。You can simply refresh your collection on client from the database using :
b.t.w - collection is an
EntityCollection
type.