Quantcast
Channel: XML, System.Xml, MSXML and XmlLite forum
Viewing all articles
Browse latest Browse all 935

DataContractSerializer and xsd classes

$
0
0

Hello everyone,

I have this very devious class hierarchy that is supposed to be saved as an XML file. I found that the DataContractSerializer is quite suitable for this objects (or at least as suitable as the XAML servcies), so I went ahead and added the DataContract and DataMember attributes to all the items in the class hierarchy.

Now, the problem is, one of the classes in this hierarcy references another class (which is outside), defined in an xsd file (created with visual studio editor). The class is a nested class (yup). The topmost class inherits from DataSet, the nested class inherits from DataRow. I couldn't find any way of adding the required attributes for the DataContractSerializer, as the designer will undo all my changes upon build (since the file is automatically generated).

How can I serialize this class along with my other classes? Apparently, DataSet has a method that write XML directly, but i can't find a way to make it work with DataContractSerializer :(

The application makes heavy use of datagridview and all teh related data controls. This is probably the reason why it uses a database and xsd in the first place (i am not the one who designed it btw). 



Viewing all articles
Browse latest Browse all 935

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>