473,396 Members | 1,998 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,396 software developers and data experts.

To serialize or not to serialize?

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
6 1558
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
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
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
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
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: Ian Tompsett | last post by:
H I was wondering if it possible for an object to serialize/deserialize itself from XML. I'd be guessing that it would need to use the XmlSerializer class, but that seems to want to create a...
5
by: David Sworder | last post by:
Hi, I've created a UserControl-derived class called MyUserControl that is able to persist and subsequently reload its state. It exposes two methods as follows: public void Serialize(Stream...
10
by: Dan | last post by:
All I Am Attempting To Serialize An Object To An XML File. Here Is The Code For That public string SaveNewSurvey( MutualSurveyObject mso_TempObject, int i_JobID ) { string s_RootFileName;...
3
by: MAY | last post by:
Hi, I have a problem about serialize the form controls. I wrote a test program to test serialize a from but fail (->An unhandled exception of type...
2
by: films | last post by:
I understand the concept. Serialization of a class will add all the sub-objects of the class to the stream if there are also serializible. So say I have: class Author {
1
by: js | last post by:
Does anybody knows how to solve the problem? I added attribute to the following classes in Microsoft.Practices.EnterpriseLibrary.Data namespace, but I still get the error. Thanks. ...
8
by: cd~ | last post by:
I can provide a test app, the news server won't allow me to post the files because they are too large (93KB and 1.2KB) I downloaded the ESRI ArcXml schema and generated the classes from the...
1
by: Tim | last post by:
Could anyone tell me what this means and how do I correct it. Any suggestions? Thanks! Tim Richardson IT Developer and Consultant www.paladin3d.com Unable to serialize the session state. In...
4
by: =?Utf-8?B?Qnlyb24=?= | last post by:
When I try to serialize an instance of the LocationCell below (note Building field) I get an error in the reflection attempt. If I remove the _Building field it serializes fine. I tried renaming...
9
by: Gillard | last post by:
i get an exeption and i do not know what else to do to continue Dim sdf As New SaveFileDialog With sdf .AddExtension = True .DefaultExt = ".record" .FileName = Now.ToLongDateString .Filter =...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.