Caching DataSet to a file

  • Thread starter Thread starter bbrewder
  • Start date Start date
B

bbrewder

I would like to create a way for an occassionally connected user to
cache some data from the database on their machine, disconnect, edit
it (possibly multiple times between machine power-offs), and then save
the data back to the database when they reconnect.

I plan on using DataSets to store the data in-process and am hoping to
be able to cache/reload not only the data, but also the entire schema.
The joins, constraints, etc are important to my application and will
be partially based on the database schema, so will be difficult to
rebuild in code.

I've looked a little bit at the DataSet.WriteXml and DataSet.ReadXml
methods but have not tried them yet (I've noticed in the documentation
that the ReadXml is not intended to be used "directly from your
code"). I am hoping to get some suggestions from others that have
already worked on this or similar problems.

thanks,
Brian Brewder
 
Hi,

bbrewder said:
I would like to create a way for an occassionally connected user to
cache some data from the database on their machine, disconnect, edit
it (possibly multiple times between machine power-offs), and then save
the data back to the database when they reconnect.

I plan on using DataSets to store the data in-process and am hoping to
be able to cache/reload not only the data, but also the entire schema.
The joins, constraints, etc are important to my application and will
be partially based on the database schema, so will be difficult to
rebuild in code.

I've looked a little bit at the DataSet.WriteXml and DataSet.ReadXml
methods but have not tried them yet (I've noticed in the documentation
that the ReadXml is not intended to be used "directly from your
code"). I am hoping to get some suggestions from others that have
already worked on this or similar problems.

Read/WriteXML are perfectly suited to store data and schema (to store schema
you'll have to use overload which acceppts XmlRead/WriteMode).
As an alternative you might consider serialization of dataset, though the
results are more or less the same in size (they both generate xml output -
serialization is less readable to human).
 
I realized I had forgotten about serialization last night and am
playing around with it this morning. It looks promising so far. It is
serializing the schema, data, and what changes have been made to the
data.

Thanks for your quick response,
Brian Brewder
 
Back
Top