What is a Channel Factory and why do you use it?
If you used Visual Studio's Add Service Reference
, or the svcutil.exe
tool, you probably won't ever see a ChannelFactory.
Basically, creating the client-side proxy for a WCF service is a two-step process:
ChannelFactory<T>
for your specific service contractIf you do have control over both ends of the wire, and you can put your service and data contracts into a separate assembly, you can break apart this two step process and handle it manually:
create the ChannelFactory<IMyService>
once, this is a fairly complex and time-consuming operation, so if ever possible, try to do this only when really necessary, and then cache the channel factory for later reuse
create the actual channel using the channel factory whenever you need to communicate with the server
It's a very specific construct for WCF services, so I don't think you'll ever use it outside the WCF scope.