开发者

Any way to stop wsdl.exe producing output for every class in a hierarchy?

开发者 https://www.devze.com 2023-01-29 11:26 出处:网络
Take a simple example - I have a \'Car\' class that inherits from a \'Vehicle\' class (BTW I\'ve using Vs2010 and C#).I write myself a trivial web server method (using asmx) that returns a \'Car\'.

Take a simple example - I have a 'Car' class that inherits from a 'Vehicle' class (BTW I've using Vs2010 and C#). I write myself a trivial web server method (using asmx) that returns a 'Car'.

Looking at the WSDL from the ASP.net generated pages I get WSDL generated from the underlying 'Vehicle' class as well as the 'Car' class. Given开发者_如何转开发 that the outside world need have no knowledge of the 'Vehicle' class is there any way I can stop the WSDL.exe producing code for it?

Thanks

SAL


I think in this case you should simply create a separate Car class (that doesn't inherit from Vehicle) for the purposes of serialization, and map between them. AutoMapper may help remove some mapping code, but it shouldn't be tricky either way.

0

精彩评论

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

关注公众号