RE: To serialize or not to serialize?
- From: Peter Bromberg [C# MVP] <pbromberg@xxxxxxxxxxxxxxxxxxx>
- Date: Tue, 5 Dec 2006 18:19:00 -0800
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
- Follow-Ups:
- Re: To serialize or not to serialize?
- From: Paez
- Re: To serialize or not to serialize?
- References:
- To serialize or not to serialize?
- From: Paez
- RE: To serialize or not to serialize?
- From: Peter Bromberg [C# MVP]
- To serialize or not to serialize?
- Prev by Date: How to Serialize Class with System.Net.IPAddress Attribute?
- Next by Date: Re: How to Serialize Class with System.Net.IPAddress Attribute?
- Previous by thread: Re: To serialize or not to serialize?
- Next by thread: Re: To serialize or not to serialize?
- Index(es):
Relevant Pages
|