views:

164

answers:

2

When you create code from a WSDL file using SvcUtil.exe, among the many types created is an interface that derives from both the service interface and IClientChannel.

If, for example, the created service interface is called IMyService, it also creates this interface:

public interface IMyServiceChannel : 
    IMyService, System.ServiceModel.IClientChannel

Why does it define this interface? As far as I can see, it's not referenced from anywhere in the auto-generated code.

+2  A: 

[UPDATE]

Found a link on MSDN (scroll to the very bottom). Nothing implements it, but you can use it when using ChannelFactory directly.

It's there so that users can have intelisense for both your service interface and WCF infrastructure in one place.

I remember someone from MS talking about it on a podcast or some blog...

Krzysztof Koźmic
Okay, but nothing seems to implement this interface, so why would I, as a developer using IntelliSense, ever consume/use it in the first place?
Mark Seemann
Thanks for the update. It would be so much more useful if IChannelFactory<T> would have had a CreateChannel() (or if ChannelFactory<T>.CreateChannel() had been virtual)...
Mark Seemann
What do you mean? CreateChannel is virtual. Just not all overloads
Krzysztof Koźmic
The CreateChannel() method (the one with no parameters) is non-virtual, but that's the one that would have been really useful...
Mark Seemann
IIRC it calls out to the other, virtual one, so although less pretty, you can still achieve the same result.
Krzysztof Koźmic
A: 

Have you tried wsdl.exe? "svcutil /?" will show you the supported values for /tcv (target clr version).

John Grey