Hi mickan,
Yes, Count() causes immediate execution of the query, but that doesn't mean that all the records have been returned to the client.
You can verify that:
mgr.Clear();
var ordersCount = mgr.Orders.Count(); // will return the number of Orders in the datasource
var orders = mgr.Orders.With(QueryStrategy.CacheOnly).Execute(); // will be empty because no Orders were loaded in the client
or, if working asynchronously:
mgr.Clear();
var ordersCountOp = mgr.Orders.AsScalarAsync().Count();
ordersCountOp.Completed += (o, args) => {
var ordersCount = ordersCountOp.Result; // will return the number of Orders in the datasource
var orders = mgr.Orders.With(QueryStrategy.CacheOnly).Execute(); // will be empty because no Orders were loaded in the client
};
To answer your questions:
1. Only the requested rows will be transfered from the data source.
2. Not necessary. (given explanation about Count() above)
3. If you are retriving a really large number of records and it's causing your app to 'hang' during this retrieval, I'd suggest issuing 2 queries: one for the records that will populate the first grid page and other for all records.
Regards,
Silvio.