To serialize or not to serialize?

  • Thread starter Thread starter Paez
  • Start date Start date
P

Paez

Hello there.

My teacher asked me to do a job and I don't know how..

This is the scenario:

I must create a client/server application. The server application is a c#
web server and the client is a c# windows aplication. The web service will
connect with a access database.

So, when the client asks for some data, the web service queries the database
and sends the data to the cliente. This is where my problem begins. How can
I send the data????

Initially, I was sending the client the dataset, but I am not allowed to do
it. So, how can I send the data?

Shall I create a class "DataToSend" similary to the data that I want to send
and then create an "DataToSend" array and finally send that array?
Shall I serialize that class?
Shall I think in another way?

Which is the best practice?

Thanks in advance.

Paez
 
Hi Peter,
--That is the question:
Whether 'tis nobler in the mind to suffer
The slings and arrows of outrageous Xml,
Or to take arms against the BinaryFormatter,
And by opposing end them?


I assume that your "teacher" is placing this arbitrary restriction that
you
cannot return a DataSet.

I hope not.

- And when your done with this exercise, perform the next one without the
appropriate FCL libraries so you can continue to learn how not to write apps
;)

<snip>
 
I assume that your "teacher" is placing this arbitrary restriction that
you
cannot return a DataSet.

Unfortunatly, that is true! His reason is: "we must think in low rate
networks. A dataset is way to large!... Blah, blah, blah..."
Create a class that mirrors the datatable(s) return, with fields that
mirror
the columns in the dataset.

I was thinking about that... but an array with, let's say, hundreds of this
class elements is too large also, or am I wrong? Maybe iste smaller than a
XML Dataset, but can it resolve my problem? I was thinking in paging this
array, sending smaller portions of data in several times... but I don't
figure how to do it....

Thanks to you all!

Paez
 
I agree, but I have already seen this before - where the professor,
instructor, etc. insists that your Webservice cannot return a Dataset because
SOAP serializers from other platforms don't speak "DataSet". Which of
course, is ludicrous, since a Dataset via SOAP is nothing but legitimate XML
following a perfectly fine schema - which schema is freely available.
But you have your purists.
Cheers,
Peter
--
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com
 
Hi There.

Peter:

The reason why my teacher insists that a WS cannot return a Dataset is due
to low rate networks, not due to SOAP schemas. I think that's because a XML
Dataset is too large.

So, in my WS, I want to turn my dataset in some type of class, and then send
the client an array of this class elements. Even so, I don't know if this is
a good idea. What if this class has hundreds or thousands of elements? Isn't
that too large also? I looking for a way to send the data in small portions,
but I don't know how... :(

Thanks for your answers.

Paez
 
My friend,
the overhead of the ADO.NET DataSet schema is trivial compared to the
baggage of transmitting hundreds or thousands of rows of data, no matter what
the object is.
There are certainly lower-overhead ways to transmit rows of data, but Inin
the big scheme of things I'd suggest you show your teacher a comparison of
relative data size with some other method vs. a DataSet with say, 1,000 rows
of data, and he/she will see that the dataset does not add that much
overhead. 10 rows, sure. 10,000 rows, I dunno. Look at my previous suggestion.
Cheers,
Peter

--
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com
 

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

Back
Top