When a query has a non-zero Top operator it’s not saved to the QueryCache.
So, for the questions in the first post -
EntityQuery eq = new IdeaBlade.Persistence.EntityQuery(typeof(SomeEntity));
eq.Top = 50;
_PMCentral.GetEntities<T>(eq,QueryStrategy.Normal)
This will go back to datasource each time it’s run because the query wasn’t placed in the QueryCache.
Second part -
EntityQuery eq = new IdeaBlade.Persistence.EntityQuery(typeof(SomeEntity));
eq.Top = 0;
_PMCentral.GetEntities<T>(eq,QueryStrategy.Normal)
eq.Top = 50;
_PMCentral.GetEntities<T>(eq,QueryStrategy.Normal)
The first query was added to the QueryCache because the Top operator was 0. On subsequent execution, even though the Top operator has now been set to 50, DevForce will first look in the QueryCache to see if the query has been executed. It finds the query, and runs the query against cache, applying the Top operator locally.