SerializerFinder creates IQueryableSerializer instead of NestedAsQueryableSerializer for nested array results

XMLWordPrintableJSON

    • Type: Improvement
    • Resolution: Unresolved
    • Priority: Unknown
    • None
    • Affects Version/s: None
    • Component/s: None
    • None
    • None
    • Dotnet Drivers
    • 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
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: