开发者

Channel Factory in WCF

开发者 https://www.devze.com 2023-01-02 01:05 出处:网络
Hi all i am new to WCF i wanted to knowif 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 cha

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开发者_JAVA技巧 are updated automatically how????


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

0

精彩评论

暂无评论...
验证码 换一张
取 消