Brady Moritz
Brady Moritz

Reputation: 8903

Serialization for data files in .Net and other applications

I read a lot of discussion about serialization technologies that are used over the wire- xml, json, proto buf, Contract serializer etc. I'm curious about any discussions on what serialization tech might work best for an application file, ie a local file saved from a thick client app. In the past I've serialized datasets to xml (and gzipped), but perhaps one of these other formats would be better suited for this application? I'm mostly interested in .Net usage, but of course part of the discussion needs to address how easily the file could utilized by another language or platform later.

Some additional info: I agree on sqlite for a database format, if the data warrants it. But when I think of a thick client app, I'm thinking more of a document based application, ie like an Office type program etc. If one can work with native objects internally and then simply serialize a full structure to a file, it will always be much easier to work with then trying to map objects to a database table. Am I correct to assume most doc based apps simply rewrite the entire file any time you click "save"?

Thanks for the feedback so far.

Upvotes: 1

Views: 74

Answers (2)

Marc Gravell
Marc Gravell

Reputation: 1062780

Many of those you mention (xml, json, protobuf) will be absolutely fine for most data, and most languages/platforms will be able to cope with them. If the data is complex, a relational database file is probably preferable, but: there is no automatic reason to prefer one approach to another. It depends a lot on your specific data and how you use it.

Upvotes: 0

csg
csg

Reputation: 2107

I would use SQLite.

It stores the data into a single file on disk, there is a .net provider for it, and of course there are providers for other languages too.

Upvotes: 1

Related Questions