-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Adding docs for filtered include feature and updating query samples #2260
Conversation
Alternatively, identical operations can be applied for each navigation that is included multiple times. | ||
|
||
[!code-csharp[Main](../../../samples/core/Querying/RelatedData/Sample.cs#MultipleLeafIncludesFiltered2)] | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
many of the filtered include scenarios translate to apply, so sqlite will throw - should we add a warning/caution for that here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
for filtered includes, take works in sqlite right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nope -
SELECT "l"."Id", "l"."Date", "l"."Name", "l"."OneToMany_Optional_Self_Inverse1Id", "l"."OneToMany_Required_Self_Inverse1Id", "l"."OneToOne_Optional_Self1Id", "t"."Id", "t"."Date", "t"."Level1_Optional_Id", "t"."Level1_Required_Id", "t"."Name", "t"."OneToMany_Optional_Inverse2Id", "t"."OneToMany_Optional_Self_Inverse2Id", "t"."OneToMany_Required_Inverse2Id", "t"."OneToMany_Required_Self_Inverse2Id", "t"."OneToOne_Optional_PK_Inverse2Id", "t"."OneToOne_Optional_Self2Id"
FROM "LevelOne" AS "l"
OUTER APPLY (
SELECT "l0"."Id", "l0"."Date", "l0"."Level1_Optional_Id", "l0"."Level1_Required_Id", "l0"."Name", "l0"."OneToMany_Optional_Inverse2Id", "l0"."OneToMany_Optional_Self_Inverse2Id", "l0"."OneToMany_Required_Inverse2Id", "l0"."OneToMany_Required_Self_Inverse2Id", "l0"."OneToOne_Optional_PK_Inverse2Id", "l0"."OneToOne_Optional_Self2Id"
FROM "LevelTwo" AS "l0"
WHERE "l"."Id" = "l0"."OneToMany_Optional_Inverse2Id"
ORDER BY "l0"."Name"
LIMIT 3
) AS "t"
ORDER BY "l"."Id", "t"."Name", "t"."Id"
Where works, OrderBy.AsQueryable works, Skip/Take fails due to APPLY, naked OrderBy fails due to a bug
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Something is wrong then. We added whole support for RowNumberExpression to convert apply to join when there is only take. dotnet/efcore#17293
There is also test which converts Take(4) in select many. At the minimum query you posted above has nothing in it which stops it from getting converted to join.
Also related to it: If we fix dotnet/efcore#17326, then skip would also convert to number and most of it should get translated to Sqlite. (For filtered include case, everything would work).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
will investigate what's up
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ctx.LevelOne.Select(l1 => l1.OneToMany_Optional1.OrderBy(x => x.Name).Take(3).ToList()).ToList();
still translates to apply on sqlite (and fails).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
File an issue and don't add any warning here.
8f99478
to
19999ba
Compare
19999ba
to
7012051
Compare
7012051
to
74d0d46
Compare
updated |
No description provided.