By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
458,169 Members | 1,705 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 458,169 IT Pros & Developers. It's quick & easy.

To serialize or not to serialize?

P: n/a
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
Dec 5 '06 #1
Share this Question
Share on Google+
6 Replies


P: n/a
Hi Paez,

What's stopping you from sending the DataSet?

--
Dave Sexton

"Paez" <marco.pais@[IGNORE]gmail.comwrote in message
news:%2****************@TK2MSFTNGP05.phx.gbl...
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

Dec 5 '06 #2

P: n/a
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>

--
Dave Sexton
Dec 5 '06 #3

P: n/a
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

"Peter Bromberg [C# MVP]" <pb*******@yahoo.nospammin.comwrote in message
news:6D**********************************@microsof t.com...
--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.

Create a class that mirrors the datatable(s) return, with fields that
mirror
the columns in the dataset.

Iterate over your datatable, creating an instance of this class and
populating the fields from the column values of each row in your
DataTable.
Then, return the array of these "row" class objects as the return value of
the WebMethod.

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


"Paez" wrote:
>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

Dec 6 '06 #4

P: n/a
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


"Peter Bromberg [C# MVP]" wrote:
--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.

Create a class that mirrors the datatable(s) return, with fields that mirror
the columns in the dataset.

Iterate over your datatable, creating an instance of this class and
populating the fields from the column values of each row in your DataTable.
Then, return the array of these "row" class objects as the return value of
the WebMethod.

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


"Paez" wrote:
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

Dec 6 '06 #5

P: n/a
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

"Peter Bromberg [C# MVP]" <pb*******@yahoo.nospammin.comwrote in message
news:6F**********************************@microsof t.com...
>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


"Peter Bromberg [C# MVP]" wrote:
>--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.

Create a class that mirrors the datatable(s) return, with fields that
mirror
the columns in the dataset.

Iterate over your datatable, creating an instance of this class and
populating the fields from the column values of each row in your
DataTable.
Then, return the array of these "row" class objects as the return value
of
the WebMethod.

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


"Paez" wrote:
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

Dec 8 '06 #6

P: n/a
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


"Paez" wrote:
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

"Peter Bromberg [C# MVP]" <pb*******@yahoo.nospammin.comwrote in message
news:6F**********************************@microsof t.com...
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


"Peter Bromberg [C# MVP]" wrote:
--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.

Create a class that mirrors the datatable(s) return, with fields that
mirror
the columns in the dataset.

Iterate over your datatable, creating an instance of this class and
populating the fields from the column values of each row in your
DataTable.
Then, return the array of these "row" class objects as the return value
of
the WebMethod.

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


"Paez" wrote:

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



Dec 9 '06 #7

This discussion thread is closed

Replies have been disabled for this discussion.