开发者

Customizing the message contracts when creating a WCF service reference in Visual Studio 2010

开发者 https://www.devze.com 2023-03-10 23:49 出处:网络
Is it possible to modify how message contracts are generated when add开发者_Go百科ing a WCF service reference in Visual Studio 2010?Specifically I want the request and response objects to have propert

Is it possible to modify how message contracts are generated when add开发者_Go百科ing a WCF service reference in Visual Studio 2010? Specifically I want the request and response objects to have properties instead of public fields.

I have no control over the WCF service itself, just the client.


I don't think you can control the proxies that get generated, but you can modify them once they are built. Why do you want to change the proxy?


You can't control the code in the generated proxy. If you want, you can do the proxy generation yourself, using the MetadataExchangeClient / ServiceContractGenerator classes. They'll give you a CodeDom object containing the code which you can modify (i.e., change fields into properties). There's an example of using the MEC/SCG classes in the MSDN forum post at http://social.msdn.microsoft.com/Forums/en-US/wcf/thread/14100bbb-9a73-4bcc-b513-088bb2e5ec65.

0

精彩评论

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

关注公众号