Pablo Galiano : Monday, August 07, 2006 - Posts

Subscriptions

<September 2010>
SuMoTuWeThFrSa
2930311234
567891011
12131415161718
19202122232425
262728293012
3456789

News

Subscribe to Pablo Galiano by Email

Post Categories

Monday, August 07, 2006 - Posts

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 Monday, August 07, 2006 4:30 PM by pga with 1 Comments