Sharing WCF Proxy classes or the classes that call those proxies

Dec 13, 2008 at 7:26 AM


Is there any way to share the generated proxy classes between WPF and Silverlight? I'm exposing the WCF service with basic-http binding. I will consume that WCF service from Desktop project and Silverlight. But i don't like to have the seperated projects so I'm looking for a way to share those generated proxy classes between WPF and Silverlight.

Note: I tried to do that but I got a lot of problems since the namespace and class structure of WPF and Silverlight have some differences.

#2. Can I share the classs that invoke the proxy class if this #1 requirement is not possible?

For example:


----------------MyEntityClass [Link from Silverlight]
-----MyProject.Manager.Desktop  ( We are doing the translation from Service Entity to Client Entity.)
----------------MyServiceManager [Link from Silverlight??   ] 
----------------MyWCFProxy [Can I use it as a link? OR Should it be an actually class?]

----------------MyEntityClass [Actual File]
----------------MyServiceManager [ Actual File] 
----------------MyWCFProxy [  Actual File.]

Dec 17, 2008 at 3:41 PM
I will answer my own questions..

#1. It's not possible to share the ServiceClients at this moment but it shouldn't be a problem since the only things that the developer need to do is "Updating the service"..

#2. Yes. but you will need to reference System.ServiceModel and System.Runtime.Serialization assemblies.

Hope it helps for other people. If you are facing any problem with this approach, please email me or drop a comment in my blog. I will get back you as soon as I can.