I'd like to generate C# classes from an XML Schema file. All the generated
classes should provide a basic member function framework like Save() and a
basic member element like Dirty. Moreover, I'd like to have all the
generated class properties overwritten so that a write will set the Dirty
member to true (see example below).
Is this possible using xsd.exe? Or is there some other way? Or do I need to
write my own generator tool?
Thanks for enlightening me!
TIA,
Axel Dahmen
-----------------------------------------------------------
class GeneratedClass : BaseClass
{
private int member_;
public int Member {
get {return member_;}
// this function references base class members...
set {member_=value; State=Updated;}
}
}
/// This class will be provided in another file.
/// It provides basic funtionality common to all generated classes
class BaseClass
{
protected enum StateEnum {Inserted,Deleted,Updated,Clean};
protected State;
public virtual Save(); // uses Reflection to save derived classes
}
sprotty@hotmail.com - 28 Jul 2005 15:00 GMT
Hi Axel
If your having problems with XSD.exe, then I suggest you look at Liquid
XML
http://www.liquid-technologies.com/
It supports C#, java, C++ & Visual Basic. It also supports more of the
XSD standard than xsd.exe, and may other the other tools out there.
Regards
Simon
> I'd like to generate C# classes from an XML Schema file. All the generated
> classes should provide a basic member function framework like Save() and a
[quoted text clipped - 32 lines]
> public virtual Save(); // uses Reflection to save derived classes
> }