From f5b3b5fabe1cd654a01c0395b41fadef077b1d5d Mon Sep 17 00:00:00 2001 From: Shay Rojansky Date: Fri, 12 Nov 2021 15:59:06 +0100 Subject: [PATCH] Put parentheses around IS NULL for non-bool operands Fixes #26652 --- .../Query/QuerySqlGenerator.cs | 15 +- .../Query/NullSemanticsQueryTestBase.cs | 18 + ...avigationsCollectionsQuerySqlServerTest.cs | 54 +- ...CollectionsSharedTypeQuerySqlServerTest.cs | 1098 +++---- ...tionsCollectionsSplitQuerySqlServerTest.cs | 90 +- .../ComplexNavigationsQuerySqlServerTest.cs | 110 +- ...NavigationsSharedTypeQuerySqlServerTest.cs | 2888 ++++++++--------- .../Query/FromSqlQuerySqlServerTest.cs | 2 +- .../Query/FunkyDataQuerySqlServerTest.cs | 70 +- .../Query/GearsOfWarQuerySqlServerTest.cs | 222 +- ...eritanceRelationshipsQuerySqlServerTest.cs | 52 +- .../ManyToManyNoTrackingQuerySqlServerTest.cs | 4 +- .../Query/ManyToManyQuerySqlServerTest.cs | 4 +- ...indAggregateOperatorsQuerySqlServerTest.cs | 20 +- .../NorthwindFunctionsQuerySqlServerTest.cs | 32 +- .../NorthwindGroupByQuerySqlServerTest.cs | 28 +- .../NorthwindIncludeQuerySqlServerTest.cs | 8 +- .../Query/NorthwindJoinQuerySqlServerTest.cs | 8 +- ...thwindKeylessEntitiesQuerySqlServerTest.cs | 4 +- ...orthwindMiscellaneousQuerySqlServerTest.cs | 96 +- .../NorthwindNavigationsQuerySqlServerTest.cs | 22 +- ...NorthwindQueryFiltersQuerySqlServerTest.cs | 54 +- .../NorthwindSelectQuerySqlServerTest.cs | 24 +- ...orthwindSetOperationsQuerySqlServerTest.cs | 6 +- ...NorthwindSplitIncludeQuerySqlServerTest.cs | 14 +- .../Query/NorthwindWhereQuerySqlServerTest.cs | 26 +- .../Query/NullSemanticsQuerySqlServerTest.cs | 260 +- .../Query/OwnedQuerySqlServerTest.cs | 8 +- .../Query/QueryBugsTest.cs | 26 +- .../Query/SharedTypeQuerySqlServerTest.cs | 4 +- ...TPTFiltersInheritanceQuerySqlServerTest.cs | 14 +- .../Query/TPTGearsOfWarQuerySqlServerTest.cs | 250 +- .../Query/TPTInheritanceQuerySqlServerTest.cs | 14 +- ...TManyToManyNoTrackingQuerySqlServerTest.cs | 4 +- .../Query/TPTManyToManyQuerySqlServerTest.cs | 4 +- .../TPTRelationshipsQuerySqlServerTest.cs | 52 +- ...avigationsCollectionsQuerySqlServerTest.cs | 54 +- .../TemporalGearsOfWarQuerySqlServerTest.cs | 8 +- .../TemporalManyToManyQuerySqlServerTest.cs | 4 +- .../Query/UdfDbFunctionSqlServerTests.cs | 6 +- .../TPTTableSplittingSqlServerTest.cs | 2 +- .../TableSplittingSqlServerTest.cs | 20 +- .../Query/GearsOfWarQuerySqliteTest.cs | 2 +- .../NorthwindFunctionsQuerySqliteTest.cs | 24 +- .../NorthwindMiscellaneousQuerySqliteTest.cs | 2 +- .../NorthwindQueryFiltersQuerySqliteTest.cs | 2 +- .../Query/NorthwindWhereQuerySqliteTest.cs | 2 +- .../Query/NullSemanticsQuerySqliteTest.cs | 20 + .../Query/TPTGearsOfWarQuerySqliteTest.cs | 2 +- 49 files changed, 2904 insertions(+), 2849 deletions(-) diff --git a/src/EFCore.Relational/Query/QuerySqlGenerator.cs b/src/EFCore.Relational/Query/QuerySqlGenerator.cs index f57e880b956..821e0aaabb1 100644 --- a/src/EFCore.Relational/Query/QuerySqlGenerator.cs +++ b/src/EFCore.Relational/Query/QuerySqlGenerator.cs @@ -789,18 +789,9 @@ protected virtual bool RequiresParentheses(SqlExpression outerExpression, SqlExp case LikeExpression _: return true; - case SqlUnaryExpression sqlUnaryExpression: - { - // Wrap IS (NOT) NULL operation when applied on bool column. - if ((sqlUnaryExpression.OperatorType == ExpressionType.Equal - || sqlUnaryExpression.OperatorType == ExpressionType.NotEqual) - && sqlUnaryExpression.Operand.Type == typeof(bool)) - { - return true; - } - - return false; - } + // Surround all IS (NOT) NULL with parentheses for now, because of operator precedence issues (i.e. x = y IS NULL) + case SqlUnaryExpression { OperatorType: ExpressionType.Equal or ExpressionType.NotEqual }: + return true; case SqlBinaryExpression sqlBinaryExpression: { diff --git a/test/EFCore.Relational.Specification.Tests/Query/NullSemanticsQueryTestBase.cs b/test/EFCore.Relational.Specification.Tests/Query/NullSemanticsQueryTestBase.cs index af8aba09e36..a1fd4157ab7 100644 --- a/test/EFCore.Relational.Specification.Tests/Query/NullSemanticsQueryTestBase.cs +++ b/test/EFCore.Relational.Specification.Tests/Query/NullSemanticsQueryTestBase.cs @@ -1606,6 +1606,24 @@ await AssertQuery( ss => ss.Set().Where(e => e.BoolB != e.NullableBoolA.HasValue)); } + [ConditionalTheory] + [MemberData(nameof(IsAsyncData))] + public virtual async Task Bool_not_equal_nullable_int_HasValue(bool async) + { + await AssertQuery( + async, + ss => ss.Set().Where(e => true != e.NullableIntA.HasValue)); + + var prm = false; + await AssertQuery( + async, + ss => ss.Set().Where(e => prm != e.NullableIntA.HasValue)); + + await AssertQuery( + async, + ss => ss.Set().Where(e => e.BoolB != e.NullableIntA.HasValue)); + } + [ConditionalTheory] [MemberData(nameof(IsAsyncData))] public virtual async Task Bool_not_equal_nullable_bool_compared_to_null(bool async) diff --git a/test/EFCore.SqlServer.FunctionalTests/Query/ComplexNavigationsCollectionsQuerySqlServerTest.cs b/test/EFCore.SqlServer.FunctionalTests/Query/ComplexNavigationsCollectionsQuerySqlServerTest.cs index c7acb67ed6b..ae46a2b85c7 100644 --- a/test/EFCore.SqlServer.FunctionalTests/Query/ComplexNavigationsCollectionsQuerySqlServerTest.cs +++ b/test/EFCore.SqlServer.FunctionalTests/Query/ComplexNavigationsCollectionsQuerySqlServerTest.cs @@ -144,7 +144,7 @@ public override async Task Include_collection_with_conditional_order_by(bool asy FROM [LevelOne] AS [l] LEFT JOIN [LevelTwo] AS [l0] ON [l].[Id] = [l0].[OneToMany_Optional_Inverse2Id] ORDER BY CASE - WHEN [l].[Name] IS NOT NULL AND ([l].[Name] LIKE N'%03') THEN 1 + WHEN ([l].[Name] IS NOT NULL) AND ([l].[Name] LIKE N'%03') THEN 1 ELSE 2 END, [l].[Id]"); } @@ -179,7 +179,7 @@ LEFT JOIN ( FROM [LevelThree] AS [l1] LEFT JOIN [LevelFour] AS [l2] ON [l1].[Id] = [l2].[Level3_Required_Id] ) AS [t] ON [l0].[Id] = [t].[OneToMany_Required_Inverse3Id] -WHERE ([l0].[Name] <> N'L2 09') OR [l0].[Name] IS NULL +WHERE ([l0].[Name] <> N'L2 09') OR ([l0].[Name] IS NULL) ORDER BY [l].[Id], [l0].[Id], [t].[Id]"); } @@ -260,7 +260,7 @@ FROM [LevelOne] AS [l] LEFT JOIN [LevelTwo] AS [l3] ON [l].[Id] = [l3].[Level1_Optional_Id] LEFT JOIN [LevelThree] AS [l4] ON [l3].[Id] = [l4].[Level2_Optional_Id] LEFT JOIN [LevelThree] AS [l5] ON [l0].[Id] = [l5].[OneToMany_Optional_Inverse3Id] -WHERE ([l1].[Name] <> N'Foo') OR [l1].[Name] IS NULL +WHERE ([l1].[Name] <> N'Foo') OR ([l1].[Name] IS NULL) ORDER BY [l].[Id], [l0].[Id], [l1].[Id], [l2].[Id], [l3].[Id], [l4].[Id]"); } @@ -478,7 +478,7 @@ LEFT JOIN ( FROM [LevelTwo] AS [l15] WHERE [l15].[Id] <> 42 ) AS [t1] ON [t].[Id2] = [t1].[OneToMany_Optional_Self_Inverse2Id] -WHERE ([l11].[Name] <> N'Foo') OR [l11].[Name] IS NULL +WHERE ([l11].[Name] <> N'Foo') OR ([l11].[Name] IS NULL) ORDER BY [l12].[Id], [l].[Id], [l0].[Id], [l1].[Id], [l2].[Id], [t].[Id], [t].[Id0], [t].[Id1], [t].[Id2], [t0].[Id], [t0].[Id0], [t0].[Id1], [t0].[Id2], [l11].[Id], [l13].[Id], [l14].[Id]"); } @@ -539,7 +539,7 @@ FROM [LevelOne] AS [l] LEFT JOIN ( 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 ([l0].[Name] <> N'Foo') OR [l0].[Name] IS NULL + WHERE ([l0].[Name] <> N'Foo') OR ([l0].[Name] IS NULL) ) AS [t] ON [l].[Id] = [t].[OneToMany_Optional_Inverse2Id] WHERE [l].[Id] < 3 ORDER BY [l].[Id]"); @@ -710,7 +710,7 @@ public override async Task Include_collection_with_groupby_in_subquery_and_filte SELECT [l].[Name] FROM [LevelOne] AS [l] GROUP BY [l].[Name] - HAVING ([l].[Name] <> N'Foo') OR [l].[Name] IS NULL + HAVING ([l].[Name] <> N'Foo') OR ([l].[Name] IS NULL) ) AS [t] LEFT JOIN ( SELECT [t1].[Id], [t1].[Date], [t1].[Name], [t1].[OneToMany_Optional_Self_Inverse1Id], [t1].[OneToMany_Required_Self_Inverse1Id], [t1].[OneToOne_Optional_Self1Id] @@ -1035,7 +1035,7 @@ FROM [LevelTwo] AS [l2] SELECT COUNT(*) FROM [LevelTwo] AS [l0] LEFT JOIN [LevelThree] AS [l1] ON [l0].[Id] = [l1].[OneToOne_Optional_PK_Inverse3Id] - WHERE ([l].[Id] = [l0].[OneToMany_Optional_Inverse2Id]) AND (([l1].[Name] <> N'Foo') OR [l1].[Name] IS NULL)) > 0 + WHERE ([l].[Id] = [l0].[OneToMany_Optional_Inverse2Id]) AND (([l1].[Name] <> N'Foo') OR ([l1].[Name] IS NULL))) > 0 ORDER BY [l].[Id], [t].[Id], [t].[Id0]"); } @@ -1293,7 +1293,7 @@ LEFT JOIN ( FROM ( SELECT [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Name], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Optional_Self_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[OneToMany_Required_Self_Inverse3Id], [l1].[OneToOne_Optional_PK_Inverse3Id], [l1].[OneToOne_Optional_Self3Id], ROW_NUMBER() OVER(PARTITION BY [l1].[OneToMany_Optional_Inverse3Id] ORDER BY [l1].[Name]) AS [row] FROM [LevelThree] AS [l1] - WHERE ([l1].[Name] <> N'Foo') OR [l1].[Name] IS NULL + WHERE ([l1].[Name] <> N'Foo') OR ([l1].[Name] IS NULL) ) AS [t] WHERE (1 < [t].[row]) AND ([t].[row] <= 4) ) AS [t0] ON [l0].[Id] = [t0].[OneToMany_Optional_Inverse3Id] @@ -1313,7 +1313,7 @@ LEFT JOIN ( FROM ( SELECT [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Name], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Optional_Self_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[OneToMany_Required_Self_Inverse3Id], [l1].[OneToOne_Optional_PK_Inverse3Id], [l1].[OneToOne_Optional_Self3Id], ROW_NUMBER() OVER(PARTITION BY [l1].[OneToMany_Optional_Inverse3Id] ORDER BY [l1].[Name]) AS [row] FROM [LevelThree] AS [l1] - WHERE ([l1].[Name] <> N'Foo') OR [l1].[Name] IS NULL + WHERE ([l1].[Name] <> N'Foo') OR ([l1].[Name] IS NULL) ) AS [t] WHERE (1 < [t].[row]) AND ([t].[row] <= 4) ) AS [t0] ON [l0].[Id] = [t0].[OneToMany_Optional_Inverse3Id] @@ -1332,7 +1332,7 @@ LEFT JOIN ( FROM ( 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], ROW_NUMBER() OVER(PARTITION BY [l0].[OneToMany_Optional_Inverse2Id] ORDER BY [l0].[Name]) AS [row] FROM [LevelTwo] AS [l0] - WHERE ([l0].[Name] <> N'Foo') OR [l0].[Name] IS NULL + WHERE ([l0].[Name] <> N'Foo') OR ([l0].[Name] IS NULL) ) AS [t] WHERE [t].[row] <= 3 ) AS [t0] ON [l].[Id] = [t0].[OneToMany_Optional_Inverse2Id] @@ -1341,7 +1341,7 @@ LEFT JOIN ( FROM ( SELECT [l1].[Id], [l1].[Date], [l1].[Level1_Optional_Id], [l1].[Level1_Required_Id], [l1].[Name], [l1].[OneToMany_Optional_Inverse2Id], [l1].[OneToMany_Optional_Self_Inverse2Id], [l1].[OneToMany_Required_Inverse2Id], [l1].[OneToMany_Required_Self_Inverse2Id], [l1].[OneToOne_Optional_PK_Inverse2Id], [l1].[OneToOne_Optional_Self2Id], ROW_NUMBER() OVER(PARTITION BY [l1].[OneToMany_Required_Inverse2Id] ORDER BY [l1].[Name] DESC) AS [row] FROM [LevelTwo] AS [l1] - WHERE ([l1].[Name] <> N'Bar') OR [l1].[Name] IS NULL + WHERE ([l1].[Name] <> N'Bar') OR ([l1].[Name] IS NULL) ) AS [t2] WHERE 1 < [t2].[row] ) AS [t1] ON [l].[Id] = [t1].[OneToMany_Required_Inverse2Id] @@ -1360,7 +1360,7 @@ OUTER APPLY ( FROM ( SELECT TOP(3) [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]) AND (([l0].[Name] <> N'Foo') OR [l0].[Name] IS NULL) + WHERE ([l].[Id] = [l0].[OneToMany_Optional_Inverse2Id]) AND (([l0].[Name] <> N'Foo') OR ([l0].[Name] IS NULL)) ORDER BY [l0].[Name] ) AS [t] LEFT JOIN ( @@ -1368,7 +1368,7 @@ LEFT JOIN ( FROM ( SELECT [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Name], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Optional_Self_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[OneToMany_Required_Self_Inverse3Id], [l1].[OneToOne_Optional_PK_Inverse3Id], [l1].[OneToOne_Optional_Self3Id], ROW_NUMBER() OVER(PARTITION BY [l1].[OneToMany_Required_Inverse3Id] ORDER BY [l1].[Name] DESC) AS [row] FROM [LevelThree] AS [l1] - WHERE ([l1].[Name] <> N'Bar') OR [l1].[Name] IS NULL + WHERE ([l1].[Name] <> N'Bar') OR ([l1].[Name] IS NULL) ) AS [t1] WHERE 1 < [t1].[row] ) AS [t0] ON [t].[Id] = [t0].[OneToMany_Required_Inverse3Id] @@ -1388,7 +1388,7 @@ LEFT JOIN ( FROM ( 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], ROW_NUMBER() OVER(PARTITION BY [l0].[OneToMany_Optional_Inverse2Id] ORDER BY [l0].[Id] DESC) AS [row] FROM [LevelTwo] AS [l0] - WHERE ([l0].[Name] <> N'Foo') OR [l0].[Name] IS NULL + WHERE ([l0].[Name] <> N'Foo') OR ([l0].[Name] IS NULL) ) AS [t] WHERE [t].[row] <= 2 ) AS [t0] ON [l].[Id] = [t0].[OneToMany_Optional_Inverse2Id] @@ -1407,7 +1407,7 @@ OUTER APPLY ( FROM ( SELECT TOP(2) [l2].[Id], [l2].[Date], [l2].[Level1_Optional_Id], [l2].[Level1_Required_Id], [l2].[Name], [l2].[OneToMany_Optional_Inverse2Id], [l2].[OneToMany_Optional_Self_Inverse2Id], [l2].[OneToMany_Required_Inverse2Id], [l2].[OneToMany_Required_Self_Inverse2Id], [l2].[OneToOne_Optional_PK_Inverse2Id], [l2].[OneToOne_Optional_Self2Id] FROM [LevelTwo] AS [l2] - WHERE ([l].[Id] = [l2].[OneToMany_Optional_Inverse2Id]) AND (([l2].[Name] <> N'Foo') OR [l2].[Name] IS NULL) + WHERE ([l].[Id] = [l2].[OneToMany_Optional_Inverse2Id]) AND (([l2].[Name] <> N'Foo') OR ([l2].[Name] IS NULL)) ORDER BY [l2].[Id] ) AS [t] LEFT JOIN [LevelThree] AS [l0] ON [t].[Id] = [l0].[Level2_Required_Id] @@ -1430,7 +1430,7 @@ OUTER APPLY ( FROM ( SELECT TOP(2) [l2].[Id], [l2].[Date], [l2].[Level1_Optional_Id], [l2].[Level1_Required_Id], [l2].[Name], [l2].[OneToMany_Optional_Inverse2Id], [l2].[OneToMany_Optional_Self_Inverse2Id], [l2].[OneToMany_Required_Inverse2Id], [l2].[OneToMany_Required_Self_Inverse2Id], [l2].[OneToOne_Optional_PK_Inverse2Id], [l2].[OneToOne_Optional_Self2Id] FROM [LevelTwo] AS [l2] - WHERE ([l].[Id] = [l2].[OneToMany_Optional_Inverse2Id]) AND (([l2].[Name] <> N'Foo') OR [l2].[Name] IS NULL) + WHERE ([l].[Id] = [l2].[OneToMany_Optional_Inverse2Id]) AND (([l2].[Name] <> N'Foo') OR ([l2].[Name] IS NULL)) ORDER BY [l2].[Id] ) AS [t] LEFT JOIN [LevelThree] AS [l0] ON [t].[Id] = [l0].[Level2_Required_Id] @@ -1451,7 +1451,7 @@ LEFT JOIN ( FROM ( 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], ROW_NUMBER() OVER(PARTITION BY [l0].[OneToMany_Optional_Inverse2Id] ORDER BY [l0].[Id]) AS [row] FROM [LevelTwo] AS [l0] - WHERE ([l0].[Name] <> N'Foo') OR [l0].[Name] IS NULL + WHERE ([l0].[Name] <> N'Foo') OR ([l0].[Name] IS NULL) ) AS [t] WHERE [t].[row] <= 3 ) AS [t0] ON [l].[Id] = [t0].[OneToMany_Optional_Inverse2Id] @@ -1470,7 +1470,7 @@ LEFT JOIN ( FROM ( 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], ROW_NUMBER() OVER(PARTITION BY [l0].[OneToMany_Optional_Inverse2Id] ORDER BY [l0].[Id]) AS [row] FROM [LevelTwo] AS [l0] - WHERE ([l0].[Name] <> N'Foo') OR [l0].[Name] IS NULL + WHERE ([l0].[Name] <> N'Foo') OR ([l0].[Name] IS NULL) ) AS [t] WHERE [t].[row] <= 3 ) AS [t0] ON [l].[Id] = [t0].[OneToMany_Optional_Inverse2Id] @@ -1489,7 +1489,7 @@ OUTER APPLY ( FROM ( SELECT TOP(1) [l1].[Id], [l1].[Date], [l1].[Level1_Optional_Id], [l1].[Level1_Required_Id], [l1].[Name], [l1].[OneToMany_Optional_Inverse2Id], [l1].[OneToMany_Optional_Self_Inverse2Id], [l1].[OneToMany_Required_Inverse2Id], [l1].[OneToMany_Required_Self_Inverse2Id], [l1].[OneToOne_Optional_PK_Inverse2Id], [l1].[OneToOne_Optional_Self2Id] FROM [LevelTwo] AS [l1] - WHERE ([l].[Id] = [l1].[OneToMany_Optional_Inverse2Id]) AND (([l1].[Name] <> N'Foo') OR [l1].[Name] IS NULL) + WHERE ([l].[Id] = [l1].[OneToMany_Optional_Inverse2Id]) AND (([l1].[Name] <> N'Foo') OR ([l1].[Name] IS NULL)) ORDER BY [l1].[Id] ) AS [t] LEFT JOIN [LevelThree] AS [l0] ON [t].[Id] = [l0].[OneToOne_Optional_PK_Inverse3Id] @@ -1517,7 +1517,7 @@ OUTER APPLY ( FROM ( SELECT TOP(1) [l3].[Id], [l3].[Level2_Optional_Id], [l3].[Level2_Required_Id], [l3].[Name], [l3].[OneToMany_Optional_Inverse3Id], [l3].[OneToMany_Optional_Self_Inverse3Id], [l3].[OneToMany_Required_Inverse3Id], [l3].[OneToMany_Required_Self_Inverse3Id], [l3].[OneToOne_Optional_PK_Inverse3Id], [l3].[OneToOne_Optional_Self3Id] FROM [LevelThree] AS [l3] - WHERE ([l0].[Id] = [l3].[OneToMany_Optional_Inverse3Id]) AND (([l3].[Name] <> N'Foo') OR [l3].[Name] IS NULL) + WHERE ([l0].[Id] = [l3].[OneToMany_Optional_Inverse3Id]) AND (([l3].[Name] <> N'Foo') OR ([l3].[Name] IS NULL)) ORDER BY [l3].[Id] ) AS [t] LEFT JOIN [LevelFour] AS [l1] ON [t].[Id] = [l1].[OneToMany_Optional_Inverse4Id] @@ -1542,7 +1542,7 @@ OUTER APPLY ( FROM ( SELECT TOP(1) [l3].[Id], [l3].[Level2_Optional_Id], [l3].[Level2_Required_Id], [l3].[Name], [l3].[OneToMany_Optional_Inverse3Id], [l3].[OneToMany_Optional_Self_Inverse3Id], [l3].[OneToMany_Required_Inverse3Id], [l3].[OneToMany_Required_Self_Inverse3Id], [l3].[OneToOne_Optional_PK_Inverse3Id], [l3].[OneToOne_Optional_Self3Id] FROM [LevelThree] AS [l3] - WHERE ([l0].[Id] = [l3].[OneToMany_Optional_Inverse3Id]) AND (([l3].[Name] <> N'Foo') OR [l3].[Name] IS NULL) + WHERE ([l0].[Id] = [l3].[OneToMany_Optional_Inverse3Id]) AND (([l3].[Name] <> N'Foo') OR ([l3].[Name] IS NULL)) ORDER BY [l3].[Id] ) AS [t] LEFT JOIN [LevelFour] AS [l1] ON [t].[Id] = [l1].[OneToMany_Optional_Inverse4Id] @@ -1566,7 +1566,7 @@ LEFT JOIN ( FROM ( 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], ROW_NUMBER() OVER(PARTITION BY [l0].[OneToMany_Optional_Inverse2Id] ORDER BY [l0].[Id]) AS [row] FROM [LevelTwo] AS [l0] - WHERE ([l0].[Name] <> @__prm_0) OR [l0].[Name] IS NULL + WHERE ([l0].[Name] <> @__prm_0) OR ([l0].[Name] IS NULL) ) AS [t] WHERE [t].[row] <= 3 ) AS [t0] ON [l].[Id] = [t0].[OneToMany_Optional_Inverse2Id] @@ -1655,7 +1655,7 @@ LEFT JOIN ( FROM ( SELECT 1 AS [c], [l0].[Id], [l0].[OneToMany_Optional_Inverse2Id], ROW_NUMBER() OVER(PARTITION BY [l0].[OneToMany_Optional_Inverse2Id] ORDER BY [l0].[Id]) AS [row] FROM [LevelTwo] AS [l0] - WHERE ([l0].[Name] <> N'Foo') OR [l0].[Name] IS NULL + WHERE ([l0].[Name] <> N'Foo') OR ([l0].[Name] IS NULL) ) AS [t] WHERE [t].[row] <= 1 ) AS [t0] ON [l].[Id] = [t0].[OneToMany_Optional_Inverse2Id] @@ -1703,7 +1703,7 @@ LEFT JOIN ( FROM [LevelTwo] AS [l15] WHERE [l15].[Id] <> 42 ) AS [t1] ON [t].[Id2] = [t1].[OneToMany_Optional_Self_Inverse2Id] -WHERE ([l11].[Name] <> N'Foo') OR [l11].[Name] IS NULL +WHERE ([l11].[Name] <> N'Foo') OR ([l11].[Name] IS NULL) ORDER BY [l12].[Id], [l].[Id], [l0].[Id], [l1].[Id], [l2].[Id], [t].[Id], [t].[Id0], [t].[Id1], [t].[Id2], [t0].[Id], [t0].[Id0], [t0].[Id1], [t0].[Id2], [l11].[Id], [l13].[Id], [l14].[Id]"); } @@ -2077,7 +2077,7 @@ OUTER APPLY ( FROM ( SELECT [l0].[Date] FROM [LevelOne] AS [l0] - WHERE ([l0].[Name] = [l].[Name]) OR ([l0].[Name] IS NULL AND [l].[Name] IS NULL) + WHERE ([l0].[Name] = [l].[Name]) OR (([l0].[Name] IS NULL) AND ([l].[Name] IS NULL)) GROUP BY [l0].[Date] ) AS [t] LEFT JOIN ( @@ -2085,7 +2085,7 @@ LEFT JOIN ( FROM ( SELECT [l1].[Id], [l1].[Date], [l1].[Name], [l1].[OneToMany_Optional_Self_Inverse1Id], [l1].[OneToMany_Required_Self_Inverse1Id], [l1].[OneToOne_Optional_Self1Id], ROW_NUMBER() OVER(PARTITION BY [l1].[Date] ORDER BY [l1].[Name]) AS [row] FROM [LevelOne] AS [l1] - WHERE ([l1].[Name] = [l].[Name]) OR ([l1].[Name] IS NULL AND [l].[Name] IS NULL) + WHERE ([l1].[Name] = [l].[Name]) OR (([l1].[Name] IS NULL) AND ([l].[Name] IS NULL)) ) AS [t1] WHERE (1 < [t1].[row]) AND ([t1].[row] <= 6) ) AS [t0] ON [t].[Date] = [t0].[Date] @@ -2385,7 +2385,7 @@ LEFT JOIN ( FROM ( SELECT 1 AS [c], [l0].[Id], [l0].[OneToMany_Optional_Inverse2Id], ROW_NUMBER() OVER(PARTITION BY [l0].[OneToMany_Optional_Inverse2Id] ORDER BY [l0].[Id]) AS [row] FROM [LevelTwo] AS [l0] - WHERE ([l0].[Name] <> N'Foo') OR [l0].[Name] IS NULL + WHERE ([l0].[Name] <> N'Foo') OR ([l0].[Name] IS NULL) ) AS [t] WHERE [t].[row] <= 1 ) AS [t0] ON [l].[Id] = [t0].[OneToMany_Optional_Inverse2Id] diff --git a/test/EFCore.SqlServer.FunctionalTests/Query/ComplexNavigationsCollectionsSharedTypeQuerySqlServerTest.cs b/test/EFCore.SqlServer.FunctionalTests/Query/ComplexNavigationsCollectionsSharedTypeQuerySqlServerTest.cs index f55151a5a32..f259d5c14be 100644 --- a/test/EFCore.SqlServer.FunctionalTests/Query/ComplexNavigationsCollectionsSharedTypeQuerySqlServerTest.cs +++ b/test/EFCore.SqlServer.FunctionalTests/Query/ComplexNavigationsCollectionsSharedTypeQuerySqlServerTest.cs @@ -40,7 +40,7 @@ LEFT JOIN ( SELECT 1 AS [c], [l0].[Id], [l1].[Id] AS [Id0], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Required_Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToMany_Optional_Inverse2Id], ROW_NUMBER() OVER(PARTITION BY [l0].[OneToMany_Optional_Inverse2Id] ORDER BY [l0].[Id], [l1].[Id]) AS [row] FROM [Level1] AS [l0] INNER JOIN [Level1] AS [l1] ON [l0].[Id] = [l1].[Id] - WHERE (([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) AND (([l0].[Level2_Name] <> N'Foo') OR [l0].[Level2_Name] IS NULL) + WHERE ((([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL)) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL)) AND (([l0].[Level2_Name] <> N'Foo') OR ([l0].[Level2_Name] IS NULL)) ) AS [t] WHERE [t].[row] <= 1 ) AS [t0] ON [l].[Id] = [t0].[OneToMany_Optional_Inverse2Id] @@ -51,8 +51,8 @@ WHERE EXISTS ( SELECT 1 FROM [Level1] AS [l3] INNER JOIN [Level1] AS [l4] ON [l3].[Id] = [l4].[Id] - WHERE ((([l3].[OneToOne_Required_PK_Date] IS NOT NULL AND [l3].[Level1_Required_Id] IS NOT NULL) AND [l3].[OneToMany_Required_Inverse2Id] IS NOT NULL) AND ([l2].[Id] = [l3].[OneToMany_Optional_Inverse2Id])) AND ([l3].[Id] = CASE - WHEN ([t0].[OneToOne_Required_PK_Date] IS NOT NULL AND [t0].[Level1_Required_Id] IS NOT NULL) AND [t0].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t0].[Id] + WHERE (((([l3].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l3].[Level1_Required_Id] IS NOT NULL)) AND ([l3].[OneToMany_Required_Inverse2Id] IS NOT NULL)) AND ([l2].[Id] = [l3].[OneToMany_Optional_Inverse2Id])) AND ([l3].[Id] = CASE + WHEN (([t0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t0].[Level1_Required_Id] IS NOT NULL)) AND ([t0].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t0].[Id] END)) ) AS [t1] ORDER BY [l].[Id], [t0].[Id], [t0].[Id0]"); @@ -69,7 +69,7 @@ INNER JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[Level2_Name], [l0].[OneToMany_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id], [l1].[Id] AS [Id0] FROM [Level1] AS [l0] INNER JOIN [Level1] AS [l1] ON [l0].[Id] = [l1].[Id] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL)) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t] ON [l].[Id] = [t].[OneToMany_Optional_Inverse2Id] LEFT JOIN ( SELECT [l2].[Id], [l2].[Level2_Optional_Id], [l2].[Level2_Required_Id], [l2].[Level3_Name], [l2].[OneToMany_Optional_Inverse3Id], [l2].[OneToMany_Required_Inverse3Id], [l2].[OneToOne_Optional_PK_Inverse3Id], [t1].[Id] AS [Id0], [t1].[Id0] AS [Id00] @@ -78,11 +78,11 @@ INNER JOIN ( SELECT [l3].[Id], [l4].[Id] AS [Id0] FROM [Level1] AS [l3] INNER JOIN [Level1] AS [l4] ON [l3].[Id] = [l4].[Id] - WHERE ([l3].[OneToOne_Required_PK_Date] IS NOT NULL AND [l3].[Level1_Required_Id] IS NOT NULL) AND [l3].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l3].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l3].[Level1_Required_Id] IS NOT NULL)) AND ([l3].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t1] ON [l2].[Id] = [t1].[Id] - WHERE [l2].[Level2_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l2].[Level2_Required_Id] IS NOT NULL) AND ([l2].[OneToMany_Required_Inverse3Id] IS NOT NULL) ) AS [t0] ON CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + WHEN (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] END = [t0].[OneToMany_Optional_Inverse3Id] ORDER BY [l].[Id], [t].[Id], [t].[Id0], [t0].[Id], [t0].[Id0]"); } @@ -98,15 +98,15 @@ INNER JOIN ( SELECT DISTINCT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[Level2_Name], [l0].[OneToMany_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id] FROM [Level1] AS [l0] INNER JOIN [Level1] AS [l1] ON [l0].[Id] = [l1].[Id] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL)) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t] ON [l].[Id] = [t].[OneToMany_Optional_Inverse2Id] LEFT JOIN ( SELECT [l2].[Id], [l2].[OneToOne_Required_PK_Date], [l2].[Level1_Optional_Id], [l2].[Level1_Required_Id], [l2].[Level2_Name], [l2].[OneToMany_Optional_Inverse2Id], [l2].[OneToMany_Required_Inverse2Id], [l2].[OneToOne_Optional_PK_Inverse2Id], [l3].[Id] AS [Id0] FROM [Level1] AS [l2] INNER JOIN [Level1] AS [l3] ON [l2].[Id] = [l3].[Id] - WHERE ([l2].[OneToOne_Required_PK_Date] IS NOT NULL AND [l2].[Level1_Required_Id] IS NOT NULL) AND [l2].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l2].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l2].[Level1_Required_Id] IS NOT NULL)) AND ([l2].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t0] ON [l].[Id] = [t0].[OneToMany_Optional_Inverse2Id] -WHERE ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL +WHERE (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) ORDER BY [l].[Id], [t].[Id], [t0].[Id]"); } @@ -125,17 +125,17 @@ ORDER BY [l].[Id] ) AS [t] OUTER APPLY ( SELECT CASE - WHEN ([t1].[OneToOne_Required_PK_Date] IS NOT NULL AND [t1].[Level1_Required_Id] IS NOT NULL) AND [t1].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t1].[Id] + WHEN (([t1].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t1].[Level1_Required_Id] IS NOT NULL)) AND ([t1].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t1].[Id] END AS [Id], [t1].[Level2_Name] AS [Name], [t1].[OneToMany_Required_Inverse2Id] AS [Level1Id], [t1].[Level1_Required_Id] AS [Level2Id], [l1].[Id] AS [Id0], [l1].[Date], [l1].[Name] AS [Name0], [t1].[Id] AS [Id1], [t1].[Id0] AS [Id00], [t1].[c] FROM ( SELECT TOP(3) [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Required_Id], [l0].[Level2_Name], [l0].[OneToMany_Required_Inverse2Id], [l2].[Id] AS [Id0], CASE - WHEN ([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [l0].[Id] + WHEN (([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL)) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [l0].[Id] END AS [c] FROM [Level1] AS [l0] INNER JOIN [Level1] AS [l2] ON [l0].[Id] = [l2].[Id] - WHERE (([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) AND ([t].[Id] = [l0].[OneToMany_Required_Inverse2Id]) + WHERE ((([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL)) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL)) AND ([t].[Id] = [l0].[OneToMany_Required_Inverse2Id]) ORDER BY CASE - WHEN ([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [l0].[Id] + WHEN (([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL)) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [l0].[Id] END ) AS [t1] INNER JOIN [Level1] AS [l1] ON [t1].[Level1_Required_Id] = [l1].[Id] @@ -159,17 +159,17 @@ OFFSET @__p_0 ROWS FETCH NEXT @__p_0 ROWS ONLY ) AS [t] OUTER APPLY ( SELECT CASE - WHEN ([t1].[OneToOne_Required_PK_Date] IS NOT NULL AND [t1].[Level1_Required_Id] IS NOT NULL) AND [t1].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t1].[Id] + WHEN (([t1].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t1].[Level1_Required_Id] IS NOT NULL)) AND ([t1].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t1].[Id] END AS [Id], [t1].[Level2_Name] AS [Name], [t1].[OneToMany_Required_Inverse2Id] AS [Level1Id], [t1].[Level1_Required_Id] AS [Level2Id], [l1].[Id] AS [Id0], [l1].[Date], [l1].[Name] AS [Name0], [t1].[Id] AS [Id1], [t1].[Id0] AS [Id00], [t1].[c] FROM ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Required_Id], [l0].[Level2_Name], [l0].[OneToMany_Required_Inverse2Id], [l2].[Id] AS [Id0], CASE - WHEN ([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [l0].[Id] + WHEN (([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL)) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [l0].[Id] END AS [c] FROM [Level1] AS [l0] INNER JOIN [Level1] AS [l2] ON [l0].[Id] = [l2].[Id] - WHERE (([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) AND ([t].[Id] = [l0].[OneToMany_Required_Inverse2Id]) + WHERE ((([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL)) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL)) AND ([t].[Id] = [l0].[OneToMany_Required_Inverse2Id]) ORDER BY CASE - WHEN ([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [l0].[Id] + WHEN (([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL)) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [l0].[Id] END OFFSET 1 ROWS FETCH NEXT 3 ROWS ONLY ) AS [t1] @@ -189,15 +189,15 @@ LEFT JOIN ( SELECT [t].[Id], [t].[OneToOne_Required_PK_Date], [t].[Level1_Optional_Id], [t].[Level1_Required_Id], [t].[Level2_Name], [t].[OneToMany_Optional_Inverse2Id], [t].[OneToMany_Required_Inverse2Id], [t].[OneToOne_Optional_PK_Inverse2Id] FROM ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[Level2_Name], [l0].[OneToMany_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id], ROW_NUMBER() OVER(PARTITION BY [l0].[OneToMany_Optional_Inverse2Id], CASE - WHEN ([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [l0].[Id] + WHEN (([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL)) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [l0].[Id] END ORDER BY [l0].[Id], [l1].[Id]) AS [row] FROM [Level1] AS [l0] INNER JOIN [Level1] AS [l1] ON [l0].[Id] = [l1].[Id] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL)) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t] WHERE [t].[row] <= 1 ) AS [t0] ON ([l].[Id] = [t0].[OneToMany_Optional_Inverse2Id]) AND ([l].[Id] = CASE - WHEN ([t0].[OneToOne_Required_PK_Date] IS NOT NULL AND [t0].[Level1_Required_Id] IS NOT NULL) AND [t0].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t0].[Id] + WHEN (([t0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t0].[Level1_Required_Id] IS NOT NULL)) AND ([t0].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t0].[Id] END)"); } @@ -212,13 +212,13 @@ LEFT JOIN ( SELECT [t].[Id], [t].[OneToOne_Required_PK_Date], [t].[Level1_Optional_Id], [t].[Level1_Required_Id], [t].[Level2_Name], [t].[OneToMany_Optional_Inverse2Id], [t].[OneToMany_Required_Inverse2Id], [t].[OneToOne_Optional_PK_Inverse2Id], [t].[Id0], [t].[c] FROM ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[Level2_Name], [l0].[OneToMany_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id], [l1].[Id] AS [Id0], ROW_NUMBER() OVER(PARTITION BY [l0].[OneToMany_Optional_Inverse2Id] ORDER BY CASE - WHEN ([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [l0].[Id] + WHEN (([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL)) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [l0].[Id] END DESC) AS [row], CASE - WHEN ([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [l0].[Id] + WHEN (([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL)) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [l0].[Id] END AS [c] FROM [Level1] AS [l0] INNER JOIN [Level1] AS [l1] ON [l0].[Id] = [l1].[Id] - WHERE (([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) AND (([l0].[Level2_Name] <> N'Foo') OR [l0].[Level2_Name] IS NULL) + WHERE ((([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL)) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL)) AND (([l0].[Level2_Name] <> N'Foo') OR ([l0].[Level2_Name] IS NULL)) ) AS [t] WHERE [t].[row] <= 2 ) AS [t0] ON [l].[Id] = [t0].[OneToMany_Optional_Inverse2Id] @@ -236,7 +236,7 @@ LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[Level2_Name], [l0].[OneToMany_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id], [l1].[Id] AS [Id0] FROM [Level1] AS [l0] INNER JOIN [Level1] AS [l1] ON [l0].[Id] = [l1].[Id] - WHERE (([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) AND ([l0].[Id] > 5) + WHERE ((([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL)) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL)) AND ([l0].[Id] > 5) ) AS [t] ON [l].[Id] = [t].[OneToMany_Optional_Inverse2Id] ORDER BY [l].[Id], [t].[Id]"); } @@ -252,7 +252,7 @@ LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[Level2_Name], [l0].[OneToMany_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id], [l1].[Id] AS [Id0] FROM [Level1] AS [l0] INNER JOIN [Level1] AS [l1] ON [l0].[Id] = [l1].[Id] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL)) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t] ON [l].[Id] = [t].[Level1_Optional_Id] LEFT JOIN ( SELECT [l2].[Id], [l2].[Level2_Optional_Id], [l2].[Level2_Required_Id], [l2].[Level3_Name], [l2].[OneToMany_Optional_Inverse3Id], [l2].[OneToMany_Required_Inverse3Id], [l2].[OneToOne_Optional_PK_Inverse3Id], [t1].[Id] AS [Id0], [t1].[Id0] AS [Id00] @@ -261,11 +261,11 @@ INNER JOIN ( SELECT [l3].[Id], [l4].[Id] AS [Id0] FROM [Level1] AS [l3] INNER JOIN [Level1] AS [l4] ON [l3].[Id] = [l4].[Id] - WHERE ([l3].[OneToOne_Required_PK_Date] IS NOT NULL AND [l3].[Level1_Required_Id] IS NOT NULL) AND [l3].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l3].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l3].[Level1_Required_Id] IS NOT NULL)) AND ([l3].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t1] ON [l2].[Id] = [t1].[Id] - WHERE [l2].[Level2_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l2].[Level2_Required_Id] IS NOT NULL) AND ([l2].[OneToMany_Required_Inverse3Id] IS NOT NULL) ) AS [t0] ON CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + WHEN (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] END = [t0].[OneToMany_Optional_Inverse3Id] ORDER BY [t].[Level2_Name], [l].[Id], [t].[Id], [t].[Id0], [t0].[Id], [t0].[Id0]"); } @@ -283,7 +283,7 @@ LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[Level2_Name], [l0].[OneToMany_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id], [l1].[Id] AS [Id0], ROW_NUMBER() OVER(PARTITION BY [l0].[OneToMany_Optional_Inverse2Id] ORDER BY [l0].[Level2_Name]) AS [row] FROM [Level1] AS [l0] INNER JOIN [Level1] AS [l1] ON [l0].[Id] = [l1].[Id] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL)) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t] WHERE 1 < [t].[row] ) AS [t0] ON [l].[Id] = [t0].[OneToMany_Optional_Inverse2Id] @@ -301,7 +301,7 @@ LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[Level2_Name], [l0].[OneToMany_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id], [l1].[Id] AS [Id0] FROM [Level1] AS [l0] INNER JOIN [Level1] AS [l1] ON [l0].[Id] = [l1].[Id] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL)) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t] ON [l].[Id] = [t].[Level1_Required_Id] LEFT JOIN ( SELECT [l2].[Id], [l2].[Level3_Name], [l2].[OneToOne_Optional_PK_Inverse3Id], [t1].[Id] AS [Id0], [t1].[Id0] AS [Id00] @@ -310,11 +310,11 @@ INNER JOIN ( SELECT [l3].[Id], [l4].[Id] AS [Id0] FROM [Level1] AS [l3] INNER JOIN [Level1] AS [l4] ON [l3].[Id] = [l4].[Id] - WHERE ([l3].[OneToOne_Required_PK_Date] IS NOT NULL AND [l3].[Level1_Required_Id] IS NOT NULL) AND [l3].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l3].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l3].[Level1_Required_Id] IS NOT NULL)) AND ([l3].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t1] ON [l2].[Id] = [t1].[Id] - WHERE [l2].[Level2_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l2].[Level2_Required_Id] IS NOT NULL) AND ([l2].[OneToMany_Required_Inverse3Id] IS NOT NULL) ) AS [t0] ON CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + WHEN (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] END = [t0].[OneToOne_Optional_PK_Inverse3Id] LEFT JOIN ( SELECT [l5].[Id], [l5].[Level2_Optional_Id], [l5].[Level2_Required_Id], [l5].[Level3_Name], [l5].[OneToMany_Optional_Inverse3Id], [l5].[OneToMany_Required_Inverse3Id], [l5].[OneToOne_Optional_PK_Inverse3Id], [t3].[Id] AS [Id0], [t3].[Id0] AS [Id00] @@ -323,17 +323,17 @@ INNER JOIN ( SELECT [l6].[Id], [l7].[Id] AS [Id0] FROM [Level1] AS [l6] INNER JOIN [Level1] AS [l7] ON [l6].[Id] = [l7].[Id] - WHERE ([l6].[OneToOne_Required_PK_Date] IS NOT NULL AND [l6].[Level1_Required_Id] IS NOT NULL) AND [l6].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l6].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l6].[Level1_Required_Id] IS NOT NULL)) AND ([l6].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t3] ON [l5].[Id] = [t3].[Id] - WHERE [l5].[Level2_Required_Id] IS NOT NULL AND [l5].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l5].[Level2_Required_Id] IS NOT NULL) AND ([l5].[OneToMany_Required_Inverse3Id] IS NOT NULL) ) AS [t2] ON CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + WHEN (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] END = [t2].[Level2_Optional_Id] LEFT JOIN ( SELECT [l8].[Id], [l8].[OneToOne_Required_PK_Date], [l8].[Level1_Optional_Id], [l8].[Level1_Required_Id], [l8].[Level2_Name], [l8].[OneToMany_Optional_Inverse2Id], [l8].[OneToMany_Required_Inverse2Id], [l8].[OneToOne_Optional_PK_Inverse2Id], [l9].[Id] AS [Id0] FROM [Level1] AS [l8] INNER JOIN [Level1] AS [l9] ON [l8].[Id] = [l9].[Id] - WHERE ([l8].[OneToOne_Required_PK_Date] IS NOT NULL AND [l8].[Level1_Required_Id] IS NOT NULL) AND [l8].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l8].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l8].[Level1_Required_Id] IS NOT NULL)) AND ([l8].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t4] ON [l].[Id] = [t4].[Level1_Optional_Id] LEFT JOIN ( SELECT [l10].[Id], [l10].[Level2_Optional_Id], [l10].[Level2_Required_Id], [l10].[Level3_Name], [l10].[OneToMany_Optional_Inverse3Id], [l10].[OneToMany_Required_Inverse3Id], [l10].[OneToOne_Optional_PK_Inverse3Id], [t6].[Id] AS [Id0], [t6].[Id0] AS [Id00] @@ -342,11 +342,11 @@ INNER JOIN ( SELECT [l11].[Id], [l12].[Id] AS [Id0] FROM [Level1] AS [l11] INNER JOIN [Level1] AS [l12] ON [l11].[Id] = [l12].[Id] - WHERE ([l11].[OneToOne_Required_PK_Date] IS NOT NULL AND [l11].[Level1_Required_Id] IS NOT NULL) AND [l11].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l11].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l11].[Level1_Required_Id] IS NOT NULL)) AND ([l11].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t6] ON [l10].[Id] = [t6].[Id] - WHERE [l10].[Level2_Required_Id] IS NOT NULL AND [l10].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l10].[Level2_Required_Id] IS NOT NULL) AND ([l10].[OneToMany_Required_Inverse3Id] IS NOT NULL) ) AS [t5] ON CASE - WHEN ([t4].[OneToOne_Required_PK_Date] IS NOT NULL AND [t4].[Level1_Required_Id] IS NOT NULL) AND [t4].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t4].[Id] + WHEN (([t4].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t4].[Level1_Required_Id] IS NOT NULL)) AND ([t4].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t4].[Id] END = [t5].[Level2_Optional_Id] LEFT JOIN ( SELECT [l13].[Id], [l13].[Level2_Optional_Id], [l13].[Level2_Required_Id], [l13].[Level3_Name], [l13].[OneToMany_Optional_Inverse3Id], [l13].[OneToMany_Required_Inverse3Id], [l13].[OneToOne_Optional_PK_Inverse3Id], [t8].[Id] AS [Id0], [t8].[Id0] AS [Id00] @@ -355,13 +355,13 @@ INNER JOIN ( SELECT [l14].[Id], [l15].[Id] AS [Id0] FROM [Level1] AS [l14] INNER JOIN [Level1] AS [l15] ON [l14].[Id] = [l15].[Id] - WHERE ([l14].[OneToOne_Required_PK_Date] IS NOT NULL AND [l14].[Level1_Required_Id] IS NOT NULL) AND [l14].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l14].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l14].[Level1_Required_Id] IS NOT NULL)) AND ([l14].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t8] ON [l13].[Id] = [t8].[Id] - WHERE [l13].[Level2_Required_Id] IS NOT NULL AND [l13].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l13].[Level2_Required_Id] IS NOT NULL) AND ([l13].[OneToMany_Required_Inverse3Id] IS NOT NULL) ) AS [t7] ON CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + WHEN (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] END = [t7].[OneToMany_Optional_Inverse3Id] -WHERE ([t0].[Level3_Name] <> N'Foo') OR [t0].[Level3_Name] IS NULL +WHERE ([t0].[Level3_Name] <> N'Foo') OR ([t0].[Level3_Name] IS NULL) ORDER BY [l].[Id], [t].[Id], [t].[Id0], [t0].[Id], [t0].[Id0], [t0].[Id00], [t2].[Id], [t2].[Id0], [t2].[Id00], [t4].[Id], [t4].[Id0], [t5].[Id], [t5].[Id0], [t5].[Id00], [t7].[Id], [t7].[Id0]"); } @@ -384,7 +384,7 @@ OUTER APPLY ( SELECT TOP(4) [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[Level2_Name], [l0].[OneToMany_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id], [l1].[Id] AS [Id0] FROM [Level1] AS [l0] INNER JOIN [Level1] AS [l1] ON [l0].[Id] = [l1].[Id] - WHERE (([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) AND ([t].[Id] = [l0].[OneToMany_Optional_Inverse2Id]) + WHERE ((([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL)) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL)) AND ([t].[Id] = [l0].[OneToMany_Optional_Inverse2Id]) ORDER BY [l0].[Level2_Name] DESC ) AS [t0] LEFT JOIN ( @@ -394,11 +394,11 @@ INNER JOIN ( SELECT [l3].[Id], [l4].[Id] AS [Id0] FROM [Level1] AS [l3] INNER JOIN [Level1] AS [l4] ON [l3].[Id] = [l4].[Id] - WHERE ([l3].[OneToOne_Required_PK_Date] IS NOT NULL AND [l3].[Level1_Required_Id] IS NOT NULL) AND [l3].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l3].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l3].[Level1_Required_Id] IS NOT NULL)) AND ([l3].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t3] ON [l2].[Id] = [t3].[Id] - WHERE [l2].[Level2_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l2].[Level2_Required_Id] IS NOT NULL) AND ([l2].[OneToMany_Required_Inverse3Id] IS NOT NULL) ) AS [t1] ON CASE - WHEN ([t0].[OneToOne_Required_PK_Date] IS NOT NULL AND [t0].[Level1_Required_Id] IS NOT NULL) AND [t0].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t0].[Id] + WHEN (([t0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t0].[Level1_Required_Id] IS NOT NULL)) AND ([t0].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t0].[Id] END = [t1].[Level2_Optional_Id] ) AS [t2] ORDER BY [t].[Id], [t2].[Level2_Name] DESC, [t2].[Id], [t2].[Id00], [t2].[Id0], [t2].[Id01]"); @@ -417,7 +417,7 @@ OUTER APPLY ( SELECT TOP(3) [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[Level2_Name], [l0].[OneToMany_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id], [l1].[Id] AS [Id0] FROM [Level1] AS [l0] INNER JOIN [Level1] AS [l1] ON [l0].[Id] = [l1].[Id] - WHERE ((([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) AND ([l].[Id] = [l0].[OneToMany_Optional_Inverse2Id])) AND (([l0].[Level2_Name] <> N'Foo') OR [l0].[Level2_Name] IS NULL) + WHERE (((([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL)) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL)) AND ([l].[Id] = [l0].[OneToMany_Optional_Inverse2Id])) AND (([l0].[Level2_Name] <> N'Foo') OR ([l0].[Level2_Name] IS NULL)) ORDER BY [l0].[Level2_Name] ) AS [t] LEFT JOIN ( @@ -429,13 +429,13 @@ INNER JOIN ( SELECT [l3].[Id], [l4].[Id] AS [Id0] FROM [Level1] AS [l3] INNER JOIN [Level1] AS [l4] ON [l3].[Id] = [l4].[Id] - WHERE ([l3].[OneToOne_Required_PK_Date] IS NOT NULL AND [l3].[Level1_Required_Id] IS NOT NULL) AND [l3].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l3].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l3].[Level1_Required_Id] IS NOT NULL)) AND ([l3].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t2] ON [l2].[Id] = [t2].[Id] - WHERE ([l2].[Level2_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse3Id] IS NOT NULL) AND (([l2].[Level3_Name] <> N'Bar') OR [l2].[Level3_Name] IS NULL) + WHERE (([l2].[Level2_Required_Id] IS NOT NULL) AND ([l2].[OneToMany_Required_Inverse3Id] IS NOT NULL)) AND (([l2].[Level3_Name] <> N'Bar') OR ([l2].[Level3_Name] IS NULL)) ) AS [t0] WHERE 1 < [t0].[row] ) AS [t1] ON CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + WHEN (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] END = [t1].[OneToMany_Required_Inverse3Id] ) AS [t3] ORDER BY [l].[Id], [t3].[Level2_Name], [t3].[Id], [t3].[Id0], [t3].[OneToMany_Required_Inverse3Id], [t3].[Level3_Name] DESC, [t3].[Id1], [t3].[Id00]"); @@ -452,7 +452,7 @@ LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[Level2_Name], [l0].[OneToMany_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id], [l1].[Id] AS [Id0] FROM [Level1] AS [l0] INNER JOIN [Level1] AS [l1] ON [l0].[Id] = [l1].[Id] - WHERE (([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) AND (([l0].[Level2_Name] <> N'Foo') OR [l0].[Level2_Name] IS NULL) + WHERE ((([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL)) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL)) AND (([l0].[Level2_Name] <> N'Foo') OR ([l0].[Level2_Name] IS NULL)) ) AS [t] ON [l].[Id] = [t].[OneToMany_Optional_Inverse2Id] WHERE [l].[Id] < 3 ORDER BY [l].[Id], [t].[Id]"); @@ -471,7 +471,7 @@ LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[Level2_Name], [l0].[OneToMany_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id], [l1].[Id] AS [Id0], ROW_NUMBER() OVER(PARTITION BY [l0].[OneToMany_Optional_Inverse2Id] ORDER BY [l0].[Level2_Name]) AS [row] FROM [Level1] AS [l0] INNER JOIN [Level1] AS [l1] ON [l0].[Id] = [l1].[Id] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL)) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t] WHERE (1 < [t].[row]) AND ([t].[row] <= 4) ) AS [t0] ON [l].[Id] = [t0].[OneToMany_Optional_Inverse2Id] @@ -489,7 +489,7 @@ LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[Level2_Name], [l0].[OneToMany_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id], [l1].[Id] AS [Id0] FROM [Level1] AS [l0] INNER JOIN [Level1] AS [l1] ON [l0].[Id] = [l1].[Id] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL)) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t] ON [l].[Id] = [t].[Level1_Optional_Id] LEFT JOIN ( SELECT [t0].[Id], [t0].[Level2_Optional_Id], [t0].[Level2_Required_Id], [t0].[Level3_Name], [t0].[OneToMany_Optional_Inverse3Id], [t0].[OneToMany_Required_Inverse3Id], [t0].[OneToOne_Optional_PK_Inverse3Id], [t0].[Id0], [t0].[Id00] @@ -500,13 +500,13 @@ INNER JOIN ( SELECT [l3].[Id], [l4].[Id] AS [Id0] FROM [Level1] AS [l3] INNER JOIN [Level1] AS [l4] ON [l3].[Id] = [l4].[Id] - WHERE ([l3].[OneToOne_Required_PK_Date] IS NOT NULL AND [l3].[Level1_Required_Id] IS NOT NULL) AND [l3].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l3].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l3].[Level1_Required_Id] IS NOT NULL)) AND ([l3].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t2] ON [l2].[Id] = [t2].[Id] - WHERE ([l2].[Level2_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse3Id] IS NOT NULL) AND (([l2].[Level3_Name] <> N'Foo') OR [l2].[Level3_Name] IS NULL) + WHERE (([l2].[Level2_Required_Id] IS NOT NULL) AND ([l2].[OneToMany_Required_Inverse3Id] IS NOT NULL)) AND (([l2].[Level3_Name] <> N'Foo') OR ([l2].[Level3_Name] IS NULL)) ) AS [t0] WHERE (1 < [t0].[row]) AND ([t0].[row] <= 4) ) AS [t1] ON CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + WHEN (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] END = [t1].[OneToMany_Optional_Inverse3Id] ORDER BY [l].[Id], [t].[Id], [t].[Id0], [t1].[OneToMany_Optional_Inverse3Id], [t1].[Level3_Name], [t1].[Id], [t1].[Id0]"); } @@ -522,10 +522,10 @@ LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[Level2_Name], [l0].[OneToMany_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id], [l1].[Id] AS [Id0] FROM [Level1] AS [l0] INNER JOIN [Level1] AS [l1] ON [l0].[Id] = [l1].[Id] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL)) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t] ON [l].[Id] = [t].[OneToMany_Optional_Inverse2Id] ORDER BY CASE - WHEN [l].[Name] IS NOT NULL AND ([l].[Name] LIKE N'%03') THEN 1 + WHEN ([l].[Name] IS NOT NULL) AND ([l].[Name] LIKE N'%03') THEN 1 ELSE 2 END, [l].[Id], [t].[Id]"); } @@ -541,7 +541,7 @@ LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[Level2_Name], [l0].[OneToMany_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id], [l1].[Id] AS [Id0] FROM [Level1] AS [l0] INNER JOIN [Level1] AS [l1] ON [l0].[Id] = [l1].[Id] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL)) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t] ON [l].[Id] = [t].[Level1_Optional_Id] LEFT JOIN ( SELECT [l2].[Id], [l2].[Level2_Optional_Id], [l2].[Level2_Required_Id], [l2].[Level3_Name], [l2].[OneToMany_Optional_Inverse3Id], [l2].[OneToMany_Required_Inverse3Id], [l2].[OneToOne_Optional_PK_Inverse3Id], [t1].[Id] AS [Id0], [t1].[Level3_Optional_Id], [t1].[Level3_Required_Id], [t1].[Level4_Name], [t1].[OneToMany_Optional_Inverse4Id], [t1].[OneToMany_Required_Inverse4Id], [t1].[OneToOne_Optional_PK_Inverse4Id], [t0].[Id] AS [Id1], [t0].[Id0] AS [Id00], [t1].[Id0] AS [Id01], [t1].[Id00] AS [Id000], [t1].[Id000] AS [Id0000] @@ -550,7 +550,7 @@ INNER JOIN ( SELECT [l3].[Id], [l4].[Id] AS [Id0] FROM [Level1] AS [l3] INNER JOIN [Level1] AS [l4] ON [l3].[Id] = [l4].[Id] - WHERE ([l3].[OneToOne_Required_PK_Date] IS NOT NULL AND [l3].[Level1_Required_Id] IS NOT NULL) AND [l3].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l3].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l3].[Level1_Required_Id] IS NOT NULL)) AND ([l3].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t0] ON [l2].[Id] = [t0].[Id] LEFT JOIN ( SELECT [l5].[Id], [l5].[Level3_Optional_Id], [l5].[Level3_Required_Id], [l5].[Level4_Name], [l5].[OneToMany_Optional_Inverse4Id], [l5].[OneToMany_Required_Inverse4Id], [l5].[OneToOne_Optional_PK_Inverse4Id], [t2].[Id] AS [Id0], [t2].[Id0] AS [Id00], [t2].[Id00] AS [Id000] @@ -562,19 +562,19 @@ INNER JOIN ( SELECT [l7].[Id], [l8].[Id] AS [Id0] FROM [Level1] AS [l7] INNER JOIN [Level1] AS [l8] ON [l7].[Id] = [l8].[Id] - WHERE ([l7].[OneToOne_Required_PK_Date] IS NOT NULL AND [l7].[Level1_Required_Id] IS NOT NULL) AND [l7].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l7].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l7].[Level1_Required_Id] IS NOT NULL)) AND ([l7].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t4] ON [l6].[Id] = [t4].[Id] - WHERE [l6].[Level2_Required_Id] IS NOT NULL AND [l6].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l6].[Level2_Required_Id] IS NOT NULL) AND ([l6].[OneToMany_Required_Inverse3Id] IS NOT NULL) ) AS [t2] ON [l5].[Id] = [t2].[Id] - WHERE [l5].[Level3_Required_Id] IS NOT NULL AND [l5].[OneToMany_Required_Inverse4Id] IS NOT NULL + WHERE ([l5].[Level3_Required_Id] IS NOT NULL) AND ([l5].[OneToMany_Required_Inverse4Id] IS NOT NULL) ) AS [t1] ON CASE - WHEN [l2].[Level2_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [l2].[Id] + WHEN ([l2].[Level2_Required_Id] IS NOT NULL) AND ([l2].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [l2].[Id] END = [t1].[Level3_Required_Id] - WHERE [l2].[Level2_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l2].[Level2_Required_Id] IS NOT NULL) AND ([l2].[OneToMany_Required_Inverse3Id] IS NOT NULL) ) AS [t3] ON CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + WHEN (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] END = [t3].[OneToMany_Required_Inverse3Id] -WHERE ([t].[Level2_Name] <> N'L2 09') OR [t].[Level2_Name] IS NULL +WHERE ([t].[Level2_Name] <> N'L2 09') OR ([t].[Level2_Name] IS NULL) ORDER BY [l].[Id], [t].[Id], [t].[Id0], [t3].[Id], [t3].[Id1], [t3].[Id00], [t3].[Id0], [t3].[Id01], [t3].[Id000]"); } @@ -597,13 +597,13 @@ LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[Level2_Name], [l0].[OneToMany_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id], [l1].[Id] AS [Id0] FROM [Level1] AS [l0] INNER JOIN [Level1] AS [l1] ON [l0].[Id] = [l1].[Id] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL)) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t0] ON [t].[Id] = [t0].[Level1_Optional_Id] LEFT JOIN ( SELECT [l2].[Id], [l2].[OneToOne_Required_PK_Date], [l2].[Level1_Optional_Id], [l2].[Level1_Required_Id], [l2].[Level2_Name], [l2].[OneToMany_Optional_Inverse2Id], [l2].[OneToMany_Required_Inverse2Id], [l2].[OneToOne_Optional_PK_Inverse2Id], [l3].[Id] AS [Id0] FROM [Level1] AS [l2] INNER JOIN [Level1] AS [l3] ON [l2].[Id] = [l3].[Id] - WHERE ([l2].[OneToOne_Required_PK_Date] IS NOT NULL AND [l2].[Level1_Required_Id] IS NOT NULL) AND [l2].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l2].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l2].[Level1_Required_Id] IS NOT NULL)) AND ([l2].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t1] ON [t].[Id] = [t1].[Level1_Required_Id] LEFT JOIN ( SELECT [l4].[Id], [l4].[Level2_Optional_Id], [l4].[Level2_Required_Id], [l4].[Level3_Name], [l4].[OneToMany_Optional_Inverse3Id], [l4].[OneToMany_Required_Inverse3Id], [l4].[OneToOne_Optional_PK_Inverse3Id], [t3].[Id] AS [Id0], [t3].[Id0] AS [Id00] @@ -612,11 +612,11 @@ INNER JOIN ( SELECT [l5].[Id], [l6].[Id] AS [Id0] FROM [Level1] AS [l5] INNER JOIN [Level1] AS [l6] ON [l5].[Id] = [l6].[Id] - WHERE ([l5].[OneToOne_Required_PK_Date] IS NOT NULL AND [l5].[Level1_Required_Id] IS NOT NULL) AND [l5].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l5].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l5].[Level1_Required_Id] IS NOT NULL)) AND ([l5].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t3] ON [l4].[Id] = [t3].[Id] - WHERE [l4].[Level2_Required_Id] IS NOT NULL AND [l4].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l4].[Level2_Required_Id] IS NOT NULL) AND ([l4].[OneToMany_Required_Inverse3Id] IS NOT NULL) ) AS [t2] ON CASE - WHEN ([t0].[OneToOne_Required_PK_Date] IS NOT NULL AND [t0].[Level1_Required_Id] IS NOT NULL) AND [t0].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t0].[Id] + WHEN (([t0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t0].[Level1_Required_Id] IS NOT NULL)) AND ([t0].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t0].[Id] END = [t2].[OneToMany_Optional_Inverse3Id] LEFT JOIN ( SELECT [l7].[Id], [l7].[Level2_Optional_Id], [l7].[Level2_Required_Id], [l7].[Level3_Name], [l7].[OneToMany_Optional_Inverse3Id], [l7].[OneToMany_Required_Inverse3Id], [l7].[OneToOne_Optional_PK_Inverse3Id], [t5].[Id] AS [Id0], [t5].[Id0] AS [Id00] @@ -625,11 +625,11 @@ INNER JOIN ( SELECT [l8].[Id], [l9].[Id] AS [Id0] FROM [Level1] AS [l8] INNER JOIN [Level1] AS [l9] ON [l8].[Id] = [l9].[Id] - WHERE ([l8].[OneToOne_Required_PK_Date] IS NOT NULL AND [l8].[Level1_Required_Id] IS NOT NULL) AND [l8].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l8].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l8].[Level1_Required_Id] IS NOT NULL)) AND ([l8].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t5] ON [l7].[Id] = [t5].[Id] - WHERE [l7].[Level2_Required_Id] IS NOT NULL AND [l7].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l7].[Level2_Required_Id] IS NOT NULL) AND ([l7].[OneToMany_Required_Inverse3Id] IS NOT NULL) ) AS [t4] ON CASE - WHEN ([t1].[OneToOne_Required_PK_Date] IS NOT NULL AND [t1].[Level1_Required_Id] IS NOT NULL) AND [t1].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t1].[Id] + WHEN (([t1].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t1].[Level1_Required_Id] IS NOT NULL)) AND ([t1].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t1].[Id] END = [t4].[OneToMany_Required_Inverse3Id] ORDER BY [t].[Name], [t].[Id], [t0].[Id], [t0].[Id0], [t1].[Id], [t1].[Id0], [t2].[Id], [t2].[Id0], [t2].[Id00], [t4].[Id], [t4].[Id0]"); } @@ -643,7 +643,7 @@ public override async Task Select_subquery_single_nested_subquery2(bool async) FROM [Level1] AS [l] LEFT JOIN ( SELECT [l0].[Id], [l1].[Id] AS [Id0], [t1].[Id] AS [Id1], [t1].[Id0] AS [Id00], [t1].[Id00] AS [Id000], [t2].[Id] AS [Id2], [t2].[Id0] AS [Id01], [t2].[Id1] AS [Id10], [t2].[Id00] AS [Id001], [t2].[Id000] AS [Id0000], [t1].[c], CASE - WHEN ([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [l0].[Id] + WHEN (([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL)) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [l0].[Id] END AS [c0], [l0].[OneToMany_Optional_Inverse2Id] FROM [Level1] AS [l0] INNER JOIN [Level1] AS [l1] ON [l0].[Id] = [l1].[Id] @@ -651,24 +651,24 @@ LEFT JOIN ( SELECT [t0].[c], [t0].[Id], [t0].[Id0], [t0].[Id00], [t0].[Level2_Required_Id], [t0].[OneToMany_Required_Inverse3Id], [t0].[OneToMany_Optional_Inverse3Id] FROM ( SELECT 1 AS [c], [l2].[Id], [t].[Id] AS [Id0], [t].[Id0] AS [Id00], [l2].[Level2_Required_Id], [l2].[OneToMany_Required_Inverse3Id], [l2].[OneToMany_Optional_Inverse3Id], ROW_NUMBER() OVER(PARTITION BY [l2].[OneToMany_Optional_Inverse3Id] ORDER BY CASE - WHEN [l2].[Level2_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [l2].[Id] + WHEN ([l2].[Level2_Required_Id] IS NOT NULL) AND ([l2].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [l2].[Id] END) AS [row] FROM [Level1] AS [l2] INNER JOIN ( SELECT [l3].[Id], [l4].[Id] AS [Id0] FROM [Level1] AS [l3] INNER JOIN [Level1] AS [l4] ON [l3].[Id] = [l4].[Id] - WHERE ([l3].[OneToOne_Required_PK_Date] IS NOT NULL AND [l3].[Level1_Required_Id] IS NOT NULL) AND [l3].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l3].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l3].[Level1_Required_Id] IS NOT NULL)) AND ([l3].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t] ON [l2].[Id] = [t].[Id] - WHERE [l2].[Level2_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l2].[Level2_Required_Id] IS NOT NULL) AND ([l2].[OneToMany_Required_Inverse3Id] IS NOT NULL) ) AS [t0] WHERE [t0].[row] <= 1 ) AS [t1] ON CASE - WHEN ([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [l0].[Id] + WHEN (([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL)) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [l0].[Id] END = [t1].[OneToMany_Optional_Inverse3Id] LEFT JOIN ( SELECT CASE - WHEN [l5].[Level3_Required_Id] IS NOT NULL AND [l5].[OneToMany_Required_Inverse4Id] IS NOT NULL THEN [l5].[Id] + WHEN ([l5].[Level3_Required_Id] IS NOT NULL) AND ([l5].[OneToMany_Required_Inverse4Id] IS NOT NULL) THEN [l5].[Id] END AS [Id], [l5].[Id] AS [Id0], [t3].[Id] AS [Id1], [t3].[Id0] AS [Id00], [t3].[Id00] AS [Id000], [l5].[OneToMany_Optional_Inverse4Id] FROM [Level1] AS [l5] INNER JOIN ( @@ -678,15 +678,15 @@ INNER JOIN ( SELECT [l7].[Id], [l8].[Id] AS [Id0] FROM [Level1] AS [l7] INNER JOIN [Level1] AS [l8] ON [l7].[Id] = [l8].[Id] - WHERE ([l7].[OneToOne_Required_PK_Date] IS NOT NULL AND [l7].[Level1_Required_Id] IS NOT NULL) AND [l7].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l7].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l7].[Level1_Required_Id] IS NOT NULL)) AND ([l7].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t4] ON [l6].[Id] = [t4].[Id] - WHERE [l6].[Level2_Required_Id] IS NOT NULL AND [l6].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l6].[Level2_Required_Id] IS NOT NULL) AND ([l6].[OneToMany_Required_Inverse3Id] IS NOT NULL) ) AS [t3] ON [l5].[Id] = [t3].[Id] - WHERE [l5].[Level3_Required_Id] IS NOT NULL AND [l5].[OneToMany_Required_Inverse4Id] IS NOT NULL + WHERE ([l5].[Level3_Required_Id] IS NOT NULL) AND ([l5].[OneToMany_Required_Inverse4Id] IS NOT NULL) ) AS [t2] ON CASE - WHEN [t1].[Level2_Required_Id] IS NOT NULL AND [t1].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [t1].[Id] + WHEN ([t1].[Level2_Required_Id] IS NOT NULL) AND ([t1].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [t1].[Id] END = [t2].[OneToMany_Optional_Inverse4Id] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL)) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t5] ON [l].[Id] = [t5].[OneToMany_Optional_Inverse2Id] ORDER BY [l].[Id], [t5].[c0], [t5].[Id], [t5].[Id0], [t5].[Id1], [t5].[Id00], [t5].[Id000], [t5].[Id2], [t5].[Id01], [t5].[Id10], [t5].[Id001]"); } @@ -702,7 +702,7 @@ INNER JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[Level2_Name], [l0].[OneToMany_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id], [l1].[Id] AS [Id0] FROM [Level1] AS [l0] INNER JOIN [Level1] AS [l1] ON [l0].[Id] = [l1].[Id] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL)) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t] ON [l].[Id] = [t].[OneToMany_Optional_Inverse2Id] LEFT JOIN ( SELECT [l2].[Id], [l2].[Level2_Optional_Id], [l2].[Level2_Required_Id], [l2].[Level3_Name], [l2].[OneToMany_Optional_Inverse3Id], [l2].[OneToMany_Required_Inverse3Id], [l2].[OneToOne_Optional_PK_Inverse3Id], [t1].[Id] AS [Id0], [t1].[Id0] AS [Id00] @@ -711,11 +711,11 @@ INNER JOIN ( SELECT [l3].[Id], [l4].[Id] AS [Id0] FROM [Level1] AS [l3] INNER JOIN [Level1] AS [l4] ON [l3].[Id] = [l4].[Id] - WHERE ([l3].[OneToOne_Required_PK_Date] IS NOT NULL AND [l3].[Level1_Required_Id] IS NOT NULL) AND [l3].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l3].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l3].[Level1_Required_Id] IS NOT NULL)) AND ([l3].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t1] ON [l2].[Id] = [t1].[Id] - WHERE [l2].[Level2_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l2].[Level2_Required_Id] IS NOT NULL) AND ([l2].[OneToMany_Required_Inverse3Id] IS NOT NULL) ) AS [t0] ON CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + WHEN (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] END = [t0].[OneToMany_Optional_Inverse3Id] ORDER BY [t].[Level2_Name], [l].[Id], [t].[Id], [t].[Id0], [t0].[Id], [t0].[Id0]"); } @@ -731,7 +731,7 @@ LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[Level2_Name], [l0].[OneToMany_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id], [l1].[Id] AS [Id0] FROM [Level1] AS [l0] INNER JOIN [Level1] AS [l1] ON [l0].[Id] = [l1].[Id] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL)) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t] ON [l].[Id] = [t].[Level1_Optional_Id] LEFT JOIN ( SELECT [l2].[Id], [l2].[Level2_Optional_Id], [l2].[Level2_Required_Id], [l2].[Level3_Name], [l2].[OneToMany_Optional_Inverse3Id], [l2].[OneToMany_Required_Inverse3Id], [l2].[OneToOne_Optional_PK_Inverse3Id], [t1].[Id] AS [Id0], [t1].[Id0] AS [Id00] @@ -740,11 +740,11 @@ INNER JOIN ( SELECT [l3].[Id], [l4].[Id] AS [Id0] FROM [Level1] AS [l3] INNER JOIN [Level1] AS [l4] ON [l3].[Id] = [l4].[Id] - WHERE ([l3].[OneToOne_Required_PK_Date] IS NOT NULL AND [l3].[Level1_Required_Id] IS NOT NULL) AND [l3].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l3].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l3].[Level1_Required_Id] IS NOT NULL)) AND ([l3].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t1] ON [l2].[Id] = [t1].[Id] - WHERE [l2].[Level2_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l2].[Level2_Required_Id] IS NOT NULL) AND ([l2].[OneToMany_Required_Inverse3Id] IS NOT NULL) ) AS [t0] ON CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + WHEN (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] END = [t0].[OneToMany_Optional_Inverse3Id] LEFT JOIN ( SELECT [l5].[Id], [l5].[OneToOne_Required_PK_Date], [l5].[Level1_Optional_Id], [l5].[Level1_Required_Id], [l5].[Level2_Name], [l5].[OneToMany_Optional_Inverse2Id], [l5].[OneToMany_Required_Inverse2Id], [l5].[OneToOne_Optional_PK_Inverse2Id], [t3].[Id] AS [Id0], [t3].[Level2_Optional_Id], [t3].[Level2_Required_Id], [t3].[Level3_Name], [t3].[OneToMany_Optional_Inverse3Id], [t3].[OneToMany_Required_Inverse3Id], [t3].[OneToOne_Optional_PK_Inverse3Id], [l6].[Id] AS [Id1], [t3].[Id0] AS [Id00], [t3].[Id00] AS [Id000] @@ -757,13 +757,13 @@ INNER JOIN ( SELECT [l8].[Id], [l9].[Id] AS [Id0] FROM [Level1] AS [l8] INNER JOIN [Level1] AS [l9] ON [l8].[Id] = [l9].[Id] - WHERE ([l8].[OneToOne_Required_PK_Date] IS NOT NULL AND [l8].[Level1_Required_Id] IS NOT NULL) AND [l8].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l8].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l8].[Level1_Required_Id] IS NOT NULL)) AND ([l8].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t4] ON [l7].[Id] = [t4].[Id] - WHERE [l7].[Level2_Required_Id] IS NOT NULL AND [l7].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l7].[Level2_Required_Id] IS NOT NULL) AND ([l7].[OneToMany_Required_Inverse3Id] IS NOT NULL) ) AS [t3] ON CASE - WHEN ([l5].[OneToOne_Required_PK_Date] IS NOT NULL AND [l5].[Level1_Required_Id] IS NOT NULL) AND [l5].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [l5].[Id] + WHEN (([l5].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l5].[Level1_Required_Id] IS NOT NULL)) AND ([l5].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [l5].[Id] END = [t3].[Level2_Optional_Id] - WHERE ([l5].[OneToOne_Required_PK_Date] IS NOT NULL AND [l5].[Level1_Required_Id] IS NOT NULL) AND [l5].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l5].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l5].[Level1_Required_Id] IS NOT NULL)) AND ([l5].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t2] ON [l].[Id] = [t2].[OneToMany_Optional_Inverse2Id] ORDER BY [l].[Id], [t].[Id], [t].[Id0], [t0].[Id], [t0].[Id0], [t0].[Id00], [t2].[Id], [t2].[Id1], [t2].[Id0], [t2].[Id00]"); } @@ -786,13 +786,13 @@ INNER JOIN ( SELECT [l3].[Id], [l4].[Id] AS [Id0] FROM [Level1] AS [l3] INNER JOIN [Level1] AS [l4] ON [l3].[Id] = [l4].[Id] - WHERE ([l3].[OneToOne_Required_PK_Date] IS NOT NULL AND [l3].[Level1_Required_Id] IS NOT NULL) AND [l3].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l3].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l3].[Level1_Required_Id] IS NOT NULL)) AND ([l3].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t] ON [l2].[Id] = [t].[Id] - WHERE [l2].[Level2_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l2].[Level2_Required_Id] IS NOT NULL) AND ([l2].[OneToMany_Required_Inverse3Id] IS NOT NULL) ) AS [t0] ON CASE - WHEN ([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [l0].[Id] + WHEN (([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL)) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [l0].[Id] END = [t0].[Level2_Optional_Id] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL)) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t1] ON [l].[Id] = [t1].[OneToMany_Optional_Inverse2Id] ORDER BY [l].[Id], [t1].[Id], [t1].[Id1], [t1].[Id0], [t1].[Id00]"); } @@ -808,7 +808,7 @@ LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[Level2_Name], [l0].[OneToMany_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id], [l1].[Id] AS [Id0] FROM [Level1] AS [l0] INNER JOIN [Level1] AS [l1] ON [l0].[Id] = [l1].[Id] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL)) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t] ON [l].[Id] = [t].[Level1_Optional_Id] LEFT JOIN ( SELECT [l2].[Id], [l2].[Level2_Optional_Id], [l2].[Level2_Required_Id], [l2].[Level3_Name], [l2].[OneToMany_Optional_Inverse3Id], [l2].[OneToMany_Required_Inverse3Id], [l2].[OneToOne_Optional_PK_Inverse3Id], [t1].[Id] AS [Id0], [t1].[Id0] AS [Id00] @@ -817,11 +817,11 @@ INNER JOIN ( SELECT [l3].[Id], [l4].[Id] AS [Id0] FROM [Level1] AS [l3] INNER JOIN [Level1] AS [l4] ON [l3].[Id] = [l4].[Id] - WHERE ([l3].[OneToOne_Required_PK_Date] IS NOT NULL AND [l3].[Level1_Required_Id] IS NOT NULL) AND [l3].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l3].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l3].[Level1_Required_Id] IS NOT NULL)) AND ([l3].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t1] ON [l2].[Id] = [t1].[Id] - WHERE [l2].[Level2_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l2].[Level2_Required_Id] IS NOT NULL) AND ([l2].[OneToMany_Required_Inverse3Id] IS NOT NULL) ) AS [t0] ON CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + WHEN (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] END = [t0].[OneToMany_Optional_Inverse3Id] ORDER BY [l].[Id], [t].[Id], [t].[Id0], [t0].[Id], [t0].[Id0]"); } @@ -837,7 +837,7 @@ LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[OneToMany_Required_Inverse2Id], [l1].[Id] AS [Id0] FROM [Level1] AS [l0] INNER JOIN [Level1] AS [l1] ON [l0].[Id] = [l1].[Id] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL)) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t] ON [l].[Id] = [t].[Level1_Optional_Id] LEFT JOIN ( SELECT [l2].[Id], [l2].[Level2_Optional_Id], [l2].[Level2_Required_Id], [l2].[Level3_Name], [l2].[OneToMany_Optional_Inverse3Id], [l2].[OneToMany_Required_Inverse3Id], [l2].[OneToOne_Optional_PK_Inverse3Id], [t1].[Id] AS [Id0], [t1].[Id0] AS [Id00] @@ -846,11 +846,11 @@ INNER JOIN ( SELECT [l3].[Id], [l4].[Id] AS [Id0] FROM [Level1] AS [l3] INNER JOIN [Level1] AS [l4] ON [l3].[Id] = [l4].[Id] - WHERE ([l3].[OneToOne_Required_PK_Date] IS NOT NULL AND [l3].[Level1_Required_Id] IS NOT NULL) AND [l3].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l3].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l3].[Level1_Required_Id] IS NOT NULL)) AND ([l3].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t1] ON [l2].[Id] = [t1].[Id] - WHERE [l2].[Level2_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l2].[Level2_Required_Id] IS NOT NULL) AND ([l2].[OneToMany_Required_Inverse3Id] IS NOT NULL) ) AS [t0] ON CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + WHEN (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] END = [t0].[OneToOne_Optional_PK_Inverse3Id] LEFT JOIN ( SELECT [l5].[Id], [l5].[Level3_Optional_Id], [l5].[Level3_Required_Id], [l5].[Level4_Name], [l5].[OneToMany_Optional_Inverse4Id], [l5].[OneToMany_Required_Inverse4Id], [l5].[OneToOne_Optional_PK_Inverse4Id], [t3].[Id] AS [Id0], [t3].[Id0] AS [Id00], [t3].[Id00] AS [Id000] @@ -862,13 +862,13 @@ INNER JOIN ( SELECT [l7].[Id], [l8].[Id] AS [Id0] FROM [Level1] AS [l7] INNER JOIN [Level1] AS [l8] ON [l7].[Id] = [l8].[Id] - WHERE ([l7].[OneToOne_Required_PK_Date] IS NOT NULL AND [l7].[Level1_Required_Id] IS NOT NULL) AND [l7].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l7].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l7].[Level1_Required_Id] IS NOT NULL)) AND ([l7].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t4] ON [l6].[Id] = [t4].[Id] - WHERE [l6].[Level2_Required_Id] IS NOT NULL AND [l6].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l6].[Level2_Required_Id] IS NOT NULL) AND ([l6].[OneToMany_Required_Inverse3Id] IS NOT NULL) ) AS [t3] ON [l5].[Id] = [t3].[Id] - WHERE [l5].[Level3_Required_Id] IS NOT NULL AND [l5].[OneToMany_Required_Inverse4Id] IS NOT NULL + WHERE ([l5].[Level3_Required_Id] IS NOT NULL) AND ([l5].[OneToMany_Required_Inverse4Id] IS NOT NULL) ) AS [t2] ON CASE - WHEN [t0].[Level2_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [t0].[Id] + WHEN ([t0].[Level2_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [t0].[Id] END = [t2].[OneToMany_Optional_Inverse4Id] ORDER BY [l].[Id], [t].[Id], [t].[Id0], [t0].[Id], [t0].[Id0], [t0].[Id00], [t2].[Id], [t2].[Id0], [t2].[Id00]"); } @@ -884,7 +884,7 @@ INNER JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[Level2_Name], [l0].[OneToMany_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id], [l1].[Id] AS [Id0] FROM [Level1] AS [l0] INNER JOIN [Level1] AS [l1] ON [l0].[Id] = [l1].[Id] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL)) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t] ON [l].[Id] = [t].[OneToMany_Optional_Inverse2Id] LEFT JOIN ( SELECT [l2].[Id], [l2].[Level2_Optional_Id], [l2].[Level2_Required_Id], [l2].[Level3_Name], [l2].[OneToMany_Optional_Inverse3Id], [l2].[OneToMany_Required_Inverse3Id], [l2].[OneToOne_Optional_PK_Inverse3Id], [t1].[Id] AS [Id0], [t1].[Id0] AS [Id00] @@ -893,11 +893,11 @@ INNER JOIN ( SELECT [l3].[Id], [l4].[Id] AS [Id0] FROM [Level1] AS [l3] INNER JOIN [Level1] AS [l4] ON [l3].[Id] = [l4].[Id] - WHERE ([l3].[OneToOne_Required_PK_Date] IS NOT NULL AND [l3].[Level1_Required_Id] IS NOT NULL) AND [l3].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l3].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l3].[Level1_Required_Id] IS NOT NULL)) AND ([l3].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t1] ON [l2].[Id] = [t1].[Id] - WHERE [l2].[Level2_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l2].[Level2_Required_Id] IS NOT NULL) AND ([l2].[OneToMany_Required_Inverse3Id] IS NOT NULL) ) AS [t0] ON CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + WHEN (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] END = [t0].[OneToMany_Required_Inverse3Id] LEFT JOIN ( SELECT [l5].[Id], [l5].[Level2_Optional_Id], [l5].[Level2_Required_Id], [l5].[Level3_Name], [l5].[OneToMany_Optional_Inverse3Id], [l5].[OneToMany_Required_Inverse3Id], [l5].[OneToOne_Optional_PK_Inverse3Id], [t3].[Id] AS [Id0], [t3].[Id0] AS [Id00] @@ -906,11 +906,11 @@ INNER JOIN ( SELECT [l6].[Id], [l7].[Id] AS [Id0] FROM [Level1] AS [l6] INNER JOIN [Level1] AS [l7] ON [l6].[Id] = [l7].[Id] - WHERE ([l6].[OneToOne_Required_PK_Date] IS NOT NULL AND [l6].[Level1_Required_Id] IS NOT NULL) AND [l6].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l6].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l6].[Level1_Required_Id] IS NOT NULL)) AND ([l6].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t3] ON [l5].[Id] = [t3].[Id] - WHERE [l5].[Level2_Required_Id] IS NOT NULL AND [l5].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l5].[Level2_Required_Id] IS NOT NULL) AND ([l5].[OneToMany_Required_Inverse3Id] IS NOT NULL) ) AS [t2] ON CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + WHEN (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] END = [t2].[OneToMany_Optional_Inverse3Id] ORDER BY [l].[Id], [t].[Id], [t].[Id0], [t0].[Id], [t0].[Id0], [t0].[Id00], [t2].[Id], [t2].[Id0]"); } @@ -926,7 +926,7 @@ INNER JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[Level2_Name], [l0].[OneToMany_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id], [l1].[Id] AS [Id0] FROM [Level1] AS [l0] INNER JOIN [Level1] AS [l1] ON [l0].[Id] = [l1].[Id] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL)) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t] ON [l].[Id] = [t].[OneToMany_Optional_Inverse2Id] LEFT JOIN ( SELECT [l2].[Id], [l2].[Level2_Optional_Id], [l2].[Level2_Required_Id], [l2].[Level3_Name], [l2].[OneToMany_Optional_Inverse3Id], [l2].[OneToMany_Required_Inverse3Id], [l2].[OneToOne_Optional_PK_Inverse3Id], [t1].[Id] AS [Id0], [t1].[Id0] AS [Id00] @@ -935,11 +935,11 @@ INNER JOIN ( SELECT [l3].[Id], [l4].[Id] AS [Id0] FROM [Level1] AS [l3] INNER JOIN [Level1] AS [l4] ON [l3].[Id] = [l4].[Id] - WHERE ([l3].[OneToOne_Required_PK_Date] IS NOT NULL AND [l3].[Level1_Required_Id] IS NOT NULL) AND [l3].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l3].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l3].[Level1_Required_Id] IS NOT NULL)) AND ([l3].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t1] ON [l2].[Id] = [t1].[Id] - WHERE [l2].[Level2_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l2].[Level2_Required_Id] IS NOT NULL) AND ([l2].[OneToMany_Required_Inverse3Id] IS NOT NULL) ) AS [t0] ON CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + WHEN (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] END = [t0].[Level2_Required_Id] LEFT JOIN ( SELECT [l5].[Id], [l5].[Level3_Optional_Id], [l5].[Level3_Required_Id], [l5].[Level4_Name], [l5].[OneToMany_Optional_Inverse4Id], [l5].[OneToMany_Required_Inverse4Id], [l5].[OneToOne_Optional_PK_Inverse4Id], [t3].[Id] AS [Id0], [t3].[Id0] AS [Id00], [t3].[Id00] AS [Id000] @@ -951,13 +951,13 @@ INNER JOIN ( SELECT [l7].[Id], [l8].[Id] AS [Id0] FROM [Level1] AS [l7] INNER JOIN [Level1] AS [l8] ON [l7].[Id] = [l8].[Id] - WHERE ([l7].[OneToOne_Required_PK_Date] IS NOT NULL AND [l7].[Level1_Required_Id] IS NOT NULL) AND [l7].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l7].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l7].[Level1_Required_Id] IS NOT NULL)) AND ([l7].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t4] ON [l6].[Id] = [t4].[Id] - WHERE [l6].[Level2_Required_Id] IS NOT NULL AND [l6].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l6].[Level2_Required_Id] IS NOT NULL) AND ([l6].[OneToMany_Required_Inverse3Id] IS NOT NULL) ) AS [t3] ON [l5].[Id] = [t3].[Id] - WHERE [l5].[Level3_Required_Id] IS NOT NULL AND [l5].[OneToMany_Required_Inverse4Id] IS NOT NULL + WHERE ([l5].[Level3_Required_Id] IS NOT NULL) AND ([l5].[OneToMany_Required_Inverse4Id] IS NOT NULL) ) AS [t2] ON CASE - WHEN [t0].[Level2_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [t0].[Id] + WHEN ([t0].[Level2_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [t0].[Id] END = [t2].[OneToMany_Optional_Inverse4Id] ORDER BY [l].[Id], [t].[Id], [t].[Id0], [t0].[Id], [t0].[Id0], [t0].[Id00], [t2].[Id], [t2].[Id0], [t2].[Id00]"); } @@ -973,13 +973,13 @@ LEFT JOIN ( SELECT [t].[Id], [t].[OneToOne_Required_PK_Date], [t].[Level1_Optional_Id], [t].[Level1_Required_Id], [t].[Level2_Name], [t].[OneToMany_Optional_Inverse2Id], [t].[OneToMany_Required_Inverse2Id], [t].[OneToOne_Optional_PK_Inverse2Id], [t].[Id0], [t].[c] FROM ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[Level2_Name], [l0].[OneToMany_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id], [l1].[Id] AS [Id0], ROW_NUMBER() OVER(PARTITION BY [l0].[OneToMany_Optional_Inverse2Id] ORDER BY CASE - WHEN ([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [l0].[Id] + WHEN (([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL)) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [l0].[Id] END) AS [row], CASE - WHEN ([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [l0].[Id] + WHEN (([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL)) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [l0].[Id] END AS [c] FROM [Level1] AS [l0] INNER JOIN [Level1] AS [l1] ON [l0].[Id] = [l1].[Id] - WHERE (([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) AND (([l0].[Level2_Name] <> N'Foo') OR [l0].[Level2_Name] IS NULL) + WHERE ((([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL)) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL)) AND (([l0].[Level2_Name] <> N'Foo') OR ([l0].[Level2_Name] IS NULL)) ) AS [t] WHERE [t].[row] <= 3 ) AS [t0] ON [l].[Id] = [t0].[OneToMany_Optional_Inverse2Id] @@ -1006,15 +1006,15 @@ INNER JOIN ( SELECT [l3].[Id], [l4].[Id] AS [Id0] FROM [Level1] AS [l3] INNER JOIN [Level1] AS [l4] ON [l3].[Id] = [l4].[Id] - WHERE ([l3].[OneToOne_Required_PK_Date] IS NOT NULL AND [l3].[Level1_Required_Id] IS NOT NULL) AND [l3].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l3].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l3].[Level1_Required_Id] IS NOT NULL)) AND ([l3].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t] ON [l2].[Id] = [t].[Id] INNER JOIN ( SELECT [l5].[Id], [l5].[OneToOne_Required_PK_Date], [l5].[Level1_Optional_Id], [l5].[Level1_Required_Id], [l5].[Level2_Name], [l5].[OneToMany_Optional_Inverse2Id], [l5].[OneToMany_Required_Inverse2Id], [l5].[OneToOne_Optional_PK_Inverse2Id], [l6].[Id] AS [Id0] FROM [Level1] AS [l5] INNER JOIN [Level1] AS [l6] ON [l5].[Id] = [l6].[Id] - WHERE ([l5].[OneToOne_Required_PK_Date] IS NOT NULL AND [l5].[Level1_Required_Id] IS NOT NULL) AND [l5].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l5].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l5].[Level1_Required_Id] IS NOT NULL)) AND ([l5].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t0] ON [l2].[OneToMany_Required_Inverse3Id] = CASE - WHEN ([t0].[OneToOne_Required_PK_Date] IS NOT NULL AND [t0].[Level1_Required_Id] IS NOT NULL) AND [t0].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t0].[Id] + WHEN (([t0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t0].[Level1_Required_Id] IS NOT NULL)) AND ([t0].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t0].[Id] END LEFT JOIN ( SELECT [l7].[Id], [l7].[Level2_Optional_Id], [l7].[Level2_Required_Id], [l7].[Level3_Name], [l7].[OneToMany_Optional_Inverse3Id], [l7].[OneToMany_Required_Inverse3Id], [l7].[OneToOne_Optional_PK_Inverse3Id], [t2].[Id] AS [Id0], [t2].[Id0] AS [Id00] @@ -1023,17 +1023,17 @@ INNER JOIN ( SELECT [l8].[Id], [l9].[Id] AS [Id0] FROM [Level1] AS [l8] INNER JOIN [Level1] AS [l9] ON [l8].[Id] = [l9].[Id] - WHERE ([l8].[OneToOne_Required_PK_Date] IS NOT NULL AND [l8].[Level1_Required_Id] IS NOT NULL) AND [l8].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l8].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l8].[Level1_Required_Id] IS NOT NULL)) AND ([l8].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t2] ON [l7].[Id] = [t2].[Id] - WHERE [l7].[Level2_Required_Id] IS NOT NULL AND [l7].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l7].[Level2_Required_Id] IS NOT NULL) AND ([l7].[OneToMany_Required_Inverse3Id] IS NOT NULL) ) AS [t1] ON CASE - WHEN ([t0].[OneToOne_Required_PK_Date] IS NOT NULL AND [t0].[Level1_Required_Id] IS NOT NULL) AND [t0].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t0].[Id] + WHEN (([t0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t0].[Level1_Required_Id] IS NOT NULL)) AND ([t0].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t0].[Id] END = [t1].[OneToMany_Optional_Inverse3Id] - WHERE [l2].[Level2_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l2].[Level2_Required_Id] IS NOT NULL) AND ([l2].[OneToMany_Required_Inverse3Id] IS NOT NULL) ) AS [t3] ON CASE - WHEN ([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [l0].[Id] + WHEN (([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL)) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [l0].[Id] END = [t3].[OneToMany_Optional_Inverse3Id] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL)) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t4] ON [l].[Id] = [t4].[OneToMany_Optional_Inverse2Id] ORDER BY [l].[Id], [t4].[Id], [t4].[Id0], [t4].[Id1], [t4].[Id10], [t4].[Id000], [t4].[Id00], [t4].[Id01], [t4].[Id2], [t4].[Id02]"); } @@ -1049,7 +1049,7 @@ INNER JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[Level2_Name], [l0].[OneToMany_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id], [l1].[Id] AS [Id0] FROM [Level1] AS [l0] INNER JOIN [Level1] AS [l1] ON [l0].[Id] = [l1].[Id] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL)) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t] ON [l].[Id] = [t].[OneToMany_Required_Inverse2Id] LEFT JOIN ( SELECT [l2].[Id], [l2].[Level2_Optional_Id], [l2].[Level2_Required_Id], [l2].[Level3_Name], [l2].[OneToMany_Optional_Inverse3Id], [l2].[OneToMany_Required_Inverse3Id], [l2].[OneToOne_Optional_PK_Inverse3Id], [t1].[Id] AS [Id0], [t1].[Id0] AS [Id00] @@ -1058,11 +1058,11 @@ INNER JOIN ( SELECT [l3].[Id], [l4].[Id] AS [Id0] FROM [Level1] AS [l3] INNER JOIN [Level1] AS [l4] ON [l3].[Id] = [l4].[Id] - WHERE ([l3].[OneToOne_Required_PK_Date] IS NOT NULL AND [l3].[Level1_Required_Id] IS NOT NULL) AND [l3].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l3].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l3].[Level1_Required_Id] IS NOT NULL)) AND ([l3].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t1] ON [l2].[Id] = [t1].[Id] - WHERE [l2].[Level2_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l2].[Level2_Required_Id] IS NOT NULL) AND ([l2].[OneToMany_Required_Inverse3Id] IS NOT NULL) ) AS [t0] ON CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + WHEN (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] END = [t0].[OneToMany_Optional_Inverse3Id] ORDER BY [l].[Id], [t].[Id], [t].[Id0], [t0].[Id], [t0].[Id0]"); } @@ -1078,13 +1078,13 @@ LEFT JOIN ( SELECT [t].[Id], [t].[OneToOne_Required_PK_Date], [t].[Level1_Optional_Id], [t].[Level1_Required_Id], [t].[Level2_Name], [t].[OneToMany_Optional_Inverse2Id], [t].[OneToMany_Required_Inverse2Id], [t].[OneToOne_Optional_PK_Inverse2Id], [t].[Id0], [t].[c] FROM ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[Level2_Name], [l0].[OneToMany_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id], [l1].[Id] AS [Id0], ROW_NUMBER() OVER(PARTITION BY [l0].[OneToMany_Optional_Inverse2Id] ORDER BY CASE - WHEN ([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [l0].[Id] + WHEN (([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL)) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [l0].[Id] END) AS [row], CASE - WHEN ([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [l0].[Id] + WHEN (([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL)) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [l0].[Id] END AS [c] FROM [Level1] AS [l0] INNER JOIN [Level1] AS [l1] ON [l0].[Id] = [l1].[Id] - WHERE (([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) AND (( + WHERE ((([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL)) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL)) AND (( SELECT COUNT(*) FROM [Level1] AS [l2] WHERE [l2].[Id] <> [l0].[Id]) > 1) @@ -1127,7 +1127,7 @@ INNER JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[Level2_Name], [l0].[OneToMany_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id] FROM [Level1] AS [l0] INNER JOIN [Level1] AS [l1] ON [l0].[Id] = [l1].[Id] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL)) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t] ON [l].[Id] = [t].[OneToMany_Optional_Inverse2Id] LEFT JOIN ( SELECT [l2].[Id], [l2].[Level2_Optional_Id], [l2].[Level2_Required_Id], [l2].[Level3_Name], [l2].[OneToMany_Optional_Inverse3Id], [l2].[OneToMany_Required_Inverse3Id], [l2].[OneToOne_Optional_PK_Inverse3Id] @@ -1136,11 +1136,11 @@ INNER JOIN ( SELECT [l3].[Id] FROM [Level1] AS [l3] INNER JOIN [Level1] AS [l4] ON [l3].[Id] = [l4].[Id] - WHERE ([l3].[OneToOne_Required_PK_Date] IS NOT NULL AND [l3].[Level1_Required_Id] IS NOT NULL) AND [l3].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l3].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l3].[Level1_Required_Id] IS NOT NULL)) AND ([l3].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t1] ON [l2].[Id] = [t1].[Id] - WHERE [l2].[Level2_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l2].[Level2_Required_Id] IS NOT NULL) AND ([l2].[OneToMany_Required_Inverse3Id] IS NOT NULL) ) AS [t0] ON CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + WHEN (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] END = [t0].[Level2_Required_Id]"); } @@ -1155,13 +1155,13 @@ OUTER APPLY ( SELECT [t].[Id], [t].[OneToOne_Required_PK_Date], [t].[Level1_Optional_Id], [t].[Level1_Required_Id], [t].[Level2_Name], [t].[OneToMany_Optional_Inverse2Id], [t].[OneToMany_Required_Inverse2Id], [t].[OneToOne_Optional_PK_Inverse2Id], [t0].[Id] AS [Id0], [t0].[Level2_Optional_Id], [t0].[Level2_Required_Id], [t0].[Level3_Name], [t0].[OneToMany_Optional_Inverse3Id], [t0].[OneToMany_Required_Inverse3Id], [t0].[OneToOne_Optional_PK_Inverse3Id], [t].[Id0] AS [Id00], [t0].[Id0] AS [Id01], [t0].[Id00] AS [Id000], [t2].[Id] AS [Id1], [t2].[Level3_Optional_Id], [t2].[Level3_Required_Id], [t2].[Level4_Name], [t2].[OneToMany_Optional_Inverse4Id], [t2].[OneToMany_Required_Inverse4Id], [t2].[OneToOne_Optional_PK_Inverse4Id], [t2].[Id0] AS [Id02], [t2].[Id00] AS [Id001], [t2].[Id000] AS [Id0000], [t].[c] FROM ( SELECT TOP(1) [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[Level2_Name], [l0].[OneToMany_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id], [l1].[Id] AS [Id0], CASE - WHEN ([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [l0].[Id] + WHEN (([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL)) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [l0].[Id] END AS [c] FROM [Level1] AS [l0] INNER JOIN [Level1] AS [l1] ON [l0].[Id] = [l1].[Id] - WHERE ((([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) AND ([l].[Id] = [l0].[OneToMany_Optional_Inverse2Id])) AND (([l0].[Level2_Name] <> N'Foo') OR [l0].[Level2_Name] IS NULL) + WHERE (((([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL)) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL)) AND ([l].[Id] = [l0].[OneToMany_Optional_Inverse2Id])) AND (([l0].[Level2_Name] <> N'Foo') OR ([l0].[Level2_Name] IS NULL)) ORDER BY CASE - WHEN ([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [l0].[Id] + WHEN (([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL)) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [l0].[Id] END ) AS [t] LEFT JOIN ( @@ -1171,11 +1171,11 @@ INNER JOIN ( SELECT [l3].[Id], [l4].[Id] AS [Id0] FROM [Level1] AS [l3] INNER JOIN [Level1] AS [l4] ON [l3].[Id] = [l4].[Id] - WHERE ([l3].[OneToOne_Required_PK_Date] IS NOT NULL AND [l3].[Level1_Required_Id] IS NOT NULL) AND [l3].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l3].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l3].[Level1_Required_Id] IS NOT NULL)) AND ([l3].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t1] ON [l2].[Id] = [t1].[Id] - WHERE [l2].[Level2_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l2].[Level2_Required_Id] IS NOT NULL) AND ([l2].[OneToMany_Required_Inverse3Id] IS NOT NULL) ) AS [t0] ON CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + WHEN (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] END = [t0].[OneToOne_Optional_PK_Inverse3Id] LEFT JOIN ( SELECT [l5].[Id], [l5].[Level3_Optional_Id], [l5].[Level3_Required_Id], [l5].[Level4_Name], [l5].[OneToMany_Optional_Inverse4Id], [l5].[OneToMany_Required_Inverse4Id], [l5].[OneToOne_Optional_PK_Inverse4Id], [t3].[Id] AS [Id0], [t3].[Id0] AS [Id00], [t3].[Id00] AS [Id000] @@ -1187,13 +1187,13 @@ INNER JOIN ( SELECT [l7].[Id], [l8].[Id] AS [Id0] FROM [Level1] AS [l7] INNER JOIN [Level1] AS [l8] ON [l7].[Id] = [l8].[Id] - WHERE ([l7].[OneToOne_Required_PK_Date] IS NOT NULL AND [l7].[Level1_Required_Id] IS NOT NULL) AND [l7].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l7].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l7].[Level1_Required_Id] IS NOT NULL)) AND ([l7].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t4] ON [l6].[Id] = [t4].[Id] - WHERE [l6].[Level2_Required_Id] IS NOT NULL AND [l6].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l6].[Level2_Required_Id] IS NOT NULL) AND ([l6].[OneToMany_Required_Inverse3Id] IS NOT NULL) ) AS [t3] ON [l5].[Id] = [t3].[Id] - WHERE ([l5].[Level3_Required_Id] IS NOT NULL AND [l5].[OneToMany_Required_Inverse4Id] IS NOT NULL) AND ([l5].[Id] > 1) + WHERE (([l5].[Level3_Required_Id] IS NOT NULL) AND ([l5].[OneToMany_Required_Inverse4Id] IS NOT NULL)) AND ([l5].[Id] > 1) ) AS [t2] ON CASE - WHEN [t0].[Level2_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [t0].[Id] + WHEN ([t0].[Level2_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [t0].[Id] END = [t2].[OneToMany_Optional_Inverse4Id] ) AS [t5] ORDER BY [l].[Id], [t5].[c], [t5].[Id], [t5].[Id00], [t5].[Id0], [t5].[Id01], [t5].[Id000], [t5].[Id1], [t5].[Id02], [t5].[Id001]"); @@ -1222,7 +1222,7 @@ LEFT JOIN ( SELECT [l1].[Id], [l1].[OneToOne_Required_PK_Date], [l1].[Level1_Optional_Id], [l1].[Level1_Required_Id], [l1].[Level2_Name], [l1].[OneToMany_Optional_Inverse2Id], [l1].[OneToMany_Required_Inverse2Id], [l1].[OneToOne_Optional_PK_Inverse2Id], [l2].[Id] AS [Id0] FROM [Level1] AS [l1] INNER JOIN [Level1] AS [l2] ON [l1].[Id] = [l2].[Id] - WHERE ([l1].[OneToOne_Required_PK_Date] IS NOT NULL AND [l1].[Level1_Required_Id] IS NOT NULL) AND [l1].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l1].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l1].[Level1_Required_Id] IS NOT NULL)) AND ([l1].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t2] ON [t0].[Id] = [t2].[OneToMany_Optional_Inverse2Id] ORDER BY [t].[Name], [t0].[Id], [t2].[Id]"); } @@ -1254,13 +1254,13 @@ public override async Task Project_collection_navigation_nested_with_take(bool a await base.Project_collection_navigation_nested_with_take(async); AssertSql( -@"SELECT [l].[Id], [t].[Id], [t].[Id0], [t1].[Id], [t1].[Level2_Optional_Id], [t1].[Level2_Required_Id], [t1].[Level3_Name], [t1].[OneToMany_Optional_Inverse3Id], [t1].[OneToMany_Required_Inverse3Id], [t1].[OneToOne_Optional_PK_Inverse3Id], [t1].[Id0], [t1].[Id00] + @"SELECT [l].[Id], [t].[Id], [t].[Id0], [t1].[Id], [t1].[Level2_Optional_Id], [t1].[Level2_Required_Id], [t1].[Level3_Name], [t1].[OneToMany_Optional_Inverse3Id], [t1].[OneToMany_Required_Inverse3Id], [t1].[OneToOne_Optional_PK_Inverse3Id], [t1].[Id0], [t1].[Id00] FROM [Level1] AS [l] LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[OneToMany_Required_Inverse2Id], [l1].[Id] AS [Id0] FROM [Level1] AS [l0] INNER JOIN [Level1] AS [l1] ON [l0].[Id] = [l1].[Id] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL)) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t] ON [l].[Id] = [t].[Level1_Optional_Id] LEFT JOIN ( SELECT [t0].[Id], [t0].[Level2_Optional_Id], [t0].[Level2_Required_Id], [t0].[Level3_Name], [t0].[OneToMany_Optional_Inverse3Id], [t0].[OneToMany_Required_Inverse3Id], [t0].[OneToOne_Optional_PK_Inverse3Id], [t0].[Id0], [t0].[Id00] @@ -1271,13 +1271,13 @@ INNER JOIN ( SELECT [l3].[Id], [l4].[Id] AS [Id0] FROM [Level1] AS [l3] INNER JOIN [Level1] AS [l4] ON [l3].[Id] = [l4].[Id] - WHERE ([l3].[OneToOne_Required_PK_Date] IS NOT NULL AND [l3].[Level1_Required_Id] IS NOT NULL) AND [l3].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l3].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l3].[Level1_Required_Id] IS NOT NULL)) AND ([l3].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t2] ON [l2].[Id] = [t2].[Id] - WHERE [l2].[Level2_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l2].[Level2_Required_Id] IS NOT NULL) AND ([l2].[OneToMany_Required_Inverse3Id] IS NOT NULL) ) AS [t0] WHERE [t0].[row] <= 50 ) AS [t1] ON CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + WHEN (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] END = [t1].[OneToMany_Optional_Inverse3Id] ORDER BY [l].[Id], [t].[Id], [t].[Id0], [t1].[Id], [t1].[Id0]"); } @@ -1288,14 +1288,14 @@ public override async Task Multiple_SelectMany_navigation_property_followed_by_s AssertSql( @"SELECT CASE - WHEN [t0].[Level2_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [t0].[Id] + WHEN ([t0].[Level2_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [t0].[Id] END, [l].[Id], [t].[Id], [t].[Id0], [t0].[Id], [t0].[Id0], [t0].[Id00], [t2].[Id], [t2].[Level3_Optional_Id], [t2].[Level3_Required_Id], [t2].[Level4_Name], [t2].[OneToMany_Optional_Inverse4Id], [t2].[OneToMany_Required_Inverse4Id], [t2].[OneToOne_Optional_PK_Inverse4Id], [t2].[Id0], [t2].[Id00], [t2].[Id000] FROM [Level1] AS [l] INNER JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Required_Id], [l0].[OneToMany_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l1].[Id] AS [Id0] FROM [Level1] AS [l0] INNER JOIN [Level1] AS [l1] ON [l0].[Id] = [l1].[Id] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL)) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t] ON [l].[Id] = [t].[OneToMany_Optional_Inverse2Id] INNER JOIN ( SELECT [l2].[Id], [l2].[Level2_Required_Id], [l2].[OneToMany_Optional_Inverse3Id], [l2].[OneToMany_Required_Inverse3Id], [t1].[Id] AS [Id0], [t1].[Id0] AS [Id00] @@ -1304,11 +1304,11 @@ INNER JOIN ( SELECT [l3].[Id], [l4].[Id] AS [Id0] FROM [Level1] AS [l3] INNER JOIN [Level1] AS [l4] ON [l3].[Id] = [l4].[Id] - WHERE ([l3].[OneToOne_Required_PK_Date] IS NOT NULL AND [l3].[Level1_Required_Id] IS NOT NULL) AND [l3].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l3].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l3].[Level1_Required_Id] IS NOT NULL)) AND ([l3].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t1] ON [l2].[Id] = [t1].[Id] - WHERE [l2].[Level2_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l2].[Level2_Required_Id] IS NOT NULL) AND ([l2].[OneToMany_Required_Inverse3Id] IS NOT NULL) ) AS [t0] ON CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + WHEN (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] END = [t0].[OneToMany_Optional_Inverse3Id] LEFT JOIN ( SELECT [l5].[Id], [l5].[Level3_Optional_Id], [l5].[Level3_Required_Id], [l5].[Level4_Name], [l5].[OneToMany_Optional_Inverse4Id], [l5].[OneToMany_Required_Inverse4Id], [l5].[OneToOne_Optional_PK_Inverse4Id], [t3].[Id] AS [Id0], [t3].[Id0] AS [Id00], [t3].[Id00] AS [Id000] @@ -1320,13 +1320,13 @@ INNER JOIN ( SELECT [l7].[Id], [l8].[Id] AS [Id0] FROM [Level1] AS [l7] INNER JOIN [Level1] AS [l8] ON [l7].[Id] = [l8].[Id] - WHERE ([l7].[OneToOne_Required_PK_Date] IS NOT NULL AND [l7].[Level1_Required_Id] IS NOT NULL) AND [l7].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l7].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l7].[Level1_Required_Id] IS NOT NULL)) AND ([l7].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t4] ON [l6].[Id] = [t4].[Id] - WHERE [l6].[Level2_Required_Id] IS NOT NULL AND [l6].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l6].[Level2_Required_Id] IS NOT NULL) AND ([l6].[OneToMany_Required_Inverse3Id] IS NOT NULL) ) AS [t3] ON [l5].[Id] = [t3].[Id] - WHERE [l5].[Level3_Required_Id] IS NOT NULL AND [l5].[OneToMany_Required_Inverse4Id] IS NOT NULL + WHERE ([l5].[Level3_Required_Id] IS NOT NULL) AND ([l5].[OneToMany_Required_Inverse4Id] IS NOT NULL) ) AS [t2] ON CASE - WHEN [t0].[Level2_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [t0].[Id] + WHEN ([t0].[Level2_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [t0].[Id] END = [t2].[OneToMany_Optional_Inverse4Id] ORDER BY [l].[Id], [t].[Id], [t].[Id0], [t0].[Id], [t0].[Id0], [t0].[Id00], [t2].[Id], [t2].[Id0], [t2].[Id00]"); } @@ -1355,7 +1355,7 @@ LEFT JOIN ( SELECT [l1].[Id], [l1].[OneToOne_Required_PK_Date], [l1].[Level1_Optional_Id], [l1].[Level1_Required_Id], [l1].[Level2_Name], [l1].[OneToMany_Optional_Inverse2Id], [l1].[OneToMany_Required_Inverse2Id], [l1].[OneToOne_Optional_PK_Inverse2Id], [l2].[Id] AS [Id0] FROM [Level1] AS [l1] INNER JOIN [Level1] AS [l2] ON [l1].[Id] = [l2].[Id] - WHERE ([l1].[OneToOne_Required_PK_Date] IS NOT NULL AND [l1].[Level1_Required_Id] IS NOT NULL) AND [l1].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l1].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l1].[Level1_Required_Id] IS NOT NULL)) AND ([l1].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t2] ON [t0].[Id] = [t2].[Level1_Optional_Id] ) AS [t1] ORDER BY [t].[Date], [t1].[Name], [t1].[Id], [t1].[Id0]"); @@ -1376,21 +1376,21 @@ LEFT JOIN ( SELECT [l1].[Id], [l1].[OneToOne_Required_PK_Date], [l1].[Level1_Optional_Id], [l1].[Level1_Required_Id], [l1].[Level2_Name], [l1].[OneToMany_Optional_Inverse2Id], [l1].[OneToMany_Required_Inverse2Id], [l1].[OneToOne_Optional_PK_Inverse2Id], [l2].[Id] AS [Id0] FROM [Level1] AS [l1] INNER JOIN [Level1] AS [l2] ON [l1].[Id] = [l2].[Id] - WHERE ([l1].[OneToOne_Required_PK_Date] IS NOT NULL AND [l1].[Level1_Required_Id] IS NOT NULL) AND [l1].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l1].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l1].[Level1_Required_Id] IS NOT NULL)) AND ([l1].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t] ON [l0].[Id] = CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + WHEN (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] END - WHERE (([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL) AND (([t].[Level1_Required_Id] = ([l].[Id] * 2)) OR ((CAST(LEN([t].[Level2_Name]) AS int) = CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] - END) OR ([t].[Level2_Name] IS NULL AND CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] - END IS NULL))) + WHERE ((([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL)) AND (([t].[Level1_Required_Id] = ([l].[Id] * 2)) OR ((CAST(LEN([t].[Level2_Name]) AS int) = CASE + WHEN (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] + END) OR (([t].[Level2_Name] IS NULL) AND (CASE + WHEN (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] + END IS NULL)))) ) AS [t0] LEFT JOIN ( SELECT [l3].[Id], [l3].[OneToOne_Required_PK_Date], [l3].[Level1_Optional_Id], [l3].[Level1_Required_Id], [l3].[Level2_Name], [l3].[OneToMany_Optional_Inverse2Id], [l3].[OneToMany_Required_Inverse2Id], [l3].[OneToOne_Optional_PK_Inverse2Id], [l4].[Id] AS [Id0] FROM [Level1] AS [l3] INNER JOIN [Level1] AS [l4] ON [l3].[Id] = [l4].[Id] - WHERE ([l3].[OneToOne_Required_PK_Date] IS NOT NULL AND [l3].[Level1_Required_Id] IS NOT NULL) AND [l3].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l3].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l3].[Level1_Required_Id] IS NOT NULL)) AND ([l3].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t1] ON [l].[Id] = [t1].[OneToMany_Optional_Inverse2Id] ORDER BY [l].[Id], [t0].[Id0], [t0].[Id], [t0].[Id00], [t1].[Id]"); } @@ -1413,7 +1413,7 @@ OUTER APPLY ( SELECT TOP(40) [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[Level2_Name], [l0].[OneToMany_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id], [l1].[Id] AS [Id0] FROM [Level1] AS [l0] INNER JOIN [Level1] AS [l1] ON [l0].[Id] = [l1].[Id] - WHERE (([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) AND ([t].[Id] = [l0].[OneToMany_Optional_Inverse2Id]) + WHERE ((([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL)) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL)) AND ([t].[Id] = [l0].[OneToMany_Optional_Inverse2Id]) ) AS [t0] LEFT JOIN ( SELECT [l2].[Id], [l2].[Level2_Optional_Id], [l2].[Level2_Required_Id], [l2].[Level3_Name], [l2].[OneToMany_Optional_Inverse3Id], [l2].[OneToMany_Required_Inverse3Id], [l2].[OneToOne_Optional_PK_Inverse3Id], [t3].[Id] AS [Id0], [t3].[Id0] AS [Id00] @@ -1422,11 +1422,11 @@ INNER JOIN ( SELECT [l3].[Id], [l4].[Id] AS [Id0] FROM [Level1] AS [l3] INNER JOIN [Level1] AS [l4] ON [l3].[Id] = [l4].[Id] - WHERE ([l3].[OneToOne_Required_PK_Date] IS NOT NULL AND [l3].[Level1_Required_Id] IS NOT NULL) AND [l3].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l3].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l3].[Level1_Required_Id] IS NOT NULL)) AND ([l3].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t3] ON [l2].[Id] = [t3].[Id] - WHERE [l2].[Level2_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l2].[Level2_Required_Id] IS NOT NULL) AND ([l2].[OneToMany_Required_Inverse3Id] IS NOT NULL) ) AS [t1] ON CASE - WHEN ([t0].[OneToOne_Required_PK_Date] IS NOT NULL AND [t0].[Level1_Required_Id] IS NOT NULL) AND [t0].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t0].[Id] + WHEN (([t0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t0].[Level1_Required_Id] IS NOT NULL)) AND ([t0].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t0].[Id] END = [t1].[Level2_Optional_Id] ) AS [t2] ORDER BY [t].[Id], [t2].[Id], [t2].[Id00], [t2].[Id0], [t2].[Id01]"); @@ -1451,7 +1451,7 @@ LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[Level2_Name], [l0].[OneToMany_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id], [l1].[Id] AS [Id0] FROM [Level1] AS [l0] INNER JOIN [Level1] AS [l1] ON [l0].[Id] = [l1].[Id] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL)) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t0] ON [t].[Id] = [t0].[Level1_Optional_Id] LEFT JOIN ( SELECT [l2].[Id], [l2].[Level2_Optional_Id], [l2].[Level2_Required_Id], [l2].[Level3_Name], [l2].[OneToMany_Optional_Inverse3Id], [l2].[OneToMany_Required_Inverse3Id], [l2].[OneToOne_Optional_PK_Inverse3Id], [t2].[Id] AS [Id0], [t2].[Id0] AS [Id00] @@ -1460,11 +1460,11 @@ INNER JOIN ( SELECT [l3].[Id], [l4].[Id] AS [Id0] FROM [Level1] AS [l3] INNER JOIN [Level1] AS [l4] ON [l3].[Id] = [l4].[Id] - WHERE ([l3].[OneToOne_Required_PK_Date] IS NOT NULL AND [l3].[Level1_Required_Id] IS NOT NULL) AND [l3].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l3].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l3].[Level1_Required_Id] IS NOT NULL)) AND ([l3].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t2] ON [l2].[Id] = [t2].[Id] - WHERE [l2].[Level2_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l2].[Level2_Required_Id] IS NOT NULL) AND ([l2].[OneToMany_Required_Inverse3Id] IS NOT NULL) ) AS [t1] ON CASE - WHEN ([t0].[OneToOne_Required_PK_Date] IS NOT NULL AND [t0].[Level1_Required_Id] IS NOT NULL) AND [t0].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t0].[Id] + WHEN (([t0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t0].[Level1_Required_Id] IS NOT NULL)) AND ([t0].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t0].[Id] END = [t1].[Level2_Required_Id] LEFT JOIN ( SELECT [l5].[Id], [l5].[Level3_Optional_Id], [l5].[Level3_Required_Id], [l5].[Level4_Name], [l5].[OneToMany_Optional_Inverse4Id], [l5].[OneToMany_Required_Inverse4Id], [l5].[OneToOne_Optional_PK_Inverse4Id], [t4].[Id] AS [Id0], [t4].[Id0] AS [Id00], [t4].[Id00] AS [Id000] @@ -1476,13 +1476,13 @@ INNER JOIN ( SELECT [l7].[Id], [l8].[Id] AS [Id0] FROM [Level1] AS [l7] INNER JOIN [Level1] AS [l8] ON [l7].[Id] = [l8].[Id] - WHERE ([l7].[OneToOne_Required_PK_Date] IS NOT NULL AND [l7].[Level1_Required_Id] IS NOT NULL) AND [l7].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l7].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l7].[Level1_Required_Id] IS NOT NULL)) AND ([l7].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t5] ON [l6].[Id] = [t5].[Id] - WHERE [l6].[Level2_Required_Id] IS NOT NULL AND [l6].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l6].[Level2_Required_Id] IS NOT NULL) AND ([l6].[OneToMany_Required_Inverse3Id] IS NOT NULL) ) AS [t4] ON [l5].[Id] = [t4].[Id] - WHERE [l5].[Level3_Required_Id] IS NOT NULL AND [l5].[OneToMany_Required_Inverse4Id] IS NOT NULL + WHERE ([l5].[Level3_Required_Id] IS NOT NULL) AND ([l5].[OneToMany_Required_Inverse4Id] IS NOT NULL) ) AS [t3] ON CASE - WHEN [t1].[Level2_Required_Id] IS NOT NULL AND [t1].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [t1].[Id] + WHEN ([t1].[Level2_Required_Id] IS NOT NULL) AND ([t1].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [t1].[Id] END = [t3].[OneToMany_Optional_Inverse4Id] ORDER BY [t].[Name], [t].[Id], [t0].[Id], [t0].[Id0], [t1].[Id], [t1].[Id0], [t1].[Id00], [t3].[Id], [t3].[Id0], [t3].[Id00]"); } @@ -1493,14 +1493,14 @@ public override async Task SelectMany_navigation_property_followed_by_select_col AssertSql( @"SELECT CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + WHEN (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] END, [l].[Id], [t].[Id], [t].[Id0], [t0].[Id], [t0].[Level2_Optional_Id], [t0].[Level2_Required_Id], [t0].[Level3_Name], [t0].[OneToMany_Optional_Inverse3Id], [t0].[OneToMany_Required_Inverse3Id], [t0].[OneToOne_Optional_PK_Inverse3Id], [t0].[Id0], [t0].[Id00] FROM [Level1] AS [l] INNER JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Required_Id], [l0].[OneToMany_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l1].[Id] AS [Id0] FROM [Level1] AS [l0] INNER JOIN [Level1] AS [l1] ON [l0].[Id] = [l1].[Id] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL)) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t] ON [l].[Id] = [t].[OneToMany_Optional_Inverse2Id] LEFT JOIN ( SELECT [l2].[Id], [l2].[Level2_Optional_Id], [l2].[Level2_Required_Id], [l2].[Level3_Name], [l2].[OneToMany_Optional_Inverse3Id], [l2].[OneToMany_Required_Inverse3Id], [l2].[OneToOne_Optional_PK_Inverse3Id], [t1].[Id] AS [Id0], [t1].[Id0] AS [Id00] @@ -1509,11 +1509,11 @@ INNER JOIN ( SELECT [l3].[Id], [l4].[Id] AS [Id0] FROM [Level1] AS [l3] INNER JOIN [Level1] AS [l4] ON [l3].[Id] = [l4].[Id] - WHERE ([l3].[OneToOne_Required_PK_Date] IS NOT NULL AND [l3].[Level1_Required_Id] IS NOT NULL) AND [l3].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l3].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l3].[Level1_Required_Id] IS NOT NULL)) AND ([l3].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t1] ON [l2].[Id] = [t1].[Id] - WHERE [l2].[Level2_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l2].[Level2_Required_Id] IS NOT NULL) AND ([l2].[OneToMany_Required_Inverse3Id] IS NOT NULL) ) AS [t0] ON CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + WHEN (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] END = [t0].[OneToMany_Optional_Inverse3Id] ORDER BY [l].[Id], [t].[Id], [t].[Id0], [t0].[Id], [t0].[Id0]"); } @@ -1543,7 +1543,7 @@ LEFT JOIN ( SELECT [l1].[Id], [l1].[OneToOne_Required_PK_Date], [l1].[Level1_Optional_Id], [l1].[Level1_Required_Id], [l1].[Level2_Name], [l1].[OneToMany_Optional_Inverse2Id], [l1].[OneToMany_Required_Inverse2Id], [l1].[OneToOne_Optional_PK_Inverse2Id], [l2].[Id] AS [Id0] FROM [Level1] AS [l1] INNER JOIN [Level1] AS [l2] ON [l1].[Id] = [l2].[Id] - WHERE ([l1].[OneToOne_Required_PK_Date] IS NOT NULL AND [l1].[Level1_Required_Id] IS NOT NULL) AND [l1].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l1].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l1].[Level1_Required_Id] IS NOT NULL)) AND ([l1].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t2] ON [t0].[Id] = [t2].[OneToMany_Optional_Inverse2Id] ORDER BY [t].[Name], [t0].[Id], [t2].[Id]"); } @@ -1559,7 +1559,7 @@ LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[Level2_Name], [l0].[OneToMany_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id], [l1].[Id] AS [Id0] FROM [Level1] AS [l0] INNER JOIN [Level1] AS [l1] ON [l0].[Id] = [l1].[Id] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL)) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t] ON [l].[Id] = [t].[Level1_Optional_Id] LEFT JOIN ( SELECT [t0].[Id], [t0].[Level2_Optional_Id], [t0].[Level2_Required_Id], [t0].[Level3_Name], [t0].[OneToMany_Optional_Inverse3Id], [t0].[OneToMany_Required_Inverse3Id], [t0].[OneToOne_Optional_PK_Inverse3Id], [t0].[Id0], [t0].[Id00] @@ -1570,13 +1570,13 @@ INNER JOIN ( SELECT [l3].[Id], [l4].[Id] AS [Id0] FROM [Level1] AS [l3] INNER JOIN [Level1] AS [l4] ON [l3].[Id] = [l4].[Id] - WHERE ([l3].[OneToOne_Required_PK_Date] IS NOT NULL AND [l3].[Level1_Required_Id] IS NOT NULL) AND [l3].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l3].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l3].[Level1_Required_Id] IS NOT NULL)) AND ([l3].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t2] ON [l2].[Id] = [t2].[Id] - WHERE ([l2].[Level2_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse3Id] IS NOT NULL) AND (([l2].[Level3_Name] <> N'Foo') OR [l2].[Level3_Name] IS NULL) + WHERE (([l2].[Level2_Required_Id] IS NOT NULL) AND ([l2].[OneToMany_Required_Inverse3Id] IS NOT NULL)) AND (([l2].[Level3_Name] <> N'Foo') OR ([l2].[Level3_Name] IS NULL)) ) AS [t0] WHERE (1 < [t0].[row]) AND ([t0].[row] <= 4) ) AS [t1] ON CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + WHEN (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] END = [t1].[OneToMany_Optional_Inverse3Id] ORDER BY [l].[Id], [t].[Id], [t].[Id0], [t1].[OneToMany_Optional_Inverse3Id], [t1].[Level3_Name], [t1].[Id], [t1].[Id0]"); } @@ -1592,7 +1592,7 @@ LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[OneToMany_Required_Inverse2Id], [l1].[Id] AS [Id0] FROM [Level1] AS [l0] INNER JOIN [Level1] AS [l1] ON [l0].[Id] = [l1].[Id] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL)) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t] ON [l].[Id] = [t].[Level1_Optional_Id] LEFT JOIN ( SELECT [l2].[Id], [l2].[Level2_Optional_Id], [l2].[Level2_Required_Id], [l2].[Level3_Name], [l2].[OneToMany_Optional_Inverse3Id], [l2].[OneToMany_Required_Inverse3Id], [l2].[OneToOne_Optional_PK_Inverse3Id], [t1].[Id] AS [Id0], [t1].[Id0] AS [Id00] @@ -1601,11 +1601,11 @@ INNER JOIN ( SELECT [l3].[Id], [l4].[Id] AS [Id0] FROM [Level1] AS [l3] INNER JOIN [Level1] AS [l4] ON [l3].[Id] = [l4].[Id] - WHERE ([l3].[OneToOne_Required_PK_Date] IS NOT NULL AND [l3].[Level1_Required_Id] IS NOT NULL) AND [l3].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l3].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l3].[Level1_Required_Id] IS NOT NULL)) AND ([l3].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t1] ON [l2].[Id] = [t1].[Id] - WHERE [l2].[Level2_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l2].[Level2_Required_Id] IS NOT NULL) AND ([l2].[OneToMany_Required_Inverse3Id] IS NOT NULL) ) AS [t0] ON CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + WHEN (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] END = [t0].[OneToMany_Optional_Inverse3Id] ORDER BY [l].[Id], [t].[Id], [t].[Id0], [t0].[Id], [t0].[Id0]"); } @@ -1626,21 +1626,21 @@ LEFT JOIN ( SELECT [t1].[Id], [t1].[c], [t1].[Id0], [t1].[Id1], [t1].[OneToMany_Required_Inverse2Id] FROM ( SELECT CASE - WHEN ([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [l0].[Id] + WHEN (([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL)) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [l0].[Id] END AS [Id], 1 AS [c], [l0].[Id] AS [Id0], [l1].[Id] AS [Id1], [l0].[OneToMany_Required_Inverse2Id], ROW_NUMBER() OVER(PARTITION BY [l0].[OneToMany_Required_Inverse2Id] ORDER BY [l0].[Id], [l1].[Id]) AS [row] FROM [Level1] AS [l0] INNER JOIN [Level1] AS [l1] ON [l0].[Id] = [l1].[Id] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL)) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t1] WHERE [t1].[row] <= 1 ) AS [t0] ON [t].[Id] = [t0].[OneToMany_Required_Inverse2Id] LEFT JOIN ( SELECT CASE - WHEN ([l2].[OneToOne_Required_PK_Date] IS NOT NULL AND [l2].[Level1_Required_Id] IS NOT NULL) AND [l2].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [l2].[Id] + WHEN (([l2].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l2].[Level1_Required_Id] IS NOT NULL)) AND ([l2].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [l2].[Id] END AS [Id], [l2].[Id] AS [Id0], [l3].[Id] AS [Id1], [l2].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l2] INNER JOIN [Level1] AS [l3] ON [l2].[Id] = [l3].[Id] - WHERE ([l2].[OneToOne_Required_PK_Date] IS NOT NULL AND [l2].[Level1_Required_Id] IS NOT NULL) AND [l2].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l2].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l2].[Level1_Required_Id] IS NOT NULL)) AND ([l2].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t2] ON [t].[Id] = [t2].[OneToMany_Required_Inverse2Id] ORDER BY [t].[Id], [t0].[Id0], [t0].[Id1], [t2].[Id0]"); } @@ -1663,13 +1663,13 @@ INNER JOIN ( SELECT [l3].[Id], [l4].[Id] AS [Id0] FROM [Level1] AS [l3] INNER JOIN [Level1] AS [l4] ON [l3].[Id] = [l4].[Id] - WHERE ([l3].[OneToOne_Required_PK_Date] IS NOT NULL AND [l3].[Level1_Required_Id] IS NOT NULL) AND [l3].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l3].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l3].[Level1_Required_Id] IS NOT NULL)) AND ([l3].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t] ON [l2].[Id] = [t].[Id] - WHERE [l2].[Level2_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l2].[Level2_Required_Id] IS NOT NULL) AND ([l2].[OneToMany_Required_Inverse3Id] IS NOT NULL) ) AS [t0] ON CASE - WHEN ([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [l0].[Id] + WHEN (([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL)) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [l0].[Id] END = [t0].[OneToOne_Optional_PK_Inverse3Id] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL)) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t1] ON [l].[Id] = [t1].[OneToMany_Optional_Inverse2Id] LEFT JOIN ( SELECT [l5].[Id], [l5].[OneToOne_Required_PK_Date], [l5].[Level1_Optional_Id], [l5].[Level1_Required_Id], [l5].[Level2_Name], [l5].[OneToMany_Optional_Inverse2Id], [l5].[OneToMany_Required_Inverse2Id], [l5].[OneToOne_Optional_PK_Inverse2Id], [t3].[Id] AS [Id0], [t3].[Level2_Optional_Id], [t3].[Level2_Required_Id], [t3].[Level3_Name], [t3].[OneToMany_Optional_Inverse3Id], [t3].[OneToMany_Required_Inverse3Id], [t3].[OneToOne_Optional_PK_Inverse3Id], [l6].[Id] AS [Id1], [t3].[Id0] AS [Id00], [t3].[Id00] AS [Id000] @@ -1682,13 +1682,13 @@ INNER JOIN ( SELECT [l8].[Id], [l9].[Id] AS [Id0] FROM [Level1] AS [l8] INNER JOIN [Level1] AS [l9] ON [l8].[Id] = [l9].[Id] - WHERE ([l8].[OneToOne_Required_PK_Date] IS NOT NULL AND [l8].[Level1_Required_Id] IS NOT NULL) AND [l8].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l8].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l8].[Level1_Required_Id] IS NOT NULL)) AND ([l8].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t4] ON [l7].[Id] = [t4].[Id] - WHERE [l7].[Level2_Required_Id] IS NOT NULL AND [l7].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l7].[Level2_Required_Id] IS NOT NULL) AND ([l7].[OneToMany_Required_Inverse3Id] IS NOT NULL) ) AS [t3] ON CASE - WHEN ([l5].[OneToOne_Required_PK_Date] IS NOT NULL AND [l5].[Level1_Required_Id] IS NOT NULL) AND [l5].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [l5].[Id] + WHEN (([l5].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l5].[Level1_Required_Id] IS NOT NULL)) AND ([l5].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [l5].[Id] END = [t3].[OneToOne_Optional_PK_Inverse3Id] - WHERE ([l5].[OneToOne_Required_PK_Date] IS NOT NULL AND [l5].[Level1_Required_Id] IS NOT NULL) AND [l5].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l5].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l5].[Level1_Required_Id] IS NOT NULL)) AND ([l5].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t2] ON [l].[Id] = [t2].[OneToMany_Optional_Inverse2Id] ORDER BY [l].[Id], [t1].[Id], [t1].[Id1], [t1].[Id0], [t1].[Id00], [t1].[Id000], [t2].[Id], [t2].[Id1], [t2].[Id0], [t2].[Id00]"); } @@ -1704,7 +1704,7 @@ LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[OneToMany_Required_Inverse2Id], [l1].[Id] AS [Id0] FROM [Level1] AS [l0] INNER JOIN [Level1] AS [l1] ON [l0].[Id] = [l1].[Id] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL)) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t] ON [l].[Id] = [t].[Level1_Optional_Id] LEFT JOIN ( SELECT [l2].[Id], [l2].[Level2_Optional_Id], [l2].[Level2_Required_Id], [l2].[Level3_Name], [l2].[OneToMany_Optional_Inverse3Id], [l2].[OneToMany_Required_Inverse3Id], [l2].[OneToOne_Optional_PK_Inverse3Id], [t1].[Id] AS [Id0], [t1].[Id0] AS [Id00] @@ -1713,11 +1713,11 @@ INNER JOIN ( SELECT [l3].[Id], [l4].[Id] AS [Id0] FROM [Level1] AS [l3] INNER JOIN [Level1] AS [l4] ON [l3].[Id] = [l4].[Id] - WHERE ([l3].[OneToOne_Required_PK_Date] IS NOT NULL AND [l3].[Level1_Required_Id] IS NOT NULL) AND [l3].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l3].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l3].[Level1_Required_Id] IS NOT NULL)) AND ([l3].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t1] ON [l2].[Id] = [t1].[Id] - WHERE [l2].[Level2_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l2].[Level2_Required_Id] IS NOT NULL) AND ([l2].[OneToMany_Required_Inverse3Id] IS NOT NULL) ) AS [t0] ON CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + WHEN (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] END = [t0].[OneToMany_Optional_Inverse3Id] ORDER BY [l].[Id], [t].[Id], [t].[Id0], [t0].[Id], [t0].[Id0]"); } @@ -1735,7 +1735,7 @@ LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[Level2_Name], [l0].[OneToMany_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id], [l1].[Id] AS [Id0], ROW_NUMBER() OVER(PARTITION BY [l0].[OneToMany_Optional_Inverse2Id] ORDER BY [l0].[Level2_Name]) AS [row] FROM [Level1] AS [l0] INNER JOIN [Level1] AS [l1] ON [l0].[Id] = [l1].[Id] - WHERE (([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) AND (([l0].[Level2_Name] <> N'Foo') OR [l0].[Level2_Name] IS NULL) + WHERE ((([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL)) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL)) AND (([l0].[Level2_Name] <> N'Foo') OR ([l0].[Level2_Name] IS NULL)) ) AS [t] WHERE [t].[row] <= 3 ) AS [t0] ON [l].[Id] = [t0].[OneToMany_Optional_Inverse2Id] @@ -1745,7 +1745,7 @@ LEFT JOIN ( SELECT [l2].[Id], [l2].[OneToOne_Required_PK_Date], [l2].[Level1_Optional_Id], [l2].[Level1_Required_Id], [l2].[Level2_Name], [l2].[OneToMany_Optional_Inverse2Id], [l2].[OneToMany_Required_Inverse2Id], [l2].[OneToOne_Optional_PK_Inverse2Id], [l3].[Id] AS [Id0], ROW_NUMBER() OVER(PARTITION BY [l2].[OneToMany_Required_Inverse2Id] ORDER BY [l2].[Level2_Name] DESC) AS [row] FROM [Level1] AS [l2] INNER JOIN [Level1] AS [l3] ON [l2].[Id] = [l3].[Id] - WHERE (([l2].[OneToOne_Required_PK_Date] IS NOT NULL AND [l2].[Level1_Required_Id] IS NOT NULL) AND [l2].[OneToMany_Required_Inverse2Id] IS NOT NULL) AND (([l2].[Level2_Name] <> N'Bar') OR [l2].[Level2_Name] IS NULL) + WHERE ((([l2].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l2].[Level1_Required_Id] IS NOT NULL)) AND ([l2].[OneToMany_Required_Inverse2Id] IS NOT NULL)) AND (([l2].[Level2_Name] <> N'Bar') OR ([l2].[Level2_Name] IS NULL)) ) AS [t2] WHERE 1 < [t2].[row] ) AS [t1] ON [l].[Id] = [t1].[OneToMany_Required_Inverse2Id] @@ -1770,11 +1770,11 @@ INNER JOIN ( SELECT [l3].[Id], [l4].[Id] AS [Id0] FROM [Level1] AS [l3] INNER JOIN [Level1] AS [l4] ON [l3].[Id] = [l4].[Id] - WHERE ([l3].[OneToOne_Required_PK_Date] IS NOT NULL AND [l3].[Level1_Required_Id] IS NOT NULL) AND [l3].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l3].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l3].[Level1_Required_Id] IS NOT NULL)) AND ([l3].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t] ON [l2].[Id] = [t].[Id] - WHERE [l2].[Level2_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l2].[Level2_Required_Id] IS NOT NULL) AND ([l2].[OneToMany_Required_Inverse3Id] IS NOT NULL) ) AS [t0] ON CASE - WHEN ([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [l0].[Id] + WHEN (([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL)) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [l0].[Id] END = [t0].[OneToOne_Optional_PK_Inverse3Id] LEFT JOIN ( SELECT [l5].[Id], [l5].[Level3_Optional_Id], [l5].[Level3_Required_Id], [l5].[Level4_Name], [l5].[OneToMany_Optional_Inverse4Id], [l5].[OneToMany_Required_Inverse4Id], [l5].[OneToOne_Optional_PK_Inverse4Id], [t2].[Id] AS [Id0], [t2].[Id0] AS [Id00], [t2].[Id00] AS [Id000] @@ -1786,13 +1786,13 @@ INNER JOIN ( SELECT [l7].[Id], [l8].[Id] AS [Id0] FROM [Level1] AS [l7] INNER JOIN [Level1] AS [l8] ON [l7].[Id] = [l8].[Id] - WHERE ([l7].[OneToOne_Required_PK_Date] IS NOT NULL AND [l7].[Level1_Required_Id] IS NOT NULL) AND [l7].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l7].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l7].[Level1_Required_Id] IS NOT NULL)) AND ([l7].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t3] ON [l6].[Id] = [t3].[Id] - WHERE [l6].[Level2_Required_Id] IS NOT NULL AND [l6].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l6].[Level2_Required_Id] IS NOT NULL) AND ([l6].[OneToMany_Required_Inverse3Id] IS NOT NULL) ) AS [t2] ON [l5].[Id] = [t2].[Id] - WHERE [l5].[Level3_Required_Id] IS NOT NULL AND [l5].[OneToMany_Required_Inverse4Id] IS NOT NULL + WHERE ([l5].[Level3_Required_Id] IS NOT NULL) AND ([l5].[OneToMany_Required_Inverse4Id] IS NOT NULL) ) AS [t1] ON CASE - WHEN [t0].[Level2_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [t0].[Id] + WHEN ([t0].[Level2_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [t0].[Id] END = [t1].[Level3_Optional_Id] LEFT JOIN ( SELECT [l9].[Id], [l9].[Level2_Optional_Id], [l9].[Level2_Required_Id], [l9].[Level3_Name], [l9].[OneToMany_Optional_Inverse3Id], [l9].[OneToMany_Required_Inverse3Id], [l9].[OneToOne_Optional_PK_Inverse3Id], [t5].[Id] AS [Id0], [t5].[Id0] AS [Id00] @@ -1801,11 +1801,11 @@ INNER JOIN ( SELECT [l10].[Id], [l11].[Id] AS [Id0] FROM [Level1] AS [l10] INNER JOIN [Level1] AS [l11] ON [l10].[Id] = [l11].[Id] - WHERE ([l10].[OneToOne_Required_PK_Date] IS NOT NULL AND [l10].[Level1_Required_Id] IS NOT NULL) AND [l10].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l10].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l10].[Level1_Required_Id] IS NOT NULL)) AND ([l10].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t5] ON [l9].[Id] = [t5].[Id] - WHERE [l9].[Level2_Required_Id] IS NOT NULL AND [l9].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l9].[Level2_Required_Id] IS NOT NULL) AND ([l9].[OneToMany_Required_Inverse3Id] IS NOT NULL) ) AS [t4] ON CASE - WHEN ([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [l0].[Id] + WHEN (([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL)) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [l0].[Id] END = [t4].[Level2_Optional_Id] LEFT JOIN ( SELECT [l12].[Id], [l12].[Level3_Optional_Id], [l12].[Level3_Required_Id], [l12].[Level4_Name], [l12].[OneToMany_Optional_Inverse4Id], [l12].[OneToMany_Required_Inverse4Id], [l12].[OneToOne_Optional_PK_Inverse4Id], [t7].[Id] AS [Id0], [t7].[Id0] AS [Id00], [t7].[Id00] AS [Id000] @@ -1817,15 +1817,15 @@ INNER JOIN ( SELECT [l14].[Id], [l15].[Id] AS [Id0] FROM [Level1] AS [l14] INNER JOIN [Level1] AS [l15] ON [l14].[Id] = [l15].[Id] - WHERE ([l14].[OneToOne_Required_PK_Date] IS NOT NULL AND [l14].[Level1_Required_Id] IS NOT NULL) AND [l14].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l14].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l14].[Level1_Required_Id] IS NOT NULL)) AND ([l14].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t8] ON [l13].[Id] = [t8].[Id] - WHERE [l13].[Level2_Required_Id] IS NOT NULL AND [l13].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l13].[Level2_Required_Id] IS NOT NULL) AND ([l13].[OneToMany_Required_Inverse3Id] IS NOT NULL) ) AS [t7] ON [l12].[Id] = [t7].[Id] - WHERE [l12].[Level3_Required_Id] IS NOT NULL AND [l12].[OneToMany_Required_Inverse4Id] IS NOT NULL + WHERE ([l12].[Level3_Required_Id] IS NOT NULL) AND ([l12].[OneToMany_Required_Inverse4Id] IS NOT NULL) ) AS [t6] ON CASE - WHEN [t4].[Level2_Required_Id] IS NOT NULL AND [t4].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [t4].[Id] + WHEN ([t4].[Level2_Required_Id] IS NOT NULL) AND ([t4].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [t4].[Id] END = [t6].[OneToMany_Optional_Inverse4Id] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL)) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t9] ON [l].[Id] = [t9].[OneToMany_Optional_Inverse2Id] ORDER BY [l].[Id], [t9].[Id], [t9].[Id3], [t9].[Id0], [t9].[Id00], [t9].[Id000], [t9].[Id1], [t9].[Id01], [t9].[Id001], [t9].[Id0000], [t9].[Id2], [t9].[Id02], [t9].[Id002], [t9].[Id4], [t9].[Id03], [t9].[Id003]"); } @@ -1846,13 +1846,13 @@ LEFT JOIN ( SELECT [t].[Id], [t].[OneToOne_Required_PK_Date], [t].[Level1_Optional_Id], [t].[Level1_Required_Id], [t].[Level2_Name], [t].[OneToMany_Optional_Inverse2Id], [t].[OneToMany_Required_Inverse2Id], [t].[OneToOne_Optional_PK_Inverse2Id], [t].[Id0], [t].[c] FROM ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[Level2_Name], [l0].[OneToMany_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id], [l1].[Id] AS [Id0], ROW_NUMBER() OVER(PARTITION BY [l0].[OneToMany_Optional_Inverse2Id] ORDER BY CASE - WHEN ([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [l0].[Id] + WHEN (([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL)) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [l0].[Id] END) AS [row], CASE - WHEN ([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [l0].[Id] + WHEN (([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL)) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [l0].[Id] END AS [c] FROM [Level1] AS [l0] INNER JOIN [Level1] AS [l1] ON [l0].[Id] = [l1].[Id] - WHERE (([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) AND (@__p_0 = CAST(1 AS bit)) + WHERE ((([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL)) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL)) AND (@__p_0 = CAST(1 AS bit)) ) AS [t] WHERE [t].[row] <= 3 ) AS [t0] ON [l].[Id] = [t0].[OneToMany_Optional_Inverse2Id] @@ -1877,13 +1877,13 @@ INNER JOIN ( SELECT [l3].[Id], [l4].[Id] AS [Id0] FROM [Level1] AS [l3] INNER JOIN [Level1] AS [l4] ON [l3].[Id] = [l4].[Id] - WHERE ([l3].[OneToOne_Required_PK_Date] IS NOT NULL AND [l3].[Level1_Required_Id] IS NOT NULL) AND [l3].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l3].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l3].[Level1_Required_Id] IS NOT NULL)) AND ([l3].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t] ON [l2].[Id] = [t].[Id] - WHERE [l2].[Level2_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l2].[Level2_Required_Id] IS NOT NULL) AND ([l2].[OneToMany_Required_Inverse3Id] IS NOT NULL) ) AS [t0] ON CASE - WHEN ([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [l0].[Id] + WHEN (([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL)) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [l0].[Id] END = [t0].[OneToOne_Optional_PK_Inverse3Id] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL)) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t1] ON [l].[Id] = [t1].[OneToMany_Optional_Inverse2Id] ORDER BY [l].[Id], [t1].[Id], [t1].[Id1], [t1].[Id0], [t1].[Id00]"); } @@ -1907,7 +1907,7 @@ LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[Level2_Name], [l0].[OneToMany_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id], [l1].[Id] AS [Id0] FROM [Level1] AS [l0] INNER JOIN [Level1] AS [l1] ON [l0].[Id] = [l1].[Id] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL)) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t0] ON [t].[Id] = [t0].[Level1_Required_Id] LEFT JOIN ( SELECT [l2].[Id], [l2].[Level2_Optional_Id], [l2].[Level2_Required_Id], [l2].[Level3_Name], [l2].[OneToMany_Optional_Inverse3Id], [l2].[OneToMany_Required_Inverse3Id], [l2].[OneToOne_Optional_PK_Inverse3Id], [t2].[Id] AS [Id0], [t2].[Id0] AS [Id00] @@ -1916,11 +1916,11 @@ INNER JOIN ( SELECT [l3].[Id], [l4].[Id] AS [Id0] FROM [Level1] AS [l3] INNER JOIN [Level1] AS [l4] ON [l3].[Id] = [l4].[Id] - WHERE ([l3].[OneToOne_Required_PK_Date] IS NOT NULL AND [l3].[Level1_Required_Id] IS NOT NULL) AND [l3].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l3].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l3].[Level1_Required_Id] IS NOT NULL)) AND ([l3].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t2] ON [l2].[Id] = [t2].[Id] - WHERE [l2].[Level2_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l2].[Level2_Required_Id] IS NOT NULL) AND ([l2].[OneToMany_Required_Inverse3Id] IS NOT NULL) ) AS [t1] ON CASE - WHEN ([t0].[OneToOne_Required_PK_Date] IS NOT NULL AND [t0].[Level1_Required_Id] IS NOT NULL) AND [t0].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t0].[Id] + WHEN (([t0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t0].[Level1_Required_Id] IS NOT NULL)) AND ([t0].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t0].[Id] END = [t1].[OneToMany_Optional_Inverse3Id] LEFT JOIN ( SELECT [l5].[Id], [l5].[Level2_Optional_Id], [l5].[Level2_Required_Id], [l5].[Level3_Name], [l5].[OneToMany_Optional_Inverse3Id], [l5].[OneToMany_Required_Inverse3Id], [l5].[OneToOne_Optional_PK_Inverse3Id], [t4].[Id] AS [Id0], [t4].[Id0] AS [Id00] @@ -1929,11 +1929,11 @@ INNER JOIN ( SELECT [l6].[Id], [l7].[Id] AS [Id0] FROM [Level1] AS [l6] INNER JOIN [Level1] AS [l7] ON [l6].[Id] = [l7].[Id] - WHERE ([l6].[OneToOne_Required_PK_Date] IS NOT NULL AND [l6].[Level1_Required_Id] IS NOT NULL) AND [l6].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l6].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l6].[Level1_Required_Id] IS NOT NULL)) AND ([l6].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t4] ON [l5].[Id] = [t4].[Id] - WHERE [l5].[Level2_Required_Id] IS NOT NULL AND [l5].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l5].[Level2_Required_Id] IS NOT NULL) AND ([l5].[OneToMany_Required_Inverse3Id] IS NOT NULL) ) AS [t3] ON CASE - WHEN ([t0].[OneToOne_Required_PK_Date] IS NOT NULL AND [t0].[Level1_Required_Id] IS NOT NULL) AND [t0].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t0].[Id] + WHEN (([t0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t0].[Level1_Required_Id] IS NOT NULL)) AND ([t0].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t0].[Id] END = [t3].[OneToMany_Required_Inverse3Id] ORDER BY [t].[Name], [t].[Id], [t0].[Id], [t0].[Id0], [t1].[Id], [t1].[Id0], [t1].[Id00], [t3].[Id], [t3].[Id0]"); } @@ -1959,7 +1959,7 @@ OUTER APPLY ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[Level2_Name], [l0].[OneToMany_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id], [l1].[Id] AS [Id0] FROM [Level1] AS [l0] INNER JOIN [Level1] AS [l1] ON [l0].[Id] = [l1].[Id] - WHERE (([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) AND ([t].[Id] = [l0].[OneToMany_Optional_Inverse2Id]) + WHERE ((([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL)) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL)) AND ([t].[Id] = [l0].[OneToMany_Optional_Inverse2Id]) ORDER BY [l0].[Level2_Name] DESC OFFSET 2 ROWS FETCH NEXT 4 ROWS ONLY ) AS [t0] @@ -1970,11 +1970,11 @@ INNER JOIN ( SELECT [l3].[Id], [l4].[Id] AS [Id0] FROM [Level1] AS [l3] INNER JOIN [Level1] AS [l4] ON [l3].[Id] = [l4].[Id] - WHERE ([l3].[OneToOne_Required_PK_Date] IS NOT NULL AND [l3].[Level1_Required_Id] IS NOT NULL) AND [l3].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l3].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l3].[Level1_Required_Id] IS NOT NULL)) AND ([l3].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t3] ON [l2].[Id] = [t3].[Id] - WHERE [l2].[Level2_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l2].[Level2_Required_Id] IS NOT NULL) AND ([l2].[OneToMany_Required_Inverse3Id] IS NOT NULL) ) AS [t1] ON CASE - WHEN ([t0].[OneToOne_Required_PK_Date] IS NOT NULL AND [t0].[Level1_Required_Id] IS NOT NULL) AND [t0].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t0].[Id] + WHEN (([t0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t0].[Level1_Required_Id] IS NOT NULL)) AND ([t0].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t0].[Id] END = [t1].[Level2_Optional_Id] ) AS [t2] ORDER BY [t].[Id] DESC, [t2].[Level2_Name] DESC, [t2].[Id], [t2].[Id00], [t2].[Id0], [t2].[Id01]"); @@ -2004,7 +2004,7 @@ LEFT JOIN ( SELECT [l1].[Id], [l1].[OneToOne_Required_PK_Date], [l1].[Level1_Optional_Id], [l1].[Level1_Required_Id], [l1].[Level2_Name], [l1].[OneToMany_Optional_Inverse2Id], [l1].[OneToMany_Required_Inverse2Id], [l1].[OneToOne_Optional_PK_Inverse2Id], [l2].[Id] AS [Id0] FROM [Level1] AS [l1] INNER JOIN [Level1] AS [l2] ON [l1].[Id] = [l2].[Id] - WHERE ([l1].[OneToOne_Required_PK_Date] IS NOT NULL AND [l1].[Level1_Required_Id] IS NOT NULL) AND [l1].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l1].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l1].[Level1_Required_Id] IS NOT NULL)) AND ([l1].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t2] ON [t0].[Id] = [t2].[OneToMany_Optional_Inverse2Id] ) AS [t1] ORDER BY [t].[Date], [t1].[Name], [t1].[Id], [t1].[Id0]"); @@ -2019,7 +2019,7 @@ public override async Task Null_check_in_anonymous_type_projection_should_not_be FROM [Level1] AS [l] LEFT JOIN ( SELECT CASE - WHEN [t0].[Level2_Required_Id] IS NULL OR [t0].[OneToMany_Required_Inverse3Id] IS NULL THEN CAST(1 AS bit) + WHEN ([t0].[Level2_Required_Id] IS NULL) OR ([t0].[OneToMany_Required_Inverse3Id] IS NULL) THEN CAST(1 AS bit) ELSE CAST(0 AS bit) END AS [c], [t0].[Level3_Name], [l0].[Id], [l1].[Id] AS [Id0], [t0].[Id] AS [Id1], [t0].[Id0] AS [Id00], [t0].[Id00] AS [Id000], [l0].[OneToMany_Optional_Inverse2Id] FROM [Level1] AS [l0] @@ -2031,13 +2031,13 @@ INNER JOIN ( SELECT [l3].[Id], [l4].[Id] AS [Id0] FROM [Level1] AS [l3] INNER JOIN [Level1] AS [l4] ON [l3].[Id] = [l4].[Id] - WHERE ([l3].[OneToOne_Required_PK_Date] IS NOT NULL AND [l3].[Level1_Required_Id] IS NOT NULL) AND [l3].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l3].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l3].[Level1_Required_Id] IS NOT NULL)) AND ([l3].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t] ON [l2].[Id] = [t].[Id] - WHERE [l2].[Level2_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l2].[Level2_Required_Id] IS NOT NULL) AND ([l2].[OneToMany_Required_Inverse3Id] IS NOT NULL) ) AS [t0] ON CASE - WHEN ([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [l0].[Id] + WHEN (([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL)) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [l0].[Id] END = [t0].[Level2_Required_Id] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL)) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t1] ON [l].[Id] = [t1].[OneToMany_Optional_Inverse2Id] ORDER BY [l].[Id], [t1].[Id], [t1].[Id0], [t1].[Id1], [t1].[Id00]"); } @@ -2055,7 +2055,7 @@ LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[Level2_Name], [l0].[OneToMany_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id], [l1].[Id] AS [Id0], ROW_NUMBER() OVER(PARTITION BY [l0].[OneToMany_Optional_Inverse2Id] ORDER BY [l0].[Id], [l1].[Id]) AS [row] FROM [Level1] AS [l0] INNER JOIN [Level1] AS [l1] ON [l0].[Id] = [l1].[Id] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL)) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t] WHERE [t].[row] <= 1 ) AS [t0] ON [l].[Id] = [t0].[OneToMany_Optional_Inverse2Id] @@ -2073,7 +2073,7 @@ LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[Level2_Name], [l0].[OneToMany_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id], [l1].[Id] AS [Id0] FROM [Level1] AS [l0] INNER JOIN [Level1] AS [l1] ON [l0].[Id] = [l1].[Id] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL)) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t] ON [l].[Id] = [t].[OneToMany_Optional_Inverse2Id] ORDER BY [l].[Id], [t].[Id]"); } @@ -2096,11 +2096,11 @@ INNER JOIN ( SELECT [l3].[Id], [l4].[Id] AS [Id0] FROM [Level1] AS [l3] INNER JOIN [Level1] AS [l4] ON [l3].[Id] = [l4].[Id] - WHERE ([l3].[OneToOne_Required_PK_Date] IS NOT NULL AND [l3].[Level1_Required_Id] IS NOT NULL) AND [l3].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l3].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l3].[Level1_Required_Id] IS NOT NULL)) AND ([l3].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t] ON [l2].[Id] = [t].[Id] - WHERE [l2].[Level2_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l2].[Level2_Required_Id] IS NOT NULL) AND ([l2].[OneToMany_Required_Inverse3Id] IS NOT NULL) ) AS [t0] ON CASE - WHEN ([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [l0].[Id] + WHEN (([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL)) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [l0].[Id] END = [t0].[OneToOne_Optional_PK_Inverse3Id] LEFT JOIN ( SELECT [l5].[Id], [l5].[Level3_Optional_Id], [l5].[Level3_Required_Id], [l5].[Level4_Name], [l5].[OneToMany_Optional_Inverse4Id], [l5].[OneToMany_Required_Inverse4Id], [l5].[OneToOne_Optional_PK_Inverse4Id], [t2].[Id] AS [Id0], [t2].[Id0] AS [Id00], [t2].[Id00] AS [Id000] @@ -2112,15 +2112,15 @@ INNER JOIN ( SELECT [l7].[Id], [l8].[Id] AS [Id0] FROM [Level1] AS [l7] INNER JOIN [Level1] AS [l8] ON [l7].[Id] = [l8].[Id] - WHERE ([l7].[OneToOne_Required_PK_Date] IS NOT NULL AND [l7].[Level1_Required_Id] IS NOT NULL) AND [l7].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l7].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l7].[Level1_Required_Id] IS NOT NULL)) AND ([l7].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t3] ON [l6].[Id] = [t3].[Id] - WHERE [l6].[Level2_Required_Id] IS NOT NULL AND [l6].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l6].[Level2_Required_Id] IS NOT NULL) AND ([l6].[OneToMany_Required_Inverse3Id] IS NOT NULL) ) AS [t2] ON [l5].[Id] = [t2].[Id] - WHERE [l5].[Level3_Required_Id] IS NOT NULL AND [l5].[OneToMany_Required_Inverse4Id] IS NOT NULL + WHERE ([l5].[Level3_Required_Id] IS NOT NULL) AND ([l5].[OneToMany_Required_Inverse4Id] IS NOT NULL) ) AS [t1] ON CASE - WHEN [t0].[Level2_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [t0].[Id] + WHEN ([t0].[Level2_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [t0].[Id] END = [t1].[Level3_Optional_Id] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL)) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t4] ON [l].[Id] = [t4].[OneToMany_Optional_Inverse2Id] ORDER BY [l].[Id], [t4].[Id], [t4].[Id2], [t4].[Id0], [t4].[Id00], [t4].[Id000], [t4].[Id1], [t4].[Id01], [t4].[Id001]"); } @@ -2143,13 +2143,13 @@ INNER JOIN ( SELECT [l3].[Id], [l4].[Id] AS [Id0] FROM [Level1] AS [l3] INNER JOIN [Level1] AS [l4] ON [l3].[Id] = [l4].[Id] - WHERE ([l3].[OneToOne_Required_PK_Date] IS NOT NULL AND [l3].[Level1_Required_Id] IS NOT NULL) AND [l3].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l3].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l3].[Level1_Required_Id] IS NOT NULL)) AND ([l3].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t] ON [l2].[Id] = [t].[Id] - WHERE [l2].[Level2_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l2].[Level2_Required_Id] IS NOT NULL) AND ([l2].[OneToMany_Required_Inverse3Id] IS NOT NULL) ) AS [t0] ON CASE - WHEN ([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [l0].[Id] + WHEN (([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL)) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [l0].[Id] END = [t0].[OneToMany_Optional_Inverse3Id] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL)) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t1] ON [l].[Id] = [t1].[OneToMany_Optional_Inverse2Id] ORDER BY [l].[Id], [t1].[Level2_Name], [t1].[Id], [t1].[Id0], [t1].[Level3_Name] DESC, [t1].[Id1], [t1].[Id00]"); } @@ -2169,24 +2169,24 @@ OUTER APPLY ( SELECT [t0].[Id], [t0].[Level2_Optional_Id], [t0].[Level2_Required_Id], [t0].[Level3_Name], [t0].[OneToMany_Optional_Inverse3Id], [t0].[OneToMany_Required_Inverse3Id], [t0].[OneToOne_Optional_PK_Inverse3Id], [t0].[Id0], [t0].[Id00], [t1].[Id] AS [Id1], [t1].[Level3_Optional_Id], [t1].[Level3_Required_Id], [t1].[Level4_Name], [t1].[OneToMany_Optional_Inverse4Id], [t1].[OneToMany_Required_Inverse4Id], [t1].[OneToOne_Optional_PK_Inverse4Id], [t1].[Id0] AS [Id01], [t1].[Id00] AS [Id000], [t1].[Id000] AS [Id0000], [t4].[Id] AS [Id2], [t4].[Level3_Optional_Id] AS [Level3_Optional_Id0], [t4].[Level3_Required_Id] AS [Level3_Required_Id0], [t4].[Level4_Name] AS [Level4_Name0], [t4].[OneToMany_Optional_Inverse4Id] AS [OneToMany_Optional_Inverse4Id0], [t4].[OneToMany_Required_Inverse4Id] AS [OneToMany_Required_Inverse4Id0], [t4].[OneToOne_Optional_PK_Inverse4Id] AS [OneToOne_Optional_PK_Inverse4Id0], [t4].[Id0] AS [Id02], [t4].[Id00] AS [Id001], [t4].[Id000] AS [Id0001], [t0].[c] FROM ( SELECT TOP(1) [l2].[Id], [l2].[Level2_Optional_Id], [l2].[Level2_Required_Id], [l2].[Level3_Name], [l2].[OneToMany_Optional_Inverse3Id], [l2].[OneToMany_Required_Inverse3Id], [l2].[OneToOne_Optional_PK_Inverse3Id], [t].[Id] AS [Id0], [t].[Id0] AS [Id00], CASE - WHEN [l2].[Level2_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [l2].[Id] + WHEN ([l2].[Level2_Required_Id] IS NOT NULL) AND ([l2].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [l2].[Id] END AS [c] FROM [Level1] AS [l2] INNER JOIN ( SELECT [l3].[Id], [l4].[Id] AS [Id0] FROM [Level1] AS [l3] INNER JOIN [Level1] AS [l4] ON [l3].[Id] = [l4].[Id] - WHERE ([l3].[OneToOne_Required_PK_Date] IS NOT NULL AND [l3].[Level1_Required_Id] IS NOT NULL) AND [l3].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l3].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l3].[Level1_Required_Id] IS NOT NULL)) AND ([l3].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t] ON [l2].[Id] = [t].[Id] - WHERE (([l2].[Level2_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse3Id] IS NOT NULL) AND (CASE - WHEN ([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [l0].[Id] - END IS NOT NULL AND ((CASE - WHEN ([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [l0].[Id] - END = [l2].[OneToMany_Optional_Inverse3Id]) OR (CASE - WHEN ([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [l0].[Id] - END IS NULL AND [l2].[OneToMany_Optional_Inverse3Id] IS NULL)))) AND (([l2].[Level3_Name] <> N'Foo') OR [l2].[Level3_Name] IS NULL) + WHERE ((([l2].[Level2_Required_Id] IS NOT NULL) AND ([l2].[OneToMany_Required_Inverse3Id] IS NOT NULL)) AND ((CASE + WHEN (([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL)) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [l0].[Id] + END IS NOT NULL) AND ((CASE + WHEN (([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL)) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [l0].[Id] + END = [l2].[OneToMany_Optional_Inverse3Id]) OR ((CASE + WHEN (([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL)) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [l0].[Id] + END IS NULL) AND ([l2].[OneToMany_Optional_Inverse3Id] IS NULL))))) AND (([l2].[Level3_Name] <> N'Foo') OR ([l2].[Level3_Name] IS NULL)) ORDER BY CASE - WHEN [l2].[Level2_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [l2].[Id] + WHEN ([l2].[Level2_Required_Id] IS NOT NULL) AND ([l2].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [l2].[Id] END ) AS [t0] LEFT JOIN ( @@ -2199,13 +2199,13 @@ INNER JOIN ( SELECT [l7].[Id], [l8].[Id] AS [Id0] FROM [Level1] AS [l7] INNER JOIN [Level1] AS [l8] ON [l7].[Id] = [l8].[Id] - WHERE ([l7].[OneToOne_Required_PK_Date] IS NOT NULL AND [l7].[Level1_Required_Id] IS NOT NULL) AND [l7].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l7].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l7].[Level1_Required_Id] IS NOT NULL)) AND ([l7].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t3] ON [l6].[Id] = [t3].[Id] - WHERE [l6].[Level2_Required_Id] IS NOT NULL AND [l6].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l6].[Level2_Required_Id] IS NOT NULL) AND ([l6].[OneToMany_Required_Inverse3Id] IS NOT NULL) ) AS [t2] ON [l5].[Id] = [t2].[Id] - WHERE [l5].[Level3_Required_Id] IS NOT NULL AND [l5].[OneToMany_Required_Inverse4Id] IS NOT NULL + WHERE ([l5].[Level3_Required_Id] IS NOT NULL) AND ([l5].[OneToMany_Required_Inverse4Id] IS NOT NULL) ) AS [t1] ON CASE - WHEN [t0].[Level2_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [t0].[Id] + WHEN ([t0].[Level2_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [t0].[Id] END = [t1].[OneToMany_Optional_Inverse4Id] LEFT JOIN ( SELECT [l9].[Id], [l9].[Level3_Optional_Id], [l9].[Level3_Required_Id], [l9].[Level4_Name], [l9].[OneToMany_Optional_Inverse4Id], [l9].[OneToMany_Required_Inverse4Id], [l9].[OneToOne_Optional_PK_Inverse4Id], [t5].[Id] AS [Id0], [t5].[Id0] AS [Id00], [t5].[Id00] AS [Id000] @@ -2217,16 +2217,16 @@ INNER JOIN ( SELECT [l11].[Id], [l12].[Id] AS [Id0] FROM [Level1] AS [l11] INNER JOIN [Level1] AS [l12] ON [l11].[Id] = [l12].[Id] - WHERE ([l11].[OneToOne_Required_PK_Date] IS NOT NULL AND [l11].[Level1_Required_Id] IS NOT NULL) AND [l11].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l11].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l11].[Level1_Required_Id] IS NOT NULL)) AND ([l11].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t6] ON [l10].[Id] = [t6].[Id] - WHERE [l10].[Level2_Required_Id] IS NOT NULL AND [l10].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l10].[Level2_Required_Id] IS NOT NULL) AND ([l10].[OneToMany_Required_Inverse3Id] IS NOT NULL) ) AS [t5] ON [l9].[Id] = [t5].[Id] - WHERE [l9].[Level3_Required_Id] IS NOT NULL AND [l9].[OneToMany_Required_Inverse4Id] IS NOT NULL + WHERE ([l9].[Level3_Required_Id] IS NOT NULL) AND ([l9].[OneToMany_Required_Inverse4Id] IS NOT NULL) ) AS [t4] ON CASE - WHEN [t0].[Level2_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [t0].[Id] + WHEN ([t0].[Level2_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [t0].[Id] END = [t4].[OneToMany_Required_Inverse4Id] ) AS [t7] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL)) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t8] ON [l].[Id] = [t8].[OneToMany_Optional_Inverse2Id] ORDER BY [l].[Id], [t8].[Id], [t8].[Id0], [t8].[c], [t8].[Id1], [t8].[Id00], [t8].[Id000], [t8].[Id10], [t8].[Id01], [t8].[Id0000], [t8].[Id00000], [t8].[Id2], [t8].[Id02], [t8].[Id001]"); } @@ -2242,7 +2242,7 @@ LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[Level2_Name], [l0].[OneToMany_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id], [l1].[Id] AS [Id0] FROM [Level1] AS [l0] INNER JOIN [Level1] AS [l1] ON [l0].[Id] = [l1].[Id] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL)) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t] ON [l].[Id] = [t].[OneToMany_Optional_Inverse2Id] ORDER BY [l].[Id], [t].[Id]"); } @@ -2258,7 +2258,7 @@ LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[Level2_Name], [l0].[OneToMany_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id], [l1].[Id] AS [Id0] FROM [Level1] AS [l0] INNER JOIN [Level1] AS [l1] ON [l0].[Id] = [l1].[Id] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL)) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t] ON [l].[Id] = [t].[Level1_Optional_Id] LEFT JOIN ( SELECT [l2].[Id], [l2].[Level2_Optional_Id], [l2].[Level2_Required_Id], [l2].[Level3_Name], [l2].[OneToMany_Optional_Inverse3Id], [l2].[OneToMany_Required_Inverse3Id], [l2].[OneToOne_Optional_PK_Inverse3Id], [t1].[Id] AS [Id0], [t1].[Id0] AS [Id00] @@ -2267,14 +2267,14 @@ INNER JOIN ( SELECT [l3].[Id], [l4].[Id] AS [Id0] FROM [Level1] AS [l3] INNER JOIN [Level1] AS [l4] ON [l3].[Id] = [l4].[Id] - WHERE ([l3].[OneToOne_Required_PK_Date] IS NOT NULL AND [l3].[Level1_Required_Id] IS NOT NULL) AND [l3].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l3].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l3].[Level1_Required_Id] IS NOT NULL)) AND ([l3].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t1] ON [l2].[Id] = [t1].[Id] - WHERE [l2].[Level2_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l2].[Level2_Required_Id] IS NOT NULL) AND ([l2].[OneToMany_Required_Inverse3Id] IS NOT NULL) ) AS [t0] ON CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + WHEN (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] END = [t0].[OneToMany_Optional_Inverse3Id] ORDER BY CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + WHEN (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] END, [l].[Id], [t].[Id], [t].[Id0], [t0].[Id], [t0].[Id0]"); } @@ -2289,7 +2289,7 @@ LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[OneToMany_Required_Inverse2Id], [l1].[Id] AS [Id0] FROM [Level1] AS [l0] INNER JOIN [Level1] AS [l1] ON [l0].[Id] = [l1].[Id] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL)) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t] ON [l].[Id] = [t].[Level1_Optional_Id] LEFT JOIN ( SELECT [l2].[Id], [l2].[Level2_Optional_Id], [l2].[Level2_Required_Id], [l2].[Level3_Name], [l2].[OneToMany_Optional_Inverse3Id], [l2].[OneToMany_Required_Inverse3Id], [l2].[OneToOne_Optional_PK_Inverse3Id], [t1].[Id] AS [Id0], [t1].[Id0] AS [Id00] @@ -2298,11 +2298,11 @@ INNER JOIN ( SELECT [l3].[Id], [l4].[Id] AS [Id0] FROM [Level1] AS [l3] INNER JOIN [Level1] AS [l4] ON [l3].[Id] = [l4].[Id] - WHERE ([l3].[OneToOne_Required_PK_Date] IS NOT NULL AND [l3].[Level1_Required_Id] IS NOT NULL) AND [l3].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l3].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l3].[Level1_Required_Id] IS NOT NULL)) AND ([l3].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t1] ON [l2].[Id] = [t1].[Id] - WHERE [l2].[Level2_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l2].[Level2_Required_Id] IS NOT NULL) AND ([l2].[OneToMany_Required_Inverse3Id] IS NOT NULL) ) AS [t0] ON CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + WHEN (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] END = [t0].[OneToOne_Optional_PK_Inverse3Id] LEFT JOIN ( SELECT [l5].[Id], [l5].[Level3_Optional_Id], [l5].[Level3_Required_Id], [l5].[Level4_Name], [l5].[OneToMany_Optional_Inverse4Id], [l5].[OneToMany_Required_Inverse4Id], [l5].[OneToOne_Optional_PK_Inverse4Id], [t3].[Id] AS [Id0], [t3].[Id0] AS [Id00], [t3].[Id00] AS [Id000] @@ -2314,13 +2314,13 @@ INNER JOIN ( SELECT [l7].[Id], [l8].[Id] AS [Id0] FROM [Level1] AS [l7] INNER JOIN [Level1] AS [l8] ON [l7].[Id] = [l8].[Id] - WHERE ([l7].[OneToOne_Required_PK_Date] IS NOT NULL AND [l7].[Level1_Required_Id] IS NOT NULL) AND [l7].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l7].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l7].[Level1_Required_Id] IS NOT NULL)) AND ([l7].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t4] ON [l6].[Id] = [t4].[Id] - WHERE [l6].[Level2_Required_Id] IS NOT NULL AND [l6].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l6].[Level2_Required_Id] IS NOT NULL) AND ([l6].[OneToMany_Required_Inverse3Id] IS NOT NULL) ) AS [t3] ON [l5].[Id] = [t3].[Id] - WHERE [l5].[Level3_Required_Id] IS NOT NULL AND [l5].[OneToMany_Required_Inverse4Id] IS NOT NULL + WHERE ([l5].[Level3_Required_Id] IS NOT NULL) AND ([l5].[OneToMany_Required_Inverse4Id] IS NOT NULL) ) AS [t2] ON CASE - WHEN [t0].[Level2_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [t0].[Id] + WHEN ([t0].[Level2_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [t0].[Id] END = [t2].[OneToMany_Optional_Inverse4Id] ORDER BY [l].[Id], [t].[Id], [t].[Id0], [t0].[Id], [t0].[Id0], [t0].[Id00], [t2].[Id], [t2].[Id0], [t2].[Id00]"); } @@ -2336,7 +2336,7 @@ INNER JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[Level2_Name], [l0].[OneToMany_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id], [l1].[Id] AS [Id0] FROM [Level1] AS [l0] INNER JOIN [Level1] AS [l1] ON [l0].[Id] = [l1].[Id] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL)) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t] ON [l].[Id] = [t].[OneToMany_Optional_Inverse2Id] LEFT JOIN ( SELECT [l2].[Id], [l2].[Level2_Optional_Id], [l2].[Level2_Required_Id], [l2].[Level3_Name], [l2].[OneToMany_Optional_Inverse3Id], [l2].[OneToMany_Required_Inverse3Id], [l2].[OneToOne_Optional_PK_Inverse3Id], [t1].[Id] AS [Id0], [t1].[Id0] AS [Id00] @@ -2345,11 +2345,11 @@ INNER JOIN ( SELECT [l3].[Id], [l4].[Id] AS [Id0] FROM [Level1] AS [l3] INNER JOIN [Level1] AS [l4] ON [l3].[Id] = [l4].[Id] - WHERE ([l3].[OneToOne_Required_PK_Date] IS NOT NULL AND [l3].[Level1_Required_Id] IS NOT NULL) AND [l3].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l3].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l3].[Level1_Required_Id] IS NOT NULL)) AND ([l3].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t1] ON [l2].[Id] = [t1].[Id] - WHERE [l2].[Level2_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l2].[Level2_Required_Id] IS NOT NULL) AND ([l2].[OneToMany_Required_Inverse3Id] IS NOT NULL) ) AS [t0] ON CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + WHEN (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] END = [t0].[OneToMany_Optional_Inverse3Id] ORDER BY [t].[Level2_Name], [l].[Id], [t].[Id], [t].[Id0], [t0].[Id], [t0].[Id0]"); } @@ -2372,13 +2372,13 @@ INNER JOIN ( SELECT [l3].[Id], [l4].[Id] AS [Id0] FROM [Level1] AS [l3] INNER JOIN [Level1] AS [l4] ON [l3].[Id] = [l4].[Id] - WHERE ([l3].[OneToOne_Required_PK_Date] IS NOT NULL AND [l3].[Level1_Required_Id] IS NOT NULL) AND [l3].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l3].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l3].[Level1_Required_Id] IS NOT NULL)) AND ([l3].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t] ON [l2].[Id] = [t].[Id] - WHERE [l2].[Level2_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l2].[Level2_Required_Id] IS NOT NULL) AND ([l2].[OneToMany_Required_Inverse3Id] IS NOT NULL) ) AS [t0] ON CASE - WHEN ([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [l0].[Id] + WHEN (([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL)) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [l0].[Id] END = [t0].[OneToOne_Optional_PK_Inverse3Id] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL)) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t1] ON [l].[Id] = [t1].[OneToMany_Optional_Inverse2Id] ORDER BY [l].[Id], [t1].[Id], [t1].[Id1], [t1].[Id0], [t1].[Id00]"); } @@ -2392,11 +2392,11 @@ public override async Task Select_nav_prop_collection_one_to_many_required(bool FROM [Level1] AS [l] LEFT JOIN ( SELECT CASE - WHEN ([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [l0].[Id] + WHEN (([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL)) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [l0].[Id] END AS [c], [l0].[Id], [l1].[Id] AS [Id0], [l0].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l0] INNER JOIN [Level1] AS [l1] ON [l0].[Id] = [l1].[Id] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL)) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t] ON [l].[Id] = [t].[OneToMany_Required_Inverse2Id] ORDER BY [l].[Id], [t].[Id]"); } @@ -2412,7 +2412,7 @@ LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[Level2_Name], [l0].[OneToMany_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id], [l1].[Id] AS [Id0] FROM [Level1] AS [l0] INNER JOIN [Level1] AS [l1] ON [l0].[Id] = [l1].[Id] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL)) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t] ON [l].[Id] = [t].[OneToMany_Optional_Inverse2Id] ORDER BY [l].[Id], [t].[Id]"); } @@ -2428,7 +2428,7 @@ LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[Level2_Name], [l0].[OneToMany_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id], [l1].[Id] AS [Id0] FROM [Level1] AS [l0] INNER JOIN [Level1] AS [l1] ON [l0].[Id] = [l1].[Id] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL)) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t] ON [l].[Id] = [t].[Level1_Optional_Id] LEFT JOIN ( SELECT [l2].[Id], [l2].[Level2_Optional_Id], [l2].[Level2_Required_Id], [l2].[Level3_Name], [l2].[OneToMany_Optional_Inverse3Id], [l2].[OneToMany_Required_Inverse3Id], [l2].[OneToOne_Optional_PK_Inverse3Id], [t1].[Id] AS [Id0], [t1].[Id0] AS [Id00] @@ -2437,11 +2437,11 @@ INNER JOIN ( SELECT [l3].[Id], [l4].[Id] AS [Id0] FROM [Level1] AS [l3] INNER JOIN [Level1] AS [l4] ON [l3].[Id] = [l4].[Id] - WHERE ([l3].[OneToOne_Required_PK_Date] IS NOT NULL AND [l3].[Level1_Required_Id] IS NOT NULL) AND [l3].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l3].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l3].[Level1_Required_Id] IS NOT NULL)) AND ([l3].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t1] ON [l2].[Id] = [t1].[Id] - WHERE [l2].[Level2_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l2].[Level2_Required_Id] IS NOT NULL) AND ([l2].[OneToMany_Required_Inverse3Id] IS NOT NULL) ) AS [t0] ON CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + WHEN (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] END = [t0].[OneToMany_Optional_Inverse3Id] LEFT JOIN ( SELECT [l5].[Id], [l5].[OneToOne_Required_PK_Date], [l5].[Level1_Optional_Id], [l5].[Level1_Required_Id], [l5].[Level2_Name], [l5].[OneToMany_Optional_Inverse2Id], [l5].[OneToMany_Required_Inverse2Id], [l5].[OneToOne_Optional_PK_Inverse2Id], [t3].[Id] AS [Id0], [t3].[Level2_Optional_Id], [t3].[Level2_Required_Id], [t3].[Level3_Name], [t3].[OneToMany_Optional_Inverse3Id], [t3].[OneToMany_Required_Inverse3Id], [t3].[OneToOne_Optional_PK_Inverse3Id], [l6].[Id] AS [Id1], [t3].[Id0] AS [Id00], [t3].[Id00] AS [Id000] @@ -2454,13 +2454,13 @@ INNER JOIN ( SELECT [l8].[Id], [l9].[Id] AS [Id0] FROM [Level1] AS [l8] INNER JOIN [Level1] AS [l9] ON [l8].[Id] = [l9].[Id] - WHERE ([l8].[OneToOne_Required_PK_Date] IS NOT NULL AND [l8].[Level1_Required_Id] IS NOT NULL) AND [l8].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l8].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l8].[Level1_Required_Id] IS NOT NULL)) AND ([l8].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t4] ON [l7].[Id] = [t4].[Id] - WHERE [l7].[Level2_Required_Id] IS NOT NULL AND [l7].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l7].[Level2_Required_Id] IS NOT NULL) AND ([l7].[OneToMany_Required_Inverse3Id] IS NOT NULL) ) AS [t3] ON CASE - WHEN ([l5].[OneToOne_Required_PK_Date] IS NOT NULL AND [l5].[Level1_Required_Id] IS NOT NULL) AND [l5].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [l5].[Id] + WHEN (([l5].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l5].[Level1_Required_Id] IS NOT NULL)) AND ([l5].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [l5].[Id] END = [t3].[Level2_Optional_Id] - WHERE ([l5].[OneToOne_Required_PK_Date] IS NOT NULL AND [l5].[Level1_Required_Id] IS NOT NULL) AND [l5].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l5].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l5].[Level1_Required_Id] IS NOT NULL)) AND ([l5].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t2] ON [l].[Id] = [t2].[OneToMany_Optional_Inverse2Id] ORDER BY [l].[Id], [t].[Id], [t].[Id0], [t0].[Id], [t0].[Id0], [t0].[Id00], [t2].[Id], [t2].[Id1], [t2].[Id0], [t2].[Id00]"); } @@ -2476,7 +2476,7 @@ LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[OneToMany_Required_Inverse2Id], [l1].[Id] AS [Id0] FROM [Level1] AS [l0] INNER JOIN [Level1] AS [l1] ON [l0].[Id] = [l1].[Id] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL)) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t] ON [l].[Id] = [t].[Level1_Optional_Id] LEFT JOIN ( SELECT [l2].[Id], [l2].[Level2_Optional_Id], [l2].[Level2_Required_Id], [l2].[Level3_Name], [l2].[OneToMany_Optional_Inverse3Id], [l2].[OneToMany_Required_Inverse3Id], [l2].[OneToOne_Optional_PK_Inverse3Id], [t1].[Id] AS [Id0], [t1].[Id0] AS [Id00] @@ -2485,11 +2485,11 @@ INNER JOIN ( SELECT [l3].[Id], [l4].[Id] AS [Id0] FROM [Level1] AS [l3] INNER JOIN [Level1] AS [l4] ON [l3].[Id] = [l4].[Id] - WHERE ([l3].[OneToOne_Required_PK_Date] IS NOT NULL AND [l3].[Level1_Required_Id] IS NOT NULL) AND [l3].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l3].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l3].[Level1_Required_Id] IS NOT NULL)) AND ([l3].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t1] ON [l2].[Id] = [t1].[Id] - WHERE [l2].[Level2_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l2].[Level2_Required_Id] IS NOT NULL) AND ([l2].[OneToMany_Required_Inverse3Id] IS NOT NULL) ) AS [t0] ON CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + WHEN (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] END = [t0].[OneToMany_Optional_Inverse3Id] ORDER BY [l].[Id], [t].[Id], [t].[Id0], [t0].[Id], [t0].[Id0]"); } @@ -2505,13 +2505,13 @@ LEFT JOIN ( SELECT [t].[Id], [t].[OneToOne_Required_PK_Date], [t].[Level1_Optional_Id], [t].[Level1_Required_Id], [t].[Level2_Name], [t].[OneToMany_Optional_Inverse2Id], [t].[OneToMany_Required_Inverse2Id], [t].[OneToOne_Optional_PK_Inverse2Id], [t].[Id0], [t].[c] FROM ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[Level2_Name], [l0].[OneToMany_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id], [l1].[Id] AS [Id0], ROW_NUMBER() OVER(PARTITION BY [l0].[OneToMany_Optional_Inverse2Id] ORDER BY CASE - WHEN ([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [l0].[Id] + WHEN (([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL)) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [l0].[Id] END) AS [row], CASE - WHEN ([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [l0].[Id] + WHEN (([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL)) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [l0].[Id] END AS [c] FROM [Level1] AS [l0] INNER JOIN [Level1] AS [l1] ON [l0].[Id] = [l1].[Id] - WHERE (([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) AND (([l0].[Level2_Name] <> N'Foo') OR [l0].[Level2_Name] IS NULL) + WHERE ((([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL)) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL)) AND (([l0].[Level2_Name] <> N'Foo') OR ([l0].[Level2_Name] IS NULL)) ) AS [t] WHERE [t].[row] <= 3 ) AS [t0] ON [l].[Id] = [t0].[OneToMany_Optional_Inverse2Id] @@ -2538,7 +2538,7 @@ OUTER APPLY ( SELECT TOP(40) [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[Level2_Name], [l0].[OneToMany_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id], [l1].[Id] AS [Id0] FROM [Level1] AS [l0] INNER JOIN [Level1] AS [l1] ON [l0].[Id] = [l1].[Id] - WHERE (([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) AND ([t].[Id] = [l0].[OneToMany_Optional_Inverse2Id]) + WHERE ((([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL)) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL)) AND ([t].[Id] = [l0].[OneToMany_Optional_Inverse2Id]) ) AS [t0] LEFT JOIN ( SELECT [l2].[Id], [l2].[Level2_Optional_Id], [l2].[Level2_Required_Id], [l2].[Level3_Name], [l2].[OneToMany_Optional_Inverse3Id], [l2].[OneToMany_Required_Inverse3Id], [l2].[OneToOne_Optional_PK_Inverse3Id], [t3].[Id] AS [Id0], [t3].[Id0] AS [Id00] @@ -2547,11 +2547,11 @@ INNER JOIN ( SELECT [l3].[Id], [l4].[Id] AS [Id0] FROM [Level1] AS [l3] INNER JOIN [Level1] AS [l4] ON [l3].[Id] = [l4].[Id] - WHERE ([l3].[OneToOne_Required_PK_Date] IS NOT NULL AND [l3].[Level1_Required_Id] IS NOT NULL) AND [l3].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l3].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l3].[Level1_Required_Id] IS NOT NULL)) AND ([l3].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t3] ON [l2].[Id] = [t3].[Id] - WHERE [l2].[Level2_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l2].[Level2_Required_Id] IS NOT NULL) AND ([l2].[OneToMany_Required_Inverse3Id] IS NOT NULL) ) AS [t1] ON CASE - WHEN ([t0].[OneToOne_Required_PK_Date] IS NOT NULL AND [t0].[Level1_Required_Id] IS NOT NULL) AND [t0].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t0].[Id] + WHEN (([t0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t0].[Level1_Required_Id] IS NOT NULL)) AND ([t0].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t0].[Id] END = [t1].[Level2_Optional_Id] ) AS [t2] ORDER BY [t].[Id], [t2].[Id], [t2].[Id00], [t2].[Id0], [t2].[Id01]"); @@ -2568,13 +2568,13 @@ LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[Level2_Name], [l0].[OneToMany_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id], [l1].[Id] AS [Id0] FROM [Level1] AS [l0] INNER JOIN [Level1] AS [l1] ON [l0].[Id] = [l1].[Id] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL)) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t] ON [l].[Id] = [t].[OneToMany_Optional_Inverse2Id] LEFT JOIN ( SELECT [l2].[Id], [l2].[OneToOne_Required_PK_Date], [l2].[Level1_Optional_Id], [l2].[Level1_Required_Id], [l2].[Level2_Name], [l2].[OneToMany_Optional_Inverse2Id], [l2].[OneToMany_Required_Inverse2Id], [l2].[OneToOne_Optional_PK_Inverse2Id], [l3].[Id] AS [Id0] FROM [Level1] AS [l2] INNER JOIN [Level1] AS [l3] ON [l2].[Id] = [l3].[Id] - WHERE ([l2].[OneToOne_Required_PK_Date] IS NOT NULL AND [l2].[Level1_Required_Id] IS NOT NULL) AND [l2].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l2].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l2].[Level1_Required_Id] IS NOT NULL)) AND ([l2].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t0] ON [l].[Id] = [t0].[OneToMany_Optional_Inverse2Id] ORDER BY [l].[Id], [t].[Id], [t].[Id0], [t0].[Id]"); } @@ -2592,7 +2592,7 @@ LEFT JOIN ( SELECT 1 AS [c], [l0].[Id], [l1].[Id] AS [Id0], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Required_Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToMany_Optional_Inverse2Id], ROW_NUMBER() OVER(PARTITION BY [l0].[OneToMany_Optional_Inverse2Id] ORDER BY [l0].[Id], [l1].[Id]) AS [row] FROM [Level1] AS [l0] INNER JOIN [Level1] AS [l1] ON [l0].[Id] = [l1].[Id] - WHERE (([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) AND (([l0].[Level2_Name] <> N'Foo') OR [l0].[Level2_Name] IS NULL) + WHERE ((([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL)) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL)) AND (([l0].[Level2_Name] <> N'Foo') OR ([l0].[Level2_Name] IS NULL)) ) AS [t] WHERE [t].[row] <= 1 ) AS [t0] ON [l].[Id] = [t0].[OneToMany_Optional_Inverse2Id] @@ -2603,8 +2603,8 @@ WHERE EXISTS ( SELECT 1 FROM [Level1] AS [l3] INNER JOIN [Level1] AS [l4] ON [l3].[Id] = [l4].[Id] - WHERE ((([l3].[OneToOne_Required_PK_Date] IS NOT NULL AND [l3].[Level1_Required_Id] IS NOT NULL) AND [l3].[OneToMany_Required_Inverse2Id] IS NOT NULL) AND ([l2].[Id] = [l3].[OneToMany_Optional_Inverse2Id])) AND ([l3].[Id] = CASE - WHEN ([t0].[OneToOne_Required_PK_Date] IS NOT NULL AND [t0].[Level1_Required_Id] IS NOT NULL) AND [t0].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t0].[Id] + WHERE (((([l3].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l3].[Level1_Required_Id] IS NOT NULL)) AND ([l3].[OneToMany_Required_Inverse2Id] IS NOT NULL)) AND ([l2].[Id] = [l3].[OneToMany_Optional_Inverse2Id])) AND ([l3].[Id] = CASE + WHEN (([t0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t0].[Level1_Required_Id] IS NOT NULL)) AND ([t0].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t0].[Id] END)) ) AS [t1] ORDER BY [l].[Id], [t0].[Id], [t0].[Id0]"); @@ -2621,34 +2621,34 @@ LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Required_Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id], [l1].[Id] AS [Id0] FROM [Level1] AS [l0] INNER JOIN [Level1] AS [l1] ON [l0].[Id] = [l1].[Id] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL)) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t] ON [l].[Id] = [t].[OneToOne_Optional_PK_Inverse2Id] LEFT JOIN ( SELECT [l2].[Id], [l2].[OneToOne_Required_PK_Date], [l2].[Level1_Optional_Id], [l2].[Level1_Required_Id], [l2].[Level2_Name], [l2].[OneToMany_Optional_Inverse2Id], [l2].[OneToMany_Required_Inverse2Id], [l2].[OneToOne_Optional_PK_Inverse2Id], [l3].[Id] AS [Id0] FROM [Level1] AS [l2] INNER JOIN [Level1] AS [l3] ON [l2].[Id] = [l3].[Id] - WHERE ([l2].[OneToOne_Required_PK_Date] IS NOT NULL AND [l2].[Level1_Required_Id] IS NOT NULL) AND [l2].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l2].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l2].[Level1_Required_Id] IS NOT NULL)) AND ([l2].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t0] ON [l].[Id] = [t0].[Level1_Optional_Id] LEFT JOIN ( SELECT [t2].[Id], [t2].[Level2_Optional_Id], [t2].[Level2_Required_Id], [t2].[Level3_Name], [t2].[OneToMany_Optional_Inverse3Id], [t2].[OneToMany_Required_Inverse3Id], [t2].[OneToOne_Optional_PK_Inverse3Id], [t2].[Id0], [t2].[Id00], [t2].[c] FROM ( SELECT [l4].[Id], [l4].[Level2_Optional_Id], [l4].[Level2_Required_Id], [l4].[Level3_Name], [l4].[OneToMany_Optional_Inverse3Id], [l4].[OneToMany_Required_Inverse3Id], [l4].[OneToOne_Optional_PK_Inverse3Id], [t3].[Id] AS [Id0], [t3].[Id0] AS [Id00], ROW_NUMBER() OVER(PARTITION BY [l4].[OneToMany_Optional_Inverse3Id] ORDER BY CASE - WHEN [l4].[Level2_Required_Id] IS NOT NULL AND [l4].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [l4].[Id] + WHEN ([l4].[Level2_Required_Id] IS NOT NULL) AND ([l4].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [l4].[Id] END) AS [row], CASE - WHEN [l4].[Level2_Required_Id] IS NOT NULL AND [l4].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [l4].[Id] + WHEN ([l4].[Level2_Required_Id] IS NOT NULL) AND ([l4].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [l4].[Id] END AS [c] FROM [Level1] AS [l4] INNER JOIN ( SELECT [l5].[Id], [l6].[Id] AS [Id0] FROM [Level1] AS [l5] INNER JOIN [Level1] AS [l6] ON [l5].[Id] = [l6].[Id] - WHERE ([l5].[OneToOne_Required_PK_Date] IS NOT NULL AND [l5].[Level1_Required_Id] IS NOT NULL) AND [l5].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l5].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l5].[Level1_Required_Id] IS NOT NULL)) AND ([l5].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t3] ON [l4].[Id] = [t3].[Id] - WHERE [l4].[Level2_Required_Id] IS NOT NULL AND [l4].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l4].[Level2_Required_Id] IS NOT NULL) AND ([l4].[OneToMany_Required_Inverse3Id] IS NOT NULL) ) AS [t2] WHERE [t2].[row] <= 3 ) AS [t1] ON CASE - WHEN ([t0].[OneToOne_Required_PK_Date] IS NOT NULL AND [t0].[Level1_Required_Id] IS NOT NULL) AND [t0].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t0].[Id] + WHEN (([t0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t0].[Level1_Required_Id] IS NOT NULL)) AND ([t0].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t0].[Id] END = [t1].[OneToMany_Optional_Inverse3Id] LEFT JOIN ( SELECT [l7].[Id], [l7].[Level2_Optional_Id], [l7].[Level2_Required_Id], [l7].[Level3_Name], [l7].[OneToMany_Optional_Inverse3Id], [l7].[OneToMany_Required_Inverse3Id], [l7].[OneToOne_Optional_PK_Inverse3Id], [t6].[Id] AS [Id0], [t6].[Level3_Optional_Id], [t6].[Level3_Required_Id], [t6].[Level4_Name], [t6].[OneToMany_Optional_Inverse4Id], [t6].[OneToMany_Required_Inverse4Id], [t6].[OneToOne_Optional_PK_Inverse4Id], [t5].[Id] AS [Id1], [t5].[Id0] AS [Id00], [t6].[Id0] AS [Id01], [t6].[Id00] AS [Id000], [t6].[Id000] AS [Id0000] @@ -2657,7 +2657,7 @@ INNER JOIN ( SELECT [l8].[Id], [l9].[Id] AS [Id0] FROM [Level1] AS [l8] INNER JOIN [Level1] AS [l9] ON [l8].[Id] = [l9].[Id] - WHERE ([l8].[OneToOne_Required_PK_Date] IS NOT NULL AND [l8].[Level1_Required_Id] IS NOT NULL) AND [l8].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l8].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l8].[Level1_Required_Id] IS NOT NULL)) AND ([l8].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t5] ON [l7].[Id] = [t5].[Id] LEFT JOIN ( SELECT [l10].[Id], [l10].[Level3_Optional_Id], [l10].[Level3_Required_Id], [l10].[Level4_Name], [l10].[OneToMany_Optional_Inverse4Id], [l10].[OneToMany_Required_Inverse4Id], [l10].[OneToOne_Optional_PK_Inverse4Id], [t7].[Id] AS [Id0], [t7].[Id0] AS [Id00], [t7].[Id00] AS [Id000] @@ -2669,22 +2669,22 @@ INNER JOIN ( SELECT [l12].[Id], [l13].[Id] AS [Id0] FROM [Level1] AS [l12] INNER JOIN [Level1] AS [l13] ON [l12].[Id] = [l13].[Id] - WHERE ([l12].[OneToOne_Required_PK_Date] IS NOT NULL AND [l12].[Level1_Required_Id] IS NOT NULL) AND [l12].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l12].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l12].[Level1_Required_Id] IS NOT NULL)) AND ([l12].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t8] ON [l11].[Id] = [t8].[Id] - WHERE [l11].[Level2_Required_Id] IS NOT NULL AND [l11].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l11].[Level2_Required_Id] IS NOT NULL) AND ([l11].[OneToMany_Required_Inverse3Id] IS NOT NULL) ) AS [t7] ON [l10].[Id] = [t7].[Id] - WHERE [l10].[Level3_Required_Id] IS NOT NULL AND [l10].[OneToMany_Required_Inverse4Id] IS NOT NULL + WHERE ([l10].[Level3_Required_Id] IS NOT NULL) AND ([l10].[OneToMany_Required_Inverse4Id] IS NOT NULL) ) AS [t6] ON CASE - WHEN [l7].[Level2_Required_Id] IS NOT NULL AND [l7].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [l7].[Id] + WHEN ([l7].[Level2_Required_Id] IS NOT NULL) AND ([l7].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [l7].[Id] END = [t6].[Level3_Optional_Id] - WHERE [l7].[Level2_Required_Id] IS NOT NULL AND [l7].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l7].[Level2_Required_Id] IS NOT NULL) AND ([l7].[OneToMany_Required_Inverse3Id] IS NOT NULL) ) AS [t4] ON CASE - WHEN ([t0].[OneToOne_Required_PK_Date] IS NOT NULL AND [t0].[Level1_Required_Id] IS NOT NULL) AND [t0].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t0].[Id] + WHEN (([t0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t0].[Level1_Required_Id] IS NOT NULL)) AND ([t0].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t0].[Id] END = [t4].[OneToMany_Required_Inverse3Id] WHERE (CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + WHEN (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] END < 3) OR (CASE - WHEN ([t0].[OneToOne_Required_PK_Date] IS NOT NULL AND [t0].[Level1_Required_Id] IS NOT NULL) AND [t0].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t0].[Id] + WHEN (([t0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t0].[Level1_Required_Id] IS NOT NULL)) AND ([t0].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t0].[Id] END > 8) ORDER BY [l].[Id], [t].[Id], [t].[Id0], [t0].[Id], [t0].[Id0], [t1].[OneToMany_Optional_Inverse3Id], [t1].[c], [t1].[Id], [t1].[Id0], [t1].[Id00], [t4].[Id], [t4].[Id1], [t4].[Id00], [t4].[Id0], [t4].[Id01], [t4].[Id000]"); } @@ -2700,7 +2700,7 @@ INNER JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Required_Id], [l0].[OneToMany_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l1].[Id] AS [Id0] FROM [Level1] AS [l0] INNER JOIN [Level1] AS [l1] ON [l0].[Id] = [l1].[Id] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL)) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t] ON [l].[Id] = [t].[OneToMany_Optional_Inverse2Id] INNER JOIN ( SELECT [l2].[Id], [l2].[Level2_Optional_Id], [l2].[Level2_Required_Id], [l2].[Level3_Name], [l2].[OneToMany_Optional_Inverse3Id], [l2].[OneToMany_Required_Inverse3Id], [l2].[OneToOne_Optional_PK_Inverse3Id], [t1].[Id] AS [Id0], [t1].[Id0] AS [Id00] @@ -2709,11 +2709,11 @@ INNER JOIN ( SELECT [l3].[Id], [l4].[Id] AS [Id0] FROM [Level1] AS [l3] INNER JOIN [Level1] AS [l4] ON [l3].[Id] = [l4].[Id] - WHERE ([l3].[OneToOne_Required_PK_Date] IS NOT NULL AND [l3].[Level1_Required_Id] IS NOT NULL) AND [l3].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l3].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l3].[Level1_Required_Id] IS NOT NULL)) AND ([l3].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t1] ON [l2].[Id] = [t1].[Id] - WHERE [l2].[Level2_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l2].[Level2_Required_Id] IS NOT NULL) AND ([l2].[OneToMany_Required_Inverse3Id] IS NOT NULL) ) AS [t0] ON CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + WHEN (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] END = [t0].[OneToMany_Optional_Inverse3Id] LEFT JOIN ( SELECT [l5].[Id], [l5].[Level3_Optional_Id], [l5].[Level3_Required_Id], [l5].[Level4_Name], [l5].[OneToMany_Optional_Inverse4Id], [l5].[OneToMany_Required_Inverse4Id], [l5].[OneToOne_Optional_PK_Inverse4Id], [t3].[Id] AS [Id0], [t3].[Id0] AS [Id00], [t3].[Id00] AS [Id000] @@ -2725,13 +2725,13 @@ INNER JOIN ( SELECT [l7].[Id], [l8].[Id] AS [Id0] FROM [Level1] AS [l7] INNER JOIN [Level1] AS [l8] ON [l7].[Id] = [l8].[Id] - WHERE ([l7].[OneToOne_Required_PK_Date] IS NOT NULL AND [l7].[Level1_Required_Id] IS NOT NULL) AND [l7].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l7].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l7].[Level1_Required_Id] IS NOT NULL)) AND ([l7].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t4] ON [l6].[Id] = [t4].[Id] - WHERE [l6].[Level2_Required_Id] IS NOT NULL AND [l6].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l6].[Level2_Required_Id] IS NOT NULL) AND ([l6].[OneToMany_Required_Inverse3Id] IS NOT NULL) ) AS [t3] ON [l5].[Id] = [t3].[Id] - WHERE [l5].[Level3_Required_Id] IS NOT NULL AND [l5].[OneToMany_Required_Inverse4Id] IS NOT NULL + WHERE ([l5].[Level3_Required_Id] IS NOT NULL) AND ([l5].[OneToMany_Required_Inverse4Id] IS NOT NULL) ) AS [t2] ON CASE - WHEN [t0].[Level2_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [t0].[Id] + WHEN ([t0].[Level2_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [t0].[Id] END = [t2].[Level3_Required_Id] LEFT JOIN ( SELECT [l9].[Id], [l9].[Level3_Optional_Id], [l9].[Level3_Required_Id], [l9].[Level4_Name], [l9].[OneToMany_Optional_Inverse4Id], [l9].[OneToMany_Required_Inverse4Id], [l9].[OneToOne_Optional_PK_Inverse4Id], [t6].[Id] AS [Id0], [t6].[Id0] AS [Id00], [t6].[Id00] AS [Id000] @@ -2743,13 +2743,13 @@ INNER JOIN ( SELECT [l11].[Id], [l12].[Id] AS [Id0] FROM [Level1] AS [l11] INNER JOIN [Level1] AS [l12] ON [l11].[Id] = [l12].[Id] - WHERE ([l11].[OneToOne_Required_PK_Date] IS NOT NULL AND [l11].[Level1_Required_Id] IS NOT NULL) AND [l11].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l11].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l11].[Level1_Required_Id] IS NOT NULL)) AND ([l11].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t7] ON [l10].[Id] = [t7].[Id] - WHERE [l10].[Level2_Required_Id] IS NOT NULL AND [l10].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l10].[Level2_Required_Id] IS NOT NULL) AND ([l10].[OneToMany_Required_Inverse3Id] IS NOT NULL) ) AS [t6] ON [l9].[Id] = [t6].[Id] - WHERE [l9].[Level3_Required_Id] IS NOT NULL AND [l9].[OneToMany_Required_Inverse4Id] IS NOT NULL + WHERE ([l9].[Level3_Required_Id] IS NOT NULL) AND ([l9].[OneToMany_Required_Inverse4Id] IS NOT NULL) ) AS [t5] ON CASE - WHEN [t0].[Level2_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [t0].[Id] + WHEN ([t0].[Level2_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [t0].[Id] END = [t5].[OneToMany_Optional_Inverse4Id] ORDER BY [l].[Id], [t].[Id], [t].[Id0], [t0].[Id], [t0].[Id0], [t0].[Id00], [t2].[Id], [t2].[Id0], [t2].[Id00], [t2].[Id000], [t5].[Id], [t5].[Id0], [t5].[Id00]"); } @@ -2769,7 +2769,7 @@ LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[Level2_Name], [l0].[OneToMany_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id], [l1].[Id] AS [Id0] FROM [Level1] AS [l0] INNER JOIN [Level1] AS [l1] ON [l0].[Id] = [l1].[Id] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL)) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t0] ON [t].[Id] = [t0].[OneToMany_Optional_Inverse2Id] ORDER BY [t].[Id], [t0].[Id]"); } @@ -2785,7 +2785,7 @@ INNER JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[Level2_Name], [l0].[OneToMany_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id], [l1].[Id] AS [Id0] FROM [Level1] AS [l0] INNER JOIN [Level1] AS [l1] ON [l0].[Id] = [l1].[Id] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL)) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t] ON [l].[Id] = [t].[OneToMany_Optional_Inverse2Id] LEFT JOIN ( SELECT [l2].[Id], [l2].[Level2_Optional_Id], [l2].[Level2_Required_Id], [l2].[Level3_Name], [l2].[OneToMany_Optional_Inverse3Id], [l2].[OneToMany_Required_Inverse3Id], [l2].[OneToOne_Optional_PK_Inverse3Id], [t1].[Id] AS [Id0], [t1].[Id0] AS [Id00] @@ -2794,11 +2794,11 @@ INNER JOIN ( SELECT [l3].[Id], [l4].[Id] AS [Id0] FROM [Level1] AS [l3] INNER JOIN [Level1] AS [l4] ON [l3].[Id] = [l4].[Id] - WHERE ([l3].[OneToOne_Required_PK_Date] IS NOT NULL AND [l3].[Level1_Required_Id] IS NOT NULL) AND [l3].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l3].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l3].[Level1_Required_Id] IS NOT NULL)) AND ([l3].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t1] ON [l2].[Id] = [t1].[Id] - WHERE [l2].[Level2_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l2].[Level2_Required_Id] IS NOT NULL) AND ([l2].[OneToMany_Required_Inverse3Id] IS NOT NULL) ) AS [t0] ON CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + WHEN (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] END = [t0].[OneToMany_Optional_Inverse3Id] ORDER BY [l].[Id], [t].[Id], [t].[Id0], [t0].[Id], [t0].[Id0]"); } @@ -2814,28 +2814,28 @@ LEFT JOIN ( SELECT [t].[c], [t].[Id], [t].[Id0], [t].[OneToOne_Required_PK_Date], [t].[Level1_Required_Id], [t].[OneToMany_Required_Inverse2Id], [t].[OneToMany_Optional_Inverse2Id] FROM ( SELECT 1 AS [c], [l0].[Id], [l1].[Id] AS [Id0], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Required_Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToMany_Optional_Inverse2Id], ROW_NUMBER() OVER(PARTITION BY [l0].[OneToMany_Optional_Inverse2Id] ORDER BY CASE - WHEN ([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [l0].[Id] + WHEN (([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL)) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [l0].[Id] END) AS [row] FROM [Level1] AS [l0] INNER JOIN [Level1] AS [l1] ON [l0].[Id] = [l1].[Id] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL)) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t] WHERE [t].[row] <= 1 ) AS [t0] ON [l].[Id] = [t0].[OneToMany_Optional_Inverse2Id] LEFT JOIN ( SELECT CASE - WHEN [l2].[Level2_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [l2].[Id] + WHEN ([l2].[Level2_Required_Id] IS NOT NULL) AND ([l2].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [l2].[Id] END AS [Id], [l2].[Id] AS [Id0], [t2].[Id] AS [Id1], [t2].[Id0] AS [Id00], [l2].[OneToMany_Optional_Inverse3Id] FROM [Level1] AS [l2] INNER JOIN ( SELECT [l3].[Id], [l4].[Id] AS [Id0] FROM [Level1] AS [l3] INNER JOIN [Level1] AS [l4] ON [l3].[Id] = [l4].[Id] - WHERE ([l3].[OneToOne_Required_PK_Date] IS NOT NULL AND [l3].[Level1_Required_Id] IS NOT NULL) AND [l3].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l3].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l3].[Level1_Required_Id] IS NOT NULL)) AND ([l3].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t2] ON [l2].[Id] = [t2].[Id] - WHERE [l2].[Level2_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l2].[Level2_Required_Id] IS NOT NULL) AND ([l2].[OneToMany_Required_Inverse3Id] IS NOT NULL) ) AS [t1] ON CASE - WHEN ([t0].[OneToOne_Required_PK_Date] IS NOT NULL AND [t0].[Level1_Required_Id] IS NOT NULL) AND [t0].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t0].[Id] + WHEN (([t0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t0].[Level1_Required_Id] IS NOT NULL)) AND ([t0].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t0].[Id] END = [t1].[OneToMany_Optional_Inverse3Id] ORDER BY [l].[Id], [t0].[Id], [t0].[Id0], [t1].[Id], [t1].[Id0], [t1].[Id1]"); } @@ -2851,7 +2851,7 @@ LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[Level2_Name], [l0].[OneToMany_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id], [l1].[Id] AS [Id0] FROM [Level1] AS [l0] INNER JOIN [Level1] AS [l1] ON [l0].[Id] = [l1].[Id] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL)) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t] ON [l].[Id] = [t].[OneToMany_Optional_Inverse2Id] ORDER BY [l].[Id], [t].[Level2_Name], [t].[Id]"); } @@ -2867,13 +2867,13 @@ OUTER APPLY ( SELECT [t].[Id], [t].[OneToOne_Required_PK_Date], [t].[Level1_Optional_Id], [t].[Level1_Required_Id], [t].[Level2_Name], [t].[OneToMany_Optional_Inverse2Id], [t].[OneToMany_Required_Inverse2Id], [t].[OneToOne_Optional_PK_Inverse2Id], [t].[Id0], [t0].[Id] AS [Id1], [t0].[Id0] AS [Id00], [t0].[Id00] AS [Id000], [t2].[Id] AS [Id2], [t2].[Level2_Optional_Id], [t2].[Level2_Required_Id], [t2].[Level3_Name], [t2].[OneToMany_Optional_Inverse3Id], [t2].[OneToMany_Required_Inverse3Id], [t2].[OneToOne_Optional_PK_Inverse3Id], [t2].[Id0] AS [Id01], [t2].[Id00] AS [Id001], [t0].[Level2_Optional_Id] AS [Level2_Optional_Id0], [t0].[Level2_Required_Id] AS [Level2_Required_Id0], [t0].[Level3_Name] AS [Level3_Name0], [t0].[OneToMany_Optional_Inverse3Id] AS [OneToMany_Optional_Inverse3Id0], [t0].[OneToMany_Required_Inverse3Id] AS [OneToMany_Required_Inverse3Id0], [t0].[OneToOne_Optional_PK_Inverse3Id] AS [OneToOne_Optional_PK_Inverse3Id0], [t].[c] FROM ( SELECT TOP(2) [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[Level2_Name], [l0].[OneToMany_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id], [l1].[Id] AS [Id0], CASE - WHEN ([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [l0].[Id] + WHEN (([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL)) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [l0].[Id] END AS [c] FROM [Level1] AS [l0] INNER JOIN [Level1] AS [l1] ON [l0].[Id] = [l1].[Id] - WHERE ((([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) AND ([l].[Id] = [l0].[OneToMany_Optional_Inverse2Id])) AND (([l0].[Level2_Name] <> N'Foo') OR [l0].[Level2_Name] IS NULL) + WHERE (((([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL)) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL)) AND ([l].[Id] = [l0].[OneToMany_Optional_Inverse2Id])) AND (([l0].[Level2_Name] <> N'Foo') OR ([l0].[Level2_Name] IS NULL)) ORDER BY CASE - WHEN ([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [l0].[Id] + WHEN (([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL)) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [l0].[Id] END ) AS [t] LEFT JOIN ( @@ -2883,11 +2883,11 @@ INNER JOIN ( SELECT [l3].[Id], [l4].[Id] AS [Id0] FROM [Level1] AS [l3] INNER JOIN [Level1] AS [l4] ON [l3].[Id] = [l4].[Id] - WHERE ([l3].[OneToOne_Required_PK_Date] IS NOT NULL AND [l3].[Level1_Required_Id] IS NOT NULL) AND [l3].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l3].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l3].[Level1_Required_Id] IS NOT NULL)) AND ([l3].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t1] ON [l2].[Id] = [t1].[Id] - WHERE [l2].[Level2_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l2].[Level2_Required_Id] IS NOT NULL) AND ([l2].[OneToMany_Required_Inverse3Id] IS NOT NULL) ) AS [t0] ON CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + WHEN (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] END = [t0].[Level2_Required_Id] LEFT JOIN ( SELECT [l5].[Id], [l5].[Level2_Optional_Id], [l5].[Level2_Required_Id], [l5].[Level3_Name], [l5].[OneToMany_Optional_Inverse3Id], [l5].[OneToMany_Required_Inverse3Id], [l5].[OneToOne_Optional_PK_Inverse3Id], [t3].[Id] AS [Id0], [t3].[Id0] AS [Id00] @@ -2896,11 +2896,11 @@ INNER JOIN ( SELECT [l6].[Id], [l7].[Id] AS [Id0] FROM [Level1] AS [l6] INNER JOIN [Level1] AS [l7] ON [l6].[Id] = [l7].[Id] - WHERE ([l6].[OneToOne_Required_PK_Date] IS NOT NULL AND [l6].[Level1_Required_Id] IS NOT NULL) AND [l6].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l6].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l6].[Level1_Required_Id] IS NOT NULL)) AND ([l6].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t3] ON [l5].[Id] = [t3].[Id] - WHERE [l5].[Level2_Required_Id] IS NOT NULL AND [l5].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l5].[Level2_Required_Id] IS NOT NULL) AND ([l5].[OneToMany_Required_Inverse3Id] IS NOT NULL) ) AS [t2] ON CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + WHEN (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] END = [t2].[OneToMany_Optional_Inverse3Id] ) AS [t4] ORDER BY [l].[Id], [t4].[c], [t4].[Id], [t4].[Id0], [t4].[Id1], [t4].[Id00], [t4].[Id000], [t4].[Id2], [t4].[Id01]"); @@ -2916,7 +2916,7 @@ public override async Task Include_collection_with_groupby_in_subquery_and_filte SELECT [l].[Name] FROM [Level1] AS [l] GROUP BY [l].[Name] - HAVING ([l].[Name] <> N'Foo') OR [l].[Name] IS NULL + HAVING ([l].[Name] <> N'Foo') OR ([l].[Name] IS NULL) ) AS [t] LEFT JOIN ( SELECT [t1].[Id], [t1].[Date], [t1].[Name] @@ -2930,7 +2930,7 @@ LEFT JOIN ( SELECT [l1].[Id], [l1].[OneToOne_Required_PK_Date], [l1].[Level1_Optional_Id], [l1].[Level1_Required_Id], [l1].[Level2_Name], [l1].[OneToMany_Optional_Inverse2Id], [l1].[OneToMany_Required_Inverse2Id], [l1].[OneToOne_Optional_PK_Inverse2Id], [l2].[Id] AS [Id0] FROM [Level1] AS [l1] INNER JOIN [Level1] AS [l2] ON [l1].[Id] = [l2].[Id] - WHERE ([l1].[OneToOne_Required_PK_Date] IS NOT NULL AND [l1].[Level1_Required_Id] IS NOT NULL) AND [l1].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l1].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l1].[Level1_Required_Id] IS NOT NULL)) AND ([l1].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t2] ON [t0].[Id] = [t2].[OneToMany_Optional_Inverse2Id] ORDER BY [t].[Name], [t0].[Id], [t2].[Id]"); } @@ -2948,13 +2948,13 @@ LEFT JOIN ( SELECT [t].[Id], [t].[OneToOne_Required_PK_Date], [t].[Level1_Optional_Id], [t].[Level1_Required_Id], [t].[Level2_Name], [t].[OneToMany_Optional_Inverse2Id], [t].[OneToMany_Required_Inverse2Id], [t].[OneToOne_Optional_PK_Inverse2Id], [t].[Id0], [t].[c] FROM ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[Level2_Name], [l0].[OneToMany_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id], [l1].[Id] AS [Id0], ROW_NUMBER() OVER(PARTITION BY [l0].[OneToMany_Optional_Inverse2Id] ORDER BY CASE - WHEN ([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [l0].[Id] + WHEN (([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL)) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [l0].[Id] END) AS [row], CASE - WHEN ([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [l0].[Id] + WHEN (([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL)) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [l0].[Id] END AS [c] FROM [Level1] AS [l0] INNER JOIN [Level1] AS [l1] ON [l0].[Id] = [l1].[Id] - WHERE (([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) AND (([l0].[Level2_Name] <> @__prm_0) OR [l0].[Level2_Name] IS NULL) + WHERE ((([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL)) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL)) AND (([l0].[Level2_Name] <> @__prm_0) OR ([l0].[Level2_Name] IS NULL)) ) AS [t] WHERE [t].[row] <= 3 ) AS [t0] ON [l].[Id] = [t0].[OneToMany_Optional_Inverse2Id] @@ -2979,13 +2979,13 @@ INNER JOIN ( SELECT [l3].[Id], [l4].[Id] AS [Id0] FROM [Level1] AS [l3] INNER JOIN [Level1] AS [l4] ON [l3].[Id] = [l4].[Id] - WHERE ([l3].[OneToOne_Required_PK_Date] IS NOT NULL AND [l3].[Level1_Required_Id] IS NOT NULL) AND [l3].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l3].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l3].[Level1_Required_Id] IS NOT NULL)) AND ([l3].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t] ON [l2].[Id] = [t].[Id] - WHERE [l2].[Level2_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l2].[Level2_Required_Id] IS NOT NULL) AND ([l2].[OneToMany_Required_Inverse3Id] IS NOT NULL) ) AS [t0] ON CASE - WHEN ([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [l0].[Id] + WHEN (([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL)) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [l0].[Id] END = [t0].[OneToMany_Optional_Inverse3Id] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL)) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t1] ON [l].[Id] = [t1].[OneToMany_Optional_Inverse2Id] ORDER BY [l].[Id], [t1].[Id], [t1].[Id0], [t1].[Level3_Name], [t1].[Id1], [t1].[Id00]"); } @@ -3003,13 +3003,13 @@ OUTER APPLY ( SELECT [t].[Id], [t].[OneToOne_Required_PK_Date], [t].[Level1_Optional_Id], [t].[Level1_Required_Id], [t].[Level2_Name], [t].[OneToMany_Optional_Inverse2Id], [t].[OneToMany_Required_Inverse2Id], [t].[OneToOne_Optional_PK_Inverse2Id], [t].[Id0], [t0].[Id] AS [Id1], [t0].[Id0] AS [Id00], [t0].[Id00] AS [Id000], [t2].[Id] AS [Id2], [t2].[Level2_Optional_Id], [t2].[Level2_Required_Id], [t2].[Level3_Name], [t2].[OneToMany_Optional_Inverse3Id], [t2].[OneToMany_Required_Inverse3Id], [t2].[OneToOne_Optional_PK_Inverse3Id], [t2].[Id0] AS [Id01], [t2].[Id00] AS [Id001], [t0].[Level2_Optional_Id] AS [Level2_Optional_Id0], [t0].[Level2_Required_Id] AS [Level2_Required_Id0], [t0].[Level3_Name] AS [Level3_Name0], [t0].[OneToMany_Optional_Inverse3Id] AS [OneToMany_Optional_Inverse3Id0], [t0].[OneToMany_Required_Inverse3Id] AS [OneToMany_Required_Inverse3Id0], [t0].[OneToOne_Optional_PK_Inverse3Id] AS [OneToOne_Optional_PK_Inverse3Id0], [t].[c] FROM ( SELECT TOP(2) [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[Level2_Name], [l0].[OneToMany_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id], [l1].[Id] AS [Id0], CASE - WHEN ([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [l0].[Id] + WHEN (([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL)) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [l0].[Id] END AS [c] FROM [Level1] AS [l0] INNER JOIN [Level1] AS [l1] ON [l0].[Id] = [l1].[Id] - WHERE ((([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) AND ([l].[Id] = [l0].[OneToMany_Optional_Inverse2Id])) AND (([l0].[Level2_Name] <> N'Foo') OR [l0].[Level2_Name] IS NULL) + WHERE (((([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL)) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL)) AND ([l].[Id] = [l0].[OneToMany_Optional_Inverse2Id])) AND (([l0].[Level2_Name] <> N'Foo') OR ([l0].[Level2_Name] IS NULL)) ORDER BY CASE - WHEN ([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [l0].[Id] + WHEN (([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL)) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [l0].[Id] END ) AS [t] LEFT JOIN ( @@ -3019,11 +3019,11 @@ INNER JOIN ( SELECT [l3].[Id], [l4].[Id] AS [Id0] FROM [Level1] AS [l3] INNER JOIN [Level1] AS [l4] ON [l3].[Id] = [l4].[Id] - WHERE ([l3].[OneToOne_Required_PK_Date] IS NOT NULL AND [l3].[Level1_Required_Id] IS NOT NULL) AND [l3].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l3].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l3].[Level1_Required_Id] IS NOT NULL)) AND ([l3].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t1] ON [l2].[Id] = [t1].[Id] - WHERE [l2].[Level2_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l2].[Level2_Required_Id] IS NOT NULL) AND ([l2].[OneToMany_Required_Inverse3Id] IS NOT NULL) ) AS [t0] ON CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + WHEN (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] END = [t0].[Level2_Required_Id] LEFT JOIN ( SELECT [l5].[Id], [l5].[Level2_Optional_Id], [l5].[Level2_Required_Id], [l5].[Level3_Name], [l5].[OneToMany_Optional_Inverse3Id], [l5].[OneToMany_Required_Inverse3Id], [l5].[OneToOne_Optional_PK_Inverse3Id], [t3].[Id] AS [Id0], [t3].[Id0] AS [Id00] @@ -3032,11 +3032,11 @@ INNER JOIN ( SELECT [l6].[Id], [l7].[Id] AS [Id0] FROM [Level1] AS [l6] INNER JOIN [Level1] AS [l7] ON [l6].[Id] = [l7].[Id] - WHERE ([l6].[OneToOne_Required_PK_Date] IS NOT NULL AND [l6].[Level1_Required_Id] IS NOT NULL) AND [l6].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l6].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l6].[Level1_Required_Id] IS NOT NULL)) AND ([l6].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t3] ON [l5].[Id] = [t3].[Id] - WHERE [l5].[Level2_Required_Id] IS NOT NULL AND [l5].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l5].[Level2_Required_Id] IS NOT NULL) AND ([l5].[OneToMany_Required_Inverse3Id] IS NOT NULL) ) AS [t2] ON CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + WHEN (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] END = [t2].[OneToMany_Optional_Inverse3Id] ) AS [t4] ORDER BY [l].[Id], [t4].[c], [t4].[Id], [t4].[Id0], [t4].[Id1], [t4].[Id00], [t4].[Id000], [t4].[Id2], [t4].[Id01]"); @@ -3055,7 +3055,7 @@ LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[Level2_Name], [l0].[OneToMany_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id], [l1].[Id] AS [Id0], ROW_NUMBER() OVER(PARTITION BY [l0].[OneToMany_Optional_Inverse2Id] ORDER BY [l0].[Id], [l1].[Id]) AS [row] FROM [Level1] AS [l0] INNER JOIN [Level1] AS [l1] ON [l0].[Id] = [l1].[Id] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL)) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t] WHERE 1 < [t].[row] ) AS [t0] ON [l].[Id] = [t0].[OneToMany_Optional_Inverse2Id] @@ -3102,11 +3102,11 @@ INNER JOIN ( SELECT [l3].[Id], [l4].[Id] AS [Id0] FROM [Level1] AS [l3] INNER JOIN [Level1] AS [l4] ON [l3].[Id] = [l4].[Id] - WHERE ([l3].[OneToOne_Required_PK_Date] IS NOT NULL AND [l3].[Level1_Required_Id] IS NOT NULL) AND [l3].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l3].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l3].[Level1_Required_Id] IS NOT NULL)) AND ([l3].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t] ON [l2].[Id] = [t].[Id] - WHERE [l2].[Level2_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l2].[Level2_Required_Id] IS NOT NULL) AND ([l2].[OneToMany_Required_Inverse3Id] IS NOT NULL) ) AS [t0] ON CASE - WHEN ([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [l0].[Id] + WHEN (([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL)) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [l0].[Id] END = [t0].[OneToOne_Optional_PK_Inverse3Id] LEFT JOIN ( SELECT [l5].[Id], [l5].[Level3_Optional_Id], [l5].[Level3_Required_Id], [l5].[Level4_Name], [l5].[OneToMany_Optional_Inverse4Id], [l5].[OneToMany_Required_Inverse4Id], [l5].[OneToOne_Optional_PK_Inverse4Id], [t2].[Id] AS [Id0], [t2].[Id0] AS [Id00], [t2].[Id00] AS [Id000] @@ -3118,13 +3118,13 @@ INNER JOIN ( SELECT [l7].[Id], [l8].[Id] AS [Id0] FROM [Level1] AS [l7] INNER JOIN [Level1] AS [l8] ON [l7].[Id] = [l8].[Id] - WHERE ([l7].[OneToOne_Required_PK_Date] IS NOT NULL AND [l7].[Level1_Required_Id] IS NOT NULL) AND [l7].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l7].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l7].[Level1_Required_Id] IS NOT NULL)) AND ([l7].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t3] ON [l6].[Id] = [t3].[Id] - WHERE [l6].[Level2_Required_Id] IS NOT NULL AND [l6].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l6].[Level2_Required_Id] IS NOT NULL) AND ([l6].[OneToMany_Required_Inverse3Id] IS NOT NULL) ) AS [t2] ON [l5].[Id] = [t2].[Id] - WHERE [l5].[Level3_Required_Id] IS NOT NULL AND [l5].[OneToMany_Required_Inverse4Id] IS NOT NULL + WHERE ([l5].[Level3_Required_Id] IS NOT NULL) AND ([l5].[OneToMany_Required_Inverse4Id] IS NOT NULL) ) AS [t1] ON CASE - WHEN [t0].[Level2_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [t0].[Id] + WHEN ([t0].[Level2_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [t0].[Id] END = [t1].[Level3_Optional_Id] LEFT JOIN ( SELECT [l9].[Id], [l9].[Level2_Optional_Id], [l9].[Level2_Required_Id], [l9].[Level3_Name], [l9].[OneToMany_Optional_Inverse3Id], [l9].[OneToMany_Required_Inverse3Id], [l9].[OneToOne_Optional_PK_Inverse3Id], [t5].[Id] AS [Id0], [t5].[Id0] AS [Id00] @@ -3133,11 +3133,11 @@ INNER JOIN ( SELECT [l10].[Id], [l11].[Id] AS [Id0] FROM [Level1] AS [l10] INNER JOIN [Level1] AS [l11] ON [l10].[Id] = [l11].[Id] - WHERE ([l10].[OneToOne_Required_PK_Date] IS NOT NULL AND [l10].[Level1_Required_Id] IS NOT NULL) AND [l10].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l10].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l10].[Level1_Required_Id] IS NOT NULL)) AND ([l10].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t5] ON [l9].[Id] = [t5].[Id] - WHERE [l9].[Level2_Required_Id] IS NOT NULL AND [l9].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l9].[Level2_Required_Id] IS NOT NULL) AND ([l9].[OneToMany_Required_Inverse3Id] IS NOT NULL) ) AS [t4] ON CASE - WHEN ([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [l0].[Id] + WHEN (([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL)) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [l0].[Id] END = [t4].[Level2_Optional_Id] LEFT JOIN ( SELECT [l12].[Id], [l12].[Level3_Optional_Id], [l12].[Level3_Required_Id], [l12].[Level4_Name], [l12].[OneToMany_Optional_Inverse4Id], [l12].[OneToMany_Required_Inverse4Id], [l12].[OneToOne_Optional_PK_Inverse4Id], [t7].[Id] AS [Id0], [t7].[Id0] AS [Id00], [t7].[Id00] AS [Id000] @@ -3149,15 +3149,15 @@ INNER JOIN ( SELECT [l14].[Id], [l15].[Id] AS [Id0] FROM [Level1] AS [l14] INNER JOIN [Level1] AS [l15] ON [l14].[Id] = [l15].[Id] - WHERE ([l14].[OneToOne_Required_PK_Date] IS NOT NULL AND [l14].[Level1_Required_Id] IS NOT NULL) AND [l14].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l14].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l14].[Level1_Required_Id] IS NOT NULL)) AND ([l14].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t8] ON [l13].[Id] = [t8].[Id] - WHERE [l13].[Level2_Required_Id] IS NOT NULL AND [l13].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l13].[Level2_Required_Id] IS NOT NULL) AND ([l13].[OneToMany_Required_Inverse3Id] IS NOT NULL) ) AS [t7] ON [l12].[Id] = [t7].[Id] - WHERE [l12].[Level3_Required_Id] IS NOT NULL AND [l12].[OneToMany_Required_Inverse4Id] IS NOT NULL + WHERE ([l12].[Level3_Required_Id] IS NOT NULL) AND ([l12].[OneToMany_Required_Inverse4Id] IS NOT NULL) ) AS [t6] ON CASE - WHEN [t4].[Level2_Required_Id] IS NOT NULL AND [t4].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [t4].[Id] + WHEN ([t4].[Level2_Required_Id] IS NOT NULL) AND ([t4].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [t4].[Id] END = [t6].[OneToMany_Optional_Inverse4Id] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL)) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t9] ON [l].[Id] = [t9].[OneToMany_Optional_Inverse2Id] ORDER BY [l].[Id], [t9].[Id], [t9].[Id3], [t9].[Id0], [t9].[Id00], [t9].[Id000], [t9].[Id1], [t9].[Id01], [t9].[Id001], [t9].[Id0000], [t9].[Id2], [t9].[Id02], [t9].[Id002], [t9].[Id4], [t9].[Id03], [t9].[Id003]"); } @@ -3175,7 +3175,7 @@ LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[Level2_Name], [l0].[OneToMany_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id], [l1].[Id] AS [Id0], ROW_NUMBER() OVER(PARTITION BY [l0].[OneToMany_Optional_Inverse2Id] ORDER BY [l0].[Id], [l1].[Id]) AS [row] FROM [Level1] AS [l0] INNER JOIN [Level1] AS [l1] ON [l0].[Id] = [l1].[Id] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL)) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t] WHERE [t].[row] <= 50 ) AS [t0] ON [l].[Id] = [t0].[OneToMany_Optional_Inverse2Id] @@ -3193,7 +3193,7 @@ LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[Level2_Name], [l0].[OneToMany_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id], [l1].[Id] AS [Id0] FROM [Level1] AS [l0] INNER JOIN [Level1] AS [l1] ON [l0].[Id] = [l1].[Id] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL)) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t] ON [l].[Id] = [t].[Level1_Optional_Id] LEFT JOIN ( SELECT [l2].[Id], [l2].[Level2_Optional_Id], [l2].[Level2_Required_Id], [l2].[Level3_Name], [l2].[OneToMany_Optional_Inverse3Id], [l2].[OneToMany_Required_Inverse3Id], [l2].[OneToOne_Optional_PK_Inverse3Id], [t1].[Id] AS [Id0], [t1].[Level3_Optional_Id], [t1].[Level3_Required_Id], [t1].[Level4_Name], [t1].[OneToMany_Optional_Inverse4Id], [t1].[OneToMany_Required_Inverse4Id], [t1].[OneToOne_Optional_PK_Inverse4Id], [t0].[Id] AS [Id1], [t0].[Id0] AS [Id00], [t1].[Id0] AS [Id01], [t1].[Id00] AS [Id000], [t1].[Id000] AS [Id0000] @@ -3202,7 +3202,7 @@ INNER JOIN ( SELECT [l3].[Id], [l4].[Id] AS [Id0] FROM [Level1] AS [l3] INNER JOIN [Level1] AS [l4] ON [l3].[Id] = [l4].[Id] - WHERE ([l3].[OneToOne_Required_PK_Date] IS NOT NULL AND [l3].[Level1_Required_Id] IS NOT NULL) AND [l3].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l3].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l3].[Level1_Required_Id] IS NOT NULL)) AND ([l3].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t0] ON [l2].[Id] = [t0].[Id] LEFT JOIN ( SELECT [l5].[Id], [l5].[Level3_Optional_Id], [l5].[Level3_Required_Id], [l5].[Level4_Name], [l5].[OneToMany_Optional_Inverse4Id], [l5].[OneToMany_Required_Inverse4Id], [l5].[OneToOne_Optional_PK_Inverse4Id], [t2].[Id] AS [Id0], [t2].[Id0] AS [Id00], [t2].[Id00] AS [Id000] @@ -3214,17 +3214,17 @@ INNER JOIN ( SELECT [l7].[Id], [l8].[Id] AS [Id0] FROM [Level1] AS [l7] INNER JOIN [Level1] AS [l8] ON [l7].[Id] = [l8].[Id] - WHERE ([l7].[OneToOne_Required_PK_Date] IS NOT NULL AND [l7].[Level1_Required_Id] IS NOT NULL) AND [l7].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l7].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l7].[Level1_Required_Id] IS NOT NULL)) AND ([l7].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t4] ON [l6].[Id] = [t4].[Id] - WHERE [l6].[Level2_Required_Id] IS NOT NULL AND [l6].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l6].[Level2_Required_Id] IS NOT NULL) AND ([l6].[OneToMany_Required_Inverse3Id] IS NOT NULL) ) AS [t2] ON [l5].[Id] = [t2].[Id] - WHERE [l5].[Level3_Required_Id] IS NOT NULL AND [l5].[OneToMany_Required_Inverse4Id] IS NOT NULL + WHERE ([l5].[Level3_Required_Id] IS NOT NULL) AND ([l5].[OneToMany_Required_Inverse4Id] IS NOT NULL) ) AS [t1] ON CASE - WHEN [l2].[Level2_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [l2].[Id] + WHEN ([l2].[Level2_Required_Id] IS NOT NULL) AND ([l2].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [l2].[Id] END = [t1].[Level3_Optional_Id] - WHERE [l2].[Level2_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l2].[Level2_Required_Id] IS NOT NULL) AND ([l2].[OneToMany_Required_Inverse3Id] IS NOT NULL) ) AS [t3] ON CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + WHEN (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] END = [t3].[OneToMany_Optional_Inverse3Id] ORDER BY [l].[Id], [t].[Id], [t].[Id0], [t3].[Id], [t3].[Id1], [t3].[Id00], [t3].[Id0], [t3].[Id01], [t3].[Id000]"); } @@ -3240,7 +3240,7 @@ LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[Level2_Name], [l0].[OneToMany_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id], [l1].[Id] AS [Id0] FROM [Level1] AS [l0] INNER JOIN [Level1] AS [l1] ON [l0].[Id] = [l1].[Id] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL)) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t] ON [l].[Id] = [t].[Level1_Required_Id] LEFT JOIN ( SELECT [l2].[Id], [l2].[Level2_Optional_Id], [l2].[Level2_Required_Id], [l2].[Level3_Name], [l2].[OneToMany_Optional_Inverse3Id], [l2].[OneToMany_Required_Inverse3Id], [l2].[OneToOne_Optional_PK_Inverse3Id], [t1].[Id] AS [Id0], [t1].[Id0] AS [Id00] @@ -3249,17 +3249,17 @@ INNER JOIN ( SELECT [l3].[Id], [l4].[Id] AS [Id0] FROM [Level1] AS [l3] INNER JOIN [Level1] AS [l4] ON [l3].[Id] = [l4].[Id] - WHERE ([l3].[OneToOne_Required_PK_Date] IS NOT NULL AND [l3].[Level1_Required_Id] IS NOT NULL) AND [l3].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l3].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l3].[Level1_Required_Id] IS NOT NULL)) AND ([l3].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t1] ON [l2].[Id] = [t1].[Id] - WHERE [l2].[Level2_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l2].[Level2_Required_Id] IS NOT NULL) AND ([l2].[OneToMany_Required_Inverse3Id] IS NOT NULL) ) AS [t0] ON CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + WHEN (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] END = [t0].[Level2_Optional_Id] LEFT JOIN ( SELECT [l5].[Id], [l5].[OneToOne_Required_PK_Date], [l5].[Level1_Optional_Id], [l5].[Level1_Required_Id], [l5].[Level2_Name], [l5].[OneToMany_Optional_Inverse2Id], [l5].[OneToMany_Required_Inverse2Id], [l5].[OneToOne_Optional_PK_Inverse2Id], [l6].[Id] AS [Id0] FROM [Level1] AS [l5] INNER JOIN [Level1] AS [l6] ON [l5].[Id] = [l6].[Id] - WHERE ([l5].[OneToOne_Required_PK_Date] IS NOT NULL AND [l5].[Level1_Required_Id] IS NOT NULL) AND [l5].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l5].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l5].[Level1_Required_Id] IS NOT NULL)) AND ([l5].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t2] ON [l].[Id] = [t2].[OneToMany_Required_Inverse2Id] ORDER BY [l].[Id], [t].[Id], [t].[Id0], [t0].[Id], [t0].[Id0], [t0].[Id00], [t2].[Id]"); } @@ -3275,7 +3275,7 @@ LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[Level2_Name], [l0].[OneToMany_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id], [l1].[Id] AS [Id0] FROM [Level1] AS [l0] INNER JOIN [Level1] AS [l1] ON [l0].[Id] = [l1].[Id] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL)) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t] ON [l].[Id] = [t].[Level1_Optional_Id] LEFT JOIN ( SELECT [l2].[Id], [l2].[Level2_Optional_Id], [l2].[Level2_Required_Id], [l2].[Level3_Name], [l2].[OneToMany_Optional_Inverse3Id], [l2].[OneToMany_Required_Inverse3Id], [l2].[OneToOne_Optional_PK_Inverse3Id], [t1].[Id] AS [Id0], [t1].[Id0] AS [Id00] @@ -3284,11 +3284,11 @@ INNER JOIN ( SELECT [l3].[Id], [l4].[Id] AS [Id0] FROM [Level1] AS [l3] INNER JOIN [Level1] AS [l4] ON [l3].[Id] = [l4].[Id] - WHERE ([l3].[OneToOne_Required_PK_Date] IS NOT NULL AND [l3].[Level1_Required_Id] IS NOT NULL) AND [l3].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l3].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l3].[Level1_Required_Id] IS NOT NULL)) AND ([l3].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t1] ON [l2].[Id] = [t1].[Id] - WHERE [l2].[Level2_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l2].[Level2_Required_Id] IS NOT NULL) AND ([l2].[OneToMany_Required_Inverse3Id] IS NOT NULL) ) AS [t0] ON CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + WHEN (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] END = [t0].[OneToMany_Optional_Inverse3Id] ORDER BY [t].[Level2_Name], [l].[Id], [t].[Id], [t].[Id0], [t0].[Id], [t0].[Id0]"); } @@ -3304,13 +3304,13 @@ LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Required_Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id], [l1].[Id] AS [Id0] FROM [Level1] AS [l0] INNER JOIN [Level1] AS [l1] ON [l0].[Id] = [l1].[Id] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL)) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t] ON [l].[Id] = [t].[OneToOne_Optional_PK_Inverse2Id] LEFT JOIN ( SELECT [l2].[Id], [l2].[OneToOne_Required_PK_Date], [l2].[Level1_Optional_Id], [l2].[Level1_Required_Id], [l2].[Level2_Name], [l2].[OneToMany_Optional_Inverse2Id], [l2].[OneToMany_Required_Inverse2Id], [l2].[OneToOne_Optional_PK_Inverse2Id], [l3].[Id] AS [Id0] FROM [Level1] AS [l2] INNER JOIN [Level1] AS [l3] ON [l2].[Id] = [l3].[Id] - WHERE ([l2].[OneToOne_Required_PK_Date] IS NOT NULL AND [l2].[Level1_Required_Id] IS NOT NULL) AND [l2].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l2].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l2].[Level1_Required_Id] IS NOT NULL)) AND ([l2].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t0] ON [l].[Id] = [t0].[Level1_Optional_Id] LEFT JOIN ( SELECT [l4].[Id], [l4].[Level2_Optional_Id], [l4].[Level2_Required_Id], [l4].[Level3_Name], [l4].[OneToMany_Optional_Inverse3Id], [l4].[OneToMany_Required_Inverse3Id], [l4].[OneToOne_Optional_PK_Inverse3Id], [t2].[Id] AS [Id0], [t2].[Level3_Optional_Id], [t2].[Level3_Required_Id], [t2].[Level4_Name], [t2].[OneToMany_Optional_Inverse4Id], [t2].[OneToMany_Required_Inverse4Id], [t2].[OneToOne_Optional_PK_Inverse4Id], [t1].[Id] AS [Id1], [t1].[Id0] AS [Id00], [t2].[Id0] AS [Id01], [t2].[Id00] AS [Id000], [t2].[Id000] AS [Id0000] @@ -3319,7 +3319,7 @@ INNER JOIN ( SELECT [l5].[Id], [l6].[Id] AS [Id0] FROM [Level1] AS [l5] INNER JOIN [Level1] AS [l6] ON [l5].[Id] = [l6].[Id] - WHERE ([l5].[OneToOne_Required_PK_Date] IS NOT NULL AND [l5].[Level1_Required_Id] IS NOT NULL) AND [l5].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l5].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l5].[Level1_Required_Id] IS NOT NULL)) AND ([l5].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t1] ON [l4].[Id] = [t1].[Id] LEFT JOIN ( SELECT [l7].[Id], [l7].[Level3_Optional_Id], [l7].[Level3_Required_Id], [l7].[Level4_Name], [l7].[OneToMany_Optional_Inverse4Id], [l7].[OneToMany_Required_Inverse4Id], [l7].[OneToOne_Optional_PK_Inverse4Id], [t4].[Id] AS [Id0], [t4].[Id0] AS [Id00], [t4].[Id00] AS [Id000] @@ -3331,22 +3331,22 @@ INNER JOIN ( SELECT [l9].[Id], [l10].[Id] AS [Id0] FROM [Level1] AS [l9] INNER JOIN [Level1] AS [l10] ON [l9].[Id] = [l10].[Id] - WHERE ([l9].[OneToOne_Required_PK_Date] IS NOT NULL AND [l9].[Level1_Required_Id] IS NOT NULL) AND [l9].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l9].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l9].[Level1_Required_Id] IS NOT NULL)) AND ([l9].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t5] ON [l8].[Id] = [t5].[Id] - WHERE [l8].[Level2_Required_Id] IS NOT NULL AND [l8].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l8].[Level2_Required_Id] IS NOT NULL) AND ([l8].[OneToMany_Required_Inverse3Id] IS NOT NULL) ) AS [t4] ON [l7].[Id] = [t4].[Id] - WHERE [l7].[Level3_Required_Id] IS NOT NULL AND [l7].[OneToMany_Required_Inverse4Id] IS NOT NULL + WHERE ([l7].[Level3_Required_Id] IS NOT NULL) AND ([l7].[OneToMany_Required_Inverse4Id] IS NOT NULL) ) AS [t2] ON CASE - WHEN [l4].[Level2_Required_Id] IS NOT NULL AND [l4].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [l4].[Id] + WHEN ([l4].[Level2_Required_Id] IS NOT NULL) AND ([l4].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [l4].[Id] END = [t2].[Level3_Optional_Id] - WHERE [l4].[Level2_Required_Id] IS NOT NULL AND [l4].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l4].[Level2_Required_Id] IS NOT NULL) AND ([l4].[OneToMany_Required_Inverse3Id] IS NOT NULL) ) AS [t3] ON CASE - WHEN ([t0].[OneToOne_Required_PK_Date] IS NOT NULL AND [t0].[Level1_Required_Id] IS NOT NULL) AND [t0].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t0].[Id] + WHEN (([t0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t0].[Level1_Required_Id] IS NOT NULL)) AND ([t0].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t0].[Id] END = [t3].[OneToMany_Optional_Inverse3Id] WHERE (CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + WHEN (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] END < 3) OR (CASE - WHEN ([t0].[OneToOne_Required_PK_Date] IS NOT NULL AND [t0].[Level1_Required_Id] IS NOT NULL) AND [t0].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t0].[Id] + WHEN (([t0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t0].[Level1_Required_Id] IS NOT NULL)) AND ([t0].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t0].[Id] END > 8) ORDER BY [l].[Id], [t].[Id], [t].[Id0], [t0].[Id], [t0].[Id0], [t3].[Id], [t3].[Id1], [t3].[Id00], [t3].[Id0], [t3].[Id01], [t3].[Id000]"); } @@ -3369,11 +3369,11 @@ INNER JOIN ( SELECT [l8].[Id], [l9].[Id] AS [Id0] FROM [Level1] AS [l8] INNER JOIN [Level1] AS [l9] ON [l8].[Id] = [l9].[Id] - WHERE ([l8].[OneToOne_Required_PK_Date] IS NOT NULL AND [l8].[Level1_Required_Id] IS NOT NULL) AND [l8].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l8].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l8].[Level1_Required_Id] IS NOT NULL)) AND ([l8].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t3] ON [l7].[Id] = [t3].[Id] - WHERE [l7].[Level2_Required_Id] IS NOT NULL AND [l7].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l7].[Level2_Required_Id] IS NOT NULL) AND ([l7].[OneToMany_Required_Inverse3Id] IS NOT NULL) ) AS [t1] ON CASE - WHEN ([l5].[OneToOne_Required_PK_Date] IS NOT NULL AND [l5].[Level1_Required_Id] IS NOT NULL) AND [l5].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [l5].[Id] + WHEN (([l5].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l5].[Level1_Required_Id] IS NOT NULL)) AND ([l5].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [l5].[Id] END = [t1].[OneToOne_Optional_PK_Inverse3Id] LEFT JOIN ( SELECT [l10].[Id], [l10].[Level3_Optional_Id], [l10].[Level3_Required_Id], [l10].[Level4_Name], [l10].[OneToMany_Optional_Inverse4Id], [l10].[OneToMany_Required_Inverse4Id], [l10].[OneToOne_Optional_PK_Inverse4Id], [t5].[Id] AS [Id0], [t5].[Id0] AS [Id00], [t5].[Id00] AS [Id000] @@ -3385,15 +3385,15 @@ INNER JOIN ( SELECT [l12].[Id], [l13].[Id] AS [Id0] FROM [Level1] AS [l12] INNER JOIN [Level1] AS [l13] ON [l12].[Id] = [l13].[Id] - WHERE ([l12].[OneToOne_Required_PK_Date] IS NOT NULL AND [l12].[Level1_Required_Id] IS NOT NULL) AND [l12].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l12].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l12].[Level1_Required_Id] IS NOT NULL)) AND ([l12].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t6] ON [l11].[Id] = [t6].[Id] - WHERE [l11].[Level2_Required_Id] IS NOT NULL AND [l11].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l11].[Level2_Required_Id] IS NOT NULL) AND ([l11].[OneToMany_Required_Inverse3Id] IS NOT NULL) ) AS [t5] ON [l10].[Id] = [t5].[Id] - WHERE [l10].[Level3_Required_Id] IS NOT NULL AND [l10].[OneToMany_Required_Inverse4Id] IS NOT NULL + WHERE ([l10].[Level3_Required_Id] IS NOT NULL) AND ([l10].[OneToMany_Required_Inverse4Id] IS NOT NULL) ) AS [t2] ON CASE - WHEN [t1].[Level2_Required_Id] IS NOT NULL AND [t1].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [t1].[Id] + WHEN ([t1].[Level2_Required_Id] IS NOT NULL) AND ([t1].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [t1].[Id] END = [t2].[Level3_Optional_Id] - WHERE ([l5].[OneToOne_Required_PK_Date] IS NOT NULL AND [l5].[Level1_Required_Id] IS NOT NULL) AND [l5].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l5].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l5].[Level1_Required_Id] IS NOT NULL)) AND ([l5].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t4] ON [l].[Id] = [t4].[OneToMany_Optional_Inverse2Id] WHERE ( SELECT COUNT(*) @@ -3406,13 +3406,13 @@ INNER JOIN ( SELECT [l3].[Id], [l3].[OneToOne_Required_PK_Date], [l3].[Level1_Optional_Id], [l3].[Level1_Required_Id], [l3].[Level2_Name], [l3].[OneToMany_Optional_Inverse2Id], [l3].[OneToMany_Required_Inverse2Id], [l3].[OneToOne_Optional_PK_Inverse2Id], [l4].[Id] AS [Id0] FROM [Level1] AS [l3] INNER JOIN [Level1] AS [l4] ON [l3].[Id] = [l4].[Id] - WHERE ([l3].[OneToOne_Required_PK_Date] IS NOT NULL AND [l3].[Level1_Required_Id] IS NOT NULL) AND [l3].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l3].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l3].[Level1_Required_Id] IS NOT NULL)) AND ([l3].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t] ON [l2].[Id] = [t].[Id] - WHERE [l2].[Level2_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l2].[Level2_Required_Id] IS NOT NULL) AND ([l2].[OneToMany_Required_Inverse3Id] IS NOT NULL) ) AS [t0] ON CASE - WHEN ([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [l0].[Id] + WHEN (([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL)) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [l0].[Id] END = [t0].[OneToOne_Optional_PK_Inverse3Id] - WHERE ((([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) AND ([l].[Id] = [l0].[OneToMany_Optional_Inverse2Id])) AND (([t0].[Level3_Name] <> N'Foo') OR [t0].[Level3_Name] IS NULL)) > 0 + WHERE (((([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL)) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL)) AND ([l].[Id] = [l0].[OneToMany_Optional_Inverse2Id])) AND (([t0].[Level3_Name] <> N'Foo') OR ([t0].[Level3_Name] IS NULL))) > 0 ORDER BY [l].[Id], [t4].[Id], [t4].[Id2], [t4].[Id0], [t4].[Id00], [t4].[Id000], [t4].[Id1], [t4].[Id01], [t4].[Id001]"); } @@ -3427,7 +3427,7 @@ LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[Level2_Name], [l0].[OneToMany_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id], [l1].[Id] AS [Id0] FROM [Level1] AS [l0] INNER JOIN [Level1] AS [l1] ON [l0].[Id] = [l1].[Id] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL)) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t] ON [l].[Id] = [t].[OneToMany_Optional_Inverse2Id] ORDER BY [l].[Id], [t].[Id]"); } @@ -3438,8 +3438,8 @@ public override async Task LeftJoin_with_Any_on_outer_source_and_projecting_coll AssertSql( @"SELECT CASE - WHEN ([t0].[OneToOne_Required_PK_Date] IS NULL OR [t0].[Level1_Required_Id] IS NULL) OR [t0].[OneToMany_Required_Inverse2Id] IS NULL THEN 0 - WHEN ([t0].[OneToOne_Required_PK_Date] IS NOT NULL AND [t0].[Level1_Required_Id] IS NOT NULL) AND [t0].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t0].[Id0] + WHEN (([t0].[OneToOne_Required_PK_Date] IS NULL) OR ([t0].[Level1_Required_Id] IS NULL)) OR ([t0].[OneToMany_Required_Inverse2Id] IS NULL) THEN 0 + WHEN (([t0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t0].[Level1_Required_Id] IS NOT NULL)) AND ([t0].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t0].[Id0] END, [l].[Id], [t0].[Id], [t0].[Id0], [t0].[Id00], [t1].[Id], [t1].[Level2_Optional_Id], [t1].[Level2_Required_Id], [t1].[Level3_Name], [t1].[OneToMany_Optional_Inverse3Id], [t1].[OneToMany_Required_Inverse3Id], [t1].[OneToOne_Optional_PK_Inverse3Id], [t1].[Id0], [t1].[Id00] FROM [Level1] AS [l] LEFT JOIN ( @@ -3449,11 +3449,11 @@ LEFT JOIN ( SELECT [l1].[Id], [l1].[OneToOne_Required_PK_Date], [l1].[Level1_Required_Id], [l1].[OneToMany_Required_Inverse2Id], [l2].[Id] AS [Id0] FROM [Level1] AS [l1] INNER JOIN [Level1] AS [l2] ON [l1].[Id] = [l2].[Id] - WHERE ([l1].[OneToOne_Required_PK_Date] IS NOT NULL AND [l1].[Level1_Required_Id] IS NOT NULL) AND [l1].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l1].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l1].[Level1_Required_Id] IS NOT NULL)) AND ([l1].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t] ON [l0].[Id] = CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + WHEN (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] END - WHERE ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t0] ON [l].[Id] = [t0].[Level1_Required_Id] LEFT JOIN ( SELECT [l3].[Id], [l3].[Level2_Optional_Id], [l3].[Level2_Required_Id], [l3].[Level3_Name], [l3].[OneToMany_Optional_Inverse3Id], [l3].[OneToMany_Required_Inverse3Id], [l3].[OneToOne_Optional_PK_Inverse3Id], [t2].[Id] AS [Id0], [t2].[Id0] AS [Id00] @@ -3462,11 +3462,11 @@ INNER JOIN ( SELECT [l4].[Id], [l5].[Id] AS [Id0] FROM [Level1] AS [l4] INNER JOIN [Level1] AS [l5] ON [l4].[Id] = [l5].[Id] - WHERE ([l4].[OneToOne_Required_PK_Date] IS NOT NULL AND [l4].[Level1_Required_Id] IS NOT NULL) AND [l4].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l4].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l4].[Level1_Required_Id] IS NOT NULL)) AND ([l4].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t2] ON [l3].[Id] = [t2].[Id] - WHERE [l3].[Level2_Required_Id] IS NOT NULL AND [l3].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l3].[Level2_Required_Id] IS NOT NULL) AND ([l3].[OneToMany_Required_Inverse3Id] IS NOT NULL) ) AS [t1] ON CASE - WHEN ([t0].[OneToOne_Required_PK_Date] IS NOT NULL AND [t0].[Level1_Required_Id] IS NOT NULL) AND [t0].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t0].[Id0] + WHEN (([t0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t0].[Level1_Required_Id] IS NOT NULL)) AND ([t0].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t0].[Id0] END = [t1].[OneToMany_Required_Inverse3Id] WHERE [l].[Name] IN (N'L1 01', N'L1 02') ORDER BY [l].[Id], [t0].[Id], [t0].[Id0], [t0].[Id00], [t1].[Id], [t1].[Id0]"); @@ -3490,13 +3490,13 @@ INNER JOIN ( SELECT [l3].[Id], [l4].[Id] AS [Id0] FROM [Level1] AS [l3] INNER JOIN [Level1] AS [l4] ON [l3].[Id] = [l4].[Id] - WHERE ([l3].[OneToOne_Required_PK_Date] IS NOT NULL AND [l3].[Level1_Required_Id] IS NOT NULL) AND [l3].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l3].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l3].[Level1_Required_Id] IS NOT NULL)) AND ([l3].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t] ON [l2].[Id] = [t].[Id] - WHERE [l2].[Level2_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l2].[Level2_Required_Id] IS NOT NULL) AND ([l2].[OneToMany_Required_Inverse3Id] IS NOT NULL) ) AS [t0] ON CASE - WHEN ([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [l0].[Id] + WHEN (([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL)) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [l0].[Id] END = [t0].[OneToMany_Optional_Inverse3Id] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL)) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t1] ON [l].[Id] = [t1].[OneToMany_Optional_Inverse2Id] ORDER BY [l].[Id], [t1].[Id], [t1].[Id0], [t1].[Id1], [t1].[Id00]"); } @@ -3532,7 +3532,7 @@ public override async Task Null_check_in_Dto_projection_should_not_be_removed(bo FROM [Level1] AS [l] LEFT JOIN ( SELECT CASE - WHEN [t0].[Level2_Required_Id] IS NULL OR [t0].[OneToMany_Required_Inverse3Id] IS NULL THEN CAST(1 AS bit) + WHEN ([t0].[Level2_Required_Id] IS NULL) OR ([t0].[OneToMany_Required_Inverse3Id] IS NULL) THEN CAST(1 AS bit) ELSE CAST(0 AS bit) END AS [c], [t0].[Level3_Name], [l0].[Id], [l1].[Id] AS [Id0], [t0].[Id] AS [Id1], [t0].[Id0] AS [Id00], [t0].[Id00] AS [Id000], [l0].[OneToMany_Optional_Inverse2Id] FROM [Level1] AS [l0] @@ -3544,13 +3544,13 @@ INNER JOIN ( SELECT [l3].[Id], [l4].[Id] AS [Id0] FROM [Level1] AS [l3] INNER JOIN [Level1] AS [l4] ON [l3].[Id] = [l4].[Id] - WHERE ([l3].[OneToOne_Required_PK_Date] IS NOT NULL AND [l3].[Level1_Required_Id] IS NOT NULL) AND [l3].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l3].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l3].[Level1_Required_Id] IS NOT NULL)) AND ([l3].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t] ON [l2].[Id] = [t].[Id] - WHERE [l2].[Level2_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l2].[Level2_Required_Id] IS NOT NULL) AND ([l2].[OneToMany_Required_Inverse3Id] IS NOT NULL) ) AS [t0] ON CASE - WHEN ([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [l0].[Id] + WHEN (([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL)) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [l0].[Id] END = [t0].[Level2_Required_Id] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL)) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t1] ON [l].[Id] = [t1].[OneToMany_Optional_Inverse2Id] ORDER BY [l].[Id], [t1].[Id], [t1].[Id0], [t1].[Id1], [t1].[Id00]"); } @@ -3568,7 +3568,7 @@ LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[Level2_Name], [l0].[OneToMany_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id], [l1].[Id] AS [Id0], ROW_NUMBER() OVER(PARTITION BY [l0].[OneToMany_Optional_Inverse2Id] ORDER BY [l0].[Level2_Name]) AS [row] FROM [Level1] AS [l0] INNER JOIN [Level1] AS [l1] ON [l0].[Id] = [l1].[Id] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL)) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t] WHERE [t].[row] <= 3 ) AS [t0] ON [l].[Id] = [t0].[OneToMany_Optional_Inverse2Id] @@ -3587,7 +3587,7 @@ OUTER APPLY ( FROM ( SELECT [l0].[Date] FROM [Level1] AS [l0] - WHERE ([l0].[Name] = [l].[Name]) OR ([l0].[Name] IS NULL AND [l].[Name] IS NULL) + WHERE ([l0].[Name] = [l].[Name]) OR (([l0].[Name] IS NULL) AND ([l].[Name] IS NULL)) GROUP BY [l0].[Date] ) AS [t] LEFT JOIN ( @@ -3595,7 +3595,7 @@ LEFT JOIN ( FROM ( SELECT [l1].[Id], [l1].[Date], [l1].[Name], ROW_NUMBER() OVER(PARTITION BY [l1].[Date] ORDER BY [l1].[Name]) AS [row] FROM [Level1] AS [l1] - WHERE ([l1].[Name] = [l].[Name]) OR ([l1].[Name] IS NULL AND [l].[Name] IS NULL) + WHERE ([l1].[Name] = [l].[Name]) OR (([l1].[Name] IS NULL) AND ([l].[Name] IS NULL)) ) AS [t1] WHERE (1 < [t1].[row]) AND ([t1].[row] <= 6) ) AS [t0] ON [t].[Date] = [t0].[Date] @@ -3614,13 +3614,13 @@ LEFT JOIN ( SELECT [t].[Id], [t].[OneToOne_Required_PK_Date], [t].[Level1_Optional_Id], [t].[Level1_Required_Id], [t].[Level2_Name], [t].[OneToMany_Optional_Inverse2Id], [t].[OneToMany_Required_Inverse2Id], [t].[OneToOne_Optional_PK_Inverse2Id], [t].[Id0], [t].[c] FROM ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[Level2_Name], [l0].[OneToMany_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id], [l1].[Id] AS [Id0], ROW_NUMBER() OVER(PARTITION BY [l0].[OneToMany_Optional_Inverse2Id] ORDER BY CASE - WHEN ([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [l0].[Id] + WHEN (([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL)) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [l0].[Id] END) AS [row], CASE - WHEN ([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [l0].[Id] + WHEN (([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL)) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [l0].[Id] END AS [c] FROM [Level1] AS [l0] INNER JOIN [Level1] AS [l1] ON [l0].[Id] = [l1].[Id] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL)) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t] WHERE [t].[row] <= 1 ) AS [t0] ON [l].[Id] = [t0].[OneToMany_Optional_Inverse2Id] @@ -3660,7 +3660,7 @@ LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[Level2_Name], [l0].[OneToMany_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id], [l1].[Id] AS [Id0] FROM [Level1] AS [l0] INNER JOIN [Level1] AS [l1] ON [l0].[Id] = [l1].[Id] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL)) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t] ON [l].[Id] = [t].[Level1_Optional_Id] LEFT JOIN ( SELECT [l2].[Id], [l2].[Level2_Optional_Id], [l2].[Level2_Required_Id], [l2].[Level3_Name], [l2].[OneToMany_Optional_Inverse3Id], [l2].[OneToMany_Required_Inverse3Id], [l2].[OneToOne_Optional_PK_Inverse3Id], [t1].[Id] AS [Id0], [t1].[Id0] AS [Id00] @@ -3669,11 +3669,11 @@ INNER JOIN ( SELECT [l3].[Id], [l4].[Id] AS [Id0] FROM [Level1] AS [l3] INNER JOIN [Level1] AS [l4] ON [l3].[Id] = [l4].[Id] - WHERE ([l3].[OneToOne_Required_PK_Date] IS NOT NULL AND [l3].[Level1_Required_Id] IS NOT NULL) AND [l3].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l3].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l3].[Level1_Required_Id] IS NOT NULL)) AND ([l3].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t1] ON [l2].[Id] = [t1].[Id] - WHERE [l2].[Level2_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l2].[Level2_Required_Id] IS NOT NULL) AND ([l2].[OneToMany_Required_Inverse3Id] IS NOT NULL) ) AS [t0] ON CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + WHEN (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] END = [t0].[OneToMany_Optional_Inverse3Id] ORDER BY [l].[Name], [l].[Id], [t].[Id], [t].[Id0], [t0].[Id], [t0].[Id0]"); } @@ -3720,11 +3720,11 @@ INNER JOIN ( SELECT [l3].[Id], [l4].[Id] AS [Id0] FROM [Level1] AS [l3] INNER JOIN [Level1] AS [l4] ON [l3].[Id] = [l4].[Id] - WHERE ([l3].[OneToOne_Required_PK_Date] IS NOT NULL AND [l3].[Level1_Required_Id] IS NOT NULL) AND [l3].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l3].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l3].[Level1_Required_Id] IS NOT NULL)) AND ([l3].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t] ON [l2].[Id] = [t].[Id] - WHERE [l2].[Level2_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l2].[Level2_Required_Id] IS NOT NULL) AND ([l2].[OneToMany_Required_Inverse3Id] IS NOT NULL) ) AS [t0] ON CASE - WHEN ([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [l0].[Id] + WHEN (([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL)) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [l0].[Id] END = [t0].[OneToOne_Optional_PK_Inverse3Id] LEFT JOIN ( SELECT [l5].[Id], [l5].[Level3_Optional_Id], [l5].[Level3_Required_Id], [l5].[Level4_Name], [l5].[OneToMany_Optional_Inverse4Id], [l5].[OneToMany_Required_Inverse4Id], [l5].[OneToOne_Optional_PK_Inverse4Id], [t2].[Id] AS [Id0], [t2].[Id0] AS [Id00], [t2].[Id00] AS [Id000] @@ -3736,15 +3736,15 @@ INNER JOIN ( SELECT [l7].[Id], [l8].[Id] AS [Id0] FROM [Level1] AS [l7] INNER JOIN [Level1] AS [l8] ON [l7].[Id] = [l8].[Id] - WHERE ([l7].[OneToOne_Required_PK_Date] IS NOT NULL AND [l7].[Level1_Required_Id] IS NOT NULL) AND [l7].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l7].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l7].[Level1_Required_Id] IS NOT NULL)) AND ([l7].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t3] ON [l6].[Id] = [t3].[Id] - WHERE [l6].[Level2_Required_Id] IS NOT NULL AND [l6].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l6].[Level2_Required_Id] IS NOT NULL) AND ([l6].[OneToMany_Required_Inverse3Id] IS NOT NULL) ) AS [t2] ON [l5].[Id] = [t2].[Id] - WHERE [l5].[Level3_Required_Id] IS NOT NULL AND [l5].[OneToMany_Required_Inverse4Id] IS NOT NULL + WHERE ([l5].[Level3_Required_Id] IS NOT NULL) AND ([l5].[OneToMany_Required_Inverse4Id] IS NOT NULL) ) AS [t1] ON CASE - WHEN [t0].[Level2_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [t0].[Id] + WHEN ([t0].[Level2_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [t0].[Id] END = [t1].[Level3_Optional_Id] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL)) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t4] ON [l].[Id] = [t4].[OneToMany_Optional_Inverse2Id] ORDER BY [l].[Id], [t4].[Id], [t4].[Id2], [t4].[Id0], [t4].[Id00], [t4].[Id000], [t4].[Id1], [t4].[Id01], [t4].[Id001]"); } @@ -3764,24 +3764,24 @@ OUTER APPLY ( SELECT [t0].[Id], [t0].[Level2_Optional_Id], [t0].[Level2_Required_Id], [t0].[Level3_Name], [t0].[OneToMany_Optional_Inverse3Id], [t0].[OneToMany_Required_Inverse3Id], [t0].[OneToOne_Optional_PK_Inverse3Id], [t0].[Id0], [t0].[Id00], [t1].[Id] AS [Id1], [t1].[Level3_Optional_Id], [t1].[Level3_Required_Id], [t1].[Level4_Name], [t1].[OneToMany_Optional_Inverse4Id], [t1].[OneToMany_Required_Inverse4Id], [t1].[OneToOne_Optional_PK_Inverse4Id], [t1].[Id0] AS [Id01], [t1].[Id00] AS [Id000], [t1].[Id000] AS [Id0000], [t4].[Id] AS [Id2], [t4].[Level3_Optional_Id] AS [Level3_Optional_Id0], [t4].[Level3_Required_Id] AS [Level3_Required_Id0], [t4].[Level4_Name] AS [Level4_Name0], [t4].[OneToMany_Optional_Inverse4Id] AS [OneToMany_Optional_Inverse4Id0], [t4].[OneToMany_Required_Inverse4Id] AS [OneToMany_Required_Inverse4Id0], [t4].[OneToOne_Optional_PK_Inverse4Id] AS [OneToOne_Optional_PK_Inverse4Id0], [t4].[Id0] AS [Id02], [t4].[Id00] AS [Id001], [t4].[Id000] AS [Id0001], [t0].[c] FROM ( SELECT TOP(1) [l2].[Id], [l2].[Level2_Optional_Id], [l2].[Level2_Required_Id], [l2].[Level3_Name], [l2].[OneToMany_Optional_Inverse3Id], [l2].[OneToMany_Required_Inverse3Id], [l2].[OneToOne_Optional_PK_Inverse3Id], [t].[Id] AS [Id0], [t].[Id0] AS [Id00], CASE - WHEN [l2].[Level2_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [l2].[Id] + WHEN ([l2].[Level2_Required_Id] IS NOT NULL) AND ([l2].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [l2].[Id] END AS [c] FROM [Level1] AS [l2] INNER JOIN ( SELECT [l3].[Id], [l4].[Id] AS [Id0] FROM [Level1] AS [l3] INNER JOIN [Level1] AS [l4] ON [l3].[Id] = [l4].[Id] - WHERE ([l3].[OneToOne_Required_PK_Date] IS NOT NULL AND [l3].[Level1_Required_Id] IS NOT NULL) AND [l3].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l3].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l3].[Level1_Required_Id] IS NOT NULL)) AND ([l3].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t] ON [l2].[Id] = [t].[Id] - WHERE (([l2].[Level2_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse3Id] IS NOT NULL) AND (CASE - WHEN ([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [l0].[Id] - END IS NOT NULL AND ((CASE - WHEN ([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [l0].[Id] - END = [l2].[OneToMany_Optional_Inverse3Id]) OR (CASE - WHEN ([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [l0].[Id] - END IS NULL AND [l2].[OneToMany_Optional_Inverse3Id] IS NULL)))) AND (([l2].[Level3_Name] <> N'Foo') OR [l2].[Level3_Name] IS NULL) + WHERE ((([l2].[Level2_Required_Id] IS NOT NULL) AND ([l2].[OneToMany_Required_Inverse3Id] IS NOT NULL)) AND ((CASE + WHEN (([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL)) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [l0].[Id] + END IS NOT NULL) AND ((CASE + WHEN (([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL)) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [l0].[Id] + END = [l2].[OneToMany_Optional_Inverse3Id]) OR ((CASE + WHEN (([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL)) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [l0].[Id] + END IS NULL) AND ([l2].[OneToMany_Optional_Inverse3Id] IS NULL))))) AND (([l2].[Level3_Name] <> N'Foo') OR ([l2].[Level3_Name] IS NULL)) ORDER BY CASE - WHEN [l2].[Level2_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [l2].[Id] + WHEN ([l2].[Level2_Required_Id] IS NOT NULL) AND ([l2].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [l2].[Id] END ) AS [t0] LEFT JOIN ( @@ -3794,13 +3794,13 @@ INNER JOIN ( SELECT [l7].[Id], [l8].[Id] AS [Id0] FROM [Level1] AS [l7] INNER JOIN [Level1] AS [l8] ON [l7].[Id] = [l8].[Id] - WHERE ([l7].[OneToOne_Required_PK_Date] IS NOT NULL AND [l7].[Level1_Required_Id] IS NOT NULL) AND [l7].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l7].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l7].[Level1_Required_Id] IS NOT NULL)) AND ([l7].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t3] ON [l6].[Id] = [t3].[Id] - WHERE [l6].[Level2_Required_Id] IS NOT NULL AND [l6].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l6].[Level2_Required_Id] IS NOT NULL) AND ([l6].[OneToMany_Required_Inverse3Id] IS NOT NULL) ) AS [t2] ON [l5].[Id] = [t2].[Id] - WHERE [l5].[Level3_Required_Id] IS NOT NULL AND [l5].[OneToMany_Required_Inverse4Id] IS NOT NULL + WHERE ([l5].[Level3_Required_Id] IS NOT NULL) AND ([l5].[OneToMany_Required_Inverse4Id] IS NOT NULL) ) AS [t1] ON CASE - WHEN [t0].[Level2_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [t0].[Id] + WHEN ([t0].[Level2_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [t0].[Id] END = [t1].[OneToMany_Optional_Inverse4Id] LEFT JOIN ( SELECT [l9].[Id], [l9].[Level3_Optional_Id], [l9].[Level3_Required_Id], [l9].[Level4_Name], [l9].[OneToMany_Optional_Inverse4Id], [l9].[OneToMany_Required_Inverse4Id], [l9].[OneToOne_Optional_PK_Inverse4Id], [t5].[Id] AS [Id0], [t5].[Id0] AS [Id00], [t5].[Id00] AS [Id000] @@ -3812,16 +3812,16 @@ INNER JOIN ( SELECT [l11].[Id], [l12].[Id] AS [Id0] FROM [Level1] AS [l11] INNER JOIN [Level1] AS [l12] ON [l11].[Id] = [l12].[Id] - WHERE ([l11].[OneToOne_Required_PK_Date] IS NOT NULL AND [l11].[Level1_Required_Id] IS NOT NULL) AND [l11].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l11].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l11].[Level1_Required_Id] IS NOT NULL)) AND ([l11].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t6] ON [l10].[Id] = [t6].[Id] - WHERE [l10].[Level2_Required_Id] IS NOT NULL AND [l10].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l10].[Level2_Required_Id] IS NOT NULL) AND ([l10].[OneToMany_Required_Inverse3Id] IS NOT NULL) ) AS [t5] ON [l9].[Id] = [t5].[Id] - WHERE [l9].[Level3_Required_Id] IS NOT NULL AND [l9].[OneToMany_Required_Inverse4Id] IS NOT NULL + WHERE ([l9].[Level3_Required_Id] IS NOT NULL) AND ([l9].[OneToMany_Required_Inverse4Id] IS NOT NULL) ) AS [t4] ON CASE - WHEN [t0].[Level2_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [t0].[Id] + WHEN ([t0].[Level2_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [t0].[Id] END = [t4].[OneToMany_Required_Inverse4Id] ) AS [t7] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL)) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t8] ON [l].[Id] = [t8].[OneToMany_Optional_Inverse2Id] ORDER BY [l].[Id], [t8].[Id], [t8].[Id0], [t8].[c], [t8].[Id1], [t8].[Id00], [t8].[Id000], [t8].[Id10], [t8].[Id01], [t8].[Id0000], [t8].[Id00000], [t8].[Id2], [t8].[Id02], [t8].[Id001]"); } @@ -3844,11 +3844,11 @@ INNER JOIN ( SELECT [l3].[Id], [l4].[Id] AS [Id0] FROM [Level1] AS [l3] INNER JOIN [Level1] AS [l4] ON [l3].[Id] = [l4].[Id] - WHERE ([l3].[OneToOne_Required_PK_Date] IS NOT NULL AND [l3].[Level1_Required_Id] IS NOT NULL) AND [l3].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l3].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l3].[Level1_Required_Id] IS NOT NULL)) AND ([l3].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t] ON [l2].[Id] = [t].[Id] - WHERE [l2].[Level2_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l2].[Level2_Required_Id] IS NOT NULL) AND ([l2].[OneToMany_Required_Inverse3Id] IS NOT NULL) ) AS [t0] ON CASE - WHEN ([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [l0].[Id] + WHEN (([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL)) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [l0].[Id] END = [t0].[OneToOne_Optional_PK_Inverse3Id] LEFT JOIN ( SELECT [l5].[Id], [l5].[Level3_Optional_Id], [l5].[Level3_Required_Id], [l5].[Level4_Name], [l5].[OneToMany_Optional_Inverse4Id], [l5].[OneToMany_Required_Inverse4Id], [l5].[OneToOne_Optional_PK_Inverse4Id], [t2].[Id] AS [Id0], [t2].[Id0] AS [Id00], [t2].[Id00] AS [Id000] @@ -3860,15 +3860,15 @@ INNER JOIN ( SELECT [l7].[Id], [l8].[Id] AS [Id0] FROM [Level1] AS [l7] INNER JOIN [Level1] AS [l8] ON [l7].[Id] = [l8].[Id] - WHERE ([l7].[OneToOne_Required_PK_Date] IS NOT NULL AND [l7].[Level1_Required_Id] IS NOT NULL) AND [l7].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l7].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l7].[Level1_Required_Id] IS NOT NULL)) AND ([l7].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t3] ON [l6].[Id] = [t3].[Id] - WHERE [l6].[Level2_Required_Id] IS NOT NULL AND [l6].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l6].[Level2_Required_Id] IS NOT NULL) AND ([l6].[OneToMany_Required_Inverse3Id] IS NOT NULL) ) AS [t2] ON [l5].[Id] = [t2].[Id] - WHERE [l5].[Level3_Required_Id] IS NOT NULL AND [l5].[OneToMany_Required_Inverse4Id] IS NOT NULL + WHERE ([l5].[Level3_Required_Id] IS NOT NULL) AND ([l5].[OneToMany_Required_Inverse4Id] IS NOT NULL) ) AS [t1] ON CASE - WHEN [t0].[Level2_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [t0].[Id] + WHEN ([t0].[Level2_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [t0].[Id] END = [t1].[Level3_Optional_Id] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL)) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t4] ON [l].[Id] = [t4].[OneToMany_Optional_Inverse2Id] ORDER BY [l].[Id], [t4].[Id1], [t4].[Id2], [t4].[Id], [t4].[Id00], [t4].[Id000], [t4].[Id0], [t4].[Id01], [t4].[Id001]"); } @@ -3884,7 +3884,7 @@ LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[Level2_Name], [l0].[OneToMany_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id], [l1].[Id] AS [Id0] FROM [Level1] AS [l0] INNER JOIN [Level1] AS [l1] ON [l0].[Id] = [l1].[Id] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL)) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t] ON [l].[Id] = [t].[Level1_Optional_Id] LEFT JOIN ( SELECT [l2].[Id], [l2].[Level2_Optional_Id], [l2].[Level2_Required_Id], [l2].[Level3_Name], [l2].[OneToMany_Optional_Inverse3Id], [l2].[OneToMany_Required_Inverse3Id], [l2].[OneToOne_Optional_PK_Inverse3Id], [t1].[Id] AS [Id0], [t1].[Id0] AS [Id00] @@ -3893,11 +3893,11 @@ INNER JOIN ( SELECT [l3].[Id], [l4].[Id] AS [Id0] FROM [Level1] AS [l3] INNER JOIN [Level1] AS [l4] ON [l3].[Id] = [l4].[Id] - WHERE ([l3].[OneToOne_Required_PK_Date] IS NOT NULL AND [l3].[Level1_Required_Id] IS NOT NULL) AND [l3].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l3].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l3].[Level1_Required_Id] IS NOT NULL)) AND ([l3].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t1] ON [l2].[Id] = [t1].[Id] - WHERE [l2].[Level2_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l2].[Level2_Required_Id] IS NOT NULL) AND ([l2].[OneToMany_Required_Inverse3Id] IS NOT NULL) ) AS [t0] ON CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + WHEN (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] END = [t0].[OneToMany_Optional_Inverse3Id] ORDER BY [l].[Id], [t].[Id], [t].[Id0], [t0].[Id], [t0].[Id0]"); } @@ -3913,7 +3913,7 @@ LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[Level2_Name], [l0].[OneToMany_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id], [l1].[Id] AS [Id0] FROM [Level1] AS [l0] INNER JOIN [Level1] AS [l1] ON [l0].[Id] = [l1].[Id] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL)) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t] ON [l].[Id] = [t].[Level1_Optional_Id] LEFT JOIN ( SELECT [l2].[Id], [l2].[Level2_Optional_Id], [l2].[Level2_Required_Id], [l2].[Level3_Name], [l2].[OneToMany_Optional_Inverse3Id], [l2].[OneToMany_Required_Inverse3Id], [l2].[OneToOne_Optional_PK_Inverse3Id], [t1].[Id] AS [Id0], [t1].[Id0] AS [Id00] @@ -3922,11 +3922,11 @@ INNER JOIN ( SELECT [l3].[Id], [l4].[Id] AS [Id0] FROM [Level1] AS [l3] INNER JOIN [Level1] AS [l4] ON [l3].[Id] = [l4].[Id] - WHERE ([l3].[OneToOne_Required_PK_Date] IS NOT NULL AND [l3].[Level1_Required_Id] IS NOT NULL) AND [l3].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l3].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l3].[Level1_Required_Id] IS NOT NULL)) AND ([l3].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t1] ON [l2].[Id] = [t1].[Id] - WHERE [l2].[Level2_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l2].[Level2_Required_Id] IS NOT NULL) AND ([l2].[OneToMany_Required_Inverse3Id] IS NOT NULL) ) AS [t0] ON CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + WHEN (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] END = [t0].[OneToMany_Optional_Inverse3Id] ORDER BY [l].[Name], [l].[Id], [t].[Id], [t].[Id0], [t0].[Id], [t0].[Id0]"); } diff --git a/test/EFCore.SqlServer.FunctionalTests/Query/ComplexNavigationsCollectionsSplitQuerySqlServerTest.cs b/test/EFCore.SqlServer.FunctionalTests/Query/ComplexNavigationsCollectionsSplitQuerySqlServerTest.cs index 7a154854c8f..6ba903f4b74 100644 --- a/test/EFCore.SqlServer.FunctionalTests/Query/ComplexNavigationsCollectionsSplitQuerySqlServerTest.cs +++ b/test/EFCore.SqlServer.FunctionalTests/Query/ComplexNavigationsCollectionsSplitQuerySqlServerTest.cs @@ -229,7 +229,7 @@ INNER JOIN ( FROM ( SELECT [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Name], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Optional_Self_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[OneToMany_Required_Self_Inverse3Id], [l1].[OneToOne_Optional_PK_Inverse3Id], [l1].[OneToOne_Optional_Self3Id], ROW_NUMBER() OVER(PARTITION BY [l1].[OneToMany_Optional_Inverse3Id] ORDER BY [l1].[Name]) AS [row] FROM [LevelThree] AS [l1] - WHERE ([l1].[Name] <> N'Foo') OR [l1].[Name] IS NULL + WHERE ([l1].[Name] <> N'Foo') OR ([l1].[Name] IS NULL) ) AS [t] WHERE (1 < [t].[row]) AND ([t].[row] <= 4) ) AS [t0] ON [l0].[Id] = [t0].[OneToMany_Optional_Inverse3Id] @@ -254,7 +254,7 @@ INNER JOIN ( FROM ( SELECT [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Name], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Optional_Self_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[OneToMany_Required_Self_Inverse3Id], [l1].[OneToOne_Optional_PK_Inverse3Id], [l1].[OneToOne_Optional_Self3Id], ROW_NUMBER() OVER(PARTITION BY [l1].[OneToMany_Optional_Inverse3Id] ORDER BY [l1].[Name]) AS [row] FROM [LevelThree] AS [l1] - WHERE ([l1].[Name] <> N'Foo') OR [l1].[Name] IS NULL + WHERE ([l1].[Name] <> N'Foo') OR ([l1].[Name] IS NULL) ) AS [t] WHERE (1 < [t].[row]) AND ([t].[row] <= 4) ) AS [t0] ON [l0].[Id] = [t0].[OneToMany_Optional_Inverse3Id] @@ -277,7 +277,7 @@ INNER JOIN ( FROM ( 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], ROW_NUMBER() OVER(PARTITION BY [l0].[OneToMany_Optional_Inverse2Id] ORDER BY [l0].[Name]) AS [row] FROM [LevelTwo] AS [l0] - WHERE ([l0].[Name] <> N'Foo') OR [l0].[Name] IS NULL + WHERE ([l0].[Name] <> N'Foo') OR ([l0].[Name] IS NULL) ) AS [t] WHERE [t].[row] <= 3 ) AS [t0] ON [l].[Id] = [t0].[OneToMany_Optional_Inverse2Id] @@ -290,7 +290,7 @@ INNER JOIN ( FROM ( 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], ROW_NUMBER() OVER(PARTITION BY [l0].[OneToMany_Required_Inverse2Id] ORDER BY [l0].[Name] DESC) AS [row] FROM [LevelTwo] AS [l0] - WHERE ([l0].[Name] <> N'Bar') OR [l0].[Name] IS NULL + WHERE ([l0].[Name] <> N'Bar') OR ([l0].[Name] IS NULL) ) AS [t] WHERE 1 < [t].[row] ) AS [t0] ON [l].[Id] = [t0].[OneToMany_Required_Inverse2Id] @@ -313,7 +313,7 @@ INNER JOIN ( FROM ( 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], ROW_NUMBER() OVER(PARTITION BY [l0].[OneToMany_Optional_Inverse2Id] ORDER BY [l0].[Name]) AS [row] FROM [LevelTwo] AS [l0] - WHERE ([l0].[Name] <> N'Foo') OR [l0].[Name] IS NULL + WHERE ([l0].[Name] <> N'Foo') OR ([l0].[Name] IS NULL) ) AS [t] WHERE [t].[row] <= 3 ) AS [t0] ON [l].[Id] = [t0].[OneToMany_Optional_Inverse2Id] @@ -326,7 +326,7 @@ INNER JOIN ( FROM ( SELECT [l0].[Id], [l0].[Name], [l0].[OneToMany_Optional_Inverse2Id], ROW_NUMBER() OVER(PARTITION BY [l0].[OneToMany_Optional_Inverse2Id] ORDER BY [l0].[Name]) AS [row] FROM [LevelTwo] AS [l0] - WHERE ([l0].[Name] <> N'Foo') OR [l0].[Name] IS NULL + WHERE ([l0].[Name] <> N'Foo') OR ([l0].[Name] IS NULL) ) AS [t] WHERE [t].[row] <= 3 ) AS [t0] ON [l].[Id] = [t0].[OneToMany_Optional_Inverse2Id] @@ -335,7 +335,7 @@ INNER JOIN ( FROM ( SELECT [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Name], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Optional_Self_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[OneToMany_Required_Self_Inverse3Id], [l1].[OneToOne_Optional_PK_Inverse3Id], [l1].[OneToOne_Optional_Self3Id], ROW_NUMBER() OVER(PARTITION BY [l1].[OneToMany_Required_Inverse3Id] ORDER BY [l1].[Name] DESC) AS [row] FROM [LevelThree] AS [l1] - WHERE ([l1].[Name] <> N'Bar') OR [l1].[Name] IS NULL + WHERE ([l1].[Name] <> N'Bar') OR ([l1].[Name] IS NULL) ) AS [t2] WHERE 1 < [t2].[row] ) AS [t1] ON [t0].[Id] = [t1].[OneToMany_Required_Inverse3Id] @@ -358,7 +358,7 @@ INNER JOIN ( FROM ( 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], ROW_NUMBER() OVER(PARTITION BY [l0].[OneToMany_Optional_Inverse2Id] ORDER BY [l0].[Id] DESC) AS [row] FROM [LevelTwo] AS [l0] - WHERE ([l0].[Name] <> N'Foo') OR [l0].[Name] IS NULL + WHERE ([l0].[Name] <> N'Foo') OR ([l0].[Name] IS NULL) ) AS [t] WHERE [t].[row] <= 2 ) AS [t0] ON [l].[Id] = [t0].[OneToMany_Optional_Inverse2Id] @@ -381,7 +381,7 @@ CROSS APPLY ( FROM ( SELECT TOP(2) [l1].[Id], [l1].[Date], [l1].[Level1_Optional_Id], [l1].[Level1_Required_Id], [l1].[Name], [l1].[OneToMany_Optional_Inverse2Id], [l1].[OneToMany_Optional_Self_Inverse2Id], [l1].[OneToMany_Required_Inverse2Id], [l1].[OneToMany_Required_Self_Inverse2Id], [l1].[OneToOne_Optional_PK_Inverse2Id], [l1].[OneToOne_Optional_Self2Id] FROM [LevelTwo] AS [l1] - WHERE ([l].[Id] = [l1].[OneToMany_Optional_Inverse2Id]) AND (([l1].[Name] <> N'Foo') OR [l1].[Name] IS NULL) + WHERE ([l].[Id] = [l1].[OneToMany_Optional_Inverse2Id]) AND (([l1].[Name] <> N'Foo') OR ([l1].[Name] IS NULL)) ORDER BY [l1].[Id] ) AS [t] LEFT JOIN [LevelThree] AS [l0] ON [t].[Id] = [l0].[Level2_Required_Id] @@ -395,7 +395,7 @@ CROSS APPLY ( FROM ( SELECT TOP(2) [l1].[Id] FROM [LevelTwo] AS [l1] - WHERE ([l].[Id] = [l1].[OneToMany_Optional_Inverse2Id]) AND (([l1].[Name] <> N'Foo') OR [l1].[Name] IS NULL) + WHERE ([l].[Id] = [l1].[OneToMany_Optional_Inverse2Id]) AND (([l1].[Name] <> N'Foo') OR ([l1].[Name] IS NULL)) ORDER BY [l1].[Id] ) AS [t] LEFT JOIN [LevelThree] AS [l0] ON [t].[Id] = [l0].[Level2_Required_Id] @@ -422,7 +422,7 @@ CROSS APPLY ( FROM ( SELECT TOP(2) [l1].[Id], [l1].[Date], [l1].[Level1_Optional_Id], [l1].[Level1_Required_Id], [l1].[Name], [l1].[OneToMany_Optional_Inverse2Id], [l1].[OneToMany_Optional_Self_Inverse2Id], [l1].[OneToMany_Required_Inverse2Id], [l1].[OneToMany_Required_Self_Inverse2Id], [l1].[OneToOne_Optional_PK_Inverse2Id], [l1].[OneToOne_Optional_Self2Id] FROM [LevelTwo] AS [l1] - WHERE ([l].[Id] = [l1].[OneToMany_Optional_Inverse2Id]) AND (([l1].[Name] <> N'Foo') OR [l1].[Name] IS NULL) + WHERE ([l].[Id] = [l1].[OneToMany_Optional_Inverse2Id]) AND (([l1].[Name] <> N'Foo') OR ([l1].[Name] IS NULL)) ORDER BY [l1].[Id] ) AS [t] LEFT JOIN [LevelThree] AS [l0] ON [t].[Id] = [l0].[Level2_Required_Id] @@ -436,7 +436,7 @@ CROSS APPLY ( FROM ( SELECT TOP(2) [l1].[Id] FROM [LevelTwo] AS [l1] - WHERE ([l].[Id] = [l1].[OneToMany_Optional_Inverse2Id]) AND (([l1].[Name] <> N'Foo') OR [l1].[Name] IS NULL) + WHERE ([l].[Id] = [l1].[OneToMany_Optional_Inverse2Id]) AND (([l1].[Name] <> N'Foo') OR ([l1].[Name] IS NULL)) ORDER BY [l1].[Id] ) AS [t] LEFT JOIN [LevelThree] AS [l0] ON [t].[Id] = [l0].[Level2_Required_Id] @@ -461,7 +461,7 @@ INNER JOIN ( FROM ( 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], ROW_NUMBER() OVER(PARTITION BY [l0].[OneToMany_Optional_Inverse2Id] ORDER BY [l0].[Id]) AS [row] FROM [LevelTwo] AS [l0] - WHERE ([l0].[Name] <> N'Foo') OR [l0].[Name] IS NULL + WHERE ([l0].[Name] <> N'Foo') OR ([l0].[Name] IS NULL) ) AS [t] WHERE [t].[row] <= 3 ) AS [t0] ON [l].[Id] = [t0].[OneToMany_Optional_Inverse2Id] @@ -484,7 +484,7 @@ INNER JOIN ( FROM ( 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], ROW_NUMBER() OVER(PARTITION BY [l0].[OneToMany_Optional_Inverse2Id] ORDER BY [l0].[Id]) AS [row] FROM [LevelTwo] AS [l0] - WHERE ([l0].[Name] <> N'Foo') OR [l0].[Name] IS NULL + WHERE ([l0].[Name] <> N'Foo') OR ([l0].[Name] IS NULL) ) AS [t] WHERE [t].[row] <= 3 ) AS [t0] ON [l].[Id] = [t0].[OneToMany_Optional_Inverse2Id] @@ -507,7 +507,7 @@ CROSS APPLY ( FROM ( SELECT TOP(1) [l1].[Id], [l1].[Date], [l1].[Level1_Optional_Id], [l1].[Level1_Required_Id], [l1].[Name], [l1].[OneToMany_Optional_Inverse2Id], [l1].[OneToMany_Optional_Self_Inverse2Id], [l1].[OneToMany_Required_Inverse2Id], [l1].[OneToMany_Required_Self_Inverse2Id], [l1].[OneToOne_Optional_PK_Inverse2Id], [l1].[OneToOne_Optional_Self2Id] FROM [LevelTwo] AS [l1] - WHERE ([l].[Id] = [l1].[OneToMany_Optional_Inverse2Id]) AND (([l1].[Name] <> N'Foo') OR [l1].[Name] IS NULL) + WHERE ([l].[Id] = [l1].[OneToMany_Optional_Inverse2Id]) AND (([l1].[Name] <> N'Foo') OR ([l1].[Name] IS NULL)) ORDER BY [l1].[Id] ) AS [t] LEFT JOIN [LevelThree] AS [l0] ON [t].[Id] = [l0].[OneToOne_Optional_PK_Inverse3Id] @@ -521,7 +521,7 @@ CROSS APPLY ( FROM ( SELECT TOP(1) [l1].[Id] FROM [LevelTwo] AS [l1] - WHERE ([l].[Id] = [l1].[OneToMany_Optional_Inverse2Id]) AND (([l1].[Name] <> N'Foo') OR [l1].[Name] IS NULL) + WHERE ([l].[Id] = [l1].[OneToMany_Optional_Inverse2Id]) AND (([l1].[Name] <> N'Foo') OR ([l1].[Name] IS NULL)) ORDER BY [l1].[Id] ) AS [t] LEFT JOIN [LevelThree] AS [l0] ON [t].[Id] = [l0].[OneToOne_Optional_PK_Inverse3Id] @@ -556,7 +556,7 @@ INNER JOIN ( FROM ( SELECT [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Name], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Optional_Self_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[OneToMany_Required_Self_Inverse3Id], [l1].[OneToOne_Optional_PK_Inverse3Id], [l1].[OneToOne_Optional_Self3Id], ROW_NUMBER() OVER(PARTITION BY [l1].[OneToMany_Optional_Inverse3Id] ORDER BY [l1].[Id]) AS [row] FROM [LevelThree] AS [l1] - WHERE ([l1].[Name] <> N'Foo') OR [l1].[Name] IS NULL + WHERE ([l1].[Name] <> N'Foo') OR ([l1].[Name] IS NULL) ) AS [t] WHERE [t].[row] <= 1 ) AS [t0] ON [l0].[Id] = [t0].[OneToMany_Optional_Inverse3Id] @@ -570,7 +570,7 @@ INNER JOIN ( FROM ( SELECT [l1].[Id], [l1].[OneToMany_Optional_Inverse3Id], ROW_NUMBER() OVER(PARTITION BY [l1].[OneToMany_Optional_Inverse3Id] ORDER BY [l1].[Id]) AS [row] FROM [LevelThree] AS [l1] - WHERE ([l1].[Name] <> N'Foo') OR [l1].[Name] IS NULL + WHERE ([l1].[Name] <> N'Foo') OR ([l1].[Name] IS NULL) ) AS [t] WHERE [t].[row] <= 1 ) AS [t0] ON [l0].[Id] = [t0].[OneToMany_Optional_Inverse3Id] @@ -585,7 +585,7 @@ INNER JOIN ( FROM ( SELECT [l1].[Id], [l1].[OneToMany_Optional_Inverse3Id], ROW_NUMBER() OVER(PARTITION BY [l1].[OneToMany_Optional_Inverse3Id] ORDER BY [l1].[Id]) AS [row] FROM [LevelThree] AS [l1] - WHERE ([l1].[Name] <> N'Foo') OR [l1].[Name] IS NULL + WHERE ([l1].[Name] <> N'Foo') OR ([l1].[Name] IS NULL) ) AS [t] WHERE [t].[row] <= 1 ) AS [t0] ON [l0].[Id] = [t0].[OneToMany_Optional_Inverse3Id] @@ -615,7 +615,7 @@ INNER JOIN ( FROM ( SELECT [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Name], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Optional_Self_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[OneToMany_Required_Self_Inverse3Id], [l1].[OneToOne_Optional_PK_Inverse3Id], [l1].[OneToOne_Optional_Self3Id], ROW_NUMBER() OVER(PARTITION BY [l1].[OneToMany_Optional_Inverse3Id] ORDER BY [l1].[Id]) AS [row] FROM [LevelThree] AS [l1] - WHERE ([l1].[Name] <> N'Foo') OR [l1].[Name] IS NULL + WHERE ([l1].[Name] <> N'Foo') OR ([l1].[Name] IS NULL) ) AS [t] WHERE [t].[row] <= 1 ) AS [t0] ON [l0].[Id] = [t0].[OneToMany_Optional_Inverse3Id] @@ -629,7 +629,7 @@ INNER JOIN ( FROM ( SELECT [l1].[Id], [l1].[OneToMany_Optional_Inverse3Id], ROW_NUMBER() OVER(PARTITION BY [l1].[OneToMany_Optional_Inverse3Id] ORDER BY [l1].[Id]) AS [row] FROM [LevelThree] AS [l1] - WHERE ([l1].[Name] <> N'Foo') OR [l1].[Name] IS NULL + WHERE ([l1].[Name] <> N'Foo') OR ([l1].[Name] IS NULL) ) AS [t] WHERE [t].[row] <= 1 ) AS [t0] ON [l0].[Id] = [t0].[OneToMany_Optional_Inverse3Id] @@ -644,7 +644,7 @@ INNER JOIN ( FROM ( SELECT [l1].[Id], [l1].[OneToMany_Optional_Inverse3Id], ROW_NUMBER() OVER(PARTITION BY [l1].[OneToMany_Optional_Inverse3Id] ORDER BY [l1].[Id]) AS [row] FROM [LevelThree] AS [l1] - WHERE ([l1].[Name] <> N'Foo') OR [l1].[Name] IS NULL + WHERE ([l1].[Name] <> N'Foo') OR ([l1].[Name] IS NULL) ) AS [t] WHERE [t].[row] <= 1 ) AS [t0] ON [l0].[Id] = [t0].[OneToMany_Optional_Inverse3Id] @@ -670,7 +670,7 @@ INNER JOIN ( FROM ( 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], ROW_NUMBER() OVER(PARTITION BY [l0].[OneToMany_Optional_Inverse2Id] ORDER BY [l0].[Id]) AS [row] FROM [LevelTwo] AS [l0] - WHERE ([l0].[Name] <> @__prm_0) OR [l0].[Name] IS NULL + WHERE ([l0].[Name] <> @__prm_0) OR ([l0].[Name] IS NULL) ) AS [t] WHERE [t].[row] <= 3 ) AS [t0] ON [l].[Id] = [t0].[OneToMany_Optional_Inverse2Id] @@ -808,7 +808,7 @@ FROM [LevelFour] AS [l7] LEFT JOIN [LevelThree] AS [l12] ON [t].[Id2] = [l12].[Level2_Optional_Id] LEFT JOIN [LevelTwo] AS [l13] ON [t0].[Level2_Optional_Id0] = [l13].[Id] LEFT JOIN [LevelThree] AS [l14] ON [l13].[Id] = [l14].[Level2_Required_Id] -WHERE ([l11].[Name] <> N'Foo') OR [l11].[Name] IS NULL +WHERE ([l11].[Name] <> N'Foo') OR ([l11].[Name] IS NULL) ORDER BY [l12].[Id], [l].[Id], [l0].[Id], [l1].[Id], [l2].[Id], [t].[Id], [t].[Id0], [t].[Id1], [t].[Id2], [t0].[Id], [t0].[Id0], [t0].[Id1], [t0].[Id2], [l11].[Id], [l13].[Id], [l14].[Id]", // @"SELECT [t1].[Id], [t1].[Date], [t1].[Level1_Optional_Id], [t1].[Level1_Required_Id], [t1].[Name], [t1].[OneToMany_Optional_Inverse2Id], [t1].[OneToMany_Optional_Self_Inverse2Id], [t1].[OneToMany_Required_Inverse2Id], [t1].[OneToMany_Required_Self_Inverse2Id], [t1].[OneToOne_Optional_PK_Inverse2Id], [t1].[OneToOne_Optional_Self2Id], [l].[Id], [l0].[Id], [l1].[Id], [l2].[Id], [t].[Id], [t].[Id0], [t].[Id1], [t].[Id2], [t0].[Id], [t0].[Id0], [t0].[Id1], [t0].[Id2], [l11].[Id], [l12].[Id], [l13].[Id], [l14].[Id] @@ -839,7 +839,7 @@ INNER JOIN ( FROM [LevelTwo] AS [l15] WHERE [l15].[Id] <> 42 ) AS [t1] ON [t].[Id2] = [t1].[OneToMany_Optional_Self_Inverse2Id] -WHERE ([l11].[Name] <> N'Foo') OR [l11].[Name] IS NULL +WHERE ([l11].[Name] <> N'Foo') OR ([l11].[Name] IS NULL) ORDER BY [l12].[Id], [l].[Id], [l0].[Id], [l1].[Id], [l2].[Id], [t].[Id], [t].[Id0], [t].[Id1], [t].[Id2], [t0].[Id], [t0].[Id0], [t0].[Id1], [t0].[Id2], [l11].[Id], [l13].[Id], [l14].[Id]"); } @@ -948,7 +948,7 @@ FROM [LevelOne] AS [l] INNER JOIN ( 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 ([l0].[Name] <> N'Foo') OR [l0].[Name] IS NULL + WHERE ([l0].[Name] <> N'Foo') OR ([l0].[Name] IS NULL) ) AS [t] ON [l].[Id] = [t].[OneToMany_Optional_Inverse2Id] WHERE [l].[Id] < 3 ORDER BY [l].[Id]"); @@ -1263,7 +1263,7 @@ LEFT JOIN ( FROM ( SELECT 1 AS [c], [l0].[Id], [l0].[OneToMany_Optional_Inverse2Id], ROW_NUMBER() OVER(PARTITION BY [l0].[OneToMany_Optional_Inverse2Id] ORDER BY [l0].[Id]) AS [row] FROM [LevelTwo] AS [l0] - WHERE ([l0].[Name] <> N'Foo') OR [l0].[Name] IS NULL + WHERE ([l0].[Name] <> N'Foo') OR ([l0].[Name] IS NULL) ) AS [t] WHERE [t].[row] <= 1 ) AS [t0] ON [l].[Id] = [t0].[OneToMany_Optional_Inverse2Id] @@ -1276,7 +1276,7 @@ LEFT JOIN ( FROM ( SELECT [l0].[Id], [l0].[OneToMany_Optional_Inverse2Id], ROW_NUMBER() OVER(PARTITION BY [l0].[OneToMany_Optional_Inverse2Id] ORDER BY [l0].[Id]) AS [row] FROM [LevelTwo] AS [l0] - WHERE ([l0].[Name] <> N'Foo') OR [l0].[Name] IS NULL + WHERE ([l0].[Name] <> N'Foo') OR ([l0].[Name] IS NULL) ) AS [t] WHERE [t].[row] <= 1 ) AS [t0] ON [l].[Id] = [t0].[OneToMany_Optional_Inverse2Id] @@ -1303,7 +1303,7 @@ LEFT JOIN ( FROM ( SELECT 1 AS [c], [l0].[Id], [l0].[OneToMany_Optional_Inverse2Id], ROW_NUMBER() OVER(PARTITION BY [l0].[OneToMany_Optional_Inverse2Id] ORDER BY [l0].[Id]) AS [row] FROM [LevelTwo] AS [l0] - WHERE ([l0].[Name] <> N'Foo') OR [l0].[Name] IS NULL + WHERE ([l0].[Name] <> N'Foo') OR ([l0].[Name] IS NULL) ) AS [t] WHERE [t].[row] <= 1 ) AS [t0] ON [l].[Id] = [t0].[OneToMany_Optional_Inverse2Id] @@ -1316,7 +1316,7 @@ LEFT JOIN ( FROM ( SELECT [l0].[Id], [l0].[OneToMany_Optional_Inverse2Id], ROW_NUMBER() OVER(PARTITION BY [l0].[OneToMany_Optional_Inverse2Id] ORDER BY [l0].[Id]) AS [row] FROM [LevelTwo] AS [l0] - WHERE ([l0].[Name] <> N'Foo') OR [l0].[Name] IS NULL + WHERE ([l0].[Name] <> N'Foo') OR ([l0].[Name] IS NULL) ) AS [t] WHERE [t].[row] <= 1 ) AS [t0] ON [l].[Id] = [t0].[OneToMany_Optional_Inverse2Id] @@ -1359,7 +1359,7 @@ FROM [LevelFour] AS [l7] LEFT JOIN [LevelThree] AS [l12] ON [t].[Id2] = [l12].[Level2_Optional_Id] LEFT JOIN [LevelTwo] AS [l13] ON [t0].[Level2_Optional_Id0] = [l13].[Id] LEFT JOIN [LevelThree] AS [l14] ON [l13].[Id] = [l14].[Level2_Required_Id] -WHERE ([l11].[Name] <> N'Foo') OR [l11].[Name] IS NULL +WHERE ([l11].[Name] <> N'Foo') OR ([l11].[Name] IS NULL) ORDER BY [l12].[Id], [l].[Id], [l0].[Id], [l1].[Id], [l2].[Id], [t].[Id], [t].[Id0], [t].[Id1], [t].[Id2], [t0].[Id], [t0].[Id0], [t0].[Id1], [t0].[Id2], [l11].[Id], [l13].[Id], [l14].[Id]", // @"SELECT [t1].[Id], [t1].[Date], [t1].[Level1_Optional_Id], [t1].[Level1_Required_Id], [t1].[Name], [t1].[OneToMany_Optional_Inverse2Id], [t1].[OneToMany_Optional_Self_Inverse2Id], [t1].[OneToMany_Required_Inverse2Id], [t1].[OneToMany_Required_Self_Inverse2Id], [t1].[OneToOne_Optional_PK_Inverse2Id], [t1].[OneToOne_Optional_Self2Id], [l].[Id], [l0].[Id], [l1].[Id], [l2].[Id], [t].[Id], [t].[Id0], [t].[Id1], [t].[Id2], [t0].[Id], [t0].[Id0], [t0].[Id1], [t0].[Id2], [l11].[Id], [l12].[Id], [l13].[Id], [l14].[Id] @@ -1390,7 +1390,7 @@ INNER JOIN ( FROM [LevelTwo] AS [l15] WHERE [l15].[Id] <> 42 ) AS [t1] ON [t].[Id2] = [t1].[OneToMany_Optional_Self_Inverse2Id] -WHERE ([l11].[Name] <> N'Foo') OR [l11].[Name] IS NULL +WHERE ([l11].[Name] <> N'Foo') OR ([l11].[Name] IS NULL) ORDER BY [l12].[Id], [l].[Id], [l0].[Id], [l1].[Id], [l2].[Id], [t].[Id], [t].[Id0], [t].[Id1], [t].[Id2], [t0].[Id], [t0].[Id0], [t0].[Id1], [t0].[Id2], [l11].[Id], [l13].[Id], [l14].[Id]"); } @@ -1635,7 +1635,7 @@ public override async Task Include_collection_with_conditional_order_by(bool asy @"SELECT [l].[Id], [l].[Date], [l].[Name], [l].[OneToMany_Optional_Self_Inverse1Id], [l].[OneToMany_Required_Self_Inverse1Id], [l].[OneToOne_Optional_Self1Id] FROM [LevelOne] AS [l] ORDER BY CASE - WHEN [l].[Name] IS NOT NULL AND ([l].[Name] LIKE N'%03') THEN 1 + WHEN ([l].[Name] IS NOT NULL) AND ([l].[Name] LIKE N'%03') THEN 1 ELSE 2 END, [l].[Id]", // @@ -1643,7 +1643,7 @@ ELSE 2 FROM [LevelOne] AS [l] INNER JOIN [LevelTwo] AS [l0] ON [l].[Id] = [l0].[OneToMany_Optional_Inverse2Id] ORDER BY CASE - WHEN [l].[Name] IS NOT NULL AND ([l].[Name] LIKE N'%03') THEN 1 + WHEN ([l].[Name] IS NOT NULL) AND ([l].[Name] LIKE N'%03') THEN 1 ELSE 2 END, [l].[Id]"); } @@ -1683,7 +1683,7 @@ public override async Task Include_nested_with_optional_navigation(bool async) @"SELECT [l].[Id], [l].[Date], [l].[Name], [l].[OneToMany_Optional_Self_Inverse1Id], [l].[OneToMany_Required_Self_Inverse1Id], [l].[OneToOne_Optional_Self1Id], [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 [LevelOne] AS [l] LEFT JOIN [LevelTwo] AS [l0] ON [l].[Id] = [l0].[Level1_Optional_Id] -WHERE ([l0].[Name] <> N'L2 09') OR [l0].[Name] IS NULL +WHERE ([l0].[Name] <> N'L2 09') OR ([l0].[Name] IS NULL) ORDER BY [l].[Id], [l0].[Id]", // @"SELECT [t].[Id], [t].[Level2_Optional_Id], [t].[Level2_Required_Id], [t].[Name], [t].[OneToMany_Optional_Inverse3Id], [t].[OneToMany_Optional_Self_Inverse3Id], [t].[OneToMany_Required_Inverse3Id], [t].[OneToMany_Required_Self_Inverse3Id], [t].[OneToOne_Optional_PK_Inverse3Id], [t].[OneToOne_Optional_Self3Id], [t].[Id0], [t].[Level3_Optional_Id], [t].[Level3_Required_Id], [t].[Name0], [t].[OneToMany_Optional_Inverse4Id], [t].[OneToMany_Optional_Self_Inverse4Id], [t].[OneToMany_Required_Inverse4Id], [t].[OneToMany_Required_Self_Inverse4Id], [t].[OneToOne_Optional_PK_Inverse4Id], [t].[OneToOne_Optional_Self4Id], [l].[Id], [l0].[Id] @@ -1694,7 +1694,7 @@ INNER JOIN ( FROM [LevelThree] AS [l1] LEFT JOIN [LevelFour] AS [l2] ON [l1].[Id] = [l2].[Level3_Required_Id] ) AS [t] ON [l0].[Id] = [t].[OneToMany_Required_Inverse3Id] -WHERE ([l0].[Name] <> N'L2 09') OR [l0].[Name] IS NULL +WHERE ([l0].[Name] <> N'L2 09') OR ([l0].[Name] IS NULL) ORDER BY [l].[Id], [l0].[Id]"); } @@ -1842,7 +1842,7 @@ FROM [LevelOne] AS [l] LEFT JOIN [LevelThree] AS [l2] ON [l0].[Id] = [l2].[Level2_Optional_Id] LEFT JOIN [LevelTwo] AS [l3] ON [l].[Id] = [l3].[Level1_Optional_Id] LEFT JOIN [LevelThree] AS [l4] ON [l3].[Id] = [l4].[Level2_Optional_Id] -WHERE ([l1].[Name] <> N'Foo') OR [l1].[Name] IS NULL +WHERE ([l1].[Name] <> N'Foo') OR ([l1].[Name] IS NULL) ORDER BY [l].[Id], [l0].[Id], [l1].[Id], [l2].[Id], [l3].[Id], [l4].[Id]", // @"SELECT [l5].[Id], [l5].[Level2_Optional_Id], [l5].[Level2_Required_Id], [l5].[Name], [l5].[OneToMany_Optional_Inverse3Id], [l5].[OneToMany_Optional_Self_Inverse3Id], [l5].[OneToMany_Required_Inverse3Id], [l5].[OneToMany_Required_Self_Inverse3Id], [l5].[OneToOne_Optional_PK_Inverse3Id], [l5].[OneToOne_Optional_Self3Id], [l].[Id], [l0].[Id], [l1].[Id], [l2].[Id], [l3].[Id], [l4].[Id] @@ -1853,7 +1853,7 @@ FROM [LevelOne] AS [l] LEFT JOIN [LevelTwo] AS [l3] ON [l].[Id] = [l3].[Level1_Optional_Id] LEFT JOIN [LevelThree] AS [l4] ON [l3].[Id] = [l4].[Level2_Optional_Id] INNER JOIN [LevelThree] AS [l5] ON [l0].[Id] = [l5].[OneToMany_Optional_Inverse3Id] -WHERE ([l1].[Name] <> N'Foo') OR [l1].[Name] IS NULL +WHERE ([l1].[Name] <> N'Foo') OR ([l1].[Name] IS NULL) ORDER BY [l].[Id], [l0].[Id], [l1].[Id], [l2].[Id], [l3].[Id], [l4].[Id]"); } @@ -2320,7 +2320,7 @@ public override async Task Include_collection_with_groupby_in_subquery_and_filte SELECT [l].[Name] FROM [LevelOne] AS [l] GROUP BY [l].[Name] - HAVING ([l].[Name] <> N'Foo') OR [l].[Name] IS NULL + HAVING ([l].[Name] <> N'Foo') OR ([l].[Name] IS NULL) ) AS [t] LEFT JOIN ( SELECT [t1].[Id], [t1].[Date], [t1].[Name], [t1].[OneToMany_Optional_Self_Inverse1Id], [t1].[OneToMany_Required_Self_Inverse1Id], [t1].[OneToOne_Optional_Self1Id] @@ -2337,7 +2337,7 @@ FROM [LevelOne] AS [l0] SELECT [l].[Name] FROM [LevelOne] AS [l] GROUP BY [l].[Name] - HAVING ([l].[Name] <> N'Foo') OR [l].[Name] IS NULL + HAVING ([l].[Name] <> N'Foo') OR ([l].[Name] IS NULL) ) AS [t] LEFT JOIN ( SELECT [t1].[Id], [t1].[Name] @@ -2677,7 +2677,7 @@ FROM [LevelOne] AS [l] SELECT COUNT(*) FROM [LevelTwo] AS [l0] LEFT JOIN [LevelThree] AS [l1] ON [l0].[Id] = [l1].[OneToOne_Optional_PK_Inverse3Id] - WHERE ([l].[Id] = [l0].[OneToMany_Optional_Inverse2Id]) AND (([l1].[Name] <> N'Foo') OR [l1].[Name] IS NULL)) > 0 + WHERE ([l].[Id] = [l0].[OneToMany_Optional_Inverse2Id]) AND (([l1].[Name] <> N'Foo') OR ([l1].[Name] IS NULL))) > 0 ORDER BY [l].[Id]", // @"SELECT [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], [t].[Id0], [t].[Level2_Optional_Id], [t].[Level2_Required_Id], [t].[Name0], [t].[OneToMany_Optional_Inverse3Id], [t].[OneToMany_Optional_Self_Inverse3Id], [t].[OneToMany_Required_Inverse3Id], [t].[OneToMany_Required_Self_Inverse3Id], [t].[OneToOne_Optional_PK_Inverse3Id], [t].[OneToOne_Optional_Self3Id], [t].[Id1], [t].[Level3_Optional_Id], [t].[Level3_Required_Id], [t].[Name1], [t].[OneToMany_Optional_Inverse4Id], [t].[OneToMany_Optional_Self_Inverse4Id], [t].[OneToMany_Required_Inverse4Id], [t].[OneToMany_Required_Self_Inverse4Id], [t].[OneToOne_Optional_PK_Inverse4Id], [t].[OneToOne_Optional_Self4Id], [l].[Id] @@ -2692,7 +2692,7 @@ FROM [LevelTwo] AS [l2] SELECT COUNT(*) FROM [LevelTwo] AS [l0] LEFT JOIN [LevelThree] AS [l1] ON [l0].[Id] = [l1].[OneToOne_Optional_PK_Inverse3Id] - WHERE ([l].[Id] = [l0].[OneToMany_Optional_Inverse2Id]) AND (([l1].[Name] <> N'Foo') OR [l1].[Name] IS NULL)) > 0 + WHERE ([l].[Id] = [l0].[OneToMany_Optional_Inverse2Id]) AND (([l1].[Name] <> N'Foo') OR ([l1].[Name] IS NULL))) > 0 ORDER BY [l].[Id]"); } @@ -3174,7 +3174,7 @@ FROM [LevelOne] AS [l] CROSS APPLY ( SELECT [l0].[Date] FROM [LevelOne] AS [l0] - WHERE ([l0].[Name] = [l].[Name]) OR ([l0].[Name] IS NULL AND [l].[Name] IS NULL) + WHERE ([l0].[Name] = [l].[Name]) OR (([l0].[Name] IS NULL) AND ([l].[Name] IS NULL)) GROUP BY [l0].[Date] ) AS [t] ORDER BY [l].[Id], [t].[Date]", @@ -3184,7 +3184,7 @@ FROM [LevelOne] AS [l] CROSS APPLY ( SELECT [l0].[Date] FROM [LevelOne] AS [l0] - WHERE ([l0].[Name] = [l].[Name]) OR ([l0].[Name] IS NULL AND [l].[Name] IS NULL) + WHERE ([l0].[Name] = [l].[Name]) OR (([l0].[Name] IS NULL) AND ([l].[Name] IS NULL)) GROUP BY [l0].[Date] ) AS [t] INNER JOIN ( @@ -3194,7 +3194,7 @@ INNER JOIN ( FROM [LevelOne] AS [l1] ) AS [t1] WHERE (1 < [t1].[row]) AND ([t1].[row] <= 6) -) AS [t0] ON (([l].[Name] = [t0].[Name]) OR ([l].[Name] IS NULL AND [t0].[Name] IS NULL)) AND ([t].[Date] = [t0].[Date]) +) AS [t0] ON (([l].[Name] = [t0].[Name]) OR (([l].[Name] IS NULL) AND ([t0].[Name] IS NULL))) AND ([t].[Date] = [t0].[Date]) ORDER BY [l].[Id], [t].[Date], [t0].[Name], [t0].[Date]"); } diff --git a/test/EFCore.SqlServer.FunctionalTests/Query/ComplexNavigationsQuerySqlServerTest.cs b/test/EFCore.SqlServer.FunctionalTests/Query/ComplexNavigationsQuerySqlServerTest.cs index e4b3cb28818..20b26846441 100644 --- a/test/EFCore.SqlServer.FunctionalTests/Query/ComplexNavigationsQuerySqlServerTest.cs +++ b/test/EFCore.SqlServer.FunctionalTests/Query/ComplexNavigationsQuerySqlServerTest.cs @@ -242,7 +242,7 @@ public override async Task Navigation_inside_method_call_translated_to_join(bool @"SELECT [l].[Id], [l].[Date], [l].[Name], [l].[OneToMany_Optional_Self_Inverse1Id], [l].[OneToMany_Required_Self_Inverse1Id], [l].[OneToOne_Optional_Self1Id] FROM [LevelOne] AS [l] LEFT JOIN [LevelTwo] AS [l0] ON [l].[Id] = [l0].[Level1_Required_Id] -WHERE [l0].[Name] IS NOT NULL AND ([l0].[Name] LIKE N'L%')"); +WHERE ([l0].[Name] IS NOT NULL) AND ([l0].[Name] LIKE N'L%')"); } public override async Task Navigation_inside_method_call_translated_to_join2(bool async) @@ -253,7 +253,7 @@ public override async Task Navigation_inside_method_call_translated_to_join2(boo @"SELECT [l].[Id], [l].[Level2_Optional_Id], [l].[Level2_Required_Id], [l].[Name], [l].[OneToMany_Optional_Inverse3Id], [l].[OneToMany_Optional_Self_Inverse3Id], [l].[OneToMany_Required_Inverse3Id], [l].[OneToMany_Required_Self_Inverse3Id], [l].[OneToOne_Optional_PK_Inverse3Id], [l].[OneToOne_Optional_Self3Id] FROM [LevelThree] AS [l] INNER JOIN [LevelTwo] AS [l0] ON [l].[Level2_Required_Id] = [l0].[Id] -WHERE [l0].[Name] IS NOT NULL AND ([l0].[Name] LIKE N'L%')"); +WHERE ([l0].[Name] IS NOT NULL) AND ([l0].[Name] LIKE N'L%')"); } public override async Task Optional_navigation_inside_method_call_translated_to_join(bool async) @@ -264,7 +264,7 @@ public override async Task Optional_navigation_inside_method_call_translated_to_ @"SELECT [l].[Id], [l].[Date], [l].[Name], [l].[OneToMany_Optional_Self_Inverse1Id], [l].[OneToMany_Required_Self_Inverse1Id], [l].[OneToOne_Optional_Self1Id] FROM [LevelOne] AS [l] LEFT JOIN [LevelTwo] AS [l0] ON [l].[Id] = [l0].[Level1_Optional_Id] -WHERE [l0].[Name] IS NOT NULL AND ([l0].[Name] LIKE N'L%')"); +WHERE ([l0].[Name] IS NOT NULL) AND ([l0].[Name] LIKE N'L%')"); } public override async Task Optional_navigation_inside_property_method_translated_to_join(bool async) @@ -286,7 +286,7 @@ public override async Task Optional_navigation_inside_nested_method_call_transla @"SELECT [l].[Id], [l].[Date], [l].[Name], [l].[OneToMany_Optional_Self_Inverse1Id], [l].[OneToMany_Required_Self_Inverse1Id], [l].[OneToOne_Optional_Self1Id] FROM [LevelOne] AS [l] LEFT JOIN [LevelTwo] AS [l0] ON [l].[Id] = [l0].[Level1_Optional_Id] -WHERE [l0].[Name] IS NOT NULL AND (UPPER([l0].[Name]) LIKE N'L%')"); +WHERE ([l0].[Name] IS NOT NULL) AND (UPPER([l0].[Name]) LIKE N'L%')"); } public override async Task Method_call_on_optional_navigation_translates_to_null_conditional_properly_for_arguments(bool async) @@ -297,7 +297,7 @@ public override async Task Method_call_on_optional_navigation_translates_to_null @"SELECT [l].[Id], [l].[Date], [l].[Name], [l].[OneToMany_Optional_Self_Inverse1Id], [l].[OneToMany_Required_Self_Inverse1Id], [l].[OneToOne_Optional_Self1Id] FROM [LevelOne] AS [l] LEFT JOIN [LevelTwo] AS [l0] ON [l].[Id] = [l0].[Level1_Optional_Id] -WHERE ([l0].[Name] = N'') OR ([l0].[Name] IS NOT NULL AND (LEFT([l0].[Name], LEN([l0].[Name])) = [l0].[Name]))"); +WHERE ([l0].[Name] = N'') OR (([l0].[Name] IS NOT NULL) AND (LEFT([l0].[Name], LEN([l0].[Name])) = [l0].[Name]))"); } public override async Task Optional_navigation_inside_method_call_translated_to_join_keeps_original_nullability(bool async) @@ -598,7 +598,7 @@ public override async Task Where_nav_prop_reference_optional2(bool async) @"SELECT [l].[Id] FROM [LevelOne] AS [l] LEFT JOIN [LevelTwo] AS [l0] ON [l].[Id] = [l0].[Level1_Optional_Id] -WHERE ([l0].[Name] = N'L2 05') OR (([l0].[Name] <> N'L2 42') OR [l0].[Name] IS NULL)"); +WHERE ([l0].[Name] = N'L2 05') OR (([l0].[Name] <> N'L2 42') OR ([l0].[Name] IS NULL))"); } public override async Task Where_nav_prop_reference_optional2_via_DefaultIfEmpty(bool async) @@ -610,7 +610,7 @@ public override async Task Where_nav_prop_reference_optional2_via_DefaultIfEmpty FROM [LevelOne] AS [l] LEFT JOIN [LevelTwo] AS [l0] ON [l].[Id] = [l0].[Level1_Optional_Id] LEFT JOIN [LevelTwo] AS [l1] ON [l].[Id] = [l1].[Level1_Optional_Id] -WHERE ([l0].[Name] = N'L2 05') OR (([l1].[Name] <> N'L2 42') OR [l1].[Name] IS NULL)"); +WHERE ([l0].[Name] = N'L2 05') OR (([l1].[Name] <> N'L2 42') OR ([l1].[Name] IS NULL))"); } public override async Task Select_multiple_nav_prop_reference_optional(bool async) @@ -633,7 +633,7 @@ public override async Task Where_multiple_nav_prop_reference_optional_member_com FROM [LevelOne] AS [l] LEFT JOIN [LevelTwo] AS [l0] ON [l].[Id] = [l0].[Level1_Optional_Id] LEFT JOIN [LevelThree] AS [l1] ON [l0].[Id] = [l1].[Level2_Optional_Id] -WHERE ([l1].[Name] <> N'L3 05') OR [l1].[Name] IS NULL"); +WHERE ([l1].[Name] <> N'L3 05') OR ([l1].[Name] IS NULL)"); } public override async Task Where_multiple_nav_prop_reference_optional_member_compared_to_null(bool async) @@ -751,7 +751,7 @@ public override async Task Where_multiple_nav_prop_optional_required(bool async) FROM [LevelOne] AS [l] LEFT JOIN [LevelTwo] AS [l0] ON [l].[Id] = [l0].[Level1_Optional_Id] LEFT JOIN [LevelThree] AS [l1] ON [l0].[Id] = [l1].[Level2_Required_Id] -WHERE ([l1].[Name] <> N'L3 05') OR [l1].[Name] IS NULL"); +WHERE ([l1].[Name] <> N'L3 05') OR ([l1].[Name] IS NULL)"); } public override async Task SelectMany_navigation_comparison1(bool async) @@ -799,7 +799,7 @@ FROM [LevelOne] AS [l] CROSS JOIN [LevelTwo] AS [l0] LEFT JOIN [LevelTwo] AS [l1] ON [l].[Id] = [l1].[Level1_Optional_Id] INNER JOIN [LevelOne] AS [l2] ON [l0].[Level1_Required_Id] = [l2].[Id] -WHERE ([l1].[Name] = N'L2 01') OR (([l2].[Name] <> N'Bar') OR [l2].[Name] IS NULL)"); +WHERE ([l1].[Name] = N'L2 01') OR (([l2].[Name] <> N'Bar') OR ([l2].[Name] IS NULL))"); } public override async Task Where_complex_predicate_with_with_nav_prop_and_OrElse2(bool async) @@ -811,7 +811,7 @@ public override async Task Where_complex_predicate_with_with_nav_prop_and_OrElse FROM [LevelOne] AS [l] LEFT JOIN [LevelTwo] AS [l0] ON [l].[Id] = [l0].[Level1_Optional_Id] LEFT JOIN [LevelThree] AS [l1] ON [l0].[Id] = [l1].[Level2_Required_Id] -WHERE ([l1].[Name] = N'L3 05') OR (([l0].[Name] <> N'L2 05') OR [l0].[Name] IS NULL)"); +WHERE ([l1].[Name] = N'L3 05') OR (([l0].[Name] <> N'L2 05') OR ([l0].[Name] IS NULL))"); } public override async Task Where_complex_predicate_with_with_nav_prop_and_OrElse3(bool async) @@ -824,7 +824,7 @@ FROM [LevelOne] AS [l] LEFT JOIN [LevelTwo] AS [l0] ON [l].[Id] = [l0].[Level1_Optional_Id] LEFT JOIN [LevelTwo] AS [l1] ON [l].[Id] = [l1].[Level1_Required_Id] LEFT JOIN [LevelThree] AS [l2] ON [l1].[Id] = [l2].[Level2_Optional_Id] -WHERE (([l0].[Name] <> N'L2 05') OR [l0].[Name] IS NULL) OR ([l2].[Name] = N'L3 05')"); +WHERE (([l0].[Name] <> N'L2 05') OR ([l0].[Name] IS NULL)) OR ([l2].[Name] = N'L3 05')"); } public override async Task Where_complex_predicate_with_with_nav_prop_and_OrElse4(bool async) @@ -837,7 +837,7 @@ FROM [LevelThree] AS [l] LEFT JOIN [LevelTwo] AS [l0] ON [l].[Level2_Optional_Id] = [l0].[Id] INNER JOIN [LevelTwo] AS [l1] ON [l].[Level2_Required_Id] = [l1].[Id] LEFT JOIN [LevelOne] AS [l2] ON [l1].[Level1_Optional_Id] = [l2].[Id] -WHERE (([l0].[Name] <> N'L2 05') OR [l0].[Name] IS NULL) OR ([l2].[Name] = N'L1 05')"); +WHERE (([l0].[Name] <> N'L2 05') OR ([l0].[Name] IS NULL)) OR ([l2].[Name] = N'L1 05')"); } public override async Task Complex_navigations_with_predicate_projected_into_anonymous_type(bool async) @@ -850,7 +850,7 @@ FROM [LevelOne] AS [l] LEFT JOIN [LevelTwo] AS [l0] ON [l].[Id] = [l0].[Level1_Required_Id] LEFT JOIN [LevelThree] AS [l1] ON [l0].[Id] = [l1].[Level2_Required_Id] LEFT JOIN [LevelThree] AS [l2] ON [l0].[Id] = [l2].[Level2_Optional_Id] -WHERE (([l1].[Id] = [l2].[Id]) OR ([l1].[Id] IS NULL AND [l2].[Id] IS NULL)) AND (([l2].[Id] <> 7) OR [l2].[Id] IS NULL)"); +WHERE (([l1].[Id] = [l2].[Id]) OR (([l1].[Id] IS NULL) AND ([l2].[Id] IS NULL))) AND (([l2].[Id] <> 7) OR ([l2].[Id] IS NULL))"); } public override async Task Complex_navigations_with_predicate_projected_into_anonymous_type2(bool async) @@ -863,7 +863,7 @@ FROM [LevelThree] AS [l] INNER JOIN [LevelTwo] AS [l0] ON [l].[Level2_Required_Id] = [l0].[Id] INNER JOIN [LevelOne] AS [l1] ON [l0].[Level1_Required_Id] = [l1].[Id] LEFT JOIN [LevelOne] AS [l2] ON [l0].[Level1_Optional_Id] = [l2].[Id] -WHERE ([l1].[Id] = [l2].[Id]) AND (([l2].[Id] <> 7) OR [l2].[Id] IS NULL)"); +WHERE ([l1].[Id] = [l2].[Id]) AND (([l2].[Id] <> 7) OR ([l2].[Id] IS NULL))"); } public override async Task Optional_navigation_projected_into_DTO(bool async) @@ -982,7 +982,7 @@ public override async Task Include_with_optional_navigation(bool async) @"SELECT [l].[Id], [l].[Date], [l].[Name], [l].[OneToMany_Optional_Self_Inverse1Id], [l].[OneToMany_Required_Self_Inverse1Id], [l].[OneToOne_Optional_Self1Id], [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 [LevelOne] AS [l] LEFT JOIN [LevelTwo] AS [l0] ON [l].[Id] = [l0].[Level1_Optional_Id] -WHERE ([l0].[Name] <> N'L2 05') OR [l0].[Name] IS NULL"); +WHERE ([l0].[Name] <> N'L2 05') OR ([l0].[Name] IS NULL)"); } public override async Task Join_flattening_bug_4539(bool async) @@ -1140,7 +1140,7 @@ FROM [LevelOne] AS [l] WHERE ( SELECT COUNT(*) FROM [LevelThree] AS [l1] - WHERE [l0].[Id] IS NOT NULL AND ([l0].[Id] = [l1].[OneToMany_Optional_Inverse3Id])) > 0"); + WHERE ([l0].[Id] IS NOT NULL) AND ([l0].[Id] = [l1].[OneToMany_Optional_Inverse3Id])) > 0"); } public override async Task Where_navigation_property_to_collection2(bool async) @@ -1744,7 +1744,7 @@ SELECT 1 FROM ( SELECT DISTINCT [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Name], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Optional_Self_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[OneToMany_Required_Self_Inverse3Id], [l1].[OneToOne_Optional_PK_Inverse3Id], [l1].[OneToOne_Optional_Self3Id] FROM [LevelThree] AS [l1] - WHERE [l0].[Id] IS NOT NULL AND ([l0].[Id] = [l1].[OneToMany_Optional_Inverse3Id]) + WHERE ([l0].[Id] IS NOT NULL) AND ([l0].[Id] = [l1].[OneToMany_Optional_Inverse3Id]) ) AS [t] WHERE [t].[Id] = 1)"); } @@ -1760,7 +1760,7 @@ FROM [LevelOne] AS [l] WHERE EXISTS ( SELECT DISTINCT 1 FROM [LevelThree] AS [l1] - WHERE ([l0].[Id] IS NOT NULL AND ([l0].[Id] = [l1].[OneToMany_Optional_Inverse3Id])) AND (CAST(LEN([l1].[Name]) AS int) = 1))"); + WHERE (([l0].[Id] IS NOT NULL) AND ([l0].[Id] = [l1].[OneToMany_Optional_Inverse3Id])) AND (CAST(LEN([l1].[Name]) AS int) = 1))"); } public override async Task Required_navigation_on_a_subquery_with_First_in_projection(bool async) @@ -1815,7 +1815,7 @@ public override async Task Manually_created_left_join_propagates_nullability_to_ FROM [LevelOne] AS [l] LEFT JOIN [LevelTwo] AS [l0] ON [l].[Id] = [l0].[Level1_Optional_Id] LEFT JOIN [LevelOne] AS [l1] ON [l0].[Level1_Required_Id] = [l1].[Id] -WHERE ([l1].[Name] <> N'L3 02') OR [l1].[Name] IS NULL"); +WHERE ([l1].[Name] <> N'L3 02') OR ([l1].[Name] IS NULL)"); } public override async Task Optional_navigation_propagates_nullability_to_manually_created_left_join1(bool async) @@ -2141,7 +2141,7 @@ public override async Task Optional_navigation_in_subquery_with_unrelated_projec SELECT TOP(@__p_0) [l].[Id] FROM [LevelOne] AS [l] LEFT JOIN [LevelTwo] AS [l0] ON [l].[Id] = [l0].[Level1_Optional_Id] -WHERE ([l0].[Name] <> N'Foo') OR [l0].[Name] IS NULL +WHERE ([l0].[Name] <> N'Foo') OR ([l0].[Name] IS NULL) ORDER BY [l].[Id]"); } @@ -2155,7 +2155,7 @@ public override async Task Explicit_GroupJoin_in_subquery_with_unrelated_project SELECT TOP(@__p_0) [l].[Id] FROM [LevelOne] AS [l] LEFT JOIN [LevelTwo] AS [l0] ON [l].[Id] = [l0].[Level1_Optional_Id] -WHERE ([l0].[Name] <> N'Foo') OR [l0].[Name] IS NULL +WHERE ([l0].[Name] <> N'Foo') OR ([l0].[Name] IS NULL) ORDER BY [l].[Id]"); } @@ -2169,7 +2169,7 @@ public override async Task Explicit_GroupJoin_in_subquery_with_unrelated_project SELECT DISTINCT [l].[Id], [l].[Date], [l].[Name], [l].[OneToMany_Optional_Self_Inverse1Id], [l].[OneToMany_Required_Self_Inverse1Id], [l].[OneToOne_Optional_Self1Id] FROM [LevelOne] AS [l] LEFT JOIN [LevelTwo] AS [l0] ON [l].[Id] = [l0].[Level1_Optional_Id] - WHERE ([l0].[Name] <> N'Foo') OR [l0].[Name] IS NULL + WHERE ([l0].[Name] <> N'Foo') OR ([l0].[Name] IS NULL) ) AS [t]"); } @@ -2181,7 +2181,7 @@ public override async Task Explicit_GroupJoin_in_subquery_with_unrelated_project @"SELECT DISTINCT [l].[Id] FROM [LevelOne] AS [l] LEFT JOIN [LevelTwo] AS [l0] ON [l].[Id] = [l0].[Level1_Optional_Id] -WHERE ([l0].[Name] <> N'Foo') OR [l0].[Name] IS NULL"); +WHERE ([l0].[Name] <> N'Foo') OR ([l0].[Name] IS NULL)"); } public override async Task Explicit_GroupJoin_in_subquery_with_unrelated_projection4(bool async) @@ -2196,7 +2196,7 @@ SELECT TOP(@__p_0) [t].[Id] SELECT DISTINCT [l].[Id] FROM [LevelOne] AS [l] LEFT JOIN [LevelTwo] AS [l0] ON [l].[Id] = [l0].[Level1_Optional_Id] - WHERE ([l0].[Name] <> N'Foo') OR [l0].[Name] IS NULL + WHERE ([l0].[Name] <> N'Foo') OR ([l0].[Name] IS NULL) ) AS [t] ORDER BY [t].[Id]"); } @@ -2255,7 +2255,7 @@ public override async Task Join_condition_optimizations_applied_correctly_when_a AssertSql( @"SELECT [l].[Id], [l].[Date], [l].[Name], [l].[OneToMany_Optional_Self_Inverse1Id], [l].[OneToMany_Required_Self_Inverse1Id], [l].[OneToOne_Optional_Self1Id] FROM [LevelOne] AS [l] -INNER JOIN [LevelTwo] AS [l0] ON ([l].[OneToMany_Optional_Self_Inverse1Id] = [l0].[Level1_Optional_Id]) OR ([l].[OneToMany_Optional_Self_Inverse1Id] IS NULL AND [l0].[Level1_Optional_Id] IS NULL)"); +INNER JOIN [LevelTwo] AS [l0] ON ([l].[OneToMany_Optional_Self_Inverse1Id] = [l0].[Level1_Optional_Id]) OR (([l].[OneToMany_Optional_Self_Inverse1Id] IS NULL) AND ([l0].[Level1_Optional_Id] IS NULL))"); } public override async Task Join_condition_optimizations_applied_correctly_when_anonymous_type_with_multiple_properties(bool async) @@ -2265,7 +2265,7 @@ public override async Task Join_condition_optimizations_applied_correctly_when_a AssertSql( @"SELECT [l].[Id], [l].[Date], [l].[Name], [l].[OneToMany_Optional_Self_Inverse1Id], [l].[OneToMany_Required_Self_Inverse1Id], [l].[OneToOne_Optional_Self1Id] FROM [LevelOne] AS [l] -INNER JOIN [LevelTwo] AS [l0] ON (([l].[OneToMany_Optional_Self_Inverse1Id] = [l0].[Level1_Optional_Id]) OR ([l].[OneToMany_Optional_Self_Inverse1Id] IS NULL AND [l0].[Level1_Optional_Id] IS NULL)) AND (([l].[OneToOne_Optional_Self1Id] = [l0].[OneToMany_Optional_Self_Inverse2Id]) OR ([l].[OneToOne_Optional_Self1Id] IS NULL AND [l0].[OneToMany_Optional_Self_Inverse2Id] IS NULL))"); +INNER JOIN [LevelTwo] AS [l0] ON (([l].[OneToMany_Optional_Self_Inverse1Id] = [l0].[Level1_Optional_Id]) OR (([l].[OneToMany_Optional_Self_Inverse1Id] IS NULL) AND ([l0].[Level1_Optional_Id] IS NULL))) AND (([l].[OneToOne_Optional_Self1Id] = [l0].[OneToMany_Optional_Self_Inverse2Id]) OR (([l].[OneToOne_Optional_Self1Id] IS NULL) AND ([l0].[OneToMany_Optional_Self_Inverse2Id] IS NULL)))"); } public override async Task Nested_group_join_with_take(bool async) @@ -2294,7 +2294,7 @@ public override async Task Navigation_with_same_navigation_compared_to_null(bool @"SELECT [l].[Id] FROM [LevelTwo] AS [l] INNER JOIN [LevelOne] AS [l0] ON [l].[OneToMany_Required_Inverse2Id] = [l0].[Id] -WHERE ([l0].[Name] <> N'L1 07') OR [l0].[Name] IS NULL"); +WHERE ([l0].[Name] <> N'L1 07') OR ([l0].[Name] IS NULL)"); } public override async Task Multi_level_navigation_compared_to_null(bool async) @@ -2318,7 +2318,7 @@ public override async Task Multi_level_navigation_with_same_navigation_compared_ FROM [LevelThree] AS [l] LEFT JOIN [LevelTwo] AS [l0] ON [l].[OneToMany_Optional_Inverse3Id] = [l0].[Id] LEFT JOIN [LevelOne] AS [l1] ON [l0].[Level1_Required_Id] = [l1].[Id] -WHERE (([l1].[Name] <> N'L1 07') OR [l1].[Name] IS NULL) AND [l1].[Id] IS NOT NULL"); +WHERE (([l1].[Name] <> N'L1 07') OR ([l1].[Name] IS NULL)) AND ([l1].[Id] IS NOT NULL)"); } public override async Task Navigations_compared_to_each_other1(bool async) @@ -2367,7 +2367,7 @@ FROM [LevelTwo] AS [l] WHERE EXISTS ( SELECT 1 FROM [LevelFour] AS [l1] - WHERE [l0].[Id] IS NOT NULL AND ([l0].[Id] = [l1].[OneToMany_Optional_Inverse4Id]))"); + WHERE ([l0].[Id] IS NOT NULL) AND ([l0].[Id] = [l1].[OneToMany_Optional_Inverse4Id]))"); } public override async Task Navigations_compared_to_each_other5(bool async) @@ -2382,7 +2382,7 @@ FROM [LevelTwo] AS [l] WHERE EXISTS ( SELECT 1 FROM [LevelFour] AS [l2] - WHERE [l0].[Id] IS NOT NULL AND ([l0].[Id] = [l2].[OneToMany_Optional_Inverse4Id]))"); + WHERE ([l0].[Id] IS NOT NULL) AND ([l0].[Id] = [l2].[OneToMany_Optional_Inverse4Id]))"); } public override async Task Level4_Include(bool async) @@ -2426,11 +2426,11 @@ public override async Task Select_subquery_with_client_eval_and_navigation2(bool SELECT TOP(1) [l1].[Name] FROM [LevelTwo] AS [l0] INNER JOIN [LevelOne] AS [l1] ON [l0].[Level1_Required_Id] = [l1].[Id] - ORDER BY [l0].[Id]) = N'L1 02') AND ( + ORDER BY [l0].[Id]) = N'L1 02') AND (( SELECT TOP(1) [l1].[Name] FROM [LevelTwo] AS [l0] INNER JOIN [LevelOne] AS [l1] ON [l0].[Level1_Required_Id] = [l1].[Id] - ORDER BY [l0].[Id]) IS NOT NULL THEN CAST(1 AS bit) + ORDER BY [l0].[Id]) IS NOT NULL) THEN CAST(1 AS bit) ELSE CAST(0 AS bit) END FROM [LevelTwo] AS [l]"); @@ -2492,7 +2492,7 @@ public override async Task Project_collection_navigation_count(bool async) @"SELECT [l].[Id], ( SELECT COUNT(*) FROM [LevelThree] AS [l1] - WHERE [l0].[Id] IS NOT NULL AND ([l0].[Id] = [l1].[OneToMany_Optional_Inverse3Id])) AS [Count] + WHERE ([l0].[Id] IS NOT NULL) AND ([l0].[Id] = [l1].[OneToMany_Optional_Inverse3Id])) AS [Count] FROM [LevelOne] AS [l] LEFT JOIN [LevelTwo] AS [l0] ON [l].[Id] = [l0].[Level1_Optional_Id]"); } @@ -2681,7 +2681,7 @@ public override async Task Accessing_optional_property_inside_result_operator_su @"SELECT [l].[Id], [l].[Date], [l].[Name], [l].[OneToMany_Optional_Self_Inverse1Id], [l].[OneToMany_Required_Self_Inverse1Id], [l].[OneToOne_Optional_Self1Id] FROM [LevelOne] AS [l] LEFT JOIN [LevelTwo] AS [l0] ON [l].[Id] = [l0].[Level1_Optional_Id] -WHERE [l0].[Name] NOT IN (N'Name1', N'Name2') OR [l0].[Name] IS NULL"); +WHERE [l0].[Name] NOT IN (N'Name1', N'Name2') OR ([l0].[Name] IS NULL)"); } public override async Task Include1(bool async) @@ -2766,7 +2766,7 @@ public override async Task Include8(bool async) @"SELECT [l].[Id], [l].[Date], [l].[Level1_Optional_Id], [l].[Level1_Required_Id], [l].[Name], [l].[OneToMany_Optional_Inverse2Id], [l].[OneToMany_Optional_Self_Inverse2Id], [l].[OneToMany_Required_Inverse2Id], [l].[OneToMany_Required_Self_Inverse2Id], [l].[OneToOne_Optional_PK_Inverse2Id], [l].[OneToOne_Optional_Self2Id], [l0].[Id], [l0].[Date], [l0].[Name], [l0].[OneToMany_Optional_Self_Inverse1Id], [l0].[OneToMany_Required_Self_Inverse1Id], [l0].[OneToOne_Optional_Self1Id] FROM [LevelTwo] AS [l] LEFT JOIN [LevelOne] AS [l0] ON [l].[Level1_Optional_Id] = [l0].[Id] -WHERE ([l0].[Name] <> N'Fubar') OR [l0].[Name] IS NULL"); +WHERE ([l0].[Name] <> N'Fubar') OR ([l0].[Name] IS NULL)"); } public override async Task Include9(bool async) @@ -2777,7 +2777,7 @@ public override async Task Include9(bool async) @"SELECT [l].[Id], [l].[Date], [l].[Level1_Optional_Id], [l].[Level1_Required_Id], [l].[Name], [l].[OneToMany_Optional_Inverse2Id], [l].[OneToMany_Optional_Self_Inverse2Id], [l].[OneToMany_Required_Inverse2Id], [l].[OneToMany_Required_Self_Inverse2Id], [l].[OneToOne_Optional_PK_Inverse2Id], [l].[OneToOne_Optional_Self2Id], [l0].[Id], [l0].[Date], [l0].[Name], [l0].[OneToMany_Optional_Self_Inverse1Id], [l0].[OneToMany_Required_Self_Inverse1Id], [l0].[OneToOne_Optional_Self1Id] FROM [LevelTwo] AS [l] LEFT JOIN [LevelOne] AS [l0] ON [l].[Level1_Optional_Id] = [l0].[Id] -WHERE ([l0].[Name] <> N'Fubar') OR [l0].[Name] IS NULL"); +WHERE ([l0].[Name] <> N'Fubar') OR ([l0].[Name] IS NULL)"); } public override async Task Include10(bool async) @@ -2892,7 +2892,7 @@ public override async Task Include18_2(bool async) SELECT DISTINCT [l].[Id], [l].[Date], [l].[Name], [l].[OneToMany_Optional_Self_Inverse1Id], [l].[OneToMany_Required_Self_Inverse1Id], [l].[OneToOne_Optional_Self1Id] FROM [LevelOne] AS [l] LEFT JOIN [LevelTwo] AS [l0] ON [l].[Id] = [l0].[Level1_Required_Id] - WHERE ([l0].[Name] <> N'Foo') OR [l0].[Name] IS NULL + WHERE ([l0].[Name] <> N'Foo') OR ([l0].[Name] IS NULL) ) AS [t] LEFT JOIN [LevelTwo] AS [l1] ON [t].[Id] = [l1].[Level1_Optional_Id]"); } @@ -3023,7 +3023,7 @@ public override async Task Include_with_all_method_include_gets_ignored(bool isA WHEN NOT EXISTS ( SELECT 1 FROM [LevelOne] AS [l] - WHERE ([l].[Name] = N'Foo') AND [l].[Name] IS NOT NULL) THEN CAST(1 AS bit) + WHERE ([l].[Name] = N'Foo') AND ([l].[Name] IS NOT NULL)) THEN CAST(1 AS bit) ELSE CAST(0 AS bit) END"); } @@ -3071,7 +3071,7 @@ FROM [LevelThree] AS [l1] ORDER BY [l1].[Id]) FROM [LevelTwo] AS [l0] WHERE [l0].[Level1_Optional_Id] = [l].[Id] - ORDER BY [l0].[Id]) <> N'Foo') OR ( + ORDER BY [l0].[Id]) <> N'Foo') OR (( SELECT TOP(1) ( SELECT TOP(1) ( SELECT TOP(1) [l2].[Name] @@ -3083,7 +3083,7 @@ FROM [LevelThree] AS [l1] ORDER BY [l1].[Id]) FROM [LevelTwo] AS [l0] WHERE [l0].[Level1_Optional_Id] = [l].[Id] - ORDER BY [l0].[Id]) IS NULL + ORDER BY [l0].[Id]) IS NULL) ORDER BY [l].[Id]"); } @@ -3157,11 +3157,11 @@ FROM [LevelTwo] AS [l1] SELECT TOP(1) [l2].[Id] FROM [LevelTwo] AS [l2] WHERE [l].[Id] = [l2].[OneToMany_Optional_Inverse2Id] - ORDER BY [l2].[Id]) = [l0].[OneToMany_Optional_Inverse3Id]) OR (( + ORDER BY [l2].[Id]) = [l0].[OneToMany_Optional_Inverse3Id]) OR ((( SELECT TOP(1) [l2].[Id] FROM [LevelTwo] AS [l2] WHERE [l].[Id] = [l2].[OneToMany_Optional_Inverse2Id] - ORDER BY [l2].[Id]) IS NULL AND [l0].[OneToMany_Optional_Inverse3Id] IS NULL)) + ORDER BY [l2].[Id]) IS NULL) AND ([l0].[OneToMany_Optional_Inverse3Id] IS NULL))) ORDER BY [l0].[Id]) FROM [LevelOne] AS [l]"); } @@ -3246,7 +3246,7 @@ FROM [LevelOne] AS [l] ORDER BY ( SELECT COUNT(*) FROM [LevelThree] AS [l2] - WHERE [l0].[Id] IS NOT NULL AND ([l0].[Id] = [l2].[OneToMany_Required_Inverse3Id])), [l1].[Name]"); + WHERE ([l0].[Id] IS NOT NULL) AND ([l0].[Id] = [l2].[OneToMany_Required_Inverse3Id])), [l1].[Name]"); } public override async Task Null_conditional_is_not_applied_explicitly_for_optional_navigation(bool async) @@ -3257,7 +3257,7 @@ public override async Task Null_conditional_is_not_applied_explicitly_for_option @"SELECT [l].[Id], [l].[Date], [l].[Name], [l].[OneToMany_Optional_Self_Inverse1Id], [l].[OneToMany_Required_Self_Inverse1Id], [l].[OneToOne_Optional_Self1Id] FROM [LevelOne] AS [l] LEFT JOIN [LevelTwo] AS [l0] ON [l].[Id] = [l0].[Level1_Optional_Id] -WHERE [l0].[Id] IS NOT NULL AND ([l0].[Name] = N'L2 01')"); +WHERE ([l0].[Id] IS NOT NULL) AND ([l0].[Name] = N'L2 01')"); } public override async Task Sum_with_selector_cast_using_as(bool async) @@ -3303,7 +3303,7 @@ FROM [LevelOne] AS [l] INNER JOIN [LevelTwo] AS [l0] ON [l].[Id] = [l0].[Level1_Required_Id] INNER JOIN [LevelThree] AS [l1] ON [l0].[Id] = [l1].[Level2_Required_Id] INNER JOIN [LevelFour] AS [l2] ON [l1].[Id] = [l2].[Level3_Required_Id] -LEFT JOIN [LevelOne] AS [l3] ON ([l0].[Id] >= [l3].[Id]) AND (([l2].[Name] = [l3].[Name]) OR ([l2].[Name] IS NULL AND [l3].[Name] IS NULL))"); +LEFT JOIN [LevelOne] AS [l3] ON ([l0].[Id] >= [l3].[Id]) AND (([l2].[Name] = [l3].[Name]) OR (([l2].[Name] IS NULL) AND ([l3].[Name] IS NULL)))"); } public override async Task Nested_SelectMany_correlated_with_join_table_correctly_translated_to_apply(bool async) @@ -3323,7 +3323,7 @@ CROSS APPLY ( SELECT [l].[Name] AS [l1Name], [l1].[Name] AS [l2Name], [l3].[Name] AS [l3Name] FROM [LevelFour] AS [l2] LEFT JOIN [LevelThree] AS [l3] ON [l2].[OneToOne_Optional_PK_Inverse4Id] = [l3].[Id] - WHERE ([l1].[Id] = [l2].[OneToMany_Optional_Inverse4Id]) OR ([l1].[Id] IS NULL AND [l2].[OneToMany_Optional_Inverse4Id] IS NULL) + WHERE ([l1].[Id] = [l2].[OneToMany_Optional_Inverse4Id]) OR (([l1].[Id] IS NULL) AND ([l2].[OneToMany_Optional_Inverse4Id] IS NULL)) ) AS [t] WHERE [l].[Id] = [l0].[OneToMany_Optional_Inverse2Id] ) AS [t0]"); @@ -3369,7 +3369,7 @@ WHEN EXISTS ( SELECT 1 FROM [LevelOne] AS [l1] LEFT JOIN [LevelTwo] AS [l2] ON [l1].[Id] = [l2].[Level1_Optional_Id] - WHERE ([l2].[Name] = [l0].[Name]) OR ([l2].[Name] IS NULL AND [l0].[Name] IS NULL)) THEN CAST(1 AS bit) + WHERE ([l2].[Name] = [l0].[Name]) OR (([l2].[Name] IS NULL) AND ([l0].[Name] IS NULL))) THEN CAST(1 AS bit) ELSE CAST(0 AS bit) END AS [Contains] FROM [LevelOne] AS [l] @@ -3386,7 +3386,7 @@ WHEN EXISTS ( SELECT 1 FROM [LevelOne] AS [l2] LEFT JOIN [LevelTwo] AS [l3] ON [l2].[Id] = [l3].[Level1_Optional_Id] - WHERE ([l3].[Id] = [l1].[Id]) OR ([l3].[Id] IS NULL AND [l1].[Id] IS NULL)) THEN CAST(1 AS bit) + WHERE ([l3].[Id] = [l1].[Id]) OR (([l3].[Id] IS NULL) AND ([l1].[Id] IS NULL))) THEN CAST(1 AS bit) ELSE CAST(0 AS bit) END AS [Contains] FROM [LevelOne] AS [l] @@ -3430,7 +3430,7 @@ public override async Task GroupBy_aggregate_where_required_relationship(bool as FROM [LevelTwo] AS [l] INNER JOIN [LevelOne] AS [l0] ON [l].[OneToMany_Required_Inverse2Id] = [l0].[Id] GROUP BY [l0].[Id] -HAVING (MAX([l].[Id]) <> 2) OR MAX([l].[Id]) IS NULL"); +HAVING (MAX([l].[Id]) <> 2) OR (MAX([l].[Id]) IS NULL)"); } public override async Task GroupBy_aggregate_where_required_relationship_2(bool async) @@ -3477,10 +3477,10 @@ FROM [LevelOne] AS [l] WHERE (CASE WHEN [l0].[Id] IS NULL THEN NULL ELSE [l1].[Name] -END <> N'L') OR CASE +END <> N'L') OR (CASE WHEN [l0].[Id] IS NULL THEN NULL ELSE [l1].[Name] -END IS NULL"); +END IS NULL)"); } public override async Task Distinct_skip_without_orderby(bool async) @@ -3586,7 +3586,7 @@ LEFT JOIN ( FROM [LevelThree] AS [l1] GROUP BY [l1].[Name] ) AS [t] ON [l].[Name] = [t].[Key] -WHERE [l0].[Name] IS NOT NULL OR ([t].[Count] > 0)"); +WHERE ([l0].[Name] IS NOT NULL) OR ([t].[Count] > 0)"); } public override async Task Collection_FirstOrDefault_property_accesses_in_projection(bool async) @@ -3657,10 +3657,10 @@ FROM [LevelTwo] AS [l1] WHERE ([l].[Id] = [l1].[OneToMany_Optional_Inverse2Id]) AND ([l1].[Name] = N'L2 02')) AND ((( SELECT TOP(1) [l2].[Id] FROM [LevelTwo] AS [l2] - WHERE ([l].[Id] = [l2].[OneToMany_Optional_Inverse2Id]) AND ([l2].[Name] = N'L2 02')) = [l0].[OneToMany_Optional_Inverse3Id]) OR (( + WHERE ([l].[Id] = [l2].[OneToMany_Optional_Inverse2Id]) AND ([l2].[Name] = N'L2 02')) = [l0].[OneToMany_Optional_Inverse3Id]) OR ((( SELECT TOP(1) [l2].[Id] FROM [LevelTwo] AS [l2] - WHERE ([l].[Id] = [l2].[OneToMany_Optional_Inverse2Id]) AND ([l2].[Name] = N'L2 02')) IS NULL AND [l0].[OneToMany_Optional_Inverse3Id] IS NULL)) + WHERE ([l].[Id] = [l2].[OneToMany_Optional_Inverse2Id]) AND ([l2].[Name] = N'L2 02')) IS NULL) AND ([l0].[OneToMany_Optional_Inverse3Id] IS NULL))) ORDER BY [l0].[Id]) AS [Pushdown] FROM [LevelOne] AS [l] WHERE [l].[Id] < 2"); diff --git a/test/EFCore.SqlServer.FunctionalTests/Query/ComplexNavigationsSharedTypeQuerySqlServerTest.cs b/test/EFCore.SqlServer.FunctionalTests/Query/ComplexNavigationsSharedTypeQuerySqlServerTest.cs index a7a80bb8fd8..77dc15094b2 100644 --- a/test/EFCore.SqlServer.FunctionalTests/Query/ComplexNavigationsSharedTypeQuerySqlServerTest.cs +++ b/test/EFCore.SqlServer.FunctionalTests/Query/ComplexNavigationsSharedTypeQuerySqlServerTest.cs @@ -38,9 +38,9 @@ LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[Level2_Name], [l0].[OneToMany_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id] FROM [Level1] AS [l0] INNER JOIN [Level1] AS [l1] ON [l0].[Id] = [l1].[Id] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL)) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t] ON [l].[Id] = CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + WHEN (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] END"); } @@ -63,9 +63,9 @@ LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[Level2_Name], [l0].[OneToMany_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id] FROM [Level1] AS [l0] INNER JOIN [Level1] AS [l1] ON [l0].[Id] = [l1].[Id] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL)) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t] ON [l].[Id] = CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + WHEN (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] END LEFT JOIN ( SELECT [l2].[Id], [l2].[Level2_Optional_Id], [l2].[Level2_Required_Id], [l2].[Level3_Name], [l2].[OneToMany_Optional_Inverse3Id], [l2].[OneToMany_Required_Inverse3Id], [l2].[OneToOne_Optional_PK_Inverse3Id] @@ -74,13 +74,13 @@ INNER JOIN ( SELECT [l3].[Id] FROM [Level1] AS [l3] INNER JOIN [Level1] AS [l4] ON [l3].[Id] = [l4].[Id] - WHERE ([l3].[OneToOne_Required_PK_Date] IS NOT NULL AND [l3].[Level1_Required_Id] IS NOT NULL) AND [l3].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l3].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l3].[Level1_Required_Id] IS NOT NULL)) AND ([l3].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t1] ON [l2].[Id] = [t1].[Id] - WHERE [l2].[Level2_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l2].[Level2_Required_Id] IS NOT NULL) AND ([l2].[OneToMany_Required_Inverse3Id] IS NOT NULL) ) AS [t0] ON CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + WHEN (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] END = CASE - WHEN [t0].[Level2_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [t0].[Id] + WHEN ([t0].[Level2_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [t0].[Id] END"); } @@ -95,9 +95,9 @@ LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Required_Id], [l0].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l0] INNER JOIN [Level1] AS [l1] ON [l0].[Id] = [l1].[Id] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL)) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t] ON [l].[Id] = CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + WHEN (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] END LEFT JOIN ( SELECT [l2].[Id], [l2].[Level2_Required_Id], [l2].[Level3_Name], [l2].[OneToMany_Required_Inverse3Id] @@ -106,13 +106,13 @@ INNER JOIN ( SELECT [l3].[Id] FROM [Level1] AS [l3] INNER JOIN [Level1] AS [l4] ON [l3].[Id] = [l4].[Id] - WHERE ([l3].[OneToOne_Required_PK_Date] IS NOT NULL AND [l3].[Level1_Required_Id] IS NOT NULL) AND [l3].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l3].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l3].[Level1_Required_Id] IS NOT NULL)) AND ([l3].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t1] ON [l2].[Id] = [t1].[Id] - WHERE [l2].[Level2_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l2].[Level2_Required_Id] IS NOT NULL) AND ([l2].[OneToMany_Required_Inverse3Id] IS NOT NULL) ) AS [t0] ON CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + WHEN (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] END = CASE - WHEN [t0].[Level2_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [t0].[Id] + WHEN ([t0].[Level2_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [t0].[Id] END GROUP BY [t0].[Level3_Name]"); } @@ -128,9 +128,9 @@ LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Required_Id], [l0].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l0] INNER JOIN [Level1] AS [l1] ON [l0].[Id] = [l1].[Id] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL)) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t] ON [l].[Id] = CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + WHEN (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] END LEFT JOIN ( SELECT [l2].[Id], [l2].[Level2_Required_Id], [l2].[Level3_Name], [l2].[OneToMany_Required_Inverse3Id] @@ -139,25 +139,25 @@ INNER JOIN ( SELECT [l3].[Id] FROM [Level1] AS [l3] INNER JOIN [Level1] AS [l4] ON [l3].[Id] = [l4].[Id] - WHERE ([l3].[OneToOne_Required_PK_Date] IS NOT NULL AND [l3].[Level1_Required_Id] IS NOT NULL) AND [l3].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l3].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l3].[Level1_Required_Id] IS NOT NULL)) AND ([l3].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t1] ON [l2].[Id] = [t1].[Id] - WHERE [l2].[Level2_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l2].[Level2_Required_Id] IS NOT NULL) AND ([l2].[OneToMany_Required_Inverse3Id] IS NOT NULL) ) AS [t0] ON CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + WHEN (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] END = CASE - WHEN [t0].[Level2_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [t0].[Id] + WHEN ([t0].[Level2_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [t0].[Id] END LEFT JOIN ( SELECT [l5].[Id], [l5].[OneToOne_Required_PK_Date], [l5].[Level1_Required_Id], [l5].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l5] INNER JOIN [Level1] AS [l6] ON [l5].[Id] = [l6].[Id] - WHERE ([l5].[OneToOne_Required_PK_Date] IS NOT NULL AND [l5].[Level1_Required_Id] IS NOT NULL) AND [l5].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l5].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l5].[Level1_Required_Id] IS NOT NULL)) AND ([l5].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t2] ON [l].[Id] = CASE - WHEN ([t2].[OneToOne_Required_PK_Date] IS NOT NULL AND [t2].[Level1_Required_Id] IS NOT NULL) AND [t2].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t2].[Id] + WHEN (([t2].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t2].[Level1_Required_Id] IS NOT NULL)) AND ([t2].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t2].[Id] END GROUP BY [t0].[Level3_Name] HAVING MIN(COALESCE(CASE - WHEN ([t2].[OneToOne_Required_PK_Date] IS NOT NULL AND [t2].[Level1_Required_Id] IS NOT NULL) AND [t2].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t2].[Id] + WHEN (([t2].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t2].[Level1_Required_Id] IS NOT NULL)) AND ([t2].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t2].[Id] END, 0)) > 0"); } @@ -172,9 +172,9 @@ LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[Level2_Name], [l0].[OneToMany_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id] FROM [Level1] AS [l0] INNER JOIN [Level1] AS [l1] ON [l0].[Id] = [l1].[Id] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL)) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t] ON [l].[Id] = CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + WHEN (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] END LEFT JOIN ( SELECT [l2].[Id], [l2].[Level2_Optional_Id], [l2].[Level2_Required_Id], [l2].[Level3_Name], [l2].[OneToMany_Optional_Inverse3Id], [l2].[OneToMany_Required_Inverse3Id], [l2].[OneToOne_Optional_PK_Inverse3Id] @@ -183,13 +183,13 @@ INNER JOIN ( SELECT [l3].[Id] FROM [Level1] AS [l3] INNER JOIN [Level1] AS [l4] ON [l3].[Id] = [l4].[Id] - WHERE ([l3].[OneToOne_Required_PK_Date] IS NOT NULL AND [l3].[Level1_Required_Id] IS NOT NULL) AND [l3].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l3].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l3].[Level1_Required_Id] IS NOT NULL)) AND ([l3].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t1] ON [l2].[Id] = [t1].[Id] - WHERE [l2].[Level2_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l2].[Level2_Required_Id] IS NOT NULL) AND ([l2].[OneToMany_Required_Inverse3Id] IS NOT NULL) ) AS [t0] ON CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + WHEN (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] END = CASE - WHEN [t0].[Level2_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [t0].[Id] + WHEN ([t0].[Level2_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [t0].[Id] END LEFT JOIN ( SELECT [l5].[Id], [l5].[Level3_Optional_Id], [l5].[Level3_Required_Id], [l5].[Level4_Name], [l5].[OneToMany_Optional_Inverse4Id], [l5].[OneToMany_Required_Inverse4Id], [l5].[OneToOne_Optional_PK_Inverse4Id] @@ -201,15 +201,15 @@ INNER JOIN ( SELECT [l7].[Id] FROM [Level1] AS [l7] INNER JOIN [Level1] AS [l8] ON [l7].[Id] = [l8].[Id] - WHERE ([l7].[OneToOne_Required_PK_Date] IS NOT NULL AND [l7].[Level1_Required_Id] IS NOT NULL) AND [l7].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l7].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l7].[Level1_Required_Id] IS NOT NULL)) AND ([l7].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t4] ON [l6].[Id] = [t4].[Id] - WHERE [l6].[Level2_Required_Id] IS NOT NULL AND [l6].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l6].[Level2_Required_Id] IS NOT NULL) AND ([l6].[OneToMany_Required_Inverse3Id] IS NOT NULL) ) AS [t3] ON [l5].[Id] = [t3].[Id] - WHERE [l5].[Level3_Required_Id] IS NOT NULL AND [l5].[OneToMany_Required_Inverse4Id] IS NOT NULL + WHERE ([l5].[Level3_Required_Id] IS NOT NULL) AND ([l5].[OneToMany_Required_Inverse4Id] IS NOT NULL) ) AS [t2] ON CASE - WHEN [t0].[Level2_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [t0].[Id] + WHEN ([t0].[Level2_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [t0].[Id] END = CASE - WHEN [t2].[Level3_Required_Id] IS NOT NULL AND [t2].[OneToMany_Required_Inverse4Id] IS NOT NULL THEN [t2].[Id] + WHEN ([t2].[Level3_Required_Id] IS NOT NULL) AND ([t2].[OneToMany_Required_Inverse4Id] IS NOT NULL) THEN [t2].[Id] END"); } @@ -231,11 +231,11 @@ LEFT JOIN ( SELECT [l1].[Id], [l1].[OneToOne_Required_PK_Date], [l1].[Level1_Optional_Id], [l1].[Level1_Required_Id], [l1].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l1] INNER JOIN [Level1] AS [l2] ON [l1].[Id] = [l2].[Id] - WHERE ([l1].[OneToOne_Required_PK_Date] IS NOT NULL AND [l1].[Level1_Required_Id] IS NOT NULL) AND [l1].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l1].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l1].[Level1_Required_Id] IS NOT NULL)) AND ([l1].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t] ON [l0].[Id] = CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + WHEN (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] END - WHERE ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t0] ON [l].[Id] = [t0].[Level1_Optional_Id] ORDER BY [l].[Id] ) AS [t1] @@ -246,13 +246,13 @@ LEFT JOIN ( SELECT [l4].[Id], [l4].[OneToOne_Required_PK_Date], [l4].[Level1_Optional_Id], [l4].[Level1_Required_Id], [l4].[Level2_Name], [l4].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l4] INNER JOIN [Level1] AS [l5] ON [l4].[Id] = [l5].[Id] - WHERE ([l4].[OneToOne_Required_PK_Date] IS NOT NULL AND [l4].[Level1_Required_Id] IS NOT NULL) AND [l4].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l4].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l4].[Level1_Required_Id] IS NOT NULL)) AND ([l4].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t3] ON [l3].[Id] = CASE - WHEN ([t3].[OneToOne_Required_PK_Date] IS NOT NULL AND [t3].[Level1_Required_Id] IS NOT NULL) AND [t3].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t3].[Id] + WHEN (([t3].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t3].[Level1_Required_Id] IS NOT NULL)) AND ([t3].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t3].[Id] END - WHERE ([t3].[OneToOne_Required_PK_Date] IS NOT NULL AND [t3].[Level1_Required_Id] IS NOT NULL) AND [t3].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([t3].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t3].[Level1_Required_Id] IS NOT NULL)) AND ([t3].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t2] ON CASE - WHEN ([t1].[OneToOne_Required_PK_Date] IS NOT NULL AND [t1].[Level1_Required_Id] IS NOT NULL) AND [t1].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t1].[Id00] + WHEN (([t1].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t1].[Level1_Required_Id] IS NOT NULL)) AND ([t1].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t1].[Id00] END = [t2].[Level1_Optional_Id] ORDER BY [t1].[Id]"); } @@ -273,13 +273,13 @@ LEFT JOIN ( SELECT [l1].[Id], [l1].[OneToOne_Required_PK_Date], [l1].[Level1_Optional_Id], [l1].[Level1_Required_Id], [l1].[Level2_Name], [l1].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l1] INNER JOIN [Level1] AS [l2] ON [l1].[Id] = [l2].[Id] - WHERE ([l1].[OneToOne_Required_PK_Date] IS NOT NULL AND [l1].[Level1_Required_Id] IS NOT NULL) AND [l1].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l1].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l1].[Level1_Required_Id] IS NOT NULL)) AND ([l1].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t] ON [l0].[Id] = CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + WHEN (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] END - WHERE ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t0] ON [l].[Id] = [t0].[Level1_Optional_Id] - WHERE ([t0].[Level2_Name] <> N'Foo') OR [t0].[Level2_Name] IS NULL + WHERE ([t0].[Level2_Name] <> N'Foo') OR ([t0].[Level2_Name] IS NULL) ) AS [t1]"); } @@ -289,7 +289,7 @@ public override async Task Result_operator_nav_prop_reference_optional_via_Defau AssertSql( @"SELECT COALESCE(SUM(CASE - WHEN ([t0].[OneToOne_Required_PK_Date] IS NULL OR [t0].[Level1_Required_Id] IS NULL) OR [t0].[OneToMany_Required_Inverse2Id] IS NULL THEN 0 + WHEN (([t0].[OneToOne_Required_PK_Date] IS NULL) OR ([t0].[Level1_Required_Id] IS NULL)) OR ([t0].[OneToMany_Required_Inverse2Id] IS NULL) THEN 0 ELSE [t0].[Level1_Required_Id] END), 0) FROM [Level1] AS [l] @@ -300,11 +300,11 @@ LEFT JOIN ( SELECT [l1].[Id], [l1].[OneToOne_Required_PK_Date], [l1].[Level1_Optional_Id], [l1].[Level1_Required_Id], [l1].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l1] INNER JOIN [Level1] AS [l2] ON [l1].[Id] = [l2].[Id] - WHERE ([l1].[OneToOne_Required_PK_Date] IS NOT NULL AND [l1].[Level1_Required_Id] IS NOT NULL) AND [l1].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l1].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l1].[Level1_Required_Id] IS NOT NULL)) AND ([l1].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t] ON [l0].[Id] = CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + WHEN (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] END - WHERE ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t0] ON [l].[Id] = [t0].[Level1_Optional_Id]"); } @@ -321,22 +321,22 @@ public override async Task Member_over_null_check_ternary_and_nested_anonymous_t AssertSql( @"SELECT [l].[Id], [l].[Name], CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NULL OR [t].[Level1_Required_Id] IS NULL) OR [t].[OneToMany_Required_Inverse2Id] IS NULL THEN CAST(1 AS bit) + WHEN (([t].[OneToOne_Required_PK_Date] IS NULL) OR ([t].[Level1_Required_Id] IS NULL)) OR ([t].[OneToMany_Required_Inverse2Id] IS NULL) THEN CAST(1 AS bit) ELSE CAST(0 AS bit) END, CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + WHEN (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] END, [t].[Level2_Name], CASE - WHEN [t0].[Level2_Required_Id] IS NULL OR [t0].[OneToMany_Required_Inverse3Id] IS NULL THEN CAST(1 AS bit) + WHEN ([t0].[Level2_Required_Id] IS NULL) OR ([t0].[OneToMany_Required_Inverse3Id] IS NULL) THEN CAST(1 AS bit) ELSE CAST(0 AS bit) END, CASE - WHEN [t0].[Level2_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [t0].[Id] + WHEN ([t0].[Level2_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [t0].[Id] END, [t0].[Level3_Name] FROM [Level1] AS [l] LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[Level2_Name], [l0].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l0] INNER JOIN [Level1] AS [l1] ON [l0].[Id] = [l1].[Id] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL)) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t] ON [l].[Id] = [t].[Level1_Optional_Id] LEFT JOIN ( SELECT [l2].[Id], [l2].[Level2_Optional_Id], [l2].[Level2_Required_Id], [l2].[Level3_Name], [l2].[OneToMany_Required_Inverse3Id] @@ -345,19 +345,19 @@ INNER JOIN ( SELECT [l3].[Id] FROM [Level1] AS [l3] INNER JOIN [Level1] AS [l4] ON [l3].[Id] = [l4].[Id] - WHERE ([l3].[OneToOne_Required_PK_Date] IS NOT NULL AND [l3].[Level1_Required_Id] IS NOT NULL) AND [l3].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l3].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l3].[Level1_Required_Id] IS NOT NULL)) AND ([l3].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t1] ON [l2].[Id] = [t1].[Id] - WHERE [l2].[Level2_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l2].[Level2_Required_Id] IS NOT NULL) AND ([l2].[OneToMany_Required_Inverse3Id] IS NOT NULL) ) AS [t0] ON CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + WHEN (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] END = [t0].[Level2_Optional_Id] WHERE (CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NULL OR [t].[Level1_Required_Id] IS NULL) OR [t].[OneToMany_Required_Inverse2Id] IS NULL THEN NULL + WHEN (([t].[OneToOne_Required_PK_Date] IS NULL) OR ([t].[Level1_Required_Id] IS NULL)) OR ([t].[OneToMany_Required_Inverse2Id] IS NULL) THEN NULL ELSE [t0].[Level3_Name] -END <> N'L') OR CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NULL OR [t].[Level1_Required_Id] IS NULL) OR [t].[OneToMany_Required_Inverse2Id] IS NULL THEN NULL +END <> N'L') OR (CASE + WHEN (([t].[OneToOne_Required_PK_Date] IS NULL) OR ([t].[Level1_Required_Id] IS NULL)) OR ([t].[OneToMany_Required_Inverse2Id] IS NULL) THEN NULL ELSE [t0].[Level3_Name] -END IS NULL"); +END IS NULL)"); } public override async Task Nested_SelectMany_correlated_with_join_table_correctly_translated_to_apply(bool async) @@ -380,13 +380,13 @@ INNER JOIN ( SELECT [l3].[Id] FROM [Level1] AS [l3] INNER JOIN [Level1] AS [l4] ON [l3].[Id] = [l4].[Id] - WHERE ([l3].[OneToOne_Required_PK_Date] IS NOT NULL AND [l3].[Level1_Required_Id] IS NOT NULL) AND [l3].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l3].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l3].[Level1_Required_Id] IS NOT NULL)) AND ([l3].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t] ON [l2].[Id] = [t].[Id] - WHERE [l2].[Level2_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l2].[Level2_Required_Id] IS NOT NULL) AND ([l2].[OneToMany_Required_Inverse3Id] IS NOT NULL) ) AS [t0] ON CASE - WHEN ([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [l0].[Id] + WHEN (([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL)) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [l0].[Id] END = CASE - WHEN [t0].[Level2_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [t0].[Id] + WHEN ([t0].[Level2_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [t0].[Id] END CROSS APPLY ( SELECT [l].[Name] AS [l1Name], [t0].[Level3_Name] AS [l2Name], [t2].[Level3_Name] AS [l3Name] @@ -398,9 +398,9 @@ INNER JOIN ( SELECT [l7].[Id] FROM [Level1] AS [l7] INNER JOIN [Level1] AS [l8] ON [l7].[Id] = [l8].[Id] - WHERE ([l7].[OneToOne_Required_PK_Date] IS NOT NULL AND [l7].[Level1_Required_Id] IS NOT NULL) AND [l7].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l7].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l7].[Level1_Required_Id] IS NOT NULL)) AND ([l7].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t4] ON [l6].[Id] = [t4].[Id] - WHERE [l6].[Level2_Required_Id] IS NOT NULL AND [l6].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l6].[Level2_Required_Id] IS NOT NULL) AND ([l6].[OneToMany_Required_Inverse3Id] IS NOT NULL) ) AS [t1] ON [l5].[Id] = [t1].[Id] LEFT JOIN ( SELECT [l9].[Id], [l9].[Level2_Required_Id], [l9].[Level3_Name], [l9].[OneToMany_Required_Inverse3Id] @@ -409,19 +409,19 @@ INNER JOIN ( SELECT [l10].[Id] FROM [Level1] AS [l10] INNER JOIN [Level1] AS [l11] ON [l10].[Id] = [l11].[Id] - WHERE ([l10].[OneToOne_Required_PK_Date] IS NOT NULL AND [l10].[Level1_Required_Id] IS NOT NULL) AND [l10].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l10].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l10].[Level1_Required_Id] IS NOT NULL)) AND ([l10].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t5] ON [l9].[Id] = [t5].[Id] - WHERE [l9].[Level2_Required_Id] IS NOT NULL AND [l9].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l9].[Level2_Required_Id] IS NOT NULL) AND ([l9].[OneToMany_Required_Inverse3Id] IS NOT NULL) ) AS [t2] ON [l5].[OneToOne_Optional_PK_Inverse4Id] = CASE - WHEN [t2].[Level2_Required_Id] IS NOT NULL AND [t2].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [t2].[Id] + WHEN ([t2].[Level2_Required_Id] IS NOT NULL) AND ([t2].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [t2].[Id] END - WHERE ([l5].[Level3_Required_Id] IS NOT NULL AND [l5].[OneToMany_Required_Inverse4Id] IS NOT NULL) AND ((CASE - WHEN [t0].[Level2_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [t0].[Id] - END = [l5].[OneToMany_Optional_Inverse4Id]) OR (CASE - WHEN [t0].[Level2_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [t0].[Id] - END IS NULL AND [l5].[OneToMany_Optional_Inverse4Id] IS NULL)) + WHERE (([l5].[Level3_Required_Id] IS NOT NULL) AND ([l5].[OneToMany_Required_Inverse4Id] IS NOT NULL)) AND ((CASE + WHEN ([t0].[Level2_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [t0].[Id] + END = [l5].[OneToMany_Optional_Inverse4Id]) OR ((CASE + WHEN ([t0].[Level2_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [t0].[Id] + END IS NULL) AND ([l5].[OneToMany_Optional_Inverse4Id] IS NULL))) ) AS [t3] - WHERE (([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) AND ([l].[Id] = [l0].[OneToMany_Optional_Inverse2Id]) + WHERE ((([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL)) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL)) AND ([l].[Id] = [l0].[OneToMany_Optional_Inverse2Id]) ) AS [t6]"); } @@ -436,7 +436,7 @@ LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Required_Id], [l0].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l0] INNER JOIN [Level1] AS [l1] ON [l0].[Id] = [l1].[Id] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL)) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t] ON [l].[Id] = [t].[Level1_Required_Id] LEFT JOIN ( SELECT [l2].[Level2_Required_Id], [l2].[Level3_Name] @@ -445,11 +445,11 @@ INNER JOIN ( SELECT [l3].[Id] FROM [Level1] AS [l3] INNER JOIN [Level1] AS [l4] ON [l3].[Id] = [l4].[Id] - WHERE ([l3].[OneToOne_Required_PK_Date] IS NOT NULL AND [l3].[Level1_Required_Id] IS NOT NULL) AND [l3].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l3].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l3].[Level1_Required_Id] IS NOT NULL)) AND ([l3].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t1] ON [l2].[Id] = [t1].[Id] - WHERE [l2].[Level2_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l2].[Level2_Required_Id] IS NOT NULL) AND ([l2].[OneToMany_Required_Inverse3Id] IS NOT NULL) ) AS [t0] ON CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + WHEN (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] END = [t0].[Level2_Required_Id] ORDER BY ( SELECT COUNT(*) @@ -458,12 +458,12 @@ INNER JOIN ( SELECT [l6].[Id], [l6].[OneToOne_Required_PK_Date], [l6].[Level1_Optional_Id], [l6].[Level1_Required_Id], [l6].[Level2_Name], [l6].[OneToMany_Optional_Inverse2Id], [l6].[OneToMany_Required_Inverse2Id], [l6].[OneToOne_Optional_PK_Inverse2Id], [l7].[Id] AS [Id0] FROM [Level1] AS [l6] INNER JOIN [Level1] AS [l7] ON [l6].[Id] = [l7].[Id] - WHERE ([l6].[OneToOne_Required_PK_Date] IS NOT NULL AND [l6].[Level1_Required_Id] IS NOT NULL) AND [l6].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l6].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l6].[Level1_Required_Id] IS NOT NULL)) AND ([l6].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t2] ON [l5].[Id] = [t2].[Id] - WHERE ([l5].[Level2_Required_Id] IS NOT NULL AND [l5].[OneToMany_Required_Inverse3Id] IS NOT NULL) AND (CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] - END IS NOT NULL AND (CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + WHERE (([l5].[Level2_Required_Id] IS NOT NULL) AND ([l5].[OneToMany_Required_Inverse3Id] IS NOT NULL)) AND ((CASE + WHEN (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] + END IS NOT NULL) AND (CASE + WHEN (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] END = [l5].[OneToMany_Required_Inverse3Id]))), [t0].[Level3_Name]"); } @@ -478,9 +478,9 @@ LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Required_Id], [l0].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l0] INNER JOIN [Level1] AS [l1] ON [l0].[Id] = [l1].[Id] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL)) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t] ON [l].[Id] = CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + WHEN (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] END LEFT JOIN ( SELECT [l2].[Id], [l2].[Level2_Required_Id], [l2].[Level3_Name], [l2].[OneToMany_Required_Inverse3Id] @@ -489,27 +489,27 @@ INNER JOIN ( SELECT [l3].[Id] FROM [Level1] AS [l3] INNER JOIN [Level1] AS [l4] ON [l3].[Id] = [l4].[Id] - WHERE ([l3].[OneToOne_Required_PK_Date] IS NOT NULL AND [l3].[Level1_Required_Id] IS NOT NULL) AND [l3].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l3].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l3].[Level1_Required_Id] IS NOT NULL)) AND ([l3].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t1] ON [l2].[Id] = [t1].[Id] - WHERE [l2].[Level2_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l2].[Level2_Required_Id] IS NOT NULL) AND ([l2].[OneToMany_Required_Inverse3Id] IS NOT NULL) ) AS [t0] ON CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + WHEN (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] END = CASE - WHEN [t0].[Level2_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [t0].[Id] + WHEN ([t0].[Level2_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [t0].[Id] END LEFT JOIN ( SELECT [l5].[Id], [l5].[OneToOne_Required_PK_Date], [l5].[Level1_Required_Id], [l5].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l5] INNER JOIN [Level1] AS [l6] ON [l5].[Id] = [l6].[Id] - WHERE ([l5].[OneToOne_Required_PK_Date] IS NOT NULL AND [l5].[Level1_Required_Id] IS NOT NULL) AND [l5].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l5].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l5].[Level1_Required_Id] IS NOT NULL)) AND ([l5].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t2] ON [l].[Id] = CASE - WHEN ([t2].[OneToOne_Required_PK_Date] IS NOT NULL AND [t2].[Level1_Required_Id] IS NOT NULL) AND [t2].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t2].[Id] + WHEN (([t2].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t2].[Level1_Required_Id] IS NOT NULL)) AND ([t2].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t2].[Id] END GROUP BY [t0].[Level3_Name] HAVING MIN(COALESCE(CASE - WHEN ([t2].[OneToOne_Required_PK_Date] IS NOT NULL AND [t2].[Level1_Required_Id] IS NOT NULL) AND [t2].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t2].[Id] + WHEN (([t2].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t2].[Level1_Required_Id] IS NOT NULL)) AND ([t2].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t2].[Id] END, 0) + COALESCE(CASE - WHEN ([t2].[OneToOne_Required_PK_Date] IS NOT NULL AND [t2].[Level1_Required_Id] IS NOT NULL) AND [t2].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t2].[Id] + WHEN (([t2].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t2].[Level1_Required_Id] IS NOT NULL)) AND ([t2].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t2].[Id] END, 0)) > 0"); } @@ -531,11 +531,11 @@ public override async Task Sum_with_filter_with_include_selector_cast_using_as(b FROM [Level1] AS [l] WHERE [l].[Id] > ( SELECT COALESCE(SUM(CASE - WHEN ([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [l0].[Id] + WHEN (([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL)) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [l0].[Id] END), 0) FROM [Level1] AS [l0] INNER JOIN [Level1] AS [l1] ON [l0].[Id] = [l1].[Id] - WHERE (([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) AND ([l].[Id] = [l0].[OneToMany_Optional_Inverse2Id]))"); + WHERE ((([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL)) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL)) AND ([l].[Id] = [l0].[OneToMany_Optional_Inverse2Id]))"); } public override async Task Distinct_take_without_orderby(bool async) @@ -552,9 +552,9 @@ LEFT JOIN ( SELECT [l1].[Id], [l1].[OneToOne_Required_PK_Date], [l1].[Level1_Optional_Id], [l1].[Level1_Required_Id], [l1].[Level2_Name], [l1].[OneToMany_Optional_Inverse2Id], [l1].[OneToMany_Required_Inverse2Id], [l1].[OneToOne_Optional_PK_Inverse2Id], [l2].[Id] AS [Id0] FROM [Level1] AS [l1] INNER JOIN [Level1] AS [l2] ON [l1].[Id] = [l2].[Id] - WHERE ([l1].[OneToOne_Required_PK_Date] IS NOT NULL AND [l1].[Level1_Required_Id] IS NOT NULL) AND [l1].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l1].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l1].[Level1_Required_Id] IS NOT NULL)) AND ([l1].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t] ON [l0].[Id] = CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + WHEN (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] END LEFT JOIN ( SELECT [l3].[Id], [l3].[Level2_Optional_Id], [l3].[Level2_Required_Id], [l3].[Level3_Name], [l3].[OneToMany_Optional_Inverse3Id], [l3].[OneToMany_Required_Inverse3Id], [l3].[OneToOne_Optional_PK_Inverse3Id], [t1].[Id] AS [Id0], [t1].[Id0] AS [Id00] @@ -563,18 +563,18 @@ INNER JOIN ( SELECT [l4].[Id], [l4].[OneToOne_Required_PK_Date], [l4].[Level1_Optional_Id], [l4].[Level1_Required_Id], [l4].[Level2_Name], [l4].[OneToMany_Optional_Inverse2Id], [l4].[OneToMany_Required_Inverse2Id], [l4].[OneToOne_Optional_PK_Inverse2Id], [l5].[Id] AS [Id0] FROM [Level1] AS [l4] INNER JOIN [Level1] AS [l5] ON [l4].[Id] = [l5].[Id] - WHERE ([l4].[OneToOne_Required_PK_Date] IS NOT NULL AND [l4].[Level1_Required_Id] IS NOT NULL) AND [l4].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l4].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l4].[Level1_Required_Id] IS NOT NULL)) AND ([l4].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t1] ON [l3].[Id] = [t1].[Id] - WHERE [l3].[Level2_Required_Id] IS NOT NULL AND [l3].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l3].[Level2_Required_Id] IS NOT NULL) AND ([l3].[OneToMany_Required_Inverse3Id] IS NOT NULL) ) AS [t0] ON CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + WHEN (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] END = CASE - WHEN [t0].[Level2_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [t0].[Id] + WHEN ([t0].[Level2_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [t0].[Id] END - WHERE (([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL) AND ([t0].[Level2_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse3Id] IS NOT NULL) + WHERE ((([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL)) AND (([t0].[Level2_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse3Id] IS NOT NULL)) ) AS [t2] ORDER BY CASE - WHEN [t2].[Level2_Required_Id] IS NOT NULL AND [t2].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [t2].[Id] + WHEN ([t2].[Level2_Required_Id] IS NOT NULL) AND ([t2].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [t2].[Id] END) FROM [Level1] AS [l] WHERE [l].[Id] < 3"); @@ -594,9 +594,9 @@ LEFT JOIN ( SELECT [l1].[Id], [l1].[OneToOne_Required_PK_Date], [l1].[Level1_Required_Id], [l1].[OneToMany_Required_Inverse2Id], [l2].[Id] AS [Id0] FROM [Level1] AS [l1] INNER JOIN [Level1] AS [l2] ON [l1].[Id] = [l2].[Id] - WHERE ([l1].[OneToOne_Required_PK_Date] IS NOT NULL AND [l1].[Level1_Required_Id] IS NOT NULL) AND [l1].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l1].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l1].[Level1_Required_Id] IS NOT NULL)) AND ([l1].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t] ON [l0].[Id] = CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + WHEN (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] END LEFT JOIN ( SELECT [l3].[Id], [l3].[Level2_Optional_Id], [l3].[Level2_Required_Id], [l3].[Level3_Name], [l3].[OneToMany_Optional_Inverse3Id], [l3].[OneToMany_Required_Inverse3Id], [l3].[OneToOne_Optional_PK_Inverse3Id], [t1].[Id] AS [Id0], [t1].[Id0] AS [Id00] @@ -605,25 +605,25 @@ INNER JOIN ( SELECT [l4].[Id], [l5].[Id] AS [Id0] FROM [Level1] AS [l4] INNER JOIN [Level1] AS [l5] ON [l4].[Id] = [l5].[Id] - WHERE ([l4].[OneToOne_Required_PK_Date] IS NOT NULL AND [l4].[Level1_Required_Id] IS NOT NULL) AND [l4].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l4].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l4].[Level1_Required_Id] IS NOT NULL)) AND ([l4].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t1] ON [l3].[Id] = [t1].[Id] - WHERE [l3].[Level2_Required_Id] IS NOT NULL AND [l3].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l3].[Level2_Required_Id] IS NOT NULL) AND ([l3].[OneToMany_Required_Inverse3Id] IS NOT NULL) ) AS [t0] ON CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + WHEN (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] END = CASE - WHEN [t0].[Level2_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [t0].[Id] + WHEN ([t0].[Level2_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [t0].[Id] END - WHERE ((([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL) AND ([t0].[Level2_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse3Id] IS NOT NULL)) AND EXISTS ( + WHERE (((([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL)) AND (([t0].[Level2_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse3Id] IS NOT NULL))) AND EXISTS ( SELECT 1 FROM [Level1] AS [l6] INNER JOIN [Level1] AS [l7] ON [l6].[Id] = [l7].[Id] - WHERE ((([l6].[OneToOne_Required_PK_Date] IS NOT NULL AND [l6].[Level1_Required_Id] IS NOT NULL) AND [l6].[OneToMany_Required_Inverse2Id] IS NOT NULL) AND ([l].[Id] = [l6].[OneToMany_Required_Inverse2Id])) AND ([l6].[Id] = [t0].[Level2_Required_Id])) + WHERE (((([l6].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l6].[Level1_Required_Id] IS NOT NULL)) AND ([l6].[OneToMany_Required_Inverse2Id] IS NOT NULL)) AND ([l].[Id] = [l6].[OneToMany_Required_Inverse2Id])) AND ([l6].[Id] = [t0].[Level2_Required_Id])) ) AS [t2] LEFT JOIN ( SELECT [l8].[Id], [l8].[OneToOne_Required_PK_Date], [l8].[Level1_Optional_Id], [l8].[Level1_Required_Id], [l8].[Level2_Name], [l8].[OneToMany_Optional_Inverse2Id], [l8].[OneToMany_Required_Inverse2Id], [l8].[OneToOne_Optional_PK_Inverse2Id], [l9].[Id] AS [Id0] FROM [Level1] AS [l8] INNER JOIN [Level1] AS [l9] ON [l8].[Id] = [l9].[Id] - WHERE ([l8].[OneToOne_Required_PK_Date] IS NOT NULL AND [l8].[Level1_Required_Id] IS NOT NULL) AND [l8].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l8].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l8].[Level1_Required_Id] IS NOT NULL)) AND ([l8].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t3] ON [l].[Id] = [t3].[OneToMany_Required_Inverse2Id] ORDER BY [l].[Id], [t2].[Id0], [t2].[Id1], [t2].[Id00], [t2].[Id], [t2].[Id01], [t2].[Id000], [t3].[Id]"); } @@ -639,7 +639,7 @@ LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l0] INNER JOIN [Level1] AS [l1] ON [l0].[Id] = [l1].[Id] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL)) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t] ON [l].[Id] = [t].[Level1_Optional_Id] LEFT JOIN ( SELECT [l2].[Id], [l2].[Level2_Optional_Id], [l2].[Level2_Required_Id], [l2].[OneToMany_Required_Inverse3Id] @@ -648,11 +648,11 @@ INNER JOIN ( SELECT [l3].[Id] FROM [Level1] AS [l3] INNER JOIN [Level1] AS [l4] ON [l3].[Id] = [l4].[Id] - WHERE ([l3].[OneToOne_Required_PK_Date] IS NOT NULL AND [l3].[Level1_Required_Id] IS NOT NULL) AND [l3].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l3].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l3].[Level1_Required_Id] IS NOT NULL)) AND ([l3].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t1] ON [l2].[Id] = [t1].[Id] - WHERE [l2].[Level2_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l2].[Level2_Required_Id] IS NOT NULL) AND ([l2].[OneToMany_Required_Inverse3Id] IS NOT NULL) ) AS [t0] ON CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + WHEN (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] END = [t0].[Level2_Optional_Id] LEFT JOIN ( SELECT [l5].[Level3_Optional_Id], [l5].[Level4_Name] @@ -664,17 +664,17 @@ INNER JOIN ( SELECT [l7].[Id] FROM [Level1] AS [l7] INNER JOIN [Level1] AS [l8] ON [l7].[Id] = [l8].[Id] - WHERE ([l7].[OneToOne_Required_PK_Date] IS NOT NULL AND [l7].[Level1_Required_Id] IS NOT NULL) AND [l7].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l7].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l7].[Level1_Required_Id] IS NOT NULL)) AND ([l7].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t4] ON [l6].[Id] = [t4].[Id] - WHERE [l6].[Level2_Required_Id] IS NOT NULL AND [l6].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l6].[Level2_Required_Id] IS NOT NULL) AND ([l6].[OneToMany_Required_Inverse3Id] IS NOT NULL) ) AS [t3] ON [l5].[Id] = [t3].[Id] - WHERE [l5].[Level3_Required_Id] IS NOT NULL AND [l5].[OneToMany_Required_Inverse4Id] IS NOT NULL + WHERE ([l5].[Level3_Required_Id] IS NOT NULL) AND ([l5].[OneToMany_Required_Inverse4Id] IS NOT NULL) ) AS [t2] ON CASE - WHEN [t0].[Level2_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [t0].[Id] + WHEN ([t0].[Level2_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [t0].[Id] END = [t2].[Level3_Optional_Id] WHERE CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NULL OR [t].[Level1_Required_Id] IS NULL) OR [t].[OneToMany_Required_Inverse2Id] IS NULL THEN NULL - WHEN [t0].[Level2_Required_Id] IS NULL OR [t0].[OneToMany_Required_Inverse3Id] IS NULL THEN NULL + WHEN (([t].[OneToOne_Required_PK_Date] IS NULL) OR ([t].[Level1_Required_Id] IS NULL)) OR ([t].[OneToMany_Required_Inverse2Id] IS NULL) THEN NULL + WHEN ([t0].[Level2_Required_Id] IS NULL) OR ([t0].[OneToMany_Required_Inverse3Id] IS NULL) THEN NULL ELSE [t2].[Level4_Name] END = N'L4 01'"); } @@ -690,9 +690,9 @@ LEFT JOIN ( SELECT [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[Level2_Name], [l0].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l0] INNER JOIN [Level1] AS [l1] ON [l0].[Id] = [l1].[Id] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL)) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t] ON [l].[Id] = [t].[Level1_Optional_Id] -WHERE (([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL) AND ([t].[Level2_Name] = N'L2 01')"); +WHERE ((([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL)) AND ([t].[Level2_Name] = N'L2 01')"); } public override async Task Multiple_conditionals_in_projection(bool async) @@ -701,7 +701,7 @@ public override async Task Multiple_conditionals_in_projection(bool async) AssertSql( @"SELECT CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + WHEN (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] END, [t0].[Level3_Name], CASE WHEN [l5].[Id] IS NULL THEN CAST(1 AS bit) ELSE CAST(0 AS bit) @@ -711,9 +711,9 @@ LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l0] INNER JOIN [Level1] AS [l1] ON [l0].[Id] = [l1].[Id] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL)) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t] ON [l].[Id] = CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + WHEN (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] END LEFT JOIN ( SELECT [l2].[Level2_Optional_Id], [l2].[Level3_Name] @@ -722,14 +722,14 @@ INNER JOIN ( SELECT [l3].[Id] FROM [Level1] AS [l3] INNER JOIN [Level1] AS [l4] ON [l3].[Id] = [l4].[Id] - WHERE ([l3].[OneToOne_Required_PK_Date] IS NOT NULL AND [l3].[Level1_Required_Id] IS NOT NULL) AND [l3].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l3].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l3].[Level1_Required_Id] IS NOT NULL)) AND ([l3].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t1] ON [l2].[Id] = [t1].[Id] - WHERE [l2].[Level2_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l2].[Level2_Required_Id] IS NOT NULL) AND ([l2].[OneToMany_Required_Inverse3Id] IS NOT NULL) ) AS [t0] ON CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + WHEN (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] END = [t0].[Level2_Optional_Id] LEFT JOIN [Level1] AS [l5] ON [t].[Level1_Optional_Id] = [l5].[Id] -WHERE ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL"); +WHERE (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL)"); } public override async Task Multiple_joins_groupby_predicate(bool async) @@ -738,7 +738,7 @@ public override async Task Multiple_joins_groupby_predicate(bool async) AssertSql( @"SELECT [l].[Id], [l].[Name], CASE - WHEN ([t0].[OneToOne_Required_PK_Date] IS NULL OR [t0].[Level1_Required_Id] IS NULL) OR [t0].[OneToMany_Required_Inverse2Id] IS NULL THEN N'Foo' + WHEN (([t0].[OneToOne_Required_PK_Date] IS NULL) OR ([t0].[Level1_Required_Id] IS NULL)) OR ([t0].[OneToMany_Required_Inverse2Id] IS NULL) THEN N'Foo' ELSE N'Bar' END AS [Foo] FROM [Level1] AS [l] @@ -749,11 +749,11 @@ LEFT JOIN ( SELECT [l1].[Id], [l1].[OneToOne_Required_PK_Date], [l1].[Level1_Optional_Id], [l1].[Level1_Required_Id], [l1].[Level2_Name], [l1].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l1] INNER JOIN [Level1] AS [l2] ON [l1].[Id] = [l2].[Id] - WHERE ([l1].[OneToOne_Required_PK_Date] IS NOT NULL AND [l1].[Level1_Required_Id] IS NOT NULL) AND [l1].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l1].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l1].[Level1_Required_Id] IS NOT NULL)) AND ([l1].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t] ON [l0].[Id] = CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + WHEN (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] END - WHERE ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t0] ON [l].[Id] = [t0].[Level1_Optional_Id] LEFT JOIN ( SELECT [t3].[Level3_Name] AS [Key], COUNT(*) AS [Count] @@ -762,9 +762,9 @@ LEFT JOIN ( SELECT [l4].[Id], [l4].[OneToOne_Required_PK_Date], [l4].[Level1_Required_Id], [l4].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l4] INNER JOIN [Level1] AS [l5] ON [l4].[Id] = [l5].[Id] - WHERE ([l4].[OneToOne_Required_PK_Date] IS NOT NULL AND [l4].[Level1_Required_Id] IS NOT NULL) AND [l4].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l4].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l4].[Level1_Required_Id] IS NOT NULL)) AND ([l4].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t1] ON [l3].[Id] = CASE - WHEN ([t1].[OneToOne_Required_PK_Date] IS NOT NULL AND [t1].[Level1_Required_Id] IS NOT NULL) AND [t1].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t1].[Id] + WHEN (([t1].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t1].[Level1_Required_Id] IS NOT NULL)) AND ([t1].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t1].[Id] END LEFT JOIN ( SELECT [l6].[Id], [l6].[Level2_Required_Id], [l6].[Level3_Name], [l6].[OneToMany_Required_Inverse3Id] @@ -773,18 +773,18 @@ INNER JOIN ( SELECT [l7].[Id] FROM [Level1] AS [l7] INNER JOIN [Level1] AS [l8] ON [l7].[Id] = [l8].[Id] - WHERE ([l7].[OneToOne_Required_PK_Date] IS NOT NULL AND [l7].[Level1_Required_Id] IS NOT NULL) AND [l7].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l7].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l7].[Level1_Required_Id] IS NOT NULL)) AND ([l7].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t4] ON [l6].[Id] = [t4].[Id] - WHERE [l6].[Level2_Required_Id] IS NOT NULL AND [l6].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l6].[Level2_Required_Id] IS NOT NULL) AND ([l6].[OneToMany_Required_Inverse3Id] IS NOT NULL) ) AS [t3] ON CASE - WHEN ([t1].[OneToOne_Required_PK_Date] IS NOT NULL AND [t1].[Level1_Required_Id] IS NOT NULL) AND [t1].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t1].[Id] + WHEN (([t1].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t1].[Level1_Required_Id] IS NOT NULL)) AND ([t1].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t1].[Id] END = CASE - WHEN [t3].[Level2_Required_Id] IS NOT NULL AND [t3].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [t3].[Id] + WHEN ([t3].[Level2_Required_Id] IS NOT NULL) AND ([t3].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [t3].[Id] END - WHERE (([t1].[OneToOne_Required_PK_Date] IS NOT NULL AND [t1].[Level1_Required_Id] IS NOT NULL) AND [t1].[OneToMany_Required_Inverse2Id] IS NOT NULL) AND ([t3].[Level2_Required_Id] IS NOT NULL AND [t3].[OneToMany_Required_Inverse3Id] IS NOT NULL) + WHERE ((([t1].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t1].[Level1_Required_Id] IS NOT NULL)) AND ([t1].[OneToMany_Required_Inverse2Id] IS NOT NULL)) AND (([t3].[Level2_Required_Id] IS NOT NULL) AND ([t3].[OneToMany_Required_Inverse3Id] IS NOT NULL)) GROUP BY [t3].[Level3_Name] ) AS [t2] ON [l].[Name] = [t2].[Key] -WHERE [t0].[Level2_Name] IS NOT NULL OR ([t2].[Count] > 0)"); +WHERE ([t0].[Level2_Name] IS NOT NULL) OR ([t2].[Count] > 0)"); } public override async Task Nested_object_constructed_from_group_key_properties(bool async) @@ -793,24 +793,24 @@ public override async Task Nested_object_constructed_from_group_key_properties(b AssertSql( @"SELECT [l].[Id], [l].[Name], [l].[Date], CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + WHEN (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] END AS [Id], [t0].[Level2_Name] AS [Name], [t].[OneToOne_Required_PK_Date] AS [Date], [t].[Level1_Optional_Id], [t].[Level1_Required_Id], COALESCE(SUM(CAST(LEN([l].[Name]) AS int)), 0) AS [Aggregate] FROM [Level1] AS [l] LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l0] INNER JOIN [Level1] AS [l1] ON [l0].[Id] = [l1].[Id] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL)) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t] ON [l].[Id] = [t].[Level1_Optional_Id] LEFT JOIN ( SELECT [l2].[Level1_Required_Id], [l2].[Level2_Name] FROM [Level1] AS [l2] INNER JOIN [Level1] AS [l3] ON [l2].[Id] = [l3].[Id] - WHERE ([l2].[OneToOne_Required_PK_Date] IS NOT NULL AND [l2].[Level1_Required_Id] IS NOT NULL) AND [l2].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l2].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l2].[Level1_Required_Id] IS NOT NULL)) AND ([l2].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t0] ON [l].[Id] = [t0].[Level1_Required_Id] -WHERE ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL +WHERE (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) GROUP BY [l].[Id], [l].[Date], [l].[Name], CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + WHEN (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] END, [t].[OneToOne_Required_PK_Date], [t].[Level1_Optional_Id], [t].[Level1_Required_Id], [t0].[Level2_Name]"); } @@ -827,10 +827,10 @@ LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[Level2_Name], [l0].[OneToMany_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id], [l1].[Id] AS [Id0] FROM [Level1] AS [l0] INNER JOIN [Level1] AS [l1] ON [l0].[Id] = [l1].[Id] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL)) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t] ON [l].[Id] = [t].[Level1_Optional_Id] WHERE CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + WHEN (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] END IS NULL) THEN CAST(1 AS bit) ELSE CAST(0 AS bit) END"); @@ -842,17 +842,17 @@ public override async Task Member_over_null_check_ternary_and_nested_dto_type(bo AssertSql( @"SELECT [l].[Id], [l].[Name], CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NULL OR [t].[Level1_Required_Id] IS NULL) OR [t].[OneToMany_Required_Inverse2Id] IS NULL THEN CAST(1 AS bit) + WHEN (([t].[OneToOne_Required_PK_Date] IS NULL) OR ([t].[Level1_Required_Id] IS NULL)) OR ([t].[OneToMany_Required_Inverse2Id] IS NULL) THEN CAST(1 AS bit) ELSE CAST(0 AS bit) END, CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + WHEN (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] END, [t].[Level2_Name] FROM [Level1] AS [l] LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[Level2_Name], [l0].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l0] INNER JOIN [Level1] AS [l1] ON [l0].[Id] = [l1].[Id] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL)) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t] ON [l].[Id] = [t].[Level1_Optional_Id] ORDER BY [t].[Level2_Name], [l].[Id]"); } @@ -868,10 +868,10 @@ LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l0] INNER JOIN [Level1] AS [l1] ON [l0].[Id] = [l1].[Id] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL)) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t] ON [l].[Id] = [t].[Level1_Optional_Id] WHERE [l].[Id] = CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + WHEN (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] END"); } @@ -884,30 +884,30 @@ public override async Task Composite_key_join_on_groupby_aggregate_projecting_on FROM [Level1] AS [l] INNER JOIN ( SELECT CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + WHEN (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] END % 3 AS [Key], COALESCE(SUM(CASE - WHEN ([t1].[OneToOne_Required_PK_Date] IS NOT NULL AND [t1].[Level1_Required_Id] IS NOT NULL) AND [t1].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t1].[Id] + WHEN (([t1].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t1].[Level1_Required_Id] IS NOT NULL)) AND ([t1].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t1].[Id] END), 0) AS [Sum] FROM [Level1] AS [l0] LEFT JOIN ( SELECT [l1].[Id], [l1].[OneToOne_Required_PK_Date], [l1].[Level1_Required_Id], [l1].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l1] INNER JOIN [Level1] AS [l2] ON [l1].[Id] = [l2].[Id] - WHERE ([l1].[OneToOne_Required_PK_Date] IS NOT NULL AND [l1].[Level1_Required_Id] IS NOT NULL) AND [l1].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l1].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l1].[Level1_Required_Id] IS NOT NULL)) AND ([l1].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t] ON [l0].[Id] = CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + WHEN (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] END LEFT JOIN ( SELECT [l3].[Id], [l3].[OneToOne_Required_PK_Date], [l3].[Level1_Required_Id], [l3].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l3] INNER JOIN [Level1] AS [l4] ON [l3].[Id] = [l4].[Id] - WHERE ([l3].[OneToOne_Required_PK_Date] IS NOT NULL AND [l3].[Level1_Required_Id] IS NOT NULL) AND [l3].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l3].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l3].[Level1_Required_Id] IS NOT NULL)) AND ([l3].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t1] ON [l0].[Id] = CASE - WHEN ([t1].[OneToOne_Required_PK_Date] IS NOT NULL AND [t1].[Level1_Required_Id] IS NOT NULL) AND [t1].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t1].[Id] + WHEN (([t1].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t1].[Level1_Required_Id] IS NOT NULL)) AND ([t1].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t1].[Id] END - WHERE ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) GROUP BY CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + WHEN (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] END % 3 ) AS [t0] ON ([l].[Id] = [t0].[Key]) AND (CAST(1 AS bit) = CASE WHEN [t0].[Sum] > 10 THEN CAST(1 AS bit) @@ -928,17 +928,17 @@ LEFT JOIN ( SELECT [l5].[Id], [l5].[OneToOne_Required_PK_Date], [l5].[Level1_Optional_Id], [l5].[Level1_Required_Id], [l5].[Level2_Name], [l5].[OneToMany_Optional_Inverse2Id], [l5].[OneToMany_Required_Inverse2Id], [l5].[OneToOne_Optional_PK_Inverse2Id], [l6].[Id] AS [Id0] FROM [Level1] AS [l5] INNER JOIN [Level1] AS [l6] ON [l5].[Id] = [l6].[Id] - WHERE ([l5].[OneToOne_Required_PK_Date] IS NOT NULL AND [l5].[Level1_Required_Id] IS NOT NULL) AND [l5].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l5].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l5].[Level1_Required_Id] IS NOT NULL)) AND ([l5].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t1] ON [l4].[Id] = [t1].[Level1_Optional_Id] WHERE (CASE - WHEN ([t1].[OneToOne_Required_PK_Date] IS NOT NULL AND [t1].[Level1_Required_Id] IS NOT NULL) AND [t1].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t1].[Id] + WHEN (([t1].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t1].[Level1_Required_Id] IS NOT NULL)) AND ([t1].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t1].[Id] END = CASE - WHEN ([t0].[OneToOne_Required_PK_Date] IS NOT NULL AND [t0].[Level1_Required_Id] IS NOT NULL) AND [t0].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t0].[Id] - END) OR (CASE - WHEN ([t1].[OneToOne_Required_PK_Date] IS NOT NULL AND [t1].[Level1_Required_Id] IS NOT NULL) AND [t1].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t1].[Id] - END IS NULL AND CASE - WHEN ([t0].[OneToOne_Required_PK_Date] IS NOT NULL AND [t0].[Level1_Required_Id] IS NOT NULL) AND [t0].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t0].[Id] - END IS NULL)) THEN CAST(1 AS bit) + WHEN (([t0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t0].[Level1_Required_Id] IS NOT NULL)) AND ([t0].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t0].[Id] + END) OR ((CASE + WHEN (([t1].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t1].[Level1_Required_Id] IS NOT NULL)) AND ([t1].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t1].[Id] + END IS NULL) AND (CASE + WHEN (([t0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t0].[Level1_Required_Id] IS NOT NULL)) AND ([t0].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t0].[Id] + END IS NULL))) THEN CAST(1 AS bit) ELSE CAST(0 AS bit) END AS [Contains] FROM [Level1] AS [l] @@ -946,13 +946,13 @@ LEFT JOIN ( SELECT [l0].[Level1_Optional_Id], [l0].[Level2_Name] FROM [Level1] AS [l0] INNER JOIN [Level1] AS [l1] ON [l0].[Id] = [l1].[Id] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL)) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t] ON [l].[Id] = [t].[Level1_Optional_Id] LEFT JOIN ( SELECT [l2].[Id], [l2].[OneToOne_Required_PK_Date], [l2].[Level1_Required_Id], [l2].[OneToMany_Required_Inverse2Id], [l2].[OneToOne_Optional_PK_Inverse2Id] FROM [Level1] AS [l2] INNER JOIN [Level1] AS [l3] ON [l2].[Id] = [l3].[Id] - WHERE ([l2].[OneToOne_Required_PK_Date] IS NOT NULL AND [l2].[Level1_Required_Id] IS NOT NULL) AND [l2].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l2].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l2].[Level1_Required_Id] IS NOT NULL)) AND ([l2].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t0] ON [l].[Id] = [t0].[OneToOne_Optional_PK_Inverse2Id]"); } @@ -962,32 +962,32 @@ public override async Task GroupBy_aggregate_where_required_relationship_2(bool AssertSql( @"SELECT [l2].[Id] AS [Key], MAX(CASE - WHEN ([t0].[OneToOne_Required_PK_Date] IS NOT NULL AND [t0].[Level1_Required_Id] IS NOT NULL) AND [t0].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t0].[Id] + WHEN (([t0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t0].[Level1_Required_Id] IS NOT NULL)) AND ([t0].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t0].[Id] END) AS [Max] FROM [Level1] AS [l] LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Required_Id], [l0].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l0] INNER JOIN [Level1] AS [l1] ON [l0].[Id] = [l1].[Id] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL)) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t] ON [l].[Id] = CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + WHEN (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] END LEFT JOIN [Level1] AS [l2] ON [t].[OneToMany_Required_Inverse2Id] = [l2].[Id] LEFT JOIN ( SELECT [l3].[Id], [l3].[OneToOne_Required_PK_Date], [l3].[Level1_Required_Id], [l3].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l3] INNER JOIN [Level1] AS [l4] ON [l3].[Id] = [l4].[Id] - WHERE ([l3].[OneToOne_Required_PK_Date] IS NOT NULL AND [l3].[Level1_Required_Id] IS NOT NULL) AND [l3].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l3].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l3].[Level1_Required_Id] IS NOT NULL)) AND ([l3].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t0] ON [l].[Id] = CASE - WHEN ([t0].[OneToOne_Required_PK_Date] IS NOT NULL AND [t0].[Level1_Required_Id] IS NOT NULL) AND [t0].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t0].[Id] + WHEN (([t0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t0].[Level1_Required_Id] IS NOT NULL)) AND ([t0].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t0].[Id] END -WHERE ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL +WHERE (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) GROUP BY [l2].[Id] HAVING (MAX(CASE - WHEN ([t0].[OneToOne_Required_PK_Date] IS NOT NULL AND [t0].[Level1_Required_Id] IS NOT NULL) AND [t0].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t0].[Id] + WHEN (([t0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t0].[Level1_Required_Id] IS NOT NULL)) AND ([t0].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t0].[Id] END) < 2) OR (MAX(CASE - WHEN ([t0].[OneToOne_Required_PK_Date] IS NOT NULL AND [t0].[Level1_Required_Id] IS NOT NULL) AND [t0].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t0].[Id] + WHEN (([t0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t0].[Level1_Required_Id] IS NOT NULL)) AND ([t0].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t0].[Id] END) > 2)"); } @@ -1002,23 +1002,23 @@ LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[Level2_Name], [l0].[OneToMany_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id], [l1].[Id] AS [Id0] FROM [Level1] AS [l0] INNER JOIN [Level1] AS [l1] ON [l0].[Id] = [l1].[Id] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL)) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t] ON [l].[Id] = [t].[Level1_Required_Id] LEFT JOIN ( SELECT [l2].[Id], [l2].[OneToOne_Required_PK_Date], [l2].[Level1_Optional_Id], [l2].[Level1_Required_Id], [l2].[Level2_Name], [l2].[OneToMany_Optional_Inverse2Id], [l2].[OneToMany_Required_Inverse2Id], [l2].[OneToOne_Optional_PK_Inverse2Id], [l3].[Id] AS [Id0] FROM [Level1] AS [l2] INNER JOIN [Level1] AS [l3] ON [l2].[Id] = [l3].[Id] - WHERE ([l2].[OneToOne_Required_PK_Date] IS NOT NULL AND [l2].[Level1_Required_Id] IS NOT NULL) AND [l2].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l2].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l2].[Level1_Required_Id] IS NOT NULL)) AND ([l2].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t0] ON [l].[Id] = [t0].[OneToMany_Required_Inverse2Id] LEFT JOIN ( SELECT [t2].[Id], [t2].[OneToOne_Required_PK_Date], [t2].[Level1_Optional_Id], [t2].[Level1_Required_Id], [t2].[Level2_Name], [t2].[OneToMany_Optional_Inverse2Id], [t2].[OneToMany_Required_Inverse2Id], [t2].[OneToOne_Optional_PK_Inverse2Id] FROM ( SELECT [l4].[Id], [l4].[OneToOne_Required_PK_Date], [l4].[Level1_Optional_Id], [l4].[Level1_Required_Id], [l4].[Level2_Name], [l4].[OneToMany_Optional_Inverse2Id], [l4].[OneToMany_Required_Inverse2Id], [l4].[OneToOne_Optional_PK_Inverse2Id], ROW_NUMBER() OVER(PARTITION BY [l4].[OneToMany_Required_Inverse2Id] ORDER BY CASE - WHEN ([l4].[OneToOne_Required_PK_Date] IS NOT NULL AND [l4].[Level1_Required_Id] IS NOT NULL) AND [l4].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [l4].[Id] + WHEN (([l4].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l4].[Level1_Required_Id] IS NOT NULL)) AND ([l4].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [l4].[Id] END DESC) AS [row] FROM [Level1] AS [l4] INNER JOIN [Level1] AS [l5] ON [l4].[Id] = [l5].[Id] - WHERE ([l4].[OneToOne_Required_PK_Date] IS NOT NULL AND [l4].[Level1_Required_Id] IS NOT NULL) AND [l4].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l4].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l4].[Level1_Required_Id] IS NOT NULL)) AND ([l4].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t2] WHERE [t2].[row] <= 1 ) AS [t1] ON [l].[Id] = [t1].[OneToMany_Required_Inverse2Id] @@ -1041,11 +1041,11 @@ LEFT JOIN ( SELECT [l1].[Id], [l1].[OneToOne_Required_PK_Date], [l1].[Level1_Optional_Id], [l1].[Level1_Required_Id], [l1].[Level2_Name], [l1].[OneToMany_Optional_Inverse2Id], [l1].[OneToMany_Required_Inverse2Id], [l1].[OneToOne_Optional_PK_Inverse2Id], [l2].[Id] AS [Id0] FROM [Level1] AS [l1] INNER JOIN [Level1] AS [l2] ON [l1].[Id] = [l2].[Id] - WHERE ([l1].[OneToOne_Required_PK_Date] IS NOT NULL AND [l1].[Level1_Required_Id] IS NOT NULL) AND [l1].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l1].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l1].[Level1_Required_Id] IS NOT NULL)) AND ([l1].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t] ON [l0].[Id] = CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + WHEN (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] END - WHERE ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t0] ON [l].[Id] = [t0].[Level1_Optional_Id] UNION ALL SELECT [l4].[Id], [l4].[Date], [l4].[Name], [t2].[Id] AS [Id0], [t2].[OneToOne_Required_PK_Date], [t2].[Level1_Optional_Id], [t2].[Level1_Required_Id], [t2].[Level2_Name], [t2].[OneToMany_Optional_Inverse2Id], [t2].[OneToMany_Required_Inverse2Id], [t2].[OneToOne_Optional_PK_Inverse2Id] @@ -1054,12 +1054,12 @@ LEFT JOIN ( SELECT [l5].[Id], [l5].[OneToOne_Required_PK_Date], [l5].[Level1_Optional_Id], [l5].[Level1_Required_Id], [l5].[Level2_Name], [l5].[OneToMany_Optional_Inverse2Id], [l5].[OneToMany_Required_Inverse2Id], [l5].[OneToOne_Optional_PK_Inverse2Id], [l6].[Id] AS [Id0] FROM [Level1] AS [l5] INNER JOIN [Level1] AS [l6] ON [l5].[Id] = [l6].[Id] - WHERE ([l5].[OneToOne_Required_PK_Date] IS NOT NULL AND [l5].[Level1_Required_Id] IS NOT NULL) AND [l5].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l5].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l5].[Level1_Required_Id] IS NOT NULL)) AND ([l5].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t2] ON [l3].[Id] = CASE - WHEN ([t2].[OneToOne_Required_PK_Date] IS NOT NULL AND [t2].[Level1_Required_Id] IS NOT NULL) AND [t2].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t2].[Id] + WHEN (([t2].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t2].[Level1_Required_Id] IS NOT NULL)) AND ([t2].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t2].[Id] END LEFT JOIN [Level1] AS [l4] ON [t2].[Level1_Optional_Id] = [l4].[Id] - WHERE (([t2].[OneToOne_Required_PK_Date] IS NOT NULL AND [t2].[Level1_Required_Id] IS NOT NULL) AND [t2].[OneToMany_Required_Inverse2Id] IS NOT NULL) AND [l4].[Id] IS NULL + WHERE ((([t2].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t2].[Level1_Required_Id] IS NOT NULL)) AND ([t2].[OneToMany_Required_Inverse2Id] IS NOT NULL)) AND ([l4].[Id] IS NULL) ) AS [t1]"); } @@ -1079,9 +1079,9 @@ LEFT JOIN ( SELECT [l1].[Id], [l1].[OneToOne_Required_PK_Date], [l1].[Level1_Optional_Id], [l1].[Level1_Required_Id], [l1].[Level2_Name], [l1].[OneToMany_Optional_Inverse2Id], [l1].[OneToMany_Required_Inverse2Id], [l1].[OneToOne_Optional_PK_Inverse2Id], [l2].[Id] AS [Id0] FROM [Level1] AS [l1] INNER JOIN [Level1] AS [l2] ON [l1].[Id] = [l2].[Id] - WHERE ([l1].[OneToOne_Required_PK_Date] IS NOT NULL AND [l1].[Level1_Required_Id] IS NOT NULL) AND [l1].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l1].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l1].[Level1_Required_Id] IS NOT NULL)) AND ([l1].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t] ON [l0].[Id] = CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + WHEN (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] END LEFT JOIN ( SELECT [l3].[Id], [l3].[Level2_Optional_Id], [l3].[Level2_Required_Id], [l3].[Level3_Name], [l3].[OneToMany_Optional_Inverse3Id], [l3].[OneToMany_Required_Inverse3Id], [l3].[OneToOne_Optional_PK_Inverse3Id], [t1].[Id] AS [Id0], [t1].[Id0] AS [Id00] @@ -1090,21 +1090,21 @@ INNER JOIN ( SELECT [l4].[Id], [l4].[OneToOne_Required_PK_Date], [l4].[Level1_Optional_Id], [l4].[Level1_Required_Id], [l4].[Level2_Name], [l4].[OneToMany_Optional_Inverse2Id], [l4].[OneToMany_Required_Inverse2Id], [l4].[OneToOne_Optional_PK_Inverse2Id], [l5].[Id] AS [Id0] FROM [Level1] AS [l4] INNER JOIN [Level1] AS [l5] ON [l4].[Id] = [l5].[Id] - WHERE ([l4].[OneToOne_Required_PK_Date] IS NOT NULL AND [l4].[Level1_Required_Id] IS NOT NULL) AND [l4].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l4].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l4].[Level1_Required_Id] IS NOT NULL)) AND ([l4].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t1] ON [l3].[Id] = [t1].[Id] - WHERE [l3].[Level2_Required_Id] IS NOT NULL AND [l3].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l3].[Level2_Required_Id] IS NOT NULL) AND ([l3].[OneToMany_Required_Inverse3Id] IS NOT NULL) ) AS [t0] ON CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + WHEN (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] END = CASE - WHEN [t0].[Level2_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [t0].[Id] + WHEN ([t0].[Level2_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [t0].[Id] END - WHERE (([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL) AND ([t0].[Level2_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse3Id] IS NOT NULL) + WHERE ((([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL)) AND (([t0].[Level2_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse3Id] IS NOT NULL)) ) AS [t2] ORDER BY (SELECT 1) OFFSET 1 ROWS ) AS [t3] ORDER BY CASE - WHEN [t3].[Level2_Required_Id] IS NOT NULL AND [t3].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [t3].[Id] + WHEN ([t3].[Level2_Required_Id] IS NOT NULL) AND ([t3].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [t3].[Id] END) FROM [Level1] AS [l] WHERE [l].[Id] < 3"); @@ -1116,33 +1116,33 @@ public override async Task GroupBy_aggregate_where_required_relationship(bool as AssertSql( @"SELECT [l2].[Id] AS [Key], MAX(CASE - WHEN ([t0].[OneToOne_Required_PK_Date] IS NOT NULL AND [t0].[Level1_Required_Id] IS NOT NULL) AND [t0].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t0].[Id] + WHEN (([t0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t0].[Level1_Required_Id] IS NOT NULL)) AND ([t0].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t0].[Id] END) AS [Max] FROM [Level1] AS [l] LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Required_Id], [l0].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l0] INNER JOIN [Level1] AS [l1] ON [l0].[Id] = [l1].[Id] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL)) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t] ON [l].[Id] = CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + WHEN (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] END LEFT JOIN [Level1] AS [l2] ON [t].[OneToMany_Required_Inverse2Id] = [l2].[Id] LEFT JOIN ( SELECT [l3].[Id], [l3].[OneToOne_Required_PK_Date], [l3].[Level1_Required_Id], [l3].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l3] INNER JOIN [Level1] AS [l4] ON [l3].[Id] = [l4].[Id] - WHERE ([l3].[OneToOne_Required_PK_Date] IS NOT NULL AND [l3].[Level1_Required_Id] IS NOT NULL) AND [l3].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l3].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l3].[Level1_Required_Id] IS NOT NULL)) AND ([l3].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t0] ON [l].[Id] = CASE - WHEN ([t0].[OneToOne_Required_PK_Date] IS NOT NULL AND [t0].[Level1_Required_Id] IS NOT NULL) AND [t0].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t0].[Id] + WHEN (([t0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t0].[Level1_Required_Id] IS NOT NULL)) AND ([t0].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t0].[Id] END -WHERE ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL +WHERE (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) GROUP BY [l2].[Id] HAVING (MAX(CASE - WHEN ([t0].[OneToOne_Required_PK_Date] IS NOT NULL AND [t0].[Level1_Required_Id] IS NOT NULL) AND [t0].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t0].[Id] -END) <> 2) OR MAX(CASE - WHEN ([t0].[OneToOne_Required_PK_Date] IS NOT NULL AND [t0].[Level1_Required_Id] IS NOT NULL) AND [t0].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t0].[Id] -END) IS NULL"); + WHEN (([t0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t0].[Level1_Required_Id] IS NOT NULL)) AND ([t0].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t0].[Id] +END) <> 2) OR (MAX(CASE + WHEN (([t0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t0].[Level1_Required_Id] IS NOT NULL)) AND ([t0].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t0].[Id] +END) IS NULL)"); } public override async Task Contains_over_optional_navigation_with_null_column(bool async) @@ -1158,9 +1158,9 @@ LEFT JOIN ( SELECT [l3].[Id], [l3].[OneToOne_Required_PK_Date], [l3].[Level1_Optional_Id], [l3].[Level1_Required_Id], [l3].[Level2_Name], [l3].[OneToMany_Optional_Inverse2Id], [l3].[OneToMany_Required_Inverse2Id], [l3].[OneToOne_Optional_PK_Inverse2Id], [l4].[Id] AS [Id0] FROM [Level1] AS [l3] INNER JOIN [Level1] AS [l4] ON [l3].[Id] = [l4].[Id] - WHERE ([l3].[OneToOne_Required_PK_Date] IS NOT NULL AND [l3].[Level1_Required_Id] IS NOT NULL) AND [l3].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l3].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l3].[Level1_Required_Id] IS NOT NULL)) AND ([l3].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t0] ON [l2].[Id] = [t0].[Level1_Optional_Id] - WHERE ([t0].[Level2_Name] = [t].[Level2_Name]) OR ([t0].[Level2_Name] IS NULL AND [t].[Level2_Name] IS NULL)) THEN CAST(1 AS bit) + WHERE ([t0].[Level2_Name] = [t].[Level2_Name]) OR (([t0].[Level2_Name] IS NULL) AND ([t].[Level2_Name] IS NULL))) THEN CAST(1 AS bit) ELSE CAST(0 AS bit) END AS [Contains] FROM [Level1] AS [l] @@ -1168,7 +1168,7 @@ LEFT JOIN ( SELECT [l0].[Level1_Optional_Id], [l0].[Level2_Name] FROM [Level1] AS [l0] INNER JOIN [Level1] AS [l1] ON [l0].[Id] = [l1].[Id] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL)) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t] ON [l].[Id] = [t].[Level1_Optional_Id]"); } @@ -1181,7 +1181,7 @@ public override async Task Collection_FirstOrDefault_property_accesses_in_projec SELECT TOP(1) [l0].[Level2_Name] FROM [Level1] AS [l0] INNER JOIN [Level1] AS [l1] ON [l0].[Id] = [l1].[Id] - WHERE ((([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) AND ([l].[Id] = [l0].[OneToMany_Optional_Inverse2Id])) AND ([l0].[Level2_Name] = N'L2 02')) AS [Pushdown] + WHERE (((([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL)) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL)) AND ([l].[Id] = [l0].[OneToMany_Optional_Inverse2Id])) AND ([l0].[Level2_Name] = N'L2 02')) AS [Pushdown] FROM [Level1] AS [l] WHERE [l].[Id] < 3"); } @@ -1200,11 +1200,11 @@ LEFT JOIN ( SELECT [l1].[Id], [l1].[OneToOne_Required_PK_Date], [l1].[Level1_Required_Id], [l1].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l1] INNER JOIN [Level1] AS [l2] ON [l1].[Id] = [l2].[Id] - WHERE ([l1].[OneToOne_Required_PK_Date] IS NOT NULL AND [l1].[Level1_Required_Id] IS NOT NULL) AND [l1].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l1].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l1].[Level1_Required_Id] IS NOT NULL)) AND ([l1].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t] ON [l0].[Id] = CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + WHEN (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] END - WHERE ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t0] ON [l].[Id] = [t0].[Level1_Required_Id] INNER JOIN ( SELECT [t3].[Id] AS [Id1], [t3].[Level2_Required_Id], [t3].[OneToMany_Required_Inverse3Id] @@ -1213,9 +1213,9 @@ LEFT JOIN ( SELECT [l4].[Id], [l4].[OneToOne_Required_PK_Date], [l4].[Level1_Required_Id], [l4].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l4] INNER JOIN [Level1] AS [l5] ON [l4].[Id] = [l5].[Id] - WHERE ([l4].[OneToOne_Required_PK_Date] IS NOT NULL AND [l4].[Level1_Required_Id] IS NOT NULL) AND [l4].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l4].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l4].[Level1_Required_Id] IS NOT NULL)) AND ([l4].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t1] ON [l3].[Id] = CASE - WHEN ([t1].[OneToOne_Required_PK_Date] IS NOT NULL AND [t1].[Level1_Required_Id] IS NOT NULL) AND [t1].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t1].[Id] + WHEN (([t1].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t1].[Level1_Required_Id] IS NOT NULL)) AND ([t1].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t1].[Id] END LEFT JOIN ( SELECT [l6].[Id], [l6].[Level2_Required_Id], [l6].[OneToMany_Required_Inverse3Id] @@ -1224,17 +1224,17 @@ INNER JOIN ( SELECT [l7].[Id] FROM [Level1] AS [l7] INNER JOIN [Level1] AS [l8] ON [l7].[Id] = [l8].[Id] - WHERE ([l7].[OneToOne_Required_PK_Date] IS NOT NULL AND [l7].[Level1_Required_Id] IS NOT NULL) AND [l7].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l7].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l7].[Level1_Required_Id] IS NOT NULL)) AND ([l7].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t4] ON [l6].[Id] = [t4].[Id] - WHERE [l6].[Level2_Required_Id] IS NOT NULL AND [l6].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l6].[Level2_Required_Id] IS NOT NULL) AND ([l6].[OneToMany_Required_Inverse3Id] IS NOT NULL) ) AS [t3] ON CASE - WHEN ([t1].[OneToOne_Required_PK_Date] IS NOT NULL AND [t1].[Level1_Required_Id] IS NOT NULL) AND [t1].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t1].[Id] + WHEN (([t1].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t1].[Level1_Required_Id] IS NOT NULL)) AND ([t1].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t1].[Id] END = CASE - WHEN [t3].[Level2_Required_Id] IS NOT NULL AND [t3].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [t3].[Id] + WHEN ([t3].[Level2_Required_Id] IS NOT NULL) AND ([t3].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [t3].[Id] END - WHERE (([t1].[OneToOne_Required_PK_Date] IS NOT NULL AND [t1].[Level1_Required_Id] IS NOT NULL) AND [t1].[OneToMany_Required_Inverse2Id] IS NOT NULL) AND ([t3].[Level2_Required_Id] IS NOT NULL AND [t3].[OneToMany_Required_Inverse3Id] IS NOT NULL) + WHERE ((([t1].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t1].[Level1_Required_Id] IS NOT NULL)) AND ([t1].[OneToMany_Required_Inverse2Id] IS NOT NULL)) AND (([t3].[Level2_Required_Id] IS NOT NULL) AND ([t3].[OneToMany_Required_Inverse3Id] IS NOT NULL)) ) AS [t2] ON CASE - WHEN ([t0].[OneToOne_Required_PK_Date] IS NOT NULL AND [t0].[Level1_Required_Id] IS NOT NULL) AND [t0].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t0].[Id0] + WHEN (([t0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t0].[Level1_Required_Id] IS NOT NULL)) AND ([t0].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t0].[Id0] END = [t2].[Level2_Required_Id] INNER JOIN ( SELECT [t8].[Level3_Required_Id], [t8].[Level4_Name] @@ -1243,9 +1243,9 @@ LEFT JOIN ( SELECT [l10].[Id], [l10].[OneToOne_Required_PK_Date], [l10].[Level1_Required_Id], [l10].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l10] INNER JOIN [Level1] AS [l11] ON [l10].[Id] = [l11].[Id] - WHERE ([l10].[OneToOne_Required_PK_Date] IS NOT NULL AND [l10].[Level1_Required_Id] IS NOT NULL) AND [l10].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l10].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l10].[Level1_Required_Id] IS NOT NULL)) AND ([l10].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t6] ON [l9].[Id] = CASE - WHEN ([t6].[OneToOne_Required_PK_Date] IS NOT NULL AND [t6].[Level1_Required_Id] IS NOT NULL) AND [t6].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t6].[Id] + WHEN (([t6].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t6].[Level1_Required_Id] IS NOT NULL)) AND ([t6].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t6].[Id] END LEFT JOIN ( SELECT [l12].[Id], [l12].[Level2_Required_Id], [l12].[OneToMany_Required_Inverse3Id] @@ -1254,13 +1254,13 @@ INNER JOIN ( SELECT [l13].[Id] FROM [Level1] AS [l13] INNER JOIN [Level1] AS [l14] ON [l13].[Id] = [l14].[Id] - WHERE ([l13].[OneToOne_Required_PK_Date] IS NOT NULL AND [l13].[Level1_Required_Id] IS NOT NULL) AND [l13].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l13].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l13].[Level1_Required_Id] IS NOT NULL)) AND ([l13].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t9] ON [l12].[Id] = [t9].[Id] - WHERE [l12].[Level2_Required_Id] IS NOT NULL AND [l12].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l12].[Level2_Required_Id] IS NOT NULL) AND ([l12].[OneToMany_Required_Inverse3Id] IS NOT NULL) ) AS [t7] ON CASE - WHEN ([t6].[OneToOne_Required_PK_Date] IS NOT NULL AND [t6].[Level1_Required_Id] IS NOT NULL) AND [t6].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t6].[Id] + WHEN (([t6].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t6].[Level1_Required_Id] IS NOT NULL)) AND ([t6].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t6].[Id] END = CASE - WHEN [t7].[Level2_Required_Id] IS NOT NULL AND [t7].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [t7].[Id] + WHEN ([t7].[Level2_Required_Id] IS NOT NULL) AND ([t7].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [t7].[Id] END LEFT JOIN ( SELECT [l15].[Id], [l15].[Level3_Required_Id], [l15].[Level4_Name], [l15].[OneToMany_Required_Inverse4Id] @@ -1272,23 +1272,23 @@ INNER JOIN ( SELECT [l17].[Id] FROM [Level1] AS [l17] INNER JOIN [Level1] AS [l18] ON [l17].[Id] = [l18].[Id] - WHERE ([l17].[OneToOne_Required_PK_Date] IS NOT NULL AND [l17].[Level1_Required_Id] IS NOT NULL) AND [l17].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l17].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l17].[Level1_Required_Id] IS NOT NULL)) AND ([l17].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t11] ON [l16].[Id] = [t11].[Id] - WHERE [l16].[Level2_Required_Id] IS NOT NULL AND [l16].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l16].[Level2_Required_Id] IS NOT NULL) AND ([l16].[OneToMany_Required_Inverse3Id] IS NOT NULL) ) AS [t10] ON [l15].[Id] = [t10].[Id] - WHERE [l15].[Level3_Required_Id] IS NOT NULL AND [l15].[OneToMany_Required_Inverse4Id] IS NOT NULL + WHERE ([l15].[Level3_Required_Id] IS NOT NULL) AND ([l15].[OneToMany_Required_Inverse4Id] IS NOT NULL) ) AS [t8] ON CASE - WHEN [t7].[Level2_Required_Id] IS NOT NULL AND [t7].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [t7].[Id] + WHEN ([t7].[Level2_Required_Id] IS NOT NULL) AND ([t7].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [t7].[Id] END = CASE - WHEN [t8].[Level3_Required_Id] IS NOT NULL AND [t8].[OneToMany_Required_Inverse4Id] IS NOT NULL THEN [t8].[Id] + WHEN ([t8].[Level3_Required_Id] IS NOT NULL) AND ([t8].[OneToMany_Required_Inverse4Id] IS NOT NULL) THEN [t8].[Id] END - WHERE ((([t6].[OneToOne_Required_PK_Date] IS NOT NULL AND [t6].[Level1_Required_Id] IS NOT NULL) AND [t6].[OneToMany_Required_Inverse2Id] IS NOT NULL) AND ([t7].[Level2_Required_Id] IS NOT NULL AND [t7].[OneToMany_Required_Inverse3Id] IS NOT NULL)) AND ([t8].[Level3_Required_Id] IS NOT NULL AND [t8].[OneToMany_Required_Inverse4Id] IS NOT NULL) + WHERE (((([t6].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t6].[Level1_Required_Id] IS NOT NULL)) AND ([t6].[OneToMany_Required_Inverse2Id] IS NOT NULL)) AND (([t7].[Level2_Required_Id] IS NOT NULL) AND ([t7].[OneToMany_Required_Inverse3Id] IS NOT NULL))) AND (([t8].[Level3_Required_Id] IS NOT NULL) AND ([t8].[OneToMany_Required_Inverse4Id] IS NOT NULL)) ) AS [t5] ON CASE - WHEN [t2].[Level2_Required_Id] IS NOT NULL AND [t2].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [t2].[Id1] + WHEN ([t2].[Level2_Required_Id] IS NOT NULL) AND ([t2].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [t2].[Id1] END = [t5].[Level3_Required_Id] LEFT JOIN [Level1] AS [l19] ON (CASE - WHEN ([t0].[OneToOne_Required_PK_Date] IS NOT NULL AND [t0].[Level1_Required_Id] IS NOT NULL) AND [t0].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t0].[Id0] -END >= [l19].[Id]) AND (([t5].[Level4_Name] = [l19].[Name]) OR ([t5].[Level4_Name] IS NULL AND [l19].[Name] IS NULL))"); + WHEN (([t0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t0].[Level1_Required_Id] IS NOT NULL)) AND ([t0].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t0].[Id0] +END >= [l19].[Id]) AND (([t5].[Level4_Name] = [l19].[Name]) OR (([t5].[Level4_Name] IS NULL) AND ([l19].[Name] IS NULL)))"); } public override async Task Contains_over_optional_navigation_with_null_constant(bool async) @@ -1304,10 +1304,10 @@ LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[Level2_Name], [l0].[OneToMany_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id], [l1].[Id] AS [Id0] FROM [Level1] AS [l0] INNER JOIN [Level1] AS [l1] ON [l0].[Id] = [l1].[Id] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL)) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t] ON [l].[Id] = [t].[Level1_Optional_Id] WHERE CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + WHEN (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] END IS NULL) THEN CAST(1 AS bit) ELSE CAST(0 AS bit) END"); @@ -1454,9 +1454,9 @@ LEFT JOIN ( SELECT [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Required_Id], [l0].[OneToMany_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l0] INNER JOIN [Level1] AS [l1] ON [l0].[Id] = [l1].[Id] - WHERE (([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) AND ([l0].[Id] > 5) + WHERE ((([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL)) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL)) AND ([l0].[Id] > 5) ) AS [t] ON [l].[Id] = [t].[OneToMany_Optional_Inverse2Id] -WHERE ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL"); +WHERE (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL)"); } public override async Task SelectMany_with_nested_navigation_and_explicit_DefaultIfEmpty(bool async) @@ -1470,7 +1470,7 @@ LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Required_Id], [l0].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l0] INNER JOIN [Level1] AS [l1] ON [l0].[Id] = [l1].[Id] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL)) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t] ON [l].[Id] = [t].[Level1_Required_Id] LEFT JOIN ( SELECT [l2].[Level2_Required_Id], [l2].[OneToMany_Optional_Inverse3Id], [l2].[OneToMany_Required_Inverse3Id] @@ -1479,13 +1479,13 @@ INNER JOIN ( SELECT [l3].[Id] FROM [Level1] AS [l3] INNER JOIN [Level1] AS [l4] ON [l3].[Id] = [l4].[Id] - WHERE ([l3].[OneToOne_Required_PK_Date] IS NOT NULL AND [l3].[Level1_Required_Id] IS NOT NULL) AND [l3].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l3].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l3].[Level1_Required_Id] IS NOT NULL)) AND ([l3].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t1] ON [l2].[Id] = [t1].[Id] - WHERE [l2].[Level2_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l2].[Level2_Required_Id] IS NOT NULL) AND ([l2].[OneToMany_Required_Inverse3Id] IS NOT NULL) ) AS [t0] ON CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + WHEN (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] END = [t0].[OneToMany_Optional_Inverse3Id] -WHERE [t0].[Level2_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse3Id] IS NOT NULL"); +WHERE ([t0].[Level2_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse3Id] IS NOT NULL)"); } public override async Task SelectMany_with_nested_navigation_filter_and_explicit_DefaultIfEmpty(bool async) @@ -1499,7 +1499,7 @@ LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l0] INNER JOIN [Level1] AS [l1] ON [l0].[Id] = [l1].[Id] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL)) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t] ON [l].[Id] = [t].[Level1_Optional_Id] LEFT JOIN ( SELECT [l2].[Level2_Required_Id], [l2].[OneToMany_Optional_Inverse3Id], [l2].[OneToMany_Required_Inverse3Id] @@ -1508,13 +1508,13 @@ INNER JOIN ( SELECT [l3].[Id] FROM [Level1] AS [l3] INNER JOIN [Level1] AS [l4] ON [l3].[Id] = [l4].[Id] - WHERE ([l3].[OneToOne_Required_PK_Date] IS NOT NULL AND [l3].[Level1_Required_Id] IS NOT NULL) AND [l3].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l3].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l3].[Level1_Required_Id] IS NOT NULL)) AND ([l3].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t1] ON [l2].[Id] = [t1].[Id] - WHERE ([l2].[Level2_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse3Id] IS NOT NULL) AND ([l2].[Id] > 5) + WHERE (([l2].[Level2_Required_Id] IS NOT NULL) AND ([l2].[OneToMany_Required_Inverse3Id] IS NOT NULL)) AND ([l2].[Id] > 5) ) AS [t0] ON CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + WHEN (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] END = [t0].[OneToMany_Optional_Inverse3Id] -WHERE [t0].[Level2_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse3Id] IS NOT NULL"); +WHERE ([t0].[Level2_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse3Id] IS NOT NULL)"); } public override async Task Prune_does_not_throw_null_ref(bool async) @@ -1533,12 +1533,12 @@ LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Required_Id], [l0].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l0] INNER JOIN [Level1] AS [l1] ON [l0].[Id] = [l1].[Id] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL)) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t] ON [l].[Id] = CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + WHEN (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] END - WHERE (([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL) AND (CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + WHERE ((([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL)) AND (CASE + WHEN (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] END < 5) ) AS [t0] ON 1 = 1 CROSS APPLY ( @@ -1559,9 +1559,9 @@ public override async Task Projecting_columns_with_same_name_from_different_enti SELECT [t5].[Id1] AS [Foo], [t5].[Id2] AS [Bar], [t5].[Id3] AS [Baz] FROM ( SELECT DISTINCT TOP(@__p_0) [l].[Id] AS [Id1], CASE - WHEN ([t0].[OneToOne_Required_PK_Date] IS NOT NULL AND [t0].[Level1_Required_Id] IS NOT NULL) AND [t0].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t0].[Id0] + WHEN (([t0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t0].[Level1_Required_Id] IS NOT NULL)) AND ([t0].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t0].[Id0] END AS [Id2], CASE - WHEN [t2].[Level2_Required_Id] IS NOT NULL AND [t2].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [t2].[Id1] + WHEN ([t2].[Level2_Required_Id] IS NOT NULL) AND ([t2].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [t2].[Id1] END AS [Id3], [l].[Name] AS [Name1], [t0].[Level2_Name] AS [Name2] FROM [Level1] AS [l] INNER JOIN ( @@ -1571,11 +1571,11 @@ LEFT JOIN ( SELECT [l1].[Id], [l1].[OneToOne_Required_PK_Date], [l1].[Level1_Optional_Id], [l1].[Level1_Required_Id], [l1].[Level2_Name], [l1].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l1] INNER JOIN [Level1] AS [l2] ON [l1].[Id] = [l2].[Id] - WHERE ([l1].[OneToOne_Required_PK_Date] IS NOT NULL AND [l1].[Level1_Required_Id] IS NOT NULL) AND [l1].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l1].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l1].[Level1_Required_Id] IS NOT NULL)) AND ([l1].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t] ON [l0].[Id] = CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + WHEN (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] END - WHERE ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t0] ON [l].[Id] = [t0].[Level1_Optional_Id] INNER JOIN ( SELECT [t3].[Id] AS [Id1], [t3].[Level2_Optional_Id], [t3].[Level2_Required_Id], [t3].[OneToMany_Required_Inverse3Id] @@ -1584,9 +1584,9 @@ LEFT JOIN ( SELECT [l4].[Id], [l4].[OneToOne_Required_PK_Date], [l4].[Level1_Required_Id], [l4].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l4] INNER JOIN [Level1] AS [l5] ON [l4].[Id] = [l5].[Id] - WHERE ([l4].[OneToOne_Required_PK_Date] IS NOT NULL AND [l4].[Level1_Required_Id] IS NOT NULL) AND [l4].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l4].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l4].[Level1_Required_Id] IS NOT NULL)) AND ([l4].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t1] ON [l3].[Id] = CASE - WHEN ([t1].[OneToOne_Required_PK_Date] IS NOT NULL AND [t1].[Level1_Required_Id] IS NOT NULL) AND [t1].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t1].[Id] + WHEN (([t1].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t1].[Level1_Required_Id] IS NOT NULL)) AND ([t1].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t1].[Id] END LEFT JOIN ( SELECT [l6].[Id], [l6].[Level2_Optional_Id], [l6].[Level2_Required_Id], [l6].[OneToMany_Required_Inverse3Id] @@ -1595,17 +1595,17 @@ INNER JOIN ( SELECT [l7].[Id] FROM [Level1] AS [l7] INNER JOIN [Level1] AS [l8] ON [l7].[Id] = [l8].[Id] - WHERE ([l7].[OneToOne_Required_PK_Date] IS NOT NULL AND [l7].[Level1_Required_Id] IS NOT NULL) AND [l7].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l7].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l7].[Level1_Required_Id] IS NOT NULL)) AND ([l7].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t4] ON [l6].[Id] = [t4].[Id] - WHERE [l6].[Level2_Required_Id] IS NOT NULL AND [l6].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l6].[Level2_Required_Id] IS NOT NULL) AND ([l6].[OneToMany_Required_Inverse3Id] IS NOT NULL) ) AS [t3] ON CASE - WHEN ([t1].[OneToOne_Required_PK_Date] IS NOT NULL AND [t1].[Level1_Required_Id] IS NOT NULL) AND [t1].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t1].[Id] + WHEN (([t1].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t1].[Level1_Required_Id] IS NOT NULL)) AND ([t1].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t1].[Id] END = CASE - WHEN [t3].[Level2_Required_Id] IS NOT NULL AND [t3].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [t3].[Id] + WHEN ([t3].[Level2_Required_Id] IS NOT NULL) AND ([t3].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [t3].[Id] END - WHERE (([t1].[OneToOne_Required_PK_Date] IS NOT NULL AND [t1].[Level1_Required_Id] IS NOT NULL) AND [t1].[OneToMany_Required_Inverse2Id] IS NOT NULL) AND ([t3].[Level2_Required_Id] IS NOT NULL AND [t3].[OneToMany_Required_Inverse3Id] IS NOT NULL) + WHERE ((([t1].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t1].[Level1_Required_Id] IS NOT NULL)) AND ([t1].[OneToMany_Required_Inverse2Id] IS NOT NULL)) AND (([t3].[Level2_Required_Id] IS NOT NULL) AND ([t3].[OneToMany_Required_Inverse3Id] IS NOT NULL)) ) AS [t2] ON CASE - WHEN ([t0].[OneToOne_Required_PK_Date] IS NOT NULL AND [t0].[Level1_Required_Id] IS NOT NULL) AND [t0].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t0].[Id0] + WHEN (([t0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t0].[Level1_Required_Id] IS NOT NULL)) AND ([t0].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t0].[Id0] END = [t2].[Level2_Optional_Id] ) AS [t5]"); } @@ -1622,27 +1622,27 @@ INNER JOIN ( SELECT [l1].[Id], [l1].[OneToOne_Required_PK_Date], [l1].[Level1_Optional_Id], [l1].[Level1_Required_Id], [l1].[Level2_Name], [l1].[OneToMany_Optional_Inverse2Id], [l1].[OneToMany_Required_Inverse2Id], [l1].[OneToOne_Optional_PK_Inverse2Id], [l2].[Id] AS [Id0] FROM [Level1] AS [l1] INNER JOIN [Level1] AS [l2] ON [l1].[Id] = [l2].[Id] - WHERE ([l1].[OneToOne_Required_PK_Date] IS NOT NULL AND [l1].[Level1_Required_Id] IS NOT NULL) AND [l1].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l1].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l1].[Level1_Required_Id] IS NOT NULL)) AND ([l1].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t] ON [l0].[Id] = [t].[Id] - WHERE ([l0].[Level2_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse3Id] IS NOT NULL) AND (EXISTS ( + WHERE (([l0].[Level2_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse3Id] IS NOT NULL)) AND (EXISTS ( SELECT 1 FROM [Level1] AS [l3] INNER JOIN [Level1] AS [l4] ON [l3].[Id] = [l4].[Id] - WHERE ((([l3].[OneToOne_Required_PK_Date] IS NOT NULL AND [l3].[Level1_Required_Id] IS NOT NULL) AND [l3].[OneToMany_Required_Inverse2Id] IS NOT NULL) AND ([l].[Id] = [l3].[OneToMany_Optional_Inverse2Id])) AND ([l3].[Level2_Name] = N'L2 02')) AND ((( + WHERE (((([l3].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l3].[Level1_Required_Id] IS NOT NULL)) AND ([l3].[OneToMany_Required_Inverse2Id] IS NOT NULL)) AND ([l].[Id] = [l3].[OneToMany_Optional_Inverse2Id])) AND ([l3].[Level2_Name] = N'L2 02')) AND ((( SELECT TOP(1) CASE - WHEN ([l5].[OneToOne_Required_PK_Date] IS NOT NULL AND [l5].[Level1_Required_Id] IS NOT NULL) AND [l5].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [l5].[Id] + WHEN (([l5].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l5].[Level1_Required_Id] IS NOT NULL)) AND ([l5].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [l5].[Id] END FROM [Level1] AS [l5] INNER JOIN [Level1] AS [l6] ON [l5].[Id] = [l6].[Id] - WHERE ((([l5].[OneToOne_Required_PK_Date] IS NOT NULL AND [l5].[Level1_Required_Id] IS NOT NULL) AND [l5].[OneToMany_Required_Inverse2Id] IS NOT NULL) AND ([l].[Id] = [l5].[OneToMany_Optional_Inverse2Id])) AND ([l5].[Level2_Name] = N'L2 02')) = [l0].[OneToMany_Optional_Inverse3Id]) OR (( + WHERE (((([l5].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l5].[Level1_Required_Id] IS NOT NULL)) AND ([l5].[OneToMany_Required_Inverse2Id] IS NOT NULL)) AND ([l].[Id] = [l5].[OneToMany_Optional_Inverse2Id])) AND ([l5].[Level2_Name] = N'L2 02')) = [l0].[OneToMany_Optional_Inverse3Id]) OR ((( SELECT TOP(1) CASE - WHEN ([l5].[OneToOne_Required_PK_Date] IS NOT NULL AND [l5].[Level1_Required_Id] IS NOT NULL) AND [l5].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [l5].[Id] + WHEN (([l5].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l5].[Level1_Required_Id] IS NOT NULL)) AND ([l5].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [l5].[Id] END FROM [Level1] AS [l5] INNER JOIN [Level1] AS [l6] ON [l5].[Id] = [l6].[Id] - WHERE ((([l5].[OneToOne_Required_PK_Date] IS NOT NULL AND [l5].[Level1_Required_Id] IS NOT NULL) AND [l5].[OneToMany_Required_Inverse2Id] IS NOT NULL) AND ([l].[Id] = [l5].[OneToMany_Optional_Inverse2Id])) AND ([l5].[Level2_Name] = N'L2 02')) IS NULL AND [l0].[OneToMany_Optional_Inverse3Id] IS NULL))) + WHERE (((([l5].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l5].[Level1_Required_Id] IS NOT NULL)) AND ([l5].[OneToMany_Required_Inverse2Id] IS NOT NULL)) AND ([l].[Id] = [l5].[OneToMany_Optional_Inverse2Id])) AND ([l5].[Level2_Name] = N'L2 02')) IS NULL) AND ([l0].[OneToMany_Optional_Inverse3Id] IS NULL)))) ORDER BY CASE - WHEN [l0].[Level2_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [l0].[Id] + WHEN ([l0].[Level2_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [l0].[Id] END) AS [Pushdown] FROM [Level1] AS [l] WHERE [l].[Id] < 2"); @@ -1661,7 +1661,7 @@ LEFT JOIN ( SELECT 1 AS [c], [l0].[Id], [l1].[Id] AS [Id0], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Required_Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToMany_Optional_Inverse2Id], ROW_NUMBER() OVER(PARTITION BY [l0].[OneToMany_Optional_Inverse2Id] ORDER BY [l0].[Id], [l1].[Id]) AS [row] FROM [Level1] AS [l0] INNER JOIN [Level1] AS [l1] ON [l0].[Id] = [l1].[Id] - WHERE (([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) AND ([l0].[Level2_Name] = N'L2 02') + WHERE ((([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL)) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL)) AND ([l0].[Level2_Name] = N'L2 02') ) AS [t] WHERE [t].[row] <= 1 ) AS [t0] ON [l].[Id] = [t0].[OneToMany_Optional_Inverse2Id] @@ -1672,11 +1672,11 @@ INNER JOIN ( SELECT [l3].[Id], [l4].[Id] AS [Id0] FROM [Level1] AS [l3] INNER JOIN [Level1] AS [l4] ON [l3].[Id] = [l4].[Id] - WHERE ([l3].[OneToOne_Required_PK_Date] IS NOT NULL AND [l3].[Level1_Required_Id] IS NOT NULL) AND [l3].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l3].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l3].[Level1_Required_Id] IS NOT NULL)) AND ([l3].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t2] ON [l2].[Id] = [t2].[Id] - WHERE [l2].[Level2_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l2].[Level2_Required_Id] IS NOT NULL) AND ([l2].[OneToMany_Required_Inverse3Id] IS NOT NULL) ) AS [t1] ON CASE - WHEN ([t0].[OneToOne_Required_PK_Date] IS NOT NULL AND [t0].[Level1_Required_Id] IS NOT NULL) AND [t0].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t0].[Id] + WHEN (([t0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t0].[Level1_Required_Id] IS NOT NULL)) AND ([t0].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t0].[Id] END = [t1].[OneToMany_Optional_Inverse3Id] WHERE [l].[Id] < 2 ORDER BY [l].[Id], [t0].[Id], [t0].[Id0], [t1].[Id], [t1].[Id0]"); @@ -1702,13 +1702,13 @@ INNER JOIN ( SELECT [l3].[Id], [l4].[Id] AS [Id0] FROM [Level1] AS [l3] INNER JOIN [Level1] AS [l4] ON [l3].[Id] = [l4].[Id] - WHERE ([l3].[OneToOne_Required_PK_Date] IS NOT NULL AND [l3].[Level1_Required_Id] IS NOT NULL) AND [l3].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l3].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l3].[Level1_Required_Id] IS NOT NULL)) AND ([l3].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t] ON [l2].[Id] = [t].[Id] - WHERE [l2].[Level2_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l2].[Level2_Required_Id] IS NOT NULL) AND ([l2].[OneToMany_Required_Inverse3Id] IS NOT NULL) ) AS [t0] ON CASE - WHEN ([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [l0].[Id] + WHEN (([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL)) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [l0].[Id] END = [t0].[Level2_Optional_Id] - WHERE (([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) AND ([l0].[Level2_Name] = N'L2 02') + WHERE ((([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL)) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL)) AND ([l0].[Level2_Name] = N'L2 02') ) AS [t1] WHERE [t1].[row] <= 1 ) AS [t2] ON [l].[Id] = [t2].[OneToMany_Optional_Inverse2Id] @@ -1729,12 +1729,12 @@ LEFT JOIN ( SELECT [l1].[Id], [l1].[OneToOne_Required_PK_Date], [l1].[Level1_Optional_Id], [l1].[Level1_Required_Id], [l1].[Level2_Name], [l1].[OneToMany_Optional_Inverse2Id], [l1].[OneToMany_Required_Inverse2Id], [l1].[OneToOne_Optional_PK_Inverse2Id] FROM [Level1] AS [l1] INNER JOIN [Level1] AS [l2] ON [l1].[Id] = [l2].[Id] - WHERE ([l1].[OneToOne_Required_PK_Date] IS NOT NULL AND [l1].[Level1_Required_Id] IS NOT NULL) AND [l1].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l1].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l1].[Level1_Required_Id] IS NOT NULL)) AND ([l1].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t] ON [l0].[Id] = CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + WHEN (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] END - WHERE (([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL) AND (CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + WHERE ((([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL)) AND (CASE + WHEN (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] END < 10) ) AS [t0]"); } @@ -1750,9 +1750,9 @@ LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Required_Id], [l0].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l0] INNER JOIN [Level1] AS [l1] ON [l0].[Id] = [l1].[Id] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL)) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t] ON [l].[Id] = CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + WHEN (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] END LEFT JOIN ( SELECT [l2].[Id], [l2].[Level2_Required_Id], [l2].[OneToMany_Required_Inverse3Id] @@ -1761,13 +1761,13 @@ INNER JOIN ( SELECT [l3].[Id] FROM [Level1] AS [l3] INNER JOIN [Level1] AS [l4] ON [l3].[Id] = [l4].[Id] - WHERE ([l3].[OneToOne_Required_PK_Date] IS NOT NULL AND [l3].[Level1_Required_Id] IS NOT NULL) AND [l3].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l3].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l3].[Level1_Required_Id] IS NOT NULL)) AND ([l3].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t1] ON [l2].[Id] = [t1].[Id] - WHERE [l2].[Level2_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l2].[Level2_Required_Id] IS NOT NULL) AND ([l2].[OneToMany_Required_Inverse3Id] IS NOT NULL) ) AS [t0] ON CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + WHEN (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] END = CASE - WHEN [t0].[Level2_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [t0].[Id] + WHEN ([t0].[Level2_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [t0].[Id] END LEFT JOIN ( SELECT [t3].[Id0] AS [Id00], [t3].[OneToOne_Required_PK_Date], [t3].[Level1_Optional_Id], [t3].[Level1_Required_Id], [t3].[Level2_Name], [t3].[OneToMany_Optional_Inverse2Id], [t3].[OneToMany_Required_Inverse2Id], [t3].[OneToOne_Optional_PK_Inverse2Id] @@ -1779,16 +1779,16 @@ LEFT JOIN ( SELECT [l7].[Id], [l7].[OneToOne_Required_PK_Date], [l7].[Level1_Optional_Id], [l7].[Level1_Required_Id], [l7].[Level2_Name], [l7].[OneToMany_Optional_Inverse2Id], [l7].[OneToMany_Required_Inverse2Id], [l7].[OneToOne_Optional_PK_Inverse2Id] FROM [Level1] AS [l7] INNER JOIN [Level1] AS [l8] ON [l7].[Id] = [l8].[Id] - WHERE ([l7].[OneToOne_Required_PK_Date] IS NOT NULL AND [l7].[Level1_Required_Id] IS NOT NULL) AND [l7].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l7].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l7].[Level1_Required_Id] IS NOT NULL)) AND ([l7].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t4] ON [l6].[Id] = CASE - WHEN ([t4].[OneToOne_Required_PK_Date] IS NOT NULL AND [t4].[Level1_Required_Id] IS NOT NULL) AND [t4].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t4].[Id] + WHEN (([t4].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t4].[Level1_Required_Id] IS NOT NULL)) AND ([t4].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t4].[Id] END - WHERE ([t4].[OneToOne_Required_PK_Date] IS NOT NULL AND [t4].[Level1_Required_Id] IS NOT NULL) AND [t4].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([t4].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t4].[Level1_Required_Id] IS NOT NULL)) AND ([t4].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t3] ON [l5].[Id] = [t3].[Level1_Optional_Id] ) AS [t2] ON [t0].[Level2_Required_Id] = CASE - WHEN ([t2].[OneToOne_Required_PK_Date] IS NOT NULL AND [t2].[Level1_Required_Id] IS NOT NULL) AND [t2].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t2].[Id00] + WHEN (([t2].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t2].[Level1_Required_Id] IS NOT NULL)) AND ([t2].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t2].[Id00] END -WHERE (([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL) AND ([t0].[Level2_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse3Id] IS NOT NULL)"); +WHERE ((([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL)) AND (([t0].[Level2_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse3Id] IS NOT NULL))"); } public override async Task SelectMany_with_nested_navigations_explicit_DefaultIfEmpty_and_additional_joins_outside_of_SelectMany4( @@ -1803,7 +1803,7 @@ LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Required_Id], [l0].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l0] INNER JOIN [Level1] AS [l1] ON [l0].[Id] = [l1].[Id] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL)) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t] ON [l].[Id] = [t].[Level1_Required_Id] LEFT JOIN ( SELECT [l2].[Id], [l2].[Level2_Optional_Id], [l2].[Level2_Required_Id], [l2].[OneToMany_Required_Inverse3Id] @@ -1812,11 +1812,11 @@ INNER JOIN ( SELECT [l3].[Id] FROM [Level1] AS [l3] INNER JOIN [Level1] AS [l4] ON [l3].[Id] = [l4].[Id] - WHERE ([l3].[OneToOne_Required_PK_Date] IS NOT NULL AND [l3].[Level1_Required_Id] IS NOT NULL) AND [l3].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l3].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l3].[Level1_Required_Id] IS NOT NULL)) AND ([l3].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t1] ON [l2].[Id] = [t1].[Id] - WHERE [l2].[Level2_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l2].[Level2_Required_Id] IS NOT NULL) AND ([l2].[OneToMany_Required_Inverse3Id] IS NOT NULL) ) AS [t0] ON CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + WHEN (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] END = [t0].[Level2_Optional_Id] LEFT JOIN ( SELECT [l5].[Id], [l5].[Level3_Optional_Id], [l5].[Level3_Required_Id], [l5].[Level4_Name], [l5].[OneToMany_Optional_Inverse4Id], [l5].[OneToMany_Required_Inverse4Id], [l5].[OneToOne_Optional_PK_Inverse4Id] @@ -1828,13 +1828,13 @@ INNER JOIN ( SELECT [l7].[Id] FROM [Level1] AS [l7] INNER JOIN [Level1] AS [l8] ON [l7].[Id] = [l8].[Id] - WHERE ([l7].[OneToOne_Required_PK_Date] IS NOT NULL AND [l7].[Level1_Required_Id] IS NOT NULL) AND [l7].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l7].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l7].[Level1_Required_Id] IS NOT NULL)) AND ([l7].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t4] ON [l6].[Id] = [t4].[Id] - WHERE [l6].[Level2_Required_Id] IS NOT NULL AND [l6].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l6].[Level2_Required_Id] IS NOT NULL) AND ([l6].[OneToMany_Required_Inverse3Id] IS NOT NULL) ) AS [t3] ON [l5].[Id] = [t3].[Id] - WHERE [l5].[Level3_Required_Id] IS NOT NULL AND [l5].[OneToMany_Required_Inverse4Id] IS NOT NULL + WHERE ([l5].[Level3_Required_Id] IS NOT NULL) AND ([l5].[OneToMany_Required_Inverse4Id] IS NOT NULL) ) AS [t2] ON CASE - WHEN [t0].[Level2_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [t0].[Id] + WHEN ([t0].[Level2_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [t0].[Id] END = [t2].[OneToMany_Required_Inverse4Id] LEFT JOIN ( SELECT [t6].[Id] AS [Id0], [t6].[OneToOne_Required_PK_Date], [t6].[Level1_Optional_Id], [t6].[Level1_Required_Id], [t6].[Level2_Name], [t6].[OneToMany_Optional_Inverse2Id], [t6].[OneToMany_Required_Inverse2Id], [t6].[OneToOne_Optional_PK_Inverse2Id] @@ -1843,15 +1843,15 @@ LEFT JOIN ( SELECT [l10].[Id], [l10].[OneToOne_Required_PK_Date], [l10].[Level1_Optional_Id], [l10].[Level1_Required_Id], [l10].[Level2_Name], [l10].[OneToMany_Optional_Inverse2Id], [l10].[OneToMany_Required_Inverse2Id], [l10].[OneToOne_Optional_PK_Inverse2Id] FROM [Level1] AS [l10] INNER JOIN [Level1] AS [l11] ON [l10].[Id] = [l11].[Id] - WHERE ([l10].[OneToOne_Required_PK_Date] IS NOT NULL AND [l10].[Level1_Required_Id] IS NOT NULL) AND [l10].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l10].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l10].[Level1_Required_Id] IS NOT NULL)) AND ([l10].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t6] ON [l9].[Id] = CASE - WHEN ([t6].[OneToOne_Required_PK_Date] IS NOT NULL AND [t6].[Level1_Required_Id] IS NOT NULL) AND [t6].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t6].[Id] + WHEN (([t6].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t6].[Level1_Required_Id] IS NOT NULL)) AND ([t6].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t6].[Id] END - WHERE ([t6].[OneToOne_Required_PK_Date] IS NOT NULL AND [t6].[Level1_Required_Id] IS NOT NULL) AND [t6].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([t6].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t6].[Level1_Required_Id] IS NOT NULL)) AND ([t6].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t5] ON CASE - WHEN [t2].[Level3_Required_Id] IS NOT NULL AND [t2].[OneToMany_Required_Inverse4Id] IS NOT NULL THEN [t2].[Id] + WHEN ([t2].[Level3_Required_Id] IS NOT NULL) AND ([t2].[OneToMany_Required_Inverse4Id] IS NOT NULL) THEN [t2].[Id] END = CASE - WHEN ([t5].[OneToOne_Required_PK_Date] IS NOT NULL AND [t5].[Level1_Required_Id] IS NOT NULL) AND [t5].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t5].[Id0] + WHEN (([t5].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t5].[Level1_Required_Id] IS NOT NULL)) AND ([t5].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t5].[Id0] END"); } @@ -1869,27 +1869,27 @@ LEFT JOIN ( SELECT [l1].[Id], [l1].[OneToOne_Required_PK_Date], [l1].[Level1_Optional_Id], [l1].[Level1_Required_Id], [l1].[Level2_Name], [l1].[OneToMany_Optional_Inverse2Id], [l1].[OneToMany_Required_Inverse2Id], [l1].[OneToOne_Optional_PK_Inverse2Id] FROM [Level1] AS [l1] INNER JOIN [Level1] AS [l2] ON [l1].[Id] = [l2].[Id] - WHERE ([l1].[OneToOne_Required_PK_Date] IS NOT NULL AND [l1].[Level1_Required_Id] IS NOT NULL) AND [l1].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l1].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l1].[Level1_Required_Id] IS NOT NULL)) AND ([l1].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t] ON [l0].[Id] = CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + WHEN (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] END - WHERE ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t0] ON [l].[Id] = COALESCE(( SELECT TOP(1) CASE - WHEN ([t1].[OneToOne_Required_PK_Date] IS NOT NULL AND [t1].[Level1_Required_Id] IS NOT NULL) AND [t1].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t1].[Id] + WHEN (([t1].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t1].[Level1_Required_Id] IS NOT NULL)) AND ([t1].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t1].[Id] END FROM [Level1] AS [l3] LEFT JOIN ( SELECT [l4].[Id], [l4].[OneToOne_Required_PK_Date], [l4].[Level1_Optional_Id], [l4].[Level1_Required_Id], [l4].[Level2_Name], [l4].[OneToMany_Optional_Inverse2Id], [l4].[OneToMany_Required_Inverse2Id], [l4].[OneToOne_Optional_PK_Inverse2Id], [l5].[Id] AS [Id0] FROM [Level1] AS [l4] INNER JOIN [Level1] AS [l5] ON [l4].[Id] = [l5].[Id] - WHERE ([l4].[OneToOne_Required_PK_Date] IS NOT NULL AND [l4].[Level1_Required_Id] IS NOT NULL) AND [l4].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l4].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l4].[Level1_Required_Id] IS NOT NULL)) AND ([l4].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t1] ON [l3].[Id] = CASE - WHEN ([t1].[OneToOne_Required_PK_Date] IS NOT NULL AND [t1].[Level1_Required_Id] IS NOT NULL) AND [t1].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t1].[Id] + WHEN (([t1].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t1].[Level1_Required_Id] IS NOT NULL)) AND ([t1].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t1].[Id] END - WHERE ([t1].[OneToOne_Required_PK_Date] IS NOT NULL AND [t1].[Level1_Required_Id] IS NOT NULL) AND [t1].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([t1].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t1].[Level1_Required_Id] IS NOT NULL)) AND ([t1].[OneToMany_Required_Inverse2Id] IS NOT NULL) ORDER BY CASE - WHEN ([t1].[OneToOne_Required_PK_Date] IS NOT NULL AND [t1].[Level1_Required_Id] IS NOT NULL) AND [t1].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t1].[Id] + WHEN (([t1].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t1].[Level1_Required_Id] IS NOT NULL)) AND ([t1].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t1].[Id] END), 0)"); } @@ -1912,11 +1912,11 @@ LEFT JOIN ( SELECT [l1].[Id], [l1].[OneToOne_Required_PK_Date], [l1].[Level1_Optional_Id], [l1].[Level1_Required_Id], [l1].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l1] INNER JOIN [Level1] AS [l2] ON [l1].[Id] = [l2].[Id] - WHERE ([l1].[OneToOne_Required_PK_Date] IS NOT NULL AND [l1].[Level1_Required_Id] IS NOT NULL) AND [l1].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l1].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l1].[Level1_Required_Id] IS NOT NULL)) AND ([l1].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t] ON [l0].[Id] = CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + WHEN (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] END - WHERE ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t0] ON [l].[Id] = [t0].[Level1_Optional_Id] ORDER BY [l].[Id] ) AS [t1] @@ -1935,9 +1935,9 @@ LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Required_Id], [l0].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l0] INNER JOIN [Level1] AS [l1] ON [l0].[Id] = [l1].[Id] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL)) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t] ON [l].[Id] = CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + WHEN (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] END LEFT JOIN ( SELECT [l2].[Id], [l2].[Level2_Required_Id], [l2].[OneToMany_Required_Inverse3Id] @@ -1946,13 +1946,13 @@ INNER JOIN ( SELECT [l3].[Id] FROM [Level1] AS [l3] INNER JOIN [Level1] AS [l4] ON [l3].[Id] = [l4].[Id] - WHERE ([l3].[OneToOne_Required_PK_Date] IS NOT NULL AND [l3].[Level1_Required_Id] IS NOT NULL) AND [l3].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l3].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l3].[Level1_Required_Id] IS NOT NULL)) AND ([l3].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t1] ON [l2].[Id] = [t1].[Id] - WHERE [l2].[Level2_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l2].[Level2_Required_Id] IS NOT NULL) AND ([l2].[OneToMany_Required_Inverse3Id] IS NOT NULL) ) AS [t0] ON CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + WHEN (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] END = CASE - WHEN [t0].[Level2_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [t0].[Id] + WHEN ([t0].[Level2_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [t0].[Id] END LEFT JOIN ( SELECT [t3].[Id0] AS [Id00], [t3].[OneToOne_Required_PK_Date], [t3].[Level1_Required_Id], [t3].[Level2_Name], [t3].[OneToMany_Required_Inverse2Id] @@ -1964,16 +1964,16 @@ LEFT JOIN ( SELECT [l7].[Id], [l7].[OneToOne_Required_PK_Date], [l7].[Level1_Optional_Id], [l7].[Level1_Required_Id], [l7].[Level2_Name], [l7].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l7] INNER JOIN [Level1] AS [l8] ON [l7].[Id] = [l8].[Id] - WHERE ([l7].[OneToOne_Required_PK_Date] IS NOT NULL AND [l7].[Level1_Required_Id] IS NOT NULL) AND [l7].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l7].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l7].[Level1_Required_Id] IS NOT NULL)) AND ([l7].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t4] ON [l6].[Id] = CASE - WHEN ([t4].[OneToOne_Required_PK_Date] IS NOT NULL AND [t4].[Level1_Required_Id] IS NOT NULL) AND [t4].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t4].[Id] + WHEN (([t4].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t4].[Level1_Required_Id] IS NOT NULL)) AND ([t4].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t4].[Id] END - WHERE ([t4].[OneToOne_Required_PK_Date] IS NOT NULL AND [t4].[Level1_Required_Id] IS NOT NULL) AND [t4].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([t4].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t4].[Level1_Required_Id] IS NOT NULL)) AND ([t4].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t3] ON [l5].[Id] = [t3].[Level1_Optional_Id] ) AS [t2] ON [t0].[Level2_Required_Id] = CASE - WHEN ([t2].[OneToOne_Required_PK_Date] IS NOT NULL AND [t2].[Level1_Required_Id] IS NOT NULL) AND [t2].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t2].[Id00] + WHEN (([t2].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t2].[Level1_Required_Id] IS NOT NULL)) AND ([t2].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t2].[Id00] END -WHERE (([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL) AND ([t0].[Level2_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse3Id] IS NOT NULL)"); +WHERE ((([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL)) AND (([t0].[Level2_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse3Id] IS NOT NULL))"); } public override async Task Contains_with_subquery_optional_navigation_and_constant_item(bool async) @@ -1987,7 +1987,7 @@ LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l0] INNER JOIN [Level1] AS [l1] ON [l0].[Id] = [l1].[Id] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL)) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t] ON [l].[Id] = [t].[Level1_Optional_Id] WHERE EXISTS ( SELECT 1 @@ -1998,18 +1998,18 @@ INNER JOIN ( SELECT [l3].[Id], [l3].[OneToOne_Required_PK_Date], [l3].[Level1_Optional_Id], [l3].[Level1_Required_Id], [l3].[Level2_Name], [l3].[OneToMany_Optional_Inverse2Id], [l3].[OneToMany_Required_Inverse2Id], [l3].[OneToOne_Optional_PK_Inverse2Id], [l4].[Id] AS [Id0] FROM [Level1] AS [l3] INNER JOIN [Level1] AS [l4] ON [l3].[Id] = [l4].[Id] - WHERE ([l3].[OneToOne_Required_PK_Date] IS NOT NULL AND [l3].[Level1_Required_Id] IS NOT NULL) AND [l3].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l3].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l3].[Level1_Required_Id] IS NOT NULL)) AND ([l3].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t1] ON [l2].[Id] = [t1].[Id] - WHERE ([l2].[Level2_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse3Id] IS NOT NULL) AND (CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] - END IS NOT NULL AND ((CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] - END = [l2].[OneToMany_Optional_Inverse3Id]) OR (CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] - END IS NULL AND [l2].[OneToMany_Optional_Inverse3Id] IS NULL))) + WHERE (([l2].[Level2_Required_Id] IS NOT NULL) AND ([l2].[OneToMany_Required_Inverse3Id] IS NOT NULL)) AND ((CASE + WHEN (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] + END IS NOT NULL) AND ((CASE + WHEN (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] + END = [l2].[OneToMany_Optional_Inverse3Id]) OR ((CASE + WHEN (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] + END IS NULL) AND ([l2].[OneToMany_Optional_Inverse3Id] IS NULL)))) ) AS [t0] WHERE CASE - WHEN [t0].[Level2_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [t0].[Id] + WHEN ([t0].[Level2_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [t0].[Id] END = 1)"); } @@ -2024,9 +2024,9 @@ LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Required_Id], [l0].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l0] INNER JOIN [Level1] AS [l1] ON [l0].[Id] = [l1].[Id] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL)) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t] ON [l].[Id] = CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + WHEN (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] END LEFT JOIN ( SELECT [l2].[Id], [l2].[Level2_Required_Id], [l2].[OneToMany_Required_Inverse3Id] @@ -2035,13 +2035,13 @@ INNER JOIN ( SELECT [l3].[Id] FROM [Level1] AS [l3] INNER JOIN [Level1] AS [l4] ON [l3].[Id] = [l4].[Id] - WHERE ([l3].[OneToOne_Required_PK_Date] IS NOT NULL AND [l3].[Level1_Required_Id] IS NOT NULL) AND [l3].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l3].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l3].[Level1_Required_Id] IS NOT NULL)) AND ([l3].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t1] ON [l2].[Id] = [t1].[Id] - WHERE [l2].[Level2_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l2].[Level2_Required_Id] IS NOT NULL) AND ([l2].[OneToMany_Required_Inverse3Id] IS NOT NULL) ) AS [t0] ON CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + WHEN (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] END = CASE - WHEN [t0].[Level2_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [t0].[Id] + WHEN ([t0].[Level2_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [t0].[Id] END LEFT JOIN ( SELECT [t3].[Id0] AS [Id00], [t3].[OneToOne_Required_PK_Date], [t3].[Level1_Required_Id], [t3].[Level2_Name], [t3].[OneToMany_Required_Inverse2Id] @@ -2053,16 +2053,16 @@ LEFT JOIN ( SELECT [l7].[Id], [l7].[OneToOne_Required_PK_Date], [l7].[Level1_Optional_Id], [l7].[Level1_Required_Id], [l7].[Level2_Name], [l7].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l7] INNER JOIN [Level1] AS [l8] ON [l7].[Id] = [l8].[Id] - WHERE ([l7].[OneToOne_Required_PK_Date] IS NOT NULL AND [l7].[Level1_Required_Id] IS NOT NULL) AND [l7].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l7].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l7].[Level1_Required_Id] IS NOT NULL)) AND ([l7].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t4] ON [l6].[Id] = CASE - WHEN ([t4].[OneToOne_Required_PK_Date] IS NOT NULL AND [t4].[Level1_Required_Id] IS NOT NULL) AND [t4].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t4].[Id] + WHEN (([t4].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t4].[Level1_Required_Id] IS NOT NULL)) AND ([t4].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t4].[Id] END - WHERE ([t4].[OneToOne_Required_PK_Date] IS NOT NULL AND [t4].[Level1_Required_Id] IS NOT NULL) AND [t4].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([t4].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t4].[Level1_Required_Id] IS NOT NULL)) AND ([t4].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t3] ON [l5].[Id] = [t3].[Level1_Optional_Id] ) AS [t2] ON [t0].[Level2_Required_Id] = CASE - WHEN ([t2].[OneToOne_Required_PK_Date] IS NOT NULL AND [t2].[Level1_Required_Id] IS NOT NULL) AND [t2].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t2].[Id00] + WHEN (([t2].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t2].[Level1_Required_Id] IS NOT NULL)) AND ([t2].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t2].[Id00] END -WHERE (([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL) AND ([t0].[Level2_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse3Id] IS NOT NULL)"); +WHERE ((([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL)) AND (([t0].[Level2_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse3Id] IS NOT NULL))"); } public override async Task Multiple_SelectMany_with_navigation_and_explicit_DefaultIfEmpty(bool async) @@ -2076,7 +2076,7 @@ INNER JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Required_Id], [l0].[OneToMany_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l0] INNER JOIN [Level1] AS [l1] ON [l0].[Id] = [l1].[Id] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL)) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t] ON [l].[Id] = [t].[OneToMany_Optional_Inverse2Id] LEFT JOIN ( SELECT [l2].[Level2_Required_Id], [l2].[OneToMany_Optional_Inverse3Id], [l2].[OneToMany_Required_Inverse3Id] @@ -2085,13 +2085,13 @@ INNER JOIN ( SELECT [l3].[Id] FROM [Level1] AS [l3] INNER JOIN [Level1] AS [l4] ON [l3].[Id] = [l4].[Id] - WHERE ([l3].[OneToOne_Required_PK_Date] IS NOT NULL AND [l3].[Level1_Required_Id] IS NOT NULL) AND [l3].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l3].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l3].[Level1_Required_Id] IS NOT NULL)) AND ([l3].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t1] ON [l2].[Id] = [t1].[Id] - WHERE ([l2].[Level2_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse3Id] IS NOT NULL) AND ([l2].[Id] > 5) + WHERE (([l2].[Level2_Required_Id] IS NOT NULL) AND ([l2].[OneToMany_Required_Inverse3Id] IS NOT NULL)) AND ([l2].[Id] > 5) ) AS [t0] ON CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + WHEN (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] END = [t0].[OneToMany_Optional_Inverse3Id] -WHERE [t0].[Level2_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse3Id] IS NOT NULL"); +WHERE ([t0].[Level2_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse3Id] IS NOT NULL)"); } public override async Task Contains_with_subquery_optional_navigation_scalar_distinct_and_constant_item(bool async) @@ -2105,7 +2105,7 @@ LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l0] INNER JOIN [Level1] AS [l1] ON [l0].[Id] = [l1].[Id] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL)) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t] ON [l].[Id] = [t].[Level1_Optional_Id] WHERE EXISTS ( SELECT DISTINCT 1 @@ -2114,15 +2114,15 @@ INNER JOIN ( SELECT [l3].[Id], [l3].[OneToOne_Required_PK_Date], [l3].[Level1_Optional_Id], [l3].[Level1_Required_Id], [l3].[Level2_Name], [l3].[OneToMany_Optional_Inverse2Id], [l3].[OneToMany_Required_Inverse2Id], [l3].[OneToOne_Optional_PK_Inverse2Id], [l4].[Id] AS [Id0] FROM [Level1] AS [l3] INNER JOIN [Level1] AS [l4] ON [l3].[Id] = [l4].[Id] - WHERE ([l3].[OneToOne_Required_PK_Date] IS NOT NULL AND [l3].[Level1_Required_Id] IS NOT NULL) AND [l3].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l3].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l3].[Level1_Required_Id] IS NOT NULL)) AND ([l3].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t0] ON [l2].[Id] = [t0].[Id] - WHERE (([l2].[Level2_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse3Id] IS NOT NULL) AND (CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] - END IS NOT NULL AND ((CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] - END = [l2].[OneToMany_Optional_Inverse3Id]) OR (CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] - END IS NULL AND [l2].[OneToMany_Optional_Inverse3Id] IS NULL)))) AND (CAST(LEN([l2].[Level3_Name]) AS int) = 1))"); + WHERE ((([l2].[Level2_Required_Id] IS NOT NULL) AND ([l2].[OneToMany_Required_Inverse3Id] IS NOT NULL)) AND ((CASE + WHEN (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] + END IS NOT NULL) AND ((CASE + WHEN (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] + END = [l2].[OneToMany_Optional_Inverse3Id]) OR ((CASE + WHEN (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] + END IS NULL) AND ([l2].[OneToMany_Optional_Inverse3Id] IS NULL))))) AND (CAST(LEN([l2].[Level3_Name]) AS int) = 1))"); } public override async Task GroupJoin_with_complex_subquery_with_joins_does_not_get_flattened2(bool async) @@ -2131,7 +2131,7 @@ public override async Task GroupJoin_with_complex_subquery_with_joins_does_not_g AssertSql( @"SELECT CASE - WHEN ([t0].[OneToOne_Required_PK_Date] IS NOT NULL AND [t0].[Level1_Required_Id] IS NOT NULL) AND [t0].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t0].[Id0] + WHEN (([t0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t0].[Level1_Required_Id] IS NOT NULL)) AND ([t0].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t0].[Id0] END FROM [Level1] AS [l] LEFT JOIN ( @@ -2141,12 +2141,12 @@ LEFT JOIN ( SELECT [l1].[Id], [l1].[OneToOne_Required_PK_Date], [l1].[Level1_Optional_Id], [l1].[Level1_Required_Id], [l1].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l1] INNER JOIN [Level1] AS [l3] ON [l1].[Id] = [l3].[Id] - WHERE ([l1].[OneToOne_Required_PK_Date] IS NOT NULL AND [l1].[Level1_Required_Id] IS NOT NULL) AND [l1].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l1].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l1].[Level1_Required_Id] IS NOT NULL)) AND ([l1].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t] ON [l0].[Id] = CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + WHEN (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] END INNER JOIN [Level1] AS [l2] ON [t].[Level1_Required_Id] = [l2].[Id] - WHERE ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t0] ON [l].[Id] = [t0].[Level1_Optional_Id]"); } @@ -2161,7 +2161,7 @@ LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Required_Id], [l0].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l0] INNER JOIN [Level1] AS [l1] ON [l0].[Id] = [l1].[Id] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL)) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t] ON [l].[Id] = [t].[Level1_Required_Id] LEFT JOIN ( SELECT [l2].[Level2_Required_Id], [l2].[OneToMany_Required_Inverse3Id] @@ -2170,13 +2170,13 @@ INNER JOIN ( SELECT [l3].[Id] FROM [Level1] AS [l3] INNER JOIN [Level1] AS [l4] ON [l3].[Id] = [l4].[Id] - WHERE ([l3].[OneToOne_Required_PK_Date] IS NOT NULL AND [l3].[Level1_Required_Id] IS NOT NULL) AND [l3].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l3].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l3].[Level1_Required_Id] IS NOT NULL)) AND ([l3].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t1] ON [l2].[Id] = [t1].[Id] - WHERE ([l2].[Level2_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse3Id] IS NOT NULL) AND ([l2].[Id] > 5) + WHERE (([l2].[Level2_Required_Id] IS NOT NULL) AND ([l2].[OneToMany_Required_Inverse3Id] IS NOT NULL)) AND ([l2].[Id] > 5) ) AS [t0] ON CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + WHEN (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] END = [t0].[OneToMany_Required_Inverse3Id] -WHERE [t0].[Level2_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse3Id] IS NOT NULL"); +WHERE ([t0].[Level2_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse3Id] IS NOT NULL)"); } public override async Task Required_navigation_on_a_subquery_with_complex_projection_and_First(bool async) @@ -2191,27 +2191,27 @@ LEFT JOIN ( SELECT [l5].[Id], [l5].[OneToOne_Required_PK_Date], [l5].[Level1_Optional_Id], [l5].[Level1_Required_Id], [l5].[Level2_Name], [l5].[OneToMany_Optional_Inverse2Id], [l5].[OneToMany_Required_Inverse2Id], [l5].[OneToOne_Optional_PK_Inverse2Id], [l6].[Id] AS [Id0] FROM [Level1] AS [l5] INNER JOIN [Level1] AS [l6] ON [l5].[Id] = [l6].[Id] - WHERE ([l5].[OneToOne_Required_PK_Date] IS NOT NULL AND [l5].[Level1_Required_Id] IS NOT NULL) AND [l5].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l5].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l5].[Level1_Required_Id] IS NOT NULL)) AND ([l5].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t0] ON [l2].[Id] = CASE - WHEN ([t0].[OneToOne_Required_PK_Date] IS NOT NULL AND [t0].[Level1_Required_Id] IS NOT NULL) AND [t0].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t0].[Id] + WHEN (([t0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t0].[Level1_Required_Id] IS NOT NULL)) AND ([t0].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t0].[Id] END INNER JOIN [Level1] AS [l3] ON [t0].[Level1_Required_Id] = [l3].[Id] LEFT JOIN [Level1] AS [l4] ON [t0].[Level1_Required_Id] = [l4].[Id] - WHERE ([t0].[OneToOne_Required_PK_Date] IS NOT NULL AND [t0].[Level1_Required_Id] IS NOT NULL) AND [t0].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([t0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t0].[Level1_Required_Id] IS NOT NULL)) AND ([t0].[OneToMany_Required_Inverse2Id] IS NOT NULL) ORDER BY CASE - WHEN ([t0].[OneToOne_Required_PK_Date] IS NOT NULL AND [t0].[Level1_Required_Id] IS NOT NULL) AND [t0].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t0].[Id] + WHEN (([t0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t0].[Level1_Required_Id] IS NOT NULL)) AND ([t0].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t0].[Id] END) FROM [Level1] AS [l] LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Required_Id], [l0].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l0] INNER JOIN [Level1] AS [l1] ON [l0].[Id] = [l1].[Id] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL)) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t] ON [l].[Id] = CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + WHEN (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] END -WHERE (([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL) AND (CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] +WHERE ((([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL)) AND (CASE + WHEN (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] END = 7)"); } @@ -2227,7 +2227,7 @@ LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Required_Id], [l0].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l0] INNER JOIN [Level1] AS [l1] ON [l0].[Id] = [l1].[Id] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL)) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t] ON [l].[Id] = [t].[Level1_Required_Id] LEFT JOIN ( SELECT [l2].[Id], [l2].[Level2_Optional_Id], [l2].[Level2_Required_Id], [l2].[OneToMany_Required_Inverse3Id] @@ -2236,11 +2236,11 @@ INNER JOIN ( SELECT [l3].[Id] FROM [Level1] AS [l3] INNER JOIN [Level1] AS [l4] ON [l3].[Id] = [l4].[Id] - WHERE ([l3].[OneToOne_Required_PK_Date] IS NOT NULL AND [l3].[Level1_Required_Id] IS NOT NULL) AND [l3].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l3].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l3].[Level1_Required_Id] IS NOT NULL)) AND ([l3].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t1] ON [l2].[Id] = [t1].[Id] - WHERE [l2].[Level2_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l2].[Level2_Required_Id] IS NOT NULL) AND ([l2].[OneToMany_Required_Inverse3Id] IS NOT NULL) ) AS [t0] ON CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + WHEN (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] END = [t0].[Level2_Optional_Id] LEFT JOIN ( SELECT [l5].[Id], [l5].[Level3_Optional_Id], [l5].[Level3_Required_Id], [l5].[Level4_Name], [l5].[OneToMany_Optional_Inverse4Id], [l5].[OneToMany_Required_Inverse4Id], [l5].[OneToOne_Optional_PK_Inverse4Id] @@ -2252,13 +2252,13 @@ INNER JOIN ( SELECT [l7].[Id] FROM [Level1] AS [l7] INNER JOIN [Level1] AS [l8] ON [l7].[Id] = [l8].[Id] - WHERE ([l7].[OneToOne_Required_PK_Date] IS NOT NULL AND [l7].[Level1_Required_Id] IS NOT NULL) AND [l7].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l7].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l7].[Level1_Required_Id] IS NOT NULL)) AND ([l7].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t4] ON [l6].[Id] = [t4].[Id] - WHERE [l6].[Level2_Required_Id] IS NOT NULL AND [l6].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l6].[Level2_Required_Id] IS NOT NULL) AND ([l6].[OneToMany_Required_Inverse3Id] IS NOT NULL) ) AS [t3] ON [l5].[Id] = [t3].[Id] - WHERE [l5].[Level3_Required_Id] IS NOT NULL AND [l5].[OneToMany_Required_Inverse4Id] IS NOT NULL + WHERE ([l5].[Level3_Required_Id] IS NOT NULL) AND ([l5].[OneToMany_Required_Inverse4Id] IS NOT NULL) ) AS [t2] ON CASE - WHEN [t0].[Level2_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [t0].[Id] + WHEN ([t0].[Level2_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [t0].[Id] END = [t2].[OneToMany_Required_Inverse4Id] INNER JOIN ( SELECT [t6].[Id] AS [Id0], [t6].[OneToOne_Required_PK_Date], [t6].[Level1_Optional_Id], [t6].[Level1_Required_Id], [t6].[Level2_Name], [t6].[OneToMany_Optional_Inverse2Id], [t6].[OneToMany_Required_Inverse2Id], [t6].[OneToOne_Optional_PK_Inverse2Id] @@ -2267,15 +2267,15 @@ LEFT JOIN ( SELECT [l10].[Id], [l10].[OneToOne_Required_PK_Date], [l10].[Level1_Optional_Id], [l10].[Level1_Required_Id], [l10].[Level2_Name], [l10].[OneToMany_Optional_Inverse2Id], [l10].[OneToMany_Required_Inverse2Id], [l10].[OneToOne_Optional_PK_Inverse2Id] FROM [Level1] AS [l10] INNER JOIN [Level1] AS [l11] ON [l10].[Id] = [l11].[Id] - WHERE ([l10].[OneToOne_Required_PK_Date] IS NOT NULL AND [l10].[Level1_Required_Id] IS NOT NULL) AND [l10].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l10].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l10].[Level1_Required_Id] IS NOT NULL)) AND ([l10].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t6] ON [l9].[Id] = CASE - WHEN ([t6].[OneToOne_Required_PK_Date] IS NOT NULL AND [t6].[Level1_Required_Id] IS NOT NULL) AND [t6].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t6].[Id] + WHEN (([t6].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t6].[Level1_Required_Id] IS NOT NULL)) AND ([t6].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t6].[Id] END - WHERE ([t6].[OneToOne_Required_PK_Date] IS NOT NULL AND [t6].[Level1_Required_Id] IS NOT NULL) AND [t6].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([t6].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t6].[Level1_Required_Id] IS NOT NULL)) AND ([t6].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t5] ON CASE - WHEN [t2].[Level3_Required_Id] IS NOT NULL AND [t2].[OneToMany_Required_Inverse4Id] IS NOT NULL THEN [t2].[Id] + WHEN ([t2].[Level3_Required_Id] IS NOT NULL) AND ([t2].[OneToMany_Required_Inverse4Id] IS NOT NULL) THEN [t2].[Id] END = CASE - WHEN ([t5].[OneToOne_Required_PK_Date] IS NOT NULL AND [t5].[Level1_Required_Id] IS NOT NULL) AND [t5].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t5].[Id0] + WHEN (([t5].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t5].[Level1_Required_Id] IS NOT NULL)) AND ([t5].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t5].[Id0] END"); } @@ -2290,12 +2290,12 @@ LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[Level2_Name], [l0].[OneToMany_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id] FROM [Level1] AS [l0] INNER JOIN [Level1] AS [l1] ON [l0].[Id] = [l1].[Id] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL)) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t] ON [l].[Id] = CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + WHEN (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] END -WHERE ((([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL) AND (CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] +WHERE (((([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL)) AND (CASE + WHEN (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] END = 7)) AND (( SELECT TOP(1) [l3].[Name] FROM [Level1] AS [l2] @@ -2303,14 +2303,14 @@ LEFT JOIN ( SELECT [l4].[Id], [l4].[OneToOne_Required_PK_Date], [l4].[Level1_Optional_Id], [l4].[Level1_Required_Id], [l4].[Level2_Name], [l4].[OneToMany_Optional_Inverse2Id], [l4].[OneToMany_Required_Inverse2Id], [l4].[OneToOne_Optional_PK_Inverse2Id], [l5].[Id] AS [Id0] FROM [Level1] AS [l4] INNER JOIN [Level1] AS [l5] ON [l4].[Id] = [l5].[Id] - WHERE ([l4].[OneToOne_Required_PK_Date] IS NOT NULL AND [l4].[Level1_Required_Id] IS NOT NULL) AND [l4].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l4].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l4].[Level1_Required_Id] IS NOT NULL)) AND ([l4].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t0] ON [l2].[Id] = CASE - WHEN ([t0].[OneToOne_Required_PK_Date] IS NOT NULL AND [t0].[Level1_Required_Id] IS NOT NULL) AND [t0].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t0].[Id] + WHEN (([t0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t0].[Level1_Required_Id] IS NOT NULL)) AND ([t0].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t0].[Id] END LEFT JOIN [Level1] AS [l3] ON [t0].[Level1_Required_Id] = [l3].[Id] - WHERE ([t0].[OneToOne_Required_PK_Date] IS NOT NULL AND [t0].[Level1_Required_Id] IS NOT NULL) AND [t0].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([t0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t0].[Level1_Required_Id] IS NOT NULL)) AND ([t0].[OneToMany_Required_Inverse2Id] IS NOT NULL) ORDER BY CASE - WHEN ([t0].[OneToOne_Required_PK_Date] IS NOT NULL AND [t0].[Level1_Required_Id] IS NOT NULL) AND [t0].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t0].[Id] + WHEN (([t0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t0].[Level1_Required_Id] IS NOT NULL)) AND ([t0].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t0].[Id] END) = N'L1 02')"); } @@ -2328,14 +2328,14 @@ LEFT JOIN ( SELECT [l1].[Id], [l1].[OneToOne_Required_PK_Date], [l1].[Level1_Optional_Id], [l1].[Level1_Required_Id], [l1].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l1] INNER JOIN [Level1] AS [l2] ON [l1].[Id] = [l2].[Id] - WHERE ([l1].[OneToOne_Required_PK_Date] IS NOT NULL AND [l1].[Level1_Required_Id] IS NOT NULL) AND [l1].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l1].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l1].[Level1_Required_Id] IS NOT NULL)) AND ([l1].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t] ON [l0].[Id] = CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + WHEN (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] END - WHERE ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t0] ON [l].[Id] = [t0].[Level1_Optional_Id] LEFT JOIN [Level1] AS [l3] ON [t0].[Level1_Required_Id] = [l3].[Id] -WHERE ([l3].[Name] <> N'L3 02') OR [l3].[Name] IS NULL"); +WHERE ([l3].[Name] <> N'L3 02') OR ([l3].[Name] IS NULL)"); } public override async Task @@ -2353,7 +2353,7 @@ LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l0] INNER JOIN [Level1] AS [l1] ON [l0].[Id] = [l1].[Id] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL)) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t] ON [l].[Id] = [t].[Level1_Optional_Id] LEFT JOIN ( SELECT [l2].[Level2_Required_Id], [l2].[OneToMany_Optional_Inverse3Id] @@ -2362,22 +2362,22 @@ INNER JOIN ( SELECT [l3].[Id] FROM [Level1] AS [l3] INNER JOIN [Level1] AS [l4] ON [l3].[Id] = [l4].[Id] - WHERE ([l3].[OneToOne_Required_PK_Date] IS NOT NULL AND [l3].[Level1_Required_Id] IS NOT NULL) AND [l3].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l3].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l3].[Level1_Required_Id] IS NOT NULL)) AND ([l3].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t1] ON [l2].[Id] = [t1].[Id] - WHERE [l2].[Level2_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l2].[Level2_Required_Id] IS NOT NULL) AND ([l2].[OneToMany_Required_Inverse3Id] IS NOT NULL) ) AS [t0] ON CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + WHEN (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] END = [t0].[OneToMany_Optional_Inverse3Id] LEFT JOIN ( SELECT [l5].[Id], [l5].[OneToOne_Required_PK_Date], [l5].[Level1_Required_Id], [l5].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l5] INNER JOIN [Level1] AS [l6] ON [l5].[Id] = [l6].[Id] - WHERE ([l5].[OneToOne_Required_PK_Date] IS NOT NULL AND [l5].[Level1_Required_Id] IS NOT NULL) AND [l5].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l5].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l5].[Level1_Required_Id] IS NOT NULL)) AND ([l5].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t2] ON [t0].[Level2_Required_Id] = CASE - WHEN ([t2].[OneToOne_Required_PK_Date] IS NOT NULL AND [t2].[Level1_Required_Id] IS NOT NULL) AND [t2].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t2].[Id] + WHEN (([t2].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t2].[Level1_Required_Id] IS NOT NULL)) AND ([t2].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t2].[Id] END LEFT JOIN [Level1] AS [l7] ON CASE - WHEN ([t2].[OneToOne_Required_PK_Date] IS NOT NULL AND [t2].[Level1_Required_Id] IS NOT NULL) AND [t2].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t2].[Id] + WHEN (([t2].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t2].[Level1_Required_Id] IS NOT NULL)) AND ([t2].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t2].[Id] END = [l7].[Id]"); } @@ -2387,16 +2387,16 @@ public override async Task Optional_navigation_propagates_nullability_to_manuall AssertSql( @"SELECT CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + WHEN (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] END AS [Id1], CASE - WHEN ([t0].[OneToOne_Required_PK_Date] IS NOT NULL AND [t0].[Level1_Required_Id] IS NOT NULL) AND [t0].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t0].[Id0] + WHEN (([t0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t0].[Level1_Required_Id] IS NOT NULL)) AND ([t0].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t0].[Id0] END AS [Id2] FROM [Level1] AS [l] LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l0] INNER JOIN [Level1] AS [l1] ON [l0].[Id] = [l1].[Id] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL)) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t] ON [l].[Id] = [t].[Level1_Optional_Id] LEFT JOIN ( SELECT [t1].[Id] AS [Id0], [t1].[OneToOne_Required_PK_Date], [t1].[Level1_Required_Id], [t1].[OneToMany_Required_Inverse2Id] @@ -2405,13 +2405,13 @@ LEFT JOIN ( SELECT [l3].[Id], [l3].[OneToOne_Required_PK_Date], [l3].[Level1_Required_Id], [l3].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l3] INNER JOIN [Level1] AS [l4] ON [l3].[Id] = [l4].[Id] - WHERE ([l3].[OneToOne_Required_PK_Date] IS NOT NULL AND [l3].[Level1_Required_Id] IS NOT NULL) AND [l3].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l3].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l3].[Level1_Required_Id] IS NOT NULL)) AND ([l3].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t1] ON [l2].[Id] = CASE - WHEN ([t1].[OneToOne_Required_PK_Date] IS NOT NULL AND [t1].[Level1_Required_Id] IS NOT NULL) AND [t1].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t1].[Id] + WHEN (([t1].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t1].[Level1_Required_Id] IS NOT NULL)) AND ([t1].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t1].[Id] END - WHERE ([t1].[OneToOne_Required_PK_Date] IS NOT NULL AND [t1].[Level1_Required_Id] IS NOT NULL) AND [t1].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([t1].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t1].[Level1_Required_Id] IS NOT NULL)) AND ([t1].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t0] ON [t].[Level1_Required_Id] = CASE - WHEN ([t0].[OneToOne_Required_PK_Date] IS NOT NULL AND [t0].[Level1_Required_Id] IS NOT NULL) AND [t0].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t0].[Id0] + WHEN (([t0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t0].[Level1_Required_Id] IS NOT NULL)) AND ([t0].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t0].[Id0] END"); } @@ -2428,7 +2428,7 @@ LEFT JOIN ( SELECT [l0].[Level1_Optional_Id], [l0].[Level2_Name] FROM [Level1] AS [l0] INNER JOIN [Level1] AS [l1] ON [l0].[Id] = [l1].[Id] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL)) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t] ON [l].[Id] = [t].[Level1_Optional_Id] ORDER BY [t].[Level2_Name], [l].[Id]"); } @@ -2448,9 +2448,9 @@ LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Required_Id], [l0].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l0] INNER JOIN [Level1] AS [l1] ON [l0].[Id] = [l1].[Id] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL)) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t] ON [l].[Id] = CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + WHEN (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] END LEFT JOIN ( SELECT [l2].[Id], [l2].[Level2_Required_Id], [l2].[OneToMany_Required_Inverse3Id] @@ -2459,13 +2459,13 @@ INNER JOIN ( SELECT [l3].[Id] FROM [Level1] AS [l3] INNER JOIN [Level1] AS [l4] ON [l3].[Id] = [l4].[Id] - WHERE ([l3].[OneToOne_Required_PK_Date] IS NOT NULL AND [l3].[Level1_Required_Id] IS NOT NULL) AND [l3].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l3].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l3].[Level1_Required_Id] IS NOT NULL)) AND ([l3].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t1] ON [l2].[Id] = [t1].[Id] - WHERE [l2].[Level2_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l2].[Level2_Required_Id] IS NOT NULL) AND ([l2].[OneToMany_Required_Inverse3Id] IS NOT NULL) ) AS [t0] ON CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + WHEN (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] END = CASE - WHEN [t0].[Level2_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [t0].[Id] + WHEN ([t0].[Level2_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [t0].[Id] END LEFT JOIN ( SELECT [l5].[Id], [l5].[Level3_Required_Id], [l5].[OneToMany_Required_Inverse4Id] @@ -2477,15 +2477,15 @@ INNER JOIN ( SELECT [l7].[Id] FROM [Level1] AS [l7] INNER JOIN [Level1] AS [l8] ON [l7].[Id] = [l8].[Id] - WHERE ([l7].[OneToOne_Required_PK_Date] IS NOT NULL AND [l7].[Level1_Required_Id] IS NOT NULL) AND [l7].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l7].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l7].[Level1_Required_Id] IS NOT NULL)) AND ([l7].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t4] ON [l6].[Id] = [t4].[Id] - WHERE [l6].[Level2_Required_Id] IS NOT NULL AND [l6].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l6].[Level2_Required_Id] IS NOT NULL) AND ([l6].[OneToMany_Required_Inverse3Id] IS NOT NULL) ) AS [t3] ON [l5].[Id] = [t3].[Id] - WHERE [l5].[Level3_Required_Id] IS NOT NULL AND [l5].[OneToMany_Required_Inverse4Id] IS NOT NULL + WHERE ([l5].[Level3_Required_Id] IS NOT NULL) AND ([l5].[OneToMany_Required_Inverse4Id] IS NOT NULL) ) AS [t2] ON CASE - WHEN [t0].[Level2_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [t0].[Id] + WHEN ([t0].[Level2_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [t0].[Id] END = CASE - WHEN [t2].[Level3_Required_Id] IS NOT NULL AND [t2].[OneToMany_Required_Inverse4Id] IS NOT NULL THEN [t2].[Id] + WHEN ([t2].[Level3_Required_Id] IS NOT NULL) AND ([t2].[OneToMany_Required_Inverse4Id] IS NOT NULL) THEN [t2].[Id] END LEFT JOIN ( SELECT [l9].[Id], [l9].[Level2_Required_Id], [l9].[OneToMany_Required_Inverse3Id] @@ -2494,19 +2494,19 @@ INNER JOIN ( SELECT [l10].[Id] FROM [Level1] AS [l10] INNER JOIN [Level1] AS [l11] ON [l10].[Id] = [l11].[Id] - WHERE ([l10].[OneToOne_Required_PK_Date] IS NOT NULL AND [l10].[Level1_Required_Id] IS NOT NULL) AND [l10].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l10].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l10].[Level1_Required_Id] IS NOT NULL)) AND ([l10].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t6] ON [l9].[Id] = [t6].[Id] - WHERE [l9].[Level2_Required_Id] IS NOT NULL AND [l9].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l9].[Level2_Required_Id] IS NOT NULL) AND ([l9].[OneToMany_Required_Inverse3Id] IS NOT NULL) ) AS [t5] ON [t2].[Level3_Required_Id] = CASE - WHEN [t5].[Level2_Required_Id] IS NOT NULL AND [t5].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [t5].[Id] + WHEN ([t5].[Level2_Required_Id] IS NOT NULL) AND ([t5].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [t5].[Id] END LEFT JOIN ( SELECT [l12].[Id], [l12].[OneToOne_Required_PK_Date], [l12].[Level1_Required_Id], [l12].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l12] INNER JOIN [Level1] AS [l13] ON [l12].[Id] = [l13].[Id] - WHERE ([l12].[OneToOne_Required_PK_Date] IS NOT NULL AND [l12].[Level1_Required_Id] IS NOT NULL) AND [l12].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l12].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l12].[Level1_Required_Id] IS NOT NULL)) AND ([l12].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t7] ON [t5].[Level2_Required_Id] = CASE - WHEN ([t7].[OneToOne_Required_PK_Date] IS NOT NULL AND [t7].[Level1_Required_Id] IS NOT NULL) AND [t7].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t7].[Id] + WHEN (([t7].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t7].[Level1_Required_Id] IS NOT NULL)) AND ([t7].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t7].[Id] END LEFT JOIN ( SELECT [l14].[Level2_Required_Id], [l14].[OneToMany_Required_Inverse3Id] @@ -2515,24 +2515,24 @@ INNER JOIN ( SELECT [l15].[Id] FROM [Level1] AS [l15] INNER JOIN [Level1] AS [l16] ON [l15].[Id] = [l16].[Id] - WHERE ([l15].[OneToOne_Required_PK_Date] IS NOT NULL AND [l15].[Level1_Required_Id] IS NOT NULL) AND [l15].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l15].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l15].[Level1_Required_Id] IS NOT NULL)) AND ([l15].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t9] ON [l14].[Id] = [t9].[Id] - WHERE [l14].[Level2_Required_Id] IS NOT NULL AND [l14].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l14].[Level2_Required_Id] IS NOT NULL) AND ([l14].[OneToMany_Required_Inverse3Id] IS NOT NULL) ) AS [t8] ON CASE - WHEN ([t7].[OneToOne_Required_PK_Date] IS NOT NULL AND [t7].[Level1_Required_Id] IS NOT NULL) AND [t7].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t7].[Id] + WHEN (([t7].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t7].[Level1_Required_Id] IS NOT NULL)) AND ([t7].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t7].[Id] END = [t8].[OneToMany_Required_Inverse3Id] LEFT JOIN ( SELECT [l17].[Id], [l17].[OneToOne_Required_PK_Date], [l17].[Level1_Required_Id], [l17].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l17] INNER JOIN [Level1] AS [l18] ON [l17].[Id] = [l18].[Id] - WHERE ([l17].[OneToOne_Required_PK_Date] IS NOT NULL AND [l17].[Level1_Required_Id] IS NOT NULL) AND [l17].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l17].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l17].[Level1_Required_Id] IS NOT NULL)) AND ([l17].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t10] ON [t8].[Level2_Required_Id] = CASE - WHEN ([t10].[OneToOne_Required_PK_Date] IS NOT NULL AND [t10].[Level1_Required_Id] IS NOT NULL) AND [t10].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t10].[Id] + WHEN (([t10].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t10].[Level1_Required_Id] IS NOT NULL)) AND ([t10].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t10].[Id] END LEFT JOIN [Level1] AS [l19] ON CASE - WHEN ([t10].[OneToOne_Required_PK_Date] IS NOT NULL AND [t10].[Level1_Required_Id] IS NOT NULL) AND [t10].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t10].[Id] + WHEN (([t10].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t10].[Level1_Required_Id] IS NOT NULL)) AND ([t10].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t10].[Id] END = [l19].[Id] -WHERE ((([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL) AND ([t0].[Level2_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse3Id] IS NOT NULL)) AND ([t2].[Level3_Required_Id] IS NOT NULL AND [t2].[OneToMany_Required_Inverse4Id] IS NOT NULL)"); +WHERE (((([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL)) AND (([t0].[Level2_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse3Id] IS NOT NULL))) AND (([t2].[Level3_Required_Id] IS NOT NULL) AND ([t2].[OneToMany_Required_Inverse4Id] IS NOT NULL))"); } public override async Task Required_navigation_on_a_subquery_with_First_in_projection(bool async) @@ -2547,26 +2547,26 @@ LEFT JOIN ( SELECT [l4].[Id], [l4].[OneToOne_Required_PK_Date], [l4].[Level1_Optional_Id], [l4].[Level1_Required_Id], [l4].[Level2_Name], [l4].[OneToMany_Optional_Inverse2Id], [l4].[OneToMany_Required_Inverse2Id], [l4].[OneToOne_Optional_PK_Inverse2Id], [l5].[Id] AS [Id0] FROM [Level1] AS [l4] INNER JOIN [Level1] AS [l5] ON [l4].[Id] = [l5].[Id] - WHERE ([l4].[OneToOne_Required_PK_Date] IS NOT NULL AND [l4].[Level1_Required_Id] IS NOT NULL) AND [l4].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l4].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l4].[Level1_Required_Id] IS NOT NULL)) AND ([l4].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t0] ON [l2].[Id] = CASE - WHEN ([t0].[OneToOne_Required_PK_Date] IS NOT NULL AND [t0].[Level1_Required_Id] IS NOT NULL) AND [t0].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t0].[Id] + WHEN (([t0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t0].[Level1_Required_Id] IS NOT NULL)) AND ([t0].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t0].[Id] END LEFT JOIN [Level1] AS [l3] ON [t0].[Level1_Required_Id] = [l3].[Id] - WHERE ([t0].[OneToOne_Required_PK_Date] IS NOT NULL AND [t0].[Level1_Required_Id] IS NOT NULL) AND [t0].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([t0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t0].[Level1_Required_Id] IS NOT NULL)) AND ([t0].[OneToMany_Required_Inverse2Id] IS NOT NULL) ORDER BY CASE - WHEN ([t0].[OneToOne_Required_PK_Date] IS NOT NULL AND [t0].[Level1_Required_Id] IS NOT NULL) AND [t0].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t0].[Id] + WHEN (([t0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t0].[Level1_Required_Id] IS NOT NULL)) AND ([t0].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t0].[Id] END) FROM [Level1] AS [l] LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Required_Id], [l0].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l0] INNER JOIN [Level1] AS [l1] ON [l0].[Id] = [l1].[Id] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL)) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t] ON [l].[Id] = CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + WHEN (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] END -WHERE (([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL) AND (CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] +WHERE ((([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL)) AND (CASE + WHEN (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] END = 7)"); } @@ -2576,7 +2576,7 @@ public override async Task GroupJoin_with_complex_subquery_with_joins_does_not_g AssertSql( @"SELECT CASE - WHEN ([t0].[OneToOne_Required_PK_Date] IS NOT NULL AND [t0].[Level1_Required_Id] IS NOT NULL) AND [t0].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t0].[Id0] + WHEN (([t0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t0].[Level1_Required_Id] IS NOT NULL)) AND ([t0].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t0].[Id0] END FROM [Level1] AS [l] LEFT JOIN ( @@ -2586,12 +2586,12 @@ LEFT JOIN ( SELECT [l1].[Id], [l1].[OneToOne_Required_PK_Date], [l1].[Level1_Optional_Id], [l1].[Level1_Required_Id], [l1].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l1] INNER JOIN [Level1] AS [l3] ON [l1].[Id] = [l3].[Id] - WHERE ([l1].[OneToOne_Required_PK_Date] IS NOT NULL AND [l1].[Level1_Required_Id] IS NOT NULL) AND [l1].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l1].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l1].[Level1_Required_Id] IS NOT NULL)) AND ([l1].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t] ON [l0].[Id] = CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + WHEN (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] END INNER JOIN [Level1] AS [l2] ON [t].[Level1_Required_Id] = [l2].[Id] - WHERE ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t0] ON [l].[Id] = [t0].[Level1_Optional_Id]"); } @@ -2601,7 +2601,7 @@ public override async Task GroupJoin_with_complex_subquery_with_joins_does_not_g AssertSql( @"SELECT CASE - WHEN ([t0].[OneToOne_Required_PK_Date] IS NOT NULL AND [t0].[Level1_Required_Id] IS NOT NULL) AND [t0].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t0].[Id0] + WHEN (([t0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t0].[Level1_Required_Id] IS NOT NULL)) AND ([t0].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t0].[Id0] END FROM [Level1] AS [l] LEFT JOIN ( @@ -2611,12 +2611,12 @@ LEFT JOIN ( SELECT [l1].[Id], [l1].[OneToOne_Required_PK_Date], [l1].[Level1_Required_Id], [l1].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l1] INNER JOIN [Level1] AS [l3] ON [l1].[Id] = [l3].[Id] - WHERE ([l1].[OneToOne_Required_PK_Date] IS NOT NULL AND [l1].[Level1_Required_Id] IS NOT NULL) AND [l1].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l1].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l1].[Level1_Required_Id] IS NOT NULL)) AND ([l1].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t] ON [l0].[Id] = CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + WHEN (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] END LEFT JOIN [Level1] AS [l2] ON [t].[Level1_Required_Id] = [l2].[Id] - WHERE ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t0] ON [l].[Id] = [t0].[Level1_Required_Id]"); } @@ -2638,11 +2638,11 @@ LEFT JOIN ( SELECT [l1].[Id], [l1].[OneToOne_Required_PK_Date], [l1].[Level1_Optional_Id], [l1].[Level1_Required_Id], [l1].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l1] INNER JOIN [Level1] AS [l2] ON [l1].[Id] = [l2].[Id] - WHERE ([l1].[OneToOne_Required_PK_Date] IS NOT NULL AND [l1].[Level1_Required_Id] IS NOT NULL) AND [l1].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l1].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l1].[Level1_Required_Id] IS NOT NULL)) AND ([l1].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t] ON [l0].[Id] = CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + WHEN (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] END - WHERE ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t0] ON [l].[Id] = [t0].[Level1_Optional_Id] ORDER BY [l].[Id] ) AS [t1] @@ -2661,15 +2661,15 @@ LEFT JOIN ( SELECT [t].[OneToOne_Required_PK_Date], [t].[Level1_Required_Id], [t].[OneToMany_Required_Inverse2Id] FROM ( SELECT [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Required_Id], [l0].[OneToMany_Required_Inverse2Id], ROW_NUMBER() OVER(PARTITION BY [l0].[OneToMany_Required_Inverse2Id] ORDER BY CASE - WHEN ([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [l0].[Id] + WHEN (([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL)) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [l0].[Id] END) AS [row] FROM [Level1] AS [l0] INNER JOIN [Level1] AS [l1] ON [l0].[Id] = [l1].[Id] - WHERE (([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) AND ([l0].[Id] > 5) + WHERE ((([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL)) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL)) AND ([l0].[Id] > 5) ) AS [t] WHERE [t].[row] <= 3 ) AS [t0] ON [l].[Id] = [t0].[OneToMany_Required_Inverse2Id] -WHERE ([t0].[OneToOne_Required_PK_Date] IS NOT NULL AND [t0].[Level1_Required_Id] IS NOT NULL) AND [t0].[OneToMany_Required_Inverse2Id] IS NOT NULL"); +WHERE (([t0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t0].[Level1_Required_Id] IS NOT NULL)) AND ([t0].[OneToMany_Required_Inverse2Id] IS NOT NULL)"); } public override async Task Select_join_subquery_containing_filter_and_distinct(bool async) @@ -2686,12 +2686,12 @@ LEFT JOIN ( SELECT [l1].[Id], [l1].[OneToOne_Required_PK_Date], [l1].[Level1_Optional_Id], [l1].[Level1_Required_Id], [l1].[Level2_Name], [l1].[OneToMany_Optional_Inverse2Id], [l1].[OneToMany_Required_Inverse2Id], [l1].[OneToOne_Optional_PK_Inverse2Id] FROM [Level1] AS [l1] INNER JOIN [Level1] AS [l2] ON [l1].[Id] = [l2].[Id] - WHERE ([l1].[OneToOne_Required_PK_Date] IS NOT NULL AND [l1].[Level1_Required_Id] IS NOT NULL) AND [l1].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l1].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l1].[Level1_Required_Id] IS NOT NULL)) AND ([l1].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t] ON [l0].[Id] = CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + WHEN (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] END - WHERE (([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL) AND (CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + WHERE ((([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL)) AND (CASE + WHEN (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] END > 2) ) AS [t0] ON [l].[Id] = [t0].[Level1_Optional_Id]"); } @@ -2707,9 +2707,9 @@ LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Required_Id], [l0].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l0] INNER JOIN [Level1] AS [l1] ON [l0].[Id] = [l1].[Id] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL)) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t] ON [l].[Id] = CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + WHEN (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] END LEFT JOIN ( SELECT [l2].[Id], [l2].[Level2_Required_Id], [l2].[Level3_Name], [l2].[OneToMany_Required_Inverse3Id] @@ -2718,13 +2718,13 @@ INNER JOIN ( SELECT [l3].[Id] FROM [Level1] AS [l3] INNER JOIN [Level1] AS [l4] ON [l3].[Id] = [l4].[Id] - WHERE ([l3].[OneToOne_Required_PK_Date] IS NOT NULL AND [l3].[Level1_Required_Id] IS NOT NULL) AND [l3].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l3].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l3].[Level1_Required_Id] IS NOT NULL)) AND ([l3].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t1] ON [l2].[Id] = [t1].[Id] - WHERE [l2].[Level2_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l2].[Level2_Required_Id] IS NOT NULL) AND ([l2].[OneToMany_Required_Inverse3Id] IS NOT NULL) ) AS [t0] ON CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + WHEN (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] END = CASE - WHEN [t0].[Level2_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [t0].[Id] + WHEN ([t0].[Level2_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [t0].[Id] END LEFT JOIN ( SELECT [t3].[Id] AS [Id0], [t3].[OneToOne_Required_PK_Date], [t3].[Level1_Required_Id], [t3].[Level2_Name], [t3].[OneToMany_Required_Inverse2Id] @@ -2733,12 +2733,12 @@ LEFT JOIN ( SELECT [l6].[Id], [l6].[OneToOne_Required_PK_Date], [l6].[Level1_Optional_Id], [l6].[Level1_Required_Id], [l6].[Level2_Name], [l6].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l6] INNER JOIN [Level1] AS [l7] ON [l6].[Id] = [l7].[Id] - WHERE ([l6].[OneToOne_Required_PK_Date] IS NOT NULL AND [l6].[Level1_Required_Id] IS NOT NULL) AND [l6].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l6].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l6].[Level1_Required_Id] IS NOT NULL)) AND ([l6].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t3] ON [l5].[Id] = [t3].[Level1_Optional_Id] ) AS [t2] ON [t0].[Level2_Required_Id] = CASE - WHEN ([t2].[OneToOne_Required_PK_Date] IS NOT NULL AND [t2].[Level1_Required_Id] IS NOT NULL) AND [t2].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t2].[Id0] + WHEN (([t2].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t2].[Level1_Required_Id] IS NOT NULL)) AND ([t2].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t2].[Id0] END -WHERE (([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL) AND ([t0].[Level2_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse3Id] IS NOT NULL)"); +WHERE ((([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL)) AND (([t0].[Level2_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse3Id] IS NOT NULL))"); } public override async Task GroupJoin_on_a_subquery_containing_another_GroupJoin_projecting_outer(bool async) @@ -2759,11 +2759,11 @@ LEFT JOIN ( SELECT [l1].[Id], [l1].[OneToOne_Required_PK_Date], [l1].[Level1_Optional_Id], [l1].[Level1_Required_Id], [l1].[Level2_Name], [l1].[OneToMany_Optional_Inverse2Id], [l1].[OneToMany_Required_Inverse2Id], [l1].[OneToOne_Optional_PK_Inverse2Id], [l2].[Id] AS [Id0] FROM [Level1] AS [l1] INNER JOIN [Level1] AS [l2] ON [l1].[Id] = [l2].[Id] - WHERE ([l1].[OneToOne_Required_PK_Date] IS NOT NULL AND [l1].[Level1_Required_Id] IS NOT NULL) AND [l1].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l1].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l1].[Level1_Required_Id] IS NOT NULL)) AND ([l1].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t] ON [l0].[Id] = CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + WHEN (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] END - WHERE ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t0] ON [l].[Id] = [t0].[Level1_Optional_Id] ORDER BY [l].[Id] ) AS [t1] @@ -2774,11 +2774,11 @@ LEFT JOIN ( SELECT [l4].[Id], [l4].[OneToOne_Required_PK_Date], [l4].[Level1_Optional_Id], [l4].[Level1_Required_Id], [l4].[Level2_Name], [l4].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l4] INNER JOIN [Level1] AS [l5] ON [l4].[Id] = [l5].[Id] - WHERE ([l4].[OneToOne_Required_PK_Date] IS NOT NULL AND [l4].[Level1_Required_Id] IS NOT NULL) AND [l4].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l4].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l4].[Level1_Required_Id] IS NOT NULL)) AND ([l4].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t3] ON [l3].[Id] = CASE - WHEN ([t3].[OneToOne_Required_PK_Date] IS NOT NULL AND [t3].[Level1_Required_Id] IS NOT NULL) AND [t3].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t3].[Id] + WHEN (([t3].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t3].[Level1_Required_Id] IS NOT NULL)) AND ([t3].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t3].[Id] END - WHERE ([t3].[OneToOne_Required_PK_Date] IS NOT NULL AND [t3].[Level1_Required_Id] IS NOT NULL) AND [t3].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([t3].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t3].[Level1_Required_Id] IS NOT NULL)) AND ([t3].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t2] ON [t1].[Id] = [t2].[Level1_Optional_Id] ORDER BY [t1].[Id]"); } @@ -2794,7 +2794,7 @@ LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l0] INNER JOIN [Level1] AS [l1] ON [l0].[Id] = [l1].[Id] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL)) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t] ON [l].[Id] = [t].[Level1_Optional_Id] LEFT JOIN ( SELECT [l2].[Level2_Required_Id], [l2].[Level3_Name] @@ -2803,13 +2803,13 @@ INNER JOIN ( SELECT [l3].[Id] FROM [Level1] AS [l3] INNER JOIN [Level1] AS [l4] ON [l3].[Id] = [l4].[Id] - WHERE ([l3].[OneToOne_Required_PK_Date] IS NOT NULL AND [l3].[Level1_Required_Id] IS NOT NULL) AND [l3].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l3].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l3].[Level1_Required_Id] IS NOT NULL)) AND ([l3].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t1] ON [l2].[Id] = [t1].[Id] - WHERE [l2].[Level2_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l2].[Level2_Required_Id] IS NOT NULL) AND ([l2].[OneToMany_Required_Inverse3Id] IS NOT NULL) ) AS [t0] ON CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + WHEN (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] END = [t0].[Level2_Required_Id] -WHERE ([t0].[Level3_Name] <> N'L3 05') OR [t0].[Level3_Name] IS NULL"); +WHERE ([t0].[Level3_Name] <> N'L3 05') OR ([t0].[Level3_Name] IS NULL)"); } public override async Task Join_navigation_non_key_join(bool async) @@ -2818,16 +2818,16 @@ public override async Task Join_navigation_non_key_join(bool async) AssertSql( @"SELECT CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + WHEN (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] END AS [Id2], [t].[Level2_Name] AS [Name2], [t0].[Id] AS [Id1], [t0].[Name] AS [Name1] FROM [Level1] AS [l] LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Required_Id], [l0].[Level2_Name], [l0].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l0] INNER JOIN [Level1] AS [l1] ON [l0].[Id] = [l1].[Id] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL)) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t] ON [l].[Id] = CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + WHEN (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] END INNER JOIN ( SELECT [l2].[Id], [l2].[Name], [t1].[Level2_Name] @@ -2836,10 +2836,10 @@ LEFT JOIN ( SELECT [l3].[Level1_Optional_Id], [l3].[Level2_Name] FROM [Level1] AS [l3] INNER JOIN [Level1] AS [l4] ON [l3].[Id] = [l4].[Id] - WHERE ([l3].[OneToOne_Required_PK_Date] IS NOT NULL AND [l3].[Level1_Required_Id] IS NOT NULL) AND [l3].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l3].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l3].[Level1_Required_Id] IS NOT NULL)) AND ([l3].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t1] ON [l2].[Id] = [t1].[Level1_Optional_Id] ) AS [t0] ON [t].[Level2_Name] = [t0].[Level2_Name] -WHERE ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL"); +WHERE (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL)"); } public override async Task Select_nav_prop_reference_optional3(bool async) @@ -2853,12 +2853,12 @@ LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l0] INNER JOIN [Level1] AS [l1] ON [l0].[Id] = [l1].[Id] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL)) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t] ON [l].[Id] = CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + WHEN (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] END LEFT JOIN [Level1] AS [l2] ON [t].[Level1_Optional_Id] = [l2].[Id] -WHERE ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL"); +WHERE (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL)"); } public override async Task Include11(bool async) @@ -2872,7 +2872,7 @@ LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[Level2_Name], [l0].[OneToMany_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id] FROM [Level1] AS [l0] INNER JOIN [Level1] AS [l1] ON [l0].[Id] = [l1].[Id] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL)) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t] ON [l].[Id] = [t].[Level1_Optional_Id] LEFT JOIN ( SELECT [l2].[Id], [l2].[Level2_Optional_Id], [l2].[Level2_Required_Id], [l2].[Level3_Name], [l2].[OneToMany_Optional_Inverse3Id], [l2].[OneToMany_Required_Inverse3Id], [l2].[OneToOne_Optional_PK_Inverse3Id] @@ -2881,11 +2881,11 @@ INNER JOIN ( SELECT [l3].[Id] FROM [Level1] AS [l3] INNER JOIN [Level1] AS [l4] ON [l3].[Id] = [l4].[Id] - WHERE ([l3].[OneToOne_Required_PK_Date] IS NOT NULL AND [l3].[Level1_Required_Id] IS NOT NULL) AND [l3].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l3].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l3].[Level1_Required_Id] IS NOT NULL)) AND ([l3].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t1] ON [l2].[Id] = [t1].[Id] - WHERE [l2].[Level2_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l2].[Level2_Required_Id] IS NOT NULL) AND ([l2].[OneToMany_Required_Inverse3Id] IS NOT NULL) ) AS [t0] ON CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + WHEN (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] END = [t0].[Level2_Optional_Id] LEFT JOIN ( SELECT [l5].[Id], [l5].[Level2_Optional_Id], [l5].[Level2_Required_Id], [l5].[Level3_Name], [l5].[OneToMany_Optional_Inverse3Id], [l5].[OneToMany_Required_Inverse3Id], [l5].[OneToOne_Optional_PK_Inverse3Id] @@ -2894,17 +2894,17 @@ INNER JOIN ( SELECT [l6].[Id] FROM [Level1] AS [l6] INNER JOIN [Level1] AS [l7] ON [l6].[Id] = [l7].[Id] - WHERE ([l6].[OneToOne_Required_PK_Date] IS NOT NULL AND [l6].[Level1_Required_Id] IS NOT NULL) AND [l6].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l6].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l6].[Level1_Required_Id] IS NOT NULL)) AND ([l6].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t3] ON [l5].[Id] = [t3].[Id] - WHERE [l5].[Level2_Required_Id] IS NOT NULL AND [l5].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l5].[Level2_Required_Id] IS NOT NULL) AND ([l5].[OneToMany_Required_Inverse3Id] IS NOT NULL) ) AS [t2] ON CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + WHEN (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] END = [t2].[OneToOne_Optional_PK_Inverse3Id] LEFT JOIN ( SELECT [l8].[Id], [l8].[OneToOne_Required_PK_Date], [l8].[Level1_Optional_Id], [l8].[Level1_Required_Id], [l8].[Level2_Name], [l8].[OneToMany_Optional_Inverse2Id], [l8].[OneToMany_Required_Inverse2Id], [l8].[OneToOne_Optional_PK_Inverse2Id] FROM [Level1] AS [l8] INNER JOIN [Level1] AS [l9] ON [l8].[Id] = [l9].[Id] - WHERE ([l8].[OneToOne_Required_PK_Date] IS NOT NULL AND [l8].[Level1_Required_Id] IS NOT NULL) AND [l8].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l8].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l8].[Level1_Required_Id] IS NOT NULL)) AND ([l8].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t4] ON [l].[Id] = [t4].[OneToOne_Optional_PK_Inverse2Id] LEFT JOIN ( SELECT [l10].[Id], [l10].[Level2_Optional_Id], [l10].[Level2_Required_Id], [l10].[Level3_Name], [l10].[OneToMany_Optional_Inverse3Id], [l10].[OneToMany_Required_Inverse3Id], [l10].[OneToOne_Optional_PK_Inverse3Id] @@ -2913,11 +2913,11 @@ INNER JOIN ( SELECT [l11].[Id] FROM [Level1] AS [l11] INNER JOIN [Level1] AS [l12] ON [l11].[Id] = [l12].[Id] - WHERE ([l11].[OneToOne_Required_PK_Date] IS NOT NULL AND [l11].[Level1_Required_Id] IS NOT NULL) AND [l11].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l11].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l11].[Level1_Required_Id] IS NOT NULL)) AND ([l11].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t6] ON [l10].[Id] = [t6].[Id] - WHERE [l10].[Level2_Required_Id] IS NOT NULL AND [l10].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l10].[Level2_Required_Id] IS NOT NULL) AND ([l10].[OneToMany_Required_Inverse3Id] IS NOT NULL) ) AS [t5] ON CASE - WHEN ([t4].[OneToOne_Required_PK_Date] IS NOT NULL AND [t4].[Level1_Required_Id] IS NOT NULL) AND [t4].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t4].[Id] + WHEN (([t4].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t4].[Level1_Required_Id] IS NOT NULL)) AND ([t4].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t4].[Id] END = [t5].[Level2_Optional_Id] LEFT JOIN ( SELECT [l13].[Id], [l13].[Level3_Optional_Id], [l13].[Level3_Required_Id], [l13].[Level4_Name], [l13].[OneToMany_Optional_Inverse4Id], [l13].[OneToMany_Required_Inverse4Id], [l13].[OneToOne_Optional_PK_Inverse4Id] @@ -2929,13 +2929,13 @@ INNER JOIN ( SELECT [l15].[Id] FROM [Level1] AS [l15] INNER JOIN [Level1] AS [l16] ON [l15].[Id] = [l16].[Id] - WHERE ([l15].[OneToOne_Required_PK_Date] IS NOT NULL AND [l15].[Level1_Required_Id] IS NOT NULL) AND [l15].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l15].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l15].[Level1_Required_Id] IS NOT NULL)) AND ([l15].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t9] ON [l14].[Id] = [t9].[Id] - WHERE [l14].[Level2_Required_Id] IS NOT NULL AND [l14].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l14].[Level2_Required_Id] IS NOT NULL) AND ([l14].[OneToMany_Required_Inverse3Id] IS NOT NULL) ) AS [t8] ON [l13].[Id] = [t8].[Id] - WHERE [l13].[Level3_Required_Id] IS NOT NULL AND [l13].[OneToMany_Required_Inverse4Id] IS NOT NULL + WHERE ([l13].[Level3_Required_Id] IS NOT NULL) AND ([l13].[OneToMany_Required_Inverse4Id] IS NOT NULL) ) AS [t7] ON CASE - WHEN [t5].[Level2_Required_Id] IS NOT NULL AND [t5].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [t5].[Id] + WHEN ([t5].[Level2_Required_Id] IS NOT NULL) AND ([t5].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [t5].[Id] END = [t7].[Level3_Optional_Id] LEFT JOIN ( SELECT [l17].[Id], [l17].[Level3_Optional_Id], [l17].[Level3_Required_Id], [l17].[Level4_Name], [l17].[OneToMany_Optional_Inverse4Id], [l17].[OneToMany_Required_Inverse4Id], [l17].[OneToOne_Optional_PK_Inverse4Id] @@ -2947,13 +2947,13 @@ INNER JOIN ( SELECT [l19].[Id] FROM [Level1] AS [l19] INNER JOIN [Level1] AS [l20] ON [l19].[Id] = [l20].[Id] - WHERE ([l19].[OneToOne_Required_PK_Date] IS NOT NULL AND [l19].[Level1_Required_Id] IS NOT NULL) AND [l19].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l19].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l19].[Level1_Required_Id] IS NOT NULL)) AND ([l19].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t12] ON [l18].[Id] = [t12].[Id] - WHERE [l18].[Level2_Required_Id] IS NOT NULL AND [l18].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l18].[Level2_Required_Id] IS NOT NULL) AND ([l18].[OneToMany_Required_Inverse3Id] IS NOT NULL) ) AS [t11] ON [l17].[Id] = [t11].[Id] - WHERE [l17].[Level3_Required_Id] IS NOT NULL AND [l17].[OneToMany_Required_Inverse4Id] IS NOT NULL + WHERE ([l17].[Level3_Required_Id] IS NOT NULL) AND ([l17].[OneToMany_Required_Inverse4Id] IS NOT NULL) ) AS [t10] ON CASE - WHEN [t5].[Level2_Required_Id] IS NOT NULL AND [t5].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [t5].[Id] + WHEN ([t5].[Level2_Required_Id] IS NOT NULL) AND ([t5].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [t5].[Id] END = [t10].[OneToOne_Optional_PK_Inverse4Id] LEFT JOIN ( SELECT [l21].[Id], [l21].[Level2_Optional_Id], [l21].[Level2_Required_Id], [l21].[Level3_Name], [l21].[OneToMany_Optional_Inverse3Id], [l21].[OneToMany_Required_Inverse3Id], [l21].[OneToOne_Optional_PK_Inverse3Id] @@ -2962,11 +2962,11 @@ INNER JOIN ( SELECT [l22].[Id] FROM [Level1] AS [l22] INNER JOIN [Level1] AS [l23] ON [l22].[Id] = [l23].[Id] - WHERE ([l22].[OneToOne_Required_PK_Date] IS NOT NULL AND [l22].[Level1_Required_Id] IS NOT NULL) AND [l22].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l22].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l22].[Level1_Required_Id] IS NOT NULL)) AND ([l22].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t14] ON [l21].[Id] = [t14].[Id] - WHERE [l21].[Level2_Required_Id] IS NOT NULL AND [l21].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l21].[Level2_Required_Id] IS NOT NULL) AND ([l21].[OneToMany_Required_Inverse3Id] IS NOT NULL) ) AS [t13] ON CASE - WHEN ([t4].[OneToOne_Required_PK_Date] IS NOT NULL AND [t4].[Level1_Required_Id] IS NOT NULL) AND [t4].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t4].[Id] + WHEN (([t4].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t4].[Level1_Required_Id] IS NOT NULL)) AND ([t4].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t4].[Id] END = [t13].[OneToOne_Optional_PK_Inverse3Id]"); } @@ -2983,7 +2983,7 @@ LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[Level2_Name], [l0].[OneToMany_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id] FROM [Level1] AS [l0] INNER JOIN [Level1] AS [l1] ON [l0].[Id] = [l1].[Id] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL)) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t] ON [l].[Id] = [t].[Level1_Optional_Id] ) AS [t0] LEFT JOIN ( @@ -2993,11 +2993,11 @@ INNER JOIN ( SELECT [l3].[Id] FROM [Level1] AS [l3] INNER JOIN [Level1] AS [l4] ON [l3].[Id] = [l4].[Id] - WHERE ([l3].[OneToOne_Required_PK_Date] IS NOT NULL AND [l3].[Level1_Required_Id] IS NOT NULL) AND [l3].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l3].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l3].[Level1_Required_Id] IS NOT NULL)) AND ([l3].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t2] ON [l2].[Id] = [t2].[Id] - WHERE [l2].[Level2_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l2].[Level2_Required_Id] IS NOT NULL) AND ([l2].[OneToMany_Required_Inverse3Id] IS NOT NULL) ) AS [t1] ON CASE - WHEN ([t0].[OneToOne_Required_PK_Date] IS NOT NULL AND [t0].[Level1_Required_Id] IS NOT NULL) AND [t0].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t0].[Id] + WHEN (([t0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t0].[Level1_Required_Id] IS NOT NULL)) AND ([t0].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t0].[Id] END = [t1].[Level2_Optional_Id]"); } @@ -3027,16 +3027,16 @@ public override async Task Join_navigation_nested(bool async) AssertSql( @"SELECT CASE - WHEN [t0].[Level2_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [t0].[Id] + WHEN ([t0].[Level2_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [t0].[Id] END AS [Id3], [t2].[Id] AS [Id1] FROM [Level1] AS [l] LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Required_Id], [l0].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l0] INNER JOIN [Level1] AS [l1] ON [l0].[Id] = [l1].[Id] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL)) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t] ON [l].[Id] = CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + WHEN (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] END LEFT JOIN ( SELECT [l2].[Id], [l2].[Level2_Required_Id], [l2].[OneToMany_Required_Inverse3Id] @@ -3045,13 +3045,13 @@ INNER JOIN ( SELECT [l3].[Id] FROM [Level1] AS [l3] INNER JOIN [Level1] AS [l4] ON [l3].[Id] = [l4].[Id] - WHERE ([l3].[OneToOne_Required_PK_Date] IS NOT NULL AND [l3].[Level1_Required_Id] IS NOT NULL) AND [l3].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l3].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l3].[Level1_Required_Id] IS NOT NULL)) AND ([l3].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t1] ON [l2].[Id] = [t1].[Id] - WHERE [l2].[Level2_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l2].[Level2_Required_Id] IS NOT NULL) AND ([l2].[OneToMany_Required_Inverse3Id] IS NOT NULL) ) AS [t0] ON CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + WHEN (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] END = CASE - WHEN [t0].[Level2_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [t0].[Id] + WHEN ([t0].[Level2_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [t0].[Id] END INNER JOIN ( SELECT [l5].[Id], [t4].[Id] AS [Id1], [t4].[Level2_Required_Id], [t4].[OneToMany_Required_Inverse3Id] @@ -3060,7 +3060,7 @@ LEFT JOIN ( SELECT [l6].[Id], [l6].[OneToOne_Required_PK_Date], [l6].[Level1_Required_Id], [l6].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l6] INNER JOIN [Level1] AS [l7] ON [l6].[Id] = [l7].[Id] - WHERE ([l6].[OneToOne_Required_PK_Date] IS NOT NULL AND [l6].[Level1_Required_Id] IS NOT NULL) AND [l6].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l6].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l6].[Level1_Required_Id] IS NOT NULL)) AND ([l6].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t3] ON [l5].[Id] = [t3].[Level1_Required_Id] LEFT JOIN ( SELECT [l8].[Id], [l8].[Level2_Optional_Id], [l8].[Level2_Required_Id], [l8].[OneToMany_Required_Inverse3Id] @@ -3069,18 +3069,18 @@ INNER JOIN ( SELECT [l9].[Id] FROM [Level1] AS [l9] INNER JOIN [Level1] AS [l10] ON [l9].[Id] = [l10].[Id] - WHERE ([l9].[OneToOne_Required_PK_Date] IS NOT NULL AND [l9].[Level1_Required_Id] IS NOT NULL) AND [l9].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l9].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l9].[Level1_Required_Id] IS NOT NULL)) AND ([l9].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t5] ON [l8].[Id] = [t5].[Id] - WHERE [l8].[Level2_Required_Id] IS NOT NULL AND [l8].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l8].[Level2_Required_Id] IS NOT NULL) AND ([l8].[OneToMany_Required_Inverse3Id] IS NOT NULL) ) AS [t4] ON CASE - WHEN ([t3].[OneToOne_Required_PK_Date] IS NOT NULL AND [t3].[Level1_Required_Id] IS NOT NULL) AND [t3].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t3].[Id] + WHEN (([t3].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t3].[Level1_Required_Id] IS NOT NULL)) AND ([t3].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t3].[Id] END = [t4].[Level2_Optional_Id] ) AS [t2] ON CASE - WHEN [t0].[Level2_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [t0].[Id] + WHEN ([t0].[Level2_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [t0].[Id] END = CASE - WHEN [t2].[Level2_Required_Id] IS NOT NULL AND [t2].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [t2].[Id1] + WHEN ([t2].[Level2_Required_Id] IS NOT NULL) AND ([t2].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [t2].[Id1] END -WHERE (([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL) AND ([t0].[Level2_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse3Id] IS NOT NULL)"); +WHERE ((([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL)) AND (([t0].[Level2_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse3Id] IS NOT NULL))"); } public override async Task Projection_select_correct_table_from_subquery_when_materialization_is_not_required(bool async) @@ -3096,14 +3096,14 @@ LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Required_Id], [l0].[Level2_Name], [l0].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l0] INNER JOIN [Level1] AS [l1] ON [l0].[Id] = [l1].[Id] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL)) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t] ON [l].[Id] = CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + WHEN (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] END LEFT JOIN [Level1] AS [l2] ON [t].[Level1_Required_Id] = [l2].[Id] -WHERE (([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL) AND ([l2].[Name] = N'L1 03') +WHERE ((([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL)) AND ([l2].[Name] = N'L1 03') ORDER BY CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + WHEN (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] END"); } @@ -3120,9 +3120,9 @@ LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Required_Id], [l0].[Level2_Name], [l0].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l0] INNER JOIN [Level1] AS [l1] ON [l0].[Id] = [l1].[Id] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL)) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t] ON [l].[Id] = CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + WHEN (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] END INNER JOIN [Level1] AS [l2] ON [t].[Level1_Required_Id] = [l2].[Id] INNER JOIN ( @@ -3132,9 +3132,9 @@ LEFT JOIN ( SELECT [l4].[Id], [l4].[OneToOne_Required_PK_Date], [l4].[Level1_Required_Id], [l4].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l4] INNER JOIN [Level1] AS [l5] ON [l4].[Id] = [l5].[Id] - WHERE ([l4].[OneToOne_Required_PK_Date] IS NOT NULL AND [l4].[Level1_Required_Id] IS NOT NULL) AND [l4].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l4].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l4].[Level1_Required_Id] IS NOT NULL)) AND ([l4].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t0] ON [l3].[Id] = CASE - WHEN ([t0].[OneToOne_Required_PK_Date] IS NOT NULL AND [t0].[Level1_Required_Id] IS NOT NULL) AND [t0].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t0].[Id] + WHEN (([t0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t0].[Level1_Required_Id] IS NOT NULL)) AND ([t0].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t0].[Id] END LEFT JOIN ( SELECT [l6].[Id], [l6].[Level2_Required_Id], [l6].[Level3_Name], [l6].[OneToMany_Required_Inverse3Id] @@ -3143,17 +3143,17 @@ INNER JOIN ( SELECT [l7].[Id] FROM [Level1] AS [l7] INNER JOIN [Level1] AS [l8] ON [l7].[Id] = [l8].[Id] - WHERE ([l7].[OneToOne_Required_PK_Date] IS NOT NULL AND [l7].[Level1_Required_Id] IS NOT NULL) AND [l7].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l7].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l7].[Level1_Required_Id] IS NOT NULL)) AND ([l7].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t3] ON [l6].[Id] = [t3].[Id] - WHERE [l6].[Level2_Required_Id] IS NOT NULL AND [l6].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l6].[Level2_Required_Id] IS NOT NULL) AND ([l6].[OneToMany_Required_Inverse3Id] IS NOT NULL) ) AS [t1] ON CASE - WHEN ([t0].[OneToOne_Required_PK_Date] IS NOT NULL AND [t0].[Level1_Required_Id] IS NOT NULL) AND [t0].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t0].[Id] + WHEN (([t0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t0].[Level1_Required_Id] IS NOT NULL)) AND ([t0].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t0].[Id] END = CASE - WHEN [t1].[Level2_Required_Id] IS NOT NULL AND [t1].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [t1].[Id] + WHEN ([t1].[Level2_Required_Id] IS NOT NULL) AND ([t1].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [t1].[Id] END - WHERE (([t0].[OneToOne_Required_PK_Date] IS NOT NULL AND [t0].[Level1_Required_Id] IS NOT NULL) AND [t0].[OneToMany_Required_Inverse2Id] IS NOT NULL) AND ([t1].[Level2_Required_Id] IS NOT NULL AND [t1].[OneToMany_Required_Inverse3Id] IS NOT NULL) + WHERE ((([t0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t0].[Level1_Required_Id] IS NOT NULL)) AND ([t0].[OneToMany_Required_Inverse2Id] IS NOT NULL)) AND (([t1].[Level2_Required_Id] IS NOT NULL) AND ([t1].[OneToMany_Required_Inverse3Id] IS NOT NULL)) ) AS [t2] ON [l2].[Id] = [t2].[Level2_Required_Id] -WHERE ((([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL) AND ([l2].[Name] = N'L1 03')) AND ([t2].[Level3_Name] = N'L3 08') +WHERE (((([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL)) AND ([l2].[Name] = N'L1 03')) AND ([t2].[Level3_Name] = N'L3 08') ORDER BY [l2].[Id]"); } @@ -3168,13 +3168,13 @@ LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[Level2_Name], [l0].[OneToMany_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id] FROM [Level1] AS [l0] INNER JOIN [Level1] AS [l1] ON [l0].[Id] = [l1].[Id] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL)) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t] ON [l].[Id] = [t].[Level1_Optional_Id] LEFT JOIN ( SELECT [l2].[Id], [l2].[OneToOne_Required_PK_Date], [l2].[Level1_Optional_Id], [l2].[Level1_Required_Id], [l2].[Level2_Name], [l2].[OneToMany_Optional_Inverse2Id], [l2].[OneToMany_Required_Inverse2Id], [l2].[OneToOne_Optional_PK_Inverse2Id] FROM [Level1] AS [l2] INNER JOIN [Level1] AS [l3] ON [l2].[Id] = [l3].[Id] - WHERE ([l2].[OneToOne_Required_PK_Date] IS NOT NULL AND [l2].[Level1_Required_Id] IS NOT NULL) AND [l2].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l2].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l2].[Level1_Required_Id] IS NOT NULL)) AND ([l2].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t0] ON [l].[Id] = [t0].[OneToOne_Optional_PK_Inverse2Id] LEFT JOIN ( SELECT [l4].[Id], [l4].[Level2_Optional_Id], [l4].[Level2_Required_Id], [l4].[Level3_Name], [l4].[OneToMany_Optional_Inverse3Id], [l4].[OneToMany_Required_Inverse3Id], [l4].[OneToOne_Optional_PK_Inverse3Id] @@ -3183,11 +3183,11 @@ INNER JOIN ( SELECT [l5].[Id] FROM [Level1] AS [l5] INNER JOIN [Level1] AS [l6] ON [l5].[Id] = [l6].[Id] - WHERE ([l5].[OneToOne_Required_PK_Date] IS NOT NULL AND [l5].[Level1_Required_Id] IS NOT NULL) AND [l5].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l5].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l5].[Level1_Required_Id] IS NOT NULL)) AND ([l5].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t2] ON [l4].[Id] = [t2].[Id] - WHERE [l4].[Level2_Required_Id] IS NOT NULL AND [l4].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l4].[Level2_Required_Id] IS NOT NULL) AND ([l4].[OneToMany_Required_Inverse3Id] IS NOT NULL) ) AS [t1] ON CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + WHEN (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] END = [t1].[Level2_Optional_Id]"); } @@ -3202,12 +3202,12 @@ LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[Level2_Name], [l0].[OneToMany_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id] FROM [Level1] AS [l0] INNER JOIN [Level1] AS [l1] ON [l0].[Id] = [l1].[Id] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL)) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t] ON [l].[Id] = CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + WHEN (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] END LEFT JOIN [Level1] AS [l2] ON [t].[Level1_Required_Id] = [l2].[Id] -WHERE (([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL) AND ([l2].[Id] = 7)"); +WHERE ((([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL)) AND ([l2].[Id] = 7)"); } public override async Task Order_by_key_of_projected_navigation_doesnt_get_optimized_into_FK_access_subquery(bool async) @@ -3220,16 +3220,16 @@ public override async Task Order_by_key_of_projected_navigation_doesnt_get_optim SELECT [l7].[Name] FROM ( SELECT TOP(@__p_0) [t2].[Level1_Required_Id] AS [Level1_Required_Id0], CASE - WHEN ([t2].[OneToOne_Required_PK_Date] IS NOT NULL AND [t2].[Level1_Required_Id] IS NOT NULL) AND [t2].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t2].[Id] + WHEN (([t2].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t2].[Level1_Required_Id] IS NOT NULL)) AND ([t2].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t2].[Id] END AS [c] FROM [Level1] AS [l] LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Required_Id], [l0].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l0] INNER JOIN [Level1] AS [l1] ON [l0].[Id] = [l1].[Id] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL)) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t] ON [l].[Id] = CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + WHEN (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] END LEFT JOIN ( SELECT [l2].[Id], [l2].[Level2_Required_Id], [l2].[OneToMany_Required_Inverse3Id] @@ -3238,25 +3238,25 @@ INNER JOIN ( SELECT [l3].[Id] FROM [Level1] AS [l3] INNER JOIN [Level1] AS [l4] ON [l3].[Id] = [l4].[Id] - WHERE ([l3].[OneToOne_Required_PK_Date] IS NOT NULL AND [l3].[Level1_Required_Id] IS NOT NULL) AND [l3].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l3].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l3].[Level1_Required_Id] IS NOT NULL)) AND ([l3].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t1] ON [l2].[Id] = [t1].[Id] - WHERE [l2].[Level2_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l2].[Level2_Required_Id] IS NOT NULL) AND ([l2].[OneToMany_Required_Inverse3Id] IS NOT NULL) ) AS [t0] ON CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + WHEN (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] END = CASE - WHEN [t0].[Level2_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [t0].[Id] + WHEN ([t0].[Level2_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [t0].[Id] END LEFT JOIN ( SELECT [l5].[Id], [l5].[OneToOne_Required_PK_Date], [l5].[Level1_Required_Id], [l5].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l5] INNER JOIN [Level1] AS [l6] ON [l5].[Id] = [l6].[Id] - WHERE ([l5].[OneToOne_Required_PK_Date] IS NOT NULL AND [l5].[Level1_Required_Id] IS NOT NULL) AND [l5].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l5].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l5].[Level1_Required_Id] IS NOT NULL)) AND ([l5].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t2] ON [t0].[Level2_Required_Id] = CASE - WHEN ([t2].[OneToOne_Required_PK_Date] IS NOT NULL AND [t2].[Level1_Required_Id] IS NOT NULL) AND [t2].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t2].[Id] + WHEN (([t2].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t2].[Level1_Required_Id] IS NOT NULL)) AND ([t2].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t2].[Id] END - WHERE (([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL) AND ([t0].[Level2_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse3Id] IS NOT NULL) + WHERE ((([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL)) AND (([t0].[Level2_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse3Id] IS NOT NULL)) ORDER BY CASE - WHEN ([t2].[OneToOne_Required_PK_Date] IS NOT NULL AND [t2].[Level1_Required_Id] IS NOT NULL) AND [t2].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t2].[Id] + WHEN (([t2].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t2].[Level1_Required_Id] IS NOT NULL)) AND ([t2].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t2].[Id] END ) AS [t3] LEFT JOIN [Level1] AS [l7] ON [t3].[Level1_Required_Id0] = [l7].[Id] @@ -3269,7 +3269,7 @@ public override async Task Where_complex_predicate_with_with_nav_prop_and_OrElse AssertSql( @"SELECT [l].[Id] AS [Id1], CASE - WHEN ([t0].[OneToOne_Required_PK_Date] IS NOT NULL AND [t0].[Level1_Required_Id] IS NOT NULL) AND [t0].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t0].[Id] + WHEN (([t0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t0].[Level1_Required_Id] IS NOT NULL)) AND ([t0].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t0].[Id] END AS [Id2] FROM [Level1] AS [l] CROSS JOIN ( @@ -3279,20 +3279,20 @@ LEFT JOIN ( SELECT [l1].[Id], [l1].[OneToOne_Required_PK_Date], [l1].[Level1_Required_Id], [l1].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l1] INNER JOIN [Level1] AS [l2] ON [l1].[Id] = [l2].[Id] - WHERE ([l1].[OneToOne_Required_PK_Date] IS NOT NULL AND [l1].[Level1_Required_Id] IS NOT NULL) AND [l1].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l1].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l1].[Level1_Required_Id] IS NOT NULL)) AND ([l1].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t] ON [l0].[Id] = CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + WHEN (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] END - WHERE ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t0] LEFT JOIN ( SELECT [l3].[Level1_Optional_Id], [l3].[Level2_Name] FROM [Level1] AS [l3] INNER JOIN [Level1] AS [l4] ON [l3].[Id] = [l4].[Id] - WHERE ([l3].[OneToOne_Required_PK_Date] IS NOT NULL AND [l3].[Level1_Required_Id] IS NOT NULL) AND [l3].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l3].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l3].[Level1_Required_Id] IS NOT NULL)) AND ([l3].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t1] ON [l].[Id] = [t1].[Level1_Optional_Id] LEFT JOIN [Level1] AS [l5] ON [t0].[Level1_Required_Id] = [l5].[Id] -WHERE ([t1].[Level2_Name] = N'L2 01') OR (([l5].[Name] <> N'Bar') OR [l5].[Name] IS NULL)"); +WHERE ([t1].[Level2_Name] = N'L2 01') OR (([l5].[Name] <> N'Bar') OR ([l5].[Name] IS NULL))"); } public override async Task OrderBy_nav_prop_reference_optional(bool async) @@ -3306,7 +3306,7 @@ LEFT JOIN ( SELECT [l0].[Level1_Optional_Id], [l0].[Level2_Name] FROM [Level1] AS [l0] INNER JOIN [Level1] AS [l1] ON [l0].[Id] = [l1].[Id] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL)) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t] ON [l].[Id] = [t].[Level1_Optional_Id] ORDER BY [t].[Level2_Name], [l].[Id]"); } @@ -3328,13 +3328,13 @@ LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[Level2_Name], [l0].[OneToMany_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id] FROM [Level1] AS [l0] INNER JOIN [Level1] AS [l1] ON [l0].[Id] = [l1].[Id] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL)) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t0] ON [t].[Id] = [t0].[OneToOne_Optional_PK_Inverse2Id] LEFT JOIN ( SELECT [l2].[Id], [l2].[OneToOne_Required_PK_Date], [l2].[Level1_Optional_Id], [l2].[Level1_Required_Id], [l2].[Level2_Name], [l2].[OneToMany_Optional_Inverse2Id], [l2].[OneToMany_Required_Inverse2Id], [l2].[OneToOne_Optional_PK_Inverse2Id] FROM [Level1] AS [l2] INNER JOIN [Level1] AS [l3] ON [l2].[Id] = [l3].[Id] - WHERE ([l2].[OneToOne_Required_PK_Date] IS NOT NULL AND [l2].[Level1_Required_Id] IS NOT NULL) AND [l2].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l2].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l2].[Level1_Required_Id] IS NOT NULL)) AND ([l2].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t1] ON [t].[Id] = [t1].[Level1_Optional_Id] ORDER BY [t].[Id]"); } @@ -3361,13 +3361,13 @@ LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[Level2_Name], [l0].[OneToMany_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id] FROM [Level1] AS [l0] INNER JOIN [Level1] AS [l1] ON [l0].[Id] = [l1].[Id] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL)) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t] ON [l].[Id] = [t].[Level1_Optional_Id] LEFT JOIN ( SELECT [l2].[Id], [l2].[OneToOne_Required_PK_Date], [l2].[Level1_Optional_Id], [l2].[Level1_Required_Id], [l2].[Level2_Name], [l2].[OneToMany_Optional_Inverse2Id], [l2].[OneToMany_Required_Inverse2Id], [l2].[OneToOne_Optional_PK_Inverse2Id] FROM [Level1] AS [l2] INNER JOIN [Level1] AS [l3] ON [l2].[Id] = [l3].[Id] - WHERE ([l2].[OneToOne_Required_PK_Date] IS NOT NULL AND [l2].[Level1_Required_Id] IS NOT NULL) AND [l2].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l2].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l2].[Level1_Required_Id] IS NOT NULL)) AND ([l2].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t0] ON [l].[Id] = [t0].[OneToOne_Optional_PK_Inverse2Id]"); } @@ -3377,7 +3377,7 @@ public override async Task Join_navigation_key_access_optional(bool async) AssertSql( @"SELECT [l].[Id] AS [Id1], CASE - WHEN ([t0].[OneToOne_Required_PK_Date] IS NOT NULL AND [t0].[Level1_Required_Id] IS NOT NULL) AND [t0].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t0].[Id0] + WHEN (([t0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t0].[Level1_Required_Id] IS NOT NULL)) AND ([t0].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t0].[Id0] END AS [Id2] FROM [Level1] AS [l] INNER JOIN ( @@ -3387,12 +3387,12 @@ LEFT JOIN ( SELECT [l1].[Id], [l1].[OneToOne_Required_PK_Date], [l1].[Level1_Optional_Id], [l1].[Level1_Required_Id], [l1].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l1] INNER JOIN [Level1] AS [l3] ON [l1].[Id] = [l3].[Id] - WHERE ([l1].[OneToOne_Required_PK_Date] IS NOT NULL AND [l1].[Level1_Required_Id] IS NOT NULL) AND [l1].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l1].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l1].[Level1_Required_Id] IS NOT NULL)) AND ([l1].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t] ON [l0].[Id] = CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + WHEN (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] END LEFT JOIN [Level1] AS [l2] ON [t].[Level1_Optional_Id] = [l2].[Id] - WHERE ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t0] ON [l].[Id] = [t0].[Id1]"); } @@ -3407,9 +3407,9 @@ LEFT JOIN ( SELECT [l0].[Level1_Optional_Id], [l0].[Level2_Name] FROM [Level1] AS [l0] INNER JOIN [Level1] AS [l1] ON [l0].[Id] = [l1].[Id] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL)) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t] ON [l].[Id] = [t].[Level1_Optional_Id] -WHERE [t].[Level2_Name] IS NOT NULL AND ([t].[Level2_Name] LIKE N'L%')"); +WHERE ([t].[Level2_Name] IS NOT NULL) AND ([t].[Level2_Name] LIKE N'L%')"); } public override async Task Multi_level_navigation_with_same_navigation_compared_to_null(bool async) @@ -3418,16 +3418,16 @@ public override async Task Multi_level_navigation_with_same_navigation_compared_ AssertSql( @"SELECT CASE - WHEN [t0].[Level2_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [t0].[Id] + WHEN ([t0].[Level2_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [t0].[Id] END FROM [Level1] AS [l] LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Required_Id], [l0].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l0] INNER JOIN [Level1] AS [l1] ON [l0].[Id] = [l1].[Id] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL)) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t] ON [l].[Id] = CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + WHEN (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] END LEFT JOIN ( SELECT [l2].[Id], [l2].[Level2_Required_Id], [l2].[OneToMany_Optional_Inverse3Id], [l2].[OneToMany_Required_Inverse3Id] @@ -3436,24 +3436,24 @@ INNER JOIN ( SELECT [l3].[Id] FROM [Level1] AS [l3] INNER JOIN [Level1] AS [l4] ON [l3].[Id] = [l4].[Id] - WHERE ([l3].[OneToOne_Required_PK_Date] IS NOT NULL AND [l3].[Level1_Required_Id] IS NOT NULL) AND [l3].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l3].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l3].[Level1_Required_Id] IS NOT NULL)) AND ([l3].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t1] ON [l2].[Id] = [t1].[Id] - WHERE [l2].[Level2_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l2].[Level2_Required_Id] IS NOT NULL) AND ([l2].[OneToMany_Required_Inverse3Id] IS NOT NULL) ) AS [t0] ON CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + WHEN (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] END = CASE - WHEN [t0].[Level2_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [t0].[Id] + WHEN ([t0].[Level2_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [t0].[Id] END LEFT JOIN ( SELECT [l5].[Id], [l5].[OneToOne_Required_PK_Date], [l5].[Level1_Required_Id], [l5].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l5] INNER JOIN [Level1] AS [l6] ON [l5].[Id] = [l6].[Id] - WHERE ([l5].[OneToOne_Required_PK_Date] IS NOT NULL AND [l5].[Level1_Required_Id] IS NOT NULL) AND [l5].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l5].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l5].[Level1_Required_Id] IS NOT NULL)) AND ([l5].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t2] ON [t0].[OneToMany_Optional_Inverse3Id] = CASE - WHEN ([t2].[OneToOne_Required_PK_Date] IS NOT NULL AND [t2].[Level1_Required_Id] IS NOT NULL) AND [t2].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t2].[Id] + WHEN (([t2].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t2].[Level1_Required_Id] IS NOT NULL)) AND ([t2].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t2].[Id] END LEFT JOIN [Level1] AS [l7] ON [t2].[Level1_Required_Id] = [l7].[Id] -WHERE (((([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL) AND ([t0].[Level2_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse3Id] IS NOT NULL)) AND (([l7].[Name] <> N'L1 07') OR [l7].[Name] IS NULL)) AND [l7].[Id] IS NOT NULL"); +WHERE ((((([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL)) AND (([t0].[Level2_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse3Id] IS NOT NULL))) AND (([l7].[Name] <> N'L1 07') OR ([l7].[Name] IS NULL))) AND ([l7].[Id] IS NOT NULL)"); } public override async Task Multi_level_navigation_compared_to_null(bool async) @@ -3462,16 +3462,16 @@ public override async Task Multi_level_navigation_compared_to_null(bool async) AssertSql( @"SELECT CASE - WHEN [t0].[Level2_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [t0].[Id] + WHEN ([t0].[Level2_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [t0].[Id] END FROM [Level1] AS [l] LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Required_Id], [l0].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l0] INNER JOIN [Level1] AS [l1] ON [l0].[Id] = [l1].[Id] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL)) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t] ON [l].[Id] = CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + WHEN (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] END LEFT JOIN ( SELECT [l2].[Id], [l2].[Level2_Required_Id], [l2].[OneToMany_Optional_Inverse3Id], [l2].[OneToMany_Required_Inverse3Id] @@ -3480,24 +3480,24 @@ INNER JOIN ( SELECT [l3].[Id] FROM [Level1] AS [l3] INNER JOIN [Level1] AS [l4] ON [l3].[Id] = [l4].[Id] - WHERE ([l3].[OneToOne_Required_PK_Date] IS NOT NULL AND [l3].[Level1_Required_Id] IS NOT NULL) AND [l3].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l3].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l3].[Level1_Required_Id] IS NOT NULL)) AND ([l3].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t1] ON [l2].[Id] = [t1].[Id] - WHERE [l2].[Level2_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l2].[Level2_Required_Id] IS NOT NULL) AND ([l2].[OneToMany_Required_Inverse3Id] IS NOT NULL) ) AS [t0] ON CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + WHEN (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] END = CASE - WHEN [t0].[Level2_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [t0].[Id] + WHEN ([t0].[Level2_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [t0].[Id] END LEFT JOIN ( SELECT [l5].[Id], [l5].[OneToOne_Required_PK_Date], [l5].[Level1_Required_Id], [l5].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l5] INNER JOIN [Level1] AS [l6] ON [l5].[Id] = [l6].[Id] - WHERE ([l5].[OneToOne_Required_PK_Date] IS NOT NULL AND [l5].[Level1_Required_Id] IS NOT NULL) AND [l5].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l5].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l5].[Level1_Required_Id] IS NOT NULL)) AND ([l5].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t2] ON [t0].[OneToMany_Optional_Inverse3Id] = CASE - WHEN ([t2].[OneToOne_Required_PK_Date] IS NOT NULL AND [t2].[Level1_Required_Id] IS NOT NULL) AND [t2].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t2].[Id] + WHEN (([t2].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t2].[Level1_Required_Id] IS NOT NULL)) AND ([t2].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t2].[Id] END LEFT JOIN [Level1] AS [l7] ON [t2].[Level1_Required_Id] = [l7].[Id] -WHERE ((([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL) AND ([t0].[Level2_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse3Id] IS NOT NULL)) AND [l7].[Id] IS NOT NULL"); +WHERE (((([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL)) AND (([t0].[Level2_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse3Id] IS NOT NULL))) AND ([l7].[Id] IS NOT NULL)"); } public override async Task Where_multiple_nav_prop_reference_optional_compared_to_null1(bool async) @@ -3511,7 +3511,7 @@ LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l0] INNER JOIN [Level1] AS [l1] ON [l0].[Id] = [l1].[Id] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL)) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t] ON [l].[Id] = [t].[Level1_Optional_Id] LEFT JOIN ( SELECT [l2].[Level2_Optional_Id], [l2].[Level2_Required_Id], [l2].[OneToMany_Required_Inverse3Id] @@ -3520,13 +3520,13 @@ INNER JOIN ( SELECT [l3].[Id] FROM [Level1] AS [l3] INNER JOIN [Level1] AS [l4] ON [l3].[Id] = [l4].[Id] - WHERE ([l3].[OneToOne_Required_PK_Date] IS NOT NULL AND [l3].[Level1_Required_Id] IS NOT NULL) AND [l3].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l3].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l3].[Level1_Required_Id] IS NOT NULL)) AND ([l3].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t1] ON [l2].[Id] = [t1].[Id] - WHERE [l2].[Level2_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l2].[Level2_Required_Id] IS NOT NULL) AND ([l2].[OneToMany_Required_Inverse3Id] IS NOT NULL) ) AS [t0] ON CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + WHEN (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] END = [t0].[Level2_Optional_Id] -WHERE [t0].[Level2_Required_Id] IS NULL OR [t0].[OneToMany_Required_Inverse3Id] IS NULL"); +WHERE ([t0].[Level2_Required_Id] IS NULL) OR ([t0].[OneToMany_Required_Inverse3Id] IS NULL)"); } public override async Task Where_complex_predicate_with_with_nav_prop_and_OrElse3(bool async) @@ -3540,13 +3540,13 @@ LEFT JOIN ( SELECT [l0].[Level1_Optional_Id], [l0].[Level2_Name] FROM [Level1] AS [l0] INNER JOIN [Level1] AS [l1] ON [l0].[Id] = [l1].[Id] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL)) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t] ON [l].[Id] = [t].[Level1_Optional_Id] LEFT JOIN ( SELECT [l2].[Id], [l2].[OneToOne_Required_PK_Date], [l2].[Level1_Required_Id], [l2].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l2] INNER JOIN [Level1] AS [l3] ON [l2].[Id] = [l3].[Id] - WHERE ([l2].[OneToOne_Required_PK_Date] IS NOT NULL AND [l2].[Level1_Required_Id] IS NOT NULL) AND [l2].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l2].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l2].[Level1_Required_Id] IS NOT NULL)) AND ([l2].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t0] ON [l].[Id] = [t0].[Level1_Required_Id] LEFT JOIN ( SELECT [l4].[Level2_Optional_Id], [l4].[Level3_Name] @@ -3555,13 +3555,13 @@ INNER JOIN ( SELECT [l5].[Id] FROM [Level1] AS [l5] INNER JOIN [Level1] AS [l6] ON [l5].[Id] = [l6].[Id] - WHERE ([l5].[OneToOne_Required_PK_Date] IS NOT NULL AND [l5].[Level1_Required_Id] IS NOT NULL) AND [l5].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l5].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l5].[Level1_Required_Id] IS NOT NULL)) AND ([l5].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t2] ON [l4].[Id] = [t2].[Id] - WHERE [l4].[Level2_Required_Id] IS NOT NULL AND [l4].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l4].[Level2_Required_Id] IS NOT NULL) AND ([l4].[OneToMany_Required_Inverse3Id] IS NOT NULL) ) AS [t1] ON CASE - WHEN ([t0].[OneToOne_Required_PK_Date] IS NOT NULL AND [t0].[Level1_Required_Id] IS NOT NULL) AND [t0].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t0].[Id] + WHEN (([t0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t0].[Level1_Required_Id] IS NOT NULL)) AND ([t0].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t0].[Id] END = [t1].[Level2_Optional_Id] -WHERE (([t].[Level2_Name] <> N'L2 05') OR [t].[Level2_Name] IS NULL) OR ([t1].[Level3_Name] = N'L3 05')"); +WHERE (([t].[Level2_Name] <> N'L2 05') OR ([t].[Level2_Name] IS NULL)) OR ([t1].[Level3_Name] = N'L3 05')"); } public override async Task Include2(bool async) @@ -3575,7 +3575,7 @@ LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[Level2_Name], [l0].[OneToMany_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id] FROM [Level1] AS [l0] INNER JOIN [Level1] AS [l1] ON [l0].[Id] = [l1].[Id] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL)) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t] ON [l].[Id] = [t].[Level1_Optional_Id]"); } @@ -3585,16 +3585,16 @@ public override async Task Join_navigation_in_inner_selector(bool async) AssertSql( @"SELECT CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + WHEN (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] END AS [Id2], [t0].[Id] AS [Id1] FROM [Level1] AS [l] LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Required_Id], [l0].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l0] INNER JOIN [Level1] AS [l1] ON [l0].[Id] = [l1].[Id] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL)) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t] ON [l].[Id] = CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + WHEN (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] END INNER JOIN ( SELECT [l2].[Id], [t1].[Id] AS [Id0], [t1].[OneToOne_Required_PK_Date], [t1].[Level1_Required_Id], [t1].[OneToMany_Required_Inverse2Id] @@ -3603,14 +3603,14 @@ LEFT JOIN ( SELECT [l3].[Id], [l3].[OneToOne_Required_PK_Date], [l3].[Level1_Optional_Id], [l3].[Level1_Required_Id], [l3].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l3] INNER JOIN [Level1] AS [l4] ON [l3].[Id] = [l4].[Id] - WHERE ([l3].[OneToOne_Required_PK_Date] IS NOT NULL AND [l3].[Level1_Required_Id] IS NOT NULL) AND [l3].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l3].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l3].[Level1_Required_Id] IS NOT NULL)) AND ([l3].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t1] ON [l2].[Id] = [t1].[Level1_Optional_Id] ) AS [t0] ON CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + WHEN (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] END = CASE - WHEN ([t0].[OneToOne_Required_PK_Date] IS NOT NULL AND [t0].[Level1_Required_Id] IS NOT NULL) AND [t0].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t0].[Id0] + WHEN (([t0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t0].[Level1_Required_Id] IS NOT NULL)) AND ([t0].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t0].[Id0] END -WHERE ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL"); +WHERE (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL)"); } public override async Task Select_nav_prop_reference_optional1(bool async) @@ -3624,7 +3624,7 @@ LEFT JOIN ( SELECT [l0].[Level1_Optional_Id], [l0].[Level2_Name] FROM [Level1] AS [l0] INNER JOIN [Level1] AS [l1] ON [l0].[Id] = [l1].[Id] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL)) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t] ON [l].[Id] = [t].[Level1_Optional_Id]"); } @@ -3634,7 +3634,7 @@ public override async Task SelectMany_navigation_comparison3(bool async) AssertSql( @"SELECT [l].[Id] AS [Id1], CASE - WHEN ([t0].[OneToOne_Required_PK_Date] IS NOT NULL AND [t0].[Level1_Required_Id] IS NOT NULL) AND [t0].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t0].[Id] + WHEN (([t0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t0].[Level1_Required_Id] IS NOT NULL)) AND ([t0].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t0].[Id] END AS [Id2] FROM [Level1] AS [l] CROSS JOIN ( @@ -3644,27 +3644,27 @@ LEFT JOIN ( SELECT [l1].[Id], [l1].[OneToOne_Required_PK_Date], [l1].[Level1_Required_Id], [l1].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l1] INNER JOIN [Level1] AS [l2] ON [l1].[Id] = [l2].[Id] - WHERE ([l1].[OneToOne_Required_PK_Date] IS NOT NULL AND [l1].[Level1_Required_Id] IS NOT NULL) AND [l1].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l1].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l1].[Level1_Required_Id] IS NOT NULL)) AND ([l1].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t] ON [l0].[Id] = CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + WHEN (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] END - WHERE ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t0] LEFT JOIN ( SELECT [l3].[Id], [l3].[OneToOne_Required_PK_Date], [l3].[Level1_Optional_Id], [l3].[Level1_Required_Id], [l3].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l3] INNER JOIN [Level1] AS [l4] ON [l3].[Id] = [l4].[Id] - WHERE ([l3].[OneToOne_Required_PK_Date] IS NOT NULL AND [l3].[Level1_Required_Id] IS NOT NULL) AND [l3].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l3].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l3].[Level1_Required_Id] IS NOT NULL)) AND ([l3].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t1] ON [l].[Id] = [t1].[Level1_Optional_Id] WHERE (CASE - WHEN ([t1].[OneToOne_Required_PK_Date] IS NOT NULL AND [t1].[Level1_Required_Id] IS NOT NULL) AND [t1].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t1].[Id] + WHEN (([t1].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t1].[Level1_Required_Id] IS NOT NULL)) AND ([t1].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t1].[Id] END = CASE - WHEN ([t0].[OneToOne_Required_PK_Date] IS NOT NULL AND [t0].[Level1_Required_Id] IS NOT NULL) AND [t0].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t0].[Id] -END) OR (CASE - WHEN ([t1].[OneToOne_Required_PK_Date] IS NOT NULL AND [t1].[Level1_Required_Id] IS NOT NULL) AND [t1].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t1].[Id] -END IS NULL AND CASE - WHEN ([t0].[OneToOne_Required_PK_Date] IS NOT NULL AND [t0].[Level1_Required_Id] IS NOT NULL) AND [t0].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t0].[Id] -END IS NULL)"); + WHEN (([t0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t0].[Level1_Required_Id] IS NOT NULL)) AND ([t0].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t0].[Id] +END) OR ((CASE + WHEN (([t1].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t1].[Level1_Required_Id] IS NOT NULL)) AND ([t1].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t1].[Id] +END IS NULL) AND (CASE + WHEN (([t0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t0].[Level1_Required_Id] IS NOT NULL)) AND ([t0].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t0].[Id] +END IS NULL))"); } public override async Task Select_multiple_nav_prop_reference_required2(bool async) @@ -3678,9 +3678,9 @@ LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Required_Id], [l0].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l0] INNER JOIN [Level1] AS [l1] ON [l0].[Id] = [l1].[Id] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL)) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t] ON [l].[Id] = CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + WHEN (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] END LEFT JOIN ( SELECT [l2].[Id], [l2].[Level2_Required_Id], [l2].[OneToMany_Required_Inverse3Id] @@ -3689,24 +3689,24 @@ INNER JOIN ( SELECT [l3].[Id] FROM [Level1] AS [l3] INNER JOIN [Level1] AS [l4] ON [l3].[Id] = [l4].[Id] - WHERE ([l3].[OneToOne_Required_PK_Date] IS NOT NULL AND [l3].[Level1_Required_Id] IS NOT NULL) AND [l3].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l3].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l3].[Level1_Required_Id] IS NOT NULL)) AND ([l3].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t1] ON [l2].[Id] = [t1].[Id] - WHERE [l2].[Level2_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l2].[Level2_Required_Id] IS NOT NULL) AND ([l2].[OneToMany_Required_Inverse3Id] IS NOT NULL) ) AS [t0] ON CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + WHEN (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] END = CASE - WHEN [t0].[Level2_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [t0].[Id] + WHEN ([t0].[Level2_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [t0].[Id] END LEFT JOIN ( SELECT [l5].[Id], [l5].[OneToOne_Required_PK_Date], [l5].[Level1_Required_Id], [l5].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l5] INNER JOIN [Level1] AS [l6] ON [l5].[Id] = [l6].[Id] - WHERE ([l5].[OneToOne_Required_PK_Date] IS NOT NULL AND [l5].[Level1_Required_Id] IS NOT NULL) AND [l5].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l5].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l5].[Level1_Required_Id] IS NOT NULL)) AND ([l5].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t2] ON [t0].[Level2_Required_Id] = CASE - WHEN ([t2].[OneToOne_Required_PK_Date] IS NOT NULL AND [t2].[Level1_Required_Id] IS NOT NULL) AND [t2].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t2].[Id] + WHEN (([t2].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t2].[Level1_Required_Id] IS NOT NULL)) AND ([t2].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t2].[Id] END LEFT JOIN [Level1] AS [l7] ON [t2].[Level1_Required_Id] = [l7].[Id] -WHERE (([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL) AND ([t0].[Level2_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse3Id] IS NOT NULL)"); +WHERE ((([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL)) AND (([t0].[Level2_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse3Id] IS NOT NULL))"); } public override async Task Include12(bool async) @@ -3720,7 +3720,7 @@ LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[Level2_Name], [l0].[OneToMany_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id] FROM [Level1] AS [l0] INNER JOIN [Level1] AS [l1] ON [l0].[Id] = [l1].[Id] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL)) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t] ON [l].[Id] = [t].[Level1_Optional_Id] LEFT JOIN ( SELECT [l2].[Id], [l2].[Level2_Optional_Id], [l2].[Level2_Required_Id], [l2].[Level3_Name], [l2].[OneToMany_Optional_Inverse3Id], [l2].[OneToMany_Required_Inverse3Id], [l2].[OneToOne_Optional_PK_Inverse3Id] @@ -3729,11 +3729,11 @@ INNER JOIN ( SELECT [l3].[Id] FROM [Level1] AS [l3] INNER JOIN [Level1] AS [l4] ON [l3].[Id] = [l4].[Id] - WHERE ([l3].[OneToOne_Required_PK_Date] IS NOT NULL AND [l3].[Level1_Required_Id] IS NOT NULL) AND [l3].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l3].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l3].[Level1_Required_Id] IS NOT NULL)) AND ([l3].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t1] ON [l2].[Id] = [t1].[Id] - WHERE [l2].[Level2_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l2].[Level2_Required_Id] IS NOT NULL) AND ([l2].[OneToMany_Required_Inverse3Id] IS NOT NULL) ) AS [t0] ON CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + WHEN (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] END = [t0].[Level2_Optional_Id]"); } @@ -3743,14 +3743,14 @@ public override async Task Join_navigation_in_outer_selector_translated_to_extra AssertSql( @"SELECT [l].[Id] AS [Id1], CASE - WHEN ([t0].[OneToOne_Required_PK_Date] IS NOT NULL AND [t0].[Level1_Required_Id] IS NOT NULL) AND [t0].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t0].[Id0] + WHEN (([t0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t0].[Level1_Required_Id] IS NOT NULL)) AND ([t0].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t0].[Id0] END AS [Id2] FROM [Level1] AS [l] LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l0] INNER JOIN [Level1] AS [l1] ON [l0].[Id] = [l1].[Id] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL)) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t] ON [l].[Id] = [t].[Level1_Optional_Id] INNER JOIN ( SELECT [t1].[Id] AS [Id0], [t1].[OneToOne_Required_PK_Date], [t1].[Level1_Required_Id], [t1].[OneToMany_Required_Inverse2Id] @@ -3759,15 +3759,15 @@ LEFT JOIN ( SELECT [l3].[Id], [l3].[OneToOne_Required_PK_Date], [l3].[Level1_Required_Id], [l3].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l3] INNER JOIN [Level1] AS [l4] ON [l3].[Id] = [l4].[Id] - WHERE ([l3].[OneToOne_Required_PK_Date] IS NOT NULL AND [l3].[Level1_Required_Id] IS NOT NULL) AND [l3].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l3].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l3].[Level1_Required_Id] IS NOT NULL)) AND ([l3].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t1] ON [l2].[Id] = CASE - WHEN ([t1].[OneToOne_Required_PK_Date] IS NOT NULL AND [t1].[Level1_Required_Id] IS NOT NULL) AND [t1].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t1].[Id] + WHEN (([t1].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t1].[Level1_Required_Id] IS NOT NULL)) AND ([t1].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t1].[Id] END - WHERE ([t1].[OneToOne_Required_PK_Date] IS NOT NULL AND [t1].[Level1_Required_Id] IS NOT NULL) AND [t1].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([t1].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t1].[Level1_Required_Id] IS NOT NULL)) AND ([t1].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t0] ON CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + WHEN (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] END = CASE - WHEN ([t0].[OneToOne_Required_PK_Date] IS NOT NULL AND [t0].[Level1_Required_Id] IS NOT NULL) AND [t0].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t0].[Id0] + WHEN (([t0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t0].[Level1_Required_Id] IS NOT NULL)) AND ([t0].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t0].[Id0] END"); } @@ -3782,7 +3782,7 @@ LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l0] INNER JOIN [Level1] AS [l1] ON [l0].[Id] = [l1].[Id] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL)) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t] ON [l].[Id] = [t].[Level1_Optional_Id] LEFT JOIN ( SELECT [l2].[Level2_Optional_Id], [l2].[Level3_Name] @@ -3791,13 +3791,13 @@ INNER JOIN ( SELECT [l3].[Id] FROM [Level1] AS [l3] INNER JOIN [Level1] AS [l4] ON [l3].[Id] = [l4].[Id] - WHERE ([l3].[OneToOne_Required_PK_Date] IS NOT NULL AND [l3].[Level1_Required_Id] IS NOT NULL) AND [l3].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l3].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l3].[Level1_Required_Id] IS NOT NULL)) AND ([l3].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t1] ON [l2].[Id] = [t1].[Id] - WHERE [l2].[Level2_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l2].[Level2_Required_Id] IS NOT NULL) AND ([l2].[OneToMany_Required_Inverse3Id] IS NOT NULL) ) AS [t0] ON CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + WHEN (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] END = [t0].[Level2_Optional_Id] -WHERE ([t0].[Level3_Name] <> N'L3 05') OR [t0].[Level3_Name] IS NULL"); +WHERE ([t0].[Level3_Name] <> N'L3 05') OR ([t0].[Level3_Name] IS NULL)"); } public override async Task Result_operator_nav_prop_reference_optional_Sum(bool async) @@ -3811,7 +3811,7 @@ LEFT JOIN ( SELECT [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id] FROM [Level1] AS [l0] INNER JOIN [Level1] AS [l1] ON [l0].[Id] = [l1].[Id] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL)) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t] ON [l].[Id] = [t].[Level1_Optional_Id]"); } @@ -3826,10 +3826,10 @@ LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Required_Id], [l0].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l0] INNER JOIN [Level1] AS [l1] ON [l0].[Id] = [l1].[Id] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL)) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t] ON [l].[Id] = [t].[Level1_Required_Id] WHERE CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + WHEN (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] END = 7"); } @@ -3851,13 +3851,13 @@ LEFT JOIN ( SELECT [l1].[Id], [l1].[OneToOne_Required_PK_Date], [l1].[Level1_Optional_Id], [l1].[Level1_Required_Id], [l1].[Level2_Name], [l1].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l1] INNER JOIN [Level1] AS [l2] ON [l1].[Id] = [l2].[Id] - WHERE ([l1].[OneToOne_Required_PK_Date] IS NOT NULL AND [l1].[Level1_Required_Id] IS NOT NULL) AND [l1].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l1].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l1].[Level1_Required_Id] IS NOT NULL)) AND ([l1].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t] ON [l0].[Id] = CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + WHEN (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] END - WHERE ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t0] ON [l].[Id] = [t0].[Level1_Optional_Id] - WHERE ([t0].[Level2_Name] <> N'Foo') OR [t0].[Level2_Name] IS NULL + WHERE ([t0].[Level2_Name] <> N'Foo') OR ([t0].[Level2_Name] IS NULL) ) AS [t1] ORDER BY [t1].[Id]"); } @@ -3873,7 +3873,7 @@ INNER JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[Level2_Name], [l0].[OneToMany_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id] FROM [Level1] AS [l0] INNER JOIN [Level1] AS [l1] ON [l0].[Id] = [l1].[Id] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL)) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t] ON [l].[Id] = [t].[OneToMany_Optional_Inverse2Id] LEFT JOIN ( SELECT [l2].[Id], [l2].[Level2_Optional_Id], [l2].[Level2_Required_Id], [l2].[Level3_Name], [l2].[OneToMany_Optional_Inverse3Id], [l2].[OneToMany_Required_Inverse3Id], [l2].[OneToOne_Optional_PK_Inverse3Id] @@ -3882,11 +3882,11 @@ INNER JOIN ( SELECT [l3].[Id] FROM [Level1] AS [l3] INNER JOIN [Level1] AS [l4] ON [l3].[Id] = [l4].[Id] - WHERE ([l3].[OneToOne_Required_PK_Date] IS NOT NULL AND [l3].[Level1_Required_Id] IS NOT NULL) AND [l3].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l3].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l3].[Level1_Required_Id] IS NOT NULL)) AND ([l3].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t1] ON [l2].[Id] = [t1].[Id] - WHERE [l2].[Level2_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l2].[Level2_Required_Id] IS NOT NULL) AND ([l2].[OneToMany_Required_Inverse3Id] IS NOT NULL) ) AS [t0] ON CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + WHEN (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] END = [t0].[Level2_Required_Id]"); } @@ -3901,7 +3901,7 @@ LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Required_Id], [l0].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l0] INNER JOIN [Level1] AS [l1] ON [l0].[Id] = [l1].[Id] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL)) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t] ON [l].[Id] = [t].[Level1_Required_Id] INNER JOIN ( SELECT [l2].[Id], [l2].[Level2_Optional_Id], [l2].[Level2_Required_Id], [l2].[Level3_Name], [l2].[OneToMany_Optional_Inverse3Id], [l2].[OneToMany_Required_Inverse3Id], [l2].[OneToOne_Optional_PK_Inverse3Id] @@ -3910,11 +3910,11 @@ INNER JOIN ( SELECT [l3].[Id] FROM [Level1] AS [l3] INNER JOIN [Level1] AS [l4] ON [l3].[Id] = [l4].[Id] - WHERE ([l3].[OneToOne_Required_PK_Date] IS NOT NULL AND [l3].[Level1_Required_Id] IS NOT NULL) AND [l3].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l3].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l3].[Level1_Required_Id] IS NOT NULL)) AND ([l3].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t1] ON [l2].[Id] = [t1].[Id] - WHERE [l2].[Level2_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l2].[Level2_Required_Id] IS NOT NULL) AND ([l2].[OneToMany_Required_Inverse3Id] IS NOT NULL) ) AS [t0] ON CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + WHEN (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] END = [t0].[OneToMany_Optional_Inverse3Id]"); } @@ -3929,10 +3929,10 @@ LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Required_Id], [l0].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l0] INNER JOIN [Level1] AS [l1] ON [l0].[Id] = [l1].[Id] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL)) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t] ON [l].[Id] = [t].[Level1_Required_Id] WHERE CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + WHEN (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] END > 7"); } @@ -3947,7 +3947,7 @@ LEFT JOIN ( SELECT [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id] FROM [Level1] AS [l0] INNER JOIN [Level1] AS [l1] ON [l0].[Id] = [l1].[Id] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL)) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t] ON [l].[Id] = [t].[Level1_Optional_Id] WHERE DATEADD(day, CAST(10.0E0 AS int), [t].[OneToOne_Required_PK_Date]) > '2000-02-01T00:00:00.0000000'"); } @@ -3963,7 +3963,7 @@ LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[Level2_Name], [l0].[OneToMany_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id] FROM [Level1] AS [l0] INNER JOIN [Level1] AS [l1] ON [l0].[Id] = [l1].[Id] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL)) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t] ON [l].[Id] = [t].[Level1_Optional_Id] LEFT JOIN ( SELECT [l2].[Id], [l2].[Level2_Optional_Id], [l2].[Level2_Required_Id], [l2].[Level3_Name], [l2].[OneToMany_Optional_Inverse3Id], [l2].[OneToMany_Required_Inverse3Id], [l2].[OneToOne_Optional_PK_Inverse3Id] @@ -3972,11 +3972,11 @@ INNER JOIN ( SELECT [l3].[Id] FROM [Level1] AS [l3] INNER JOIN [Level1] AS [l4] ON [l3].[Id] = [l4].[Id] - WHERE ([l3].[OneToOne_Required_PK_Date] IS NOT NULL AND [l3].[Level1_Required_Id] IS NOT NULL) AND [l3].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l3].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l3].[Level1_Required_Id] IS NOT NULL)) AND ([l3].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t1] ON [l2].[Id] = [t1].[Id] - WHERE [l2].[Level2_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l2].[Level2_Required_Id] IS NOT NULL) AND ([l2].[OneToMany_Required_Inverse3Id] IS NOT NULL) ) AS [t0] ON CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + WHEN (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] END = [t0].[OneToOne_Optional_PK_Inverse3Id]"); } @@ -3994,13 +3994,13 @@ LEFT JOIN ( SELECT [l1].[Id], [l1].[OneToOne_Required_PK_Date], [l1].[Level1_Optional_Id], [l1].[Level1_Required_Id], [l1].[Level2_Name], [l1].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l1] INNER JOIN [Level1] AS [l2] ON [l1].[Id] = [l2].[Id] - WHERE ([l1].[OneToOne_Required_PK_Date] IS NOT NULL AND [l1].[Level1_Required_Id] IS NOT NULL) AND [l1].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l1].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l1].[Level1_Required_Id] IS NOT NULL)) AND ([l1].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t] ON [l0].[Id] = CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + WHEN (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] END - WHERE ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t0] ON [l].[Id] = [t0].[Level1_Optional_Id] -WHERE ([t0].[Level2_Name] <> N'Foo') OR [t0].[Level2_Name] IS NULL"); +WHERE ([t0].[Level2_Name] <> N'Foo') OR ([t0].[Level2_Name] IS NULL)"); } public override async Task Include18_1_1(bool async) @@ -4018,7 +4018,7 @@ LEFT JOIN ( SELECT [l0].[Level1_Required_Id], [l0].[Level2_Name] FROM [Level1] AS [l0] INNER JOIN [Level1] AS [l1] ON [l0].[Id] = [l1].[Id] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL)) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t] ON [l].[Id] = [t].[Level1_Required_Id] ORDER BY [t].[Level2_Name] ) AS [t0] @@ -4026,7 +4026,7 @@ LEFT JOIN ( SELECT [l2].[Id], [l2].[OneToOne_Required_PK_Date], [l2].[Level1_Optional_Id], [l2].[Level1_Required_Id], [l2].[Level2_Name], [l2].[OneToMany_Optional_Inverse2Id], [l2].[OneToMany_Required_Inverse2Id], [l2].[OneToOne_Optional_PK_Inverse2Id] FROM [Level1] AS [l2] INNER JOIN [Level1] AS [l3] ON [l2].[Id] = [l3].[Id] - WHERE ([l2].[OneToOne_Required_PK_Date] IS NOT NULL AND [l2].[Level1_Required_Id] IS NOT NULL) AND [l2].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l2].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l2].[Level1_Required_Id] IS NOT NULL)) AND ([l2].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t1] ON [t0].[Id] = [t1].[Level1_Optional_Id] ORDER BY [t0].[Level2_Name]"); } @@ -4037,17 +4037,17 @@ public override async Task Optional_navigation_projected_into_DTO(bool async) AssertSql( @"SELECT [l].[Id], [l].[Name], CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN CAST(1 AS bit) + WHEN (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN CAST(1 AS bit) ELSE CAST(0 AS bit) END, CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + WHEN (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] END, [t].[Level2_Name] FROM [Level1] AS [l] LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[Level2_Name], [l0].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l0] INNER JOIN [Level1] AS [l1] ON [l0].[Id] = [l1].[Id] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL)) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t] ON [l].[Id] = [t].[Level1_Optional_Id]"); } @@ -4057,16 +4057,16 @@ public override async Task Join_navigation_nested2(bool async) AssertSql( @"SELECT CASE - WHEN [t0].[Level2_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [t0].[Id] + WHEN ([t0].[Level2_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [t0].[Id] END AS [Id3], [t2].[Id] AS [Id1] FROM [Level1] AS [l] LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Required_Id], [l0].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l0] INNER JOIN [Level1] AS [l1] ON [l0].[Id] = [l1].[Id] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL)) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t] ON [l].[Id] = CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + WHEN (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] END LEFT JOIN ( SELECT [l2].[Id], [l2].[Level2_Required_Id], [l2].[OneToMany_Required_Inverse3Id] @@ -4075,13 +4075,13 @@ INNER JOIN ( SELECT [l3].[Id] FROM [Level1] AS [l3] INNER JOIN [Level1] AS [l4] ON [l3].[Id] = [l4].[Id] - WHERE ([l3].[OneToOne_Required_PK_Date] IS NOT NULL AND [l3].[Level1_Required_Id] IS NOT NULL) AND [l3].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l3].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l3].[Level1_Required_Id] IS NOT NULL)) AND ([l3].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t1] ON [l2].[Id] = [t1].[Id] - WHERE [l2].[Level2_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l2].[Level2_Required_Id] IS NOT NULL) AND ([l2].[OneToMany_Required_Inverse3Id] IS NOT NULL) ) AS [t0] ON CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + WHEN (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] END = CASE - WHEN [t0].[Level2_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [t0].[Id] + WHEN ([t0].[Level2_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [t0].[Id] END INNER JOIN ( SELECT [l5].[Id], [t4].[Id] AS [Id1], [t4].[Level2_Required_Id], [t4].[OneToMany_Required_Inverse3Id] @@ -4090,7 +4090,7 @@ LEFT JOIN ( SELECT [l6].[Id], [l6].[OneToOne_Required_PK_Date], [l6].[Level1_Required_Id], [l6].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l6] INNER JOIN [Level1] AS [l7] ON [l6].[Id] = [l7].[Id] - WHERE ([l6].[OneToOne_Required_PK_Date] IS NOT NULL AND [l6].[Level1_Required_Id] IS NOT NULL) AND [l6].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l6].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l6].[Level1_Required_Id] IS NOT NULL)) AND ([l6].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t3] ON [l5].[Id] = [t3].[Level1_Required_Id] LEFT JOIN ( SELECT [l8].[Id], [l8].[Level2_Optional_Id], [l8].[Level2_Required_Id], [l8].[OneToMany_Required_Inverse3Id] @@ -4099,18 +4099,18 @@ INNER JOIN ( SELECT [l9].[Id] FROM [Level1] AS [l9] INNER JOIN [Level1] AS [l10] ON [l9].[Id] = [l10].[Id] - WHERE ([l9].[OneToOne_Required_PK_Date] IS NOT NULL AND [l9].[Level1_Required_Id] IS NOT NULL) AND [l9].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l9].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l9].[Level1_Required_Id] IS NOT NULL)) AND ([l9].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t5] ON [l8].[Id] = [t5].[Id] - WHERE [l8].[Level2_Required_Id] IS NOT NULL AND [l8].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l8].[Level2_Required_Id] IS NOT NULL) AND ([l8].[OneToMany_Required_Inverse3Id] IS NOT NULL) ) AS [t4] ON CASE - WHEN ([t3].[OneToOne_Required_PK_Date] IS NOT NULL AND [t3].[Level1_Required_Id] IS NOT NULL) AND [t3].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t3].[Id] + WHEN (([t3].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t3].[Level1_Required_Id] IS NOT NULL)) AND ([t3].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t3].[Id] END = [t4].[Level2_Optional_Id] ) AS [t2] ON CASE - WHEN [t0].[Level2_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [t0].[Id] + WHEN ([t0].[Level2_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [t0].[Id] END = CASE - WHEN [t2].[Level2_Required_Id] IS NOT NULL AND [t2].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [t2].[Id1] + WHEN ([t2].[Level2_Required_Id] IS NOT NULL) AND ([t2].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [t2].[Id1] END -WHERE (([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL) AND ([t0].[Level2_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse3Id] IS NOT NULL)"); +WHERE ((([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL)) AND (([t0].[Level2_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse3Id] IS NOT NULL))"); } public override async Task Key_equality_using_property_method_and_member_expression1(bool async) @@ -4124,10 +4124,10 @@ LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Required_Id], [l0].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l0] INNER JOIN [Level1] AS [l1] ON [l0].[Id] = [l1].[Id] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL)) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t] ON [l].[Id] = [t].[Level1_Required_Id] WHERE CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + WHEN (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] END = 7"); } @@ -4137,19 +4137,19 @@ public override async Task Navigation_key_access_optional_comparison(bool async) AssertSql( @"SELECT CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + WHEN (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] END FROM [Level1] AS [l] LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Required_Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id] FROM [Level1] AS [l0] INNER JOIN [Level1] AS [l1] ON [l0].[Id] = [l1].[Id] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL)) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t] ON [l].[Id] = CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + WHEN (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] END LEFT JOIN [Level1] AS [l2] ON [t].[OneToOne_Optional_PK_Inverse2Id] = [l2].[Id] -WHERE (([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL) AND ([l2].[Id] > 5)"); +WHERE ((([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL)) AND ([l2].[Id] > 5)"); } public override async Task SelectMany_navigation_property(bool async) @@ -4163,7 +4163,7 @@ INNER JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[Level2_Name], [l0].[OneToMany_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id] FROM [Level1] AS [l0] INNER JOIN [Level1] AS [l1] ON [l0].[Id] = [l1].[Id] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL)) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t] ON [l].[Id] = [t].[OneToMany_Optional_Inverse2Id]"); } @@ -4173,16 +4173,16 @@ public override async Task Join_with_orderby_on_inner_sequence_navigation_non_ke AssertSql( @"SELECT CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + WHEN (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] END AS [Id2], [t].[Level2_Name] AS [Name2], [t0].[Id] AS [Id1], [t0].[Name] AS [Name1] FROM [Level1] AS [l] LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Required_Id], [l0].[Level2_Name], [l0].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l0] INNER JOIN [Level1] AS [l1] ON [l0].[Id] = [l1].[Id] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL)) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t] ON [l].[Id] = CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + WHEN (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] END INNER JOIN ( SELECT [l2].[Id], [l2].[Name], [t1].[Level2_Name] @@ -4191,10 +4191,10 @@ LEFT JOIN ( SELECT [l3].[Level1_Optional_Id], [l3].[Level2_Name] FROM [Level1] AS [l3] INNER JOIN [Level1] AS [l4] ON [l3].[Id] = [l4].[Id] - WHERE ([l3].[OneToOne_Required_PK_Date] IS NOT NULL AND [l3].[Level1_Required_Id] IS NOT NULL) AND [l3].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l3].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l3].[Level1_Required_Id] IS NOT NULL)) AND ([l3].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t1] ON [l2].[Id] = [t1].[Level1_Optional_Id] ) AS [t0] ON [t].[Level2_Name] = [t0].[Level2_Name] -WHERE ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL"); +WHERE (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL)"); } public override async Task Correlated_subquery_doesnt_project_unnecessary_columns_in_top_level_join(bool async) @@ -4203,7 +4203,7 @@ public override async Task Correlated_subquery_doesnt_project_unnecessary_column AssertSql( @"SELECT [l].[Name] AS [Name1], CASE - WHEN ([t0].[OneToOne_Required_PK_Date] IS NOT NULL AND [t0].[Level1_Required_Id] IS NOT NULL) AND [t0].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t0].[Id0] + WHEN (([t0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t0].[Level1_Required_Id] IS NOT NULL)) AND ([t0].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t0].[Id0] END AS [Id2] FROM [Level1] AS [l] INNER JOIN ( @@ -4213,12 +4213,12 @@ LEFT JOIN ( SELECT [l1].[Id], [l1].[OneToOne_Required_PK_Date], [l1].[Level1_Optional_Id], [l1].[Level1_Required_Id], [l1].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l1] INNER JOIN [Level1] AS [l3] ON [l1].[Id] = [l3].[Id] - WHERE ([l1].[OneToOne_Required_PK_Date] IS NOT NULL AND [l1].[Level1_Required_Id] IS NOT NULL) AND [l1].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l1].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l1].[Level1_Required_Id] IS NOT NULL)) AND ([l1].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t] ON [l0].[Id] = CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + WHEN (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] END LEFT JOIN [Level1] AS [l2] ON [t].[Level1_Optional_Id] = [l2].[Id] - WHERE ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t0] ON [l].[Id] = [t0].[Id1] WHERE EXISTS ( SELECT 1 @@ -4227,11 +4227,11 @@ LEFT JOIN ( SELECT [l5].[Id], [l5].[OneToOne_Required_PK_Date], [l5].[Level1_Optional_Id], [l5].[Level1_Required_Id], [l5].[Level2_Name], [l5].[OneToMany_Optional_Inverse2Id], [l5].[OneToMany_Required_Inverse2Id], [l5].[OneToOne_Optional_PK_Inverse2Id], [l6].[Id] AS [Id0] FROM [Level1] AS [l5] INNER JOIN [Level1] AS [l6] ON [l5].[Id] = [l6].[Id] - WHERE ([l5].[OneToOne_Required_PK_Date] IS NOT NULL AND [l5].[Level1_Required_Id] IS NOT NULL) AND [l5].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l5].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l5].[Level1_Required_Id] IS NOT NULL)) AND ([l5].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t1] ON [l4].[Id] = CASE - WHEN ([t1].[OneToOne_Required_PK_Date] IS NOT NULL AND [t1].[Level1_Required_Id] IS NOT NULL) AND [t1].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t1].[Id] + WHEN (([t1].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t1].[Level1_Required_Id] IS NOT NULL)) AND ([t1].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t1].[Id] END - WHERE (([t1].[OneToOne_Required_PK_Date] IS NOT NULL AND [t1].[Level1_Required_Id] IS NOT NULL) AND [t1].[OneToMany_Required_Inverse2Id] IS NOT NULL) AND ([t1].[Level1_Required_Id] = [l].[Id]))"); + WHERE ((([t1].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t1].[Level1_Required_Id] IS NOT NULL)) AND ([t1].[OneToMany_Required_Inverse2Id] IS NOT NULL)) AND ([t1].[Level1_Required_Id] = [l].[Id]))"); } public override async Task SelectMany_navigation_property_and_projection(bool async) @@ -4245,7 +4245,7 @@ INNER JOIN ( SELECT [l0].[Level2_Name], [l0].[OneToMany_Optional_Inverse2Id] FROM [Level1] AS [l0] INNER JOIN [Level1] AS [l1] ON [l0].[Id] = [l1].[Id] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL)) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t] ON [l].[Id] = [t].[OneToMany_Optional_Inverse2Id]"); } @@ -4260,9 +4260,9 @@ LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Required_Id], [l0].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l0] INNER JOIN [Level1] AS [l1] ON [l0].[Id] = [l1].[Id] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL)) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t] ON [l].[Id] = CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + WHEN (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] END LEFT JOIN ( SELECT [l2].[Id], [l2].[Level2_Required_Id], [l2].[OneToMany_Required_Inverse3Id] @@ -4271,26 +4271,26 @@ INNER JOIN ( SELECT [l3].[Id] FROM [Level1] AS [l3] INNER JOIN [Level1] AS [l4] ON [l3].[Id] = [l4].[Id] - WHERE ([l3].[OneToOne_Required_PK_Date] IS NOT NULL AND [l3].[Level1_Required_Id] IS NOT NULL) AND [l3].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l3].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l3].[Level1_Required_Id] IS NOT NULL)) AND ([l3].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t1] ON [l2].[Id] = [t1].[Id] - WHERE [l2].[Level2_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l2].[Level2_Required_Id] IS NOT NULL) AND ([l2].[OneToMany_Required_Inverse3Id] IS NOT NULL) ) AS [t0] ON CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + WHEN (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] END = CASE - WHEN [t0].[Level2_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [t0].[Id] + WHEN ([t0].[Level2_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [t0].[Id] END LEFT JOIN ( SELECT [l5].[Id], [l5].[OneToOne_Required_PK_Date], [l5].[Level1_Required_Id], [l5].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l5] INNER JOIN [Level1] AS [l6] ON [l5].[Id] = [l6].[Id] - WHERE ([l5].[OneToOne_Required_PK_Date] IS NOT NULL AND [l5].[Level1_Required_Id] IS NOT NULL) AND [l5].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l5].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l5].[Level1_Required_Id] IS NOT NULL)) AND ([l5].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t2] ON [t0].[Level2_Required_Id] = CASE - WHEN ([t2].[OneToOne_Required_PK_Date] IS NOT NULL AND [t2].[Level1_Required_Id] IS NOT NULL) AND [t2].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t2].[Id] + WHEN (([t2].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t2].[Level1_Required_Id] IS NOT NULL)) AND ([t2].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t2].[Id] END LEFT JOIN [Level1] AS [l7] ON [t2].[Level1_Required_Id] = [l7].[Id] -WHERE (([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL) AND ([t0].[Level2_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse3Id] IS NOT NULL) +WHERE ((([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL)) AND (([t0].[Level2_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse3Id] IS NOT NULL)) ORDER BY CASE - WHEN ([t2].[OneToOne_Required_PK_Date] IS NOT NULL AND [t2].[Level1_Required_Id] IS NOT NULL) AND [t2].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t2].[Id] + WHEN (([t2].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t2].[Level1_Required_Id] IS NOT NULL)) AND ([t2].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t2].[Id] END"); } @@ -4305,13 +4305,13 @@ LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Required_Id], [l0].[Level2_Name], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id] FROM [Level1] AS [l0] INNER JOIN [Level1] AS [l1] ON [l0].[Id] = [l1].[Id] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL)) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t] ON [l].[Id] = CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + WHEN (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] END LEFT JOIN [Level1] AS [l2] ON [t].[OneToMany_Required_Inverse2Id] = [l2].[Id] LEFT JOIN [Level1] AS [l3] ON [t].[OneToOne_Optional_PK_Inverse2Id] = [l3].[Id] -WHERE (([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL) AND (([l2].[Id] = [l3].[Id]) OR ([l2].[Id] IS NULL AND [l3].[Id] IS NULL))"); +WHERE ((([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL)) AND (([l2].[Id] = [l3].[Id]) OR (([l2].[Id] IS NULL) AND ([l3].[Id] IS NULL)))"); } public override async Task SelectMany_with_navigation_and_explicit_DefaultIfEmpty(bool async) @@ -4325,9 +4325,9 @@ LEFT JOIN ( SELECT [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Required_Id], [l0].[OneToMany_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l0] INNER JOIN [Level1] AS [l1] ON [l0].[Id] = [l1].[Id] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL)) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t] ON [l].[Id] = [t].[OneToMany_Optional_Inverse2Id] -WHERE ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL"); +WHERE (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL)"); } public override async Task Explicit_GroupJoin_in_subquery_with_multiple_result_operator_distinct_count_materializes_main_clause( @@ -4350,11 +4350,11 @@ LEFT JOIN ( SELECT [l2].[Id], [l2].[OneToOne_Required_PK_Date], [l2].[Level1_Optional_Id], [l2].[Level1_Required_Id], [l2].[Level2_Name], [l2].[OneToMany_Optional_Inverse2Id], [l2].[OneToMany_Required_Inverse2Id], [l2].[OneToOne_Optional_PK_Inverse2Id], [l3].[Id] AS [Id0] FROM [Level1] AS [l2] INNER JOIN [Level1] AS [l3] ON [l2].[Id] = [l3].[Id] - WHERE ([l2].[OneToOne_Required_PK_Date] IS NOT NULL AND [l2].[Level1_Required_Id] IS NOT NULL) AND [l2].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l2].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l2].[Level1_Required_Id] IS NOT NULL)) AND ([l2].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t] ON [l1].[Id] = CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + WHEN (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] END - WHERE ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t0] ON [l0].[Id] = [t0].[Level1_Optional_Id] ) AS [t1]) > 4"); } @@ -4370,9 +4370,9 @@ LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Required_Id], [l0].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l0] INNER JOIN [Level1] AS [l1] ON [l0].[Id] = [l1].[Id] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL)) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t] ON [l].[Id] = CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + WHEN (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] END LEFT JOIN ( SELECT [l2].[Id], [l2].[Level2_Required_Id], [l2].[OneToMany_Required_Inverse3Id] @@ -4381,25 +4381,25 @@ INNER JOIN ( SELECT [l3].[Id] FROM [Level1] AS [l3] INNER JOIN [Level1] AS [l4] ON [l3].[Id] = [l4].[Id] - WHERE ([l3].[OneToOne_Required_PK_Date] IS NOT NULL AND [l3].[Level1_Required_Id] IS NOT NULL) AND [l3].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l3].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l3].[Level1_Required_Id] IS NOT NULL)) AND ([l3].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t1] ON [l2].[Id] = [t1].[Id] - WHERE [l2].[Level2_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l2].[Level2_Required_Id] IS NOT NULL) AND ([l2].[OneToMany_Required_Inverse3Id] IS NOT NULL) ) AS [t0] ON CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + WHEN (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] END = CASE - WHEN [t0].[Level2_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [t0].[Id] + WHEN ([t0].[Level2_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [t0].[Id] END LEFT JOIN ( SELECT [l5].[Id], [l5].[OneToOne_Required_PK_Date], [l5].[Level1_Optional_Id], [l5].[Level1_Required_Id], [l5].[Level2_Name], [l5].[OneToMany_Optional_Inverse2Id], [l5].[OneToMany_Required_Inverse2Id], [l5].[OneToOne_Optional_PK_Inverse2Id] FROM [Level1] AS [l5] INNER JOIN [Level1] AS [l6] ON [l5].[Id] = [l6].[Id] - WHERE ([l5].[OneToOne_Required_PK_Date] IS NOT NULL AND [l5].[Level1_Required_Id] IS NOT NULL) AND [l5].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l5].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l5].[Level1_Required_Id] IS NOT NULL)) AND ([l5].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t2] ON [t0].[Level2_Required_Id] = CASE - WHEN ([t2].[OneToOne_Required_PK_Date] IS NOT NULL AND [t2].[Level1_Required_Id] IS NOT NULL) AND [t2].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t2].[Id] + WHEN (([t2].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t2].[Level1_Required_Id] IS NOT NULL)) AND ([t2].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t2].[Id] END -WHERE (([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL) AND ([t0].[Level2_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse3Id] IS NOT NULL) +WHERE ((([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL)) AND (([t0].[Level2_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse3Id] IS NOT NULL)) ORDER BY CASE - WHEN ([t2].[OneToOne_Required_PK_Date] IS NOT NULL AND [t2].[Level1_Required_Id] IS NOT NULL) AND [t2].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t2].[Id] + WHEN (([t2].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t2].[Level1_Required_Id] IS NOT NULL)) AND ([t2].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t2].[Id] END"); } @@ -4414,7 +4414,7 @@ INNER JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[Level2_Name], [l0].[OneToMany_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id] FROM [Level1] AS [l0] INNER JOIN [Level1] AS [l1] ON [l0].[Id] = [l1].[Id] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL)) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t] ON [l].[Id] = [t].[OneToMany_Optional_Inverse2Id] LEFT JOIN ( SELECT [l2].[Id], [l2].[Level2_Optional_Id], [l2].[Level2_Required_Id], [l2].[Level3_Name], [l2].[OneToMany_Optional_Inverse3Id], [l2].[OneToMany_Required_Inverse3Id], [l2].[OneToOne_Optional_PK_Inverse3Id] @@ -4423,11 +4423,11 @@ INNER JOIN ( SELECT [l3].[Id] FROM [Level1] AS [l3] INNER JOIN [Level1] AS [l4] ON [l3].[Id] = [l4].[Id] - WHERE ([l3].[OneToOne_Required_PK_Date] IS NOT NULL AND [l3].[Level1_Required_Id] IS NOT NULL) AND [l3].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l3].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l3].[Level1_Required_Id] IS NOT NULL)) AND ([l3].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t1] ON [l2].[Id] = [t1].[Id] - WHERE [l2].[Level2_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l2].[Level2_Required_Id] IS NOT NULL) AND ([l2].[OneToMany_Required_Inverse3Id] IS NOT NULL) ) AS [t0] ON CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + WHEN (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] END = [t0].[Level2_Required_Id] LEFT JOIN ( SELECT [l5].[Id], [l5].[Level3_Optional_Id], [l5].[Level3_Required_Id], [l5].[Level4_Name], [l5].[OneToMany_Optional_Inverse4Id], [l5].[OneToMany_Required_Inverse4Id], [l5].[OneToOne_Optional_PK_Inverse4Id] @@ -4439,13 +4439,13 @@ INNER JOIN ( SELECT [l7].[Id] FROM [Level1] AS [l7] INNER JOIN [Level1] AS [l8] ON [l7].[Id] = [l8].[Id] - WHERE ([l7].[OneToOne_Required_PK_Date] IS NOT NULL AND [l7].[Level1_Required_Id] IS NOT NULL) AND [l7].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l7].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l7].[Level1_Required_Id] IS NOT NULL)) AND ([l7].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t4] ON [l6].[Id] = [t4].[Id] - WHERE [l6].[Level2_Required_Id] IS NOT NULL AND [l6].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l6].[Level2_Required_Id] IS NOT NULL) AND ([l6].[OneToMany_Required_Inverse3Id] IS NOT NULL) ) AS [t3] ON [l5].[Id] = [t3].[Id] - WHERE [l5].[Level3_Required_Id] IS NOT NULL AND [l5].[OneToMany_Required_Inverse4Id] IS NOT NULL + WHERE ([l5].[Level3_Required_Id] IS NOT NULL) AND ([l5].[OneToMany_Required_Inverse4Id] IS NOT NULL) ) AS [t2] ON CASE - WHEN [t0].[Level2_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [t0].[Id] + WHEN ([t0].[Level2_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [t0].[Id] END = [t2].[Level3_Required_Id]"); } @@ -4460,9 +4460,9 @@ LEFT JOIN ( SELECT [l0].[Level1_Optional_Id], [l0].[Level2_Name] FROM [Level1] AS [l0] INNER JOIN [Level1] AS [l1] ON [l0].[Id] = [l1].[Id] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL)) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t] ON [l].[Id] = [t].[Level1_Optional_Id] -WHERE ([t].[Level2_Name] = N'') OR ([t].[Level2_Name] IS NOT NULL AND (LEFT([t].[Level2_Name], LEN([t].[Level2_Name])) = [t].[Level2_Name]))"); +WHERE ([t].[Level2_Name] = N'') OR (([t].[Level2_Name] IS NOT NULL) AND (LEFT([t].[Level2_Name], LEN([t].[Level2_Name])) = [t].[Level2_Name]))"); } public override async Task SelectMany_subquery_with_custom_projection(bool async) @@ -4478,7 +4478,7 @@ INNER JOIN ( SELECT [l0].[Level2_Name] AS [Name], [l0].[OneToMany_Optional_Inverse2Id] FROM [Level1] AS [l0] INNER JOIN [Level1] AS [l1] ON [l0].[Id] = [l1].[Id] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL)) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t] ON [l].[Id] = [t].[OneToMany_Optional_Inverse2Id] ORDER BY [l].[Id]"); } @@ -4497,17 +4497,17 @@ LEFT JOIN ( SELECT [l1].[Id], [l1].[OneToOne_Required_PK_Date], [l1].[Level1_Optional_Id], [l1].[Level1_Required_Id], [l1].[Level2_Name], [l1].[OneToMany_Optional_Inverse2Id], [l1].[OneToMany_Required_Inverse2Id], [l1].[OneToOne_Optional_PK_Inverse2Id] FROM [Level1] AS [l1] INNER JOIN [Level1] AS [l2] ON [l1].[Id] = [l2].[Id] - WHERE ([l1].[OneToOne_Required_PK_Date] IS NOT NULL AND [l1].[Level1_Required_Id] IS NOT NULL) AND [l1].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l1].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l1].[Level1_Required_Id] IS NOT NULL)) AND ([l1].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t] ON [l0].[Id] = CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + WHEN (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] END - WHERE ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t0] ON [l].[Id] = [t0].[Level1_Required_Id] LEFT JOIN ( SELECT [l3].[Id], [l3].[OneToOne_Required_PK_Date], [l3].[Level1_Optional_Id], [l3].[Level1_Required_Id], [l3].[Level2_Name], [l3].[OneToMany_Optional_Inverse2Id], [l3].[OneToMany_Required_Inverse2Id], [l3].[OneToOne_Optional_PK_Inverse2Id] FROM [Level1] AS [l3] INNER JOIN [Level1] AS [l4] ON [l3].[Id] = [l4].[Id] - WHERE ([l3].[OneToOne_Required_PK_Date] IS NOT NULL AND [l3].[Level1_Required_Id] IS NOT NULL) AND [l3].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l3].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l3].[Level1_Required_Id] IS NOT NULL)) AND ([l3].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t1] ON [l].[Id] = [t1].[Level1_Optional_Id]"); } @@ -4539,12 +4539,12 @@ LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[Level2_Name], [l0].[OneToMany_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id] FROM [Level1] AS [l0] INNER JOIN [Level1] AS [l1] ON [l0].[Id] = [l1].[Id] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL)) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t] ON [l].[Id] = CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + WHEN (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] END LEFT JOIN [Level1] AS [l2] ON [t].[Level1_Required_Id] = [l2].[Id] -WHERE (([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL) AND ([l2].[Id] = 1)"); +WHERE ((([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL)) AND ([l2].[Id] = 1)"); } public override async Task Include10(bool async) @@ -4558,7 +4558,7 @@ LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[Level2_Name], [l0].[OneToMany_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id] FROM [Level1] AS [l0] INNER JOIN [Level1] AS [l1] ON [l0].[Id] = [l1].[Id] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL)) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t] ON [l].[Id] = [t].[Level1_Optional_Id] LEFT JOIN ( SELECT [l2].[Id], [l2].[Level2_Optional_Id], [l2].[Level2_Required_Id], [l2].[Level3_Name], [l2].[OneToMany_Optional_Inverse3Id], [l2].[OneToMany_Required_Inverse3Id], [l2].[OneToOne_Optional_PK_Inverse3Id] @@ -4567,17 +4567,17 @@ INNER JOIN ( SELECT [l3].[Id] FROM [Level1] AS [l3] INNER JOIN [Level1] AS [l4] ON [l3].[Id] = [l4].[Id] - WHERE ([l3].[OneToOne_Required_PK_Date] IS NOT NULL AND [l3].[Level1_Required_Id] IS NOT NULL) AND [l3].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l3].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l3].[Level1_Required_Id] IS NOT NULL)) AND ([l3].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t1] ON [l2].[Id] = [t1].[Id] - WHERE [l2].[Level2_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l2].[Level2_Required_Id] IS NOT NULL) AND ([l2].[OneToMany_Required_Inverse3Id] IS NOT NULL) ) AS [t0] ON CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + WHEN (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] END = [t0].[OneToOne_Optional_PK_Inverse3Id] LEFT JOIN ( SELECT [l5].[Id], [l5].[OneToOne_Required_PK_Date], [l5].[Level1_Optional_Id], [l5].[Level1_Required_Id], [l5].[Level2_Name], [l5].[OneToMany_Optional_Inverse2Id], [l5].[OneToMany_Required_Inverse2Id], [l5].[OneToOne_Optional_PK_Inverse2Id] FROM [Level1] AS [l5] INNER JOIN [Level1] AS [l6] ON [l5].[Id] = [l6].[Id] - WHERE ([l5].[OneToOne_Required_PK_Date] IS NOT NULL AND [l5].[Level1_Required_Id] IS NOT NULL) AND [l5].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l5].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l5].[Level1_Required_Id] IS NOT NULL)) AND ([l5].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t2] ON [l].[Id] = [t2].[OneToOne_Optional_PK_Inverse2Id] LEFT JOIN ( SELECT [l7].[Id], [l7].[Level2_Optional_Id], [l7].[Level2_Required_Id], [l7].[Level3_Name], [l7].[OneToMany_Optional_Inverse3Id], [l7].[OneToMany_Required_Inverse3Id], [l7].[OneToOne_Optional_PK_Inverse3Id] @@ -4586,11 +4586,11 @@ INNER JOIN ( SELECT [l8].[Id] FROM [Level1] AS [l8] INNER JOIN [Level1] AS [l9] ON [l8].[Id] = [l9].[Id] - WHERE ([l8].[OneToOne_Required_PK_Date] IS NOT NULL AND [l8].[Level1_Required_Id] IS NOT NULL) AND [l8].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l8].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l8].[Level1_Required_Id] IS NOT NULL)) AND ([l8].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t4] ON [l7].[Id] = [t4].[Id] - WHERE [l7].[Level2_Required_Id] IS NOT NULL AND [l7].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l7].[Level2_Required_Id] IS NOT NULL) AND ([l7].[OneToMany_Required_Inverse3Id] IS NOT NULL) ) AS [t3] ON CASE - WHEN ([t2].[OneToOne_Required_PK_Date] IS NOT NULL AND [t2].[Level1_Required_Id] IS NOT NULL) AND [t2].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t2].[Id] + WHEN (([t2].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t2].[Level1_Required_Id] IS NOT NULL)) AND ([t2].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t2].[Id] END = [t3].[Level2_Optional_Id] LEFT JOIN ( SELECT [l10].[Id], [l10].[Level3_Optional_Id], [l10].[Level3_Required_Id], [l10].[Level4_Name], [l10].[OneToMany_Optional_Inverse4Id], [l10].[OneToMany_Required_Inverse4Id], [l10].[OneToOne_Optional_PK_Inverse4Id] @@ -4602,13 +4602,13 @@ INNER JOIN ( SELECT [l12].[Id] FROM [Level1] AS [l12] INNER JOIN [Level1] AS [l13] ON [l12].[Id] = [l13].[Id] - WHERE ([l12].[OneToOne_Required_PK_Date] IS NOT NULL AND [l12].[Level1_Required_Id] IS NOT NULL) AND [l12].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l12].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l12].[Level1_Required_Id] IS NOT NULL)) AND ([l12].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t7] ON [l11].[Id] = [t7].[Id] - WHERE [l11].[Level2_Required_Id] IS NOT NULL AND [l11].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l11].[Level2_Required_Id] IS NOT NULL) AND ([l11].[OneToMany_Required_Inverse3Id] IS NOT NULL) ) AS [t6] ON [l10].[Id] = [t6].[Id] - WHERE [l10].[Level3_Required_Id] IS NOT NULL AND [l10].[OneToMany_Required_Inverse4Id] IS NOT NULL + WHERE ([l10].[Level3_Required_Id] IS NOT NULL) AND ([l10].[OneToMany_Required_Inverse4Id] IS NOT NULL) ) AS [t5] ON CASE - WHEN [t3].[Level2_Required_Id] IS NOT NULL AND [t3].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [t3].[Id] + WHEN ([t3].[Level2_Required_Id] IS NOT NULL) AND ([t3].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [t3].[Id] END = [t5].[OneToOne_Optional_PK_Inverse4Id]"); } @@ -4623,16 +4623,16 @@ LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[Level2_Name], [l0].[OneToMany_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id] FROM [Level1] AS [l0] INNER JOIN [Level1] AS [l1] ON [l0].[Id] = [l1].[Id] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL)) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t] ON [l].[Id] = CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + WHEN (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] END LEFT JOIN [Level1] AS [l2] ON [t].[OneToMany_Required_Inverse2Id] = [l2].[Id] -WHERE (([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL) AND (( +WHERE ((([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL)) AND (( SELECT COUNT(*) FROM [Level1] AS [l3] INNER JOIN [Level1] AS [l4] ON [l3].[Id] = [l4].[Id] - WHERE (([l3].[OneToOne_Required_PK_Date] IS NOT NULL AND [l3].[Level1_Required_Id] IS NOT NULL) AND [l3].[OneToMany_Required_Inverse2Id] IS NOT NULL) AND ([l2].[Id] IS NOT NULL AND ([l2].[Id] = [l3].[OneToMany_Optional_Inverse2Id]))) > 0)"); + WHERE ((([l3].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l3].[Level1_Required_Id] IS NOT NULL)) AND ([l3].[OneToMany_Required_Inverse2Id] IS NOT NULL)) AND (([l2].[Id] IS NOT NULL) AND ([l2].[Id] = [l3].[OneToMany_Optional_Inverse2Id]))) > 0)"); } public override async Task Where_multiple_nav_prop_reference_optional_compared_to_null2(bool async) @@ -4646,9 +4646,9 @@ LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Required_Id], [l0].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l0] INNER JOIN [Level1] AS [l1] ON [l0].[Id] = [l1].[Id] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL)) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t] ON [l].[Id] = CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + WHEN (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] END LEFT JOIN ( SELECT [l2].[Id], [l2].[Level2_Optional_Id], [l2].[Level2_Required_Id], [l2].[Level3_Name], [l2].[OneToMany_Optional_Inverse3Id], [l2].[OneToMany_Required_Inverse3Id], [l2].[OneToOne_Optional_PK_Inverse3Id] @@ -4657,24 +4657,24 @@ INNER JOIN ( SELECT [l3].[Id] FROM [Level1] AS [l3] INNER JOIN [Level1] AS [l4] ON [l3].[Id] = [l4].[Id] - WHERE ([l3].[OneToOne_Required_PK_Date] IS NOT NULL AND [l3].[Level1_Required_Id] IS NOT NULL) AND [l3].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l3].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l3].[Level1_Required_Id] IS NOT NULL)) AND ([l3].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t1] ON [l2].[Id] = [t1].[Id] - WHERE [l2].[Level2_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l2].[Level2_Required_Id] IS NOT NULL) AND ([l2].[OneToMany_Required_Inverse3Id] IS NOT NULL) ) AS [t0] ON CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + WHEN (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] END = CASE - WHEN [t0].[Level2_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [t0].[Id] + WHEN ([t0].[Level2_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [t0].[Id] END LEFT JOIN ( SELECT [l5].[Id], [l5].[OneToOne_Required_PK_Date], [l5].[Level1_Optional_Id], [l5].[Level1_Required_Id], [l5].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l5] INNER JOIN [Level1] AS [l6] ON [l5].[Id] = [l6].[Id] - WHERE ([l5].[OneToOne_Required_PK_Date] IS NOT NULL AND [l5].[Level1_Required_Id] IS NOT NULL) AND [l5].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l5].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l5].[Level1_Required_Id] IS NOT NULL)) AND ([l5].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t2] ON [t0].[Level2_Optional_Id] = CASE - WHEN ([t2].[OneToOne_Required_PK_Date] IS NOT NULL AND [t2].[Level1_Required_Id] IS NOT NULL) AND [t2].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t2].[Id] + WHEN (([t2].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t2].[Level1_Required_Id] IS NOT NULL)) AND ([t2].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t2].[Id] END LEFT JOIN [Level1] AS [l7] ON [t2].[Level1_Optional_Id] = [l7].[Id] -WHERE ((([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL) AND ([t0].[Level2_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse3Id] IS NOT NULL)) AND [l7].[Id] IS NULL"); +WHERE (((([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL)) AND (([t0].[Level2_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse3Id] IS NOT NULL))) AND ([l7].[Id] IS NULL)"); } public override async Task SelectMany_navigation_property_and_filter_after(bool async) @@ -4688,13 +4688,13 @@ INNER JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[Level2_Name], [l0].[OneToMany_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id] FROM [Level1] AS [l0] INNER JOIN [Level1] AS [l1] ON [l0].[Id] = [l1].[Id] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL)) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t] ON [l].[Id] = [t].[OneToMany_Optional_Inverse2Id] WHERE (CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] -END <> 6) OR CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] -END IS NULL"); + WHEN (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] +END <> 6) OR (CASE + WHEN (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] +END IS NULL)"); } public override async Task Correlated_nested_subquery_doesnt_project_unnecessary_columns_in_top_level(bool async) @@ -4711,20 +4711,20 @@ LEFT JOIN ( SELECT [l1].[Id], [l1].[OneToOne_Required_PK_Date], [l1].[Level1_Optional_Id], [l1].[Level1_Required_Id], [l1].[Level2_Name], [l1].[OneToMany_Optional_Inverse2Id], [l1].[OneToMany_Required_Inverse2Id], [l1].[OneToOne_Optional_PK_Inverse2Id], [l2].[Id] AS [Id0] FROM [Level1] AS [l1] INNER JOIN [Level1] AS [l2] ON [l1].[Id] = [l2].[Id] - WHERE ([l1].[OneToOne_Required_PK_Date] IS NOT NULL AND [l1].[Level1_Required_Id] IS NOT NULL) AND [l1].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l1].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l1].[Level1_Required_Id] IS NOT NULL)) AND ([l1].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t] ON [l0].[Id] = CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + WHEN (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] END - WHERE (([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL) AND EXISTS ( + WHERE ((([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL)) AND EXISTS ( SELECT 1 FROM [Level1] AS [l3] LEFT JOIN ( SELECT [l4].[Id], [l4].[OneToOne_Required_PK_Date], [l4].[Level1_Optional_Id], [l4].[Level1_Required_Id], [l4].[Level2_Name], [l4].[OneToMany_Optional_Inverse2Id], [l4].[OneToMany_Required_Inverse2Id], [l4].[OneToOne_Optional_PK_Inverse2Id], [l5].[Id] AS [Id0] FROM [Level1] AS [l4] INNER JOIN [Level1] AS [l5] ON [l4].[Id] = [l5].[Id] - WHERE ([l4].[OneToOne_Required_PK_Date] IS NOT NULL AND [l4].[Level1_Required_Id] IS NOT NULL) AND [l4].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l4].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l4].[Level1_Required_Id] IS NOT NULL)) AND ([l4].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t0] ON [l3].[Id] = CASE - WHEN ([t0].[OneToOne_Required_PK_Date] IS NOT NULL AND [t0].[Level1_Required_Id] IS NOT NULL) AND [t0].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t0].[Id] + WHEN (([t0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t0].[Level1_Required_Id] IS NOT NULL)) AND ([t0].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t0].[Id] END LEFT JOIN ( SELECT [l6].[Id], [l6].[Level2_Optional_Id], [l6].[Level2_Required_Id], [l6].[Level3_Name], [l6].[OneToMany_Optional_Inverse3Id], [l6].[OneToMany_Required_Inverse3Id], [l6].[OneToOne_Optional_PK_Inverse3Id], [t2].[Id] AS [Id0], [t2].[Id0] AS [Id00] @@ -4733,15 +4733,15 @@ INNER JOIN ( SELECT [l7].[Id], [l7].[OneToOne_Required_PK_Date], [l7].[Level1_Optional_Id], [l7].[Level1_Required_Id], [l7].[Level2_Name], [l7].[OneToMany_Optional_Inverse2Id], [l7].[OneToMany_Required_Inverse2Id], [l7].[OneToOne_Optional_PK_Inverse2Id], [l8].[Id] AS [Id0] FROM [Level1] AS [l7] INNER JOIN [Level1] AS [l8] ON [l7].[Id] = [l8].[Id] - WHERE ([l7].[OneToOne_Required_PK_Date] IS NOT NULL AND [l7].[Level1_Required_Id] IS NOT NULL) AND [l7].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l7].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l7].[Level1_Required_Id] IS NOT NULL)) AND ([l7].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t2] ON [l6].[Id] = [t2].[Id] - WHERE [l6].[Level2_Required_Id] IS NOT NULL AND [l6].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l6].[Level2_Required_Id] IS NOT NULL) AND ([l6].[OneToMany_Required_Inverse3Id] IS NOT NULL) ) AS [t1] ON CASE - WHEN ([t0].[OneToOne_Required_PK_Date] IS NOT NULL AND [t0].[Level1_Required_Id] IS NOT NULL) AND [t0].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t0].[Id] + WHEN (([t0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t0].[Level1_Required_Id] IS NOT NULL)) AND ([t0].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t0].[Id] END = CASE - WHEN [t1].[Level2_Required_Id] IS NOT NULL AND [t1].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [t1].[Id] + WHEN ([t1].[Level2_Required_Id] IS NOT NULL) AND ([t1].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [t1].[Id] END - WHERE (([t0].[OneToOne_Required_PK_Date] IS NOT NULL AND [t0].[Level1_Required_Id] IS NOT NULL) AND [t0].[OneToMany_Required_Inverse2Id] IS NOT NULL) AND ([t1].[Level2_Required_Id] IS NOT NULL AND [t1].[OneToMany_Required_Inverse3Id] IS NOT NULL)))"); + WHERE ((([t0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t0].[Level1_Required_Id] IS NOT NULL)) AND ([t0].[OneToMany_Required_Inverse2Id] IS NOT NULL)) AND (([t1].[Level2_Required_Id] IS NOT NULL) AND ([t1].[OneToMany_Required_Inverse3Id] IS NOT NULL))))"); } public override async Task OrderBy_nav_prop_reference_optional_via_DefaultIfEmpty(bool async) @@ -4758,11 +4758,11 @@ LEFT JOIN ( SELECT [l1].[Id], [l1].[OneToOne_Required_PK_Date], [l1].[Level1_Optional_Id], [l1].[Level1_Required_Id], [l1].[Level2_Name], [l1].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l1] INNER JOIN [Level1] AS [l2] ON [l1].[Id] = [l2].[Id] - WHERE ([l1].[OneToOne_Required_PK_Date] IS NOT NULL AND [l1].[Level1_Required_Id] IS NOT NULL) AND [l1].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l1].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l1].[Level1_Required_Id] IS NOT NULL)) AND ([l1].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t] ON [l0].[Id] = CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + WHEN (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] END - WHERE ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t0] ON [l].[Id] = [t0].[Level1_Optional_Id] ORDER BY [t0].[Level2_Name], [l].[Id]"); } @@ -4778,7 +4778,7 @@ LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[Level2_Name], [l0].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l0] INNER JOIN [Level1] AS [l1] ON [l0].[Id] = [l1].[Id] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL)) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t] ON [l].[Id] = [t].[Level1_Optional_Id] LEFT JOIN ( SELECT [l2].[Level2_Required_Id], [l2].[Level3_Name] @@ -4787,13 +4787,13 @@ INNER JOIN ( SELECT [l3].[Id] FROM [Level1] AS [l3] INNER JOIN [Level1] AS [l4] ON [l3].[Id] = [l4].[Id] - WHERE ([l3].[OneToOne_Required_PK_Date] IS NOT NULL AND [l3].[Level1_Required_Id] IS NOT NULL) AND [l3].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l3].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l3].[Level1_Required_Id] IS NOT NULL)) AND ([l3].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t1] ON [l2].[Id] = [t1].[Id] - WHERE [l2].[Level2_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l2].[Level2_Required_Id] IS NOT NULL) AND ([l2].[OneToMany_Required_Inverse3Id] IS NOT NULL) ) AS [t0] ON CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + WHEN (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] END = [t0].[Level2_Required_Id] -WHERE ([t0].[Level3_Name] = N'L3 05') OR (([t].[Level2_Name] <> N'L2 05') OR [t].[Level2_Name] IS NULL)"); +WHERE ([t0].[Level3_Name] = N'L3 05') OR (([t].[Level2_Name] <> N'L2 05') OR ([t].[Level2_Name] IS NULL))"); } public override async Task Optional_navigation_inside_nested_method_call_translated_to_join(bool async) @@ -4807,9 +4807,9 @@ LEFT JOIN ( SELECT [l0].[Level1_Optional_Id], [l0].[Level2_Name] FROM [Level1] AS [l0] INNER JOIN [Level1] AS [l1] ON [l0].[Id] = [l1].[Id] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL)) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t] ON [l].[Id] = [t].[Level1_Optional_Id] -WHERE [t].[Level2_Name] IS NOT NULL AND (UPPER([t].[Level2_Name]) LIKE N'L%')"); +WHERE ([t].[Level2_Name] IS NOT NULL) AND (UPPER([t].[Level2_Name]) LIKE N'L%')"); } public override async Task Multiple_SelectMany_calls(bool async) @@ -4823,7 +4823,7 @@ INNER JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Required_Id], [l0].[OneToMany_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l0] INNER JOIN [Level1] AS [l1] ON [l0].[Id] = [l1].[Id] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL)) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t] ON [l].[Id] = [t].[OneToMany_Optional_Inverse2Id] INNER JOIN ( SELECT [l2].[Id], [l2].[Level2_Optional_Id], [l2].[Level2_Required_Id], [l2].[Level3_Name], [l2].[OneToMany_Optional_Inverse3Id], [l2].[OneToMany_Required_Inverse3Id], [l2].[OneToOne_Optional_PK_Inverse3Id] @@ -4832,11 +4832,11 @@ INNER JOIN ( SELECT [l3].[Id] FROM [Level1] AS [l3] INNER JOIN [Level1] AS [l4] ON [l3].[Id] = [l4].[Id] - WHERE ([l3].[OneToOne_Required_PK_Date] IS NOT NULL AND [l3].[Level1_Required_Id] IS NOT NULL) AND [l3].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l3].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l3].[Level1_Required_Id] IS NOT NULL)) AND ([l3].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t1] ON [l2].[Id] = [t1].[Id] - WHERE [l2].[Level2_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l2].[Level2_Required_Id] IS NOT NULL) AND ([l2].[OneToMany_Required_Inverse3Id] IS NOT NULL) ) AS [t0] ON CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + WHEN (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] END = [t0].[OneToMany_Optional_Inverse3Id]"); } @@ -4851,9 +4851,9 @@ LEFT JOIN ( SELECT [l0].[Level1_Required_Id], [l0].[Level2_Name] FROM [Level1] AS [l0] INNER JOIN [Level1] AS [l1] ON [l0].[Id] = [l1].[Id] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL)) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t] ON [l].[Id] = [t].[Level1_Required_Id] -WHERE [t].[Level2_Name] IS NOT NULL AND ([t].[Level2_Name] LIKE N'L%')"); +WHERE ([t].[Level2_Name] IS NOT NULL) AND ([t].[Level2_Name] LIKE N'L%')"); } public override async Task Include5(bool async) @@ -4867,7 +4867,7 @@ LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[Level2_Name], [l0].[OneToMany_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id] FROM [Level1] AS [l0] INNER JOIN [Level1] AS [l1] ON [l0].[Id] = [l1].[Id] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL)) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t] ON [l].[Id] = [t].[Level1_Optional_Id] LEFT JOIN ( SELECT [l2].[Id], [l2].[Level2_Optional_Id], [l2].[Level2_Required_Id], [l2].[Level3_Name], [l2].[OneToMany_Optional_Inverse3Id], [l2].[OneToMany_Required_Inverse3Id], [l2].[OneToOne_Optional_PK_Inverse3Id] @@ -4876,11 +4876,11 @@ INNER JOIN ( SELECT [l3].[Id] FROM [Level1] AS [l3] INNER JOIN [Level1] AS [l4] ON [l3].[Id] = [l4].[Id] - WHERE ([l3].[OneToOne_Required_PK_Date] IS NOT NULL AND [l3].[Level1_Required_Id] IS NOT NULL) AND [l3].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l3].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l3].[Level1_Required_Id] IS NOT NULL)) AND ([l3].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t1] ON [l2].[Id] = [t1].[Id] - WHERE [l2].[Level2_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l2].[Level2_Required_Id] IS NOT NULL) AND ([l2].[OneToMany_Required_Inverse3Id] IS NOT NULL) ) AS [t0] ON CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + WHEN (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] END = [t0].[OneToOne_Optional_PK_Inverse3Id]"); } @@ -4907,9 +4907,9 @@ LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Required_Id], [l0].[Level2_Name], [l0].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l0] INNER JOIN [Level1] AS [l1] ON [l0].[Id] = [l1].[Id] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL)) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t] ON [l].[Id] = CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + WHEN (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] END LEFT JOIN ( SELECT [l2].[Id], [l2].[Level2_Required_Id], [l2].[OneToMany_Required_Inverse3Id] @@ -4918,13 +4918,13 @@ INNER JOIN ( SELECT [l3].[Id] FROM [Level1] AS [l3] INNER JOIN [Level1] AS [l4] ON [l3].[Id] = [l4].[Id] - WHERE ([l3].[OneToOne_Required_PK_Date] IS NOT NULL AND [l3].[Level1_Required_Id] IS NOT NULL) AND [l3].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l3].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l3].[Level1_Required_Id] IS NOT NULL)) AND ([l3].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t1] ON [l2].[Id] = [t1].[Id] - WHERE [l2].[Level2_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l2].[Level2_Required_Id] IS NOT NULL) AND ([l2].[OneToMany_Required_Inverse3Id] IS NOT NULL) ) AS [t0] ON CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + WHEN (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] END = [t0].[Level2_Required_Id] -WHERE (([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL) AND EXISTS ( +WHERE ((([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL)) AND EXISTS ( SELECT 1 FROM [Level1] AS [l5] INNER JOIN ( @@ -4934,17 +4934,17 @@ INNER JOIN ( SELECT [l7].[Id], [l7].[OneToOne_Required_PK_Date], [l7].[Level1_Optional_Id], [l7].[Level1_Required_Id], [l7].[Level2_Name], [l7].[OneToMany_Optional_Inverse2Id], [l7].[OneToMany_Required_Inverse2Id], [l7].[OneToOne_Optional_PK_Inverse2Id], [l8].[Id] AS [Id0] FROM [Level1] AS [l7] INNER JOIN [Level1] AS [l8] ON [l7].[Id] = [l8].[Id] - WHERE ([l7].[OneToOne_Required_PK_Date] IS NOT NULL AND [l7].[Level1_Required_Id] IS NOT NULL) AND [l7].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l7].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l7].[Level1_Required_Id] IS NOT NULL)) AND ([l7].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t3] ON [l6].[Id] = [t3].[Id] - WHERE [l6].[Level2_Required_Id] IS NOT NULL AND [l6].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l6].[Level2_Required_Id] IS NOT NULL) AND ([l6].[OneToMany_Required_Inverse3Id] IS NOT NULL) ) AS [t2] ON [l5].[Id] = [t2].[Id] - WHERE ([l5].[Level3_Required_Id] IS NOT NULL AND [l5].[OneToMany_Required_Inverse4Id] IS NOT NULL) AND (CASE - WHEN [t0].[Level2_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [t0].[Id] - END IS NOT NULL AND ((CASE - WHEN [t0].[Level2_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [t0].[Id] - END = [l5].[OneToMany_Optional_Inverse4Id]) OR (CASE - WHEN [t0].[Level2_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [t0].[Id] - END IS NULL AND [l5].[OneToMany_Optional_Inverse4Id] IS NULL))))"); + WHERE (([l5].[Level3_Required_Id] IS NOT NULL) AND ([l5].[OneToMany_Required_Inverse4Id] IS NOT NULL)) AND ((CASE + WHEN ([t0].[Level2_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [t0].[Id] + END IS NOT NULL) AND ((CASE + WHEN ([t0].[Level2_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [t0].[Id] + END = [l5].[OneToMany_Optional_Inverse4Id]) OR ((CASE + WHEN ([t0].[Level2_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [t0].[Id] + END IS NULL) AND ([l5].[OneToMany_Optional_Inverse4Id] IS NULL)))))"); } public override async Task Null_check_removal_applied_recursively(bool async) @@ -4958,7 +4958,7 @@ LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l0] INNER JOIN [Level1] AS [l1] ON [l0].[Id] = [l1].[Id] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL)) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t] ON [l].[Id] = [t].[Level1_Optional_Id] LEFT JOIN ( SELECT [l2].[Id], [l2].[Level2_Optional_Id], [l2].[Level2_Required_Id], [l2].[OneToMany_Required_Inverse3Id] @@ -4967,11 +4967,11 @@ INNER JOIN ( SELECT [l3].[Id] FROM [Level1] AS [l3] INNER JOIN [Level1] AS [l4] ON [l3].[Id] = [l4].[Id] - WHERE ([l3].[OneToOne_Required_PK_Date] IS NOT NULL AND [l3].[Level1_Required_Id] IS NOT NULL) AND [l3].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l3].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l3].[Level1_Required_Id] IS NOT NULL)) AND ([l3].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t1] ON [l2].[Id] = [t1].[Id] - WHERE [l2].[Level2_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l2].[Level2_Required_Id] IS NOT NULL) AND ([l2].[OneToMany_Required_Inverse3Id] IS NOT NULL) ) AS [t0] ON CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + WHEN (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] END = [t0].[Level2_Optional_Id] LEFT JOIN ( SELECT [l5].[Level3_Optional_Id], [l5].[Level4_Name] @@ -4983,13 +4983,13 @@ INNER JOIN ( SELECT [l7].[Id] FROM [Level1] AS [l7] INNER JOIN [Level1] AS [l8] ON [l7].[Id] = [l8].[Id] - WHERE ([l7].[OneToOne_Required_PK_Date] IS NOT NULL AND [l7].[Level1_Required_Id] IS NOT NULL) AND [l7].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l7].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l7].[Level1_Required_Id] IS NOT NULL)) AND ([l7].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t4] ON [l6].[Id] = [t4].[Id] - WHERE [l6].[Level2_Required_Id] IS NOT NULL AND [l6].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l6].[Level2_Required_Id] IS NOT NULL) AND ([l6].[OneToMany_Required_Inverse3Id] IS NOT NULL) ) AS [t3] ON [l5].[Id] = [t3].[Id] - WHERE [l5].[Level3_Required_Id] IS NOT NULL AND [l5].[OneToMany_Required_Inverse4Id] IS NOT NULL + WHERE ([l5].[Level3_Required_Id] IS NOT NULL) AND ([l5].[OneToMany_Required_Inverse4Id] IS NOT NULL) ) AS [t2] ON CASE - WHEN [t0].[Level2_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [t0].[Id] + WHEN ([t0].[Level2_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [t0].[Id] END = [t2].[Level3_Optional_Id] WHERE [t2].[Level4_Name] = N'L4 01'"); } @@ -5005,7 +5005,7 @@ INNER JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[Level2_Name], [l0].[OneToMany_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id] FROM [Level1] AS [l0] INNER JOIN [Level1] AS [l1] ON [l0].[Id] = [l1].[Id] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL)) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t] ON [l].[Id] = [t].[OneToMany_Required_Inverse2Id] WHERE EXISTS ( SELECT 1 @@ -5014,12 +5014,12 @@ INNER JOIN ( SELECT [l3].[Id], [l3].[OneToOne_Required_PK_Date], [l3].[Level1_Optional_Id], [l3].[Level1_Required_Id], [l3].[Level2_Name], [l3].[OneToMany_Optional_Inverse2Id], [l3].[OneToMany_Required_Inverse2Id], [l3].[OneToOne_Optional_PK_Inverse2Id], [l4].[Id] AS [Id0] FROM [Level1] AS [l3] INNER JOIN [Level1] AS [l4] ON [l3].[Id] = [l4].[Id] - WHERE ([l3].[OneToOne_Required_PK_Date] IS NOT NULL AND [l3].[Level1_Required_Id] IS NOT NULL) AND [l3].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l3].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l3].[Level1_Required_Id] IS NOT NULL)) AND ([l3].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t0] ON [l2].[Id] = [t0].[Id] - WHERE ([l2].[Level2_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse3Id] IS NOT NULL) AND (CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] - END IS NOT NULL AND (CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + WHERE (([l2].[Level2_Required_Id] IS NOT NULL) AND ([l2].[OneToMany_Required_Inverse3Id] IS NOT NULL)) AND ((CASE + WHEN (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] + END IS NOT NULL) AND (CASE + WHEN (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] END = [l2].[OneToMany_Required_Inverse3Id])))"); } @@ -5034,7 +5034,7 @@ LEFT JOIN ( SELECT [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id] FROM [Level1] AS [l0] INNER JOIN [Level1] AS [l1] ON [l0].[Id] = [l1].[Id] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL)) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t] ON [l].[Id] = [t].[Level1_Optional_Id]"); } @@ -5044,14 +5044,14 @@ public override async Task Complex_navigations_with_predicate_projected_into_ano AssertSql( @"SELECT [l].[Name], CASE - WHEN [t2].[Level2_Required_Id] IS NOT NULL AND [t2].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [t2].[Id] + WHEN ([t2].[Level2_Required_Id] IS NOT NULL) AND ([t2].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [t2].[Id] END AS [Id] FROM [Level1] AS [l] LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Required_Id], [l0].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l0] INNER JOIN [Level1] AS [l1] ON [l0].[Id] = [l1].[Id] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL)) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t] ON [l].[Id] = [t].[Level1_Required_Id] LEFT JOIN ( SELECT [l2].[Id], [l2].[Level2_Required_Id], [l2].[OneToMany_Required_Inverse3Id] @@ -5060,11 +5060,11 @@ INNER JOIN ( SELECT [l3].[Id] FROM [Level1] AS [l3] INNER JOIN [Level1] AS [l4] ON [l3].[Id] = [l4].[Id] - WHERE ([l3].[OneToOne_Required_PK_Date] IS NOT NULL AND [l3].[Level1_Required_Id] IS NOT NULL) AND [l3].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l3].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l3].[Level1_Required_Id] IS NOT NULL)) AND ([l3].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t1] ON [l2].[Id] = [t1].[Id] - WHERE [l2].[Level2_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l2].[Level2_Required_Id] IS NOT NULL) AND ([l2].[OneToMany_Required_Inverse3Id] IS NOT NULL) ) AS [t0] ON CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + WHEN (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] END = [t0].[Level2_Required_Id] LEFT JOIN ( SELECT [l5].[Id], [l5].[Level2_Optional_Id], [l5].[Level2_Required_Id], [l5].[OneToMany_Required_Inverse3Id] @@ -5073,25 +5073,25 @@ INNER JOIN ( SELECT [l6].[Id] FROM [Level1] AS [l6] INNER JOIN [Level1] AS [l7] ON [l6].[Id] = [l7].[Id] - WHERE ([l6].[OneToOne_Required_PK_Date] IS NOT NULL AND [l6].[Level1_Required_Id] IS NOT NULL) AND [l6].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l6].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l6].[Level1_Required_Id] IS NOT NULL)) AND ([l6].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t3] ON [l5].[Id] = [t3].[Id] - WHERE [l5].[Level2_Required_Id] IS NOT NULL AND [l5].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l5].[Level2_Required_Id] IS NOT NULL) AND ([l5].[OneToMany_Required_Inverse3Id] IS NOT NULL) ) AS [t2] ON CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + WHEN (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] END = [t2].[Level2_Optional_Id] WHERE ((CASE - WHEN [t0].[Level2_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [t0].[Id] + WHEN ([t0].[Level2_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [t0].[Id] END = CASE - WHEN [t2].[Level2_Required_Id] IS NOT NULL AND [t2].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [t2].[Id] -END) OR (CASE - WHEN [t0].[Level2_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [t0].[Id] -END IS NULL AND CASE - WHEN [t2].[Level2_Required_Id] IS NOT NULL AND [t2].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [t2].[Id] -END IS NULL)) AND ((CASE - WHEN [t2].[Level2_Required_Id] IS NOT NULL AND [t2].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [t2].[Id] -END <> 7) OR CASE - WHEN [t2].[Level2_Required_Id] IS NOT NULL AND [t2].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [t2].[Id] -END IS NULL)"); + WHEN ([t2].[Level2_Required_Id] IS NOT NULL) AND ([t2].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [t2].[Id] +END) OR ((CASE + WHEN ([t0].[Level2_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [t0].[Id] +END IS NULL) AND (CASE + WHEN ([t2].[Level2_Required_Id] IS NOT NULL) AND ([t2].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [t2].[Id] +END IS NULL))) AND ((CASE + WHEN ([t2].[Level2_Required_Id] IS NOT NULL) AND ([t2].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [t2].[Id] +END <> 7) OR (CASE + WHEN ([t2].[Level2_Required_Id] IS NOT NULL) AND ([t2].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [t2].[Id] +END IS NULL))"); } public override async Task GroupJoin_without_DefaultIfEmpty(bool async) @@ -5108,11 +5108,11 @@ LEFT JOIN ( SELECT [l1].[Id], [l1].[OneToOne_Required_PK_Date], [l1].[Level1_Optional_Id], [l1].[Level1_Required_Id], [l1].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l1] INNER JOIN [Level1] AS [l2] ON [l1].[Id] = [l2].[Id] - WHERE ([l1].[OneToOne_Required_PK_Date] IS NOT NULL AND [l1].[Level1_Required_Id] IS NOT NULL) AND [l1].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l1].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l1].[Level1_Required_Id] IS NOT NULL)) AND ([l1].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t] ON [l0].[Id] = CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + WHEN (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] END - WHERE ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t0] ON [l].[Id] = [t0].[Level1_Optional_Id]"); } @@ -5127,12 +5127,12 @@ LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Required_Id], [l0].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l0] INNER JOIN [Level1] AS [l1] ON [l0].[Id] = [l1].[Id] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL)) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t] ON [l].[Id] = [t].[Level1_Required_Id] WHERE (CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + WHEN (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] END = 1) OR (CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + WHEN (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] END = 2)"); } @@ -5142,14 +5142,14 @@ public override async Task Select_multiple_nav_prop_reference_required(bool asyn AssertSql( @"SELECT CASE - WHEN [t0].[Level2_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [t0].[Id] + WHEN ([t0].[Level2_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [t0].[Id] END FROM [Level1] AS [l] LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Required_Id], [l0].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l0] INNER JOIN [Level1] AS [l1] ON [l0].[Id] = [l1].[Id] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL)) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t] ON [l].[Id] = [t].[Level1_Required_Id] LEFT JOIN ( SELECT [l2].[Id], [l2].[Level2_Required_Id], [l2].[OneToMany_Required_Inverse3Id] @@ -5158,11 +5158,11 @@ INNER JOIN ( SELECT [l3].[Id] FROM [Level1] AS [l3] INNER JOIN [Level1] AS [l4] ON [l3].[Id] = [l4].[Id] - WHERE ([l3].[OneToOne_Required_PK_Date] IS NOT NULL AND [l3].[Level1_Required_Id] IS NOT NULL) AND [l3].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l3].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l3].[Level1_Required_Id] IS NOT NULL)) AND ([l3].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t1] ON [l2].[Id] = [t1].[Id] - WHERE [l2].[Level2_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l2].[Level2_Required_Id] IS NOT NULL) AND ([l2].[OneToMany_Required_Inverse3Id] IS NOT NULL) ) AS [t0] ON CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + WHEN (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] END = [t0].[Level2_Required_Id]"); } @@ -5178,21 +5178,21 @@ INNER JOIN ( SELECT [l3].[Id], [l3].[OneToOne_Required_PK_Date], [l3].[Level1_Optional_Id], [l3].[Level1_Required_Id], [l3].[Level2_Name], [l3].[OneToMany_Optional_Inverse2Id], [l3].[OneToMany_Required_Inverse2Id], [l3].[OneToOne_Optional_PK_Inverse2Id], [l4].[Id] AS [Id0] FROM [Level1] AS [l3] INNER JOIN [Level1] AS [l4] ON [l3].[Id] = [l4].[Id] - WHERE ([l3].[OneToOne_Required_PK_Date] IS NOT NULL AND [l3].[Level1_Required_Id] IS NOT NULL) AND [l3].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l3].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l3].[Level1_Required_Id] IS NOT NULL)) AND ([l3].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t0] ON [l2].[Id] = [t0].[Id] - WHERE ([l2].[Level2_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse3Id] IS NOT NULL) AND (CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] - END IS NOT NULL AND ((CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] - END = [l2].[OneToMany_Optional_Inverse3Id]) OR (CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] - END IS NULL AND [l2].[OneToMany_Optional_Inverse3Id] IS NULL)))) AS [Count] + WHERE (([l2].[Level2_Required_Id] IS NOT NULL) AND ([l2].[OneToMany_Required_Inverse3Id] IS NOT NULL)) AND ((CASE + WHEN (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] + END IS NOT NULL) AND ((CASE + WHEN (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] + END = [l2].[OneToMany_Optional_Inverse3Id]) OR ((CASE + WHEN (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] + END IS NULL) AND ([l2].[OneToMany_Optional_Inverse3Id] IS NULL))))) AS [Count] FROM [Level1] AS [l] LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l0] INNER JOIN [Level1] AS [l1] ON [l0].[Id] = [l1].[Id] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL)) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t] ON [l].[Id] = [t].[Level1_Optional_Id]"); } @@ -5209,15 +5209,15 @@ LEFT JOIN ( SELECT [l0].[Level1_Required_Id], [l0].[Level2_Name] FROM [Level1] AS [l0] INNER JOIN [Level1] AS [l1] ON [l0].[Id] = [l1].[Id] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL)) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t] ON [l].[Id] = [t].[Level1_Required_Id] - WHERE ([t].[Level2_Name] <> N'Foo') OR [t].[Level2_Name] IS NULL + WHERE ([t].[Level2_Name] <> N'Foo') OR ([t].[Level2_Name] IS NULL) ) AS [t0] LEFT JOIN ( SELECT [l2].[Id], [l2].[OneToOne_Required_PK_Date], [l2].[Level1_Optional_Id], [l2].[Level1_Required_Id], [l2].[Level2_Name], [l2].[OneToMany_Optional_Inverse2Id], [l2].[OneToMany_Required_Inverse2Id], [l2].[OneToOne_Optional_PK_Inverse2Id] FROM [Level1] AS [l2] INNER JOIN [Level1] AS [l3] ON [l2].[Id] = [l3].[Id] - WHERE ([l2].[OneToOne_Required_PK_Date] IS NOT NULL AND [l2].[Level1_Required_Id] IS NOT NULL) AND [l2].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l2].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l2].[Level1_Required_Id] IS NOT NULL)) AND ([l2].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t1] ON [t0].[Id] = [t1].[Level1_Optional_Id]"); } @@ -5232,7 +5232,7 @@ LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[Level2_Name], [l0].[OneToMany_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id] FROM [Level1] AS [l0] INNER JOIN [Level1] AS [l1] ON [l0].[Id] = [l1].[Id] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL)) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t] ON [l].[Id] = [t].[Level1_Optional_Id]"); } @@ -5247,9 +5247,9 @@ LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[Level2_Name], [l0].[OneToMany_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id] FROM [Level1] AS [l0] INNER JOIN [Level1] AS [l1] ON [l0].[Id] = [l1].[Id] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL)) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t] ON [l].[Id] = [t].[Level1_Optional_Id] -WHERE ([t].[Level2_Name] <> N'L2 05') OR [t].[Level2_Name] IS NULL"); +WHERE ([t].[Level2_Name] <> N'L2 05') OR ([t].[Level2_Name] IS NULL)"); } public override async Task GroupJoin_on_right_side_being_a_subquery(bool async) @@ -5260,16 +5260,16 @@ public override async Task GroupJoin_on_right_side_being_a_subquery(bool async) @"@__p_0='2' SELECT CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + WHEN (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] END AS [Id], [t0].[Name] FROM [Level1] AS [l] LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l0] INNER JOIN [Level1] AS [l1] ON [l0].[Id] = [l1].[Id] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL)) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t] ON [l].[Id] = CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + WHEN (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] END LEFT JOIN ( SELECT TOP(@__p_0) [l2].[Id], [l2].[Name] @@ -5278,11 +5278,11 @@ LEFT JOIN ( SELECT [l3].[Level1_Optional_Id], [l3].[Level2_Name] FROM [Level1] AS [l3] INNER JOIN [Level1] AS [l4] ON [l3].[Id] = [l4].[Id] - WHERE ([l3].[OneToOne_Required_PK_Date] IS NOT NULL AND [l3].[Level1_Required_Id] IS NOT NULL) AND [l3].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l3].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l3].[Level1_Required_Id] IS NOT NULL)) AND ([l3].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t1] ON [l2].[Id] = [t1].[Level1_Optional_Id] ORDER BY [t1].[Level2_Name] ) AS [t0] ON [t].[Level1_Optional_Id] = [t0].[Id] -WHERE ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL"); +WHERE (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL)"); } public override async Task Multiple_SelectMany_with_string_based_Include(bool async) @@ -5296,7 +5296,7 @@ INNER JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Required_Id], [l0].[OneToMany_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l0] INNER JOIN [Level1] AS [l1] ON [l0].[Id] = [l1].[Id] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL)) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t] ON [l].[Id] = [t].[OneToMany_Optional_Inverse2Id] INNER JOIN ( SELECT [l2].[Id], [l2].[Level2_Optional_Id], [l2].[Level2_Required_Id], [l2].[Level3_Name], [l2].[OneToMany_Optional_Inverse3Id], [l2].[OneToMany_Required_Inverse3Id], [l2].[OneToOne_Optional_PK_Inverse3Id] @@ -5305,11 +5305,11 @@ INNER JOIN ( SELECT [l3].[Id] FROM [Level1] AS [l3] INNER JOIN [Level1] AS [l4] ON [l3].[Id] = [l4].[Id] - WHERE ([l3].[OneToOne_Required_PK_Date] IS NOT NULL AND [l3].[Level1_Required_Id] IS NOT NULL) AND [l3].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l3].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l3].[Level1_Required_Id] IS NOT NULL)) AND ([l3].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t1] ON [l2].[Id] = [t1].[Id] - WHERE [l2].[Level2_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l2].[Level2_Required_Id] IS NOT NULL) AND ([l2].[OneToMany_Required_Inverse3Id] IS NOT NULL) ) AS [t0] ON CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + WHEN (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] END = [t0].[OneToMany_Optional_Inverse3Id] LEFT JOIN ( SELECT [l5].[Id], [l5].[Level3_Optional_Id], [l5].[Level3_Required_Id], [l5].[Level4_Name], [l5].[OneToMany_Optional_Inverse4Id], [l5].[OneToMany_Required_Inverse4Id], [l5].[OneToOne_Optional_PK_Inverse4Id] @@ -5321,13 +5321,13 @@ INNER JOIN ( SELECT [l7].[Id] FROM [Level1] AS [l7] INNER JOIN [Level1] AS [l8] ON [l7].[Id] = [l8].[Id] - WHERE ([l7].[OneToOne_Required_PK_Date] IS NOT NULL AND [l7].[Level1_Required_Id] IS NOT NULL) AND [l7].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l7].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l7].[Level1_Required_Id] IS NOT NULL)) AND ([l7].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t4] ON [l6].[Id] = [t4].[Id] - WHERE [l6].[Level2_Required_Id] IS NOT NULL AND [l6].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l6].[Level2_Required_Id] IS NOT NULL) AND ([l6].[OneToMany_Required_Inverse3Id] IS NOT NULL) ) AS [t3] ON [l5].[Id] = [t3].[Id] - WHERE [l5].[Level3_Required_Id] IS NOT NULL AND [l5].[OneToMany_Required_Inverse4Id] IS NOT NULL + WHERE ([l5].[Level3_Required_Id] IS NOT NULL) AND ([l5].[OneToMany_Required_Inverse4Id] IS NOT NULL) ) AS [t2] ON CASE - WHEN [t0].[Level2_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [t0].[Id] + WHEN ([t0].[Level2_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [t0].[Id] END = [t2].[Level3_Required_Id]"); } @@ -5342,9 +5342,9 @@ LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Required_Id], [l0].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l0] INNER JOIN [Level1] AS [l1] ON [l0].[Id] = [l1].[Id] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL)) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t] ON [l].[Id] = CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + WHEN (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] END LEFT JOIN ( SELECT [l2].[Id], [l2].[Level2_Optional_Id], [l2].[Level2_Required_Id], [l2].[Level3_Name], [l2].[OneToMany_Optional_Inverse3Id], [l2].[OneToMany_Required_Inverse3Id], [l2].[OneToOne_Optional_PK_Inverse3Id] @@ -5353,38 +5353,38 @@ INNER JOIN ( SELECT [l3].[Id] FROM [Level1] AS [l3] INNER JOIN [Level1] AS [l4] ON [l3].[Id] = [l4].[Id] - WHERE ([l3].[OneToOne_Required_PK_Date] IS NOT NULL AND [l3].[Level1_Required_Id] IS NOT NULL) AND [l3].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l3].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l3].[Level1_Required_Id] IS NOT NULL)) AND ([l3].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t1] ON [l2].[Id] = [t1].[Id] - WHERE [l2].[Level2_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l2].[Level2_Required_Id] IS NOT NULL) AND ([l2].[OneToMany_Required_Inverse3Id] IS NOT NULL) ) AS [t0] ON CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + WHEN (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] END = CASE - WHEN [t0].[Level2_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [t0].[Id] + WHEN ([t0].[Level2_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [t0].[Id] END LEFT JOIN ( SELECT [l5].[Id], [l5].[OneToOne_Required_PK_Date], [l5].[Level1_Required_Id], [l5].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l5] INNER JOIN [Level1] AS [l6] ON [l5].[Id] = [l6].[Id] - WHERE ([l5].[OneToOne_Required_PK_Date] IS NOT NULL AND [l5].[Level1_Required_Id] IS NOT NULL) AND [l5].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l5].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l5].[Level1_Required_Id] IS NOT NULL)) AND ([l5].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t2] ON [t0].[Level2_Required_Id] = CASE - WHEN ([t2].[OneToOne_Required_PK_Date] IS NOT NULL AND [t2].[Level1_Required_Id] IS NOT NULL) AND [t2].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t2].[Id] + WHEN (([t2].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t2].[Level1_Required_Id] IS NOT NULL)) AND ([t2].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t2].[Id] END -WHERE ((([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL) AND ([t0].[Level2_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse3Id] IS NOT NULL)) AND (( +WHERE (((([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL)) AND (([t0].[Level2_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse3Id] IS NOT NULL))) AND (( SELECT COUNT(*) FROM [Level1] AS [l7] INNER JOIN ( SELECT [l8].[Id], [l8].[OneToOne_Required_PK_Date], [l8].[Level1_Optional_Id], [l8].[Level1_Required_Id], [l8].[Level2_Name], [l8].[OneToMany_Optional_Inverse2Id], [l8].[OneToMany_Required_Inverse2Id], [l8].[OneToOne_Optional_PK_Inverse2Id], [l9].[Id] AS [Id0] FROM [Level1] AS [l8] INNER JOIN [Level1] AS [l9] ON [l8].[Id] = [l9].[Id] - WHERE ([l8].[OneToOne_Required_PK_Date] IS NOT NULL AND [l8].[Level1_Required_Id] IS NOT NULL) AND [l8].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l8].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l8].[Level1_Required_Id] IS NOT NULL)) AND ([l8].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t3] ON [l7].[Id] = [t3].[Id] - WHERE ([l7].[Level2_Required_Id] IS NOT NULL AND [l7].[OneToMany_Required_Inverse3Id] IS NOT NULL) AND (CASE - WHEN ([t2].[OneToOne_Required_PK_Date] IS NOT NULL AND [t2].[Level1_Required_Id] IS NOT NULL) AND [t2].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t2].[Id] - END IS NOT NULL AND ((CASE - WHEN ([t2].[OneToOne_Required_PK_Date] IS NOT NULL AND [t2].[Level1_Required_Id] IS NOT NULL) AND [t2].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t2].[Id] - END = [l7].[OneToMany_Optional_Inverse3Id]) OR (CASE - WHEN ([t2].[OneToOne_Required_PK_Date] IS NOT NULL AND [t2].[Level1_Required_Id] IS NOT NULL) AND [t2].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t2].[Id] - END IS NULL AND [l7].[OneToMany_Optional_Inverse3Id] IS NULL)))) > 0)"); + WHERE (([l7].[Level2_Required_Id] IS NOT NULL) AND ([l7].[OneToMany_Required_Inverse3Id] IS NOT NULL)) AND ((CASE + WHEN (([t2].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t2].[Level1_Required_Id] IS NOT NULL)) AND ([t2].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t2].[Id] + END IS NOT NULL) AND ((CASE + WHEN (([t2].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t2].[Level1_Required_Id] IS NOT NULL)) AND ([t2].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t2].[Id] + END = [l7].[OneToMany_Optional_Inverse3Id]) OR ((CASE + WHEN (([t2].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t2].[Level1_Required_Id] IS NOT NULL)) AND ([t2].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t2].[Id] + END IS NULL) AND ([l7].[OneToMany_Optional_Inverse3Id] IS NULL))))) > 0)"); } public override async Task GroupJoin_in_subquery_with_client_projection(bool async) @@ -5404,11 +5404,11 @@ LEFT JOIN ( SELECT [l2].[Id], [l2].[OneToOne_Required_PK_Date], [l2].[Level1_Optional_Id], [l2].[Level1_Required_Id], [l2].[Level2_Name], [l2].[OneToMany_Optional_Inverse2Id], [l2].[OneToMany_Required_Inverse2Id], [l2].[OneToOne_Optional_PK_Inverse2Id], [l3].[Id] AS [Id0] FROM [Level1] AS [l2] INNER JOIN [Level1] AS [l3] ON [l2].[Id] = [l3].[Id] - WHERE ([l2].[OneToOne_Required_PK_Date] IS NOT NULL AND [l2].[Level1_Required_Id] IS NOT NULL) AND [l2].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l2].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l2].[Level1_Required_Id] IS NOT NULL)) AND ([l2].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t] ON [l1].[Id] = CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + WHEN (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] END - WHERE ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t0] ON [l0].[Id] = [t0].[Level1_Optional_Id]) > 7) AND ([l].[Id] < 3)"); } @@ -5423,9 +5423,9 @@ LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Required_Id], [l0].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l0] INNER JOIN [Level1] AS [l1] ON [l0].[Id] = [l1].[Id] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL)) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t] ON [l].[Id] = CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + WHEN (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] END LEFT JOIN ( SELECT [l2].[Id], [l2].[Level2_Required_Id], [l2].[OneToMany_Required_Inverse3Id] @@ -5434,28 +5434,28 @@ INNER JOIN ( SELECT [l3].[Id] FROM [Level1] AS [l3] INNER JOIN [Level1] AS [l4] ON [l3].[Id] = [l4].[Id] - WHERE ([l3].[OneToOne_Required_PK_Date] IS NOT NULL AND [l3].[Level1_Required_Id] IS NOT NULL) AND [l3].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l3].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l3].[Level1_Required_Id] IS NOT NULL)) AND ([l3].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t1] ON [l2].[Id] = [t1].[Id] - WHERE [l2].[Level2_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l2].[Level2_Required_Id] IS NOT NULL) AND ([l2].[OneToMany_Required_Inverse3Id] IS NOT NULL) ) AS [t0] ON CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + WHEN (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] END = CASE - WHEN [t0].[Level2_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [t0].[Id] + WHEN ([t0].[Level2_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [t0].[Id] END INNER JOIN [Level1] AS [l5] ON CASE - WHEN [t0].[Level2_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [t0].[Id] + WHEN ([t0].[Level2_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [t0].[Id] END = ( SELECT TOP(1) CASE - WHEN [t3].[Level2_Required_Id] IS NOT NULL AND [t3].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [t3].[Id1] + WHEN ([t3].[Level2_Required_Id] IS NOT NULL) AND ([t3].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [t3].[Id1] END FROM [Level1] AS [l6] LEFT JOIN ( SELECT [l7].[Id], [l7].[OneToOne_Required_PK_Date], [l7].[Level1_Optional_Id], [l7].[Level1_Required_Id], [l7].[Level2_Name], [l7].[OneToMany_Optional_Inverse2Id], [l7].[OneToMany_Required_Inverse2Id], [l7].[OneToOne_Optional_PK_Inverse2Id], [l8].[Id] AS [Id0] FROM [Level1] AS [l7] INNER JOIN [Level1] AS [l8] ON [l7].[Id] = [l8].[Id] - WHERE ([l7].[OneToOne_Required_PK_Date] IS NOT NULL AND [l7].[Level1_Required_Id] IS NOT NULL) AND [l7].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l7].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l7].[Level1_Required_Id] IS NOT NULL)) AND ([l7].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t2] ON [l6].[Id] = CASE - WHEN ([t2].[OneToOne_Required_PK_Date] IS NOT NULL AND [t2].[Level1_Required_Id] IS NOT NULL) AND [t2].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t2].[Id] + WHEN (([t2].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t2].[Level1_Required_Id] IS NOT NULL)) AND ([t2].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t2].[Id] END LEFT JOIN ( SELECT [l9].[Id], [l9].[Date], [l9].[Name], [t4].[Id] AS [Id0], [t4].[OneToOne_Required_PK_Date], [t4].[Level1_Optional_Id], [t4].[Level1_Required_Id], [t4].[Level2_Name], [t4].[OneToMany_Optional_Inverse2Id], [t4].[OneToMany_Required_Inverse2Id], [t4].[OneToOne_Optional_PK_Inverse2Id], [t5].[Id] AS [Id1], [t5].[Level2_Optional_Id], [t5].[Level2_Required_Id], [t5].[Level3_Name], [t5].[OneToMany_Optional_Inverse3Id], [t5].[OneToMany_Required_Inverse3Id], [t5].[OneToOne_Optional_PK_Inverse3Id], [t4].[Id0] AS [Id00], [t5].[Id0] AS [Id01], [t5].[Id00] AS [Id000] @@ -5464,9 +5464,9 @@ LEFT JOIN ( SELECT [l10].[Id], [l10].[OneToOne_Required_PK_Date], [l10].[Level1_Optional_Id], [l10].[Level1_Required_Id], [l10].[Level2_Name], [l10].[OneToMany_Optional_Inverse2Id], [l10].[OneToMany_Required_Inverse2Id], [l10].[OneToOne_Optional_PK_Inverse2Id], [l11].[Id] AS [Id0] FROM [Level1] AS [l10] INNER JOIN [Level1] AS [l11] ON [l10].[Id] = [l11].[Id] - WHERE ([l10].[OneToOne_Required_PK_Date] IS NOT NULL AND [l10].[Level1_Required_Id] IS NOT NULL) AND [l10].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l10].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l10].[Level1_Required_Id] IS NOT NULL)) AND ([l10].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t4] ON [l9].[Id] = CASE - WHEN ([t4].[OneToOne_Required_PK_Date] IS NOT NULL AND [t4].[Level1_Required_Id] IS NOT NULL) AND [t4].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t4].[Id] + WHEN (([t4].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t4].[Level1_Required_Id] IS NOT NULL)) AND ([t4].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t4].[Id] END LEFT JOIN ( SELECT [l12].[Id], [l12].[Level2_Optional_Id], [l12].[Level2_Required_Id], [l12].[Level3_Name], [l12].[OneToMany_Optional_Inverse3Id], [l12].[OneToMany_Required_Inverse3Id], [l12].[OneToOne_Optional_PK_Inverse3Id], [t6].[Id] AS [Id0], [t6].[Id0] AS [Id00] @@ -5475,23 +5475,23 @@ INNER JOIN ( SELECT [l13].[Id], [l13].[OneToOne_Required_PK_Date], [l13].[Level1_Optional_Id], [l13].[Level1_Required_Id], [l13].[Level2_Name], [l13].[OneToMany_Optional_Inverse2Id], [l13].[OneToMany_Required_Inverse2Id], [l13].[OneToOne_Optional_PK_Inverse2Id], [l14].[Id] AS [Id0] FROM [Level1] AS [l13] INNER JOIN [Level1] AS [l14] ON [l13].[Id] = [l14].[Id] - WHERE ([l13].[OneToOne_Required_PK_Date] IS NOT NULL AND [l13].[Level1_Required_Id] IS NOT NULL) AND [l13].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l13].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l13].[Level1_Required_Id] IS NOT NULL)) AND ([l13].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t6] ON [l12].[Id] = [t6].[Id] - WHERE [l12].[Level2_Required_Id] IS NOT NULL AND [l12].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l12].[Level2_Required_Id] IS NOT NULL) AND ([l12].[OneToMany_Required_Inverse3Id] IS NOT NULL) ) AS [t5] ON CASE - WHEN ([t4].[OneToOne_Required_PK_Date] IS NOT NULL AND [t4].[Level1_Required_Id] IS NOT NULL) AND [t4].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t4].[Id] + WHEN (([t4].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t4].[Level1_Required_Id] IS NOT NULL)) AND ([t4].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t4].[Id] END = CASE - WHEN [t5].[Level2_Required_Id] IS NOT NULL AND [t5].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [t5].[Id] + WHEN ([t5].[Level2_Required_Id] IS NOT NULL) AND ([t5].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [t5].[Id] END - WHERE (([t4].[OneToOne_Required_PK_Date] IS NOT NULL AND [t4].[Level1_Required_Id] IS NOT NULL) AND [t4].[OneToMany_Required_Inverse2Id] IS NOT NULL) AND ([t5].[Level2_Required_Id] IS NOT NULL AND [t5].[OneToMany_Required_Inverse3Id] IS NOT NULL) + WHERE ((([t4].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t4].[Level1_Required_Id] IS NOT NULL)) AND ([t4].[OneToMany_Required_Inverse2Id] IS NOT NULL)) AND (([t5].[Level2_Required_Id] IS NOT NULL) AND ([t5].[OneToMany_Required_Inverse3Id] IS NOT NULL)) ) AS [t3] ON CASE - WHEN ([t2].[OneToOne_Required_PK_Date] IS NOT NULL AND [t2].[Level1_Required_Id] IS NOT NULL) AND [t2].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t2].[Id] + WHEN (([t2].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t2].[Level1_Required_Id] IS NOT NULL)) AND ([t2].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t2].[Id] END = [t3].[Level2_Optional_Id] - WHERE ([t2].[OneToOne_Required_PK_Date] IS NOT NULL AND [t2].[Level1_Required_Id] IS NOT NULL) AND [t2].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([t2].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t2].[Level1_Required_Id] IS NOT NULL)) AND ([t2].[OneToMany_Required_Inverse2Id] IS NOT NULL) ORDER BY CASE - WHEN [t3].[Level2_Required_Id] IS NOT NULL AND [t3].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [t3].[Id1] + WHEN ([t3].[Level2_Required_Id] IS NOT NULL) AND ([t3].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [t3].[Id1] END) -WHERE (([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL) AND ([t0].[Level2_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse3Id] IS NOT NULL)"); +WHERE ((([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL)) AND (([t0].[Level2_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse3Id] IS NOT NULL))"); } public override async Task Join_navigation_deeply_nested_required(bool async) @@ -5500,7 +5500,7 @@ public override async Task Join_navigation_deeply_nested_required(bool async) AssertSql( @"SELECT CASE - WHEN [t8].[Level3_Required_Id] IS NOT NULL AND [t8].[OneToMany_Required_Inverse4Id] IS NOT NULL THEN [t8].[Id2] + WHEN ([t8].[Level3_Required_Id] IS NOT NULL) AND ([t8].[OneToMany_Required_Inverse4Id] IS NOT NULL) THEN [t8].[Id2] END AS [Id4], [t8].[Level4_Name] AS [Name4], [l].[Id] AS [Id1], [l].[Name] AS [Name1] FROM [Level1] AS [l] INNER JOIN ( @@ -5510,9 +5510,9 @@ LEFT JOIN ( SELECT [l1].[Id], [l1].[OneToOne_Required_PK_Date], [l1].[Level1_Required_Id], [l1].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l1] INNER JOIN [Level1] AS [l2] ON [l1].[Id] = [l2].[Id] - WHERE ([l1].[OneToOne_Required_PK_Date] IS NOT NULL AND [l1].[Level1_Required_Id] IS NOT NULL) AND [l1].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l1].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l1].[Level1_Required_Id] IS NOT NULL)) AND ([l1].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t] ON [l0].[Id] = CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + WHEN (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] END LEFT JOIN ( SELECT [l3].[Id], [l3].[Level2_Required_Id], [l3].[OneToMany_Required_Inverse3Id] @@ -5521,13 +5521,13 @@ INNER JOIN ( SELECT [l4].[Id] FROM [Level1] AS [l4] INNER JOIN [Level1] AS [l5] ON [l4].[Id] = [l5].[Id] - WHERE ([l4].[OneToOne_Required_PK_Date] IS NOT NULL AND [l4].[Level1_Required_Id] IS NOT NULL) AND [l4].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l4].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l4].[Level1_Required_Id] IS NOT NULL)) AND ([l4].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t1] ON [l3].[Id] = [t1].[Id] - WHERE [l3].[Level2_Required_Id] IS NOT NULL AND [l3].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l3].[Level2_Required_Id] IS NOT NULL) AND ([l3].[OneToMany_Required_Inverse3Id] IS NOT NULL) ) AS [t0] ON CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + WHEN (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] END = CASE - WHEN [t0].[Level2_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [t0].[Id] + WHEN ([t0].[Level2_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [t0].[Id] END LEFT JOIN ( SELECT [l6].[Id], [l6].[Level3_Required_Id], [l6].[Level4_Name], [l6].[OneToMany_Required_Inverse4Id] @@ -5539,15 +5539,15 @@ INNER JOIN ( SELECT [l8].[Id] FROM [Level1] AS [l8] INNER JOIN [Level1] AS [l9] ON [l8].[Id] = [l9].[Id] - WHERE ([l8].[OneToOne_Required_PK_Date] IS NOT NULL AND [l8].[Level1_Required_Id] IS NOT NULL) AND [l8].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l8].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l8].[Level1_Required_Id] IS NOT NULL)) AND ([l8].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t4] ON [l7].[Id] = [t4].[Id] - WHERE [l7].[Level2_Required_Id] IS NOT NULL AND [l7].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l7].[Level2_Required_Id] IS NOT NULL) AND ([l7].[OneToMany_Required_Inverse3Id] IS NOT NULL) ) AS [t3] ON [l6].[Id] = [t3].[Id] - WHERE [l6].[Level3_Required_Id] IS NOT NULL AND [l6].[OneToMany_Required_Inverse4Id] IS NOT NULL + WHERE ([l6].[Level3_Required_Id] IS NOT NULL) AND ([l6].[OneToMany_Required_Inverse4Id] IS NOT NULL) ) AS [t2] ON CASE - WHEN [t0].[Level2_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [t0].[Id] + WHEN ([t0].[Level2_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [t0].[Id] END = CASE - WHEN [t2].[Level3_Required_Id] IS NOT NULL AND [t2].[OneToMany_Required_Inverse4Id] IS NOT NULL THEN [t2].[Id] + WHEN ([t2].[Level3_Required_Id] IS NOT NULL) AND ([t2].[OneToMany_Required_Inverse4Id] IS NOT NULL) THEN [t2].[Id] END LEFT JOIN ( SELECT [l10].[Id], [l10].[Level2_Required_Id], [l10].[OneToMany_Required_Inverse3Id] @@ -5556,24 +5556,24 @@ INNER JOIN ( SELECT [l11].[Id] FROM [Level1] AS [l11] INNER JOIN [Level1] AS [l12] ON [l11].[Id] = [l12].[Id] - WHERE ([l11].[OneToOne_Required_PK_Date] IS NOT NULL AND [l11].[Level1_Required_Id] IS NOT NULL) AND [l11].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l11].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l11].[Level1_Required_Id] IS NOT NULL)) AND ([l11].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t6] ON [l10].[Id] = [t6].[Id] - WHERE [l10].[Level2_Required_Id] IS NOT NULL AND [l10].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l10].[Level2_Required_Id] IS NOT NULL) AND ([l10].[OneToMany_Required_Inverse3Id] IS NOT NULL) ) AS [t5] ON [t2].[Level3_Required_Id] = CASE - WHEN [t5].[Level2_Required_Id] IS NOT NULL AND [t5].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [t5].[Id] + WHEN ([t5].[Level2_Required_Id] IS NOT NULL) AND ([t5].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [t5].[Id] END LEFT JOIN ( SELECT [l13].[Id], [l13].[OneToOne_Required_PK_Date], [l13].[Level1_Required_Id], [l13].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l13] INNER JOIN [Level1] AS [l15] ON [l13].[Id] = [l15].[Id] - WHERE ([l13].[OneToOne_Required_PK_Date] IS NOT NULL AND [l13].[Level1_Required_Id] IS NOT NULL) AND [l13].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l13].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l13].[Level1_Required_Id] IS NOT NULL)) AND ([l13].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t7] ON [t5].[Level2_Required_Id] = CASE - WHEN ([t7].[OneToOne_Required_PK_Date] IS NOT NULL AND [t7].[Level1_Required_Id] IS NOT NULL) AND [t7].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t7].[Id] + WHEN (([t7].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t7].[Level1_Required_Id] IS NOT NULL)) AND ([t7].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t7].[Id] END LEFT JOIN [Level1] AS [l14] ON CASE - WHEN ([t7].[OneToOne_Required_PK_Date] IS NOT NULL AND [t7].[Level1_Required_Id] IS NOT NULL) AND [t7].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t7].[Id] + WHEN (([t7].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t7].[Level1_Required_Id] IS NOT NULL)) AND ([t7].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t7].[Id] END = [l14].[Id] - WHERE ((([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL) AND ([t0].[Level2_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse3Id] IS NOT NULL)) AND ([t2].[Level3_Required_Id] IS NOT NULL AND [t2].[OneToMany_Required_Inverse4Id] IS NOT NULL) + WHERE (((([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL)) AND (([t0].[Level2_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse3Id] IS NOT NULL))) AND (([t2].[Level3_Required_Id] IS NOT NULL) AND ([t2].[OneToMany_Required_Inverse4Id] IS NOT NULL)) ) AS [t8] ON [l].[Name] = [t8].[Name0]"); } @@ -5590,7 +5590,7 @@ LEFT JOIN ( SELECT [l0].[Level1_Required_Id], [l0].[Level2_Name] FROM [Level1] AS [l0] INNER JOIN [Level1] AS [l1] ON [l0].[Id] = [l1].[Id] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL)) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t] ON [l].[Id] = [t].[Level1_Required_Id] WHERE [t].[Level2_Name] = N'L2 03' ORDER BY [l].[Id]"); @@ -5607,26 +5607,26 @@ LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Required_Id], [l0].[Level2_Name], [l0].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l0] INNER JOIN [Level1] AS [l1] ON [l0].[Id] = [l1].[Id] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL)) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t] ON [l].[Id] = CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + WHEN (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] END -WHERE (([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL) AND EXISTS ( +WHERE ((([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL)) AND EXISTS ( SELECT 1 FROM [Level1] AS [l2] INNER JOIN ( SELECT [l3].[Id], [l3].[OneToOne_Required_PK_Date], [l3].[Level1_Optional_Id], [l3].[Level1_Required_Id], [l3].[Level2_Name], [l3].[OneToMany_Optional_Inverse2Id], [l3].[OneToMany_Required_Inverse2Id], [l3].[OneToOne_Optional_PK_Inverse2Id], [l4].[Id] AS [Id0] FROM [Level1] AS [l3] INNER JOIN [Level1] AS [l4] ON [l3].[Id] = [l4].[Id] - WHERE ([l3].[OneToOne_Required_PK_Date] IS NOT NULL AND [l3].[Level1_Required_Id] IS NOT NULL) AND [l3].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l3].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l3].[Level1_Required_Id] IS NOT NULL)) AND ([l3].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t0] ON [l2].[Id] = [t0].[Id] - WHERE ([l2].[Level2_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse3Id] IS NOT NULL) AND (CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] - END IS NOT NULL AND ((CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] - END = [l2].[OneToMany_Optional_Inverse3Id]) OR (CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] - END IS NULL AND [l2].[OneToMany_Optional_Inverse3Id] IS NULL))))"); + WHERE (([l2].[Level2_Required_Id] IS NOT NULL) AND ([l2].[OneToMany_Required_Inverse3Id] IS NOT NULL)) AND ((CASE + WHEN (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] + END IS NOT NULL) AND ((CASE + WHEN (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] + END = [l2].[OneToMany_Optional_Inverse3Id]) OR ((CASE + WHEN (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] + END IS NULL) AND ([l2].[OneToMany_Optional_Inverse3Id] IS NULL)))))"); } public override async Task Where_multiple_nav_prop_reference_optional_compared_to_null5(bool async) @@ -5640,7 +5640,7 @@ LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l0] INNER JOIN [Level1] AS [l1] ON [l0].[Id] = [l1].[Id] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL)) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t] ON [l].[Id] = [t].[Level1_Optional_Id] LEFT JOIN ( SELECT [l2].[Id], [l2].[Level2_Required_Id], [l2].[OneToMany_Required_Inverse3Id] @@ -5649,11 +5649,11 @@ INNER JOIN ( SELECT [l3].[Id] FROM [Level1] AS [l3] INNER JOIN [Level1] AS [l4] ON [l3].[Id] = [l4].[Id] - WHERE ([l3].[OneToOne_Required_PK_Date] IS NOT NULL AND [l3].[Level1_Required_Id] IS NOT NULL) AND [l3].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l3].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l3].[Level1_Required_Id] IS NOT NULL)) AND ([l3].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t1] ON [l2].[Id] = [t1].[Id] - WHERE [l2].[Level2_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l2].[Level2_Required_Id] IS NOT NULL) AND ([l2].[OneToMany_Required_Inverse3Id] IS NOT NULL) ) AS [t0] ON CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + WHEN (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] END = [t0].[Level2_Required_Id] LEFT JOIN ( SELECT [l5].[Level3_Required_Id], [l5].[OneToMany_Required_Inverse4Id] @@ -5665,15 +5665,15 @@ INNER JOIN ( SELECT [l7].[Id] FROM [Level1] AS [l7] INNER JOIN [Level1] AS [l8] ON [l7].[Id] = [l8].[Id] - WHERE ([l7].[OneToOne_Required_PK_Date] IS NOT NULL AND [l7].[Level1_Required_Id] IS NOT NULL) AND [l7].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l7].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l7].[Level1_Required_Id] IS NOT NULL)) AND ([l7].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t4] ON [l6].[Id] = [t4].[Id] - WHERE [l6].[Level2_Required_Id] IS NOT NULL AND [l6].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l6].[Level2_Required_Id] IS NOT NULL) AND ([l6].[OneToMany_Required_Inverse3Id] IS NOT NULL) ) AS [t3] ON [l5].[Id] = [t3].[Id] - WHERE [l5].[Level3_Required_Id] IS NOT NULL AND [l5].[OneToMany_Required_Inverse4Id] IS NOT NULL + WHERE ([l5].[Level3_Required_Id] IS NOT NULL) AND ([l5].[OneToMany_Required_Inverse4Id] IS NOT NULL) ) AS [t2] ON CASE - WHEN [t0].[Level2_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [t0].[Id] + WHEN ([t0].[Level2_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [t0].[Id] END = [t2].[Level3_Required_Id] -WHERE [t2].[Level3_Required_Id] IS NULL OR [t2].[OneToMany_Required_Inverse4Id] IS NULL"); +WHERE ([t2].[Level3_Required_Id] IS NULL) OR ([t2].[OneToMany_Required_Inverse4Id] IS NULL)"); } public override async Task Where_on_multilevel_reference_in_subquery_with_outer_projection(bool async) @@ -5690,9 +5690,9 @@ LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Required_Id], [l0].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l0] INNER JOIN [Level1] AS [l1] ON [l0].[Id] = [l1].[Id] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL)) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t] ON [l].[Id] = CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + WHEN (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] END LEFT JOIN ( SELECT [l2].[Id], [l2].[Level2_Required_Id], [l2].[Level3_Name], [l2].[OneToMany_Required_Inverse3Id] @@ -5701,24 +5701,24 @@ INNER JOIN ( SELECT [l3].[Id] FROM [Level1] AS [l3] INNER JOIN [Level1] AS [l4] ON [l3].[Id] = [l4].[Id] - WHERE ([l3].[OneToOne_Required_PK_Date] IS NOT NULL AND [l3].[Level1_Required_Id] IS NOT NULL) AND [l3].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l3].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l3].[Level1_Required_Id] IS NOT NULL)) AND ([l3].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t1] ON [l2].[Id] = [t1].[Id] - WHERE [l2].[Level2_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l2].[Level2_Required_Id] IS NOT NULL) AND ([l2].[OneToMany_Required_Inverse3Id] IS NOT NULL) ) AS [t0] ON CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + WHEN (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] END = CASE - WHEN [t0].[Level2_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [t0].[Id] + WHEN ([t0].[Level2_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [t0].[Id] END LEFT JOIN ( SELECT [l5].[Id], [l5].[OneToOne_Required_PK_Date], [l5].[Level1_Required_Id], [l5].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l5] INNER JOIN [Level1] AS [l6] ON [l5].[Id] = [l6].[Id] - WHERE ([l5].[OneToOne_Required_PK_Date] IS NOT NULL AND [l5].[Level1_Required_Id] IS NOT NULL) AND [l5].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l5].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l5].[Level1_Required_Id] IS NOT NULL)) AND ([l5].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t2] ON [t0].[OneToMany_Required_Inverse3Id] = CASE - WHEN ([t2].[OneToOne_Required_PK_Date] IS NOT NULL AND [t2].[Level1_Required_Id] IS NOT NULL) AND [t2].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t2].[Id] + WHEN (([t2].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t2].[Level1_Required_Id] IS NOT NULL)) AND ([t2].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t2].[Id] END LEFT JOIN [Level1] AS [l7] ON [t2].[Level1_Required_Id] = [l7].[Id] -WHERE ((([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL) AND ([t0].[Level2_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse3Id] IS NOT NULL)) AND ([l7].[Name] = N'L1 03') +WHERE (((([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL)) AND (([t0].[Level2_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse3Id] IS NOT NULL))) AND ([l7].[Name] = N'L1 03') ORDER BY [t0].[Level2_Required_Id] OFFSET @__p_0 ROWS FETCH NEXT @__p_1 ROWS ONLY"); } @@ -5737,9 +5737,9 @@ LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Required_Id], [l0].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l0] INNER JOIN [Level1] AS [l1] ON [l0].[Id] = [l1].[Id] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL)) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t] ON [l].[Id] = CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + WHEN (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] END INNER JOIN [Level1] AS [l2] ON [t].[Level1_Required_Id] = [l2].[Id] INNER JOIN ( @@ -5749,9 +5749,9 @@ LEFT JOIN ( SELECT [l4].[Id], [l4].[OneToOne_Required_PK_Date], [l4].[Level1_Required_Id], [l4].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l4] INNER JOIN [Level1] AS [l5] ON [l4].[Id] = [l5].[Id] - WHERE ([l4].[OneToOne_Required_PK_Date] IS NOT NULL AND [l4].[Level1_Required_Id] IS NOT NULL) AND [l4].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l4].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l4].[Level1_Required_Id] IS NOT NULL)) AND ([l4].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t0] ON [l3].[Id] = CASE - WHEN ([t0].[OneToOne_Required_PK_Date] IS NOT NULL AND [t0].[Level1_Required_Id] IS NOT NULL) AND [t0].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t0].[Id] + WHEN (([t0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t0].[Level1_Required_Id] IS NOT NULL)) AND ([t0].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t0].[Id] END LEFT JOIN ( SELECT [l6].[Id], [l6].[Level2_Required_Id], [l6].[Level3_Name], [l6].[OneToMany_Required_Inverse3Id] @@ -5760,17 +5760,17 @@ INNER JOIN ( SELECT [l7].[Id] FROM [Level1] AS [l7] INNER JOIN [Level1] AS [l8] ON [l7].[Id] = [l8].[Id] - WHERE ([l7].[OneToOne_Required_PK_Date] IS NOT NULL AND [l7].[Level1_Required_Id] IS NOT NULL) AND [l7].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l7].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l7].[Level1_Required_Id] IS NOT NULL)) AND ([l7].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t3] ON [l6].[Id] = [t3].[Id] - WHERE [l6].[Level2_Required_Id] IS NOT NULL AND [l6].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l6].[Level2_Required_Id] IS NOT NULL) AND ([l6].[OneToMany_Required_Inverse3Id] IS NOT NULL) ) AS [t1] ON CASE - WHEN ([t0].[OneToOne_Required_PK_Date] IS NOT NULL AND [t0].[Level1_Required_Id] IS NOT NULL) AND [t0].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t0].[Id] + WHEN (([t0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t0].[Level1_Required_Id] IS NOT NULL)) AND ([t0].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t0].[Id] END = CASE - WHEN [t1].[Level2_Required_Id] IS NOT NULL AND [t1].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [t1].[Id] + WHEN ([t1].[Level2_Required_Id] IS NOT NULL) AND ([t1].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [t1].[Id] END - WHERE (([t0].[OneToOne_Required_PK_Date] IS NOT NULL AND [t0].[Level1_Required_Id] IS NOT NULL) AND [t0].[OneToMany_Required_Inverse2Id] IS NOT NULL) AND ([t1].[Level2_Required_Id] IS NOT NULL AND [t1].[OneToMany_Required_Inverse3Id] IS NOT NULL) + WHERE ((([t0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t0].[Level1_Required_Id] IS NOT NULL)) AND ([t0].[OneToMany_Required_Inverse2Id] IS NOT NULL)) AND (([t1].[Level2_Required_Id] IS NOT NULL) AND ([t1].[OneToMany_Required_Inverse3Id] IS NOT NULL)) ) AS [t2] ON [l2].[Id] = [t2].[Level2_Required_Id] -WHERE ((([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL) AND ([l2].[Name] = N'L1 03')) AND ([t2].[Level3_Name] = N'L3 08') +WHERE (((([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL)) AND ([l2].[Name] = N'L1 03')) AND ([t2].[Level3_Name] = N'L3 08') ORDER BY [l2].[Id]"); } @@ -5785,7 +5785,7 @@ LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[Level2_Name], [l0].[OneToMany_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id] FROM [Level1] AS [l0] INNER JOIN [Level1] AS [l1] ON [l0].[Id] = [l1].[Id] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL)) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t] ON [l].[Id] = [t].[Level1_Optional_Id] LEFT JOIN ( SELECT [l2].[Id], [l2].[Level2_Optional_Id], [l2].[Level2_Required_Id], [l2].[Level3_Name], [l2].[OneToMany_Optional_Inverse3Id], [l2].[OneToMany_Required_Inverse3Id], [l2].[OneToOne_Optional_PK_Inverse3Id] @@ -5794,11 +5794,11 @@ INNER JOIN ( SELECT [l3].[Id] FROM [Level1] AS [l3] INNER JOIN [Level1] AS [l4] ON [l3].[Id] = [l4].[Id] - WHERE ([l3].[OneToOne_Required_PK_Date] IS NOT NULL AND [l3].[Level1_Required_Id] IS NOT NULL) AND [l3].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l3].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l3].[Level1_Required_Id] IS NOT NULL)) AND ([l3].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t1] ON [l2].[Id] = [t1].[Id] - WHERE [l2].[Level2_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l2].[Level2_Required_Id] IS NOT NULL) AND ([l2].[OneToMany_Required_Inverse3Id] IS NOT NULL) ) AS [t0] ON CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + WHEN (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] END = [t0].[OneToOne_Optional_PK_Inverse3Id]"); } @@ -5813,7 +5813,7 @@ LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[Level2_Name], [l0].[OneToMany_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id] FROM [Level1] AS [l0] INNER JOIN [Level1] AS [l1] ON [l0].[Id] = [l1].[Id] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL)) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t] ON [l].[Id] = [t].[OneToOne_Optional_PK_Inverse2Id]"); } @@ -5831,9 +5831,9 @@ LEFT JOIN ( SELECT [l1].[Id], [l1].[OneToOne_Required_PK_Date], [l1].[Level1_Optional_Id], [l1].[Level1_Required_Id], [l1].[Level2_Name], [l1].[OneToMany_Optional_Inverse2Id], [l1].[OneToMany_Required_Inverse2Id], [l1].[OneToOne_Optional_PK_Inverse2Id], [l2].[Id] AS [Id0] FROM [Level1] AS [l1] INNER JOIN [Level1] AS [l2] ON [l1].[Id] = [l2].[Id] - WHERE ([l1].[OneToOne_Required_PK_Date] IS NOT NULL AND [l1].[Level1_Required_Id] IS NOT NULL) AND [l1].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l1].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l1].[Level1_Required_Id] IS NOT NULL)) AND ([l1].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t] ON [l0].[Id] = CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + WHEN (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] END LEFT JOIN ( SELECT [l3].[Id], [l3].[Level2_Optional_Id], [l3].[Level2_Required_Id], [l3].[Level3_Name], [l3].[OneToMany_Optional_Inverse3Id], [l3].[OneToMany_Required_Inverse3Id], [l3].[OneToOne_Optional_PK_Inverse3Id], [t1].[Id] AS [Id0], [t1].[Id0] AS [Id00] @@ -5842,18 +5842,18 @@ INNER JOIN ( SELECT [l4].[Id], [l4].[OneToOne_Required_PK_Date], [l4].[Level1_Optional_Id], [l4].[Level1_Required_Id], [l4].[Level2_Name], [l4].[OneToMany_Optional_Inverse2Id], [l4].[OneToMany_Required_Inverse2Id], [l4].[OneToOne_Optional_PK_Inverse2Id], [l5].[Id] AS [Id0] FROM [Level1] AS [l4] INNER JOIN [Level1] AS [l5] ON [l4].[Id] = [l5].[Id] - WHERE ([l4].[OneToOne_Required_PK_Date] IS NOT NULL AND [l4].[Level1_Required_Id] IS NOT NULL) AND [l4].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l4].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l4].[Level1_Required_Id] IS NOT NULL)) AND ([l4].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t1] ON [l3].[Id] = [t1].[Id] - WHERE [l3].[Level2_Required_Id] IS NOT NULL AND [l3].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l3].[Level2_Required_Id] IS NOT NULL) AND ([l3].[OneToMany_Required_Inverse3Id] IS NOT NULL) ) AS [t0] ON CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + WHEN (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] END = CASE - WHEN [t0].[Level2_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [t0].[Id] + WHEN ([t0].[Level2_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [t0].[Id] END - WHERE (([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL) AND ([t0].[Level2_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse3Id] IS NOT NULL) + WHERE ((([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL)) AND (([t0].[Level2_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse3Id] IS NOT NULL)) ) AS [t2] ORDER BY CASE - WHEN [t2].[Level2_Required_Id] IS NOT NULL AND [t2].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [t2].[Id] + WHEN ([t2].[Level2_Required_Id] IS NOT NULL) AND ([t2].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [t2].[Id] END OFFSET 1 ROWS FETCH NEXT 1 ROWS ONLY) FROM [Level1] AS [l] @@ -5874,20 +5874,20 @@ LEFT JOIN ( SELECT [l1].[Id], [l1].[OneToOne_Required_PK_Date], [l1].[Level1_Optional_Id], [l1].[Level1_Required_Id], [l1].[Level2_Name], [l1].[OneToMany_Optional_Inverse2Id], [l1].[OneToMany_Required_Inverse2Id], [l1].[OneToOne_Optional_PK_Inverse2Id], [l2].[Id] AS [Id0] FROM [Level1] AS [l1] INNER JOIN [Level1] AS [l2] ON [l1].[Id] = [l2].[Id] - WHERE ([l1].[OneToOne_Required_PK_Date] IS NOT NULL AND [l1].[Level1_Required_Id] IS NOT NULL) AND [l1].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l1].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l1].[Level1_Required_Id] IS NOT NULL)) AND ([l1].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t] ON [l0].[Id] = CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + WHEN (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] END - WHERE (([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL) AND EXISTS ( + WHERE ((([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL)) AND EXISTS ( SELECT 1 FROM [Level1] AS [l3] LEFT JOIN ( SELECT [l4].[Id], [l4].[OneToOne_Required_PK_Date], [l4].[Level1_Optional_Id], [l4].[Level1_Required_Id], [l4].[Level2_Name], [l4].[OneToMany_Optional_Inverse2Id], [l4].[OneToMany_Required_Inverse2Id], [l4].[OneToOne_Optional_PK_Inverse2Id], [l5].[Id] AS [Id0] FROM [Level1] AS [l4] INNER JOIN [Level1] AS [l5] ON [l4].[Id] = [l5].[Id] - WHERE ([l4].[OneToOne_Required_PK_Date] IS NOT NULL AND [l4].[Level1_Required_Id] IS NOT NULL) AND [l4].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l4].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l4].[Level1_Required_Id] IS NOT NULL)) AND ([l4].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t0] ON [l3].[Id] = CASE - WHEN ([t0].[OneToOne_Required_PK_Date] IS NOT NULL AND [t0].[Level1_Required_Id] IS NOT NULL) AND [t0].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t0].[Id] + WHEN (([t0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t0].[Level1_Required_Id] IS NOT NULL)) AND ([t0].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t0].[Id] END LEFT JOIN ( SELECT [l6].[Id], [l6].[Level2_Optional_Id], [l6].[Level2_Required_Id], [l6].[Level3_Name], [l6].[OneToMany_Optional_Inverse3Id], [l6].[OneToMany_Required_Inverse3Id], [l6].[OneToOne_Optional_PK_Inverse3Id], [t2].[Id] AS [Id0], [t2].[Id0] AS [Id00] @@ -5896,15 +5896,15 @@ INNER JOIN ( SELECT [l7].[Id], [l7].[OneToOne_Required_PK_Date], [l7].[Level1_Optional_Id], [l7].[Level1_Required_Id], [l7].[Level2_Name], [l7].[OneToMany_Optional_Inverse2Id], [l7].[OneToMany_Required_Inverse2Id], [l7].[OneToOne_Optional_PK_Inverse2Id], [l8].[Id] AS [Id0] FROM [Level1] AS [l7] INNER JOIN [Level1] AS [l8] ON [l7].[Id] = [l8].[Id] - WHERE ([l7].[OneToOne_Required_PK_Date] IS NOT NULL AND [l7].[Level1_Required_Id] IS NOT NULL) AND [l7].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l7].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l7].[Level1_Required_Id] IS NOT NULL)) AND ([l7].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t2] ON [l6].[Id] = [t2].[Id] - WHERE [l6].[Level2_Required_Id] IS NOT NULL AND [l6].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l6].[Level2_Required_Id] IS NOT NULL) AND ([l6].[OneToMany_Required_Inverse3Id] IS NOT NULL) ) AS [t1] ON CASE - WHEN ([t0].[OneToOne_Required_PK_Date] IS NOT NULL AND [t0].[Level1_Required_Id] IS NOT NULL) AND [t0].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t0].[Id] + WHEN (([t0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t0].[Level1_Required_Id] IS NOT NULL)) AND ([t0].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t0].[Id] END = CASE - WHEN [t1].[Level2_Required_Id] IS NOT NULL AND [t1].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [t1].[Id] + WHEN ([t1].[Level2_Required_Id] IS NOT NULL) AND ([t1].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [t1].[Id] END - WHERE (([t0].[OneToOne_Required_PK_Date] IS NOT NULL AND [t0].[Level1_Required_Id] IS NOT NULL) AND [t0].[OneToMany_Required_Inverse2Id] IS NOT NULL) AND ([t1].[Level2_Required_Id] IS NOT NULL AND [t1].[OneToMany_Required_Inverse3Id] IS NOT NULL)))"); + WHERE ((([t0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t0].[Level1_Required_Id] IS NOT NULL)) AND ([t0].[OneToMany_Required_Inverse2Id] IS NOT NULL)) AND (([t1].[Level2_Required_Id] IS NOT NULL) AND ([t1].[OneToMany_Required_Inverse3Id] IS NOT NULL))))"); } public override async Task Order_by_key_of_projected_navigation_doesnt_get_optimized_into_FK_access3(bool async) @@ -5918,9 +5918,9 @@ LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Required_Id], [l0].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l0] INNER JOIN [Level1] AS [l1] ON [l0].[Id] = [l1].[Id] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL)) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t] ON [l].[Id] = CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + WHEN (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] END LEFT JOIN ( SELECT [l2].[Id], [l2].[Level2_Required_Id], [l2].[OneToMany_Required_Inverse3Id] @@ -5929,25 +5929,25 @@ INNER JOIN ( SELECT [l3].[Id] FROM [Level1] AS [l3] INNER JOIN [Level1] AS [l4] ON [l3].[Id] = [l4].[Id] - WHERE ([l3].[OneToOne_Required_PK_Date] IS NOT NULL AND [l3].[Level1_Required_Id] IS NOT NULL) AND [l3].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l3].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l3].[Level1_Required_Id] IS NOT NULL)) AND ([l3].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t1] ON [l2].[Id] = [t1].[Id] - WHERE [l2].[Level2_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l2].[Level2_Required_Id] IS NOT NULL) AND ([l2].[OneToMany_Required_Inverse3Id] IS NOT NULL) ) AS [t0] ON CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + WHEN (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] END = CASE - WHEN [t0].[Level2_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [t0].[Id] + WHEN ([t0].[Level2_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [t0].[Id] END LEFT JOIN ( SELECT [l5].[Id], [l5].[OneToOne_Required_PK_Date], [l5].[Level1_Optional_Id], [l5].[Level1_Required_Id], [l5].[Level2_Name], [l5].[OneToMany_Optional_Inverse2Id], [l5].[OneToMany_Required_Inverse2Id], [l5].[OneToOne_Optional_PK_Inverse2Id] FROM [Level1] AS [l5] INNER JOIN [Level1] AS [l6] ON [l5].[Id] = [l6].[Id] - WHERE ([l5].[OneToOne_Required_PK_Date] IS NOT NULL AND [l5].[Level1_Required_Id] IS NOT NULL) AND [l5].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l5].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l5].[Level1_Required_Id] IS NOT NULL)) AND ([l5].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t2] ON [t0].[Level2_Required_Id] = CASE - WHEN ([t2].[OneToOne_Required_PK_Date] IS NOT NULL AND [t2].[Level1_Required_Id] IS NOT NULL) AND [t2].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t2].[Id] + WHEN (([t2].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t2].[Level1_Required_Id] IS NOT NULL)) AND ([t2].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t2].[Id] END -WHERE (([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL) AND ([t0].[Level2_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse3Id] IS NOT NULL) +WHERE ((([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL)) AND (([t0].[Level2_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse3Id] IS NOT NULL)) ORDER BY CASE - WHEN ([t2].[OneToOne_Required_PK_Date] IS NOT NULL AND [t2].[Level1_Required_Id] IS NOT NULL) AND [t2].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t2].[Id] + WHEN (([t2].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t2].[Level1_Required_Id] IS NOT NULL)) AND ([t2].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t2].[Id] END"); } @@ -5957,14 +5957,14 @@ public override async Task Select_nav_prop_reference_optional2(bool async) AssertSql( @"SELECT CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + WHEN (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] END FROM [Level1] AS [l] LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l0] INNER JOIN [Level1] AS [l1] ON [l0].[Id] = [l1].[Id] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL)) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t] ON [l].[Id] = [t].[Level1_Optional_Id]"); } @@ -5979,9 +5979,9 @@ LEFT JOIN ( SELECT [l0].[Level1_Optional_Id], [l0].[Level2_Name] FROM [Level1] AS [l0] INNER JOIN [Level1] AS [l1] ON [l0].[Id] = [l1].[Id] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL)) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t] ON [l].[Id] = [t].[Level1_Optional_Id] -WHERE [t].[Level2_Name] NOT IN (N'Name1', N'Name2') OR [t].[Level2_Name] IS NULL"); +WHERE [t].[Level2_Name] NOT IN (N'Name1', N'Name2') OR ([t].[Level2_Name] IS NULL)"); } public override async Task Where_multiple_nav_prop_reference_optional_compared_to_null4(bool async) @@ -5995,9 +5995,9 @@ LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Required_Id], [l0].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l0] INNER JOIN [Level1] AS [l1] ON [l0].[Id] = [l1].[Id] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL)) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t] ON [l].[Id] = CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + WHEN (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] END LEFT JOIN ( SELECT [l2].[Id], [l2].[Level2_Optional_Id], [l2].[Level2_Required_Id], [l2].[Level3_Name], [l2].[OneToMany_Optional_Inverse3Id], [l2].[OneToMany_Required_Inverse3Id], [l2].[OneToOne_Optional_PK_Inverse3Id] @@ -6006,24 +6006,24 @@ INNER JOIN ( SELECT [l3].[Id] FROM [Level1] AS [l3] INNER JOIN [Level1] AS [l4] ON [l3].[Id] = [l4].[Id] - WHERE ([l3].[OneToOne_Required_PK_Date] IS NOT NULL AND [l3].[Level1_Required_Id] IS NOT NULL) AND [l3].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l3].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l3].[Level1_Required_Id] IS NOT NULL)) AND ([l3].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t1] ON [l2].[Id] = [t1].[Id] - WHERE [l2].[Level2_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l2].[Level2_Required_Id] IS NOT NULL) AND ([l2].[OneToMany_Required_Inverse3Id] IS NOT NULL) ) AS [t0] ON CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + WHEN (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] END = CASE - WHEN [t0].[Level2_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [t0].[Id] + WHEN ([t0].[Level2_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [t0].[Id] END LEFT JOIN ( SELECT [l5].[Id], [l5].[OneToOne_Required_PK_Date], [l5].[Level1_Optional_Id], [l5].[Level1_Required_Id], [l5].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l5] INNER JOIN [Level1] AS [l6] ON [l5].[Id] = [l6].[Id] - WHERE ([l5].[OneToOne_Required_PK_Date] IS NOT NULL AND [l5].[Level1_Required_Id] IS NOT NULL) AND [l5].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l5].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l5].[Level1_Required_Id] IS NOT NULL)) AND ([l5].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t2] ON [t0].[Level2_Optional_Id] = CASE - WHEN ([t2].[OneToOne_Required_PK_Date] IS NOT NULL AND [t2].[Level1_Required_Id] IS NOT NULL) AND [t2].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t2].[Id] + WHEN (([t2].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t2].[Level1_Required_Id] IS NOT NULL)) AND ([t2].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t2].[Id] END LEFT JOIN [Level1] AS [l7] ON [t2].[Level1_Optional_Id] = [l7].[Id] -WHERE ((([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL) AND ([t0].[Level2_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse3Id] IS NOT NULL)) AND [l7].[Id] IS NOT NULL"); +WHERE (((([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL)) AND (([t0].[Level2_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse3Id] IS NOT NULL))) AND ([l7].[Id] IS NOT NULL)"); } public override async Task Multi_include_with_groupby_in_subquery(bool async) @@ -6046,7 +6046,7 @@ LEFT JOIN ( SELECT [l1].[Id], [l1].[OneToOne_Required_PK_Date], [l1].[Level1_Optional_Id], [l1].[Level1_Required_Id], [l1].[Level2_Name], [l1].[OneToMany_Optional_Inverse2Id], [l1].[OneToMany_Required_Inverse2Id], [l1].[OneToOne_Optional_PK_Inverse2Id], [l2].[Id] AS [Id0] FROM [Level1] AS [l1] INNER JOIN [Level1] AS [l2] ON [l1].[Id] = [l2].[Id] - WHERE ([l1].[OneToOne_Required_PK_Date] IS NOT NULL AND [l1].[Level1_Required_Id] IS NOT NULL) AND [l1].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l1].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l1].[Level1_Required_Id] IS NOT NULL)) AND ([l1].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t2] ON [l0].[Id] = [t2].[Level1_Optional_Id] ) AS [t0] WHERE [t0].[row] <= 1 @@ -6058,11 +6058,11 @@ INNER JOIN ( SELECT [l4].[Id], [l5].[Id] AS [Id0] FROM [Level1] AS [l4] INNER JOIN [Level1] AS [l5] ON [l4].[Id] = [l5].[Id] - WHERE ([l4].[OneToOne_Required_PK_Date] IS NOT NULL AND [l4].[Level1_Required_Id] IS NOT NULL) AND [l4].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l4].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l4].[Level1_Required_Id] IS NOT NULL)) AND ([l4].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t4] ON [l3].[Id] = [t4].[Id] - WHERE [l3].[Level2_Required_Id] IS NOT NULL AND [l3].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l3].[Level2_Required_Id] IS NOT NULL) AND ([l3].[OneToMany_Required_Inverse3Id] IS NOT NULL) ) AS [t3] ON CASE - WHEN ([t1].[OneToOne_Required_PK_Date] IS NOT NULL AND [t1].[Level1_Required_Id] IS NOT NULL) AND [t1].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t1].[Id0] + WHEN (([t1].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t1].[Level1_Required_Id] IS NOT NULL)) AND ([t1].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t1].[Id0] END = [t3].[OneToMany_Optional_Inverse3Id] ORDER BY [t].[Name], [t1].[Id], [t1].[Id0], [t1].[Id00], [t3].[Id], [t3].[Id0]"); } @@ -6073,16 +6073,16 @@ public override async Task Join_navigation_deeply_nested_non_key_join(bool async AssertSql( @"SELECT CASE - WHEN [t2].[Level3_Required_Id] IS NOT NULL AND [t2].[OneToMany_Required_Inverse4Id] IS NOT NULL THEN [t2].[Id] + WHEN ([t2].[Level3_Required_Id] IS NOT NULL) AND ([t2].[OneToMany_Required_Inverse4Id] IS NOT NULL) THEN [t2].[Id] END AS [Id4], [t2].[Level4_Name] AS [Name4], [t5].[Id] AS [Id1], [t5].[Name] AS [Name1] FROM [Level1] AS [l] LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Required_Id], [l0].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l0] INNER JOIN [Level1] AS [l1] ON [l0].[Id] = [l1].[Id] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL)) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t] ON [l].[Id] = CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + WHEN (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] END LEFT JOIN ( SELECT [l2].[Id], [l2].[Level2_Required_Id], [l2].[OneToMany_Required_Inverse3Id] @@ -6091,13 +6091,13 @@ INNER JOIN ( SELECT [l3].[Id] FROM [Level1] AS [l3] INNER JOIN [Level1] AS [l4] ON [l3].[Id] = [l4].[Id] - WHERE ([l3].[OneToOne_Required_PK_Date] IS NOT NULL AND [l3].[Level1_Required_Id] IS NOT NULL) AND [l3].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l3].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l3].[Level1_Required_Id] IS NOT NULL)) AND ([l3].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t1] ON [l2].[Id] = [t1].[Id] - WHERE [l2].[Level2_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l2].[Level2_Required_Id] IS NOT NULL) AND ([l2].[OneToMany_Required_Inverse3Id] IS NOT NULL) ) AS [t0] ON CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + WHEN (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] END = CASE - WHEN [t0].[Level2_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [t0].[Id] + WHEN ([t0].[Level2_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [t0].[Id] END LEFT JOIN ( SELECT [l5].[Id], [l5].[Level3_Required_Id], [l5].[Level4_Name], [l5].[OneToMany_Required_Inverse4Id] @@ -6109,15 +6109,15 @@ INNER JOIN ( SELECT [l7].[Id] FROM [Level1] AS [l7] INNER JOIN [Level1] AS [l8] ON [l7].[Id] = [l8].[Id] - WHERE ([l7].[OneToOne_Required_PK_Date] IS NOT NULL AND [l7].[Level1_Required_Id] IS NOT NULL) AND [l7].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l7].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l7].[Level1_Required_Id] IS NOT NULL)) AND ([l7].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t4] ON [l6].[Id] = [t4].[Id] - WHERE [l6].[Level2_Required_Id] IS NOT NULL AND [l6].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l6].[Level2_Required_Id] IS NOT NULL) AND ([l6].[OneToMany_Required_Inverse3Id] IS NOT NULL) ) AS [t3] ON [l5].[Id] = [t3].[Id] - WHERE [l5].[Level3_Required_Id] IS NOT NULL AND [l5].[OneToMany_Required_Inverse4Id] IS NOT NULL + WHERE ([l5].[Level3_Required_Id] IS NOT NULL) AND ([l5].[OneToMany_Required_Inverse4Id] IS NOT NULL) ) AS [t2] ON CASE - WHEN [t0].[Level2_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [t0].[Id] + WHEN ([t0].[Level2_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [t0].[Id] END = CASE - WHEN [t2].[Level3_Required_Id] IS NOT NULL AND [t2].[OneToMany_Required_Inverse4Id] IS NOT NULL THEN [t2].[Id] + WHEN ([t2].[Level3_Required_Id] IS NOT NULL) AND ([t2].[OneToMany_Required_Inverse4Id] IS NOT NULL) THEN [t2].[Id] END INNER JOIN ( SELECT [l9].[Id], [l9].[Name], [t8].[Level4_Name] @@ -6126,7 +6126,7 @@ LEFT JOIN ( SELECT [l10].[Id], [l10].[OneToOne_Required_PK_Date], [l10].[Level1_Required_Id], [l10].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l10] INNER JOIN [Level1] AS [l11] ON [l10].[Id] = [l11].[Id] - WHERE ([l10].[OneToOne_Required_PK_Date] IS NOT NULL AND [l10].[Level1_Required_Id] IS NOT NULL) AND [l10].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l10].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l10].[Level1_Required_Id] IS NOT NULL)) AND ([l10].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t6] ON [l9].[Id] = [t6].[Level1_Required_Id] LEFT JOIN ( SELECT [l12].[Id], [l12].[Level2_Optional_Id], [l12].[Level2_Required_Id], [l12].[OneToMany_Required_Inverse3Id] @@ -6135,11 +6135,11 @@ INNER JOIN ( SELECT [l13].[Id] FROM [Level1] AS [l13] INNER JOIN [Level1] AS [l14] ON [l13].[Id] = [l14].[Id] - WHERE ([l13].[OneToOne_Required_PK_Date] IS NOT NULL AND [l13].[Level1_Required_Id] IS NOT NULL) AND [l13].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l13].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l13].[Level1_Required_Id] IS NOT NULL)) AND ([l13].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t9] ON [l12].[Id] = [t9].[Id] - WHERE [l12].[Level2_Required_Id] IS NOT NULL AND [l12].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l12].[Level2_Required_Id] IS NOT NULL) AND ([l12].[OneToMany_Required_Inverse3Id] IS NOT NULL) ) AS [t7] ON CASE - WHEN ([t6].[OneToOne_Required_PK_Date] IS NOT NULL AND [t6].[Level1_Required_Id] IS NOT NULL) AND [t6].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t6].[Id] + WHEN (([t6].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t6].[Level1_Required_Id] IS NOT NULL)) AND ([t6].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t6].[Id] END = [t7].[Level2_Optional_Id] LEFT JOIN ( SELECT [l15].[Id], [l15].[Level3_Required_Id], [l15].[Level4_Name], [l15].[OneToMany_Required_Inverse4Id] @@ -6151,18 +6151,18 @@ INNER JOIN ( SELECT [l17].[Id] FROM [Level1] AS [l17] INNER JOIN [Level1] AS [l18] ON [l17].[Id] = [l18].[Id] - WHERE ([l17].[OneToOne_Required_PK_Date] IS NOT NULL AND [l17].[Level1_Required_Id] IS NOT NULL) AND [l17].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l17].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l17].[Level1_Required_Id] IS NOT NULL)) AND ([l17].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t11] ON [l16].[Id] = [t11].[Id] - WHERE [l16].[Level2_Required_Id] IS NOT NULL AND [l16].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l16].[Level2_Required_Id] IS NOT NULL) AND ([l16].[OneToMany_Required_Inverse3Id] IS NOT NULL) ) AS [t10] ON [l15].[Id] = [t10].[Id] - WHERE [l15].[Level3_Required_Id] IS NOT NULL AND [l15].[OneToMany_Required_Inverse4Id] IS NOT NULL + WHERE ([l15].[Level3_Required_Id] IS NOT NULL) AND ([l15].[OneToMany_Required_Inverse4Id] IS NOT NULL) ) AS [t8] ON CASE - WHEN [t7].[Level2_Required_Id] IS NOT NULL AND [t7].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [t7].[Id] + WHEN ([t7].[Level2_Required_Id] IS NOT NULL) AND ([t7].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [t7].[Id] END = CASE - WHEN [t8].[Level3_Required_Id] IS NOT NULL AND [t8].[OneToMany_Required_Inverse4Id] IS NOT NULL THEN [t8].[Id] + WHEN ([t8].[Level3_Required_Id] IS NOT NULL) AND ([t8].[OneToMany_Required_Inverse4Id] IS NOT NULL) THEN [t8].[Id] END ) AS [t5] ON [t2].[Level4_Name] = [t5].[Level4_Name] -WHERE ((([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL) AND ([t0].[Level2_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse3Id] IS NOT NULL)) AND ([t2].[Level3_Required_Id] IS NOT NULL AND [t2].[OneToMany_Required_Inverse4Id] IS NOT NULL)"); +WHERE (((([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL)) AND (([t0].[Level2_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse3Id] IS NOT NULL))) AND (([t2].[Level3_Required_Id] IS NOT NULL) AND ([t2].[OneToMany_Required_Inverse4Id] IS NOT NULL))"); } public override async Task Join_navigation_in_outer_selector_translated_to_extra_join_nested(bool async) @@ -6171,14 +6171,14 @@ public override async Task Join_navigation_in_outer_selector_translated_to_extra AssertSql( @"SELECT [l].[Id] AS [Id1], CASE - WHEN [t2].[Level2_Required_Id] IS NOT NULL AND [t2].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [t2].[Id1] + WHEN ([t2].[Level2_Required_Id] IS NOT NULL) AND ([t2].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [t2].[Id1] END AS [Id3] FROM [Level1] AS [l] LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Required_Id], [l0].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l0] INNER JOIN [Level1] AS [l1] ON [l0].[Id] = [l1].[Id] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL)) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t] ON [l].[Id] = [t].[Level1_Required_Id] LEFT JOIN ( SELECT [l2].[Id], [l2].[Level2_Optional_Id], [l2].[Level2_Required_Id], [l2].[OneToMany_Required_Inverse3Id] @@ -6187,11 +6187,11 @@ INNER JOIN ( SELECT [l3].[Id] FROM [Level1] AS [l3] INNER JOIN [Level1] AS [l4] ON [l3].[Id] = [l4].[Id] - WHERE ([l3].[OneToOne_Required_PK_Date] IS NOT NULL AND [l3].[Level1_Required_Id] IS NOT NULL) AND [l3].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l3].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l3].[Level1_Required_Id] IS NOT NULL)) AND ([l3].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t1] ON [l2].[Id] = [t1].[Id] - WHERE [l2].[Level2_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l2].[Level2_Required_Id] IS NOT NULL) AND ([l2].[OneToMany_Required_Inverse3Id] IS NOT NULL) ) AS [t0] ON CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + WHEN (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] END = [t0].[Level2_Optional_Id] INNER JOIN ( SELECT [t4].[Id] AS [Id1], [t4].[Level2_Required_Id], [t4].[OneToMany_Required_Inverse3Id] @@ -6200,9 +6200,9 @@ LEFT JOIN ( SELECT [l6].[Id], [l6].[OneToOne_Required_PK_Date], [l6].[Level1_Required_Id], [l6].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l6] INNER JOIN [Level1] AS [l7] ON [l6].[Id] = [l7].[Id] - WHERE ([l6].[OneToOne_Required_PK_Date] IS NOT NULL AND [l6].[Level1_Required_Id] IS NOT NULL) AND [l6].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l6].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l6].[Level1_Required_Id] IS NOT NULL)) AND ([l6].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t3] ON [l5].[Id] = CASE - WHEN ([t3].[OneToOne_Required_PK_Date] IS NOT NULL AND [t3].[Level1_Required_Id] IS NOT NULL) AND [t3].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t3].[Id] + WHEN (([t3].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t3].[Level1_Required_Id] IS NOT NULL)) AND ([t3].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t3].[Id] END LEFT JOIN ( SELECT [l8].[Id], [l8].[Level2_Required_Id], [l8].[OneToMany_Required_Inverse3Id] @@ -6211,19 +6211,19 @@ INNER JOIN ( SELECT [l9].[Id] FROM [Level1] AS [l9] INNER JOIN [Level1] AS [l10] ON [l9].[Id] = [l10].[Id] - WHERE ([l9].[OneToOne_Required_PK_Date] IS NOT NULL AND [l9].[Level1_Required_Id] IS NOT NULL) AND [l9].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l9].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l9].[Level1_Required_Id] IS NOT NULL)) AND ([l9].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t5] ON [l8].[Id] = [t5].[Id] - WHERE [l8].[Level2_Required_Id] IS NOT NULL AND [l8].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l8].[Level2_Required_Id] IS NOT NULL) AND ([l8].[OneToMany_Required_Inverse3Id] IS NOT NULL) ) AS [t4] ON CASE - WHEN ([t3].[OneToOne_Required_PK_Date] IS NOT NULL AND [t3].[Level1_Required_Id] IS NOT NULL) AND [t3].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t3].[Id] + WHEN (([t3].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t3].[Level1_Required_Id] IS NOT NULL)) AND ([t3].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t3].[Id] END = CASE - WHEN [t4].[Level2_Required_Id] IS NOT NULL AND [t4].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [t4].[Id] + WHEN ([t4].[Level2_Required_Id] IS NOT NULL) AND ([t4].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [t4].[Id] END - WHERE (([t3].[OneToOne_Required_PK_Date] IS NOT NULL AND [t3].[Level1_Required_Id] IS NOT NULL) AND [t3].[OneToMany_Required_Inverse2Id] IS NOT NULL) AND ([t4].[Level2_Required_Id] IS NOT NULL AND [t4].[OneToMany_Required_Inverse3Id] IS NOT NULL) + WHERE ((([t3].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t3].[Level1_Required_Id] IS NOT NULL)) AND ([t3].[OneToMany_Required_Inverse2Id] IS NOT NULL)) AND (([t4].[Level2_Required_Id] IS NOT NULL) AND ([t4].[OneToMany_Required_Inverse3Id] IS NOT NULL)) ) AS [t2] ON CASE - WHEN [t0].[Level2_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [t0].[Id] + WHEN ([t0].[Level2_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [t0].[Id] END = CASE - WHEN [t2].[Level2_Required_Id] IS NOT NULL AND [t2].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [t2].[Id1] + WHEN ([t2].[Level2_Required_Id] IS NOT NULL) AND ([t2].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [t2].[Id1] END"); } @@ -6238,9 +6238,9 @@ LEFT JOIN ( SELECT [l0].[Level1_Optional_Id], [l0].[Level2_Name] FROM [Level1] AS [l0] INNER JOIN [Level1] AS [l1] ON [l0].[Id] = [l1].[Id] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL)) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t] ON [l].[Id] = [t].[Level1_Optional_Id] -WHERE ([t].[Level2_Name] = N'L2 05') OR (([t].[Level2_Name] <> N'L2 42') OR [t].[Level2_Name] IS NULL)"); +WHERE ([t].[Level2_Name] = N'L2 05') OR (([t].[Level2_Name] <> N'L2 42') OR ([t].[Level2_Name] IS NULL))"); } public override async Task GroupJoin_client_method_on_outer(bool async) @@ -6257,11 +6257,11 @@ LEFT JOIN ( SELECT [l1].[Id], [l1].[OneToOne_Required_PK_Date], [l1].[Level1_Optional_Id], [l1].[Level1_Required_Id], [l1].[Level2_Name], [l1].[OneToMany_Optional_Inverse2Id], [l1].[OneToMany_Required_Inverse2Id], [l1].[OneToOne_Optional_PK_Inverse2Id], [l2].[Id] AS [Id0] FROM [Level1] AS [l1] INNER JOIN [Level1] AS [l2] ON [l1].[Id] = [l2].[Id] - WHERE ([l1].[OneToOne_Required_PK_Date] IS NOT NULL AND [l1].[Level1_Required_Id] IS NOT NULL) AND [l1].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l1].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l1].[Level1_Required_Id] IS NOT NULL)) AND ([l1].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t] ON [l0].[Id] = CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + WHEN (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] END - WHERE ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t0] ON [l].[Id] = [t0].[Level1_Optional_Id]"); } @@ -6276,9 +6276,9 @@ LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Required_Id], [l0].[Level2_Name], [l0].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l0] INNER JOIN [Level1] AS [l1] ON [l0].[Id] = [l1].[Id] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL)) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t] ON [l].[Id] = CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + WHEN (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] END LEFT JOIN ( SELECT [l2].[Id], [l2].[Level2_Required_Id], [l2].[OneToMany_Required_Inverse3Id] @@ -6287,11 +6287,11 @@ INNER JOIN ( SELECT [l3].[Id] FROM [Level1] AS [l3] INNER JOIN [Level1] AS [l4] ON [l3].[Id] = [l4].[Id] - WHERE ([l3].[OneToOne_Required_PK_Date] IS NOT NULL AND [l3].[Level1_Required_Id] IS NOT NULL) AND [l3].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l3].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l3].[Level1_Required_Id] IS NOT NULL)) AND ([l3].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t1] ON [l2].[Id] = [t1].[Id] - WHERE [l2].[Level2_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l2].[Level2_Required_Id] IS NOT NULL) AND ([l2].[OneToMany_Required_Inverse3Id] IS NOT NULL) ) AS [t0] ON CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + WHEN (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] END = [t0].[Level2_Required_Id] LEFT JOIN ( SELECT [l5].[Id], [l5].[Level2_Optional_Id], [l5].[Level2_Required_Id], [l5].[Level3_Name], [l5].[OneToMany_Optional_Inverse3Id], [l5].[OneToMany_Required_Inverse3Id], [l5].[OneToOne_Optional_PK_Inverse3Id], [t3].[Id] AS [Id0], [t3].[Id0] AS [Id00] @@ -6300,13 +6300,13 @@ INNER JOIN ( SELECT [l6].[Id], [l7].[Id] AS [Id0] FROM [Level1] AS [l6] INNER JOIN [Level1] AS [l7] ON [l6].[Id] = [l7].[Id] - WHERE ([l6].[OneToOne_Required_PK_Date] IS NOT NULL AND [l6].[Level1_Required_Id] IS NOT NULL) AND [l6].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l6].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l6].[Level1_Required_Id] IS NOT NULL)) AND ([l6].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t3] ON [l5].[Id] = [t3].[Id] - WHERE [l5].[Level2_Required_Id] IS NOT NULL AND [l5].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l5].[Level2_Required_Id] IS NOT NULL) AND ([l5].[OneToMany_Required_Inverse3Id] IS NOT NULL) ) AS [t2] ON CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + WHEN (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] END = [t2].[OneToOne_Optional_PK_Inverse3Id] -WHERE (([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL) AND EXISTS ( +WHERE ((([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL)) AND EXISTS ( SELECT 1 FROM [Level1] AS [l8] INNER JOIN ( @@ -6316,17 +6316,17 @@ INNER JOIN ( SELECT [l10].[Id], [l10].[OneToOne_Required_PK_Date], [l10].[Level1_Optional_Id], [l10].[Level1_Required_Id], [l10].[Level2_Name], [l10].[OneToMany_Optional_Inverse2Id], [l10].[OneToMany_Required_Inverse2Id], [l10].[OneToOne_Optional_PK_Inverse2Id], [l11].[Id] AS [Id0] FROM [Level1] AS [l10] INNER JOIN [Level1] AS [l11] ON [l10].[Id] = [l11].[Id] - WHERE ([l10].[OneToOne_Required_PK_Date] IS NOT NULL AND [l10].[Level1_Required_Id] IS NOT NULL) AND [l10].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l10].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l10].[Level1_Required_Id] IS NOT NULL)) AND ([l10].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t5] ON [l9].[Id] = [t5].[Id] - WHERE [l9].[Level2_Required_Id] IS NOT NULL AND [l9].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l9].[Level2_Required_Id] IS NOT NULL) AND ([l9].[OneToMany_Required_Inverse3Id] IS NOT NULL) ) AS [t4] ON [l8].[Id] = [t4].[Id] - WHERE ([l8].[Level3_Required_Id] IS NOT NULL AND [l8].[OneToMany_Required_Inverse4Id] IS NOT NULL) AND (CASE - WHEN [t0].[Level2_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [t0].[Id] - END IS NOT NULL AND ((CASE - WHEN [t0].[Level2_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [t0].[Id] - END = [l8].[OneToMany_Optional_Inverse4Id]) OR (CASE - WHEN [t0].[Level2_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [t0].[Id] - END IS NULL AND [l8].[OneToMany_Optional_Inverse4Id] IS NULL))))"); + WHERE (([l8].[Level3_Required_Id] IS NOT NULL) AND ([l8].[OneToMany_Required_Inverse4Id] IS NOT NULL)) AND ((CASE + WHEN ([t0].[Level2_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [t0].[Id] + END IS NOT NULL) AND ((CASE + WHEN ([t0].[Level2_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [t0].[Id] + END = [l8].[OneToMany_Optional_Inverse4Id]) OR ((CASE + WHEN ([t0].[Level2_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [t0].[Id] + END IS NULL) AND ([l8].[OneToMany_Optional_Inverse4Id] IS NULL)))))"); } public override async Task Include_multiple_collections_on_same_level(bool async) @@ -6340,13 +6340,13 @@ LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[Level2_Name], [l0].[OneToMany_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id], [l1].[Id] AS [Id0] FROM [Level1] AS [l0] INNER JOIN [Level1] AS [l1] ON [l0].[Id] = [l1].[Id] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL)) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t] ON [l].[Id] = [t].[OneToMany_Optional_Inverse2Id] LEFT JOIN ( SELECT [l2].[Id], [l2].[OneToOne_Required_PK_Date], [l2].[Level1_Optional_Id], [l2].[Level1_Required_Id], [l2].[Level2_Name], [l2].[OneToMany_Optional_Inverse2Id], [l2].[OneToMany_Required_Inverse2Id], [l2].[OneToOne_Optional_PK_Inverse2Id], [l3].[Id] AS [Id0] FROM [Level1] AS [l2] INNER JOIN [Level1] AS [l3] ON [l2].[Id] = [l3].[Id] - WHERE ([l2].[OneToOne_Required_PK_Date] IS NOT NULL AND [l2].[Level1_Required_Id] IS NOT NULL) AND [l2].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l2].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l2].[Level1_Required_Id] IS NOT NULL)) AND ([l2].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t0] ON [l].[Id] = [t0].[OneToMany_Required_Inverse2Id] ORDER BY [l].[Id], [t].[Id], [t].[Id0], [t0].[Id]"); } @@ -6362,12 +6362,12 @@ LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[Level2_Name], [l0].[OneToMany_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id] FROM [Level1] AS [l0] INNER JOIN [Level1] AS [l1] ON [l0].[Id] = [l1].[Id] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL)) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t] ON [l].[Id] = CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + WHEN (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] END LEFT JOIN [Level1] AS [l2] ON [t].[Level1_Required_Id] = [l2].[Id] -WHERE (([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL) AND ([l2].[Id] > 7)"); +WHERE ((([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL)) AND ([l2].[Id] > 7)"); } public override async Task Select_optional_navigation_property_string_concat(bool async) @@ -6376,7 +6376,7 @@ public override async Task Select_optional_navigation_property_string_concat(boo AssertSql( @"SELECT (COALESCE([l].[Name], N'') + N' ') + COALESCE(CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Level2_Name] + WHEN (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Level2_Name] ELSE N'NULL' END, N'') FROM [Level1] AS [l] @@ -6384,7 +6384,7 @@ LEFT JOIN ( SELECT [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Required_Id], [l0].[Level2_Name], [l0].[OneToMany_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l0] INNER JOIN [Level1] AS [l1] ON [l0].[Id] = [l1].[Id] - WHERE (([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) AND ([l0].[Id] > 5) + WHERE ((([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL)) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL)) AND ([l0].[Id] > 5) ) AS [t] ON [l].[Id] = [t].[OneToMany_Optional_Inverse2Id]"); } @@ -6394,16 +6394,16 @@ public override async Task Join_navigation_in_outer_selector_translated_to_extra AssertSql( @"SELECT CASE - WHEN [t0].[Level2_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [t0].[Id] + WHEN ([t0].[Level2_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [t0].[Id] END AS [Id3], [l8].[Id] AS [Id1] FROM [Level1] AS [l] LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Required_Id], [l0].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l0] INNER JOIN [Level1] AS [l1] ON [l0].[Id] = [l1].[Id] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL)) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t] ON [l].[Id] = CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + WHEN (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] END LEFT JOIN ( SELECT [l2].[Id], [l2].[Level2_Required_Id], [l2].[OneToMany_Required_Inverse3Id] @@ -6412,25 +6412,25 @@ INNER JOIN ( SELECT [l3].[Id] FROM [Level1] AS [l3] INNER JOIN [Level1] AS [l4] ON [l3].[Id] = [l4].[Id] - WHERE ([l3].[OneToOne_Required_PK_Date] IS NOT NULL AND [l3].[Level1_Required_Id] IS NOT NULL) AND [l3].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l3].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l3].[Level1_Required_Id] IS NOT NULL)) AND ([l3].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t1] ON [l2].[Id] = [t1].[Id] - WHERE [l2].[Level2_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l2].[Level2_Required_Id] IS NOT NULL) AND ([l2].[OneToMany_Required_Inverse3Id] IS NOT NULL) ) AS [t0] ON CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + WHEN (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] END = CASE - WHEN [t0].[Level2_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [t0].[Id] + WHEN ([t0].[Level2_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [t0].[Id] END LEFT JOIN ( SELECT [l5].[Id], [l5].[OneToOne_Required_PK_Date], [l5].[Level1_Optional_Id], [l5].[Level1_Required_Id], [l5].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l5] INNER JOIN [Level1] AS [l6] ON [l5].[Id] = [l6].[Id] - WHERE ([l5].[OneToOne_Required_PK_Date] IS NOT NULL AND [l5].[Level1_Required_Id] IS NOT NULL) AND [l5].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l5].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l5].[Level1_Required_Id] IS NOT NULL)) AND ([l5].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t2] ON [t0].[Level2_Required_Id] = CASE - WHEN ([t2].[OneToOne_Required_PK_Date] IS NOT NULL AND [t2].[Level1_Required_Id] IS NOT NULL) AND [t2].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t2].[Id] + WHEN (([t2].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t2].[Level1_Required_Id] IS NOT NULL)) AND ([t2].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t2].[Id] END LEFT JOIN [Level1] AS [l7] ON [t2].[Level1_Optional_Id] = [l7].[Id] INNER JOIN [Level1] AS [l8] ON [l7].[Id] = [l8].[Id] -WHERE (([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL) AND ([t0].[Level2_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse3Id] IS NOT NULL)"); +WHERE ((([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL)) AND (([t0].[Level2_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse3Id] IS NOT NULL))"); } public override async Task Include19(bool async) @@ -6446,13 +6446,13 @@ LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[Level2_Name], [l0].[OneToMany_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id] FROM [Level1] AS [l0] INNER JOIN [Level1] AS [l1] ON [l0].[Id] = [l1].[Id] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL)) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t] ON [l].[Id] = [t].[Level1_Optional_Id] LEFT JOIN ( SELECT [l2].[Id], [l2].[OneToOne_Required_PK_Date], [l2].[Level1_Optional_Id], [l2].[Level1_Required_Id], [l2].[Level2_Name], [l2].[OneToMany_Optional_Inverse2Id], [l2].[OneToMany_Required_Inverse2Id], [l2].[OneToOne_Optional_PK_Inverse2Id] FROM [Level1] AS [l2] INNER JOIN [Level1] AS [l3] ON [l2].[Id] = [l3].[Id] - WHERE ([l2].[OneToOne_Required_PK_Date] IS NOT NULL AND [l2].[Level1_Required_Id] IS NOT NULL) AND [l2].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l2].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l2].[Level1_Required_Id] IS NOT NULL)) AND ([l2].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t0] ON [l].[Id] = [t0].[OneToOne_Optional_PK_Inverse2Id] ) AS [t1]"); } @@ -6468,7 +6468,7 @@ INNER JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[Level2_Name], [l0].[OneToMany_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id] FROM [Level1] AS [l0] INNER JOIN [Level1] AS [l1] ON [l0].[Id] = [l1].[Id] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL)) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t] ON [l].[Id] = [t].[OneToMany_Optional_Inverse2Id] WHERE [l].[Id] = 1"); } @@ -6487,9 +6487,9 @@ LEFT JOIN ( SELECT [l1].[Id], [l1].[OneToOne_Required_PK_Date], [l1].[Level1_Optional_Id], [l1].[Level1_Required_Id], [l1].[Level2_Name], [l1].[OneToMany_Optional_Inverse2Id], [l1].[OneToMany_Required_Inverse2Id], [l1].[OneToOne_Optional_PK_Inverse2Id], [l2].[Id] AS [Id0] FROM [Level1] AS [l1] INNER JOIN [Level1] AS [l2] ON [l1].[Id] = [l2].[Id] - WHERE ([l1].[OneToOne_Required_PK_Date] IS NOT NULL AND [l1].[Level1_Required_Id] IS NOT NULL) AND [l1].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l1].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l1].[Level1_Required_Id] IS NOT NULL)) AND ([l1].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t] ON [l0].[Id] = CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + WHEN (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] END LEFT JOIN ( SELECT [l3].[Id], [l3].[Level2_Optional_Id], [l3].[Level2_Required_Id], [l3].[Level3_Name], [l3].[OneToMany_Optional_Inverse3Id], [l3].[OneToMany_Required_Inverse3Id], [l3].[OneToOne_Optional_PK_Inverse3Id], [t1].[Id] AS [Id0], [t1].[Id0] AS [Id00] @@ -6498,15 +6498,15 @@ INNER JOIN ( SELECT [l4].[Id], [l4].[OneToOne_Required_PK_Date], [l4].[Level1_Optional_Id], [l4].[Level1_Required_Id], [l4].[Level2_Name], [l4].[OneToMany_Optional_Inverse2Id], [l4].[OneToMany_Required_Inverse2Id], [l4].[OneToOne_Optional_PK_Inverse2Id], [l5].[Id] AS [Id0] FROM [Level1] AS [l4] INNER JOIN [Level1] AS [l5] ON [l4].[Id] = [l5].[Id] - WHERE ([l4].[OneToOne_Required_PK_Date] IS NOT NULL AND [l4].[Level1_Required_Id] IS NOT NULL) AND [l4].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l4].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l4].[Level1_Required_Id] IS NOT NULL)) AND ([l4].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t1] ON [l3].[Id] = [t1].[Id] - WHERE [l3].[Level2_Required_Id] IS NOT NULL AND [l3].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l3].[Level2_Required_Id] IS NOT NULL) AND ([l3].[OneToMany_Required_Inverse3Id] IS NOT NULL) ) AS [t0] ON CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + WHEN (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] END = CASE - WHEN [t0].[Level2_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [t0].[Id] + WHEN ([t0].[Level2_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [t0].[Id] END - WHERE (([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL) AND ([t0].[Level2_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse3Id] IS NOT NULL) + WHERE ((([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL)) AND (([t0].[Level2_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse3Id] IS NOT NULL)) ) AS [t2] ORDER BY (SELECT 1) OFFSET 1 ROWS FETCH NEXT 1 ROWS ONLY) AS [Subquery] @@ -6525,7 +6525,7 @@ LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[Level2_Name], [l0].[OneToMany_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id] FROM [Level1] AS [l0] INNER JOIN [Level1] AS [l1] ON [l0].[Id] = [l1].[Id] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL)) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t] ON [l].[Id] = [t].[Level1_Optional_Id]"); } @@ -6540,9 +6540,9 @@ LEFT JOIN ( SELECT [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l0] INNER JOIN [Level1] AS [l1] ON [l0].[Id] = [l1].[Id] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL)) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t] ON [l].[Id] = [t].[Level1_Optional_Id] -WHERE ([t].[OneToOne_Required_PK_Date] IS NULL OR [t].[Level1_Required_Id] IS NULL) OR [t].[OneToMany_Required_Inverse2Id] IS NULL"); +WHERE (([t].[OneToOne_Required_PK_Date] IS NULL) OR ([t].[Level1_Required_Id] IS NULL)) OR ([t].[OneToMany_Required_Inverse2Id] IS NULL)"); } public override async Task Where_nav_prop_reference_optional2_via_DefaultIfEmpty(bool async) @@ -6559,11 +6559,11 @@ LEFT JOIN ( SELECT [l1].[Id], [l1].[OneToOne_Required_PK_Date], [l1].[Level1_Optional_Id], [l1].[Level1_Required_Id], [l1].[Level2_Name], [l1].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l1] INNER JOIN [Level1] AS [l2] ON [l1].[Id] = [l2].[Id] - WHERE ([l1].[OneToOne_Required_PK_Date] IS NOT NULL AND [l1].[Level1_Required_Id] IS NOT NULL) AND [l1].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l1].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l1].[Level1_Required_Id] IS NOT NULL)) AND ([l1].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t] ON [l0].[Id] = CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + WHEN (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] END - WHERE ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t0] ON [l].[Id] = [t0].[Level1_Optional_Id] LEFT JOIN ( SELECT [t2].[Level1_Optional_Id], [t2].[Level2_Name] @@ -6572,13 +6572,13 @@ LEFT JOIN ( SELECT [l4].[Id], [l4].[OneToOne_Required_PK_Date], [l4].[Level1_Optional_Id], [l4].[Level1_Required_Id], [l4].[Level2_Name], [l4].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l4] INNER JOIN [Level1] AS [l5] ON [l4].[Id] = [l5].[Id] - WHERE ([l4].[OneToOne_Required_PK_Date] IS NOT NULL AND [l4].[Level1_Required_Id] IS NOT NULL) AND [l4].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l4].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l4].[Level1_Required_Id] IS NOT NULL)) AND ([l4].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t2] ON [l3].[Id] = CASE - WHEN ([t2].[OneToOne_Required_PK_Date] IS NOT NULL AND [t2].[Level1_Required_Id] IS NOT NULL) AND [t2].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t2].[Id] + WHEN (([t2].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t2].[Level1_Required_Id] IS NOT NULL)) AND ([t2].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t2].[Id] END - WHERE ([t2].[OneToOne_Required_PK_Date] IS NOT NULL AND [t2].[Level1_Required_Id] IS NOT NULL) AND [t2].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([t2].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t2].[Level1_Required_Id] IS NOT NULL)) AND ([t2].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t1] ON [l].[Id] = [t1].[Level1_Optional_Id] -WHERE ([t0].[Level2_Name] = N'L2 05') OR (([t1].[Level2_Name] <> N'L2 42') OR [t1].[Level2_Name] IS NULL)"); +WHERE ([t0].[Level2_Name] = N'L2 05') OR (([t1].[Level2_Name] <> N'L2 42') OR ([t1].[Level2_Name] IS NULL))"); } public override async Task Result_operator_nav_prop_reference_optional_Average_with_identity_selector(bool async) @@ -6592,7 +6592,7 @@ LEFT JOIN ( SELECT [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id] FROM [Level1] AS [l0] INNER JOIN [Level1] AS [l1] ON [l0].[Id] = [l1].[Id] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL)) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t] ON [l].[Id] = [t].[Level1_Optional_Id]"); } @@ -6607,7 +6607,7 @@ LEFT JOIN ( SELECT [l0].[Level1_Optional_Id], [l0].[Level2_Name] FROM [Level1] AS [l0] INNER JOIN [Level1] AS [l1] ON [l0].[Id] = [l1].[Id] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL)) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t] ON [l].[Id] = [t].[Level1_Optional_Id] WHERE [t].[Level2_Name] = N'L2 01'"); } @@ -6625,10 +6625,10 @@ LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l0] INNER JOIN [Level1] AS [l1] ON [l0].[Id] = [l1].[Id] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL)) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t] ON [l].[Id] = [t].[Level1_Optional_Id] WHERE DATEADD(day, CAST(CAST(CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + WHEN (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] END AS float) AS int), DATEADD(day, CAST(15.0E0 AS int), [t].[OneToOne_Required_PK_Date])) > '2002-02-01T00:00:00.0000000'"); } @@ -6643,12 +6643,12 @@ LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[Level2_Name], [l0].[OneToMany_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id] FROM [Level1] AS [l0] INNER JOIN [Level1] AS [l1] ON [l0].[Id] = [l1].[Id] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL)) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t] ON [l].[Id] = CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + WHEN (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] END LEFT JOIN [Level1] AS [l2] ON [t].[Level1_Required_Id] = [l2].[Id] -WHERE (([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL) AND ([l2].[Id] = 7)"); +WHERE ((([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL)) AND ([l2].[Id] = 7)"); } public override async Task Include_reference_with_groupby_in_subquery(bool async) @@ -6671,7 +6671,7 @@ LEFT JOIN ( SELECT [l1].[Id], [l1].[OneToOne_Required_PK_Date], [l1].[Level1_Optional_Id], [l1].[Level1_Required_Id], [l1].[Level2_Name], [l1].[OneToMany_Optional_Inverse2Id], [l1].[OneToMany_Required_Inverse2Id], [l1].[OneToOne_Optional_PK_Inverse2Id] FROM [Level1] AS [l1] INNER JOIN [Level1] AS [l2] ON [l1].[Id] = [l2].[Id] - WHERE ([l1].[OneToOne_Required_PK_Date] IS NOT NULL AND [l1].[Level1_Required_Id] IS NOT NULL) AND [l1].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l1].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l1].[Level1_Required_Id] IS NOT NULL)) AND ([l1].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t2] ON [l0].[Id] = [t2].[Level1_Optional_Id] ) AS [t0] WHERE [t0].[row] <= 1 @@ -6684,7 +6684,7 @@ public override async Task SelectMany_navigation_comparison2(bool async) AssertSql( @"SELECT [l].[Id] AS [Id1], CASE - WHEN ([t0].[OneToOne_Required_PK_Date] IS NOT NULL AND [t0].[Level1_Required_Id] IS NOT NULL) AND [t0].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t0].[Id] + WHEN (([t0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t0].[Level1_Required_Id] IS NOT NULL)) AND ([t0].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t0].[Id] END AS [Id2] FROM [Level1] AS [l] CROSS JOIN ( @@ -6694,11 +6694,11 @@ LEFT JOIN ( SELECT [l1].[Id], [l1].[OneToOne_Required_PK_Date], [l1].[Level1_Optional_Id], [l1].[Level1_Required_Id], [l1].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l1] INNER JOIN [Level1] AS [l2] ON [l1].[Id] = [l2].[Id] - WHERE ([l1].[OneToOne_Required_PK_Date] IS NOT NULL AND [l1].[Level1_Required_Id] IS NOT NULL) AND [l1].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l1].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l1].[Level1_Required_Id] IS NOT NULL)) AND ([l1].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t] ON [l0].[Id] = CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + WHEN (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] END - WHERE ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t0] LEFT JOIN [Level1] AS [l3] ON [t0].[Level1_Optional_Id] = [l3].[Id] WHERE [l].[Id] = [l3].[Id]"); @@ -6715,10 +6715,10 @@ LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Required_Id], [l0].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l0] INNER JOIN [Level1] AS [l1] ON [l0].[Id] = [l1].[Id] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL)) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t] ON [l].[Id] = [t].[Level1_Required_Id] WHERE CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + WHEN (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] END = 7"); } @@ -6733,7 +6733,7 @@ LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Required_Id], [l0].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l0] INNER JOIN [Level1] AS [l1] ON [l0].[Id] = [l1].[Id] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL)) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t] ON [l].[Id] = [t].[Level1_Required_Id] WHERE ( SELECT COUNT(*) @@ -6742,15 +6742,15 @@ INNER JOIN ( SELECT [l3].[Id], [l3].[OneToOne_Required_PK_Date], [l3].[Level1_Optional_Id], [l3].[Level1_Required_Id], [l3].[Level2_Name], [l3].[OneToMany_Optional_Inverse2Id], [l3].[OneToMany_Required_Inverse2Id], [l3].[OneToOne_Optional_PK_Inverse2Id], [l4].[Id] AS [Id0] FROM [Level1] AS [l3] INNER JOIN [Level1] AS [l4] ON [l3].[Id] = [l4].[Id] - WHERE ([l3].[OneToOne_Required_PK_Date] IS NOT NULL AND [l3].[Level1_Required_Id] IS NOT NULL) AND [l3].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l3].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l3].[Level1_Required_Id] IS NOT NULL)) AND ([l3].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t0] ON [l2].[Id] = [t0].[Id] - WHERE ([l2].[Level2_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse3Id] IS NOT NULL) AND (CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] - END IS NOT NULL AND ((CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] - END = [l2].[OneToMany_Optional_Inverse3Id]) OR (CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] - END IS NULL AND [l2].[OneToMany_Optional_Inverse3Id] IS NULL)))) > 0"); + WHERE (([l2].[Level2_Required_Id] IS NOT NULL) AND ([l2].[OneToMany_Required_Inverse3Id] IS NOT NULL)) AND ((CASE + WHEN (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] + END IS NOT NULL) AND ((CASE + WHEN (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] + END = [l2].[OneToMany_Optional_Inverse3Id]) OR ((CASE + WHEN (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] + END IS NULL) AND ([l2].[OneToMany_Optional_Inverse3Id] IS NULL))))) > 0"); } public override async Task Select_multiple_nav_prop_optional_required(bool async) @@ -6759,14 +6759,14 @@ public override async Task Select_multiple_nav_prop_optional_required(bool async AssertSql( @"SELECT CASE - WHEN [t0].[Level2_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [t0].[Id] + WHEN ([t0].[Level2_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [t0].[Id] END FROM [Level1] AS [l] LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l0] INNER JOIN [Level1] AS [l1] ON [l0].[Id] = [l1].[Id] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL)) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t] ON [l].[Id] = [t].[Level1_Optional_Id] LEFT JOIN ( SELECT [l2].[Id], [l2].[Level2_Required_Id], [l2].[OneToMany_Required_Inverse3Id] @@ -6775,11 +6775,11 @@ INNER JOIN ( SELECT [l3].[Id] FROM [Level1] AS [l3] INNER JOIN [Level1] AS [l4] ON [l3].[Id] = [l4].[Id] - WHERE ([l3].[OneToOne_Required_PK_Date] IS NOT NULL AND [l3].[Level1_Required_Id] IS NOT NULL) AND [l3].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l3].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l3].[Level1_Required_Id] IS NOT NULL)) AND ([l3].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t1] ON [l2].[Id] = [t1].[Id] - WHERE [l2].[Level2_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l2].[Level2_Required_Id] IS NOT NULL) AND ([l2].[OneToMany_Required_Inverse3Id] IS NOT NULL) ) AS [t0] ON CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + WHEN (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] END = [t0].[Level2_Required_Id]"); } @@ -6794,7 +6794,7 @@ LEFT JOIN ( SELECT [l0].[Level1_Optional_Id], [l0].[Level2_Name] FROM [Level1] AS [l0] INNER JOIN [Level1] AS [l1] ON [l0].[Id] = [l1].[Id] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL)) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t] ON [l].[Id] = [t].[Level1_Optional_Id] WHERE [t].[Level2_Name] IN (N'L2 05', N'L2 07')"); } @@ -6817,13 +6817,13 @@ INNER JOIN ( SELECT [l3].[Id] FROM [Level1] AS [l3] INNER JOIN [Level1] AS [l4] ON [l3].[Id] = [l4].[Id] - WHERE ([l3].[OneToOne_Required_PK_Date] IS NOT NULL AND [l3].[Level1_Required_Id] IS NOT NULL) AND [l3].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l3].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l3].[Level1_Required_Id] IS NOT NULL)) AND ([l3].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t] ON [l2].[Id] = [t].[Id] - WHERE [l2].[Level2_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l2].[Level2_Required_Id] IS NOT NULL) AND ([l2].[OneToMany_Required_Inverse3Id] IS NOT NULL) ) AS [t0] ON CASE - WHEN ([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [l0].[Id] + WHEN (([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL)) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [l0].[Id] END = [t0].[Level2_Optional_Id] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL)) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t1] ON [l].[Id] = [t1].[OneToMany_Optional_Inverse2Id]"); } @@ -6833,18 +6833,18 @@ public override async Task Join_navigations_in_inner_selector_translated_without AssertSql( @"SELECT CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + WHEN (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] END AS [Id2], [t0].[Id] AS [Id1], CASE - WHEN [t3].[Level2_Required_Id] IS NOT NULL AND [t3].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [t3].[Id1] + WHEN ([t3].[Level2_Required_Id] IS NOT NULL) AND ([t3].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [t3].[Id1] END AS [Id3] FROM [Level1] AS [l] LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Required_Id], [l0].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l0] INNER JOIN [Level1] AS [l1] ON [l0].[Id] = [l1].[Id] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL)) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t] ON [l].[Id] = CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + WHEN (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] END INNER JOIN ( SELECT [l2].[Id], [t1].[Id] AS [Id0], [t1].[OneToOne_Required_PK_Date], [t1].[Level1_Required_Id], [t1].[OneToMany_Required_Inverse2Id] @@ -6853,12 +6853,12 @@ LEFT JOIN ( SELECT [l3].[Id], [l3].[OneToOne_Required_PK_Date], [l3].[Level1_Optional_Id], [l3].[Level1_Required_Id], [l3].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l3] INNER JOIN [Level1] AS [l4] ON [l3].[Id] = [l4].[Id] - WHERE ([l3].[OneToOne_Required_PK_Date] IS NOT NULL AND [l3].[Level1_Required_Id] IS NOT NULL) AND [l3].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l3].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l3].[Level1_Required_Id] IS NOT NULL)) AND ([l3].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t1] ON [l2].[Id] = [t1].[Level1_Optional_Id] ) AS [t0] ON CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + WHEN (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] END = CASE - WHEN ([t0].[OneToOne_Required_PK_Date] IS NOT NULL AND [t0].[Level1_Required_Id] IS NOT NULL) AND [t0].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t0].[Id0] + WHEN (([t0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t0].[Level1_Required_Id] IS NOT NULL)) AND ([t0].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t0].[Id0] END INNER JOIN ( SELECT [t4].[Id] AS [Id1], [t4].[Level2_Required_Id], [t4].[OneToMany_Required_Inverse3Id], [t5].[Id] AS [Id2], [t5].[OneToOne_Required_PK_Date] AS [OneToOne_Required_PK_Date0], [t5].[Level1_Required_Id] AS [Level1_Required_Id0], [t5].[OneToMany_Required_Inverse2Id] AS [OneToMany_Required_Inverse2Id0] @@ -6867,9 +6867,9 @@ LEFT JOIN ( SELECT [l6].[Id], [l6].[OneToOne_Required_PK_Date], [l6].[Level1_Required_Id], [l6].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l6] INNER JOIN [Level1] AS [l7] ON [l6].[Id] = [l7].[Id] - WHERE ([l6].[OneToOne_Required_PK_Date] IS NOT NULL AND [l6].[Level1_Required_Id] IS NOT NULL) AND [l6].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l6].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l6].[Level1_Required_Id] IS NOT NULL)) AND ([l6].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t2] ON [l5].[Id] = CASE - WHEN ([t2].[OneToOne_Required_PK_Date] IS NOT NULL AND [t2].[Level1_Required_Id] IS NOT NULL) AND [t2].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t2].[Id] + WHEN (([t2].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t2].[Level1_Required_Id] IS NOT NULL)) AND ([t2].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t2].[Id] END LEFT JOIN ( SELECT [l8].[Id], [l8].[Level2_Optional_Id], [l8].[Level2_Required_Id], [l8].[OneToMany_Required_Inverse3Id] @@ -6878,29 +6878,29 @@ INNER JOIN ( SELECT [l9].[Id] FROM [Level1] AS [l9] INNER JOIN [Level1] AS [l10] ON [l9].[Id] = [l10].[Id] - WHERE ([l9].[OneToOne_Required_PK_Date] IS NOT NULL AND [l9].[Level1_Required_Id] IS NOT NULL) AND [l9].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l9].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l9].[Level1_Required_Id] IS NOT NULL)) AND ([l9].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t6] ON [l8].[Id] = [t6].[Id] - WHERE [l8].[Level2_Required_Id] IS NOT NULL AND [l8].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l8].[Level2_Required_Id] IS NOT NULL) AND ([l8].[OneToMany_Required_Inverse3Id] IS NOT NULL) ) AS [t4] ON CASE - WHEN ([t2].[OneToOne_Required_PK_Date] IS NOT NULL AND [t2].[Level1_Required_Id] IS NOT NULL) AND [t2].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t2].[Id] + WHEN (([t2].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t2].[Level1_Required_Id] IS NOT NULL)) AND ([t2].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t2].[Id] END = CASE - WHEN [t4].[Level2_Required_Id] IS NOT NULL AND [t4].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [t4].[Id] + WHEN ([t4].[Level2_Required_Id] IS NOT NULL) AND ([t4].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [t4].[Id] END LEFT JOIN ( SELECT [l11].[Id], [l11].[OneToOne_Required_PK_Date], [l11].[Level1_Required_Id], [l11].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l11] INNER JOIN [Level1] AS [l12] ON [l11].[Id] = [l12].[Id] - WHERE ([l11].[OneToOne_Required_PK_Date] IS NOT NULL AND [l11].[Level1_Required_Id] IS NOT NULL) AND [l11].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l11].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l11].[Level1_Required_Id] IS NOT NULL)) AND ([l11].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t5] ON [t4].[Level2_Optional_Id] = CASE - WHEN ([t5].[OneToOne_Required_PK_Date] IS NOT NULL AND [t5].[Level1_Required_Id] IS NOT NULL) AND [t5].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t5].[Id] + WHEN (([t5].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t5].[Level1_Required_Id] IS NOT NULL)) AND ([t5].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t5].[Id] END - WHERE (([t2].[OneToOne_Required_PK_Date] IS NOT NULL AND [t2].[Level1_Required_Id] IS NOT NULL) AND [t2].[OneToMany_Required_Inverse2Id] IS NOT NULL) AND ([t4].[Level2_Required_Id] IS NOT NULL AND [t4].[OneToMany_Required_Inverse3Id] IS NOT NULL) + WHERE ((([t2].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t2].[Level1_Required_Id] IS NOT NULL)) AND ([t2].[OneToMany_Required_Inverse2Id] IS NOT NULL)) AND (([t4].[Level2_Required_Id] IS NOT NULL) AND ([t4].[OneToMany_Required_Inverse3Id] IS NOT NULL)) ) AS [t3] ON CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + WHEN (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] END = CASE - WHEN ([t3].[OneToOne_Required_PK_Date0] IS NOT NULL AND [t3].[Level1_Required_Id0] IS NOT NULL) AND [t3].[OneToMany_Required_Inverse2Id0] IS NOT NULL THEN [t3].[Id2] + WHEN (([t3].[OneToOne_Required_PK_Date0] IS NOT NULL) AND ([t3].[Level1_Required_Id0] IS NOT NULL)) AND ([t3].[OneToMany_Required_Inverse2Id0] IS NOT NULL) THEN [t3].[Id2] END -WHERE ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL"); +WHERE (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL)"); } public override async Task Optional_navigation_inside_nested_method_call_translated_to_join_keeps_original_nullability(bool async) @@ -6914,7 +6914,7 @@ LEFT JOIN ( SELECT [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id] FROM [Level1] AS [l0] INNER JOIN [Level1] AS [l1] ON [l0].[Id] = [l1].[Id] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL)) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t] ON [l].[Id] = [t].[Level1_Optional_Id] WHERE DATEADD(month, CAST(2 AS int), DATEADD(day, CAST(15.0E0 AS int), DATEADD(day, CAST(10.0E0 AS int), [t].[OneToOne_Required_PK_Date]))) > '2002-02-01T00:00:00.0000000'"); } @@ -6930,7 +6930,7 @@ LEFT JOIN ( SELECT [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id] FROM [Level1] AS [l0] INNER JOIN [Level1] AS [l1] ON [l0].[Id] = [l1].[Id] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL)) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t] ON [l].[Id] = [t].[Level1_Optional_Id]"); } @@ -6951,11 +6951,11 @@ LEFT JOIN ( SELECT [l2].[Id], [l2].[OneToOne_Required_PK_Date], [l2].[Level1_Optional_Id], [l2].[Level1_Required_Id], [l2].[Level2_Name], [l2].[OneToMany_Optional_Inverse2Id], [l2].[OneToMany_Required_Inverse2Id], [l2].[OneToOne_Optional_PK_Inverse2Id], [l3].[Id] AS [Id0] FROM [Level1] AS [l2] INNER JOIN [Level1] AS [l3] ON [l2].[Id] = [l3].[Id] - WHERE ([l2].[OneToOne_Required_PK_Date] IS NOT NULL AND [l2].[Level1_Required_Id] IS NOT NULL) AND [l2].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l2].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l2].[Level1_Required_Id] IS NOT NULL)) AND ([l2].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t] ON [l1].[Id] = CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + WHEN (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] END - WHERE ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t0] ON [l0].[Id] = [t0].[Level1_Optional_Id] WHERE ( SELECT COUNT(*) @@ -6967,11 +6967,11 @@ LEFT JOIN ( SELECT [l6].[Id], [l6].[OneToOne_Required_PK_Date], [l6].[Level1_Optional_Id], [l6].[Level1_Required_Id], [l6].[Level2_Name], [l6].[OneToMany_Optional_Inverse2Id], [l6].[OneToMany_Required_Inverse2Id], [l6].[OneToOne_Optional_PK_Inverse2Id], [l7].[Id] AS [Id0] FROM [Level1] AS [l6] INNER JOIN [Level1] AS [l7] ON [l6].[Id] = [l7].[Id] - WHERE ([l6].[OneToOne_Required_PK_Date] IS NOT NULL AND [l6].[Level1_Required_Id] IS NOT NULL) AND [l6].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l6].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l6].[Level1_Required_Id] IS NOT NULL)) AND ([l6].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t2] ON [l5].[Id] = CASE - WHEN ([t2].[OneToOne_Required_PK_Date] IS NOT NULL AND [t2].[Level1_Required_Id] IS NOT NULL) AND [t2].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t2].[Id] + WHEN (([t2].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t2].[Level1_Required_Id] IS NOT NULL)) AND ([t2].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t2].[Id] END - WHERE ([t2].[OneToOne_Required_PK_Date] IS NOT NULL AND [t2].[Level1_Required_Id] IS NOT NULL) AND [t2].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([t2].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t2].[Level1_Required_Id] IS NOT NULL)) AND ([t2].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t1] ON [l4].[Id] = [t1].[Level1_Optional_Id]) > 7) > 4) AND ([l].[Id] < 2)"); } @@ -6986,9 +6986,9 @@ LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Required_Id], [l0].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l0] INNER JOIN [Level1] AS [l1] ON [l0].[Id] = [l1].[Id] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL)) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t] ON [l].[Id] = CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + WHEN (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] END LEFT JOIN ( SELECT [l2].[Id], [l2].[Level2_Required_Id], [l2].[Level3_Name], [l2].[OneToMany_Required_Inverse3Id] @@ -6997,25 +6997,25 @@ INNER JOIN ( SELECT [l3].[Id] FROM [Level1] AS [l3] INNER JOIN [Level1] AS [l4] ON [l3].[Id] = [l4].[Id] - WHERE ([l3].[OneToOne_Required_PK_Date] IS NOT NULL AND [l3].[Level1_Required_Id] IS NOT NULL) AND [l3].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l3].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l3].[Level1_Required_Id] IS NOT NULL)) AND ([l3].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t1] ON [l2].[Id] = [t1].[Id] - WHERE [l2].[Level2_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l2].[Level2_Required_Id] IS NOT NULL) AND ([l2].[OneToMany_Required_Inverse3Id] IS NOT NULL) ) AS [t0] ON CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + WHEN (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] END = CASE - WHEN [t0].[Level2_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [t0].[Id] + WHEN ([t0].[Level2_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [t0].[Id] END LEFT JOIN ( SELECT [l5].[Id], [l5].[OneToOne_Required_PK_Date], [l5].[Level1_Optional_Id], [l5].[Level1_Required_Id], [l5].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l5] INNER JOIN [Level1] AS [l6] ON [l5].[Id] = [l6].[Id] - WHERE ([l5].[OneToOne_Required_PK_Date] IS NOT NULL AND [l5].[Level1_Required_Id] IS NOT NULL) AND [l5].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l5].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l5].[Level1_Required_Id] IS NOT NULL)) AND ([l5].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t2] ON [t0].[Level2_Required_Id] = CASE - WHEN ([t2].[OneToOne_Required_PK_Date] IS NOT NULL AND [t2].[Level1_Required_Id] IS NOT NULL) AND [t2].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t2].[Id] + WHEN (([t2].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t2].[Level1_Required_Id] IS NOT NULL)) AND ([t2].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t2].[Id] END LEFT JOIN [Level1] AS [l7] ON [t2].[Level1_Required_Id] = [l7].[Id] LEFT JOIN [Level1] AS [l8] ON [t2].[Level1_Optional_Id] = [l8].[Id] -WHERE ((([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL) AND ([t0].[Level2_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse3Id] IS NOT NULL)) AND ((([l7].[Id] = [l8].[Id]) OR ([l7].[Id] IS NULL AND [l8].[Id] IS NULL)) AND (([l8].[Id] <> 7) OR [l8].[Id] IS NULL))"); +WHERE (((([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL)) AND (([t0].[Level2_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse3Id] IS NOT NULL))) AND ((([l7].[Id] = [l8].[Id]) OR (([l7].[Id] IS NULL) AND ([l8].[Id] IS NULL))) AND (([l8].[Id] <> 7) OR ([l8].[Id] IS NULL)))"); } public override async Task Select_subquery_with_client_eval_and_navigation1(bool async) @@ -7030,25 +7030,25 @@ LEFT JOIN ( SELECT [l4].[Id], [l4].[OneToOne_Required_PK_Date], [l4].[Level1_Optional_Id], [l4].[Level1_Required_Id], [l4].[Level2_Name], [l4].[OneToMany_Optional_Inverse2Id], [l4].[OneToMany_Required_Inverse2Id], [l4].[OneToOne_Optional_PK_Inverse2Id], [l5].[Id] AS [Id0] FROM [Level1] AS [l4] INNER JOIN [Level1] AS [l5] ON [l4].[Id] = [l5].[Id] - WHERE ([l4].[OneToOne_Required_PK_Date] IS NOT NULL AND [l4].[Level1_Required_Id] IS NOT NULL) AND [l4].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l4].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l4].[Level1_Required_Id] IS NOT NULL)) AND ([l4].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t0] ON [l2].[Id] = CASE - WHEN ([t0].[OneToOne_Required_PK_Date] IS NOT NULL AND [t0].[Level1_Required_Id] IS NOT NULL) AND [t0].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t0].[Id] + WHEN (([t0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t0].[Level1_Required_Id] IS NOT NULL)) AND ([t0].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t0].[Id] END LEFT JOIN [Level1] AS [l3] ON [t0].[Level1_Required_Id] = [l3].[Id] - WHERE ([t0].[OneToOne_Required_PK_Date] IS NOT NULL AND [t0].[Level1_Required_Id] IS NOT NULL) AND [t0].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([t0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t0].[Level1_Required_Id] IS NOT NULL)) AND ([t0].[OneToMany_Required_Inverse2Id] IS NOT NULL) ORDER BY CASE - WHEN ([t0].[OneToOne_Required_PK_Date] IS NOT NULL AND [t0].[Level1_Required_Id] IS NOT NULL) AND [t0].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t0].[Id] + WHEN (([t0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t0].[Level1_Required_Id] IS NOT NULL)) AND ([t0].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t0].[Id] END) FROM [Level1] AS [l] LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Required_Id], [l0].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l0] INNER JOIN [Level1] AS [l1] ON [l0].[Id] = [l1].[Id] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL)) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t] ON [l].[Id] = CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + WHEN (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] END -WHERE ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL"); +WHERE (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL)"); } public override async Task String_include_multiple_derived_collection_navigation_with_same_name_and_different_type(bool async) @@ -7074,7 +7074,7 @@ LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[Level2_Name], [l0].[OneToMany_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id] FROM [Level1] AS [l0] INNER JOIN [Level1] AS [l1] ON [l0].[Id] = [l1].[Id] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL)) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t] ON [l].[Id] = [t].[Level1_Optional_Id]"); } @@ -7095,11 +7095,11 @@ LEFT JOIN ( SELECT [l2].[Id], [l2].[OneToOne_Required_PK_Date], [l2].[Level1_Optional_Id], [l2].[Level1_Required_Id], [l2].[Level2_Name], [l2].[OneToMany_Optional_Inverse2Id], [l2].[OneToMany_Required_Inverse2Id], [l2].[OneToOne_Optional_PK_Inverse2Id], [l3].[Id] AS [Id0] FROM [Level1] AS [l2] INNER JOIN [Level1] AS [l3] ON [l2].[Id] = [l3].[Id] - WHERE ([l2].[OneToOne_Required_PK_Date] IS NOT NULL AND [l2].[Level1_Required_Id] IS NOT NULL) AND [l2].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l2].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l2].[Level1_Required_Id] IS NOT NULL)) AND ([l2].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t] ON [l1].[Id] = CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + WHEN (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] END - WHERE ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t0] ON [l0].[Id] = [t0].[Level1_Optional_Id]) > 4"); } @@ -7114,9 +7114,9 @@ LEFT JOIN ( SELECT [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Required_Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id] FROM [Level1] AS [l0] INNER JOIN [Level1] AS [l1] ON [l0].[Id] = [l1].[Id] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL)) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t] ON [l].[Id] = [t].[OneToOne_Optional_PK_Inverse2Id] -WHERE ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL"); +WHERE (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL)"); } public override async Task Result_operator_nav_prop_reference_optional_Min(bool async) @@ -7130,7 +7130,7 @@ LEFT JOIN ( SELECT [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id] FROM [Level1] AS [l0] INNER JOIN [Level1] AS [l1] ON [l0].[Id] = [l1].[Id] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL)) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t] ON [l].[Id] = [t].[Level1_Optional_Id]"); } @@ -7145,13 +7145,13 @@ LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[Level2_Name], [l0].[OneToMany_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id] FROM [Level1] AS [l0] INNER JOIN [Level1] AS [l1] ON [l0].[Id] = [l1].[Id] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL)) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t] ON [l].[Id] = CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + WHEN (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] END -WHERE ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL +WHERE (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) ORDER BY CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + WHEN (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] END"); } @@ -7166,9 +7166,9 @@ LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Required_Id], [l0].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l0] INNER JOIN [Level1] AS [l1] ON [l0].[Id] = [l1].[Id] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL)) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t] ON [l].[Id] = CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + WHEN (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] END LEFT JOIN ( SELECT [l2].[Id], [l2].[Level2_Optional_Id], [l2].[Level2_Required_Id], [l2].[Level3_Name], [l2].[OneToMany_Optional_Inverse3Id], [l2].[OneToMany_Required_Inverse3Id], [l2].[OneToOne_Optional_PK_Inverse3Id] @@ -7177,23 +7177,23 @@ INNER JOIN ( SELECT [l3].[Id] FROM [Level1] AS [l3] INNER JOIN [Level1] AS [l4] ON [l3].[Id] = [l4].[Id] - WHERE ([l3].[OneToOne_Required_PK_Date] IS NOT NULL AND [l3].[Level1_Required_Id] IS NOT NULL) AND [l3].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l3].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l3].[Level1_Required_Id] IS NOT NULL)) AND ([l3].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t1] ON [l2].[Id] = [t1].[Id] - WHERE [l2].[Level2_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l2].[Level2_Required_Id] IS NOT NULL) AND ([l2].[OneToMany_Required_Inverse3Id] IS NOT NULL) ) AS [t0] ON CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + WHEN (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] END = CASE - WHEN [t0].[Level2_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [t0].[Id] + WHEN ([t0].[Level2_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [t0].[Id] END LEFT JOIN ( SELECT [l5].[Id], [l5].[OneToOne_Required_PK_Date], [l5].[Level1_Required_Id], [l5].[Level2_Name], [l5].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l5] INNER JOIN [Level1] AS [l6] ON [l5].[Id] = [l6].[Id] - WHERE ([l5].[OneToOne_Required_PK_Date] IS NOT NULL AND [l5].[Level1_Required_Id] IS NOT NULL) AND [l5].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l5].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l5].[Level1_Required_Id] IS NOT NULL)) AND ([l5].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t2] ON [t0].[Level2_Required_Id] = CASE - WHEN ([t2].[OneToOne_Required_PK_Date] IS NOT NULL AND [t2].[Level1_Required_Id] IS NOT NULL) AND [t2].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t2].[Id] + WHEN (([t2].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t2].[Level1_Required_Id] IS NOT NULL)) AND ([t2].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t2].[Id] END -WHERE ((([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL) AND ([t0].[Level2_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse3Id] IS NOT NULL)) AND ([t2].[Level2_Name] IS NOT NULL AND ([t2].[Level2_Name] LIKE N'L%'))"); +WHERE (((([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL)) AND (([t0].[Level2_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse3Id] IS NOT NULL))) AND (([t2].[Level2_Name] IS NOT NULL) AND ([t2].[Level2_Name] LIKE N'L%'))"); } public override async Task Select_nav_prop_reference_optional1_via_DefaultIfEmpty(bool async) @@ -7210,11 +7210,11 @@ LEFT JOIN ( SELECT [l1].[Id], [l1].[OneToOne_Required_PK_Date], [l1].[Level1_Optional_Id], [l1].[Level1_Required_Id], [l1].[Level2_Name], [l1].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l1] INNER JOIN [Level1] AS [l2] ON [l1].[Id] = [l2].[Id] - WHERE ([l1].[OneToOne_Required_PK_Date] IS NOT NULL AND [l1].[Level1_Required_Id] IS NOT NULL) AND [l1].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l1].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l1].[Level1_Required_Id] IS NOT NULL)) AND ([l1].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t] ON [l0].[Id] = CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + WHEN (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] END - WHERE ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t0] ON [l].[Id] = [t0].[Level1_Optional_Id]"); } @@ -7229,7 +7229,7 @@ LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l0] INNER JOIN [Level1] AS [l1] ON [l0].[Id] = [l1].[Id] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL)) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t] ON [l].[Id] = [t].[Level1_Optional_Id] LEFT JOIN ( SELECT [l2].[Level2_Optional_Id], [l2].[Level2_Required_Id], [l2].[OneToMany_Required_Inverse3Id] @@ -7238,13 +7238,13 @@ INNER JOIN ( SELECT [l3].[Id] FROM [Level1] AS [l3] INNER JOIN [Level1] AS [l4] ON [l3].[Id] = [l4].[Id] - WHERE ([l3].[OneToOne_Required_PK_Date] IS NOT NULL AND [l3].[Level1_Required_Id] IS NOT NULL) AND [l3].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l3].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l3].[Level1_Required_Id] IS NOT NULL)) AND ([l3].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t1] ON [l2].[Id] = [t1].[Id] - WHERE [l2].[Level2_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l2].[Level2_Required_Id] IS NOT NULL) AND ([l2].[OneToMany_Required_Inverse3Id] IS NOT NULL) ) AS [t0] ON CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + WHEN (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] END = [t0].[Level2_Optional_Id] -WHERE [t0].[Level2_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse3Id] IS NOT NULL"); +WHERE ([t0].[Level2_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse3Id] IS NOT NULL)"); } public override async Task Navigations_compared_to_each_other1(bool async) @@ -7258,12 +7258,12 @@ LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Required_Id], [l0].[Level2_Name], [l0].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l0] INNER JOIN [Level1] AS [l1] ON [l0].[Id] = [l1].[Id] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL)) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t] ON [l].[Id] = CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + WHEN (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] END LEFT JOIN [Level1] AS [l2] ON [t].[OneToMany_Required_Inverse2Id] = [l2].[Id] -WHERE (([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL) AND (([l2].[Id] = [l2].[Id]) OR [l2].[Id] IS NULL)"); +WHERE ((([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL)) AND (([l2].[Id] = [l2].[Id]) OR ([l2].[Id] IS NULL))"); } public override async Task Optional_navigation_in_subquery_with_unrelated_projection(bool async) @@ -7279,9 +7279,9 @@ LEFT JOIN ( SELECT [l0].[Level1_Optional_Id], [l0].[Level2_Name] FROM [Level1] AS [l0] INNER JOIN [Level1] AS [l1] ON [l0].[Id] = [l1].[Id] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL)) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t] ON [l].[Id] = [t].[Level1_Optional_Id] -WHERE ([t].[Level2_Name] <> N'Foo') OR [t].[Level2_Name] IS NULL +WHERE ([t].[Level2_Name] <> N'Foo') OR ([t].[Level2_Name] IS NULL) ORDER BY [l].[Id]"); } @@ -7299,11 +7299,11 @@ LEFT JOIN ( SELECT [l1].[Id], [l1].[OneToOne_Required_PK_Date], [l1].[Level1_Optional_Id], [l1].[Level1_Required_Id], [l1].[Level2_Name], [l1].[OneToMany_Optional_Inverse2Id], [l1].[OneToMany_Required_Inverse2Id], [l1].[OneToOne_Optional_PK_Inverse2Id], [l2].[Id] AS [Id0] FROM [Level1] AS [l1] INNER JOIN [Level1] AS [l2] ON [l1].[Id] = [l2].[Id] - WHERE ([l1].[OneToOne_Required_PK_Date] IS NOT NULL AND [l1].[Level1_Required_Id] IS NOT NULL) AND [l1].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l1].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l1].[Level1_Required_Id] IS NOT NULL)) AND ([l1].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t] ON [l0].[Id] = CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + WHEN (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] END - WHERE (([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL) AND ([t].[Level1_Required_Id] = [l].[Id]))"); + WHERE ((([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL)) AND ([t].[Level1_Required_Id] = [l].[Id]))"); } public override async Task Select_subquery_with_client_eval_and_navigation2(bool async) @@ -7319,30 +7319,30 @@ LEFT JOIN ( SELECT [l4].[Id], [l4].[OneToOne_Required_PK_Date], [l4].[Level1_Optional_Id], [l4].[Level1_Required_Id], [l4].[Level2_Name], [l4].[OneToMany_Optional_Inverse2Id], [l4].[OneToMany_Required_Inverse2Id], [l4].[OneToOne_Optional_PK_Inverse2Id], [l5].[Id] AS [Id0] FROM [Level1] AS [l4] INNER JOIN [Level1] AS [l5] ON [l4].[Id] = [l5].[Id] - WHERE ([l4].[OneToOne_Required_PK_Date] IS NOT NULL AND [l4].[Level1_Required_Id] IS NOT NULL) AND [l4].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l4].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l4].[Level1_Required_Id] IS NOT NULL)) AND ([l4].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t0] ON [l2].[Id] = CASE - WHEN ([t0].[OneToOne_Required_PK_Date] IS NOT NULL AND [t0].[Level1_Required_Id] IS NOT NULL) AND [t0].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t0].[Id] + WHEN (([t0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t0].[Level1_Required_Id] IS NOT NULL)) AND ([t0].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t0].[Id] END LEFT JOIN [Level1] AS [l3] ON [t0].[Level1_Required_Id] = [l3].[Id] - WHERE ([t0].[OneToOne_Required_PK_Date] IS NOT NULL AND [t0].[Level1_Required_Id] IS NOT NULL) AND [t0].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([t0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t0].[Level1_Required_Id] IS NOT NULL)) AND ([t0].[OneToMany_Required_Inverse2Id] IS NOT NULL) ORDER BY CASE - WHEN ([t0].[OneToOne_Required_PK_Date] IS NOT NULL AND [t0].[Level1_Required_Id] IS NOT NULL) AND [t0].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t0].[Id] - END) = N'L1 02') AND ( + WHEN (([t0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t0].[Level1_Required_Id] IS NOT NULL)) AND ([t0].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t0].[Id] + END) = N'L1 02') AND (( SELECT TOP(1) [l3].[Name] FROM [Level1] AS [l2] LEFT JOIN ( SELECT [l4].[Id], [l4].[OneToOne_Required_PK_Date], [l4].[Level1_Optional_Id], [l4].[Level1_Required_Id], [l4].[Level2_Name], [l4].[OneToMany_Optional_Inverse2Id], [l4].[OneToMany_Required_Inverse2Id], [l4].[OneToOne_Optional_PK_Inverse2Id], [l5].[Id] AS [Id0] FROM [Level1] AS [l4] INNER JOIN [Level1] AS [l5] ON [l4].[Id] = [l5].[Id] - WHERE ([l4].[OneToOne_Required_PK_Date] IS NOT NULL AND [l4].[Level1_Required_Id] IS NOT NULL) AND [l4].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l4].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l4].[Level1_Required_Id] IS NOT NULL)) AND ([l4].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t0] ON [l2].[Id] = CASE - WHEN ([t0].[OneToOne_Required_PK_Date] IS NOT NULL AND [t0].[Level1_Required_Id] IS NOT NULL) AND [t0].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t0].[Id] + WHEN (([t0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t0].[Level1_Required_Id] IS NOT NULL)) AND ([t0].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t0].[Id] END LEFT JOIN [Level1] AS [l3] ON [t0].[Level1_Required_Id] = [l3].[Id] - WHERE ([t0].[OneToOne_Required_PK_Date] IS NOT NULL AND [t0].[Level1_Required_Id] IS NOT NULL) AND [t0].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([t0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t0].[Level1_Required_Id] IS NOT NULL)) AND ([t0].[OneToMany_Required_Inverse2Id] IS NOT NULL) ORDER BY CASE - WHEN ([t0].[OneToOne_Required_PK_Date] IS NOT NULL AND [t0].[Level1_Required_Id] IS NOT NULL) AND [t0].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t0].[Id] - END) IS NOT NULL THEN CAST(1 AS bit) + WHEN (([t0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t0].[Level1_Required_Id] IS NOT NULL)) AND ([t0].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t0].[Id] + END) IS NOT NULL) THEN CAST(1 AS bit) ELSE CAST(0 AS bit) END FROM [Level1] AS [l] @@ -7350,11 +7350,11 @@ LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Required_Id], [l0].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l0] INNER JOIN [Level1] AS [l1] ON [l0].[Id] = [l1].[Id] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL)) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t] ON [l].[Id] = CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + WHEN (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] END -WHERE ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL"); +WHERE (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL)"); } public override async Task Include18_1(bool async) @@ -7371,7 +7371,7 @@ LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[Level2_Name], [l0].[OneToMany_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id] FROM [Level1] AS [l0] INNER JOIN [Level1] AS [l1] ON [l0].[Id] = [l1].[Id] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL)) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t0] ON [t].[Id] = [t0].[Level1_Optional_Id]"); } @@ -7389,13 +7389,13 @@ LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[Level2_Name], [l0].[OneToMany_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id] FROM [Level1] AS [l0] INNER JOIN [Level1] AS [l1] ON [l0].[Id] = [l1].[Id] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL)) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t0] ON [t].[Id] = [t0].[Level1_Optional_Id] LEFT JOIN ( SELECT [l2].[Id], [l2].[OneToOne_Required_PK_Date], [l2].[Level1_Optional_Id], [l2].[Level1_Required_Id], [l2].[Level2_Name], [l2].[OneToMany_Optional_Inverse2Id], [l2].[OneToMany_Required_Inverse2Id], [l2].[OneToOne_Optional_PK_Inverse2Id] FROM [Level1] AS [l2] INNER JOIN [Level1] AS [l3] ON [l2].[Id] = [l3].[Id] - WHERE ([l2].[OneToOne_Required_PK_Date] IS NOT NULL AND [l2].[Level1_Required_Id] IS NOT NULL) AND [l2].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l2].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l2].[Level1_Required_Id] IS NOT NULL)) AND ([l2].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t1] ON [t].[Id] = [t1].[Level1_Optional_Id]"); } @@ -7410,7 +7410,7 @@ LEFT JOIN ( SELECT [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id] FROM [Level1] AS [l0] INNER JOIN [Level1] AS [l1] ON [l0].[Id] = [l1].[Id] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL)) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t] ON [l].[Id] = [t].[Level1_Optional_Id]"); } @@ -7428,9 +7428,9 @@ LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Required_Id], [l0].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l0] INNER JOIN [Level1] AS [l1] ON [l0].[Id] = [l1].[Id] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL)) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t] ON [l].[Id] = CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + WHEN (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] END LEFT JOIN ( SELECT [l2].[Id], [l2].[Level2_Required_Id], [l2].[OneToMany_Required_Inverse3Id] @@ -7439,25 +7439,25 @@ INNER JOIN ( SELECT [l3].[Id] FROM [Level1] AS [l3] INNER JOIN [Level1] AS [l4] ON [l3].[Id] = [l4].[Id] - WHERE ([l3].[OneToOne_Required_PK_Date] IS NOT NULL AND [l3].[Level1_Required_Id] IS NOT NULL) AND [l3].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l3].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l3].[Level1_Required_Id] IS NOT NULL)) AND ([l3].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t1] ON [l2].[Id] = [t1].[Id] - WHERE [l2].[Level2_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l2].[Level2_Required_Id] IS NOT NULL) AND ([l2].[OneToMany_Required_Inverse3Id] IS NOT NULL) ) AS [t0] ON CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + WHEN (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] END = CASE - WHEN [t0].[Level2_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [t0].[Id] + WHEN ([t0].[Level2_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [t0].[Id] END LEFT JOIN ( SELECT [l5].[Id], [l5].[OneToOne_Required_PK_Date], [l5].[Level1_Required_Id], [l5].[Level2_Name], [l5].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l5] INNER JOIN [Level1] AS [l6] ON [l5].[Id] = [l6].[Id] - WHERE ([l5].[OneToOne_Required_PK_Date] IS NOT NULL AND [l5].[Level1_Required_Id] IS NOT NULL) AND [l5].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l5].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l5].[Level1_Required_Id] IS NOT NULL)) AND ([l5].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t2] ON [t0].[Level2_Required_Id] = CASE - WHEN ([t2].[OneToOne_Required_PK_Date] IS NOT NULL AND [t2].[Level1_Required_Id] IS NOT NULL) AND [t2].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t2].[Id] + WHEN (([t2].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t2].[Level1_Required_Id] IS NOT NULL)) AND ([t2].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t2].[Id] END -WHERE (([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL) AND ([t0].[Level2_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse3Id] IS NOT NULL) +WHERE ((([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL)) AND (([t0].[Level2_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse3Id] IS NOT NULL)) ORDER BY CASE - WHEN ([t2].[OneToOne_Required_PK_Date] IS NOT NULL AND [t2].[Level1_Required_Id] IS NOT NULL) AND [t2].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t2].[Id] + WHEN (([t2].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t2].[Level1_Required_Id] IS NOT NULL)) AND ([t2].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t2].[Id] END"); } @@ -7475,11 +7475,11 @@ LEFT JOIN ( SELECT [l1].[Id], [l1].[OneToOne_Required_PK_Date], [l1].[Level1_Optional_Id], [l1].[Level1_Required_Id], [l1].[Level2_Name], [l1].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l1] INNER JOIN [Level1] AS [l2] ON [l1].[Id] = [l2].[Id] - WHERE ([l1].[OneToOne_Required_PK_Date] IS NOT NULL AND [l1].[Level1_Required_Id] IS NOT NULL) AND [l1].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l1].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l1].[Level1_Required_Id] IS NOT NULL)) AND ([l1].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t] ON [l0].[Id] = CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + WHEN (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] END - WHERE ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t0] ON [l].[Id] = [t0].[Level1_Optional_Id] LEFT JOIN ( SELECT [t2].[Level1_Optional_Id], [t2].[Level2_Name] @@ -7488,11 +7488,11 @@ LEFT JOIN ( SELECT [l4].[Id], [l4].[OneToOne_Required_PK_Date], [l4].[Level1_Optional_Id], [l4].[Level1_Required_Id], [l4].[Level2_Name], [l4].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l4] INNER JOIN [Level1] AS [l5] ON [l4].[Id] = [l5].[Id] - WHERE ([l4].[OneToOne_Required_PK_Date] IS NOT NULL AND [l4].[Level1_Required_Id] IS NOT NULL) AND [l4].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l4].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l4].[Level1_Required_Id] IS NOT NULL)) AND ([l4].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t2] ON [l3].[Id] = CASE - WHEN ([t2].[OneToOne_Required_PK_Date] IS NOT NULL AND [t2].[Level1_Required_Id] IS NOT NULL) AND [t2].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t2].[Id] + WHEN (([t2].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t2].[Level1_Required_Id] IS NOT NULL)) AND ([t2].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t2].[Id] END - WHERE ([t2].[OneToOne_Required_PK_Date] IS NOT NULL AND [t2].[Level1_Required_Id] IS NOT NULL) AND [t2].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([t2].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t2].[Level1_Required_Id] IS NOT NULL)) AND ([t2].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t1] ON [l].[Id] = [t1].[Level1_Optional_Id] WHERE ([t0].[Level2_Name] = N'L2 05') OR ([t1].[Level2_Name] = N'L2 07')"); } @@ -7503,7 +7503,7 @@ public override async Task Join_navigation_key_access_required(bool async) AssertSql( @"SELECT [l].[Id] AS [Id1], CASE - WHEN ([t0].[OneToOne_Required_PK_Date] IS NOT NULL AND [t0].[Level1_Required_Id] IS NOT NULL) AND [t0].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t0].[Id0] + WHEN (([t0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t0].[Level1_Required_Id] IS NOT NULL)) AND ([t0].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t0].[Id0] END AS [Id2] FROM [Level1] AS [l] INNER JOIN ( @@ -7513,12 +7513,12 @@ LEFT JOIN ( SELECT [l1].[Id], [l1].[OneToOne_Required_PK_Date], [l1].[Level1_Required_Id], [l1].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l1] INNER JOIN [Level1] AS [l3] ON [l1].[Id] = [l3].[Id] - WHERE ([l1].[OneToOne_Required_PK_Date] IS NOT NULL AND [l1].[Level1_Required_Id] IS NOT NULL) AND [l1].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l1].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l1].[Level1_Required_Id] IS NOT NULL)) AND ([l1].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t] ON [l0].[Id] = CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + WHEN (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] END LEFT JOIN [Level1] AS [l2] ON [t].[Level1_Required_Id] = [l2].[Id] - WHERE ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t0] ON [l].[Id] = [t0].[Id1]"); } @@ -7531,7 +7531,7 @@ public override async Task Include_with_all_method_include_gets_ignored(bool asy WHEN NOT EXISTS ( SELECT 1 FROM [Level1] AS [l] - WHERE ([l].[Name] = N'Foo') AND [l].[Name] IS NOT NULL) THEN CAST(1 AS bit) + WHERE ([l].[Name] = N'Foo') AND ([l].[Name] IS NOT NULL)) THEN CAST(1 AS bit) ELSE CAST(0 AS bit) END"); } @@ -7551,7 +7551,7 @@ LEFT JOIN ( SELECT [l0].[Level1_Required_Id], [l0].[Level2_Name] FROM [Level1] AS [l0] INNER JOIN [Level1] AS [l1] ON [l0].[Id] = [l1].[Id] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL)) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t] ON [l].[Id] = [t].[Level1_Required_Id] ORDER BY [t].[Level2_Name] ) AS [t0] @@ -7559,7 +7559,7 @@ LEFT JOIN ( SELECT [l2].[Id], [l2].[OneToOne_Required_PK_Date], [l2].[Level1_Optional_Id], [l2].[Level1_Required_Id], [l2].[Level2_Name], [l2].[OneToMany_Optional_Inverse2Id], [l2].[OneToMany_Required_Inverse2Id], [l2].[OneToOne_Optional_PK_Inverse2Id] FROM [Level1] AS [l2] INNER JOIN [Level1] AS [l3] ON [l2].[Id] = [l3].[Id] - WHERE ([l2].[OneToOne_Required_PK_Date] IS NOT NULL AND [l2].[Level1_Required_Id] IS NOT NULL) AND [l2].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l2].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l2].[Level1_Required_Id] IS NOT NULL)) AND ([l2].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t1] ON [t0].[Id] = [t1].[Level1_Optional_Id] ORDER BY [t0].[Level2_Name]"); } @@ -7570,7 +7570,7 @@ public override async Task Select_nav_prop_reference_optional2_via_DefaultIfEmpt AssertSql( @"SELECT CASE - WHEN ([t0].[OneToOne_Required_PK_Date] IS NOT NULL AND [t0].[Level1_Required_Id] IS NOT NULL) AND [t0].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t0].[Id0] + WHEN (([t0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t0].[Level1_Required_Id] IS NOT NULL)) AND ([t0].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t0].[Id0] END FROM [Level1] AS [l] LEFT JOIN ( @@ -7580,11 +7580,11 @@ LEFT JOIN ( SELECT [l1].[Id], [l1].[OneToOne_Required_PK_Date], [l1].[Level1_Optional_Id], [l1].[Level1_Required_Id], [l1].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l1] INNER JOIN [Level1] AS [l2] ON [l1].[Id] = [l2].[Id] - WHERE ([l1].[OneToOne_Required_PK_Date] IS NOT NULL AND [l1].[Level1_Required_Id] IS NOT NULL) AND [l1].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l1].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l1].[Level1_Required_Id] IS NOT NULL)) AND ([l1].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t] ON [l0].[Id] = CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + WHEN (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] END - WHERE ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t0] ON [l].[Id] = [t0].[Level1_Optional_Id]"); } @@ -7599,9 +7599,9 @@ LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Required_Id], [l0].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l0] INNER JOIN [Level1] AS [l1] ON [l0].[Id] = [l1].[Id] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL)) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t] ON [l].[Id] = CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + WHEN (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] END LEFT JOIN ( SELECT [l2].[Id], [l2].[Level2_Required_Id], [l2].[OneToMany_Required_Inverse3Id] @@ -7610,25 +7610,25 @@ INNER JOIN ( SELECT [l3].[Id] FROM [Level1] AS [l3] INNER JOIN [Level1] AS [l4] ON [l3].[Id] = [l4].[Id] - WHERE ([l3].[OneToOne_Required_PK_Date] IS NOT NULL AND [l3].[Level1_Required_Id] IS NOT NULL) AND [l3].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l3].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l3].[Level1_Required_Id] IS NOT NULL)) AND ([l3].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t1] ON [l2].[Id] = [t1].[Id] - WHERE [l2].[Level2_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l2].[Level2_Required_Id] IS NOT NULL) AND ([l2].[OneToMany_Required_Inverse3Id] IS NOT NULL) ) AS [t0] ON CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + WHEN (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] END = CASE - WHEN [t0].[Level2_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [t0].[Id] + WHEN ([t0].[Level2_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [t0].[Id] END LEFT JOIN ( SELECT [l5].[Id], [l5].[OneToOne_Required_PK_Date], [l5].[Level1_Optional_Id], [l5].[Level1_Required_Id], [l5].[Level2_Name], [l5].[OneToMany_Optional_Inverse2Id], [l5].[OneToMany_Required_Inverse2Id], [l5].[OneToOne_Optional_PK_Inverse2Id] FROM [Level1] AS [l5] INNER JOIN [Level1] AS [l6] ON [l5].[Id] = [l6].[Id] - WHERE ([l5].[OneToOne_Required_PK_Date] IS NOT NULL AND [l5].[Level1_Required_Id] IS NOT NULL) AND [l5].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l5].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l5].[Level1_Required_Id] IS NOT NULL)) AND ([l5].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t2] ON [t0].[Level2_Required_Id] = CASE - WHEN ([t2].[OneToOne_Required_PK_Date] IS NOT NULL AND [t2].[Level1_Required_Id] IS NOT NULL) AND [t2].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t2].[Id] + WHEN (([t2].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t2].[Level1_Required_Id] IS NOT NULL)) AND ([t2].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t2].[Id] END -WHERE (([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL) AND ([t0].[Level2_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse3Id] IS NOT NULL) +WHERE ((([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL)) AND (([t0].[Level2_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse3Id] IS NOT NULL)) ORDER BY CASE - WHEN ([t2].[OneToOne_Required_PK_Date] IS NOT NULL AND [t2].[Level1_Required_Id] IS NOT NULL) AND [t2].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t2].[Id] + WHEN (([t2].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t2].[Level1_Required_Id] IS NOT NULL)) AND ([t2].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t2].[Id] END"); } @@ -7638,16 +7638,16 @@ public override async Task Where_complex_predicate_with_with_nav_prop_and_OrElse AssertSql( @"SELECT CASE - WHEN [t0].[Level2_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [t0].[Id] + WHEN ([t0].[Level2_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [t0].[Id] END FROM [Level1] AS [l] LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Required_Id], [l0].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l0] INNER JOIN [Level1] AS [l1] ON [l0].[Id] = [l1].[Id] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL)) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t] ON [l].[Id] = CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + WHEN (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] END LEFT JOIN ( SELECT [l2].[Id], [l2].[Level2_Optional_Id], [l2].[Level2_Required_Id], [l2].[OneToMany_Required_Inverse3Id] @@ -7656,32 +7656,32 @@ INNER JOIN ( SELECT [l3].[Id] FROM [Level1] AS [l3] INNER JOIN [Level1] AS [l4] ON [l3].[Id] = [l4].[Id] - WHERE ([l3].[OneToOne_Required_PK_Date] IS NOT NULL AND [l3].[Level1_Required_Id] IS NOT NULL) AND [l3].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l3].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l3].[Level1_Required_Id] IS NOT NULL)) AND ([l3].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t1] ON [l2].[Id] = [t1].[Id] - WHERE [l2].[Level2_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l2].[Level2_Required_Id] IS NOT NULL) AND ([l2].[OneToMany_Required_Inverse3Id] IS NOT NULL) ) AS [t0] ON CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + WHEN (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] END = CASE - WHEN [t0].[Level2_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [t0].[Id] + WHEN ([t0].[Level2_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [t0].[Id] END LEFT JOIN ( SELECT [l5].[Id], [l5].[OneToOne_Required_PK_Date], [l5].[Level1_Required_Id], [l5].[Level2_Name], [l5].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l5] INNER JOIN [Level1] AS [l6] ON [l5].[Id] = [l6].[Id] - WHERE ([l5].[OneToOne_Required_PK_Date] IS NOT NULL AND [l5].[Level1_Required_Id] IS NOT NULL) AND [l5].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l5].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l5].[Level1_Required_Id] IS NOT NULL)) AND ([l5].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t2] ON [t0].[Level2_Optional_Id] = CASE - WHEN ([t2].[OneToOne_Required_PK_Date] IS NOT NULL AND [t2].[Level1_Required_Id] IS NOT NULL) AND [t2].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t2].[Id] + WHEN (([t2].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t2].[Level1_Required_Id] IS NOT NULL)) AND ([t2].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t2].[Id] END LEFT JOIN ( SELECT [l7].[Id], [l7].[OneToOne_Required_PK_Date], [l7].[Level1_Optional_Id], [l7].[Level1_Required_Id], [l7].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l7] INNER JOIN [Level1] AS [l8] ON [l7].[Id] = [l8].[Id] - WHERE ([l7].[OneToOne_Required_PK_Date] IS NOT NULL AND [l7].[Level1_Required_Id] IS NOT NULL) AND [l7].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l7].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l7].[Level1_Required_Id] IS NOT NULL)) AND ([l7].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t3] ON [t0].[Level2_Required_Id] = CASE - WHEN ([t3].[OneToOne_Required_PK_Date] IS NOT NULL AND [t3].[Level1_Required_Id] IS NOT NULL) AND [t3].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t3].[Id] + WHEN (([t3].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t3].[Level1_Required_Id] IS NOT NULL)) AND ([t3].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t3].[Id] END LEFT JOIN [Level1] AS [l9] ON [t3].[Level1_Optional_Id] = [l9].[Id] -WHERE ((([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL) AND ([t0].[Level2_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse3Id] IS NOT NULL)) AND ((([t2].[Level2_Name] <> N'L2 05') OR [t2].[Level2_Name] IS NULL) OR ([l9].[Name] = N'L1 05'))"); +WHERE (((([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL)) AND (([t0].[Level2_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse3Id] IS NOT NULL))) AND ((([t2].[Level2_Name] <> N'L2 05') OR ([t2].[Level2_Name] IS NULL)) OR ([l9].[Name] = N'L1 05'))"); } public override async Task String_include_multiple_derived_navigation_with_same_name_and_same_type(bool async) @@ -7707,9 +7707,9 @@ LEFT JOIN ( SELECT [l6].[Id], [l6].[OneToOne_Required_PK_Date], [l6].[Level1_Optional_Id], [l6].[Level1_Required_Id], [l6].[Level2_Name], [l6].[OneToMany_Optional_Inverse2Id], [l6].[OneToMany_Required_Inverse2Id], [l6].[OneToOne_Optional_PK_Inverse2Id], [l8].[Id] AS [Id0] FROM [Level1] AS [l6] INNER JOIN [Level1] AS [l8] ON [l6].[Id] = [l8].[Id] - WHERE ([l6].[OneToOne_Required_PK_Date] IS NOT NULL AND [l6].[Level1_Required_Id] IS NOT NULL) AND [l6].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l6].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l6].[Level1_Required_Id] IS NOT NULL)) AND ([l6].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t2] ON [l5].[Id] = CASE - WHEN ([t2].[OneToOne_Required_PK_Date] IS NOT NULL AND [t2].[Level1_Required_Id] IS NOT NULL) AND [t2].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t2].[Id] + WHEN (([t2].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t2].[Level1_Required_Id] IS NOT NULL)) AND ([t2].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t2].[Id] END LEFT JOIN ( SELECT [l9].[Id], [l9].[Level2_Optional_Id], [l9].[Level2_Required_Id], [l9].[Level3_Name], [l9].[OneToMany_Optional_Inverse3Id], [l9].[OneToMany_Required_Inverse3Id], [l9].[OneToOne_Optional_PK_Inverse3Id], [t5].[Id] AS [Id0], [t5].[Id0] AS [Id00] @@ -7718,35 +7718,35 @@ INNER JOIN ( SELECT [l10].[Id], [l10].[OneToOne_Required_PK_Date], [l10].[Level1_Optional_Id], [l10].[Level1_Required_Id], [l10].[Level2_Name], [l10].[OneToMany_Optional_Inverse2Id], [l10].[OneToMany_Required_Inverse2Id], [l10].[OneToOne_Optional_PK_Inverse2Id], [l11].[Id] AS [Id0] FROM [Level1] AS [l10] INNER JOIN [Level1] AS [l11] ON [l10].[Id] = [l11].[Id] - WHERE ([l10].[OneToOne_Required_PK_Date] IS NOT NULL AND [l10].[Level1_Required_Id] IS NOT NULL) AND [l10].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l10].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l10].[Level1_Required_Id] IS NOT NULL)) AND ([l10].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t5] ON [l9].[Id] = [t5].[Id] - WHERE [l9].[Level2_Required_Id] IS NOT NULL AND [l9].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l9].[Level2_Required_Id] IS NOT NULL) AND ([l9].[OneToMany_Required_Inverse3Id] IS NOT NULL) ) AS [t3] ON CASE - WHEN ([t2].[OneToOne_Required_PK_Date] IS NOT NULL AND [t2].[Level1_Required_Id] IS NOT NULL) AND [t2].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t2].[Id] + WHEN (([t2].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t2].[Level1_Required_Id] IS NOT NULL)) AND ([t2].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t2].[Id] END = CASE - WHEN [t3].[Level2_Required_Id] IS NOT NULL AND [t3].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [t3].[Id] + WHEN ([t3].[Level2_Required_Id] IS NOT NULL) AND ([t3].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [t3].[Id] END LEFT JOIN ( SELECT [l12].[Id], [l12].[OneToOne_Required_PK_Date], [l12].[Level1_Optional_Id], [l12].[Level1_Required_Id], [l12].[Level2_Name], [l12].[OneToMany_Optional_Inverse2Id], [l12].[OneToMany_Required_Inverse2Id], [l12].[OneToOne_Optional_PK_Inverse2Id], [l13].[Id] AS [Id0] FROM [Level1] AS [l12] INNER JOIN [Level1] AS [l13] ON [l12].[Id] = [l13].[Id] - WHERE ([l12].[OneToOne_Required_PK_Date] IS NOT NULL AND [l12].[Level1_Required_Id] IS NOT NULL) AND [l12].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l12].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l12].[Level1_Required_Id] IS NOT NULL)) AND ([l12].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t4] ON [t3].[Level2_Required_Id] = CASE - WHEN ([t4].[OneToOne_Required_PK_Date] IS NOT NULL AND [t4].[Level1_Required_Id] IS NOT NULL) AND [t4].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t4].[Id] + WHEN (([t4].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t4].[Level1_Required_Id] IS NOT NULL)) AND ([t4].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t4].[Id] END LEFT JOIN [Level1] AS [l7] ON [t4].[Level1_Required_Id] = [l7].[Id] - WHERE (([t2].[OneToOne_Required_PK_Date] IS NOT NULL AND [t2].[Level1_Required_Id] IS NOT NULL) AND [t2].[OneToMany_Required_Inverse2Id] IS NOT NULL) AND ([t3].[Level2_Required_Id] IS NOT NULL AND [t3].[OneToMany_Required_Inverse3Id] IS NOT NULL) + WHERE ((([t2].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t2].[Level1_Required_Id] IS NOT NULL)) AND ([t2].[OneToMany_Required_Inverse2Id] IS NOT NULL)) AND (([t3].[Level2_Required_Id] IS NOT NULL) AND ([t3].[OneToMany_Required_Inverse3Id] IS NOT NULL)) ORDER BY CASE - WHEN [t3].[Level2_Required_Id] IS NOT NULL AND [t3].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [t3].[Id] + WHEN ([t3].[Level2_Required_Id] IS NOT NULL) AND ([t3].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [t3].[Id] END) FROM [Level1] AS [l] LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Required_Id], [l0].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l0] INNER JOIN [Level1] AS [l1] ON [l0].[Id] = [l1].[Id] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL)) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t] ON [l].[Id] = CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + WHEN (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] END LEFT JOIN ( SELECT [l2].[Id], [l2].[Level2_Required_Id], [l2].[OneToMany_Required_Inverse3Id] @@ -7755,15 +7755,15 @@ INNER JOIN ( SELECT [l3].[Id] FROM [Level1] AS [l3] INNER JOIN [Level1] AS [l4] ON [l3].[Id] = [l4].[Id] - WHERE ([l3].[OneToOne_Required_PK_Date] IS NOT NULL AND [l3].[Level1_Required_Id] IS NOT NULL) AND [l3].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l3].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l3].[Level1_Required_Id] IS NOT NULL)) AND ([l3].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t1] ON [l2].[Id] = [t1].[Id] - WHERE [l2].[Level2_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l2].[Level2_Required_Id] IS NOT NULL) AND ([l2].[OneToMany_Required_Inverse3Id] IS NOT NULL) ) AS [t0] ON CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + WHEN (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] END = CASE - WHEN [t0].[Level2_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [t0].[Id] + WHEN ([t0].[Level2_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [t0].[Id] END -WHERE (([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL) AND ([t0].[Level2_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse3Id] IS NOT NULL)"); +WHERE ((([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL)) AND (([t0].[Level2_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse3Id] IS NOT NULL))"); } public override async Task Optional_navigation_take_optional_navigation(bool async) @@ -7776,17 +7776,17 @@ public override async Task Optional_navigation_take_optional_navigation(bool asy SELECT [t1].[Level3_Name] FROM ( SELECT TOP(@__p_0) [t].[Id] AS [Id0], [t].[OneToOne_Required_PK_Date], [t].[Level1_Required_Id], [t].[OneToMany_Required_Inverse2Id], CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + WHEN (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] END AS [c] FROM [Level1] AS [l] LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l0] INNER JOIN [Level1] AS [l1] ON [l0].[Id] = [l1].[Id] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL)) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t] ON [l].[Id] = [t].[Level1_Optional_Id] ORDER BY CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + WHEN (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] END ) AS [t0] LEFT JOIN ( @@ -7796,11 +7796,11 @@ INNER JOIN ( SELECT [l3].[Id] FROM [Level1] AS [l3] INNER JOIN [Level1] AS [l4] ON [l3].[Id] = [l4].[Id] - WHERE ([l3].[OneToOne_Required_PK_Date] IS NOT NULL AND [l3].[Level1_Required_Id] IS NOT NULL) AND [l3].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l3].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l3].[Level1_Required_Id] IS NOT NULL)) AND ([l3].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t2] ON [l2].[Id] = [t2].[Id] - WHERE [l2].[Level2_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l2].[Level2_Required_Id] IS NOT NULL) AND ([l2].[OneToMany_Required_Inverse3Id] IS NOT NULL) ) AS [t1] ON CASE - WHEN ([t0].[OneToOne_Required_PK_Date] IS NOT NULL AND [t0].[Level1_Required_Id] IS NOT NULL) AND [t0].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t0].[Id0] + WHEN (([t0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t0].[Level1_Required_Id] IS NOT NULL)) AND ([t0].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t0].[Id0] END = [t1].[Level2_Optional_Id] ORDER BY [t0].[c]"); } @@ -7816,7 +7816,7 @@ LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l0] INNER JOIN [Level1] AS [l1] ON [l0].[Id] = [l1].[Id] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL)) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t] ON [l].[Id] = [t].[Level1_Optional_Id] INNER JOIN ( SELECT [l2].[Level3_Name], [l2].[OneToMany_Optional_Inverse3Id] @@ -7825,11 +7825,11 @@ INNER JOIN ( SELECT [l3].[Id] FROM [Level1] AS [l3] INNER JOIN [Level1] AS [l4] ON [l3].[Id] = [l4].[Id] - WHERE ([l3].[OneToOne_Required_PK_Date] IS NOT NULL AND [l3].[Level1_Required_Id] IS NOT NULL) AND [l3].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l3].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l3].[Level1_Required_Id] IS NOT NULL)) AND ([l3].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t1] ON [l2].[Id] = [t1].[Id] - WHERE [l2].[Level2_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l2].[Level2_Required_Id] IS NOT NULL) AND ([l2].[OneToMany_Required_Inverse3Id] IS NOT NULL) ) AS [t0] ON CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + WHEN (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] END = [t0].[OneToMany_Optional_Inverse3Id]"); } @@ -7848,7 +7848,7 @@ LEFT JOIN ( SELECT [l0].[Level1_Required_Id], [l0].[Level2_Name] FROM [Level1] AS [l0] INNER JOIN [Level1] AS [l1] ON [l0].[Id] = [l1].[Id] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL)) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t] ON [l].[Id] = [t].[Level1_Required_Id] ORDER BY [t].[Level2_Name] ) AS [t0] @@ -7856,7 +7856,7 @@ LEFT JOIN ( SELECT [l2].[Id], [l2].[OneToOne_Required_PK_Date], [l2].[Level1_Optional_Id], [l2].[Level1_Required_Id], [l2].[Level2_Name], [l2].[OneToMany_Optional_Inverse2Id], [l2].[OneToMany_Required_Inverse2Id], [l2].[OneToOne_Optional_PK_Inverse2Id] FROM [Level1] AS [l2] INNER JOIN [Level1] AS [l3] ON [l2].[Id] = [l3].[Id] - WHERE ([l2].[OneToOne_Required_PK_Date] IS NOT NULL AND [l2].[Level1_Required_Id] IS NOT NULL) AND [l2].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l2].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l2].[Level1_Required_Id] IS NOT NULL)) AND ([l2].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t1] ON [t0].[Id] = [t1].[Level1_Optional_Id] ORDER BY [t0].[Level2_Name]"); } @@ -7867,19 +7867,19 @@ public override async Task Navigation_with_same_navigation_compared_to_null(bool AssertSql( @"SELECT CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + WHEN (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] END FROM [Level1] AS [l] LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Required_Id], [l0].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l0] INNER JOIN [Level1] AS [l1] ON [l0].[Id] = [l1].[Id] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL)) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t] ON [l].[Id] = CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + WHEN (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] END LEFT JOIN [Level1] AS [l2] ON [t].[OneToMany_Required_Inverse2Id] = [l2].[Id] -WHERE (([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL) AND ((([l2].[Name] <> N'L1 07') OR [l2].[Name] IS NULL) AND [l2].[Id] IS NOT NULL)"); +WHERE ((([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL)) AND ((([l2].[Name] <> N'L1 07') OR ([l2].[Name] IS NULL)) AND ([l2].[Id] IS NOT NULL))"); } public override async Task Explicit_GroupJoin_in_subquery_with_unrelated_projection(bool async) @@ -7898,13 +7898,13 @@ LEFT JOIN ( SELECT [l1].[Id], [l1].[OneToOne_Required_PK_Date], [l1].[Level1_Optional_Id], [l1].[Level1_Required_Id], [l1].[Level2_Name], [l1].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l1] INNER JOIN [Level1] AS [l2] ON [l1].[Id] = [l2].[Id] - WHERE ([l1].[OneToOne_Required_PK_Date] IS NOT NULL AND [l1].[Level1_Required_Id] IS NOT NULL) AND [l1].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l1].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l1].[Level1_Required_Id] IS NOT NULL)) AND ([l1].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t] ON [l0].[Id] = CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + WHEN (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] END - WHERE ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t0] ON [l].[Id] = [t0].[Level1_Optional_Id] -WHERE ([t0].[Level2_Name] <> N'Foo') OR [t0].[Level2_Name] IS NULL +WHERE ([t0].[Level2_Name] <> N'Foo') OR ([t0].[Level2_Name] IS NULL) ORDER BY [l].[Id]"); } @@ -7914,21 +7914,21 @@ public override async Task Navigation_key_access_required_comparison(bool async) AssertSql( @"SELECT CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + WHEN (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] END FROM [Level1] AS [l] LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Required_Id], [l0].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l0] INNER JOIN [Level1] AS [l1] ON [l0].[Id] = [l1].[Id] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL)) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t] ON [l].[Id] = CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + WHEN (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] END LEFT JOIN [Level1] AS [l2] ON CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + WHEN (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] END = [l2].[Id] -WHERE (([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL) AND ([l2].[Id] > 5)"); +WHERE ((([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL)) AND ([l2].[Id] > 5)"); } public override async Task SelectMany_navigation_comparison1(bool async) @@ -7961,11 +7961,11 @@ LEFT JOIN ( SELECT [l2].[Id], [l2].[OneToOne_Required_PK_Date], [l2].[Level1_Optional_Id], [l2].[Level1_Required_Id], [l2].[Level2_Name], [l2].[OneToMany_Optional_Inverse2Id], [l2].[OneToMany_Required_Inverse2Id], [l2].[OneToOne_Optional_PK_Inverse2Id], [l3].[Id] AS [Id0] FROM [Level1] AS [l2] INNER JOIN [Level1] AS [l3] ON [l2].[Id] = [l3].[Id] - WHERE ([l2].[OneToOne_Required_PK_Date] IS NOT NULL AND [l2].[Level1_Required_Id] IS NOT NULL) AND [l2].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l2].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l2].[Level1_Required_Id] IS NOT NULL)) AND ([l2].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t] ON [l1].[Id] = CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + WHEN (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] END - WHERE ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t0] ON [l0].[Id] = [t0].[Level1_Optional_Id] ) AS [t1]) > 7) AND ([l].[Id] < 3)"); } @@ -7985,7 +7985,7 @@ LEFT JOIN ( SELECT [l0].[Level1_Required_Id], [l0].[Level2_Name] FROM [Level1] AS [l0] INNER JOIN [Level1] AS [l1] ON [l0].[Id] = [l1].[Id] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL)) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t] ON [l].[Id] = [t].[Level1_Required_Id] ORDER BY [t].[Level2_Name] ) AS [t0] @@ -7993,7 +7993,7 @@ LEFT JOIN ( SELECT [l2].[Id], [l2].[OneToOne_Required_PK_Date], [l2].[Level1_Optional_Id], [l2].[Level1_Required_Id], [l2].[Level2_Name], [l2].[OneToMany_Optional_Inverse2Id], [l2].[OneToMany_Required_Inverse2Id], [l2].[OneToOne_Optional_PK_Inverse2Id] FROM [Level1] AS [l2] INNER JOIN [Level1] AS [l3] ON [l2].[Id] = [l3].[Id] - WHERE ([l2].[OneToOne_Required_PK_Date] IS NOT NULL AND [l2].[Level1_Required_Id] IS NOT NULL) AND [l2].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l2].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l2].[Level1_Required_Id] IS NOT NULL)) AND ([l2].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t1] ON [t0].[Id] = [t1].[Level1_Optional_Id] ORDER BY [t0].[Level2_Name]"); } @@ -8009,12 +8009,12 @@ LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[Level2_Name], [l0].[OneToMany_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id] FROM [Level1] AS [l0] INNER JOIN [Level1] AS [l1] ON [l0].[Id] = [l1].[Id] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL)) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t] ON [l].[Id] = CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + WHEN (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] END LEFT JOIN [Level1] AS [l2] ON [t].[Level1_Required_Id] = [l2].[Id] -WHERE (([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL) AND [l2].[Id] IN (1, 2)"); +WHERE ((([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL)) AND [l2].[Id] IN (1, 2)"); } public override async Task Entity_equality_empty(bool async) @@ -8028,10 +8028,10 @@ LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l0] INNER JOIN [Level1] AS [l1] ON [l0].[Id] = [l1].[Id] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL)) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t] ON [l].[Id] = [t].[Level1_Optional_Id] WHERE CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + WHEN (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] END = 0"); } @@ -8047,33 +8047,33 @@ INNER JOIN ( SELECT [l1].[Id], [l1].[OneToOne_Required_PK_Date], [l1].[Level1_Optional_Id], [l1].[Level1_Required_Id], [l1].[Level2_Name], [l1].[OneToMany_Optional_Inverse2Id], [l1].[OneToMany_Required_Inverse2Id], [l1].[OneToOne_Optional_PK_Inverse2Id], [l2].[Id] AS [Id0] FROM [Level1] AS [l1] INNER JOIN [Level1] AS [l2] ON [l1].[Id] = [l2].[Id] - WHERE ([l1].[OneToOne_Required_PK_Date] IS NOT NULL AND [l1].[Level1_Required_Id] IS NOT NULL) AND [l1].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l1].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l1].[Level1_Required_Id] IS NOT NULL)) AND ([l1].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t] ON [l0].[Id] = [t].[Id] - WHERE ([l0].[Level2_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse3Id] IS NOT NULL) AND (EXISTS ( + WHERE (([l0].[Level2_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse3Id] IS NOT NULL)) AND (EXISTS ( SELECT 1 FROM [Level1] AS [l3] INNER JOIN [Level1] AS [l4] ON [l3].[Id] = [l4].[Id] - WHERE (([l3].[OneToOne_Required_PK_Date] IS NOT NULL AND [l3].[Level1_Required_Id] IS NOT NULL) AND [l3].[OneToMany_Required_Inverse2Id] IS NOT NULL) AND ([l].[Id] = [l3].[OneToMany_Optional_Inverse2Id])) AND ((( + WHERE ((([l3].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l3].[Level1_Required_Id] IS NOT NULL)) AND ([l3].[OneToMany_Required_Inverse2Id] IS NOT NULL)) AND ([l].[Id] = [l3].[OneToMany_Optional_Inverse2Id])) AND ((( SELECT TOP(1) CASE - WHEN ([l5].[OneToOne_Required_PK_Date] IS NOT NULL AND [l5].[Level1_Required_Id] IS NOT NULL) AND [l5].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [l5].[Id] + WHEN (([l5].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l5].[Level1_Required_Id] IS NOT NULL)) AND ([l5].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [l5].[Id] END FROM [Level1] AS [l5] INNER JOIN [Level1] AS [l6] ON [l5].[Id] = [l6].[Id] - WHERE (([l5].[OneToOne_Required_PK_Date] IS NOT NULL AND [l5].[Level1_Required_Id] IS NOT NULL) AND [l5].[OneToMany_Required_Inverse2Id] IS NOT NULL) AND ([l].[Id] = [l5].[OneToMany_Optional_Inverse2Id]) + WHERE ((([l5].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l5].[Level1_Required_Id] IS NOT NULL)) AND ([l5].[OneToMany_Required_Inverse2Id] IS NOT NULL)) AND ([l].[Id] = [l5].[OneToMany_Optional_Inverse2Id]) ORDER BY CASE - WHEN ([l5].[OneToOne_Required_PK_Date] IS NOT NULL AND [l5].[Level1_Required_Id] IS NOT NULL) AND [l5].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [l5].[Id] - END) = [l0].[OneToMany_Optional_Inverse3Id]) OR (( + WHEN (([l5].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l5].[Level1_Required_Id] IS NOT NULL)) AND ([l5].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [l5].[Id] + END) = [l0].[OneToMany_Optional_Inverse3Id]) OR ((( SELECT TOP(1) CASE - WHEN ([l5].[OneToOne_Required_PK_Date] IS NOT NULL AND [l5].[Level1_Required_Id] IS NOT NULL) AND [l5].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [l5].[Id] + WHEN (([l5].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l5].[Level1_Required_Id] IS NOT NULL)) AND ([l5].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [l5].[Id] END FROM [Level1] AS [l5] INNER JOIN [Level1] AS [l6] ON [l5].[Id] = [l6].[Id] - WHERE (([l5].[OneToOne_Required_PK_Date] IS NOT NULL AND [l5].[Level1_Required_Id] IS NOT NULL) AND [l5].[OneToMany_Required_Inverse2Id] IS NOT NULL) AND ([l].[Id] = [l5].[OneToMany_Optional_Inverse2Id]) + WHERE ((([l5].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l5].[Level1_Required_Id] IS NOT NULL)) AND ([l5].[OneToMany_Required_Inverse2Id] IS NOT NULL)) AND ([l].[Id] = [l5].[OneToMany_Optional_Inverse2Id]) ORDER BY CASE - WHEN ([l5].[OneToOne_Required_PK_Date] IS NOT NULL AND [l5].[Level1_Required_Id] IS NOT NULL) AND [l5].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [l5].[Id] - END) IS NULL AND [l0].[OneToMany_Optional_Inverse3Id] IS NULL))) + WHEN (([l5].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l5].[Level1_Required_Id] IS NOT NULL)) AND ([l5].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [l5].[Id] + END) IS NULL) AND ([l0].[OneToMany_Optional_Inverse3Id] IS NULL)))) ORDER BY CASE - WHEN [l0].[Level2_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [l0].[Id] + WHEN ([l0].[Level2_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [l0].[Id] END) FROM [Level1] AS [l]"); } @@ -8092,11 +8092,11 @@ LEFT JOIN ( SELECT [l1].[Id], [l1].[OneToOne_Required_PK_Date], [l1].[Level1_Optional_Id], [l1].[Level1_Required_Id], [l1].[Level2_Name], [l1].[OneToMany_Optional_Inverse2Id], [l1].[OneToMany_Required_Inverse2Id], [l1].[OneToOne_Optional_PK_Inverse2Id] FROM [Level1] AS [l1] INNER JOIN [Level1] AS [l2] ON [l1].[Id] = [l2].[Id] - WHERE ([l1].[OneToOne_Required_PK_Date] IS NOT NULL AND [l1].[Level1_Required_Id] IS NOT NULL) AND [l1].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l1].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l1].[Level1_Required_Id] IS NOT NULL)) AND ([l1].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t] ON [l0].[Id] = CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + WHEN (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] END - WHERE ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t0] ON [l].[Id] = [t0].[Level1_Optional_Id] CROSS JOIN ( SELECT [t2].[Level1_Required_Id] @@ -8105,11 +8105,11 @@ LEFT JOIN ( SELECT [l4].[Id], [l4].[OneToOne_Required_PK_Date], [l4].[Level1_Required_Id], [l4].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l4] INNER JOIN [Level1] AS [l5] ON [l4].[Id] = [l5].[Id] - WHERE ([l4].[OneToOne_Required_PK_Date] IS NOT NULL AND [l4].[Level1_Required_Id] IS NOT NULL) AND [l4].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l4].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l4].[Level1_Required_Id] IS NOT NULL)) AND ([l4].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t2] ON [l3].[Id] = CASE - WHEN ([t2].[OneToOne_Required_PK_Date] IS NOT NULL AND [t2].[Level1_Required_Id] IS NOT NULL) AND [t2].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t2].[Id] + WHEN (([t2].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t2].[Level1_Required_Id] IS NOT NULL)) AND ([t2].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t2].[Id] END - WHERE ([t2].[OneToOne_Required_PK_Date] IS NOT NULL AND [t2].[Level1_Required_Id] IS NOT NULL) AND [t2].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([t2].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t2].[Level1_Required_Id] IS NOT NULL)) AND ([t2].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t1] INNER JOIN [Level1] AS [l6] ON [t1].[Level1_Required_Id] = [l6].[Id]"); } @@ -8142,14 +8142,14 @@ public override async Task Select_multiple_nav_prop_reference_optional(bool asyn AssertSql( @"SELECT CASE - WHEN [t0].[Level2_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [t0].[Id] + WHEN ([t0].[Level2_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [t0].[Id] END FROM [Level1] AS [l] LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l0] INNER JOIN [Level1] AS [l1] ON [l0].[Id] = [l1].[Id] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL)) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t] ON [l].[Id] = [t].[Level1_Optional_Id] LEFT JOIN ( SELECT [l2].[Id], [l2].[Level2_Optional_Id], [l2].[Level2_Required_Id], [l2].[OneToMany_Required_Inverse3Id] @@ -8158,11 +8158,11 @@ INNER JOIN ( SELECT [l3].[Id] FROM [Level1] AS [l3] INNER JOIN [Level1] AS [l4] ON [l3].[Id] = [l4].[Id] - WHERE ([l3].[OneToOne_Required_PK_Date] IS NOT NULL AND [l3].[Level1_Required_Id] IS NOT NULL) AND [l3].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l3].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l3].[Level1_Required_Id] IS NOT NULL)) AND ([l3].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t1] ON [l2].[Id] = [t1].[Id] - WHERE [l2].[Level2_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l2].[Level2_Required_Id] IS NOT NULL) AND ([l2].[OneToMany_Required_Inverse3Id] IS NOT NULL) ) AS [t0] ON CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + WHEN (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] END = [t0].[Level2_Optional_Id]"); } @@ -8177,7 +8177,7 @@ LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l0] INNER JOIN [Level1] AS [l1] ON [l0].[Id] = [l1].[Id] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL)) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t] ON [l].[Id] = [t].[Level1_Optional_Id] LEFT JOIN ( SELECT [l2].[Level2_Optional_Id], [l2].[Level3_Name] @@ -8186,11 +8186,11 @@ INNER JOIN ( SELECT [l3].[Id] FROM [Level1] AS [l3] INNER JOIN [Level1] AS [l4] ON [l3].[Id] = [l4].[Id] - WHERE ([l3].[OneToOne_Required_PK_Date] IS NOT NULL AND [l3].[Level1_Required_Id] IS NOT NULL) AND [l3].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l3].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l3].[Level1_Required_Id] IS NOT NULL)) AND ([l3].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t1] ON [l2].[Id] = [t1].[Id] - WHERE [l2].[Level2_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l2].[Level2_Required_Id] IS NOT NULL) AND ([l2].[OneToMany_Required_Inverse3Id] IS NOT NULL) ) AS [t0] ON CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + WHEN (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] END = [t0].[Level2_Optional_Id] WHERE [t0].[Level3_Name] IS NOT NULL"); } @@ -8214,11 +8214,11 @@ LEFT JOIN ( SELECT [l2].[Id], [l2].[OneToOne_Required_PK_Date], [l2].[Level1_Optional_Id], [l2].[Level1_Required_Id], [l2].[Level2_Name], [l2].[OneToMany_Optional_Inverse2Id], [l2].[OneToMany_Required_Inverse2Id], [l2].[OneToOne_Optional_PK_Inverse2Id], [l3].[Id] AS [Id0] FROM [Level1] AS [l2] INNER JOIN [Level1] AS [l3] ON [l2].[Id] = [l3].[Id] - WHERE ([l2].[OneToOne_Required_PK_Date] IS NOT NULL AND [l2].[Level1_Required_Id] IS NOT NULL) AND [l2].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l2].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l2].[Level1_Required_Id] IS NOT NULL)) AND ([l2].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t] ON [l1].[Id] = CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + WHEN (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] END - WHERE ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t0] ON [l0].[Id] = [t0].[Level1_Optional_Id] WHERE ( SELECT COUNT(*) @@ -8230,11 +8230,11 @@ LEFT JOIN ( SELECT [l6].[Id], [l6].[OneToOne_Required_PK_Date], [l6].[Level1_Optional_Id], [l6].[Level1_Required_Id], [l6].[Level2_Name], [l6].[OneToMany_Optional_Inverse2Id], [l6].[OneToMany_Required_Inverse2Id], [l6].[OneToOne_Optional_PK_Inverse2Id], [l7].[Id] AS [Id0] FROM [Level1] AS [l6] INNER JOIN [Level1] AS [l7] ON [l6].[Id] = [l7].[Id] - WHERE ([l6].[OneToOne_Required_PK_Date] IS NOT NULL AND [l6].[Level1_Required_Id] IS NOT NULL) AND [l6].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l6].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l6].[Level1_Required_Id] IS NOT NULL)) AND ([l6].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t2] ON [l5].[Id] = CASE - WHEN ([t2].[OneToOne_Required_PK_Date] IS NOT NULL AND [t2].[Level1_Required_Id] IS NOT NULL) AND [t2].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t2].[Id] + WHEN (([t2].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t2].[Level1_Required_Id] IS NOT NULL)) AND ([t2].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t2].[Id] END - WHERE ([t2].[OneToOne_Required_PK_Date] IS NOT NULL AND [t2].[Level1_Required_Id] IS NOT NULL) AND [t2].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([t2].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t2].[Level1_Required_Id] IS NOT NULL)) AND ([t2].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t1] ON [l4].[Id] = [t1].[Level1_Optional_Id]) > 7 ORDER BY [l0].[Id] ) AS [t3]) > 4) AND ([l].[Id] < 2)"); @@ -8251,10 +8251,10 @@ LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l0] INNER JOIN [Level1] AS [l1] ON [l0].[Id] = [l1].[Id] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE (([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL)) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) ) AS [t] ON [l].[Id] = [t].[Level1_Optional_Id] WHERE CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + WHEN (([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL)) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] END = 0"); } diff --git a/test/EFCore.SqlServer.FunctionalTests/Query/FromSqlQuerySqlServerTest.cs b/test/EFCore.SqlServer.FunctionalTests/Query/FromSqlQuerySqlServerTest.cs index 0f2b1d5ae7f..ec2ec4de2bb 100644 --- a/test/EFCore.SqlServer.FunctionalTests/Query/FromSqlQuerySqlServerTest.cs +++ b/test/EFCore.SqlServer.FunctionalTests/Query/FromSqlQuerySqlServerTest.cs @@ -447,7 +447,7 @@ public override async Task FromSqlRaw_composed_with_nullable_predicate(bool asyn FROM ( SELECT * FROM ""Customers"" ) AS [m] -WHERE ([m].[ContactName] = [m].[CompanyName]) OR ([m].[ContactName] IS NULL AND [m].[CompanyName] IS NULL)"); +WHERE ([m].[ContactName] = [m].[CompanyName]) OR (([m].[ContactName] IS NULL) AND ([m].[CompanyName] IS NULL))"); } public override async Task FromSqlRaw_with_dbParameter(bool async) diff --git a/test/EFCore.SqlServer.FunctionalTests/Query/FunkyDataQuerySqlServerTest.cs b/test/EFCore.SqlServer.FunctionalTests/Query/FunkyDataQuerySqlServerTest.cs index f3d8ed331f6..5c617bdd4e0 100644 --- a/test/EFCore.SqlServer.FunctionalTests/Query/FunkyDataQuerySqlServerTest.cs +++ b/test/EFCore.SqlServer.FunctionalTests/Query/FunkyDataQuerySqlServerTest.cs @@ -139,11 +139,11 @@ public override async Task String_starts_with_on_argument_with_wildcard_constant AssertSql( @"SELECT [f].[FirstName] FROM [FunkyCustomers] AS [f] -WHERE [f].[FirstName] IS NOT NULL AND ([f].[FirstName] LIKE N'\%B%' ESCAPE N'\')", +WHERE ([f].[FirstName] IS NOT NULL) AND ([f].[FirstName] LIKE N'\%B%' ESCAPE N'\')", // @"SELECT [f].[FirstName] FROM [FunkyCustomers] AS [f] -WHERE [f].[FirstName] IS NOT NULL AND ([f].[FirstName] LIKE N'a\_%' ESCAPE N'\')", +WHERE ([f].[FirstName] IS NOT NULL) AND ([f].[FirstName] LIKE N'a\_%' ESCAPE N'\')", // @"SELECT [f].[FirstName] FROM [FunkyCustomers] AS [f] @@ -154,11 +154,11 @@ FROM [FunkyCustomers] AS [f] // @"SELECT [f].[FirstName] FROM [FunkyCustomers] AS [f] -WHERE [f].[FirstName] IS NOT NULL AND ([f].[FirstName] LIKE N'\_Ba\_%' ESCAPE N'\')", +WHERE ([f].[FirstName] IS NOT NULL) AND ([f].[FirstName] LIKE N'\_Ba\_%' ESCAPE N'\')", // @"SELECT [f].[FirstName] FROM [FunkyCustomers] AS [f] -WHERE [f].[FirstName] IS NOT NULL AND NOT ([f].[FirstName] LIKE N'\%B\%a\%r%' ESCAPE N'\')", +WHERE ([f].[FirstName] IS NOT NULL) AND NOT ([f].[FirstName] LIKE N'\%B\%a\%r%' ESCAPE N'\')", // @"SELECT [f].[FirstName] FROM [FunkyCustomers] AS [f] @@ -178,13 +178,13 @@ public override async Task String_starts_with_on_argument_with_wildcard_paramete SELECT [f].[FirstName] FROM [FunkyCustomers] AS [f] -WHERE (@__prm1_0 = N'') OR ([f].[FirstName] IS NOT NULL AND (LEFT([f].[FirstName], LEN(@__prm1_0)) = @__prm1_0))", +WHERE (@__prm1_0 = N'') OR (([f].[FirstName] IS NOT NULL) AND (LEFT([f].[FirstName], LEN(@__prm1_0)) = @__prm1_0))", // @"@__prm2_0='a_' (Size = 4000) SELECT [f].[FirstName] FROM [FunkyCustomers] AS [f] -WHERE (@__prm2_0 = N'') OR ([f].[FirstName] IS NOT NULL AND (LEFT([f].[FirstName], LEN(@__prm2_0)) = @__prm2_0))", +WHERE (@__prm2_0 = N'') OR (([f].[FirstName] IS NOT NULL) AND (LEFT([f].[FirstName], LEN(@__prm2_0)) = @__prm2_0))", // @"SELECT [f].[FirstName] FROM [FunkyCustomers] AS [f] @@ -194,25 +194,25 @@ FROM [FunkyCustomers] AS [f] SELECT [f].[FirstName] FROM [FunkyCustomers] AS [f] -WHERE (@__prm4_0 = N'') OR ([f].[FirstName] IS NOT NULL AND (LEFT([f].[FirstName], LEN(@__prm4_0)) = @__prm4_0))", +WHERE (@__prm4_0 = N'') OR (([f].[FirstName] IS NOT NULL) AND (LEFT([f].[FirstName], LEN(@__prm4_0)) = @__prm4_0))", // @"@__prm5_0='_Ba_' (Size = 4000) SELECT [f].[FirstName] FROM [FunkyCustomers] AS [f] -WHERE (@__prm5_0 = N'') OR ([f].[FirstName] IS NOT NULL AND (LEFT([f].[FirstName], LEN(@__prm5_0)) = @__prm5_0))", +WHERE (@__prm5_0 = N'') OR (([f].[FirstName] IS NOT NULL) AND (LEFT([f].[FirstName], LEN(@__prm5_0)) = @__prm5_0))", // @"@__prm6_0='%B%a%r' (Size = 4000) SELECT [f].[FirstName] FROM [FunkyCustomers] AS [f] -WHERE (@__prm6_0 <> N'') AND ([f].[FirstName] IS NOT NULL AND (LEFT([f].[FirstName], LEN(@__prm6_0)) <> @__prm6_0))", +WHERE (@__prm6_0 <> N'') AND (([f].[FirstName] IS NOT NULL) AND (LEFT([f].[FirstName], LEN(@__prm6_0)) <> @__prm6_0))", // @"@__prm7_0='' (Size = 4000) SELECT [f].[FirstName] FROM [FunkyCustomers] AS [f] -WHERE (@__prm7_0 <> N'') AND ([f].[FirstName] IS NOT NULL AND (LEFT([f].[FirstName], LEN(@__prm7_0)) <> @__prm7_0))", +WHERE (@__prm7_0 <> N'') AND (([f].[FirstName] IS NOT NULL) AND (LEFT([f].[FirstName], LEN(@__prm7_0)) <> @__prm7_0))", // @"SELECT [f].[FirstName] FROM [FunkyCustomers] AS [f] @@ -226,37 +226,37 @@ public override async Task String_starts_with_on_argument_with_bracket(bool asyn AssertSql( @"SELECT [f].[Id], [f].[FirstName], [f].[LastName], [f].[NullableBool] FROM [FunkyCustomers] AS [f] -WHERE [f].[FirstName] IS NOT NULL AND ([f].[FirstName] LIKE N'\[%' ESCAPE N'\')", +WHERE ([f].[FirstName] IS NOT NULL) AND ([f].[FirstName] LIKE N'\[%' ESCAPE N'\')", // @"SELECT [f].[Id], [f].[FirstName], [f].[LastName], [f].[NullableBool] FROM [FunkyCustomers] AS [f] -WHERE [f].[FirstName] IS NOT NULL AND ([f].[FirstName] LIKE N'B\[%' ESCAPE N'\')", +WHERE ([f].[FirstName] IS NOT NULL) AND ([f].[FirstName] LIKE N'B\[%' ESCAPE N'\')", // @"SELECT [f].[Id], [f].[FirstName], [f].[LastName], [f].[NullableBool] FROM [FunkyCustomers] AS [f] -WHERE [f].[FirstName] IS NOT NULL AND ([f].[FirstName] LIKE N'B\[\[a^%' ESCAPE N'\')", +WHERE ([f].[FirstName] IS NOT NULL) AND ([f].[FirstName] LIKE N'B\[\[a^%' ESCAPE N'\')", // @"@__prm1_0='[' (Size = 4000) SELECT [f].[Id], [f].[FirstName], [f].[LastName], [f].[NullableBool] FROM [FunkyCustomers] AS [f] -WHERE (@__prm1_0 = N'') OR ([f].[FirstName] IS NOT NULL AND (LEFT([f].[FirstName], LEN(@__prm1_0)) = @__prm1_0))", +WHERE (@__prm1_0 = N'') OR (([f].[FirstName] IS NOT NULL) AND (LEFT([f].[FirstName], LEN(@__prm1_0)) = @__prm1_0))", // @"@__prm2_0='B[' (Size = 4000) SELECT [f].[Id], [f].[FirstName], [f].[LastName], [f].[NullableBool] FROM [FunkyCustomers] AS [f] -WHERE (@__prm2_0 = N'') OR ([f].[FirstName] IS NOT NULL AND (LEFT([f].[FirstName], LEN(@__prm2_0)) = @__prm2_0))", +WHERE (@__prm2_0 = N'') OR (([f].[FirstName] IS NOT NULL) AND (LEFT([f].[FirstName], LEN(@__prm2_0)) = @__prm2_0))", // @"@__prm3_0='B[[a^' (Size = 4000) SELECT [f].[Id], [f].[FirstName], [f].[LastName], [f].[NullableBool] FROM [FunkyCustomers] AS [f] -WHERE (@__prm3_0 = N'') OR ([f].[FirstName] IS NOT NULL AND (LEFT([f].[FirstName], LEN(@__prm3_0)) = @__prm3_0))", +WHERE (@__prm3_0 = N'') OR (([f].[FirstName] IS NOT NULL) AND (LEFT([f].[FirstName], LEN(@__prm3_0)) = @__prm3_0))", // @"SELECT [f].[Id], [f].[FirstName], [f].[LastName], [f].[NullableBool] FROM [FunkyCustomers] AS [f] -WHERE ([f].[LastName] = N'') OR ([f].[FirstName] IS NOT NULL AND ([f].[LastName] IS NOT NULL AND (LEFT([f].[FirstName], LEN([f].[LastName])) = [f].[LastName])))"); +WHERE ([f].[LastName] = N'') OR (([f].[FirstName] IS NOT NULL) AND (([f].[LastName] IS NOT NULL) AND (LEFT([f].[FirstName], LEN([f].[LastName])) = [f].[LastName])))"); } public override async Task String_starts_with_on_argument_with_wildcard_column(bool async) @@ -267,7 +267,7 @@ public override async Task String_starts_with_on_argument_with_wildcard_column(b @"SELECT [f].[FirstName] AS [fn], [f0].[LastName] AS [ln] FROM [FunkyCustomers] AS [f] CROSS JOIN [FunkyCustomers] AS [f0] -WHERE ([f0].[LastName] = N'') OR ([f].[FirstName] IS NOT NULL AND ([f0].[LastName] IS NOT NULL AND (LEFT([f].[FirstName], LEN([f0].[LastName])) = [f0].[LastName])))"); +WHERE ([f0].[LastName] = N'') OR (([f].[FirstName] IS NOT NULL) AND (([f0].[LastName] IS NOT NULL) AND (LEFT([f].[FirstName], LEN([f0].[LastName])) = [f0].[LastName])))"); } public override async Task String_starts_with_on_argument_with_wildcard_column_negated(bool async) @@ -278,7 +278,7 @@ public override async Task String_starts_with_on_argument_with_wildcard_column_n @"SELECT [f].[FirstName] AS [fn], [f0].[LastName] AS [ln] FROM [FunkyCustomers] AS [f] CROSS JOIN [FunkyCustomers] AS [f0] -WHERE (([f0].[LastName] <> N'') OR [f0].[LastName] IS NULL) AND ([f].[FirstName] IS NOT NULL AND ([f0].[LastName] IS NOT NULL AND (LEFT([f].[FirstName], LEN([f0].[LastName])) <> [f0].[LastName])))"); +WHERE (([f0].[LastName] <> N'') OR ([f0].[LastName] IS NULL)) AND (([f].[FirstName] IS NOT NULL) AND (([f0].[LastName] IS NOT NULL) AND (LEFT([f].[FirstName], LEN([f0].[LastName])) <> [f0].[LastName])))"); } public override async Task String_ends_with_on_argument_with_wildcard_constant(bool async) @@ -288,11 +288,11 @@ public override async Task String_ends_with_on_argument_with_wildcard_constant(b AssertSql( @"SELECT [f].[FirstName] FROM [FunkyCustomers] AS [f] -WHERE [f].[FirstName] IS NOT NULL AND ([f].[FirstName] LIKE N'%\%B' ESCAPE N'\')", +WHERE ([f].[FirstName] IS NOT NULL) AND ([f].[FirstName] LIKE N'%\%B' ESCAPE N'\')", // @"SELECT [f].[FirstName] FROM [FunkyCustomers] AS [f] -WHERE [f].[FirstName] IS NOT NULL AND ([f].[FirstName] LIKE N'%a\_' ESCAPE N'\')", +WHERE ([f].[FirstName] IS NOT NULL) AND ([f].[FirstName] LIKE N'%a\_' ESCAPE N'\')", // @"SELECT [f].[FirstName] FROM [FunkyCustomers] AS [f] @@ -303,11 +303,11 @@ FROM [FunkyCustomers] AS [f] // @"SELECT [f].[FirstName] FROM [FunkyCustomers] AS [f] -WHERE [f].[FirstName] IS NOT NULL AND ([f].[FirstName] LIKE N'%\_Ba\_' ESCAPE N'\')", +WHERE ([f].[FirstName] IS NOT NULL) AND ([f].[FirstName] LIKE N'%\_Ba\_' ESCAPE N'\')", // @"SELECT [f].[FirstName] FROM [FunkyCustomers] AS [f] -WHERE [f].[FirstName] IS NOT NULL AND NOT ([f].[FirstName] LIKE N'%\%B\%a\%r' ESCAPE N'\')", +WHERE ([f].[FirstName] IS NOT NULL) AND NOT ([f].[FirstName] LIKE N'%\%B\%a\%r' ESCAPE N'\')", // @"SELECT [f].[FirstName] FROM [FunkyCustomers] AS [f] @@ -327,13 +327,13 @@ public override async Task String_ends_with_on_argument_with_wildcard_parameter( SELECT [f].[FirstName] FROM [FunkyCustomers] AS [f] -WHERE (@__prm1_0 = N'') OR ([f].[FirstName] IS NOT NULL AND (RIGHT([f].[FirstName], LEN(@__prm1_0)) = @__prm1_0))", +WHERE (@__prm1_0 = N'') OR (([f].[FirstName] IS NOT NULL) AND (RIGHT([f].[FirstName], LEN(@__prm1_0)) = @__prm1_0))", // @"@__prm2_0='a_' (Size = 4000) SELECT [f].[FirstName] FROM [FunkyCustomers] AS [f] -WHERE (@__prm2_0 = N'') OR ([f].[FirstName] IS NOT NULL AND (RIGHT([f].[FirstName], LEN(@__prm2_0)) = @__prm2_0))", +WHERE (@__prm2_0 = N'') OR (([f].[FirstName] IS NOT NULL) AND (RIGHT([f].[FirstName], LEN(@__prm2_0)) = @__prm2_0))", // @"SELECT [f].[FirstName] FROM [FunkyCustomers] AS [f] @@ -343,25 +343,25 @@ FROM [FunkyCustomers] AS [f] SELECT [f].[FirstName] FROM [FunkyCustomers] AS [f] -WHERE (@__prm4_0 = N'') OR ([f].[FirstName] IS NOT NULL AND (RIGHT([f].[FirstName], LEN(@__prm4_0)) = @__prm4_0))", +WHERE (@__prm4_0 = N'') OR (([f].[FirstName] IS NOT NULL) AND (RIGHT([f].[FirstName], LEN(@__prm4_0)) = @__prm4_0))", // @"@__prm5_0='_Ba_' (Size = 4000) SELECT [f].[FirstName] FROM [FunkyCustomers] AS [f] -WHERE (@__prm5_0 = N'') OR ([f].[FirstName] IS NOT NULL AND (RIGHT([f].[FirstName], LEN(@__prm5_0)) = @__prm5_0))", +WHERE (@__prm5_0 = N'') OR (([f].[FirstName] IS NOT NULL) AND (RIGHT([f].[FirstName], LEN(@__prm5_0)) = @__prm5_0))", // @"@__prm6_0='%B%a%r' (Size = 4000) SELECT [f].[FirstName] FROM [FunkyCustomers] AS [f] -WHERE (@__prm6_0 <> N'') AND ([f].[FirstName] IS NOT NULL AND (RIGHT([f].[FirstName], LEN(@__prm6_0)) <> @__prm6_0))", +WHERE (@__prm6_0 <> N'') AND (([f].[FirstName] IS NOT NULL) AND (RIGHT([f].[FirstName], LEN(@__prm6_0)) <> @__prm6_0))", // @"@__prm7_0='' (Size = 4000) SELECT [f].[FirstName] FROM [FunkyCustomers] AS [f] -WHERE (@__prm7_0 <> N'') AND ([f].[FirstName] IS NOT NULL AND (RIGHT([f].[FirstName], LEN(@__prm7_0)) <> @__prm7_0))", +WHERE (@__prm7_0 <> N'') AND (([f].[FirstName] IS NOT NULL) AND (RIGHT([f].[FirstName], LEN(@__prm7_0)) <> @__prm7_0))", // @"SELECT [f].[FirstName] FROM [FunkyCustomers] AS [f] @@ -376,7 +376,7 @@ public override async Task String_ends_with_on_argument_with_wildcard_column(boo @"SELECT [f].[FirstName] AS [fn], [f0].[LastName] AS [ln] FROM [FunkyCustomers] AS [f] CROSS JOIN [FunkyCustomers] AS [f0] -WHERE ([f0].[LastName] = N'') OR ([f].[FirstName] IS NOT NULL AND ([f0].[LastName] IS NOT NULL AND (RIGHT([f].[FirstName], LEN([f0].[LastName])) = [f0].[LastName])))"); +WHERE ([f0].[LastName] = N'') OR (([f].[FirstName] IS NOT NULL) AND (([f0].[LastName] IS NOT NULL) AND (RIGHT([f].[FirstName], LEN([f0].[LastName])) = [f0].[LastName])))"); } public override async Task String_ends_with_on_argument_with_wildcard_column_negated(bool async) @@ -387,7 +387,7 @@ public override async Task String_ends_with_on_argument_with_wildcard_column_neg @"SELECT [f].[FirstName] AS [fn], [f0].[LastName] AS [ln] FROM [FunkyCustomers] AS [f] CROSS JOIN [FunkyCustomers] AS [f0] -WHERE (([f0].[LastName] <> N'') OR [f0].[LastName] IS NULL) AND ([f].[FirstName] IS NOT NULL AND ([f0].[LastName] IS NOT NULL AND (RIGHT([f].[FirstName], LEN([f0].[LastName])) <> [f0].[LastName])))"); +WHERE (([f0].[LastName] <> N'') OR ([f0].[LastName] IS NULL)) AND (([f].[FirstName] IS NOT NULL) AND (([f0].[LastName] IS NOT NULL) AND (RIGHT([f].[FirstName], LEN([f0].[LastName])) <> [f0].[LastName])))"); } public override async Task String_ends_with_inside_conditional(bool async) @@ -399,7 +399,7 @@ public override async Task String_ends_with_inside_conditional(bool async) FROM [FunkyCustomers] AS [f] CROSS JOIN [FunkyCustomers] AS [f0] WHERE CASE - WHEN ([f0].[LastName] = N'') OR ([f].[FirstName] IS NOT NULL AND ([f0].[LastName] IS NOT NULL AND (RIGHT([f].[FirstName], LEN([f0].[LastName])) = [f0].[LastName]))) THEN CAST(1 AS bit) + WHEN ([f0].[LastName] = N'') OR (([f].[FirstName] IS NOT NULL) AND (([f0].[LastName] IS NOT NULL) AND (RIGHT([f].[FirstName], LEN([f0].[LastName])) = [f0].[LastName]))) THEN CAST(1 AS bit) ELSE CAST(0 AS bit) END = CAST(1 AS bit)"); } @@ -413,7 +413,7 @@ public override async Task String_ends_with_inside_conditional_negated(bool asyn FROM [FunkyCustomers] AS [f] CROSS JOIN [FunkyCustomers] AS [f0] WHERE CASE - WHEN (([f0].[LastName] <> N'') OR [f0].[LastName] IS NULL) AND ([f].[FirstName] IS NOT NULL AND ([f0].[LastName] IS NOT NULL AND (RIGHT([f].[FirstName], LEN([f0].[LastName])) <> [f0].[LastName]))) THEN CAST(1 AS bit) + WHEN (([f0].[LastName] <> N'') OR ([f0].[LastName] IS NULL)) AND (([f].[FirstName] IS NOT NULL) AND (([f0].[LastName] IS NOT NULL) AND (RIGHT([f].[FirstName], LEN([f0].[LastName])) <> [f0].[LastName]))) THEN CAST(1 AS bit) ELSE CAST(0 AS bit) END = CAST(1 AS bit)"); } @@ -427,7 +427,7 @@ public override async Task String_ends_with_equals_nullable_column(bool async) FROM [FunkyCustomers] AS [f] CROSS JOIN [FunkyCustomers] AS [f0] WHERE CASE - WHEN (([f0].[LastName] = N'') AND [f0].[LastName] IS NOT NULL) OR ([f].[FirstName] IS NOT NULL AND ([f0].[LastName] IS NOT NULL AND (RIGHT([f].[FirstName], LEN([f0].[LastName])) = [f0].[LastName]))) THEN CAST(1 AS bit) + WHEN (([f0].[LastName] = N'') AND ([f0].[LastName] IS NOT NULL)) OR (([f].[FirstName] IS NOT NULL) AND (([f0].[LastName] IS NOT NULL) AND (RIGHT([f].[FirstName], LEN([f0].[LastName])) = [f0].[LastName]))) THEN CAST(1 AS bit) ELSE CAST(0 AS bit) END = [f].[NullableBool]"); } @@ -441,7 +441,7 @@ public override async Task String_ends_with_not_equals_nullable_column(bool asyn FROM [FunkyCustomers] AS [f] CROSS JOIN [FunkyCustomers] AS [f0] WHERE (CASE - WHEN (([f0].[LastName] = N'') AND [f0].[LastName] IS NOT NULL) OR ([f].[FirstName] IS NOT NULL AND ([f0].[LastName] IS NOT NULL AND (RIGHT([f].[FirstName], LEN([f0].[LastName])) = [f0].[LastName]))) THEN CAST(1 AS bit) + WHEN (([f0].[LastName] = N'') AND ([f0].[LastName] IS NOT NULL)) OR (([f].[FirstName] IS NOT NULL) AND (([f0].[LastName] IS NOT NULL) AND (RIGHT([f].[FirstName], LEN([f0].[LastName])) = [f0].[LastName]))) THEN CAST(1 AS bit) ELSE CAST(0 AS bit) END <> [f].[NullableBool]) OR ([f].[NullableBool] IS NULL)"); } diff --git a/test/EFCore.SqlServer.FunctionalTests/Query/GearsOfWarQuerySqlServerTest.cs b/test/EFCore.SqlServer.FunctionalTests/Query/GearsOfWarQuerySqlServerTest.cs index 7bc0b549a99..001d0a2e78d 100644 --- a/test/EFCore.SqlServer.FunctionalTests/Query/GearsOfWarQuerySqlServerTest.cs +++ b/test/EFCore.SqlServer.FunctionalTests/Query/GearsOfWarQuerySqlServerTest.cs @@ -51,7 +51,7 @@ public override async Task Negate_on_like_expression(bool async) AssertSql( @"SELECT [s].[Id], [s].[Banner], [s].[Banner5], [s].[InternalNumber], [s].[Name] FROM [Squads] AS [s] -WHERE [s].[Name] IS NOT NULL AND NOT ([s].[Name] LIKE N'us%')"); +WHERE ([s].[Name] IS NOT NULL) AND NOT ([s].[Name] LIKE N'us%')"); } public override async Task Entity_equality_empty(bool async) @@ -216,7 +216,7 @@ public override async Task Include_where_list_contains_navigation(bool async) @"SELECT [g].[Nickname], [g].[SquadId], [g].[AssignedCityName], [g].[CityOfBirthName], [g].[Discriminator], [g].[FullName], [g].[HasSoulPatch], [g].[LeaderNickname], [g].[LeaderSquadId], [g].[Rank], [t].[Id], [t].[GearNickName], [t].[GearSquadId], [t].[IssueDate], [t].[Note] FROM [Gears] AS [g] LEFT JOIN [Tags] AS [t] ON ([g].[Nickname] = [t].[GearNickName]) AND ([g].[SquadId] = [t].[GearSquadId]) -WHERE [t].[Id] IS NOT NULL AND [t].[Id] IN ('34c8d86e-a4ac-4be5-827f-584dda348a07', 'df36f493-463f-4123-83f9-6b135deeb7ba', 'a8ad98f9-e023-4e2a-9a70-c2728455bd34', '70534e05-782c-4052-8720-c2c54481ce5f', 'a7be028a-0cf2-448f-ab55-ce8bc5d8cf69', 'b39a6fba-9026-4d69-828e-fd7068673e57')"); +WHERE ([t].[Id] IS NOT NULL) AND [t].[Id] IN ('34c8d86e-a4ac-4be5-827f-584dda348a07', 'df36f493-463f-4123-83f9-6b135deeb7ba', 'a8ad98f9-e023-4e2a-9a70-c2728455bd34', '70534e05-782c-4052-8720-c2c54481ce5f', 'a7be028a-0cf2-448f-ab55-ce8bc5d8cf69', 'b39a6fba-9026-4d69-828e-fd7068673e57')"); } public override async Task Include_where_list_contains_navigation2(bool async) @@ -231,7 +231,7 @@ public override async Task Include_where_list_contains_navigation2(bool async) FROM [Gears] AS [g] INNER JOIN [Cities] AS [c] ON [g].[CityOfBirthName] = [c].[Name] LEFT JOIN [Tags] AS [t] ON ([g].[Nickname] = [t].[GearNickName]) AND ([g].[SquadId] = [t].[GearSquadId]) -WHERE [c].[Location] IS NOT NULL AND [t].[Id] IN ('34c8d86e-a4ac-4be5-827f-584dda348a07', 'df36f493-463f-4123-83f9-6b135deeb7ba', 'a8ad98f9-e023-4e2a-9a70-c2728455bd34', '70534e05-782c-4052-8720-c2c54481ce5f', 'a7be028a-0cf2-448f-ab55-ce8bc5d8cf69', 'b39a6fba-9026-4d69-828e-fd7068673e57')"); +WHERE ([c].[Location] IS NOT NULL) AND [t].[Id] IN ('34c8d86e-a4ac-4be5-827f-584dda348a07', 'df36f493-463f-4123-83f9-6b135deeb7ba', 'a8ad98f9-e023-4e2a-9a70-c2728455bd34', '70534e05-782c-4052-8720-c2c54481ce5f', 'a7be028a-0cf2-448f-ab55-ce8bc5d8cf69', 'b39a6fba-9026-4d69-828e-fd7068673e57')"); } public override async Task Navigation_accessed_twice_outside_and_inside_subquery(bool async) @@ -245,7 +245,7 @@ public override async Task Navigation_accessed_twice_outside_and_inside_subquery @"SELECT [g].[Nickname], [g].[SquadId], [g].[AssignedCityName], [g].[CityOfBirthName], [g].[Discriminator], [g].[FullName], [g].[HasSoulPatch], [g].[LeaderNickname], [g].[LeaderSquadId], [g].[Rank] FROM [Gears] AS [g] LEFT JOIN [Tags] AS [t] ON ([g].[Nickname] = [t].[GearNickName]) AND ([g].[SquadId] = [t].[GearSquadId]) -WHERE [t].[Id] IS NOT NULL AND [t].[Id] IN ('34c8d86e-a4ac-4be5-827f-584dda348a07', 'df36f493-463f-4123-83f9-6b135deeb7ba', 'a8ad98f9-e023-4e2a-9a70-c2728455bd34', '70534e05-782c-4052-8720-c2c54481ce5f', 'a7be028a-0cf2-448f-ab55-ce8bc5d8cf69', 'b39a6fba-9026-4d69-828e-fd7068673e57')"); +WHERE ([t].[Id] IS NOT NULL) AND [t].[Id] IN ('34c8d86e-a4ac-4be5-827f-584dda348a07', 'df36f493-463f-4123-83f9-6b135deeb7ba', 'a8ad98f9-e023-4e2a-9a70-c2728455bd34', '70534e05-782c-4052-8720-c2c54481ce5f', 'a7be028a-0cf2-448f-ab55-ce8bc5d8cf69', 'b39a6fba-9026-4d69-828e-fd7068673e57')"); } public override async Task Include_with_join_multi_level(bool async) @@ -330,7 +330,7 @@ public override async Task Include_with_nested_navigation_in_order_by(bool async FROM [Weapons] AS [w] LEFT JOIN [Gears] AS [g] ON [w].[OwnerFullName] = [g].[FullName] LEFT JOIN [Cities] AS [c] ON [g].[CityOfBirthName] = [c].[Name] -WHERE ([g].[Nickname] <> N'Paduk') OR [g].[Nickname] IS NULL +WHERE ([g].[Nickname] <> N'Paduk') OR ([g].[Nickname] IS NULL) ORDER BY [c].[Name], [w].[Id]"); } @@ -563,10 +563,10 @@ FROM [Gears] AS [g0] ORDER BY [g0].[Nickname], [g0].[SquadId])) = ( SELECT TOP(1) [g0].[Rank] FROM [Gears] AS [g0] - ORDER BY [g0].[Nickname], [g0].[SquadId])) OR ( + ORDER BY [g0].[Nickname], [g0].[SquadId])) OR (( SELECT TOP(1) [g0].[Rank] FROM [Gears] AS [g0] - ORDER BY [g0].[Nickname], [g0].[SquadId]) IS NULL", + ORDER BY [g0].[Nickname], [g0].[SquadId]) IS NULL)", // @"SELECT [g].[Nickname], [g].[SquadId], [g].[AssignedCityName], [g].[CityOfBirthName], [g].[Discriminator], [g].[FullName], [g].[HasSoulPatch], [g].[LeaderNickname], [g].[LeaderSquadId], [g].[Rank] FROM [Gears] AS [g] @@ -576,10 +576,10 @@ FROM [Gears] AS [g0] ORDER BY [g0].[Nickname], [g0].[SquadId])) = ( SELECT TOP(1) [g0].[Rank] FROM [Gears] AS [g0] - ORDER BY [g0].[Nickname], [g0].[SquadId])) OR ( + ORDER BY [g0].[Nickname], [g0].[SquadId])) OR (( SELECT TOP(1) [g0].[Rank] FROM [Gears] AS [g0] - ORDER BY [g0].[Nickname], [g0].[SquadId]) IS NULL"); + ORDER BY [g0].[Nickname], [g0].[SquadId]) IS NULL)"); } public override async Task Where_enum_has_flag_subquery_client_eval(bool async) @@ -595,10 +595,10 @@ FROM [Gears] AS [g0] ORDER BY [g0].[Nickname], [g0].[SquadId])) = ( SELECT TOP(1) [g0].[Rank] FROM [Gears] AS [g0] - ORDER BY [g0].[Nickname], [g0].[SquadId])) OR ( + ORDER BY [g0].[Nickname], [g0].[SquadId])) OR (( SELECT TOP(1) [g0].[Rank] FROM [Gears] AS [g0] - ORDER BY [g0].[Nickname], [g0].[SquadId]) IS NULL"); + ORDER BY [g0].[Nickname], [g0].[SquadId]) IS NULL)"); } public override async Task Where_enum_has_flag_with_non_nullable_parameter(bool async) @@ -688,7 +688,7 @@ public override async Task Select_comparison_with_null(bool async) @"@__ammunitionType_0='1' (Nullable = true) SELECT [w].[Id], CASE - WHEN ([w].[AmmunitionType] = @__ammunitionType_0) AND [w].[AmmunitionType] IS NOT NULL THEN CAST(1 AS bit) + WHEN ([w].[AmmunitionType] = @__ammunitionType_0) AND ([w].[AmmunitionType] IS NOT NULL) THEN CAST(1 AS bit) ELSE CAST(0 AS bit) END AS [Cartridge] FROM [Weapons] AS [w] @@ -754,11 +754,11 @@ public override async Task Select_ternary_operation_with_has_value_not_null(bool AssertSql( @"SELECT [w].[Id], CASE - WHEN [w].[AmmunitionType] IS NOT NULL AND ([w].[AmmunitionType] = 1) THEN N'Yes' + WHEN ([w].[AmmunitionType] IS NOT NULL) AND ([w].[AmmunitionType] = 1) THEN N'Yes' ELSE N'No' END AS [IsCartridge] FROM [Weapons] AS [w] -WHERE [w].[AmmunitionType] IS NOT NULL AND ([w].[AmmunitionType] = 1)"); +WHERE ([w].[AmmunitionType] IS NOT NULL) AND ([w].[AmmunitionType] = 1)"); } public override async Task Select_ternary_operation_multiple_conditions(bool async) @@ -791,7 +791,7 @@ public override async Task Select_multiple_conditions(bool async) AssertSql( @"SELECT [w].[Id], CASE - WHEN ([w].[IsAutomatic] = CAST(0 AS bit)) AND (([w].[SynergyWithId] = 1) AND [w].[SynergyWithId] IS NOT NULL) THEN CAST(1 AS bit) + WHEN ([w].[IsAutomatic] = CAST(0 AS bit)) AND (([w].[SynergyWithId] = 1) AND ([w].[SynergyWithId] IS NOT NULL)) THEN CAST(1 AS bit) ELSE CAST(0 AS bit) END AS [IsCartridge] FROM [Weapons] AS [w]"); @@ -819,7 +819,7 @@ public override async Task Null_propagation_optimization1(bool async) AssertSql( @"SELECT [g].[Nickname], [g].[SquadId], [g].[AssignedCityName], [g].[CityOfBirthName], [g].[Discriminator], [g].[FullName], [g].[HasSoulPatch], [g].[LeaderNickname], [g].[LeaderSquadId], [g].[Rank] FROM [Gears] AS [g] -WHERE ([g].[LeaderNickname] = N'Marcus') AND [g].[LeaderNickname] IS NOT NULL"); +WHERE ([g].[LeaderNickname] = N'Marcus') AND ([g].[LeaderNickname] IS NOT NULL)"); } public override async Task Null_propagation_optimization2(bool async) @@ -833,7 +833,7 @@ FROM [Gears] AS [g] WHERE CASE WHEN [g].[LeaderNickname] IS NULL THEN NULL ELSE CASE - WHEN [g].[LeaderNickname] IS NOT NULL AND ([g].[LeaderNickname] LIKE N'%us') THEN CAST(1 AS bit) + WHEN ([g].[LeaderNickname] IS NOT NULL) AND ([g].[LeaderNickname] LIKE N'%us') THEN CAST(1 AS bit) ELSE CAST(0 AS bit) END END = CAST(1 AS bit)"); @@ -867,10 +867,10 @@ FROM [Gears] AS [g] WHERE (CASE WHEN [g].[LeaderNickname] IS NULL THEN NULL ELSE CAST(LEN([g].[LeaderNickname]) AS int) -END = 5) AND CASE +END = 5) AND (CASE WHEN [g].[LeaderNickname] IS NULL THEN NULL ELSE CAST(LEN([g].[LeaderNickname]) AS int) -END IS NOT NULL"); +END IS NOT NULL)"); } public override async Task Null_propagation_optimization5(bool async) @@ -884,10 +884,10 @@ FROM [Gears] AS [g] WHERE (CASE WHEN [g].[LeaderNickname] IS NOT NULL THEN CAST(LEN([g].[LeaderNickname]) AS int) ELSE NULL -END = 5) AND CASE +END = 5) AND (CASE WHEN [g].[LeaderNickname] IS NOT NULL THEN CAST(LEN([g].[LeaderNickname]) AS int) ELSE NULL -END IS NOT NULL"); +END IS NOT NULL)"); } public override async Task Null_propagation_optimization6(bool async) @@ -901,10 +901,10 @@ FROM [Gears] AS [g] WHERE (CASE WHEN [g].[LeaderNickname] IS NOT NULL THEN CAST(LEN([g].[LeaderNickname]) AS int) ELSE NULL -END = 5) AND CASE +END = 5) AND (CASE WHEN [g].[LeaderNickname] IS NOT NULL THEN CAST(LEN([g].[LeaderNickname]) AS int) ELSE NULL -END IS NOT NULL"); +END IS NOT NULL)"); } public override async Task Select_null_propagation_optimization7(bool async) @@ -972,7 +972,7 @@ public override async Task Select_null_propagation_negative3(bool async) AssertSql( @"SELECT [g0].[Nickname], CASE - WHEN [g0].[Nickname] IS NOT NULL AND [g0].[SquadId] IS NOT NULL THEN CASE + WHEN ([g0].[Nickname] IS NOT NULL) AND ([g0].[SquadId] IS NOT NULL) THEN CASE WHEN [g0].[LeaderNickname] IS NOT NULL THEN CAST(1 AS bit) ELSE CAST(0 AS bit) END @@ -989,7 +989,7 @@ public override async Task Select_null_propagation_negative4(bool async) AssertSql( @"SELECT CASE - WHEN [g0].[Nickname] IS NOT NULL AND [g0].[SquadId] IS NOT NULL THEN CAST(1 AS bit) + WHEN ([g0].[Nickname] IS NOT NULL) AND ([g0].[SquadId] IS NOT NULL) THEN CAST(1 AS bit) ELSE CAST(0 AS bit) END, [g0].[Nickname] FROM [Gears] AS [g] @@ -1003,7 +1003,7 @@ public override async Task Select_null_propagation_negative5(bool async) AssertSql( @"SELECT CASE - WHEN [g0].[Nickname] IS NOT NULL AND [g0].[SquadId] IS NOT NULL THEN CAST(1 AS bit) + WHEN ([g0].[Nickname] IS NOT NULL) AND ([g0].[SquadId] IS NOT NULL) THEN CAST(1 AS bit) ELSE CAST(0 AS bit) END, [g0].[Nickname] FROM [Gears] AS [g] @@ -1089,7 +1089,7 @@ ELSE NULL END FROM [Tags] AS [t] LEFT JOIN [Gears] AS [g] ON ([t].[GearNickName] = [g].[Nickname]) AND ([t].[GearSquadId] = [g].[SquadId]) -LEFT JOIN [Tags] AS [t0] ON (([g].[Nickname] = [t0].[GearNickName]) OR ([g].[Nickname] IS NULL AND [t0].[GearNickName] IS NULL)) AND (([g].[SquadId] = [t0].[GearSquadId]) OR ([g].[SquadId] IS NULL AND [t0].[GearSquadId] IS NULL)) +LEFT JOIN [Tags] AS [t0] ON (([g].[Nickname] = [t0].[GearNickName]) OR (([g].[Nickname] IS NULL) AND ([t0].[GearNickName] IS NULL))) AND (([g].[SquadId] = [t0].[GearSquadId]) OR (([g].[SquadId] IS NULL) AND ([t0].[GearSquadId] IS NULL))) LEFT JOIN [Gears] AS [g0] ON ([t0].[GearNickName] = [g0].[Nickname]) AND ([t0].[GearSquadId] = [g0].[SquadId]) LEFT JOIN [Cities] AS [c] ON [g0].[AssignedCityName] = [c].[Name]"); } @@ -1200,7 +1200,7 @@ FROM [Tags] AS [t] CROSS JOIN [Tags] AS [t0] LEFT JOIN [Gears] AS [g] ON ([t].[GearNickName] = [g].[Nickname]) AND ([t].[GearSquadId] = [g].[SquadId]) LEFT JOIN [Gears] AS [g0] ON ([t0].[GearNickName] = [g0].[Nickname]) AND ([t0].[GearSquadId] = [g0].[SquadId]) -WHERE ([g].[Nickname] = [g0].[Nickname]) OR ([g].[Nickname] IS NULL AND [g0].[Nickname] IS NULL)"); +WHERE ([g].[Nickname] = [g0].[Nickname]) OR (([g].[Nickname] IS NULL) AND ([g0].[Nickname] IS NULL))"); } public override async Task Select_Singleton_Navigation_With_Member_Access(bool async) @@ -1211,7 +1211,7 @@ public override async Task Select_Singleton_Navigation_With_Member_Access(bool a @"SELECT [g].[Nickname], [g].[SquadId], [g].[AssignedCityName], [g].[CityOfBirthName], [g].[Discriminator], [g].[FullName], [g].[HasSoulPatch], [g].[LeaderNickname], [g].[LeaderSquadId], [g].[Rank] FROM [Tags] AS [t] LEFT JOIN [Gears] AS [g] ON ([t].[GearNickName] = [g].[Nickname]) AND ([t].[GearSquadId] = [g].[SquadId]) -WHERE ([g].[Nickname] = N'Marcus') AND (([g].[CityOfBirthName] <> N'Ephyra') OR [g].[CityOfBirthName] IS NULL)"); +WHERE ([g].[Nickname] = N'Marcus') AND (([g].[CityOfBirthName] <> N'Ephyra') OR ([g].[CityOfBirthName] IS NULL))"); } public override async Task Select_Where_Navigation(bool async) @@ -1235,7 +1235,7 @@ FROM [Tags] AS [t] CROSS JOIN [Tags] AS [t0] LEFT JOIN [Gears] AS [g] ON ([t].[GearNickName] = [g].[Nickname]) AND ([t].[GearSquadId] = [g].[SquadId]) LEFT JOIN [Gears] AS [g0] ON ([t0].[GearNickName] = [g0].[Nickname]) AND ([t0].[GearSquadId] = [g0].[SquadId]) -WHERE (([g].[Nickname] = [g0].[Nickname]) OR ([g].[Nickname] IS NULL AND [g0].[Nickname] IS NULL)) AND (([g].[SquadId] = [g0].[SquadId]) OR ([g].[SquadId] IS NULL AND [g0].[SquadId] IS NULL))"); +WHERE (([g].[Nickname] = [g0].[Nickname]) OR (([g].[Nickname] IS NULL) AND ([g0].[Nickname] IS NULL))) AND (([g].[SquadId] = [g0].[SquadId]) OR (([g].[SquadId] IS NULL) AND ([g0].[SquadId] IS NULL)))"); } public override async Task Select_Where_Navigation_Null(bool async) @@ -1246,7 +1246,7 @@ public override async Task Select_Where_Navigation_Null(bool async) @"SELECT [t].[Id], [t].[GearNickName], [t].[GearSquadId], [t].[IssueDate], [t].[Note] FROM [Tags] AS [t] LEFT JOIN [Gears] AS [g] ON ([t].[GearNickName] = [g].[Nickname]) AND ([t].[GearSquadId] = [g].[SquadId]) -WHERE [g].[Nickname] IS NULL OR [g].[SquadId] IS NULL"); +WHERE ([g].[Nickname] IS NULL) OR ([g].[SquadId] IS NULL)"); } public override async Task Select_Where_Navigation_Null_Reverse(bool async) @@ -1257,7 +1257,7 @@ public override async Task Select_Where_Navigation_Null_Reverse(bool async) @"SELECT [t].[Id], [t].[GearNickName], [t].[GearSquadId], [t].[IssueDate], [t].[Note] FROM [Tags] AS [t] LEFT JOIN [Gears] AS [g] ON ([t].[GearNickName] = [g].[Nickname]) AND ([t].[GearSquadId] = [g].[SquadId]) -WHERE [g].[Nickname] IS NULL OR [g].[SquadId] IS NULL"); +WHERE ([g].[Nickname] IS NULL) OR ([g].[SquadId] IS NULL)"); } public override async Task Select_Where_Navigation_Scalar_Equals_Navigation_Scalar_Projected(bool async) @@ -1270,7 +1270,7 @@ FROM [Tags] AS [t] CROSS JOIN [Tags] AS [t0] LEFT JOIN [Gears] AS [g] ON ([t].[GearNickName] = [g].[Nickname]) AND ([t].[GearSquadId] = [g].[SquadId]) LEFT JOIN [Gears] AS [g0] ON ([t0].[GearNickName] = [g0].[Nickname]) AND ([t0].[GearSquadId] = [g0].[SquadId]) -WHERE ([g].[Nickname] = [g0].[Nickname]) OR ([g].[Nickname] IS NULL AND [g0].[Nickname] IS NULL)"); +WHERE ([g].[Nickname] = [g0].[Nickname]) OR (([g].[Nickname] IS NULL) AND ([g0].[Nickname] IS NULL))"); } public override async Task Optional_Navigation_Null_Coalesce_To_Clr_Type(bool async) @@ -1707,7 +1707,7 @@ public override async Task Singleton_Navigation_With_Member_Access(bool async) @"SELECT [g].[CityOfBirthName] AS [B] FROM [Tags] AS [t] LEFT JOIN [Gears] AS [g] ON ([t].[GearNickName] = [g].[Nickname]) AND ([t].[GearSquadId] = [g].[SquadId]) -WHERE ([g].[Nickname] = N'Marcus') AND (([g].[CityOfBirthName] <> N'Ephyra') OR [g].[CityOfBirthName] IS NULL)"); +WHERE ([g].[Nickname] = N'Marcus') AND (([g].[CityOfBirthName] <> N'Ephyra') OR ([g].[CityOfBirthName] IS NULL))"); } public override async Task GroupJoin_Composite_Key(bool async) @@ -2072,7 +2072,7 @@ public override async Task Coalesce_operator_in_projection_with_other_conditions AssertSql( @"SELECT CASE - WHEN (([w].[AmmunitionType] = 1) AND [w].[AmmunitionType] IS NOT NULL) AND (COALESCE([w].[IsAutomatic], CAST(0 AS bit)) = CAST(1 AS bit)) THEN CAST(1 AS bit) + WHEN (([w].[AmmunitionType] = 1) AND ([w].[AmmunitionType] IS NOT NULL)) AND (COALESCE([w].[IsAutomatic], CAST(0 AS bit)) = CAST(1 AS bit)) THEN CAST(1 AS bit) ELSE CAST(0 AS bit) END FROM [Weapons] AS [w]"); @@ -2086,7 +2086,7 @@ public override async Task Optional_navigation_type_compensation_works_with_pred @"SELECT [t].[Id], [t].[GearNickName], [t].[GearSquadId], [t].[IssueDate], [t].[Note] FROM [Tags] AS [t] LEFT JOIN [Gears] AS [g] ON ([t].[GearNickName] = [g].[Nickname]) AND ([t].[GearSquadId] = [g].[SquadId]) -WHERE (([t].[Note] <> N'K.I.A.') OR [t].[Note] IS NULL) AND ([g].[HasSoulPatch] = CAST(1 AS bit))"); +WHERE (([t].[Note] <> N'K.I.A.') OR ([t].[Note] IS NULL)) AND ([g].[HasSoulPatch] = CAST(1 AS bit))"); } public override async Task Optional_navigation_type_compensation_works_with_predicate2(bool async) @@ -2185,7 +2185,7 @@ public override async Task Optional_navigation_type_compensation_works_with_proj @"SELECT [g].[SquadId] FROM [Tags] AS [t] LEFT JOIN [Gears] AS [g] ON ([t].[GearNickName] = [g].[Nickname]) AND ([t].[GearSquadId] = [g].[SquadId]) -WHERE ([t].[Note] <> N'K.I.A.') OR [t].[Note] IS NULL"); +WHERE ([t].[Note] <> N'K.I.A.') OR ([t].[Note] IS NULL)"); } public override async Task Optional_navigation_type_compensation_works_with_projection_into_anonymous_type(bool async) @@ -2196,7 +2196,7 @@ public override async Task Optional_navigation_type_compensation_works_with_proj @"SELECT [g].[SquadId] FROM [Tags] AS [t] LEFT JOIN [Gears] AS [g] ON ([t].[GearNickName] = [g].[Nickname]) AND ([t].[GearSquadId] = [g].[SquadId]) -WHERE ([t].[Note] <> N'K.I.A.') OR [t].[Note] IS NULL"); +WHERE ([t].[Note] <> N'K.I.A.') OR ([t].[Note] IS NULL)"); } public override async Task Optional_navigation_type_compensation_works_with_DTOs(bool async) @@ -2207,7 +2207,7 @@ public override async Task Optional_navigation_type_compensation_works_with_DTOs @"SELECT [g].[SquadId] AS [Id] FROM [Tags] AS [t] LEFT JOIN [Gears] AS [g] ON ([t].[GearNickName] = [g].[Nickname]) AND ([t].[GearSquadId] = [g].[SquadId]) -WHERE ([t].[Note] <> N'K.I.A.') OR [t].[Note] IS NULL"); +WHERE ([t].[Note] <> N'K.I.A.') OR ([t].[Note] IS NULL)"); } public override async Task Optional_navigation_type_compensation_works_with_list_initializers(bool async) @@ -2218,7 +2218,7 @@ public override async Task Optional_navigation_type_compensation_works_with_list @"SELECT [g].[SquadId], [g].[SquadId] + 1 FROM [Tags] AS [t] LEFT JOIN [Gears] AS [g] ON ([t].[GearNickName] = [g].[Nickname]) AND ([t].[GearSquadId] = [g].[SquadId]) -WHERE ([t].[Note] <> N'K.I.A.') OR [t].[Note] IS NULL +WHERE ([t].[Note] <> N'K.I.A.') OR ([t].[Note] IS NULL) ORDER BY [t].[Note]"); } @@ -2230,7 +2230,7 @@ public override async Task Optional_navigation_type_compensation_works_with_arra @"SELECT [g].[SquadId] FROM [Tags] AS [t] LEFT JOIN [Gears] AS [g] ON ([t].[GearNickName] = [g].[Nickname]) AND ([t].[GearSquadId] = [g].[SquadId]) -WHERE ([t].[Note] <> N'K.I.A.') OR [t].[Note] IS NULL"); +WHERE ([t].[Note] <> N'K.I.A.') OR ([t].[Note] IS NULL)"); } public override async Task Optional_navigation_type_compensation_works_with_orderby(bool async) @@ -2241,7 +2241,7 @@ public override async Task Optional_navigation_type_compensation_works_with_orde @"SELECT [t].[Id], [t].[GearNickName], [t].[GearSquadId], [t].[IssueDate], [t].[Note] FROM [Tags] AS [t] LEFT JOIN [Gears] AS [g] ON ([t].[GearNickName] = [g].[Nickname]) AND ([t].[GearSquadId] = [g].[SquadId]) -WHERE ([t].[Note] <> N'K.I.A.') OR [t].[Note] IS NULL +WHERE ([t].[Note] <> N'K.I.A.') OR ([t].[Note] IS NULL) ORDER BY [g].[SquadId]"); } @@ -2255,7 +2255,7 @@ WHEN NOT EXISTS ( SELECT 1 FROM [Tags] AS [t] LEFT JOIN [Gears] AS [g] ON ([t].[GearNickName] = [g].[Nickname]) AND ([t].[GearSquadId] = [g].[SquadId]) - WHERE (([t].[Note] <> N'K.I.A.') OR [t].[Note] IS NULL) AND ([g].[HasSoulPatch] = CAST(0 AS bit))) THEN CAST(1 AS bit) + WHERE (([t].[Note] <> N'K.I.A.') OR ([t].[Note] IS NULL)) AND ([g].[HasSoulPatch] = CAST(0 AS bit))) THEN CAST(1 AS bit) ELSE CAST(0 AS bit) END"); } @@ -2268,7 +2268,7 @@ public override async Task Optional_navigation_type_compensation_works_with_nega @"SELECT [t].[Id], [t].[GearNickName], [t].[GearSquadId], [t].[IssueDate], [t].[Note] FROM [Tags] AS [t] LEFT JOIN [Gears] AS [g] ON ([t].[GearNickName] = [g].[Nickname]) AND ([t].[GearSquadId] = [g].[SquadId]) -WHERE (([t].[Note] <> N'K.I.A.') OR [t].[Note] IS NULL) AND ([g].[HasSoulPatch] = CAST(0 AS bit))"); +WHERE (([t].[Note] <> N'K.I.A.') OR ([t].[Note] IS NULL)) AND ([g].[HasSoulPatch] = CAST(0 AS bit))"); } public override async Task Optional_navigation_type_compensation_works_with_contains(bool async) @@ -2279,7 +2279,7 @@ public override async Task Optional_navigation_type_compensation_works_with_cont @"SELECT [t].[Id], [t].[GearNickName], [t].[GearSquadId], [t].[IssueDate], [t].[Note] FROM [Tags] AS [t] LEFT JOIN [Gears] AS [g] ON ([t].[GearNickName] = [g].[Nickname]) AND ([t].[GearSquadId] = [g].[SquadId]) -WHERE (([t].[Note] <> N'K.I.A.') OR [t].[Note] IS NULL) AND EXISTS ( +WHERE (([t].[Note] <> N'K.I.A.') OR ([t].[Note] IS NULL)) AND EXISTS ( SELECT 1 FROM [Gears] AS [g0] WHERE [g0].[SquadId] = [g].[SquadId])"); @@ -2403,7 +2403,7 @@ FROM [Gears] AS [g] LEFT JOIN ( SELECT [w].[Id], [w].[AmmunitionType], [w].[IsAutomatic], [w].[Name], [w].[OwnerFullName], [w].[SynergyWithId] FROM [Weapons] AS [w] - WHERE ([w].[Name] <> N'Lancer') OR [w].[Name] IS NULL + WHERE ([w].[Name] <> N'Lancer') OR ([w].[Name] IS NULL) ) AS [t] ON [g].[FullName] = [t].[OwnerFullName] WHERE [c].[Name] IN (N'Ephyra', N'Hanover') ORDER BY [g].[Nickname], [g].[SquadId], [c].[Name]"); @@ -2707,7 +2707,7 @@ public override async Task Distinct_with_optional_navigation_is_translated_to_sq @"SELECT DISTINCT [g].[HasSoulPatch] FROM [Gears] AS [g] LEFT JOIN [Tags] AS [t] ON ([g].[Nickname] = [t].[GearNickName]) AND ([g].[SquadId] = [t].[GearSquadId]) -WHERE ([t].[Note] <> N'Foo') OR [t].[Note] IS NULL"); +WHERE ([t].[Note] <> N'Foo') OR ([t].[Note] IS NULL)"); } public override async Task Sum_with_optional_navigation_is_translated_to_sql(bool async) @@ -2718,7 +2718,7 @@ public override async Task Sum_with_optional_navigation_is_translated_to_sql(boo @"SELECT COALESCE(SUM([g].[SquadId]), 0) FROM [Gears] AS [g] LEFT JOIN [Tags] AS [t] ON ([g].[Nickname] = [t].[GearNickName]) AND ([g].[SquadId] = [t].[GearSquadId]) -WHERE ([t].[Note] <> N'Foo') OR [t].[Note] IS NULL"); +WHERE ([t].[Note] <> N'Foo') OR ([t].[Note] IS NULL)"); } public override async Task Count_with_optional_navigation_is_translated_to_sql(bool async) @@ -2729,7 +2729,7 @@ public override async Task Count_with_optional_navigation_is_translated_to_sql(b @"SELECT COUNT(*) FROM [Gears] AS [g] LEFT JOIN [Tags] AS [t] ON ([g].[Nickname] = [t].[GearNickName]) AND ([g].[SquadId] = [t].[GearSquadId]) -WHERE ([t].[Note] <> N'Foo') OR [t].[Note] IS NULL"); +WHERE ([t].[Note] <> N'Foo') OR ([t].[Note] IS NULL)"); } public override async Task FirstOrDefault_with_manually_created_groupjoin_is_translated_to_sql(bool async) @@ -2767,7 +2767,7 @@ WHEN NOT EXISTS ( SELECT 1 FROM [Gears] AS [g] LEFT JOIN [Tags] AS [t] ON ([g].[Nickname] = [t].[GearNickName]) AND ([g].[SquadId] = [t].[GearSquadId]) - WHERE ([t].[Note] = N'Foo') AND [t].[Note] IS NOT NULL) THEN CAST(1 AS bit) + WHERE ([t].[Note] = N'Foo') AND ([t].[Note] IS NOT NULL)) THEN CAST(1 AS bit) ELSE CAST(0 AS bit) END"); } @@ -2882,7 +2882,7 @@ public override async Task Subquery_containing_join_gets_lifted_clashing_names(b FROM [Gears] AS [g] INNER JOIN [Tags] AS [t] ON [g].[Nickname] = [t].[GearNickName] INNER JOIN [Tags] AS [t0] ON [g].[Nickname] = [t0].[GearNickName] -WHERE ([t].[GearNickName] <> N'Cole Train') OR [t].[GearNickName] IS NULL +WHERE ([t].[GearNickName] <> N'Cole Train') OR ([t].[GearNickName] IS NULL) ORDER BY [g].[Nickname], [t0].[Id]"); } @@ -3279,7 +3279,7 @@ public override async Task Contains_on_nullable_array_produces_correct_sql(bool @"SELECT [g].[Nickname], [g].[SquadId], [g].[AssignedCityName], [g].[CityOfBirthName], [g].[Discriminator], [g].[FullName], [g].[HasSoulPatch], [g].[LeaderNickname], [g].[LeaderSquadId], [g].[Rank] FROM [Gears] AS [g] LEFT JOIN [Cities] AS [c] ON [g].[AssignedCityName] = [c].[Name] -WHERE ([g].[SquadId] < 2) AND (([c].[Name] = N'Ephyra') OR [c].[Name] IS NULL)"); +WHERE ([g].[SquadId] < 2) AND (([c].[Name] = N'Ephyra') OR ([c].[Name] IS NULL))"); } public override async Task Optional_navigation_with_collection_composite_key(bool async) @@ -3293,7 +3293,7 @@ LEFT JOIN [Gears] AS [g] ON ([t].[GearNickName] = [g].[Nickname]) AND ([t].[Gear WHERE ([g].[Discriminator] = N'Officer') AND (( SELECT COUNT(*) FROM [Gears] AS [g0] - WHERE (([g].[Nickname] IS NOT NULL AND [g].[SquadId] IS NOT NULL) AND (([g].[Nickname] = [g0].[LeaderNickname]) AND ([g].[SquadId] = [g0].[LeaderSquadId]))) AND ([g0].[Nickname] = N'Dom')) > 0)"); + WHERE ((([g].[Nickname] IS NOT NULL) AND ([g].[SquadId] IS NOT NULL)) AND (([g].[Nickname] = [g0].[LeaderNickname]) AND ([g].[SquadId] = [g0].[LeaderSquadId]))) AND ([g0].[Nickname] = N'Dom')) > 0)"); } public override async Task Select_null_conditional_with_inheritance(bool async) @@ -3350,7 +3350,7 @@ FROM [LocustLeaders] AS [l] WHERE [l].[Discriminator] = N'LocustCommander' ) AS [t] ON [f].[CommanderName] = [t].[Name] LEFT JOIN [Gears] AS [g] ON ([t].[DefeatedByNickname] = [g].[Nickname]) AND ([t].[DefeatedBySquadId] = [g].[SquadId]) -LEFT JOIN [Gears] AS [g0] ON (([g].[Nickname] = [g0].[LeaderNickname]) OR ([g].[Nickname] IS NULL AND [g0].[LeaderNickname] IS NULL)) AND ([g].[SquadId] = [g0].[LeaderSquadId]) +LEFT JOIN [Gears] AS [g0] ON (([g].[Nickname] = [g0].[LeaderNickname]) OR (([g].[Nickname] IS NULL) AND ([g0].[LeaderNickname] IS NULL))) AND ([g].[SquadId] = [g0].[LeaderSquadId]) ORDER BY [f].[Id], [t].[Name], [g].[Nickname], [g].[SquadId], [g0].[Nickname]"); } @@ -3367,7 +3367,7 @@ FROM [LocustLeaders] AS [l] WHERE [l].[Discriminator] = N'LocustCommander' ) AS [t] ON [f].[CommanderName] = [t].[Name] LEFT JOIN [Gears] AS [g] ON ([t].[DefeatedByNickname] = [g].[Nickname]) AND ([t].[DefeatedBySquadId] = [g].[SquadId]) -LEFT JOIN [Gears] AS [g0] ON (([g].[Nickname] = [g0].[LeaderNickname]) OR ([g].[Nickname] IS NULL AND [g0].[LeaderNickname] IS NULL)) AND ([g].[SquadId] = [g0].[LeaderSquadId]) +LEFT JOIN [Gears] AS [g0] ON (([g].[Nickname] = [g0].[LeaderNickname]) OR (([g].[Nickname] IS NULL) AND ([g0].[LeaderNickname] IS NULL))) AND ([g].[SquadId] = [g0].[LeaderSquadId]) ORDER BY [f].[Id], [t].[Name], [g].[Nickname], [g].[SquadId], [g0].[Nickname]"); } @@ -3404,7 +3404,7 @@ LEFT JOIN ( SELECT [g0].[Nickname], [g0].[SquadId], [g0].[AssignedCityName], [g0].[CityOfBirthName], [g0].[Discriminator], [g0].[FullName], [g0].[HasSoulPatch], [g0].[LeaderNickname], [g0].[LeaderSquadId], [g0].[Rank], [c].[Name], [c].[Location], [c].[Nation] FROM [Gears] AS [g0] INNER JOIN [Cities] AS [c] ON [g0].[CityOfBirthName] = [c].[Name] -) AS [t] ON (([g].[Nickname] = [t].[LeaderNickname]) OR ([g].[Nickname] IS NULL AND [t].[LeaderNickname] IS NULL)) AND ([g].[SquadId] = [t].[LeaderSquadId]) +) AS [t] ON (([g].[Nickname] = [t].[LeaderNickname]) OR (([g].[Nickname] IS NULL) AND ([t].[LeaderNickname] IS NULL))) AND ([g].[SquadId] = [t].[LeaderSquadId]) ORDER BY [l].[Name], [g].[Nickname], [g].[SquadId], [t].[Nickname], [t].[SquadId]"); } @@ -3508,7 +3508,7 @@ FROM [LocustLeaders] AS [l] WHERE [l].[Discriminator] = N'LocustCommander' ) AS [t] ON [f].[CommanderName] = [t].[Name] LEFT JOIN [Gears] AS [g] ON ([t].[DefeatedByNickname] = [g].[Nickname]) AND ([t].[DefeatedBySquadId] = [g].[SquadId]) -LEFT JOIN [Gears] AS [g0] ON (([g].[Nickname] = [g0].[LeaderNickname]) OR ([g].[Nickname] IS NULL AND [g0].[LeaderNickname] IS NULL)) AND ([g].[SquadId] = [g0].[LeaderSquadId]) +LEFT JOIN [Gears] AS [g0] ON (([g].[Nickname] = [g0].[LeaderNickname]) OR (([g].[Nickname] IS NULL) AND ([g0].[LeaderNickname] IS NULL))) AND ([g].[SquadId] = [g0].[LeaderSquadId]) ORDER BY [f].[Id], [t].[Name], [g].[Nickname], [g].[SquadId], [g0].[Nickname]"); } @@ -3555,7 +3555,7 @@ FROM [LocustLeaders] AS [l] WHERE [l].[Discriminator] = N'LocustCommander' ) AS [t] ON [f].[CommanderName] = [t].[Name] LEFT JOIN [Gears] AS [g] ON ([t].[DefeatedByNickname] = [g].[Nickname]) AND ([t].[DefeatedBySquadId] = [g].[SquadId]) -LEFT JOIN [Gears] AS [g0] ON (([g].[Nickname] = [g0].[LeaderNickname]) OR ([g].[Nickname] IS NULL AND [g0].[LeaderNickname] IS NULL)) AND ([g].[SquadId] = [g0].[LeaderSquadId]) +LEFT JOIN [Gears] AS [g0] ON (([g].[Nickname] = [g0].[LeaderNickname]) OR (([g].[Nickname] IS NULL) AND ([g0].[LeaderNickname] IS NULL))) AND ([g].[SquadId] = [g0].[LeaderSquadId]) ORDER BY [f].[Id], [t].[Name], [g].[Nickname], [g].[SquadId], [g0].[Nickname]"); } @@ -3581,7 +3581,7 @@ public override async Task Projecting_nullable_bool_in_conditional_works(bool as AssertSql( @"SELECT CASE - WHEN [g].[Nickname] IS NOT NULL AND [g].[SquadId] IS NOT NULL THEN [g].[HasSoulPatch] + WHEN ([g].[Nickname] IS NOT NULL) AND ([g].[SquadId] IS NOT NULL) THEN [g].[HasSoulPatch] ELSE CAST(0 AS bit) END AS [Prop] FROM [Tags] AS [t] @@ -3671,7 +3671,7 @@ FROM [Gears] AS [g] LEFT JOIN ( SELECT [w].[Id], [w].[AmmunitionType], [w].[IsAutomatic], [w].[Name], [w].[OwnerFullName], [w].[SynergyWithId] FROM [Weapons] AS [w] - WHERE ([w].[IsAutomatic] = CAST(1 AS bit)) OR (([w].[Name] <> N'foo') OR [w].[Name] IS NULL) + WHERE ([w].[IsAutomatic] = CAST(1 AS bit)) OR (([w].[Name] <> N'foo') OR ([w].[Name] IS NULL)) ) AS [t] ON [g].[FullName] = [t].[OwnerFullName] WHERE [g].[Nickname] <> N'Marcus' ORDER BY [g].[Nickname], [g].[SquadId]"); @@ -3687,7 +3687,7 @@ FROM [Gears] AS [g] LEFT JOIN ( SELECT [w].[Id], [w].[AmmunitionType], [w].[IsAutomatic], [w].[Name], [w].[OwnerFullName], [w].[SynergyWithId] FROM [Weapons] AS [w] - WHERE ([w].[IsAutomatic] = CAST(1 AS bit)) OR (([w].[Name] <> N'foo') OR [w].[Name] IS NULL) + WHERE ([w].[IsAutomatic] = CAST(1 AS bit)) OR (([w].[Name] <> N'foo') OR ([w].[Name] IS NULL)) ) AS [t] ON [g].[FullName] = [t].[OwnerFullName] WHERE [g].[Nickname] <> N'Marcus' ORDER BY [g].[Nickname], [g].[SquadId]"); @@ -3703,7 +3703,7 @@ FROM [Gears] AS [g] LEFT JOIN ( SELECT [w].[Id], [w].[AmmunitionType], [w].[IsAutomatic], [w].[Name], [w].[OwnerFullName], [w].[SynergyWithId] FROM [Weapons] AS [w] - WHERE ([w].[IsAutomatic] = CAST(1 AS bit)) OR (([w].[Name] <> N'foo') OR [w].[Name] IS NULL) + WHERE ([w].[IsAutomatic] = CAST(1 AS bit)) OR (([w].[Name] <> N'foo') OR ([w].[Name] IS NULL)) ) AS [t] ON [g].[FullName] = [t].[OwnerFullName] WHERE [g].[Nickname] <> N'Marcus' ORDER BY [g].[Nickname], [g].[SquadId]"); @@ -3719,7 +3719,7 @@ FROM [Gears] AS [g] LEFT JOIN ( SELECT [w].[Id], [w].[AmmunitionType], [w].[IsAutomatic], [w].[Name], [w].[OwnerFullName], [w].[SynergyWithId] FROM [Weapons] AS [w] - WHERE ([w].[IsAutomatic] = CAST(1 AS bit)) OR (([w].[Name] <> N'foo') OR [w].[Name] IS NULL) + WHERE ([w].[IsAutomatic] = CAST(1 AS bit)) OR (([w].[Name] <> N'foo') OR ([w].[Name] IS NULL)) ) AS [t] ON [g].[FullName] = [t].[OwnerFullName] WHERE [g].[Nickname] <> N'Marcus' ORDER BY [g].[Nickname], [g].[SquadId], [t].[Name] DESC"); @@ -3751,7 +3751,7 @@ FROM [Gears] AS [g] LEFT JOIN ( SELECT [w].[Name], [w].[Id], [w].[OwnerFullName] FROM [Weapons] AS [w] - WHERE ([w].[IsAutomatic] = CAST(1 AS bit)) OR (([w].[Name] <> N'foo') OR [w].[Name] IS NULL) + WHERE ([w].[IsAutomatic] = CAST(1 AS bit)) OR (([w].[Name] <> N'foo') OR ([w].[Name] IS NULL)) ) AS [t] ON [g].[FullName] = [t].[OwnerFullName] WHERE [g].[Nickname] <> N'Marcus' ORDER BY [g].[Nickname], [g].[SquadId]"); @@ -3767,7 +3767,7 @@ FROM [Gears] AS [g] LEFT JOIN ( SELECT N'BFG' AS [c], [w].[Id], [w].[OwnerFullName] FROM [Weapons] AS [w] - WHERE ([w].[IsAutomatic] = CAST(1 AS bit)) OR (([w].[Name] <> N'foo') OR [w].[Name] IS NULL) + WHERE ([w].[IsAutomatic] = CAST(1 AS bit)) OR (([w].[Name] <> N'foo') OR ([w].[Name] IS NULL)) ) AS [t] ON [g].[FullName] = [t].[OwnerFullName] WHERE [g].[Nickname] <> N'Marcus' ORDER BY [g].[Nickname], [g].[SquadId]"); @@ -3783,7 +3783,7 @@ FROM [Gears] AS [g] LEFT JOIN ( SELECT CAST(1 AS bit) AS [c], [w].[Id], [w].[OwnerFullName] FROM [Weapons] AS [w] - WHERE ([w].[IsAutomatic] = CAST(1 AS bit)) OR (([w].[Name] <> N'foo') OR [w].[Name] IS NULL) + WHERE ([w].[IsAutomatic] = CAST(1 AS bit)) OR (([w].[Name] <> N'foo') OR ([w].[Name] IS NULL)) ) AS [t] ON [g].[FullName] = [t].[OwnerFullName] WHERE [g].[Nickname] <> N'Marcus' ORDER BY [g].[Nickname], [g].[SquadId]"); @@ -3894,7 +3894,7 @@ FROM [Gears] AS [g0] LEFT JOIN ( SELECT [w].[Id], [w].[AmmunitionType], [w].[IsAutomatic], [w].[Name], [w].[OwnerFullName], [w].[SynergyWithId] FROM [Weapons] AS [w] - WHERE ([w].[Name] <> N'Bar') OR [w].[Name] IS NULL + WHERE ([w].[Name] <> N'Bar') OR ([w].[Name] IS NULL) ) AS [t] ON [g0].[FullName] = [t].[OwnerFullName] WHERE [g0].[FullName] <> N'Foo' ) AS [t0] ON ([g].[Nickname] = [t0].[LeaderNickname]) AND ([g].[SquadId] = [t0].[LeaderSquadId]) @@ -4031,7 +4031,7 @@ LEFT JOIN ( SELECT [w].[Id], [w].[AmmunitionType], [w].[IsAutomatic], [w].[Name], [w].[OwnerFullName], [w].[SynergyWithId], [g2].[Nickname], [g2].[SquadId], ( SELECT COUNT(*) FROM [Weapons] AS [w0] - WHERE [g2].[FullName] IS NOT NULL AND ([g2].[FullName] = [w0].[OwnerFullName])) AS [c] + WHERE ([g2].[FullName] IS NOT NULL) AND ([g2].[FullName] = [w0].[OwnerFullName])) AS [c] FROM [Weapons] AS [w] LEFT JOIN [Gears] AS [g2] ON [w].[OwnerFullName] = [g2].[FullName] ) AS [t0] ON [g1].[FullName] = [t0].[OwnerFullName] @@ -4061,7 +4061,7 @@ FROM [Weapons] AS [w] LEFT JOIN [Squads] AS [s] ON [g3].[SquadId] = [s].[Id] LEFT JOIN [Weapons] AS [w0] ON [g3].[FullName] = [w0].[OwnerFullName] LEFT JOIN [Gears] AS [g4] ON [s].[Id] = [g4].[SquadId] - WHERE ([w].[Name] <> N'Bar') OR [w].[Name] IS NULL + WHERE ([w].[Name] <> N'Bar') OR ([w].[Name] IS NULL) ) AS [t1] ON [g2].[FullName] = [t1].[OwnerFullName] WHERE [g2].[FullName] <> N'Foo' ) AS [t0] ON ([g].[Nickname] = [t0].[LeaderNickname]) AND ([g].[SquadId] = [t0].[LeaderSquadId]) @@ -4122,7 +4122,7 @@ FROM [Gears] AS [g0] OUTER APPLY ( SELECT [w].[Name], [g0].[Nickname], [w].[Id] FROM [Weapons] AS [w] - WHERE (([w].[Name] <> N'Bar') OR [w].[Name] IS NULL) AND ([g0].[FullName] = [w].[OwnerFullName]) + WHERE (([w].[Name] <> N'Bar') OR ([w].[Name] IS NULL)) AND ([g0].[FullName] = [w].[OwnerFullName]) ) AS [t] WHERE [g0].[FullName] <> N'Foo' ) AS [t0] ON ([g].[Nickname] = [t0].[LeaderNickname]) AND ([g].[SquadId] = [t0].[LeaderSquadId]) @@ -4143,7 +4143,7 @@ FROM [Gears] AS [g0] LEFT JOIN ( SELECT [w].[Name], [g].[Nickname], [w].[Id], [w].[OwnerFullName] FROM [Weapons] AS [w] - WHERE ([w].[Name] <> N'Bar') OR [w].[Name] IS NULL + WHERE ([w].[Name] <> N'Bar') OR ([w].[Name] IS NULL) ) AS [t] ON [g0].[FullName] = [t].[OwnerFullName] WHERE ([g0].[FullName] <> N'Foo') AND (([g].[Nickname] = [g0].[LeaderNickname]) AND ([g].[SquadId] = [g0].[LeaderSquadId])) ) AS [t0] @@ -4162,7 +4162,7 @@ CROSS JOIN [Squads] AS [s] LEFT JOIN ( SELECT [w].[Id], [w].[AmmunitionType], [w].[IsAutomatic], [w].[Name], [w].[OwnerFullName], [w].[SynergyWithId] FROM [Weapons] AS [w] - WHERE ([w].[IsAutomatic] = CAST(1 AS bit)) OR (([w].[Name] <> N'foo') OR [w].[Name] IS NULL) + WHERE ([w].[IsAutomatic] = CAST(1 AS bit)) OR (([w].[Name] <> N'foo') OR ([w].[Name] IS NULL)) ) AS [t] ON [g].[FullName] = [t].[OwnerFullName] LEFT JOIN ( SELECT [g0].[Nickname], [g0].[SquadId], [g0].[AssignedCityName], [g0].[CityOfBirthName], [g0].[Discriminator], [g0].[FullName], [g0].[HasSoulPatch], [g0].[LeaderNickname], [g0].[LeaderSquadId], [g0].[Rank] @@ -4294,7 +4294,7 @@ LEFT JOIN ( FROM [Gears] AS [g] WHERE [g].[Discriminator] = N'Officer' ) AS [t0] ON [t].[GearNickName] = [t0].[Nickname] -LEFT JOIN [Gears] AS [g0] ON (([t0].[Nickname] = [g0].[LeaderNickname]) OR ([t0].[Nickname] IS NULL AND [g0].[LeaderNickname] IS NULL)) AND ([t0].[SquadId] = [g0].[LeaderSquadId]) +LEFT JOIN [Gears] AS [g0] ON (([t0].[Nickname] = [g0].[LeaderNickname]) OR (([t0].[Nickname] IS NULL) AND ([g0].[LeaderNickname] IS NULL))) AND ([t0].[SquadId] = [g0].[LeaderSquadId]) ORDER BY [t].[Id], [t0].[Nickname], [t0].[SquadId], [g0].[Nickname]"); } @@ -4515,7 +4515,7 @@ public override async Task Include_on_derived_type_with_order_by_and_paging(bool SELECT TOP(@__p_0) [l].[Name], [l].[Discriminator], [l].[LocustHordeId], [l].[ThreatLevel], [l].[ThreatLevelByte], [l].[ThreatLevelNullableByte], [l].[DefeatedByNickname], [l].[DefeatedBySquadId], [l].[HighCommandId], [g].[Nickname], [g].[SquadId], [g].[AssignedCityName], [g].[CityOfBirthName], [g].[Discriminator] AS [Discriminator0], [g].[FullName], [g].[HasSoulPatch], [g].[LeaderNickname], [g].[LeaderSquadId], [g].[Rank], [t].[Id], [t].[Note] FROM [LocustLeaders] AS [l] LEFT JOIN [Gears] AS [g] ON ([l].[DefeatedByNickname] = [g].[Nickname]) AND ([l].[DefeatedBySquadId] = [g].[SquadId]) - LEFT JOIN [Tags] AS [t] ON (([g].[Nickname] = [t].[GearNickName]) OR ([g].[Nickname] IS NULL AND [t].[GearNickName] IS NULL)) AND (([g].[SquadId] = [t].[GearSquadId]) OR ([g].[SquadId] IS NULL AND [t].[GearSquadId] IS NULL)) + LEFT JOIN [Tags] AS [t] ON (([g].[Nickname] = [t].[GearNickName]) OR (([g].[Nickname] IS NULL) AND ([t].[GearNickName] IS NULL))) AND (([g].[SquadId] = [t].[GearSquadId]) OR (([g].[SquadId] IS NULL) AND ([t].[GearSquadId] IS NULL))) ORDER BY [t].[Note] ) AS [t0] LEFT JOIN [Weapons] AS [w] ON [t0].[FullName] = [w].[OwnerFullName] @@ -5363,7 +5363,7 @@ public override async Task Double_order_by_on_string_compare(bool async) @"SELECT [w].[Id], [w].[AmmunitionType], [w].[IsAutomatic], [w].[Name], [w].[OwnerFullName], [w].[SynergyWithId] FROM [Weapons] AS [w] ORDER BY CASE - WHEN ([w].[Name] = N'Marcus'' Lancer') AND [w].[Name] IS NOT NULL THEN CAST(1 AS bit) + WHEN ([w].[Name] = N'Marcus'' Lancer') AND ([w].[Name] IS NOT NULL) THEN CAST(1 AS bit) ELSE CAST(0 AS bit) END, [w].[Id]"); } @@ -5387,7 +5387,7 @@ public override async Task String_compare_with_null_conditional_argument(bool as FROM [Weapons] AS [w] LEFT JOIN [Weapons] AS [w0] ON [w].[SynergyWithId] = [w0].[Id] ORDER BY CASE - WHEN ([w0].[Name] = N'Marcus'' Lancer') AND [w0].[Name] IS NOT NULL THEN CAST(1 AS bit) + WHEN ([w0].[Name] = N'Marcus'' Lancer') AND ([w0].[Name] IS NOT NULL) THEN CAST(1 AS bit) ELSE CAST(0 AS bit) END"); } @@ -5401,7 +5401,7 @@ public override async Task String_compare_with_null_conditional_argument2(bool a FROM [Weapons] AS [w] LEFT JOIN [Weapons] AS [w0] ON [w].[SynergyWithId] = [w0].[Id] ORDER BY CASE - WHEN (N'Marcus'' Lancer' = [w0].[Name]) AND [w0].[Name] IS NOT NULL THEN CAST(1 AS bit) + WHEN (N'Marcus'' Lancer' = [w0].[Name]) AND ([w0].[Name] IS NOT NULL) THEN CAST(1 AS bit) ELSE CAST(0 AS bit) END"); } @@ -5743,7 +5743,7 @@ await base.Null_semantics_is_correctly_applied_for_function_comparisons_that_tak FROM [Tags] AS [t] LEFT JOIN [Gears] AS [g] ON ([t].[GearNickName] = [g].[Nickname]) AND ([t].[GearSquadId] = [g].[SquadId]) LEFT JOIN [Squads] AS [s] ON [g].[SquadId] = [s].[Id] -WHERE (SUBSTRING([t].[Note], 0 + 1, CAST(LEN([s].[Name]) AS int)) = [t].[GearNickName]) OR (([t].[Note] IS NULL OR [s].[Name] IS NULL) AND [t].[GearNickName] IS NULL)"); +WHERE (SUBSTRING([t].[Note], 0 + 1, CAST(LEN([s].[Name]) AS int)) = [t].[GearNickName]) OR ((([t].[Note] IS NULL) OR ([s].[Name] IS NULL)) AND ([t].[GearNickName] IS NULL))"); } public override async Task Filter_with_new_Guid(bool async) @@ -5783,7 +5783,7 @@ public override async Task OfTypeNav1(bool async) FROM [Gears] AS [g] LEFT JOIN [Tags] AS [t] ON ([g].[Nickname] = [t].[GearNickName]) AND ([g].[SquadId] = [t].[GearSquadId]) LEFT JOIN [Tags] AS [t0] ON ([g].[Nickname] = [t0].[GearNickName]) AND ([g].[SquadId] = [t0].[GearSquadId]) -WHERE ((([t].[Note] <> N'Foo') OR [t].[Note] IS NULL) AND ([g].[Discriminator] = N'Officer')) AND (([t0].[Note] <> N'Bar') OR [t0].[Note] IS NULL)"); +WHERE ((([t].[Note] <> N'Foo') OR ([t].[Note] IS NULL)) AND ([g].[Discriminator] = N'Officer')) AND (([t0].[Note] <> N'Bar') OR ([t0].[Note] IS NULL))"); } public override async Task OfTypeNav2(bool async) @@ -5795,7 +5795,7 @@ public override async Task OfTypeNav2(bool async) FROM [Gears] AS [g] LEFT JOIN [Tags] AS [t] ON ([g].[Nickname] = [t].[GearNickName]) AND ([g].[SquadId] = [t].[GearSquadId]) LEFT JOIN [Cities] AS [c] ON [g].[AssignedCityName] = [c].[Name] -WHERE ((([t].[Note] <> N'Foo') OR [t].[Note] IS NULL) AND ([g].[Discriminator] = N'Officer')) AND (([c].[Location] <> 'Bar') OR [c].[Location] IS NULL)"); +WHERE ((([t].[Note] <> N'Foo') OR ([t].[Note] IS NULL)) AND ([g].[Discriminator] = N'Officer')) AND (([c].[Location] <> 'Bar') OR ([c].[Location] IS NULL))"); } public override async Task OfTypeNav3(bool async) @@ -5808,7 +5808,7 @@ FROM [Gears] AS [g] LEFT JOIN [Tags] AS [t] ON ([g].[Nickname] = [t].[GearNickName]) AND ([g].[SquadId] = [t].[GearSquadId]) INNER JOIN [Weapons] AS [w] ON [g].[FullName] = [w].[OwnerFullName] LEFT JOIN [Tags] AS [t0] ON ([g].[Nickname] = [t0].[GearNickName]) AND ([g].[SquadId] = [t0].[GearSquadId]) -WHERE ((([t].[Note] <> N'Foo') OR [t].[Note] IS NULL) AND ([g].[Discriminator] = N'Officer')) AND (([t0].[Note] <> N'Bar') OR [t0].[Note] IS NULL)"); +WHERE ((([t].[Note] <> N'Foo') OR ([t].[Note] IS NULL)) AND ([g].[Discriminator] = N'Officer')) AND (([t0].[Note] <> N'Bar') OR ([t0].[Note] IS NULL))"); } public override void Nav_rewrite_Distinct_with_convert() @@ -5840,7 +5840,7 @@ LEFT JOIN ( FROM [LocustLeaders] AS [l] WHERE [l].[Discriminator] = N'LocustCommander' ) AS [t] ON [f].[CommanderName] = [t].[Name] -WHERE ([c].[Name] <> N'Foo') OR [c].[Name] IS NULL"); +WHERE ([c].[Name] <> N'Foo') OR ([c].[Name] IS NULL)"); } public override async Task Nav_rewrite_with_convert2(bool async) @@ -5856,7 +5856,7 @@ SELECT [l].[Name] FROM [LocustLeaders] AS [l] WHERE [l].[Discriminator] = N'LocustCommander' ) AS [t] ON [f].[CommanderName] = [t].[Name] -WHERE (([c].[Name] <> N'Foo') OR [c].[Name] IS NULL) AND (([t].[Name] <> N'Bar') OR [t].[Name] IS NULL)"); +WHERE (([c].[Name] <> N'Foo') OR ([c].[Name] IS NULL)) AND (([t].[Name] <> N'Bar') OR ([t].[Name] IS NULL))"); } public override async Task Nav_rewrite_with_convert3(bool async) @@ -5872,7 +5872,7 @@ SELECT [l].[Name] FROM [LocustLeaders] AS [l] WHERE [l].[Discriminator] = N'LocustCommander' ) AS [t] ON [f].[CommanderName] = [t].[Name] -WHERE (([c].[Name] <> N'Foo') OR [c].[Name] IS NULL) AND (([t].[Name] <> N'Bar') OR [t].[Name] IS NULL)"); +WHERE (([c].[Name] <> N'Foo') OR ([c].[Name] IS NULL)) AND (([t].[Name] <> N'Bar') OR ([t].[Name] IS NULL))"); } public override async Task Where_contains_on_navigation_with_composite_keys(bool async) @@ -5968,7 +5968,7 @@ public override async Task Left_join_projection_using_conditional_tracking(bool AssertSql( @"SELECT CASE - WHEN [g0].[Nickname] IS NULL OR [g0].[SquadId] IS NULL THEN CAST(1 AS bit) + WHEN ([g0].[Nickname] IS NULL) OR ([g0].[SquadId] IS NULL) THEN CAST(1 AS bit) ELSE CAST(0 AS bit) END, [g].[Nickname], [g].[SquadId], [g].[AssignedCityName], [g].[CityOfBirthName], [g].[Discriminator], [g].[FullName], [g].[HasSoulPatch], [g].[LeaderNickname], [g].[LeaderSquadId], [g].[Rank], [g0].[Nickname], [g0].[SquadId], [g0].[AssignedCityName], [g0].[CityOfBirthName], [g0].[Discriminator], [g0].[FullName], [g0].[HasSoulPatch], [g0].[LeaderNickname], [g0].[LeaderSquadId], [g0].[Rank] FROM [Gears] AS [g] @@ -5990,7 +5990,7 @@ LEFT JOIN ( FROM [Gears] AS [g0] ) AS [t1] WHERE [t1].[row] <= 50 -) AS [t0] ON (([g].[Nickname] = [t0].[LeaderNickname]) OR ([g].[Nickname] IS NULL AND [t0].[LeaderNickname] IS NULL)) AND ([g].[SquadId] = [t0].[LeaderSquadId]) +) AS [t0] ON (([g].[Nickname] = [t0].[LeaderNickname]) OR (([g].[Nickname] IS NULL) AND ([t0].[LeaderNickname] IS NULL))) AND ([g].[SquadId] = [t0].[LeaderSquadId]) WHERE [g].[Discriminator] = N'Officer' ORDER BY [t].[Id], [g].[Nickname], [g].[SquadId], [t0].[Nickname]"); } @@ -6003,7 +6003,7 @@ public override async Task Project_collection_navigation_nested_composite_key(bo @"SELECT [t].[Id], [g].[Nickname], [g].[SquadId], [g0].[Nickname], [g0].[SquadId], [g0].[AssignedCityName], [g0].[CityOfBirthName], [g0].[Discriminator], [g0].[FullName], [g0].[HasSoulPatch], [g0].[LeaderNickname], [g0].[LeaderSquadId], [g0].[Rank] FROM [Tags] AS [t] LEFT JOIN [Gears] AS [g] ON ([t].[GearNickName] = [g].[Nickname]) AND ([t].[GearSquadId] = [g].[SquadId]) -LEFT JOIN [Gears] AS [g0] ON (([g].[Nickname] = [g0].[LeaderNickname]) OR ([g].[Nickname] IS NULL AND [g0].[LeaderNickname] IS NULL)) AND ([g].[SquadId] = [g0].[LeaderSquadId]) +LEFT JOIN [Gears] AS [g0] ON (([g].[Nickname] = [g0].[LeaderNickname]) OR (([g].[Nickname] IS NULL) AND ([g0].[LeaderNickname] IS NULL))) AND ([g].[SquadId] = [g0].[LeaderSquadId]) WHERE [g].[Discriminator] = N'Officer' ORDER BY [t].[Id], [g].[Nickname], [g].[SquadId], [g0].[Nickname]"); } @@ -6239,7 +6239,7 @@ public override async Task Accessing_property_of_optional_navigation_in_child_pr AssertSql( @"SELECT CASE - WHEN [g].[Nickname] IS NOT NULL AND [g].[SquadId] IS NOT NULL THEN CAST(1 AS bit) + WHEN ([g].[Nickname] IS NOT NULL) AND ([g].[SquadId] IS NOT NULL) THEN CAST(1 AS bit) ELSE CAST(0 AS bit) END, [t].[Id], [g].[Nickname], [g].[SquadId], [t0].[Nickname], [t0].[Id], [t0].[SquadId] FROM [Tags] AS [t] @@ -6550,11 +6550,11 @@ FROM [Factions] AS [f] SELECT TOP(1) [c0].[Name] FROM [Gears] AS [g] INNER JOIN [Cities] AS [c0] ON [g].[CityOfBirthName] = [c0].[Name] - ORDER BY [g].[Nickname])) OR ([c].[Name] IS NULL AND ( + ORDER BY [g].[Nickname])) OR (([c].[Name] IS NULL) AND (( SELECT TOP(1) [c0].[Name] FROM [Gears] AS [g] INNER JOIN [Cities] AS [c0] ON [g].[CityOfBirthName] = [c0].[Name] - ORDER BY [g].[Nickname]) IS NULL)"); + ORDER BY [g].[Nickname]) IS NULL))"); } public override async Task Bitwise_operation_with_non_null_parameter_optimizes_null_checks(bool async) @@ -6609,7 +6609,7 @@ FROM [Weapons] AS [w] SELECT [w].[Id], [w].[AmmunitionType], [w].[IsAutomatic], [w].[Name], [w].[OwnerFullName], [w].[SynergyWithId] FROM [Weapons] AS [w] -WHERE (([w].[AmmunitionType] & @__prm_0) <> 0) OR [w].[AmmunitionType] IS NULL", +WHERE (([w].[AmmunitionType] & @__prm_0) <> 0) OR ([w].[AmmunitionType] IS NULL)", // @"@__prm_0='1' (Nullable = true) @@ -6762,10 +6762,10 @@ WHERE CASE WHEN (( SELECT TOP(1) [w].[Name] FROM [Weapons] AS [w] - WHERE [w].[Id] = [g].[SquadId]) = @__prm2_1) AND ( + WHERE [w].[Id] = [g].[SquadId]) = @__prm2_1) AND (( SELECT TOP(1) [w].[Name] FROM [Weapons] AS [w] - WHERE [w].[Id] = [g].[SquadId]) IS NOT NULL THEN CAST(1 AS bit) + WHERE [w].[Id] = [g].[SquadId]) IS NOT NULL) THEN CAST(1 AS bit) ELSE CAST(0 AS bit) END ELSE CAST(0 AS bit) @@ -6982,7 +6982,7 @@ FROM [LocustLeaders] AS [l] WHERE EXISTS ( SELECT 1 FROM [LocustLeaders] AS [l0] - WHERE ([l0].[ThreatLevelNullableByte] = [l].[ThreatLevelNullableByte]) OR ([l0].[ThreatLevelNullableByte] IS NULL AND [l].[ThreatLevelNullableByte] IS NULL))"); + WHERE ([l0].[ThreatLevelNullableByte] = [l].[ThreatLevelNullableByte]) OR (([l0].[ThreatLevelNullableByte] IS NULL) AND ([l].[ThreatLevelNullableByte] IS NULL)))"); } public override async Task Contains_on_collection_of_nullable_byte_subquery_null_constant(bool async) @@ -7071,7 +7071,7 @@ FROM [Gears] AS [g] WHERE EXISTS ( SELECT 1 FROM [LocustLeaders] AS [l0] - WHERE ([l0].[ThreatLevelNullableByte] = [l].[ThreatLevelNullableByte]) OR ([l0].[ThreatLevelNullableByte] IS NULL AND [l].[ThreatLevelNullableByte] IS NULL)) + WHERE ([l0].[ThreatLevelNullableByte] = [l].[ThreatLevelNullableByte]) OR (([l0].[ThreatLevelNullableByte] IS NULL) AND ([l].[ThreatLevelNullableByte] IS NULL))) ) AS [t]"); } @@ -7088,7 +7088,7 @@ FROM [Gears] AS [g] WHERE NOT (EXISTS ( SELECT 1 FROM [LocustLeaders] AS [l0] - WHERE ([l0].[ThreatLevelNullableByte] = [l].[ThreatLevelNullableByte]) OR ([l0].[ThreatLevelNullableByte] IS NULL AND [l].[ThreatLevelNullableByte] IS NULL))) + WHERE ([l0].[ThreatLevelNullableByte] = [l].[ThreatLevelNullableByte]) OR (([l0].[ThreatLevelNullableByte] IS NULL) AND ([l].[ThreatLevelNullableByte] IS NULL)))) ) AS [t]"); } @@ -7148,7 +7148,7 @@ public override async Task Enum_array_contains(bool async) @"SELECT [w].[Id], [w].[AmmunitionType], [w].[IsAutomatic], [w].[Name], [w].[OwnerFullName], [w].[SynergyWithId] FROM [Weapons] AS [w] LEFT JOIN [Weapons] AS [w0] ON [w].[SynergyWithId] = [w0].[Id] -WHERE [w0].[Id] IS NOT NULL AND (([w0].[AmmunitionType] = 1) OR [w0].[AmmunitionType] IS NULL)"); +WHERE ([w0].[Id] IS NOT NULL) AND (([w0].[AmmunitionType] = 1) OR ([w0].[AmmunitionType] IS NULL))"); } [ConditionalTheory] @@ -7204,7 +7204,7 @@ public override async Task SelectMany_predicate_with_non_equality_comparison_con AssertSql( @"SELECT [g].[Nickname], [g].[SquadId], [g].[AssignedCityName], [g].[CityOfBirthName], [g].[Discriminator], [g].[FullName], [g].[HasSoulPatch], [g].[LeaderNickname], [g].[LeaderSquadId], [g].[Rank], [w].[Id], [w].[AmmunitionType], [w].[IsAutomatic], [w].[Name], [w].[OwnerFullName], [w].[SynergyWithId] FROM [Gears] AS [g] -INNER JOIN [Weapons] AS [w] ON ([g].[FullName] <> [w].[OwnerFullName]) OR [w].[OwnerFullName] IS NULL +INNER JOIN [Weapons] AS [w] ON ([g].[FullName] <> [w].[OwnerFullName]) OR ([w].[OwnerFullName] IS NULL) ORDER BY [g].[Nickname], [w].[Id]"); } @@ -7215,7 +7215,7 @@ public override async Task SelectMany_predicate_with_non_equality_comparison_Def AssertSql( @"SELECT [g].[Nickname], [g].[SquadId], [g].[AssignedCityName], [g].[CityOfBirthName], [g].[Discriminator], [g].[FullName], [g].[HasSoulPatch], [g].[LeaderNickname], [g].[LeaderSquadId], [g].[Rank], [w].[Id], [w].[AmmunitionType], [w].[IsAutomatic], [w].[Name], [w].[OwnerFullName], [w].[SynergyWithId] FROM [Gears] AS [g] -LEFT JOIN [Weapons] AS [w] ON ([g].[FullName] <> [w].[OwnerFullName]) OR [w].[OwnerFullName] IS NULL +LEFT JOIN [Weapons] AS [w] ON ([g].[FullName] <> [w].[OwnerFullName]) OR ([w].[OwnerFullName] IS NULL) ORDER BY [g].[Nickname], [w].[Id]"); } @@ -7231,7 +7231,7 @@ LEFT JOIN ( SELECT [w0].[Id], [w0].[AmmunitionType], [w0].[IsAutomatic], [w0].[Name], [w0].[OwnerFullName], [w0].[SynergyWithId] FROM [Weapons] AS [w] LEFT JOIN [Weapons] AS [w0] ON [w].[SynergyWithId] = [w0].[Id] -) AS [t] ON ([g].[FullName] <> [t].[OwnerFullName]) OR [t].[OwnerFullName] IS NULL +) AS [t] ON ([g].[FullName] <> [t].[OwnerFullName]) OR ([t].[OwnerFullName] IS NULL) ORDER BY [g].[Nickname], [t].[Id]"); } @@ -7242,7 +7242,7 @@ public override async Task SelectMany_without_result_selector_and_non_equality_c AssertSql( @"SELECT [w].[Id], [w].[AmmunitionType], [w].[IsAutomatic], [w].[Name], [w].[OwnerFullName], [w].[SynergyWithId] FROM [Gears] AS [g] -LEFT JOIN [Weapons] AS [w] ON ([g].[FullName] <> [w].[OwnerFullName]) OR [w].[OwnerFullName] IS NULL"); +LEFT JOIN [Weapons] AS [w] ON ([g].[FullName] <> [w].[OwnerFullName]) OR ([w].[OwnerFullName] IS NULL)"); } public override async Task Filtered_collection_projection_with_order_comparison_predicate_converted_to_join(bool async) @@ -7288,7 +7288,7 @@ FROM [Gears] AS [g] CROSS APPLY ( SELECT TOP(3) [w].[Id], [w].[AmmunitionType], [w].[IsAutomatic], [w].[Name], [w].[OwnerFullName], [w].[SynergyWithId] FROM [Weapons] AS [w] - WHERE ([w].[OwnerFullName] <> [g].[FullName]) OR [w].[OwnerFullName] IS NULL + WHERE ([w].[OwnerFullName] <> [g].[FullName]) OR ([w].[OwnerFullName] IS NULL) ORDER BY [w].[Id] ) AS [t] ORDER BY [g].[Nickname], [t].[Id]"); @@ -7330,11 +7330,11 @@ public override async Task Accessing_derived_property_using_hard_and_soft_cast(b AssertSql( @"SELECT [l].[Name], [l].[Discriminator], [l].[LocustHordeId], [l].[ThreatLevel], [l].[ThreatLevelByte], [l].[ThreatLevelNullableByte], [l].[DefeatedByNickname], [l].[DefeatedBySquadId], [l].[HighCommandId] FROM [LocustLeaders] AS [l] -WHERE ([l].[Discriminator] = N'LocustCommander') AND (([l].[HighCommandId] <> 0) OR [l].[HighCommandId] IS NULL)", +WHERE ([l].[Discriminator] = N'LocustCommander') AND (([l].[HighCommandId] <> 0) OR ([l].[HighCommandId] IS NULL))", // @"SELECT [l].[Name], [l].[Discriminator], [l].[LocustHordeId], [l].[ThreatLevel], [l].[ThreatLevelByte], [l].[ThreatLevelNullableByte], [l].[DefeatedByNickname], [l].[DefeatedBySquadId], [l].[HighCommandId] FROM [LocustLeaders] AS [l] -WHERE ([l].[Discriminator] = N'LocustCommander') AND (([l].[HighCommandId] <> 0) OR [l].[HighCommandId] IS NULL)"); +WHERE ([l].[Discriminator] = N'LocustCommander') AND (([l].[HighCommandId] <> 0) OR ([l].[HighCommandId] IS NULL))"); } public override async Task Cast_to_derived_followed_by_include_and_FirstOrDefault(bool async) @@ -7471,7 +7471,7 @@ public override async Task Composite_key_entity_equal_null(bool async) @"SELECT [l].[Name], [l].[Discriminator], [l].[LocustHordeId], [l].[ThreatLevel], [l].[ThreatLevelByte], [l].[ThreatLevelNullableByte], [l].[DefeatedByNickname], [l].[DefeatedBySquadId], [l].[HighCommandId] FROM [LocustLeaders] AS [l] LEFT JOIN [Gears] AS [g] ON ([l].[DefeatedByNickname] = [g].[Nickname]) AND ([l].[DefeatedBySquadId] = [g].[SquadId]) -WHERE ([l].[Discriminator] = N'LocustCommander') AND ([g].[Nickname] IS NULL OR [g].[SquadId] IS NULL)"); +WHERE ([l].[Discriminator] = N'LocustCommander') AND (([g].[Nickname] IS NULL) OR ([g].[SquadId] IS NULL))"); } public override async Task Composite_key_entity_not_equal_null(bool async) @@ -7482,7 +7482,7 @@ public override async Task Composite_key_entity_not_equal_null(bool async) @"SELECT [l].[Name], [l].[Discriminator], [l].[LocustHordeId], [l].[ThreatLevel], [l].[ThreatLevelByte], [l].[ThreatLevelNullableByte], [l].[DefeatedByNickname], [l].[DefeatedBySquadId], [l].[HighCommandId] FROM [LocustLeaders] AS [l] LEFT JOIN [Gears] AS [g] ON ([l].[DefeatedByNickname] = [g].[Nickname]) AND ([l].[DefeatedBySquadId] = [g].[SquadId]) -WHERE ([l].[Discriminator] = N'LocustCommander') AND ([g].[Nickname] IS NOT NULL AND [g].[SquadId] IS NOT NULL)"); +WHERE ([l].[Discriminator] = N'LocustCommander') AND (([g].[Nickname] IS NOT NULL) AND ([g].[SquadId] IS NOT NULL))"); } [ConditionalFact] @@ -7602,7 +7602,7 @@ public override async Task Projecting_property_converted_to_nullable_with_condit AssertSql( @"SELECT CASE - WHEN ([t].[Note] <> N'K.I.A.') OR [t].[Note] IS NULL THEN CASE + WHEN ([t].[Note] <> N'K.I.A.') OR ([t].[Note] IS NULL) THEN CASE WHEN [t].[GearNickName] IS NOT NULL THEN [g].[SquadId] ELSE NULL END @@ -7716,10 +7716,10 @@ public override async Task Projecting_property_converted_to_nullable_into_unary( @"SELECT [t].[Note] FROM [Tags] AS [t] LEFT JOIN [Gears] AS [g] ON ([t].[GearNickName] = [g].[Nickname]) AND ([t].[GearSquadId] = [g].[SquadId]) -WHERE CASE +WHERE (CASE WHEN [t].[GearNickName] IS NOT NULL THEN [g].[Nickname] ELSE NULL -END IS NOT NULL AND (CASE +END IS NOT NULL) AND (CASE WHEN [t].[GearNickName] IS NOT NULL THEN [g].[HasSoulPatch] ELSE NULL END = CAST(0 AS bit)) @@ -7734,7 +7734,7 @@ public override async Task Projecting_property_converted_to_nullable_into_member @"SELECT [g].[Nickname] FROM [Gears] AS [g] LEFT JOIN [Tags] AS [t] ON ([g].[Nickname] = [t].[GearNickName]) AND ([g].[SquadId] = [t].[GearSquadId]) -WHERE (DATEPART(month, [t].[IssueDate]) <> 5) OR [t].[IssueDate] IS NULL +WHERE (DATEPART(month, [t].[IssueDate]) <> 5) OR ([t].[IssueDate] IS NULL) ORDER BY [g].[Nickname]"); } @@ -8147,7 +8147,7 @@ public override async Task Project_navigation_defined_on_derived_from_entity_wit AssertSql( @"SELECT [l].[Name], [l].[Discriminator], [l].[LocustHordeId], [l].[ThreatLevel], [l].[ThreatLevelByte], [l].[ThreatLevelNullableByte], [l].[DefeatedByNickname], [l].[DefeatedBySquadId], [l].[HighCommandId], [g].[Nickname], [g].[SquadId], [g].[AssignedCityName], [g].[CityOfBirthName], [g].[Discriminator], [g].[FullName], [g].[HasSoulPatch], [g].[LeaderNickname], [g].[LeaderSquadId], [g].[Rank], CASE - WHEN [g].[Nickname] IS NULL OR [g].[SquadId] IS NULL THEN CAST(1 AS bit) + WHEN ([g].[Nickname] IS NULL) OR ([g].[SquadId] IS NULL) THEN CAST(1 AS bit) ELSE CAST(0 AS bit) END AS [IsNull], [f].[Id], [f].[CapitalName], [f].[Discriminator], [f].[Name], [f].[ServerAddress], [f].[CommanderName], [f].[Eradicated], CASE WHEN [f].[Id] IS NULL THEN CAST(1 AS bit) diff --git a/test/EFCore.SqlServer.FunctionalTests/Query/InheritanceRelationshipsQuerySqlServerTest.cs b/test/EFCore.SqlServer.FunctionalTests/Query/InheritanceRelationshipsQuerySqlServerTest.cs index 0b4f59e8685..7cecab51be9 100644 --- a/test/EFCore.SqlServer.FunctionalTests/Query/InheritanceRelationshipsQuerySqlServerTest.cs +++ b/test/EFCore.SqlServer.FunctionalTests/Query/InheritanceRelationshipsQuerySqlServerTest.cs @@ -90,7 +90,7 @@ FROM [BaseEntities] AS [b] LEFT JOIN [BaseReferencesOnBase] AS [b0] ON [b].[Id] = [b0].[BaseParentId] LEFT JOIN [BaseEntities_OwnedCollectionOnBase] AS [b1] ON [b].[Id] = [b1].[BaseInheritanceRelationshipEntityId] LEFT JOIN [BaseEntities_OwnedCollectionOnDerived] AS [b2] ON [b].[Id] = [b2].[DerivedInheritanceRelationshipEntityId] -WHERE ([b].[Name] <> N'Bar') OR [b].[Name] IS NULL +WHERE ([b].[Name] <> N'Bar') OR ([b].[Name] IS NULL) ORDER BY [b].[Id], [b0].[Id], [b1].[BaseInheritanceRelationshipEntityId], [b1].[Id], [b2].[DerivedInheritanceRelationshipEntityId]"); } @@ -104,7 +104,7 @@ FROM [BaseReferencesOnBase] AS [b] LEFT JOIN [BaseEntities] AS [b0] ON [b].[BaseParentId] = [b0].[Id] LEFT JOIN [BaseEntities_OwnedCollectionOnBase] AS [b1] ON [b0].[Id] = [b1].[BaseInheritanceRelationshipEntityId] LEFT JOIN [BaseEntities_OwnedCollectionOnDerived] AS [b2] ON [b0].[Id] = [b2].[DerivedInheritanceRelationshipEntityId] -WHERE ([b].[Name] <> N'Bar') OR [b].[Name] IS NULL +WHERE ([b].[Name] <> N'Bar') OR ([b].[Name] IS NULL) ORDER BY [b].[Id], [b0].[Id], [b1].[BaseInheritanceRelationshipEntityId], [b1].[Id], [b2].[DerivedInheritanceRelationshipEntityId]"); } @@ -144,7 +144,7 @@ FROM [BaseEntities] AS [b] LEFT JOIN [ReferencesOnBase] AS [r] ON [b].[Id] = [r].[ParentId] LEFT JOIN [BaseEntities_OwnedCollectionOnBase] AS [b0] ON [b].[Id] = [b0].[BaseInheritanceRelationshipEntityId] LEFT JOIN [BaseEntities_OwnedCollectionOnDerived] AS [b1] ON [b].[Id] = [b1].[DerivedInheritanceRelationshipEntityId] -WHERE ([b].[Name] <> N'Bar') OR [b].[Name] IS NULL +WHERE ([b].[Name] <> N'Bar') OR ([b].[Name] IS NULL) ORDER BY [b].[Id], [r].[Id], [b0].[BaseInheritanceRelationshipEntityId], [b0].[Id], [b1].[DerivedInheritanceRelationshipEntityId]"); } @@ -158,7 +158,7 @@ FROM [ReferencesOnBase] AS [r] LEFT JOIN [BaseEntities] AS [b] ON [r].[ParentId] = [b].[Id] LEFT JOIN [BaseEntities_OwnedCollectionOnBase] AS [b0] ON [b].[Id] = [b0].[BaseInheritanceRelationshipEntityId] LEFT JOIN [BaseEntities_OwnedCollectionOnDerived] AS [b1] ON [b].[Id] = [b1].[DerivedInheritanceRelationshipEntityId] -WHERE ([r].[Name] <> N'Bar') OR [r].[Name] IS NULL +WHERE ([r].[Name] <> N'Bar') OR ([r].[Name] IS NULL) ORDER BY [r].[Id], [b].[Id], [b0].[BaseInheritanceRelationshipEntityId], [b0].[Id], [b1].[DerivedInheritanceRelationshipEntityId]"); } @@ -198,7 +198,7 @@ FROM [BaseEntities] AS [b] LEFT JOIN [BaseEntities_OwnedCollectionOnBase] AS [b0] ON [b].[Id] = [b0].[BaseInheritanceRelationshipEntityId] LEFT JOIN [BaseEntities_OwnedCollectionOnDerived] AS [b1] ON [b].[Id] = [b1].[DerivedInheritanceRelationshipEntityId] LEFT JOIN [BaseCollectionsOnBase] AS [b2] ON [b].[Id] = [b2].[BaseParentId] -WHERE ([b].[Name] <> N'Bar') OR [b].[Name] IS NULL +WHERE ([b].[Name] <> N'Bar') OR ([b].[Name] IS NULL) ORDER BY [b].[Id], [b0].[BaseInheritanceRelationshipEntityId], [b0].[Id], [b1].[DerivedInheritanceRelationshipEntityId], [b1].[Id]"); } @@ -212,7 +212,7 @@ FROM [BaseCollectionsOnBase] AS [b] LEFT JOIN [BaseEntities] AS [b0] ON [b].[BaseParentId] = [b0].[Id] LEFT JOIN [BaseEntities_OwnedCollectionOnBase] AS [b1] ON [b0].[Id] = [b1].[BaseInheritanceRelationshipEntityId] LEFT JOIN [BaseEntities_OwnedCollectionOnDerived] AS [b2] ON [b0].[Id] = [b2].[DerivedInheritanceRelationshipEntityId] -WHERE ([b].[Name] <> N'Bar') OR [b].[Name] IS NULL +WHERE ([b].[Name] <> N'Bar') OR ([b].[Name] IS NULL) ORDER BY [b].[Id], [b0].[Id], [b1].[BaseInheritanceRelationshipEntityId], [b1].[Id], [b2].[DerivedInheritanceRelationshipEntityId]"); } @@ -252,7 +252,7 @@ FROM [BaseEntities] AS [b] LEFT JOIN [BaseEntities_OwnedCollectionOnBase] AS [b0] ON [b].[Id] = [b0].[BaseInheritanceRelationshipEntityId] LEFT JOIN [BaseEntities_OwnedCollectionOnDerived] AS [b1] ON [b].[Id] = [b1].[DerivedInheritanceRelationshipEntityId] LEFT JOIN [CollectionsOnBase] AS [c] ON [b].[Id] = [c].[ParentId] -WHERE ([b].[Name] <> N'Bar') OR [b].[Name] IS NULL +WHERE ([b].[Name] <> N'Bar') OR ([b].[Name] IS NULL) ORDER BY [b].[Id], [b0].[BaseInheritanceRelationshipEntityId], [b0].[Id], [b1].[DerivedInheritanceRelationshipEntityId], [b1].[Id]"); } @@ -266,7 +266,7 @@ FROM [CollectionsOnBase] AS [c] LEFT JOIN [BaseEntities] AS [b] ON [c].[ParentId] = [b].[Id] LEFT JOIN [BaseEntities_OwnedCollectionOnBase] AS [b0] ON [b].[Id] = [b0].[BaseInheritanceRelationshipEntityId] LEFT JOIN [BaseEntities_OwnedCollectionOnDerived] AS [b1] ON [b].[Id] = [b1].[DerivedInheritanceRelationshipEntityId] -WHERE ([c].[Name] <> N'Bar') OR [c].[Name] IS NULL +WHERE ([c].[Name] <> N'Bar') OR ([c].[Name] IS NULL) ORDER BY [c].[Id], [b].[Id], [b0].[BaseInheritanceRelationshipEntityId], [b0].[Id], [b1].[DerivedInheritanceRelationshipEntityId]"); } @@ -343,7 +343,7 @@ FROM [BaseEntities] AS [b] LEFT JOIN [BaseReferencesOnBase] AS [b0] ON [b].[Id] = [b0].[BaseParentId] LEFT JOIN [BaseEntities_OwnedCollectionOnBase] AS [b1] ON [b].[Id] = [b1].[BaseInheritanceRelationshipEntityId] LEFT JOIN [BaseEntities_OwnedCollectionOnDerived] AS [b2] ON [b].[Id] = [b2].[DerivedInheritanceRelationshipEntityId] -WHERE ([b].[Discriminator] = N'DerivedInheritanceRelationshipEntity') AND (([b].[Name] <> N'Bar') OR [b].[Name] IS NULL) +WHERE ([b].[Discriminator] = N'DerivedInheritanceRelationshipEntity') AND (([b].[Name] <> N'Bar') OR ([b].[Name] IS NULL)) ORDER BY [b].[Id], [b0].[Id], [b1].[BaseInheritanceRelationshipEntityId], [b1].[Id], [b2].[DerivedInheritanceRelationshipEntityId]"); } @@ -357,7 +357,7 @@ FROM [BaseEntities] AS [b] LEFT JOIN [BaseReferencesOnDerived] AS [b0] ON [b].[Id] = [b0].[BaseParentId] LEFT JOIN [BaseEntities_OwnedCollectionOnBase] AS [b1] ON [b].[Id] = [b1].[BaseInheritanceRelationshipEntityId] LEFT JOIN [BaseEntities_OwnedCollectionOnDerived] AS [b2] ON [b].[Id] = [b2].[DerivedInheritanceRelationshipEntityId] -WHERE ([b].[Discriminator] = N'DerivedInheritanceRelationshipEntity') AND (([b].[Name] <> N'Bar') OR [b].[Name] IS NULL) +WHERE ([b].[Discriminator] = N'DerivedInheritanceRelationshipEntity') AND (([b].[Name] <> N'Bar') OR ([b].[Name] IS NULL)) ORDER BY [b].[Id], [b0].[Id], [b1].[BaseInheritanceRelationshipEntityId], [b1].[Id], [b2].[DerivedInheritanceRelationshipEntityId]"); } @@ -375,7 +375,7 @@ FROM [BaseReferencesOnDerived] AS [b0] ) AS [t] ON [b].[Id] = [t].[DerivedInheritanceRelationshipEntityId] LEFT JOIN [BaseEntities_OwnedCollectionOnBase] AS [b1] ON [b].[Id] = [b1].[BaseInheritanceRelationshipEntityId] LEFT JOIN [BaseEntities_OwnedCollectionOnDerived] AS [b2] ON [b].[Id] = [b2].[DerivedInheritanceRelationshipEntityId] -WHERE ([b].[Discriminator] = N'DerivedInheritanceRelationshipEntity') AND (([b].[Name] <> N'Bar') OR [b].[Name] IS NULL) +WHERE ([b].[Discriminator] = N'DerivedInheritanceRelationshipEntity') AND (([b].[Name] <> N'Bar') OR ([b].[Name] IS NULL)) ORDER BY [b].[Id], [t].[Id], [b1].[BaseInheritanceRelationshipEntityId], [b1].[Id], [b2].[DerivedInheritanceRelationshipEntityId]"); } @@ -393,7 +393,7 @@ FROM [BaseEntities] AS [b0] ) AS [t] ON [b].[BaseParentId] = [t].[Id] LEFT JOIN [BaseEntities_OwnedCollectionOnBase] AS [b1] ON [t].[Id] = [b1].[BaseInheritanceRelationshipEntityId] LEFT JOIN [BaseEntities_OwnedCollectionOnDerived] AS [b2] ON [t].[Id] = [b2].[DerivedInheritanceRelationshipEntityId] -WHERE ([b].[Name] <> N'Bar') OR [b].[Name] IS NULL +WHERE ([b].[Name] <> N'Bar') OR ([b].[Name] IS NULL) ORDER BY [b].[Id], [t].[Id], [b1].[BaseInheritanceRelationshipEntityId], [b1].[Id], [b2].[DerivedInheritanceRelationshipEntityId]"); } @@ -752,25 +752,25 @@ public override async Task Include_collection_with_inheritance_with_filter_split AssertSql( @"SELECT [b].[Id], [b].[Discriminator], [b].[Name], [b].[BaseId], [b].[OwnedReferenceOnBase_Id], [b].[OwnedReferenceOnBase_Name], [b].[OwnedReferenceOnDerived_Id], [b].[OwnedReferenceOnDerived_Name] FROM [BaseEntities] AS [b] -WHERE ([b].[Name] <> N'Bar') OR [b].[Name] IS NULL +WHERE ([b].[Name] <> N'Bar') OR ([b].[Name] IS NULL) ORDER BY [b].[Id]", // @"SELECT [b0].[BaseInheritanceRelationshipEntityId], [b0].[Id], [b0].[Name], [b].[Id] FROM [BaseEntities] AS [b] INNER JOIN [BaseEntities_OwnedCollectionOnBase] AS [b0] ON [b].[Id] = [b0].[BaseInheritanceRelationshipEntityId] -WHERE ([b].[Name] <> N'Bar') OR [b].[Name] IS NULL +WHERE ([b].[Name] <> N'Bar') OR ([b].[Name] IS NULL) ORDER BY [b].[Id]", // @"SELECT [b0].[DerivedInheritanceRelationshipEntityId], [b0].[Id], [b0].[Name], [b].[Id] FROM [BaseEntities] AS [b] INNER JOIN [BaseEntities_OwnedCollectionOnDerived] AS [b0] ON [b].[Id] = [b0].[DerivedInheritanceRelationshipEntityId] -WHERE ([b].[Name] <> N'Bar') OR [b].[Name] IS NULL +WHERE ([b].[Name] <> N'Bar') OR ([b].[Name] IS NULL) ORDER BY [b].[Id]", // @"SELECT [b0].[Id], [b0].[BaseParentId], [b0].[Discriminator], [b0].[Name], [b0].[DerivedProperty], [b].[Id] FROM [BaseEntities] AS [b] INNER JOIN [BaseCollectionsOnBase] AS [b0] ON [b].[Id] = [b0].[BaseParentId] -WHERE ([b].[Name] <> N'Bar') OR [b].[Name] IS NULL +WHERE ([b].[Name] <> N'Bar') OR ([b].[Name] IS NULL) ORDER BY [b].[Id]"); } @@ -782,21 +782,21 @@ public override async Task Include_collection_with_inheritance_with_filter_rever @"SELECT [b].[Id], [b].[BaseParentId], [b].[Discriminator], [b].[Name], [b].[DerivedProperty], [b0].[Id], [b0].[Discriminator], [b0].[Name], [b0].[BaseId], [b0].[OwnedReferenceOnBase_Id], [b0].[OwnedReferenceOnBase_Name], [b0].[OwnedReferenceOnDerived_Id], [b0].[OwnedReferenceOnDerived_Name] FROM [BaseCollectionsOnBase] AS [b] LEFT JOIN [BaseEntities] AS [b0] ON [b].[BaseParentId] = [b0].[Id] -WHERE ([b].[Name] <> N'Bar') OR [b].[Name] IS NULL +WHERE ([b].[Name] <> N'Bar') OR ([b].[Name] IS NULL) ORDER BY [b].[Id], [b0].[Id]", // @"SELECT [b1].[BaseInheritanceRelationshipEntityId], [b1].[Id], [b1].[Name], [b].[Id], [b0].[Id] FROM [BaseCollectionsOnBase] AS [b] LEFT JOIN [BaseEntities] AS [b0] ON [b].[BaseParentId] = [b0].[Id] INNER JOIN [BaseEntities_OwnedCollectionOnBase] AS [b1] ON [b0].[Id] = [b1].[BaseInheritanceRelationshipEntityId] -WHERE ([b].[Name] <> N'Bar') OR [b].[Name] IS NULL +WHERE ([b].[Name] <> N'Bar') OR ([b].[Name] IS NULL) ORDER BY [b].[Id], [b0].[Id]", // @"SELECT [b1].[DerivedInheritanceRelationshipEntityId], [b1].[Id], [b1].[Name], [b].[Id], [b0].[Id] FROM [BaseCollectionsOnBase] AS [b] LEFT JOIN [BaseEntities] AS [b0] ON [b].[BaseParentId] = [b0].[Id] INNER JOIN [BaseEntities_OwnedCollectionOnDerived] AS [b1] ON [b0].[Id] = [b1].[DerivedInheritanceRelationshipEntityId] -WHERE ([b].[Name] <> N'Bar') OR [b].[Name] IS NULL +WHERE ([b].[Name] <> N'Bar') OR ([b].[Name] IS NULL) ORDER BY [b].[Id], [b0].[Id]"); } @@ -855,25 +855,25 @@ public override async Task Include_collection_without_inheritance_with_filter_sp AssertSql( @"SELECT [b].[Id], [b].[Discriminator], [b].[Name], [b].[BaseId], [b].[OwnedReferenceOnBase_Id], [b].[OwnedReferenceOnBase_Name], [b].[OwnedReferenceOnDerived_Id], [b].[OwnedReferenceOnDerived_Name] FROM [BaseEntities] AS [b] -WHERE ([b].[Name] <> N'Bar') OR [b].[Name] IS NULL +WHERE ([b].[Name] <> N'Bar') OR ([b].[Name] IS NULL) ORDER BY [b].[Id]", // @"SELECT [b0].[BaseInheritanceRelationshipEntityId], [b0].[Id], [b0].[Name], [b].[Id] FROM [BaseEntities] AS [b] INNER JOIN [BaseEntities_OwnedCollectionOnBase] AS [b0] ON [b].[Id] = [b0].[BaseInheritanceRelationshipEntityId] -WHERE ([b].[Name] <> N'Bar') OR [b].[Name] IS NULL +WHERE ([b].[Name] <> N'Bar') OR ([b].[Name] IS NULL) ORDER BY [b].[Id]", // @"SELECT [b0].[DerivedInheritanceRelationshipEntityId], [b0].[Id], [b0].[Name], [b].[Id] FROM [BaseEntities] AS [b] INNER JOIN [BaseEntities_OwnedCollectionOnDerived] AS [b0] ON [b].[Id] = [b0].[DerivedInheritanceRelationshipEntityId] -WHERE ([b].[Name] <> N'Bar') OR [b].[Name] IS NULL +WHERE ([b].[Name] <> N'Bar') OR ([b].[Name] IS NULL) ORDER BY [b].[Id]", // @"SELECT [c].[Id], [c].[Name], [c].[ParentId], [b].[Id] FROM [BaseEntities] AS [b] INNER JOIN [CollectionsOnBase] AS [c] ON [b].[Id] = [c].[ParentId] -WHERE ([b].[Name] <> N'Bar') OR [b].[Name] IS NULL +WHERE ([b].[Name] <> N'Bar') OR ([b].[Name] IS NULL) ORDER BY [b].[Id]"); } @@ -885,21 +885,21 @@ public override async Task Include_collection_without_inheritance_with_filter_re @"SELECT [c].[Id], [c].[Name], [c].[ParentId], [b].[Id], [b].[Discriminator], [b].[Name], [b].[BaseId], [b].[OwnedReferenceOnBase_Id], [b].[OwnedReferenceOnBase_Name], [b].[OwnedReferenceOnDerived_Id], [b].[OwnedReferenceOnDerived_Name] FROM [CollectionsOnBase] AS [c] LEFT JOIN [BaseEntities] AS [b] ON [c].[ParentId] = [b].[Id] -WHERE ([c].[Name] <> N'Bar') OR [c].[Name] IS NULL +WHERE ([c].[Name] <> N'Bar') OR ([c].[Name] IS NULL) ORDER BY [c].[Id], [b].[Id]", // @"SELECT [b0].[BaseInheritanceRelationshipEntityId], [b0].[Id], [b0].[Name], [c].[Id], [b].[Id] FROM [CollectionsOnBase] AS [c] LEFT JOIN [BaseEntities] AS [b] ON [c].[ParentId] = [b].[Id] INNER JOIN [BaseEntities_OwnedCollectionOnBase] AS [b0] ON [b].[Id] = [b0].[BaseInheritanceRelationshipEntityId] -WHERE ([c].[Name] <> N'Bar') OR [c].[Name] IS NULL +WHERE ([c].[Name] <> N'Bar') OR ([c].[Name] IS NULL) ORDER BY [c].[Id], [b].[Id]", // @"SELECT [b0].[DerivedInheritanceRelationshipEntityId], [b0].[Id], [b0].[Name], [c].[Id], [b].[Id] FROM [CollectionsOnBase] AS [c] LEFT JOIN [BaseEntities] AS [b] ON [c].[ParentId] = [b].[Id] INNER JOIN [BaseEntities_OwnedCollectionOnDerived] AS [b0] ON [b].[Id] = [b0].[DerivedInheritanceRelationshipEntityId] -WHERE ([c].[Name] <> N'Bar') OR [c].[Name] IS NULL +WHERE ([c].[Name] <> N'Bar') OR ([c].[Name] IS NULL) ORDER BY [c].[Id], [b].[Id]"); } diff --git a/test/EFCore.SqlServer.FunctionalTests/Query/ManyToManyNoTrackingQuerySqlServerTest.cs b/test/EFCore.SqlServer.FunctionalTests/Query/ManyToManyNoTrackingQuerySqlServerTest.cs index d02a9b82f7d..7a3d7b235ae 100644 --- a/test/EFCore.SqlServer.FunctionalTests/Query/ManyToManyNoTrackingQuerySqlServerTest.cs +++ b/test/EFCore.SqlServer.FunctionalTests/Query/ManyToManyNoTrackingQuerySqlServerTest.cs @@ -104,7 +104,7 @@ INNER JOIN ( FROM [EntityRoots] AS [e0] WHERE [e0].[Discriminator] IN (N'EntityBranch', N'EntityLeaf') ) AS [t] ON [j].[EntityBranchId] = [t].[Id] - WHERE ([e].[Id] = [j].[EntityOneId]) AND ([t].[Name] IS NOT NULL AND ([t].[Name] LIKE N'L%'))), [e].[Id]"); + WHERE ([e].[Id] = [j].[EntityOneId]) AND (([t].[Name] IS NOT NULL) AND ([t].[Name] LIKE N'L%'))), [e].[Id]"); } public override async Task Skip_navigation_long_count_without_predicate(bool async) @@ -132,7 +132,7 @@ ORDER BY ( SELECT COUNT_BIG(*) FROM [EntityTwoEntityTwo] AS [e0] INNER JOIN [EntityTwos] AS [e1] ON [e0].[SelfSkipSharedLeftId] = [e1].[Id] - WHERE ([e].[Id] = [e0].[SelfSkipSharedRightId]) AND ([e1].[Name] IS NOT NULL AND ([e1].[Name] LIKE N'L%'))) DESC, [e].[Id]"); + WHERE ([e].[Id] = [e0].[SelfSkipSharedRightId]) AND (([e1].[Name] IS NOT NULL) AND ([e1].[Name] LIKE N'L%'))) DESC, [e].[Id]"); } public override async Task Skip_navigation_select_many_average(bool async) diff --git a/test/EFCore.SqlServer.FunctionalTests/Query/ManyToManyQuerySqlServerTest.cs b/test/EFCore.SqlServer.FunctionalTests/Query/ManyToManyQuerySqlServerTest.cs index 968f9fcd21e..b8a8c1db66b 100644 --- a/test/EFCore.SqlServer.FunctionalTests/Query/ManyToManyQuerySqlServerTest.cs +++ b/test/EFCore.SqlServer.FunctionalTests/Query/ManyToManyQuerySqlServerTest.cs @@ -103,7 +103,7 @@ INNER JOIN ( FROM [EntityRoots] AS [e0] WHERE [e0].[Discriminator] IN (N'EntityBranch', N'EntityLeaf') ) AS [t] ON [j].[EntityBranchId] = [t].[Id] - WHERE ([e].[Id] = [j].[EntityOneId]) AND ([t].[Name] IS NOT NULL AND ([t].[Name] LIKE N'L%'))), [e].[Id]"); + WHERE ([e].[Id] = [j].[EntityOneId]) AND (([t].[Name] IS NOT NULL) AND ([t].[Name] LIKE N'L%'))), [e].[Id]"); } public override async Task Skip_navigation_long_count_without_predicate(bool async) @@ -131,7 +131,7 @@ ORDER BY ( SELECT COUNT_BIG(*) FROM [EntityTwoEntityTwo] AS [e0] INNER JOIN [EntityTwos] AS [e1] ON [e0].[SelfSkipSharedLeftId] = [e1].[Id] - WHERE ([e].[Id] = [e0].[SelfSkipSharedRightId]) AND ([e1].[Name] IS NOT NULL AND ([e1].[Name] LIKE N'L%'))) DESC, [e].[Id]"); + WHERE ([e].[Id] = [e0].[SelfSkipSharedRightId]) AND (([e1].[Name] IS NOT NULL) AND ([e1].[Name] LIKE N'L%'))) DESC, [e].[Id]"); } public override async Task Skip_navigation_select_many_average(bool async) diff --git a/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindAggregateOperatorsQuerySqlServerTest.cs b/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindAggregateOperatorsQuerySqlServerTest.cs index 1432d62b34c..b99230cd3db 100644 --- a/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindAggregateOperatorsQuerySqlServerTest.cs +++ b/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindAggregateOperatorsQuerySqlServerTest.cs @@ -542,7 +542,7 @@ public override async Task Select_All(bool async) WHEN NOT EXISTS ( SELECT 1 FROM [Orders] AS [o] - WHERE ([o].[CustomerID] <> N'ALFKI') OR [o].[CustomerID] IS NULL) THEN CAST(1 AS bit) + WHERE ([o].[CustomerID] <> N'ALFKI') OR ([o].[CustomerID] IS NULL)) THEN CAST(1 AS bit) ELSE CAST(0 AS bit) END"); } @@ -1089,7 +1089,7 @@ public override async Task OrderBy_Where_Count_with_predicate(bool async) AssertSql( @"SELECT COUNT(*) FROM [Orders] AS [o] -WHERE ([o].[OrderID] > 10) AND (([o].[CustomerID] <> N'ALFKI') OR [o].[CustomerID] IS NULL)"); +WHERE ([o].[OrderID] > 10) AND (([o].[CustomerID] <> N'ALFKI') OR ([o].[CustomerID] IS NULL))"); } public override async Task Distinct(bool async) @@ -1627,7 +1627,7 @@ public override async Task Average_with_non_matching_types_in_projection_doesnt_ AssertSql( @"SELECT AVG(CAST(CAST([o].[OrderID] AS bigint) AS float)) FROM [Orders] AS [o] -WHERE [o].[CustomerID] IS NOT NULL AND ([o].[CustomerID] LIKE N'A%')"); +WHERE ([o].[CustomerID] IS NOT NULL) AND ([o].[CustomerID] LIKE N'A%')"); } public override async Task Max_with_non_matching_types_in_projection_introduces_explicit_cast(bool async) @@ -1637,7 +1637,7 @@ public override async Task Max_with_non_matching_types_in_projection_introduces_ AssertSql( @"SELECT MAX(CAST([o].[OrderID] AS bigint)) FROM [Orders] AS [o] -WHERE [o].[CustomerID] IS NOT NULL AND ([o].[CustomerID] LIKE N'A%')"); +WHERE ([o].[CustomerID] IS NOT NULL) AND ([o].[CustomerID] LIKE N'A%')"); } public override async Task Min_with_non_matching_types_in_projection_introduces_explicit_cast(bool async) @@ -1647,7 +1647,7 @@ public override async Task Min_with_non_matching_types_in_projection_introduces_ AssertSql( @"SELECT MIN(CAST([o].[OrderID] AS bigint)) FROM [Orders] AS [o] -WHERE [o].[CustomerID] IS NOT NULL AND ([o].[CustomerID] LIKE N'A%')"); +WHERE ([o].[CustomerID] IS NOT NULL) AND ([o].[CustomerID] LIKE N'A%')"); } public override async Task OrderBy_Take_Last_gives_correct_result(bool async) @@ -1836,7 +1836,7 @@ FROM [Orders] AS [o] WHERE EXISTS ( SELECT 1 FROM [Orders] AS [o0] - WHERE ([o0].[CustomerID] = N'VINET') AND [o0].[CustomerID] IS NULL)"); + WHERE ([o0].[CustomerID] = N'VINET') AND ([o0].[CustomerID] IS NULL))"); } public override async Task Contains_over_entityType_with_null_should_rewrite_to_identity_equality_subquery_negated(bool async) @@ -1849,7 +1849,7 @@ FROM [Orders] AS [o] WHERE NOT (EXISTS ( SELECT 1 FROM [Orders] AS [o0] - WHERE ([o0].[CustomerID] = N'VINET') AND [o0].[CustomerID] IS NULL))"); + WHERE ([o0].[CustomerID] = N'VINET') AND ([o0].[CustomerID] IS NULL)))"); } public override async Task Contains_over_entityType_with_null_should_rewrite_to_identity_equality_subquery_complex(bool async) @@ -1863,13 +1863,13 @@ WHERE CASE WHEN EXISTS ( SELECT 1 FROM [Orders] AS [o0] - WHERE ([o0].[CustomerID] = N'VINET') AND [o0].[CustomerID] IS NULL) THEN CAST(1 AS bit) + WHERE ([o0].[CustomerID] = N'VINET') AND ([o0].[CustomerID] IS NULL)) THEN CAST(1 AS bit) ELSE CAST(0 AS bit) END = CASE WHEN EXISTS ( SELECT 1 FROM [Orders] AS [o1] - WHERE (([o1].[CustomerID] <> N'VINET') OR [o1].[CustomerID] IS NULL) AND [o1].[CustomerID] IS NULL) THEN CAST(1 AS bit) + WHERE (([o1].[CustomerID] <> N'VINET') OR ([o1].[CustomerID] IS NULL)) AND ([o1].[CustomerID] IS NULL)) THEN CAST(1 AS bit) ELSE CAST(0 AS bit) END"); } @@ -1883,7 +1883,7 @@ public override async Task Contains_over_nullable_scalar_with_null_in_subquery_t WHEN EXISTS ( SELECT 1 FROM [Orders] AS [o0] - WHERE ([o0].[CustomerID] = N'VINET') AND [o0].[CustomerID] IS NULL) THEN CAST(1 AS bit) + WHERE ([o0].[CustomerID] = N'VINET') AND ([o0].[CustomerID] IS NULL)) THEN CAST(1 AS bit) ELSE CAST(0 AS bit) END FROM [Orders] AS [o]"); diff --git a/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindFunctionsQuerySqlServerTest.cs b/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindFunctionsQuerySqlServerTest.cs index b47dc97c0e4..a964a65dac3 100644 --- a/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindFunctionsQuerySqlServerTest.cs +++ b/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindFunctionsQuerySqlServerTest.cs @@ -34,7 +34,7 @@ public override async Task String_StartsWith_Literal(bool async) AssertSql( @"SELECT [c].[CustomerID], [c].[Address], [c].[City], [c].[CompanyName], [c].[ContactName], [c].[ContactTitle], [c].[Country], [c].[Fax], [c].[Phone], [c].[PostalCode], [c].[Region] FROM [Customers] AS [c] -WHERE [c].[ContactName] IS NOT NULL AND ([c].[ContactName] LIKE N'M%')"); +WHERE ([c].[ContactName] IS NOT NULL) AND ([c].[ContactName] LIKE N'M%')"); } public override async Task String_StartsWith_Identity(bool async) @@ -44,7 +44,7 @@ public override async Task String_StartsWith_Identity(bool async) AssertSql( @"SELECT [c].[CustomerID], [c].[Address], [c].[City], [c].[CompanyName], [c].[ContactName], [c].[ContactTitle], [c].[Country], [c].[Fax], [c].[Phone], [c].[PostalCode], [c].[Region] FROM [Customers] AS [c] -WHERE ([c].[ContactName] = N'') OR ([c].[ContactName] IS NOT NULL AND (LEFT([c].[ContactName], LEN([c].[ContactName])) = [c].[ContactName]))"); +WHERE ([c].[ContactName] = N'') OR (([c].[ContactName] IS NOT NULL) AND (LEFT([c].[ContactName], LEN([c].[ContactName])) = [c].[ContactName]))"); } public override async Task String_StartsWith_Column(bool async) @@ -54,7 +54,7 @@ public override async Task String_StartsWith_Column(bool async) AssertSql( @"SELECT [c].[CustomerID], [c].[Address], [c].[City], [c].[CompanyName], [c].[ContactName], [c].[ContactTitle], [c].[Country], [c].[Fax], [c].[Phone], [c].[PostalCode], [c].[Region] FROM [Customers] AS [c] -WHERE ([c].[ContactName] = N'') OR ([c].[ContactName] IS NOT NULL AND (LEFT([c].[ContactName], LEN([c].[ContactName])) = [c].[ContactName]))"); +WHERE ([c].[ContactName] = N'') OR (([c].[ContactName] IS NOT NULL) AND (LEFT([c].[ContactName], LEN([c].[ContactName])) = [c].[ContactName]))"); } public override async Task String_StartsWith_MethodCall(bool async) @@ -64,7 +64,7 @@ public override async Task String_StartsWith_MethodCall(bool async) AssertSql( @"SELECT [c].[CustomerID], [c].[Address], [c].[City], [c].[CompanyName], [c].[ContactName], [c].[ContactTitle], [c].[Country], [c].[Fax], [c].[Phone], [c].[PostalCode], [c].[Region] FROM [Customers] AS [c] -WHERE [c].[ContactName] IS NOT NULL AND ([c].[ContactName] LIKE N'M%')"); +WHERE ([c].[ContactName] IS NOT NULL) AND ([c].[ContactName] LIKE N'M%')"); } public override async Task String_EndsWith_Literal(bool async) @@ -74,7 +74,7 @@ public override async Task String_EndsWith_Literal(bool async) AssertSql( @"SELECT [c].[CustomerID], [c].[Address], [c].[City], [c].[CompanyName], [c].[ContactName], [c].[ContactTitle], [c].[Country], [c].[Fax], [c].[Phone], [c].[PostalCode], [c].[Region] FROM [Customers] AS [c] -WHERE [c].[ContactName] IS NOT NULL AND ([c].[ContactName] LIKE N'%b')"); +WHERE ([c].[ContactName] IS NOT NULL) AND ([c].[ContactName] LIKE N'%b')"); } public override async Task String_EndsWith_Identity(bool async) @@ -84,7 +84,7 @@ public override async Task String_EndsWith_Identity(bool async) AssertSql( @"SELECT [c].[CustomerID], [c].[Address], [c].[City], [c].[CompanyName], [c].[ContactName], [c].[ContactTitle], [c].[Country], [c].[Fax], [c].[Phone], [c].[PostalCode], [c].[Region] FROM [Customers] AS [c] -WHERE ([c].[ContactName] = N'') OR ([c].[ContactName] IS NOT NULL AND (RIGHT([c].[ContactName], LEN([c].[ContactName])) = [c].[ContactName]))"); +WHERE ([c].[ContactName] = N'') OR (([c].[ContactName] IS NOT NULL) AND (RIGHT([c].[ContactName], LEN([c].[ContactName])) = [c].[ContactName]))"); } public override async Task String_EndsWith_Column(bool async) @@ -94,7 +94,7 @@ public override async Task String_EndsWith_Column(bool async) AssertSql( @"SELECT [c].[CustomerID], [c].[Address], [c].[City], [c].[CompanyName], [c].[ContactName], [c].[ContactTitle], [c].[Country], [c].[Fax], [c].[Phone], [c].[PostalCode], [c].[Region] FROM [Customers] AS [c] -WHERE ([c].[ContactName] = N'') OR ([c].[ContactName] IS NOT NULL AND (RIGHT([c].[ContactName], LEN([c].[ContactName])) = [c].[ContactName]))"); +WHERE ([c].[ContactName] = N'') OR (([c].[ContactName] IS NOT NULL) AND (RIGHT([c].[ContactName], LEN([c].[ContactName])) = [c].[ContactName]))"); } public override async Task String_EndsWith_MethodCall(bool async) @@ -104,7 +104,7 @@ public override async Task String_EndsWith_MethodCall(bool async) AssertSql( @"SELECT [c].[CustomerID], [c].[Address], [c].[City], [c].[CompanyName], [c].[ContactName], [c].[ContactTitle], [c].[Country], [c].[Fax], [c].[Phone], [c].[PostalCode], [c].[Region] FROM [Customers] AS [c] -WHERE [c].[ContactName] IS NOT NULL AND ([c].[ContactName] LIKE N'%m')"); +WHERE ([c].[ContactName] IS NOT NULL) AND ([c].[ContactName] LIKE N'%m')"); } public override async Task String_Contains_Literal(bool async) @@ -370,7 +370,7 @@ FROM [Customers] AS [c] // @"SELECT [c].[CustomerID], [c].[Address], [c].[City], [c].[CompanyName], [c].[ContactName], [c].[ContactTitle], [c].[Country], [c].[Fax], [c].[Phone], [c].[PostalCode], [c].[Region] FROM [Customers] AS [c] -WHERE ([c].[ContactTitle] = N'Owner') AND (([c].[Country] <> N'USA') OR [c].[Country] IS NULL)"); +WHERE ([c].[ContactTitle] = N'Owner') AND (([c].[Country] <> N'USA') OR ([c].[Country] IS NULL))"); } public override async Task String_Compare_to_simple_zero(bool async) @@ -546,7 +546,7 @@ FROM [Customers] AS [c] // @"SELECT [c].[CustomerID], [c].[Address], [c].[City], [c].[CompanyName], [c].[ContactName], [c].[ContactTitle], [c].[Country], [c].[Fax], [c].[Phone], [c].[PostalCode], [c].[Region] FROM [Customers] AS [c] -WHERE ([c].[ContactTitle] = N'Owner') AND (([c].[Country] <> N'USA') OR [c].[Country] IS NULL)"); +WHERE ([c].[ContactTitle] = N'Owner') AND (([c].[Country] <> N'USA') OR ([c].[Country] IS NULL))"); } public override async Task DateTime_Compare_to_simple_zero(bool async, bool compareTo) @@ -564,7 +564,7 @@ FROM [Orders] AS [o] SELECT [o].[OrderID], [o].[CustomerID], [o].[EmployeeID], [o].[OrderDate] FROM [Orders] AS [o] -WHERE ([o].[OrderDate] <> @__myDatetime_0) OR [o].[OrderDate] IS NULL", +WHERE ([o].[OrderDate] <> @__myDatetime_0) OR ([o].[OrderDate] IS NULL)", // @"@__myDatetime_0='1998-05-04T00:00:00.0000000' (DbType = DateTime) @@ -1668,7 +1668,7 @@ public override async Task IsNullOrEmpty_in_predicate(bool async) AssertSql( @"SELECT [c].[CustomerID], [c].[Address], [c].[City], [c].[CompanyName], [c].[ContactName], [c].[ContactTitle], [c].[Country], [c].[Fax], [c].[Phone], [c].[PostalCode], [c].[Region] FROM [Customers] AS [c] -WHERE [c].[Region] IS NULL OR ([c].[Region] LIKE N'')"); +WHERE ([c].[Region] IS NULL) OR ([c].[Region] LIKE N'')"); } public override async Task IsNullOrEmpty_in_projection(bool async) @@ -1677,7 +1677,7 @@ public override async Task IsNullOrEmpty_in_projection(bool async) AssertSql( @"SELECT [c].[CustomerID] AS [Id], CASE - WHEN [c].[Region] IS NULL OR ([c].[Region] LIKE N'') THEN CAST(1 AS bit) + WHEN ([c].[Region] IS NULL) OR ([c].[Region] LIKE N'') THEN CAST(1 AS bit) ELSE CAST(0 AS bit) END AS [Value] FROM [Customers] AS [c]"); @@ -1690,7 +1690,7 @@ public override async Task IsNullOrEmpty_negated_in_predicate(bool async) AssertSql( @"SELECT [c].[CustomerID], [c].[Address], [c].[City], [c].[CompanyName], [c].[ContactName], [c].[ContactTitle], [c].[Country], [c].[Fax], [c].[Phone], [c].[PostalCode], [c].[Region] FROM [Customers] AS [c] -WHERE [c].[Region] IS NOT NULL AND NOT ([c].[Region] LIKE N'')"); +WHERE ([c].[Region] IS NOT NULL) AND NOT ([c].[Region] LIKE N'')"); } public override async Task IsNullOrEmpty_negated_in_projection(bool async) @@ -1699,7 +1699,7 @@ public override async Task IsNullOrEmpty_negated_in_projection(bool async) AssertSql( @"SELECT [c].[CustomerID] AS [Id], CASE - WHEN [c].[Region] IS NOT NULL AND NOT ([c].[Region] LIKE N'') THEN CAST(1 AS bit) + WHEN ([c].[Region] IS NOT NULL) AND NOT ([c].[Region] LIKE N'') THEN CAST(1 AS bit) ELSE CAST(0 AS bit) END AS [Value] FROM [Customers] AS [c]"); @@ -1712,7 +1712,7 @@ public override async Task IsNullOrWhiteSpace_in_predicate(bool async) AssertSql( @"SELECT [c].[CustomerID], [c].[Address], [c].[City], [c].[CompanyName], [c].[ContactName], [c].[ContactTitle], [c].[Country], [c].[Fax], [c].[Phone], [c].[PostalCode], [c].[Region] FROM [Customers] AS [c] -WHERE [c].[Region] IS NULL OR ([c].[Region] = N'')"); +WHERE ([c].[Region] IS NULL) OR ([c].[Region] = N'')"); } public override async Task IsNullOrWhiteSpace_in_predicate_on_non_nullable_column(bool async) diff --git a/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindGroupByQuerySqlServerTest.cs b/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindGroupByQuerySqlServerTest.cs index b4e721eebf9..acab97c6d82 100644 --- a/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindGroupByQuerySqlServerTest.cs +++ b/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindGroupByQuerySqlServerTest.cs @@ -1295,7 +1295,7 @@ WHERE EXISTS ( SELECT 1 FROM [Orders] AS [o0] GROUP BY [o0].[CustomerID] - HAVING (COUNT(*) > 30) AND (([o0].[CustomerID] = [o].[CustomerID]) OR ([o0].[CustomerID] IS NULL AND [o].[CustomerID] IS NULL)))"); + HAVING (COUNT(*) > 30) AND (([o0].[CustomerID] = [o].[CustomerID]) OR (([o0].[CustomerID] IS NULL) AND ([o].[CustomerID] IS NULL))))"); } public override async Task GroupBy_aggregate_Pushdown(bool async) @@ -1670,7 +1670,7 @@ SELECT COUNT(*) AS [c], [p0].[ProductID] FROM [Products] AS [p0] GROUP BY [p0].[ProductID] ) AS [t0] -WHERE [o].[CustomerID] IS NOT NULL AND ([o].[CustomerID] LIKE N'A%') +WHERE ([o].[CustomerID] IS NOT NULL) AND ([o].[CustomerID] LIKE N'A%') ORDER BY [o].[OrderID], [t].[ProductID]"); } @@ -1684,7 +1684,7 @@ WHEN NOT EXISTS ( SELECT 1 FROM [Orders] AS [o] GROUP BY [o].[CustomerID] - HAVING ([o].[CustomerID] <> N'ALFKI') OR [o].[CustomerID] IS NULL) THEN CAST(1 AS bit) + HAVING ([o].[CustomerID] <> N'ALFKI') OR ([o].[CustomerID] IS NULL)) THEN CAST(1 AS bit) ELSE CAST(0 AS bit) END"); } @@ -1767,7 +1767,7 @@ public override async Task GroupBy_Where_Count_with_predicate(bool async) AssertSql( @"SELECT COUNT(CASE - WHEN (([o].[OrderID] < 10300) AND [o].[OrderDate] IS NOT NULL) AND (DATEPART(year, [o].[OrderDate]) = 1997) THEN 1 + WHEN (([o].[OrderID] < 10300) AND ([o].[OrderDate] IS NOT NULL)) AND (DATEPART(year, [o].[OrderDate]) = 1997) THEN 1 END) FROM [Orders] AS [o] GROUP BY [o].[CustomerID]"); @@ -1779,7 +1779,7 @@ public override async Task GroupBy_Where_Where_Count(bool async) AssertSql( @"SELECT COUNT(CASE - WHEN (([o].[OrderID] < 10300) AND [o].[OrderDate] IS NOT NULL) AND (DATEPART(year, [o].[OrderDate]) = 1997) THEN 1 + WHEN (([o].[OrderID] < 10300) AND ([o].[OrderDate] IS NOT NULL)) AND (DATEPART(year, [o].[OrderDate]) = 1997) THEN 1 END) FROM [Orders] AS [o] GROUP BY [o].[CustomerID]"); @@ -1791,7 +1791,7 @@ public override async Task GroupBy_Where_Select_Where_Count(bool async) AssertSql( @"SELECT COUNT(CASE - WHEN (([o].[OrderID] < 10300) AND [o].[OrderDate] IS NOT NULL) AND (DATEPART(year, [o].[OrderDate]) = 1997) THEN 1 + WHEN (([o].[OrderID] < 10300) AND ([o].[OrderDate] IS NOT NULL)) AND (DATEPART(year, [o].[OrderDate]) = 1997) THEN 1 END) FROM [Orders] AS [o] GROUP BY [o].[CustomerID]"); @@ -1803,7 +1803,7 @@ public override async Task GroupBy_Where_Select_Where_Select_Min(bool async) AssertSql( @"SELECT MIN(CASE - WHEN (([o].[OrderID] < 10300) AND [o].[OrderDate] IS NOT NULL) AND (DATEPART(year, [o].[OrderDate]) = 1997) THEN [o].[OrderID] + WHEN (([o].[OrderID] < 10300) AND ([o].[OrderDate] IS NOT NULL)) AND (DATEPART(year, [o].[OrderDate]) = 1997) THEN [o].[OrderID] END) FROM [Orders] AS [o] GROUP BY [o].[CustomerID]"); @@ -1894,7 +1894,7 @@ public override async Task GroupBy_Shadow(bool async) @"SELECT ( SELECT TOP(1) [e0].[Title] FROM [Employees] AS [e0] - WHERE (([e0].[Title] = N'Sales Representative') AND ([e0].[EmployeeID] = 1)) AND (([e].[Title] = [e0].[Title]) OR ([e].[Title] IS NULL AND [e0].[Title] IS NULL))) + WHERE (([e0].[Title] = N'Sales Representative') AND ([e0].[EmployeeID] = 1)) AND (([e].[Title] = [e0].[Title]) OR (([e].[Title] IS NULL) AND ([e0].[Title] IS NULL)))) FROM [Employees] AS [e] WHERE ([e].[Title] = N'Sales Representative') AND ([e].[EmployeeID] = 1) GROUP BY [e].[Title]"); @@ -1982,7 +1982,7 @@ LEFT JOIN ( SELECT [c0].[CustomerID], [c0].[Address], [c0].[City], [c0].[CompanyName], [c0].[ContactName], [c0].[ContactTitle], [c0].[Country], [c0].[Fax], [c0].[Phone], [c0].[PostalCode], [c0].[Region] FROM [Customers] AS [c0] WHERE [c0].[CustomerID] LIKE N'A%' -) AS [t0] ON ([t].[City] = [t0].[City]) OR ([t].[City] IS NULL AND [t0].[City] IS NULL) +) AS [t0] ON ([t].[City] = [t0].[City]) OR (([t].[City] IS NULL) AND ([t0].[City] IS NULL)) ORDER BY [t].[City]"); } @@ -2054,7 +2054,7 @@ SELECT DISTINCT MAX(DISTINCT ([t].[OrderDate])) FROM ( SELECT DISTINCT [o0].[OrderID], [o0].[CustomerID], [o0].[EmployeeID], [o0].[OrderDate] FROM [Orders] AS [o0] - WHERE ([o].[CustomerID] = [o0].[CustomerID]) OR ([o].[CustomerID] IS NULL AND [o0].[CustomerID] IS NULL) + WHERE ([o].[CustomerID] = [o0].[CustomerID]) OR (([o].[CustomerID] IS NULL) AND ([o0].[CustomerID] IS NULL)) ) AS [t]) AS [Max] FROM [Orders] AS [o] GROUP BY [o].[CustomerID]"); @@ -2498,7 +2498,7 @@ public override async Task GroupBy_aggregate_join_with_group_result(bool async) FROM [Orders] AS [o] GROUP BY [o].[CustomerID] ) AS [t] -INNER JOIN [Orders] AS [o0] ON (([t].[Key] = [o0].[CustomerID]) OR ([t].[Key] IS NULL AND [o0].[CustomerID] IS NULL)) AND (([t].[LastOrderDate] = [o0].[OrderDate]) OR ([t].[LastOrderDate] IS NULL AND [o0].[OrderDate] IS NULL))"); +INNER JOIN [Orders] AS [o0] ON (([t].[Key] = [o0].[CustomerID]) OR (([t].[Key] IS NULL) AND ([o0].[CustomerID] IS NULL))) AND (([t].[LastOrderDate] = [o0].[OrderDate]) OR (([t].[LastOrderDate] IS NULL) AND ([o0].[OrderDate] IS NULL)))"); } public override async Task GroupBy_aggregate_from_right_side_of_join(bool async) @@ -2699,7 +2699,7 @@ ELSE 0 ELSE 0 END), 0) AS [Sum2] FROM [Orders] AS [o] -WHERE [o].[CustomerID] IS NOT NULL AND ([o].[CustomerID] LIKE N'A%') +WHERE ([o].[CustomerID] IS NOT NULL) AND ([o].[CustomerID] LIKE N'A%') GROUP BY [o].[CustomerID]"); } @@ -2804,7 +2804,7 @@ public override async Task Select_uncorrelated_collection_with_groupby_when_oute SELECT DISTINCT [c].[City] FROM [Orders] AS [o] LEFT JOIN [Customers] AS [c] ON [o].[CustomerID] = [c].[CustomerID] - WHERE [o].[CustomerID] IS NOT NULL AND ([o].[CustomerID] LIKE N'A%') + WHERE ([o].[CustomerID] IS NOT NULL) AND ([o].[CustomerID] LIKE N'A%') ) AS [t] OUTER APPLY ( SELECT [p].[ProductID] @@ -2845,7 +2845,7 @@ public override async Task Select_correlated_collection_after_GroupBy_aggregate_ SELECT [o].[CustomerID] FROM [Orders] AS [o] GROUP BY [o].[CustomerID] - HAVING [o].[CustomerID] IS NOT NULL AND ([o].[CustomerID] LIKE N'F%') + HAVING ([o].[CustomerID] IS NOT NULL) AND ([o].[CustomerID] LIKE N'F%') ) AS [t] LEFT JOIN [Orders] AS [o0] ON [t].[CustomerID] = [o0].[CustomerID] ORDER BY [t].[CustomerID]"); diff --git a/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindIncludeQuerySqlServerTest.cs b/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindIncludeQuerySqlServerTest.cs index 65da90cd110..c3861dc3bb5 100644 --- a/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindIncludeQuerySqlServerTest.cs +++ b/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindIncludeQuerySqlServerTest.cs @@ -49,7 +49,7 @@ public override async Task Include_reference(bool async) @"SELECT [o].[OrderID], [o].[CustomerID], [o].[EmployeeID], [o].[OrderDate], [c].[CustomerID], [c].[Address], [c].[City], [c].[CompanyName], [c].[ContactName], [c].[ContactTitle], [c].[Country], [c].[Fax], [c].[Phone], [c].[PostalCode], [c].[Region] FROM [Orders] AS [o] LEFT JOIN [Customers] AS [c] ON [o].[CustomerID] = [c].[CustomerID] -WHERE [o].[CustomerID] IS NOT NULL AND ([o].[CustomerID] LIKE N'F%')"); +WHERE ([o].[CustomerID] IS NOT NULL) AND ([o].[CustomerID] LIKE N'F%')"); } public override async Task Include_when_result_operator(bool async) @@ -154,7 +154,7 @@ public override async Task Include_reference_and_collection(bool async) FROM [Orders] AS [o] LEFT JOIN [Customers] AS [c] ON [o].[CustomerID] = [c].[CustomerID] LEFT JOIN [Order Details] AS [o0] ON [o].[OrderID] = [o0].[OrderID] -WHERE [o].[CustomerID] IS NOT NULL AND ([o].[CustomerID] LIKE N'F%') +WHERE ([o].[CustomerID] IS NOT NULL) AND ([o].[CustomerID] LIKE N'F%') ORDER BY [o].[OrderID], [c].[CustomerID], [o0].[OrderID]"); } @@ -269,7 +269,7 @@ public override async Task Include_collection_alias_generation(bool async) @"SELECT [o].[OrderID], [o].[CustomerID], [o].[EmployeeID], [o].[OrderDate], [o0].[OrderID], [o0].[ProductID], [o0].[Discount], [o0].[Quantity], [o0].[UnitPrice] FROM [Orders] AS [o] LEFT JOIN [Order Details] AS [o0] ON [o].[OrderID] = [o0].[OrderID] -WHERE [o].[CustomerID] IS NOT NULL AND ([o].[CustomerID] LIKE N'F%') +WHERE ([o].[CustomerID] IS NOT NULL) AND ([o].[CustomerID] LIKE N'F%') ORDER BY [o].[OrderID], [o0].[OrderID]"); } @@ -677,7 +677,7 @@ FROM [Customers] AS [c] OUTER APPLY ( SELECT TOP(5) [o].[OrderID] FROM [Orders] AS [o] - WHERE ([o].[CustomerID] <> [c].[CustomerID]) OR [o].[CustomerID] IS NULL + WHERE ([o].[CustomerID] <> [c].[CustomerID]) OR ([o].[CustomerID] IS NULL) ORDER BY [c].[CustomerID] ) AS [t] LEFT JOIN [Orders] AS [o0] ON [c].[CustomerID] = [o0].[CustomerID] diff --git a/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindJoinQuerySqlServerTest.cs b/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindJoinQuerySqlServerTest.cs index 0253a116cca..305f9a1fb62 100644 --- a/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindJoinQuerySqlServerTest.cs +++ b/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindJoinQuerySqlServerTest.cs @@ -238,7 +238,7 @@ public override async Task Join_same_collection_force_alias_uniquefication(bool @"SELECT [o].[OrderID], [o].[CustomerID], [o].[EmployeeID], [o].[OrderDate], [o0].[OrderID], [o0].[CustomerID], [o0].[EmployeeID], [o0].[OrderDate] FROM [Orders] AS [o] INNER JOIN [Orders] AS [o0] ON [o].[CustomerID] = [o0].[CustomerID] -WHERE [o].[CustomerID] IS NOT NULL AND ([o].[CustomerID] LIKE N'F%')"); +WHERE ([o].[CustomerID] IS NOT NULL) AND ([o].[CustomerID] LIKE N'F%')"); } public override async Task GroupJoin_simple(bool async) @@ -333,7 +333,7 @@ FROM [Employees] AS [e] LEFT JOIN ( SELECT [o].[OrderID], [o].[CustomerID], [o].[EmployeeID], [o].[OrderDate] FROM [Orders] AS [o] - WHERE [o].[CustomerID] IS NOT NULL AND ([o].[CustomerID] LIKE N'F%') + WHERE ([o].[CustomerID] IS NOT NULL) AND ([o].[CustomerID] LIKE N'F%') ) AS [t] ON [e].[EmployeeID] = [t].[EmployeeID]"); } @@ -477,7 +477,7 @@ SELECT TOP(@__p_0) [o].[OrderID], [o].[CustomerID] FROM [Orders] AS [o] ORDER BY [o].[OrderID] ) AS [t] - WHERE [t].[CustomerID] IS NOT NULL AND ([t].[CustomerID] LIKE N'A%') + WHERE ([t].[CustomerID] IS NOT NULL) AND ([t].[CustomerID] LIKE N'A%') ) AS [t0] ON [c].[CustomerID] = [t0].[CustomerID]"); } @@ -728,7 +728,7 @@ FROM [Customers] AS [c] ) AS [t] OUTER APPLY ( SELECT CASE - WHEN ([t1].[CustomerID] = [c0].[City]) OR ([t1].[CustomerID] IS NULL AND [c0].[City] IS NULL) THEN N'A' + WHEN ([t1].[CustomerID] = [c0].[City]) OR (([t1].[CustomerID] IS NULL) AND ([c0].[City] IS NULL)) THEN N'A' ELSE N'B' END AS [Title], [t1].[OrderID], [c0].[CustomerID], [t1].[OrderDate] FROM ( diff --git a/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindKeylessEntitiesQuerySqlServerTest.cs b/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindKeylessEntitiesQuerySqlServerTest.cs index 84ac5ce173c..aa2a889fa72 100644 --- a/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindKeylessEntitiesQuerySqlServerTest.cs +++ b/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindKeylessEntitiesQuerySqlServerTest.cs @@ -124,7 +124,7 @@ public override async Task KeylessEntity_select_where_navigation_multi_level(boo WHERE EXISTS ( SELECT 1 FROM [Orders] AS [o] - WHERE [c].[CustomerID] IS NOT NULL AND ([c].[CustomerID] = [o].[CustomerID]))"); + WHERE ([c].[CustomerID] IS NOT NULL) AND ([c].[CustomerID] = [o].[CustomerID]))"); } [ConditionalFact] @@ -172,7 +172,7 @@ SELECT TOP(@__p_0) [m].[City], [m].[ContactName] WHERE EXISTS ( SELECT 1 FROM [Customers] AS [c] - WHERE ([c].[City] = [m].[City]) OR ([c].[City] IS NULL AND [m].[City] IS NULL)) + WHERE ([c].[City] = [m].[City]) OR (([c].[City] IS NULL) AND ([m].[City] IS NULL))) ORDER BY [m].[ContactName]"); } diff --git a/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindMiscellaneousQuerySqlServerTest.cs b/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindMiscellaneousQuerySqlServerTest.cs index c76b8f78aac..ff666c43bb1 100644 --- a/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindMiscellaneousQuerySqlServerTest.cs +++ b/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindMiscellaneousQuerySqlServerTest.cs @@ -431,10 +431,10 @@ FROM [Employees] AS [e] WHERE ([e].[FirstName] = ( SELECT TOP(1) [e0].[FirstName] FROM [Employees] AS [e0] - ORDER BY [e0].[EmployeeID])) OR ([e].[FirstName] IS NULL AND ( + ORDER BY [e0].[EmployeeID])) OR (([e].[FirstName] IS NULL) AND (( SELECT TOP(1) [e0].[FirstName] FROM [Employees] AS [e0] - ORDER BY [e0].[EmployeeID]) IS NULL)"); + ORDER BY [e0].[EmployeeID]) IS NULL))"); } public override async Task Where_query_composition_is_null(bool async) @@ -593,7 +593,7 @@ FROM [Employees] AS [e] WHERE ( SELECT TOP(1) [e0].[EmployeeID] FROM [Employees] AS [e0] - WHERE ([e0].[EmployeeID] <> [e].[ReportsTo]) OR [e].[ReportsTo] IS NULL) = 0"); + WHERE ([e0].[EmployeeID] <> [e].[ReportsTo]) OR ([e].[ReportsTo] IS NULL)) = 0"); } public override async Task Where_query_composition_entity_equality_multiple_elements_Single(bool async) @@ -606,7 +606,7 @@ FROM [Employees] AS [e] WHERE ( SELECT TOP(1) [e0].[EmployeeID] FROM [Employees] AS [e0] - WHERE ([e0].[EmployeeID] <> [e].[ReportsTo]) OR [e].[ReportsTo] IS NULL) = 0"); + WHERE ([e0].[EmployeeID] <> [e].[ReportsTo]) OR ([e].[ReportsTo] IS NULL)) = 0"); } public override async Task Where_query_composition_entity_equality_multiple_elements_FirstOrDefault(bool async) @@ -619,7 +619,7 @@ FROM [Employees] AS [e] WHERE ( SELECT TOP(1) [e0].[EmployeeID] FROM [Employees] AS [e0] - WHERE ([e0].[EmployeeID] <> [e].[ReportsTo]) OR [e].[ReportsTo] IS NULL) = 0"); + WHERE ([e0].[EmployeeID] <> [e].[ReportsTo]) OR ([e].[ReportsTo] IS NULL)) = 0"); } public override async Task Where_query_composition_entity_equality_multiple_elements_First(bool async) @@ -632,7 +632,7 @@ FROM [Employees] AS [e] WHERE ( SELECT TOP(1) [e0].[EmployeeID] FROM [Employees] AS [e0] - WHERE ([e0].[EmployeeID] <> [e].[ReportsTo]) OR [e].[ReportsTo] IS NULL) = 0"); + WHERE ([e0].[EmployeeID] <> [e].[ReportsTo]) OR ([e].[ReportsTo] IS NULL)) = 0"); } public override async Task Where_query_composition2(bool async) @@ -650,10 +650,10 @@ FROM [Employees] AS [e] WHERE ([t].[FirstName] = ( SELECT TOP(1) [e0].[FirstName] FROM [Employees] AS [e0] - ORDER BY [e0].[EmployeeID])) OR ([t].[FirstName] IS NULL AND ( + ORDER BY [e0].[EmployeeID])) OR (([t].[FirstName] IS NULL) AND (( SELECT TOP(1) [e0].[FirstName] FROM [Employees] AS [e0] - ORDER BY [e0].[EmployeeID]) IS NULL)"); + ORDER BY [e0].[EmployeeID]) IS NULL))"); } public override async Task Where_query_composition2_FirstOrDefault(bool async) @@ -671,10 +671,10 @@ FROM [Employees] AS [e] WHERE ([t].[FirstName] = ( SELECT TOP(1) [e0].[FirstName] FROM [Employees] AS [e0] - ORDER BY [e0].[EmployeeID])) OR ([t].[FirstName] IS NULL AND ( + ORDER BY [e0].[EmployeeID])) OR (([t].[FirstName] IS NULL) AND (( SELECT TOP(1) [e0].[FirstName] FROM [Employees] AS [e0] - ORDER BY [e0].[EmployeeID]) IS NULL)"); + ORDER BY [e0].[EmployeeID]) IS NULL))"); } public override async Task Where_query_composition2_FirstOrDefault_with_anonymous(bool async) @@ -692,10 +692,10 @@ FROM [Employees] AS [e] WHERE ([t].[FirstName] = ( SELECT TOP(1) [e0].[FirstName] FROM [Employees] AS [e0] - ORDER BY [e0].[EmployeeID])) OR ([t].[FirstName] IS NULL AND ( + ORDER BY [e0].[EmployeeID])) OR (([t].[FirstName] IS NULL) AND (( SELECT TOP(1) [e0].[FirstName] FROM [Employees] AS [e0] - ORDER BY [e0].[EmployeeID]) IS NULL)"); + ORDER BY [e0].[EmployeeID]) IS NULL))"); } public override void Select_Subquery_Single() @@ -787,16 +787,16 @@ SELECT TOP(1) [c0].[Country] FROM [Orders] AS [o1] INNER JOIN [Customers] AS [c0] ON [o1].[CustomerID] = [c0].[CustomerID] WHERE [o1].[OrderID] = [t0].[OrderID] - ORDER BY [o1].[OrderID], [c0].[CustomerID])) OR (( + ORDER BY [o1].[OrderID], [c0].[CustomerID])) OR ((( SELECT TOP(1) [c].[Country] FROM [Customers] AS [c] WHERE [c].[CustomerID] = [t].[CustomerID] - ORDER BY [c].[CustomerID]) IS NULL AND ( + ORDER BY [c].[CustomerID]) IS NULL) AND (( SELECT TOP(1) [c0].[Country] FROM [Orders] AS [o1] INNER JOIN [Customers] AS [c0] ON [o1].[CustomerID] = [c0].[CustomerID] WHERE [o1].[OrderID] = [t0].[OrderID] - ORDER BY [o1].[OrderID], [c0].[CustomerID]) IS NULL)) > 0 + ORDER BY [o1].[OrderID], [c0].[CustomerID]) IS NULL))) > 0 ORDER BY [t].[OrderID]"); } @@ -1329,7 +1329,7 @@ public override async Task Any_predicate(bool async) WHEN EXISTS ( SELECT 1 FROM [Customers] AS [c] - WHERE [c].[ContactName] IS NOT NULL AND ([c].[ContactName] LIKE N'A%')) THEN CAST(1 AS bit) + WHERE ([c].[ContactName] IS NOT NULL) AND ([c].[ContactName] LIKE N'A%')) THEN CAST(1 AS bit) ELSE CAST(0 AS bit) END"); } @@ -1344,7 +1344,7 @@ FROM [Customers] AS [c] WHERE NOT (EXISTS ( SELECT 1 FROM [Orders] AS [o] - WHERE [o].[CustomerID] IS NOT NULL AND ([o].[CustomerID] LIKE N'A%')))"); + WHERE ([o].[CustomerID] IS NOT NULL) AND ([o].[CustomerID] LIKE N'A%')))"); } public override async Task Any_nested_negated2(bool async) @@ -1354,10 +1354,10 @@ public override async Task Any_nested_negated2(bool async) AssertSql( @"SELECT [c].[CustomerID], [c].[Address], [c].[City], [c].[CompanyName], [c].[ContactName], [c].[ContactTitle], [c].[Country], [c].[Fax], [c].[Phone], [c].[PostalCode], [c].[Region] FROM [Customers] AS [c] -WHERE (([c].[City] <> N'London') OR [c].[City] IS NULL) AND NOT (EXISTS ( +WHERE (([c].[City] <> N'London') OR ([c].[City] IS NULL)) AND NOT (EXISTS ( SELECT 1 FROM [Orders] AS [o] - WHERE [o].[CustomerID] IS NOT NULL AND ([o].[CustomerID] LIKE N'A%')))"); + WHERE ([o].[CustomerID] IS NOT NULL) AND ([o].[CustomerID] LIKE N'A%')))"); } public override async Task Any_nested_negated3(bool async) @@ -1370,7 +1370,7 @@ FROM [Customers] AS [c] WHERE NOT (EXISTS ( SELECT 1 FROM [Orders] AS [o] - WHERE [o].[CustomerID] IS NOT NULL AND ([o].[CustomerID] LIKE N'A%'))) AND (([c].[City] <> N'London') OR [c].[City] IS NULL)"); + WHERE ([o].[CustomerID] IS NOT NULL) AND ([o].[CustomerID] LIKE N'A%'))) AND (([c].[City] <> N'London') OR ([c].[City] IS NULL))"); } public override async Task Any_nested(bool async) @@ -1383,7 +1383,7 @@ FROM [Customers] AS [c] WHERE EXISTS ( SELECT 1 FROM [Orders] AS [o] - WHERE [o].[CustomerID] IS NOT NULL AND ([o].[CustomerID] LIKE N'A%'))"); + WHERE ([o].[CustomerID] IS NOT NULL) AND ([o].[CustomerID] LIKE N'A%'))"); } public override async Task Any_nested2(bool async) @@ -1393,10 +1393,10 @@ public override async Task Any_nested2(bool async) AssertSql( @"SELECT [c].[CustomerID], [c].[Address], [c].[City], [c].[CompanyName], [c].[ContactName], [c].[ContactTitle], [c].[Country], [c].[Fax], [c].[Phone], [c].[PostalCode], [c].[Region] FROM [Customers] AS [c] -WHERE (([c].[City] <> N'London') OR [c].[City] IS NULL) AND EXISTS ( +WHERE (([c].[City] <> N'London') OR ([c].[City] IS NULL)) AND EXISTS ( SELECT 1 FROM [Orders] AS [o] - WHERE [o].[CustomerID] IS NOT NULL AND ([o].[CustomerID] LIKE N'A%'))"); + WHERE ([o].[CustomerID] IS NOT NULL) AND ([o].[CustomerID] LIKE N'A%'))"); } public override async Task Any_nested3(bool async) @@ -1409,7 +1409,7 @@ FROM [Customers] AS [c] WHERE EXISTS ( SELECT 1 FROM [Orders] AS [o] - WHERE [o].[CustomerID] IS NOT NULL AND ([o].[CustomerID] LIKE N'A%')) AND (([c].[City] <> N'London') OR [c].[City] IS NULL)"); + WHERE ([o].[CustomerID] IS NOT NULL) AND ([o].[CustomerID] LIKE N'A%')) AND (([c].[City] <> N'London') OR ([c].[City] IS NULL))"); } public override void Any_with_multiple_conditions_still_uses_exists() @@ -1434,7 +1434,7 @@ public override async Task All_top_level(bool async) WHEN NOT EXISTS ( SELECT 1 FROM [Customers] AS [c] - WHERE [c].[ContactName] IS NULL OR NOT ([c].[ContactName] LIKE N'A%')) THEN CAST(1 AS bit) + WHERE ([c].[ContactName] IS NULL) OR NOT ([c].[ContactName] LIKE N'A%')) THEN CAST(1 AS bit) ELSE CAST(0 AS bit) END"); } @@ -1448,7 +1448,7 @@ public override async Task All_top_level_column(bool async) WHEN NOT EXISTS ( SELECT 1 FROM [Customers] AS [c] - WHERE (([c].[ContactName] <> N'') OR [c].[ContactName] IS NULL) AND ([c].[ContactName] IS NULL OR (LEFT([c].[ContactName], LEN([c].[ContactName])) <> [c].[ContactName]))) THEN CAST(1 AS bit) + WHERE (([c].[ContactName] <> N'') OR ([c].[ContactName] IS NULL)) AND (([c].[ContactName] IS NULL) OR (LEFT([c].[ContactName], LEN([c].[ContactName])) <> [c].[ContactName]))) THEN CAST(1 AS bit) ELSE CAST(0 AS bit) END"); } @@ -1823,7 +1823,7 @@ public override async Task SelectMany_cartesian_product_with_ordering(bool async @"SELECT [c].[CustomerID], [c].[Address], [c].[City], [c].[CompanyName], [c].[ContactName], [c].[ContactTitle], [c].[Country], [c].[Fax], [c].[Phone], [c].[PostalCode], [c].[Region], [e].[City] FROM [Customers] AS [c] CROSS JOIN [Employees] AS [e] -WHERE ([c].[City] = [e].[City]) OR ([c].[City] IS NULL AND [e].[City] IS NULL) +WHERE ([c].[City] = [e].[City]) OR (([c].[City] IS NULL) AND ([e].[City] IS NULL)) ORDER BY [e].[City], [c].[CustomerID] DESC"); } @@ -2235,7 +2235,7 @@ SELECT 1 FROM [Customers] AS [c0] WHERE [c0].[CustomerID] = N'ALFKI') THEN CAST(1 AS bit) ELSE CAST(0 AS bit) - END) <> N'Nowhere') OR ( + END) <> N'Nowhere') OR (( SELECT TOP(1) [c].[City] FROM [Customers] AS [c] ORDER BY CASE @@ -2244,7 +2244,7 @@ SELECT 1 FROM [Customers] AS [c0] WHERE [c0].[CustomerID] = N'ALFKI') THEN CAST(1 AS bit) ELSE CAST(0 AS bit) - END) IS NULL)"); + END) IS NULL))"); } public override async Task Where_subquery_recursive_trivial(bool async) @@ -2520,7 +2520,7 @@ public override async Task OrderBy_comparison_operator(bool async) @"SELECT [c].[CustomerID], [c].[Address], [c].[City], [c].[CompanyName], [c].[ContactName], [c].[ContactTitle], [c].[Country], [c].[Fax], [c].[Phone], [c].[PostalCode], [c].[Region] FROM [Customers] AS [c] ORDER BY CASE - WHEN ([c].[Region] = N'ASK') AND [c].[Region] IS NOT NULL THEN CAST(1 AS bit) + WHEN ([c].[Region] = N'ASK') AND ([c].[Region] IS NOT NULL) THEN CAST(1 AS bit) ELSE CAST(0 AS bit) END"); } @@ -2989,7 +2989,7 @@ public override async Task Parameter_extraction_short_circuits_1(bool async) SELECT [o].[OrderID], [o].[CustomerID], [o].[EmployeeID], [o].[OrderDate] FROM [Orders] AS [o] -WHERE ([o].[OrderID] < 10400) AND (([o].[OrderDate] IS NOT NULL AND (DATEPART(month, [o].[OrderDate]) = @__dateFilter_Value_Month_0)) AND (DATEPART(year, [o].[OrderDate]) = @__dateFilter_Value_Year_1))", +WHERE ([o].[OrderID] < 10400) AND ((([o].[OrderDate] IS NOT NULL) AND (DATEPART(month, [o].[OrderDate]) = @__dateFilter_Value_Month_0)) AND (DATEPART(year, [o].[OrderDate]) = @__dateFilter_Value_Year_1))", // @"SELECT [o].[OrderID], [o].[CustomerID], [o].[EmployeeID], [o].[OrderDate] FROM [Orders] AS [o] @@ -3006,7 +3006,7 @@ public override async Task Parameter_extraction_short_circuits_2(bool async) SELECT [o].[OrderID], [o].[CustomerID], [o].[EmployeeID], [o].[OrderDate] FROM [Orders] AS [o] -WHERE ([o].[OrderID] < 10400) AND (([o].[OrderDate] IS NOT NULL AND (DATEPART(month, [o].[OrderDate]) = @__dateFilter_Value_Month_0)) AND (DATEPART(year, [o].[OrderDate]) = @__dateFilter_Value_Year_1))", +WHERE ([o].[OrderID] < 10400) AND ((([o].[OrderDate] IS NOT NULL) AND (DATEPART(month, [o].[OrderDate]) = @__dateFilter_Value_Month_0)) AND (DATEPART(year, [o].[OrderDate]) = @__dateFilter_Value_Year_1))", // @"SELECT [o].[OrderID], [o].[CustomerID], [o].[EmployeeID], [o].[OrderDate] FROM [Orders] AS [o] @@ -3023,7 +3023,7 @@ public override async Task Parameter_extraction_short_circuits_3(bool async) SELECT [o].[OrderID], [o].[CustomerID], [o].[EmployeeID], [o].[OrderDate] FROM [Orders] AS [o] -WHERE ([o].[OrderID] < 10400) OR (([o].[OrderDate] IS NOT NULL AND (DATEPART(month, [o].[OrderDate]) = @__dateFilter_Value_Month_0)) AND (DATEPART(year, [o].[OrderDate]) = @__dateFilter_Value_Year_1))", +WHERE ([o].[OrderID] < 10400) OR ((([o].[OrderDate] IS NOT NULL) AND (DATEPART(month, [o].[OrderDate]) = @__dateFilter_Value_Month_0)) AND (DATEPART(year, [o].[OrderDate]) = @__dateFilter_Value_Year_1))", // @"SELECT [o].[OrderID], [o].[CustomerID], [o].[EmployeeID], [o].[OrderDate] FROM [Orders] AS [o]"); @@ -3080,7 +3080,7 @@ public override async Task Query_expression_with_to_string_and_contains(bool asy AssertSql( @"SELECT [o].[CustomerID] FROM [Orders] AS [o] -WHERE [o].[OrderDate] IS NOT NULL AND (CONVERT(varchar(10), [o].[EmployeeID]) LIKE N'%10%')"); +WHERE ([o].[OrderDate] IS NOT NULL) AND (CONVERT(varchar(10), [o].[EmployeeID]) LIKE N'%10%')"); } public override async Task Select_expression_long_to_string(bool async) @@ -3229,7 +3229,7 @@ public override async Task Select_expression_references_are_updated_correctly_wi SELECT DISTINCT DATEPART(year, [o].[OrderDate]) FROM [Orders] AS [o] -WHERE [o].[OrderDate] IS NOT NULL AND (DATEPART(year, [o].[OrderDate]) < @__nextYear_0)"); +WHERE ([o].[OrderDate] IS NOT NULL) AND (DATEPART(year, [o].[OrderDate]) < @__nextYear_0)"); } public override async Task DefaultIfEmpty_without_group_join(bool async) @@ -3299,7 +3299,7 @@ WHERE [o].[OrderID] > 15000 ) AS [t] ON 1 = 1 ) AS [t0] LEFT JOIN [Orders] AS [o0] ON [c].[CustomerID] = [o0].[CustomerID] -WHERE ([c].[City] = N'Seattle') AND ([t0].[OrderID] IS NOT NULL AND [o0].[OrderID] IS NOT NULL) +WHERE ([c].[City] = N'Seattle') AND (([t0].[OrderID] IS NOT NULL) AND ([o0].[OrderID] IS NOT NULL)) ORDER BY [t0].[OrderID], [o0].[OrderDate]"); } @@ -3326,7 +3326,7 @@ OUTER APPLY ( FROM [Orders] AS [o0] WHERE [o0].[OrderID] <= CAST(LEN([c].[CustomerID]) AS int) ) AS [t1] -WHERE ([c].[City] = N'Seattle') AND ([t0].[OrderID] IS NOT NULL AND [t1].[OrderID] IS NOT NULL) +WHERE ([c].[City] = N'Seattle') AND (([t0].[OrderID] IS NOT NULL) AND ([t1].[OrderID] IS NOT NULL)) ORDER BY [t0].[OrderID], [t1].[OrderDate]"); } @@ -3712,7 +3712,7 @@ public override async Task Anonymous_complex_distinct_result(bool async) SELECT DISTINCT [c].[CustomerID] + COALESCE([c].[City], N'') AS [A] FROM [Customers] AS [c] ) AS [t] -WHERE [t].[A] IS NOT NULL AND ([t].[A] LIKE N'A%')"); +WHERE ([t].[A] IS NOT NULL) AND ([t].[A] LIKE N'A%')"); } public override async Task Anonymous_complex_orderby(bool async) @@ -3816,7 +3816,7 @@ public override async Task DTO_complex_distinct_result(bool async) SELECT DISTINCT [c].[CustomerID] + COALESCE([c].[City], N'') AS [Property] FROM [Customers] AS [c] ) AS [t] -WHERE [t].[Property] IS NOT NULL AND ([t].[Property] LIKE N'A%')"); +WHERE ([t].[Property] IS NOT NULL) AND ([t].[Property] LIKE N'A%')"); } public override async Task DTO_complex_orderby(bool async) @@ -4282,7 +4282,7 @@ FROM [Orders] AS [o] CROSS JOIN [Orders] AS [o0] LEFT JOIN [Customers] AS [c] ON [o].[CustomerID] = [c].[CustomerID] LEFT JOIN [Customers] AS [c0] ON [o0].[CustomerID] = [c0].[CustomerID] -WHERE ([o].[CustomerID] IS NOT NULL AND ([o].[CustomerID] LIKE N'A%')) AND (([c].[CustomerID] = [c0].[CustomerID]) OR ([c].[CustomerID] IS NULL AND [c0].[CustomerID] IS NULL)) +WHERE (([o].[CustomerID] IS NOT NULL) AND ([o].[CustomerID] LIKE N'A%')) AND (([c].[CustomerID] = [c0].[CustomerID]) OR (([c].[CustomerID] IS NULL) AND ([c0].[CustomerID] IS NULL))) ORDER BY [o].[OrderID], [o0].[OrderID]"); } @@ -4296,7 +4296,7 @@ FROM [Orders] AS [o] CROSS JOIN [Orders] AS [o0] LEFT JOIN [Customers] AS [c] ON [o].[CustomerID] = [c].[CustomerID] LEFT JOIN [Customers] AS [c0] ON [o0].[CustomerID] = [c0].[CustomerID] -WHERE ([o].[CustomerID] IS NOT NULL AND ([o].[CustomerID] LIKE N'A%')) AND (([c].[CustomerID] = [c0].[CustomerID]) OR ([c].[CustomerID] IS NULL AND [c0].[CustomerID] IS NULL)) +WHERE (([o].[CustomerID] IS NOT NULL) AND ([o].[CustomerID] LIKE N'A%')) AND (([c].[CustomerID] = [c0].[CustomerID]) OR (([c].[CustomerID] IS NULL) AND ([c0].[CustomerID] IS NULL))) ORDER BY [o].[OrderID], [o0].[OrderID]"); } @@ -4341,7 +4341,7 @@ public override async Task Comparing_collection_navigation_to_null_complex(bool FROM [Order Details] AS [o] INNER JOIN [Orders] AS [o0] ON [o].[OrderID] = [o0].[OrderID] LEFT JOIN [Customers] AS [c] ON [o0].[CustomerID] = [c].[CustomerID] -WHERE ([o].[OrderID] < 10250) AND [c].[CustomerID] IS NOT NULL +WHERE ([o].[OrderID] < 10250) AND ([c].[CustomerID] IS NOT NULL) ORDER BY [o].[OrderID], [o].[ProductID]"); } @@ -4573,11 +4573,11 @@ FROM [Customers] AS [c] SELECT TOP(1) [o].[OrderID] FROM [Orders] AS [o] WHERE [c].[CustomerID] = [o].[CustomerID] - ORDER BY [o].[OrderDate]) <> 0) OR ( + ORDER BY [o].[OrderDate]) <> 0) OR (( SELECT TOP(1) [o].[OrderID] FROM [Orders] AS [o] WHERE [c].[CustomerID] = [o].[CustomerID] - ORDER BY [o].[OrderDate]) IS NULL)"); + ORDER BY [o].[OrderDate]) IS NULL))"); } public override async Task Collection_navigation_equal_to_null_for_subquery(bool async) @@ -5137,12 +5137,12 @@ SELECT TOP(1) [c1].[CustomerID] FROM [Orders] AS [o1] LEFT JOIN [Customers] AS [c1] ON [o1].[CustomerID] = [c1].[CustomerID] WHERE [c].[CustomerID] = [o1].[CustomerID] - ORDER BY [o1].[OrderDate]) = [o].[CustomerID]) OR (( + ORDER BY [o1].[OrderDate]) = [o].[CustomerID]) OR ((( SELECT TOP(1) [c1].[CustomerID] FROM [Orders] AS [o1] LEFT JOIN [Customers] AS [c1] ON [o1].[CustomerID] = [c1].[CustomerID] WHERE [c].[CustomerID] = [o1].[CustomerID] - ORDER BY [o1].[OrderDate]) IS NULL AND [o].[CustomerID] IS NULL))) AND ([o].[OrderID] < 11000)) THEN CAST(1 AS bit) + ORDER BY [o1].[OrderDate]) IS NULL) AND ([o].[CustomerID] IS NULL)))) AND ([o].[OrderID] < 11000)) THEN CAST(1 AS bit) ELSE CAST(0 AS bit) END AS [Complex] FROM [Customers] AS [c] @@ -5278,12 +5278,12 @@ FROM [Customers] AS [c] CROSS APPLY ( SELECT TOP(9) [e].[City], [t0].[City] AS [c1] FROM [Employees] AS [e] - WHERE ([t0].[City] = [e].[City]) OR ([t0].[City] IS NULL AND [e].[City] IS NULL) + WHERE ([t0].[City] = [e].[City]) OR (([t0].[City] IS NULL) AND ([e].[City] IS NULL)) ) AS [t1] CROSS APPLY ( SELECT TOP(9) [t0].[City], [e0].[EmployeeID] FROM [Employees] AS [e0] - WHERE ([t1].[City] = [e0].[City]) OR ([t1].[City] IS NULL AND [e0].[City] IS NULL) + WHERE ([t1].[City] = [e0].[City]) OR (([t1].[City] IS NULL) AND ([e0].[City] IS NULL)) ) AS [t2]"); } diff --git a/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindNavigationsQuerySqlServerTest.cs b/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindNavigationsQuerySqlServerTest.cs index 7329ed7a2e3..2cbf9ed8549 100644 --- a/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindNavigationsQuerySqlServerTest.cs +++ b/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindNavigationsQuerySqlServerTest.cs @@ -264,7 +264,7 @@ public override async Task Select_Where_Navigation_Multiple_Access(bool async) @"SELECT [o].[OrderID], [o].[CustomerID], [o].[EmployeeID], [o].[OrderDate] FROM [Orders] AS [o] LEFT JOIN [Customers] AS [c] ON [o].[CustomerID] = [c].[CustomerID] -WHERE ([c].[City] = N'Seattle') AND (([c].[Phone] <> N'555 555 5555') OR [c].[Phone] IS NULL)"); +WHERE ([c].[City] = N'Seattle') AND (([c].[Phone] <> N'555 555 5555') OR ([c].[Phone] IS NULL))"); } public override async Task Select_Navigations_Where_Navigations(bool async) @@ -275,7 +275,7 @@ public override async Task Select_Navigations_Where_Navigations(bool async) @"SELECT [c].[CustomerID], [c].[Address], [c].[City], [c].[CompanyName], [c].[ContactName], [c].[ContactTitle], [c].[Country], [c].[Fax], [c].[Phone], [c].[PostalCode], [c].[Region] FROM [Orders] AS [o] LEFT JOIN [Customers] AS [c] ON [o].[CustomerID] = [c].[CustomerID] -WHERE ([c].[City] = N'Seattle') AND (([c].[Phone] <> N'555 555 5555') OR [c].[Phone] IS NULL)"); +WHERE ([c].[City] = N'Seattle') AND (([c].[Phone] <> N'555 555 5555') OR ([c].[Phone] IS NULL))"); } public override async Task Select_Singleton_Navigation_With_Member_Access(bool async) @@ -286,7 +286,7 @@ public override async Task Select_Singleton_Navigation_With_Member_Access(bool a @"SELECT [c].[CustomerID], [c].[Address], [c].[City], [c].[CompanyName], [c].[ContactName], [c].[ContactTitle], [c].[Country], [c].[Fax], [c].[Phone], [c].[PostalCode], [c].[Region] FROM [Orders] AS [o] LEFT JOIN [Customers] AS [c] ON [o].[CustomerID] = [c].[CustomerID] -WHERE ([c].[City] = N'Seattle') AND (([c].[Phone] <> N'555 555 5555') OR [c].[Phone] IS NULL)"); +WHERE ([c].[City] = N'Seattle') AND (([c].[Phone] <> N'555 555 5555') OR ([c].[Phone] IS NULL))"); } public override async Task Select_count_plus_sum(bool async) @@ -312,7 +312,7 @@ public override async Task Singleton_Navigation_With_Member_Access(bool async) @"SELECT [c].[City] AS [B] FROM [Orders] AS [o] LEFT JOIN [Customers] AS [c] ON [o].[CustomerID] = [c].[CustomerID] -WHERE ([c].[City] = N'Seattle') AND (([c].[Phone] <> N'555 555 5555') OR [c].[Phone] IS NULL)"); +WHERE ([c].[City] = N'Seattle') AND (([c].[Phone] <> N'555 555 5555') OR ([c].[Phone] IS NULL))"); } public override async Task Select_Where_Navigation_Scalar_Equals_Navigation_Scalar_Projected(bool async) @@ -329,7 +329,7 @@ WHERE [o0].[OrderID] < 10400 ) AS [t] LEFT JOIN [Customers] AS [c] ON [o].[CustomerID] = [c].[CustomerID] LEFT JOIN [Customers] AS [c0] ON [t].[CustomerID] = [c0].[CustomerID] -WHERE ([o].[OrderID] < 10300) AND (([c].[City] = [c0].[City]) OR ([c].[City] IS NULL AND [c0].[City] IS NULL))"); +WHERE ([o].[OrderID] < 10300) AND (([c].[City] = [c0].[City]) OR (([c].[City] IS NULL) AND ([c0].[City] IS NULL)))"); } public override async Task Select_Where_Navigation_Equals_Navigation(bool async) @@ -342,7 +342,7 @@ FROM [Orders] AS [o] CROSS JOIN [Orders] AS [o0] LEFT JOIN [Customers] AS [c] ON [o].[CustomerID] = [c].[CustomerID] LEFT JOIN [Customers] AS [c0] ON [o0].[CustomerID] = [c0].[CustomerID] -WHERE (([o].[CustomerID] IS NOT NULL AND ([o].[CustomerID] LIKE N'A%')) AND ([o0].[CustomerID] IS NOT NULL AND ([o0].[CustomerID] LIKE N'A%'))) AND (([c].[CustomerID] = [c0].[CustomerID]) OR ([c].[CustomerID] IS NULL AND [c0].[CustomerID] IS NULL))"); +WHERE ((([o].[CustomerID] IS NOT NULL) AND ([o].[CustomerID] LIKE N'A%')) AND (([o0].[CustomerID] IS NOT NULL) AND ([o0].[CustomerID] LIKE N'A%'))) AND (([c].[CustomerID] = [c0].[CustomerID]) OR (([c].[CustomerID] IS NULL) AND ([c0].[CustomerID] IS NULL)))"); } public override async Task Select_Where_Navigation_Null(bool async) @@ -509,7 +509,7 @@ public override async Task Collection_select_nav_prop_all(bool async) WHEN NOT EXISTS ( SELECT 1 FROM [Orders] AS [o] - WHERE ([c].[CustomerID] = [o].[CustomerID]) AND (([o].[CustomerID] <> N'ALFKI') OR [o].[CustomerID] IS NULL)) THEN CAST(1 AS bit) + WHERE ([c].[CustomerID] = [o].[CustomerID]) AND (([o].[CustomerID] <> N'ALFKI') OR ([o].[CustomerID] IS NULL))) THEN CAST(1 AS bit) ELSE CAST(0 AS bit) END AS [All] FROM [Customers] AS [c]"); @@ -525,7 +525,7 @@ FROM [Customers] AS [c] WHERE NOT EXISTS ( SELECT 1 FROM [Orders] AS [o] - WHERE ([c].[CustomerID] = [o].[CustomerID]) AND (([o].[CustomerID] <> N'ALFKI') OR [o].[CustomerID] IS NULL))"); + WHERE ([c].[CustomerID] = [o].[CustomerID]) AND (([o].[CustomerID] <> N'ALFKI') OR ([o].[CustomerID] IS NULL)))"); } public override async Task Collection_select_nav_prop_count(bool async) @@ -619,7 +619,7 @@ SELECT COUNT_BIG(*) FROM [Order Details] AS [o3] WHERE [o].[OrderID] = [o3].[OrderID]) AS [collection2] FROM [Orders] AS [o] -WHERE [o].[CustomerID] IS NOT NULL AND ([o].[CustomerID] LIKE N'A%')"); +WHERE ([o].[CustomerID] IS NOT NULL) AND ([o].[CustomerID] LIKE N'A%')"); } public override async Task Collection_select_nav_prop_sum(bool async) @@ -857,7 +857,7 @@ SELECT COUNT(*) FROM [Order Details] AS [o0] INNER JOIN [Orders] AS [o1] ON [o0].[OrderID] = [o1].[OrderID] LEFT JOIN [Customers] AS [c0] ON [o1].[CustomerID] = [c0].[CustomerID] - WHERE ([c].[Country] = [c0].[Country]) OR ([c].[Country] IS NULL AND [c0].[Country] IS NULL)) > 0) AND [o].[OrderID] IN (10643, 10692)"); + WHERE ([c].[Country] = [c0].[Country]) OR (([c].[Country] IS NULL) AND ([c0].[Country] IS NULL))) > 0) AND [o].[OrderID] IN (10643, 10692)"); } public override async Task Project_single_scalar_value_subquery_is_properly_inlined(bool async) @@ -954,7 +954,7 @@ FROM [Orders] AS [o] WHERE ( SELECT COUNT(*) FROM [Orders] AS [o0] - WHERE ([c].[CustomerID] IS NOT NULL AND ([c].[CustomerID] = [o0].[CustomerID])) AND ([o0].[OrderID] > 10260)) > 30"); + WHERE (([c].[CustomerID] IS NOT NULL) AND ([c].[CustomerID] = [o0].[CustomerID])) AND ([o0].[OrderID] > 10260)) > 30"); } public override async Task Multiple_include_with_multiple_optional_navigations(bool async) diff --git a/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindQueryFiltersQuerySqlServerTest.cs b/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindQueryFiltersQuerySqlServerTest.cs index fd532180a09..a28961d08a9 100644 --- a/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindQueryFiltersQuerySqlServerTest.cs +++ b/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindQueryFiltersQuerySqlServerTest.cs @@ -30,7 +30,7 @@ public override async Task Count_query(bool async) SELECT COUNT(*) FROM [Customers] AS [c] -WHERE (@__ef_filter__TenantPrefix_0 = N'') OR ([c].[CompanyName] IS NOT NULL AND (LEFT([c].[CompanyName], LEN(@__ef_filter__TenantPrefix_0)) = @__ef_filter__TenantPrefix_0))"); +WHERE (@__ef_filter__TenantPrefix_0 = N'') OR (([c].[CompanyName] IS NOT NULL) AND (LEFT([c].[CompanyName], LEN(@__ef_filter__TenantPrefix_0)) = @__ef_filter__TenantPrefix_0))"); } public override async Task Materialized_query(bool async) @@ -42,7 +42,7 @@ public override async Task Materialized_query(bool async) SELECT [c].[CustomerID], [c].[Address], [c].[City], [c].[CompanyName], [c].[ContactName], [c].[ContactTitle], [c].[Country], [c].[Fax], [c].[Phone], [c].[PostalCode], [c].[Region] FROM [Customers] AS [c] -WHERE (@__ef_filter__TenantPrefix_0 = N'') OR ([c].[CompanyName] IS NOT NULL AND (LEFT([c].[CompanyName], LEN(@__ef_filter__TenantPrefix_0)) = @__ef_filter__TenantPrefix_0))"); +WHERE (@__ef_filter__TenantPrefix_0 = N'') OR (([c].[CompanyName] IS NOT NULL) AND (LEFT([c].[CompanyName], LEN(@__ef_filter__TenantPrefix_0)) = @__ef_filter__TenantPrefix_0))"); } public override async Task Find(bool async) @@ -55,7 +55,7 @@ public override async Task Find(bool async) SELECT TOP(1) [c].[CustomerID], [c].[Address], [c].[City], [c].[CompanyName], [c].[ContactName], [c].[ContactTitle], [c].[Country], [c].[Fax], [c].[Phone], [c].[PostalCode], [c].[Region] FROM [Customers] AS [c] -WHERE ((@__ef_filter__TenantPrefix_0 = N'') OR ([c].[CompanyName] IS NOT NULL AND (LEFT([c].[CompanyName], LEN(@__ef_filter__TenantPrefix_0)) = @__ef_filter__TenantPrefix_0))) AND ([c].[CustomerID] = @__p_0)"); +WHERE ((@__ef_filter__TenantPrefix_0 = N'') OR (([c].[CompanyName] IS NOT NULL) AND (LEFT([c].[CompanyName], LEN(@__ef_filter__TenantPrefix_0)) = @__ef_filter__TenantPrefix_0))) AND ([c].[CustomerID] = @__p_0)"); } public override async Task Materialized_query_parameter(bool async) @@ -67,7 +67,7 @@ public override async Task Materialized_query_parameter(bool async) SELECT [c].[CustomerID], [c].[Address], [c].[City], [c].[CompanyName], [c].[ContactName], [c].[ContactTitle], [c].[Country], [c].[Fax], [c].[Phone], [c].[PostalCode], [c].[Region] FROM [Customers] AS [c] -WHERE (@__ef_filter__TenantPrefix_0 = N'') OR ([c].[CompanyName] IS NOT NULL AND (LEFT([c].[CompanyName], LEN(@__ef_filter__TenantPrefix_0)) = @__ef_filter__TenantPrefix_0))"); +WHERE (@__ef_filter__TenantPrefix_0 = N'') OR (([c].[CompanyName] IS NOT NULL) AND (LEFT([c].[CompanyName], LEN(@__ef_filter__TenantPrefix_0)) = @__ef_filter__TenantPrefix_0))"); } public override async Task Materialized_query_parameter_new_context(bool async) @@ -79,13 +79,13 @@ public override async Task Materialized_query_parameter_new_context(bool async) SELECT [c].[CustomerID], [c].[Address], [c].[City], [c].[CompanyName], [c].[ContactName], [c].[ContactTitle], [c].[Country], [c].[Fax], [c].[Phone], [c].[PostalCode], [c].[Region] FROM [Customers] AS [c] -WHERE (@__ef_filter__TenantPrefix_0 = N'') OR ([c].[CompanyName] IS NOT NULL AND (LEFT([c].[CompanyName], LEN(@__ef_filter__TenantPrefix_0)) = @__ef_filter__TenantPrefix_0))", +WHERE (@__ef_filter__TenantPrefix_0 = N'') OR (([c].[CompanyName] IS NOT NULL) AND (LEFT([c].[CompanyName], LEN(@__ef_filter__TenantPrefix_0)) = @__ef_filter__TenantPrefix_0))", // @"@__ef_filter__TenantPrefix_0='T' (Size = 4000) SELECT [c].[CustomerID], [c].[Address], [c].[City], [c].[CompanyName], [c].[ContactName], [c].[ContactTitle], [c].[Country], [c].[Fax], [c].[Phone], [c].[PostalCode], [c].[Region] FROM [Customers] AS [c] -WHERE (@__ef_filter__TenantPrefix_0 = N'') OR ([c].[CompanyName] IS NOT NULL AND (LEFT([c].[CompanyName], LEN(@__ef_filter__TenantPrefix_0)) = @__ef_filter__TenantPrefix_0))"); +WHERE (@__ef_filter__TenantPrefix_0 = N'') OR (([c].[CompanyName] IS NOT NULL) AND (LEFT([c].[CompanyName], LEN(@__ef_filter__TenantPrefix_0)) = @__ef_filter__TenantPrefix_0))"); } public override async Task Projection_query_parameter(bool async) @@ -97,7 +97,7 @@ public override async Task Projection_query_parameter(bool async) SELECT [c].[CustomerID] FROM [Customers] AS [c] -WHERE (@__ef_filter__TenantPrefix_0 = N'') OR ([c].[CompanyName] IS NOT NULL AND (LEFT([c].[CompanyName], LEN(@__ef_filter__TenantPrefix_0)) = @__ef_filter__TenantPrefix_0))"); +WHERE (@__ef_filter__TenantPrefix_0 = N'') OR (([c].[CompanyName] IS NOT NULL) AND (LEFT([c].[CompanyName], LEN(@__ef_filter__TenantPrefix_0)) = @__ef_filter__TenantPrefix_0))"); } public override async Task Projection_query(bool async) @@ -109,7 +109,7 @@ public override async Task Projection_query(bool async) SELECT [c].[CustomerID] FROM [Customers] AS [c] -WHERE (@__ef_filter__TenantPrefix_0 = N'') OR ([c].[CompanyName] IS NOT NULL AND (LEFT([c].[CompanyName], LEN(@__ef_filter__TenantPrefix_0)) = @__ef_filter__TenantPrefix_0))"); +WHERE (@__ef_filter__TenantPrefix_0 = N'') OR (([c].[CompanyName] IS NOT NULL) AND (LEFT([c].[CompanyName], LEN(@__ef_filter__TenantPrefix_0)) = @__ef_filter__TenantPrefix_0))"); } public override async Task Include_query(bool async) @@ -127,11 +127,11 @@ FROM [Orders] AS [o] LEFT JOIN ( SELECT [c0].[CustomerID], [c0].[CompanyName] FROM [Customers] AS [c0] - WHERE (@__ef_filter__TenantPrefix_0 = N'') OR ([c0].[CompanyName] IS NOT NULL AND (LEFT([c0].[CompanyName], LEN(@__ef_filter__TenantPrefix_0)) = @__ef_filter__TenantPrefix_0)) + WHERE (@__ef_filter__TenantPrefix_0 = N'') OR (([c0].[CompanyName] IS NOT NULL) AND (LEFT([c0].[CompanyName], LEN(@__ef_filter__TenantPrefix_0)) = @__ef_filter__TenantPrefix_0)) ) AS [t] ON [o].[CustomerID] = [t].[CustomerID] WHERE [t].[CustomerID] IS NOT NULL -) AS [t0] ON [t0].[CompanyName] IS NOT NULL AND ([c].[CustomerID] = [t0].[CustomerID]) -WHERE (@__ef_filter__TenantPrefix_0 = N'') OR ([c].[CompanyName] IS NOT NULL AND (LEFT([c].[CompanyName], LEN(@__ef_filter__TenantPrefix_0)) = @__ef_filter__TenantPrefix_0)) +) AS [t0] ON ([t0].[CompanyName] IS NOT NULL) AND ([c].[CustomerID] = [t0].[CustomerID]) +WHERE (@__ef_filter__TenantPrefix_0 = N'') OR (([c].[CompanyName] IS NOT NULL) AND (LEFT([c].[CompanyName], LEN(@__ef_filter__TenantPrefix_0)) = @__ef_filter__TenantPrefix_0)) ORDER BY [c].[CustomerID], [t0].[OrderID]"); } @@ -158,9 +158,9 @@ FROM [Orders] AS [o] LEFT JOIN ( SELECT [c].[CustomerID], [c].[Address], [c].[City], [c].[CompanyName], [c].[ContactName], [c].[ContactTitle], [c].[Country], [c].[Fax], [c].[Phone], [c].[PostalCode], [c].[Region] FROM [Customers] AS [c] - WHERE (@__ef_filter__TenantPrefix_0 = N'') OR ([c].[CompanyName] IS NOT NULL AND (LEFT([c].[CompanyName], LEN(@__ef_filter__TenantPrefix_0)) = @__ef_filter__TenantPrefix_0)) + WHERE (@__ef_filter__TenantPrefix_0 = N'') OR (([c].[CompanyName] IS NOT NULL) AND (LEFT([c].[CompanyName], LEN(@__ef_filter__TenantPrefix_0)) = @__ef_filter__TenantPrefix_0)) ) AS [t] ON [o].[CustomerID] = [t].[CustomerID] -WHERE [t].[CustomerID] IS NOT NULL AND [t].[CompanyName] IS NOT NULL"); +WHERE ([t].[CustomerID] IS NOT NULL) AND ([t].[CompanyName] IS NOT NULL)"); } public override async Task Project_reference_that_itself_has_query_filter_with_another_reference(bool async) @@ -179,9 +179,9 @@ FROM [Orders] AS [o0] LEFT JOIN ( SELECT [c].[CustomerID], [c].[CompanyName] FROM [Customers] AS [c] - WHERE (@__ef_filter__TenantPrefix_1 = N'') OR ([c].[CompanyName] IS NOT NULL AND (LEFT([c].[CompanyName], LEN(@__ef_filter__TenantPrefix_1)) = @__ef_filter__TenantPrefix_1)) + WHERE (@__ef_filter__TenantPrefix_1 = N'') OR (([c].[CompanyName] IS NOT NULL) AND (LEFT([c].[CompanyName], LEN(@__ef_filter__TenantPrefix_1)) = @__ef_filter__TenantPrefix_1)) ) AS [t] ON [o0].[CustomerID] = [t].[CustomerID] - WHERE [t].[CustomerID] IS NOT NULL AND [t].[CompanyName] IS NOT NULL + WHERE ([t].[CustomerID] IS NOT NULL) AND ([t].[CompanyName] IS NOT NULL) ) AS [t0] ON [o].[OrderID] = [t0].[OrderID] WHERE [o].[Quantity] > @__ef_filter___quantity_0"); } @@ -202,10 +202,10 @@ FROM [Orders] AS [o] LEFT JOIN ( SELECT [c0].[CustomerID], [c0].[CompanyName] FROM [Customers] AS [c0] - WHERE (@__ef_filter__TenantPrefix_0 = N'') OR ([c0].[CompanyName] IS NOT NULL AND (LEFT([c0].[CompanyName], LEN(@__ef_filter__TenantPrefix_0)) = @__ef_filter__TenantPrefix_0)) + WHERE (@__ef_filter__TenantPrefix_0 = N'') OR (([c0].[CompanyName] IS NOT NULL) AND (LEFT([c0].[CompanyName], LEN(@__ef_filter__TenantPrefix_0)) = @__ef_filter__TenantPrefix_0)) ) AS [t] ON [o].[CustomerID] = [t].[CustomerID] WHERE [t].[CustomerID] IS NOT NULL -) AS [t0] ON [t0].[CompanyName] IS NOT NULL AND ([c].[CustomerID] = [t0].[CustomerID]) +) AS [t0] ON ([t0].[CompanyName] IS NOT NULL) AND ([c].[CustomerID] = [t0].[CustomerID]) INNER JOIN ( SELECT [o0].[OrderID], [o0].[Discount] FROM [Order Details] AS [o0] @@ -215,13 +215,13 @@ FROM [Orders] AS [o1] LEFT JOIN ( SELECT [c1].[CustomerID], [c1].[CompanyName] FROM [Customers] AS [c1] - WHERE (@__ef_filter__TenantPrefix_0 = N'') OR ([c1].[CompanyName] IS NOT NULL AND (LEFT([c1].[CompanyName], LEN(@__ef_filter__TenantPrefix_0)) = @__ef_filter__TenantPrefix_0)) + WHERE (@__ef_filter__TenantPrefix_0 = N'') OR (([c1].[CompanyName] IS NOT NULL) AND (LEFT([c1].[CompanyName], LEN(@__ef_filter__TenantPrefix_0)) = @__ef_filter__TenantPrefix_0)) ) AS [t3] ON [o1].[CustomerID] = [t3].[CustomerID] - WHERE [t3].[CustomerID] IS NOT NULL AND [t3].[CompanyName] IS NOT NULL + WHERE ([t3].[CustomerID] IS NOT NULL) AND ([t3].[CompanyName] IS NOT NULL) ) AS [t2] ON [o0].[OrderID] = [t2].[OrderID] WHERE [o0].[Quantity] > @__ef_filter___quantity_1 ) AS [t1] ON [t0].[OrderID] = [t1].[OrderID] -WHERE ((@__ef_filter__TenantPrefix_0 = N'') OR ([c].[CompanyName] IS NOT NULL AND (LEFT([c].[CompanyName], LEN(@__ef_filter__TenantPrefix_0)) = @__ef_filter__TenantPrefix_0))) AND ([t1].[Discount] < CAST(10 AS real))"); +WHERE ((@__ef_filter__TenantPrefix_0 = N'') OR (([c].[CompanyName] IS NOT NULL) AND (LEFT([c].[CompanyName], LEN(@__ef_filter__TenantPrefix_0)) = @__ef_filter__TenantPrefix_0))) AND ([t1].[Discount] < CAST(10 AS real))"); } [ConditionalFact] @@ -241,7 +241,7 @@ public void FromSql_is_composed() FROM ( select * from Customers ) AS [m] -WHERE (@__ef_filter__TenantPrefix_0 = N'') OR ([m].[CompanyName] IS NOT NULL AND (LEFT([m].[CompanyName], LEN(@__ef_filter__TenantPrefix_0)) = @__ef_filter__TenantPrefix_0))"); +WHERE (@__ef_filter__TenantPrefix_0 = N'') OR (([m].[CompanyName] IS NOT NULL) AND (LEFT([m].[CompanyName], LEN(@__ef_filter__TenantPrefix_0)) = @__ef_filter__TenantPrefix_0))"); } [ConditionalFact] @@ -264,9 +264,9 @@ public void FromSql_is_composed_when_filter_has_navigation() LEFT JOIN ( SELECT [c].[CustomerID], [c].[CompanyName] FROM [Customers] AS [c] - WHERE (@__ef_filter__TenantPrefix_0 = N'') OR ([c].[CompanyName] IS NOT NULL AND (LEFT([c].[CompanyName], LEN(@__ef_filter__TenantPrefix_0)) = @__ef_filter__TenantPrefix_0)) + WHERE (@__ef_filter__TenantPrefix_0 = N'') OR (([c].[CompanyName] IS NOT NULL) AND (LEFT([c].[CompanyName], LEN(@__ef_filter__TenantPrefix_0)) = @__ef_filter__TenantPrefix_0)) ) AS [t] ON [m].[CustomerID] = [t].[CustomerID] -WHERE [t].[CustomerID] IS NOT NULL AND [t].[CompanyName] IS NOT NULL"); +WHERE ([t].[CustomerID] IS NOT NULL) AND ([t].[CompanyName] IS NOT NULL)"); } public override void Compiled_query() @@ -279,14 +279,14 @@ public override void Compiled_query() SELECT [c].[CustomerID], [c].[Address], [c].[City], [c].[CompanyName], [c].[ContactName], [c].[ContactTitle], [c].[Country], [c].[Fax], [c].[Phone], [c].[PostalCode], [c].[Region] FROM [Customers] AS [c] -WHERE ((@__ef_filter__TenantPrefix_0 = N'') OR ([c].[CompanyName] IS NOT NULL AND (LEFT([c].[CompanyName], LEN(@__ef_filter__TenantPrefix_0)) = @__ef_filter__TenantPrefix_0))) AND ([c].[CustomerID] = @__customerID)", +WHERE ((@__ef_filter__TenantPrefix_0 = N'') OR (([c].[CompanyName] IS NOT NULL) AND (LEFT([c].[CompanyName], LEN(@__ef_filter__TenantPrefix_0)) = @__ef_filter__TenantPrefix_0))) AND ([c].[CustomerID] = @__customerID)", // @"@__ef_filter__TenantPrefix_0='B' (Size = 4000) @__customerID='BLAUS' (Size = 5) (DbType = StringFixedLength) SELECT [c].[CustomerID], [c].[Address], [c].[City], [c].[CompanyName], [c].[ContactName], [c].[ContactTitle], [c].[Country], [c].[Fax], [c].[Phone], [c].[PostalCode], [c].[Region] FROM [Customers] AS [c] -WHERE ((@__ef_filter__TenantPrefix_0 = N'') OR ([c].[CompanyName] IS NOT NULL AND (LEFT([c].[CompanyName], LEN(@__ef_filter__TenantPrefix_0)) = @__ef_filter__TenantPrefix_0))) AND ([c].[CustomerID] = @__customerID)"); +WHERE ((@__ef_filter__TenantPrefix_0 = N'') OR (([c].[CompanyName] IS NOT NULL) AND (LEFT([c].[CompanyName], LEN(@__ef_filter__TenantPrefix_0)) = @__ef_filter__TenantPrefix_0))) AND ([c].[CustomerID] = @__customerID)"); } public override async Task Entity_Equality(bool async) @@ -301,9 +301,9 @@ FROM [Orders] AS [o] LEFT JOIN ( SELECT [c].[CustomerID], [c].[CompanyName] FROM [Customers] AS [c] - WHERE (@__ef_filter__TenantPrefix_0 = N'') OR ([c].[CompanyName] IS NOT NULL AND (LEFT([c].[CompanyName], LEN(@__ef_filter__TenantPrefix_0)) = @__ef_filter__TenantPrefix_0)) + WHERE (@__ef_filter__TenantPrefix_0 = N'') OR (([c].[CompanyName] IS NOT NULL) AND (LEFT([c].[CompanyName], LEN(@__ef_filter__TenantPrefix_0)) = @__ef_filter__TenantPrefix_0)) ) AS [t] ON [o].[CustomerID] = [t].[CustomerID] -WHERE [t].[CustomerID] IS NOT NULL AND [t].[CompanyName] IS NOT NULL"); +WHERE ([t].[CustomerID] IS NOT NULL) AND ([t].[CompanyName] IS NOT NULL)"); } private void AssertSql(params string[] expected) diff --git a/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindSelectQuerySqlServerTest.cs b/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindSelectQuerySqlServerTest.cs index caff165231e..fa9ae9ae787 100644 --- a/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindSelectQuerySqlServerTest.cs +++ b/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindSelectQuerySqlServerTest.cs @@ -364,10 +364,10 @@ FROM [Order Details] AS [o0] WHERE ([o].[OrderID] = [o0].[OrderID]) AND (([o0].[OrderID] <> ( SELECT COUNT(*) FROM [Orders] AS [o1] - WHERE [c].[CustomerID] = [o1].[CustomerID])) OR ( + WHERE [c].[CustomerID] = [o1].[CustomerID])) OR (( SELECT COUNT(*) FROM [Orders] AS [o1] - WHERE [c].[CustomerID] = [o1].[CustomerID]) IS NULL)), 0) + WHERE [c].[CustomerID] = [o1].[CustomerID]) IS NULL))), 0) FROM [Orders] AS [o] WHERE ([c].[CustomerID] = [o].[CustomerID]) AND ([o].[OrderID] < 10500)), 0) AS [Order] FROM [Customers] AS [c] @@ -952,7 +952,7 @@ public override async Task Projecting_nullable_struct(bool async) AssertSql( @"SELECT [o].[CustomerID], CASE - WHEN ([o].[CustomerID] = N'ALFKI') AND [o].[CustomerID] IS NOT NULL THEN CAST(1 AS bit) + WHEN ([o].[CustomerID] = N'ALFKI') AND ([o].[CustomerID] IS NOT NULL) THEN CAST(1 AS bit) ELSE CAST(0 AS bit) END, [o].[OrderID], CAST(LEN([o].[CustomerID]) AS int) FROM [Orders] AS [o]"); @@ -1058,7 +1058,7 @@ FROM [Customers] AS [c] OUTER APPLY ( SELECT [c].[City] FROM [Orders] AS [o] - WHERE ([c].[CustomerID] <> [o].[CustomerID]) OR [o].[CustomerID] IS NULL + WHERE ([c].[CustomerID] <> [o].[CustomerID]) OR ([o].[CustomerID] IS NULL) ) AS [t]"); } @@ -1072,7 +1072,7 @@ FROM [Customers] AS [c] OUTER APPLY ( SELECT TOP(2) [o].[OrderID], [o].[CustomerID], [o].[EmployeeID], [o].[OrderDate] FROM [Orders] AS [o] - WHERE ([c].[CustomerID] <> [o].[CustomerID]) OR [o].[CustomerID] IS NULL + WHERE ([c].[CustomerID] <> [o].[CustomerID]) OR ([o].[CustomerID] IS NULL) ORDER BY [c].[City], [o].[OrderID] ) AS [t]"); } @@ -1590,7 +1590,7 @@ public override async Task Projection_custom_type_in_both_sides_of_ternary(bool AssertSql( @"SELECT CASE - WHEN ([c].[City] = N'Seattle') AND [c].[City] IS NOT NULL THEN CAST(1 AS bit) + WHEN ([c].[City] = N'Seattle') AND ([c].[City] IS NOT NULL) THEN CAST(1 AS bit) ELSE CAST(0 AS bit) END FROM [Customers] AS [c] @@ -1788,7 +1788,7 @@ FROM [Orders] AS [o] OUTER APPLY ( SELECT [t].[CustomerID], [o0].[OrderID], [o0].[OrderDate] FROM [Orders] AS [o0] - WHERE [o0].[OrderID] IN (10248, 10249, 10250) AND (([t].[CustomerID] = [o0].[CustomerID]) OR ([t].[CustomerID] IS NULL AND [o0].[CustomerID] IS NULL)) + WHERE [o0].[OrderID] IN (10248, 10249, 10250) AND (([t].[CustomerID] = [o0].[CustomerID]) OR (([t].[CustomerID] IS NULL) AND ([o0].[CustomerID] IS NULL))) ) AS [t0] ORDER BY [t].[CustomerID], [t0].[OrderID]"); } @@ -1824,7 +1824,7 @@ FROM [Orders] AS [o] OUTER APPLY ( SELECT [t].[OrderDate] AS [Outer1], [t].[CustomerID] AS [Outer2], [o0].[OrderID] AS [Inner], [o0].[OrderDate] FROM [Orders] AS [o0] - WHERE [o0].[OrderID] IN (10248, 10249, 10250) AND (([t].[CustomerID] = [o0].[CustomerID]) OR ([t].[CustomerID] IS NULL AND [o0].[CustomerID] IS NULL)) + WHERE [o0].[OrderID] IN (10248, 10249, 10250) AND (([t].[CustomerID] = [o0].[CustomerID]) OR (([t].[CustomerID] IS NULL) AND ([o0].[CustomerID] IS NULL))) ) AS [t0] ORDER BY [t].[OrderDate], [t].[CustomerID]"); } @@ -1903,12 +1903,12 @@ OUTER APPLY ( FROM ( SELECT DISTINCT [o].[OrderID], [o].[CustomerID], [o].[EmployeeID], [o].[OrderDate] FROM [Orders] AS [o] - WHERE (([o].[CustomerID] = [t].[City]) OR ([o].[CustomerID] IS NULL AND [t].[City] IS NULL)) AND (DATEPART(year, [o].[OrderDate]) = 1997) + WHERE (([o].[CustomerID] = [t].[City]) OR (([o].[CustomerID] IS NULL) AND ([t].[City] IS NULL))) AND (DATEPART(year, [o].[OrderDate]) = 1997) ) AS [t0] OUTER APPLY ( SELECT [t0].[OrderID], [o0].[OrderID] AS [OrderID0] FROM [Orders] AS [o0] - WHERE ([t0].[CustomerID] = [t].[City]) OR ([t0].[CustomerID] IS NULL AND [t].[City] IS NULL) + WHERE ([t0].[CustomerID] = [t].[City]) OR (([t0].[CustomerID] IS NULL) AND ([t].[City] IS NULL)) ) AS [t2] ) AS [t1] ORDER BY [t].[City], [t1].[OrderID], [t1].[OrderID00]"); @@ -1975,7 +1975,7 @@ public override async Task Take_on_top_level_and_on_collection_projection_with_o FROM ( SELECT TOP(1) [o].[OrderID], [o].[OrderDate] FROM [Orders] AS [o] - WHERE [o].[CustomerID] IS NOT NULL AND ([o].[CustomerID] LIKE N'F%') + WHERE ([o].[CustomerID] IS NOT NULL) AND ([o].[CustomerID] LIKE N'F%') ) AS [t] OUTER APPLY ( SELECT [t1].[OrderID], [p].[ProductID], [p].[Discontinued], [p].[ProductName], [p].[SupplierID], [p].[UnitPrice], [p].[UnitsInStock], [t1].[UnitPrice] AS [UnitPrice0], [t1].[ProductID] AS [ProductID0] @@ -2005,7 +2005,7 @@ ORDER BY [c].[CustomerID] ) AS [t] OUTER APPLY ( SELECT CASE - WHEN ([t1].[CustomerID] = [c0].[CustomerID]) OR ([t1].[CustomerID] IS NULL AND [c0].[CustomerID] IS NULL) THEN N'A' + WHEN ([t1].[CustomerID] = [c0].[CustomerID]) OR (([t1].[CustomerID] IS NULL) AND ([c0].[CustomerID] IS NULL)) THEN N'A' ELSE N'B' END AS [Title], [t1].[OrderID], [c0].[CustomerID], [t1].[OrderDate] FROM ( diff --git a/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindSetOperationsQuerySqlServerTest.cs b/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindSetOperationsQuerySqlServerTest.cs index 068761f2fbd..b2e34529082 100644 --- a/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindSetOperationsQuerySqlServerTest.cs +++ b/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindSetOperationsQuerySqlServerTest.cs @@ -274,11 +274,11 @@ public override async Task Union_with_anonymous_type_projection(bool async) FROM ( SELECT [c].[CustomerID], [c].[Address], [c].[City], [c].[CompanyName], [c].[ContactName], [c].[ContactTitle], [c].[Country], [c].[Fax], [c].[Phone], [c].[PostalCode], [c].[Region] FROM [Customers] AS [c] - WHERE [c].[CompanyName] IS NOT NULL AND ([c].[CompanyName] LIKE N'A%') + WHERE ([c].[CompanyName] IS NOT NULL) AND ([c].[CompanyName] LIKE N'A%') UNION SELECT [c0].[CustomerID], [c0].[Address], [c0].[City], [c0].[CompanyName], [c0].[ContactName], [c0].[ContactTitle], [c0].[Country], [c0].[Fax], [c0].[Phone], [c0].[PostalCode], [c0].[Region] FROM [Customers] AS [c0] - WHERE [c0].[CompanyName] IS NOT NULL AND ([c0].[CompanyName] LIKE N'B%') + WHERE ([c0].[CompanyName] IS NOT NULL) AND ([c0].[CompanyName] LIKE N'B%') ) AS [t]"); } @@ -295,7 +295,7 @@ FROM [Customers] AS [c] SELECT [p].[ProductName] AS [ContactName] FROM [Products] AS [p] ) AS [t] -WHERE [t].[ContactName] IS NOT NULL AND ([t].[ContactName] LIKE N'C%') +WHERE ([t].[ContactName] IS NOT NULL) AND ([t].[ContactName] LIKE N'C%') ORDER BY [t].[ContactName]"); } diff --git a/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindSplitIncludeQuerySqlServerTest.cs b/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindSplitIncludeQuerySqlServerTest.cs index 1dd81937eaf..e9545899d80 100644 --- a/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindSplitIncludeQuerySqlServerTest.cs +++ b/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindSplitIncludeQuerySqlServerTest.cs @@ -52,7 +52,7 @@ public override async Task Include_reference(bool async) @"SELECT [o].[OrderID], [o].[CustomerID], [o].[EmployeeID], [o].[OrderDate], [c].[CustomerID], [c].[Address], [c].[City], [c].[CompanyName], [c].[ContactName], [c].[ContactTitle], [c].[Country], [c].[Fax], [c].[Phone], [c].[PostalCode], [c].[Region] FROM [Orders] AS [o] LEFT JOIN [Customers] AS [c] ON [o].[CustomerID] = [c].[CustomerID] -WHERE [o].[CustomerID] IS NOT NULL AND ([o].[CustomerID] LIKE N'F%')"); +WHERE ([o].[CustomerID] IS NOT NULL) AND ([o].[CustomerID] LIKE N'F%')"); } public override async Task Include_when_result_operator(bool async) @@ -173,14 +173,14 @@ public override async Task Include_reference_and_collection(bool async) @"SELECT [o].[OrderID], [o].[CustomerID], [o].[EmployeeID], [o].[OrderDate], [c].[CustomerID], [c].[Address], [c].[City], [c].[CompanyName], [c].[ContactName], [c].[ContactTitle], [c].[Country], [c].[Fax], [c].[Phone], [c].[PostalCode], [c].[Region] FROM [Orders] AS [o] LEFT JOIN [Customers] AS [c] ON [o].[CustomerID] = [c].[CustomerID] -WHERE [o].[CustomerID] IS NOT NULL AND ([o].[CustomerID] LIKE N'F%') +WHERE ([o].[CustomerID] IS NOT NULL) AND ([o].[CustomerID] LIKE N'F%') ORDER BY [o].[OrderID], [c].[CustomerID]", // @"SELECT [o0].[OrderID], [o0].[ProductID], [o0].[Discount], [o0].[Quantity], [o0].[UnitPrice], [o].[OrderID], [c].[CustomerID] FROM [Orders] AS [o] LEFT JOIN [Customers] AS [c] ON [o].[CustomerID] = [c].[CustomerID] INNER JOIN [Order Details] AS [o0] ON [o].[OrderID] = [o0].[OrderID] -WHERE [o].[CustomerID] IS NOT NULL AND ([o].[CustomerID] LIKE N'F%') +WHERE ([o].[CustomerID] IS NOT NULL) AND ([o].[CustomerID] LIKE N'F%') ORDER BY [o].[OrderID], [c].[CustomerID]"); } @@ -313,13 +313,13 @@ public override async Task Include_collection_alias_generation(bool async) AssertSql( @"SELECT [o].[OrderID], [o].[CustomerID], [o].[EmployeeID], [o].[OrderDate] FROM [Orders] AS [o] -WHERE [o].[CustomerID] IS NOT NULL AND ([o].[CustomerID] LIKE N'F%') +WHERE ([o].[CustomerID] IS NOT NULL) AND ([o].[CustomerID] LIKE N'F%') ORDER BY [o].[OrderID]", // @"SELECT [o0].[OrderID], [o0].[ProductID], [o0].[Discount], [o0].[Quantity], [o0].[UnitPrice], [o].[OrderID] FROM [Orders] AS [o] INNER JOIN [Order Details] AS [o0] ON [o].[OrderID] = [o0].[OrderID] -WHERE [o].[CustomerID] IS NOT NULL AND ([o].[CustomerID] LIKE N'F%') +WHERE ([o].[CustomerID] IS NOT NULL) AND ([o].[CustomerID] LIKE N'F%') ORDER BY [o].[OrderID]"); } @@ -948,7 +948,7 @@ FROM [Customers] AS [c] OUTER APPLY ( SELECT TOP(5) [o].[OrderID] FROM [Orders] AS [o] - WHERE ([o].[CustomerID] <> [c].[CustomerID]) OR [o].[CustomerID] IS NULL + WHERE ([o].[CustomerID] <> [c].[CustomerID]) OR ([o].[CustomerID] IS NULL) ORDER BY [c].[CustomerID] ) AS [t] WHERE [c].[CustomerID] LIKE N'F%' @@ -959,7 +959,7 @@ FROM [Customers] AS [c] OUTER APPLY ( SELECT TOP(5) [o].[OrderID] FROM [Orders] AS [o] - WHERE ([o].[CustomerID] <> [c].[CustomerID]) OR [o].[CustomerID] IS NULL + WHERE ([o].[CustomerID] <> [c].[CustomerID]) OR ([o].[CustomerID] IS NULL) ORDER BY [c].[CustomerID] ) AS [t] INNER JOIN [Orders] AS [o0] ON [c].[CustomerID] = [o0].[CustomerID] diff --git a/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindWhereQuerySqlServerTest.cs b/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindWhereQuerySqlServerTest.cs index fbe4bbabdeb..91748d48142 100644 --- a/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindWhereQuerySqlServerTest.cs +++ b/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindWhereQuerySqlServerTest.cs @@ -483,10 +483,10 @@ FROM [Employees] AS [e] WHERE ([e].[Title] = ( SELECT TOP(1) [e0].[Title] FROM [Employees] AS [e0] - ORDER BY [e0].[Title])) OR ([e].[Title] IS NULL AND ( + ORDER BY [e0].[Title])) OR (([e].[Title] IS NULL) AND (( SELECT TOP(1) [e0].[Title] FROM [Employees] AS [e0] - ORDER BY [e0].[Title]) IS NULL)"); + ORDER BY [e0].[Title]) IS NULL))"); } public override async Task Where_subquery_correlated(bool async) @@ -680,10 +680,10 @@ FROM [Customers] AS [c] WHERE (CASE WHEN N'Sea' = N'' THEN 0 ELSE CAST(CHARINDEX(N'Sea', [c].[City]) AS int) - 1 -END <> -1) OR CASE +END <> -1) OR (CASE WHEN N'Sea' = N'' THEN 0 ELSE CAST(CHARINDEX(N'Sea', [c].[City]) AS int) - 1 -END IS NULL"); +END IS NULL)"); } public override async Task Where_string_replace(bool async) @@ -949,7 +949,7 @@ public override async Task Where_identity_comparison(bool async) AssertSql( @"SELECT [c].[CustomerID], [c].[Address], [c].[City], [c].[CompanyName], [c].[ContactName], [c].[ContactTitle], [c].[Country], [c].[Fax], [c].[Phone], [c].[PostalCode], [c].[Region] FROM [Customers] AS [c] -WHERE ([c].[City] = [c].[City]) OR [c].[City] IS NULL"); +WHERE ([c].[City] = [c].[City]) OR ([c].[City] IS NULL)"); } public override async Task Where_in_optimization_multiple(bool async) @@ -971,7 +971,7 @@ public override async Task Where_not_in_optimization1(bool async) @"SELECT [c].[CustomerID], [c].[Address], [c].[City], [c].[CompanyName], [c].[ContactName], [c].[ContactTitle], [c].[Country], [c].[Fax], [c].[Phone], [c].[PostalCode], [c].[Region], [e].[EmployeeID], [e].[City], [e].[Country], [e].[FirstName], [e].[ReportsTo], [e].[Title] FROM [Customers] AS [c] CROSS JOIN [Employees] AS [e] -WHERE (([c].[City] <> N'London') OR [c].[City] IS NULL) AND (([e].[City] <> N'London') OR [e].[City] IS NULL)"); +WHERE (([c].[City] <> N'London') OR ([c].[City] IS NULL)) AND (([e].[City] <> N'London') OR ([e].[City] IS NULL))"); } public override async Task Where_not_in_optimization2(bool async) @@ -982,7 +982,7 @@ public override async Task Where_not_in_optimization2(bool async) @"SELECT [c].[CustomerID], [c].[Address], [c].[City], [c].[CompanyName], [c].[ContactName], [c].[ContactTitle], [c].[Country], [c].[Fax], [c].[Phone], [c].[PostalCode], [c].[Region], [e].[EmployeeID], [e].[City], [e].[Country], [e].[FirstName], [e].[ReportsTo], [e].[Title] FROM [Customers] AS [c] CROSS JOIN [Employees] AS [e] -WHERE [c].[City] NOT IN (N'London', N'Berlin') OR [c].[City] IS NULL"); +WHERE [c].[City] NOT IN (N'London', N'Berlin') OR ([c].[City] IS NULL)"); } public override async Task Where_not_in_optimization3(bool async) @@ -993,7 +993,7 @@ public override async Task Where_not_in_optimization3(bool async) @"SELECT [c].[CustomerID], [c].[Address], [c].[City], [c].[CompanyName], [c].[ContactName], [c].[ContactTitle], [c].[Country], [c].[Fax], [c].[Phone], [c].[PostalCode], [c].[Region], [e].[EmployeeID], [e].[City], [e].[Country], [e].[FirstName], [e].[ReportsTo], [e].[Title] FROM [Customers] AS [c] CROSS JOIN [Employees] AS [e] -WHERE [c].[City] NOT IN (N'London', N'Berlin', N'Seattle') OR [c].[City] IS NULL"); +WHERE [c].[City] NOT IN (N'London', N'Berlin', N'Seattle') OR ([c].[City] IS NULL)"); } public override async Task Where_not_in_optimization4(bool async) @@ -1004,7 +1004,7 @@ public override async Task Where_not_in_optimization4(bool async) @"SELECT [c].[CustomerID], [c].[Address], [c].[City], [c].[CompanyName], [c].[ContactName], [c].[ContactTitle], [c].[Country], [c].[Fax], [c].[Phone], [c].[PostalCode], [c].[Region], [e].[EmployeeID], [e].[City], [e].[Country], [e].[FirstName], [e].[ReportsTo], [e].[Title] FROM [Customers] AS [c] CROSS JOIN [Employees] AS [e] -WHERE [c].[City] NOT IN (N'London', N'Berlin', N'Seattle', N'Lisboa') OR [c].[City] IS NULL"); +WHERE [c].[City] NOT IN (N'London', N'Berlin', N'Seattle', N'Lisboa') OR ([c].[City] IS NULL)"); } public override async Task Where_select_many_and(bool async) @@ -1547,7 +1547,7 @@ public override async Task Where_compare_null(bool async) AssertSql( @"SELECT [c].[CustomerID], [c].[Address], [c].[City], [c].[CompanyName], [c].[ContactName], [c].[ContactTitle], [c].[Country], [c].[Fax], [c].[Phone], [c].[PostalCode], [c].[Region] FROM [Customers] AS [c] -WHERE [c].[City] IS NULL AND ([c].[Country] = N'UK')"); +WHERE ([c].[City] IS NULL) AND ([c].[Country] = N'UK')"); } public override async Task Where_compare_null_with_cast_to_object(bool async) @@ -2136,7 +2136,7 @@ public override async Task Multiple_OrElse_on_same_column_with_null_constant_com AssertSql( @"SELECT [c].[CustomerID], [c].[Address], [c].[City], [c].[CompanyName], [c].[ContactName], [c].[ContactTitle], [c].[Country], [c].[Fax], [c].[Phone], [c].[PostalCode], [c].[Region] FROM [Customers] AS [c] -WHERE [c].[Region] IN (N'WA', N'OR', N'BC') OR [c].[Region] IS NULL"); +WHERE [c].[Region] IN (N'WA', N'OR', N'BC') OR ([c].[Region] IS NULL)"); } public override async Task Constant_array_Contains_OrElse_comparison_with_constant_gets_combined_to_one_in(bool async) @@ -2213,7 +2213,7 @@ public override async Task Multiple_OrElse_on_same_column_with_null_parameter_co AssertSql( @"SELECT [c].[CustomerID], [c].[Address], [c].[City], [c].[CompanyName], [c].[ContactName], [c].[ContactTitle], [c].[Country], [c].[Fax], [c].[Phone], [c].[PostalCode], [c].[Region] FROM [Customers] AS [c] -WHERE ([c].[Region] IN (N'WA', N'OR') OR [c].[Region] IS NULL) OR ([c].[Region] = N'BC')"); +WHERE ([c].[Region] IN (N'WA', N'OR') OR ([c].[Region] IS NULL)) OR ([c].[Region] = N'BC')"); } public override async Task Parameter_array_Contains_OrElse_comparison_with_constant(bool async) @@ -2256,7 +2256,7 @@ public override async Task Two_sets_of_comparison_combine_correctly2(bool async) AssertSql( @"SELECT [c].[CustomerID], [c].[Address], [c].[City], [c].[CompanyName], [c].[ContactName], [c].[ContactTitle], [c].[Country], [c].[Fax], [c].[Phone], [c].[PostalCode], [c].[Region] FROM [Customers] AS [c] -WHERE ([c].[Region] <> N'WA') AND [c].[Region] IS NOT NULL"); +WHERE ([c].[Region] <> N'WA') AND ([c].[Region] IS NOT NULL)"); } public override async Task Filter_with_EF_Property_using_closure_for_property_name(bool async) diff --git a/test/EFCore.SqlServer.FunctionalTests/Query/NullSemanticsQuerySqlServerTest.cs b/test/EFCore.SqlServer.FunctionalTests/Query/NullSemanticsQuerySqlServerTest.cs index 78959800600..857f5e5fae6 100644 --- a/test/EFCore.SqlServer.FunctionalTests/Query/NullSemanticsQuerySqlServerTest.cs +++ b/test/EFCore.SqlServer.FunctionalTests/Query/NullSemanticsQuerySqlServerTest.cs @@ -479,7 +479,7 @@ WHERE CASE WHEN ([e].[NullableBoolA] = [e].[BoolB]) AND ([e].[NullableBoolA] IS NOT NULL) THEN CAST(1 AS bit) ELSE CAST(0 AS bit) END = CASE - WHEN ([e].[IntA] = [e].[NullableIntB]) AND [e].[NullableIntB] IS NOT NULL THEN CAST(1 AS bit) + WHEN ([e].[IntA] = [e].[NullableIntB]) AND ([e].[NullableIntB] IS NOT NULL) THEN CAST(1 AS bit) ELSE CAST(0 AS bit) END", // @@ -489,7 +489,7 @@ WHERE CASE WHEN (([e].[NullableBoolA] = [e].[NullableBoolB]) AND (([e].[NullableBoolA] IS NOT NULL) AND ([e].[NullableBoolB] IS NOT NULL))) OR (([e].[NullableBoolA] IS NULL) AND ([e].[NullableBoolB] IS NULL)) THEN CAST(1 AS bit) ELSE CAST(0 AS bit) END = CASE - WHEN (([e].[NullableIntA] = [e].[NullableIntB]) AND ([e].[NullableIntA] IS NOT NULL AND [e].[NullableIntB] IS NOT NULL)) OR ([e].[NullableIntA] IS NULL AND [e].[NullableIntB] IS NULL) THEN CAST(1 AS bit) + WHEN (([e].[NullableIntA] = [e].[NullableIntB]) AND (([e].[NullableIntA] IS NOT NULL) AND ([e].[NullableIntB] IS NOT NULL))) OR (([e].[NullableIntA] IS NULL) AND ([e].[NullableIntB] IS NULL)) THEN CAST(1 AS bit) ELSE CAST(0 AS bit) END"); } @@ -515,7 +515,7 @@ WHERE CASE WHEN ([e].[NullableBoolA] = [e].[BoolB]) AND ([e].[NullableBoolA] IS NOT NULL) THEN CAST(1 AS bit) ELSE CAST(0 AS bit) END <> CASE - WHEN ([e].[IntA] = [e].[NullableIntB]) AND [e].[NullableIntB] IS NOT NULL THEN CAST(1 AS bit) + WHEN ([e].[IntA] = [e].[NullableIntB]) AND ([e].[NullableIntB] IS NOT NULL) THEN CAST(1 AS bit) ELSE CAST(0 AS bit) END", // @@ -525,7 +525,7 @@ WHERE CASE WHEN (([e].[NullableBoolA] = [e].[NullableBoolB]) AND (([e].[NullableBoolA] IS NOT NULL) AND ([e].[NullableBoolB] IS NOT NULL))) OR (([e].[NullableBoolA] IS NULL) AND ([e].[NullableBoolB] IS NULL)) THEN CAST(1 AS bit) ELSE CAST(0 AS bit) END <> CASE - WHEN (([e].[NullableIntA] = [e].[NullableIntB]) AND ([e].[NullableIntA] IS NOT NULL AND [e].[NullableIntB] IS NOT NULL)) OR ([e].[NullableIntA] IS NULL AND [e].[NullableIntB] IS NULL) THEN CAST(1 AS bit) + WHEN (([e].[NullableIntA] = [e].[NullableIntB]) AND (([e].[NullableIntA] IS NOT NULL) AND ([e].[NullableIntB] IS NOT NULL))) OR (([e].[NullableIntA] IS NULL) AND ([e].[NullableIntB] IS NULL)) THEN CAST(1 AS bit) ELSE CAST(0 AS bit) END"); } @@ -551,7 +551,7 @@ WHERE CASE WHEN ([e].[NullableBoolA] <> [e].[BoolB]) OR ([e].[NullableBoolA] IS NULL) THEN CAST(1 AS bit) ELSE CAST(0 AS bit) END = CASE - WHEN ([e].[IntA] = [e].[NullableIntB]) AND [e].[NullableIntB] IS NOT NULL THEN CAST(1 AS bit) + WHEN ([e].[IntA] = [e].[NullableIntB]) AND ([e].[NullableIntB] IS NOT NULL) THEN CAST(1 AS bit) ELSE CAST(0 AS bit) END", // @@ -561,7 +561,7 @@ WHERE CASE WHEN (([e].[NullableBoolA] <> [e].[NullableBoolB]) OR (([e].[NullableBoolA] IS NULL) OR ([e].[NullableBoolB] IS NULL))) AND (([e].[NullableBoolA] IS NOT NULL) OR ([e].[NullableBoolB] IS NOT NULL)) THEN CAST(1 AS bit) ELSE CAST(0 AS bit) END = CASE - WHEN (([e].[NullableIntA] = [e].[NullableIntB]) AND ([e].[NullableIntA] IS NOT NULL AND [e].[NullableIntB] IS NOT NULL)) OR ([e].[NullableIntA] IS NULL AND [e].[NullableIntB] IS NULL) THEN CAST(1 AS bit) + WHEN (([e].[NullableIntA] = [e].[NullableIntB]) AND (([e].[NullableIntA] IS NOT NULL) AND ([e].[NullableIntB] IS NOT NULL))) OR (([e].[NullableIntA] IS NULL) AND ([e].[NullableIntB] IS NULL)) THEN CAST(1 AS bit) ELSE CAST(0 AS bit) END"); } @@ -587,7 +587,7 @@ WHERE CASE WHEN ([e].[NullableBoolA] <> [e].[BoolB]) OR ([e].[NullableBoolA] IS NULL) THEN CAST(1 AS bit) ELSE CAST(0 AS bit) END <> CASE - WHEN ([e].[IntA] = [e].[NullableIntB]) AND [e].[NullableIntB] IS NOT NULL THEN CAST(1 AS bit) + WHEN ([e].[IntA] = [e].[NullableIntB]) AND ([e].[NullableIntB] IS NOT NULL) THEN CAST(1 AS bit) ELSE CAST(0 AS bit) END", // @@ -597,7 +597,7 @@ WHERE CASE WHEN (([e].[NullableBoolA] <> [e].[NullableBoolB]) OR (([e].[NullableBoolA] IS NULL) OR ([e].[NullableBoolB] IS NULL))) AND (([e].[NullableBoolA] IS NOT NULL) OR ([e].[NullableBoolB] IS NOT NULL)) THEN CAST(1 AS bit) ELSE CAST(0 AS bit) END <> CASE - WHEN (([e].[NullableIntA] = [e].[NullableIntB]) AND ([e].[NullableIntA] IS NOT NULL AND [e].[NullableIntB] IS NOT NULL)) OR ([e].[NullableIntA] IS NULL AND [e].[NullableIntB] IS NULL) THEN CAST(1 AS bit) + WHEN (([e].[NullableIntA] = [e].[NullableIntB]) AND (([e].[NullableIntA] IS NOT NULL) AND ([e].[NullableIntB] IS NOT NULL))) OR (([e].[NullableIntA] IS NULL) AND ([e].[NullableIntB] IS NULL)) THEN CAST(1 AS bit) ELSE CAST(0 AS bit) END"); } @@ -623,7 +623,7 @@ WHERE CASE WHEN ([e].[NullableBoolA] <> [e].[BoolB]) OR ([e].[NullableBoolA] IS NULL) THEN CAST(1 AS bit) ELSE CAST(0 AS bit) END = CASE - WHEN ([e].[IntA] <> [e].[NullableIntB]) OR [e].[NullableIntB] IS NULL THEN CAST(1 AS bit) + WHEN ([e].[IntA] <> [e].[NullableIntB]) OR ([e].[NullableIntB] IS NULL) THEN CAST(1 AS bit) ELSE CAST(0 AS bit) END", // @@ -633,7 +633,7 @@ WHERE CASE WHEN (([e].[NullableBoolA] <> [e].[NullableBoolB]) OR (([e].[NullableBoolA] IS NULL) OR ([e].[NullableBoolB] IS NULL))) AND (([e].[NullableBoolA] IS NOT NULL) OR ([e].[NullableBoolB] IS NOT NULL)) THEN CAST(1 AS bit) ELSE CAST(0 AS bit) END = CASE - WHEN (([e].[NullableIntA] <> [e].[NullableIntB]) OR ([e].[NullableIntA] IS NULL OR [e].[NullableIntB] IS NULL)) AND ([e].[NullableIntA] IS NOT NULL OR [e].[NullableIntB] IS NOT NULL) THEN CAST(1 AS bit) + WHEN (([e].[NullableIntA] <> [e].[NullableIntB]) OR (([e].[NullableIntA] IS NULL) OR ([e].[NullableIntB] IS NULL))) AND (([e].[NullableIntA] IS NOT NULL) OR ([e].[NullableIntB] IS NOT NULL)) THEN CAST(1 AS bit) ELSE CAST(0 AS bit) END"); } @@ -659,7 +659,7 @@ WHERE CASE WHEN ([e].[NullableBoolA] <> [e].[BoolB]) OR ([e].[NullableBoolA] IS NULL) THEN CAST(1 AS bit) ELSE CAST(0 AS bit) END <> CASE - WHEN ([e].[IntA] <> [e].[NullableIntB]) OR [e].[NullableIntB] IS NULL THEN CAST(1 AS bit) + WHEN ([e].[IntA] <> [e].[NullableIntB]) OR ([e].[NullableIntB] IS NULL) THEN CAST(1 AS bit) ELSE CAST(0 AS bit) END", // @@ -669,7 +669,7 @@ WHERE CASE WHEN (([e].[NullableBoolA] <> [e].[NullableBoolB]) OR (([e].[NullableBoolA] IS NULL) OR ([e].[NullableBoolB] IS NULL))) AND (([e].[NullableBoolA] IS NOT NULL) OR ([e].[NullableBoolB] IS NOT NULL)) THEN CAST(1 AS bit) ELSE CAST(0 AS bit) END <> CASE - WHEN (([e].[NullableIntA] <> [e].[NullableIntB]) OR ([e].[NullableIntA] IS NULL OR [e].[NullableIntB] IS NULL)) AND ([e].[NullableIntA] IS NOT NULL OR [e].[NullableIntB] IS NOT NULL) THEN CAST(1 AS bit) + WHEN (([e].[NullableIntA] <> [e].[NullableIntB]) OR (([e].[NullableIntA] IS NULL) OR ([e].[NullableIntB] IS NULL))) AND (([e].[NullableIntA] IS NOT NULL) OR ([e].[NullableIntB] IS NOT NULL)) THEN CAST(1 AS bit) ELSE CAST(0 AS bit) END"); } @@ -713,7 +713,7 @@ public override async Task Contains_with_local_array_closure_with_null(bool asyn AssertSql( @"SELECT [e].[Id] FROM [Entities1] AS [e] -WHERE ([e].[NullableStringA] = N'Foo') OR [e].[NullableStringA] IS NULL"); +WHERE ([e].[NullableStringA] = N'Foo') OR ([e].[NullableStringA] IS NULL)"); } public override async Task Contains_with_local_array_closure_false_with_null(bool async) @@ -723,7 +723,7 @@ public override async Task Contains_with_local_array_closure_false_with_null(boo AssertSql( @"SELECT [e].[Id] FROM [Entities1] AS [e] -WHERE ([e].[NullableStringA] <> N'Foo') AND [e].[NullableStringA] IS NOT NULL"); +WHERE ([e].[NullableStringA] <> N'Foo') AND ([e].[NullableStringA] IS NOT NULL)"); } public override async Task Contains_with_local_nullable_array_closure_negated(bool async) @@ -733,7 +733,7 @@ public override async Task Contains_with_local_nullable_array_closure_negated(bo AssertSql( @"SELECT [e].[Id] FROM [Entities1] AS [e] -WHERE ([e].[NullableStringA] <> N'Foo') OR [e].[NullableStringA] IS NULL"); +WHERE ([e].[NullableStringA] <> N'Foo') OR ([e].[NullableStringA] IS NULL)"); } public override async Task Contains_with_local_array_closure_with_multiple_nulls(bool async) @@ -743,7 +743,7 @@ public override async Task Contains_with_local_array_closure_with_multiple_nulls AssertSql( @"SELECT [e].[Id] FROM [Entities1] AS [e] -WHERE ([e].[NullableStringA] = N'Foo') OR [e].[NullableStringA] IS NULL"); +WHERE ([e].[NullableStringA] = N'Foo') OR ([e].[NullableStringA] IS NULL)"); } public override async Task Where_multiple_ors_with_null(bool async) @@ -753,7 +753,7 @@ public override async Task Where_multiple_ors_with_null(bool async) AssertSql( @"SELECT [e].[Id] FROM [Entities1] AS [e] -WHERE [e].[NullableStringA] IN (N'Foo', N'Blah') OR [e].[NullableStringA] IS NULL"); +WHERE [e].[NullableStringA] IN (N'Foo', N'Blah') OR ([e].[NullableStringA] IS NULL)"); } public override async Task Where_multiple_ands_with_null(bool async) @@ -763,7 +763,7 @@ public override async Task Where_multiple_ands_with_null(bool async) AssertSql( @"SELECT [e].[Id] FROM [Entities1] AS [e] -WHERE [e].[NullableStringA] NOT IN (N'Foo', N'Blah') AND [e].[NullableStringA] IS NOT NULL"); +WHERE [e].[NullableStringA] NOT IN (N'Foo', N'Blah') AND ([e].[NullableStringA] IS NOT NULL)"); } public override async Task Where_multiple_ors_with_nullable_parameter(bool async) @@ -773,7 +773,7 @@ public override async Task Where_multiple_ors_with_nullable_parameter(bool async AssertSql( @"SELECT [e].[Id] FROM [Entities1] AS [e] -WHERE ([e].[NullableStringA] = N'Foo') OR [e].[NullableStringA] IS NULL"); +WHERE ([e].[NullableStringA] = N'Foo') OR ([e].[NullableStringA] IS NULL)"); } public override async Task Where_multiple_ands_with_nullable_parameter_and_constant(bool async) @@ -785,7 +785,7 @@ public override async Task Where_multiple_ands_with_nullable_parameter_and_const SELECT [e].[Id] FROM [Entities1] AS [e] -WHERE ((([e].[NullableStringA] <> N'Foo') OR [e].[NullableStringA] IS NULL) AND [e].[NullableStringA] IS NOT NULL) AND ([e].[NullableStringA] <> @__prm3_2)"); +WHERE ((([e].[NullableStringA] <> N'Foo') OR ([e].[NullableStringA] IS NULL)) AND ([e].[NullableStringA] IS NOT NULL)) AND ([e].[NullableStringA] <> @__prm3_2)"); } public override async Task Where_multiple_ands_with_nullable_parameter_and_constant_not_optimized(bool async) @@ -797,7 +797,7 @@ public override async Task Where_multiple_ands_with_nullable_parameter_and_const SELECT [e].[Id] FROM [Entities1] AS [e] -WHERE (([e].[NullableStringB] IS NOT NULL AND (([e].[NullableStringA] <> N'Foo') OR [e].[NullableStringA] IS NULL)) AND [e].[NullableStringA] IS NOT NULL) AND ([e].[NullableStringA] <> @__prm3_2)"); +WHERE ((([e].[NullableStringB] IS NOT NULL) AND (([e].[NullableStringA] <> N'Foo') OR ([e].[NullableStringA] IS NULL))) AND ([e].[NullableStringA] IS NOT NULL)) AND ([e].[NullableStringA] <> @__prm3_2)"); } public override async Task Where_coalesce(bool async) @@ -837,7 +837,7 @@ public override async Task Where_equal_with_coalesce(bool async) AssertSql( @"SELECT [e].[Id] FROM [Entities1] AS [e] -WHERE (COALESCE([e].[NullableStringA], [e].[NullableStringB]) = [e].[NullableStringC]) OR (([e].[NullableStringA] IS NULL AND [e].[NullableStringB] IS NULL) AND [e].[NullableStringC] IS NULL)"); +WHERE (COALESCE([e].[NullableStringA], [e].[NullableStringB]) = [e].[NullableStringC]) OR ((([e].[NullableStringA] IS NULL) AND ([e].[NullableStringB] IS NULL)) AND ([e].[NullableStringC] IS NULL))"); } public override async Task Where_not_equal_with_coalesce(bool async) @@ -847,7 +847,7 @@ public override async Task Where_not_equal_with_coalesce(bool async) AssertSql( @"SELECT [e].[Id] FROM [Entities1] AS [e] -WHERE ((COALESCE([e].[NullableStringA], [e].[NullableStringB]) <> [e].[NullableStringC]) OR (([e].[NullableStringA] IS NULL AND [e].[NullableStringB] IS NULL) OR [e].[NullableStringC] IS NULL)) AND (([e].[NullableStringA] IS NOT NULL OR [e].[NullableStringB] IS NOT NULL) OR [e].[NullableStringC] IS NOT NULL)"); +WHERE ((COALESCE([e].[NullableStringA], [e].[NullableStringB]) <> [e].[NullableStringC]) OR ((([e].[NullableStringA] IS NULL) AND ([e].[NullableStringB] IS NULL)) OR ([e].[NullableStringC] IS NULL))) AND ((([e].[NullableStringA] IS NOT NULL) OR ([e].[NullableStringB] IS NOT NULL)) OR ([e].[NullableStringC] IS NOT NULL))"); } public override async Task Where_equal_with_coalesce_both_sides(bool async) @@ -867,7 +867,7 @@ public override async Task Where_not_equal_with_coalesce_both_sides(bool async) AssertSql( @"SELECT [e].[Id] FROM [Entities1] AS [e] -WHERE ((COALESCE([e].[NullableIntA], [e].[NullableIntB]) <> COALESCE([e].[NullableIntC], [e].[NullableIntB])) OR (([e].[NullableIntA] IS NULL AND [e].[NullableIntB] IS NULL) OR ([e].[NullableIntC] IS NULL AND [e].[NullableIntB] IS NULL))) AND (([e].[NullableIntA] IS NOT NULL OR [e].[NullableIntB] IS NOT NULL) OR ([e].[NullableIntC] IS NOT NULL OR [e].[NullableIntB] IS NOT NULL))"); +WHERE ((COALESCE([e].[NullableIntA], [e].[NullableIntB]) <> COALESCE([e].[NullableIntC], [e].[NullableIntB])) OR ((([e].[NullableIntA] IS NULL) AND ([e].[NullableIntB] IS NULL)) OR (([e].[NullableIntC] IS NULL) AND ([e].[NullableIntB] IS NULL)))) AND ((([e].[NullableIntA] IS NOT NULL) OR ([e].[NullableIntB] IS NOT NULL)) OR (([e].[NullableIntC] IS NOT NULL) OR ([e].[NullableIntB] IS NOT NULL)))"); } public override async Task Where_equal_with_conditional(bool async) @@ -878,12 +878,12 @@ public override async Task Where_equal_with_conditional(bool async) @"SELECT [e].[Id] FROM [Entities1] AS [e] WHERE (CASE - WHEN ([e].[NullableStringA] = [e].[NullableStringB]) OR ([e].[NullableStringA] IS NULL AND [e].[NullableStringB] IS NULL) THEN [e].[NullableStringA] + WHEN ([e].[NullableStringA] = [e].[NullableStringB]) OR (([e].[NullableStringA] IS NULL) AND ([e].[NullableStringB] IS NULL)) THEN [e].[NullableStringA] ELSE [e].[NullableStringB] -END = [e].[NullableStringC]) OR (CASE - WHEN ([e].[NullableStringA] = [e].[NullableStringB]) OR ([e].[NullableStringA] IS NULL AND [e].[NullableStringB] IS NULL) THEN [e].[NullableStringA] +END = [e].[NullableStringC]) OR ((CASE + WHEN ([e].[NullableStringA] = [e].[NullableStringB]) OR (([e].[NullableStringA] IS NULL) AND ([e].[NullableStringB] IS NULL)) THEN [e].[NullableStringA] ELSE [e].[NullableStringB] -END IS NULL AND [e].[NullableStringC] IS NULL)"); +END IS NULL) AND ([e].[NullableStringC] IS NULL))"); } public override async Task Where_not_equal_with_conditional(bool async) @@ -894,15 +894,15 @@ public override async Task Where_not_equal_with_conditional(bool async) @"SELECT [e].[Id] FROM [Entities1] AS [e] WHERE (([e].[NullableStringC] <> CASE - WHEN ([e].[NullableStringA] = [e].[NullableStringB]) OR ([e].[NullableStringA] IS NULL AND [e].[NullableStringB] IS NULL) THEN [e].[NullableStringA] + WHEN ([e].[NullableStringA] = [e].[NullableStringB]) OR (([e].[NullableStringA] IS NULL) AND ([e].[NullableStringB] IS NULL)) THEN [e].[NullableStringA] ELSE [e].[NullableStringB] -END) OR ([e].[NullableStringC] IS NULL OR CASE - WHEN ([e].[NullableStringA] = [e].[NullableStringB]) OR ([e].[NullableStringA] IS NULL AND [e].[NullableStringB] IS NULL) THEN [e].[NullableStringA] +END) OR (([e].[NullableStringC] IS NULL) OR (CASE + WHEN ([e].[NullableStringA] = [e].[NullableStringB]) OR (([e].[NullableStringA] IS NULL) AND ([e].[NullableStringB] IS NULL)) THEN [e].[NullableStringA] ELSE [e].[NullableStringB] -END IS NULL)) AND ([e].[NullableStringC] IS NOT NULL OR CASE - WHEN ([e].[NullableStringA] = [e].[NullableStringB]) OR ([e].[NullableStringA] IS NULL AND [e].[NullableStringB] IS NULL) THEN [e].[NullableStringA] +END IS NULL))) AND (([e].[NullableStringC] IS NOT NULL) OR (CASE + WHEN ([e].[NullableStringA] = [e].[NullableStringB]) OR (([e].[NullableStringA] IS NULL) AND ([e].[NullableStringB] IS NULL)) THEN [e].[NullableStringA] ELSE [e].[NullableStringB] -END IS NOT NULL)"); +END IS NOT NULL))"); } public override async Task Where_equal_with_conditional_non_nullable(bool async) @@ -913,9 +913,9 @@ public override async Task Where_equal_with_conditional_non_nullable(bool async) @"SELECT [e].[Id] FROM [Entities1] AS [e] WHERE ([e].[NullableStringC] <> CASE - WHEN ([e].[NullableStringA] = [e].[NullableStringB]) OR ([e].[NullableStringA] IS NULL AND [e].[NullableStringB] IS NULL) THEN [e].[StringA] + WHEN ([e].[NullableStringA] = [e].[NullableStringB]) OR (([e].[NullableStringA] IS NULL) AND ([e].[NullableStringB] IS NULL)) THEN [e].[StringA] ELSE [e].[StringB] -END) OR [e].[NullableStringC] IS NULL"); +END) OR ([e].[NullableStringC] IS NULL)"); } public override async Task Where_equal_with_and_and_contains(bool async) @@ -934,7 +934,7 @@ public override async Task Null_comparison_in_selector_with_relational_nulls(boo AssertSql( @"SELECT CASE - WHEN ([e].[NullableStringA] <> N'Foo') OR [e].[NullableStringA] IS NULL THEN CAST(1 AS bit) + WHEN ([e].[NullableStringA] <> N'Foo') OR ([e].[NullableStringA] IS NULL) THEN CAST(1 AS bit) ELSE CAST(0 AS bit) END FROM [Entities1] AS [e]"); @@ -948,10 +948,10 @@ public override async Task Null_comparison_in_order_by_with_relational_nulls(boo @"SELECT [e].[Id], [e].[BoolA], [e].[BoolB], [e].[BoolC], [e].[IntA], [e].[IntB], [e].[IntC], [e].[NullableBoolA], [e].[NullableBoolB], [e].[NullableBoolC], [e].[NullableIntA], [e].[NullableIntB], [e].[NullableIntC], [e].[NullableStringA], [e].[NullableStringB], [e].[NullableStringC], [e].[StringA], [e].[StringB], [e].[StringC] FROM [Entities1] AS [e] ORDER BY CASE - WHEN ([e].[NullableStringA] <> N'Foo') OR [e].[NullableStringA] IS NULL THEN CAST(1 AS bit) + WHEN ([e].[NullableStringA] <> N'Foo') OR ([e].[NullableStringA] IS NULL) THEN CAST(1 AS bit) ELSE CAST(0 AS bit) END, CASE - WHEN ([e].[NullableIntB] <> 10) OR [e].[NullableIntB] IS NULL THEN CAST(1 AS bit) + WHEN ([e].[NullableIntB] <> 10) OR ([e].[NullableIntB] IS NULL) THEN CAST(1 AS bit) ELSE CAST(0 AS bit) END"); } @@ -1254,33 +1254,33 @@ FROM [Entities1] AS [e] WHERE (CASE WHEN N'oo' = N'' THEN 0 ELSE CAST(CHARINDEX(N'oo', [e].[NullableStringA]) AS int) - 1 -END = [e].[NullableIntA]) OR (CASE +END = [e].[NullableIntA]) OR ((CASE WHEN N'oo' = N'' THEN 0 ELSE CAST(CHARINDEX(N'oo', [e].[NullableStringA]) AS int) - 1 -END IS NULL AND [e].[NullableIntA] IS NULL)", +END IS NULL) AND ([e].[NullableIntA] IS NULL))", // @"SELECT [e].[Id] FROM [Entities1] AS [e] WHERE (CASE WHEN N'ar' = N'' THEN 0 ELSE CAST(CHARINDEX(N'ar', [e].[NullableStringA]) AS int) - 1 -END = [e].[NullableIntA]) OR (CASE +END = [e].[NullableIntA]) OR ((CASE WHEN N'ar' = N'' THEN 0 ELSE CAST(CHARINDEX(N'ar', [e].[NullableStringA]) AS int) - 1 -END IS NULL AND [e].[NullableIntA] IS NULL)", +END IS NULL) AND ([e].[NullableIntA] IS NULL))", // @"SELECT [e].[Id] FROM [Entities1] AS [e] WHERE ((CASE WHEN N'oo' = N'' THEN 0 ELSE CAST(CHARINDEX(N'oo', [e].[NullableStringA]) AS int) - 1 -END <> [e].[NullableIntB]) OR (CASE +END <> [e].[NullableIntB]) OR ((CASE WHEN N'oo' = N'' THEN 0 ELSE CAST(CHARINDEX(N'oo', [e].[NullableStringA]) AS int) - 1 -END IS NULL OR [e].[NullableIntB] IS NULL)) AND (CASE +END IS NULL) OR ([e].[NullableIntB] IS NULL))) AND ((CASE WHEN N'oo' = N'' THEN 0 ELSE CAST(CHARINDEX(N'oo', [e].[NullableStringA]) AS int) - 1 -END IS NOT NULL OR [e].[NullableIntB] IS NOT NULL)"); +END IS NOT NULL) OR ([e].[NullableIntB] IS NOT NULL))"); // issue #18773 // AssertSql( // @"SELECT [e].[Id] @@ -1330,13 +1330,13 @@ ELSE CAST(CHARINDEX(N'oo', [e].[NullableStringA]) AS int) - 1 END = CASE WHEN N'ar' = N'' THEN 0 ELSE CAST(CHARINDEX(N'ar', [e].[NullableStringB]) AS int) - 1 -END) OR (CASE +END) OR ((CASE WHEN N'oo' = N'' THEN 0 ELSE CAST(CHARINDEX(N'oo', [e].[NullableStringA]) AS int) - 1 -END IS NULL AND CASE +END IS NULL) AND (CASE WHEN N'ar' = N'' THEN 0 ELSE CAST(CHARINDEX(N'ar', [e].[NullableStringB]) AS int) - 1 -END IS NULL)", +END IS NULL))", // @"SELECT [e].[Id] FROM [Entities1] AS [e] @@ -1346,19 +1346,19 @@ ELSE CAST(CHARINDEX(N'oo', [e].[NullableStringA]) AS int) - 1 END <> CASE WHEN N'ar' = N'' THEN 0 ELSE CAST(CHARINDEX(N'ar', [e].[NullableStringB]) AS int) - 1 -END) OR (CASE +END) OR ((CASE WHEN N'oo' = N'' THEN 0 ELSE CAST(CHARINDEX(N'oo', [e].[NullableStringA]) AS int) - 1 -END IS NULL OR CASE +END IS NULL) OR (CASE WHEN N'ar' = N'' THEN 0 ELSE CAST(CHARINDEX(N'ar', [e].[NullableStringB]) AS int) - 1 -END IS NULL)) AND (CASE +END IS NULL))) AND ((CASE WHEN N'oo' = N'' THEN 0 ELSE CAST(CHARINDEX(N'oo', [e].[NullableStringA]) AS int) - 1 -END IS NOT NULL OR CASE +END IS NOT NULL) OR (CASE WHEN N'ar' = N'' THEN 0 ELSE CAST(CHARINDEX(N'ar', [e].[NullableStringB]) AS int) - 1 -END IS NOT NULL)", +END IS NOT NULL))", // @"SELECT [e].[Id] FROM [Entities1] AS [e] @@ -1368,19 +1368,19 @@ ELSE CAST(CHARINDEX(N'oo', [e].[NullableStringA]) AS int) - 1 END <> CASE WHEN N'ar' = N'' THEN 0 ELSE CAST(CHARINDEX(N'ar', [e].[NullableStringA]) AS int) - 1 -END) OR (CASE +END) OR ((CASE WHEN N'oo' = N'' THEN 0 ELSE CAST(CHARINDEX(N'oo', [e].[NullableStringA]) AS int) - 1 -END IS NULL OR CASE +END IS NULL) OR (CASE WHEN N'ar' = N'' THEN 0 ELSE CAST(CHARINDEX(N'ar', [e].[NullableStringA]) AS int) - 1 -END IS NULL)) AND (CASE +END IS NULL))) AND ((CASE WHEN N'oo' = N'' THEN 0 ELSE CAST(CHARINDEX(N'oo', [e].[NullableStringA]) AS int) - 1 -END IS NOT NULL OR CASE +END IS NOT NULL) OR (CASE WHEN N'ar' = N'' THEN 0 ELSE CAST(CHARINDEX(N'ar', [e].[NullableStringA]) AS int) - 1 -END IS NOT NULL)"); +END IS NOT NULL))"); // issue #18773 // AssertSql( // @"SELECT [e].[Id] @@ -1403,11 +1403,11 @@ public override async Task Null_semantics_applied_when_comparing_two_functions_w AssertSql( @"SELECT [e].[Id] FROM [Entities1] AS [e] -WHERE (REPLACE([e].[NullableStringA], [e].[NullableStringB], [e].[NullableStringC]) = [e].[NullableStringA]) OR ((([e].[NullableStringA] IS NULL OR [e].[NullableStringB] IS NULL) OR [e].[NullableStringC] IS NULL) AND [e].[NullableStringA] IS NULL)", +WHERE (REPLACE([e].[NullableStringA], [e].[NullableStringB], [e].[NullableStringC]) = [e].[NullableStringA]) OR (((([e].[NullableStringA] IS NULL) OR ([e].[NullableStringB] IS NULL)) OR ([e].[NullableStringC] IS NULL)) AND ([e].[NullableStringA] IS NULL))", // @"SELECT [e].[Id] FROM [Entities1] AS [e] -WHERE ((REPLACE([e].[NullableStringA], [e].[NullableStringB], [e].[NullableStringC]) <> [e].[NullableStringA]) OR ((([e].[NullableStringA] IS NULL OR [e].[NullableStringB] IS NULL) OR [e].[NullableStringC] IS NULL) OR [e].[NullableStringA] IS NULL)) AND ((([e].[NullableStringA] IS NOT NULL AND [e].[NullableStringB] IS NOT NULL) AND [e].[NullableStringC] IS NOT NULL) OR [e].[NullableStringA] IS NOT NULL)"); +WHERE ((REPLACE([e].[NullableStringA], [e].[NullableStringB], [e].[NullableStringC]) <> [e].[NullableStringA]) OR (((([e].[NullableStringA] IS NULL) OR ([e].[NullableStringB] IS NULL)) OR ([e].[NullableStringC] IS NULL)) OR ([e].[NullableStringA] IS NULL))) AND (((([e].[NullableStringA] IS NOT NULL) AND ([e].[NullableStringB] IS NOT NULL)) AND ([e].[NullableStringC] IS NOT NULL)) OR ([e].[NullableStringA] IS NOT NULL))"); } public override async Task Null_semantics_coalesce(bool async) @@ -1475,7 +1475,7 @@ public override async Task Null_semantics_function(bool async) AssertSql( @"SELECT [e].[Id] FROM [Entities1] AS [e] -WHERE ((SUBSTRING([e].[NullableStringA], 0 + 1, [e].[IntA]) <> [e].[NullableStringB]) OR ([e].[NullableStringA] IS NULL OR [e].[NullableStringB] IS NULL)) AND ([e].[NullableStringA] IS NOT NULL OR [e].[NullableStringB] IS NOT NULL)"); +WHERE ((SUBSTRING([e].[NullableStringA], 0 + 1, [e].[IntA]) <> [e].[NullableStringB]) OR (([e].[NullableStringA] IS NULL) OR ([e].[NullableStringB] IS NULL))) AND (([e].[NullableStringA] IS NOT NULL) OR ([e].[NullableStringB] IS NOT NULL))"); } public override async Task Null_semantics_join_with_composite_key(bool async) @@ -1485,8 +1485,8 @@ public override async Task Null_semantics_join_with_composite_key(bool async) AssertSql( @"SELECT [e].[Id], [e].[BoolA], [e].[BoolB], [e].[BoolC], [e].[IntA], [e].[IntB], [e].[IntC], [e].[NullableBoolA], [e].[NullableBoolB], [e].[NullableBoolC], [e].[NullableIntA], [e].[NullableIntB], [e].[NullableIntC], [e].[NullableStringA], [e].[NullableStringB], [e].[NullableStringC], [e].[StringA], [e].[StringB], [e].[StringC], [e0].[Id], [e0].[BoolA], [e0].[BoolB], [e0].[BoolC], [e0].[IntA], [e0].[IntB], [e0].[IntC], [e0].[NullableBoolA], [e0].[NullableBoolB], [e0].[NullableBoolC], [e0].[NullableIntA], [e0].[NullableIntB], [e0].[NullableIntC], [e0].[NullableStringA], [e0].[NullableStringB], [e0].[NullableStringC], [e0].[StringA], [e0].[StringB], [e0].[StringC] FROM [Entities1] AS [e] -INNER JOIN [Entities2] AS [e0] ON (([e].[NullableStringA] = [e0].[NullableStringB]) OR ([e].[NullableStringA] IS NULL AND [e0].[NullableStringB] IS NULL)) AND (CASE - WHEN (([e].[NullableStringB] <> [e].[NullableStringC]) OR ([e].[NullableStringB] IS NULL OR [e].[NullableStringC] IS NULL)) AND ([e].[NullableStringB] IS NOT NULL OR [e].[NullableStringC] IS NOT NULL) THEN CAST(1 AS bit) +INNER JOIN [Entities2] AS [e0] ON (([e].[NullableStringA] = [e0].[NullableStringB]) OR (([e].[NullableStringA] IS NULL) AND ([e0].[NullableStringB] IS NULL))) AND (CASE + WHEN (([e].[NullableStringB] <> [e].[NullableStringC]) OR (([e].[NullableStringB] IS NULL) OR ([e].[NullableStringC] IS NULL))) AND (([e].[NullableStringB] IS NOT NULL) OR ([e].[NullableStringC] IS NOT NULL)) THEN CAST(1 AS bit) ELSE CAST(0 AS bit) END = COALESCE([e0].[NullableBoolA], [e0].[BoolC]))"); } @@ -1502,15 +1502,15 @@ WHERE [e].[NullableIntA] IN (1, 2)", // @"SELECT [e].[Id] FROM [Entities1] AS [e] -WHERE [e].[NullableIntA] NOT IN (1, 2) OR [e].[NullableIntA] IS NULL", +WHERE [e].[NullableIntA] NOT IN (1, 2) OR ([e].[NullableIntA] IS NULL)", // @"SELECT [e].[Id] FROM [Entities1] AS [e] -WHERE [e].[NullableIntA] IN (1, 2) OR [e].[NullableIntA] IS NULL", +WHERE [e].[NullableIntA] IN (1, 2) OR ([e].[NullableIntA] IS NULL)", // @"SELECT [e].[Id] FROM [Entities1] AS [e] -WHERE [e].[NullableIntA] NOT IN (1, 2) AND [e].[NullableIntA] IS NOT NULL", +WHERE [e].[NullableIntA] NOT IN (1, 2) AND ([e].[NullableIntA] IS NOT NULL)", // @"SELECT [e].[Id] FROM [Entities1] AS [e] @@ -1518,15 +1518,15 @@ WHERE [e].[NullableIntA] IN (1, 2)", // @"SELECT [e].[Id] FROM [Entities1] AS [e] -WHERE [e].[NullableIntA] NOT IN (1, 2) OR [e].[NullableIntA] IS NULL", +WHERE [e].[NullableIntA] NOT IN (1, 2) OR ([e].[NullableIntA] IS NULL)", // @"SELECT [e].[Id] FROM [Entities1] AS [e] -WHERE [e].[NullableIntA] IN (1, 2) OR [e].[NullableIntA] IS NULL", +WHERE [e].[NullableIntA] IN (1, 2) OR ([e].[NullableIntA] IS NULL)", // @"SELECT [e].[Id] FROM [Entities1] AS [e] -WHERE [e].[NullableIntA] NOT IN (1, 2) AND [e].[NullableIntA] IS NOT NULL"); +WHERE [e].[NullableIntA] NOT IN (1, 2) AND ([e].[NullableIntA] IS NOT NULL)"); } public override async Task Null_semantics_contains_array_with_no_values(bool async) @@ -1608,23 +1608,23 @@ public override async Task Null_semantics_with_null_check_simple(bool async) AssertSql( @"SELECT [e].[Id] FROM [Entities1] AS [e] -WHERE [e].[NullableIntA] IS NOT NULL AND ([e].[NullableIntA] = [e].[NullableIntB])", +WHERE ([e].[NullableIntA] IS NOT NULL) AND ([e].[NullableIntA] = [e].[NullableIntB])", // @"SELECT [e].[Id] FROM [Entities1] AS [e] -WHERE [e].[NullableIntA] IS NOT NULL AND (([e].[NullableIntA] <> [e].[NullableIntB]) OR [e].[NullableIntB] IS NULL)", +WHERE ([e].[NullableIntA] IS NOT NULL) AND (([e].[NullableIntA] <> [e].[NullableIntB]) OR ([e].[NullableIntB] IS NULL))", // @"SELECT [e].[Id] FROM [Entities1] AS [e] -WHERE [e].[NullableIntA] IS NOT NULL AND ([e].[NullableIntA] = [e].[IntC])", +WHERE ([e].[NullableIntA] IS NOT NULL) AND ([e].[NullableIntA] = [e].[IntC])", // @"SELECT [e].[Id] FROM [Entities1] AS [e] -WHERE ([e].[NullableIntA] IS NOT NULL AND [e].[NullableIntB] IS NOT NULL) AND ([e].[NullableIntA] = [e].[NullableIntB])", +WHERE (([e].[NullableIntA] IS NOT NULL) AND ([e].[NullableIntB] IS NOT NULL)) AND ([e].[NullableIntA] = [e].[NullableIntB])", // @"SELECT [e].[Id] FROM [Entities1] AS [e] -WHERE ([e].[NullableIntA] IS NOT NULL AND [e].[NullableIntB] IS NOT NULL) AND ([e].[NullableIntA] <> [e].[NullableIntB])"); +WHERE (([e].[NullableIntA] IS NOT NULL) AND ([e].[NullableIntB] IS NOT NULL)) AND ([e].[NullableIntA] <> [e].[NullableIntB])"); } public override async Task Null_semantics_with_null_check_complex(bool async) @@ -1634,15 +1634,15 @@ public override async Task Null_semantics_with_null_check_complex(bool async) AssertSql( @"SELECT [e].[Id] FROM [Entities1] AS [e] -WHERE [e].[NullableIntA] IS NOT NULL AND ((([e].[NullableIntC] <> [e].[NullableIntA]) OR [e].[NullableIntC] IS NULL) OR ([e].[NullableIntB] IS NOT NULL AND ([e].[NullableIntA] <> [e].[NullableIntB])))", +WHERE ([e].[NullableIntA] IS NOT NULL) AND ((([e].[NullableIntC] <> [e].[NullableIntA]) OR ([e].[NullableIntC] IS NULL)) OR (([e].[NullableIntB] IS NOT NULL) AND ([e].[NullableIntA] <> [e].[NullableIntB])))", // @"SELECT [e].[Id] FROM [Entities1] AS [e] -WHERE [e].[NullableIntA] IS NOT NULL AND ((([e].[NullableIntC] <> [e].[NullableIntA]) OR [e].[NullableIntC] IS NULL) OR (([e].[NullableIntA] <> [e].[NullableIntB]) OR [e].[NullableIntB] IS NULL))", +WHERE ([e].[NullableIntA] IS NOT NULL) AND ((([e].[NullableIntC] <> [e].[NullableIntA]) OR ([e].[NullableIntC] IS NULL)) OR (([e].[NullableIntA] <> [e].[NullableIntB]) OR ([e].[NullableIntB] IS NULL)))", // @"SELECT [e].[Id] FROM [Entities1] AS [e] -WHERE ([e].[NullableIntA] IS NOT NULL OR [e].[NullableIntB] IS NOT NULL) AND (([e].[NullableIntA] = [e].[NullableIntC]) OR ([e].[NullableIntA] IS NULL AND [e].[NullableIntC] IS NULL))"); +WHERE (([e].[NullableIntA] IS NOT NULL) OR ([e].[NullableIntB] IS NOT NULL)) AND (([e].[NullableIntA] = [e].[NullableIntC]) OR (([e].[NullableIntA] IS NULL) AND ([e].[NullableIntC] IS NULL)))"); } public override async Task Null_semantics_with_null_check_complex2(bool async) @@ -1670,15 +1670,15 @@ FROM [Entities1] AS [e] // @"SELECT [e].[Id] FROM [Entities1] AS [e] -WHERE [e].[NullableIntA] IS NULL OR [e].[NullableIntB] IS NULL", +WHERE ([e].[NullableIntA] IS NULL) OR ([e].[NullableIntB] IS NULL)", // @"SELECT [e].[Id] FROM [Entities1] AS [e] -WHERE [e].[NullableIntA] IS NULL AND [e].[NullableIntB] IS NULL", +WHERE ([e].[NullableIntA] IS NULL) AND ([e].[NullableIntB] IS NULL)", // @"SELECT [e].[Id] FROM [Entities1] AS [e] -WHERE [e].[NullableIntA] IS NOT NULL OR [e].[NullableIntB] IS NOT NULL"); +WHERE ([e].[NullableIntA] IS NOT NULL) OR ([e].[NullableIntB] IS NOT NULL)"); } public override async Task Coalesce_not_equal(bool async) @@ -1736,7 +1736,7 @@ public override async Task Nullable_column_info_propagates_inside_binary_AndAlso AssertSql( @"SELECT [e].[Id] FROM [Entities1] AS [e] -WHERE ([e].[NullableStringA] IS NOT NULL AND [e].[NullableStringB] IS NOT NULL) AND ([e].[NullableStringA] <> [e].[NullableStringB])"); +WHERE (([e].[NullableStringA] IS NOT NULL) AND ([e].[NullableStringB] IS NOT NULL)) AND ([e].[NullableStringA] <> [e].[NullableStringB])"); } public override async Task Nullable_column_info_doesnt_propagate_inside_binary_OrElse(bool async) @@ -1746,7 +1746,7 @@ public override async Task Nullable_column_info_doesnt_propagate_inside_binary_O AssertSql( @"SELECT [e].[Id] FROM [Entities1] AS [e] -WHERE ([e].[NullableStringA] IS NOT NULL OR [e].[NullableStringB] IS NOT NULL) AND ((([e].[NullableStringA] <> [e].[NullableStringB]) OR ([e].[NullableStringA] IS NULL OR [e].[NullableStringB] IS NULL)) AND ([e].[NullableStringA] IS NOT NULL OR [e].[NullableStringB] IS NOT NULL))"); +WHERE (([e].[NullableStringA] IS NOT NULL) OR ([e].[NullableStringB] IS NOT NULL)) AND ((([e].[NullableStringA] <> [e].[NullableStringB]) OR (([e].[NullableStringA] IS NULL) OR ([e].[NullableStringB] IS NULL))) AND (([e].[NullableStringA] IS NOT NULL) OR ([e].[NullableStringB] IS NOT NULL)))"); } public override async Task Nullable_column_info_propagates_inside_binary_OrElse_when_info_is_duplicated(bool async) @@ -1756,11 +1756,11 @@ public override async Task Nullable_column_info_propagates_inside_binary_OrElse_ AssertSql( @"SELECT [e].[Id] FROM [Entities1] AS [e] -WHERE (([e].[NullableStringA] IS NOT NULL AND [e].[NullableStringB] IS NOT NULL) OR [e].[NullableStringA] IS NOT NULL) AND (([e].[NullableStringA] <> [e].[NullableStringB]) OR [e].[NullableStringB] IS NULL)", +WHERE ((([e].[NullableStringA] IS NOT NULL) AND ([e].[NullableStringB] IS NOT NULL)) OR ([e].[NullableStringA] IS NOT NULL)) AND (([e].[NullableStringA] <> [e].[NullableStringB]) OR ([e].[NullableStringB] IS NULL))", // @"SELECT [e].[Id] FROM [Entities1] AS [e] -WHERE (([e].[NullableStringA] IS NOT NULL AND [e].[NullableStringB] IS NOT NULL) OR ([e].[NullableStringB] IS NOT NULL AND [e].[NullableStringA] IS NOT NULL)) AND ([e].[NullableStringA] <> [e].[NullableStringB])"); +WHERE ((([e].[NullableStringA] IS NOT NULL) AND ([e].[NullableStringB] IS NOT NULL)) OR (([e].[NullableStringB] IS NOT NULL) AND ([e].[NullableStringA] IS NOT NULL))) AND ([e].[NullableStringA] <> [e].[NullableStringB])"); } public override async Task Nullable_column_info_propagates_inside_conditional(bool async) @@ -1787,7 +1787,7 @@ public override async Task Nullable_column_info_doesnt_propagate_between_project WHEN [e].[NullableStringA] IS NOT NULL THEN CAST(1 AS bit) ELSE CAST(0 AS bit) END AS [Foo], CASE - WHEN ([e].[NullableStringA] <> [e].[StringA]) OR [e].[NullableStringA] IS NULL THEN CAST(1 AS bit) + WHEN ([e].[NullableStringA] <> [e].[StringA]) OR ([e].[NullableStringA] IS NULL) THEN CAST(1 AS bit) ELSE CAST(0 AS bit) END AS [Bar] FROM [Entities1] AS [e]"); @@ -1811,7 +1811,7 @@ public override async Task Nullable_column_info_propagation_complex(bool async) AssertSql( @"SELECT [e].[Id] FROM [Entities1] AS [e] -WHERE (([e].[NullableStringA] IS NOT NULL AND ([e].[NullableBoolB] IS NOT NULL)) AND [e].[NullableStringC] IS NOT NULL) AND (([e].[NullableBoolB] <> [e].[NullableBoolC]) OR ([e].[NullableBoolC] IS NULL))"); +WHERE ((([e].[NullableStringA] IS NOT NULL) AND ([e].[NullableBoolB] IS NOT NULL)) AND ([e].[NullableStringC] IS NOT NULL)) AND (([e].[NullableBoolB] <> [e].[NullableBoolC]) OR ([e].[NullableBoolC] IS NULL))"); } public override async Task Empty_subquery_with_contains_returns_false(bool async) @@ -1840,7 +1840,7 @@ public override async Task Nullable_string_FirstOrDefault_compared_to_nullable_s AssertSql( @"SELECT [e].[Id], [e].[BoolA], [e].[BoolB], [e].[BoolC], [e].[IntA], [e].[IntB], [e].[IntC], [e].[NullableBoolA], [e].[NullableBoolB], [e].[NullableBoolC], [e].[NullableIntA], [e].[NullableIntB], [e].[NullableIntC], [e].[NullableStringA], [e].[NullableStringB], [e].[NullableStringC], [e].[StringA], [e].[StringB], [e].[StringC] FROM [Entities1] AS [e] -WHERE (SUBSTRING([e].[NullableStringA], 1, 1) = SUBSTRING([e].[NullableStringB], LEN([e].[NullableStringB]), 1)) OR ([e].[NullableStringA] IS NULL AND [e].[NullableStringB] IS NULL)"); +WHERE (SUBSTRING([e].[NullableStringA], 1, 1) = SUBSTRING([e].[NullableStringB], LEN([e].[NullableStringB]), 1)) OR (([e].[NullableStringA] IS NULL) AND ([e].[NullableStringB] IS NULL))"); } public override async Task Null_semantics_applied_to_CompareTo_equality(bool async) @@ -1850,19 +1850,19 @@ public override async Task Null_semantics_applied_to_CompareTo_equality(bool asy AssertSql( @"SELECT [e].[Id], [e].[BoolA], [e].[BoolB], [e].[BoolC], [e].[IntA], [e].[IntB], [e].[IntC], [e].[NullableBoolA], [e].[NullableBoolB], [e].[NullableBoolC], [e].[NullableIntA], [e].[NullableIntB], [e].[NullableIntC], [e].[NullableStringA], [e].[NullableStringB], [e].[NullableStringC], [e].[StringA], [e].[StringB], [e].[StringC] FROM [Entities1] AS [e] -WHERE ([e].[NullableStringA] = [e].[NullableStringB]) OR ([e].[NullableStringA] IS NULL AND [e].[NullableStringB] IS NULL)", +WHERE ([e].[NullableStringA] = [e].[NullableStringB]) OR (([e].[NullableStringA] IS NULL) AND ([e].[NullableStringB] IS NULL))", // @"SELECT [e].[Id], [e].[BoolA], [e].[BoolB], [e].[BoolC], [e].[IntA], [e].[IntB], [e].[IntC], [e].[NullableBoolA], [e].[NullableBoolB], [e].[NullableBoolC], [e].[NullableIntA], [e].[NullableIntB], [e].[NullableIntC], [e].[NullableStringA], [e].[NullableStringB], [e].[NullableStringC], [e].[StringA], [e].[StringB], [e].[StringC] FROM [Entities1] AS [e] -WHERE ([e].[NullableStringA] = [e].[NullableStringB]) OR ([e].[NullableStringA] IS NULL AND [e].[NullableStringB] IS NULL)", +WHERE ([e].[NullableStringA] = [e].[NullableStringB]) OR (([e].[NullableStringA] IS NULL) AND ([e].[NullableStringB] IS NULL))", // @"SELECT [e].[Id], [e].[BoolA], [e].[BoolB], [e].[BoolC], [e].[IntA], [e].[IntB], [e].[IntC], [e].[NullableBoolA], [e].[NullableBoolB], [e].[NullableBoolC], [e].[NullableIntA], [e].[NullableIntB], [e].[NullableIntC], [e].[NullableStringA], [e].[NullableStringB], [e].[NullableStringC], [e].[StringA], [e].[StringB], [e].[StringC] FROM [Entities1] AS [e] -WHERE (([e].[NullableStringA] <> [e].[NullableStringB]) OR ([e].[NullableStringA] IS NULL OR [e].[NullableStringB] IS NULL)) AND ([e].[NullableStringA] IS NOT NULL OR [e].[NullableStringB] IS NOT NULL)", +WHERE (([e].[NullableStringA] <> [e].[NullableStringB]) OR (([e].[NullableStringA] IS NULL) OR ([e].[NullableStringB] IS NULL))) AND (([e].[NullableStringA] IS NOT NULL) OR ([e].[NullableStringB] IS NOT NULL))", // @"SELECT [e].[Id], [e].[BoolA], [e].[BoolB], [e].[BoolC], [e].[IntA], [e].[IntB], [e].[IntC], [e].[NullableBoolA], [e].[NullableBoolB], [e].[NullableBoolC], [e].[NullableIntA], [e].[NullableIntB], [e].[NullableIntC], [e].[NullableStringA], [e].[NullableStringB], [e].[NullableStringC], [e].[StringA], [e].[StringB], [e].[StringC] FROM [Entities1] AS [e] -WHERE (([e].[NullableStringA] <> [e].[NullableStringB]) OR ([e].[NullableStringA] IS NULL OR [e].[NullableStringB] IS NULL)) AND ([e].[NullableStringA] IS NOT NULL OR [e].[NullableStringB] IS NOT NULL)"); +WHERE (([e].[NullableStringA] <> [e].[NullableStringB]) OR (([e].[NullableStringA] IS NULL) OR ([e].[NullableStringB] IS NULL))) AND (([e].[NullableStringA] IS NOT NULL) OR ([e].[NullableStringB] IS NOT NULL))"); } public override async Task Nested_CompareTo_optimized(bool async) @@ -1872,19 +1872,19 @@ public override async Task Nested_CompareTo_optimized(bool async) AssertSql( @"SELECT [e].[Id], [e].[BoolA], [e].[BoolB], [e].[BoolC], [e].[IntA], [e].[IntB], [e].[IntC], [e].[NullableBoolA], [e].[NullableBoolB], [e].[NullableBoolC], [e].[NullableIntA], [e].[NullableIntB], [e].[NullableIntC], [e].[NullableStringA], [e].[NullableStringB], [e].[NullableStringC], [e].[StringA], [e].[StringB], [e].[StringC] FROM [Entities1] AS [e] -WHERE ([e].[NullableStringA] = [e].[NullableStringB]) OR ([e].[NullableStringA] IS NULL AND [e].[NullableStringB] IS NULL)", +WHERE ([e].[NullableStringA] = [e].[NullableStringB]) OR (([e].[NullableStringA] IS NULL) AND ([e].[NullableStringB] IS NULL))", // @"SELECT [e].[Id], [e].[BoolA], [e].[BoolB], [e].[BoolC], [e].[IntA], [e].[IntB], [e].[IntC], [e].[NullableBoolA], [e].[NullableBoolB], [e].[NullableBoolC], [e].[NullableIntA], [e].[NullableIntB], [e].[NullableIntC], [e].[NullableStringA], [e].[NullableStringB], [e].[NullableStringC], [e].[StringA], [e].[StringB], [e].[StringC] FROM [Entities1] AS [e] -WHERE ([e].[NullableStringA] = [e].[NullableStringB]) OR ([e].[NullableStringA] IS NULL AND [e].[NullableStringB] IS NULL)", +WHERE ([e].[NullableStringA] = [e].[NullableStringB]) OR (([e].[NullableStringA] IS NULL) AND ([e].[NullableStringB] IS NULL))", // @"SELECT [e].[Id], [e].[BoolA], [e].[BoolB], [e].[BoolC], [e].[IntA], [e].[IntB], [e].[IntC], [e].[NullableBoolA], [e].[NullableBoolB], [e].[NullableBoolC], [e].[NullableIntA], [e].[NullableIntB], [e].[NullableIntC], [e].[NullableStringA], [e].[NullableStringB], [e].[NullableStringC], [e].[StringA], [e].[StringB], [e].[StringC] FROM [Entities1] AS [e] -WHERE (([e].[NullableStringA] <> [e].[NullableStringB]) OR ([e].[NullableStringA] IS NULL OR [e].[NullableStringB] IS NULL)) AND ([e].[NullableStringA] IS NOT NULL OR [e].[NullableStringB] IS NOT NULL)", +WHERE (([e].[NullableStringA] <> [e].[NullableStringB]) OR (([e].[NullableStringA] IS NULL) OR ([e].[NullableStringB] IS NULL))) AND (([e].[NullableStringA] IS NOT NULL) OR ([e].[NullableStringB] IS NOT NULL))", // @"SELECT [e].[Id], [e].[BoolA], [e].[BoolB], [e].[BoolC], [e].[IntA], [e].[IntB], [e].[IntC], [e].[NullableBoolA], [e].[NullableBoolB], [e].[NullableBoolC], [e].[NullableIntA], [e].[NullableIntB], [e].[NullableIntC], [e].[NullableStringA], [e].[NullableStringB], [e].[NullableStringC], [e].[StringA], [e].[StringB], [e].[StringC] FROM [Entities1] AS [e] -WHERE (([e].[NullableStringA] <> [e].[NullableStringB]) OR ([e].[NullableStringA] IS NULL OR [e].[NullableStringB] IS NULL)) AND ([e].[NullableStringA] IS NOT NULL OR [e].[NullableStringB] IS NOT NULL)"); +WHERE (([e].[NullableStringA] <> [e].[NullableStringB]) OR (([e].[NullableStringA] IS NULL) OR ([e].[NullableStringB] IS NULL))) AND (([e].[NullableStringA] IS NOT NULL) OR ([e].[NullableStringB] IS NOT NULL))"); } public override async Task False_compared_to_negated_is_null(bool async) @@ -1904,7 +1904,7 @@ public override async Task Multiple_non_equality_comparisons_with_null_in_the_mi AssertSql( @"SELECT [e].[Id], [e].[BoolA], [e].[BoolB], [e].[BoolC], [e].[IntA], [e].[IntB], [e].[IntC], [e].[NullableBoolA], [e].[NullableBoolB], [e].[NullableBoolC], [e].[NullableIntA], [e].[NullableIntB], [e].[NullableIntC], [e].[NullableStringA], [e].[NullableStringB], [e].[NullableStringC], [e].[StringA], [e].[StringB], [e].[StringC] FROM [Entities1] AS [e] -WHERE [e].[NullableIntA] NOT IN (1, 2) AND [e].[NullableIntA] IS NOT NULL"); +WHERE [e].[NullableIntA] NOT IN (1, 2) AND ([e].[NullableIntA] IS NOT NULL)"); } public override async Task Multiple_non_equality_comparisons_including_null_comparison_work_for_relational_null_semantics(bool async) @@ -1914,7 +1914,7 @@ public override async Task Multiple_non_equality_comparisons_including_null_comp AssertSql( @"SELECT [e].[Id], [e].[BoolA], [e].[BoolB], [e].[BoolC], [e].[IntA], [e].[IntB], [e].[IntC], [e].[NullableBoolA], [e].[NullableBoolB], [e].[NullableBoolC], [e].[NullableIntA], [e].[NullableIntB], [e].[NullableIntC], [e].[NullableStringA], [e].[NullableStringB], [e].[NullableStringC], [e].[StringA], [e].[StringB], [e].[StringC] FROM [Entities1] AS [e] -WHERE ([e].[NullableIntA] <> 1) AND [e].[NullableIntA] IS NOT NULL"); +WHERE ([e].[NullableIntA] <> 1) AND ([e].[NullableIntA] IS NOT NULL)"); } public override async Task Multiple_non_equality_comparisons_without_null_comparison_work_for_relational_null_semantics(bool async) @@ -1934,7 +1934,7 @@ public override async Task Multiple_equality_comparisons_including_null_comparis AssertSql( @"SELECT [e].[Id], [e].[BoolA], [e].[BoolB], [e].[BoolC], [e].[IntA], [e].[IntB], [e].[IntC], [e].[NullableBoolA], [e].[NullableBoolB], [e].[NullableBoolC], [e].[NullableIntA], [e].[NullableIntB], [e].[NullableIntC], [e].[NullableStringA], [e].[NullableStringB], [e].[NullableStringC], [e].[StringA], [e].[StringB], [e].[StringC] FROM [Entities1] AS [e] -WHERE ([e].[NullableIntA] = 1) OR [e].[NullableIntA] IS NULL"); +WHERE ([e].[NullableIntA] = 1) OR ([e].[NullableIntA] IS NULL)"); } public override async Task Multiple_contains_calls_get_combined_into_one_for_relational_null_semantics(bool async) @@ -1964,7 +1964,7 @@ public override async Task Contains_with_comparison_dont_get_combined_for_relati AssertSql( @"SELECT [e].[Id], [e].[BoolA], [e].[BoolB], [e].[BoolC], [e].[IntA], [e].[IntB], [e].[IntC], [e].[NullableBoolA], [e].[NullableBoolB], [e].[NullableBoolC], [e].[NullableIntA], [e].[NullableIntB], [e].[NullableIntC], [e].[NullableStringA], [e].[NullableStringB], [e].[NullableStringC], [e].[StringA], [e].[StringB], [e].[StringC] FROM [Entities1] AS [e] -WHERE [e].[NullableIntA] IN (1, 2) OR [e].[NullableIntA] IS NULL"); +WHERE [e].[NullableIntA] IN (1, 2) OR ([e].[NullableIntA] IS NULL)"); } public override async Task Negated_contains_with_comparison_dont_get_combined_for_relational_null_semantics(bool async) @@ -1974,7 +1974,7 @@ public override async Task Negated_contains_with_comparison_dont_get_combined_fo AssertSql( @"SELECT [e].[Id], [e].[BoolA], [e].[BoolB], [e].[BoolC], [e].[IntA], [e].[IntB], [e].[IntC], [e].[NullableBoolA], [e].[NullableBoolB], [e].[NullableBoolC], [e].[NullableIntA], [e].[NullableIntB], [e].[NullableIntC], [e].[NullableStringA], [e].[NullableStringB], [e].[NullableStringC], [e].[StringA], [e].[StringB], [e].[StringC] FROM [Entities1] AS [e] -WHERE [e].[NullableIntA] IS NOT NULL AND [e].[NullableIntA] NOT IN (1, 2)"); +WHERE ([e].[NullableIntA] IS NOT NULL) AND [e].[NullableIntA] NOT IN (1, 2)"); } public override async Task Negated_contains_with_comparison_without_null_get_combined_for_relational_null_semantics(bool async) @@ -2058,6 +2058,32 @@ ELSE CAST(0 AS bit) END"); } + public override async Task Bool_not_equal_nullable_int_HasValue(bool async) + { + await base.Bool_not_equal_nullable_int_HasValue(async); + + AssertSql( + @"SELECT [e].[Id], [e].[BoolA], [e].[BoolB], [e].[BoolC], [e].[IntA], [e].[IntB], [e].[IntC], [e].[NullableBoolA], [e].[NullableBoolB], [e].[NullableBoolC], [e].[NullableIntA], [e].[NullableIntB], [e].[NullableIntC], [e].[NullableStringA], [e].[NullableStringB], [e].[NullableStringC], [e].[StringA], [e].[StringB], [e].[StringC] +FROM [Entities1] AS [e] +WHERE [e].[NullableIntA] IS NULL", + // + @"@__prm_0='False' + +SELECT [e].[Id], [e].[BoolA], [e].[BoolB], [e].[BoolC], [e].[IntA], [e].[IntB], [e].[IntC], [e].[NullableBoolA], [e].[NullableBoolB], [e].[NullableBoolC], [e].[NullableIntA], [e].[NullableIntB], [e].[NullableIntC], [e].[NullableStringA], [e].[NullableStringB], [e].[NullableStringC], [e].[StringA], [e].[StringB], [e].[StringC] +FROM [Entities1] AS [e] +WHERE @__prm_0 <> CASE + WHEN [e].[NullableIntA] IS NOT NULL THEN CAST(1 AS bit) + ELSE CAST(0 AS bit) +END", + // + @"SELECT [e].[Id], [e].[BoolA], [e].[BoolB], [e].[BoolC], [e].[IntA], [e].[IntB], [e].[IntC], [e].[NullableBoolA], [e].[NullableBoolB], [e].[NullableBoolC], [e].[NullableIntA], [e].[NullableIntB], [e].[NullableIntC], [e].[NullableStringA], [e].[NullableStringB], [e].[NullableStringC], [e].[StringA], [e].[StringB], [e].[StringC] +FROM [Entities1] AS [e] +WHERE [e].[BoolB] <> CASE + WHEN [e].[NullableIntA] IS NOT NULL THEN CAST(1 AS bit) + ELSE CAST(0 AS bit) +END"); + } + public override async Task Bool_not_equal_nullable_bool_compared_to_null(bool async) { await base.Bool_not_equal_nullable_bool_compared_to_null(async); @@ -2130,7 +2156,7 @@ public override async Task Is_null_on_column_followed_by_OrElse_optimizes_nullab AssertSql( @"SELECT [e].[Id], [e].[BoolA], [e].[BoolB], [e].[BoolC], [e].[IntA], [e].[IntB], [e].[IntC], [e].[NullableBoolA], [e].[NullableBoolB], [e].[NullableBoolC], [e].[NullableIntA], [e].[NullableIntB], [e].[NullableIntC], [e].[NullableStringA], [e].[NullableStringB], [e].[NullableStringC], [e].[StringA], [e].[StringB], [e].[StringC] FROM [Entities1] AS [e] -WHERE [e].[NullableStringA] IS NOT NULL AND ([e].[NullableStringA] = N'Foo')"); +WHERE ([e].[NullableStringA] IS NOT NULL) AND ([e].[NullableStringA] = N'Foo')"); } public override async Task Is_null_on_column_followed_by_OrElse_optimizes_nullability_negative(bool async) @@ -2140,7 +2166,7 @@ public override async Task Is_null_on_column_followed_by_OrElse_optimizes_nullab AssertSql( @"SELECT [e].[Id], [e].[BoolA], [e].[BoolB], [e].[BoolC], [e].[IntA], [e].[IntB], [e].[IntC], [e].[NullableBoolA], [e].[NullableBoolB], [e].[NullableBoolC], [e].[NullableIntA], [e].[NullableIntB], [e].[NullableIntC], [e].[NullableStringA], [e].[NullableStringB], [e].[NullableStringC], [e].[StringA], [e].[StringB], [e].[StringC] FROM [Entities1] AS [e] -WHERE [e].[NullableStringA] IS NOT NULL OR (([e].[NullableStringA] = N'Foo') AND [e].[NullableStringA] IS NOT NULL)"); +WHERE ([e].[NullableStringA] IS NOT NULL) OR (([e].[NullableStringA] = N'Foo') AND ([e].[NullableStringA] IS NOT NULL))"); } public override async Task Is_null_on_column_followed_by_OrElse_optimizes_nullability_nested(bool async) @@ -2150,7 +2176,7 @@ public override async Task Is_null_on_column_followed_by_OrElse_optimizes_nullab AssertSql( @"SELECT [e].[Id], [e].[BoolA], [e].[BoolB], [e].[BoolC], [e].[IntA], [e].[IntB], [e].[IntC], [e].[NullableBoolA], [e].[NullableBoolB], [e].[NullableBoolC], [e].[NullableIntA], [e].[NullableIntB], [e].[NullableIntC], [e].[NullableStringA], [e].[NullableStringB], [e].[NullableStringC], [e].[StringA], [e].[StringB], [e].[StringC] FROM [Entities1] AS [e] -WHERE ([e].[NullableStringA] IS NULL OR [e].[NullableStringB] IS NULL) OR ([e].[NullableStringA] <> [e].[NullableStringB])"); +WHERE (([e].[NullableStringA] IS NULL) OR ([e].[NullableStringB] IS NULL)) OR ([e].[NullableStringA] <> [e].[NullableStringB])"); } public override async Task Is_null_on_column_followed_by_OrElse_optimizes_nullability_intersection(bool async) @@ -2160,7 +2186,7 @@ public override async Task Is_null_on_column_followed_by_OrElse_optimizes_nullab AssertSql( @"SELECT [e].[Id], [e].[BoolA], [e].[BoolB], [e].[BoolC], [e].[IntA], [e].[IntB], [e].[IntC], [e].[NullableBoolA], [e].[NullableBoolB], [e].[NullableBoolC], [e].[NullableIntA], [e].[NullableIntB], [e].[NullableIntC], [e].[NullableStringA], [e].[NullableStringB], [e].[NullableStringC], [e].[StringA], [e].[StringB], [e].[StringC] FROM [Entities1] AS [e] -WHERE ([e].[NullableStringA] IS NULL AND ((([e].[StringA] = N'Foo') OR [e].[NullableStringA] IS NULL) OR [e].[NullableStringB] IS NULL)) OR (([e].[NullableStringA] <> [e].[NullableStringB]) OR [e].[NullableStringB] IS NULL)"); +WHERE (([e].[NullableStringA] IS NULL) AND ((([e].[StringA] = N'Foo') OR ([e].[NullableStringA] IS NULL)) OR ([e].[NullableStringB] IS NULL))) OR (([e].[NullableStringA] <> [e].[NullableStringB]) OR ([e].[NullableStringB] IS NULL))"); } public override async Task Is_null_on_column_followed_by_OrElse_optimizes_nullability_conditional(bool async) @@ -2173,11 +2199,11 @@ public override async Task Is_null_on_column_followed_by_OrElse_optimizes_nullab FROM [Entities1] AS [e] WHERE CASE WHEN [e].[NullableStringA] IS NULL THEN CASE - WHEN (([e].[NullableStringA] <> [e].[NullableStringB]) OR ([e].[NullableStringA] IS NULL OR [e].[NullableStringB] IS NULL)) AND ([e].[NullableStringA] IS NOT NULL OR [e].[NullableStringB] IS NOT NULL) THEN CAST(1 AS bit) + WHEN (([e].[NullableStringA] <> [e].[NullableStringB]) OR (([e].[NullableStringA] IS NULL) OR ([e].[NullableStringB] IS NULL))) AND (([e].[NullableStringA] IS NOT NULL) OR ([e].[NullableStringB] IS NOT NULL)) THEN CAST(1 AS bit) ELSE CAST(0 AS bit) END ELSE CASE - WHEN (([e].[NullableStringA] <> [e].[NullableStringC]) OR ([e].[NullableStringA] IS NULL OR [e].[NullableStringC] IS NULL)) AND ([e].[NullableStringA] IS NOT NULL OR [e].[NullableStringC] IS NOT NULL) THEN CAST(1 AS bit) + WHEN (([e].[NullableStringA] <> [e].[NullableStringC]) OR (([e].[NullableStringA] IS NULL) OR ([e].[NullableStringC] IS NULL))) AND (([e].[NullableStringA] IS NOT NULL) OR ([e].[NullableStringC] IS NOT NULL)) THEN CAST(1 AS bit) ELSE CAST(0 AS bit) END END = CAST(1 AS bit)"); @@ -2192,12 +2218,12 @@ public override async Task Is_null_on_column_followed_by_OrElse_optimizes_nullab @"SELECT [e].[Id], [e].[BoolA], [e].[BoolB], [e].[BoolC], [e].[IntA], [e].[IntB], [e].[IntC], [e].[NullableBoolA], [e].[NullableBoolB], [e].[NullableBoolC], [e].[NullableIntA], [e].[NullableIntB], [e].[NullableIntC], [e].[NullableStringA], [e].[NullableStringB], [e].[NullableStringC], [e].[StringA], [e].[StringB], [e].[StringC] FROM [Entities1] AS [e] WHERE CASE - WHEN [e].[NullableStringA] IS NULL OR [e].[NullableStringB] IS NULL THEN CASE - WHEN (([e].[NullableStringA] = [e].[NullableStringB]) AND ([e].[NullableStringA] IS NOT NULL AND [e].[NullableStringB] IS NOT NULL)) OR ([e].[NullableStringA] IS NULL AND [e].[NullableStringB] IS NULL) THEN CAST(1 AS bit) + WHEN ([e].[NullableStringA] IS NULL) OR ([e].[NullableStringB] IS NULL) THEN CASE + WHEN (([e].[NullableStringA] = [e].[NullableStringB]) AND (([e].[NullableStringA] IS NOT NULL) AND ([e].[NullableStringB] IS NOT NULL))) OR (([e].[NullableStringA] IS NULL) AND ([e].[NullableStringB] IS NULL)) THEN CAST(1 AS bit) ELSE CAST(0 AS bit) END ELSE CASE - WHEN (([e].[NullableStringA] <> [e].[NullableStringB]) OR ([e].[NullableStringA] IS NULL OR [e].[NullableStringB] IS NULL)) AND ([e].[NullableStringA] IS NOT NULL OR [e].[NullableStringB] IS NOT NULL) THEN CAST(1 AS bit) + WHEN (([e].[NullableStringA] <> [e].[NullableStringB]) OR (([e].[NullableStringA] IS NULL) OR ([e].[NullableStringB] IS NULL))) AND (([e].[NullableStringA] IS NOT NULL) OR ([e].[NullableStringB] IS NOT NULL)) THEN CAST(1 AS bit) ELSE CAST(0 AS bit) END END = CAST(1 AS bit)"); @@ -2211,12 +2237,12 @@ public override async Task Is_null_on_column_followed_by_OrElse_optimizes_nullab @"SELECT [e].[Id], [e].[BoolA], [e].[BoolB], [e].[BoolC], [e].[IntA], [e].[IntB], [e].[IntC], [e].[NullableBoolA], [e].[NullableBoolB], [e].[NullableBoolC], [e].[NullableIntA], [e].[NullableIntB], [e].[NullableIntC], [e].[NullableStringA], [e].[NullableStringB], [e].[NullableStringC], [e].[StringA], [e].[StringB], [e].[StringC] FROM [Entities1] AS [e] WHERE CASE - WHEN ([e].[NullableStringA] IS NULL OR [e].[NullableStringB] IS NULL) AND ([e].[NullableBoolC] IS NULL) THEN CASE - WHEN (([e].[NullableStringA] = [e].[NullableStringB]) AND ([e].[NullableStringA] IS NOT NULL AND [e].[NullableStringB] IS NOT NULL)) OR ([e].[NullableStringA] IS NULL AND [e].[NullableStringB] IS NULL) THEN CAST(1 AS bit) + WHEN (([e].[NullableStringA] IS NULL) OR ([e].[NullableStringB] IS NULL)) AND ([e].[NullableBoolC] IS NULL) THEN CASE + WHEN (([e].[NullableStringA] = [e].[NullableStringB]) AND (([e].[NullableStringA] IS NOT NULL) AND ([e].[NullableStringB] IS NOT NULL))) OR (([e].[NullableStringA] IS NULL) AND ([e].[NullableStringB] IS NULL)) THEN CAST(1 AS bit) ELSE CAST(0 AS bit) END ELSE CASE - WHEN (([e].[NullableStringA] <> [e].[NullableStringB]) OR ([e].[NullableStringA] IS NULL OR [e].[NullableStringB] IS NULL)) AND ([e].[NullableStringA] IS NOT NULL OR [e].[NullableStringB] IS NOT NULL) THEN CAST(1 AS bit) + WHEN (([e].[NullableStringA] <> [e].[NullableStringB]) OR (([e].[NullableStringA] IS NULL) OR ([e].[NullableStringB] IS NULL))) AND (([e].[NullableStringA] IS NOT NULL) OR ([e].[NullableStringB] IS NOT NULL)) THEN CAST(1 AS bit) ELSE CAST(0 AS bit) END END = CAST(1 AS bit)"); @@ -2272,7 +2298,7 @@ public override async Task Sum_function_is_always_considered_non_nullable(bool a AssertSql( @"SELECT [e].[NullableIntA] AS [Key], CASE - WHEN (COALESCE(SUM([e].[IntA]), 0) <> [e].[NullableIntA]) OR [e].[NullableIntA] IS NULL THEN CAST(1 AS bit) + WHEN (COALESCE(SUM([e].[IntA]), 0) <> [e].[NullableIntA]) OR ([e].[NullableIntA] IS NULL) THEN CAST(1 AS bit) ELSE CAST(0 AS bit) END AS [Sum] FROM [Entities1] AS [e] @@ -2286,7 +2312,7 @@ public override async Task Nullability_is_computed_correctly_for_chained_coalesc AssertSql( @"SELECT [e].[Id], [e].[BoolA], [e].[BoolB], [e].[BoolC], [e].[IntA], [e].[IntB], [e].[IntC], [e].[NullableBoolA], [e].[NullableBoolB], [e].[NullableBoolC], [e].[NullableIntA], [e].[NullableIntB], [e].[NullableIntC], [e].[NullableStringA], [e].[NullableStringB], [e].[NullableStringC], [e].[StringA], [e].[StringB], [e].[StringC] FROM [Entities1] AS [e] -WHERE (COALESCE([e].[NullableIntA], [e].[NullableIntB], [e].[IntC]) <> [e].[NullableIntC]) OR [e].[NullableIntC] IS NULL"); +WHERE (COALESCE([e].[NullableIntA], [e].[NullableIntB], [e].[IntC]) <> [e].[NullableIntC]) OR ([e].[NullableIntC] IS NULL)"); } public override async Task Nullability_check_is_computed_correctly_for_chained_coalesce(bool async) @@ -2296,11 +2322,11 @@ public override async Task Nullability_check_is_computed_correctly_for_chained_c AssertSql( @"SELECT [e].[Id] FROM [Entities1] AS [e] -WHERE ([e].[NullableIntA] IS NULL AND [e].[NullableIntB] IS NULL) AND [e].[NullableIntC] IS NULL", +WHERE (([e].[NullableIntA] IS NULL) AND ([e].[NullableIntB] IS NULL)) AND ([e].[NullableIntC] IS NULL)", // @"SELECT [e].[Id] FROM [Entities1] AS [e] -WHERE ([e].[NullableIntA] IS NOT NULL OR [e].[NullableIntB] IS NOT NULL) OR [e].[NullableIntC] IS NOT NULL"); +WHERE (([e].[NullableIntA] IS NOT NULL) OR ([e].[NullableIntB] IS NOT NULL)) OR ([e].[NullableIntC] IS NOT NULL)"); } public override async Task Coalesce_on_self_gets_simplified(bool async) diff --git a/test/EFCore.SqlServer.FunctionalTests/Query/OwnedQuerySqlServerTest.cs b/test/EFCore.SqlServer.FunctionalTests/Query/OwnedQuerySqlServerTest.cs index 6647fb21fea..498679e0079 100644 --- a/test/EFCore.SqlServer.FunctionalTests/Query/OwnedQuerySqlServerTest.cs +++ b/test/EFCore.SqlServer.FunctionalTests/Query/OwnedQuerySqlServerTest.cs @@ -247,7 +247,7 @@ LEFT JOIN ( FROM [Order] AS [o0] LEFT JOIN [OrderDetail] AS [o1] ON ([o0].[ClientId] = [o1].[OrderClientId]) AND ([o0].[Id] = [o1].[OrderId]) ) AS [t] ON [o].[Id] = [t].[ClientId] -WHERE ([p].[Id] <> 42) OR [p].[Id] IS NULL +WHERE ([p].[Id] <> 42) OR ([p].[Id] IS NULL) ORDER BY [o].[Id], [p].[Id], [t].[ClientId], [t].[Id], [t].[OrderClientId], [t].[OrderId]"); } @@ -278,7 +278,7 @@ FROM [Order] AS [o0] LEFT JOIN [OwnedPerson] AS [o1] ON [o0].[ClientId] = [o1].[Id] LEFT JOIN [Planet] AS [p0] ON [o1].[PersonAddress_Country_PlanetId] = [p0].[Id] LEFT JOIN [Star] AS [s] ON [p0].[StarId] = [s].[Id] - WHERE ([o].[Id] = [o0].[ClientId]) AND (([s].[Id] <> 42) OR [s].[Id] IS NULL)) AS [Count], [p].[Id], [p].[StarId] + WHERE ([o].[Id] = [o0].[ClientId]) AND (([s].[Id] <> 42) OR ([s].[Id] IS NULL))) AS [Count], [p].[Id], [p].[StarId] FROM [OwnedPerson] AS [o] LEFT JOIN [Planet] AS [p] ON [o].[PersonAddress_Country_PlanetId] = [p].[Id] ORDER BY [o].[Id]"); @@ -297,7 +297,7 @@ LEFT JOIN ( FROM [Order] AS [o0] LEFT JOIN [OrderDetail] AS [o1] ON ([o0].[ClientId] = [o1].[OrderClientId]) AND ([o0].[Id] = [o1].[OrderId]) ) AS [t] ON [o].[Id] = [t].[ClientId] -WHERE ([p].[Id] <> 7) OR [p].[Id] IS NULL +WHERE ([p].[Id] <> 7) OR ([p].[Id] IS NULL) ORDER BY [o].[Id], [p].[Id], [t].[ClientId], [t].[Id], [t].[OrderClientId], [t].[OrderId]"); } @@ -1169,7 +1169,7 @@ public override async Task Projecting_collection_correlated_with_keyless_entity_ @"SELECT [b].[Throned_Value], [f].[Id], [b].[Id], [p].[Id], [p].[StarId] FROM [Fink] AS [f] LEFT JOIN [Barton] AS [b] ON [f].[BartonId] = [b].[Id] -LEFT JOIN [Planet] AS [p] ON ([b].[Throned_Value] <> [p].[Id]) OR [b].[Throned_Value] IS NULL +LEFT JOIN [Planet] AS [p] ON ([b].[Throned_Value] <> [p].[Id]) OR ([b].[Throned_Value] IS NULL) ORDER BY [f].[Id], [b].[Id]"); } diff --git a/test/EFCore.SqlServer.FunctionalTests/Query/QueryBugsTest.cs b/test/EFCore.SqlServer.FunctionalTests/Query/QueryBugsTest.cs index 03369fbe834..65062193aec 100644 --- a/test/EFCore.SqlServer.FunctionalTests/Query/QueryBugsTest.cs +++ b/test/EFCore.SqlServer.FunctionalTests/Query/QueryBugsTest.cs @@ -2989,7 +2989,7 @@ FROM [Factions] AS [f] WHERE EXISTS ( SELECT 1 FROM [Leaders] AS [l] - WHERE ([l].[Name] IS NOT NULL AND ([l].[Name] LIKE N'Bran%')) AND ([l].[Name] = N'Crach an Craite'))"); + WHERE (([l].[Name] IS NOT NULL) AND ([l].[Name] LIKE N'Bran%')) AND ([l].[Name] = N'Crach an Craite'))"); } } @@ -4736,7 +4736,7 @@ public virtual async Task Self_reference_in_query_filter_works() FROM [EntitiesWithQueryFilterSelfReference] AS [e] WHERE EXISTS ( SELECT 1 - FROM [EntitiesWithQueryFilterSelfReference] AS [e0]) AND (([e].[Name] <> N'Foo') OR [e].[Name] IS NULL)"); + FROM [EntitiesWithQueryFilterSelfReference] AS [e0]) AND (([e].[Name] <> N'Foo') OR ([e].[Name] IS NULL))"); } using (var context = contextFactory.CreateContext()) @@ -4753,7 +4753,7 @@ SELECT 1 FROM [EntitiesWithQueryFilterSelfReference] AS [e0] WHERE EXISTS ( SELECT 1 - FROM [EntitiesWithQueryFilterSelfReference] AS [e1])) AND (([e].[Name] <> N'Foo') OR [e].[Name] IS NULL)"); + FROM [EntitiesWithQueryFilterSelfReference] AS [e1])) AND (([e].[Name] <> N'Foo') OR ([e].[Name] IS NULL))"); } } @@ -5354,10 +5354,10 @@ FROM [Values] AS [v] WHERE [e].[Id] = [v].[Entity11023Id]) AND ((( SELECT TOP(1) [v0].[Id] FROM [Values] AS [v0] - WHERE [e].[Id] = [v0].[Entity11023Id]) = [t].[Value11023Id]) OR (( + WHERE [e].[Id] = [v0].[Entity11023Id]) = [t].[Value11023Id]) OR ((( SELECT TOP(1) [v0].[Id] FROM [Values] AS [v0] - WHERE [e].[Id] = [v0].[Entity11023Id]) IS NULL AND [t].[Value11023Id] IS NULL)) + WHERE [e].[Id] = [v0].[Entity11023Id]) IS NULL) AND ([t].[Value11023Id] IS NULL))) ) AS [t0] ORDER BY [e].[Id], [t0].[Id]"); } @@ -5753,7 +5753,7 @@ LEFT JOIN ( WHEN COALESCE(( SELECT MAX([d2].[GameNumber]) FROM [DbGame] AS [d2] - WHERE [d1].[Id] IS NOT NULL AND ([d1].[Id] = [d2].[SeasonId])), 0) > 10 THEN CAST(1 AS bit) + WHERE ([d1].[Id] IS NOT NULL) AND ([d1].[Id] = [d2].[SeasonId])), 0) > 10 THEN CAST(1 AS bit) ELSE CAST(0 AS bit) END AS [IsPastTradeDeadline], [d].[DbTradeId] FROM [DbTradeAsset] AS [d] @@ -6250,7 +6250,7 @@ FROM [CustomerFilters] AS [c] SELECT COUNT(*) FROM [Customers] AS [c0] LEFT JOIN [CustomerMemberships] AS [c1] ON [c0].[Id] = [c1].[CustomerId] - WHERE [c1].[Id] IS NOT NULL AND ([c0].[Id] = [c].[CustomerId])) > 0"); + WHERE ([c1].[Id] IS NOT NULL) AND ([c0].[Id] = [c].[CustomerId])) > 0"); } using (var context = contextFactory.CreateContext()) @@ -7314,13 +7314,13 @@ public virtual async Task Invoke_inside_query_filter_gets_correctly_evaluated_du SELECT [e].[Id], [e].[Name], [e].[TenantId] FROM [Entities] AS [e] -WHERE (([e].[Name] <> N'Foo') OR [e].[Name] IS NULL) AND ([e].[TenantId] = @__ef_filter__p_0)", +WHERE (([e].[Name] <> N'Foo') OR ([e].[Name] IS NULL)) AND ([e].[TenantId] = @__ef_filter__p_0)", // @"@__ef_filter__p_0='2' SELECT [e].[Id], [e].[Name], [e].[TenantId] FROM [Entities] AS [e] -WHERE (([e].[Name] <> N'Foo') OR [e].[Name] IS NULL) AND ([e].[TenantId] = @__ef_filter__p_0)"); +WHERE (([e].[Name] <> N'Foo') OR ([e].[Name] IS NULL)) AND ([e].[TenantId] = @__ef_filter__p_0)"); } } @@ -9110,7 +9110,7 @@ public async Task SaveChangesAsync_accepts_changes_with_ConfigureAwait_true_2284 var observableThing = new ObservableThing22841(); var origSynchronizationContext = SynchronizationContext.Current; - var trackingSynchronizationContext = new SingleThreadSynchronizationContext22841(); + var trackingSynchronizationContext = new SingleThreadSynchronizati0onContext22841(); SynchronizationContext.SetSynchronizationContext(trackingSynchronizationContext); bool? isMySyncContext = null; @@ -9449,12 +9449,12 @@ OUTER APPLY ( SELECT [m0].[Id], [m0].[Budget], [m0].[Description], [m0].[DurationInMins], [m0].[Name], [m0].[PosterUrl], [m0].[Rating], [m0].[ReleaseDate], [m0].[Revenue] FROM [MovieActorEntity] AS [m] INNER JOIN [MovieEntity] AS [m0] ON [m].[MovieId] = [m0].[Id] - WHERE [t].[Id0] IS NOT NULL AND ([t].[Id0] = [m].[ActorId]) + WHERE ([t].[Id0] IS NOT NULL) AND ([t].[Id0] = [m].[ActorId]) UNION SELECT [m2].[Id], [m2].[Budget], [m2].[Description], [m2].[DurationInMins], [m2].[Name], [m2].[PosterUrl], [m2].[Rating], [m2].[ReleaseDate], [m2].[Revenue] FROM [MovieDirectorEntity] AS [m1] INNER JOIN [MovieEntity] AS [m2] ON [m1].[MovieId] = [m2].[Id] - WHERE [t].[Id1] IS NOT NULL AND ([t].[Id1] = [m1].[DirectorId]) + WHERE ([t].[Id1] IS NOT NULL) AND ([t].[Id1] = [m1].[DirectorId]) ) AS [t0] ORDER BY [t].[Id], [t].[Id0], [t].[Id1], [p0].[Id]"); } @@ -9588,7 +9588,7 @@ SELECT TOP(2) ( SELECT COUNT(*) FROM [Cars] AS [c] INNER JOIN [Taxis] AS [t0] ON [c].[Id] = [t0].[CarId] - WHERE ([u].[Id] = [c].[EUserId]) AND (([t0].[ReportText] <> N'') OR [t0].[ReportText] IS NULL)) AS [c], [u].[Id] + WHERE ([u].[Id] = [c].[EUserId]) AND (([t0].[ReportText] <> N'') OR ([t0].[ReportText] IS NULL))) AS [c], [u].[Id] FROM [Users] AS [u] ) AS [t] OUTER APPLY ( diff --git a/test/EFCore.SqlServer.FunctionalTests/Query/SharedTypeQuerySqlServerTest.cs b/test/EFCore.SqlServer.FunctionalTests/Query/SharedTypeQuerySqlServerTest.cs index 07f8b2d53ff..1b49faf9c4a 100644 --- a/test/EFCore.SqlServer.FunctionalTests/Query/SharedTypeQuerySqlServerTest.cs +++ b/test/EFCore.SqlServer.FunctionalTests/Query/SharedTypeQuerySqlServerTest.cs @@ -20,7 +20,7 @@ FROM [ViewQuery24601] AS [v] WHERE EXISTS ( SELECT 1 FROM [STET] AS [s] - WHERE ([s].[Value] = [v].[Value]) OR ([s].[Value] IS NULL AND [v].[Value] IS NULL))"); + WHERE ([s].[Value] = [v].[Value]) OR (([s].[Value] IS NULL) AND ([v].[Value] IS NULL)))"); } public override async Task Can_use_shared_type_entity_type_in_query_filter_with_from_sql(bool async) @@ -35,7 +35,7 @@ SELECT 1 FROM ( Select * from STET ) AS [s] - WHERE ([s].[Value] = [v].[Value]) OR ([s].[Value] IS NULL AND [v].[Value] IS NULL))"); + WHERE ([s].[Value] = [v].[Value]) OR (([s].[Value] IS NULL) AND ([v].[Value] IS NULL)))"); } } } diff --git a/test/EFCore.SqlServer.FunctionalTests/Query/TPTFiltersInheritanceQuerySqlServerTest.cs b/test/EFCore.SqlServer.FunctionalTests/Query/TPTFiltersInheritanceQuerySqlServerTest.cs index f2fe0a418dc..7a52e6c90d6 100644 --- a/test/EFCore.SqlServer.FunctionalTests/Query/TPTFiltersInheritanceQuerySqlServerTest.cs +++ b/test/EFCore.SqlServer.FunctionalTests/Query/TPTFiltersInheritanceQuerySqlServerTest.cs @@ -47,7 +47,7 @@ FROM [Animals] AS [a] LEFT JOIN [Birds] AS [b] ON [a].[Species] = [b].[Species] LEFT JOIN [Eagle] AS [e] ON [a].[Species] = [e].[Species] LEFT JOIN [Kiwi] AS [k] ON [a].[Species] = [k].[Species] -WHERE ([a].[CountryId] = 1) AND [k].[Species] IS NOT NULL"); +WHERE ([a].[CountryId] = 1) AND ([k].[Species] IS NOT NULL)"); } public override async Task Can_use_is_kiwi_with_other_predicate(bool async) @@ -63,7 +63,7 @@ FROM [Animals] AS [a] LEFT JOIN [Birds] AS [b] ON [a].[Species] = [b].[Species] LEFT JOIN [Eagle] AS [e] ON [a].[Species] = [e].[Species] LEFT JOIN [Kiwi] AS [k] ON [a].[Species] = [k].[Species] -WHERE ([a].[CountryId] = 1) AND ([k].[Species] IS NOT NULL AND ([a].[CountryId] = 1))"); +WHERE ([a].[CountryId] = 1) AND (([k].[Species] IS NOT NULL) AND ([a].[CountryId] = 1))"); } public override async Task Can_use_is_kiwi_in_projection(bool async) @@ -93,7 +93,7 @@ FROM [Animals] AS [a] LEFT JOIN [Birds] AS [b] ON [a].[Species] = [b].[Species] LEFT JOIN [Eagle] AS [e] ON [a].[Species] = [e].[Species] LEFT JOIN [Kiwi] AS [k] ON [a].[Species] = [k].[Species] -WHERE ([a].[CountryId] = 1) AND ([k].[Species] IS NOT NULL OR [e].[Species] IS NOT NULL) +WHERE ([a].[CountryId] = 1) AND (([k].[Species] IS NOT NULL) OR ([e].[Species] IS NOT NULL)) ORDER BY [a].[Species]"); } @@ -110,7 +110,7 @@ FROM [Animals] AS [a] LEFT JOIN [Birds] AS [b] ON [a].[Species] = [b].[Species] LEFT JOIN [Eagle] AS [e] ON [a].[Species] = [e].[Species] LEFT JOIN [Kiwi] AS [k] ON [a].[Species] = [k].[Species] -WHERE (([a].[CountryId] = 1) AND ([a].[CountryId] = 1)) AND ([k].[Species] IS NOT NULL OR [e].[Species] IS NOT NULL) +WHERE (([a].[CountryId] = 1) AND ([a].[CountryId] = 1)) AND (([k].[Species] IS NOT NULL) OR ([e].[Species] IS NOT NULL)) ORDER BY [a].[Species]"); } @@ -124,7 +124,7 @@ FROM [Animals] AS [a] LEFT JOIN [Birds] AS [b] ON [a].[Species] = [b].[Species] LEFT JOIN [Eagle] AS [e] ON [a].[Species] = [e].[Species] LEFT JOIN [Kiwi] AS [k] ON [a].[Species] = [k].[Species] -WHERE ([a].[CountryId] = 1) AND ([k].[Species] IS NOT NULL OR [e].[Species] IS NOT NULL)"); +WHERE ([a].[CountryId] = 1) AND (([k].[Species] IS NOT NULL) OR ([e].[Species] IS NOT NULL))"); } public override async Task Can_use_of_type_bird_first(bool async) @@ -140,7 +140,7 @@ FROM [Animals] AS [a] LEFT JOIN [Birds] AS [b] ON [a].[Species] = [b].[Species] LEFT JOIN [Eagle] AS [e] ON [a].[Species] = [e].[Species] LEFT JOIN [Kiwi] AS [k] ON [a].[Species] = [k].[Species] -WHERE ([a].[CountryId] = 1) AND ([k].[Species] IS NOT NULL OR [e].[Species] IS NOT NULL) +WHERE ([a].[CountryId] = 1) AND (([k].[Species] IS NOT NULL) OR ([e].[Species] IS NOT NULL)) ORDER BY [a].[Species]"); } @@ -155,7 +155,7 @@ END AS [Discriminator] FROM [Animals] AS [a] LEFT JOIN [Birds] AS [b] ON [a].[Species] = [b].[Species] LEFT JOIN [Kiwi] AS [k] ON [a].[Species] = [k].[Species] -WHERE ([a].[CountryId] = 1) AND [k].[Species] IS NOT NULL"); +WHERE ([a].[CountryId] = 1) AND ([k].[Species] IS NOT NULL)"); } public override async Task Can_use_derived_set(bool async) diff --git a/test/EFCore.SqlServer.FunctionalTests/Query/TPTGearsOfWarQuerySqlServerTest.cs b/test/EFCore.SqlServer.FunctionalTests/Query/TPTGearsOfWarQuerySqlServerTest.cs index cf617713a70..86c5557cb8c 100644 --- a/test/EFCore.SqlServer.FunctionalTests/Query/TPTGearsOfWarQuerySqlServerTest.cs +++ b/test/EFCore.SqlServer.FunctionalTests/Query/TPTGearsOfWarQuerySqlServerTest.cs @@ -50,7 +50,7 @@ public override async Task Negate_on_like_expression(bool async) AssertSql( @"SELECT [s].[Id], [s].[Banner], [s].[Banner5], [s].[InternalNumber], [s].[Name] FROM [Squads] AS [s] -WHERE [s].[Name] IS NOT NULL AND NOT ([s].[Name] LIKE N'us%')"); +WHERE ([s].[Name] IS NOT NULL) AND NOT ([s].[Name] LIKE N'us%')"); } public override async Task Entity_equality_empty(bool async) @@ -296,7 +296,7 @@ WHEN [o].[Nickname] IS NOT NULL THEN N'Officer' FROM [Gears] AS [g] LEFT JOIN [Officers] AS [o] ON ([g].[Nickname] = [o].[Nickname]) AND ([g].[SquadId] = [o].[SquadId]) LEFT JOIN [Tags] AS [t] ON ([g].[Nickname] = [t].[GearNickName]) AND ([g].[SquadId] = [t].[GearSquadId]) -WHERE [t].[Id] IS NOT NULL AND [t].[Id] IN ('34c8d86e-a4ac-4be5-827f-584dda348a07', 'df36f493-463f-4123-83f9-6b135deeb7ba', 'a8ad98f9-e023-4e2a-9a70-c2728455bd34', '70534e05-782c-4052-8720-c2c54481ce5f', 'a7be028a-0cf2-448f-ab55-ce8bc5d8cf69', 'b39a6fba-9026-4d69-828e-fd7068673e57')"); +WHERE ([t].[Id] IS NOT NULL) AND [t].[Id] IN ('34c8d86e-a4ac-4be5-827f-584dda348a07', 'df36f493-463f-4123-83f9-6b135deeb7ba', 'a8ad98f9-e023-4e2a-9a70-c2728455bd34', '70534e05-782c-4052-8720-c2c54481ce5f', 'a7be028a-0cf2-448f-ab55-ce8bc5d8cf69', 'b39a6fba-9026-4d69-828e-fd7068673e57')"); } public override async Task Include_where_list_contains_navigation2(bool async) @@ -314,7 +314,7 @@ FROM [Gears] AS [g] LEFT JOIN [Officers] AS [o] ON ([g].[Nickname] = [o].[Nickname]) AND ([g].[SquadId] = [o].[SquadId]) INNER JOIN [Cities] AS [c] ON [g].[CityOfBirthName] = [c].[Name] LEFT JOIN [Tags] AS [t] ON ([g].[Nickname] = [t].[GearNickName]) AND ([g].[SquadId] = [t].[GearSquadId]) -WHERE [c].[Location] IS NOT NULL AND [t].[Id] IN ('34c8d86e-a4ac-4be5-827f-584dda348a07', 'df36f493-463f-4123-83f9-6b135deeb7ba', 'a8ad98f9-e023-4e2a-9a70-c2728455bd34', '70534e05-782c-4052-8720-c2c54481ce5f', 'a7be028a-0cf2-448f-ab55-ce8bc5d8cf69', 'b39a6fba-9026-4d69-828e-fd7068673e57')"); +WHERE ([c].[Location] IS NOT NULL) AND [t].[Id] IN ('34c8d86e-a4ac-4be5-827f-584dda348a07', 'df36f493-463f-4123-83f9-6b135deeb7ba', 'a8ad98f9-e023-4e2a-9a70-c2728455bd34', '70534e05-782c-4052-8720-c2c54481ce5f', 'a7be028a-0cf2-448f-ab55-ce8bc5d8cf69', 'b39a6fba-9026-4d69-828e-fd7068673e57')"); } public override async Task Navigation_accessed_twice_outside_and_inside_subquery(bool async) @@ -331,7 +331,7 @@ END AS [Discriminator] FROM [Gears] AS [g] LEFT JOIN [Officers] AS [o] ON ([g].[Nickname] = [o].[Nickname]) AND ([g].[SquadId] = [o].[SquadId]) LEFT JOIN [Tags] AS [t] ON ([g].[Nickname] = [t].[GearNickName]) AND ([g].[SquadId] = [t].[GearSquadId]) -WHERE [t].[Id] IS NOT NULL AND [t].[Id] IN ('34c8d86e-a4ac-4be5-827f-584dda348a07', 'df36f493-463f-4123-83f9-6b135deeb7ba', 'a8ad98f9-e023-4e2a-9a70-c2728455bd34', '70534e05-782c-4052-8720-c2c54481ce5f', 'a7be028a-0cf2-448f-ab55-ce8bc5d8cf69', 'b39a6fba-9026-4d69-828e-fd7068673e57')"); +WHERE ([t].[Id] IS NOT NULL) AND [t].[Id] IN ('34c8d86e-a4ac-4be5-827f-584dda348a07', 'df36f493-463f-4123-83f9-6b135deeb7ba', 'a8ad98f9-e023-4e2a-9a70-c2728455bd34', '70534e05-782c-4052-8720-c2c54481ce5f', 'a7be028a-0cf2-448f-ab55-ce8bc5d8cf69', 'b39a6fba-9026-4d69-828e-fd7068673e57')"); } public override async Task Include_with_join_multi_level(bool async) @@ -455,7 +455,7 @@ FROM [Gears] AS [g] LEFT JOIN [Officers] AS [o] ON ([g].[Nickname] = [o].[Nickname]) AND ([g].[SquadId] = [o].[SquadId]) ) AS [t] ON [w].[OwnerFullName] = [t].[FullName] LEFT JOIN [Cities] AS [c] ON [t].[CityOfBirthName] = [c].[Name] -WHERE ([t].[Nickname] <> N'Paduk') OR [t].[Nickname] IS NULL +WHERE ([t].[Nickname] <> N'Paduk') OR ([t].[Nickname] IS NULL) ORDER BY [c].[Name], [w].[Id]"); } @@ -739,15 +739,15 @@ LEFT JOIN [Officers] AS [o0] ON ([g0].[Nickname] = [o0].[Nickname]) AND ([g0].[S SELECT TOP(1) [g0].[Rank] FROM [Gears] AS [g0] LEFT JOIN [Officers] AS [o0] ON ([g0].[Nickname] = [o0].[Nickname]) AND ([g0].[SquadId] = [o0].[SquadId]) - ORDER BY [g0].[Nickname], [g0].[SquadId])) OR (( + ORDER BY [g0].[Nickname], [g0].[SquadId])) OR ((( SELECT TOP(1) [g0].[Rank] FROM [Gears] AS [g0] LEFT JOIN [Officers] AS [o0] ON ([g0].[Nickname] = [o0].[Nickname]) AND ([g0].[SquadId] = [o0].[SquadId]) - ORDER BY [g0].[Nickname], [g0].[SquadId]) IS NULL AND ( + ORDER BY [g0].[Nickname], [g0].[SquadId]) IS NULL) AND (( SELECT TOP(1) [g0].[Rank] FROM [Gears] AS [g0] LEFT JOIN [Officers] AS [o0] ON ([g0].[Nickname] = [o0].[Nickname]) AND ([g0].[SquadId] = [o0].[SquadId]) - ORDER BY [g0].[Nickname], [g0].[SquadId]) IS NULL)", + ORDER BY [g0].[Nickname], [g0].[SquadId]) IS NULL))", // @"SELECT [g].[Nickname], [g].[SquadId], [g].[AssignedCityName], [g].[CityOfBirthName], [g].[FullName], [g].[HasSoulPatch], [g].[LeaderNickname], [g].[LeaderSquadId], [g].[Rank], CASE WHEN [o].[Nickname] IS NOT NULL THEN N'Officer' @@ -762,15 +762,15 @@ LEFT JOIN [Officers] AS [o0] ON ([g0].[Nickname] = [o0].[Nickname]) AND ([g0].[S SELECT TOP(1) [g0].[Rank] FROM [Gears] AS [g0] LEFT JOIN [Officers] AS [o0] ON ([g0].[Nickname] = [o0].[Nickname]) AND ([g0].[SquadId] = [o0].[SquadId]) - ORDER BY [g0].[Nickname], [g0].[SquadId])) OR (( + ORDER BY [g0].[Nickname], [g0].[SquadId])) OR ((( SELECT TOP(1) [g0].[Rank] FROM [Gears] AS [g0] LEFT JOIN [Officers] AS [o0] ON ([g0].[Nickname] = [o0].[Nickname]) AND ([g0].[SquadId] = [o0].[SquadId]) - ORDER BY [g0].[Nickname], [g0].[SquadId]) IS NULL AND ( + ORDER BY [g0].[Nickname], [g0].[SquadId]) IS NULL) AND (( SELECT TOP(1) [g0].[Rank] FROM [Gears] AS [g0] LEFT JOIN [Officers] AS [o0] ON ([g0].[Nickname] = [o0].[Nickname]) AND ([g0].[SquadId] = [o0].[SquadId]) - ORDER BY [g0].[Nickname], [g0].[SquadId]) IS NULL)"); + ORDER BY [g0].[Nickname], [g0].[SquadId]) IS NULL))"); } public override async Task Where_enum_has_flag_subquery_client_eval(bool async) @@ -791,15 +791,15 @@ LEFT JOIN [Officers] AS [o0] ON ([g0].[Nickname] = [o0].[Nickname]) AND ([g0].[S SELECT TOP(1) [g0].[Rank] FROM [Gears] AS [g0] LEFT JOIN [Officers] AS [o0] ON ([g0].[Nickname] = [o0].[Nickname]) AND ([g0].[SquadId] = [o0].[SquadId]) - ORDER BY [g0].[Nickname], [g0].[SquadId])) OR (( + ORDER BY [g0].[Nickname], [g0].[SquadId])) OR ((( SELECT TOP(1) [g0].[Rank] FROM [Gears] AS [g0] LEFT JOIN [Officers] AS [o0] ON ([g0].[Nickname] = [o0].[Nickname]) AND ([g0].[SquadId] = [o0].[SquadId]) - ORDER BY [g0].[Nickname], [g0].[SquadId]) IS NULL AND ( + ORDER BY [g0].[Nickname], [g0].[SquadId]) IS NULL) AND (( SELECT TOP(1) [g0].[Rank] FROM [Gears] AS [g0] LEFT JOIN [Officers] AS [o0] ON ([g0].[Nickname] = [o0].[Nickname]) AND ([g0].[SquadId] = [o0].[SquadId]) - ORDER BY [g0].[Nickname], [g0].[SquadId]) IS NULL)"); + ORDER BY [g0].[Nickname], [g0].[SquadId]) IS NULL))"); } public override async Task Where_enum_has_flag_with_non_nullable_parameter(bool async) @@ -901,7 +901,7 @@ public override async Task Select_comparison_with_null(bool async) @"@__ammunitionType_0='1' (Nullable = true) SELECT [w].[Id], CASE - WHEN ([w].[AmmunitionType] = @__ammunitionType_0) AND [w].[AmmunitionType] IS NOT NULL THEN CAST(1 AS bit) + WHEN ([w].[AmmunitionType] = @__ammunitionType_0) AND ([w].[AmmunitionType] IS NOT NULL) THEN CAST(1 AS bit) ELSE CAST(0 AS bit) END AS [Cartridge] FROM [Weapons] AS [w] @@ -967,11 +967,11 @@ public override async Task Select_ternary_operation_with_has_value_not_null(bool AssertSql( @"SELECT [w].[Id], CASE - WHEN [w].[AmmunitionType] IS NOT NULL AND ([w].[AmmunitionType] = 1) THEN N'Yes' + WHEN ([w].[AmmunitionType] IS NOT NULL) AND ([w].[AmmunitionType] = 1) THEN N'Yes' ELSE N'No' END AS [IsCartridge] FROM [Weapons] AS [w] -WHERE [w].[AmmunitionType] IS NOT NULL AND ([w].[AmmunitionType] = 1)"); +WHERE ([w].[AmmunitionType] IS NOT NULL) AND ([w].[AmmunitionType] = 1)"); } public override async Task Select_ternary_operation_multiple_conditions(bool async) @@ -1004,7 +1004,7 @@ public override async Task Select_multiple_conditions(bool async) AssertSql( @"SELECT [w].[Id], CASE - WHEN ([w].[IsAutomatic] = CAST(0 AS bit)) AND (([w].[SynergyWithId] = 1) AND [w].[SynergyWithId] IS NOT NULL) THEN CAST(1 AS bit) + WHEN ([w].[IsAutomatic] = CAST(0 AS bit)) AND (([w].[SynergyWithId] = 1) AND ([w].[SynergyWithId] IS NOT NULL)) THEN CAST(1 AS bit) ELSE CAST(0 AS bit) END AS [IsCartridge] FROM [Weapons] AS [w]"); @@ -1035,7 +1035,7 @@ WHEN [o].[Nickname] IS NOT NULL THEN N'Officer' END AS [Discriminator] FROM [Gears] AS [g] LEFT JOIN [Officers] AS [o] ON ([g].[Nickname] = [o].[Nickname]) AND ([g].[SquadId] = [o].[SquadId]) -WHERE ([g].[LeaderNickname] = N'Marcus') AND [g].[LeaderNickname] IS NOT NULL"); +WHERE ([g].[LeaderNickname] = N'Marcus') AND ([g].[LeaderNickname] IS NOT NULL)"); } public override async Task Null_propagation_optimization2(bool async) @@ -1052,7 +1052,7 @@ LEFT JOIN [Officers] AS [o] ON ([g].[Nickname] = [o].[Nickname]) AND ([g].[Squad WHERE CASE WHEN [g].[LeaderNickname] IS NULL THEN NULL ELSE CASE - WHEN [g].[LeaderNickname] IS NOT NULL AND ([g].[LeaderNickname] LIKE N'%us') THEN CAST(1 AS bit) + WHEN ([g].[LeaderNickname] IS NOT NULL) AND ([g].[LeaderNickname] LIKE N'%us') THEN CAST(1 AS bit) ELSE CAST(0 AS bit) END END = CAST(1 AS bit)"); @@ -1092,10 +1092,10 @@ LEFT JOIN [Officers] AS [o] ON ([g].[Nickname] = [o].[Nickname]) AND ([g].[Squad WHERE (CASE WHEN [g].[LeaderNickname] IS NULL THEN NULL ELSE CAST(LEN([g].[LeaderNickname]) AS int) -END = 5) AND CASE +END = 5) AND (CASE WHEN [g].[LeaderNickname] IS NULL THEN NULL ELSE CAST(LEN([g].[LeaderNickname]) AS int) -END IS NOT NULL"); +END IS NOT NULL)"); } public override async Task Null_propagation_optimization5(bool async) @@ -1112,10 +1112,10 @@ LEFT JOIN [Officers] AS [o] ON ([g].[Nickname] = [o].[Nickname]) AND ([g].[Squad WHERE (CASE WHEN [g].[LeaderNickname] IS NOT NULL THEN CAST(LEN([g].[LeaderNickname]) AS int) ELSE NULL -END = 5) AND CASE +END = 5) AND (CASE WHEN [g].[LeaderNickname] IS NOT NULL THEN CAST(LEN([g].[LeaderNickname]) AS int) ELSE NULL -END IS NOT NULL"); +END IS NOT NULL)"); } public override async Task Null_propagation_optimization6(bool async) @@ -1132,10 +1132,10 @@ LEFT JOIN [Officers] AS [o] ON ([g].[Nickname] = [o].[Nickname]) AND ([g].[Squad WHERE (CASE WHEN [g].[LeaderNickname] IS NOT NULL THEN CAST(LEN([g].[LeaderNickname]) AS int) ELSE NULL -END = 5) AND CASE +END = 5) AND (CASE WHEN [g].[LeaderNickname] IS NOT NULL THEN CAST(LEN([g].[LeaderNickname]) AS int) ELSE NULL -END IS NOT NULL"); +END IS NOT NULL)"); } public override async Task Select_null_propagation_optimization7(bool async) @@ -1206,7 +1206,7 @@ public override async Task Select_null_propagation_negative3(bool async) AssertSql( @"SELECT [t].[Nickname], CASE - WHEN [t].[Nickname] IS NOT NULL AND [t].[SquadId] IS NOT NULL THEN CASE + WHEN ([t].[Nickname] IS NOT NULL) AND ([t].[SquadId] IS NOT NULL) THEN CASE WHEN [t].[LeaderNickname] IS NOT NULL THEN CAST(1 AS bit) ELSE CAST(0 AS bit) END @@ -1226,7 +1226,7 @@ public override async Task Select_null_propagation_negative4(bool async) AssertSql( @"SELECT CASE - WHEN [t].[Nickname] IS NOT NULL AND [t].[SquadId] IS NOT NULL THEN CAST(1 AS bit) + WHEN ([t].[Nickname] IS NOT NULL) AND ([t].[SquadId] IS NOT NULL) THEN CAST(1 AS bit) ELSE CAST(0 AS bit) END, [t].[Nickname] FROM [Gears] AS [g] @@ -1243,7 +1243,7 @@ public override async Task Select_null_propagation_negative5(bool async) AssertSql( @"SELECT CASE - WHEN [t].[Nickname] IS NOT NULL AND [t].[SquadId] IS NOT NULL THEN CAST(1 AS bit) + WHEN ([t].[Nickname] IS NOT NULL) AND ([t].[SquadId] IS NOT NULL) THEN CAST(1 AS bit) ELSE CAST(0 AS bit) END, [t].[Nickname] FROM [Gears] AS [g] @@ -1341,7 +1341,7 @@ LEFT JOIN ( SELECT [g].[Nickname], [g].[SquadId] FROM [Gears] AS [g] ) AS [t0] ON ([t].[GearNickName] = [t0].[Nickname]) AND ([t].[GearSquadId] = [t0].[SquadId]) -LEFT JOIN [Tags] AS [t1] ON (([t0].[Nickname] = [t1].[GearNickName]) OR ([t0].[Nickname] IS NULL AND [t1].[GearNickName] IS NULL)) AND (([t0].[SquadId] = [t1].[GearSquadId]) OR ([t0].[SquadId] IS NULL AND [t1].[GearSquadId] IS NULL)) +LEFT JOIN [Tags] AS [t1] ON (([t0].[Nickname] = [t1].[GearNickName]) OR (([t0].[Nickname] IS NULL) AND ([t1].[GearNickName] IS NULL))) AND (([t0].[SquadId] = [t1].[GearSquadId]) OR (([t0].[SquadId] IS NULL) AND ([t1].[GearSquadId] IS NULL))) LEFT JOIN ( SELECT [g0].[Nickname], [g0].[SquadId], [g0].[AssignedCityName] FROM [Gears] AS [g0] @@ -1461,7 +1461,7 @@ LEFT JOIN ( SELECT [g0].[Nickname], [g0].[SquadId] FROM [Gears] AS [g0] ) AS [t2] ON ([t0].[GearNickName] = [t2].[Nickname]) AND ([t0].[GearSquadId] = [t2].[SquadId]) -WHERE ([t1].[Nickname] = [t2].[Nickname]) OR ([t1].[Nickname] IS NULL AND [t2].[Nickname] IS NULL)"); +WHERE ([t1].[Nickname] = [t2].[Nickname]) OR (([t1].[Nickname] IS NULL) AND ([t2].[Nickname] IS NULL))"); } public override async Task Select_Singleton_Navigation_With_Member_Access(bool async) @@ -1478,7 +1478,7 @@ END AS [Discriminator] FROM [Gears] AS [g] LEFT JOIN [Officers] AS [o] ON ([g].[Nickname] = [o].[Nickname]) AND ([g].[SquadId] = [o].[SquadId]) ) AS [t0] ON ([t].[GearNickName] = [t0].[Nickname]) AND ([t].[GearSquadId] = [t0].[SquadId]) -WHERE ([t0].[Nickname] = N'Marcus') AND (([t0].[CityOfBirthName] <> N'Ephyra') OR [t0].[CityOfBirthName] IS NULL)"); +WHERE ([t0].[Nickname] = N'Marcus') AND (([t0].[CityOfBirthName] <> N'Ephyra') OR ([t0].[CityOfBirthName] IS NULL))"); } public override async Task Select_Where_Navigation(bool async) @@ -1511,7 +1511,7 @@ LEFT JOIN ( SELECT [g0].[Nickname], [g0].[SquadId] FROM [Gears] AS [g0] ) AS [t2] ON ([t0].[GearNickName] = [t2].[Nickname]) AND ([t0].[GearSquadId] = [t2].[SquadId]) -WHERE (([t1].[Nickname] = [t2].[Nickname]) OR ([t1].[Nickname] IS NULL AND [t2].[Nickname] IS NULL)) AND (([t1].[SquadId] = [t2].[SquadId]) OR ([t1].[SquadId] IS NULL AND [t2].[SquadId] IS NULL))"); +WHERE (([t1].[Nickname] = [t2].[Nickname]) OR (([t1].[Nickname] IS NULL) AND ([t2].[Nickname] IS NULL))) AND (([t1].[SquadId] = [t2].[SquadId]) OR (([t1].[SquadId] IS NULL) AND ([t2].[SquadId] IS NULL)))"); } public override async Task Select_Where_Navigation_Null(bool async) @@ -1525,7 +1525,7 @@ LEFT JOIN ( SELECT [g].[Nickname], [g].[SquadId] FROM [Gears] AS [g] ) AS [t0] ON ([t].[GearNickName] = [t0].[Nickname]) AND ([t].[GearSquadId] = [t0].[SquadId]) -WHERE [t0].[Nickname] IS NULL OR [t0].[SquadId] IS NULL"); +WHERE ([t0].[Nickname] IS NULL) OR ([t0].[SquadId] IS NULL)"); } public override async Task Select_Where_Navigation_Null_Reverse(bool async) @@ -1539,7 +1539,7 @@ LEFT JOIN ( SELECT [g].[Nickname], [g].[SquadId] FROM [Gears] AS [g] ) AS [t0] ON ([t].[GearNickName] = [t0].[Nickname]) AND ([t].[GearSquadId] = [t0].[SquadId]) -WHERE [t0].[Nickname] IS NULL OR [t0].[SquadId] IS NULL"); +WHERE ([t0].[Nickname] IS NULL) OR ([t0].[SquadId] IS NULL)"); } public override async Task Select_Where_Navigation_Scalar_Equals_Navigation_Scalar_Projected(bool async) @@ -1558,7 +1558,7 @@ LEFT JOIN ( SELECT [g0].[Nickname], [g0].[SquadId] FROM [Gears] AS [g0] ) AS [t2] ON ([t0].[GearNickName] = [t2].[Nickname]) AND ([t0].[GearSquadId] = [t2].[SquadId]) -WHERE ([t1].[Nickname] = [t2].[Nickname]) OR ([t1].[Nickname] IS NULL AND [t2].[Nickname] IS NULL)"); +WHERE ([t1].[Nickname] = [t2].[Nickname]) OR (([t1].[Nickname] IS NULL) AND ([t2].[Nickname] IS NULL))"); } public override async Task Optional_Navigation_Null_Coalesce_To_Clr_Type(bool async) @@ -2073,7 +2073,7 @@ LEFT JOIN ( SELECT [g].[Nickname], [g].[SquadId], [g].[CityOfBirthName] FROM [Gears] AS [g] ) AS [t0] ON ([t].[GearNickName] = [t0].[Nickname]) AND ([t].[GearSquadId] = [t0].[SquadId]) -WHERE ([t0].[Nickname] = N'Marcus') AND (([t0].[CityOfBirthName] <> N'Ephyra') OR [t0].[CityOfBirthName] IS NULL)"); +WHERE ([t0].[Nickname] = N'Marcus') AND (([t0].[CityOfBirthName] <> N'Ephyra') OR ([t0].[CityOfBirthName] IS NULL))"); } public override async Task GroupJoin_Composite_Key(bool async) @@ -2496,7 +2496,7 @@ public override async Task Coalesce_operator_in_projection_with_other_conditions AssertSql( @"SELECT CASE - WHEN (([w].[AmmunitionType] = 1) AND [w].[AmmunitionType] IS NOT NULL) AND (COALESCE([w].[IsAutomatic], CAST(0 AS bit)) = CAST(1 AS bit)) THEN CAST(1 AS bit) + WHEN (([w].[AmmunitionType] = 1) AND ([w].[AmmunitionType] IS NOT NULL)) AND (COALESCE([w].[IsAutomatic], CAST(0 AS bit)) = CAST(1 AS bit)) THEN CAST(1 AS bit) ELSE CAST(0 AS bit) END FROM [Weapons] AS [w]"); @@ -2513,7 +2513,7 @@ LEFT JOIN ( SELECT [g].[Nickname], [g].[SquadId], [g].[HasSoulPatch] FROM [Gears] AS [g] ) AS [t0] ON ([t].[GearNickName] = [t0].[Nickname]) AND ([t].[GearSquadId] = [t0].[SquadId]) -WHERE (([t].[Note] <> N'K.I.A.') OR [t].[Note] IS NULL) AND ([t0].[HasSoulPatch] = CAST(1 AS bit))"); +WHERE (([t].[Note] <> N'K.I.A.') OR ([t].[Note] IS NULL)) AND ([t0].[HasSoulPatch] = CAST(1 AS bit))"); } public override async Task Optional_navigation_type_compensation_works_with_predicate2(bool async) @@ -2636,7 +2636,7 @@ LEFT JOIN ( SELECT [g].[Nickname], [g].[SquadId] FROM [Gears] AS [g] ) AS [t0] ON ([t].[GearNickName] = [t0].[Nickname]) AND ([t].[GearSquadId] = [t0].[SquadId]) -WHERE ([t].[Note] <> N'K.I.A.') OR [t].[Note] IS NULL"); +WHERE ([t].[Note] <> N'K.I.A.') OR ([t].[Note] IS NULL)"); } public override async Task Optional_navigation_type_compensation_works_with_projection_into_anonymous_type(bool async) @@ -2650,7 +2650,7 @@ LEFT JOIN ( SELECT [g].[Nickname], [g].[SquadId] FROM [Gears] AS [g] ) AS [t0] ON ([t].[GearNickName] = [t0].[Nickname]) AND ([t].[GearSquadId] = [t0].[SquadId]) -WHERE ([t].[Note] <> N'K.I.A.') OR [t].[Note] IS NULL"); +WHERE ([t].[Note] <> N'K.I.A.') OR ([t].[Note] IS NULL)"); } public override async Task Optional_navigation_type_compensation_works_with_DTOs(bool async) @@ -2664,7 +2664,7 @@ LEFT JOIN ( SELECT [g].[Nickname], [g].[SquadId] FROM [Gears] AS [g] ) AS [t0] ON ([t].[GearNickName] = [t0].[Nickname]) AND ([t].[GearSquadId] = [t0].[SquadId]) -WHERE ([t].[Note] <> N'K.I.A.') OR [t].[Note] IS NULL"); +WHERE ([t].[Note] <> N'K.I.A.') OR ([t].[Note] IS NULL)"); } public override async Task Optional_navigation_type_compensation_works_with_list_initializers(bool async) @@ -2678,7 +2678,7 @@ LEFT JOIN ( SELECT [g].[Nickname], [g].[SquadId] FROM [Gears] AS [g] ) AS [t0] ON ([t].[GearNickName] = [t0].[Nickname]) AND ([t].[GearSquadId] = [t0].[SquadId]) -WHERE ([t].[Note] <> N'K.I.A.') OR [t].[Note] IS NULL +WHERE ([t].[Note] <> N'K.I.A.') OR ([t].[Note] IS NULL) ORDER BY [t].[Note]"); } @@ -2693,7 +2693,7 @@ LEFT JOIN ( SELECT [g].[Nickname], [g].[SquadId] FROM [Gears] AS [g] ) AS [t0] ON ([t].[GearNickName] = [t0].[Nickname]) AND ([t].[GearSquadId] = [t0].[SquadId]) -WHERE ([t].[Note] <> N'K.I.A.') OR [t].[Note] IS NULL"); +WHERE ([t].[Note] <> N'K.I.A.') OR ([t].[Note] IS NULL)"); } public override async Task Optional_navigation_type_compensation_works_with_orderby(bool async) @@ -2707,7 +2707,7 @@ LEFT JOIN ( SELECT [g].[Nickname], [g].[SquadId] FROM [Gears] AS [g] ) AS [t0] ON ([t].[GearNickName] = [t0].[Nickname]) AND ([t].[GearSquadId] = [t0].[SquadId]) -WHERE ([t].[Note] <> N'K.I.A.') OR [t].[Note] IS NULL +WHERE ([t].[Note] <> N'K.I.A.') OR ([t].[Note] IS NULL) ORDER BY [t0].[SquadId]"); } @@ -2727,7 +2727,7 @@ END AS [Discriminator] FROM [Gears] AS [g] LEFT JOIN [Officers] AS [o] ON ([g].[Nickname] = [o].[Nickname]) AND ([g].[SquadId] = [o].[SquadId]) ) AS [t0] ON ([t].[GearNickName] = [t0].[Nickname]) AND ([t].[GearSquadId] = [t0].[SquadId]) - WHERE (([t].[Note] <> N'K.I.A.') OR [t].[Note] IS NULL) AND ([t0].[HasSoulPatch] = CAST(0 AS bit))) THEN CAST(1 AS bit) + WHERE (([t].[Note] <> N'K.I.A.') OR ([t].[Note] IS NULL)) AND ([t0].[HasSoulPatch] = CAST(0 AS bit))) THEN CAST(1 AS bit) ELSE CAST(0 AS bit) END"); } @@ -2743,7 +2743,7 @@ LEFT JOIN ( SELECT [g].[Nickname], [g].[SquadId], [g].[HasSoulPatch] FROM [Gears] AS [g] ) AS [t0] ON ([t].[GearNickName] = [t0].[Nickname]) AND ([t].[GearSquadId] = [t0].[SquadId]) -WHERE (([t].[Note] <> N'K.I.A.') OR [t].[Note] IS NULL) AND ([t0].[HasSoulPatch] = CAST(0 AS bit))"); +WHERE (([t].[Note] <> N'K.I.A.') OR ([t].[Note] IS NULL)) AND ([t0].[HasSoulPatch] = CAST(0 AS bit))"); } public override async Task Optional_navigation_type_compensation_works_with_contains(bool async) @@ -2757,7 +2757,7 @@ LEFT JOIN ( SELECT [g].[Nickname], [g].[SquadId] FROM [Gears] AS [g] ) AS [t0] ON ([t].[GearNickName] = [t0].[Nickname]) AND ([t].[GearSquadId] = [t0].[SquadId]) -WHERE (([t].[Note] <> N'K.I.A.') OR [t].[Note] IS NULL) AND EXISTS ( +WHERE (([t].[Note] <> N'K.I.A.') OR ([t].[Note] IS NULL)) AND EXISTS ( SELECT 1 FROM [Gears] AS [g0] LEFT JOIN [Officers] AS [o0] ON ([g0].[Nickname] = [o0].[Nickname]) AND ([g0].[SquadId] = [o0].[SquadId]) @@ -2882,7 +2882,7 @@ FROM [Gears] AS [g] LEFT JOIN ( SELECT [w].[Id], [w].[AmmunitionType], [w].[IsAutomatic], [w].[Name], [w].[OwnerFullName], [w].[SynergyWithId] FROM [Weapons] AS [w] - WHERE ([w].[Name] <> N'Lancer') OR [w].[Name] IS NULL + WHERE ([w].[Name] <> N'Lancer') OR ([w].[Name] IS NULL) ) AS [t] ON [g].[FullName] = [t].[OwnerFullName] WHERE [c].[Name] IN (N'Ephyra', N'Hanover') ORDER BY [g].[Nickname], [g].[SquadId], [c].[Name]"); @@ -3217,7 +3217,7 @@ public override async Task Distinct_with_optional_navigation_is_translated_to_sq @"SELECT DISTINCT [g].[HasSoulPatch] FROM [Gears] AS [g] LEFT JOIN [Tags] AS [t] ON ([g].[Nickname] = [t].[GearNickName]) AND ([g].[SquadId] = [t].[GearSquadId]) -WHERE ([t].[Note] <> N'Foo') OR [t].[Note] IS NULL"); +WHERE ([t].[Note] <> N'Foo') OR ([t].[Note] IS NULL)"); } public override async Task Sum_with_optional_navigation_is_translated_to_sql(bool async) @@ -3228,7 +3228,7 @@ public override async Task Sum_with_optional_navigation_is_translated_to_sql(boo @"SELECT COALESCE(SUM([g].[SquadId]), 0) FROM [Gears] AS [g] LEFT JOIN [Tags] AS [t] ON ([g].[Nickname] = [t].[GearNickName]) AND ([g].[SquadId] = [t].[GearSquadId]) -WHERE ([t].[Note] <> N'Foo') OR [t].[Note] IS NULL"); +WHERE ([t].[Note] <> N'Foo') OR ([t].[Note] IS NULL)"); } public override async Task Count_with_optional_navigation_is_translated_to_sql(bool async) @@ -3239,7 +3239,7 @@ public override async Task Count_with_optional_navigation_is_translated_to_sql(b @"SELECT COUNT(*) FROM [Gears] AS [g] LEFT JOIN [Tags] AS [t] ON ([g].[Nickname] = [t].[GearNickName]) AND ([g].[SquadId] = [t].[GearSquadId]) -WHERE ([t].[Note] <> N'Foo') OR [t].[Note] IS NULL"); +WHERE ([t].[Note] <> N'Foo') OR ([t].[Note] IS NULL)"); } public override async Task FirstOrDefault_with_manually_created_groupjoin_is_translated_to_sql(bool async) @@ -3285,7 +3285,7 @@ SELECT 1 FROM [Gears] AS [g] LEFT JOIN [Officers] AS [o] ON ([g].[Nickname] = [o].[Nickname]) AND ([g].[SquadId] = [o].[SquadId]) LEFT JOIN [Tags] AS [t] ON ([g].[Nickname] = [t].[GearNickName]) AND ([g].[SquadId] = [t].[GearSquadId]) - WHERE ([t].[Note] = N'Foo') AND [t].[Note] IS NOT NULL) THEN CAST(1 AS bit) + WHERE ([t].[Note] = N'Foo') AND ([t].[Note] IS NOT NULL)) THEN CAST(1 AS bit) ELSE CAST(0 AS bit) END"); } @@ -3406,7 +3406,7 @@ public override async Task Subquery_containing_join_gets_lifted_clashing_names(b FROM [Gears] AS [g] INNER JOIN [Tags] AS [t] ON [g].[Nickname] = [t].[GearNickName] INNER JOIN [Tags] AS [t0] ON [g].[Nickname] = [t0].[GearNickName] -WHERE ([t].[GearNickName] <> N'Cole Train') OR [t].[GearNickName] IS NULL +WHERE ([t].[GearNickName] <> N'Cole Train') OR ([t].[GearNickName] IS NULL) ORDER BY [g].[Nickname], [t0].[Id]"); } @@ -3832,7 +3832,7 @@ LEFT JOIN ( SELECT [g0].[Nickname], [g0].[SquadId] FROM [Gears] AS [g0] ) AS [t1] ON ([t0].[DefeatedByNickname] = [t1].[Nickname]) AND ([t0].[DefeatedBySquadId] = [t1].[SquadId]) -WHERE ([l].[Id] IS NOT NULL AND ([t].[HasSoulPatch] = CAST(1 AS bit))) AND (([t1].[Nickname] = [t].[Nickname]) AND ([t1].[SquadId] = [t].[SquadId]))"); +WHERE (([l].[Id] IS NOT NULL) AND ([t].[HasSoulPatch] = CAST(1 AS bit))) AND (([t1].[Nickname] = [t].[Nickname]) AND ([t1].[SquadId] = [t].[SquadId]))"); } public override async Task Comparing_entities_using_Equals_inheritance(bool async) @@ -3863,7 +3863,7 @@ END AS [Discriminator] FROM [Gears] AS [g] LEFT JOIN [Officers] AS [o] ON ([g].[Nickname] = [o].[Nickname]) AND ([g].[SquadId] = [o].[SquadId]) LEFT JOIN [Cities] AS [c] ON [g].[AssignedCityName] = [c].[Name] -WHERE ([g].[SquadId] < 2) AND (([c].[Name] = N'Ephyra') OR [c].[Name] IS NULL)"); +WHERE ([g].[SquadId] < 2) AND (([c].[Name] = N'Ephyra') OR ([c].[Name] IS NULL))"); } public override async Task Optional_navigation_with_collection_composite_key(bool async) @@ -3884,7 +3884,7 @@ LEFT JOIN [Officers] AS [o] ON ([g].[Nickname] = [o].[Nickname]) AND ([g].[Squad SELECT COUNT(*) FROM [Gears] AS [g0] LEFT JOIN [Officers] AS [o0] ON ([g0].[Nickname] = [o0].[Nickname]) AND ([g0].[SquadId] = [o0].[SquadId]) - WHERE (([t0].[Nickname] IS NOT NULL AND [t0].[SquadId] IS NOT NULL) AND (([t0].[Nickname] = [g0].[LeaderNickname]) AND ([t0].[SquadId] = [g0].[LeaderSquadId]))) AND ([g0].[Nickname] = N'Dom')) > 0)"); + WHERE ((([t0].[Nickname] IS NOT NULL) AND ([t0].[SquadId] IS NOT NULL)) AND (([t0].[Nickname] = [g0].[LeaderNickname]) AND ([t0].[SquadId] = [g0].[LeaderSquadId]))) AND ([g0].[Nickname] = N'Dom')) > 0)"); } public override async Task Select_null_conditional_with_inheritance(bool async) @@ -3967,7 +3967,7 @@ WHEN [o0].[Nickname] IS NOT NULL THEN N'Officer' END AS [Discriminator] FROM [Gears] AS [g0] LEFT JOIN [Officers] AS [o0] ON ([g0].[Nickname] = [o0].[Nickname]) AND ([g0].[SquadId] = [o0].[SquadId]) -) AS [t1] ON (([t0].[Nickname] = [t1].[LeaderNickname]) OR ([t0].[Nickname] IS NULL AND [t1].[LeaderNickname] IS NULL)) AND ([t0].[SquadId] = [t1].[LeaderSquadId]) +) AS [t1] ON (([t0].[Nickname] = [t1].[LeaderNickname]) OR (([t0].[Nickname] IS NULL) AND ([t1].[LeaderNickname] IS NULL))) AND ([t0].[SquadId] = [t1].[LeaderSquadId]) WHERE [l].[Id] IS NOT NULL ORDER BY [f].[Id], [t].[Name], [t0].[Nickname], [t0].[SquadId], [t1].[Nickname]"); } @@ -3995,7 +3995,7 @@ WHEN [o0].[Nickname] IS NOT NULL THEN N'Officer' END AS [Discriminator] FROM [Gears] AS [g0] LEFT JOIN [Officers] AS [o0] ON ([g0].[Nickname] = [o0].[Nickname]) AND ([g0].[SquadId] = [o0].[SquadId]) -) AS [t1] ON (([t0].[Nickname] = [t1].[LeaderNickname]) OR ([t0].[Nickname] IS NULL AND [t1].[LeaderNickname] IS NULL)) AND ([t0].[SquadId] = [t1].[LeaderSquadId]) +) AS [t1] ON (([t0].[Nickname] = [t1].[LeaderNickname]) OR (([t0].[Nickname] IS NULL) AND ([t1].[LeaderNickname] IS NULL))) AND ([t0].[SquadId] = [t1].[LeaderSquadId]) WHERE [l].[Id] IS NOT NULL ORDER BY [f].[Id], [t].[Name], [t0].[Nickname], [t0].[SquadId], [t1].[Nickname]"); } @@ -4063,7 +4063,7 @@ WHEN [o0].[Nickname] IS NOT NULL THEN N'Officer' FROM [Gears] AS [g0] LEFT JOIN [Officers] AS [o0] ON ([g0].[Nickname] = [o0].[Nickname]) AND ([g0].[SquadId] = [o0].[SquadId]) INNER JOIN [Cities] AS [c] ON [g0].[CityOfBirthName] = [c].[Name] -) AS [t0] ON (([t].[Nickname] = [t0].[LeaderNickname]) OR ([t].[Nickname] IS NULL AND [t0].[LeaderNickname] IS NULL)) AND ([t].[SquadId] = [t0].[LeaderSquadId]) +) AS [t0] ON (([t].[Nickname] = [t0].[LeaderNickname]) OR (([t].[Nickname] IS NULL) AND ([t0].[LeaderNickname] IS NULL))) AND ([t].[SquadId] = [t0].[LeaderSquadId]) ORDER BY [l].[Name], [t].[Nickname], [t].[SquadId], [t0].[Nickname], [t0].[SquadId]"); } @@ -4245,7 +4245,7 @@ WHEN [o0].[Nickname] IS NOT NULL THEN N'Officer' END AS [Discriminator] FROM [Gears] AS [g0] LEFT JOIN [Officers] AS [o0] ON ([g0].[Nickname] = [o0].[Nickname]) AND ([g0].[SquadId] = [o0].[SquadId]) -) AS [t1] ON (([t0].[Nickname] = [t1].[LeaderNickname]) OR ([t0].[Nickname] IS NULL AND [t1].[LeaderNickname] IS NULL)) AND ([t0].[SquadId] = [t1].[LeaderSquadId]) +) AS [t1] ON (([t0].[Nickname] = [t1].[LeaderNickname]) OR (([t0].[Nickname] IS NULL) AND ([t1].[LeaderNickname] IS NULL))) AND ([t0].[SquadId] = [t1].[LeaderSquadId]) ORDER BY [f].[Id], [t].[Name], [t0].[Nickname], [t0].[SquadId], [t1].[Nickname]"); } @@ -4331,7 +4331,7 @@ WHEN [o0].[Nickname] IS NOT NULL THEN N'Officer' END AS [Discriminator] FROM [Gears] AS [g0] LEFT JOIN [Officers] AS [o0] ON ([g0].[Nickname] = [o0].[Nickname]) AND ([g0].[SquadId] = [o0].[SquadId]) -) AS [t1] ON (([t0].[Nickname] = [t1].[LeaderNickname]) OR ([t0].[Nickname] IS NULL AND [t1].[LeaderNickname] IS NULL)) AND ([t0].[SquadId] = [t1].[LeaderSquadId]) +) AS [t1] ON (([t0].[Nickname] = [t1].[LeaderNickname]) OR (([t0].[Nickname] IS NULL) AND ([t1].[LeaderNickname] IS NULL))) AND ([t0].[SquadId] = [t1].[LeaderSquadId]) ORDER BY [f].[Id], [t].[Name], [t0].[Nickname], [t0].[SquadId], [t1].[Nickname]"); } @@ -4363,7 +4363,7 @@ public override async Task Projecting_nullable_bool_in_conditional_works(bool as AssertSql( @"SELECT CASE - WHEN [t0].[Nickname] IS NOT NULL AND [t0].[SquadId] IS NOT NULL THEN [t0].[HasSoulPatch] + WHEN ([t0].[Nickname] IS NOT NULL) AND ([t0].[SquadId] IS NOT NULL) THEN [t0].[HasSoulPatch] ELSE CAST(0 AS bit) END AS [Prop] FROM [Tags] AS [t] @@ -4431,7 +4431,7 @@ FROM [Gears] AS [g] LEFT JOIN ( SELECT [w].[Id], [w].[AmmunitionType], [w].[IsAutomatic], [w].[Name], [w].[OwnerFullName], [w].[SynergyWithId] FROM [Weapons] AS [w] - WHERE ([w].[IsAutomatic] = CAST(1 AS bit)) OR (([w].[Name] <> N'foo') OR [w].[Name] IS NULL) + WHERE ([w].[IsAutomatic] = CAST(1 AS bit)) OR (([w].[Name] <> N'foo') OR ([w].[Name] IS NULL)) ) AS [t] ON [g].[FullName] = [t].[OwnerFullName] WHERE [g].[Nickname] <> N'Marcus' ORDER BY [g].[Nickname], [g].[SquadId]"); @@ -4447,7 +4447,7 @@ FROM [Gears] AS [g] LEFT JOIN ( SELECT [w].[Id], [w].[AmmunitionType], [w].[IsAutomatic], [w].[Name], [w].[OwnerFullName], [w].[SynergyWithId] FROM [Weapons] AS [w] - WHERE ([w].[IsAutomatic] = CAST(1 AS bit)) OR (([w].[Name] <> N'foo') OR [w].[Name] IS NULL) + WHERE ([w].[IsAutomatic] = CAST(1 AS bit)) OR (([w].[Name] <> N'foo') OR ([w].[Name] IS NULL)) ) AS [t] ON [g].[FullName] = [t].[OwnerFullName] WHERE [g].[Nickname] <> N'Marcus' ORDER BY [g].[Nickname], [g].[SquadId]"); @@ -4463,7 +4463,7 @@ FROM [Gears] AS [g] LEFT JOIN ( SELECT [w].[Id], [w].[AmmunitionType], [w].[IsAutomatic], [w].[Name], [w].[OwnerFullName], [w].[SynergyWithId] FROM [Weapons] AS [w] - WHERE ([w].[IsAutomatic] = CAST(1 AS bit)) OR (([w].[Name] <> N'foo') OR [w].[Name] IS NULL) + WHERE ([w].[IsAutomatic] = CAST(1 AS bit)) OR (([w].[Name] <> N'foo') OR ([w].[Name] IS NULL)) ) AS [t] ON [g].[FullName] = [t].[OwnerFullName] WHERE [g].[Nickname] <> N'Marcus' ORDER BY [g].[Nickname], [g].[SquadId]"); @@ -4479,7 +4479,7 @@ FROM [Gears] AS [g] LEFT JOIN ( SELECT [w].[Id], [w].[AmmunitionType], [w].[IsAutomatic], [w].[Name], [w].[OwnerFullName], [w].[SynergyWithId] FROM [Weapons] AS [w] - WHERE ([w].[IsAutomatic] = CAST(1 AS bit)) OR (([w].[Name] <> N'foo') OR [w].[Name] IS NULL) + WHERE ([w].[IsAutomatic] = CAST(1 AS bit)) OR (([w].[Name] <> N'foo') OR ([w].[Name] IS NULL)) ) AS [t] ON [g].[FullName] = [t].[OwnerFullName] WHERE [g].[Nickname] <> N'Marcus' ORDER BY [g].[Nickname], [g].[SquadId], [t].[Name] DESC"); @@ -4498,7 +4498,7 @@ LEFT JOIN ( FROM [Gears] AS [g0] WHERE [g0].[HasSoulPatch] = CAST(0 AS bit) ) AS [t] ON ([g].[Nickname] = [t].[LeaderNickname]) AND ([g].[SquadId] = [t].[LeaderSquadId]) -WHERE [o].[Nickname] IS NOT NULL AND ([g].[Nickname] <> N'Foo') +WHERE ([o].[Nickname] IS NOT NULL) AND ([g].[Nickname] <> N'Foo') ORDER BY [g].[Nickname], [g].[SquadId], [t].[Nickname]"); } @@ -4512,7 +4512,7 @@ FROM [Gears] AS [g] LEFT JOIN ( SELECT [w].[Name], [w].[Id], [w].[OwnerFullName] FROM [Weapons] AS [w] - WHERE ([w].[IsAutomatic] = CAST(1 AS bit)) OR (([w].[Name] <> N'foo') OR [w].[Name] IS NULL) + WHERE ([w].[IsAutomatic] = CAST(1 AS bit)) OR (([w].[Name] <> N'foo') OR ([w].[Name] IS NULL)) ) AS [t] ON [g].[FullName] = [t].[OwnerFullName] WHERE [g].[Nickname] <> N'Marcus' ORDER BY [g].[Nickname], [g].[SquadId]"); @@ -4528,7 +4528,7 @@ FROM [Gears] AS [g] LEFT JOIN ( SELECT N'BFG' AS [c], [w].[Id], [w].[OwnerFullName] FROM [Weapons] AS [w] - WHERE ([w].[IsAutomatic] = CAST(1 AS bit)) OR (([w].[Name] <> N'foo') OR [w].[Name] IS NULL) + WHERE ([w].[IsAutomatic] = CAST(1 AS bit)) OR (([w].[Name] <> N'foo') OR ([w].[Name] IS NULL)) ) AS [t] ON [g].[FullName] = [t].[OwnerFullName] WHERE [g].[Nickname] <> N'Marcus' ORDER BY [g].[Nickname], [g].[SquadId]"); @@ -4544,7 +4544,7 @@ FROM [Gears] AS [g] LEFT JOIN ( SELECT CAST(1 AS bit) AS [c], [w].[Id], [w].[OwnerFullName] FROM [Weapons] AS [w] - WHERE ([w].[IsAutomatic] = CAST(1 AS bit)) OR (([w].[Name] <> N'foo') OR [w].[Name] IS NULL) + WHERE ([w].[IsAutomatic] = CAST(1 AS bit)) OR (([w].[Name] <> N'foo') OR ([w].[Name] IS NULL)) ) AS [t] ON [g].[FullName] = [t].[OwnerFullName] WHERE [g].[Nickname] <> N'Marcus' ORDER BY [g].[Nickname], [g].[SquadId]"); @@ -4659,7 +4659,7 @@ FROM [Gears] AS [g0] LEFT JOIN ( SELECT [w].[Id], [w].[AmmunitionType], [w].[IsAutomatic], [w].[Name], [w].[OwnerFullName], [w].[SynergyWithId] FROM [Weapons] AS [w] - WHERE ([w].[Name] <> N'Bar') OR [w].[Name] IS NULL + WHERE ([w].[Name] <> N'Bar') OR ([w].[Name] IS NULL) ) AS [t] ON [g0].[FullName] = [t].[OwnerFullName] WHERE [g0].[FullName] <> N'Foo' ) AS [t0] ON ([g].[Nickname] = [t0].[LeaderNickname]) AND ([g].[SquadId] = [t0].[LeaderSquadId]) @@ -4737,7 +4737,7 @@ public override async Task Multiple_orderby_with_navigation_expansion_on_one_of_ FROM [Gears] AS [g] LEFT JOIN [Officers] AS [o] ON ([g].[Nickname] = [o].[Nickname]) AND ([g].[SquadId] = [o].[SquadId]) LEFT JOIN [Tags] AS [t] ON ([g].[Nickname] = [t].[GearNickName]) AND ([g].[SquadId] = [t].[GearSquadId]) -WHERE [o].[Nickname] IS NOT NULL AND EXISTS ( +WHERE ([o].[Nickname] IS NOT NULL) AND EXISTS ( SELECT 1 FROM [Gears] AS [g0] LEFT JOIN [Officers] AS [o0] ON ([g0].[Nickname] = [o0].[Nickname]) AND ([g0].[SquadId] = [o0].[SquadId]) @@ -4766,7 +4766,7 @@ LEFT JOIN ( FROM [Gears] AS [g2] ) AS [t2] ON [w].[OwnerFullName] = [t2].[FullName] ) AS [t1] ON [t0].[FullName] = [t1].[OwnerFullName] -WHERE [o].[Nickname] IS NOT NULL AND EXISTS ( +WHERE ([o].[Nickname] IS NOT NULL) AND EXISTS ( SELECT 1 FROM [Gears] AS [g0] LEFT JOIN [Officers] AS [o0] ON ([g0].[Nickname] = [o0].[Nickname]) AND ([g0].[SquadId] = [o0].[SquadId]) @@ -4796,7 +4796,7 @@ LEFT JOIN ( FROM [Gears] AS [g2] ) AS [t2] ON [w].[OwnerFullName] = [t2].[FullName] ) AS [t1] ON [t0].[FullName] = [t1].[OwnerFullName] -WHERE [o].[Nickname] IS NOT NULL AND EXISTS ( +WHERE ([o].[Nickname] IS NOT NULL) AND EXISTS ( SELECT 1 FROM [Gears] AS [g0] LEFT JOIN [Officers] AS [o0] ON ([g0].[Nickname] = [o0].[Nickname]) AND ([g0].[SquadId] = [o0].[SquadId]) @@ -4822,14 +4822,14 @@ LEFT JOIN ( SELECT [w].[Id], [w].[AmmunitionType], [w].[IsAutomatic], [w].[Name], [w].[OwnerFullName], [w].[SynergyWithId], [t2].[Nickname], [t2].[SquadId], ( SELECT COUNT(*) FROM [Weapons] AS [w0] - WHERE [t2].[FullName] IS NOT NULL AND ([t2].[FullName] = [w0].[OwnerFullName])) AS [c] + WHERE ([t2].[FullName] IS NOT NULL) AND ([t2].[FullName] = [w0].[OwnerFullName])) AS [c] FROM [Weapons] AS [w] LEFT JOIN ( SELECT [g2].[Nickname], [g2].[SquadId], [g2].[FullName] FROM [Gears] AS [g2] ) AS [t2] ON [w].[OwnerFullName] = [t2].[FullName] ) AS [t1] ON [t0].[FullName] = [t1].[OwnerFullName] -WHERE [o].[Nickname] IS NOT NULL AND EXISTS ( +WHERE ([o].[Nickname] IS NOT NULL) AND EXISTS ( SELECT 1 FROM [Gears] AS [g0] LEFT JOIN [Officers] AS [o0] ON ([g0].[Nickname] = [o0].[Nickname]) AND ([g0].[SquadId] = [o0].[SquadId]) @@ -4866,7 +4866,7 @@ LEFT JOIN ( SELECT [g4].[Nickname], [g4].[HasSoulPatch], [g4].[SquadId] FROM [Gears] AS [g4] ) AS [t4] ON [s].[Id] = [t4].[SquadId] - WHERE ([w].[Name] <> N'Bar') OR [w].[Name] IS NULL + WHERE ([w].[Name] <> N'Bar') OR ([w].[Name] IS NULL) ) AS [t1] ON [g2].[FullName] = [t1].[OwnerFullName] WHERE [g2].[FullName] <> N'Foo' ) AS [t2] ON ([g].[Nickname] = [t2].[LeaderNickname]) AND ([g].[SquadId] = [t2].[LeaderSquadId]) @@ -4878,7 +4878,7 @@ LEFT JOIN ( FROM [Gears] AS [g5] ) AS [t6] ON [w1].[OwnerFullName] = [t6].[FullName] ) AS [t5] ON [t0].[FullName] = [t5].[OwnerFullName] -WHERE [o].[Nickname] IS NOT NULL AND EXISTS ( +WHERE ([o].[Nickname] IS NOT NULL) AND EXISTS ( SELECT 1 FROM [Gears] AS [g0] LEFT JOIN [Officers] AS [o0] ON ([g0].[Nickname] = [o0].[Nickname]) AND ([g0].[SquadId] = [o0].[SquadId]) @@ -4934,7 +4934,7 @@ FROM [Gears] AS [g0] OUTER APPLY ( SELECT [w].[Name], [g0].[Nickname], [w].[Id] FROM [Weapons] AS [w] - WHERE (([w].[Name] <> N'Bar') OR [w].[Name] IS NULL) AND ([g0].[FullName] = [w].[OwnerFullName]) + WHERE (([w].[Name] <> N'Bar') OR ([w].[Name] IS NULL)) AND ([g0].[FullName] = [w].[OwnerFullName]) ) AS [t] WHERE [g0].[FullName] <> N'Foo' ) AS [t0] ON ([g].[Nickname] = [t0].[LeaderNickname]) AND ([g].[SquadId] = [t0].[LeaderSquadId]) @@ -4956,7 +4956,7 @@ FROM [Gears] AS [g0] LEFT JOIN ( SELECT [w].[Name], [g].[Nickname], [w].[Id], [w].[OwnerFullName] FROM [Weapons] AS [w] - WHERE ([w].[Name] <> N'Bar') OR [w].[Name] IS NULL + WHERE ([w].[Name] <> N'Bar') OR ([w].[Name] IS NULL) ) AS [t] ON [g0].[FullName] = [t].[OwnerFullName] WHERE ([g0].[FullName] <> N'Foo') AND (([g].[Nickname] = [g0].[LeaderNickname]) AND ([g].[SquadId] = [g0].[LeaderSquadId])) ) AS [t0] @@ -4975,7 +4975,7 @@ CROSS JOIN [Squads] AS [s] LEFT JOIN ( SELECT [w].[Id], [w].[AmmunitionType], [w].[IsAutomatic], [w].[Name], [w].[OwnerFullName], [w].[SynergyWithId] FROM [Weapons] AS [w] - WHERE ([w].[IsAutomatic] = CAST(1 AS bit)) OR (([w].[Name] <> N'foo') OR [w].[Name] IS NULL) + WHERE ([w].[IsAutomatic] = CAST(1 AS bit)) OR (([w].[Name] <> N'foo') OR ([w].[Name] IS NULL)) ) AS [t] ON [g].[FullName] = [t].[OwnerFullName] LEFT JOIN ( SELECT [g0].[Nickname], [g0].[SquadId], [g0].[AssignedCityName], [g0].[CityOfBirthName], [g0].[FullName], [g0].[HasSoulPatch], [g0].[LeaderNickname], [g0].[LeaderSquadId], [g0].[Rank], CASE @@ -5124,7 +5124,7 @@ WHERE [o].[Nickname] IS NOT NULL LEFT JOIN ( SELECT [g0].[FullName], [g0].[Nickname], [g0].[SquadId], [g0].[LeaderNickname], [g0].[LeaderSquadId] FROM [Gears] AS [g0] -) AS [t1] ON (([t0].[Nickname] = [t1].[LeaderNickname]) OR ([t0].[Nickname] IS NULL AND [t1].[LeaderNickname] IS NULL)) AND ([t0].[SquadId] = [t1].[LeaderSquadId]) +) AS [t1] ON (([t0].[Nickname] = [t1].[LeaderNickname]) OR (([t0].[Nickname] IS NULL) AND ([t1].[LeaderNickname] IS NULL))) AND ([t0].[SquadId] = [t1].[LeaderSquadId]) ORDER BY [t].[Id], [t0].[Nickname], [t0].[SquadId], [t1].[Nickname]"); } @@ -5348,7 +5348,7 @@ WHEN [l1].[Id] IS NOT NULL THEN N'LocustHorde' END AS [Discriminator] FROM [Factions] AS [f] LEFT JOIN [LocustHordes] AS [l1] ON [f].[Id] = [l1].[Id] - WHERE [l1].[Id] IS NOT NULL AND ([f].[Name] = N'Swarm') + WHERE ([l1].[Id] IS NOT NULL) AND ([f].[Name] = N'Swarm') ) AS [t] ON [l].[Name] = [t].[CommanderName] WHERE ([t].[Eradicated] <> CAST(1 AS bit)) OR ([t].[Eradicated] IS NULL)"); } @@ -5366,7 +5366,7 @@ WHEN [l1].[Id] IS NOT NULL THEN N'LocustHorde' END AS [Discriminator] FROM [Factions] AS [f] LEFT JOIN [LocustHordes] AS [l1] ON [f].[Id] = [l1].[Id] - WHERE [l1].[Id] IS NOT NULL AND ([f].[Name] = N'Swarm') + WHERE ([l1].[Id] IS NOT NULL) AND ([f].[Name] = N'Swarm') ) AS [t] ON [l].[Name] = [t].[CommanderName] WHERE ([t].[Eradicated] <> CAST(1 AS bit)) OR ([t].[Eradicated] IS NULL)"); } @@ -5392,7 +5392,7 @@ END AS [Discriminator] FROM [Gears] AS [g] LEFT JOIN [Officers] AS [o] ON ([g].[Nickname] = [o].[Nickname]) AND ([g].[SquadId] = [o].[SquadId]) ) AS [t] ON ([l0].[DefeatedByNickname] = [t].[Nickname]) AND ([l0].[DefeatedBySquadId] = [t].[SquadId]) - LEFT JOIN [Tags] AS [t0] ON (([t].[Nickname] = [t0].[GearNickName]) OR ([t].[Nickname] IS NULL AND [t0].[GearNickName] IS NULL)) AND (([t].[SquadId] = [t0].[GearSquadId]) OR ([t].[SquadId] IS NULL AND [t0].[GearSquadId] IS NULL)) + LEFT JOIN [Tags] AS [t0] ON (([t].[Nickname] = [t0].[GearNickName]) OR (([t].[Nickname] IS NULL) AND ([t0].[GearNickName] IS NULL))) AND (([t].[SquadId] = [t0].[GearSquadId]) OR (([t].[SquadId] IS NULL) AND ([t0].[GearSquadId] IS NULL))) ORDER BY [t0].[Note] ) AS [t1] LEFT JOIN [Weapons] AS [w] ON [t1].[FullName] = [w].[OwnerFullName] @@ -6335,7 +6335,7 @@ public override async Task Double_order_by_on_string_compare(bool async) @"SELECT [w].[Id], [w].[AmmunitionType], [w].[IsAutomatic], [w].[Name], [w].[OwnerFullName], [w].[SynergyWithId] FROM [Weapons] AS [w] ORDER BY CASE - WHEN ([w].[Name] = N'Marcus'' Lancer') AND [w].[Name] IS NOT NULL THEN CAST(1 AS bit) + WHEN ([w].[Name] = N'Marcus'' Lancer') AND ([w].[Name] IS NOT NULL) THEN CAST(1 AS bit) ELSE CAST(0 AS bit) END, [w].[Id]"); } @@ -6359,7 +6359,7 @@ public override async Task String_compare_with_null_conditional_argument(bool as FROM [Weapons] AS [w] LEFT JOIN [Weapons] AS [w0] ON [w].[SynergyWithId] = [w0].[Id] ORDER BY CASE - WHEN ([w0].[Name] = N'Marcus'' Lancer') AND [w0].[Name] IS NOT NULL THEN CAST(1 AS bit) + WHEN ([w0].[Name] = N'Marcus'' Lancer') AND ([w0].[Name] IS NOT NULL) THEN CAST(1 AS bit) ELSE CAST(0 AS bit) END"); } @@ -6373,7 +6373,7 @@ public override async Task String_compare_with_null_conditional_argument2(bool a FROM [Weapons] AS [w] LEFT JOIN [Weapons] AS [w0] ON [w].[SynergyWithId] = [w0].[Id] ORDER BY CASE - WHEN (N'Marcus'' Lancer' = [w0].[Name]) AND [w0].[Name] IS NOT NULL THEN CAST(1 AS bit) + WHEN (N'Marcus'' Lancer' = [w0].[Name]) AND ([w0].[Name] IS NOT NULL) THEN CAST(1 AS bit) ELSE CAST(0 AS bit) END"); } @@ -6739,7 +6739,7 @@ LEFT JOIN ( FROM [Gears] AS [g] ) AS [t0] ON ([t].[GearNickName] = [t0].[Nickname]) AND ([t].[GearSquadId] = [t0].[SquadId]) LEFT JOIN [Squads] AS [s] ON [t0].[SquadId] = [s].[Id] -WHERE (SUBSTRING([t].[Note], 0 + 1, CAST(LEN([s].[Name]) AS int)) = [t].[GearNickName]) OR (([t].[Note] IS NULL OR [s].[Name] IS NULL) AND [t].[GearNickName] IS NULL)"); +WHERE (SUBSTRING([t].[Note], 0 + 1, CAST(LEN([s].[Name]) AS int)) = [t].[GearNickName]) OR ((([t].[Note] IS NULL) OR ([s].[Name] IS NULL)) AND ([t].[GearNickName] IS NULL))"); } public override async Task Filter_with_new_Guid(bool async) @@ -6782,7 +6782,7 @@ FROM [Gears] AS [g] LEFT JOIN [Officers] AS [o] ON ([g].[Nickname] = [o].[Nickname]) AND ([g].[SquadId] = [o].[SquadId]) LEFT JOIN [Tags] AS [t] ON ([g].[Nickname] = [t].[GearNickName]) AND ([g].[SquadId] = [t].[GearSquadId]) LEFT JOIN [Tags] AS [t0] ON ([g].[Nickname] = [t0].[GearNickName]) AND ([g].[SquadId] = [t0].[GearSquadId]) -WHERE ((([t].[Note] <> N'Foo') OR [t].[Note] IS NULL) AND [o].[Nickname] IS NOT NULL) AND (([t0].[Note] <> N'Bar') OR [t0].[Note] IS NULL)"); +WHERE ((([t].[Note] <> N'Foo') OR ([t].[Note] IS NULL)) AND ([o].[Nickname] IS NOT NULL)) AND (([t0].[Note] <> N'Bar') OR ([t0].[Note] IS NULL))"); } public override async Task OfTypeNav2(bool async) @@ -6797,7 +6797,7 @@ FROM [Gears] AS [g] LEFT JOIN [Officers] AS [o] ON ([g].[Nickname] = [o].[Nickname]) AND ([g].[SquadId] = [o].[SquadId]) LEFT JOIN [Tags] AS [t] ON ([g].[Nickname] = [t].[GearNickName]) AND ([g].[SquadId] = [t].[GearSquadId]) LEFT JOIN [Cities] AS [c] ON [g].[AssignedCityName] = [c].[Name] -WHERE ((([t].[Note] <> N'Foo') OR [t].[Note] IS NULL) AND [o].[Nickname] IS NOT NULL) AND (([c].[Location] <> 'Bar') OR [c].[Location] IS NULL)"); +WHERE ((([t].[Note] <> N'Foo') OR ([t].[Note] IS NULL)) AND ([o].[Nickname] IS NOT NULL)) AND (([c].[Location] <> 'Bar') OR ([c].[Location] IS NULL))"); } public override async Task OfTypeNav3(bool async) @@ -6813,7 +6813,7 @@ LEFT JOIN [Officers] AS [o] ON ([g].[Nickname] = [o].[Nickname]) AND ([g].[Squad LEFT JOIN [Tags] AS [t] ON ([g].[Nickname] = [t].[GearNickName]) AND ([g].[SquadId] = [t].[GearSquadId]) INNER JOIN [Weapons] AS [w] ON [g].[FullName] = [w].[OwnerFullName] LEFT JOIN [Tags] AS [t0] ON ([g].[Nickname] = [t0].[GearNickName]) AND ([g].[SquadId] = [t0].[GearSquadId]) -WHERE ((([t].[Note] <> N'Foo') OR [t].[Note] IS NULL) AND [o].[Nickname] IS NOT NULL) AND (([t0].[Note] <> N'Bar') OR [t0].[Note] IS NULL)"); +WHERE ((([t].[Note] <> N'Foo') OR ([t].[Note] IS NULL)) AND ([o].[Nickname] IS NOT NULL)) AND (([t0].[Note] <> N'Bar') OR ([t0].[Note] IS NULL))"); } public override void Nav_rewrite_Distinct_with_convert() @@ -6846,7 +6846,7 @@ LEFT JOIN ( FROM [LocustLeaders] AS [l0] INNER JOIN [LocustCommanders] AS [l1] ON [l0].[Name] = [l1].[Name] ) AS [t] ON [l].[CommanderName] = [t].[Name] -WHERE ([c].[Name] <> N'Foo') OR [c].[Name] IS NULL"); +WHERE ([c].[Name] <> N'Foo') OR ([c].[Name] IS NULL)"); } public override async Task Nav_rewrite_with_convert2(bool async) @@ -6865,7 +6865,7 @@ SELECT [l0].[Name] FROM [LocustLeaders] AS [l0] INNER JOIN [LocustCommanders] AS [l1] ON [l0].[Name] = [l1].[Name] ) AS [t] ON [l].[CommanderName] = [t].[Name] -WHERE (([c].[Name] <> N'Foo') OR [c].[Name] IS NULL) AND (([t].[Name] <> N'Bar') OR [t].[Name] IS NULL)"); +WHERE (([c].[Name] <> N'Foo') OR ([c].[Name] IS NULL)) AND (([t].[Name] <> N'Bar') OR ([t].[Name] IS NULL))"); } public override async Task Nav_rewrite_with_convert3(bool async) @@ -6884,7 +6884,7 @@ SELECT [l0].[Name] FROM [LocustLeaders] AS [l0] INNER JOIN [LocustCommanders] AS [l1] ON [l0].[Name] = [l1].[Name] ) AS [t] ON [l].[CommanderName] = [t].[Name] -WHERE (([c].[Name] <> N'Foo') OR [c].[Name] IS NULL) AND (([t].[Name] <> N'Bar') OR [t].[Name] IS NULL)"); +WHERE (([c].[Name] <> N'Foo') OR ([c].[Name] IS NULL)) AND (([t].[Name] <> N'Bar') OR ([t].[Name] IS NULL))"); } public override async Task Where_contains_on_navigation_with_composite_keys(bool async) @@ -6993,7 +6993,7 @@ public override async Task Left_join_projection_using_conditional_tracking(bool AssertSql( @"SELECT CASE - WHEN [t].[Nickname] IS NULL OR [t].[SquadId] IS NULL THEN CAST(1 AS bit) + WHEN ([t].[Nickname] IS NULL) OR ([t].[SquadId] IS NULL) THEN CAST(1 AS bit) ELSE CAST(0 AS bit) END, [g].[Nickname], [g].[SquadId], [g].[AssignedCityName], [g].[CityOfBirthName], [g].[FullName], [g].[HasSoulPatch], [g].[LeaderNickname], [g].[LeaderSquadId], [g].[Rank], CASE WHEN [o].[Nickname] IS NOT NULL THEN N'Officer' @@ -7033,7 +7033,7 @@ FROM [Gears] AS [g0] LEFT JOIN [Officers] AS [o0] ON ([g0].[Nickname] = [o0].[Nickname]) AND ([g0].[SquadId] = [o0].[SquadId]) ) AS [t2] WHERE [t2].[row] <= 50 -) AS [t1] ON (([t0].[Nickname] = [t1].[LeaderNickname]) OR ([t0].[Nickname] IS NULL AND [t1].[LeaderNickname] IS NULL)) AND ([t0].[SquadId] = [t1].[LeaderSquadId]) +) AS [t1] ON (([t0].[Nickname] = [t1].[LeaderNickname]) OR (([t0].[Nickname] IS NULL) AND ([t1].[LeaderNickname] IS NULL))) AND ([t0].[SquadId] = [t1].[LeaderSquadId]) WHERE [t0].[Discriminator] = N'Officer' ORDER BY [t].[Id], [t0].[Nickname], [t0].[SquadId], [t1].[Nickname]"); } @@ -7058,7 +7058,7 @@ WHEN [o0].[Nickname] IS NOT NULL THEN N'Officer' END AS [Discriminator] FROM [Gears] AS [g0] LEFT JOIN [Officers] AS [o0] ON ([g0].[Nickname] = [o0].[Nickname]) AND ([g0].[SquadId] = [o0].[SquadId]) -) AS [t1] ON (([t0].[Nickname] = [t1].[LeaderNickname]) OR ([t0].[Nickname] IS NULL AND [t1].[LeaderNickname] IS NULL)) AND ([t0].[SquadId] = [t1].[LeaderSquadId]) +) AS [t1] ON (([t0].[Nickname] = [t1].[LeaderNickname]) OR (([t0].[Nickname] IS NULL) AND ([t1].[LeaderNickname] IS NULL))) AND ([t0].[SquadId] = [t1].[LeaderSquadId]) WHERE [t0].[Discriminator] = N'Officer' ORDER BY [t].[Id], [t0].[Nickname], [t0].[SquadId], [t1].[Nickname]"); } @@ -7154,7 +7154,7 @@ SELECT [l0].[Name] FROM [LocustLeaders] AS [l0] INNER JOIN [LocustCommanders] AS [l1] ON [l0].[Name] = [l1].[Name] ) AS [t] ON [l].[CommanderName] = [t].[Name] -WHERE [l].[Id] IS NOT NULL AND [t].[Name] IS NOT NULL"); +WHERE ([l].[Id] IS NOT NULL) AND ([t].[Name] IS NOT NULL)"); } public override async Task Navigation_based_on_complex_expression3(bool async) @@ -7290,7 +7290,7 @@ public override async Task Accessing_property_of_optional_navigation_in_child_pr AssertSql( @"SELECT CASE - WHEN [t0].[Nickname] IS NOT NULL AND [t0].[SquadId] IS NOT NULL THEN CAST(1 AS bit) + WHEN ([t0].[Nickname] IS NOT NULL) AND ([t0].[SquadId] IS NOT NULL) THEN CAST(1 AS bit) ELSE CAST(0 AS bit) END, [t].[Id], [t0].[Nickname], [t0].[SquadId], [t1].[Nickname], [t1].[Id], [t1].[SquadId] FROM [Tags] AS [t] @@ -7320,7 +7320,7 @@ WHERE EXISTS ( SELECT 1 FROM [Gears] AS [g] LEFT JOIN [Officers] AS [o] ON ([g].[Nickname] = [o].[Nickname]) AND ([g].[SquadId] = [o].[SquadId]) - WHERE (([c].[Name] = [g].[CityOfBirthName]) AND [o].[Nickname] IS NOT NULL) AND ([g].[Nickname] = N'Marcus'))"); + WHERE (([c].[Name] = [g].[CityOfBirthName]) AND ([o].[Nickname] IS NOT NULL)) AND ([g].[Nickname] = N'Marcus'))"); } public override async Task Query_reusing_parameter_doesnt_declare_duplicate_parameter(bool async) @@ -7653,12 +7653,12 @@ SELECT TOP(1) [c0].[Name] FROM [Gears] AS [g] LEFT JOIN [Officers] AS [o] ON ([g].[Nickname] = [o].[Nickname]) AND ([g].[SquadId] = [o].[SquadId]) INNER JOIN [Cities] AS [c0] ON [g].[CityOfBirthName] = [c0].[Name] - ORDER BY [g].[Nickname])) OR ([c].[Name] IS NULL AND ( + ORDER BY [g].[Nickname])) OR (([c].[Name] IS NULL) AND (( SELECT TOP(1) [c0].[Name] FROM [Gears] AS [g] LEFT JOIN [Officers] AS [o] ON ([g].[Nickname] = [o].[Nickname]) AND ([g].[SquadId] = [o].[SquadId]) INNER JOIN [Cities] AS [c0] ON [g].[CityOfBirthName] = [c0].[Name] - ORDER BY [g].[Nickname]) IS NULL)"); + ORDER BY [g].[Nickname]) IS NULL))"); } public override async Task Bitwise_operation_with_non_null_parameter_optimizes_null_checks(bool async) @@ -7716,7 +7716,7 @@ FROM [Weapons] AS [w] SELECT [w].[Id], [w].[AmmunitionType], [w].[IsAutomatic], [w].[Name], [w].[OwnerFullName], [w].[SynergyWithId] FROM [Weapons] AS [w] -WHERE (([w].[AmmunitionType] & @__prm_0) <> 0) OR [w].[AmmunitionType] IS NULL", +WHERE (([w].[AmmunitionType] & @__prm_0) <> 0) OR ([w].[AmmunitionType] IS NULL)", // @"@__prm_0='1' (Nullable = true) @@ -7887,10 +7887,10 @@ WHERE CASE WHEN (( SELECT TOP(1) [w].[Name] FROM [Weapons] AS [w] - WHERE [w].[Id] = [g].[SquadId]) = @__prm2_1) AND ( + WHERE [w].[Id] = [g].[SquadId]) = @__prm2_1) AND (( SELECT TOP(1) [w].[Name] FROM [Weapons] AS [w] - WHERE [w].[Id] = [g].[SquadId]) IS NOT NULL THEN CAST(1 AS bit) + WHERE [w].[Id] = [g].[SquadId]) IS NOT NULL) THEN CAST(1 AS bit) ELSE CAST(0 AS bit) END ELSE CAST(0 AS bit) @@ -8121,7 +8121,7 @@ WHERE EXISTS ( SELECT 1 FROM [LocustLeaders] AS [l1] LEFT JOIN [LocustCommanders] AS [l2] ON [l1].[Name] = [l2].[Name] - WHERE ([l1].[ThreatLevelNullableByte] = [l].[ThreatLevelNullableByte]) OR ([l1].[ThreatLevelNullableByte] IS NULL AND [l].[ThreatLevelNullableByte] IS NULL))"); + WHERE ([l1].[ThreatLevelNullableByte] = [l].[ThreatLevelNullableByte]) OR (([l1].[ThreatLevelNullableByte] IS NULL) AND ([l].[ThreatLevelNullableByte] IS NULL)))"); } public override async Task Contains_on_collection_of_nullable_byte_subquery_null_constant(bool async) @@ -8236,7 +8236,7 @@ WHERE EXISTS ( SELECT 1 FROM [LocustLeaders] AS [l1] LEFT JOIN [LocustCommanders] AS [l2] ON [l1].[Name] = [l2].[Name] - WHERE ([l1].[ThreatLevelNullableByte] = [l].[ThreatLevelNullableByte]) OR ([l1].[ThreatLevelNullableByte] IS NULL AND [l].[ThreatLevelNullableByte] IS NULL)) + WHERE ([l1].[ThreatLevelNullableByte] = [l].[ThreatLevelNullableByte]) OR (([l1].[ThreatLevelNullableByte] IS NULL) AND ([l].[ThreatLevelNullableByte] IS NULL))) ) AS [t]"); } @@ -8257,7 +8257,7 @@ WHERE NOT (EXISTS ( SELECT 1 FROM [LocustLeaders] AS [l1] LEFT JOIN [LocustCommanders] AS [l2] ON [l1].[Name] = [l2].[Name] - WHERE ([l1].[ThreatLevelNullableByte] = [l].[ThreatLevelNullableByte]) OR ([l1].[ThreatLevelNullableByte] IS NULL AND [l].[ThreatLevelNullableByte] IS NULL))) + WHERE ([l1].[ThreatLevelNullableByte] = [l].[ThreatLevelNullableByte]) OR (([l1].[ThreatLevelNullableByte] IS NULL) AND ([l].[ThreatLevelNullableByte] IS NULL)))) ) AS [t]"); } @@ -8323,7 +8323,7 @@ public override async Task Enum_array_contains(bool async) @"SELECT [w].[Id], [w].[AmmunitionType], [w].[IsAutomatic], [w].[Name], [w].[OwnerFullName], [w].[SynergyWithId] FROM [Weapons] AS [w] LEFT JOIN [Weapons] AS [w0] ON [w].[SynergyWithId] = [w0].[Id] -WHERE [w0].[Id] IS NOT NULL AND (([w0].[AmmunitionType] = 1) OR [w0].[AmmunitionType] IS NULL)"); +WHERE ([w0].[Id] IS NOT NULL) AND (([w0].[AmmunitionType] = 1) OR ([w0].[AmmunitionType] IS NULL))"); } [ConditionalTheory] @@ -8385,7 +8385,7 @@ WHEN [o].[Nickname] IS NOT NULL THEN N'Officer' END AS [Discriminator], [w].[Id], [w].[AmmunitionType], [w].[IsAutomatic], [w].[Name], [w].[OwnerFullName], [w].[SynergyWithId] FROM [Gears] AS [g] LEFT JOIN [Officers] AS [o] ON ([g].[Nickname] = [o].[Nickname]) AND ([g].[SquadId] = [o].[SquadId]) -INNER JOIN [Weapons] AS [w] ON ([g].[FullName] <> [w].[OwnerFullName]) OR [w].[OwnerFullName] IS NULL +INNER JOIN [Weapons] AS [w] ON ([g].[FullName] <> [w].[OwnerFullName]) OR ([w].[OwnerFullName] IS NULL) ORDER BY [g].[Nickname], [w].[Id]"); } @@ -8399,7 +8399,7 @@ WHEN [o].[Nickname] IS NOT NULL THEN N'Officer' END AS [Discriminator], [w].[Id], [w].[AmmunitionType], [w].[IsAutomatic], [w].[Name], [w].[OwnerFullName], [w].[SynergyWithId] FROM [Gears] AS [g] LEFT JOIN [Officers] AS [o] ON ([g].[Nickname] = [o].[Nickname]) AND ([g].[SquadId] = [o].[SquadId]) -LEFT JOIN [Weapons] AS [w] ON ([g].[FullName] <> [w].[OwnerFullName]) OR [w].[OwnerFullName] IS NULL +LEFT JOIN [Weapons] AS [w] ON ([g].[FullName] <> [w].[OwnerFullName]) OR ([w].[OwnerFullName] IS NULL) ORDER BY [g].[Nickname], [w].[Id]"); } @@ -8418,7 +8418,7 @@ LEFT JOIN ( SELECT [w0].[Id], [w0].[AmmunitionType], [w0].[IsAutomatic], [w0].[Name], [w0].[OwnerFullName], [w0].[SynergyWithId] FROM [Weapons] AS [w] LEFT JOIN [Weapons] AS [w0] ON [w].[SynergyWithId] = [w0].[Id] -) AS [t] ON ([g].[FullName] <> [t].[OwnerFullName]) OR [t].[OwnerFullName] IS NULL +) AS [t] ON ([g].[FullName] <> [t].[OwnerFullName]) OR ([t].[OwnerFullName] IS NULL) ORDER BY [g].[Nickname], [t].[Id]"); } @@ -8429,7 +8429,7 @@ public override async Task SelectMany_without_result_selector_and_non_equality_c AssertSql( @"SELECT [w].[Id], [w].[AmmunitionType], [w].[IsAutomatic], [w].[Name], [w].[OwnerFullName], [w].[SynergyWithId] FROM [Gears] AS [g] -LEFT JOIN [Weapons] AS [w] ON ([g].[FullName] <> [w].[OwnerFullName]) OR [w].[OwnerFullName] IS NULL"); +LEFT JOIN [Weapons] AS [w] ON ([g].[FullName] <> [w].[OwnerFullName]) OR ([w].[OwnerFullName] IS NULL)"); } public override async Task Filtered_collection_projection_with_order_comparison_predicate_converted_to_join(bool async) @@ -8478,7 +8478,7 @@ LEFT JOIN [Officers] AS [o] ON ([g].[Nickname] = [o].[Nickname]) AND ([g].[Squad CROSS APPLY ( SELECT TOP(3) [w].[Id], [w].[AmmunitionType], [w].[IsAutomatic], [w].[Name], [w].[OwnerFullName], [w].[SynergyWithId] FROM [Weapons] AS [w] - WHERE ([w].[OwnerFullName] <> [g].[FullName]) OR [w].[OwnerFullName] IS NULL + WHERE ([w].[OwnerFullName] <> [g].[FullName]) OR ([w].[OwnerFullName] IS NULL) ORDER BY [w].[Id] ) AS [t] ORDER BY [g].[Nickname], [t].[Id]"); @@ -8525,14 +8525,14 @@ WHEN [l0].[Name] IS NOT NULL THEN N'LocustCommander' END AS [Discriminator] FROM [LocustLeaders] AS [l] LEFT JOIN [LocustCommanders] AS [l0] ON [l].[Name] = [l0].[Name] -WHERE [l0].[Name] IS NOT NULL AND (([l0].[HighCommandId] <> 0) OR [l0].[HighCommandId] IS NULL)", +WHERE ([l0].[Name] IS NOT NULL) AND (([l0].[HighCommandId] <> 0) OR ([l0].[HighCommandId] IS NULL))", // @"SELECT [l].[Name], [l].[LocustHordeId], [l].[ThreatLevel], [l].[ThreatLevelByte], [l].[ThreatLevelNullableByte], [l0].[DefeatedByNickname], [l0].[DefeatedBySquadId], [l0].[HighCommandId], CASE WHEN [l0].[Name] IS NOT NULL THEN N'LocustCommander' END AS [Discriminator] FROM [LocustLeaders] AS [l] LEFT JOIN [LocustCommanders] AS [l0] ON [l].[Name] = [l0].[Name] -WHERE [l0].[Name] IS NOT NULL AND (([l0].[HighCommandId] <> 0) OR [l0].[HighCommandId] IS NULL)"); +WHERE ([l0].[Name] IS NOT NULL) AND (([l0].[HighCommandId] <> 0) OR ([l0].[HighCommandId] IS NULL))"); } public override async Task Cast_to_derived_followed_by_include_and_FirstOrDefault(bool async) @@ -8657,7 +8657,7 @@ LEFT JOIN ( SELECT [g].[Nickname], [g].[SquadId] FROM [Gears] AS [g] ) AS [t] ON ([l0].[DefeatedByNickname] = [t].[Nickname]) AND ([l0].[DefeatedBySquadId] = [t].[SquadId]) -WHERE [l0].[Name] IS NOT NULL AND ([t].[Nickname] IS NULL OR [t].[SquadId] IS NULL)"); +WHERE ([l0].[Name] IS NOT NULL) AND (([t].[Nickname] IS NULL) OR ([t].[SquadId] IS NULL))"); } public override async Task Composite_key_entity_not_equal_null(bool async) @@ -8674,7 +8674,7 @@ LEFT JOIN ( SELECT [g].[Nickname], [g].[SquadId] FROM [Gears] AS [g] ) AS [t] ON ([l0].[DefeatedByNickname] = [t].[Nickname]) AND ([l0].[DefeatedBySquadId] = [t].[SquadId]) -WHERE [l0].[Name] IS NOT NULL AND ([t].[Nickname] IS NOT NULL AND [t].[SquadId] IS NOT NULL)"); +WHERE ([l0].[Name] IS NOT NULL) AND (([t].[Nickname] IS NOT NULL) AND ([t].[SquadId] IS NOT NULL))"); } public override async Task Projecting_property_converted_to_nullable_with_comparison(bool async) @@ -8743,7 +8743,7 @@ public override async Task Projecting_property_converted_to_nullable_with_condit AssertSql( @"SELECT CASE - WHEN ([t].[Note] <> N'K.I.A.') OR [t].[Note] IS NULL THEN CASE + WHEN ([t].[Note] <> N'K.I.A.') OR ([t].[Note] IS NULL) THEN CASE WHEN [t].[GearNickName] IS NOT NULL THEN [t0].[SquadId] ELSE NULL END @@ -8878,10 +8878,10 @@ LEFT JOIN ( SELECT [g].[Nickname], [g].[SquadId], [g].[HasSoulPatch] FROM [Gears] AS [g] ) AS [t0] ON ([t].[GearNickName] = [t0].[Nickname]) AND ([t].[GearSquadId] = [t0].[SquadId]) -WHERE CASE +WHERE (CASE WHEN [t].[GearNickName] IS NOT NULL THEN [t0].[Nickname] ELSE NULL -END IS NOT NULL AND (CASE +END IS NOT NULL) AND (CASE WHEN [t].[GearNickName] IS NOT NULL THEN [t0].[HasSoulPatch] ELSE NULL END = CAST(0 AS bit)) @@ -8896,7 +8896,7 @@ public override async Task Projecting_property_converted_to_nullable_into_member @"SELECT [g].[Nickname] FROM [Gears] AS [g] LEFT JOIN [Tags] AS [t] ON ([g].[Nickname] = [t].[GearNickName]) AND ([g].[SquadId] = [t].[GearSquadId]) -WHERE (DATEPART(month, [t].[IssueDate]) <> 5) OR [t].[IssueDate] IS NULL +WHERE (DATEPART(month, [t].[IssueDate]) <> 5) OR ([t].[IssueDate] IS NULL) ORDER BY [g].[Nickname]"); } @@ -9109,7 +9109,7 @@ public override async Task Project_navigation_defined_on_derived_from_entity_wit @"SELECT [l].[Name], [l].[LocustHordeId], [l].[ThreatLevel], [l].[ThreatLevelByte], [l].[ThreatLevelNullableByte], [l0].[DefeatedByNickname], [l0].[DefeatedBySquadId], [l0].[HighCommandId], CASE WHEN [l0].[Name] IS NOT NULL THEN N'LocustCommander' END AS [Discriminator], [t].[Nickname], [t].[SquadId], [t].[AssignedCityName], [t].[CityOfBirthName], [t].[FullName], [t].[HasSoulPatch], [t].[LeaderNickname], [t].[LeaderSquadId], [t].[Rank], [t].[Discriminator], CASE - WHEN [t].[Nickname] IS NULL OR [t].[SquadId] IS NULL THEN CAST(1 AS bit) + WHEN ([t].[Nickname] IS NULL) OR ([t].[SquadId] IS NULL) THEN CAST(1 AS bit) ELSE CAST(0 AS bit) END AS [IsNull], [t0].[Id], [t0].[CapitalName], [t0].[Name], [t0].[ServerAddress], [t0].[CommanderName], [t0].[Eradicated], CASE WHEN [t0].[Id] IS NULL THEN CAST(1 AS bit) diff --git a/test/EFCore.SqlServer.FunctionalTests/Query/TPTInheritanceQuerySqlServerTest.cs b/test/EFCore.SqlServer.FunctionalTests/Query/TPTInheritanceQuerySqlServerTest.cs index d4ae1108a58..ca7ba57e2f6 100644 --- a/test/EFCore.SqlServer.FunctionalTests/Query/TPTInheritanceQuerySqlServerTest.cs +++ b/test/EFCore.SqlServer.FunctionalTests/Query/TPTInheritanceQuerySqlServerTest.cs @@ -352,7 +352,7 @@ FROM [Animals] AS [a] LEFT JOIN [Birds] AS [b] ON [a].[Species] = [b].[Species] LEFT JOIN [Eagle] AS [e] ON [a].[Species] = [e].[Species] LEFT JOIN [Kiwi] AS [k] ON [a].[Species] = [k].[Species] -WHERE [k].[Species] IS NOT NULL AND ([a].[CountryId] = 1)"); +WHERE ([k].[Species] IS NOT NULL) AND ([a].[CountryId] = 1)"); } public override async Task Can_use_of_type_animal(bool async) @@ -384,7 +384,7 @@ FROM [Animals] AS [a] LEFT JOIN [Birds] AS [b] ON [a].[Species] = [b].[Species] LEFT JOIN [Eagle] AS [e] ON [a].[Species] = [e].[Species] LEFT JOIN [Kiwi] AS [k] ON [a].[Species] = [k].[Species] -WHERE [k].[Species] IS NOT NULL OR [e].[Species] IS NOT NULL +WHERE ([k].[Species] IS NOT NULL) OR ([e].[Species] IS NOT NULL) ORDER BY [a].[Species]"); } @@ -401,7 +401,7 @@ FROM [Animals] AS [a] LEFT JOIN [Birds] AS [b] ON [a].[Species] = [b].[Species] LEFT JOIN [Eagle] AS [e] ON [a].[Species] = [e].[Species] LEFT JOIN [Kiwi] AS [k] ON [a].[Species] = [k].[Species] -WHERE [k].[Species] IS NOT NULL OR [e].[Species] IS NOT NULL +WHERE ([k].[Species] IS NOT NULL) OR ([e].[Species] IS NOT NULL) ORDER BY [a].[Species]"); } @@ -418,7 +418,7 @@ FROM [Animals] AS [a] LEFT JOIN [Birds] AS [b] ON [a].[Species] = [b].[Species] LEFT JOIN [Eagle] AS [e] ON [a].[Species] = [e].[Species] LEFT JOIN [Kiwi] AS [k] ON [a].[Species] = [k].[Species] -WHERE ([a].[CountryId] = 1) AND ([k].[Species] IS NOT NULL OR [e].[Species] IS NOT NULL) +WHERE ([a].[CountryId] = 1) AND (([k].[Species] IS NOT NULL) OR ([e].[Species] IS NOT NULL)) ORDER BY [a].[Species]"); } @@ -432,7 +432,7 @@ FROM [Animals] AS [a] LEFT JOIN [Birds] AS [b] ON [a].[Species] = [b].[Species] LEFT JOIN [Eagle] AS [e] ON [a].[Species] = [e].[Species] LEFT JOIN [Kiwi] AS [k] ON [a].[Species] = [k].[Species] -WHERE [k].[Species] IS NOT NULL OR [e].[Species] IS NOT NULL"); +WHERE ([k].[Species] IS NOT NULL) OR ([e].[Species] IS NOT NULL)"); } public override async Task Can_use_of_type_kiwi(bool async) @@ -460,7 +460,7 @@ END AS [Discriminator] FROM [Animals] AS [a] LEFT JOIN [Birds] AS [b] ON [a].[Species] = [b].[Species] LEFT JOIN [Kiwi] AS [k] ON [a].[Species] = [k].[Species] -WHERE [k].[Species] IS NOT NULL AND ([k].[FoundOn] = CAST(0 AS tinyint))"); +WHERE ([k].[Species] IS NOT NULL) AND ([k].[FoundOn] = CAST(0 AS tinyint))"); } public override async Task Can_use_of_type_kiwi_where_south_on_derived_property(bool async) @@ -474,7 +474,7 @@ END AS [Discriminator] FROM [Animals] AS [a] LEFT JOIN [Birds] AS [b] ON [a].[Species] = [b].[Species] LEFT JOIN [Kiwi] AS [k] ON [a].[Species] = [k].[Species] -WHERE [k].[Species] IS NOT NULL AND ([k].[FoundOn] = CAST(1 AS tinyint))"); +WHERE ([k].[Species] IS NOT NULL) AND ([k].[FoundOn] = CAST(1 AS tinyint))"); } public override async Task Can_use_of_type_rose(bool async) diff --git a/test/EFCore.SqlServer.FunctionalTests/Query/TPTManyToManyNoTrackingQuerySqlServerTest.cs b/test/EFCore.SqlServer.FunctionalTests/Query/TPTManyToManyNoTrackingQuerySqlServerTest.cs index 0c5f3047f80..e1c9f0e1750 100644 --- a/test/EFCore.SqlServer.FunctionalTests/Query/TPTManyToManyNoTrackingQuerySqlServerTest.cs +++ b/test/EFCore.SqlServer.FunctionalTests/Query/TPTManyToManyNoTrackingQuerySqlServerTest.cs @@ -107,7 +107,7 @@ FROM [Roots] AS [r] INNER JOIN [Branches] AS [b] ON [r].[Id] = [b].[Id] LEFT JOIN [Leaves] AS [l] ON [r].[Id] = [l].[Id] ) AS [t] ON [j].[EntityBranchId] = [t].[Id] - WHERE ([e].[Id] = [j].[EntityOneId]) AND ([t].[Name] IS NOT NULL AND ([t].[Name] LIKE N'L%'))), [e].[Id]"); + WHERE ([e].[Id] = [j].[EntityOneId]) AND (([t].[Name] IS NOT NULL) AND ([t].[Name] LIKE N'L%'))), [e].[Id]"); } public override async Task Skip_navigation_long_count_without_predicate(bool async) @@ -135,7 +135,7 @@ ORDER BY ( SELECT COUNT_BIG(*) FROM [EntityTwoEntityTwo] AS [e0] INNER JOIN [EntityTwos] AS [e1] ON [e0].[SelfSkipSharedLeftId] = [e1].[Id] - WHERE ([e].[Id] = [e0].[SelfSkipSharedRightId]) AND ([e1].[Name] IS NOT NULL AND ([e1].[Name] LIKE N'L%'))) DESC, [e].[Id]"); + WHERE ([e].[Id] = [e0].[SelfSkipSharedRightId]) AND (([e1].[Name] IS NOT NULL) AND ([e1].[Name] LIKE N'L%'))) DESC, [e].[Id]"); } public override async Task Skip_navigation_select_many_average(bool async) diff --git a/test/EFCore.SqlServer.FunctionalTests/Query/TPTManyToManyQuerySqlServerTest.cs b/test/EFCore.SqlServer.FunctionalTests/Query/TPTManyToManyQuerySqlServerTest.cs index a4d742a5e6e..f2c1c927f12 100644 --- a/test/EFCore.SqlServer.FunctionalTests/Query/TPTManyToManyQuerySqlServerTest.cs +++ b/test/EFCore.SqlServer.FunctionalTests/Query/TPTManyToManyQuerySqlServerTest.cs @@ -106,7 +106,7 @@ FROM [Roots] AS [r] INNER JOIN [Branches] AS [b] ON [r].[Id] = [b].[Id] LEFT JOIN [Leaves] AS [l] ON [r].[Id] = [l].[Id] ) AS [t] ON [j].[EntityBranchId] = [t].[Id] - WHERE ([e].[Id] = [j].[EntityOneId]) AND ([t].[Name] IS NOT NULL AND ([t].[Name] LIKE N'L%'))), [e].[Id]"); + WHERE ([e].[Id] = [j].[EntityOneId]) AND (([t].[Name] IS NOT NULL) AND ([t].[Name] LIKE N'L%'))), [e].[Id]"); } public override async Task Skip_navigation_long_count_without_predicate(bool async) @@ -134,7 +134,7 @@ ORDER BY ( SELECT COUNT_BIG(*) FROM [EntityTwoEntityTwo] AS [e0] INNER JOIN [EntityTwos] AS [e1] ON [e0].[SelfSkipSharedLeftId] = [e1].[Id] - WHERE ([e].[Id] = [e0].[SelfSkipSharedRightId]) AND ([e1].[Name] IS NOT NULL AND ([e1].[Name] LIKE N'L%'))) DESC, [e].[Id]"); + WHERE ([e].[Id] = [e0].[SelfSkipSharedRightId]) AND (([e1].[Name] IS NOT NULL) AND ([e1].[Name] LIKE N'L%'))) DESC, [e].[Id]"); } public override async Task Skip_navigation_select_many_average(bool async) diff --git a/test/EFCore.SqlServer.FunctionalTests/Query/TPTRelationshipsQuerySqlServerTest.cs b/test/EFCore.SqlServer.FunctionalTests/Query/TPTRelationshipsQuerySqlServerTest.cs index abef61d0275..857cf720548 100644 --- a/test/EFCore.SqlServer.FunctionalTests/Query/TPTRelationshipsQuerySqlServerTest.cs +++ b/test/EFCore.SqlServer.FunctionalTests/Query/TPTRelationshipsQuerySqlServerTest.cs @@ -92,7 +92,7 @@ FROM [BaseEntities] AS [b] LEFT JOIN [BaseEntities_OwnedCollectionOnBase] AS [b0] ON [b].[Id] = [b0].[BaseInheritanceRelationshipEntityId] LEFT JOIN [DerivedEntities_OwnedCollectionOnDerived] AS [d0] ON [b].[Id] = [d0].[DerivedInheritanceRelationshipEntityId] LEFT JOIN [CollectionsOnBase] AS [c] ON [b].[Id] = [c].[ParentId] -WHERE ([b].[Name] <> N'Bar') OR [b].[Name] IS NULL +WHERE ([b].[Name] <> N'Bar') OR ([b].[Name] IS NULL) ORDER BY [b].[Id], [b0].[BaseInheritanceRelationshipEntityId], [b0].[Id], [d0].[DerivedInheritanceRelationshipEntityId], [d0].[Id]"); } @@ -112,7 +112,7 @@ FROM [BaseEntities] AS [b] ) AS [t] ON [c].[ParentId] = [t].[Id] LEFT JOIN [BaseEntities_OwnedCollectionOnBase] AS [b0] ON [t].[Id] = [b0].[BaseInheritanceRelationshipEntityId] LEFT JOIN [DerivedEntities_OwnedCollectionOnDerived] AS [d0] ON [t].[Id] = [d0].[DerivedInheritanceRelationshipEntityId] -WHERE ([c].[Name] <> N'Bar') OR [c].[Name] IS NULL +WHERE ([c].[Name] <> N'Bar') OR ([c].[Name] IS NULL) ORDER BY [c].[Id], [t].[Id], [b0].[BaseInheritanceRelationshipEntityId], [b0].[Id], [d0].[DerivedInheritanceRelationshipEntityId]"); } @@ -257,7 +257,7 @@ END AS [Discriminator] FROM [BaseCollectionsOnBase] AS [b1] LEFT JOIN [DerivedCollectionsOnBase] AS [d1] ON [b1].[Id] = [d1].[Id] ) AS [t] ON [b].[Id] = [t].[BaseParentId] -WHERE ([b].[Name] <> N'Bar') OR [b].[Name] IS NULL +WHERE ([b].[Name] <> N'Bar') OR ([b].[Name] IS NULL) ORDER BY [b].[Id], [b0].[BaseInheritanceRelationshipEntityId], [b0].[Id], [d0].[DerivedInheritanceRelationshipEntityId], [d0].[Id]"); } @@ -280,7 +280,7 @@ FROM [BaseEntities] AS [b0] ) AS [t] ON [b].[BaseParentId] = [t].[Id] LEFT JOIN [BaseEntities_OwnedCollectionOnBase] AS [b1] ON [t].[Id] = [b1].[BaseInheritanceRelationshipEntityId] LEFT JOIN [DerivedEntities_OwnedCollectionOnDerived] AS [d1] ON [t].[Id] = [d1].[DerivedInheritanceRelationshipEntityId] -WHERE ([b].[Name] <> N'Bar') OR [b].[Name] IS NULL +WHERE ([b].[Name] <> N'Bar') OR ([b].[Name] IS NULL) ORDER BY [b].[Id], [t].[Id], [b1].[BaseInheritanceRelationshipEntityId], [b1].[Id], [d1].[DerivedInheritanceRelationshipEntityId]"); } @@ -377,7 +377,7 @@ FROM [BaseEntities] AS [b] LEFT JOIN [ReferencesOnBase] AS [r] ON [b].[Id] = [r].[ParentId] LEFT JOIN [BaseEntities_OwnedCollectionOnBase] AS [b0] ON [b].[Id] = [b0].[BaseInheritanceRelationshipEntityId] LEFT JOIN [DerivedEntities_OwnedCollectionOnDerived] AS [d0] ON [b].[Id] = [d0].[DerivedInheritanceRelationshipEntityId] -WHERE ([b].[Name] <> N'Bar') OR [b].[Name] IS NULL +WHERE ([b].[Name] <> N'Bar') OR ([b].[Name] IS NULL) ORDER BY [b].[Id], [r].[Id], [b0].[BaseInheritanceRelationshipEntityId], [b0].[Id], [d0].[DerivedInheritanceRelationshipEntityId]"); } @@ -397,7 +397,7 @@ FROM [BaseEntities] AS [b] ) AS [t] ON [r].[ParentId] = [t].[Id] LEFT JOIN [BaseEntities_OwnedCollectionOnBase] AS [b0] ON [t].[Id] = [b0].[BaseInheritanceRelationshipEntityId] LEFT JOIN [DerivedEntities_OwnedCollectionOnDerived] AS [d0] ON [t].[Id] = [d0].[DerivedInheritanceRelationshipEntityId] -WHERE ([r].[Name] <> N'Bar') OR [r].[Name] IS NULL +WHERE ([r].[Name] <> N'Bar') OR ([r].[Name] IS NULL) ORDER BY [r].[Id], [t].[Id], [b0].[BaseInheritanceRelationshipEntityId], [b0].[Id], [d0].[DerivedInheritanceRelationshipEntityId]"); } @@ -518,7 +518,7 @@ FROM [BaseReferencesOnBase] AS [b0] ) AS [t] ON [b].[Id] = [t].[BaseParentId] LEFT JOIN [BaseEntities_OwnedCollectionOnBase] AS [b1] ON [b].[Id] = [b1].[BaseInheritanceRelationshipEntityId] LEFT JOIN [DerivedEntities_OwnedCollectionOnDerived] AS [d1] ON [b].[Id] = [d1].[DerivedInheritanceRelationshipEntityId] -WHERE ([b].[Name] <> N'Bar') OR [b].[Name] IS NULL +WHERE ([b].[Name] <> N'Bar') OR ([b].[Name] IS NULL) ORDER BY [b].[Id], [t].[Id], [b1].[BaseInheritanceRelationshipEntityId], [b1].[Id], [d1].[DerivedInheritanceRelationshipEntityId]"); } @@ -539,7 +539,7 @@ FROM [BaseReferencesOnDerived] AS [b0] ) AS [t] ON [b].[Id] = [t].[BaseParentId] LEFT JOIN [BaseEntities_OwnedCollectionOnBase] AS [b1] ON [b].[Id] = [b1].[BaseInheritanceRelationshipEntityId] LEFT JOIN [DerivedEntities_OwnedCollectionOnDerived] AS [d1] ON [b].[Id] = [d1].[DerivedInheritanceRelationshipEntityId] -WHERE ([b].[Name] <> N'Bar') OR [b].[Name] IS NULL +WHERE ([b].[Name] <> N'Bar') OR ([b].[Name] IS NULL) ORDER BY [b].[Id], [t].[Id], [b1].[BaseInheritanceRelationshipEntityId], [b1].[Id], [d1].[DerivedInheritanceRelationshipEntityId]"); } @@ -558,7 +558,7 @@ FROM [BaseReferencesOnDerived] AS [b0] ) AS [t] ON [b].[Id] = [t].[DerivedInheritanceRelationshipEntityId] LEFT JOIN [BaseEntities_OwnedCollectionOnBase] AS [b1] ON [b].[Id] = [b1].[BaseInheritanceRelationshipEntityId] LEFT JOIN [DerivedEntities_OwnedCollectionOnDerived] AS [d1] ON [b].[Id] = [d1].[DerivedInheritanceRelationshipEntityId] -WHERE ([b].[Name] <> N'Bar') OR [b].[Name] IS NULL +WHERE ([b].[Name] <> N'Bar') OR ([b].[Name] IS NULL) ORDER BY [b].[Id], [t].[Id], [b1].[BaseInheritanceRelationshipEntityId], [b1].[Id], [d1].[DerivedInheritanceRelationshipEntityId]"); } @@ -579,7 +579,7 @@ FROM [BaseEntities] AS [b0] ) AS [t] ON [b].[BaseParentId] = [t].[Id] LEFT JOIN [BaseEntities_OwnedCollectionOnBase] AS [b1] ON [t].[Id] = [b1].[BaseInheritanceRelationshipEntityId] LEFT JOIN [DerivedEntities_OwnedCollectionOnDerived] AS [d1] ON [t].[Id] = [d1].[DerivedInheritanceRelationshipEntityId] -WHERE ([b].[Name] <> N'Bar') OR [b].[Name] IS NULL +WHERE ([b].[Name] <> N'Bar') OR ([b].[Name] IS NULL) ORDER BY [b].[Id], [t].[Id], [b1].[BaseInheritanceRelationshipEntityId], [b1].[Id], [d1].[DerivedInheritanceRelationshipEntityId]"); } @@ -624,7 +624,7 @@ FROM [BaseReferencesOnBase] AS [b0] ) AS [t] ON [b].[Id] = [t].[BaseParentId] LEFT JOIN [BaseEntities_OwnedCollectionOnBase] AS [b1] ON [b].[Id] = [b1].[BaseInheritanceRelationshipEntityId] LEFT JOIN [DerivedEntities_OwnedCollectionOnDerived] AS [d1] ON [b].[Id] = [d1].[DerivedInheritanceRelationshipEntityId] -WHERE ([b].[Name] <> N'Bar') OR [b].[Name] IS NULL +WHERE ([b].[Name] <> N'Bar') OR ([b].[Name] IS NULL) ORDER BY [b].[Id], [t].[Id], [b1].[BaseInheritanceRelationshipEntityId], [b1].[Id], [d1].[DerivedInheritanceRelationshipEntityId]"); } @@ -647,7 +647,7 @@ FROM [BaseEntities] AS [b0] ) AS [t] ON [b].[BaseParentId] = [t].[Id] LEFT JOIN [BaseEntities_OwnedCollectionOnBase] AS [b1] ON [t].[Id] = [b1].[BaseInheritanceRelationshipEntityId] LEFT JOIN [DerivedEntities_OwnedCollectionOnDerived] AS [d1] ON [t].[Id] = [d1].[DerivedInheritanceRelationshipEntityId] -WHERE ([b].[Name] <> N'Bar') OR [b].[Name] IS NULL +WHERE ([b].[Name] <> N'Bar') OR ([b].[Name] IS NULL) ORDER BY [b].[Id], [t].[Id], [b1].[BaseInheritanceRelationshipEntityId], [b1].[Id], [d1].[DerivedInheritanceRelationshipEntityId]"); } @@ -1116,19 +1116,19 @@ WHEN [d].[Id] IS NOT NULL THEN N'DerivedInheritanceRelationshipEntity' END AS [Discriminator], [b].[OwnedReferenceOnBase_Id], [b].[OwnedReferenceOnBase_Name], [d].[Id], [d].[OwnedReferenceOnDerived_Id], [d].[OwnedReferenceOnDerived_Name] FROM [BaseEntities] AS [b] LEFT JOIN [DerivedEntities] AS [d] ON [b].[Id] = [d].[Id] -WHERE ([b].[Name] <> N'Bar') OR [b].[Name] IS NULL +WHERE ([b].[Name] <> N'Bar') OR ([b].[Name] IS NULL) ORDER BY [b].[Id]", // @"SELECT [b0].[BaseInheritanceRelationshipEntityId], [b0].[Id], [b0].[Name], [b].[Id] FROM [BaseEntities] AS [b] INNER JOIN [BaseEntities_OwnedCollectionOnBase] AS [b0] ON [b].[Id] = [b0].[BaseInheritanceRelationshipEntityId] -WHERE ([b].[Name] <> N'Bar') OR [b].[Name] IS NULL +WHERE ([b].[Name] <> N'Bar') OR ([b].[Name] IS NULL) ORDER BY [b].[Id]", // @"SELECT [d0].[DerivedInheritanceRelationshipEntityId], [d0].[Id], [d0].[Name], [b].[Id] FROM [BaseEntities] AS [b] INNER JOIN [DerivedEntities_OwnedCollectionOnDerived] AS [d0] ON [b].[Id] = [d0].[DerivedInheritanceRelationshipEntityId] -WHERE ([b].[Name] <> N'Bar') OR [b].[Name] IS NULL +WHERE ([b].[Name] <> N'Bar') OR ([b].[Name] IS NULL) ORDER BY [b].[Id]", // @"SELECT [t].[Id], [t].[BaseParentId], [t].[Name], [t].[DerivedProperty], [t].[Discriminator], [b].[Id] @@ -1140,7 +1140,7 @@ END AS [Discriminator] FROM [BaseCollectionsOnBase] AS [b0] LEFT JOIN [DerivedCollectionsOnBase] AS [d0] ON [b0].[Id] = [d0].[Id] ) AS [t] ON [b].[Id] = [t].[BaseParentId] -WHERE ([b].[Name] <> N'Bar') OR [b].[Name] IS NULL +WHERE ([b].[Name] <> N'Bar') OR ([b].[Name] IS NULL) ORDER BY [b].[Id]"); } @@ -1161,7 +1161,7 @@ WHEN [d0].[Id] IS NOT NULL THEN N'DerivedInheritanceRelationshipEntity' FROM [BaseEntities] AS [b0] LEFT JOIN [DerivedEntities] AS [d0] ON [b0].[Id] = [d0].[Id] ) AS [t] ON [b].[BaseParentId] = [t].[Id] -WHERE ([b].[Name] <> N'Bar') OR [b].[Name] IS NULL +WHERE ([b].[Name] <> N'Bar') OR ([b].[Name] IS NULL) ORDER BY [b].[Id], [t].[Id]", // @"SELECT [b1].[BaseInheritanceRelationshipEntityId], [b1].[Id], [b1].[Name], [b].[Id], [t].[Id] @@ -1171,7 +1171,7 @@ SELECT [b0].[Id] FROM [BaseEntities] AS [b0] ) AS [t] ON [b].[BaseParentId] = [t].[Id] INNER JOIN [BaseEntities_OwnedCollectionOnBase] AS [b1] ON [t].[Id] = [b1].[BaseInheritanceRelationshipEntityId] -WHERE ([b].[Name] <> N'Bar') OR [b].[Name] IS NULL +WHERE ([b].[Name] <> N'Bar') OR ([b].[Name] IS NULL) ORDER BY [b].[Id], [t].[Id]", // @"SELECT [d1].[DerivedInheritanceRelationshipEntityId], [d1].[Id], [d1].[Name], [b].[Id], [t].[Id] @@ -1181,7 +1181,7 @@ SELECT [b0].[Id] FROM [BaseEntities] AS [b0] ) AS [t] ON [b].[BaseParentId] = [t].[Id] INNER JOIN [DerivedEntities_OwnedCollectionOnDerived] AS [d1] ON [t].[Id] = [d1].[DerivedInheritanceRelationshipEntityId] -WHERE ([b].[Name] <> N'Bar') OR [b].[Name] IS NULL +WHERE ([b].[Name] <> N'Bar') OR ([b].[Name] IS NULL) ORDER BY [b].[Id], [t].[Id]"); } @@ -1258,25 +1258,25 @@ WHEN [d].[Id] IS NOT NULL THEN N'DerivedInheritanceRelationshipEntity' END AS [Discriminator], [b].[OwnedReferenceOnBase_Id], [b].[OwnedReferenceOnBase_Name], [d].[Id], [d].[OwnedReferenceOnDerived_Id], [d].[OwnedReferenceOnDerived_Name] FROM [BaseEntities] AS [b] LEFT JOIN [DerivedEntities] AS [d] ON [b].[Id] = [d].[Id] -WHERE ([b].[Name] <> N'Bar') OR [b].[Name] IS NULL +WHERE ([b].[Name] <> N'Bar') OR ([b].[Name] IS NULL) ORDER BY [b].[Id]", // @"SELECT [b0].[BaseInheritanceRelationshipEntityId], [b0].[Id], [b0].[Name], [b].[Id] FROM [BaseEntities] AS [b] INNER JOIN [BaseEntities_OwnedCollectionOnBase] AS [b0] ON [b].[Id] = [b0].[BaseInheritanceRelationshipEntityId] -WHERE ([b].[Name] <> N'Bar') OR [b].[Name] IS NULL +WHERE ([b].[Name] <> N'Bar') OR ([b].[Name] IS NULL) ORDER BY [b].[Id]", // @"SELECT [d0].[DerivedInheritanceRelationshipEntityId], [d0].[Id], [d0].[Name], [b].[Id] FROM [BaseEntities] AS [b] INNER JOIN [DerivedEntities_OwnedCollectionOnDerived] AS [d0] ON [b].[Id] = [d0].[DerivedInheritanceRelationshipEntityId] -WHERE ([b].[Name] <> N'Bar') OR [b].[Name] IS NULL +WHERE ([b].[Name] <> N'Bar') OR ([b].[Name] IS NULL) ORDER BY [b].[Id]", // @"SELECT [c].[Id], [c].[Name], [c].[ParentId], [b].[Id] FROM [BaseEntities] AS [b] INNER JOIN [CollectionsOnBase] AS [c] ON [b].[Id] = [c].[ParentId] -WHERE ([b].[Name] <> N'Bar') OR [b].[Name] IS NULL +WHERE ([b].[Name] <> N'Bar') OR ([b].[Name] IS NULL) ORDER BY [b].[Id]"); } @@ -1294,7 +1294,7 @@ WHEN [d].[Id] IS NOT NULL THEN N'DerivedInheritanceRelationshipEntity' FROM [BaseEntities] AS [b] LEFT JOIN [DerivedEntities] AS [d] ON [b].[Id] = [d].[Id] ) AS [t] ON [c].[ParentId] = [t].[Id] -WHERE ([c].[Name] <> N'Bar') OR [c].[Name] IS NULL +WHERE ([c].[Name] <> N'Bar') OR ([c].[Name] IS NULL) ORDER BY [c].[Id], [t].[Id]", // @"SELECT [b0].[BaseInheritanceRelationshipEntityId], [b0].[Id], [b0].[Name], [c].[Id], [t].[Id] @@ -1304,7 +1304,7 @@ SELECT [b].[Id] FROM [BaseEntities] AS [b] ) AS [t] ON [c].[ParentId] = [t].[Id] INNER JOIN [BaseEntities_OwnedCollectionOnBase] AS [b0] ON [t].[Id] = [b0].[BaseInheritanceRelationshipEntityId] -WHERE ([c].[Name] <> N'Bar') OR [c].[Name] IS NULL +WHERE ([c].[Name] <> N'Bar') OR ([c].[Name] IS NULL) ORDER BY [c].[Id], [t].[Id]", // @"SELECT [d0].[DerivedInheritanceRelationshipEntityId], [d0].[Id], [d0].[Name], [c].[Id], [t].[Id] @@ -1314,7 +1314,7 @@ SELECT [b].[Id] FROM [BaseEntities] AS [b] ) AS [t] ON [c].[ParentId] = [t].[Id] INNER JOIN [DerivedEntities_OwnedCollectionOnDerived] AS [d0] ON [t].[Id] = [d0].[DerivedInheritanceRelationshipEntityId] -WHERE ([c].[Name] <> N'Bar') OR [c].[Name] IS NULL +WHERE ([c].[Name] <> N'Bar') OR ([c].[Name] IS NULL) ORDER BY [c].[Id], [t].[Id]"); } diff --git a/test/EFCore.SqlServer.FunctionalTests/Query/TemporalComplexNavigationsCollectionsQuerySqlServerTest.cs b/test/EFCore.SqlServer.FunctionalTests/Query/TemporalComplexNavigationsCollectionsQuerySqlServerTest.cs index b1b953c3ce5..bb594480e4b 100644 --- a/test/EFCore.SqlServer.FunctionalTests/Query/TemporalComplexNavigationsCollectionsQuerySqlServerTest.cs +++ b/test/EFCore.SqlServer.FunctionalTests/Query/TemporalComplexNavigationsCollectionsQuerySqlServerTest.cs @@ -95,7 +95,7 @@ LEFT JOIN ( FROM ( 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], [l0].[PeriodEnd], [l0].[PeriodStart], ROW_NUMBER() OVER(PARTITION BY [l0].[OneToMany_Optional_Inverse2Id] ORDER BY [l0].[Id]) AS [row] FROM [LevelTwo] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l0] - WHERE ([l0].[Name] <> N'Foo') OR [l0].[Name] IS NULL + WHERE ([l0].[Name] <> N'Foo') OR ([l0].[Name] IS NULL) ) AS [t] WHERE [t].[row] <= 3 ) AS [t0] ON [l].[Id] = [t0].[OneToMany_Optional_Inverse2Id] @@ -130,7 +130,7 @@ LEFT JOIN ( SELECT COUNT(*) FROM [LevelTwo] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l0] LEFT JOIN [LevelThree] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l1] ON [l0].[Id] = [l1].[OneToOne_Optional_PK_Inverse3Id] - WHERE ([l].[Id] = [l0].[OneToMany_Optional_Inverse2Id]) AND (([l1].[Name] <> N'Foo') OR [l1].[Name] IS NULL)) > 0 + WHERE ([l].[Id] = [l0].[OneToMany_Optional_Inverse2Id]) AND (([l1].[Name] <> N'Foo') OR ([l1].[Name] IS NULL))) > 0 ORDER BY [l].[Id], [t].[Id], [t].[Id0]"); } @@ -147,7 +147,7 @@ LEFT JOIN ( FROM ( SELECT [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Name], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Optional_Self_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[OneToMany_Required_Self_Inverse3Id], [l1].[OneToOne_Optional_PK_Inverse3Id], [l1].[OneToOne_Optional_Self3Id], [l1].[PeriodEnd], [l1].[PeriodStart], ROW_NUMBER() OVER(PARTITION BY [l1].[OneToMany_Optional_Inverse3Id] ORDER BY [l1].[Name]) AS [row] FROM [LevelThree] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l1] - WHERE ([l1].[Name] <> N'Foo') OR [l1].[Name] IS NULL + WHERE ([l1].[Name] <> N'Foo') OR ([l1].[Name] IS NULL) ) AS [t] WHERE (1 < [t].[row]) AND ([t].[row] <= 4) ) AS [t0] ON [l0].[Id] = [t0].[OneToMany_Optional_Inverse3Id] @@ -246,7 +246,7 @@ LEFT JOIN ( FROM ( SELECT [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Name], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Optional_Self_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[OneToMany_Required_Self_Inverse3Id], [l1].[OneToOne_Optional_PK_Inverse3Id], [l1].[OneToOne_Optional_Self3Id], [l1].[PeriodEnd], [l1].[PeriodStart], ROW_NUMBER() OVER(PARTITION BY [l1].[OneToMany_Optional_Inverse3Id] ORDER BY [l1].[Name]) AS [row] FROM [LevelThree] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l1] - WHERE ([l1].[Name] <> N'Foo') OR [l1].[Name] IS NULL + WHERE ([l1].[Name] <> N'Foo') OR ([l1].[Name] IS NULL) ) AS [t] WHERE (1 < [t].[row]) AND ([t].[row] <= 4) ) AS [t0] ON [l0].[Id] = [t0].[OneToMany_Optional_Inverse3Id] @@ -265,7 +265,7 @@ LEFT JOIN ( FROM ( SELECT 1 AS [c], [l0].[Id], [l0].[OneToMany_Optional_Inverse2Id], ROW_NUMBER() OVER(PARTITION BY [l0].[OneToMany_Optional_Inverse2Id] ORDER BY [l0].[Id]) AS [row] FROM [LevelTwo] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l0] - WHERE ([l0].[Name] <> N'Foo') OR [l0].[Name] IS NULL + WHERE ([l0].[Name] <> N'Foo') OR ([l0].[Name] IS NULL) ) AS [t] WHERE [t].[row] <= 1 ) AS [t0] ON [l].[Id] = [t0].[OneToMany_Optional_Inverse2Id] @@ -329,7 +329,7 @@ OUTER APPLY ( FROM ( SELECT TOP(2) [l2].[Id], [l2].[Date], [l2].[Level1_Optional_Id], [l2].[Level1_Required_Id], [l2].[Name], [l2].[OneToMany_Optional_Inverse2Id], [l2].[OneToMany_Optional_Self_Inverse2Id], [l2].[OneToMany_Required_Inverse2Id], [l2].[OneToMany_Required_Self_Inverse2Id], [l2].[OneToOne_Optional_PK_Inverse2Id], [l2].[OneToOne_Optional_Self2Id], [l2].[PeriodEnd], [l2].[PeriodStart] FROM [LevelTwo] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l2] - WHERE ([l].[Id] = [l2].[OneToMany_Optional_Inverse2Id]) AND (([l2].[Name] <> N'Foo') OR [l2].[Name] IS NULL) + WHERE ([l].[Id] = [l2].[OneToMany_Optional_Inverse2Id]) AND (([l2].[Name] <> N'Foo') OR ([l2].[Name] IS NULL)) ORDER BY [l2].[Id] ) AS [t] LEFT JOIN [LevelThree] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l0] ON [t].[Id] = [l0].[Level2_Required_Id] @@ -347,7 +347,7 @@ public override async Task Include_collection_with_conditional_order_by(bool asy FROM [LevelOne] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l] LEFT JOIN [LevelTwo] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l0] ON [l].[Id] = [l0].[OneToMany_Optional_Inverse2Id] ORDER BY CASE - WHEN [l].[Name] IS NOT NULL AND ([l].[Name] LIKE N'%03') THEN 1 + WHEN ([l].[Name] IS NOT NULL) AND ([l].[Name] LIKE N'%03') THEN 1 ELSE 2 END, [l].[Id]"); } @@ -402,7 +402,7 @@ public override async Task Include_collection_with_groupby_in_subquery_and_filte SELECT [l].[Name] FROM [LevelOne] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l] GROUP BY [l].[Name] - HAVING ([l].[Name] <> N'Foo') OR [l].[Name] IS NULL + HAVING ([l].[Name] <> N'Foo') OR ([l].[Name] IS NULL) ) AS [t] LEFT JOIN ( SELECT [t1].[Id], [t1].[Date], [t1].[Name], [t1].[OneToMany_Optional_Self_Inverse1Id], [t1].[OneToMany_Required_Self_Inverse1Id], [t1].[OneToOne_Optional_Self1Id], [t1].[PeriodEnd], [t1].[PeriodStart] @@ -660,7 +660,7 @@ public override async Task Multiple_include_with_multiple_optional_navigations(b LEFT JOIN [LevelTwo] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l3] ON [l].[Id] = [l3].[Level1_Optional_Id] LEFT JOIN [LevelThree] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l4] ON [l3].[Id] = [l4].[Level2_Optional_Id] LEFT JOIN [LevelThree] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l5] ON [l0].[Id] = [l5].[OneToMany_Optional_Inverse3Id] -WHERE ([l1].[Name] <> N'Foo') OR [l1].[Name] IS NULL +WHERE ([l1].[Name] <> N'Foo') OR ([l1].[Name] IS NULL) ORDER BY [l].[Id], [l0].[Id], [l1].[Id], [l2].[Id], [l3].[Id], [l4].[Id]"); } @@ -789,7 +789,7 @@ LEFT JOIN ( FROM ( 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], [l0].[PeriodEnd], [l0].[PeriodStart], ROW_NUMBER() OVER(PARTITION BY [l0].[OneToMany_Optional_Inverse2Id] ORDER BY [l0].[Id]) AS [row] FROM [LevelTwo] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l0] - WHERE ([l0].[Name] <> @__prm_0) OR [l0].[Name] IS NULL + WHERE ([l0].[Name] <> @__prm_0) OR ([l0].[Name] IS NULL) ) AS [t] WHERE [t].[row] <= 3 ) AS [t0] ON [l].[Id] = [t0].[OneToMany_Optional_Inverse2Id] @@ -866,7 +866,7 @@ LEFT JOIN ( FROM [LevelTwo] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l15] WHERE [l15].[Id] <> 42 ) AS [t1] ON [t].[Id2] = [t1].[OneToMany_Optional_Self_Inverse2Id] -WHERE ([l11].[Name] <> N'Foo') OR [l11].[Name] IS NULL +WHERE ([l11].[Name] <> N'Foo') OR ([l11].[Name] IS NULL) ORDER BY [l12].[Id], [l].[Id], [l0].[Id], [l1].[Id], [l2].[Id], [t].[Id], [t].[Id0], [t].[Id1], [t].[Id2], [t0].[Id], [t0].[Id0], [t0].[Id1], [t0].[Id2], [l11].[Id], [l13].[Id], [l14].[Id]"); } @@ -883,7 +883,7 @@ LEFT JOIN ( FROM [LevelThree] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l1] LEFT JOIN [LevelFour] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l2] ON [l1].[Id] = [l2].[Level3_Required_Id] ) AS [t] ON [l0].[Id] = [t].[OneToMany_Required_Inverse3Id] -WHERE ([l0].[Name] <> N'L2 09') OR [l0].[Name] IS NULL +WHERE ([l0].[Name] <> N'L2 09') OR ([l0].[Name] IS NULL) ORDER BY [l].[Id], [l0].[Id], [t].[Id]"); } @@ -897,7 +897,7 @@ public override async Task Project_collection_navigation_composed(bool async) LEFT JOIN ( 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], [l0].[PeriodEnd], [l0].[PeriodStart] FROM [LevelTwo] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l0] - WHERE ([l0].[Name] <> N'Foo') OR [l0].[Name] IS NULL + WHERE ([l0].[Name] <> N'Foo') OR ([l0].[Name] IS NULL) ) AS [t] ON [l].[Id] = [t].[OneToMany_Optional_Inverse2Id] WHERE [l].[Id] < 3 ORDER BY [l].[Id]"); @@ -1062,7 +1062,7 @@ OUTER APPLY ( FROM ( SELECT TOP(3) [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], [l0].[PeriodEnd], [l0].[PeriodStart] FROM [LevelTwo] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l0] - WHERE ([l].[Id] = [l0].[OneToMany_Optional_Inverse2Id]) AND (([l0].[Name] <> N'Foo') OR [l0].[Name] IS NULL) + WHERE ([l].[Id] = [l0].[OneToMany_Optional_Inverse2Id]) AND (([l0].[Name] <> N'Foo') OR ([l0].[Name] IS NULL)) ORDER BY [l0].[Name] ) AS [t] LEFT JOIN ( @@ -1070,7 +1070,7 @@ LEFT JOIN ( FROM ( SELECT [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Name], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Optional_Self_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[OneToMany_Required_Self_Inverse3Id], [l1].[OneToOne_Optional_PK_Inverse3Id], [l1].[OneToOne_Optional_Self3Id], [l1].[PeriodEnd], [l1].[PeriodStart], ROW_NUMBER() OVER(PARTITION BY [l1].[OneToMany_Required_Inverse3Id] ORDER BY [l1].[Name] DESC) AS [row] FROM [LevelThree] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l1] - WHERE ([l1].[Name] <> N'Bar') OR [l1].[Name] IS NULL + WHERE ([l1].[Name] <> N'Bar') OR ([l1].[Name] IS NULL) ) AS [t1] WHERE 1 < [t1].[row] ) AS [t0] ON [t].[Id] = [t0].[OneToMany_Required_Inverse3Id] @@ -1111,7 +1111,7 @@ LEFT JOIN ( FROM ( SELECT 1 AS [c], [l0].[Id], [l0].[OneToMany_Optional_Inverse2Id], ROW_NUMBER() OVER(PARTITION BY [l0].[OneToMany_Optional_Inverse2Id] ORDER BY [l0].[Id]) AS [row] FROM [LevelTwo] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l0] - WHERE ([l0].[Name] <> N'Foo') OR [l0].[Name] IS NULL + WHERE ([l0].[Name] <> N'Foo') OR ([l0].[Name] IS NULL) ) AS [t] WHERE [t].[row] <= 1 ) AS [t0] ON [l].[Id] = [t0].[OneToMany_Optional_Inverse2Id] @@ -1311,7 +1311,7 @@ OUTER APPLY ( FROM ( SELECT TOP(1) [l1].[Id], [l1].[Date], [l1].[Level1_Optional_Id], [l1].[Level1_Required_Id], [l1].[Name], [l1].[OneToMany_Optional_Inverse2Id], [l1].[OneToMany_Optional_Self_Inverse2Id], [l1].[OneToMany_Required_Inverse2Id], [l1].[OneToMany_Required_Self_Inverse2Id], [l1].[OneToOne_Optional_PK_Inverse2Id], [l1].[OneToOne_Optional_Self2Id], [l1].[PeriodEnd], [l1].[PeriodStart] FROM [LevelTwo] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l1] - WHERE ([l].[Id] = [l1].[OneToMany_Optional_Inverse2Id]) AND (([l1].[Name] <> N'Foo') OR [l1].[Name] IS NULL) + WHERE ([l].[Id] = [l1].[OneToMany_Optional_Inverse2Id]) AND (([l1].[Name] <> N'Foo') OR ([l1].[Name] IS NULL)) ORDER BY [l1].[Id] ) AS [t] LEFT JOIN [LevelThree] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l0] ON [t].[Id] = [l0].[OneToOne_Optional_PK_Inverse3Id] @@ -1369,7 +1369,7 @@ OUTER APPLY ( FROM ( SELECT TOP(1) [l3].[Id], [l3].[Level2_Optional_Id], [l3].[Level2_Required_Id], [l3].[Name], [l3].[OneToMany_Optional_Inverse3Id], [l3].[OneToMany_Optional_Self_Inverse3Id], [l3].[OneToMany_Required_Inverse3Id], [l3].[OneToMany_Required_Self_Inverse3Id], [l3].[OneToOne_Optional_PK_Inverse3Id], [l3].[OneToOne_Optional_Self3Id], [l3].[PeriodEnd], [l3].[PeriodStart] FROM [LevelThree] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l3] - WHERE ([l0].[Id] = [l3].[OneToMany_Optional_Inverse3Id]) AND (([l3].[Name] <> N'Foo') OR [l3].[Name] IS NULL) + WHERE ([l0].[Id] = [l3].[OneToMany_Optional_Inverse3Id]) AND (([l3].[Name] <> N'Foo') OR ([l3].[Name] IS NULL)) ORDER BY [l3].[Id] ) AS [t] LEFT JOIN [LevelFour] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l1] ON [t].[Id] = [l1].[OneToMany_Optional_Inverse4Id] @@ -1681,7 +1681,7 @@ LEFT JOIN ( FROM ( 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], [l0].[PeriodEnd], [l0].[PeriodStart], ROW_NUMBER() OVER(PARTITION BY [l0].[OneToMany_Optional_Inverse2Id] ORDER BY [l0].[Id]) AS [row] FROM [LevelTwo] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l0] - WHERE ([l0].[Name] <> N'Foo') OR [l0].[Name] IS NULL + WHERE ([l0].[Name] <> N'Foo') OR ([l0].[Name] IS NULL) ) AS [t] WHERE [t].[row] <= 3 ) AS [t0] ON [l].[Id] = [t0].[OneToMany_Optional_Inverse2Id] @@ -1723,7 +1723,7 @@ LEFT JOIN ( FROM [LevelTwo] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l15] WHERE [l15].[Id] <> 42 ) AS [t1] ON [t].[Id2] = [t1].[OneToMany_Optional_Self_Inverse2Id] -WHERE ([l11].[Name] <> N'Foo') OR [l11].[Name] IS NULL +WHERE ([l11].[Name] <> N'Foo') OR ([l11].[Name] IS NULL) ORDER BY [l12].[Id], [l].[Id], [l0].[Id], [l1].[Id], [l2].[Id], [t].[Id], [t].[Id0], [t].[Id1], [t].[Id2], [t0].[Id], [t0].[Id0], [t0].[Id1], [t0].[Id2], [l11].[Id], [l13].[Id], [l14].[Id]"); } @@ -1849,7 +1849,7 @@ LEFT JOIN ( FROM ( 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], [l0].[PeriodEnd], [l0].[PeriodStart], ROW_NUMBER() OVER(PARTITION BY [l0].[OneToMany_Optional_Inverse2Id] ORDER BY [l0].[Id] DESC) AS [row] FROM [LevelTwo] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l0] - WHERE ([l0].[Name] <> N'Foo') OR [l0].[Name] IS NULL + WHERE ([l0].[Name] <> N'Foo') OR ([l0].[Name] IS NULL) ) AS [t] WHERE [t].[row] <= 2 ) AS [t0] ON [l].[Id] = [t0].[OneToMany_Optional_Inverse2Id] @@ -2019,7 +2019,7 @@ LEFT JOIN ( FROM ( 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], [l0].[PeriodEnd], [l0].[PeriodStart], ROW_NUMBER() OVER(PARTITION BY [l0].[OneToMany_Optional_Inverse2Id] ORDER BY [l0].[Name]) AS [row] FROM [LevelTwo] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l0] - WHERE ([l0].[Name] <> N'Foo') OR [l0].[Name] IS NULL + WHERE ([l0].[Name] <> N'Foo') OR ([l0].[Name] IS NULL) ) AS [t] WHERE [t].[row] <= 3 ) AS [t0] ON [l].[Id] = [t0].[OneToMany_Optional_Inverse2Id] @@ -2028,7 +2028,7 @@ LEFT JOIN ( FROM ( SELECT [l1].[Id], [l1].[Date], [l1].[Level1_Optional_Id], [l1].[Level1_Required_Id], [l1].[Name], [l1].[OneToMany_Optional_Inverse2Id], [l1].[OneToMany_Optional_Self_Inverse2Id], [l1].[OneToMany_Required_Inverse2Id], [l1].[OneToMany_Required_Self_Inverse2Id], [l1].[OneToOne_Optional_PK_Inverse2Id], [l1].[OneToOne_Optional_Self2Id], [l1].[PeriodEnd], [l1].[PeriodStart], ROW_NUMBER() OVER(PARTITION BY [l1].[OneToMany_Required_Inverse2Id] ORDER BY [l1].[Name] DESC) AS [row] FROM [LevelTwo] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l1] - WHERE ([l1].[Name] <> N'Bar') OR [l1].[Name] IS NULL + WHERE ([l1].[Name] <> N'Bar') OR ([l1].[Name] IS NULL) ) AS [t2] WHERE 1 < [t2].[row] ) AS [t1] ON [l].[Id] = [t1].[OneToMany_Required_Inverse2Id] @@ -2069,7 +2069,7 @@ OUTER APPLY ( FROM ( SELECT [l0].[Date] FROM [LevelOne] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l0] - WHERE ([l0].[Name] = [l].[Name]) OR ([l0].[Name] IS NULL AND [l].[Name] IS NULL) + WHERE ([l0].[Name] = [l].[Name]) OR (([l0].[Name] IS NULL) AND ([l].[Name] IS NULL)) GROUP BY [l0].[Date] ) AS [t] LEFT JOIN ( @@ -2077,7 +2077,7 @@ LEFT JOIN ( FROM ( SELECT [l1].[Id], [l1].[Date], [l1].[Name], [l1].[OneToMany_Optional_Self_Inverse1Id], [l1].[OneToMany_Required_Self_Inverse1Id], [l1].[OneToOne_Optional_Self1Id], [l1].[PeriodEnd], [l1].[PeriodStart], ROW_NUMBER() OVER(PARTITION BY [l1].[Date] ORDER BY [l1].[Name]) AS [row] FROM [LevelOne] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l1] - WHERE ([l1].[Name] = [l].[Name]) OR ([l1].[Name] IS NULL AND [l].[Name] IS NULL) + WHERE ([l1].[Name] = [l].[Name]) OR (([l1].[Name] IS NULL) AND ([l].[Name] IS NULL)) ) AS [t1] WHERE (1 < [t1].[row]) AND ([t1].[row] <= 6) ) AS [t0] ON [t].[Date] = [t0].[Date] @@ -2266,7 +2266,7 @@ OUTER APPLY ( FROM ( SELECT TOP(2) [l2].[Id], [l2].[Date], [l2].[Level1_Optional_Id], [l2].[Level1_Required_Id], [l2].[Name], [l2].[OneToMany_Optional_Inverse2Id], [l2].[OneToMany_Optional_Self_Inverse2Id], [l2].[OneToMany_Required_Inverse2Id], [l2].[OneToMany_Required_Self_Inverse2Id], [l2].[OneToOne_Optional_PK_Inverse2Id], [l2].[OneToOne_Optional_Self2Id], [l2].[PeriodEnd], [l2].[PeriodStart] FROM [LevelTwo] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l2] - WHERE ([l].[Id] = [l2].[OneToMany_Optional_Inverse2Id]) AND (([l2].[Name] <> N'Foo') OR [l2].[Name] IS NULL) + WHERE ([l].[Id] = [l2].[OneToMany_Optional_Inverse2Id]) AND (([l2].[Name] <> N'Foo') OR ([l2].[Name] IS NULL)) ORDER BY [l2].[Id] ) AS [t] LEFT JOIN [LevelThree] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l0] ON [t].[Id] = [l0].[Level2_Required_Id] @@ -2371,7 +2371,7 @@ OUTER APPLY ( FROM ( SELECT TOP(1) [l3].[Id], [l3].[Level2_Optional_Id], [l3].[Level2_Required_Id], [l3].[Name], [l3].[OneToMany_Optional_Inverse3Id], [l3].[OneToMany_Optional_Self_Inverse3Id], [l3].[OneToMany_Required_Inverse3Id], [l3].[OneToMany_Required_Self_Inverse3Id], [l3].[OneToOne_Optional_PK_Inverse3Id], [l3].[OneToOne_Optional_Self3Id], [l3].[PeriodEnd], [l3].[PeriodStart] FROM [LevelThree] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l3] - WHERE ([l0].[Id] = [l3].[OneToMany_Optional_Inverse3Id]) AND (([l3].[Name] <> N'Foo') OR [l3].[Name] IS NULL) + WHERE ([l0].[Id] = [l3].[OneToMany_Optional_Inverse3Id]) AND (([l3].[Name] <> N'Foo') OR ([l3].[Name] IS NULL)) ORDER BY [l3].[Id] ) AS [t] LEFT JOIN [LevelFour] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l1] ON [t].[Id] = [l1].[OneToMany_Optional_Inverse4Id] diff --git a/test/EFCore.SqlServer.FunctionalTests/Query/TemporalGearsOfWarQuerySqlServerTest.cs b/test/EFCore.SqlServer.FunctionalTests/Query/TemporalGearsOfWarQuerySqlServerTest.cs index a1d8a117992..fe1586eec00 100644 --- a/test/EFCore.SqlServer.FunctionalTests/Query/TemporalGearsOfWarQuerySqlServerTest.cs +++ b/test/EFCore.SqlServer.FunctionalTests/Query/TemporalGearsOfWarQuerySqlServerTest.cs @@ -250,11 +250,11 @@ public override async Task Accessing_derived_property_using_hard_and_soft_cast(b AssertSql( @"SELECT [l].[Name], [l].[Discriminator], [l].[LocustHordeId], [l].[PeriodEnd], [l].[PeriodStart], [l].[ThreatLevel], [l].[ThreatLevelByte], [l].[ThreatLevelNullableByte], [l].[DefeatedByNickname], [l].[DefeatedBySquadId], [l].[HighCommandId] FROM [LocustLeaders] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l] -WHERE ([l].[Discriminator] = N'LocustCommander') AND (([l].[HighCommandId] <> 0) OR [l].[HighCommandId] IS NULL)", +WHERE ([l].[Discriminator] = N'LocustCommander') AND (([l].[HighCommandId] <> 0) OR ([l].[HighCommandId] IS NULL))", // @"SELECT [l].[Name], [l].[Discriminator], [l].[LocustHordeId], [l].[PeriodEnd], [l].[PeriodStart], [l].[ThreatLevel], [l].[ThreatLevelByte], [l].[ThreatLevelNullableByte], [l].[DefeatedByNickname], [l].[DefeatedBySquadId], [l].[HighCommandId] FROM [LocustLeaders] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l] -WHERE ([l].[Discriminator] = N'LocustCommander') AND (([l].[HighCommandId] <> 0) OR [l].[HighCommandId] IS NULL)"); +WHERE ([l].[Discriminator] = N'LocustCommander') AND (([l].[HighCommandId] <> 0) OR ([l].[HighCommandId] IS NULL))"); } public override async Task Accessing_property_of_optional_navigation_in_child_projection_works(bool async) @@ -263,7 +263,7 @@ public override async Task Accessing_property_of_optional_navigation_in_child_pr AssertSql( @"SELECT CASE - WHEN [g].[Nickname] IS NOT NULL AND [g].[SquadId] IS NOT NULL THEN CAST(1 AS bit) + WHEN ([g].[Nickname] IS NOT NULL) AND ([g].[SquadId] IS NOT NULL) THEN CAST(1 AS bit) ELSE CAST(0 AS bit) END, [t].[Id], [g].[Nickname], [g].[SquadId], [t0].[Nickname], [t0].[Id], [t0].[SquadId] FROM [Tags] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [t] @@ -301,7 +301,7 @@ WHEN NOT EXISTS ( SELECT 1 FROM [Gears] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [g] LEFT JOIN [Tags] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [t] ON ([g].[Nickname] = [t].[GearNickName]) AND ([g].[SquadId] = [t].[GearSquadId]) - WHERE ([t].[Note] = N'Foo') AND [t].[Note] IS NOT NULL) THEN CAST(1 AS bit) + WHERE ([t].[Note] = N'Foo') AND ([t].[Note] IS NOT NULL)) THEN CAST(1 AS bit) ELSE CAST(0 AS bit) END"); } diff --git a/test/EFCore.SqlServer.FunctionalTests/Query/TemporalManyToManyQuerySqlServerTest.cs b/test/EFCore.SqlServer.FunctionalTests/Query/TemporalManyToManyQuerySqlServerTest.cs index 004d6cf3f52..ffc1e2b8b41 100644 --- a/test/EFCore.SqlServer.FunctionalTests/Query/TemporalManyToManyQuerySqlServerTest.cs +++ b/test/EFCore.SqlServer.FunctionalTests/Query/TemporalManyToManyQuerySqlServerTest.cs @@ -125,7 +125,7 @@ INNER JOIN ( FROM [EntityRoots] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [e0] WHERE [e0].[Discriminator] IN (N'EntityBranch', N'EntityLeaf') ) AS [t] ON [j].[EntityBranchId] = [t].[Id] - WHERE ([e].[Id] = [j].[EntityOneId]) AND ([t].[Name] IS NOT NULL AND ([t].[Name] LIKE N'L%'))), [e].[Id]"); + WHERE ([e].[Id] = [j].[EntityOneId]) AND (([t].[Name] IS NOT NULL) AND ([t].[Name] LIKE N'L%'))), [e].[Id]"); } public override async Task Skip_navigation_long_count_without_predicate(bool async) @@ -153,7 +153,7 @@ ORDER BY ( SELECT COUNT_BIG(*) FROM [EntityTwoEntityTwo] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [e0] INNER JOIN [EntityTwos] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [e1] ON [e0].[SelfSkipSharedLeftId] = [e1].[Id] - WHERE ([e].[Id] = [e0].[SelfSkipSharedRightId]) AND ([e1].[Name] IS NOT NULL AND ([e1].[Name] LIKE N'L%'))) DESC, [e].[Id]"); + WHERE ([e].[Id] = [e0].[SelfSkipSharedRightId]) AND (([e1].[Name] IS NOT NULL) AND ([e1].[Name] LIKE N'L%'))) DESC, [e].[Id]"); } public override async Task Skip_navigation_select_many_average(bool async) diff --git a/test/EFCore.SqlServer.FunctionalTests/Query/UdfDbFunctionSqlServerTests.cs b/test/EFCore.SqlServer.FunctionalTests/Query/UdfDbFunctionSqlServerTests.cs index 789cbbcefbe..0db63f40b9b 100644 --- a/test/EFCore.SqlServer.FunctionalTests/Query/UdfDbFunctionSqlServerTests.cs +++ b/test/EFCore.SqlServer.FunctionalTests/Query/UdfDbFunctionSqlServerTests.cs @@ -258,7 +258,7 @@ public override void Compare_functions_returning_int_that_take_nullable_param_wh AssertSql( @"SELECT [c].[Id], [c].[FirstName], [c].[LastName] FROM [Customers] AS [c] -WHERE (([dbo].[StringLength]([c].[FirstName]) <> [dbo].[StringLength]([c].[LastName])) OR ([c].[FirstName] IS NULL OR [c].[LastName] IS NULL)) AND ([c].[FirstName] IS NOT NULL OR [c].[LastName] IS NOT NULL) +WHERE (([dbo].[StringLength]([c].[FirstName]) <> [dbo].[StringLength]([c].[LastName])) OR (([c].[FirstName] IS NULL) OR ([c].[LastName] IS NULL))) AND (([c].[FirstName] IS NOT NULL) OR ([c].[LastName] IS NOT NULL)) ORDER BY [c].[Id]"); } @@ -290,7 +290,7 @@ public override void Scalar_Function_with_nested_InExpression_translation() @"SELECT [c].[Id], [c].[FirstName], [c].[LastName] FROM [Customers] AS [c] WHERE CASE - WHEN SUBSTRING([c].[FirstName], 0 + 1, 1) IN (N'A', N'B', N'C') AND SUBSTRING([c].[FirstName], 0 + 1, 1) IS NOT NULL THEN CAST(1 AS bit) + WHEN SUBSTRING([c].[FirstName], 0 + 1, 1) IN (N'A', N'B', N'C') AND (SUBSTRING([c].[FirstName], 0 + 1, 1) IS NOT NULL) THEN CAST(1 AS bit) ELSE CAST(0 AS bit) END IN (CAST(1 AS bit), CAST(0 AS bit))"); } @@ -804,7 +804,7 @@ public override void Udf_with_argument_being_comparison_of_nullable_columns() @"SELECT [g].[Count], [g].[CustomerId], [g].[Year] FROM [Addresses] AS [a] CROSS APPLY [dbo].[GetCustomerOrderCountByYearOnlyFrom2000](1, CASE - WHEN (([a].[City] = [a].[State]) AND ([a].[City] IS NOT NULL AND [a].[State] IS NOT NULL)) OR ([a].[City] IS NULL AND [a].[State] IS NULL) THEN CAST(1 AS bit) + WHEN (([a].[City] = [a].[State]) AND (([a].[City] IS NOT NULL) AND ([a].[State] IS NOT NULL))) OR (([a].[City] IS NULL) AND ([a].[State] IS NULL)) THEN CAST(1 AS bit) ELSE CAST(0 AS bit) END) AS [g] ORDER BY [a].[Id], [g].[Year]"); diff --git a/test/EFCore.SqlServer.FunctionalTests/TPTTableSplittingSqlServerTest.cs b/test/EFCore.SqlServer.FunctionalTests/TPTTableSplittingSqlServerTest.cs index 5e1d29cc9d0..21f9184beb1 100644 --- a/test/EFCore.SqlServer.FunctionalTests/TPTTableSplittingSqlServerTest.cs +++ b/test/EFCore.SqlServer.FunctionalTests/TPTTableSplittingSqlServerTest.cs @@ -181,7 +181,7 @@ SELECT [p].[Name] FROM [PoweredVehicles] AS [p] INNER JOIN [CombustionEngines] AS [c0] ON [p].[Name] = [c0].[VehicleName] ) AS [t] ON [c].[VehicleName] = [t].[Name] -WHERE [c].[Capacity] IS NOT NULL AND [c].[FuelType] IS NOT NULL"); +WHERE ([c].[Capacity] IS NOT NULL) AND ([c].[FuelType] IS NOT NULL)"); } public override async Task Can_change_dependent_instance_non_derived() diff --git a/test/EFCore.SqlServer.FunctionalTests/TableSplittingSqlServerTest.cs b/test/EFCore.SqlServer.FunctionalTests/TableSplittingSqlServerTest.cs index d410d8eac78..da57c6f279e 100644 --- a/test/EFCore.SqlServer.FunctionalTests/TableSplittingSqlServerTest.cs +++ b/test/EFCore.SqlServer.FunctionalTests/TableSplittingSqlServerTest.cs @@ -51,9 +51,9 @@ SELECT [v6].[Name] FROM [Vehicles] AS [v6] WHERE [v6].[Discriminator] IN (N'PoweredVehicle', N'CompositeVehicle') ) AS [t3] ON [v5].[Name] = [t3].[Name] - WHERE [v5].[Computed] IS NOT NULL AND [v5].[Engine_Discriminator] IS NOT NULL + WHERE ([v5].[Computed] IS NOT NULL) AND ([v5].[Engine_Discriminator] IS NOT NULL) ) AS [t2] ON [v].[Name] = CASE - WHEN [t2].[Computed] IS NOT NULL AND [t2].[Engine_Discriminator] IS NOT NULL THEN [t2].[Name] + WHEN ([t2].[Computed] IS NOT NULL) AND ([t2].[Engine_Discriminator] IS NOT NULL) THEN [t2].[Name] END LEFT JOIN ( SELECT [v7].[Name], [v7].[Capacity], [v7].[FuelTank_Discriminator], [v7].[FuelType], [v7].[GrainGeometry] @@ -63,7 +63,7 @@ INNER JOIN ( FROM [Vehicles] AS [v8] WHERE [v8].[Discriminator] IN (N'PoweredVehicle', N'CompositeVehicle') ) AS [t5] ON [v7].[Name] = [t5].[Name] - WHERE [v7].[Capacity] IS NOT NULL AND [v7].[FuelTank_Discriminator] IS NOT NULL + WHERE ([v7].[Capacity] IS NOT NULL) AND ([v7].[FuelTank_Discriminator] IS NOT NULL) UNION SELECT [v9].[Name], [v9].[Capacity], [v9].[FuelTank_Discriminator], [v9].[FuelType], [v9].[GrainGeometry] FROM [Vehicles] AS [v9] @@ -77,11 +77,11 @@ WHERE [v11].[Discriminator] IN (N'PoweredVehicle', N'CompositeVehicle') ) AS [t7] ON [v10].[Name] = [t7].[Name] WHERE [v10].[Engine_Discriminator] IN (N'ContinuousCombustionEngine', N'IntermittentCombustionEngine', N'SolidRocket') ) AS [t6] ON [v9].[Name] = [t6].[Name] - WHERE [v9].[Capacity] IS NOT NULL AND [v9].[FuelTank_Discriminator] IS NOT NULL + WHERE ([v9].[Capacity] IS NOT NULL) AND ([v9].[FuelTank_Discriminator] IS NOT NULL) ) AS [t4] ON CASE - WHEN [t2].[Computed] IS NOT NULL AND [t2].[Engine_Discriminator] IS NOT NULL THEN [t2].[Name] + WHEN ([t2].[Computed] IS NOT NULL) AND ([t2].[Engine_Discriminator] IS NOT NULL) THEN [t2].[Name] END = CASE - WHEN [t4].[Capacity] IS NOT NULL AND [t4].[FuelTank_Discriminator] IS NOT NULL THEN [t4].[Name] + WHEN ([t4].[Capacity] IS NOT NULL) AND ([t4].[FuelTank_Discriminator] IS NOT NULL) THEN [t4].[Name] END ORDER BY [v].[Name]"); } @@ -128,7 +128,7 @@ INNER JOIN ( FROM [Vehicles] AS [v0] WHERE [v0].[Discriminator] IN (N'PoweredVehicle', N'CompositeVehicle') ) AS [t] ON [v].[Name] = [t].[Name] -WHERE [v].[Capacity] IS NOT NULL AND [v].[FuelTank_Discriminator] IS NOT NULL +WHERE ([v].[Capacity] IS NOT NULL) AND ([v].[FuelTank_Discriminator] IS NOT NULL) UNION SELECT [v1].[Name], [v1].[Capacity], [v1].[FuelTank_Discriminator], [v1].[FuelType], [v1].[GrainGeometry] FROM [Vehicles] AS [v1] @@ -142,7 +142,7 @@ WHERE [v3].[Discriminator] IN (N'PoweredVehicle', N'CompositeVehicle') ) AS [t2] ON [v2].[Name] = [t2].[Name] WHERE [v2].[Engine_Discriminator] IN (N'ContinuousCombustionEngine', N'IntermittentCombustionEngine', N'SolidRocket') ) AS [t1] ON [v1].[Name] = [t1].[Name] -WHERE [v1].[Capacity] IS NOT NULL AND [v1].[FuelTank_Discriminator] IS NOT NULL"); +WHERE ([v1].[Capacity] IS NOT NULL) AND ([v1].[FuelTank_Discriminator] IS NOT NULL)"); } public override async Task Can_query_shared_derived_nonhierarchy() @@ -186,7 +186,7 @@ INNER JOIN ( FROM [Vehicles] AS [v0] WHERE [v0].[Discriminator] IN (N'PoweredVehicle', N'CompositeVehicle') ) AS [t] ON [v].[Name] = [t].[Name] -WHERE [v].[Capacity] IS NOT NULL AND [v].[FuelType] IS NOT NULL +WHERE ([v].[Capacity] IS NOT NULL) AND ([v].[FuelType] IS NOT NULL) UNION SELECT [v1].[Name], [v1].[Capacity], [v1].[FuelType] FROM [Vehicles] AS [v1] @@ -200,7 +200,7 @@ WHERE [v3].[Discriminator] IN (N'PoweredVehicle', N'CompositeVehicle') ) AS [t2] ON [v2].[Name] = [t2].[Name] WHERE [v2].[Engine_Discriminator] IN (N'ContinuousCombustionEngine', N'IntermittentCombustionEngine', N'SolidRocket') ) AS [t1] ON [v1].[Name] = [t1].[Name] -WHERE [v1].[Capacity] IS NOT NULL AND [v1].[FuelType] IS NOT NULL"); +WHERE ([v1].[Capacity] IS NOT NULL) AND ([v1].[FuelType] IS NOT NULL)"); } public override async Task Can_change_dependent_instance_non_derived() diff --git a/test/EFCore.Sqlite.FunctionalTests/Query/GearsOfWarQuerySqliteTest.cs b/test/EFCore.Sqlite.FunctionalTests/Query/GearsOfWarQuerySqliteTest.cs index 4fa310309f1..1a5053cd405 100644 --- a/test/EFCore.Sqlite.FunctionalTests/Query/GearsOfWarQuerySqliteTest.cs +++ b/test/EFCore.Sqlite.FunctionalTests/Query/GearsOfWarQuerySqliteTest.cs @@ -217,7 +217,7 @@ public override async Task Negate_on_like_expression(bool async) AssertSql( @"SELECT ""s"".""Id"", ""s"".""Banner"", ""s"".""Banner5"", ""s"".""InternalNumber"", ""s"".""Name"" FROM ""Squads"" AS ""s"" -WHERE ""s"".""Name"" IS NOT NULL AND NOT (""s"".""Name"" LIKE 'us%')"); +WHERE (""s"".""Name"" IS NOT NULL) AND NOT (""s"".""Name"" LIKE 'us%')"); } public override async Task Select_datetimeoffset_comparison_in_projection(bool async) diff --git a/test/EFCore.Sqlite.FunctionalTests/Query/NorthwindFunctionsQuerySqliteTest.cs b/test/EFCore.Sqlite.FunctionalTests/Query/NorthwindFunctionsQuerySqliteTest.cs index 54579cafef4..4de7db06929 100644 --- a/test/EFCore.Sqlite.FunctionalTests/Query/NorthwindFunctionsQuerySqliteTest.cs +++ b/test/EFCore.Sqlite.FunctionalTests/Query/NorthwindFunctionsQuerySqliteTest.cs @@ -184,7 +184,7 @@ public override async Task String_StartsWith_Literal(bool async) AssertSql( @"SELECT ""c"".""CustomerID"", ""c"".""Address"", ""c"".""City"", ""c"".""CompanyName"", ""c"".""ContactName"", ""c"".""ContactTitle"", ""c"".""Country"", ""c"".""Fax"", ""c"".""Phone"", ""c"".""PostalCode"", ""c"".""Region"" FROM ""Customers"" AS ""c"" -WHERE ""c"".""ContactName"" IS NOT NULL AND (""c"".""ContactName"" LIKE 'M%')"); +WHERE (""c"".""ContactName"" IS NOT NULL) AND (""c"".""ContactName"" LIKE 'M%')"); } public override async Task String_StartsWith_Identity(bool async) @@ -194,7 +194,7 @@ public override async Task String_StartsWith_Identity(bool async) AssertSql( @"SELECT ""c"".""CustomerID"", ""c"".""Address"", ""c"".""City"", ""c"".""CompanyName"", ""c"".""ContactName"", ""c"".""ContactTitle"", ""c"".""Country"", ""c"".""Fax"", ""c"".""Phone"", ""c"".""PostalCode"", ""c"".""Region"" FROM ""Customers"" AS ""c"" -WHERE (""c"".""ContactName"" = '') OR (""c"".""ContactName"" IS NOT NULL AND (((""c"".""ContactName"" LIKE ""c"".""ContactName"" || '%') AND (substr(""c"".""ContactName"", 1, length(""c"".""ContactName"")) = ""c"".""ContactName"")) OR (""c"".""ContactName"" = '')))"); +WHERE (""c"".""ContactName"" = '') OR ((""c"".""ContactName"" IS NOT NULL) AND (((""c"".""ContactName"" LIKE ""c"".""ContactName"" || '%') AND (substr(""c"".""ContactName"", 1, length(""c"".""ContactName"")) = ""c"".""ContactName"")) OR (""c"".""ContactName"" = '')))"); } public override async Task String_StartsWith_Column(bool async) @@ -204,7 +204,7 @@ public override async Task String_StartsWith_Column(bool async) AssertSql( @"SELECT ""c"".""CustomerID"", ""c"".""Address"", ""c"".""City"", ""c"".""CompanyName"", ""c"".""ContactName"", ""c"".""ContactTitle"", ""c"".""Country"", ""c"".""Fax"", ""c"".""Phone"", ""c"".""PostalCode"", ""c"".""Region"" FROM ""Customers"" AS ""c"" -WHERE (""c"".""ContactName"" = '') OR (""c"".""ContactName"" IS NOT NULL AND (((""c"".""ContactName"" LIKE ""c"".""ContactName"" || '%') AND (substr(""c"".""ContactName"", 1, length(""c"".""ContactName"")) = ""c"".""ContactName"")) OR (""c"".""ContactName"" = '')))"); +WHERE (""c"".""ContactName"" = '') OR ((""c"".""ContactName"" IS NOT NULL) AND (((""c"".""ContactName"" LIKE ""c"".""ContactName"" || '%') AND (substr(""c"".""ContactName"", 1, length(""c"".""ContactName"")) = ""c"".""ContactName"")) OR (""c"".""ContactName"" = '')))"); } public override async Task String_StartsWith_MethodCall(bool async) @@ -214,7 +214,7 @@ public override async Task String_StartsWith_MethodCall(bool async) AssertSql( @"SELECT ""c"".""CustomerID"", ""c"".""Address"", ""c"".""City"", ""c"".""CompanyName"", ""c"".""ContactName"", ""c"".""ContactTitle"", ""c"".""Country"", ""c"".""Fax"", ""c"".""Phone"", ""c"".""PostalCode"", ""c"".""Region"" FROM ""Customers"" AS ""c"" -WHERE ""c"".""ContactName"" IS NOT NULL AND (""c"".""ContactName"" LIKE 'M%')"); +WHERE (""c"".""ContactName"" IS NOT NULL) AND (""c"".""ContactName"" LIKE 'M%')"); } public override async Task String_EndsWith_Literal(bool async) @@ -224,7 +224,7 @@ public override async Task String_EndsWith_Literal(bool async) AssertSql( @"SELECT ""c"".""CustomerID"", ""c"".""Address"", ""c"".""City"", ""c"".""CompanyName"", ""c"".""ContactName"", ""c"".""ContactTitle"", ""c"".""Country"", ""c"".""Fax"", ""c"".""Phone"", ""c"".""PostalCode"", ""c"".""Region"" FROM ""Customers"" AS ""c"" -WHERE ""c"".""ContactName"" IS NOT NULL AND (""c"".""ContactName"" LIKE '%b')"); +WHERE (""c"".""ContactName"" IS NOT NULL) AND (""c"".""ContactName"" LIKE '%b')"); } public override async Task String_EndsWith_Identity(bool async) @@ -234,7 +234,7 @@ public override async Task String_EndsWith_Identity(bool async) AssertSql( @"SELECT ""c"".""CustomerID"", ""c"".""Address"", ""c"".""City"", ""c"".""CompanyName"", ""c"".""ContactName"", ""c"".""ContactTitle"", ""c"".""Country"", ""c"".""Fax"", ""c"".""Phone"", ""c"".""PostalCode"", ""c"".""Region"" FROM ""Customers"" AS ""c"" -WHERE (""c"".""ContactName"" = '') OR (""c"".""ContactName"" IS NOT NULL AND ((substr(""c"".""ContactName"", -length(""c"".""ContactName"")) = ""c"".""ContactName"") OR (""c"".""ContactName"" = '')))"); +WHERE (""c"".""ContactName"" = '') OR ((""c"".""ContactName"" IS NOT NULL) AND ((substr(""c"".""ContactName"", -length(""c"".""ContactName"")) = ""c"".""ContactName"") OR (""c"".""ContactName"" = '')))"); } public override async Task String_EndsWith_Column(bool async) @@ -244,7 +244,7 @@ public override async Task String_EndsWith_Column(bool async) AssertSql( @"SELECT ""c"".""CustomerID"", ""c"".""Address"", ""c"".""City"", ""c"".""CompanyName"", ""c"".""ContactName"", ""c"".""ContactTitle"", ""c"".""Country"", ""c"".""Fax"", ""c"".""Phone"", ""c"".""PostalCode"", ""c"".""Region"" FROM ""Customers"" AS ""c"" -WHERE (""c"".""ContactName"" = '') OR (""c"".""ContactName"" IS NOT NULL AND ((substr(""c"".""ContactName"", -length(""c"".""ContactName"")) = ""c"".""ContactName"") OR (""c"".""ContactName"" = '')))"); +WHERE (""c"".""ContactName"" = '') OR ((""c"".""ContactName"" IS NOT NULL) AND ((substr(""c"".""ContactName"", -length(""c"".""ContactName"")) = ""c"".""ContactName"") OR (""c"".""ContactName"" = '')))"); } public override async Task String_EndsWith_MethodCall(bool async) @@ -254,7 +254,7 @@ public override async Task String_EndsWith_MethodCall(bool async) AssertSql( @"SELECT ""c"".""CustomerID"", ""c"".""Address"", ""c"".""City"", ""c"".""CompanyName"", ""c"".""ContactName"", ""c"".""ContactTitle"", ""c"".""Country"", ""c"".""Fax"", ""c"".""Phone"", ""c"".""PostalCode"", ""c"".""Region"" FROM ""Customers"" AS ""c"" -WHERE ""c"".""ContactName"" IS NOT NULL AND (""c"".""ContactName"" LIKE '%m')"); +WHERE (""c"".""ContactName"" IS NOT NULL) AND (""c"".""ContactName"" LIKE '%m')"); } public override async Task String_Contains_Literal(bool async) @@ -322,7 +322,7 @@ public override async Task IsNullOrWhiteSpace_in_predicate(bool async) AssertSql( @"SELECT ""c"".""CustomerID"", ""c"".""Address"", ""c"".""City"", ""c"".""CompanyName"", ""c"".""ContactName"", ""c"".""ContactTitle"", ""c"".""Country"", ""c"".""Fax"", ""c"".""Phone"", ""c"".""PostalCode"", ""c"".""Region"" FROM ""Customers"" AS ""c"" -WHERE ""c"".""Region"" IS NULL OR (trim(""c"".""Region"") = '')"); +WHERE (""c"".""Region"" IS NULL) OR (trim(""c"".""Region"") = '')"); } public override async Task Indexof_with_emptystring(bool async) @@ -624,7 +624,7 @@ public override async Task IsNullOrEmpty_in_predicate(bool async) AssertSql( @"SELECT ""c"".""CustomerID"", ""c"".""Address"", ""c"".""City"", ""c"".""CompanyName"", ""c"".""ContactName"", ""c"".""ContactTitle"", ""c"".""Country"", ""c"".""Fax"", ""c"".""Phone"", ""c"".""PostalCode"", ""c"".""Region"" FROM ""Customers"" AS ""c"" -WHERE ""c"".""Region"" IS NULL OR (""c"".""Region"" = '')"); +WHERE (""c"".""Region"" IS NULL) OR (""c"".""Region"" = '')"); } public override async Task IsNullOrEmpty_in_projection(bool async) @@ -632,7 +632,7 @@ public override async Task IsNullOrEmpty_in_projection(bool async) await base.IsNullOrEmpty_in_projection(async); AssertSql( - @"SELECT ""c"".""CustomerID"" AS ""Id"", ""c"".""Region"" IS NULL OR (""c"".""Region"" = '') AS ""Value"" + @"SELECT ""c"".""CustomerID"" AS ""Id"", (""c"".""Region"" IS NULL) OR (""c"".""Region"" = '') AS ""Value"" FROM ""Customers"" AS ""c"""); } @@ -643,7 +643,7 @@ public override async Task IsNullOrEmpty_negated_in_predicate(bool async) AssertSql( @"SELECT ""c"".""CustomerID"", ""c"".""Address"", ""c"".""City"", ""c"".""CompanyName"", ""c"".""ContactName"", ""c"".""ContactTitle"", ""c"".""Country"", ""c"".""Fax"", ""c"".""Phone"", ""c"".""PostalCode"", ""c"".""Region"" FROM ""Customers"" AS ""c"" -WHERE ""c"".""Region"" IS NOT NULL AND (""c"".""Region"" <> '')"); +WHERE (""c"".""Region"" IS NOT NULL) AND (""c"".""Region"" <> '')"); } public override Task Datetime_subtraction_TotalDays(bool async) diff --git a/test/EFCore.Sqlite.FunctionalTests/Query/NorthwindMiscellaneousQuerySqliteTest.cs b/test/EFCore.Sqlite.FunctionalTests/Query/NorthwindMiscellaneousQuerySqliteTest.cs index 92908221a71..0d6370692b2 100644 --- a/test/EFCore.Sqlite.FunctionalTests/Query/NorthwindMiscellaneousQuerySqliteTest.cs +++ b/test/EFCore.Sqlite.FunctionalTests/Query/NorthwindMiscellaneousQuerySqliteTest.cs @@ -32,7 +32,7 @@ public override async Task Query_expression_with_to_string_and_contains(bool asy AssertSql( @"SELECT ""o"".""CustomerID"" FROM ""Orders"" AS ""o"" -WHERE ""o"".""OrderDate"" IS NOT NULL AND (('10' = '') OR (instr(CAST(""o"".""EmployeeID"" AS TEXT), '10') > 0))"); +WHERE (""o"".""OrderDate"" IS NOT NULL) AND (('10' = '') OR (instr(CAST(""o"".""EmployeeID"" AS TEXT), '10') > 0))"); } public override async Task Take_Skip(bool async) diff --git a/test/EFCore.Sqlite.FunctionalTests/Query/NorthwindQueryFiltersQuerySqliteTest.cs b/test/EFCore.Sqlite.FunctionalTests/Query/NorthwindQueryFiltersQuerySqliteTest.cs index d8e888e2435..3be6f5d3111 100644 --- a/test/EFCore.Sqlite.FunctionalTests/Query/NorthwindQueryFiltersQuerySqliteTest.cs +++ b/test/EFCore.Sqlite.FunctionalTests/Query/NorthwindQueryFiltersQuerySqliteTest.cs @@ -27,7 +27,7 @@ public override async Task Count_query(bool async) SELECT COUNT(*) FROM ""Customers"" AS ""c"" -WHERE (@__ef_filter__TenantPrefix_0 = '') OR (""c"".""CompanyName"" IS NOT NULL AND (((""c"".""CompanyName"" LIKE @__ef_filter__TenantPrefix_0 || '%') AND (substr(""c"".""CompanyName"", 1, length(@__ef_filter__TenantPrefix_0)) = @__ef_filter__TenantPrefix_0)) OR (@__ef_filter__TenantPrefix_0 = '')))"); +WHERE (@__ef_filter__TenantPrefix_0 = '') OR ((""c"".""CompanyName"" IS NOT NULL) AND (((""c"".""CompanyName"" LIKE @__ef_filter__TenantPrefix_0 || '%') AND (substr(""c"".""CompanyName"", 1, length(@__ef_filter__TenantPrefix_0)) = @__ef_filter__TenantPrefix_0)) OR (@__ef_filter__TenantPrefix_0 = '')))"); } private void AssertSql(params string[] expected) diff --git a/test/EFCore.Sqlite.FunctionalTests/Query/NorthwindWhereQuerySqliteTest.cs b/test/EFCore.Sqlite.FunctionalTests/Query/NorthwindWhereQuerySqliteTest.cs index 2c81c656f37..1fa1a206880 100644 --- a/test/EFCore.Sqlite.FunctionalTests/Query/NorthwindWhereQuerySqliteTest.cs +++ b/test/EFCore.Sqlite.FunctionalTests/Query/NorthwindWhereQuerySqliteTest.cs @@ -191,7 +191,7 @@ public override async Task Where_string_indexof(bool async) AssertSql( @"SELECT ""c"".""CustomerID"", ""c"".""Address"", ""c"".""City"", ""c"".""CompanyName"", ""c"".""ContactName"", ""c"".""ContactTitle"", ""c"".""Country"", ""c"".""Fax"", ""c"".""Phone"", ""c"".""PostalCode"", ""c"".""Region"" FROM ""Customers"" AS ""c"" -WHERE ((instr(""c"".""City"", 'Sea') - 1) <> -1) OR ""c"".""City"" IS NULL"); +WHERE ((instr(""c"".""City"", 'Sea') - 1) <> -1) OR (""c"".""City"" IS NULL)"); } public override async Task Where_string_replace(bool async) diff --git a/test/EFCore.Sqlite.FunctionalTests/Query/NullSemanticsQuerySqliteTest.cs b/test/EFCore.Sqlite.FunctionalTests/Query/NullSemanticsQuerySqliteTest.cs index b577098f307..bd399163e98 100644 --- a/test/EFCore.Sqlite.FunctionalTests/Query/NullSemanticsQuerySqliteTest.cs +++ b/test/EFCore.Sqlite.FunctionalTests/Query/NullSemanticsQuerySqliteTest.cs @@ -71,6 +71,26 @@ public override async Task Bool_not_equal_nullable_bool_HasValue(bool async) WHERE ""e"".""BoolB"" <> (""e"".""NullableBoolA"" IS NOT NULL)"); } + public override async Task Bool_not_equal_nullable_int_HasValue(bool async) + { + await base.Bool_not_equal_nullable_int_HasValue(async); + + AssertSql( + @"SELECT ""e"".""Id"", ""e"".""BoolA"", ""e"".""BoolB"", ""e"".""BoolC"", ""e"".""IntA"", ""e"".""IntB"", ""e"".""IntC"", ""e"".""NullableBoolA"", ""e"".""NullableBoolB"", ""e"".""NullableBoolC"", ""e"".""NullableIntA"", ""e"".""NullableIntB"", ""e"".""NullableIntC"", ""e"".""NullableStringA"", ""e"".""NullableStringB"", ""e"".""NullableStringC"", ""e"".""StringA"", ""e"".""StringB"", ""e"".""StringC"" +FROM ""Entities1"" AS ""e"" +WHERE ""e"".""NullableIntA"" IS NULL", + // + @"@__prm_0='False' + +SELECT ""e"".""Id"", ""e"".""BoolA"", ""e"".""BoolB"", ""e"".""BoolC"", ""e"".""IntA"", ""e"".""IntB"", ""e"".""IntC"", ""e"".""NullableBoolA"", ""e"".""NullableBoolB"", ""e"".""NullableBoolC"", ""e"".""NullableIntA"", ""e"".""NullableIntB"", ""e"".""NullableIntC"", ""e"".""NullableStringA"", ""e"".""NullableStringB"", ""e"".""NullableStringC"", ""e"".""StringA"", ""e"".""StringB"", ""e"".""StringC"" +FROM ""Entities1"" AS ""e"" +WHERE @__prm_0 <> (""e"".""NullableIntA"" IS NOT NULL)", + // + @"SELECT ""e"".""Id"", ""e"".""BoolA"", ""e"".""BoolB"", ""e"".""BoolC"", ""e"".""IntA"", ""e"".""IntB"", ""e"".""IntC"", ""e"".""NullableBoolA"", ""e"".""NullableBoolB"", ""e"".""NullableBoolC"", ""e"".""NullableIntA"", ""e"".""NullableIntB"", ""e"".""NullableIntC"", ""e"".""NullableStringA"", ""e"".""NullableStringB"", ""e"".""NullableStringC"", ""e"".""StringA"", ""e"".""StringB"", ""e"".""StringC"" +FROM ""Entities1"" AS ""e"" +WHERE ""e"".""BoolB"" <> (""e"".""NullableIntA"" IS NOT NULL)"); + } + public override async Task Bool_not_equal_nullable_bool_compared_to_null(bool async) { await base.Bool_not_equal_nullable_bool_compared_to_null(async); diff --git a/test/EFCore.Sqlite.FunctionalTests/Query/TPTGearsOfWarQuerySqliteTest.cs b/test/EFCore.Sqlite.FunctionalTests/Query/TPTGearsOfWarQuerySqliteTest.cs index f2140392c24..63ef54ec461 100644 --- a/test/EFCore.Sqlite.FunctionalTests/Query/TPTGearsOfWarQuerySqliteTest.cs +++ b/test/EFCore.Sqlite.FunctionalTests/Query/TPTGearsOfWarQuerySqliteTest.cs @@ -218,7 +218,7 @@ public override async Task Negate_on_like_expression(bool async) AssertSql( @"SELECT ""s"".""Id"", ""s"".""Banner"", ""s"".""Banner5"", ""s"".""InternalNumber"", ""s"".""Name"" FROM ""Squads"" AS ""s"" -WHERE ""s"".""Name"" IS NOT NULL AND NOT (""s"".""Name"" LIKE 'us%')"); +WHERE (""s"".""Name"" IS NOT NULL) AND NOT (""s"".""Name"" LIKE 'us%')"); } public override async Task Select_datetimeoffset_comparison_in_projection(bool async)