473,802 Members | 2,172 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 1580
Hi Paez,

What's stopping you from sending the DataSet?

--
Dave Sexton

"Paez" <marco.pais@[IGNORE]gmail.comwrote in message
news:%2******** ********@TK2MSF TNGP05.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*******@yaho o.nospammin.com wrote in message
news:6D******** *************** ***********@mic rosoft.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*******@yaho o.nospammin.com wrote in message
news:6F******** *************** ***********@mic rosoft.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*******@yaho o.nospammin.com wrote in message
news:6F******** *************** ***********@mic rosoft.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
5831
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 brand new object when deserializing. In my case I have an existing object that I'd like to pass some XML to for the object to repopulate its member variables. Similarly I'd like it to be able to populate an XML string from the values of its member...
5
24732
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 s); public void Deserialize(Stream s); Within the MyUserControl class, there is a field of type MyInnerClass
10
4168
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; string s_FinalFileName; try
3
10390
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 'System.Runtime.Serialization.SerializationException' occurred in mscorlib.dll) . Thx in advance. Here is the part of the code: Regards MAY
2
8891
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
1468
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. Database.cs DatabaseFactory.cs DatabaseProviderFactory.cs DBCommandWrapper.cs
8
5468
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 schema using xsd.exe, which took a while because xsd doesn't handle recursive elements very well (StackOverFlow exception during generation). Now that I have the classes I am trying to serialize them to an xml document to send to ArcIMS to generate...
1
39709
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 'StateServer' and 'SQLServer' mode, ASP.NET will serialize the session state objects, and as a result non-serializable objects or MarshalByRef objects are not permitted. The same
4
7147
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 Building._Name to Building._BName in case the duplicate name was the issue, but that didn't help. Is there a native way to serialize nested objects, or will I have to write my own? public class LocationCell
9
1902
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 = "recorder (*.record)|*.record" End With If sdf.ShowDialog = Windows.Forms.DialogResult.OK Then Dim Serializer As New
0
9699
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10304
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10285
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9114
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7598
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5494
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5622
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3792
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2966
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.