473,399 Members | 4,192 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,399 software developers and data experts.

Persistence - Serialization

We have the need to persist data to a configuration database. We want the
format of this data to be XML. There are two approaches that come to mind
that seem to fit the bill. Below are the two approaches I'm referring to.
Note that I do list what I think are the pros and cons of each approach.

1. .NET Serialization.

We could create classes which can participate in .NET serialization. Since
we want the format of the persisted data to be XML we could either use the
SOAP Formatter or write our own formatter which emits XML.

Pros:

* Get serialization of .NET or Framework types as long as those classes are
marked as [Serializable].

Cons:

* No schema backing the types, or at least I'm not in control of the schema.
For instance, I would have no idea what a Hashtable using the SOAP Formatter
would generate.
* More information serialized than needed. We don't need transient state
persisted so we don't need privates serialized.
* Potential of a breaking change to a .NET or Framework type to invalid all
of my data which includes this type.

2. XML Serialization

We could create classes which can serialize via the XmlSerializer. I have
done this in the past and my usual approach is to first define the XML schema
(XSD) and then have the xsd.exe tool generate the class(es). This approach
ensures that the classes generated conform to the schema since the xsd.exe
tool generates the appropriate XML Serialization attributes.

Pros:

* Data is backed by schema which I control.
* I know exactly what the data looks like (which may come in handy if
someone wants to parse this data in java on Unix).
* Only the data we need serialized will be serialized as opposed to all
public and private data members.
* No potential for a breaking change of a .NET or Framework class to bust my
configuration (of course unless the XmlSerializer class has a breaking
change).

Cons:

* I'm not sure about this, but I assume there are a bunch of .NET and/or
Framework classes that would not serialize via the XmlSerializer. This means
that if I make use of those classes and need to serialize data they contain,
I'll have to write auxiliary classes to serialize that information.

--
Thanks,
Nick
Nov 17 '05 #1
0 1199

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Paolo Losi | last post by:
Hi all, I'm pretty new to the python language so please excuse me if this is FAQ... I'm very glad to be part of the list! :-) I'm looking into a way to implement a generic workflow framework...
49
by: Paul Rubin | last post by:
I've started a few threads before on object persistence in medium to high end server apps. This one is about low end apps, for example, a simple cgi on a personal web site that might get a dozen...
1
by: Francis ANDRE | last post by:
Hi As an effort to monopolize eveything, the Microsoft guys have deposed a USA patent about serialization of objects: ...
11
by: jacob navia | last post by:
I am writing software to make a general storage facility of any kind of objects to/from disk. The intermeidate format used is XML, using the schema (modified a bit) of Microsoft:...
10
by: Simon Harvey | last post by:
Hi everyone, Can anyone tell me if I declare a global variable in my pages code behind, is it persisted if the page does a post back, or do I need to add the object to the session object in...
2
by: dkode | last post by:
Hello, I am laying out the architecture for a very large website that will scale to a very large degree. I have a couple of questions before I attempt to go and implement a Broker/Persistence...
2
by: =?ISO-8859-1?Q?=22Andr=E9s_G=2E_Aragoneses_=5B_kno | last post by:
I am developing a Windows Service that is resident on the machine. The program needs to synchronize certain object list in memory (an object typed as List<Foo>) with disc, serializing and...
0
by: Bill McCormick | last post by:
I'm looking for the best (easiest, cheapest, fastest, most flexible) way to implement object persistence in .NET 3.5. The object data is native XML, so serialization is a good option as well as...
0
myusernotyours
by: myusernotyours | last post by:
Hi all, Am trying to create a Java Desktop App that uses Java Persistence in Netbeans. The database is MS Access but I tried with Mysql and got the same error. When I run the app( Create the...
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: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
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,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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
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...

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.