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

Support `OfType` and `is` with scalar discriminators when using class mapped serializers

    • Type: Icon: New Feature New Feature
    • Resolution: Duplicate
    • Priority: Icon: Unknown Unknown
    • None
    • Affects Version/s: 3.0.0
    • Component/s: Linq, Serialization
    • None
    • None
    • Dotnet Drivers
    • 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

      Currently `OfType` and `is` only work with the `HiearchicalDiscriminatorConvention`.

      This is because with hierarchical discriminators the `_t` value lists all of the classes in the class hierarchy, which makes it possible to write MQL queries for `OfType` and `is`.

      To support an `OfType` or `is` query in MQL requires a different query which lists all of the known subtypes in the query itself (rather than relying on them being stored in the `_t` field). This in turn requires that the `ScalarDiscriminatorConvention` implement the new `IScalarDiscriminatorConvention` interface ` and in particular the `GetDiscriminatorsForTypeAndSubTypes`  method.

            Assignee:
            robert@mongodb.com Robert Stam
            Reporter:
            robert@mongodb.com Robert Stam
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved:
              None
              None
              None
              None