Serializable base class added to XSDToClasses project

At the prompting (or complaint) of a reader, I’ve shared a base class that I use with my code generator.

The generated code is “pure” in that it doesn’t contain any methods that don’t have to do with the data — it doesn’t implement saving and loading methods. I could create a codemodifier for this, but it could just cause trouble. However, this leaves users writing the saving and loading code over and over, and we can’t have that.

An XSD can express inheritance. Generating save and load methods for every class would cause lots of warnings and duplicated code. So I’ve created a generic base class that contains a bunch of utility methods including the save and load methods. If you want to have these in a class, just inherit the partial class from this base class and you’re ready to go.

There is an example project that shows you how to use it. There’s also a nifty serializable color class. It’s not going to work in every circumstance (for example if  your class is already inheriting), but it should reduce the amount of code you need to write.

You can find the download at google code  here.

XsdToClasses Open Sourced

The XsdToClasses tools, which I’ve been using for most of my software development for many years, has been published as open source at Google Code. The license is the GPL V3; note that since the XsdToClasses tool is a code generator, the tool itself is GPL, but the code it generates is most definitely not; the output from the program can be under any license you like.

I use this tool so much, and it has saved me many hours of development time over many years. May it serve you well also.

Follow

Get every new post delivered to your Inbox.