You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Allow expression row value comparisons via extension methods #2349
I prevently implemented #2111 and reverted a bad approach, which pattern-matched the expanded form above in the tree, and replaced it with the row value expression. This was both brittle (some tree shapes failed to be matched), and also results in complicated LINQ queries.
Ideally, users would be able to express row value comparisons in LINQ queries by using value tuples (see dotnet/efcore#26822):
Tuples really are the appropriate .NET construct for mapping a row value.
When some day ValueTuple syntax becomes supported in LINQ expression trees ((x, y)), this should transition seamlessly.
Doesn't rely on provider array support which is PG-specific, so should be easily portable to the general relational layer if we want.
Avoids any confusion with arrays, which are also supported in PG. For example, arrays can also be compared in PG (very different thing from row value comparisons).
We can selectively make NewExpression for ValueTuple non-evaluatable, rather than NewArrayExpression, which is used in other contexts where it can be evaluatable (see Support for row value comparisons #2350 (comment)).
changed the title [-]Allow expression row value comparisons via extension method with object array parameters[/-][+]Allow expression row value comparisons via extension methods[/+]on May 6, 2022
Activity
Support for row value comparisons
Support for row value comparisons
Support for row value comparisons
Support for row value comparisons
Support for row value comparisons
roji commentedon May 6, 2022
OK, I ended up going in a slightly different direction, and using
ValueType<T1, T2...>(x, y...)instead of arrays to express row values in LINQ:This is a bit uglier/more verbose, but:
(x, y)), this should transition seamlessly./cc @smitpatel
[-]Allow expression row value comparisons via extension method with object array parameters[/-][+]Allow expression row value comparisons via extension methods[/+]Support for row value comparisons
Support for row value comparisons
Support for row value comparisons (#2350)
Document row value comparisons
roji commentedon May 8, 2022
Docs: npgsql/doc@511a6af in the 7.0 branch.
Document row value comparisons
Document row value comparisons
Document row value comparisons
Document row value comparisons
Document row value comparisons
Document row value comparisons