XML from SQL or from DataSet - Design Question!

P

PCC

I am writing a data access layer for a web service. Data from the web
service is to be returned as XML. My design dilemma is this...

Should I be returning XML from my stored procedures using the "for xml"
clause or loading the data into a DataSet in the data access layer and then
outputting XML from the dataset as the response? All my sprocs are simple
CRUD spocs just to keep maintenance easy.

My own bias is to output XML from the DataSet after I have loaded it in from
the sproc. That said, my real question is if I am not really doing anything
with the data until it ends up in a DataSet within the Business Object
Layer, why should I bother to load it into a DataSet in the Data Access
Layer and then serialize it as XML when I can get XML string from the
database?

You can tell I am a little lost and confused here. You advice is greatly
appreciated. I know how to do both, but am not sure which is best in the
long run. Thank you.
 
T

Thomas

DataSet is serializable. If your receiving end is .Net
Frameworks then why not serialize/deserialize the
Datasets. ADO.NET had made DataSets so easy to use.

I'm not a big fan of SQL XML. For one thing, debugging
in Query/Analyzer is a pain in the butt. If your query
gets a bit complicated (two or more tables), your result
may not give you the schema you want. I only use SQL XML
when I need hierarchical data.

Hope this helps!
Thomas
 

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