Details
-
New Feature
-
Resolution: Unresolved
-
Minor - P4
-
None
-
2.4.3
Description
A serialization framework in .NET should understand and support System.Runtime.ISerializable. Presently, the MongoDB C# driver does not appear to have any reference to this interface.
The interface is extremely practical, as it allows for owners of classes to implement the GetObjectData method in their class and define universal logic for serializing their class across any future serializers. This is preferable to having to learn the idiosyncrasies of proprietary serializers and re-write the same serialization logic multiple times depending on the output format and library. The custom serialization abstractions in MongoDB will still be needed for complex scenarios when the GetObjectData does not provide enough flexibility. However, for companies which have already invested significant time and energy into leveraging ISerializable for XML and JSON serialization in their application, and which want to move to MongoDB, it's a significant frustration that this native platform serialization mechanism is not honored.
Json.NET honors the nature of the ISerializable interface and GetObjectData method, and provides a good model for how it should work in the Mongo Driver. While it's not trivial to implement, it doesn't seem difficult either.
http://www.newtonsoft.com/json/help/html/SerializationGuide.htm#ISerializable