WCF - Can I generate one proxy from two separate interfaces

483 Views Asked by At

I have two separate interfaces and two separate endpoints (.svc files) defined in a single WCF project. These interfaces share common objects in the project. Is there a way to create a single proxy that combines both interfaces and all the objects, since they are shared?

Thanks!

2

There are 2 best solutions below

2
laconicdev On BEST ANSWER

While searching here, I ended up finding another thread (I lost the url) which suggested using the following svc syntax:

svcutil.exe /ct:System.Collections.Generic.List`1 /ser:Auto /tcv:Version35 /n:*,MyNamespace http://localhost/MyService/Services/Service1.svc?wsdl http://localhost/MyService/Services/Service2.svc?wsdl http://localhost/MyService/Services/Service3.svc?wsdl

By doing this, I was able to create a single proxy which had three interfaces and three client classes, but all objects that were common in the implementation appeared only once.

0
jonnyb On

You can implement multiple interfaces in one service:

public class MyService : IContract1, IContract2
{

}

Then you can have a proxy for that service that uses both contracts.