R. Michel

Hello,

I'm building a distributed application composed of several WCF Services and a front-end web application.

Each of the different services (Service1, Service2, Service3, ...) expose a set of methods that pass custom classes as parameters: Order, Client, ...

The web application thus calls the exposed methods using the svcutil generated proxy classes.

In some cases, I would like to use objects returned from 1 service as parameters used in another service:

Client c = Service1.GetClient();
Order o = Service2.CreateNewOrder(c);

Although the class types (Client, Order,...) used in my services are the same, svcutil generates different proxy classes in different namespaces, for each service:

Service1.Client is not the sames as Service2.Client

How can I share the same class among separate services



Re: Windows Communication Foundation (Indigo) Sharing Parameter Types among WCF Services

Mohammad Makarechian - MSFT

Hello,

You can put the data classes such as 'Order' and 'Client' that will be exchanged amongst services in a separate, common (shared) assembly (or assemblies, if you prefer that in your design) and then use the '/r' option of svcutil.exe to refeerence the assembly (or assemblies) when generating proxy code from the services. This prevents svcutil.exe from re-generating these data classes.

Thanks.





Re: Windows Communication Foundation (Indigo) Sharing Parameter Types among WCF Services

Amit Sharan

Hi, I am experiencing the same problem in my services design.

The problem with the solution above (/r switch) is that:

  1. It doesnt' work when using XmlSerializer
  2. A remove system that generates a proxy to my services via the wsdl, doesn't have the shared objects assembly.

My question:

Is there a way to export all the services in a single WSDL and manipulate it in a way such that the generated types will be 'global' and shared among the generated proxies





Re: Windows Communication Foundation (Indigo) Sharing Parameter Types among WCF Services

Zhisheng Huang - MSFT

Have you try the /n option of the svcutil It generates type into the designated namespace.