-
-
Notifications
You must be signed in to change notification settings - Fork 229
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Join with composite key - error: The LINQ expression ... could not be translated
#663
Comments
Does the strongly typed example work? |
@chrisarmand |
Attached is a full working console-app - it relies on EFCore 7 + Postgresql provider The strongly typed version works fine dbcontext.Table1
.Join(dbcontext.Table2,
it1 => new { key1 = it1.Prop1, key2 = it1.Prop2 },
it2 => new { key1 = it2.Prop1, key2 = it2.Prop2 },
(it1, it2) => new { it1, it2 }) and generate expected SQL query SELECT t."Id", t."Prop1", t."Prop2", t0."Id", t0."Prop1", t0."Prop2"
FROM "Table1" AS t
INNER JOIN "Table2" AS t0 ON t."Prop1" = t0."Prop1" AND t."Prop2" = t0."Prop2" The dynamic version dbcontext.Table1
.Join(dbcontext.Table2,
"new(Prop1 as key1, Prop2 as key2)",
"new(Prop1 as key1, Prop2 as key2)",
"new(outer as t1, inner as t2)") raises following error
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
1. Description
I'm trying to write a JOIN query involving composite key, but cannot find proper syntax... help/advice would be welcome
Strongly typed exemple:
Dynamic LINQ trial:
on execution, I keep getting following error:
The LINQ expression ... could not be translated
2. Exception
call stack
The text was updated successfully, but these errors were encountered: