Load()不会刷新所有更改 [英] Load() does not refresh all changes

查看:131
本文介绍了Load()不会刷新所有更改的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好,

我有一个奇怪的问题:

您有一个包含以下行的数据库:

Hello,

I have this strange problem:

You have a database with these rows:

Table: Letter

Id=1,Name="A"
Id=1,Name="B"
Id=1,Name="C"


现在,您进行查询


Now you make the query

var q= (from l in context.Letter where l="A" select l);
g.Load();


现在在上下文中.本地哟只有一行(第一行)

如果转到数据库并删除或删除或添加文件,则将相应地刷新本地(在更改之间必须使用Load()和Refresh()).

但是在这种情况下,它不起作用,请参见:

您进入数据库,将"A"更改为"B",然后重复查询


Now in context.Local yo have only one row (the first one)

If you go to database and remove or delete or add files, the Local refresh accordingly (you must use Load() and Refresh() between changes).

But in this case it does not work, see it:

You go to database and change "A" to "B" and repeat the query

g.Load();


实体将其值更改为"B",因此必须将其从本地"中删除,但是当本地必须具有0个元素(count == 0)时,该值在本地"中仍然有效(count == 1)


The entity changes his value to "B" so it must been removed from Local but it stills alive in Local (count==1) when the local must have 0 elements (count==0)

Any idea?

推荐答案

也可以在这里查看: http://msdn.microsoft.com/en-us/library/bb896255.aspx [ ^ ]
Look also here: http://msdn.microsoft.com/en-us/library/bb896255.aspx[^]


这篇关于Load()不会刷新所有更改的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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