SerializerFinder creates IQueryableSerializer instead of NestedAsQueryableSerializer for nested array results

XMLWordPrintableJSON

    • Type: Improvement
    • Resolution: Unresolved
    • Priority: Major - P3
    • None
    • Affects Version/s: None
    • Component/s: LINQ
    • 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

      The SerializerFinder's CreateCollectionSerializerFromItemSerializer in SerializerFinderHelperMethods.cs creates IQueryableSerializer for all IQueryable<> types. However, when the result is from a nested array operation (e.g., x.A.AsQueryable().Select(...) or x.B.AsQueryable().SelectMany(...)), the translator needs a NestedAsQueryableSerializer (which implements the INestedAsQueryableSerializer marker interface). This marker is required by NestedAsQueryableHelper.EnsureQueryableMethodHasNestedAsQueryableSource for downstream Queryable method chaining.

      Because of this mismatch, the translators for Select and SelectMany cannot use context.GetSerializer(expression) for their result serializers and must construct the correct NestedAsQueryableSerializer ad-hoc via NestedAsQueryableSerializer.CreateIEnumerableOrNestedAsQueryableSerializer.

      To fully align with the architectural direction of having all serializer information come from the known serializer map, the SerializerFinder would need to be taught the distinction between top-level IQueryable (from the database/pipeline) and nested AsQueryable() (from a nested array), so it can produce the correct serializer type.

      Found during CSHARP-5847 implementation.

            Assignee:
            Unassigned
            Reporter:
            Adelin Mbida Owona
            None
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: