Solved

WCF dataservice serverside paging and silverlight datagrid clientside paging?

Posted on 2010-08-26
4
1,864 Views
Last Modified: 2013-11-12
Dear experts,

I have a WCF DataService with an ADO.NET Entity Framework model which is set on our test DB with 1 table in it called "Patient". This table contains 11000 records so I can test 'paging'. I've turned paging on in this service to 10 records ("config.SetEntitySetPageSize("Patients", 10)").

I have a client application in Silverlight which has a DataGrid. I've been able to set clientside paging on by using a PagedCollectionView and a DataPager.

The problem however is that this makes the serverside paging useless. Because now I have to retrieve all 11000 records 10 at a time (which is like 20 seconds delay or something) for the paging on the DataGrid to work (DataPager needs the full collection before it can calculate the number of pages ofcourse).

Isn't there a way to solve this elegantly? Basically what I want is for the datagrid to be able to retrieve the next 10 records from the WCF dataservice when the user presses 'next' on the DataPager.
0
Comment
Question by:Labelsoft
  • 2
  • 2
4 Comments
 
LVL 16

Accepted Solution

by:
SriVaddadi earned 500 total points
ID: 33541250
0
 
LVL 3

Author Closing Comment

by:Labelsoft
ID: 33565375
First off, excuse me for the delay. I've been puzzling with a colleague since you posted to figure it out.

We've finally got this stuff to work. It was for the most part link #2 you provided, so you'll get the credits.

We wanted it declarative in XAML because we want to use MVVM pattern on the client. In retrospect it made stuff quite complicated at first. Now we've got it to work it's quite simple (all thnx to WCF and Silverlight 4).

Quickly the basic steps (if anybody is interested in the exact details please feel free to contact us):

- Set up DomainService
- Give it the method to call (like for instance: GetCustomers())
- Set up DomainDataSource in XAML
- Hook up DataPager to DomainDataSource
- Hook up Grid to DataPager
- Override Count in DomainService if you want total pages on DataPager

Note: If you work with large datasets, don't forget to set up your web.config accordingly (maxReceivedMessageSize="2147483647" and maxItemsInObjectGraph="10000000" for instance).

Ok thnx! And again, contact us for details if you need it.
0
 
LVL 16

Expert Comment

by:SriVaddadi
ID: 33565426
Thanks for giving the details on your approach. I do know that DomainDataSource has an element in XAML.  Also I m not sure if you know about this but you could pass the UI element to VM through commanding whether its PRISM or MVVM light.  I agree but it would not be the best practice though as there would not be advantage of using MVVM but just an idea. MVVM is more like a discipline you should stick to in whatever may be the scenario.
0
 
LVL 3

Author Comment

by:Labelsoft
ID: 33574315
Well, to be honest, we haven't given it much thought. Now we realize that DomainDataSource and MVVM are not compatible. We are basically going to try to put the logic that the DDS does for you in a VM. It's not going to be easy, but we are going to try.
0

Featured Post

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This document covers how to connect to SQL Server and browse its contents.  It is meant for those new to Visual Studio and/or working with Microsoft SQL Server.  It is not a guide to building SQL Server database connections in your code.  This is mo…
Here I am going to explain creating proxies at runtime for WCF Service. So basically we use to generate proxies using Add Service Reference and then giving the Url of the WCF service then generate proxy files at client side. Ok, what if something ge…
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…

790 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question