473,387 Members | 1,721 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

XML from SQL or from DataSet - Design Question!

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.
Nov 15 '05 #1
1 1488
Hi PCC,
A very interesting design decision indeed. Here's my
$0.02 -
I've used both ways in different projects too.A couple of
things that you might want to consider :

1)What is the format of the XML data expected by the
client? Do you have complete freedom to define the
expected schema the way you want or should it conform to a
particular specification? Converting the Dataset to XML
generates alot of extra XML stuff that you might not
really need and you might want to think of using an XSL.
IF that does happen, then it might help to use a SQL
template at the DB level and apply the XSL there. Of
course SQL Managed clases also guve you the ability to do
all this on the clent-side if server load is a concern.

2) If you are absolutely sure that all u need to output is
XML, then why use a dataset? Why not just use
SqlXmlcommand.ExecuteXmlReader to get the XML stream back?

3) If you think that at some point of time you might need
to use the data to perform databinding using ASP.NET
controls etc., then it makes sense to stick to using a
dataset (the other option of course is using XML data
islands on IE client-side OR using an XML deserializer to
create an object out of your XML OR rad in the XML in the
dataset I guess :-))
-----Original Message-----
I am writing a data access layer for a web service. Data from the webservice 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 thenoutputting XML from the dataset as the response? All my sprocs are simpleCRUD spocs just to keep maintenance easy.

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

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

Nov 15 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Diego TERCERO | last post by:
Hi... I'm working on a tool for editing text resources for a family of software product my company produces. These text resources are found in a SQL Server database, in a table called...
0
by: Mike | last post by:
Hi, I am trying to solve a problem with a DataSet issue I am having. In my app the user selects certain options and based on those options it goes out to the db to get data based on those...
3
by: redneon | last post by:
I've populated a DataSet in my C# program and verified that it contains the data I passed it. I've then created a blank CrystalReport and set it's DataSource to my DataSet. Then I created a...
5
by: Karl | last post by:
Hi C# experts, I am to C# and .NET. I am writing a database application using C# and Dataset. In Sql server, I have a Acount table which contains over 100,000 records. This table will be...
1
by: stormogulen | last post by:
Hi! I'm hoping someone can help me come up with a 'best possible solution' for the following problem: I'm trying to design an addressbook, i.e a storage for adresses. I would like my adresses...
1
by: Keith | last post by:
Hi, I created a dataset during run time and assigned it to the datagrid. But i cant get the FindBy<Key> method to work. During design time, i got a error "dtProdHdr is not a member of...
3
by: Yul | last post by:
Hi, We are in the process of designing an ASP.NET app, where a user will enter some 'Customer ID' to be queried in the database. If the ID is valid, several stored procedures will be called to...
4
by: dtblankenship | last post by:
Hello everyone, I know this question has been asked many times in the forums, and after spending a few days reading, I am still confused as to the answer. I have a ListBox (lstBox),...
5
by: Mark Olbert | last post by:
I'm starting to play around with VS2005 and ASP.NET 2 and have some questions. The typical pattern for a data-driven aspx page in v1.1 was data connection -> data adapter -> dataset -> bound...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.