2010-12-02 82 views
3

我無法理解DomainDataSource.AutoLoad 和DomainDataSource.RefreshInterval之間的關係。Silverlight RIA服務DomainDataSource,AutoLoad和RefreshInterval之間的關係

如果我爲給定的DomainDataSource啓用AutoLoad,服務器會以很高的速率反覆詢問 ......這不是我想要的。

因此,我將RefreshInterval設置爲「00:00:10」(每隔10秒?),但是根本沒有加載 數據。

如果我將AutoLoad設置爲true,則RefreshInterval的值似乎不會影響任何內容。

然後有LoadDelay屬性,似乎與AutoLoad, 有關,但將其設置爲10秒不會減慢對服務器的重複查詢。

它變得更糟,因爲我正在嘗試的應用程序是基於導航的應用程序 並且每次頁面加載時,似乎都會同時執行更多查詢,即使您轉到其他頁面應用。

我明確地做錯了什麼,但我無法弄清楚是什麼因爲我無法理解這些屬性的細節。我閱讀了MSDN文檔,但曾經他們沒有真正幫助。

我希望它不是模糊的問題。

回答

1

MSDN帶來了曙光:

When AutoLoad is true, any property change affecting the load query 
will automatically invoke a Load after the specified LoadDelay. 
Examples of properties that impact the query are PageSize and 
FilterOperator. Also, changes to dependency object collections, such as 
FilterDescriptors and changes to the dependency properties on elements 
contained in those collections, will affect the query and prompt 
an automatic Load. 

和RefreshInterval

When a non-zero TimeSpan is specified, a Load operation is automatically 
invoked each time the interval elapses, as long as CanLoad is true. When 
this property is set, a timer starts, regardless of the value of the 
AutoLoad property or whether a Load has been executed previously 

所以這聽起來像自動加載和RefreshInterval沒有直接關係的。有一點需要考慮的是CanLoad屬性,它在許多方面被設置爲false。這可能是阻止你的RefreshInterval工作的原因。如果DomainContext中的任何實體有待處理的更改,CanLoad會被設置爲false,這些更改可能會在您不時意識到的情況下發生。

DDS的真正專家是RIA服務團隊的成員。他們在RIA Services forums以外比這裏更多,所以問問可能有一個好主意。

+0

馬特,我會檢查出這個鏈接,我不會標記你的答案,因爲也許有人找到了解決方案。但thnx的提示。看起來你從文檔中瞭解到同樣的東西,因爲我不知道CanLoad屬性問題(+1) – TimothyP 2010-12-02 14:48:29