Uploaded image for project: 'C# Driver'
  1. C# Driver
  2. CSHARP-5259

Allow serializers to specify a DiscriminatorConvention

    • Type: Icon: Task Task
    • Resolution: Done
    • Priority: Icon: Unknown Unknown
    • 3.0.0
    • Affects Version/s: None
    • Component/s: 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?

      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@mongodb.com Robert Stam
            Reporter:
            damien.guard@mongodb.com Damien Guard
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: