Prism V2 - Siliverlight Web Services Hands On Labs?

Topics: Prism v2 - Silverlight 2
Feb 24, 2009 at 3:30 PM
I am new to Prism.  I installed  Prism V2 Drop 9 and built the Stock Trader RI and successfully ran the WPF and Silverlight versions.
I am considering using Prism to build a Silverlight data driven application.  In looking through the hands on-labs and Prism Help file, I did not see any guidance or examples explaining how to use Prism with Silverlight web services. 
If you could point me in the right direction, I would appreciate it.  

Thank you very much,

Feb 24, 2009 at 3:54 PM
I've blogged a wee bit on the topic.  Perhaps one of the following will get you pointed in the right direction (many have short webcast)

You may want to visit my - it has a functional demo with Prism and WCF

Feb 24, 2009 at 5:20 PM
Check this excellent article Understanding WCF Servics in Silverlight 2.

Feb 24, 2009 at 5:54 PM
Some books I would "strongly" recommend:

"Data-Driven Service with Silverlight 2" by John Papa - search for him on the Internet - he has great Silverlight WCF material to include MSDN articles (available online); I consider him an authortitative source on the topic of Silverlight and WCF.

"Developing Service-Oriented AJAX Application on the Microsoft Platform" by Daniel Larson

"Microsoft .NET: Architecting Applications for the Enterprise" by Dino Esposito and Andrea Altarello

These books were instrumental in helping me build an Enterprise Level Framework (around Prism/WCF) in the absence of authoritative sources  / samples.

Feb 25, 2009 at 12:07 AM

Thank you for your response.

I bought "Data-Driven Services with Silverlight 2" as soon as it hit the market.  After review and some prorgramming practice, I decided to build my data driven Sliverlight LOB application using RESTful services with WebClient and HttpWebRequest.  That decision was driven in part by a strong desire to avoid depending on magical service client creation as you point out above.

That said, could you comment on the feasibility of developing a Silverlight application using RESTful services with Prism V2?         

Feb 25, 2009 at 3:20 AM
Unfortunately I have not had the ability to use RESTful services...  I'm developing a Patient Record Management System for local doctors and the idea of patient records being available via REST would probably not go well with HIPAA.   On a different contract our first Silverlight/WCF application was built around an Employee Service that is fed from multiple data sources, i.e.,  Active Directory and other proprietary systems; having employee information available via REST was not an option.  So I have no experience in this area (yet)...  

I have a pretty decent workaround (until a SvcUtil is available to generate proxy classes).  I still have to update every Web Service whenever I update the service interface but I can then delete the configuration file;  the entire solution, i.e.,  Unit Test, WCF Services, Silverlight application/modules and ASP.NET all work off a single Web.Config (through the power of Unity).

The following is why I can delete the configuration file after manually Updating the WCF Service reference: 

        /// <summary>
        /// Initializes a new instance of the <see cref="DoctorServiceDAL"/> class.
        /// </summary>
        /// <param name="aggregator">The aggregator.</param>
        public DoctorServiceDAL(IUnityContainer container)
                // Set container reference for class use
                Container = container;

                IServerConfiguration config = container.Resolve<IServerConfiguration>();

                // Use basic HttpBinding on both Silverlight and Desktop
                BasicHttpBinding binding =
                    new BasicHttpBinding(BasicHttpSecurityMode.None);

                binding.Name = "bndDoctorService";

                // Get the WebServiceURI from the unity container
                Uri baseAddress = new Uri(config.WebServiceURI_DEV);

                EndpointAddress address = new EndpointAddress(baseAddress);

                // Instantiate our service using configured data
                client = new wcf.DoctorServiceClient(binding, address);


Feb 25, 2009 at 1:29 PM

Thank you for taking the time to post some code from your Patient Record Management System to provide a workaround!

I will study it and try to move forward.


Aug 6, 2009 at 3:38 AM
I copied a previous post to this one and deleted the emails from the previous post at the request of one of the people in the email. Unfortunately this causes the post to be out of sequence. 

billkrat wrote:
I agree, I started with this Blog but be wary!

Now we may turn our attention to the client application.  To begin, let me start off by reminding everyone that you shouldn't ever use "Add Service Reference" in Visual Studio for magical service client creation.  The code is incredibly verbose, hard to manageable, edits are prone to being overwritten, and it's almost always used as an excuse to not actually learn WCF.  There are few things worse than having to deal with people who thing they know a product simply because they know how to use a mouse.  There are reasons why Juval Lowy, in all his books and talks, repeatedly tells people to avoid using this flawed feature.  Fortunately, as professionals, we have the ability to understand how to do things without magic.

The above excerpt from the mentioned link sent me on a long hard wild goose chase (considering the title of the blog).  To make a very long story short I'll share correspondance that I had with a Silverlight Web Services Team member.

-----Original Message-----
From: Yavor Georgiev
Sent: Monday, January 12, 2009 12:05 PM
To: Bill Kratochvil

Cc: CDF Silverlight Customer Issues
Subject: RE: (Silverlight Web Services Team) : SLSvcUtil - what is recommended P&P?

Hi Bill,

Thanks for your note.

I understand the scenario you are encountering in your enterprise app around managing config files. This is a common customer request and a command-line tool like svcutil is being considered in the next version of Silverilght.

Unfortunately we don't have any additional tips we can provide at this point. Please continue to follow our blog for SL3-related updates.


-----Original Message-----
From: bill  Kratochvil
Sent: Wednesday, January 07, 2009 7:21 PM
To: Yavor Georgiev
Subject: (Silverlight Web Services Team) : SLSvcUtil - what is recommended P&P?
Importance: High

Can the team provide guidance for consuming WCF service for enterprise level applications?   My initial efforts were somewhat frustrating as the Silverlight forums have you going in circles looking for a SLSvcUtil that doesn't exist, or SVCUtil flags that supposedly support Silverlight (that no one can reference).

The following blog highlights an issue with using Prism/CompositeWPF and Silverlight - the main assembly has to have a copy of the ServiceReferences.ClientConfig referenced in a module (separate assembly):

The above provides a simple solution for a single module that consumes a single WCF service.   When we have 20+ modules, configuration promises to be quite the nightmare complicated by a cyle that has the solution moving through development, staging and production environments.

"Add Web Service" doesn't seem to be a viable solution.

Your guidance and assistance will be appreciated as we have numerous sprints planned throughout the year that will be based on the infrastructure I provide; as an Independent Contractor I have a large responsibility to get this done right .

Bill Kratochvil
Global Webnet, LLC
This message was generated from a contact form at:
It was submitted by BillKrat

Your contact information was not shared with the user.