Search code examples
silverlightwcf-ria-servicesdomaindatasource

Silverlight RIA Services DomainDataSource, relation between AutoLoad and RefreshInterval


I'm having trouble understanding the relation between DomainDataSource.AutoLoad and DomainDataSource.RefreshInterval.

If I enable AutoLoad for a given DomainDataSource, the server is being queried repeatedly at a very high rate... this is not what I want.

So I set RefreshInterval to "00:00:10" (every 10 seconds right?) but then the data is not loaded at all.

If I set AutoLoad to true, the value of RefreshInterval does not seem to affect anything.

And then there's the LoadDelay property, that one does seem to be related to AutoLoad, but setting this to 10 seconds does not slow down the repeated queries to the server.

It gets even worse because the application I'm trying is a Navigation based application and every time a page gets loaded, more queries seem to be executed at the same time, even when you go to a different page within the application.

I'm definatly doing something wrong, but I can't figure out what because I fail to understand the specifics of these properties. I read the MSDN docs, but for once they didn't really help.

I'm hope it's not to vague of a question.


Solution

  • MSDN sheds some light:

    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.
    

    and for 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
    

    So it sounds like AutoLoad and RefreshInterval don't have a direct relation at all. One thing to consider is the CanLoad property, which gets set to false for many things. It may be what is preventing your RefreshInterval from working. CanLoad gets set to false if any entity in the DomainContext has pending changes, which can happen without you realizing it at times.

    The real experts on DDS are members of the RIA Services team. They hang out on the RIA Services forums a lot more than here, so asking there might be a good idea.