Best practice when calling services via proxy

Topics: Prism v4 - Silverlight 4, Prism v4 - WPF 4
Feb 25, 2011 at 12:08 PM


I'm in the beginning of creating my first Silverlight application with PRISM and want to know how I should structure my code. The problemdomain is how to add data to my PRISM application from multiple services and how to create client-side proxies to do the calls?

I have looked at the reference applications but I can't see any good solution for calling real-world web services there. Am I wrong?

Well, I have read that it is bad practice to use "Add Service Reference" and create the proxy that way. I like the idea of creating my own proxy-classes based on the ClientBase<T> class and so on, because it gives me full controll over the code. I would also like to create a infrastrucure module that provide all the modules with a service reference. Does anyone think the same and have some code snippets to show me how you have solved it? Is this the right way of thinking?

I have a WCF service that gives me access to the business logic. The service has multiple endpoints (Customers, Products, Suppliers etc), I may as well let each module (Customers, Suppliers) to have their own service reference because each module will only need one of the endpoints available from the service. But then again, I would like to create my own proxies and not use the "Add Service Reference", is this a weired requirement from me? Is "Add Service Reference" an acceptable way of doing it? WCF-guru Juval Lowy does not think so!!.... ;-)

I want to do the right decisions as early as possible in the project lifetime in order to use the PRISM framework for what it's worth.


Thanks in advance!

Feb 25, 2011 at 2:10 PM


There is no guidance in Prism regarding how to call web services. However, you might find the following threads useful, as they deal with a similar concern:

As for whether to use "Add Service Reference" for the proxy, you might find better support in the WCF Forum.

I hope you find this helpful.

Guido Leandro Maliandi