创建动态代理对象 [英] Create Dynamic Proxies objects
问题描述
有没有办法快速创建WCF代理对象而不使用编码?在飞行中我的意思是在运行时。所以说我有一个正在访问WCF服务的智能客户端应用程序。在客户端运行时,WCF服务的数据合同已更改。我想动态地创建一个反映变更的数据合约的新代理对象。
Is there a way to create WCF proxy objects on the fly without using codedom? By on the fly I mean during runtime. So lets say I have a smart client application that is accessing a WCF service. The Data Contract for the WCF service is changed while the client is running. I want to dynamically create a new proxy object that reflects the changed data contract.
推荐答案
你应该阅读这篇文章: WCF手动方式...正确的方式
You should read this article: WCF the Manual Way… the Right Way
并调查使用ChannelFactory类。如果合同在飞行中发生变化,那么您将有很多反思来创建和调用成员,但是我不能想到你不应该做任何事情。
And look into using the ChannelFactory class. You are going to have alot of reflection to create and invoke the members if the contract changes on the fly but I can't think of any reason you shouldn't be able to do it.
这篇关于创建动态代理对象的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!