在Silverlight RIA服务中禁用DomainContext / DomainDataSource的缓存 [英] Disable caching of DomainContext / DomainDataSource in Silverlight RIA Services

查看:79
本文介绍了在Silverlight RIA服务中禁用DomainContext / DomainDataSource的缓存的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用带有过滤器描述符的DomainDataSource,但似乎DomainDataSource(或DomainContext)正在缓存旧数据,而不是用数据库中的新数据替换它。

I use a DomainDataSource with filter descriptors, but it seems that the DomainDataSource (or DomainContext) is caching old data and not replacing it with fresh data from the database.

<riacontrols:DomainDataSource
        AutoLoad="True"
        LoadSize="5"                        
        Name="employeeDomainDataSource"
        QueryName="GetEmployeeQuery" Width="0" DomainContext="{Binding EmployeeContext}">
        <riacontrols:DomainDataSource.FilterDescriptors>                
            <riacontrols:FilterDescriptor IsCaseSensitive="False" PropertyPath="Name" Operator="Contains" Value="{Binding ElementName=NameFilter, Path=Text}"/>
        </riacontrols:DomainDataSource.FilterDescriptors>
    </riacontrols:DomainDataSource>

我也有DataPager控件。

I also have a DataPager control.

假设用户A和B加载了数据。用户B在编辑模式下更改员工姓名。用户A输入该新名称作为过滤器,将获取数据,但显示旧(已缓存)名称。我使用了提琴手,可以看到从数据库和Web服务返回了正确的数据。

Suppose user A and B load the data. User B changes the Employee's Name in edit mode. User A types in that new name as filter, the data will be fetched but the old (cached) name is displayed. I used fiddler and I can see that the correct data is returned from the database and the webservice.

有没有可以关闭此功能的选项?

Is there any option where I can switch this off?

推荐答案

我认为您需要在数据上指定LoadOption。

I think you need to specify a LoadOption on the data.

我可以记不清了,我找不到文档,但是我相信您需要重写DomainDataSource上的LoadingData事件;并设置args.MergeOption。尝试刷新当前。

I can't remember exactly, and I can't find the documentation, but I believe you need to override the LoadingData event on the DomainDataSource; and set the args.MergeOption. Try 'RefreshCurrent'.

这篇关于在Silverlight RIA服务中禁用DomainContext / DomainDataSource的缓存的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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