[dba-VB] C# serialization

Shamil Salakhetdinov shamil at smsconsulting.spb.ru
Tue Oct 13 17:28:47 CDT 2009


Hi Gustav,

Your example is good and approving complex DataSets's application for XML
serialization/deserialization into/from XML files or in memory. What I meant
was that AFAIS (and as I do) DataSets are rarely used in large enterprise
level applications to communicate (CRUD, data retrieval) with backend
databases.

--
Shamil 

-----Original Message-----
From: dba-vb-bounces at databaseadvisors.com
[mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of Gustav Brock
Sent: Wednesday, October 14, 2009 1:26 AM
To: dba-vb at databaseadvisors.com
Subject: Re: [dba-VB] C# serialization

Hi Shamil

Thanks for the insight. 
But could you tell a bit of your reasons for not using datasets when you in
your next post ask "do you know a
way to implement XML in memory serialization using less code lines?"

Don't get me wrong (that counts for JC as well) - I'm not on a mission for
datasets - I just found them extremely convenient when I for a recent small
project needed to read, list, and archive structured data as simple as
possible using standardized methods (not reinventing anything) assuming I
couldn't be the first on this planet having that need.
With datasets I can design a table schema much the usual way with relations,
referential integrity, autonumbers, required and/or unique fields etc. etc.
- and write the whole stuff to an XML file with a single line of code. To
me, this is one of the tools of VS which saves you much trouble and time.

Of course, many cases can probably be listed where this is too limited but
for quite a few projects the datasets will fill the bill.

/gustav


>>> shamil at smsconsulting.spb.ru 13-10-2009 21:26 >>>
Hi John,

You can use XMlArray attribute to define the name of XML group of serialized
arrays, collections, lists,..

http://msdn.microsoft.com/en-us/library/system.xml.serialization.xmlattribut

es.xmlarray.aspx

BTW, guys and gals, I'm programming on C# every day - I forgot when I last
time used DataSets typed or not, well, that could be specifics of my subject
area, but for example for a large ASP.NET site I developed, multi-layered
with several thousands of custom classes etc. , DataSets were not used at
all - and that large ASP.NET site is a business application with MS SQL 2005
backend...

Just out of curiosity I have just checked DotNetNuke Community Edition 5.1.4
sources

http://dotnetnuke.codeplex.com/Release/ProjectReleases.aspx?ReleaseId=33848 

to find out how much times DataSet is used in these sources - here is my
search result:

===
Matching lines: 22    
Matching files: 5    
Total files searched: 1414
===


--
Shamil

-----Original Message-----
From: dba-vb-bounces at databaseadvisors.com 
[mailto:dba-vb-bounces at databaseadvisors.com] On Behalf Of jwcolby
Sent: Tuesday, October 13, 2009 8:13 PM
To: Discussion concerning Visual Basic and related programming issues.
Subject: Re: [dba-VB] C# serialization

 > Of course, I can see an educational purpose by handcrafting a kind of
database, but ...

LOL.  Well, this is after a CLASS in C# the purpose of which is to LEARN C#.
You do not start at typed data sets, you start with "this is a variable" and
"this is a for
loop".  I am very much at that level.

I am quite sure that in a year I will be throwing out typed datasets with
the best of them but right 
now I am still forgetting to put a ; at the end of the line.

Have patience Master #2.

John W. Colby
www.ColbyConsulting.com 


Gustav Brock wrote:
> Hi John
> 
> Sounds like a quite normal database app to me ...
> 
> If so, all the typed dataset stuff is ready at your hands.
> To persist (to an XML file without the overhead you claim about) use
method WriteXml.
> To read it at load, use method ReadXml. Can't be simpler.
> 
> Of course, I can see an educational purpose by handcrafting a kind of
database, but ...
> 
> /gustav




 

__________ Information from ESET NOD32 Antivirus, version of virus signature
database 4504 (20091013) __________

The message was checked by ESET NOD32 Antivirus.

http://www.esetnod32.ru
 




More information about the dba-VB mailing list