DataSet vs. DOM

  • Thread starter Thread starter indra
  • Start date Start date
I

indra

In our project we need to get data from a database and
return it, or cache it and return it later. We might also
get the data from a web service instead of a database.

Question, is DataSet the best option for retrieving data
from a database. Between DataSet and DOM which will be
faster for manipulating, caching, and retrieving data?

Also, just to confirm, does the DataSet store data
internally as XML. My understanding is that it does not,
it is just a data structure internally.

Any thoughts will be greatly appreciated.

Thanks in advance,
indra
 
Hi,

I would prefer to use DataSet as it gives much more flexibility. For
instance, storing current and previous values, constraints to mention a few.
Offcourse, you can persist data as a Diffgram (XML). But, there are no
second thoughts on the ease of manipulation. DataSet is the way to go.
A problem with DOM (XMLDocument class) is that it is not serializable. So,
you can have problems persisting it in session stores like State Server or
SQL Server. Also, DOM cannot be a part of the web service interface for the
same reason. On the contrary DataSet is serializable and hence gives you
more options.
 
Have a look at the XmlDataDocument. Should give you the "best" of both
worlds.

Eirik M.
 
indra said:
In our project we need to get data from a database and
return it, or cache it and return it later. We might also
get the data from a web service instead of a database.

None. Put the data into objects. We make this exclusibvely in our
applications. We write a pretty complex XML based editor (ok: editor foor a
COMPLEX configuration file that is stored in XML), and the XmlSerializer
plus "real objects" managed to give us a great infrastructure.
Question, is DataSet the best option for retrieving data
from a database. Between DataSet and DOM which will be
faster for manipulating, caching, and retrieving data?
Objects.

Also, just to confirm, does the DataSet store data
internally as XML. My understanding is that it does not,
it is just a data structure internally.

No, the Datasets does NOT store the data as xml internally :-(

My bet would be objects.
 
Hi,
How do you accomplish this? I've been going back in forth trying to
determine the best way to return data as well. DataReader is fine except
connection must remain open. DataSet seems fine but is a little resource
heavy. I looked into making a custom XML based reader (disconnected of
course) and made some progress but it has a couple of problems. First, it
has to process the data twice, once to fill the custom object, and again to
display (or do whatever you want to do) the data. Second, it isn't as
flexible as say DataSets which can be the DataSource for many web controls
(I guess you can convert before making it the datasource though).

Thanks,
Dan
 
Daniel said:
Hi,
How do you accomplish this? I've been going back in forth trying to

With programming. There are solutions to this.

Actually we spent about two many years in developing a framework for this.

Look up the term "O/R Mapper" in googlle, an be surprised. Tons of
references.

If you look for a god product on .NET - try our EntityBroker.

Thomas Tomiczek
THONA Software & Consulting Ltd.
(Microsoft MVP C#/.NET)
 
Back
Top