This is a migrated thread and some comments may be shown as answers.

QDSCV not loading the same query again

2 Answers 126 Views
GridView
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Jono
Top achievements
Rank 1
Jono asked on 06 May 2011, 12:45 AM

 

 


Hi

I have a MVVM RIA services solution that contains the following query that populates a RadGridView.

 

_statusHistory = new QueryableDomainServiceCollectionView<Status>(_context, _context.GetStatusBySourceTableIDSourceTableNameQuery(_sourceTableID,_sourceTableName));
  
_statusHistory.LoadedData += new EventHandler<Telerik.Windows.Controls.DomainServices.LoadedDataEventArgs>(_statusHistory_LoadedData);

On each query that has unique parameters it executes and the LoadedData event is thrown

But when a query runs again (ie using previously used parameters) the query does not run I can tell because the LoadedData event is never thrown. The results still contains the previous queries data set.

It seem that when data is loaded from the database it works but when the data is cached in the DomainContext it does not load.

I have tried many variations of this with no luck
I want to do serverside filtering

So my question is what am I missing or do I need to go about this a completely different way?

2 Answers, 1 is accepted

Sort by
0
Accepted
Rossen Hristov
Telerik team
answered on 06 May 2011, 08:27 AM
Hi Jono,

Are you calling the Load method explicitly or are you relying on the AutoLoad functionality?

When the query has not changed since the last successful trip to the server, no AutoLoad will trigger because the query is the same as the previous one. If you want to manually tell the QDSCV to go to the server and fetch the data, you can call the Load method.

As for the entity states...

You can attach to the LoadingData event. In the event handler, the arguments contain a property called LoadBehavior. Set it to LoadBehavior.RefreshCurrent in order to clear the cache and reload all entities from the server.

You can learn more about LoadBehavior here.

If problems still exists after this, I would ask you to prepare and attach a small runnable sample project and I will take a look at it.

Thanks in advance.

Greetings,
Ross
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Jono
Top achievements
Rank 1
answered on 09 May 2011, 01:22 AM
Thanks for the information on how the loading works that has helped me pinpoint what is happening.

I have found that I was also adding an object to the QDSCV (obviously not properly) that was causing a problem which stopped the query from re-loading.

I had the a very similar problem with the QDSCV not calling Load I found that HasChanges was set to true even though I had not made any changes to I called RejectedChanges and the Load worked

_statusHistory = new QueryableDomainServiceCollectionView<Status>(_context, _context.GetStatusBySourceTableIDSourceTableNameQuery(_sourceTableID,_sourceTableName)); 
if (_statusTypeOptions.HasChanges());
    _statusTypeOptions.RejectChanges();

 

Tags
GridView
Asked by
Jono
Top achievements
Rank 1
Answers by
Rossen Hristov
Telerik team
Jono
Top achievements
Rank 1
Share this question
or