views:

49

answers:

1

We will be using custom Silverlight 4.0 controls on our ASP.NET MVC web page to display data from our database and was wondering what the most efficient method was? We will be having returned values of up to 100k records (of 2 properties per record).

We have a test that uses the HTML Bridge from Javascript to Silverlight. First we perform a post request to a controller action in the MVC web app and return JSON. This JSON is then passed to the Silverlight where it is parsed and the UI updated. This seems to be rather slow, with the stored procedure (the select) taking about 3 seconds and the entire update in the browser about 10-15sec.

Having a brief look on the net, it seems that WCF is another option, but not having used it, I wasn't sure of it's capability or suitability.

Does anyone have any experiences or recommendations?

+2  A: 

You should definitely consider a change in your approach. This just shouldn't have to be so complicated. WCF is a possible solution. I am sure you are gonna get better performance out of it.

  • It is designed to transfer data across the wire. Web services in general are thought to be the "right way" to provide data to your silverlight app. WCF services are definitely more configurable.
  • Another point in favour of web services is that this approach is more straightforward than the one you apply. You don't have to serialize in JSON then to parse in JavaScript objects and then to pass them to Silverlight.
  • It is really easy to port and continue developing with wcf.
  • Last but not least your code will be much more readable and maintainable.

It seems that performance is critical in your case so you can take a look here for compraison.

In conclusion my advice is to consider a change in your approach. WCF services looks like possible solution.

Hope this helps.

Koynov
We actually ended up moving away from Silverlight, but this is a good answer for the question.
Alastair Pitts