I wonder what is the best way to transfert data from the database to the WCF service to the client between these two options:
Option 1.
I have two tables in my database, “data1” and “data2”.
The to table are linked by “data2Id”. data2Id is not unique and can be linked to more then one DATA.
data1:
dataId | data2Id
----------------
int | int
int | int
... | ...
data2:
data2Id| DATA
----------------
int | string
int | string
I would then do a SELECT with an INNER JOIN to get the DATA in data2 with the correct dataId. Then, I would send the found strings in a List
Option 2.
data1:
dataId | DATA
----------------
int | XML
int | XML
... | ...
And the XML would look like that:
<DATA>string</DATA>
<DATA>string</DATA>
<DATA>string</DATA>
<DATA>string</DATA>
I would then SELECT the right DATA with the wanted dataId. Then I would send the XML to the client to parse it.
Does sending a huge list of string trough the WCF to the client would be more or less efficient then sending an XML and parse it client side?
I suppose you always want to do your best to minimise the amount of data going over the wire (within reason of course)
You need to weigh up the pros and cons of filtering the data on the server (and sending less data over the wire) and filtering the data on the client, which would give you more flexibility (but at a cost as it takes time to send the data over the wire)