8 - Summary

Let's make a summary of all described communication methods.
As you could notice, using all proxy classes and WebClient class do not require to perform synchronization with UI while updating XAML elements from callback. You need to remember that only when using HttpWebRequest.

Which method should I use?
It depends on your own scenario. Use one of the web services (ASMX or WCF) if you have already created complex methods for your web application which you would like to use by your client application. You can simply call them without creating their equivalents on the client side.

For example:
Both in the previous chapter and in my latest post I am using web service which is internally calling TreeHelper.GetDocuments() method to get the documents' data. This method is too complex to create it using ADO.NET Data Services. More over, if you did so, you would have to keep two functionally identical versions of one method: one for the server and one for the client.

On another hand, use ADO.NET Data Service in such scenarios where you do not need identical methods on the server side. But do not use ADO.NET Data Service if its entity data model should contain dynamically modified database tables.

For example:
You will include some document type table into your entity data model. Then you will modify fields of that document type on the server (Site manager -> Development -> Document types -> edit document type -> Fields tab). Finally, your client application will not see new/updated columns of that table because its entity data model will not be updated automatically. You can do so manually using Model Browser in Visual Studio but I didn't find the way how you can do it programmatically using client script - something like "Check if the table columns were changed. If so, run the script to update the entity data model." I'm not sure if it is even possible.

If you would like to build your own HTTP-Based service (e.g. some kind of REST service), I strongly recommend you to use WebClient class instead of the HttpWebRequest class. WebClient class implementation is simpler and do not require to handle the synchronization while updating the XAML from the callback. However, HttpWebRequest supports a larger subset of the HTTP protocol, which tends to make it more appropriate for some advanced scenarios.

Here it is - Silverlight news in Kentico CMS!
I have just finished the prototype of the "Silverlight Repeater" web part which will enable you to specify XAML data templates and data filter in the very same way as you do in CMS Repeater or CMS Datalist. Plus you will be able to define animated effects for switching between the list and selected item views.  See the screenshots bellow:

Silverlight repeater web part XAML transformation
 Silverlight repeater web part  XAML transformation

Another thing I am currently working on is general "Silverlight Data Source" web part. It means our goal is to separate data from the control itself. I will not explain you the way it will be working. The important for you is the fact that you will be able to attach such data source to any Silverlight list control (Silverlight Repeater, Silverlight Datalist etc.)  

It means we continue exploring Silverlight possibilities within our CMS and you can expect something like that in some of the future versions. Please, do not ask me when. The only thing I can tell you at the moment is that it's really easy to use and looks amazing:) Please, be patient.


This article is part of the Data communication in Silverlight 2.0 tutorial.
Share this article on   LinkedIn

Petr Vozak

Technology Partnership Product Owner at Kentico. He works with technology partners to enrich the Kentico product offering and bring greater value to those using our products.