Pablo Galiano : ChannelFactory versus Proxy generation

Subscriptions

<November 2008>
SuMoTuWeThFrSa
2627282930311
2345678
9101112131415
16171819202122
23242526272829
30123456

News

Subscribe to Pablo Galiano by Email

Post Categories

ChannelFactory versus Proxy generation

When creating a WCF Client we have two possibilities:

The well known option is to create a proxy using svcutil.exe, this implies having the proxy class itself and the corresponding changes to the application configuration file.

But we have another option, we could use the ChannelFactory class to construct a channel between the client and the service without the need of a proxy.

Suppose that we have the following contract:

   contract.jpg

This is the codesnippet for the channel creation on the client:

channel.jpg

This has in my opinion a couple of benefits:

  • We dont need to generate the proxy class and configure the client.
  • In a development enviroment everytime that we add/modify a service contract/data contract/message contract we need to re-generate the proxy for the client. This could save time everytime that we need to run our tests :)

Please check the documentation for more information.

 

Pablo

posted on Monday, August 07, 2006 4:30 PM by pga

# re: ChannelFactory versus Proxy generation @ Wednesday, April 09, 2008 2:26 AM

Thanks, just what I was looking for. Generate code? No way!

Inv