Allow tuples to be used as join keys
- Dominant language
- C#
- Stars
- 14.8k
- Forks
- 3.4k
- PR merge metrics
- PR metrics pending
Description
When performing Join, EF currently only supports scalars and anonymous types (see #25075). The problem with anonymous types is that they can't be shared: you cannot have a property/function somewhere that's used in multiple queries, and which returns a key selector `Expression>`, since anonymous types are unspeakable and cannot appear in the Func signature (see https://github.com/dotnet/efcore/issues/25075#issuecomment-2628223540). #25075 suggests allowing arbitrary POCOs as join keys, but that raises complex questions around equality behavior etc. which makes this undesirable.
A good solution here seems to be to allow tuples as join keys: these have clear equality semantics and can be named in Func signatures.
Contributor guide
Assessment
This issue has not been assessed yet.