|
Are you hand writing classes and then generating an XSD from the hand written classes?
And then are you creating class wrappers based on the XSD?
Because you won't ever be able to get LinqToXsd to instantiate your hand written classes from an Xml file.
Or write classes that cast to your hand written classes.
We have a similar situation, we have auto generated classes wrappers made by LinqToSql
And we have auto generated class wrappers made by LinqToXsd
In order to ease translating between the two, we use partial classes and extension methods to write handy helper methods for doing the convertion.
So if we have a SLUser class from LinqToSql and a BLUser class from LinqToXsd we write an extention method User.ToBLUser() and a partial method BLUser.ToSLUser()
If you really want it to flatten your own objects to Xml and vice versa, perhaps .NETs own Xml Serialization functionality would be better?
|