Allow serializers to specify a DiscriminatorConvention

XMLWordPrintableJSON

    • Type: Task
    • Resolution: Done
    • Priority: Unknown
    • 3.0.0
    • Affects Version/s: None
    • Component/s: None
    • None
    • None
    • Fully Compatible
    • Dotnet Drivers
    • Not Needed
    • 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

      Right now some of the visitors in the LINQ provider are hard-coded to look for ObjectSerializer and if the serializer is this type then look for the DiscriminatorConvention property. This prevents other serializers from being able to expose this and limits them to the static BsonSerializer registry.

      I propose introducing a new interface such as ISpecifyDiscriminatorConvention which has a single property:

      IDiscriminatorConvention DiscriminatorConvention { get; }} 

      The visitors can then look for this interface instead. ObjectSerializer can implement it as can anyone else.

            Assignee:
            Robert Stam
            Reporter:
            Damien Guard
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: