views:

244

answers:

1

Hi all i am new to WCF i wanted to know if i use channel factory and if i make any changes in service contract whether the changes will be updated automatically in the client system or not???If the changes are updated automatically how????

+1  A: 

No, the channel factory is not updated automatically - you have to update your service reference (if you added it using Visual Studio's Add Service Reference) or you need to re-create the client side proxy from the WSDL/XSD or service URL.

UPDATE: of course, if you're sharing the service and data contracts in an assembly between both the service and the client, then of course you have the client up to date as soon as you have the new service contract DLL in place...

If you want to enable this sharing of service and data contracts, use the following setup:

  • in your Contracts assembly, have all the service contracts (interfaces) and data contracts (data types)

  • in your implementation of the service, reference that Contracts assembly and implement the service contract(s)

  • in your client-side proxy, also reference that shared Contracts assembly, and use ChannelFactory<T> to create a channel factory for the service contract interface T.

With this setup, whenever you make a change to the shared contract assembly, both service implementation and client side proxy will "get" those changes, e.g. they're always up to date and using the same service and data contracts

marc_s
Thnaks..If i add service DLL in client side then if i make any changes in the service then what should be done in order to update the client side????
If you share the DLL with the service and data contracts, then you don't have to do anything - you're sharing the same code base, after all, so any changes in your service contracts are in the client side proxy automatically (you didn't mention this very important fact in your question....)
marc_s
sorry marc its my mistake...can u give me an example how to use the channel factory and make changes in the service without changing anything in the client side????
Thanks marc...it really helped me