dotnet / dotnet/efcore

Allow tuples to be used as join keys

Open
#35,565 0 comments 5 reactions 0 assignees View on GitHub
area-query
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

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.