1

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

SAL
  • 1,218
  • 1
  • 14
  • 34

1 Answers1

1

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.

Marc Gravell
  • 1,026,079
  • 266
  • 2,566
  • 2,900
  • That'll work fine for simple cases but ultimately I want to do the same thing for some rather complex classes that have a hierarchy as long as your arm... What I've done thus far is more or less what you suggest - I have a simple 'lightweight' class that I return. – SAL Dec 07 '10 at 15:59
  • 1
    @SAL well unless you handle the WSDL manually, that is (AFAIK) he closest you'll get for asmx – Marc Gravell Dec 07 '10 at 16:18