Produce easy to use and commented C# classes from XSD that could change



On a recent project we need to talk to a XML web service over HTTP. The project will run for a long time and we know that in that time the schema of the XML is likely to change some what although not drastically.


The service has a bunch of XSD files and we intend to generate out classes from these XSD's using xsd2code for Visual Studio.


I have a few thoughts/worries however. The names for the properties in the class are a little curt and I'd like to make them a bit more friendly, so instead of



private string ix_Rep_St { get; }


I'd rather it was something like:



private string BookingStatus


Even better I'd like it to have intellisense which I could add by editing the generated classes however as mentioned we are expecting these to change a little which could mean having to regenerate it all.


I'm after a way to end up with a set of classes that work with the service, yet are easy to code against (ie they use readable syntax) and have intellisense. I'm not sure how best to go about it.


My options seem to be:



  • Find away to separate out comments from the generated class file?

  • Generate everytime and put up with it, have some higher level classes interact with these nastily named ones from the service which should keep the mess contained.

  • Wrap all my classes in new human friendly wrappers with intellisense added in. Store the XSD's in source control and use that to highlight when something has changed then manually add it in


The wrapper sounds appealing if it where not for the amount of files I need to wrap, 30+ by my rough calculations which makes it feel like a bit of a slog.


Any pointers/ideas?


No comments:

Post a Comment