Solved

WCF dataservice serverside paging and silverlight datagrid clientside paging?

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

A theme is a collection of property settings that allow you to define the look of pages and controls, and then apply the look consistently across pages in an application. Themes can be made up of a set of elements: skins, style sheets, images, and o…
Whether you've completed a degree in computer sciences or you're a self-taught programmer, writing your first lines of code in the real world is always a challenge. Here are some of the most common pitfalls for new programmers.
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…
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

932 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

10 Experts available now in Live!

Get 1:1 Help Now