Question on binary serialization of datasets

W

Wild Wind

Hello,

I have an object which has various properties, including one which is
of type DataSet.

I need to serialize this object in binary format, but I've discovered
that the BinaryFormatter will only format datasets in XML format.

I've read various articles on how to address the problem, including
the KB829740 article which talks about using a DataSetSurrogate
class.

I'm not quite sure how this class would work in my
circumstance, because the sample it gives deals with the simple
case of just serializing a dataset, rather than serializing an
object that has a dataset.

Should I have a new property of type DataSetSurrogate in my object
and pass the DataSet object in my class to this DataSetSurrogate's
constructor? If so, how do I stop the existing DataSet from being
serialized?

Presumably, when I deserialise my object, I should use the
ConvertToDataSet method of the DataSetSurrogate property that
I get back to produce the original DataSet, right?

I would appreciate any answers/clarification I get on this subject.
 
W

Wild Wind

Hello Greg,

I've read that article, but while it talks about a new class called
CompactFormatter, it doesn't answer the very specific questions
I've asked about the use of the *DataSetSurrogate* class which is
what I am thinking of using. The questions (again) are:

To use the DataSetSurrogate for a DataSet that is a property of an
object, should I have a new property of type DataSetSurrogate in my object
and pass the DataSet object in my class to this DataSetSurrogate's
constructor? If so, how do I stop the existing DataSet from being
serialized?

Presumably, when I deserialise my object, I should use the
ConvertToDataSet method of the DataSetSurrogate property that
I get back to produce the original DataSet, right?

TIA,

Akin
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top