-1

Can anyone point me to the most efficient, or at this point, any way to do server side paging in Silverlight using an MVC RESTful API layer?

I have a very large overhead call that can hypothetically return thousands upon thousands of complex objects which in turn can contain dozens of complex objects themselves. I want to limit this to 10 per call using paging.

I'm looking at the Silverlight DataPager and although you can use RIA services for server-side paging, I'm not sure how, if at all, you could incorporate a REST API call.

I was going the route of simply modifying my API call myself to accept a start point and count of records to return, but although this works on the API/server-side, the Silverlight's DataPager "PageCount" and other items are read-only and I cannot manually set those knowing my dataset count.

Would the only remedy be to continue the way I'm going but create my own UserControl and override that read-only functionality in some way?

ghost_mv
  • 1,170
  • 4
  • 20
  • 43
  • What is the problem with your current solution? What has RIA got to do with REST? – Dave Hillier Aug 10 '12 at 23:35
  • the problem with my current solution besides the fact that i had to basically do paging manually from the ground up is that with the standard silverlight pager everything is read only. so i can't manually set the page count or anything. i'll have to come up with my own proprietary pager. – ghost_mv Aug 17 '12 at 15:36
  • i don't understand the "downvote" and think it's pretty childish, but i appreciate your suggestions anyways and decided to go another route. – ghost_mv Aug 21 '12 at 17:03
  • that comment seems a bit hypocritical when you've made two down votes to answers of this question. Perhaps you should consider commenting. Your question may have been overly specific as you're the only one to answer. – Dave Hillier Sep 01 '12 at 19:59
  • i did comment on the overall question itself, not specifically to the answers. the answers didn't address the problem at hand that i'd specifically already given reasons that i did go down the suggested road. – ghost_mv Sep 13 '12 at 16:44
  • perhaps you should consider revising your question so that it appeals more to others. You gave no specific reason for your downvotes. – Dave Hillier Sep 13 '12 at 22:11
  • So you immaturely downvote my entire question? Come on man. Let's be grown up here. I officially apologize for hurting your feelings by downvoting your answer. – ghost_mv Sep 26 '12 at 21:30

3 Answers3

0

The Silverlight HTTP stack is not great for REST. The default mode of browser based requests converts requests to either 200 or 404. This means you have to use client mode so that you can use techniques like here. You can use the Client Stack - but that is limited too.

Paging in REST is usually implemented like a linked list. Your response contains a link to the next set of objects.

WCF RIA is a technology that generates both client and server side code. I don't understand how it relates to REST. Either use REST or WCF RIA.

Community
  • 1
  • 1
Dave Hillier
  • 18,105
  • 9
  • 43
  • 87
  • 1
    well... it's not exactly true that Silverlight can't handle other response than 200 or 404. Since v3 we have the Client networking stack that let you use much more than the brwoser based one. Have a look at: http://www.wintellect.com/CS/blogs/jprosise/archive/2009/10/14/silverlight-3-s-new-client-networking-stack.aspx – mCasamento Aug 11 '12 at 18:52
  • Updated - the question is a bit... confused. I agree with your RIA answer. – Dave Hillier Aug 11 '12 at 20:42
0

I believe that the best way to get data on silverlight is WCF Ria Services. It's a bunch of code built upon WCF but it let you query your datasource with dynamic linq filtering/ordering/paging and grouping client side. Have a look at http://blogs.msdn.com/b/saurabh/archive/2009/11/23/understanding-the-wcf-in-wcf-ria-services.aspx

As far maintenability/performance, I've architected and co-developed an internal site with this technology that serve 500+ contemporary users on a data model of about 300 classes and I think that to deliver the same capability with plain WCF I'd spent much more developers time. Be careful however that WCF RIA it's a bit opinionated and you may need to trick something, however, WCF RIA it's highly customizable especially server-side.

mCasamento
  • 1,413
  • 1
  • 11
  • 21
-1

I simply had our UX designer create a new paging UI control that I manually manage myself and use my own paging REST API.

ghost_mv
  • 1,170
  • 4
  • 20
  • 43