Page 1 of 1

Where expression with .All (and this one containing !.All) generates invalid query

Posted: Thu 23 Jan 2020 14:39
by jmeyns
In this example the Where expression has been replaced by a FirstOrDefault expression.

Code: Select all

var classroomResult2 = context
                        .Set<Classroom>()
                        .FirstOrDefault(_ => _.PuzzleGroups.All(gr => !gr.Puzzles.All(p => p.Completed)));
Invalid query:

Code: Select all

SELECT
	 "_".ID,
	 "_".NAME

FROM CLASSROOM "_"

WHERE NOT EXISTS (
	
    SELECT
		 1
    
	FROM PUZZLE_GROUP "gr"
    
	WHERE (
		"_".ID = "gr".CLASSROOM_ID)
	 AND
		 (
			SELECT
				 CASE
        WHEN NOT EXISTS (
					
            SELECT
						 1
            
					FROM PUZZLE "p"
            
					WHERE (
						"gr".ID = "p".PUZZLE_GROUP_ID)
					 AND
						 (
							"p".COMPLETED = 0)
						)
					
        THEN 1 ELSE 0
    END
    
				FROM DUAL)
			)
		
FETCH FIRST 1 ROWS ONLY
Database Provider: Devart.Data.Oracle.EFCore version 9.10.909

A repository reproducing the issue can be found here: https://github.com/janmeyns/devart-efco ... ll-not-all

Re: Where expression with .All (and this one containing !.All) generates invalid query

Posted: Tue 28 Jan 2020 13:54
by Shalex
Thank you for your report. We have reproduced the issue and will notify you when it is fixed.

Re: Where expression with .All (and this one containing !.All) generates invalid query

Posted: Thu 06 Feb 2020 11:14
by Shalex
The bug with using .All in the .Where expression in EF Core 2 and EF Core 3 is fixed. We will notify you when the new public build of dotConnect for Oracle is available for download.

Re: Where expression with .All (and this one containing !.All) generates invalid query

Posted: Mon 02 Mar 2020 16:22
by Shalex
dotConnect for Oracle v9.11.951 is released: viewtopic.php?f=1&t=39884.