I am looking for a best practices or sample showing how a user would query for varying collection counts in the ui and adjust the "AnctipatedSize" property of a virtual collection accordingly to reflect proper total pages.
For example, we use EntityQueries in RIA, should the query be executed and returned in total to a viewmodel private collection to get the actual count and adjust the anticipated size (to get a correct page count), then using SkipTake against that private cache for paging?
Thanks
The DataPage model, assuming it is what was presented here, is a potential solution yet I am wondering what can be done with EntityQueries in WCF RIA. You have another presentation that I would like to see expanded upon to show how to better deal with the server processing vs silverlight client and paging, while using EntityQueries and VirtualCollections.
Now whether the DataPage<T> response model should/could be combined with the RIA methods on the DomainService, and requests to page go to the service on each page.
Or do what I did and return the complete result set to a ViewModel and have the count done there by setting IncludeTotalCount = true on the initial EntityQuery and just use the VirtualCollection to handle the rendering of the prefectched data to the grid with linq.
I just would like to know your thoughts, hope I haven't confused matters.
Regards,
Adam
I'm checking if you have any more questions or concerns regarding the virtual collection.
Thanks,
Hi,Let's use the VirtualCollection as a source for a grid. The grid access the first page and the VirtualCollection requests data from the application.The application can use a WCF service to request items from the server when VirtualCollection fires ItemsDataRequested.The GetDataPage is a sample method that returns a data page: public DataPage GetDataPage(int startIndex, int count, ...)The DataPage class has three properties: DataItems - the records StartIndex - the index of first item that the VC requests DataCount - the total number of itemsIn a DataPageCompleted eventhandler the application calls the LoadItems method: _virtualCollection.LoadItems(e.Result.StartIndex, e.Result.DataItems); if (e.Result.DataCount > -1) { // here the application can set the actual count _virtualCollection.AnticipatedCount = e.Result.DataCount; }Hope this helpsRegars,Marin