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

      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: