views:

138

answers:

2

hi, I am coding a webservice in ASPX which queries a local SQL-Database:

SqlDataAdapter dAdapter = new SqlDataAdapter(query, connString);
SqlCommandBuilder cBuilder = new SqlCommandBuilder(dAdapter);

my question which complex DataType (obviously serializable) should I use? One which my WinFroms-Client can receive and put in a DataGridView for presentation?

Any input is appreciated!

A: 

DataTable or DataSet

msi
For speedy development these work great. For performance and maintainability they suck.
Chuck Conway
-1: Very bad choice.
John Saunders
+2  A: 

DataGridView can bind to any objects, so I recommend returning Plain Old CLR Objects (POCO).

Don't return DataSets or DataTables, because those will cause a large amount of XML to be transferred over the wire, which isn't needed. Also, that makes your webservice all-but-unusable for alternative clients like Java. That might not be one of your requirements at the moment, but you're writing a web service, not a .NET remoting service. Therefore you should write an API that is in the spirit of the web, using simple, discoverable XML.

The scenario you're describing here is that the Data Transfer Object enterprise design pattern. Take a look at the following references:

Neil Barnwell
you have an interesting point there, ill have to look into that. thx
Hoax