Add Support for System.Runtime.ISerializable for Custom Serialization

XMLWordPrintableJSON

    • Type: New Feature
    • Resolution: Won't Fix
    • Priority: Minor - P4
    • None
    • Affects Version/s: 2.4.3
    • Component/s: Serialization
    • None
    • Hide

      1. What would you like to communicate to the user about this feature?
      2. Would you like the user to see examples of the syntax and/or executable code and its output?
      3. Which versions of the driver/connector does this apply to?

      Show
      1. What would you like to communicate to the user about this feature? 2. Would you like the user to see examples of the syntax and/or executable code and its output? 3. Which versions of the driver/connector does this apply to?
    • None
    • None
    • None
    • None
    • None
    • None

      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

            Assignee:
            Unassigned
            Reporter:
            Jerry Wiltse
            Votes:
            3 Vote for this issue
            Watchers:
            8 Start watching this issue

              Created:
              Updated:
              Resolved: