Solved

WCF dataservice serverside paging and silverlight datagrid clientside paging?

Posted on 2010-08-26
4
1,831 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

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

Suggested Solutions

In my previous article (http://www.experts-exchange.com/Programming/Languages/.NET/.NET_Framework_3.x/A_4362-Serialization-in-NET-1.html) we saw the basics of serialization and how types/objects can be serialized to Binary format. In this blog we wi…
For most people, the WrapPanel seems like a magic when they switch from WinForms to WPF. Most of us will think that the code that is used to write a control like that would be difficult. However, most of the work is done by the WPF engine, and the W…
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…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…

708 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now