views:

32

answers:

1

I have 5 tables belonging to 2 different datasets, I use them to populate some grids in a page. I want to implement some snapshot functionality and I need to save the data in the tables in an XML in the database. I was thinking of simply serializing the tables to XML using the .Net XmlSerializer (deserializing also), but there is a lot of extra data, basically the table definition and some columns i don't need. My other option is to iterate through the tables and create by hand the XML; the structure is going to be quite complex, and in the page I will have to do the reverse, to iterate through the XML and add the data to the tables to which my grids are bound. How much of a performance penalty would the second approach involve, better to say, would it be noticeable (about 20 datarows per table, each table has about 4 columns)? Also, from other points of view (maintainability), what would you recommend?

+1  A: 

With a DataSet, you can create the XML. You already are aware of this, based on your question. If you want to prune the data out a bit, you could build your own XML, but you can also create an XSLT file and transform the XML to the simplified XML you are looking at. It is a one-step process, unlike the looping necessary to create XML or prune out the XML document created.

Gregory A Beamer