Compact Formatter
About
News
Download
RSS
Links


About the Compact Formatter

What is the CompactFormatter?

The CompactFormatter is a generic formatter for the .NET Compact Framework. It is fully realized in .NET managed code and this means that it is able to work on every device able to support the .NET Compact Framework or every other standard-compliant CLI implementation.

Even if the CompactFormatter is able to serialize automatically the majority of objects using Reflection, it allows programmers to redefine the serialization algorithm of custom objects if this is needed ( such as, for example, if a custom serialization algorithm is more efficient than the standard one ).

The interface that the CompactFormatter class expose to the user is very similar to the BinaryFormatter ( or SOAPFormatter ) one and so using it ( or, to some extents, porting applications from .NET to it ) should be very simple for people who knows how to use standard .NET Full Formatters.

CompactFormatter is still in Beta (even if we reached 1.0.0 version) simply because it needs more testing. I hope to remove the beta status in a couple of months if no critical problems will be reported.

CompactFormatter is and will always be released under the LGPL License.

Features
  • Able to serialize primitive types automatically.
  • Able to serialize user-defined types automatically.
  • Thanks to Surrogate and Overrider mechanism, allows a safer serialization even of framework types.
  • Uses an interface very similar to standard Binary/SOAP formatters used in .NET
  • Supports NotSerializable fields, that are fields which must not be serialized.
  • Produces a data stream more compact than the one used by .NET BinaryFormatter.
  • It is faster than BinaryFormatter and SOAPFormatter.
  • Allows users to redefine serialization mechanism of their classes (Custom Serialization).
  • It correctly rebuilds the object reference graph.
  • Allows the use of user-defined StreamParsers, these are wrapper around serialization stream (useful to implement transformations just before sending the stream on the wire: soon available StreamParsers will allow zip compression and TEA data encryption out of the box.)
  • Fully implemented in .NET managed code.
Why using managed code? It's so slooow...

Indeed, but i chose to use managed code in an effort to gain maximum portability. In fact the world of smart devices is incredibly various and realizing the CompactFormatter completely in managed code allowed me to put just the Compact Framework as a requirement for the CompactFormatter. Anyway, the stream of data produced by the CompactFormatter during serialization is smaller than BinaryFormatter one and this helps to keep the gap small, but it's a fact that the BinaryFormatter ( which works natively ) will out-perform CompactFormatter when several objects are serialized ( because the CompactFormatter needs to wait for the Garbage Collector to come in and free memory ).

A rewrite of core serialization routines in native code is definitely a TODO task, but only now that a managed version is ready ( so that if a smart device has not a native version available it could always use the managed one ).

Copyright © 2005 Angelo Scotto

This website is hosted for free by Freewebs.com - free website. Get your own Free Website now!