[英]WCF Data services - Client is caching results
我有WCF數據服務,我的客戶端是WPF應用。
我的WCF數據服務中有一項服務操作。 這樣的東西
[WebGet]
public IQueryable<VSuppliersExtra> GetAllVSuppliers()
{
List<VSuppliersExtra> lstVsup = new List<VSuppliersExtra>();
// add some VSuppliersExtra entities to the list
........
return lstVsup.AsQueryable<VSuppliersExtra>();
}
在我的客戶中
oCollection = new ObservableCollection<VSuppliersExtra>(jp.CreateQuery<VSuppliersExtra>("GetAllVSuppliers"));
//Open a new window Change collection and update the changes in the DB
.......
//run the same query again
.......
oCollection = new ObservableCollection<VSuppliersExtra>(jp.CreateQuery<VSuppliersExtra>("GetAllVSuppliers"));
現在,一切正常,但第二次調用服務操作將始終為我提供相同的結果,而無需進行更改,直到我重新啟動應用程序為止。
我檢查了數據庫,所有更改都保存到了SQL Server,我已經檢查了服務中的函數,並且它確實返回了更新的數據...但是,我得到的結果集是相同的!!!! 客戶端有緩存嗎????
好吧,我發現了一些文章http://msdn.microsoft.com/en-us/library/gg602811.aspx
我添加了一個context.MergeOptions = MergeOption.OverwriteChanges;
就是那個把戲。
謝謝
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.