From b53cde36152428722b9e2833752952fa58f82ccb Mon Sep 17 00:00:00 2001 From: Shay Rojansky Date: Wed, 28 Sep 2022 18:28:38 +0200 Subject: [PATCH] Add parentheses around SQL IS NULL Fixes #29222 --- .../Query/QuerySqlGenerator.cs | 6 +- .../NonSharedModelBulkUpdatesSqlServerTest.cs | 2 +- .../NorthwindBulkUpdatesSqlServerTest.cs | 18 +- ...tersInheritanceBulkUpdatesSqlServerTest.cs | 4 +- .../TPTInheritanceBulkUpdatesSqlServerTest.cs | 2 +- ...avigationsCollectionsQuerySqlServerTest.cs | 62 +- ...CollectionsSharedTypeQuerySqlServerTest.cs | 942 +++--- ...tionsCollectionsSplitQuerySqlServerTest.cs | 100 +- .../ComplexNavigationsQuerySqlServerTest.cs | 122 +- ...NavigationsSharedTypeQuerySqlServerTest.cs | 2618 ++++++++--------- .../Query/Ef6GroupBySqlServerTest.cs | 14 +- .../EntitySplittingQuerySqlServerTest.cs | 4 +- .../Query/FromSqlQuerySqlServerTest.cs | 2 +- .../Query/FunkyDataQuerySqlServerTest.cs | 70 +- .../Query/GearsOfWarQuerySqlServerTest.cs | 232 +- ...eritanceRelationshipsQuerySqlServerTest.cs | 52 +- .../Query/JsonQuerySqlServerTest.cs | 4 +- .../ManyToManyNoTrackingQuerySqlServerTest.cs | 4 +- .../Query/ManyToManyQuerySqlServerTest.cs | 4 +- ...indAggregateOperatorsQuerySqlServerTest.cs | 28 +- ...NorthwindAsNoTrackingQuerySqlServerTest.cs | 2 +- ...windEFPropertyIncludeQuerySqlServerTest.cs | 16 +- .../NorthwindFunctionsQuerySqlServerTest.cs | 34 +- .../NorthwindGroupByQuerySqlServerTest.cs | 32 +- ...windIncludeNoTrackingQuerySqlServerTest.cs | 12 +- .../NorthwindIncludeQuerySqlServerTest.cs | 16 +- .../Query/NorthwindJoinQuerySqlServerTest.cs | 12 +- ...thwindKeylessEntitiesQuerySqlServerTest.cs | 4 +- ...orthwindMiscellaneousQuerySqlServerTest.cs | 100 +- .../NorthwindNavigationsQuerySqlServerTest.cs | 26 +- ...NorthwindQueryFiltersQuerySqlServerTest.cs | 58 +- .../NorthwindSelectQuerySqlServerTest.cs | 28 +- ...orthwindSetOperationsQuerySqlServerTest.cs | 6 +- ...plitIncludeNoTrackingQuerySqlServerTest.cs | 20 +- ...NorthwindSplitIncludeQuerySqlServerTest.cs | 28 +- ...orthwindStringIncludeQuerySqlServerTest.cs | 16 +- .../Query/NorthwindWhereQuerySqlServerTest.cs | 24 +- .../Query/NullSemanticsQuerySqlServerTest.cs | 206 +- .../Query/OwnedQuerySqlServerTest.cs | 8 +- .../Query/QueryBugsTest.cs | 26 +- .../Query/SharedTypeQuerySqlServerTest.cs | 4 +- .../Query/SimpleQuerySqlServerTest.cs | 26 +- .../Query/TPCGearsOfWarQuerySqlServerTest.cs | 232 +- ...CManyToManyNoTrackingQuerySqlServerTest.cs | 6 +- .../Query/TPCManyToManyQuerySqlServerTest.cs | 6 +- .../TPCRelationshipsQuerySqlServerTest.cs | 92 +- ...TPTFiltersInheritanceQuerySqlServerTest.cs | 14 +- .../Query/TPTGearsOfWarQuerySqlServerTest.cs | 260 +- .../Query/TPTInheritanceQuerySqlServerTest.cs | 18 +- ...TManyToManyNoTrackingQuerySqlServerTest.cs | 14 +- .../Query/TPTManyToManyQuerySqlServerTest.cs | 14 +- .../TPTRelationshipsQuerySqlServerTest.cs | 68 +- ...avigationsCollectionsQuerySqlServerTest.cs | 62 +- ...CollectionsSharedTypeQuerySqlServerTest.cs | 804 ++--- .../TemporalGearsOfWarQuerySqlServerTest.cs | 226 +- .../TemporalManyToManyQuerySqlServerTest.cs | 4 +- .../Query/TemporalOwnedQuerySqlServerTest.cs | 8 +- .../Query/TemporalTableSqlServerTest.cs | 2 +- .../Query/UdfDbFunctionSqlServerTests.cs | 6 +- .../TPTTableSplittingSqlServerTest.cs | 2 +- .../TableSplittingSqlServerTest.cs | 8 +- .../NonSharedModelBulkUpdatesSqliteTest.cs | 2 +- .../NorthwindBulkUpdatesSqliteTest.cs | 12 +- ...FiltersInheritanceBulkUpdatesSqliteTest.cs | 4 +- .../TPTInheritanceBulkUpdatesSqliteTest.cs | 2 +- .../Query/GearsOfWarQuerySqliteTest.cs | 222 +- .../NorthwindFunctionsQuerySqliteTest.cs | 24 +- .../NorthwindMiscellaneousQuerySqliteTest.cs | 2 +- .../NorthwindQueryFiltersQuerySqliteTest.cs | 2 +- .../Query/NorthwindWhereQuerySqliteTest.cs | 2 +- .../Query/TPCGearsOfWarQuerySqliteTest.cs | 2 +- .../Query/TPTGearsOfWarQuerySqliteTest.cs | 2 +- 72 files changed, 3557 insertions(+), 3559 deletions(-) diff --git a/src/EFCore.Relational/Query/QuerySqlGenerator.cs b/src/EFCore.Relational/Query/QuerySqlGenerator.cs index 230b45670c0..39ae61bda32 100644 --- a/src/EFCore.Relational/Query/QuerySqlGenerator.cs +++ b/src/EFCore.Relational/Query/QuerySqlGenerator.cs @@ -958,10 +958,8 @@ protected virtual bool RequiresParentheses(SqlExpression outerExpression, SqlExp 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)) + // Wrap IS (NOT) NULL operation + if (sqlUnaryExpression.OperatorType is ExpressionType.Equal or ExpressionType.NotEqual) { return true; } diff --git a/test/EFCore.SqlServer.FunctionalTests/BulkUpdates/NonSharedModelBulkUpdatesSqlServerTest.cs b/test/EFCore.SqlServer.FunctionalTests/BulkUpdates/NonSharedModelBulkUpdatesSqlServerTest.cs index b53fa408f56..567a44a1a8d 100644 --- a/test/EFCore.SqlServer.FunctionalTests/BulkUpdates/NonSharedModelBulkUpdatesSqlServerTest.cs +++ b/test/EFCore.SqlServer.FunctionalTests/BulkUpdates/NonSharedModelBulkUpdatesSqlServerTest.cs @@ -45,7 +45,7 @@ public override async Task Delete_predicate_based_on_optional_navigation(bool as @"DELETE FROM [p] FROM [Posts] AS [p] LEFT JOIN [Blogs] AS [b] ON [p].[BlogId] = [b].[Id] -WHERE [b].[Title] IS NOT NULL AND ([b].[Title] LIKE N'Arthur%')"); +WHERE ([b].[Title] IS NOT NULL) AND ([b].[Title] LIKE N'Arthur%')"); } private void AssertSql(params string[] expected) diff --git a/test/EFCore.SqlServer.FunctionalTests/BulkUpdates/NorthwindBulkUpdatesSqlServerTest.cs b/test/EFCore.SqlServer.FunctionalTests/BulkUpdates/NorthwindBulkUpdatesSqlServerTest.cs index 3efcc5a797e..7f1107a15a9 100644 --- a/test/EFCore.SqlServer.FunctionalTests/BulkUpdates/NorthwindBulkUpdatesSqlServerTest.cs +++ b/test/EFCore.SqlServer.FunctionalTests/BulkUpdates/NorthwindBulkUpdatesSqlServerTest.cs @@ -196,7 +196,7 @@ FROM [Order Details] AS [o] SELECT TOP(1) ( SELECT TOP(1) [o1].[OrderID] FROM [Orders] AS [o1] - WHERE [o0].[CustomerID] = [o1].[CustomerID] OR ([o0].[CustomerID] IS NULL AND [o1].[CustomerID] IS NULL)) + WHERE [o0].[CustomerID] = [o1].[CustomerID] OR (([o0].[CustomerID] IS NULL) AND ([o1].[CustomerID] IS NULL))) FROM [Orders] AS [o0] GROUP BY [o0].[CustomerID] HAVING COUNT(*) > 11)"); @@ -217,7 +217,7 @@ GROUP BY [o1].[CustomerID] HAVING COUNT(*) > 9 AND ( SELECT TOP(1) [o2].[OrderID] FROM [Orders] AS [o2] - WHERE [o1].[CustomerID] = [o2].[CustomerID] OR ([o1].[CustomerID] IS NULL AND [o2].[CustomerID] IS NULL)) = [o0].[OrderID])"); + WHERE [o1].[CustomerID] = [o2].[CustomerID] OR (([o1].[CustomerID] IS NULL) AND ([o2].[CustomerID] IS NULL))) = [o0].[OrderID])"); } public override async Task Delete_GroupBy_Where_Select(bool async) @@ -321,7 +321,7 @@ public override async Task Delete_Where_using_navigation_2(bool async) 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 [c].[CustomerID] IS NOT NULL AND ([c].[CustomerID] LIKE N'F%')"); +WHERE ([c].[CustomerID] IS NOT NULL) AND ([c].[CustomerID] LIKE N'F%')"); } public override async Task Delete_Union(bool async) @@ -455,7 +455,7 @@ public override async Task Delete_Where_optional_navigation_predicate(bool async 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 [c].[City] IS NOT NULL AND ([c].[City] LIKE N'Se%')"); +WHERE ([c].[City] IS NOT NULL) AND ([c].[City] LIKE N'Se%')"); } public override async Task Delete_with_join(bool async) @@ -826,7 +826,7 @@ FROM [Customers] AS [c] SELECT TOP(1) ( SELECT TOP(1) [o0].[CustomerID] 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))) FROM [Orders] AS [o] GROUP BY [o].[CustomerID] HAVING COUNT(*) > 11)"); @@ -855,7 +855,7 @@ HAVING COUNT(*) > 11 AND ( SELECT TOP(1) [c0].[CustomerID] FROM [Orders] AS [o0] LEFT JOIN [Customers] AS [c0] ON [o0].[CustomerID] = [c0].[CustomerID] - WHERE [o].[CustomerID] = [o0].[CustomerID] OR ([o].[CustomerID] IS NULL AND [o0].[CustomerID] IS NULL)) = [c].[CustomerID])"); + WHERE [o].[CustomerID] = [o0].[CustomerID] OR (([o].[CustomerID] IS NULL) AND ([o0].[CustomerID] IS NULL))) = [c].[CustomerID])"); } public override async Task Update_Where_Distinct_set_constant(bool async) @@ -1179,7 +1179,7 @@ FROM [Customers] AS [c] CROSS 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].[City] IS NOT NULL AND ([c0].[City] LIKE N'S%') + WHERE ([c0].[City] IS NOT NULL) AND ([c0].[City] LIKE N'S%') ) AS [t] LEFT JOIN ( SELECT [o].[OrderID], [o].[CustomerID], [o].[EmployeeID], [o].[OrderDate] @@ -1200,7 +1200,7 @@ FROM [Customers] AS [c] CROSS 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].[City] IS NOT NULL AND ([c0].[City] LIKE N'S%') + WHERE ([c0].[City] IS NOT NULL) AND ([c0].[City] LIKE N'S%') ) AS [t] CROSS APPLY ( SELECT [o].[OrderID], [o].[CustomerID], [o].[EmployeeID], [o].[OrderDate] @@ -1221,7 +1221,7 @@ FROM [Customers] AS [c] CROSS 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].[City] IS NOT NULL AND ([c0].[City] LIKE N'S%') + WHERE ([c0].[City] IS NOT NULL) AND ([c0].[City] LIKE N'S%') ) AS [t] OUTER APPLY ( SELECT [o].[OrderID], [o].[CustomerID], [o].[EmployeeID], [o].[OrderDate] diff --git a/test/EFCore.SqlServer.FunctionalTests/BulkUpdates/TPTFiltersInheritanceBulkUpdatesSqlServerTest.cs b/test/EFCore.SqlServer.FunctionalTests/BulkUpdates/TPTFiltersInheritanceBulkUpdatesSqlServerTest.cs index 2775a72e82a..b46ea9bba80 100644 --- a/test/EFCore.SqlServer.FunctionalTests/BulkUpdates/TPTFiltersInheritanceBulkUpdatesSqlServerTest.cs +++ b/test/EFCore.SqlServer.FunctionalTests/BulkUpdates/TPTFiltersInheritanceBulkUpdatesSqlServerTest.cs @@ -59,7 +59,7 @@ FROM [Animals] AS [a] LEFT JOIN [Birds] AS [b] ON [a].[Id] = [b].[Id] LEFT JOIN [Eagle] AS [e] ON [a].[Id] = [e].[Id] LEFT JOIN [Kiwi] AS [k] ON [a].[Id] = [k].[Id] - WHERE [a].[CountryId] = 1 AND [c].[Id] = [a].[CountryId] AND [k].[Id] IS NOT NULL AND [a].[CountryId] > 0) > 0"); + WHERE [a].[CountryId] = 1 AND [c].[Id] = [a].[CountryId] AND ([k].[Id] IS NOT NULL) AND [a].[CountryId] > 0) > 0"); } public override async Task Delete_where_keyless_entity_mapped_to_sql_query(bool async) @@ -149,7 +149,7 @@ FROM [Animals] AS [a] LEFT JOIN [Birds] AS [b] ON [a].[Id] = [b].[Id] LEFT JOIN [Eagle] AS [e] ON [a].[Id] = [e].[Id] LEFT JOIN [Kiwi] AS [k] ON [a].[Id] = [k].[Id] - WHERE [a].[CountryId] = 1 AND [c].[Id] = [a].[CountryId] AND [k].[Id] IS NOT NULL AND [a].[CountryId] > 0) > 0"); + WHERE [a].[CountryId] = 1 AND [c].[Id] = [a].[CountryId] AND ([k].[Id] IS NOT NULL) AND [a].[CountryId] > 0) > 0"); } public override async Task Update_where_keyless_entity_mapped_to_sql_query(bool async) diff --git a/test/EFCore.SqlServer.FunctionalTests/BulkUpdates/TPTInheritanceBulkUpdatesSqlServerTest.cs b/test/EFCore.SqlServer.FunctionalTests/BulkUpdates/TPTInheritanceBulkUpdatesSqlServerTest.cs index 9c462c05430..362bf4d98cc 100644 --- a/test/EFCore.SqlServer.FunctionalTests/BulkUpdates/TPTInheritanceBulkUpdatesSqlServerTest.cs +++ b/test/EFCore.SqlServer.FunctionalTests/BulkUpdates/TPTInheritanceBulkUpdatesSqlServerTest.cs @@ -130,7 +130,7 @@ FROM [Animals] AS [a] LEFT JOIN [Birds] AS [b] ON [a].[Id] = [b].[Id] LEFT JOIN [Eagle] AS [e] ON [a].[Id] = [e].[Id] LEFT JOIN [Kiwi] AS [k] ON [a].[Id] = [k].[Id] - WHERE [c].[Id] = [a].[CountryId] AND [k].[Id] IS NOT NULL AND [a].[CountryId] > 0) > 0"); + WHERE [c].[Id] = [a].[CountryId] AND ([k].[Id] IS NOT NULL) AND [a].[CountryId] > 0) > 0"); } public override async Task Update_where_keyless_entity_mapped_to_sql_query(bool async) diff --git a/test/EFCore.SqlServer.FunctionalTests/Query/ComplexNavigationsCollectionsQuerySqlServerTest.cs b/test/EFCore.SqlServer.FunctionalTests/Query/ComplexNavigationsCollectionsQuerySqlServerTest.cs index d630d688fbf..59961ebe257 100644 --- a/test/EFCore.SqlServer.FunctionalTests/Query/ComplexNavigationsCollectionsQuerySqlServerTest.cs +++ b/test/EFCore.SqlServer.FunctionalTests/Query/ComplexNavigationsCollectionsQuerySqlServerTest.cs @@ -138,7 +138,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]"); } @@ -173,7 +173,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]"); } @@ -254,7 +254,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]"); } @@ -472,7 +472,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]"); } @@ -533,7 +533,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]"); @@ -704,7 +704,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] @@ -1029,7 +1029,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]"); } @@ -1287,7 +1287,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] @@ -1307,7 +1307,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] @@ -1326,7 +1326,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] @@ -1335,7 +1335,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] @@ -1354,7 +1354,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 ( @@ -1362,7 +1362,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] @@ -1382,7 +1382,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] @@ -1401,7 +1401,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] @@ -1424,7 +1424,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] @@ -1445,7 +1445,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] @@ -1464,7 +1464,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] @@ -1483,7 +1483,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] @@ -1511,7 +1511,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] @@ -1536,7 +1536,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] @@ -1560,7 +1560,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] @@ -1649,7 +1649,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] @@ -1697,7 +1697,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]"); } @@ -2071,7 +2071,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 ( @@ -2079,7 +2079,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] @@ -2375,7 +2375,7 @@ FROM [LevelOne] AS [l] OUTER APPLY ( SELECT TOP(1) 1 AS [c], [l0].[Id] 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] OUTER APPLY ( SELECT [l1].[Name], [l1].[Id] @@ -2423,7 +2423,7 @@ FROM [LevelOne] AS [l] OUTER APPLY ( SELECT [l1].[Id] AS [ChildId], [l0].[Name] AS [ParentName] 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] ORDER BY [l].[Id], [l0].[Id]"); } @@ -2440,7 +2440,7 @@ FROM [LevelOne] AS [l] OUTER APPLY ( SELECT [l2].[Name] AS [Key], COUNT(*) AS [Count] FROM [LevelThree] AS [l2] - WHERE [l0].[Id] IS NOT NULL AND [l0].[Id] = [l2].[OneToMany_Optional_Inverse3Id] + WHERE ([l0].[Id] IS NOT NULL) AND [l0].[Id] = [l2].[OneToMany_Optional_Inverse3Id] GROUP BY [l2].[Name] ) AS [t] ORDER BY [l].[Id], [l0].[Id], [l1].[Id]"); @@ -2497,7 +2497,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]"); } @@ -2558,7 +2558,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] diff --git a/test/EFCore.SqlServer.FunctionalTests/Query/ComplexNavigationsCollectionsSharedTypeQuerySqlServerTest.cs b/test/EFCore.SqlServer.FunctionalTests/Query/ComplexNavigationsCollectionsSharedTypeQuerySqlServerTest.cs index f8bfcf7ed40..cef574f4ec5 100644 --- a/test/EFCore.SqlServer.FunctionalTests/Query/ComplexNavigationsCollectionsSharedTypeQuerySqlServerTest.cs +++ b/test/EFCore.SqlServer.FunctionalTests/Query/ComplexNavigationsCollectionsSharedTypeQuerySqlServerTest.cs @@ -32,11 +32,11 @@ FROM [Level1] AS [l0] LEFT JOIN ( SELECT [l1].[Id], [l1].[OneToOne_Required_PK_Date], [l1].[Level1_Required_Id], [l1].[Level2_Name], [l1].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l1] - 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].[Level2_Name] <> N'Foo' OR [t].[Level2_Name] 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].[Level2_Name] <> N'Foo' OR ([t].[Level2_Name] IS NULL)) ) AS [t0] OUTER APPLY ( SELECT [l2].[Name], [l2].[Id] @@ -44,8 +44,8 @@ FROM [Level1] AS [l2] WHERE EXISTS ( SELECT 1 FROM [Level1] AS [l3] - WHERE [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].[Id0] + WHERE ([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].[Id0] END) ) AS [t1] ORDER BY [l].[Id], [t0].[Id], [t0].[Id0]"); @@ -61,14 +61,14 @@ FROM [Level1] AS [l] 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] - WHERE [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 [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Level3_Name], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[OneToOne_Optional_PK_Inverse3Id] FROM [Level1] AS [l1] - WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[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]"); } @@ -83,14 +83,14 @@ FROM [Level1] AS [l] 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] - WHERE [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 [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] - 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 [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]"); } @@ -109,16 +109,16 @@ 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], [l0].[Id] AS [Id0], [l0].[Date], [l0].[Name] AS [Name0], [t1].[Id] AS [Id1], [t1].[c] FROM ( SELECT TOP(3) [l1].[Id], [l1].[OneToOne_Required_PK_Date], [l1].[Level1_Required_Id], [l1].[Level2_Name], [l1].[OneToMany_Required_Inverse2Id], CASE - WHEN [l1].[OneToOne_Required_PK_Date] IS NOT NULL AND [l1].[Level1_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [l1].[Id] + WHEN ([l1].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l1].[Level1_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [l1].[Id] END AS [c] FROM [Level1] AS [l1] - 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 AND [t].[Id] = [l1].[OneToMany_Required_Inverse2Id] + 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) AND [t].[Id] = [l1].[OneToMany_Required_Inverse2Id] ORDER BY CASE - WHEN [l1].[OneToOne_Required_PK_Date] IS NOT NULL AND [l1].[Level1_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [l1].[Id] + WHEN ([l1].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l1].[Level1_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [l1].[Id] END ) AS [t1] INNER JOIN [Level1] AS [l0] ON [t1].[Level1_Required_Id] = [l0].[Id] @@ -142,16 +142,16 @@ 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], [l0].[Id] AS [Id0], [l0].[Date], [l0].[Name] AS [Name0], [t1].[Id] AS [Id1], [t1].[c] FROM ( SELECT [l1].[Id], [l1].[OneToOne_Required_PK_Date], [l1].[Level1_Required_Id], [l1].[Level2_Name], [l1].[OneToMany_Required_Inverse2Id], CASE - WHEN [l1].[OneToOne_Required_PK_Date] IS NOT NULL AND [l1].[Level1_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [l1].[Id] + WHEN ([l1].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l1].[Level1_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [l1].[Id] END AS [c] FROM [Level1] AS [l1] - 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 AND [t].[Id] = [l1].[OneToMany_Required_Inverse2Id] + 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) AND [t].[Id] = [l1].[OneToMany_Required_Inverse2Id] ORDER BY CASE - WHEN [l1].[OneToOne_Required_PK_Date] IS NOT NULL AND [l1].[Level1_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [l1].[Id] + WHEN ([l1].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l1].[Level1_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [l1].[Id] END OFFSET 1 ROWS FETCH NEXT 3 ROWS ONLY ) AS [t1] @@ -171,14 +171,14 @@ 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]) AS [row] FROM [Level1] AS [l0] - WHERE [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"); } @@ -193,12 +193,12 @@ 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].[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], 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] - WHERE [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] @@ -215,7 +215,7 @@ 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_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id] FROM [Level1] AS [l0] - WHERE [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]"); } @@ -230,14 +230,14 @@ 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_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id] FROM [Level1] AS [l0] - WHERE [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 [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Level3_Name], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[OneToOne_Optional_PK_Inverse3Id] FROM [Level1] AS [l1] - WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[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]"); } @@ -254,7 +254,7 @@ LEFT JOIN ( 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] ORDER BY [l0].[Level2_Name]) AS [row] FROM [Level1] AS [l0] - WHERE [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] @@ -271,42 +271,42 @@ 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_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id] FROM [Level1] AS [l0] - WHERE [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 [l1].[Id], [l1].[Level3_Name], [l1].[OneToOne_Optional_PK_Inverse3Id] FROM [Level1] AS [l1] - WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[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 [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] FROM [Level1] AS [l2] - 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 [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + WHEN ([t].[OneToOne_Required_PK_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] 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] - WHERE [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 [l].[Id] = [t2].[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] FROM [Level1] AS [l4] - 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 [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 [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] FROM [Level1] AS [l5] - 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 [t4] 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 = [t4].[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], [t0].[Id], [t1].[Id], [t2].[Id], [t3].[Id]"); } @@ -328,15 +328,15 @@ OUTER APPLY ( FROM ( 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] FROM [Level1] AS [l0] - WHERE [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 ( SELECT [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Level3_Name], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[OneToOne_Optional_PK_Inverse3Id] FROM [Level1] AS [l1] - WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[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].[Level2_Optional_Id] ) AS [t1] ORDER BY [t].[Id], [t1].[Level2_Name] DESC, [t1].[Id]"); @@ -354,7 +354,7 @@ OUTER APPLY ( FROM ( 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] FROM [Level1] AS [l0] - WHERE [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 ( @@ -362,11 +362,11 @@ LEFT JOIN ( FROM ( SELECT [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Level3_Name], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[OneToOne_Optional_PK_Inverse3Id], ROW_NUMBER() OVER(PARTITION BY [l1].[OneToMany_Required_Inverse3Id] ORDER BY [l1].[Level3_Name] DESC) AS [row] FROM [Level1] AS [l1] - WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL AND ([l1].[Level3_Name] <> N'Bar' OR [l1].[Level3_Name] IS NULL) + WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse3Id] IS NOT NULL) AND ([l1].[Level3_Name] <> N'Bar' OR ([l1].[Level3_Name] IS NULL)) ) AS [t1] WHERE 1 < [t1].[row] ) 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] ) AS [t2] ORDER BY [l].[Id], [t2].[Level2_Name], [t2].[Id], [t2].[OneToMany_Required_Inverse3Id], [t2].[Level3_Name] DESC"); @@ -382,7 +382,7 @@ 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_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id] FROM [Level1] AS [l0] - WHERE [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]"); @@ -400,7 +400,7 @@ LEFT JOIN ( 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] ORDER BY [l0].[Level2_Name]) AS [row] FROM [Level1] AS [l0] - WHERE [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] @@ -417,18 +417,18 @@ 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_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id] FROM [Level1] AS [l0] - WHERE [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], [t1].[Level2_Optional_Id], [t1].[Level2_Required_Id], [t1].[Level3_Name], [t1].[OneToMany_Optional_Inverse3Id], [t1].[OneToMany_Required_Inverse3Id], [t1].[OneToOne_Optional_PK_Inverse3Id] FROM ( SELECT [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Level3_Name], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[OneToOne_Optional_PK_Inverse3Id], ROW_NUMBER() OVER(PARTITION BY [l1].[OneToMany_Optional_Inverse3Id] ORDER BY [l1].[Level3_Name]) AS [row] FROM [Level1] AS [l1] - WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL AND ([l1].[Level3_Name] <> N'Foo' OR [l1].[Level3_Name] IS NULL) + WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse3Id] IS NOT NULL) AND ([l1].[Level3_Name] <> N'Foo' OR ([l1].[Level3_Name] IS NULL)) ) AS [t1] WHERE 1 < [t1].[row] AND [t1].[row] <= 4 ) 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], [t0].[OneToMany_Optional_Inverse3Id], [t0].[Level3_Name]"); } @@ -443,10 +443,10 @@ 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_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id] FROM [Level1] AS [l0] - WHERE [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]"); } @@ -461,7 +461,7 @@ 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_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id] FROM [Level1] AS [l0] - WHERE [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 [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Level3_Name], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[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] @@ -469,15 +469,15 @@ FROM [Level1] AS [l1] LEFT JOIN ( SELECT [l2].[Id], [l2].[Level3_Optional_Id], [l2].[Level3_Required_Id], [l2].[Level4_Name], [l2].[OneToMany_Optional_Inverse4Id], [l2].[OneToMany_Required_Inverse4Id], [l2].[OneToOne_Optional_PK_Inverse4Id] FROM [Level1] AS [l2] - WHERE [l2].[Level3_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse4Id] IS NOT NULL + WHERE ([l2].[Level3_Required_Id] IS NOT NULL) AND ([l2].[OneToMany_Required_Inverse4Id] IS NOT NULL) ) AS [t1] ON CASE - WHEN [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [l1].[Id] + WHEN ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [l1].[Id] END = [t1].[Level3_Required_Id] - WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[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] -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], [t0].[Id]"); } @@ -499,26 +499,26 @@ OFFSET @__p_0 ROWS FETCH NEXT @__p_1 ROWS ONLY 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] - WHERE [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 [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] - 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 [t1] ON [t].[Id] = [t1].[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] FROM [Level1] AS [l2] - 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 [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 [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] FROM [Level1] AS [l3] - 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].[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 = [t3].[OneToMany_Required_Inverse3Id] ORDER BY [t].[Name], [t].[Id], [t0].[Id], [t1].[Id], [t2].[Id]"); } @@ -532,32 +532,32 @@ public override async Task Select_subquery_single_nested_subquery2(bool async) FROM [Level1] AS [l] LEFT JOIN ( SELECT [l0].[Id], [t0].[Id] AS [Id0], [t1].[Id] AS [Id1], [t1].[Id0] AS [Id00], [t0].[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] LEFT JOIN ( SELECT [t].[c], [t].[Id], [t].[Level2_Required_Id], [t].[OneToMany_Required_Inverse3Id], [t].[OneToMany_Optional_Inverse3Id] FROM ( SELECT 1 AS [c], [l1].[Id], [l1].[Level2_Required_Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[OneToMany_Optional_Inverse3Id], ROW_NUMBER() OVER(PARTITION BY [l1].[OneToMany_Optional_Inverse3Id] ORDER BY CASE - WHEN [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [l1].[Id] + WHEN ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [l1].[Id] END) AS [row] FROM [Level1] AS [l1] - WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse3Id] IS NOT NULL) ) AS [t] WHERE [t].[row] <= 1 ) 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] LEFT JOIN ( SELECT CASE - WHEN [l2].[Level3_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse4Id] IS NOT NULL THEN [l2].[Id] + WHEN ([l2].[Level3_Required_Id] IS NOT NULL) AND ([l2].[OneToMany_Required_Inverse4Id] IS NOT NULL) THEN [l2].[Id] END AS [Id], [l2].[Id] AS [Id0], [l2].[OneToMany_Optional_Inverse4Id] FROM [Level1] AS [l2] - WHERE [l2].[Level3_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse4Id] IS NOT NULL + WHERE ([l2].[Level3_Required_Id] IS NOT NULL) AND ([l2].[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] - WHERE [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 [t2] ON [l].[Id] = [t2].[OneToMany_Optional_Inverse2Id] ORDER BY [l].[Id], [t2].[c0], [t2].[Id], [t2].[Id0], [t2].[Id1]"); } @@ -572,14 +572,14 @@ FROM [Level1] AS [l] 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] - WHERE [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 [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Level3_Name], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[OneToOne_Optional_PK_Inverse3Id] FROM [Level1] AS [l1] - WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[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]"); } @@ -594,14 +594,14 @@ 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_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id] FROM [Level1] AS [l0] - WHERE [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 [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Level3_Name], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[OneToOne_Optional_PK_Inverse3Id] FROM [Level1] AS [l1] - WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[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 [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], [t2].[Id] AS [Id0], [t2].[Level2_Optional_Id], [t2].[Level2_Required_Id], [t2].[Level3_Name], [t2].[OneToMany_Optional_Inverse3Id], [t2].[OneToMany_Required_Inverse3Id], [t2].[OneToOne_Optional_PK_Inverse3Id] @@ -609,11 +609,11 @@ FROM [Level1] AS [l2] 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] FROM [Level1] AS [l3] - 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 [t2] ON 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 = [t2].[Level2_Optional_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 [l].[Id] = [t1].[OneToMany_Optional_Inverse2Id] ORDER BY [l].[Id], [t].[Id], [t0].[Id], [t1].[Id]"); } @@ -631,11 +631,11 @@ FROM [Level1] AS [l0] LEFT JOIN ( SELECT [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Level3_Name], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[OneToOne_Optional_PK_Inverse3Id] FROM [Level1] AS [l1] - WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse3Id] IS NOT NULL) ) AS [t] 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 = [t].[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 [t0] ON [l].[Id] = [t0].[OneToMany_Optional_Inverse2Id] ORDER BY [l].[Id], [t0].[Id]"); } @@ -650,14 +650,14 @@ 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_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id] FROM [Level1] AS [l0] - WHERE [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 [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Level3_Name], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[OneToOne_Optional_PK_Inverse3Id] FROM [Level1] AS [l1] - WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[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]"); } @@ -672,21 +672,21 @@ 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] - WHERE [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 [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Level3_Name], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[OneToOne_Optional_PK_Inverse3Id] FROM [Level1] AS [l1] - WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[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 [l2].[Id], [l2].[Level3_Optional_Id], [l2].[Level3_Required_Id], [l2].[Level4_Name], [l2].[OneToMany_Optional_Inverse4Id], [l2].[OneToMany_Required_Inverse4Id], [l2].[OneToOne_Optional_PK_Inverse4Id] FROM [Level1] AS [l2] - WHERE [l2].[Level3_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse4Id] IS NOT NULL + WHERE ([l2].[Level3_Required_Id] IS NOT NULL) AND ([l2].[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] ORDER BY [l].[Id], [t].[Id], [t0].[Id]"); } @@ -701,21 +701,21 @@ FROM [Level1] AS [l] 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] - WHERE [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 [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Level3_Name], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[OneToOne_Optional_PK_Inverse3Id] FROM [Level1] AS [l1] - WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[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 [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] FROM [Level1] AS [l2] - 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 [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + WHEN ([t].[OneToOne_Required_PK_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], [t0].[Id]"); } @@ -730,21 +730,21 @@ FROM [Level1] AS [l] 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] - WHERE [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 [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Level3_Name], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[OneToOne_Optional_PK_Inverse3Id] FROM [Level1] AS [l1] - WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[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 [l2].[Id], [l2].[Level3_Optional_Id], [l2].[Level3_Required_Id], [l2].[Level4_Name], [l2].[OneToMany_Optional_Inverse4Id], [l2].[OneToMany_Required_Inverse4Id], [l2].[OneToOne_Optional_PK_Inverse4Id] FROM [Level1] AS [l2] - WHERE [l2].[Level3_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse4Id] IS NOT NULL + WHERE ([l2].[Level3_Required_Id] IS NOT NULL) AND ([l2].[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] ORDER BY [l].[Id], [t].[Id], [t0].[Id]"); } @@ -760,12 +760,12 @@ 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].[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], 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] - WHERE [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] @@ -790,22 +790,22 @@ FROM [Level1] AS [l1] INNER 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] - 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].[OneToMany_Required_Inverse3Id] = CASE - WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + WHEN ([t].[OneToOne_Required_PK_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] FROM [Level1] AS [l3] - 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 = [t0].[OneToMany_Optional_Inverse3Id] - WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse3Id] IS NOT NULL) ) 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] - WHERE [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 [t2] ON [l].[Id] = [t2].[OneToMany_Optional_Inverse2Id] ORDER BY [l].[Id], [t2].[Id], [t2].[Id0], [t2].[Id00]"); } @@ -820,14 +820,14 @@ FROM [Level1] AS [l] 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] - WHERE [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 [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Level3_Name], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[OneToOne_Optional_PK_Inverse3Id] FROM [Level1] AS [l1] - WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[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]"); } @@ -843,12 +843,12 @@ 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].[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], 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] - WHERE [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 [l1] WHERE [l1].[Id] <> [l0].[Id]) > 1 @@ -890,14 +890,14 @@ FROM [Level1] AS [l] 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] - WHERE [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 [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Level3_Name], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[OneToOne_Optional_PK_Inverse3Id] FROM [Level1] AS [l1] - WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[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]"); } @@ -912,27 +912,27 @@ 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], [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], [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], 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] - WHERE [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 ( SELECT [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Level3_Name], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[OneToOne_Optional_PK_Inverse3Id] FROM [Level1] AS [l1] - WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[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 [l2].[Id], [l2].[Level3_Optional_Id], [l2].[Level3_Required_Id], [l2].[Level4_Name], [l2].[OneToMany_Optional_Inverse4Id], [l2].[OneToMany_Required_Inverse4Id], [l2].[OneToOne_Optional_PK_Inverse4Id] FROM [Level1] AS [l2] - WHERE [l2].[Level3_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse4Id] IS NOT NULL AND [l2].[Id] > 1 + WHERE ([l2].[Level3_Required_Id] IS NOT NULL) AND ([l2].[OneToMany_Required_Inverse4Id] IS NOT NULL) AND [l2].[Id] > 1 ) 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] ) AS [t2] ORDER BY [l].[Id], [t2].[c], [t2].[Id], [t2].[Id0]"); @@ -960,7 +960,7 @@ FROM [Level1] AS [l0] 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] - 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]"); } @@ -997,18 +997,18 @@ 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] - WHERE [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], [t1].[Level2_Optional_Id], [t1].[Level2_Required_Id], [t1].[Level3_Name], [t1].[OneToMany_Optional_Inverse3Id], [t1].[OneToMany_Required_Inverse3Id], [t1].[OneToOne_Optional_PK_Inverse3Id] FROM ( SELECT [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Level3_Name], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[OneToOne_Optional_PK_Inverse3Id], ROW_NUMBER() OVER(PARTITION BY [l1].[OneToMany_Optional_Inverse3Id] ORDER BY [l1].[Id]) AS [row] FROM [Level1] AS [l1] - WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse3Id] IS NOT NULL) ) AS [t1] WHERE [t1].[row] <= 50 ) 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]"); } @@ -1019,27 +1019,27 @@ 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], [t0].[Id], [t1].[Id], [t1].[Level3_Optional_Id], [t1].[Level3_Required_Id], [t1].[Level4_Name], [t1].[OneToMany_Optional_Inverse4Id], [t1].[OneToMany_Required_Inverse4Id], [t1].[OneToOne_Optional_PK_Inverse4Id] 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] FROM [Level1] AS [l0] - WHERE [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 [l1].[Id], [l1].[Level2_Required_Id], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id] FROM [Level1] AS [l1] - WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[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 [l2].[Id], [l2].[Level3_Optional_Id], [l2].[Level3_Required_Id], [l2].[Level4_Name], [l2].[OneToMany_Optional_Inverse4Id], [l2].[OneToMany_Required_Inverse4Id], [l2].[OneToOne_Optional_PK_Inverse4Id] FROM [Level1] AS [l2] - WHERE [l2].[Level3_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse4Id] IS NOT NULL + WHERE ([l2].[Level3_Required_Id] IS NOT NULL) AND ([l2].[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] ORDER BY [l].[Id], [t].[Id], [t0].[Id]"); } @@ -1067,7 +1067,7 @@ OFFSET 1 ROWS FETCH NEXT 5 ROWS ONLY 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] - 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]"); @@ -1087,20 +1087,20 @@ FROM [Level1] AS [l0] 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] - 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 [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] - 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 [l].[Id] = [t1].[OneToMany_Optional_Inverse2Id] ORDER BY [l].[Id], [t0].[Id0], [t0].[Id]"); } @@ -1122,14 +1122,14 @@ OUTER APPLY ( FROM ( 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] FROM [Level1] AS [l0] - WHERE [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 [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Level3_Name], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[OneToOne_Optional_PK_Inverse3Id] FROM [Level1] AS [l1] - WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[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].[Level2_Optional_Id] ) AS [t1] ORDER BY [t].[Id], [t1].[Id]"); @@ -1153,21 +1153,21 @@ OFFSET @__p_0 ROWS FETCH NEXT @__p_1 ROWS ONLY 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] - WHERE [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 [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Level3_Name], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[OneToOne_Optional_PK_Inverse3Id] FROM [Level1] AS [l1] - WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[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 [l2].[Id], [l2].[Level3_Optional_Id], [l2].[Level3_Required_Id], [l2].[Level4_Name], [l2].[OneToMany_Optional_Inverse4Id], [l2].[OneToMany_Required_Inverse4Id], [l2].[OneToOne_Optional_PK_Inverse4Id] FROM [Level1] AS [l2] - WHERE [l2].[Level3_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse4Id] IS NOT NULL + WHERE ([l2].[Level3_Required_Id] IS NOT NULL) AND ([l2].[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] ORDER BY [t].[Name], [t].[Id], [t0].[Id], [t1].[Id]"); } @@ -1178,20 +1178,20 @@ 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], [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] 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] FROM [Level1] AS [l0] - WHERE [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 [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Level3_Name], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[OneToOne_Optional_PK_Inverse3Id] FROM [Level1] AS [l1] - WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[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]"); } @@ -1220,7 +1220,7 @@ WHERE [l0].[Id] > 3 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] - 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]"); } @@ -1235,18 +1235,18 @@ 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_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id] FROM [Level1] AS [l0] - WHERE [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], [t1].[Level2_Optional_Id], [t1].[Level2_Required_Id], [t1].[Level3_Name], [t1].[OneToMany_Optional_Inverse3Id], [t1].[OneToMany_Required_Inverse3Id], [t1].[OneToOne_Optional_PK_Inverse3Id] FROM ( SELECT [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Level3_Name], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[OneToOne_Optional_PK_Inverse3Id], ROW_NUMBER() OVER(PARTITION BY [l1].[OneToMany_Optional_Inverse3Id] ORDER BY [l1].[Level3_Name]) AS [row] FROM [Level1] AS [l1] - WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL AND ([l1].[Level3_Name] <> N'Foo' OR [l1].[Level3_Name] IS NULL) + WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse3Id] IS NOT NULL) AND ([l1].[Level3_Name] <> N'Foo' OR ([l1].[Level3_Name] IS NULL)) ) AS [t1] WHERE 1 < [t1].[row] AND [t1].[row] <= 4 ) 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], [t0].[OneToMany_Optional_Inverse3Id], [t0].[Level3_Name]"); } @@ -1261,14 +1261,14 @@ 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] - WHERE [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 [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Level3_Name], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[OneToOne_Optional_PK_Inverse3Id] FROM [Level1] AS [l1] - WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[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]"); } @@ -1289,19 +1289,19 @@ LEFT JOIN ( SELECT [t1].[Id], [t1].[c], [t1].[Id0], [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], [l0].[OneToMany_Required_Inverse2Id], ROW_NUMBER() OVER(PARTITION BY [l0].[OneToMany_Required_Inverse2Id] ORDER BY [l0].[Id]) AS [row] FROM [Level1] AS [l0] - WHERE [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 [l1].[OneToOne_Required_PK_Date] IS NOT NULL AND [l1].[Level1_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [l1].[Id] + WHEN ([l1].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l1].[Level1_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [l1].[Id] END AS [Id], [l1].[Id] AS [Id0], [l1].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l1] - 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 [t].[Id] = [t2].[OneToMany_Required_Inverse2Id] ORDER BY [t].[Id], [t0].[Id0]"); } @@ -1319,11 +1319,11 @@ FROM [Level1] AS [l0] LEFT JOIN ( SELECT [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Level3_Name], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[OneToOne_Optional_PK_Inverse3Id] FROM [Level1] AS [l1] - WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse3Id] IS NOT NULL) ) AS [t] 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 = [t].[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 [t0] ON [l].[Id] = [t0].[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], [t2].[Id] AS [Id0], [t2].[Level2_Optional_Id], [t2].[Level2_Required_Id], [t2].[Level3_Name], [t2].[OneToMany_Optional_Inverse3Id], [t2].[OneToMany_Required_Inverse3Id], [t2].[OneToOne_Optional_PK_Inverse3Id] @@ -1331,11 +1331,11 @@ FROM [Level1] AS [l2] 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] FROM [Level1] AS [l3] - 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 [t2] ON 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 = [t2].[OneToOne_Optional_PK_Inverse3Id] - 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 [l].[Id] = [t1].[OneToMany_Optional_Inverse2Id] ORDER BY [l].[Id], [t0].[Id], [t0].[Id0], [t1].[Id]"); } @@ -1350,14 +1350,14 @@ 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] - WHERE [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 [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Level3_Name], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[OneToOne_Optional_PK_Inverse3Id] FROM [Level1] AS [l1] - WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[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]"); } @@ -1374,7 +1374,7 @@ LEFT JOIN ( 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] ORDER BY [l0].[Level2_Name]) AS [row] FROM [Level1] AS [l0] - WHERE [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] @@ -1383,7 +1383,7 @@ LEFT JOIN ( FROM ( 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], ROW_NUMBER() OVER(PARTITION BY [l1].[OneToMany_Required_Inverse2Id] ORDER BY [l1].[Level2_Name] DESC) AS [row] FROM [Level1] AS [l1] - 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 AND ([l1].[Level2_Name] <> N'Bar' OR [l1].[Level2_Name] IS 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) AND ([l1].[Level2_Name] <> N'Bar' OR ([l1].[Level2_Name] IS NULL)) ) AS [t2] WHERE 1 < [t2].[row] ) AS [t1] ON [l].[Id] = [t1].[OneToMany_Required_Inverse2Id] @@ -1403,32 +1403,32 @@ FROM [Level1] AS [l0] LEFT JOIN ( SELECT [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Level3_Name], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[OneToOne_Optional_PK_Inverse3Id] FROM [Level1] AS [l1] - WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse3Id] IS NOT NULL) ) AS [t] 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 = [t].[OneToOne_Optional_PK_Inverse3Id] LEFT JOIN ( SELECT [l2].[Id], [l2].[Level3_Optional_Id], [l2].[Level3_Required_Id], [l2].[Level4_Name], [l2].[OneToMany_Optional_Inverse4Id], [l2].[OneToMany_Required_Inverse4Id], [l2].[OneToOne_Optional_PK_Inverse4Id] FROM [Level1] AS [l2] - WHERE [l2].[Level3_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse4Id] IS NOT NULL + WHERE ([l2].[Level3_Required_Id] IS NOT NULL) AND ([l2].[OneToMany_Required_Inverse4Id] IS NOT NULL) ) AS [t0] ON CASE - WHEN [t].[Level2_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [t].[Id] + WHEN ([t].[Level2_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [t].[Id] END = [t0].[Level3_Optional_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] FROM [Level1] AS [l3] - 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 [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].[Level2_Optional_Id] LEFT JOIN ( SELECT [l4].[Id], [l4].[Level3_Optional_Id], [l4].[Level3_Required_Id], [l4].[Level4_Name], [l4].[OneToMany_Optional_Inverse4Id], [l4].[OneToMany_Required_Inverse4Id], [l4].[OneToOne_Optional_PK_Inverse4Id] FROM [Level1] AS [l4] - WHERE [l4].[Level3_Required_Id] IS NOT NULL AND [l4].[OneToMany_Required_Inverse4Id] IS NOT NULL + WHERE ([l4].[Level3_Required_Id] IS NOT NULL) AND ([l4].[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 [t3] ON [l].[Id] = [t3].[OneToMany_Optional_Inverse2Id] ORDER BY [l].[Id], [t3].[Id], [t3].[Id0], [t3].[Id1], [t3].[Id2]"); } @@ -1449,12 +1449,12 @@ 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].[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], 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] - WHERE [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] @@ -1474,11 +1474,11 @@ FROM [Level1] AS [l0] LEFT JOIN ( SELECT [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Level3_Name], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[OneToOne_Optional_PK_Inverse3Id] FROM [Level1] AS [l1] - WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse3Id] IS NOT NULL) ) AS [t] 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 = [t].[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 [t0] ON [l].[Id] = [t0].[OneToMany_Optional_Inverse2Id] ORDER BY [l].[Id], [t0].[Id]"); } @@ -1501,21 +1501,21 @@ OFFSET @__p_0 ROWS FETCH NEXT @__p_1 ROWS ONLY 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] - WHERE [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 [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Level3_Name], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[OneToOne_Optional_PK_Inverse3Id] FROM [Level1] AS [l1] - WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[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 [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] FROM [Level1] AS [l2] - 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 [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_Required_Inverse3Id] ORDER BY [t].[Name], [t].[Id], [t0].[Id], [t1].[Id]"); } @@ -1540,16 +1540,16 @@ OUTER APPLY ( 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] FROM [Level1] AS [l0] - WHERE [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] LEFT JOIN ( SELECT [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Level3_Name], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[OneToOne_Optional_PK_Inverse3Id] FROM [Level1] AS [l1] - WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[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].[Level2_Optional_Id] ) AS [t1] ORDER BY [t].[Id] DESC, [t1].[Level2_Name] DESC, [t1].[Id]"); @@ -1578,7 +1578,7 @@ OFFSET 1 ROWS FETCH NEXT 5 ROWS ONLY 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] - 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]"); @@ -1593,18 +1593,18 @@ public override async Task Null_check_in_anonymous_type_projection_should_not_be FROM [Level1] AS [l] LEFT JOIN ( SELECT CASE - WHEN [t].[Level2_Required_Id] IS NULL OR [t].[OneToMany_Required_Inverse3Id] IS NULL THEN CAST(1 AS bit) + WHEN ([t].[Level2_Required_Id] IS NULL) OR ([t].[OneToMany_Required_Inverse3Id] IS NULL) THEN CAST(1 AS bit) ELSE CAST(0 AS bit) END AS [c], [t].[Level3_Name], [l0].[Id], [t].[Id] AS [Id0], [l0].[OneToMany_Optional_Inverse2Id] FROM [Level1] AS [l0] LEFT JOIN ( SELECT [l1].[Id], [l1].[Level2_Required_Id], [l1].[Level3_Name], [l1].[OneToMany_Required_Inverse3Id] FROM [Level1] AS [l1] - WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse3Id] IS NOT NULL) ) AS [t] 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 = [t].[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 [t0] ON [l].[Id] = [t0].[OneToMany_Optional_Inverse2Id] ORDER BY [l].[Id], [t0].[Id]"); } @@ -1621,7 +1621,7 @@ LEFT JOIN ( 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] ORDER BY [l0].[Id]) AS [row] FROM [Level1] AS [l0] - WHERE [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] @@ -1638,7 +1638,7 @@ 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_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id] FROM [Level1] AS [l0] - WHERE [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]"); } @@ -1656,18 +1656,18 @@ FROM [Level1] AS [l0] LEFT JOIN ( SELECT [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Level3_Name], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[OneToOne_Optional_PK_Inverse3Id] FROM [Level1] AS [l1] - WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse3Id] IS NOT NULL) ) AS [t] 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 = [t].[OneToOne_Optional_PK_Inverse3Id] LEFT JOIN ( SELECT [l2].[Id], [l2].[Level3_Optional_Id], [l2].[Level3_Required_Id], [l2].[Level4_Name], [l2].[OneToMany_Optional_Inverse4Id], [l2].[OneToMany_Required_Inverse4Id], [l2].[OneToOne_Optional_PK_Inverse4Id] FROM [Level1] AS [l2] - WHERE [l2].[Level3_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse4Id] IS NOT NULL + WHERE ([l2].[Level3_Required_Id] IS NOT NULL) AND ([l2].[OneToMany_Required_Inverse4Id] IS NOT NULL) ) AS [t0] ON CASE - WHEN [t].[Level2_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [t].[Id] + WHEN ([t].[Level2_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [t].[Id] END = [t0].[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 [t1] ON [l].[Id] = [t1].[OneToMany_Optional_Inverse2Id] ORDER BY [l].[Id], [t1].[Id], [t1].[Id0]"); } @@ -1685,11 +1685,11 @@ FROM [Level1] AS [l0] LEFT JOIN ( SELECT [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Level3_Name], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[OneToOne_Optional_PK_Inverse3Id] FROM [Level1] AS [l1] - WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse3Id] IS NOT NULL) ) AS [t] 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 = [t].[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 [t0] ON [l].[Id] = [t0].[OneToMany_Optional_Inverse2Id] ORDER BY [l].[Id], [t0].[Level2_Name], [t0].[Id], [t0].[Level3_Name] DESC"); } @@ -1708,36 +1708,36 @@ OUTER APPLY ( SELECT [t].[Id], [t].[Level2_Optional_Id], [t].[Level2_Required_Id], [t].[Level3_Name], [t].[OneToMany_Optional_Inverse3Id], [t].[OneToMany_Required_Inverse3Id], [t].[OneToOne_Optional_PK_Inverse3Id], [t0].[Id] AS [Id0], [t0].[Level3_Optional_Id], [t0].[Level3_Required_Id], [t0].[Level4_Name], [t0].[OneToMany_Optional_Inverse4Id], [t0].[OneToMany_Required_Inverse4Id], [t0].[OneToOne_Optional_PK_Inverse4Id], [t1].[Id] AS [Id1], [t1].[Level3_Optional_Id] AS [Level3_Optional_Id0], [t1].[Level3_Required_Id] AS [Level3_Required_Id0], [t1].[Level4_Name] AS [Level4_Name0], [t1].[OneToMany_Optional_Inverse4Id] AS [OneToMany_Optional_Inverse4Id0], [t1].[OneToMany_Required_Inverse4Id] AS [OneToMany_Required_Inverse4Id0], [t1].[OneToOne_Optional_PK_Inverse4Id] AS [OneToOne_Optional_PK_Inverse4Id0], [t].[c] FROM ( SELECT TOP(1) [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Level3_Name], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[OneToOne_Optional_PK_Inverse3Id], CASE - WHEN [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [l1].[Id] + WHEN ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [l1].[Id] END AS [c] FROM [Level1] AS [l1] - WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[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 = [l1].[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 [l1].[OneToMany_Optional_Inverse3Id] IS NULL)) AND ([l1].[Level3_Name] <> N'Foo' OR [l1].[Level3_Name] IS NULL) + WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[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 = [l1].[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 ([l1].[OneToMany_Optional_Inverse3Id] IS NULL))) AND ([l1].[Level3_Name] <> N'Foo' OR ([l1].[Level3_Name] IS NULL)) ORDER BY CASE - WHEN [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [l1].[Id] + WHEN ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [l1].[Id] END ) AS [t] LEFT JOIN ( SELECT [l2].[Id], [l2].[Level3_Optional_Id], [l2].[Level3_Required_Id], [l2].[Level4_Name], [l2].[OneToMany_Optional_Inverse4Id], [l2].[OneToMany_Required_Inverse4Id], [l2].[OneToOne_Optional_PK_Inverse4Id] FROM [Level1] AS [l2] - WHERE [l2].[Level3_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse4Id] IS NOT NULL + WHERE ([l2].[Level3_Required_Id] IS NOT NULL) AND ([l2].[OneToMany_Required_Inverse4Id] IS NOT NULL) ) AS [t0] ON CASE - WHEN [t].[Level2_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [t].[Id] + WHEN ([t].[Level2_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [t].[Id] END = [t0].[OneToMany_Optional_Inverse4Id] LEFT JOIN ( SELECT [l3].[Id], [l3].[Level3_Optional_Id], [l3].[Level3_Required_Id], [l3].[Level4_Name], [l3].[OneToMany_Optional_Inverse4Id], [l3].[OneToMany_Required_Inverse4Id], [l3].[OneToOne_Optional_PK_Inverse4Id] FROM [Level1] AS [l3] - WHERE [l3].[Level3_Required_Id] IS NOT NULL AND [l3].[OneToMany_Required_Inverse4Id] IS NOT NULL + WHERE ([l3].[Level3_Required_Id] IS NOT NULL) AND ([l3].[OneToMany_Required_Inverse4Id] IS NOT NULL) ) AS [t1] ON CASE - WHEN [t].[Level2_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [t].[Id] + WHEN ([t].[Level2_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [t].[Id] END = [t1].[OneToMany_Required_Inverse4Id] ) AS [t2] - WHERE [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 [t3] ON [l].[Id] = [t3].[OneToMany_Optional_Inverse2Id] ORDER BY [l].[Id], [t3].[Id], [t3].[c], [t3].[Id0], [t3].[Id00]"); } @@ -1752,7 +1752,7 @@ 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_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id] FROM [Level1] AS [l0] - WHERE [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]"); } @@ -1767,17 +1767,17 @@ 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_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id] FROM [Level1] AS [l0] - WHERE [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 [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Level3_Name], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[OneToOne_Optional_PK_Inverse3Id] FROM [Level1] AS [l1] - WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[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]"); } @@ -1791,21 +1791,21 @@ 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] - WHERE [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 [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Level3_Name], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[OneToOne_Optional_PK_Inverse3Id] FROM [Level1] AS [l1] - WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[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 [l2].[Id], [l2].[Level3_Optional_Id], [l2].[Level3_Required_Id], [l2].[Level4_Name], [l2].[OneToMany_Optional_Inverse4Id], [l2].[OneToMany_Required_Inverse4Id], [l2].[OneToOne_Optional_PK_Inverse4Id] FROM [Level1] AS [l2] - WHERE [l2].[Level3_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse4Id] IS NOT NULL + WHERE ([l2].[Level3_Required_Id] IS NOT NULL) AND ([l2].[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] ORDER BY [l].[Id], [t].[Id], [t0].[Id]"); } @@ -1820,14 +1820,14 @@ FROM [Level1] AS [l] 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] - WHERE [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 [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Level3_Name], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[OneToOne_Optional_PK_Inverse3Id] FROM [Level1] AS [l1] - WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[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]"); } @@ -1845,11 +1845,11 @@ FROM [Level1] AS [l0] LEFT JOIN ( SELECT [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Level3_Name], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[OneToOne_Optional_PK_Inverse3Id] FROM [Level1] AS [l1] - WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse3Id] IS NOT NULL) ) AS [t] 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 = [t].[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 [t0] ON [l].[Id] = [t0].[OneToMany_Optional_Inverse2Id] ORDER BY [l].[Id], [t0].[Id]"); } @@ -1863,10 +1863,10 @@ 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], [l0].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l0] - WHERE [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]"); } @@ -1881,7 +1881,7 @@ 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_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id] FROM [Level1] AS [l0] - WHERE [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]"); } @@ -1896,14 +1896,14 @@ 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_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id] FROM [Level1] AS [l0] - WHERE [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 [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Level3_Name], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[OneToOne_Optional_PK_Inverse3Id] FROM [Level1] AS [l1] - WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[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 [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], [t2].[Id] AS [Id0], [t2].[Level2_Optional_Id], [t2].[Level2_Required_Id], [t2].[Level3_Name], [t2].[OneToMany_Optional_Inverse3Id], [t2].[OneToMany_Required_Inverse3Id], [t2].[OneToOne_Optional_PK_Inverse3Id] @@ -1911,11 +1911,11 @@ FROM [Level1] AS [l2] 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] FROM [Level1] AS [l3] - 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 [t2] ON 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 = [t2].[Level2_Optional_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 [l].[Id] = [t1].[OneToMany_Optional_Inverse2Id] ORDER BY [l].[Id], [t].[Id], [t0].[Id], [t1].[Id]"); } @@ -1930,14 +1930,14 @@ 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] - WHERE [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 [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Level3_Name], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[OneToOne_Optional_PK_Inverse3Id] FROM [Level1] AS [l1] - WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[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]"); } @@ -1953,12 +1953,12 @@ 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].[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], 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] - WHERE [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] @@ -1984,14 +1984,14 @@ OUTER APPLY ( FROM ( 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] FROM [Level1] AS [l0] - WHERE [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 [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Level3_Name], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[OneToOne_Optional_PK_Inverse3Id] FROM [Level1] AS [l1] - WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[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].[Level2_Optional_Id] ) AS [t1] ORDER BY [t].[Id], [t1].[Id]"); @@ -2007,12 +2007,12 @@ 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_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id] FROM [Level1] AS [l0] - WHERE [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 [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] - 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 [t0] ON [l].[Id] = [t0].[OneToMany_Optional_Inverse2Id] ORDER BY [l].[Id], [t].[Id]"); } @@ -2029,7 +2029,7 @@ LEFT JOIN ( FROM ( SELECT 1 AS [c], [l0].[Id], [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]) AS [row] FROM [Level1] AS [l0] - WHERE [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] @@ -2039,8 +2039,8 @@ FROM [Level1] AS [l1] WHERE EXISTS ( SELECT 1 FROM [Level1] AS [l2] - 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 [l1].[Id] = [l2].[OneToMany_Optional_Inverse2Id] AND [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] + 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 [l1].[Id] = [l2].[OneToMany_Optional_Inverse2Id] AND [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] END) ) AS [t1] ORDER BY [l].[Id], [t0].[Id]"); @@ -2056,27 +2056,27 @@ 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] - WHERE [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 [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] - 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 [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].[c] FROM ( 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], 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], 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] - 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 [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 [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], [t4].[Id] AS [Id0], [t4].[Level3_Optional_Id], [t4].[Level3_Required_Id], [t4].[Level4_Name], [t4].[OneToMany_Optional_Inverse4Id], [t4].[OneToMany_Required_Inverse4Id], [t4].[OneToOne_Optional_PK_Inverse4Id] @@ -2084,18 +2084,18 @@ FROM [Level1] AS [l3] LEFT JOIN ( SELECT [l4].[Id], [l4].[Level3_Optional_Id], [l4].[Level3_Required_Id], [l4].[Level4_Name], [l4].[OneToMany_Optional_Inverse4Id], [l4].[OneToMany_Required_Inverse4Id], [l4].[OneToOne_Optional_PK_Inverse4Id] FROM [Level1] AS [l4] - WHERE [l4].[Level3_Required_Id] IS NOT NULL AND [l4].[OneToMany_Required_Inverse4Id] IS NOT NULL + WHERE ([l4].[Level3_Required_Id] IS NOT NULL) AND ([l4].[OneToMany_Required_Inverse4Id] IS NOT NULL) ) AS [t4] ON CASE - WHEN [l3].[Level2_Required_Id] IS NOT NULL AND [l3].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [l3].[Id] + WHEN ([l3].[Level2_Required_Id] IS NOT NULL) AND ([l3].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [l3].[Id] END = [t4].[Level3_Optional_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 [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] 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], [t0].[Id], [t1].[OneToMany_Optional_Inverse3Id], [t1].[c], [t1].[Id], [t3].[Id]"); } @@ -2110,28 +2110,28 @@ 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] FROM [Level1] AS [l0] - WHERE [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 [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Level3_Name], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[OneToOne_Optional_PK_Inverse3Id] FROM [Level1] AS [l1] - WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[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 [l2].[Id], [l2].[Level3_Optional_Id], [l2].[Level3_Required_Id], [l2].[Level4_Name], [l2].[OneToMany_Optional_Inverse4Id], [l2].[OneToMany_Required_Inverse4Id], [l2].[OneToOne_Optional_PK_Inverse4Id] FROM [Level1] AS [l2] - WHERE [l2].[Level3_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse4Id] IS NOT NULL + WHERE ([l2].[Level3_Required_Id] IS NOT NULL) AND ([l2].[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_Required_Id] LEFT JOIN ( SELECT [l3].[Id], [l3].[Level3_Optional_Id], [l3].[Level3_Required_Id], [l3].[Level4_Name], [l3].[OneToMany_Optional_Inverse4Id], [l3].[OneToMany_Required_Inverse4Id], [l3].[OneToOne_Optional_PK_Inverse4Id] FROM [Level1] AS [l3] - WHERE [l3].[Level3_Required_Id] IS NOT NULL AND [l3].[OneToMany_Required_Inverse4Id] IS NOT NULL + WHERE ([l3].[Level3_Required_Id] IS NOT NULL) AND ([l3].[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], [t0].[Id], [t1].[Id]"); } @@ -2150,7 +2150,7 @@ 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_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id] FROM [Level1] AS [l0] - WHERE [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]"); } @@ -2165,14 +2165,14 @@ FROM [Level1] AS [l] 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] - WHERE [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 [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Level3_Name], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[OneToOne_Optional_PK_Inverse3Id] FROM [Level1] AS [l1] - WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[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]"); } @@ -2188,21 +2188,21 @@ LEFT JOIN ( SELECT [t].[c], [t].[Id], [t].[OneToOne_Required_PK_Date], [t].[Level1_Required_Id], [t].[OneToMany_Required_Inverse2Id], [t].[OneToMany_Optional_Inverse2Id] FROM ( SELECT 1 AS [c], [l0].[Id], [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] - WHERE [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 [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [l1].[Id] + WHEN ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [l1].[Id] END AS [Id], [l1].[Id] AS [Id0], [l1].[OneToMany_Optional_Inverse3Id] FROM [Level1] AS [l1] - WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[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], [t1].[Id]"); } @@ -2217,7 +2217,7 @@ 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_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id] FROM [Level1] AS [l0] - WHERE [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]"); } @@ -2233,27 +2233,27 @@ 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], [t1].[Id] AS [Id1], [t1].[Level2_Optional_Id], [t1].[Level2_Required_Id], [t1].[Level3_Name], [t1].[OneToMany_Optional_Inverse3Id], [t1].[OneToMany_Required_Inverse3Id], [t1].[OneToOne_Optional_PK_Inverse3Id], [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], 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] - WHERE [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 ( SELECT [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Level3_Name], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[OneToOne_Optional_PK_Inverse3Id] FROM [Level1] AS [l1] - WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[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 [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] FROM [Level1] AS [l2] - 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 [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + WHEN ([t].[OneToOne_Required_PK_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] ) AS [t2] ORDER BY [l].[Id], [t2].[c], [t2].[Id], [t2].[Id0]"); @@ -2269,7 +2269,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] @@ -2282,7 +2282,7 @@ FROM [Level1] AS [l0] 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] - 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]"); } @@ -2300,12 +2300,12 @@ 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].[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], 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] - WHERE [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] @@ -2325,11 +2325,11 @@ FROM [Level1] AS [l0] LEFT JOIN ( SELECT [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Level3_Name], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[OneToOne_Optional_PK_Inverse3Id] FROM [Level1] AS [l1] - WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse3Id] IS NOT NULL) ) AS [t] 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 = [t].[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 [t0] ON [l].[Id] = [t0].[OneToMany_Optional_Inverse2Id] ORDER BY [l].[Id], [t0].[Id], [t0].[Level3_Name]"); } @@ -2347,27 +2347,27 @@ 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], [t1].[Id] AS [Id1], [t1].[Level2_Optional_Id], [t1].[Level2_Required_Id], [t1].[Level3_Name], [t1].[OneToMany_Optional_Inverse3Id], [t1].[OneToMany_Required_Inverse3Id], [t1].[OneToOne_Optional_PK_Inverse3Id], [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], 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] - WHERE [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 ( SELECT [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Level3_Name], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[OneToOne_Optional_PK_Inverse3Id] FROM [Level1] AS [l1] - WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[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 [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] FROM [Level1] AS [l2] - 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 [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + WHEN ([t].[OneToOne_Required_PK_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] ) AS [t2] ORDER BY [l].[Id], [t2].[c], [t2].[Id], [t2].[Id0]"); @@ -2385,7 +2385,7 @@ LEFT JOIN ( 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] ORDER BY [l0].[Id]) AS [row] FROM [Level1] AS [l0] - WHERE [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] @@ -2427,32 +2427,32 @@ FROM [Level1] AS [l0] LEFT JOIN ( SELECT [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Level3_Name], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[OneToOne_Optional_PK_Inverse3Id] FROM [Level1] AS [l1] - WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse3Id] IS NOT NULL) ) AS [t] 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 = [t].[OneToOne_Optional_PK_Inverse3Id] LEFT JOIN ( SELECT [l2].[Id], [l2].[Level3_Optional_Id], [l2].[Level3_Required_Id], [l2].[Level4_Name], [l2].[OneToMany_Optional_Inverse4Id], [l2].[OneToMany_Required_Inverse4Id], [l2].[OneToOne_Optional_PK_Inverse4Id] FROM [Level1] AS [l2] - WHERE [l2].[Level3_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse4Id] IS NOT NULL + WHERE ([l2].[Level3_Required_Id] IS NOT NULL) AND ([l2].[OneToMany_Required_Inverse4Id] IS NOT NULL) ) AS [t0] ON CASE - WHEN [t].[Level2_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [t].[Id] + WHEN ([t].[Level2_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [t].[Id] END = [t0].[Level3_Optional_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] FROM [Level1] AS [l3] - 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 [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].[Level2_Optional_Id] LEFT JOIN ( SELECT [l4].[Id], [l4].[Level3_Optional_Id], [l4].[Level3_Required_Id], [l4].[Level4_Name], [l4].[OneToMany_Optional_Inverse4Id], [l4].[OneToMany_Required_Inverse4Id], [l4].[OneToOne_Optional_PK_Inverse4Id] FROM [Level1] AS [l4] - WHERE [l4].[Level3_Required_Id] IS NOT NULL AND [l4].[OneToMany_Required_Inverse4Id] IS NOT NULL + WHERE ([l4].[Level3_Required_Id] IS NOT NULL) AND ([l4].[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 [t3] ON [l].[Id] = [t3].[OneToMany_Optional_Inverse2Id] ORDER BY [l].[Id], [t3].[Id], [t3].[Id0], [t3].[Id1], [t3].[Id2]"); } @@ -2469,7 +2469,7 @@ LEFT JOIN ( 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] ORDER BY [l0].[Id]) AS [row] FROM [Level1] AS [l0] - WHERE [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] @@ -2486,7 +2486,7 @@ 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_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id] FROM [Level1] AS [l0] - WHERE [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 [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Level3_Name], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[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] @@ -2494,13 +2494,13 @@ FROM [Level1] AS [l1] LEFT JOIN ( SELECT [l2].[Id], [l2].[Level3_Optional_Id], [l2].[Level3_Required_Id], [l2].[Level4_Name], [l2].[OneToMany_Optional_Inverse4Id], [l2].[OneToMany_Required_Inverse4Id], [l2].[OneToOne_Optional_PK_Inverse4Id] FROM [Level1] AS [l2] - WHERE [l2].[Level3_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse4Id] IS NOT NULL + WHERE ([l2].[Level3_Required_Id] IS NOT NULL) AND ([l2].[OneToMany_Required_Inverse4Id] IS NOT NULL) ) AS [t1] ON CASE - WHEN [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [l1].[Id] + WHEN ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [l1].[Id] END = [t1].[Level3_Optional_Id] - WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[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], [t0].[Id]"); } @@ -2515,19 +2515,19 @@ 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_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id] FROM [Level1] AS [l0] - WHERE [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 [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Level3_Name], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[OneToOne_Optional_PK_Inverse3Id] FROM [Level1] AS [l1] - WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[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 [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] - 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 [l].[Id] = [t1].[OneToMany_Required_Inverse2Id] ORDER BY [l].[Id], [t].[Id], [t0].[Id]"); } @@ -2542,14 +2542,14 @@ 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_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id] FROM [Level1] AS [l0] - WHERE [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 [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Level3_Name], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[OneToOne_Optional_PK_Inverse3Id] FROM [Level1] AS [l1] - WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[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]"); } @@ -2564,12 +2564,12 @@ 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] - WHERE [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 [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] - 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 [t0] ON [l].[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].[Level3_Optional_Id], [t2].[Level3_Required_Id], [t2].[Level4_Name], [t2].[OneToMany_Optional_Inverse4Id], [t2].[OneToMany_Required_Inverse4Id], [t2].[OneToOne_Optional_PK_Inverse4Id] @@ -2577,18 +2577,18 @@ FROM [Level1] AS [l2] LEFT JOIN ( SELECT [l3].[Id], [l3].[Level3_Optional_Id], [l3].[Level3_Required_Id], [l3].[Level4_Name], [l3].[OneToMany_Optional_Inverse4Id], [l3].[OneToMany_Required_Inverse4Id], [l3].[OneToOne_Optional_PK_Inverse4Id] FROM [Level1] AS [l3] - WHERE [l3].[Level3_Required_Id] IS NOT NULL AND [l3].[OneToMany_Required_Inverse4Id] IS NOT NULL + WHERE ([l3].[Level3_Required_Id] IS NOT NULL) AND ([l3].[OneToMany_Required_Inverse4Id] IS NOT NULL) ) AS [t2] 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 = [t2].[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 [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 CASE - WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + WHEN ([t].[OneToOne_Required_PK_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], [t0].[Id], [t1].[Id]"); } @@ -2606,18 +2606,18 @@ FROM [Level1] AS [l2] 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] FROM [Level1] AS [l3] - 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 [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 = [t0].[OneToOne_Optional_PK_Inverse3Id] LEFT JOIN ( SELECT [l4].[Id], [l4].[Level3_Optional_Id], [l4].[Level3_Required_Id], [l4].[Level4_Name], [l4].[OneToMany_Optional_Inverse4Id], [l4].[OneToMany_Required_Inverse4Id], [l4].[OneToOne_Optional_PK_Inverse4Id] FROM [Level1] AS [l4] - WHERE [l4].[Level3_Required_Id] IS NOT NULL AND [l4].[OneToMany_Required_Inverse4Id] IS NOT NULL + WHERE ([l4].[Level3_Required_Id] IS NOT NULL) AND ([l4].[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 [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 [l].[Id] = [t1].[OneToMany_Optional_Inverse2Id] WHERE ( SELECT COUNT(*) @@ -2625,11 +2625,11 @@ FROM [Level1] AS [l0] LEFT JOIN ( SELECT [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Level3_Name], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[OneToOne_Optional_PK_Inverse3Id] FROM [Level1] AS [l1] - WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse3Id] IS NOT NULL) ) AS [t] 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 = [t].[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 ([t].[Level3_Name] <> N'Foo' OR [t].[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 ([t].[Level3_Name] <> N'Foo' OR ([t].[Level3_Name] IS NULL))) > 0 ORDER BY [l].[Id], [t1].[Id], [t1].[Id0]"); } @@ -2643,7 +2643,7 @@ 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_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id] FROM [Level1] AS [l0] - WHERE [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]"); } @@ -2654,8 +2654,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], [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] FROM [Level1] AS [l] LEFT JOIN ( @@ -2664,18 +2664,18 @@ 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] - 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 [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] FROM [Level1] AS [l2] - 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].[OneToMany_Required_Inverse3Id] WHERE [l].[Name] IN (N'L1 01', N'L1 02') ORDER BY [l].[Id], [t0].[Id], [t0].[Id0]"); @@ -2694,11 +2694,11 @@ FROM [Level1] AS [l0] LEFT JOIN ( SELECT [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Level3_Name], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[OneToOne_Optional_PK_Inverse3Id] FROM [Level1] AS [l1] - WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse3Id] IS NOT NULL) ) AS [t] 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 = [t].[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 [t0] ON [l].[Id] = [t0].[OneToMany_Optional_Inverse2Id] ORDER BY [l].[Id], [t0].[Id]"); } @@ -2734,18 +2734,18 @@ public override async Task Null_check_in_Dto_projection_should_not_be_removed(bo FROM [Level1] AS [l] LEFT JOIN ( SELECT CASE - WHEN [t].[Level2_Required_Id] IS NULL OR [t].[OneToMany_Required_Inverse3Id] IS NULL THEN CAST(1 AS bit) + WHEN ([t].[Level2_Required_Id] IS NULL) OR ([t].[OneToMany_Required_Inverse3Id] IS NULL) THEN CAST(1 AS bit) ELSE CAST(0 AS bit) END AS [c], [t].[Level3_Name], [l0].[Id], [t].[Id] AS [Id0], [l0].[OneToMany_Optional_Inverse2Id] FROM [Level1] AS [l0] LEFT JOIN ( SELECT [l1].[Id], [l1].[Level2_Required_Id], [l1].[Level3_Name], [l1].[OneToMany_Required_Inverse3Id] FROM [Level1] AS [l1] - WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse3Id] IS NOT NULL) ) AS [t] 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 = [t].[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 [t0] ON [l].[Id] = [t0].[OneToMany_Optional_Inverse2Id] ORDER BY [l].[Id], [t0].[Id]"); } @@ -2762,7 +2762,7 @@ LEFT JOIN ( 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] ORDER BY [l0].[Level2_Name]) AS [row] FROM [Level1] AS [l0] - WHERE [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] @@ -2781,7 +2781,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 ( @@ -2789,7 +2789,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] @@ -2808,12 +2808,12 @@ 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].[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], 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] - WHERE [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] @@ -2852,14 +2852,14 @@ 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_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id] FROM [Level1] AS [l0] - WHERE [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 [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Level3_Name], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[OneToOne_Optional_PK_Inverse3Id] FROM [Level1] AS [l1] - WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[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]"); } @@ -2901,18 +2901,18 @@ FROM [Level1] AS [l0] LEFT JOIN ( SELECT [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Level3_Name], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[OneToOne_Optional_PK_Inverse3Id] FROM [Level1] AS [l1] - WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse3Id] IS NOT NULL) ) AS [t] 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 = [t].[OneToOne_Optional_PK_Inverse3Id] LEFT JOIN ( SELECT [l2].[Id], [l2].[Level3_Optional_Id], [l2].[Level3_Required_Id], [l2].[Level4_Name], [l2].[OneToMany_Optional_Inverse4Id], [l2].[OneToMany_Required_Inverse4Id], [l2].[OneToOne_Optional_PK_Inverse4Id] FROM [Level1] AS [l2] - WHERE [l2].[Level3_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse4Id] IS NOT NULL + WHERE ([l2].[Level3_Required_Id] IS NOT NULL) AND ([l2].[OneToMany_Required_Inverse4Id] IS NOT NULL) ) AS [t0] ON CASE - WHEN [t].[Level2_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [t].[Id] + WHEN ([t].[Level2_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [t].[Id] END = [t0].[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 [t1] ON [l].[Id] = [t1].[OneToMany_Optional_Inverse2Id] ORDER BY [l].[Id], [t1].[Id], [t1].[Id0]"); } @@ -2931,36 +2931,36 @@ OUTER APPLY ( SELECT [t].[Id], [t].[Level2_Optional_Id], [t].[Level2_Required_Id], [t].[Level3_Name], [t].[OneToMany_Optional_Inverse3Id], [t].[OneToMany_Required_Inverse3Id], [t].[OneToOne_Optional_PK_Inverse3Id], [t0].[Id] AS [Id0], [t0].[Level3_Optional_Id], [t0].[Level3_Required_Id], [t0].[Level4_Name], [t0].[OneToMany_Optional_Inverse4Id], [t0].[OneToMany_Required_Inverse4Id], [t0].[OneToOne_Optional_PK_Inverse4Id], [t1].[Id] AS [Id1], [t1].[Level3_Optional_Id] AS [Level3_Optional_Id0], [t1].[Level3_Required_Id] AS [Level3_Required_Id0], [t1].[Level4_Name] AS [Level4_Name0], [t1].[OneToMany_Optional_Inverse4Id] AS [OneToMany_Optional_Inverse4Id0], [t1].[OneToMany_Required_Inverse4Id] AS [OneToMany_Required_Inverse4Id0], [t1].[OneToOne_Optional_PK_Inverse4Id] AS [OneToOne_Optional_PK_Inverse4Id0], [t].[c] FROM ( SELECT TOP(1) [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Level3_Name], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[OneToOne_Optional_PK_Inverse3Id], CASE - WHEN [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [l1].[Id] + WHEN ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [l1].[Id] END AS [c] FROM [Level1] AS [l1] - WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[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 = [l1].[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 [l1].[OneToMany_Optional_Inverse3Id] IS NULL)) AND ([l1].[Level3_Name] <> N'Foo' OR [l1].[Level3_Name] IS NULL) + WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[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 = [l1].[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 ([l1].[OneToMany_Optional_Inverse3Id] IS NULL))) AND ([l1].[Level3_Name] <> N'Foo' OR ([l1].[Level3_Name] IS NULL)) ORDER BY CASE - WHEN [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [l1].[Id] + WHEN ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [l1].[Id] END ) AS [t] LEFT JOIN ( SELECT [l2].[Id], [l2].[Level3_Optional_Id], [l2].[Level3_Required_Id], [l2].[Level4_Name], [l2].[OneToMany_Optional_Inverse4Id], [l2].[OneToMany_Required_Inverse4Id], [l2].[OneToOne_Optional_PK_Inverse4Id] FROM [Level1] AS [l2] - WHERE [l2].[Level3_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse4Id] IS NOT NULL + WHERE ([l2].[Level3_Required_Id] IS NOT NULL) AND ([l2].[OneToMany_Required_Inverse4Id] IS NOT NULL) ) AS [t0] ON CASE - WHEN [t].[Level2_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [t].[Id] + WHEN ([t].[Level2_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [t].[Id] END = [t0].[OneToMany_Optional_Inverse4Id] LEFT JOIN ( SELECT [l3].[Id], [l3].[Level3_Optional_Id], [l3].[Level3_Required_Id], [l3].[Level4_Name], [l3].[OneToMany_Optional_Inverse4Id], [l3].[OneToMany_Required_Inverse4Id], [l3].[OneToOne_Optional_PK_Inverse4Id] FROM [Level1] AS [l3] - WHERE [l3].[Level3_Required_Id] IS NOT NULL AND [l3].[OneToMany_Required_Inverse4Id] IS NOT NULL + WHERE ([l3].[Level3_Required_Id] IS NOT NULL) AND ([l3].[OneToMany_Required_Inverse4Id] IS NOT NULL) ) AS [t1] ON CASE - WHEN [t].[Level2_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [t].[Id] + WHEN ([t].[Level2_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [t].[Id] END = [t1].[OneToMany_Required_Inverse4Id] ) AS [t2] - WHERE [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 [t3] ON [l].[Id] = [t3].[OneToMany_Optional_Inverse2Id] ORDER BY [l].[Id], [t3].[Id], [t3].[c], [t3].[Id0], [t3].[Id00]"); } @@ -2978,18 +2978,18 @@ FROM [Level1] AS [l0] LEFT JOIN ( SELECT [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Level3_Name], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[OneToOne_Optional_PK_Inverse3Id] FROM [Level1] AS [l1] - WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse3Id] IS NOT NULL) ) AS [t] 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 = [t].[OneToOne_Optional_PK_Inverse3Id] LEFT JOIN ( SELECT [l2].[Id], [l2].[Level3_Optional_Id], [l2].[Level3_Required_Id], [l2].[Level4_Name], [l2].[OneToMany_Optional_Inverse4Id], [l2].[OneToMany_Required_Inverse4Id], [l2].[OneToOne_Optional_PK_Inverse4Id] FROM [Level1] AS [l2] - WHERE [l2].[Level3_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse4Id] IS NOT NULL + WHERE ([l2].[Level3_Required_Id] IS NOT NULL) AND ([l2].[OneToMany_Required_Inverse4Id] IS NOT NULL) ) AS [t0] ON CASE - WHEN [t].[Level2_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [t].[Id] + WHEN ([t].[Level2_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [t].[Id] END = [t0].[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 [t1] ON [l].[Id] = [t1].[OneToMany_Optional_Inverse2Id] ORDER BY [l].[Id], [t1].[Id1], [t1].[Id]"); } @@ -3004,14 +3004,14 @@ 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_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id] FROM [Level1] AS [l0] - WHERE [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 [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Level3_Name], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[OneToOne_Optional_PK_Inverse3Id] FROM [Level1] AS [l1] - WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[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]"); } @@ -3026,14 +3026,14 @@ 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_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id] FROM [Level1] AS [l0] - WHERE [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 [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Level3_Name], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[OneToOne_Optional_PK_Inverse3Id] FROM [Level1] AS [l1] - WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[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]"); } @@ -3239,20 +3239,20 @@ 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] - WHERE [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] OUTER APPLY ( SELECT CASE - WHEN [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [l1].[Id] + WHEN ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [l1].[Id] END AS [ChildId], [t].[Level2_Name] AS [ParentName], [l1].[Id] FROM [Level1] AS [l1] - WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[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 = [l1].[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 [l1].[OneToMany_Optional_Inverse3Id] IS NULL)) + WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[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 = [l1].[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 ([l1].[OneToMany_Optional_Inverse3Id] IS NULL))) ) AS [t0] ORDER BY [l].[Id], [t].[Id]"); } @@ -3267,25 +3267,25 @@ 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] - WHERE [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 [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Level3_Name], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[OneToOne_Optional_PK_Inverse3Id] FROM [Level1] AS [l1] - WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[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] OUTER APPLY ( SELECT [l2].[Level3_Name] AS [Key], COUNT(*) AS [Count] FROM [Level1] AS [l2] - 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))) GROUP BY [l2].[Level3_Name] ) AS [t1] ORDER BY [l].[Id], [t].[Id], [t0].[Id]"); @@ -3308,14 +3308,14 @@ 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_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id] FROM [Level1] AS [l0] - WHERE [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 [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Level3_Name], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[OneToOne_Optional_PK_Inverse3Id] FROM [Level1] AS [l1] - WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[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 [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], [t2].[Id] AS [Id0], [t2].[Level2_Optional_Id], [t2].[Level2_Required_Id], [t2].[Level3_Name], [t2].[OneToMany_Optional_Inverse3Id], [t2].[OneToMany_Required_Inverse3Id], [t2].[OneToOne_Optional_PK_Inverse3Id] @@ -3323,11 +3323,11 @@ FROM [Level1] AS [l2] 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] FROM [Level1] AS [l3] - 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 [t2] ON 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 = [t2].[Level2_Optional_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 [l].[Id] = [t1].[OneToMany_Optional_Inverse2Id] ORDER BY [l].[Id], [t].[Id], [t0].[Id], [t1].[Id]"); } @@ -3345,18 +3345,18 @@ FROM [Level1] AS [l2] 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] FROM [Level1] AS [l3] - 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 [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 = [t0].[OneToOne_Optional_PK_Inverse3Id] LEFT JOIN ( SELECT [l4].[Id], [l4].[Level3_Optional_Id], [l4].[Level3_Required_Id], [l4].[Level4_Name], [l4].[OneToMany_Optional_Inverse4Id], [l4].[OneToMany_Required_Inverse4Id], [l4].[OneToOne_Optional_PK_Inverse4Id] FROM [Level1] AS [l4] - WHERE [l4].[Level3_Required_Id] IS NOT NULL AND [l4].[OneToMany_Required_Inverse4Id] IS NOT NULL + WHERE ([l4].[Level3_Required_Id] IS NOT NULL) AND ([l4].[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 [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 [l].[Id] = [t1].[OneToMany_Optional_Inverse2Id] WHERE ( SELECT COUNT(*) @@ -3364,11 +3364,11 @@ FROM [Level1] AS [l0] LEFT JOIN ( SELECT [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Level3_Name], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[OneToOne_Optional_PK_Inverse3Id] FROM [Level1] AS [l1] - WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse3Id] IS NOT NULL) ) AS [t] 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 = [t].[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 ([t].[Level3_Name] <> N'Foo' OR [t].[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 ([t].[Level3_Name] <> N'Foo' OR ([t].[Level3_Name] IS NULL))) > 0 ORDER BY [l].[Id], [t1].[Id], [t1].[Id0]"); } @@ -3382,7 +3382,7 @@ 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_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id] FROM [Level1] AS [l0] - WHERE [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]"); } @@ -3397,7 +3397,7 @@ 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_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id] FROM [Level1] AS [l0] - WHERE [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]"); } @@ -3414,7 +3414,7 @@ LEFT JOIN ( 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] ORDER BY [l0].[Level2_Name]) AS [row] FROM [Level1] AS [l0] - WHERE [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] @@ -3431,18 +3431,18 @@ 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_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id] FROM [Level1] AS [l0] - WHERE [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], [t1].[Level2_Optional_Id], [t1].[Level2_Required_Id], [t1].[Level3_Name], [t1].[OneToMany_Optional_Inverse3Id], [t1].[OneToMany_Required_Inverse3Id], [t1].[OneToOne_Optional_PK_Inverse3Id] FROM ( SELECT [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Level3_Name], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[OneToOne_Optional_PK_Inverse3Id], ROW_NUMBER() OVER(PARTITION BY [l1].[OneToMany_Optional_Inverse3Id] ORDER BY [l1].[Level3_Name]) AS [row] FROM [Level1] AS [l1] - WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL AND ([l1].[Level3_Name] <> N'Foo' OR [l1].[Level3_Name] IS NULL) + WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse3Id] IS NOT NULL) AND ([l1].[Level3_Name] <> N'Foo' OR ([l1].[Level3_Name] IS NULL)) ) AS [t1] WHERE 1 < [t1].[row] AND [t1].[row] <= 4 ) 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], [t0].[OneToMany_Optional_Inverse3Id], [t0].[Level3_Name]"); } @@ -3457,7 +3457,7 @@ 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_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id] FROM [Level1] AS [l0] - WHERE [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].[Name], [l].[Id]"); } @@ -3475,11 +3475,11 @@ FROM [Level1] AS [l0] LEFT JOIN ( SELECT [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Level3_Name], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[OneToOne_Optional_PK_Inverse3Id] FROM [Level1] AS [l1] - WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse3Id] IS NOT NULL) ) AS [t] 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 = [t].[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 [t0] ON [l].[Id] = [t0].[OneToMany_Optional_Inverse2Id] ORDER BY [l].[Name], [l].[Id], [t0].[Id]"); } @@ -3497,11 +3497,11 @@ FROM [Level1] AS [l0] LEFT JOIN ( SELECT [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Level3_Name], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[OneToOne_Optional_PK_Inverse3Id] FROM [Level1] AS [l1] - WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse3Id] IS NOT NULL) ) AS [t] 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 = [t].[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 [t0] ON [l].[Id] = [t0].[OneToMany_Optional_Inverse2Id] ORDER BY [l].[Name], [l].[Id], [t0].[Id]"); } @@ -3516,12 +3516,12 @@ 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_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id] FROM [Level1] AS [l0] - WHERE [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 [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] - 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 [t0] ON [l].[Id] = [t0].[OneToMany_Required_Inverse2Id] ORDER BY [l].[Name], [l].[Id], [t].[Id]"); } @@ -3536,12 +3536,12 @@ 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_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id] FROM [Level1] AS [l0] - WHERE [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 [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] - 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 [t0] ON [l].[Id] = [t0].[OneToMany_Optional_Inverse2Id] ORDER BY [l].[Name], [l].[Id], [t].[Id]"); } @@ -3556,7 +3556,7 @@ 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_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id] FROM [Level1] AS [l0] - WHERE [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 [l].[Name]"); } @@ -3571,12 +3571,12 @@ 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_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id] FROM [Level1] AS [l0] - WHERE [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 [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] - 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 [t0] ON [l].[Id] = [t0].[Level1_Required_Id] ORDER BY [l].[Name]"); } diff --git a/test/EFCore.SqlServer.FunctionalTests/Query/ComplexNavigationsCollectionsSplitQuerySqlServerTest.cs b/test/EFCore.SqlServer.FunctionalTests/Query/ComplexNavigationsCollectionsSplitQuerySqlServerTest.cs index 603087f41cc..5eac64a1f9a 100644 --- a/test/EFCore.SqlServer.FunctionalTests/Query/ComplexNavigationsCollectionsSplitQuerySqlServerTest.cs +++ b/test/EFCore.SqlServer.FunctionalTests/Query/ComplexNavigationsCollectionsSplitQuerySqlServerTest.cs @@ -223,7 +223,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] @@ -248,7 +248,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] @@ -271,7 +271,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] @@ -284,7 +284,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] @@ -307,7 +307,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] @@ -320,7 +320,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] @@ -329,7 +329,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] @@ -352,7 +352,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] @@ -375,7 +375,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] @@ -389,7 +389,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] @@ -416,7 +416,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] @@ -430,7 +430,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] @@ -455,7 +455,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] @@ -478,7 +478,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] @@ -501,7 +501,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] @@ -515,7 +515,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] @@ -550,7 +550,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] @@ -564,7 +564,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] @@ -579,7 +579,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] @@ -609,7 +609,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] @@ -623,7 +623,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] @@ -638,7 +638,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] @@ -664,7 +664,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] @@ -802,7 +802,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] @@ -833,7 +833,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]"); } @@ -942,7 +942,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]"); @@ -1253,7 +1253,7 @@ FROM [LevelOne] AS [l] OUTER APPLY ( SELECT TOP(1) 1 AS [c], [l0].[Id] 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] ORDER BY [l].[Id], [t].[Id]", // @@ -1262,7 +1262,7 @@ FROM [LevelOne] AS [l] OUTER APPLY ( SELECT TOP(1) [l0].[Id] 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] CROSS APPLY ( SELECT [l1].[Name] @@ -1287,7 +1287,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] @@ -1300,7 +1300,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] @@ -1343,7 +1343,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] @@ -1374,7 +1374,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]"); } @@ -1619,7 +1619,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]", // @@ -1627,7 +1627,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]"); } @@ -1667,7 +1667,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] @@ -1678,7 +1678,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]"); } @@ -1826,7 +1826,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] @@ -1837,7 +1837,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]"); } @@ -2304,7 +2304,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] @@ -2321,7 +2321,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] @@ -2661,7 +2661,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] @@ -2676,7 +2676,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]"); } @@ -3158,7 +3158,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]", @@ -3168,7 +3168,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 ( @@ -3178,7 +3178,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]"); } @@ -3413,7 +3413,7 @@ FROM [LevelOne] AS [l] CROSS APPLY ( SELECT [l1].[Id] AS [ChildId], [l0].[Name] AS [ParentName] 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] ORDER BY [l].[Id], [l0].[Id]"); } @@ -3436,7 +3436,7 @@ FROM [LevelOne] AS [l] CROSS APPLY ( SELECT [l2].[Name] AS [Key], COUNT(*) AS [Count] FROM [LevelThree] AS [l2] - WHERE [l0].[Id] IS NOT NULL AND [l0].[Id] = [l2].[OneToMany_Optional_Inverse3Id] + WHERE ([l0].[Id] IS NOT NULL) AND [l0].[Id] = [l2].[OneToMany_Optional_Inverse3Id] GROUP BY [l2].[Name] ) AS [t] ORDER BY [l].[Id], [l0].[Id], [l1].[Id]"); @@ -3507,7 +3507,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] @@ -3522,7 +3522,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]"); } @@ -3600,7 +3600,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] diff --git a/test/EFCore.SqlServer.FunctionalTests/Query/ComplexNavigationsQuerySqlServerTest.cs b/test/EFCore.SqlServer.FunctionalTests/Query/ComplexNavigationsQuerySqlServerTest.cs index 4e1064c0ab6..a4b4fb57495 100644 --- a/test/EFCore.SqlServer.FunctionalTests/Query/ComplexNavigationsQuerySqlServerTest.cs +++ b/test/EFCore.SqlServer.FunctionalTests/Query/ComplexNavigationsQuerySqlServerTest.cs @@ -235,7 +235,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) @@ -246,7 +246,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) @@ -257,7 +257,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) @@ -279,7 +279,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) @@ -290,7 +290,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) @@ -591,7 +591,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) @@ -603,7 +603,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) @@ -626,7 +626,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) @@ -744,7 +744,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) @@ -792,7 +792,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) @@ -804,7 +804,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) @@ -817,7 +817,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) @@ -830,7 +830,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) @@ -843,7 +843,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) @@ -856,7 +856,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) @@ -975,7 +975,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) @@ -1133,7 +1133,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) @@ -1737,7 +1737,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)"); } @@ -1753,7 +1753,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) @@ -1808,7 +1808,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) @@ -2150,7 +2150,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]"); } @@ -2164,7 +2164,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]"); } @@ -2178,7 +2178,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]"); } @@ -2190,7 +2190,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) @@ -2205,7 +2205,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]"); } @@ -2264,7 +2264,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) @@ -2274,7 +2274,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) @@ -2303,7 +2303,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) @@ -2327,7 +2327,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) @@ -2376,7 +2376,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) @@ -2391,7 +2391,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) @@ -2435,11 +2435,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]"); @@ -2501,7 +2501,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]"); } @@ -2690,7 +2690,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) @@ -2775,7 +2775,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) @@ -2786,7 +2786,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) @@ -2901,7 +2901,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]"); } @@ -3032,7 +3032,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"); } @@ -3080,7 +3080,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] @@ -3092,7 +3092,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]"); } @@ -3159,19 +3159,19 @@ public override async Task Member_pushdown_with_multiple_collections(bool async) @"SELECT ( SELECT TOP(1) [l0].[Name] FROM [LevelThree] AS [l0] - WHERE ( + WHERE (( SELECT TOP(1) [l1].[Id] FROM [LevelTwo] AS [l1] WHERE [l].[Id] = [l1].[OneToMany_Optional_Inverse2Id] - ORDER BY [l1].[Id]) IS NOT NULL AND (( + ORDER BY [l1].[Id]) IS NOT NULL) AND (( 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]"); } @@ -3253,7 +3253,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) @@ -3264,7 +3264,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) @@ -3310,7 +3310,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) @@ -3330,7 +3330,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] IS NOT NULL AND [l1].[Id] = [l2].[OneToMany_Optional_Inverse4Id] + WHERE ([l1].[Id] IS NOT NULL) AND [l1].[Id] = [l2].[OneToMany_Optional_Inverse4Id] ) AS [t] WHERE [l].[Id] = [l0].[OneToMany_Optional_Inverse2Id] ) AS [t0]"); @@ -3376,7 +3376,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] @@ -3393,7 +3393,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] @@ -3417,7 +3417,7 @@ FROM [LevelOne] AS [l2] LEFT JOIN [LevelTwo] AS [l3] ON [l2].[Id] = [l3].[Id] LEFT JOIN [LevelThree] AS [l4] ON [l3].[Id] = [l4].[Id] LEFT JOIN [LevelTwo] AS [l5] ON [l2].[Id] = [l5].[Id] - WHERE [l1].[Name] = [l4].[Name] OR ([l1].[Name] IS NULL AND [l4].[Name] IS NULL)) > 0"); + WHERE [l1].[Name] = [l4].[Name] OR (([l1].[Name] IS NULL) AND ([l4].[Name] IS NULL))) > 0"); } public override async Task Nested_object_constructed_from_group_key_properties(bool async) @@ -3442,7 +3442,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) @@ -3489,10 +3489,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) @@ -3601,7 +3601,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) @@ -3666,16 +3666,16 @@ public override async Task Multiple_collection_FirstOrDefault_followed_by_member @"SELECT [l].[Id], ( SELECT TOP(1) [l0].[Name] FROM [LevelThree] AS [l0] - WHERE ( + WHERE (( SELECT TOP(1) [l1].[Id] FROM [LevelTwo] AS [l1] - WHERE [l].[Id] = [l1].[OneToMany_Optional_Inverse2Id] AND [l1].[Name] = N'L2 02') IS NOT NULL AND (( + WHERE [l].[Id] = [l1].[OneToMany_Optional_Inverse2Id] AND [l1].[Name] = N'L2 02') IS NOT NULL) 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"); @@ -3870,7 +3870,7 @@ FROM [LevelOne] AS [l2] LEFT JOIN [LevelTwo] AS [l3] ON [l2].[Id] = [l3].[Id] LEFT JOIN [LevelThree] AS [l4] ON [l3].[Id] = [l4].[Id] LEFT JOIN [LevelTwo] AS [l5] ON [l2].[Id] = [l5].[Id] - WHERE [l1].[Name] = [l4].[Name] OR ([l1].[Name] IS NULL AND [l4].[Name] IS NULL)) > 0"); + WHERE [l1].[Name] = [l4].[Name] OR (([l1].[Name] IS NULL) AND ([l4].[Name] IS NULL))) > 0"); } public override async Task Simple_level1_level2_level3_include(bool async) diff --git a/test/EFCore.SqlServer.FunctionalTests/Query/ComplexNavigationsSharedTypeQuerySqlServerTest.cs b/test/EFCore.SqlServer.FunctionalTests/Query/ComplexNavigationsSharedTypeQuerySqlServerTest.cs index 6622b9d1144..acb3775c36e 100644 --- a/test/EFCore.SqlServer.FunctionalTests/Query/ComplexNavigationsSharedTypeQuerySqlServerTest.cs +++ b/test/EFCore.SqlServer.FunctionalTests/Query/ComplexNavigationsSharedTypeQuerySqlServerTest.cs @@ -31,9 +31,9 @@ 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_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id] FROM [Level1] AS [l0] - WHERE [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"); } @@ -55,18 +55,18 @@ 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_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id] FROM [Level1] AS [l0] - WHERE [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 [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Level3_Name], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[OneToOne_Optional_PK_Inverse3Id] FROM [Level1] AS [l1] - WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[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"); } @@ -80,18 +80,18 @@ 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] - WHERE [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 [l1].[Id], [l1].[Level2_Required_Id], [l1].[Level3_Name], [l1].[OneToMany_Required_Inverse3Id] FROM [Level1] AS [l1] - WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[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]"); } @@ -106,49 +106,49 @@ 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] - WHERE [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 [l1].[Id], [l1].[Level2_Required_Id], [l1].[Level3_Name], [l1].[OneToMany_Required_Inverse3Id] FROM [Level1] AS [l1] - WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[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] HAVING ( SELECT MIN(COALESCE(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, 0)) FROM [Level1] AS [l2] 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] - WHERE [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 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] FROM [Level1] AS [l4] - 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 [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 [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 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] - 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 [l2].[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 [t0].[Level3_Name] = [t2].[Level3_Name] OR ([t0].[Level3_Name] IS NULL AND [t2].[Level3_Name] IS NULL)) > 0"); + WHERE [t0].[Level3_Name] = [t2].[Level3_Name] OR (([t0].[Level3_Name] IS NULL) AND ([t2].[Level3_Name] IS NULL))) > 0"); } public override async Task Simple_level1_level2_level3_include(bool async) @@ -161,27 +161,27 @@ 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_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id] FROM [Level1] AS [l0] - WHERE [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 [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Level3_Name], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[OneToOne_Optional_PK_Inverse3Id] FROM [Level1] AS [l1] - WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[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 [l2].[Id], [l2].[Level3_Optional_Id], [l2].[Level3_Required_Id], [l2].[Level4_Name], [l2].[OneToMany_Optional_Inverse4Id], [l2].[OneToMany_Required_Inverse4Id], [l2].[OneToOne_Optional_PK_Inverse4Id] FROM [Level1] AS [l2] - WHERE [l2].[Level3_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse4Id] IS NOT NULL + WHERE ([l2].[Level3_Required_Id] IS NOT NULL) AND ([l2].[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 = CASE - WHEN [t1].[Level3_Required_Id] IS NOT NULL AND [t1].[OneToMany_Required_Inverse4Id] IS NOT NULL THEN [t1].[Id] + WHEN ([t1].[Level3_Required_Id] IS NOT NULL) AND ([t1].[OneToMany_Required_Inverse4Id] IS NOT NULL) THEN [t1].[Id] END"); } @@ -202,11 +202,11 @@ FROM [Level1] AS [l0] 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] - 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] @@ -216,13 +216,13 @@ FROM [Level1] AS [l2] LEFT JOIN ( SELECT [l3].[Id], [l3].[OneToOne_Required_PK_Date], [l3].[Level1_Optional_Id], [l3].[Level1_Required_Id], [l3].[Level2_Name], [l3].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l3] - WHERE [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] = 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]"); } @@ -242,13 +242,13 @@ FROM [Level1] AS [l0] 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] - 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]"); } @@ -258,7 +258,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] @@ -268,11 +268,11 @@ FROM [Level1] AS [l0] 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] - 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]"); } @@ -289,36 +289,36 @@ 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] - WHERE [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 [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Level3_Name], [l1].[OneToMany_Required_Inverse3Id] FROM [Level1] AS [l1] - WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[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) @@ -336,11 +336,11 @@ FROM [Level1] AS [l0] LEFT JOIN ( SELECT [l1].[Id], [l1].[Level2_Required_Id], [l1].[Level3_Name], [l1].[OneToMany_Required_Inverse3Id] FROM [Level1] AS [l1] - WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse3Id] IS NOT NULL) ) AS [t] 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 [t].[Level2_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [t].[Id] + WHEN ([t].[Level2_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [t].[Id] END CROSS APPLY ( SELECT [l].[Name] AS [l1Name], [t].[Level3_Name] AS [l2Name], [t1].[Level3_Name] AS [l3Name] @@ -348,19 +348,19 @@ FROM [Level1] AS [l2] LEFT JOIN ( SELECT [l3].[Id], [l3].[Level2_Required_Id], [l3].[Level3_Name], [l3].[OneToMany_Required_Inverse3Id] FROM [Level1] AS [l3] - 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 [l2].[OneToOne_Optional_PK_Inverse4Id] = 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 [l2].[Level3_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse4Id] IS NOT NULL AND CASE - WHEN [t].[Level2_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [t].[Id] - END IS NOT NULL AND (CASE - WHEN [t].[Level2_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [t].[Id] - END = [l2].[OneToMany_Optional_Inverse4Id] OR (CASE - WHEN [t].[Level2_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [t].[Id] - END IS NULL AND [l2].[OneToMany_Optional_Inverse4Id] IS NULL)) + WHERE ([l2].[Level3_Required_Id] IS NOT NULL) AND ([l2].[OneToMany_Required_Inverse4Id] IS NOT NULL) AND (CASE + WHEN ([t].[Level2_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [t].[Id] + END IS NOT NULL) AND (CASE + WHEN ([t].[Level2_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [t].[Id] + END = [l2].[OneToMany_Optional_Inverse4Id] OR ((CASE + WHEN ([t].[Level2_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [t].[Id] + END IS NULL) AND ([l2].[OneToMany_Optional_Inverse4Id] IS NULL))) ) AS [t0] - WHERE [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 [t2]"); } @@ -374,22 +374,22 @@ 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] - WHERE [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 [l1].[Level2_Required_Id], [l1].[Level3_Name] FROM [Level1] AS [l1] - WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[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(*) FROM [Level1] AS [l2] - 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]), [t0].[Level3_Name]"); } @@ -403,51 +403,51 @@ 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] - WHERE [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 [l1].[Id], [l1].[Level2_Required_Id], [l1].[Level3_Name], [l1].[OneToMany_Required_Inverse3Id] FROM [Level1] AS [l1] - WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[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] HAVING ( SELECT MIN(COALESCE(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, 0) + COALESCE(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, 0)) FROM [Level1] AS [l2] 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] - WHERE [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 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] FROM [Level1] AS [l4] - 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 [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 [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 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] - 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 [l2].[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 [t0].[Level3_Name] = [t2].[Level3_Name] OR ([t0].[Level3_Name] IS NULL AND [t2].[Level3_Name] IS NULL)) > 0"); + WHERE [t0].[Level3_Name] = [t2].[Level3_Name] OR (([t0].[Level3_Name] IS NULL) AND ([t2].[Level3_Name] IS NULL))) > 0"); } public override async Task Sum_with_selector_cast_using_as(bool async) @@ -468,10 +468,10 @@ 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] - WHERE [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) @@ -487,23 +487,23 @@ FROM [Level1] AS [l0] 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] - 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 [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] FROM [Level1] AS [l2] - 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) ) AS [t1] ORDER BY 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) FROM [Level1] AS [l] WHERE [l].[Id] < 3"); @@ -522,28 +522,28 @@ 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] - 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 [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] FROM [Level1] AS [l2] - 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 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 [l3] - WHERE [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_Required_Inverse2Id] AND [l3].[Id] = [t0].[Level2_Required_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_Required_Inverse2Id] AND [l3].[Id] = [t0].[Level2_Required_Id]) ) AS [t1] 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] FROM [Level1] AS [l4] - 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 [l].[Id] = [t2].[OneToMany_Required_Inverse2Id] ORDER BY [l].[Id], [t1].[Id0], [t1].[Id1], [t1].[Id]"); } @@ -558,25 +558,25 @@ 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] - WHERE [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 [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[OneToMany_Required_Inverse3Id] FROM [Level1] AS [l1] - WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[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 [l2].[Level3_Optional_Id], [l2].[Level4_Name] FROM [Level1] AS [l2] - WHERE [l2].[Level3_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse4Id] IS NOT NULL + WHERE ([l2].[Level3_Required_Id] IS NOT NULL) AND ([l2].[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 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 [t1].[Level4_Name] END = N'L4 01'"); } @@ -591,9 +591,9 @@ FROM [Level1] AS [l] 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] - WHERE [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) @@ -602,7 +602,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 [l2].[Id] IS NULL THEN CAST(1 AS bit) ELSE CAST(0 AS bit) @@ -611,19 +611,19 @@ 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] - WHERE [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 [l1].[Level2_Optional_Id], [l1].[Level3_Name] FROM [Level1] AS [l1] - WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[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 [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 Multiple_joins_groupby_predicate(bool async) @@ -632,7 +632,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] @@ -642,11 +642,11 @@ FROM [Level1] AS [l0] 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] - 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] @@ -654,23 +654,23 @@ FROM [Level1] AS [l2] LEFT JOIN ( SELECT [l3].[Id], [l3].[OneToOne_Required_PK_Date], [l3].[Level1_Required_Id], [l3].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l3] - WHERE [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] = 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 [l4].[Id], [l4].[Level2_Required_Id], [l4].[Level3_Name], [l4].[OneToMany_Required_Inverse3Id] FROM [Level1] AS [l4] - 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 [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 - 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) GROUP BY [t3].[Level3_Name] ) AS [t1] ON [l].[Name] = [t1].[Key] -WHERE [t0].[Level2_Name] IS NOT NULL OR [t1].[Count] > 0"); +WHERE ([t0].[Level2_Name] IS NOT NULL) OR [t1].[Count] > 0"); } public override async Task Nested_object_constructed_from_group_key_properties(bool async) @@ -681,20 +681,20 @@ public override async Task Nested_object_constructed_from_group_key_properties(b @"SELECT [t1].[Id], [t1].[Name], [t1].[Date], [t1].[InnerId] AS [Id], [t1].[Level2_Name0] AS [Name], [t1].[OneToOne_Required_PK_Date] AS [Date], [t1].[Level1_Optional_Id], [t1].[Level1_Required_Id], COALESCE(SUM(CAST(LEN([t1].[Name]) AS int)), 0) AS [Aggregate] FROM ( SELECT [l].[Id], [l].[Date], [l].[Name], [t].[OneToOne_Required_PK_Date], [t].[Level1_Optional_Id], [t].[Level1_Required_Id], [t0].[Level2_Name] AS [Level2_Name0], CASE - WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + WHEN ([t].[OneToOne_Required_PK_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 [InnerId] 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] - WHERE [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 [l1].[Level1_Required_Id], [l1].[Level2_Name] FROM [Level1] AS [l1] - 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 [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) ) AS [t1] GROUP BY [t1].[Id], [t1].[Date], [t1].[Name], [t1].[InnerId], [t1].[OneToOne_Required_PK_Date], [t1].[Level1_Optional_Id], [t1].[Level1_Required_Id], [t1].[Level2_Name0]"); } @@ -711,10 +711,10 @@ 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_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id] FROM [Level1] AS [l0] - WHERE [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"); @@ -726,16 +726,16 @@ 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] - WHERE [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]"); } @@ -750,10 +750,10 @@ 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] - WHERE [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"); } @@ -767,43 +767,43 @@ FROM [Level1] AS [l] INNER JOIN ( SELECT [t0].[Key], ( SELECT COALESCE(SUM(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), 0) FROM ( SELECT [l1].[Id], [l1].[Date], [l1].[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], 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 % 3 AS [Key] FROM [Level1] AS [l1] 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] - 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 [t4] ON [l1].[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 [t2] 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] - WHERE [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 [t2].[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 [t0].[Key] = [t2].[Key] OR ([t0].[Key] IS NULL AND [t2].[Key] IS NULL)) AS [Sum] + WHERE [t0].[Key] = [t2].[Key] OR (([t0].[Key] IS NULL) AND ([t2].[Key] IS NULL))) AS [Sum] FROM ( 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] FROM [Level1] AS [l0] LEFT JOIN ( SELECT [l4].[Id], [l4].[OneToOne_Required_PK_Date], [l4].[Level1_Required_Id], [l4].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l4] - 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 [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] GROUP BY [t0].[Key] ) AS [t1] ON [l].[Id] = [t1].[Key] AND CAST(1 AS bit) = CASE @@ -824,29 +824,29 @@ FROM [Level1] AS [l2] 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] - WHERE [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] 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] LEFT JOIN ( SELECT [l0].[Level1_Optional_Id], [l0].[Level2_Name] FROM [Level1] AS [l0] - WHERE [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 [l1].[Id], [l1].[OneToOne_Required_PK_Date], [l1].[Level1_Required_Id], [l1].[OneToMany_Required_Inverse2Id], [l1].[OneToOne_Optional_PK_Inverse2Id] FROM [Level1] AS [l1] - 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 [t0] ON [l].[Id] = [t0].[OneToOne_Optional_PK_Inverse2Id]"); } @@ -896,21 +896,21 @@ 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_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id] FROM [Level1] AS [l0] - WHERE [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 [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] - 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 [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 [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], ROW_NUMBER() OVER(PARTITION BY [l2].[OneToMany_Required_Inverse2Id] ORDER BY 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 DESC) AS [row] FROM [Level1] AS [l2] - 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] WHERE [t2].[row] <= 1 ) AS [t1] ON [l].[Id] = [t1].[OneToMany_Required_Inverse2Id] @@ -930,11 +930,11 @@ FROM [Level1] AS [l0] 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] - 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 [l3].[Id] @@ -942,12 +942,12 @@ FROM [Level1] AS [l2] LEFT JOIN ( SELECT [l4].[Id], [l4].[OneToOne_Required_PK_Date], [l4].[Level1_Optional_Id], [l4].[Level1_Required_Id], [l4].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l4] - 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 [l2].[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 [l3] ON [t2].[Level1_Optional_Id] = [l3].[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 [l3].[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 ([l3].[Id] IS NULL)"); } public override async Task Distinct_skip_without_orderby(bool async) @@ -965,26 +965,26 @@ FROM [Level1] AS [l0] 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] - 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 [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] FROM [Level1] AS [l2] - 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) ) AS [t1] ORDER BY (SELECT 1) OFFSET 1 ROWS ) 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"); @@ -1038,16 +1038,16 @@ FROM [Level1] AS [l1] 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] - 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 [l1].[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] LEFT JOIN ( SELECT [l0].[Level1_Optional_Id], [l0].[Level2_Name] FROM [Level1] AS [l0] - WHERE [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]"); } @@ -1059,7 +1059,7 @@ public override async Task Collection_FirstOrDefault_property_accesses_in_projec @"SELECT [l].[Id], ( SELECT TOP(1) [l0].[Level2_Name] FROM [Level1] AS [l0] - WHERE [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"); } @@ -1077,11 +1077,11 @@ 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] - 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] @@ -1089,22 +1089,22 @@ FROM [Level1] AS [l2] LEFT JOIN ( SELECT [l3].[Id], [l3].[OneToOne_Required_PK_Date], [l3].[Level1_Required_Id], [l3].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l3] - WHERE [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] = 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 [l4].[Id], [l4].[Level2_Required_Id], [l4].[OneToMany_Required_Inverse3Id] FROM [Level1] AS [l4] - 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 [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 - 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) ) 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_Required_Id] INNER JOIN ( SELECT [t7].[Level3_Required_Id], [t7].[Level4_Name] @@ -1112,35 +1112,35 @@ FROM [Level1] AS [l5] LEFT JOIN ( SELECT [l6].[Id], [l6].[OneToOne_Required_PK_Date], [l6].[Level1_Required_Id], [l6].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l6] - 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 [t5] ON [l5].[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 LEFT JOIN ( SELECT [l7].[Id], [l7].[Level2_Required_Id], [l7].[OneToMany_Required_Inverse3Id] FROM [Level1] AS [l7] - 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 [t6] ON 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 = CASE - WHEN [t6].[Level2_Required_Id] IS NOT NULL AND [t6].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [t6].[Id] + WHEN ([t6].[Level2_Required_Id] IS NOT NULL) AND ([t6].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [t6].[Id] END LEFT JOIN ( SELECT [l8].[Id], [l8].[Level3_Required_Id], [l8].[Level4_Name], [l8].[OneToMany_Required_Inverse4Id] FROM [Level1] AS [l8] - WHERE [l8].[Level3_Required_Id] IS NOT NULL AND [l8].[OneToMany_Required_Inverse4Id] IS NOT NULL + WHERE ([l8].[Level3_Required_Id] IS NOT NULL) AND ([l8].[OneToMany_Required_Inverse4Id] IS NOT NULL) ) AS [t7] ON CASE - WHEN [t6].[Level2_Required_Id] IS NOT NULL AND [t6].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [t6].[Id] + WHEN ([t6].[Level2_Required_Id] IS NOT NULL) AND ([t6].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [t6].[Id] END = CASE - WHEN [t7].[Level3_Required_Id] IS NOT NULL AND [t7].[OneToMany_Required_Inverse4Id] IS NOT NULL THEN [t7].[Id] + WHEN ([t7].[Level3_Required_Id] IS NOT NULL) AND ([t7].[OneToMany_Required_Inverse4Id] IS NOT NULL) THEN [t7].[Id] END - WHERE [t5].[OneToOne_Required_PK_Date] IS NOT NULL AND [t5].[Level1_Required_Id] IS NOT NULL AND [t5].[OneToMany_Required_Inverse2Id] IS NOT NULL AND [t6].[Level2_Required_Id] IS NOT NULL AND [t6].[OneToMany_Required_Inverse3Id] IS NOT NULL AND [t7].[Level3_Required_Id] IS NOT NULL AND [t7].[OneToMany_Required_Inverse4Id] IS NOT NULL + WHERE ([t5].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t5].[Level1_Required_Id] IS NOT NULL) AND ([t5].[OneToMany_Required_Inverse2Id] IS NOT NULL) AND ([t6].[Level2_Required_Id] IS NOT NULL) AND ([t6].[OneToMany_Required_Inverse3Id] IS NOT NULL) AND ([t7].[Level3_Required_Id] IS NOT NULL) AND ([t7].[OneToMany_Required_Inverse4Id] IS NOT NULL) ) AS [t4] ON CASE - WHEN [t1].[Level2_Required_Id] IS NOT NULL AND [t1].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [t1].[Id1] + WHEN ([t1].[Level2_Required_Id] IS NOT NULL) AND ([t1].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [t1].[Id1] END = [t4].[Level3_Required_Id] LEFT JOIN [Level1] AS [l9] 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 >= [l9].[Id] AND ([t4].[Level4_Name] = [l9].[Name] OR ([t4].[Level4_Name] IS NULL AND [l9].[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 >= [l9].[Id] AND ([t4].[Level4_Name] = [l9].[Name] OR (([t4].[Level4_Name] IS NULL) AND ([l9].[Name] IS NULL)))"); } public override async Task Contains_over_optional_navigation_with_null_constant(bool async) @@ -1155,10 +1155,10 @@ 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_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id] FROM [Level1] AS [l0] - WHERE [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"); @@ -1304,9 +1304,9 @@ FROM [Level1] AS [l] LEFT JOIN ( SELECT [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Required_Id], [l0].[OneToMany_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l0] - WHERE [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) @@ -1319,16 +1319,16 @@ 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] - WHERE [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 [l1].[Level2_Required_Id], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id] FROM [Level1] AS [l1] - WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[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) @@ -1341,16 +1341,16 @@ 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] - WHERE [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 [l1].[Level2_Required_Id], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id] FROM [Level1] AS [l1] - WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL AND [l1].[Id] > 5 + WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse3Id] IS NOT NULL) AND [l1].[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) @@ -1368,12 +1368,12 @@ 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] - WHERE [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 ( @@ -1394,9 +1394,9 @@ public override async Task Projecting_columns_with_same_name_from_different_enti SELECT [t4].[Id1] AS [Foo], [t4].[Id2] AS [Bar], [t4].[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 [t1].[Level2_Required_Id] IS NOT NULL AND [t1].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [t1].[Id1] + WHEN ([t1].[Level2_Required_Id] IS NOT NULL) AND ([t1].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [t1].[Id1] END AS [Id3], [l].[Name] AS [Name1], [t0].[Level2_Name] AS [Name2] FROM [Level1] AS [l] INNER JOIN ( @@ -1405,11 +1405,11 @@ FROM [Level1] AS [l0] 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] - 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] @@ -1417,22 +1417,22 @@ FROM [Level1] AS [l2] LEFT JOIN ( SELECT [l3].[Id], [l3].[OneToOne_Required_PK_Date], [l3].[Level1_Required_Id], [l3].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l3] - WHERE [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] = 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 [l4].[Id], [l4].[Level2_Optional_Id], [l4].[Level2_Required_Id], [l4].[OneToMany_Required_Inverse3Id] FROM [Level1] AS [l4] - 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 [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 - 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) ) 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] ) AS [t4]"); } @@ -1445,24 +1445,24 @@ public override async Task Multiple_collection_FirstOrDefault_followed_by_member @"SELECT [l].[Id], ( SELECT TOP(1) [l0].[Level3_Name] FROM [Level1] AS [l0] - WHERE [l0].[Level2_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse3Id] IS NOT NULL AND ( + WHERE ([l0].[Level2_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse3Id] IS NOT NULL) AND (( SELECT TOP(1) CASE - WHEN [l1].[OneToOne_Required_PK_Date] IS NOT NULL AND [l1].[Level1_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [l1].[Id] + WHEN ([l1].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l1].[Level1_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [l1].[Id] END FROM [Level1] AS [l1] - 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 AND [l].[Id] = [l1].[OneToMany_Optional_Inverse2Id] AND [l1].[Level2_Name] = N'L2 02') IS NOT NULL AND (( + 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) AND [l].[Id] = [l1].[OneToMany_Optional_Inverse2Id] AND [l1].[Level2_Name] = N'L2 02') IS NOT NULL) AND (( SELECT TOP(1) 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 FROM [Level1] AS [l2] - 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 [l].[Id] = [l2].[OneToMany_Optional_Inverse2Id] AND [l2].[Level2_Name] = N'L2 02') = [l0].[OneToMany_Optional_Inverse3Id] OR (( + 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 [l].[Id] = [l2].[OneToMany_Optional_Inverse2Id] AND [l2].[Level2_Name] = N'L2 02') = [l0].[OneToMany_Optional_Inverse3Id] OR ((( SELECT TOP(1) 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 FROM [Level1] AS [l2] - 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 [l].[Id] = [l2].[OneToMany_Optional_Inverse2Id] AND [l2].[Level2_Name] = N'L2 02') IS NULL AND [l0].[OneToMany_Optional_Inverse3Id] 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 [l].[Id] = [l2].[OneToMany_Optional_Inverse2Id] AND [l2].[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"); @@ -1480,16 +1480,16 @@ LEFT JOIN ( FROM ( SELECT 1 AS [c], [l0].[Id], [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]) AS [row] FROM [Level1] AS [l0] - WHERE [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] LEFT JOIN ( SELECT [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Level3_Name], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[OneToOne_Optional_PK_Inverse3Id] FROM [Level1] AS [l1] - WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[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]"); @@ -1510,11 +1510,11 @@ FROM [Level1] AS [l0] LEFT JOIN ( SELECT [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Level3_Name], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[OneToOne_Optional_PK_Inverse3Id] FROM [Level1] AS [l1] - WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse3Id] IS NOT NULL) ) AS [t] 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 = [t].[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 [t0] WHERE [t0].[row] <= 1 ) AS [t1] ON [l].[Id] = [t1].[OneToMany_Optional_Inverse2Id] @@ -1534,12 +1534,12 @@ FROM [Level1] AS [l0] 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] - 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]"); } @@ -1554,18 +1554,18 @@ 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] - WHERE [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 [l1].[Id], [l1].[Level2_Required_Id], [l1].[OneToMany_Required_Inverse3Id] FROM [Level1] AS [l1] - WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[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 [t2].[Id0] AS [Id00], [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] @@ -1576,16 +1576,16 @@ 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] FROM [Level1] AS [l4] - 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 [l2].[Id] = [t2].[Level1_Optional_Id] ) AS [t1] ON [t0].[Level2_Required_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].[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 -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( @@ -1599,21 +1599,21 @@ 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] - WHERE [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 [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[OneToMany_Required_Inverse3Id] FROM [Level1] AS [l1] - WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[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 [l2].[Id], [l2].[Level3_Optional_Id], [l2].[Level3_Required_Id], [l2].[Level4_Name], [l2].[OneToMany_Optional_Inverse4Id], [l2].[OneToMany_Required_Inverse4Id], [l2].[OneToOne_Optional_PK_Inverse4Id] FROM [Level1] AS [l2] - WHERE [l2].[Level3_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse4Id] IS NOT NULL + WHERE ([l2].[Level3_Required_Id] IS NOT NULL) AND ([l2].[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_Required_Inverse4Id] LEFT JOIN ( SELECT [t3].[Id] AS [Id0], [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] @@ -1621,15 +1621,15 @@ 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] FROM [Level1] AS [l4] - 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].[Level3_Required_Id] IS NOT NULL AND [t1].[OneToMany_Required_Inverse4Id] IS NOT NULL THEN [t1].[Id] + WHEN ([t1].[Level3_Required_Id] IS NOT NULL) AND ([t1].[OneToMany_Required_Inverse4Id] IS NOT NULL) THEN [t1].[Id] END = 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"); } @@ -1646,26 +1646,26 @@ FROM [Level1] AS [l0] 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] - 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 [l2] 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] - WHERE [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) 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)"); } @@ -1687,11 +1687,11 @@ FROM [Level1] AS [l0] 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] - 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] @@ -1709,18 +1709,18 @@ 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] - WHERE [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 [l1].[Id], [l1].[Level2_Required_Id], [l1].[OneToMany_Required_Inverse3Id] FROM [Level1] AS [l1] - WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[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 [t2].[Id0] AS [Id00], [t2].[OneToOne_Required_PK_Date], [t2].[Level1_Required_Id], [t2].[Level2_Name], [t2].[OneToMany_Required_Inverse2Id] @@ -1731,16 +1731,16 @@ 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_Required_Inverse2Id] FROM [Level1] AS [l4] - 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 [l2].[Id] = [t2].[Level1_Optional_Id] ) AS [t1] ON [t0].[Level2_Required_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].[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 -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) @@ -1753,23 +1753,23 @@ 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] - WHERE [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 FROM ( SELECT DISTINCT [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Level3_Name], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[OneToOne_Optional_PK_Inverse3Id] FROM [Level1] AS [l1] - WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[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 = [l1].[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 [l1].[OneToMany_Optional_Inverse3Id] IS NULL)) + WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[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 = [l1].[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 ([l1].[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)"); } @@ -1783,18 +1783,18 @@ 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] - WHERE [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 [l1].[Id], [l1].[Level2_Required_Id], [l1].[OneToMany_Required_Inverse3Id] FROM [Level1] AS [l1] - WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[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 [t2].[Id0] AS [Id00], [t2].[OneToOne_Required_PK_Date], [t2].[Level1_Required_Id], [t2].[Level2_Name], [t2].[OneToMany_Required_Inverse2Id] @@ -1805,16 +1805,16 @@ 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_Required_Inverse2Id] FROM [Level1] AS [l4] - 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 [l2].[Id] = [t2].[Level1_Optional_Id] ) AS [t1] ON [t0].[Level2_Required_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].[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 -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) @@ -1827,16 +1827,16 @@ 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] FROM [Level1] AS [l0] - WHERE [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 [l1].[Level2_Required_Id], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id] FROM [Level1] AS [l1] - WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL AND [l1].[Id] > 5 + WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse3Id] IS NOT NULL) AND [l1].[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) @@ -1849,18 +1849,18 @@ 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] - WHERE [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 FROM [Level1] AS [l1] - WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[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 = [l1].[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 [l1].[OneToMany_Optional_Inverse3Id] IS NULL)) AND CAST(LEN([l1].[Level3_Name]) AS int) = 1)"); + WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[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 = [l1].[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 ([l1].[OneToMany_Optional_Inverse3Id] IS NULL))) AND CAST(LEN([l1].[Level3_Name]) AS int) = 1)"); } public override async Task GroupJoin_with_complex_subquery_with_joins_does_not_get_flattened2(bool async) @@ -1869,7 +1869,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 ( @@ -1878,12 +1878,12 @@ FROM [Level1] AS [l0] LEFT JOIN ( SELECT [l2].[Id], [l2].[OneToOne_Required_PK_Date], [l2].[Level1_Optional_Id], [l2].[Level1_Required_Id], [l2].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l2] - 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 [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 [l1] ON [t].[Level1_Required_Id] = [l1].[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]"); } @@ -1897,16 +1897,16 @@ 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] - WHERE [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 [l1].[Level2_Required_Id], [l1].[OneToMany_Required_Inverse3Id] FROM [Level1] AS [l1] - WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL AND [l1].[Id] > 5 + WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse3Id] IS NOT NULL) AND [l1].[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) @@ -1920,26 +1920,26 @@ FROM [Level1] AS [l1] 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] FROM [Level1] AS [l4] - 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 [l1].[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 [l2] ON [t0].[Level1_Required_Id] = [l2].[Id] 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] - WHERE [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"); } @@ -1954,21 +1954,21 @@ 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] - WHERE [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 [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[OneToMany_Required_Inverse3Id] FROM [Level1] AS [l1] - WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[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 [l2].[Id], [l2].[Level3_Optional_Id], [l2].[Level3_Required_Id], [l2].[Level4_Name], [l2].[OneToMany_Optional_Inverse4Id], [l2].[OneToMany_Required_Inverse4Id], [l2].[OneToOne_Optional_PK_Inverse4Id] FROM [Level1] AS [l2] - WHERE [l2].[Level3_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse4Id] IS NOT NULL + WHERE ([l2].[Level3_Required_Id] IS NOT NULL) AND ([l2].[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_Required_Inverse4Id] INNER JOIN ( SELECT [t3].[Id] AS [Id0], [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] @@ -1976,15 +1976,15 @@ 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] FROM [Level1] AS [l4] - 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].[Level3_Required_Id] IS NOT NULL AND [t1].[OneToMany_Required_Inverse4Id] IS NOT NULL THEN [t1].[Id] + WHEN ([t1].[Level3_Required_Id] IS NOT NULL) AND ([t1].[OneToMany_Required_Inverse4Id] IS NOT NULL) THEN [t1].[Id] END = 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"); } @@ -1998,26 +1998,26 @@ 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_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id] FROM [Level1] AS [l0] - WHERE [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) [l2].[Name] FROM [Level1] AS [l1] 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] - WHERE [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 [l1].[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 [l2] ON [t0].[Level1_Required_Id] = [l2].[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'"); } @@ -2034,14 +2034,14 @@ FROM [Level1] AS [l0] 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] - 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 [l2] ON [t0].[Level1_Required_Id] = [l2].[Id] -WHERE [l2].[Name] <> N'L3 02' OR [l2].[Name] IS NULL"); +WHERE [l2].[Name] <> N'L3 02' OR ([l2].[Name] IS NULL)"); } public override async Task @@ -2058,24 +2058,24 @@ 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] - WHERE [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 [l1].[Level2_Required_Id], [l1].[OneToMany_Optional_Inverse3Id] FROM [Level1] AS [l1] - WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[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 [l2].[Id], [l2].[OneToOne_Required_PK_Date], [l2].[Level1_Required_Id], [l2].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l2] - 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].[Level2_Required_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 [Level1] AS [l3] 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 = [l3].[Id]"); } @@ -2085,15 +2085,15 @@ 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] - WHERE [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] @@ -2101,13 +2101,13 @@ FROM [Level1] AS [l1] LEFT JOIN ( SELECT [l2].[Id], [l2].[OneToOne_Required_PK_Date], [l2].[Level1_Required_Id], [l2].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l2] - 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 [l1].[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"); } @@ -2123,7 +2123,7 @@ FROM [Level1] AS [l] LEFT JOIN ( SELECT [l0].[Level1_Optional_Id], [l0].[Level2_Name] FROM [Level1] AS [l0] - WHERE [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]"); } @@ -2142,60 +2142,60 @@ 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] - WHERE [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 [l1].[Id], [l1].[Level2_Required_Id], [l1].[OneToMany_Required_Inverse3Id] FROM [Level1] AS [l1] - WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[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 [l2].[Id], [l2].[Level3_Required_Id], [l2].[OneToMany_Required_Inverse4Id] FROM [Level1] AS [l2] - WHERE [l2].[Level3_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse4Id] IS NOT NULL + WHERE ([l2].[Level3_Required_Id] IS NOT NULL) AND ([l2].[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 = CASE - WHEN [t1].[Level3_Required_Id] IS NOT NULL AND [t1].[OneToMany_Required_Inverse4Id] IS NOT NULL THEN [t1].[Id] + WHEN ([t1].[Level3_Required_Id] IS NOT NULL) AND ([t1].[OneToMany_Required_Inverse4Id] IS NOT NULL) THEN [t1].[Id] END LEFT JOIN ( SELECT [l3].[Id], [l3].[Level2_Required_Id], [l3].[OneToMany_Required_Inverse3Id] FROM [Level1] AS [l3] - 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 [t2] ON [t1].[Level3_Required_Id] = 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 LEFT JOIN ( SELECT [l4].[Id], [l4].[OneToOne_Required_PK_Date], [l4].[Level1_Required_Id], [l4].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l4] - 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 [t2].[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 ( SELECT [l5].[Level2_Required_Id], [l5].[OneToMany_Required_Inverse3Id] FROM [Level1] AS [l5] - 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 [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].[OneToMany_Required_Inverse3Id] LEFT JOIN ( SELECT [l6].[Id], [l6].[OneToOne_Required_PK_Date], [l6].[Level1_Required_Id], [l6].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l6] - 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 [t5] ON [t4].[Level2_Required_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 LEFT JOIN [Level1] AS [l7] ON 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 = [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 [t1].[Level3_Required_Id] IS NOT NULL AND [t1].[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 ([t1].[Level3_Required_Id] IS NOT NULL) AND ([t1].[OneToMany_Required_Inverse4Id] IS NOT NULL)"); } public override async Task Required_navigation_on_a_subquery_with_First_in_projection(bool async) @@ -2209,25 +2209,25 @@ FROM [Level1] AS [l1] 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] - WHERE [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 [l1].[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 [l2] ON [t0].[Level1_Required_Id] = [l2].[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] - WHERE [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"); } @@ -2237,7 +2237,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 ( @@ -2246,12 +2246,12 @@ FROM [Level1] AS [l0] LEFT JOIN ( SELECT [l2].[Id], [l2].[OneToOne_Required_PK_Date], [l2].[Level1_Optional_Id], [l2].[Level1_Required_Id], [l2].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l2] - 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 [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 [l1] ON [t].[Level1_Required_Id] = [l1].[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]"); } @@ -2261,7 +2261,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 ( @@ -2270,12 +2270,12 @@ FROM [Level1] AS [l0] LEFT JOIN ( SELECT [l2].[Id], [l2].[OneToOne_Required_PK_Date], [l2].[Level1_Required_Id], [l2].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l2] - 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 [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 [l1] ON [t].[Level1_Required_Id] = [l1].[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]"); } @@ -2296,11 +2296,11 @@ FROM [Level1] AS [l0] 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] - 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] @@ -2319,14 +2319,14 @@ 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] - WHERE [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) @@ -2342,12 +2342,12 @@ FROM [Level1] AS [l0] 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] - 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]"); } @@ -2362,18 +2362,18 @@ 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] - WHERE [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 [l1].[Id], [l1].[Level2_Required_Id], [l1].[Level3_Name], [l1].[OneToMany_Required_Inverse3Id] FROM [Level1] AS [l1] - WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[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 [t2].[Id] AS [Id0], [t2].[OneToOne_Required_PK_Date], [t2].[Level1_Required_Id], [t2].[Level2_Name], [t2].[OneToMany_Required_Inverse2Id] @@ -2381,12 +2381,12 @@ FROM [Level1] AS [l2] LEFT JOIN ( SELECT [l3].[Id], [l3].[OneToOne_Required_PK_Date], [l3].[Level1_Optional_Id], [l3].[Level1_Required_Id], [l3].[Level2_Name], [l3].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l3] - WHERE [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].[Level1_Optional_Id] ) AS [t1] ON [t0].[Level2_Required_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].[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 -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) @@ -2406,11 +2406,11 @@ FROM [Level1] AS [l0] 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] - 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] @@ -2420,11 +2420,11 @@ FROM [Level1] AS [l2] LEFT JOIN ( SELECT [l3].[Id], [l3].[OneToOne_Required_PK_Date], [l3].[Level1_Optional_Id], [l3].[Level1_Required_Id], [l3].[Level2_Name], [l3].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l3] - WHERE [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] = 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]"); } @@ -2439,16 +2439,16 @@ 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] - WHERE [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 [l1].[Level2_Required_Id], [l1].[Level3_Name] FROM [Level1] AS [l1] - WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[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) @@ -2457,15 +2457,15 @@ 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] - WHERE [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 [l1].[Id], [l1].[Name], [t1].[Level2_Name] @@ -2473,10 +2473,10 @@ FROM [Level1] AS [l1] LEFT JOIN ( SELECT [l2].[Level1_Optional_Id], [l2].[Level2_Name] FROM [Level1] AS [l2] - 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 [l1].[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) @@ -2489,12 +2489,12 @@ 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] - WHERE [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 [l1] ON [t].[Level1_Optional_Id] = [l1].[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) @@ -2507,54 +2507,54 @@ 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_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id] FROM [Level1] AS [l0] - WHERE [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 [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Level3_Name], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[OneToOne_Optional_PK_Inverse3Id] FROM [Level1] AS [l1] - WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[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 [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] FROM [Level1] AS [l2] - 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 [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + WHEN ([t].[OneToOne_Required_PK_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].[OneToOne_Optional_PK_Inverse3Id] 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] - WHERE [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 [l].[Id] = [t2].[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] FROM [Level1] AS [l4] - 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 [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 [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] FROM [Level1] AS [l5] - 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 [t4] 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 = [t4].[Level3_Optional_Id] LEFT JOIN ( SELECT [l6].[Id], [l6].[Level3_Optional_Id], [l6].[Level3_Required_Id], [l6].[Level4_Name], [l6].[OneToMany_Optional_Inverse4Id], [l6].[OneToMany_Required_Inverse4Id], [l6].[OneToOne_Optional_PK_Inverse4Id] FROM [Level1] AS [l6] - 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 [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] 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] FROM [Level1] AS [l7] - 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 [t6] 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 = [t6].[OneToOne_Optional_PK_Inverse3Id]"); } @@ -2570,15 +2570,15 @@ 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_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id] FROM [Level1] AS [l0] - WHERE [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 ( SELECT [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Level3_Name], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[OneToOne_Optional_PK_Inverse3Id] FROM [Level1] AS [l1] - WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[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]"); } @@ -2608,24 +2608,24 @@ 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], [t1].[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] - WHERE [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 [l1].[Id], [l1].[Level2_Required_Id], [l1].[OneToMany_Required_Inverse3Id] FROM [Level1] AS [l1] - WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[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 [l2].[Id], [t3].[Id] AS [Id1], [t3].[Level2_Required_Id], [t3].[OneToMany_Required_Inverse3Id] @@ -2633,21 +2633,21 @@ FROM [Level1] AS [l2] LEFT JOIN ( SELECT [l3].[Id], [l3].[OneToOne_Required_PK_Date], [l3].[Level1_Required_Id], [l3].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l3] - WHERE [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].[Level1_Required_Id] LEFT JOIN ( SELECT [l4].[Id], [l4].[Level2_Optional_Id], [l4].[Level2_Required_Id], [l4].[OneToMany_Required_Inverse3Id] FROM [Level1] AS [l4] - 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 [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] ) 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 = CASE - WHEN [t1].[Level2_Required_Id] IS NOT NULL AND [t1].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [t1].[Id1] + WHEN ([t1].[Level2_Required_Id] IS NOT NULL) AND ([t1].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [t1].[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) @@ -2662,14 +2662,14 @@ 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] - WHERE [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 [l1] ON [t].[Level1_Required_Id] = [l1].[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 [l1].[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 [l1].[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"); } @@ -2685,9 +2685,9 @@ 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] - WHERE [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 [l1] ON [t].[Level1_Required_Id] = [l1].[Id] INNER JOIN ( @@ -2696,22 +2696,22 @@ FROM [Level1] AS [l2] LEFT JOIN ( SELECT [l3].[Id], [l3].[OneToOne_Required_PK_Date], [l3].[Level1_Required_Id], [l3].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l3] - WHERE [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] = 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 [l4].[Id], [l4].[Level2_Required_Id], [l4].[Level3_Name], [l4].[OneToMany_Required_Inverse3Id] FROM [Level1] AS [l4] - 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 = 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 [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 [t2].[Level2_Required_Id] IS NOT NULL AND [t2].[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 ([t2].[Level2_Required_Id] IS NOT NULL) AND ([t2].[OneToMany_Required_Inverse3Id] IS NOT NULL) ) AS [t1] ON [l1].[Id] = [t1].[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 [l1].[Name] = N'L1 03' AND [t1].[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 [l1].[Name] = N'L1 03' AND [t1].[Level3_Name] = N'L3 08' ORDER BY [l1].[Id]"); } @@ -2725,19 +2725,19 @@ 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_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id] FROM [Level1] AS [l0] - WHERE [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 [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] - 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 [t0] ON [l].[Id] = [t0].[OneToOne_Optional_PK_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] FROM [Level1] AS [l2] - 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 [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + WHEN ([t].[OneToOne_Required_PK_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]"); } @@ -2751,12 +2751,12 @@ 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_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id] FROM [Level1] AS [l0] - WHERE [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 [l1] ON [t].[Level1_Required_Id] = [l1].[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 [l1].[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 [l1].[Id] = 7"); } public override async Task Order_by_key_of_projected_navigation_doesnt_get_optimized_into_FK_access_subquery(bool async) @@ -2769,35 +2769,35 @@ public override async Task Order_by_key_of_projected_navigation_doesnt_get_optim SELECT [l3].[Name] FROM ( SELECT TOP(@__p_0) [t1].[Level1_Required_Id] AS [Level1_Required_Id0], 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 [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] - WHERE [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 [l1].[Id], [l1].[Level2_Required_Id], [l1].[OneToMany_Required_Inverse3Id] FROM [Level1] AS [l1] - WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[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 [l2].[Id], [l2].[OneToOne_Required_PK_Date], [l2].[Level1_Required_Id], [l2].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l2] - 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].[Level2_Required_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 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 [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 [t2] LEFT JOIN [Level1] AS [l3] ON [t2].[Level1_Required_Id0] = [l3].[Id] @@ -2810,7 +2810,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 ( @@ -2819,19 +2819,19 @@ 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] - 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 [l2].[Level1_Optional_Id], [l2].[Level2_Name] FROM [Level1] AS [l2] - 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 [l].[Id] = [t1].[Level1_Optional_Id] LEFT JOIN [Level1] AS [l3] ON [t0].[Level1_Required_Id] = [l3].[Id] -WHERE [t1].[Level2_Name] = N'L2 01' OR [l3].[Name] <> N'Bar' OR [l3].[Name] IS NULL"); +WHERE [t1].[Level2_Name] = N'L2 01' OR [l3].[Name] <> N'Bar' OR ([l3].[Name] IS NULL)"); } public override async Task OrderBy_nav_prop_reference_optional(bool async) @@ -2844,7 +2844,7 @@ FROM [Level1] AS [l] LEFT JOIN ( SELECT [l0].[Level1_Optional_Id], [l0].[Level2_Name] FROM [Level1] AS [l0] - WHERE [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]"); } @@ -2865,12 +2865,12 @@ ORDER BY [l].[Id] 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] - WHERE [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 [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] - 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 [t1] ON [t].[Id] = [t1].[Level1_Optional_Id] ORDER BY [t].[Id]"); } @@ -2896,12 +2896,12 @@ 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_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id] FROM [Level1] AS [l0] - WHERE [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 [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] - 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 [t0] ON [l].[Id] = [t0].[OneToOne_Optional_PK_Inverse2Id]"); } @@ -2911,7 +2911,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 ( @@ -2920,12 +2920,12 @@ FROM [Level1] AS [l0] LEFT JOIN ( SELECT [l2].[Id], [l2].[OneToOne_Required_PK_Date], [l2].[Level1_Optional_Id], [l2].[Level1_Required_Id], [l2].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l2] - 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 [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 [l1] ON [t].[Level1_Optional_Id] = [l1].[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]"); } @@ -2939,9 +2939,9 @@ FROM [Level1] AS [l] LEFT JOIN ( SELECT [l0].[Level1_Optional_Id], [l0].[Level2_Name] FROM [Level1] AS [l0] - WHERE [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) @@ -2950,34 +2950,34 @@ 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] - WHERE [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 [l1].[Id], [l1].[Level2_Required_Id], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id] FROM [Level1] AS [l1] - WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[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 [l2].[Id], [l2].[OneToOne_Required_PK_Date], [l2].[Level1_Required_Id], [l2].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l2] - 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].[OneToMany_Optional_Inverse3Id] = 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 [Level1] AS [l3] ON [t1].[Level1_Required_Id] = [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 [t0].[Level2_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse3Id] IS NOT NULL AND ([l3].[Name] <> N'L1 07' OR [l3].[Name] IS NULL) AND [l3].[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 ([l3].[Name] <> N'L1 07' OR ([l3].[Name] IS NULL)) AND ([l3].[Id] IS NOT NULL)"); } public override async Task Multi_level_navigation_compared_to_null(bool async) @@ -2986,34 +2986,34 @@ 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] - WHERE [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 [l1].[Id], [l1].[Level2_Required_Id], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id] FROM [Level1] AS [l1] - WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[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 [l2].[Id], [l2].[OneToOne_Required_PK_Date], [l2].[Level1_Required_Id], [l2].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l2] - 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].[OneToMany_Optional_Inverse3Id] = 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 [Level1] AS [l3] ON [t1].[Level1_Required_Id] = [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 [t0].[Level2_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse3Id] IS NOT NULL AND [l3].[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 ([l3].[Id] IS NOT NULL)"); } public override async Task Where_multiple_nav_prop_reference_optional_compared_to_null1(bool async) @@ -3026,16 +3026,16 @@ 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] - WHERE [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 [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[OneToMany_Required_Inverse3Id] FROM [Level1] AS [l1] - WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[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) @@ -3048,21 +3048,21 @@ FROM [Level1] AS [l] LEFT JOIN ( SELECT [l0].[Level1_Optional_Id], [l0].[Level2_Name] FROM [Level1] AS [l0] - WHERE [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 [l1].[Id], [l1].[OneToOne_Required_PK_Date], [l1].[Level1_Required_Id], [l1].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l1] - 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 [t0] ON [l].[Id] = [t0].[Level1_Required_Id] LEFT JOIN ( SELECT [l2].[Level2_Optional_Id], [l2].[Level3_Name] FROM [Level1] AS [l2] - 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] -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) @@ -3075,7 +3075,7 @@ 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_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id] FROM [Level1] AS [l0] - WHERE [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]"); } @@ -3085,15 +3085,15 @@ 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] - WHERE [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 [l1].[Id], [t1].[Id] AS [Id0], [t1].[OneToOne_Required_PK_Date], [t1].[Level1_Required_Id], [t1].[OneToMany_Required_Inverse2Id] @@ -3101,14 +3101,14 @@ FROM [Level1] AS [l1] LEFT JOIN ( SELECT [l2].[Id], [l2].[OneToOne_Required_PK_Date], [l2].[Level1_Optional_Id], [l2].[Level1_Required_Id], [l2].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l2] - 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 [l1].[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) @@ -3121,7 +3121,7 @@ FROM [Level1] AS [l] LEFT JOIN ( SELECT [l0].[Level1_Optional_Id], [l0].[Level2_Name] FROM [Level1] AS [l0] - WHERE [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]"); } @@ -3131,7 +3131,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 ( @@ -3140,26 +3140,26 @@ 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] - 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 [l2].[Id], [l2].[OneToOne_Required_PK_Date], [l2].[Level1_Optional_Id], [l2].[Level1_Required_Id], [l2].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l2] - 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 [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) @@ -3172,28 +3172,28 @@ 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] - WHERE [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 [l1].[Id], [l1].[Level2_Required_Id], [l1].[OneToMany_Required_Inverse3Id] FROM [Level1] AS [l1] - WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[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 [l2].[Id], [l2].[OneToOne_Required_PK_Date], [l2].[Level1_Required_Id], [l2].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l2] - 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].[Level2_Required_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 [Level1] AS [l3] ON [t1].[Level1_Required_Id] = [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 [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) @@ -3206,14 +3206,14 @@ 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_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id] FROM [Level1] AS [l0] - WHERE [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 [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Level3_Name], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[OneToOne_Optional_PK_Inverse3Id] FROM [Level1] AS [l1] - WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[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]"); } @@ -3223,13 +3223,13 @@ 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] - WHERE [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] @@ -3237,15 +3237,15 @@ FROM [Level1] AS [l1] LEFT JOIN ( SELECT [l2].[Id], [l2].[OneToOne_Required_PK_Date], [l2].[Level1_Required_Id], [l2].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l2] - 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 [l1].[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"); } @@ -3259,16 +3259,16 @@ 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] - WHERE [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 [l1].[Level2_Optional_Id], [l1].[Level3_Name] FROM [Level1] AS [l1] - WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[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) @@ -3281,7 +3281,7 @@ FROM [Level1] AS [l] LEFT JOIN ( SELECT [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id] FROM [Level1] AS [l0] - WHERE [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]"); } @@ -3295,10 +3295,10 @@ 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] - WHERE [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"); } @@ -3319,13 +3319,13 @@ FROM [Level1] AS [l0] 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] - 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]"); } @@ -3340,14 +3340,14 @@ FROM [Level1] AS [l] 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] - WHERE [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 [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Level3_Name], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[OneToOne_Optional_PK_Inverse3Id] FROM [Level1] AS [l1] - WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[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]"); } @@ -3361,14 +3361,14 @@ 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] - WHERE [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 [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Level3_Name], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[OneToOne_Optional_PK_Inverse3Id] FROM [Level1] AS [l1] - WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[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]"); } @@ -3382,10 +3382,10 @@ 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] - WHERE [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"); } @@ -3399,7 +3399,7 @@ FROM [Level1] AS [l] LEFT JOIN ( SELECT [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id] FROM [Level1] AS [l0] - WHERE [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'"); } @@ -3414,14 +3414,14 @@ 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_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id] FROM [Level1] AS [l0] - WHERE [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 [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Level3_Name], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[OneToOne_Optional_PK_Inverse3Id] FROM [Level1] AS [l1] - WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[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]"); } @@ -3438,13 +3438,13 @@ FROM [Level1] AS [l0] 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] - 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) @@ -3461,14 +3461,14 @@ FROM [Level1] AS [l] LEFT JOIN ( SELECT [l0].[Level1_Required_Id], [l0].[Level2_Name] FROM [Level1] AS [l0] - WHERE [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] 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] - 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 [t1] ON [t0].[Id] = [t1].[Level1_Optional_Id] ORDER BY [t0].[Level2_Name]"); } @@ -3479,16 +3479,16 @@ 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] - WHERE [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]"); } @@ -3498,24 +3498,24 @@ 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], [t1].[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] - WHERE [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 [l1].[Id], [l1].[Level2_Required_Id], [l1].[OneToMany_Required_Inverse3Id] FROM [Level1] AS [l1] - WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[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 [l2].[Id], [t3].[Id] AS [Id1], [t3].[Level2_Required_Id], [t3].[OneToMany_Required_Inverse3Id] @@ -3523,21 +3523,21 @@ FROM [Level1] AS [l2] LEFT JOIN ( SELECT [l3].[Id], [l3].[OneToOne_Required_PK_Date], [l3].[Level1_Required_Id], [l3].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l3] - WHERE [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].[Level1_Required_Id] LEFT JOIN ( SELECT [l4].[Id], [l4].[Level2_Optional_Id], [l4].[Level2_Required_Id], [l4].[OneToMany_Required_Inverse3Id] FROM [Level1] AS [l4] - 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 [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] ) 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 = CASE - WHEN [t1].[Level2_Required_Id] IS NOT NULL AND [t1].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [t1].[Id1] + WHEN ([t1].[Level2_Required_Id] IS NOT NULL) AND ([t1].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [t1].[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) @@ -3550,10 +3550,10 @@ 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] - WHERE [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"); } @@ -3563,18 +3563,18 @@ 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] - WHERE [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 [l1] ON [t].[OneToOne_Optional_PK_Inverse2Id] = [l1].[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 [l1].[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 [l1].[Id] > 5"); } public override async Task SelectMany_navigation_property(bool async) @@ -3587,7 +3587,7 @@ FROM [Level1] AS [l] 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] - WHERE [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]"); } @@ -3597,15 +3597,15 @@ 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] - WHERE [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 [l1].[Id], [l1].[Name], [t1].[Level2_Name] @@ -3613,10 +3613,10 @@ FROM [Level1] AS [l1] LEFT JOIN ( SELECT [l2].[Level1_Optional_Id], [l2].[Level2_Name] FROM [Level1] AS [l2] - 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 [l1].[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) @@ -3625,7 +3625,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 ( @@ -3634,12 +3634,12 @@ FROM [Level1] AS [l0] LEFT JOIN ( SELECT [l2].[Id], [l2].[OneToOne_Required_PK_Date], [l2].[Level1_Optional_Id], [l2].[Level1_Required_Id], [l2].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l2] - 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 [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 [l1] ON [t].[Level1_Optional_Id] = [l1].[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 @@ -3647,11 +3647,11 @@ 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] FROM [Level1] AS [l4] - 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 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) @@ -3664,7 +3664,7 @@ FROM [Level1] AS [l] INNER JOIN ( SELECT [l0].[Level2_Name], [l0].[OneToMany_Optional_Inverse2Id] FROM [Level1] AS [l0] - WHERE [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]"); } @@ -3678,30 +3678,30 @@ 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] - WHERE [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 [l1].[Id], [l1].[Level2_Required_Id], [l1].[OneToMany_Required_Inverse3Id] FROM [Level1] AS [l1] - WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[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 [l2].[Id], [l2].[OneToOne_Required_PK_Date], [l2].[Level1_Required_Id], [l2].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l2] - 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].[Level2_Required_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 [Level1] AS [l3] ON [t1].[Level1_Required_Id] = [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 [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 [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"); } @@ -3715,13 +3715,13 @@ 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], [l0].[OneToOne_Optional_PK_Inverse2Id] FROM [Level1] AS [l0] - WHERE [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 [l1] ON [t].[OneToMany_Required_Inverse2Id] = [l1].[Id] 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 ([l1].[Id] = [l2].[Id] OR ([l1].[Id] IS NULL AND [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 ([l1].[Id] = [l2].[Id] OR (([l1].[Id] IS NULL) AND ([l2].[Id] IS NULL)))"); } public override async Task SelectMany_with_navigation_and_explicit_DefaultIfEmpty(bool async) @@ -3734,9 +3734,9 @@ FROM [Level1] AS [l] LEFT JOIN ( SELECT [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Required_Id], [l0].[OneToMany_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l0] - WHERE [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( @@ -3758,11 +3758,11 @@ FROM [Level1] AS [l1] 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] - 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"); } @@ -3777,29 +3777,29 @@ 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] - WHERE [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 [l1].[Id], [l1].[Level2_Required_Id], [l1].[OneToMany_Required_Inverse3Id] FROM [Level1] AS [l1] - WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[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 [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] - 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].[Level2_Required_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 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 [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"); } @@ -3813,21 +3813,21 @@ FROM [Level1] AS [l] 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] - WHERE [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 [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Level3_Name], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[OneToOne_Optional_PK_Inverse3Id] FROM [Level1] AS [l1] - WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[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 [l2].[Id], [l2].[Level3_Optional_Id], [l2].[Level3_Required_Id], [l2].[Level4_Name], [l2].[OneToMany_Optional_Inverse4Id], [l2].[OneToMany_Required_Inverse4Id], [l2].[OneToOne_Optional_PK_Inverse4Id] FROM [Level1] AS [l2] - WHERE [l2].[Level3_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse4Id] IS NOT NULL + WHERE ([l2].[Level3_Required_Id] IS NOT NULL) AND ([l2].[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_Required_Id]"); } @@ -3841,9 +3841,9 @@ FROM [Level1] AS [l] LEFT JOIN ( SELECT [l0].[Level1_Optional_Id], [l0].[Level2_Name] FROM [Level1] AS [l0] - WHERE [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) @@ -3858,7 +3858,7 @@ FROM [Level1] AS [l] INNER JOIN ( SELECT [l0].[Level2_Name] AS [Name], [l0].[OneToMany_Optional_Inverse2Id] FROM [Level1] AS [l0] - WHERE [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]"); } @@ -3876,16 +3876,16 @@ FROM [Level1] AS [l0] 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] - 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 [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] - 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 [l].[Id] = [t1].[Level1_Optional_Id]"); } @@ -3916,12 +3916,12 @@ 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_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id] FROM [Level1] AS [l0] - WHERE [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 [l1] ON [t].[Level1_Required_Id] = [l1].[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 [l1].[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 [l1].[Id] = 1"); } public override async Task Include10(bool async) @@ -3934,33 +3934,33 @@ 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_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id] FROM [Level1] AS [l0] - WHERE [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 [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Level3_Name], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[OneToOne_Optional_PK_Inverse3Id] FROM [Level1] AS [l1] - WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[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 [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] - 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 [l].[Id] = [t1].[OneToOne_Optional_PK_Inverse2Id] 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] FROM [Level1] AS [l3] - 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 [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].[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 = [t2].[Level2_Optional_Id] LEFT JOIN ( SELECT [l4].[Id], [l4].[Level3_Optional_Id], [l4].[Level3_Required_Id], [l4].[Level4_Name], [l4].[OneToMany_Optional_Inverse4Id], [l4].[OneToMany_Required_Inverse4Id], [l4].[OneToOne_Optional_PK_Inverse4Id] FROM [Level1] AS [l4] - WHERE [l4].[Level3_Required_Id] IS NOT NULL AND [l4].[OneToMany_Required_Inverse4Id] IS NOT NULL + WHERE ([l4].[Level3_Required_Id] IS NOT NULL) AND ([l4].[OneToMany_Required_Inverse4Id] IS NOT NULL) ) AS [t3] ON 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 = [t3].[OneToOne_Optional_PK_Inverse4Id]"); } @@ -3974,15 +3974,15 @@ 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_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id] FROM [Level1] AS [l0] - WHERE [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 [l1] ON [t].[OneToMany_Required_Inverse2Id] = [l1].[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 [l2] - 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 [l1].[Id] IS NOT NULL AND [l1].[Id] = [l2].[OneToMany_Optional_Inverse2Id]) > 0"); + 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 ([l1].[Id] IS NOT NULL) AND [l1].[Id] = [l2].[OneToMany_Optional_Inverse2Id]) > 0"); } public override async Task Where_multiple_nav_prop_reference_optional_compared_to_null2(bool async) @@ -3995,28 +3995,28 @@ 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] - WHERE [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 [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Level3_Name], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[OneToOne_Optional_PK_Inverse3Id] FROM [Level1] AS [l1] - WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[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 [l2].[Id], [l2].[OneToOne_Required_PK_Date], [l2].[Level1_Optional_Id], [l2].[Level1_Required_Id], [l2].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l2] - 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].[Level2_Optional_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 [Level1] AS [l3] ON [t1].[Level1_Optional_Id] = [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 [t0].[Level2_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse3Id] IS NOT 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 ([t0].[Level2_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse3Id] IS NOT NULL) AND ([l3].[Id] IS NULL)"); } public override async Task SelectMany_navigation_property_and_filter_after(bool async) @@ -4029,13 +4029,13 @@ FROM [Level1] AS [l] 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] - WHERE [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) @@ -4051,30 +4051,30 @@ FROM [Level1] AS [l0] 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] - 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 [l2] 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] - WHERE [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] = 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 [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] FROM [Level1] AS [l4] - 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 = 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) @@ -4090,11 +4090,11 @@ FROM [Level1] AS [l0] 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] - 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]"); } @@ -4109,16 +4109,16 @@ 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] - WHERE [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 [l1].[Level2_Required_Id], [l1].[Level3_Name] FROM [Level1] AS [l1] - WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[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) @@ -4131,9 +4131,9 @@ FROM [Level1] AS [l] LEFT JOIN ( SELECT [l0].[Level1_Optional_Id], [l0].[Level2_Name] FROM [Level1] AS [l0] - WHERE [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) @@ -4146,14 +4146,14 @@ 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] FROM [Level1] AS [l0] - WHERE [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 [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Level3_Name], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[OneToOne_Optional_PK_Inverse3Id] FROM [Level1] AS [l1] - WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[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]"); } @@ -4167,9 +4167,9 @@ FROM [Level1] AS [l] LEFT JOIN ( SELECT [l0].[Level1_Required_Id], [l0].[Level2_Name] FROM [Level1] AS [l0] - WHERE [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) @@ -4182,14 +4182,14 @@ 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_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id] FROM [Level1] AS [l0] - WHERE [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 [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Level3_Name], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[OneToOne_Optional_PK_Inverse3Id] FROM [Level1] AS [l1] - WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[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]"); } @@ -4215,27 +4215,27 @@ 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] - WHERE [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 [l1].[Id], [l1].[Level2_Required_Id], [l1].[OneToMany_Required_Inverse3Id] FROM [Level1] AS [l1] - WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[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 [l2] - WHERE [l2].[Level3_Required_Id] IS NOT NULL AND [l2].[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 = [l2].[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 [l2].[OneToMany_Optional_Inverse4Id] IS NULL)))"); + WHERE ([l2].[Level3_Required_Id] IS NOT NULL) AND ([l2].[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 = [l2].[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 ([l2].[OneToMany_Optional_Inverse4Id] IS NULL))))"); } public override async Task Null_check_removal_applied_recursively(bool async) @@ -4248,21 +4248,21 @@ 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] - WHERE [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 [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[OneToMany_Required_Inverse3Id] FROM [Level1] AS [l1] - WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[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 [l2].[Level3_Optional_Id], [l2].[Level4_Name] FROM [Level1] AS [l2] - WHERE [l2].[Level3_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse4Id] IS NOT NULL + WHERE ([l2].[Level3_Required_Id] IS NOT NULL) AND ([l2].[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 [t1].[Level4_Name] = N'L4 01'"); } @@ -4277,15 +4277,15 @@ FROM [Level1] AS [l] 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] - WHERE [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 FROM [Level1] AS [l1] - WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[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 ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[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 = [l1].[OneToMany_Required_Inverse3Id])"); } @@ -4299,7 +4299,7 @@ FROM [Level1] AS [l] LEFT JOIN ( SELECT [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id] FROM [Level1] AS [l0] - WHERE [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]"); } @@ -4309,41 +4309,41 @@ public override async Task Complex_navigations_with_predicate_projected_into_ano AssertSql( @"SELECT [l].[Name], 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 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] - WHERE [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 [l1].[Id], [l1].[Level2_Required_Id], [l1].[OneToMany_Required_Inverse3Id] FROM [Level1] AS [l1] - WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[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 [l2].[Id], [l2].[Level2_Optional_Id], [l2].[Level2_Required_Id], [l2].[OneToMany_Required_Inverse3Id] FROM [Level1] AS [l2] - 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 [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + WHEN ([t].[OneToOne_Required_PK_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] 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 [t1].[Level2_Required_Id] IS NOT NULL AND [t1].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [t1].[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 [t1].[Level2_Required_Id] IS NOT NULL AND [t1].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [t1].[Id] -END IS NULL)) AND (CASE - WHEN [t1].[Level2_Required_Id] IS NOT NULL AND [t1].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [t1].[Id] -END <> 7 OR CASE - WHEN [t1].[Level2_Required_Id] IS NOT NULL AND [t1].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [t1].[Id] -END IS NULL)"); + WHEN ([t1].[Level2_Required_Id] IS NOT NULL) AND ([t1].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [t1].[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 ([t1].[Level2_Required_Id] IS NOT NULL) AND ([t1].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [t1].[Id] +END IS NULL))) AND (CASE + WHEN ([t1].[Level2_Required_Id] IS NOT NULL) AND ([t1].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [t1].[Id] +END <> 7 OR (CASE + WHEN ([t1].[Level2_Required_Id] IS NOT NULL) AND ([t1].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [t1].[Id] +END IS NULL))"); } public override async Task GroupJoin_without_DefaultIfEmpty(bool async) @@ -4359,11 +4359,11 @@ FROM [Level1] AS [l0] 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] - 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]"); } @@ -4377,12 +4377,12 @@ 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] - WHERE [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"); } @@ -4392,20 +4392,20 @@ 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] - WHERE [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 [l1].[Id], [l1].[Level2_Required_Id], [l1].[OneToMany_Required_Inverse3Id] FROM [Level1] AS [l1] - WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[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]"); } @@ -4417,18 +4417,18 @@ public override async Task Project_collection_navigation_count(bool async) @"SELECT [l].[Id], ( SELECT COUNT(*) FROM [Level1] AS [l1] - WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[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 = [l1].[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 [l1].[OneToMany_Optional_Inverse3Id] IS NULL))) AS [Count] + WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[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 = [l1].[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 ([l1].[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] - WHERE [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]"); } @@ -4444,14 +4444,14 @@ FROM [Level1] AS [l] LEFT JOIN ( SELECT [l0].[Level1_Required_Id], [l0].[Level2_Name] FROM [Level1] AS [l0] - WHERE [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 [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] - 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 [t1] ON [t0].[Id] = [t1].[Level1_Optional_Id]"); } @@ -4465,7 +4465,7 @@ 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_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id] FROM [Level1] AS [l0] - WHERE [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]"); } @@ -4479,9 +4479,9 @@ 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_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id] FROM [Level1] AS [l0] - WHERE [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) @@ -4492,15 +4492,15 @@ 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] - WHERE [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) [l1].[Id], [l1].[Name] @@ -4508,11 +4508,11 @@ FROM [Level1] AS [l1] LEFT JOIN ( SELECT [l2].[Level1_Optional_Id], [l2].[Level2_Name] FROM [Level1] AS [l2] - 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 [l1].[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) @@ -4525,21 +4525,21 @@ 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] FROM [Level1] AS [l0] - WHERE [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 [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Level3_Name], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[OneToOne_Optional_PK_Inverse3Id] FROM [Level1] AS [l1] - WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[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 [l2].[Id], [l2].[Level3_Optional_Id], [l2].[Level3_Required_Id], [l2].[Level4_Name], [l2].[OneToMany_Optional_Inverse4Id], [l2].[OneToMany_Required_Inverse4Id], [l2].[OneToOne_Optional_PK_Inverse4Id] FROM [Level1] AS [l2] - WHERE [l2].[Level3_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse4Id] IS NOT NULL + WHERE ([l2].[Level3_Required_Id] IS NOT NULL) AND ([l2].[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_Required_Id]"); } @@ -4553,36 +4553,36 @@ 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] - WHERE [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 [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Level3_Name], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[OneToOne_Optional_PK_Inverse3Id] FROM [Level1] AS [l1] - WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[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 [l2].[Id], [l2].[OneToOne_Required_PK_Date], [l2].[Level1_Required_Id], [l2].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l2] - 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].[Level2_Required_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 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 [l3] - WHERE [l3].[Level2_Required_Id] IS NOT NULL AND [l3].[OneToMany_Required_Inverse3Id] IS NOT NULL AND 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 NOT NULL AND (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 = [l3].[OneToMany_Optional_Inverse3Id] 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 [l3].[OneToMany_Optional_Inverse3Id] IS NULL))) > 0"); + WHERE ([l3].[Level2_Required_Id] IS NOT NULL) AND ([l3].[OneToMany_Required_Inverse3Id] IS NOT NULL) AND (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 NOT NULL) AND (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 = [l3].[OneToMany_Optional_Inverse3Id] 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 ([l3].[OneToMany_Optional_Inverse3Id] IS NULL)))) > 0"); } public override async Task GroupJoin_in_subquery_with_client_projection(bool async) @@ -4601,11 +4601,11 @@ FROM [Level1] AS [l1] 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] - 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"); } @@ -4619,32 +4619,32 @@ 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] - WHERE [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 [l1].[Id], [l1].[Level2_Required_Id], [l1].[OneToMany_Required_Inverse3Id] FROM [Level1] AS [l1] - WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[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 [l2] 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 [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 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] FROM [Level1] AS [l4] - 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 [l5].[Id], [l5].[Date], [l5].[Name], [t3].[Id] AS [Id0], [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], [t4].[Id] AS [Id1], [t4].[Level2_Optional_Id], [t4].[Level2_Required_Id], [t4].[Level3_Name], [t4].[OneToMany_Optional_Inverse3Id], [t4].[OneToMany_Required_Inverse3Id], [t4].[OneToOne_Optional_PK_Inverse3Id] @@ -4652,28 +4652,28 @@ FROM [Level1] AS [l5] 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] FROM [Level1] AS [l6] - 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 [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] FROM [Level1] AS [l7] - 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 [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 [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 = [t2].[Level2_Optional_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 + 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 [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 Join_navigation_deeply_nested_required(bool async) @@ -4682,7 +4682,7 @@ public override async Task Join_navigation_deeply_nested_required(bool async) AssertSql( @"SELECT CASE - WHEN [t4].[Level3_Required_Id] IS NOT NULL AND [t4].[OneToMany_Required_Inverse4Id] IS NOT NULL THEN [t4].[Id2] + WHEN ([t4].[Level3_Required_Id] IS NOT NULL) AND ([t4].[OneToMany_Required_Inverse4Id] IS NOT NULL) THEN [t4].[Id2] END AS [Id4], [t4].[Level4_Name] AS [Name4], [l].[Id] AS [Id1], [l].[Name] AS [Name1] FROM [Level1] AS [l] INNER JOIN ( @@ -4691,46 +4691,46 @@ 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] - 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 [l2].[Id], [l2].[Level2_Required_Id], [l2].[OneToMany_Required_Inverse3Id] FROM [Level1] AS [l2] - 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 [l3].[Id], [l3].[Level3_Required_Id], [l3].[Level4_Name], [l3].[OneToMany_Required_Inverse4Id] FROM [Level1] AS [l3] - WHERE [l3].[Level3_Required_Id] IS NOT NULL AND [l3].[OneToMany_Required_Inverse4Id] IS NOT NULL + WHERE ([l3].[Level3_Required_Id] IS NOT NULL) AND ([l3].[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 = CASE - WHEN [t1].[Level3_Required_Id] IS NOT NULL AND [t1].[OneToMany_Required_Inverse4Id] IS NOT NULL THEN [t1].[Id] + WHEN ([t1].[Level3_Required_Id] IS NOT NULL) AND ([t1].[OneToMany_Required_Inverse4Id] IS NOT NULL) THEN [t1].[Id] END LEFT JOIN ( SELECT [l4].[Id], [l4].[Level2_Required_Id], [l4].[OneToMany_Required_Inverse3Id] FROM [Level1] AS [l4] - 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 [t1].[Level3_Required_Id] = 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 LEFT JOIN ( SELECT [l6].[Id], [l6].[OneToOne_Required_PK_Date], [l6].[Level1_Required_Id], [l6].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l6] - 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 [t2].[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 [l5] 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 = [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 AND [t0].[Level2_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse3Id] IS NOT NULL AND [t1].[Level3_Required_Id] IS NOT NULL AND [t1].[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 ([t1].[Level3_Required_Id] IS NOT NULL) AND ([t1].[OneToMany_Required_Inverse4Id] IS NOT NULL) ) AS [t4] ON [l].[Name] = [t4].[Name0]"); } @@ -4746,7 +4746,7 @@ FROM [Level1] AS [l] LEFT JOIN ( SELECT [l0].[Level1_Required_Id], [l0].[Level2_Name] FROM [Level1] AS [l0] - WHERE [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]"); @@ -4762,20 +4762,20 @@ 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] - WHERE [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 [l1] - WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[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 = [l1].[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 [l1].[OneToMany_Optional_Inverse3Id] IS NULL)))"); + WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[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 = [l1].[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 ([l1].[OneToMany_Optional_Inverse3Id] IS NULL))))"); } public override async Task Where_multiple_nav_prop_reference_optional_compared_to_null5(bool async) @@ -4788,23 +4788,23 @@ 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] - WHERE [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 [l1].[Id], [l1].[Level2_Required_Id], [l1].[OneToMany_Required_Inverse3Id] FROM [Level1] AS [l1] - WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[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 [l2].[Level3_Required_Id], [l2].[OneToMany_Required_Inverse4Id] FROM [Level1] AS [l2] - WHERE [l2].[Level3_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse4Id] IS NOT NULL + WHERE ([l2].[Level3_Required_Id] IS NOT NULL) AND ([l2].[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_Required_Id] -WHERE [t1].[Level3_Required_Id] IS NULL OR [t1].[OneToMany_Required_Inverse4Id] IS NULL"); +WHERE ([t1].[Level3_Required_Id] IS NULL) OR ([t1].[OneToMany_Required_Inverse4Id] IS NULL)"); } public override async Task Where_on_multilevel_reference_in_subquery_with_outer_projection(bool async) @@ -4820,28 +4820,28 @@ 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] - WHERE [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 [l1].[Id], [l1].[Level2_Required_Id], [l1].[Level3_Name], [l1].[OneToMany_Required_Inverse3Id] FROM [Level1] AS [l1] - WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[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 [l2].[Id], [l2].[OneToOne_Required_PK_Date], [l2].[Level1_Required_Id], [l2].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l2] - 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].[OneToMany_Required_Inverse3Id] = 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 [Level1] AS [l3] ON [t1].[Level1_Required_Id] = [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 [t0].[Level2_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse3Id] IS NOT NULL AND [l3].[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 [l3].[Name] = N'L1 03' ORDER BY [t0].[Level2_Required_Id] OFFSET @__p_0 ROWS FETCH NEXT @__p_1 ROWS ONLY"); } @@ -4859,9 +4859,9 @@ 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] - WHERE [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 [l1] ON [t].[Level1_Required_Id] = [l1].[Id] INNER JOIN ( @@ -4870,22 +4870,22 @@ FROM [Level1] AS [l2] LEFT JOIN ( SELECT [l3].[Id], [l3].[OneToOne_Required_PK_Date], [l3].[Level1_Required_Id], [l3].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l3] - WHERE [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] = 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 [l4].[Id], [l4].[Level2_Required_Id], [l4].[Level3_Name], [l4].[OneToMany_Required_Inverse3Id] FROM [Level1] AS [l4] - 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 = 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 [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 [t2].[Level2_Required_Id] IS NOT NULL AND [t2].[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 ([t2].[Level2_Required_Id] IS NOT NULL) AND ([t2].[OneToMany_Required_Inverse3Id] IS NOT NULL) ) AS [t1] ON [l1].[Id] = [t1].[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 [l1].[Name] = N'L1 03' AND [t1].[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 [l1].[Name] = N'L1 03' AND [t1].[Level3_Name] = N'L3 08' ORDER BY [l1].[Id]"); } @@ -4899,14 +4899,14 @@ 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_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id] FROM [Level1] AS [l0] - WHERE [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 [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Level3_Name], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[OneToOne_Optional_PK_Inverse3Id] FROM [Level1] AS [l1] - WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[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]"); } @@ -4920,7 +4920,7 @@ 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_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id] FROM [Level1] AS [l0] - WHERE [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]"); } @@ -4937,23 +4937,23 @@ FROM [Level1] AS [l0] 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] - 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 [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] FROM [Level1] AS [l2] - 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) ) AS [t1] ORDER BY 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 OFFSET 1 ROWS FETCH NEXT 1 ROWS ONLY) FROM [Level1] AS [l] @@ -4973,30 +4973,30 @@ FROM [Level1] AS [l0] 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] - 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 [l2] 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] - WHERE [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] = 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 [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] FROM [Level1] AS [l4] - 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 = 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) @@ -5009,29 +5009,29 @@ 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] - WHERE [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 [l1].[Id], [l1].[Level2_Required_Id], [l1].[OneToMany_Required_Inverse3Id] FROM [Level1] AS [l1] - WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[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 [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] - 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].[Level2_Required_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 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 [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"); } @@ -5041,13 +5041,13 @@ 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] - WHERE [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]"); } @@ -5061,9 +5061,9 @@ FROM [Level1] AS [l] LEFT JOIN ( SELECT [l0].[Level1_Optional_Id], [l0].[Level2_Name] FROM [Level1] AS [l0] - WHERE [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) @@ -5076,28 +5076,28 @@ 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] - WHERE [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 [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Level3_Name], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[OneToOne_Optional_PK_Inverse3Id] FROM [Level1] AS [l1] - WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[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 [l2].[Id], [l2].[OneToOne_Required_PK_Date], [l2].[Level1_Optional_Id], [l2].[Level1_Required_Id], [l2].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l2] - 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].[Level2_Optional_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 [Level1] AS [l3] ON [t1].[Level1_Optional_Id] = [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 [t0].[Level2_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse3Id] IS NOT NULL AND [l3].[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 ([l3].[Id] IS NOT NULL)"); } public override async Task Multi_include_with_groupby_in_subquery(bool async) @@ -5119,7 +5119,7 @@ FROM [Level1] AS [l0] 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] - 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 @@ -5127,9 +5127,9 @@ WHERE [l1].[OneToOne_Required_PK_Date] IS NOT NULL AND [l1].[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] FROM [Level1] AS [l2] - 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 [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]"); } @@ -5140,33 +5140,33 @@ public override async Task Join_navigation_deeply_nested_non_key_join(bool async AssertSql( @"SELECT CASE - WHEN [t1].[Level3_Required_Id] IS NOT NULL AND [t1].[OneToMany_Required_Inverse4Id] IS NOT NULL THEN [t1].[Id] + WHEN ([t1].[Level3_Required_Id] IS NOT NULL) AND ([t1].[OneToMany_Required_Inverse4Id] IS NOT NULL) THEN [t1].[Id] END AS [Id4], [t1].[Level4_Name] AS [Name4], [t2].[Id] AS [Id1], [t2].[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] - WHERE [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 [l1].[Id], [l1].[Level2_Required_Id], [l1].[OneToMany_Required_Inverse3Id] FROM [Level1] AS [l1] - WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[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 [l2].[Id], [l2].[Level3_Required_Id], [l2].[Level4_Name], [l2].[OneToMany_Required_Inverse4Id] FROM [Level1] AS [l2] - WHERE [l2].[Level3_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse4Id] IS NOT NULL + WHERE ([l2].[Level3_Required_Id] IS NOT NULL) AND ([l2].[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 = CASE - WHEN [t1].[Level3_Required_Id] IS NOT NULL AND [t1].[OneToMany_Required_Inverse4Id] IS NOT NULL THEN [t1].[Id] + WHEN ([t1].[Level3_Required_Id] IS NOT NULL) AND ([t1].[OneToMany_Required_Inverse4Id] IS NOT NULL) THEN [t1].[Id] END INNER JOIN ( SELECT [l3].[Id], [l3].[Name], [t5].[Level4_Name] @@ -5174,26 +5174,26 @@ FROM [Level1] AS [l3] LEFT JOIN ( SELECT [l4].[Id], [l4].[OneToOne_Required_PK_Date], [l4].[Level1_Required_Id], [l4].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l4] - 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] = [t3].[Level1_Required_Id] LEFT JOIN ( SELECT [l5].[Id], [l5].[Level2_Optional_Id], [l5].[Level2_Required_Id], [l5].[OneToMany_Required_Inverse3Id] FROM [Level1] AS [l5] - 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 [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] LEFT JOIN ( SELECT [l6].[Id], [l6].[Level3_Required_Id], [l6].[Level4_Name], [l6].[OneToMany_Required_Inverse4Id] FROM [Level1] AS [l6] - 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 [t5] 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 = CASE - WHEN [t5].[Level3_Required_Id] IS NOT NULL AND [t5].[OneToMany_Required_Inverse4Id] IS NOT NULL THEN [t5].[Id] + WHEN ([t5].[Level3_Required_Id] IS NOT NULL) AND ([t5].[OneToMany_Required_Inverse4Id] IS NOT NULL) THEN [t5].[Id] END ) AS [t2] ON [t1].[Level4_Name] = [t2].[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 [t1].[Level3_Required_Id] IS NOT NULL AND [t1].[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 ([t1].[Level3_Required_Id] IS NOT NULL) AND ([t1].[OneToMany_Required_Inverse4Id] IS NOT NULL)"); } public override async Task Join_navigation_in_outer_selector_translated_to_extra_join_nested(bool async) @@ -5202,20 +5202,20 @@ public override async Task Join_navigation_in_outer_selector_translated_to_extra AssertSql( @"SELECT [l].[Id] AS [Id1], CASE - WHEN [t1].[Level2_Required_Id] IS NOT NULL AND [t1].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [t1].[Id1] + WHEN ([t1].[Level2_Required_Id] IS NOT NULL) AND ([t1].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [t1].[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] - WHERE [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 [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[OneToMany_Required_Inverse3Id] FROM [Level1] AS [l1] - WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[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 [t3].[Id] AS [Id1], [t3].[Level2_Required_Id], [t3].[OneToMany_Required_Inverse3Id] @@ -5223,24 +5223,24 @@ FROM [Level1] AS [l2] LEFT JOIN ( SELECT [l3].[Id], [l3].[OneToOne_Required_PK_Date], [l3].[Level1_Required_Id], [l3].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l3] - WHERE [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] = 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 [l4].[Id], [l4].[Level2_Required_Id], [l4].[OneToMany_Required_Inverse3Id] FROM [Level1] AS [l4] - 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 [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 - 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) ) 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 = CASE - WHEN [t1].[Level2_Required_Id] IS NOT NULL AND [t1].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [t1].[Id1] + WHEN ([t1].[Level2_Required_Id] IS NOT NULL) AND ([t1].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [t1].[Id1] END"); } @@ -5254,9 +5254,9 @@ FROM [Level1] AS [l] LEFT JOIN ( SELECT [l0].[Level1_Optional_Id], [l0].[Level2_Name] FROM [Level1] AS [l0] - WHERE [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) @@ -5272,11 +5272,11 @@ FROM [Level1] AS [l0] 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] - 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]"); } @@ -5290,34 +5290,34 @@ 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] - WHERE [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 [l1].[Id], [l1].[Level2_Required_Id], [l1].[OneToMany_Required_Inverse3Id] FROM [Level1] AS [l1] - WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[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 [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] FROM [Level1] AS [l2] - 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 [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + WHEN ([t].[OneToOne_Required_PK_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].[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 [l3] - WHERE [l3].[Level3_Required_Id] IS NOT NULL AND [l3].[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 = [l3].[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 [l3].[OneToMany_Optional_Inverse4Id] IS NULL)))"); + WHERE ([l3].[Level3_Required_Id] IS NOT NULL) AND ([l3].[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 = [l3].[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 ([l3].[OneToMany_Optional_Inverse4Id] IS NULL))))"); } public override async Task Include_multiple_collections_on_same_level(bool async) @@ -5330,12 +5330,12 @@ 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_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id] FROM [Level1] AS [l0] - WHERE [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 [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] - 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 [t0] ON [l].[Id] = [t0].[OneToMany_Required_Inverse2Id] ORDER BY [l].[Id], [t].[Id]"); } @@ -5350,12 +5350,12 @@ 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_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id] FROM [Level1] AS [l0] - WHERE [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 [l1] ON [t].[Level1_Required_Id] = [l1].[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 [l1].[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 [l1].[Id] > 7"); } public override async Task Select_optional_navigation_property_string_concat(bool async) @@ -5364,14 +5364,14 @@ 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] 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] - WHERE [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]"); } @@ -5381,35 +5381,35 @@ 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], [l4].[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] - WHERE [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 [l1].[Id], [l1].[Level2_Required_Id], [l1].[OneToMany_Required_Inverse3Id] FROM [Level1] AS [l1] - WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[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 [l2].[Id], [l2].[OneToOne_Required_PK_Date], [l2].[Level1_Optional_Id], [l2].[Level1_Required_Id], [l2].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l2] - 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].[Level2_Required_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 [Level1] AS [l3] ON [t1].[Level1_Optional_Id] = [l3].[Id] INNER JOIN [Level1] AS [l4] ON [l3].[Id] = [l4].[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) @@ -5424,12 +5424,12 @@ 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_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id] FROM [Level1] AS [l0] - WHERE [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 [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] - 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 [t0] ON [l].[Id] = [t0].[OneToOne_Optional_PK_Inverse2Id] ) AS [t1]"); } @@ -5444,7 +5444,7 @@ FROM [Level1] AS [l] 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] - WHERE [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"); } @@ -5462,20 +5462,20 @@ FROM [Level1] AS [l0] 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] - 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 [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] FROM [Level1] AS [l2] - 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) ) AS [t1] ORDER BY (SELECT 1) OFFSET 1 ROWS FETCH NEXT 1 ROWS ONLY) AS [Subquery] @@ -5493,7 +5493,7 @@ 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_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id] FROM [Level1] AS [l0] - WHERE [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]"); } @@ -5507,9 +5507,9 @@ FROM [Level1] AS [l] LEFT JOIN ( SELECT [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l0] - WHERE [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) @@ -5525,11 +5525,11 @@ FROM [Level1] AS [l0] 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] - 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] @@ -5537,13 +5537,13 @@ FROM [Level1] AS [l2] LEFT JOIN ( SELECT [l3].[Id], [l3].[OneToOne_Required_PK_Date], [l3].[Level1_Optional_Id], [l3].[Level1_Required_Id], [l3].[Level2_Name], [l3].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l3] - WHERE [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] = 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) @@ -5556,7 +5556,7 @@ FROM [Level1] AS [l] LEFT JOIN ( SELECT [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id] FROM [Level1] AS [l0] - WHERE [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]"); } @@ -5570,7 +5570,7 @@ FROM [Level1] AS [l] LEFT JOIN ( SELECT [l0].[Level1_Optional_Id], [l0].[Level2_Name] FROM [Level1] AS [l0] - WHERE [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'"); } @@ -5587,10 +5587,10 @@ 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] - WHERE [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'"); } @@ -5604,12 +5604,12 @@ 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_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id] FROM [Level1] AS [l0] - WHERE [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 [l1] ON [t].[Level1_Required_Id] = [l1].[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 [l1].[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 [l1].[Id] = 7"); } public override async Task Include_reference_with_groupby_in_subquery(bool async) @@ -5631,7 +5631,7 @@ FROM [Level1] AS [l0] 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] - 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 @@ -5644,7 +5644,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 ( @@ -5653,11 +5653,11 @@ FROM [Level1] AS [l0] 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] - 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 [l2] ON [t0].[Level1_Optional_Id] = [l2].[Id] WHERE [l].[Id] = [l2].[Id]"); @@ -5673,10 +5673,10 @@ 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] - WHERE [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"); } @@ -5690,18 +5690,18 @@ 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] - WHERE [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(*) FROM [Level1] AS [l1] - WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[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 = [l1].[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 [l1].[OneToMany_Optional_Inverse3Id] IS NULL))) > 0"); + WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[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 = [l1].[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 ([l1].[OneToMany_Optional_Inverse3Id] IS NULL)))) > 0"); } public override async Task Select_multiple_nav_prop_optional_required(bool async) @@ -5710,20 +5710,20 @@ 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] - WHERE [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 [l1].[Id], [l1].[Level2_Required_Id], [l1].[OneToMany_Required_Inverse3Id] FROM [Level1] AS [l1] - WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[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]"); } @@ -5737,7 +5737,7 @@ FROM [Level1] AS [l] LEFT JOIN ( SELECT [l0].[Level1_Optional_Id], [l0].[Level2_Name] FROM [Level1] AS [l0] - WHERE [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')"); } @@ -5755,11 +5755,11 @@ FROM [Level1] AS [l0] LEFT JOIN ( SELECT [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Level3_Name], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[OneToOne_Optional_PK_Inverse3Id] FROM [Level1] AS [l1] - WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse3Id] IS NOT NULL) ) AS [t] 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 = [t].[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 [t0] ON [l].[Id] = [t0].[OneToMany_Optional_Inverse2Id]"); } @@ -5769,17 +5769,17 @@ 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 [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] - WHERE [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 [l1].[Id], [t1].[Id] AS [Id0], [t1].[OneToOne_Required_PK_Date], [t1].[Level1_Required_Id], [t1].[OneToMany_Required_Inverse2Id] @@ -5787,12 +5787,12 @@ FROM [Level1] AS [l1] LEFT JOIN ( SELECT [l2].[Id], [l2].[OneToOne_Required_PK_Date], [l2].[Level1_Optional_Id], [l2].[Level1_Required_Id], [l2].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l2] - 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 [l1].[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] @@ -5800,33 +5800,33 @@ FROM [Level1] AS [l3] LEFT JOIN ( SELECT [l4].[Id], [l4].[OneToOne_Required_PK_Date], [l4].[Level1_Required_Id], [l4].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l4] - 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 LEFT JOIN ( SELECT [l5].[Id], [l5].[Level2_Optional_Id], [l5].[Level2_Required_Id], [l5].[OneToMany_Required_Inverse3Id] FROM [Level1] AS [l5] - 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 [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 LEFT JOIN ( SELECT [l6].[Id], [l6].[OneToOne_Required_PK_Date], [l6].[Level1_Required_Id], [l6].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l6] - 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 [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 [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 [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + WHEN ([t].[OneToOne_Required_PK_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 [t2].[OneToOne_Required_PK_Date0] IS NOT NULL AND [t2].[Level1_Required_Id0] IS NOT NULL AND [t2].[OneToMany_Required_Inverse2Id0] IS NOT NULL THEN [t2].[Id2] + WHEN ([t2].[OneToOne_Required_PK_Date0] IS NOT NULL) AND ([t2].[Level1_Required_Id0] IS NOT NULL) AND ([t2].[OneToMany_Required_Inverse2Id0] IS NOT NULL) THEN [t2].[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) @@ -5839,7 +5839,7 @@ FROM [Level1] AS [l] LEFT JOIN ( SELECT [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id] FROM [Level1] AS [l0] - WHERE [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'"); } @@ -5854,7 +5854,7 @@ FROM [Level1] AS [l] LEFT JOIN ( SELECT [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id] FROM [Level1] AS [l0] - WHERE [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]"); } @@ -5874,11 +5874,11 @@ FROM [Level1] AS [l1] 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] - 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(*) @@ -5889,11 +5889,11 @@ FROM [Level1] AS [l4] 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] - 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] = 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 [l3].[Id] = [t1].[Level1_Optional_Id]) > 7) > 4 AND [l].[Id] < 2"); } @@ -5907,29 +5907,29 @@ 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] - WHERE [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 [l1].[Id], [l1].[Level2_Required_Id], [l1].[Level3_Name], [l1].[OneToMany_Required_Inverse3Id] FROM [Level1] AS [l1] - WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[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 [l2].[Id], [l2].[OneToOne_Required_PK_Date], [l2].[Level1_Optional_Id], [l2].[Level1_Required_Id], [l2].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l2] - 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].[Level2_Required_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 [Level1] AS [l3] ON [t1].[Level1_Required_Id] = [l3].[Id] LEFT JOIN [Level1] AS [l4] ON [t1].[Level1_Optional_Id] = [l4].[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 ([l3].[Id] = [l4].[Id] OR ([l3].[Id] IS NULL AND [l4].[Id] IS NULL)) AND ([l4].[Id] <> 7 OR [l4].[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 ([l3].[Id] = [l4].[Id] OR (([l3].[Id] IS NULL) AND ([l4].[Id] IS NULL))) AND ([l4].[Id] <> 7 OR ([l4].[Id] IS NULL))"); } public override async Task Select_subquery_with_client_eval_and_navigation1(bool async) @@ -5943,24 +5943,24 @@ FROM [Level1] AS [l1] 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] - WHERE [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 [l1].[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 [l2] ON [t0].[Level1_Required_Id] = [l2].[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] - WHERE [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) @@ -5985,7 +5985,7 @@ 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_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id] FROM [Level1] AS [l0] - WHERE [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]"); } @@ -6005,11 +6005,11 @@ FROM [Level1] AS [l1] 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] - 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"); } @@ -6023,9 +6023,9 @@ FROM [Level1] AS [l] 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] - WHERE [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) @@ -6038,7 +6038,7 @@ FROM [Level1] AS [l] LEFT JOIN ( SELECT [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id] FROM [Level1] AS [l0] - WHERE [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]"); } @@ -6052,13 +6052,13 @@ 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_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id] FROM [Level1] AS [l0] - WHERE [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"); } @@ -6072,27 +6072,27 @@ 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] - WHERE [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 [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Level3_Name], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[OneToOne_Optional_PK_Inverse3Id] FROM [Level1] AS [l1] - WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[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 [l2].[Id], [l2].[OneToOne_Required_PK_Date], [l2].[Level1_Required_Id], [l2].[Level2_Name], [l2].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l2] - 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].[Level2_Required_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 AND [t0].[Level2_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse3Id] IS NOT NULL AND [t1].[Level2_Name] IS NOT NULL AND ([t1].[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 ([t1].[Level2_Name] IS NOT NULL) AND ([t1].[Level2_Name] LIKE N'L%')"); } public override async Task Select_nav_prop_reference_optional1_via_DefaultIfEmpty(bool async) @@ -6108,11 +6108,11 @@ FROM [Level1] AS [l0] 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] - 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]"); } @@ -6126,16 +6126,16 @@ 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] - WHERE [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 [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[OneToMany_Required_Inverse3Id] FROM [Level1] AS [l1] - WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[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) @@ -6148,12 +6148,12 @@ 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] - WHERE [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 [l1] ON [t].[OneToMany_Required_Inverse2Id] = [l1].[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 ([l1].[Id] = [l1].[Id] OR [l1].[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 ([l1].[Id] = [l1].[Id] OR ([l1].[Id] IS NULL))"); } public override async Task Optional_navigation_in_subquery_with_unrelated_projection(bool async) @@ -6168,9 +6168,9 @@ FROM [Level1] AS [l] LEFT JOIN ( SELECT [l0].[Level1_Optional_Id], [l0].[Level2_Name] FROM [Level1] AS [l0] - WHERE [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]"); } @@ -6187,11 +6187,11 @@ FROM [Level1] AS [l0] 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] - 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) @@ -6206,40 +6206,40 @@ FROM [Level1] AS [l1] 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] - WHERE [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 [l1].[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 [l2] ON [t0].[Level1_Required_Id] = [l2].[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) [l2].[Name] FROM [Level1] AS [l1] 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] - WHERE [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 [l1].[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 [l2] ON [t0].[Level1_Required_Id] = [l2].[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] LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Required_Id], [l0].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l0] - WHERE [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) @@ -6255,7 +6255,7 @@ 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_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id] FROM [Level1] AS [l0] - WHERE [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]"); } @@ -6272,12 +6272,12 @@ 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_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id] FROM [Level1] AS [l0] - WHERE [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 [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] - 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 [t1] ON [t].[Id] = [t1].[Level1_Optional_Id]"); } @@ -6291,7 +6291,7 @@ FROM [Level1] AS [l] LEFT JOIN ( SELECT [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id] FROM [Level1] AS [l0] - WHERE [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]"); } @@ -6308,29 +6308,29 @@ 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] - WHERE [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 [l1].[Id], [l1].[Level2_Required_Id], [l1].[OneToMany_Required_Inverse3Id] FROM [Level1] AS [l1] - WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[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 [l2].[Id], [l2].[OneToOne_Required_PK_Date], [l2].[Level1_Required_Id], [l2].[Level2_Name], [l2].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l2] - 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].[Level2_Required_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 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 [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"); } @@ -6347,11 +6347,11 @@ FROM [Level1] AS [l0] 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] - 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] @@ -6359,11 +6359,11 @@ FROM [Level1] AS [l2] LEFT JOIN ( SELECT [l3].[Id], [l3].[OneToOne_Required_PK_Date], [l3].[Level1_Optional_Id], [l3].[Level1_Required_Id], [l3].[Level2_Name], [l3].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l3] - WHERE [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] = 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'"); } @@ -6374,7 +6374,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 ( @@ -6383,12 +6383,12 @@ FROM [Level1] AS [l0] LEFT JOIN ( SELECT [l2].[Id], [l2].[OneToOne_Required_PK_Date], [l2].[Level1_Required_Id], [l2].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l2] - 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 [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 [l1] ON [t].[Level1_Required_Id] = [l1].[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]"); } @@ -6401,7 +6401,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"); } @@ -6420,14 +6420,14 @@ FROM [Level1] AS [l] LEFT JOIN ( SELECT [l0].[Level1_Required_Id], [l0].[Level2_Name] FROM [Level1] AS [l0] - WHERE [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] 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] - 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 [t1] ON [t0].[Id] = [t1].[Level1_Optional_Id] ORDER BY [t0].[Level2_Name]"); } @@ -6438,7 +6438,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 ( @@ -6447,11 +6447,11 @@ FROM [Level1] AS [l0] 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] - 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]"); } @@ -6465,29 +6465,29 @@ 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] - WHERE [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 [l1].[Id], [l1].[Level2_Required_Id], [l1].[OneToMany_Required_Inverse3Id] FROM [Level1] AS [l1] - WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[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 [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] - 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].[Level2_Required_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 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 [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"); } @@ -6497,41 +6497,41 @@ 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] - WHERE [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 [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[OneToMany_Required_Inverse3Id] FROM [Level1] AS [l1] - WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[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 [l2].[Id], [l2].[OneToOne_Required_PK_Date], [l2].[Level1_Required_Id], [l2].[Level2_Name], [l2].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l2] - 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].[Level2_Optional_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 [l3].[Id], [l3].[OneToOne_Required_PK_Date], [l3].[Level1_Optional_Id], [l3].[Level1_Required_Id], [l3].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l3] - WHERE [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 [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 [l4] ON [t2].[Level1_Optional_Id] = [l4].[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 ([t1].[Level2_Name] <> N'L2 05' OR [t1].[Level2_Name] IS NULL OR [l4].[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 ([t1].[Level2_Name] <> N'L2 05' OR ([t1].[Level2_Name] IS NULL) OR [l4].[Name] = N'L1 05')"); } public override async Task String_include_multiple_derived_navigation_with_same_name_and_same_type(bool async) @@ -6556,49 +6556,49 @@ 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] FROM [Level1] AS [l4] - 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 [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 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] FROM [Level1] AS [l5] - 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 [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 [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 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] FROM [Level1] AS [l6] - 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 [t2].[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 [l3] ON [t3].[Level1_Required_Id] = [l3].[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 [t2].[Level2_Required_Id] IS NOT NULL AND [t2].[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 ([t2].[Level2_Required_Id] IS NOT NULL) AND ([t2].[OneToMany_Required_Inverse3Id] IS NOT NULL) 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] LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Required_Id], [l0].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l0] - WHERE [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 [l1].[Id], [l1].[Level2_Required_Id], [l1].[OneToMany_Required_Inverse3Id] FROM [Level1] AS [l1] - WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[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) @@ -6611,24 +6611,24 @@ 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] - WHERE [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 ( SELECT [l1].[Level2_Optional_Id], [l1].[Level3_Name] FROM [Level1] AS [l1] - WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[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]"); } @@ -6643,14 +6643,14 @@ 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] - WHERE [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 [l1].[Level3_Name], [l1].[OneToMany_Optional_Inverse3Id] FROM [Level1] AS [l1] - WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[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]"); } @@ -6668,14 +6668,14 @@ FROM [Level1] AS [l] LEFT JOIN ( SELECT [l0].[Level1_Required_Id], [l0].[Level2_Name] FROM [Level1] AS [l0] - WHERE [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] 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] - 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 [t1] ON [t0].[Id] = [t1].[Level1_Optional_Id] ORDER BY [t0].[Level2_Name]"); } @@ -6686,18 +6686,18 @@ 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] - WHERE [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 [l1] ON [t].[OneToMany_Required_Inverse2Id] = [l1].[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 ([l1].[Name] <> N'L1 07' OR [l1].[Name] IS NULL) AND [l1].[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 ([l1].[Name] <> N'L1 07' OR ([l1].[Name] IS NULL)) AND ([l1].[Id] IS NOT NULL)"); } public override async Task Explicit_GroupJoin_in_subquery_with_unrelated_projection(bool async) @@ -6715,13 +6715,13 @@ FROM [Level1] AS [l0] 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] - 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]"); } @@ -6731,20 +6731,20 @@ 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] - WHERE [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 [l1] 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 = [l1].[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 [l1].[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 [l1].[Id] > 5"); } public override async Task SelectMany_navigation_comparison1(bool async) @@ -6776,11 +6776,11 @@ FROM [Level1] AS [l1] 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] - 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"); } @@ -6799,14 +6799,14 @@ FROM [Level1] AS [l] LEFT JOIN ( SELECT [l0].[Level1_Required_Id], [l0].[Level2_Name] FROM [Level1] AS [l0] - WHERE [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] 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] - 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 [t1] ON [t0].[Id] = [t1].[Level1_Optional_Id] ORDER BY [t0].[Level2_Name]"); } @@ -6821,12 +6821,12 @@ 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_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id] FROM [Level1] AS [l0] - WHERE [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 [l1] ON [t].[Level1_Required_Id] = [l1].[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 [l1].[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 [l1].[Id] IN (1, 2)"); } public override async Task Entity_equality_empty(bool async) @@ -6839,10 +6839,10 @@ 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] - WHERE [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"); } @@ -6854,33 +6854,33 @@ public override async Task Member_pushdown_with_multiple_collections(bool async) @"SELECT ( SELECT TOP(1) [l0].[Level3_Name] FROM [Level1] AS [l0] - WHERE [l0].[Level2_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse3Id] IS NOT NULL AND ( + WHERE ([l0].[Level2_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse3Id] IS NOT NULL) AND (( SELECT TOP(1) CASE - WHEN [l1].[OneToOne_Required_PK_Date] IS NOT NULL AND [l1].[Level1_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [l1].[Id] + WHEN ([l1].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l1].[Level1_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [l1].[Id] END FROM [Level1] AS [l1] - 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 AND [l].[Id] = [l1].[OneToMany_Optional_Inverse2Id] + 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) AND [l].[Id] = [l1].[OneToMany_Optional_Inverse2Id] ORDER BY CASE - WHEN [l1].[OneToOne_Required_PK_Date] IS NOT NULL AND [l1].[Level1_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [l1].[Id] - END) IS NOT NULL AND (( + WHEN ([l1].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l1].[Level1_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [l1].[Id] + END) IS NOT NULL) AND (( SELECT TOP(1) 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 FROM [Level1] AS [l2] - 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 [l].[Id] = [l2].[OneToMany_Optional_Inverse2Id] + 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 [l].[Id] = [l2].[OneToMany_Optional_Inverse2Id] ORDER BY 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] - END) = [l0].[OneToMany_Optional_Inverse3Id] OR (( + 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) = [l0].[OneToMany_Optional_Inverse3Id] OR ((( SELECT TOP(1) 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 FROM [Level1] AS [l2] - 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 [l].[Id] = [l2].[OneToMany_Optional_Inverse2Id] + 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 [l].[Id] = [l2].[OneToMany_Optional_Inverse2Id] ORDER BY 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] - END) IS NULL AND [l0].[OneToMany_Optional_Inverse3Id] IS NULL)) + 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) 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]"); } @@ -6898,11 +6898,11 @@ FROM [Level1] AS [l0] 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] - 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] @@ -6910,11 +6910,11 @@ FROM [Level1] AS [l2] LEFT JOIN ( SELECT [l3].[Id], [l3].[OneToOne_Required_PK_Date], [l3].[Level1_Required_Id], [l3].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l3] - WHERE [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] = 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 [l4] ON [t1].[Level1_Required_Id] = [l4].[Id]"); } @@ -6947,20 +6947,20 @@ 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] - WHERE [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 [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[OneToMany_Required_Inverse3Id] FROM [Level1] AS [l1] - WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[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]"); } @@ -6974,14 +6974,14 @@ 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] - WHERE [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 [l1].[Level2_Optional_Id], [l1].[Level3_Name] FROM [Level1] AS [l1] - WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[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"); } @@ -7004,11 +7004,11 @@ FROM [Level1] AS [l1] 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] - 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(*) @@ -7019,11 +7019,11 @@ FROM [Level1] AS [l4] 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] - 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] = 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 [l3].[Id] = [t1].[Level1_Optional_Id]) > 7 ORDER BY [l0].[Id] ) AS [t3]) > 4 AND [l].[Id] < 2"); @@ -7039,10 +7039,10 @@ 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] - WHERE [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"); } @@ -7108,21 +7108,21 @@ public override async Task GroupJoin_with_subquery_on_inner(bool async) FROM [Level1] AS [l] OUTER APPLY ( SELECT TOP(10) [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], [l0].[Id] AS [Id0], CASE - WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + WHEN ([t].[OneToOne_Required_PK_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 [l0] 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] - 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 [l].[Id] = [t].[Level1_Optional_Id] 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 [l].[Id] = [t].[Level1_Optional_Id] 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 > 0 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]"); } @@ -7136,21 +7136,21 @@ public override async Task GroupJoin_with_subquery_on_inner_and_no_DefaultIfEmpt FROM [Level1] AS [l] CROSS APPLY ( SELECT TOP(10) [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], [l0].[Id] AS [Id0], CASE - WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + WHEN ([t].[OneToOne_Required_PK_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 [l0] 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] - 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 [l].[Id] = [t].[Level1_Optional_Id] 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 [l].[Id] = [t].[Level1_Optional_Id] 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 > 0 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]"); } @@ -7287,14 +7287,14 @@ FROM [Level1] AS [l] 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] - WHERE [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 [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Level3_Name], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[OneToOne_Optional_PK_Inverse3Id] FROM [Level1] AS [l1] - WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[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]"); } @@ -7308,21 +7308,21 @@ 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] FROM [Level1] AS [l0] - WHERE [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 [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Level3_Name], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[OneToOne_Optional_PK_Inverse3Id] FROM [Level1] AS [l1] - WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[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 [l2].[Id], [l2].[Level3_Optional_Id], [l2].[Level3_Required_Id], [l2].[Level4_Name], [l2].[OneToMany_Optional_Inverse4Id], [l2].[OneToMany_Required_Inverse4Id], [l2].[OneToOne_Optional_PK_Inverse4Id] FROM [Level1] AS [l2] - WHERE [l2].[Level3_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse4Id] IS NOT NULL + WHERE ([l2].[Level3_Required_Id] IS NOT NULL) AND ([l2].[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_Required_Id]"); } diff --git a/test/EFCore.SqlServer.FunctionalTests/Query/Ef6GroupBySqlServerTest.cs b/test/EFCore.SqlServer.FunctionalTests/Query/Ef6GroupBySqlServerTest.cs index dc911eeddb8..f8edac0c01d 100644 --- a/test/EFCore.SqlServer.FunctionalTests/Query/Ef6GroupBySqlServerTest.cs +++ b/test/EFCore.SqlServer.FunctionalTests/Query/Ef6GroupBySqlServerTest.cs @@ -557,7 +557,7 @@ FROM [Person] AS [p0] LEFT JOIN [Feet] AS [f0] ON [p0].[Id] = [f0].[Id] ) AS [t1] WHERE [t1].[row] <= 1 -) AS [t0] ON ([t].[Id] = [t0].[Id0] OR ([t].[Id] IS NULL AND [t0].[Id0] IS NULL)) AND ([t].[Size] = [t0].[Size] OR ([t].[Size] IS NULL AND [t0].[Size] IS NULL))"); +) AS [t0] ON ([t].[Id] = [t0].[Id0] OR (([t].[Id] IS NULL) AND ([t0].[Id0] IS NULL))) AND ([t].[Size] = [t0].[Size] OR (([t].[Size] IS NULL) AND ([t0].[Size] IS NULL)))"); } public override async Task Whats_new_2021_sample_16(bool async) @@ -636,7 +636,7 @@ LEFT JOIN ( SELECT [s0].[Id], [s0].[Style], [s0].[Age], [p0].[Id] AS [Id0] FROM [Person] AS [p0] INNER JOIN [Shoes] AS [s0] ON [p0].[Age] = [s0].[Age] -) AS [t0] ON [t].[Id] = [t0].[Id0] AND ([t].[Style] = [t0].[Style] OR ([t].[Style] IS NULL AND [t0].[Style] IS NULL)) AND [t].[Age] = [t0].[Age] +) AS [t0] ON [t].[Id] = [t0].[Id0] AND ([t].[Style] = [t0].[Style] OR (([t].[Style] IS NULL) AND ([t0].[Style] IS NULL))) AND [t].[Age] = [t0].[Age] ORDER BY [t].[Id], [t].[Style], [t].[Age], [t0].[Id0]"); } @@ -651,7 +651,7 @@ public override async Task Whats_new_2021_sample_13(bool async) FROM [Person] AS [p] GROUP BY [p].[FirstName], [p].[MiddleInitial] ) AS [t] -LEFT JOIN [Person] AS [p0] ON ([t].[FirstName] = [p0].[FirstName] OR ([t].[FirstName] IS NULL AND [p0].[FirstName] IS NULL)) AND ([t].[MiddleInitial] = [p0].[MiddleInitial] OR ([t].[MiddleInitial] IS NULL AND [p0].[MiddleInitial] IS NULL)) +LEFT JOIN [Person] AS [p0] ON ([t].[FirstName] = [p0].[FirstName] OR (([t].[FirstName] IS NULL) AND ([p0].[FirstName] IS NULL))) AND ([t].[MiddleInitial] = [p0].[MiddleInitial] OR (([t].[MiddleInitial] IS NULL) AND ([p0].[MiddleInitial] IS NULL))) ORDER BY [t].[FirstName], [t].[MiddleInitial], [p0].[Id]"); } @@ -728,11 +728,11 @@ FROM [Person] AS [p1] LEFT JOIN [Feet] AS [f0] ON [p1].[Id] = [f0].[Id] LEFT JOIN [Person] AS [p2] ON [f0].[Id] = [p2].[Id] LEFT JOIN [Feet] AS [f1] ON [p1].[Id] = [f1].[Id] - WHERE [f0].[Size] = @__size_0 AND [p1].[MiddleInitial] IS NOT NULL AND ([f0].[Id] <> 1 OR [f0].[Id] IS NULL) AND ([f].[Size] = [f0].[Size] OR ([f].[Size] IS NULL AND [f0].[Size] IS NULL)) AND ([p0].[LastName] = [p2].[LastName] OR ([p0].[LastName] IS NULL AND [p2].[LastName] IS NULL))) AS [Min] + WHERE [f0].[Size] = @__size_0 AND ([p1].[MiddleInitial] IS NOT NULL) AND ([f0].[Id] <> 1 OR ([f0].[Id] IS NULL)) AND ([f].[Size] = [f0].[Size] OR (([f].[Size] IS NULL) AND ([f0].[Size] IS NULL))) AND ([p0].[LastName] = [p2].[LastName] OR (([p0].[LastName] IS NULL) AND ([p2].[LastName] IS NULL)))) AS [Min] FROM [Person] AS [p] LEFT JOIN [Feet] AS [f] ON [p].[Id] = [f].[Id] LEFT JOIN [Person] AS [p0] ON [f].[Id] = [p0].[Id] -WHERE [f].[Size] = @__size_0 AND [p].[MiddleInitial] IS NOT NULL AND ([f].[Id] <> 1 OR [f].[Id] IS NULL) +WHERE [f].[Size] = @__size_0 AND ([p].[MiddleInitial] IS NOT NULL) AND ([f].[Id] <> 1 OR ([f].[Id] IS NULL)) GROUP BY [f].[Size], [p0].[LastName]"); } @@ -765,7 +765,7 @@ public override async Task Whats_new_2021_sample_9(bool async) SELECT COALESCE(SUM([f].[Size]), 0) FROM [Person] AS [p0] LEFT JOIN [Feet] AS [f] ON [p0].[Id] = [f].[Id] - WHERE [p].[FirstName] = [p0].[FirstName] OR ([p].[FirstName] IS NULL AND [p0].[FirstName] IS NULL)) AS [Total] + WHERE [p].[FirstName] = [p0].[FirstName] OR (([p].[FirstName] IS NULL) AND ([p0].[FirstName] IS NULL))) AS [Total] FROM [Person] AS [p] GROUP BY [p].[FirstName]"); } @@ -789,7 +789,7 @@ public override async Task Whats_new_2021_sample_4(bool async) SELECT TOP(1) [s0].[Style] FROM [Person] AS [p0] INNER JOIN [Shoes] AS [s0] ON [p0].[Age] = [s0].[Age] - WHERE [s].[Style] = [s0].[Style] OR ([s].[Style] IS NULL AND [s0].[Style] IS NULL)) AS [Style], COUNT(*) AS [Count] + WHERE [s].[Style] = [s0].[Style] OR (([s].[Style] IS NULL) AND ([s0].[Style] IS NULL))) AS [Style], COUNT(*) AS [Count] FROM [Person] AS [p] INNER JOIN [Shoes] AS [s] ON [p].[Age] = [s].[Age] GROUP BY [s].[Style]"); diff --git a/test/EFCore.SqlServer.FunctionalTests/Query/EntitySplittingQuerySqlServerTest.cs b/test/EFCore.SqlServer.FunctionalTests/Query/EntitySplittingQuerySqlServerTest.cs index f015477fdd7..d1677dabfcd 100644 --- a/test/EFCore.SqlServer.FunctionalTests/Query/EntitySplittingQuerySqlServerTest.cs +++ b/test/EFCore.SqlServer.FunctionalTests/Query/EntitySplittingQuerySqlServerTest.cs @@ -182,9 +182,9 @@ public override async Task Normal_entity_owning_a_split_reference_with_main_frag AssertSql( @"SELECT [e].[Id], CASE - WHEN [e].[OwnedReference_Id] IS NOT NULL AND [e].[OwnedReference_OwnedIntValue1] IS NOT NULL AND [e].[OwnedReference_OwnedIntValue2] IS NOT NULL THEN [o].[OwnedIntValue4] + WHEN ([e].[OwnedReference_Id] IS NOT NULL) AND ([e].[OwnedReference_OwnedIntValue1] IS NOT NULL) AND ([e].[OwnedReference_OwnedIntValue2] IS NOT NULL) THEN [o].[OwnedIntValue4] END AS [OwnedIntValue4], CASE - WHEN [e].[OwnedReference_Id] IS NOT NULL AND [e].[OwnedReference_OwnedIntValue1] IS NOT NULL AND [e].[OwnedReference_OwnedIntValue2] IS NOT NULL THEN [o].[OwnedStringValue4] + WHEN ([e].[OwnedReference_Id] IS NOT NULL) AND ([e].[OwnedReference_OwnedIntValue1] IS NOT NULL) AND ([e].[OwnedReference_OwnedIntValue2] IS NOT NULL) THEN [o].[OwnedStringValue4] END AS [OwnedStringValue4] FROM [EntityOnes] AS [e] LEFT JOIN [OwnedReferenceExtras2] AS [o] ON [e].[Id] = [o].[EntityOneId]"); diff --git a/test/EFCore.SqlServer.FunctionalTests/Query/FromSqlQuerySqlServerTest.cs b/test/EFCore.SqlServer.FunctionalTests/Query/FromSqlQuerySqlServerTest.cs index 943ebdb0120..828d640aa70 100644 --- a/test/EFCore.SqlServer.FunctionalTests/Query/FromSqlQuerySqlServerTest.cs +++ b/test/EFCore.SqlServer.FunctionalTests/Query/FromSqlQuerySqlServerTest.cs @@ -497,7 +497,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 7f300e8ae11..815fe8664cb 100644 --- a/test/EFCore.SqlServer.FunctionalTests/Query/FunkyDataQuerySqlServerTest.cs +++ b/test/EFCore.SqlServer.FunctionalTests/Query/FunkyDataQuerySqlServerTest.cs @@ -135,11 +135,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] @@ -150,11 +150,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] @@ -174,13 +174,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] @@ -190,25 +190,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] @@ -222,37 +222,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) @@ -263,7 +263,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) @@ -274,7 +274,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) @@ -284,11 +284,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] @@ -299,11 +299,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] @@ -323,13 +323,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] @@ -339,25 +339,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] @@ -372,7 +372,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) @@ -383,7 +383,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) @@ -395,7 +395,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)"); } @@ -409,7 +409,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)"); } @@ -423,7 +423,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]"); } @@ -437,7 +437,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 d4585b24e50..de55358cda3 100644 --- a/test/EFCore.SqlServer.FunctionalTests/Query/GearsOfWarQuerySqlServerTest.cs +++ b/test/EFCore.SqlServer.FunctionalTests/Query/GearsOfWarQuerySqlServerTest.cs @@ -60,7 +60,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) @@ -225,7 +225,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) @@ -240,7 +240,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) @@ -254,7 +254,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) @@ -339,7 +339,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]"); } @@ -572,10 +572,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] @@ -585,10 +585,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) @@ -604,10 +604,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) @@ -697,7 +697,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] @@ -763,11 +763,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) @@ -800,7 +800,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]"); @@ -828,7 +828,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) @@ -842,7 +842,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)"); @@ -876,10 +876,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) @@ -893,10 +893,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) @@ -910,10 +910,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) @@ -981,7 +981,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 @@ -998,7 +998,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] @@ -1012,7 +1012,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] @@ -1098,7 +1098,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]"); } @@ -1208,7 +1208,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) @@ -1219,7 +1219,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) @@ -1243,7 +1243,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) @@ -1254,7 +1254,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) @@ -1265,7 +1265,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) @@ -1278,7 +1278,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) @@ -1712,7 +1712,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) @@ -1968,7 +1968,7 @@ public override async Task Include_on_GroupJoin_SelectMany_DefaultIfEmpty_with_c // Issue#16897 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], [g0].[SquadId], [g0].[AssignedCityName], [g0].[CityOfBirthName], [g0].[Discriminator], [g0].[FullName], [g0].[HasSoulPatch], [g0].[LeaderNickname], [g0].[LeaderSquadId], [g0].[Rank], [g].[Nickname], [g].[SquadId], [w].[Id], [w].[AmmunitionType], [w].[IsAutomatic], [w].[Name], [w].[OwnerFullName], [w].[SynergyWithId], [g].[AssignedCityName], [g].[CityOfBirthName], [g].[Discriminator], [g].[FullName], [g].[HasSoulPatch], [g].[LeaderNickname], [g].[LeaderSquadId], [g].[Rank], [w0].[Id], [w0].[AmmunitionType], [w0].[IsAutomatic], [w0].[Name], [w0].[OwnerFullName], [w0].[SynergyWithId] FROM [Gears] AS [g] @@ -1984,7 +1984,7 @@ public override async Task Include_on_GroupJoin_SelectMany_DefaultIfEmpty_with_c AssertSql( @"SELECT [g].[Nickname], [g].[SquadId], [g].[AssignedCityName], [g].[CityOfBirthName], [g].[Discriminator], [g].[FullName], [g].[HasSoulPatch], [g].[LeaderNickname], [g].[LeaderSquadId], [g].[Rank], [g0].[Nickname], [g0].[SquadId], [w].[Id], [w].[AmmunitionType], [w].[IsAutomatic], [w].[Name], [w].[OwnerFullName], [w].[SynergyWithId], [g0].[AssignedCityName], [g0].[CityOfBirthName], [g0].[Discriminator], [g0].[FullName], [g0].[HasSoulPatch], [g0].[LeaderNickname], [g0].[LeaderSquadId], [g0].[Rank], [w0].[Id], [w0].[AmmunitionType], [w0].[IsAutomatic], [w0].[Name], [w0].[OwnerFullName], [w0].[SynergyWithId], [w1].[Id], [w1].[AmmunitionType], [w1].[IsAutomatic], [w1].[Name], [w1].[OwnerFullName], [w1].[SynergyWithId], [w2].[Id], [w2].[AmmunitionType], [w2].[IsAutomatic], [w2].[Name], [w2].[OwnerFullName], [w2].[SynergyWithId], 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, [w3].[Id], [w3].[AmmunitionType], [w3].[IsAutomatic], [w3].[Name], [w3].[OwnerFullName], [w3].[SynergyWithId], [w4].[Id], [w4].[AmmunitionType], [w4].[IsAutomatic], [w4].[Name], [w4].[OwnerFullName], [w4].[SynergyWithId] FROM [Gears] AS [g] @@ -2024,7 +2024,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]"); @@ -2038,7 +2038,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) @@ -2137,7 +2137,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) @@ -2148,7 +2148,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) @@ -2159,7 +2159,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) @@ -2170,7 +2170,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]"); } @@ -2182,7 +2182,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) @@ -2193,7 +2193,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]"); } @@ -2207,7 +2207,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"); } @@ -2220,7 +2220,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) @@ -2231,7 +2231,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])"); @@ -2262,7 +2262,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]"); @@ -2697,7 +2697,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) @@ -2708,7 +2708,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) @@ -2719,7 +2719,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) @@ -2757,7 +2757,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"); } @@ -2872,7 +2872,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]"); } @@ -3220,7 +3220,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) @@ -3234,7 +3234,7 @@ FROM [Tags] AS [t] 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) @@ -3291,7 +3291,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]"); } @@ -3308,7 +3308,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]"); } @@ -3345,7 +3345,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]"); } @@ -3449,7 +3449,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]"); } @@ -3496,7 +3496,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]"); } @@ -3522,7 +3522,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] @@ -3612,7 +3612,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]"); @@ -3628,7 +3628,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]"); @@ -3644,7 +3644,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]"); @@ -3660,7 +3660,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"); @@ -3692,7 +3692,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]"); @@ -3708,7 +3708,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]"); @@ -3724,7 +3724,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]"); @@ -3835,7 +3835,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] @@ -3972,7 +3972,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] @@ -4002,7 +4002,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] @@ -4063,7 +4063,7 @@ FROM [Gears] AS [g0] OUTER APPLY ( SELECT [w].[Name], [g0].[Nickname], [w].[Id] FROM [Weapons] AS [w] - WHERE [g0].[FullName] = [w].[OwnerFullName] AND ([w].[Name] <> N'Bar' OR [w].[Name] IS NULL) + WHERE [g0].[FullName] = [w].[OwnerFullName] AND ([w].[Name] <> N'Bar' OR ([w].[Name] IS NULL)) ) AS [t] WHERE [g0].[FullName] <> N'Foo' ) AS [t0] ON [g].[Nickname] = [t0].[LeaderNickname] AND [g].[SquadId] = [t0].[LeaderSquadId] @@ -4084,7 +4084,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 [g].[Nickname] = [g0].[LeaderNickname] AND [g].[SquadId] = [g0].[LeaderSquadId] AND [g0].[FullName] <> N'Foo' ) AS [t0] @@ -4103,7 +4103,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] @@ -4221,7 +4221,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]"); } @@ -4442,7 +4442,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] @@ -5280,7 +5280,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]"); } @@ -5304,7 +5304,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"); } @@ -5318,7 +5318,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"); } @@ -5652,7 +5652,7 @@ public override async Task @"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 SUBSTRING([t].[Note], 0 + 1, [g].[SquadId]) = [t].[GearNickName] OR (([t].[Note] IS NULL OR [g].[SquadId] IS NULL) AND [t].[GearNickName] IS NULL)"); +WHERE SUBSTRING([t].[Note], 0 + 1, [g].[SquadId]) = [t].[GearNickName] OR ((([t].[Note] IS NULL) OR ([g].[SquadId] IS NULL)) AND ([t].[GearNickName] IS NULL))"); } public override async Task @@ -5666,7 +5666,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) @@ -5706,7 +5706,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) @@ -5718,7 +5718,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) @@ -5731,7 +5731,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 async Task Nav_rewrite_Distinct_with_convert() @@ -5761,7 +5761,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) @@ -5777,7 +5777,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) @@ -5793,7 +5793,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) @@ -5906,7 +5906,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] @@ -5928,7 +5928,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]"); } @@ -5941,7 +5941,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]"); } @@ -5953,7 +5953,7 @@ public override async Task Null_checks_in_correlated_predicate_are_correctly_tra AssertSql( @"SELECT [t].[Id], [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] AND [t].[Note] IS NOT NULL +LEFT JOIN [Gears] AS [g] ON [t].[GearNickName] = [g].[Nickname] AND [t].[GearSquadId] = [g].[SquadId] AND ([t].[Note] IS NOT NULL) ORDER BY [t].[Id], [g].[Nickname]"); } @@ -6122,7 +6122,7 @@ public override async Task Navigation_based_on_complex_expression6(bool async) AssertSql( @"SELECT CASE - WHEN [t0].[Name] = N'Queen Myrrah' AND [t0].[Name] IS NOT NULL THEN CAST(1 AS bit) + WHEN [t0].[Name] = N'Queen Myrrah' AND ([t0].[Name] IS NOT NULL) THEN CAST(1 AS bit) ELSE CAST(0 AS bit) END, [t0].[Name], [t0].[Discriminator], [t0].[LocustHordeId], [t0].[ThreatLevel], [t0].[ThreatLevelByte], [t0].[ThreatLevelNullableByte], [t0].[DefeatedByNickname], [t0].[DefeatedBySquadId], [t0].[HighCommandId], [t].[Name], [t].[Discriminator], [t].[LocustHordeId], [t].[ThreatLevel], [t].[ThreatLevelByte], [t].[ThreatLevelNullableByte], [t].[DefeatedByNickname], [t].[DefeatedBySquadId], [t].[HighCommandId] FROM [Factions] AS [f] @@ -6220,7 +6220,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] @@ -6535,11 +6535,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) @@ -6594,7 +6594,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) @@ -6747,10 +6747,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) @@ -6967,7 +6967,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) @@ -7056,7 +7056,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]"); } @@ -7073,7 +7073,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]"); } @@ -7133,7 +7133,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] @@ -7189,7 +7189,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]"); } @@ -7200,7 +7200,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]"); } @@ -7216,7 +7216,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]"); } @@ -7227,7 +7227,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) @@ -7273,7 +7273,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]"); @@ -7315,11 +7315,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) @@ -7456,7 +7456,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) @@ -7467,7 +7467,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] @@ -7590,7 +7590,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 @@ -7704,10 +7704,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) @@ -7722,7 +7722,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]"); } @@ -8128,7 +8128,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 5e45f559791..6c42cd720f7 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/JsonQuerySqlServerTest.cs b/test/EFCore.SqlServer.FunctionalTests/Query/JsonQuerySqlServerTest.cs index 7d5e2f3d440..7be1e9b470f 100644 --- a/test/EFCore.SqlServer.FunctionalTests/Query/JsonQuerySqlServerTest.cs +++ b/test/EFCore.SqlServer.FunctionalTests/Query/JsonQuerySqlServerTest.cs @@ -524,7 +524,7 @@ public override async Task Json_scalar_required_null_semantics(bool async) AssertSql( @"SELECT [j].[Name] FROM [JsonEntitiesBasic] AS [j] -WHERE CAST(JSON_VALUE([j].[OwnedReferenceRoot],'$.Number') AS int) <> CAST(LEN(CAST(JSON_VALUE([j].[OwnedReferenceRoot],'$.Name') AS nvarchar(max))) AS int) OR CAST(JSON_VALUE([j].[OwnedReferenceRoot],'$.Name') AS nvarchar(max)) IS NULL"); +WHERE CAST(JSON_VALUE([j].[OwnedReferenceRoot],'$.Number') AS int) <> CAST(LEN(CAST(JSON_VALUE([j].[OwnedReferenceRoot],'$.Name') AS nvarchar(max))) AS int) OR (CAST(JSON_VALUE([j].[OwnedReferenceRoot],'$.Name') AS nvarchar(max)) IS NULL)"); } public override async Task Json_scalar_optional_null_semantics(bool async) @@ -534,7 +534,7 @@ public override async Task Json_scalar_optional_null_semantics(bool async) AssertSql( @"SELECT [j].[Name] FROM [JsonEntitiesBasic] AS [j] -WHERE CAST(JSON_VALUE([j].[OwnedReferenceRoot],'$.Name') AS nvarchar(max)) = CAST(JSON_VALUE([j].[OwnedReferenceRoot],'$.OwnedReferenceBranch.OwnedReferenceLeaf.SomethingSomething') AS nvarchar(max)) OR (CAST(JSON_VALUE([j].[OwnedReferenceRoot],'$.Name') AS nvarchar(max)) IS NULL AND CAST(JSON_VALUE([j].[OwnedReferenceRoot],'$.OwnedReferenceBranch.OwnedReferenceLeaf.SomethingSomething') AS nvarchar(max)) IS NULL)"); +WHERE CAST(JSON_VALUE([j].[OwnedReferenceRoot],'$.Name') AS nvarchar(max)) = CAST(JSON_VALUE([j].[OwnedReferenceRoot],'$.OwnedReferenceBranch.OwnedReferenceLeaf.SomethingSomething') AS nvarchar(max)) OR ((CAST(JSON_VALUE([j].[OwnedReferenceRoot],'$.Name') AS nvarchar(max)) IS NULL) AND (CAST(JSON_VALUE([j].[OwnedReferenceRoot],'$.OwnedReferenceBranch.OwnedReferenceLeaf.SomethingSomething') AS nvarchar(max)) IS NULL))"); } public override async Task Group_by_on_json_scalar(bool async) diff --git a/test/EFCore.SqlServer.FunctionalTests/Query/ManyToManyNoTrackingQuerySqlServerTest.cs b/test/EFCore.SqlServer.FunctionalTests/Query/ManyToManyNoTrackingQuerySqlServerTest.cs index b7cc22b9a86..ce8df62a3f8 100644 --- a/test/EFCore.SqlServer.FunctionalTests/Query/ManyToManyNoTrackingQuerySqlServerTest.cs +++ b/test/EFCore.SqlServer.FunctionalTests/Query/ManyToManyNoTrackingQuerySqlServerTest.cs @@ -101,7 +101,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) @@ -129,7 +129,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 5f25d5b155c..6f0899e79cd 100644 --- a/test/EFCore.SqlServer.FunctionalTests/Query/ManyToManyQuerySqlServerTest.cs +++ b/test/EFCore.SqlServer.FunctionalTests/Query/ManyToManyQuerySqlServerTest.cs @@ -100,7 +100,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) @@ -128,7 +128,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 b4b793b3983..1dbf37e99d3 100644 --- a/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindAggregateOperatorsQuerySqlServerTest.cs +++ b/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindAggregateOperatorsQuerySqlServerTest.cs @@ -536,7 +536,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"); } @@ -1083,7 +1083,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) @@ -1210,11 +1210,11 @@ FROM [Customers] AS [c] OUTER APPLY ( SELECT TOP(1) [o].[OrderID], [o].[ProductID], [o].[Discount], [o].[Quantity], [o].[UnitPrice] FROM [Order Details] AS [o] - WHERE ( + WHERE (( SELECT TOP(1) [o0].[OrderID] FROM [Orders] AS [o0] WHERE [c].[CustomerID] = [o0].[CustomerID] - ORDER BY [o0].[OrderID]) IS NOT NULL AND ( + ORDER BY [o0].[OrderID]) IS NOT NULL) AND ( SELECT TOP(1) [o1].[OrderID] FROM [Orders] AS [o1] WHERE [c].[CustomerID] = [o1].[CustomerID] @@ -1233,11 +1233,11 @@ public override async Task Multiple_collection_navigation_with_FirstOrDefault_ch @"SELECT ( SELECT TOP(1) [o].[ProductID] FROM [Order Details] AS [o] - WHERE ( + WHERE (( SELECT TOP(1) [o0].[OrderID] FROM [Orders] AS [o0] WHERE [c].[CustomerID] = [o0].[CustomerID] - ORDER BY [o0].[OrderID]) IS NOT NULL AND ( + ORDER BY [o0].[OrderID]) IS NOT NULL) AND ( SELECT TOP(1) [o1].[OrderID] FROM [Orders] AS [o1] WHERE [c].[CustomerID] = [o1].[CustomerID] @@ -1614,7 +1614,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) @@ -1624,7 +1624,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) @@ -1634,7 +1634,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) @@ -1823,7 +1823,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) @@ -1836,7 +1836,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) @@ -1850,13 +1850,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"); } @@ -1870,7 +1870,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/NorthwindAsNoTrackingQuerySqlServerTest.cs b/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindAsNoTrackingQuerySqlServerTest.cs index c4f3b1ef117..93443154643 100644 --- a/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindAsNoTrackingQuerySqlServerTest.cs +++ b/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindAsNoTrackingQuerySqlServerTest.cs @@ -88,7 +88,7 @@ public override async Task Applied_after_navigation_expansion(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'London' OR [c].[City] IS NULL"); +WHERE [c].[City] <> N'London' OR ([c].[City] IS NULL)"); } public override async Task Include_reference_and_collection(bool async) diff --git a/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindEFPropertyIncludeQuerySqlServerTest.cs b/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindEFPropertyIncludeQuerySqlServerTest.cs index b9901202fba..b0dc6d4c18d 100644 --- a/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindEFPropertyIncludeQuerySqlServerTest.cs +++ b/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindEFPropertyIncludeQuerySqlServerTest.cs @@ -123,7 +123,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]"); } @@ -212,7 +212,7 @@ public override async Task Include_references_then_include_collection(bool async FROM [Orders] AS [o] LEFT JOIN [Customers] AS [c] ON [o].[CustomerID] = [c].[CustomerID] LEFT JOIN [Orders] AS [o0] ON [c].[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%') ORDER BY [o].[OrderID], [c].[CustomerID]"); } @@ -906,7 +906,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] @@ -1000,7 +1000,7 @@ public override async Task Include_reference_when_entity_in_projection(bool asyn @"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_reference_single_or_default_when_no_result(bool async) @@ -1339,7 +1339,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_multiple_references_and_collection_multi_level_reverse(bool async) @@ -1545,7 +1545,7 @@ public override async Task Include_collection_and_reference(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]"); } @@ -1659,7 +1659,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]"); } @@ -1722,7 +1722,7 @@ public override async Task Include_reference_and_collection_order_by(bool async) FROM [Orders] AS [o] LEFT JOIN [Customers] AS [c] ON [o].[CustomerID] = [c].[CustomerID] LEFT JOIN [Orders] AS [o0] ON [c].[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%') ORDER BY [o].[OrderID], [c].[CustomerID]"); } diff --git a/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindFunctionsQuerySqlServerTest.cs b/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindFunctionsQuerySqlServerTest.cs index 020dc4e2844..001968afb7e 100644 --- a/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindFunctionsQuerySqlServerTest.cs +++ b/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindFunctionsQuerySqlServerTest.cs @@ -41,7 +41,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) @@ -75,7 +75,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) @@ -85,7 +85,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) @@ -95,7 +95,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) @@ -105,7 +105,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) @@ -115,7 +115,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) @@ -125,7 +125,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) @@ -135,7 +135,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) @@ -145,7 +145,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) @@ -468,7 +468,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) @@ -644,7 +644,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) @@ -662,7 +662,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) @@ -1842,7 +1842,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) @@ -1851,7 +1851,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]"); @@ -1864,7 +1864,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) @@ -1873,7 +1873,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]"); @@ -1886,7 +1886,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 21e2eee1183..5a962c04f9f 100644 --- a/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindGroupByQuerySqlServerTest.cs +++ b/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindGroupByQuerySqlServerTest.cs @@ -1303,7 +1303,7 @@ public override async Task GroupBy_complex_key_aggregate_2(bool async) @"SELECT [t].[Key] AS [Month], COALESCE(SUM([t].[OrderID]), 0) AS [Total], ( SELECT COALESCE(SUM([o0].[OrderID]), 0) FROM [Orders] AS [o0] - WHERE DATEPART(month, [o0].[OrderDate]) = [t].[Key] OR ([o0].[OrderDate] IS NULL AND [t].[Key] IS NULL)) AS [Payment] + WHERE DATEPART(month, [o0].[OrderDate]) = [t].[Key] OR (([o0].[OrderDate] IS NULL) AND ([t].[Key] IS NULL))) AS [Payment] FROM ( SELECT [o].[OrderID], DATEPART(month, [o].[OrderDate]) AS [Key] FROM [Orders] AS [o] @@ -1365,7 +1365,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) @@ -1758,7 +1758,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]"); } @@ -1772,7 +1772,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"); } @@ -1855,7 +1855,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]"); @@ -1867,7 +1867,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]"); @@ -1879,7 +1879,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]"); @@ -1891,7 +1891,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]"); @@ -1972,7 +1972,7 @@ public override async Task GroupBy_with_aggregate_through_navigation_property(bo SELECT MAX([c].[Region]) FROM [Orders] AS [o0] LEFT JOIN [Customers] AS [c] ON [o0].[CustomerID] = [c].[CustomerID] - WHERE [o].[EmployeeID] = [o0].[EmployeeID] OR ([o].[EmployeeID] IS NULL AND [o0].[EmployeeID] IS NULL)) AS [max] + WHERE [o].[EmployeeID] = [o0].[EmployeeID] OR (([o].[EmployeeID] IS NULL) AND ([o0].[EmployeeID] IS NULL))) AS [max] FROM [Orders] AS [o] GROUP BY [o].[EmployeeID]"); } @@ -1985,7 +1985,7 @@ public override async Task GroupBy_with_aggregate_containing_complex_where(bool @"SELECT [o].[EmployeeID] AS [Key], ( SELECT MAX([o0].[OrderID]) FROM [Orders] AS [o0] - WHERE CAST([o0].[EmployeeID] AS bigint) = CAST((MAX([o].[OrderID]) * 6) AS bigint) OR ([o0].[EmployeeID] IS NULL AND MAX([o].[OrderID]) IS NULL)) AS [Max] + WHERE CAST([o0].[EmployeeID] AS bigint) = CAST((MAX([o].[OrderID]) * 6) AS bigint) OR (([o0].[EmployeeID] IS NULL) AND (MAX([o].[OrderID]) IS NULL))) AS [Max] FROM [Orders] AS [o] GROUP BY [o].[EmployeeID]"); } @@ -1998,7 +1998,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]"); @@ -2622,7 +2622,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) @@ -2859,7 +2859,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]"); } @@ -3023,7 +3023,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] @@ -3064,7 +3064,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]"); @@ -3113,7 +3113,7 @@ FROM [Orders] AS [o0] WHERE [c].[CustomerID] = [o0].[CustomerID] ) AS [t0] LEFT JOIN [Customers] AS [c0] ON [t0].[CustomerID] = [c0].[CustomerID] - WHERE ([t].[Key] = [t0].[Key] OR ([t].[Key] IS NULL AND [t0].[Key] IS NULL)) AND (COALESCE([c0].[City], N'') + COALESCE([t0].[CustomerID], N'') LIKE N'Lon%')) AS [Count], [t].[Key] + WHERE ([t].[Key] = [t0].[Key] OR (([t].[Key] IS NULL) AND ([t0].[Key] IS NULL))) AND (COALESCE([c0].[City], N'') + COALESCE([t0].[CustomerID], N'') LIKE N'Lon%')) AS [Count], [t].[Key] FROM ( SELECT [o].[OrderID], COALESCE([c2].[City], N'') + COALESCE([o].[CustomerID], N'') AS [Key] FROM [Orders] AS [o] diff --git a/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindIncludeNoTrackingQuerySqlServerTest.cs b/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindIncludeNoTrackingQuerySqlServerTest.cs index 9455c759497..4b4ef9d6d2d 100644 --- a/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindIncludeNoTrackingQuerySqlServerTest.cs +++ b/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindIncludeNoTrackingQuerySqlServerTest.cs @@ -129,7 +129,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]"); } @@ -183,7 +183,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]"); } @@ -274,7 +274,7 @@ public override async Task Include_reference_when_entity_in_projection(bool asyn @"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_reference_Join_GroupBy_Select(bool async) @@ -1107,7 +1107,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] @@ -1337,7 +1337,7 @@ public override async Task Include_collection_and_reference(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]"); } @@ -1396,7 +1396,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_reference_distinct_is_server_evaluated(bool async) diff --git a/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindIncludeQuerySqlServerTest.cs b/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindIncludeQuerySqlServerTest.cs index 056e92e03b2..f91f2036b4e 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] @@ -1778,7 +1778,7 @@ public override async Task Include_reference_and_collection_order_by(bool async) FROM [Orders] AS [o] LEFT JOIN [Customers] AS [c] ON [o].[CustomerID] = [c].[CustomerID] LEFT JOIN [Orders] AS [o0] ON [c].[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%') ORDER BY [o].[OrderID], [c].[CustomerID]"); } @@ -1825,7 +1825,7 @@ public override async Task Include_references_then_include_collection(bool async FROM [Orders] AS [o] LEFT JOIN [Customers] AS [c] ON [o].[CustomerID] = [c].[CustomerID] LEFT JOIN [Orders] AS [o0] ON [c].[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%') ORDER BY [o].[OrderID], [c].[CustomerID]"); } @@ -1838,7 +1838,7 @@ public override async Task Include_collection_and_reference(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]"); } @@ -1922,7 +1922,7 @@ public override async Task Include_reference_when_entity_in_projection(bool asyn @"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_multiple_references_then_include_multi_level_reverse(bool async) diff --git a/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindJoinQuerySqlServerTest.cs b/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindJoinQuerySqlServerTest.cs index 43a54f97a26..18bf48e2439 100644 --- a/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindJoinQuerySqlServerTest.cs +++ b/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindJoinQuerySqlServerTest.cs @@ -205,7 +205,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) @@ -353,7 +353,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]"); } @@ -405,7 +405,7 @@ public override async Task GroupJoin_DefaultIfEmpty_Where(bool async) @"SELECT [o].[OrderID], [o].[CustomerID], [o].[EmployeeID], [o].[OrderDate] FROM [Customers] AS [c] LEFT JOIN [Orders] AS [o] ON [c].[CustomerID] = [o].[CustomerID] -WHERE [o].[OrderID] IS NOT NULL AND [o].[CustomerID] = N'ALFKI'"); +WHERE ([o].[OrderID] IS NOT NULL) AND [o].[CustomerID] = N'ALFKI'"); } public override async Task Join_GroupJoin_DefaultIfEmpty_Where(bool async) @@ -417,7 +417,7 @@ public override async Task Join_GroupJoin_DefaultIfEmpty_Where(bool async) FROM [Customers] AS [c] INNER JOIN [Orders] AS [o] ON [c].[CustomerID] = [o].[CustomerID] LEFT JOIN [Orders] AS [o0] ON [c].[CustomerID] = [o0].[CustomerID] -WHERE [o0].[OrderID] IS NOT NULL AND [o0].[CustomerID] = N'ALFKI'"); +WHERE ([o0].[OrderID] IS NOT NULL) AND [o0].[CustomerID] = N'ALFKI'"); } public override async Task GroupJoin_DefaultIfEmpty_Project(bool async) @@ -504,7 +504,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]"); } @@ -755,7 +755,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 c37eedc0c95..d04a3d2555d 100644 --- a/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindKeylessEntitiesQuerySqlServerTest.cs +++ b/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindKeylessEntitiesQuerySqlServerTest.cs @@ -114,7 +114,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])"); } public override async Task Auto_initialized_view_set(bool async) @@ -161,7 +161,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 ddbe5b40479..6b12ef2f6fb 100644 --- a/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindMiscellaneousQuerySqlServerTest.cs +++ b/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindMiscellaneousQuerySqlServerTest.cs @@ -428,10 +428,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) @@ -590,7 +590,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) @@ -603,7 +603,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) @@ -616,7 +616,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) @@ -629,7 +629,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) @@ -647,10 +647,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) @@ -668,10 +668,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) @@ -689,10 +689,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 Select_Subquery_Single(bool async) @@ -784,16 +784,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]"); } @@ -1323,7 +1323,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"); } @@ -1338,7 +1338,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) @@ -1348,10 +1348,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) @@ -1364,7 +1364,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) @@ -1377,7 +1377,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) @@ -1387,10 +1387,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) @@ -1403,7 +1403,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 async Task Any_with_multiple_conditions_still_uses_exists(bool async) @@ -1428,7 +1428,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"); } @@ -1442,7 +1442,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"); } @@ -1793,7 +1793,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"); } @@ -2205,7 +2205,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 @@ -2214,7 +2214,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) @@ -2506,7 +2506,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"); } @@ -2971,7 +2971,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] @@ -2988,7 +2988,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] @@ -3005,7 +3005,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]"); @@ -3062,7 +3062,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) @@ -3211,7 +3211,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) @@ -3281,7 +3281,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]"); } @@ -3308,7 +3308,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]"); } @@ -4251,7 +4251,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]"); } @@ -4265,7 +4265,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]"); } @@ -4310,7 +4310,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]"); } @@ -4527,11 +4527,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) @@ -5063,22 +5063,22 @@ public override async Task Pending_selector_in_cardinality_reducing_method_is_ap WHEN EXISTS ( SELECT 1 FROM [Orders] AS [o] - WHERE ( + WHERE (( SELECT TOP(1) [c0].[CustomerID] FROM [Orders] AS [o0] LEFT JOIN [Customers] AS [c0] ON [o0].[CustomerID] = [c0].[CustomerID] WHERE [c].[CustomerID] = [o0].[CustomerID] - ORDER BY [o0].[OrderDate]) IS NOT NULL AND (( + ORDER BY [o0].[OrderDate]) IS NOT NULL) AND (( 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] @@ -5214,12 +5214,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]"); } @@ -5884,7 +5884,7 @@ FROM [Orders] AS [o] WHERE EXISTS ( SELECT 1 FROM [Orders] AS [o0] - WHERE [o0].[OrderID] = @__firstOrder_OrderID_0 AND ([o0].[CustomerID] = [o].[CustomerID] OR ([o0].[CustomerID] IS NULL AND [o].[CustomerID] IS NULL)))"); + WHERE [o0].[OrderID] = @__firstOrder_OrderID_0 AND ([o0].[CustomerID] = [o].[CustomerID] OR (([o0].[CustomerID] IS NULL) AND ([o].[CustomerID] IS NULL))))"); } public override async Task Cast_results_to_object(bool async) @@ -5972,7 +5972,7 @@ public override async Task SelectMany_correlated_simple(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] = [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 [c].[CustomerID], [e].[EmployeeID]"); } diff --git a/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindNavigationsQuerySqlServerTest.cs b/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindNavigationsQuerySqlServerTest.cs index da4337233aa..08359ac0769 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) @@ -828,7 +828,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) @@ -925,7 +925,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) @@ -956,7 +956,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) + WHERE [c].[Country] = [c0].[Country] OR (([c].[Country] IS NULL) AND ([c0].[Country] IS NULL)) ) AS [t]) > 0"); } @@ -974,7 +974,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 Where_subquery_on_navigation_client_eval(bool async) diff --git a/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindQueryFiltersQuerySqlServerTest.cs b/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindQueryFiltersQuerySqlServerTest.cs index d30787f9b37..4262f618a75 100644 --- a/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindQueryFiltersQuerySqlServerTest.cs +++ b/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindQueryFiltersQuerySqlServerTest.cs @@ -31,7 +31,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_1)) = @__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_1)) = @__ef_filter__TenantPrefix_0)"); } public override async Task Materialized_query(bool async) @@ -44,7 +44,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_1)) = @__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_1)) = @__ef_filter__TenantPrefix_0)"); } public override async Task Find(bool async) @@ -58,7 +58,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_1)) = @__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_1)) = @__ef_filter__TenantPrefix_0)) AND [c].[CustomerID] = @__p_0"); } public override async Task Materialized_query_parameter(bool async) @@ -71,7 +71,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_1)) = @__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_1)) = @__ef_filter__TenantPrefix_0)"); } public override async Task Materialized_query_parameter_new_context(bool async) @@ -84,14 +84,14 @@ 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_1)) = @__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_1)) = @__ef_filter__TenantPrefix_0)", // @"@__ef_filter__TenantPrefix_0='T' (Size = 4000) @__ef_filter__TenantPrefix_0_1='T' (Size = 40) 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_1)) = @__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_1)) = @__ef_filter__TenantPrefix_0)"); } public override async Task Projection_query_parameter(bool async) @@ -104,7 +104,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_1)) = @__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_1)) = @__ef_filter__TenantPrefix_0)"); } public override async Task Projection_query(bool async) @@ -117,7 +117,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_1)) = @__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_1)) = @__ef_filter__TenantPrefix_0)"); } public override async Task Include_query(bool async) @@ -136,11 +136,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_1)) = @__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_1)) = @__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) ) AS [t0] ON [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) +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]"); } @@ -168,9 +168,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_1)) = @__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_1)) = @__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) @@ -190,9 +190,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_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_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"); } @@ -214,9 +214,9 @@ 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_1)) = @__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_1)) = @__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) ) AS [t0] ON [c].[CustomerID] = [t0].[CustomerID] INNER JOIN ( SELECT [o0].[OrderID], [o0].[Discount] @@ -227,13 +227,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] @@ -254,7 +254,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_1)) = @__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_1)) = @__ef_filter__TenantPrefix_0)"); } [ConditionalFact] @@ -278,9 +278,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_1)) = @__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_1)) = @__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() @@ -294,7 +294,7 @@ 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_1)) = @__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_1)) = @__ef_filter__TenantPrefix_0)) AND [c].[CustomerID] = @__customerID", // @"@__ef_filter__TenantPrefix_0='B' (Size = 4000) @__ef_filter__TenantPrefix_0_1='B' (Size = 40) @@ -302,7 +302,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 (@__ef_filter__TenantPrefix_0 = N'' OR ([c].[CompanyName] IS NOT NULL AND LEFT([c].[CompanyName], LEN(@__ef_filter__TenantPrefix_0_1)) = @__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_1)) = @__ef_filter__TenantPrefix_0)) AND [c].[CustomerID] = @__customerID"); } public override async Task Entity_Equality(bool async) @@ -318,9 +318,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_1)) = @__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_1)) = @__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 Client_eval(bool async) @@ -343,9 +343,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_1)) = @__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_1)) = @__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 Included_one_to_many_query_with_client_eval(bool async) diff --git a/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindSelectQuerySqlServerTest.cs b/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindSelectQuerySqlServerTest.cs index a86d80fbc51..10144c21c0a 100644 --- a/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindSelectQuerySqlServerTest.cs +++ b/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindSelectQuerySqlServerTest.cs @@ -367,10 +367,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) + WHERE [c].[CustomerID] = [o1].[CustomerID]) IS NULL)) ORDER BY [o0].[OrderID], [o0].[ProductID]), 0) FROM [Orders] AS [o] WHERE [c].[CustomerID] = [o].[CustomerID] AND [o].[OrderID] < 10500 @@ -970,7 +970,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]"); @@ -1076,7 +1076,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]"); } @@ -1090,7 +1090,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]"); } @@ -1616,7 +1616,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] @@ -1814,7 +1814,7 @@ FROM [Orders] AS [o] OUTER APPLY ( SELECT [t].[CustomerID], [o0].[OrderID], [o0].[OrderDate] FROM [Orders] AS [o0] - WHERE [t].[CustomerID] IS NOT NULL AND [t].[CustomerID] = [o0].[CustomerID] AND [o0].[OrderID] IN (10248, 10249, 10250) + WHERE ([t].[CustomerID] IS NOT NULL) AND [t].[CustomerID] = [o0].[CustomerID] AND [o0].[OrderID] IN (10248, 10249, 10250) ) AS [t0] ORDER BY [t].[CustomerID], [t0].[OrderID]"); } @@ -1850,7 +1850,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].[CustomerID] = [t].[CustomerID] OR ([o0].[CustomerID] IS NULL AND [t].[CustomerID] IS NULL)) AND [o0].[OrderID] IN (10248, 10249, 10250) + WHERE ([o0].[CustomerID] = [t].[CustomerID] OR (([o0].[CustomerID] IS NULL) AND ([t].[CustomerID] IS NULL))) AND [o0].[OrderID] IN (10248, 10249, 10250) ) AS [t0] ORDER BY [t].[OrderDate], [t].[CustomerID]"); } @@ -1926,12 +1926,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]"); @@ -1998,7 +1998,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] @@ -2028,7 +2028,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 ( @@ -2092,7 +2092,7 @@ public override async Task VisitLambda_should_not_be_visited_trivially(bool asyn 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'A%')"); +WHERE ([o].[CustomerID] IS NOT NULL) AND ([o].[CustomerID] LIKE N'A%')"); } public override async Task Select_anonymous_literal(bool async) @@ -2265,7 +2265,7 @@ FROM [Orders] AS [o] OUTER APPLY ( SELECT [t0].[CustomerID] AS [Outer], [o0].[OrderID] AS [Inner], [o0].[OrderDate] FROM [Orders] AS [o0] - WHERE ([o0].[CustomerID] = [t0].[CustomerID] OR ([o0].[CustomerID] IS NULL AND [t0].[CustomerID] IS NULL)) AND [o0].[OrderID] IN (10248, 10249, 10250) + WHERE ([o0].[CustomerID] = [t0].[CustomerID] OR (([o0].[CustomerID] IS NULL) AND ([t0].[CustomerID] IS NULL))) AND [o0].[OrderID] IN (10248, 10249, 10250) ) AS [t1] ORDER BY [t0].[CustomerID], [t0].[Complex]"); } diff --git a/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindSetOperationsQuerySqlServerTest.cs b/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindSetOperationsQuerySqlServerTest.cs index 93cc79e9f7e..10fe97f8ffd 100644 --- a/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindSetOperationsQuerySqlServerTest.cs +++ b/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindSetOperationsQuerySqlServerTest.cs @@ -273,11 +273,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]"); } @@ -294,7 +294,7 @@ FROM [Customers] AS [c] SELECT [p].[ProductName] AS [CompanyName] FROM [Products] AS [p] ) AS [t] -WHERE [t].[CompanyName] IS NOT NULL AND ([t].[CompanyName] LIKE N'C%') +WHERE ([t].[CompanyName] IS NOT NULL) AND ([t].[CompanyName] LIKE N'C%') ORDER BY [t].[CompanyName]"); } diff --git a/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindSplitIncludeNoTrackingQuerySqlServerTest.cs b/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindSplitIncludeNoTrackingQuerySqlServerTest.cs index 2c4f7740e88..6c263502ba9 100644 --- a/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindSplitIncludeNoTrackingQuerySqlServerTest.cs +++ b/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindSplitIncludeNoTrackingQuerySqlServerTest.cs @@ -412,14 +412,14 @@ public override async Task Include_collection_and_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%') 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]"); } @@ -1030,13 +1030,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]"); } @@ -1637,7 +1637,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_reference_with_filter_reordered(bool async) @@ -1710,7 +1710,7 @@ public override async Task Include_reference_when_entity_in_projection(bool asyn @"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_collection_force_alias_uniquefication(bool async) @@ -2103,7 +2103,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%' @@ -2114,7 +2114,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] @@ -2331,14 +2331,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]"); } diff --git a/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindSplitIncludeQuerySqlServerTest.cs b/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindSplitIncludeQuerySqlServerTest.cs index dc31a4854b7..f95a432e6f0 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) @@ -144,14 +144,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]"); } @@ -285,13 +285,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]"); } @@ -920,7 +920,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%' @@ -931,7 +931,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] @@ -2215,7 +2215,7 @@ public override async Task Include_reference_when_entity_in_projection(bool asyn @"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_closes_reader(bool async) @@ -2380,14 +2380,14 @@ public override async Task Include_reference_and_collection_order_by(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].[CustomerID], [o0].[EmployeeID], [o0].[OrderDate], [o].[OrderID], [c].[CustomerID] FROM [Orders] AS [o] LEFT JOIN [Customers] AS [c] ON [o].[CustomerID] = [c].[CustomerID] INNER JOIN [Orders] AS [o0] ON [c].[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%') ORDER BY [o].[OrderID], [c].[CustomerID]"); } @@ -2443,14 +2443,14 @@ public override async Task Include_collection_and_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%') 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]"); } @@ -2523,14 +2523,14 @@ public override async Task Include_references_then_include_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].[CustomerID], [o0].[EmployeeID], [o0].[OrderDate], [o].[OrderID], [c].[CustomerID] FROM [Orders] AS [o] LEFT JOIN [Customers] AS [c] ON [o].[CustomerID] = [c].[CustomerID] INNER JOIN [Orders] AS [o0] ON [c].[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%') ORDER BY [o].[OrderID], [c].[CustomerID]"); } diff --git a/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindStringIncludeQuerySqlServerTest.cs b/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindStringIncludeQuerySqlServerTest.cs index 265e97aac9f..0e1b12cabc1 100644 --- a/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindStringIncludeQuerySqlServerTest.cs +++ b/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindStringIncludeQuerySqlServerTest.cs @@ -123,7 +123,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]"); } @@ -212,7 +212,7 @@ public override async Task Include_references_then_include_collection(bool async FROM [Orders] AS [o] LEFT JOIN [Customers] AS [c] ON [o].[CustomerID] = [c].[CustomerID] LEFT JOIN [Orders] AS [o0] ON [c].[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%') ORDER BY [o].[OrderID], [c].[CustomerID]"); } @@ -906,7 +906,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] @@ -1000,7 +1000,7 @@ public override async Task Include_reference_when_entity_in_projection(bool asyn @"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_reference_single_or_default_when_no_result(bool async) @@ -1339,7 +1339,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_multiple_references_and_collection_multi_level_reverse(bool async) @@ -1545,7 +1545,7 @@ public override async Task Include_collection_and_reference(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]"); } @@ -1659,7 +1659,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]"); } @@ -1722,7 +1722,7 @@ public override async Task Include_reference_and_collection_order_by(bool async) FROM [Orders] AS [o] LEFT JOIN [Customers] AS [c] ON [o].[CustomerID] = [c].[CustomerID] LEFT JOIN [Orders] AS [o0] ON [c].[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%') ORDER BY [o].[OrderID], [c].[CustomerID]"); } diff --git a/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindWhereQuerySqlServerTest.cs b/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindWhereQuerySqlServerTest.cs index bd916c29e81..d1c08999cb1 100644 --- a/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindWhereQuerySqlServerTest.cs +++ b/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindWhereQuerySqlServerTest.cs @@ -480,10 +480,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) @@ -674,7 +674,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 (CAST(CHARINDEX(N'Sea', [c].[City]) AS int) - 1) <> -1 OR [c].[City] IS NULL"); +WHERE (CAST(CHARINDEX(N'Sea', [c].[City]) AS int) - 1) <> -1 OR ([c].[City] IS NULL)"); } public override async Task Where_string_replace(bool async) @@ -940,7 +940,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) @@ -962,7 +962,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) @@ -973,7 +973,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) @@ -984,7 +984,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) @@ -995,7 +995,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) @@ -1529,7 +1529,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) @@ -2118,7 +2118,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) @@ -2195,7 +2195,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) @@ -2238,7 +2238,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 0fb1704ee70..0364f7578f0 100644 --- a/test/EFCore.SqlServer.FunctionalTests/Query/NullSemanticsQuerySqlServerTest.cs +++ b/test/EFCore.SqlServer.FunctionalTests/Query/NullSemanticsQuerySqlServerTest.cs @@ -476,7 +476,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", // @@ -486,7 +486,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"); } @@ -512,7 +512,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", // @@ -522,7 +522,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"); } @@ -548,7 +548,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", // @@ -558,7 +558,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"); } @@ -584,7 +584,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", // @@ -594,7 +594,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"); } @@ -620,7 +620,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", // @@ -630,7 +630,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"); } @@ -656,7 +656,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", // @@ -666,7 +666,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"); } @@ -710,7 +710,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) @@ -720,7 +720,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) @@ -730,7 +730,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) @@ -740,7 +740,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) @@ -750,7 +750,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) @@ -760,7 +760,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) @@ -770,7 +770,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) @@ -782,7 +782,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) @@ -794,7 +794,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) @@ -834,7 +834,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) @@ -844,7 +844,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) @@ -864,7 +864,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) @@ -875,12 +875,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) @@ -891,15 +891,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) @@ -910,9 +910,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) @@ -931,7 +931,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]"); @@ -945,10 +945,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"); } @@ -1248,15 +1248,15 @@ public override async Task Null_semantics_applied_when_comparing_function_with_n AssertSql( @"SELECT [e].[Id] FROM [Entities1] AS [e] -WHERE (CAST(CHARINDEX(N'oo', [e].[NullableStringA]) AS int) - 1) = [e].[NullableIntA] OR ([e].[NullableStringA] IS NULL AND [e].[NullableIntA] IS NULL)", +WHERE (CAST(CHARINDEX(N'oo', [e].[NullableStringA]) AS int) - 1) = [e].[NullableIntA] OR (([e].[NullableStringA] IS NULL) AND ([e].[NullableIntA] IS NULL))", // @"SELECT [e].[Id] FROM [Entities1] AS [e] -WHERE (CAST(CHARINDEX(N'ar', [e].[NullableStringA]) AS int) - 1) = [e].[NullableIntA] OR ([e].[NullableStringA] IS NULL AND [e].[NullableIntA] IS NULL)", +WHERE (CAST(CHARINDEX(N'ar', [e].[NullableStringA]) AS int) - 1) = [e].[NullableIntA] OR (([e].[NullableStringA] IS NULL) AND ([e].[NullableIntA] IS NULL))", // @"SELECT [e].[Id] FROM [Entities1] AS [e] -WHERE ((CAST(CHARINDEX(N'oo', [e].[NullableStringA]) AS int) - 1) <> [e].[NullableIntB] OR [e].[NullableStringA] IS NULL OR [e].[NullableIntB] IS NULL) AND ([e].[NullableStringA] IS NOT NULL OR [e].[NullableIntB] IS NOT NULL)"); +WHERE ((CAST(CHARINDEX(N'oo', [e].[NullableStringA]) AS int) - 1) <> [e].[NullableIntB] OR ([e].[NullableStringA] IS NULL) OR ([e].[NullableIntB] IS NULL)) AND (([e].[NullableStringA] IS NOT NULL) OR ([e].[NullableIntB] IS NOT NULL))"); } public override async Task Where_IndexOf_empty(bool async) @@ -1284,15 +1284,15 @@ public override async Task Null_semantics_applied_when_comparing_two_functions_w AssertSql( @"SELECT [e].[Id] FROM [Entities1] AS [e] -WHERE (CAST(CHARINDEX(N'oo', [e].[NullableStringA]) AS int) - 1) = (CAST(CHARINDEX(N'ar', [e].[NullableStringB]) AS int) - 1) OR ([e].[NullableStringA] IS NULL AND [e].[NullableStringB] IS NULL)", +WHERE (CAST(CHARINDEX(N'oo', [e].[NullableStringA]) AS int) - 1) = (CAST(CHARINDEX(N'ar', [e].[NullableStringB]) AS int) - 1) OR (([e].[NullableStringA] IS NULL) AND ([e].[NullableStringB] IS NULL))", // @"SELECT [e].[Id] FROM [Entities1] AS [e] -WHERE ((CAST(CHARINDEX(N'oo', [e].[NullableStringA]) AS int) - 1) <> (CAST(CHARINDEX(N'ar', [e].[NullableStringB]) AS int) - 1) OR [e].[NullableStringA] IS NULL OR [e].[NullableStringB] IS NULL) AND ([e].[NullableStringA] IS NOT NULL OR [e].[NullableStringB] IS NOT NULL)", +WHERE ((CAST(CHARINDEX(N'oo', [e].[NullableStringA]) AS int) - 1) <> (CAST(CHARINDEX(N'ar', [e].[NullableStringB]) AS int) - 1) 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] FROM [Entities1] AS [e] -WHERE ((CAST(CHARINDEX(N'oo', [e].[NullableStringA]) AS int) - 1) <> (CAST(CHARINDEX(N'ar', [e].[NullableStringA]) AS int) - 1) OR [e].[NullableStringA] IS NULL) AND [e].[NullableStringA] IS NOT NULL"); +WHERE ((CAST(CHARINDEX(N'oo', [e].[NullableStringA]) AS int) - 1) <> (CAST(CHARINDEX(N'ar', [e].[NullableStringA]) AS int) - 1) OR ([e].[NullableStringA] IS NULL)) AND ([e].[NullableStringA] IS NOT NULL)"); } public override async Task Null_semantics_applied_when_comparing_two_functions_with_multiple_nullable_arguments(bool async) @@ -1302,11 +1302,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) @@ -1374,7 +1374,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) @@ -1384,8 +1384,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])"); } @@ -1401,15 +1401,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] @@ -1417,15 +1417,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) @@ -1507,23 +1507,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) @@ -1533,15 +1533,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) @@ -1569,15 +1569,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) @@ -1635,7 +1635,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) @@ -1645,7 +1645,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) @@ -1655,11 +1655,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) @@ -1686,7 +1686,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]"); @@ -1710,7 +1710,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) @@ -1739,7 +1739,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) @@ -1749,19 +1749,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) @@ -1771,19 +1771,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) @@ -1803,7 +1803,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( @@ -1814,7 +1814,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) @@ -1834,7 +1834,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) @@ -1864,7 +1864,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) @@ -1874,7 +1874,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) @@ -2056,7 +2056,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) @@ -2066,7 +2066,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) @@ -2076,7 +2076,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) @@ -2086,7 +2086,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) @@ -2099,11 +2099,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)"); @@ -2118,12 +2118,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)"); @@ -2137,12 +2137,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)"); @@ -2198,7 +2198,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] @@ -2212,7 +2212,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) @@ -2222,11 +2222,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 20632fbb23e..196bb6fac7f 100644 --- a/test/EFCore.SqlServer.FunctionalTests/Query/OwnedQuerySqlServerTest.cs +++ b/test/EFCore.SqlServer.FunctionalTests/Query/OwnedQuerySqlServerTest.cs @@ -243,7 +243,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]"); } @@ -274,7 +274,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].[Name], [p].[StarId] + WHERE [o].[Id] = [o0].[ClientId] AND ([s].[Id] <> 42 OR ([s].[Id] IS NULL))) AS [Count], [p].[Id], [p].[Name], [p].[StarId] FROM [OwnedPerson] AS [o] LEFT JOIN [Planet] AS [p] ON [o].[PersonAddress_Country_PlanetId] = [p].[Id] ORDER BY [o].[Id]"); @@ -293,7 +293,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]"); } @@ -1148,7 +1148,7 @@ public override async Task Projecting_collection_correlated_with_keyless_entity_ @"SELECT [b].[Throned_Value], [f].[Id], [b].[Id], [p].[Id], [p].[Name], [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 056d446b0de..ca709e124cb 100644 --- a/test/EFCore.SqlServer.FunctionalTests/Query/QueryBugsTest.cs +++ b/test/EFCore.SqlServer.FunctionalTests/Query/QueryBugsTest.cs @@ -3026,7 +3026,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')"); } } @@ -4755,7 +4755,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()) @@ -5359,16 +5359,16 @@ OUTER APPLY ( SELECT [s].[ThingId], [t].[Id], [s].[Id] AS [Id0] FROM [Things] AS [t] LEFT JOIN [Subthings] AS [s] ON [t].[Id] = [s].[ThingId] - WHERE ( + WHERE (( SELECT TOP(1) [v].[Id] FROM [Values] AS [v] - WHERE [e].[Id] = [v].[Entity11023Id]) IS NOT NULL AND (( + WHERE [e].[Id] = [v].[Entity11023Id]) IS NOT NULL) 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]"); } @@ -5764,7 +5764,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] @@ -6259,7 +6259,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()) @@ -7290,13 +7290,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"); } } @@ -9349,12 +9349,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]"); } @@ -9490,7 +9490,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 2e729fbd8a9..7ac7f1da185 100644 --- a/test/EFCore.SqlServer.FunctionalTests/Query/SharedTypeQuerySqlServerTest.cs +++ b/test/EFCore.SqlServer.FunctionalTests/Query/SharedTypeQuerySqlServerTest.cs @@ -18,7 +18,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) @@ -33,6 +33,6 @@ 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/SimpleQuerySqlServerTest.cs b/test/EFCore.SqlServer.FunctionalTests/Query/SimpleQuerySqlServerTest.cs index 54d472a9af5..0b73ec35bf9 100644 --- a/test/EFCore.SqlServer.FunctionalTests/Query/SimpleQuerySqlServerTest.cs +++ b/test/EFCore.SqlServer.FunctionalTests/Query/SimpleQuerySqlServerTest.cs @@ -180,7 +180,7 @@ public override async Task GroupBy_aggregate_on_right_side_of_join(bool async) FROM [OrderItems] AS [o] INNER JOIN ( SELECT [o0].[OrderId] AS [Key], MAX(CASE - WHEN [o0].[ShippingDate] IS NULL AND [o0].[CancellationDate] IS NULL THEN [o0].[OrderId] + WHEN ([o0].[ShippingDate] IS NULL) AND ([o0].[CancellationDate] IS NULL) THEN [o0].[OrderId] ELSE [o0].[OrderId] - 10000000 END) AS [IsPending] FROM [OrderItems] AS [o0] @@ -225,17 +225,17 @@ public override async Task GroupBy_Aggregate_over_navigations_repeated(bool asyn SELECT MIN([o].[HourlyRate]) FROM [TimeSheets] AS [t0] LEFT JOIN [Order] AS [o] ON [t0].[OrderId] = [o].[Id] - WHERE [t0].[OrderId] IS NOT NULL AND [t].[OrderId] = [t0].[OrderId]) AS [HourlyRate], ( + WHERE ([t0].[OrderId] IS NOT NULL) AND [t].[OrderId] = [t0].[OrderId]) AS [HourlyRate], ( SELECT MIN([c].[Id]) FROM [TimeSheets] AS [t1] INNER JOIN [Project] AS [p] ON [t1].[ProjectId] = [p].[Id] INNER JOIN [Customers] AS [c] ON [p].[CustomerId] = [c].[Id] - WHERE [t1].[OrderId] IS NOT NULL AND [t].[OrderId] = [t1].[OrderId]) AS [CustomerId], ( + WHERE ([t1].[OrderId] IS NOT NULL) AND [t].[OrderId] = [t1].[OrderId]) AS [CustomerId], ( SELECT MIN([c0].[Name]) FROM [TimeSheets] AS [t2] INNER JOIN [Project] AS [p0] ON [t2].[ProjectId] = [p0].[Id] INNER JOIN [Customers] AS [c0] ON [p0].[CustomerId] = [c0].[Id] - WHERE [t2].[OrderId] IS NOT NULL AND [t].[OrderId] = [t2].[OrderId]) AS [CustomerName] + WHERE ([t2].[OrderId] IS NOT NULL) AND [t].[OrderId] = [t2].[OrderId]) AS [CustomerName] FROM [TimeSheets] AS [t] WHERE [t].[OrderId] IS NOT NULL GROUP BY [t].[OrderId]"); @@ -251,7 +251,7 @@ SELECT MIN([o0].[HourlyRate]) FROM [Order] AS [o0] WHERE [o0].[CustomerId] = [o].[CustomerId]) AS [CustomerMinHourlyRate], MIN([o].[HourlyRate]) AS [HourlyRate], COUNT(*) AS [Count] FROM [Order] AS [o] -WHERE [o].[Number] <> N'A1' OR [o].[Number] IS NULL +WHERE [o].[Number] <> N'A1' OR ([o].[Number] IS NULL) GROUP BY [o].[CustomerId], [o].[Number]"); } @@ -263,7 +263,7 @@ public override async Task Aggregate_over_subquery_in_group_by_projection_2(bool @"SELECT [t].[Value] AS [A], ( SELECT MAX([t0].[Id]) FROM [Table] AS [t0] - WHERE [t0].[Value] = (MAX([t].[Id]) * 6) OR ([t0].[Value] IS NULL AND MAX([t].[Id]) IS NULL)) AS [B] + WHERE [t0].[Value] = (MAX([t].[Id]) * 6) OR (([t0].[Value] IS NULL) AND (MAX([t].[Id]) IS NULL))) AS [B] FROM [Table] AS [t] GROUP BY [t].[Value]"); } @@ -364,17 +364,17 @@ public override async Task Subquery_first_member_compared_to_null(bool async) @"SELECT ( SELECT TOP(1) [c1].[SomeOtherNullableDateTime] FROM [Child26744] AS [c1] - WHERE [p].[Id] = [c1].[ParentId] AND [c1].[SomeNullableDateTime] IS NULL + WHERE [p].[Id] = [c1].[ParentId] AND ([c1].[SomeNullableDateTime] IS NULL) ORDER BY [c1].[SomeInteger]) FROM [Parents] AS [p] WHERE EXISTS ( SELECT 1 FROM [Child26744] AS [c] - WHERE [p].[Id] = [c].[ParentId] AND [c].[SomeNullableDateTime] IS NULL) AND ( + WHERE [p].[Id] = [c].[ParentId] AND ([c].[SomeNullableDateTime] IS NULL)) AND (( SELECT TOP(1) [c0].[SomeOtherNullableDateTime] FROM [Child26744] AS [c0] - WHERE [p].[Id] = [c0].[ParentId] AND [c0].[SomeNullableDateTime] IS NULL - ORDER BY [c0].[SomeInteger]) IS NOT NULL"); + WHERE [p].[Id] = [c0].[ParentId] AND ([c0].[SomeNullableDateTime] IS NULL) + ORDER BY [c0].[SomeInteger]) IS NOT NULL)"); } public override async Task SelectMany_where_Select(bool async) @@ -441,7 +441,7 @@ public override async Task Hierarchy_query_with_abstract_type_sibling(bool async AssertSql( @"SELECT [a].[Id], [a].[Discriminator], [a].[Species], [a].[Name], [a].[EdcuationLevel], [a].[FavoriteToy] FROM [Animals] AS [a] -WHERE [a].[Discriminator] IN (N'Cat', N'Dog') AND [a].[Species] IS NOT NULL AND ([a].[Species] LIKE N'F%')"); +WHERE [a].[Discriminator] IN (N'Cat', N'Dog') AND ([a].[Species] IS NOT NULL) AND ([a].[Species] LIKE N'F%')"); } public override async Task Hierarchy_query_with_abstract_type_sibling_TPT(bool async) @@ -457,7 +457,7 @@ FROM [Animals] AS [a] LEFT JOIN [Pets] AS [p] ON [a].[Id] = [p].[Id] LEFT JOIN [Cats] AS [c] ON [a].[Id] = [c].[Id] LEFT JOIN [Dogs] AS [d] ON [a].[Id] = [d].[Id] -WHERE ([d].[Id] IS NOT NULL OR [c].[Id] IS NOT NULL) AND [a].[Species] IS NOT NULL AND ([a].[Species] LIKE N'F%')"); +WHERE (([d].[Id] IS NOT NULL) OR ([c].[Id] IS NOT NULL)) AND ([a].[Species] IS NOT NULL) AND ([a].[Species] LIKE N'F%')"); } public override async Task Hierarchy_query_with_abstract_type_sibling_TPC(bool async) @@ -473,7 +473,7 @@ UNION ALL SELECT [d].[Id], [d].[Species], [d].[Name], NULL AS [EdcuationLevel], [d].[FavoriteToy], N'Dog' AS [Discriminator] FROM [Dogs] AS [d] ) AS [t] -WHERE [t].[Species] IS NOT NULL AND ([t].[Species] LIKE N'F%')"); +WHERE ([t].[Species] IS NOT NULL) AND ([t].[Species] LIKE N'F%')"); } [ConditionalTheory] diff --git a/test/EFCore.SqlServer.FunctionalTests/Query/TPCGearsOfWarQuerySqlServerTest.cs b/test/EFCore.SqlServer.FunctionalTests/Query/TPCGearsOfWarQuerySqlServerTest.cs index f58fc9f9b3c..a25705bda19 100644 --- a/test/EFCore.SqlServer.FunctionalTests/Query/TPCGearsOfWarQuerySqlServerTest.cs +++ b/test/EFCore.SqlServer.FunctionalTests/Query/TPCGearsOfWarQuerySqlServerTest.cs @@ -60,7 +60,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) @@ -325,7 +325,7 @@ UNION ALL FROM [Officers] AS [o] ) AS [t] LEFT JOIN [Tags] AS [t0] ON [t].[Nickname] = [t0].[GearNickName] AND [t].[SquadId] = [t0].[GearSquadId] -WHERE [t0].[Id] IS NOT NULL AND [t0].[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 ([t0].[Id] IS NOT NULL) AND [t0].[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) @@ -346,7 +346,7 @@ FROM [Officers] AS [o] ) AS [t] INNER JOIN [Cities] AS [c] ON [t].[CityOfBirthName] = [c].[Name] LEFT JOIN [Tags] AS [t0] ON [t].[Nickname] = [t0].[GearNickName] AND [t].[SquadId] = [t0].[GearSquadId] -WHERE [c].[Location] IS NOT NULL AND [t0].[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 [t0].[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) @@ -366,7 +366,7 @@ UNION ALL FROM [Officers] AS [o] ) AS [t] LEFT JOIN [Tags] AS [t0] ON [t].[Nickname] = [t0].[GearNickName] AND [t].[SquadId] = [t0].[GearSquadId] -WHERE [t0].[Id] IS NOT NULL AND [t0].[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 ([t0].[Id] IS NOT NULL) AND [t0].[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) @@ -480,7 +480,7 @@ UNION ALL FROM [Officers] AS [o] ) 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]"); } @@ -845,7 +845,7 @@ UNION ALL SELECT [o0].[Nickname], [o0].[SquadId], [o0].[AssignedCityName], [o0].[CityOfBirthName], [o0].[FullName], [o0].[HasSoulPatch], [o0].[LeaderNickname], [o0].[LeaderSquadId], [o0].[Rank], N'Officer' AS [Discriminator] FROM [Officers] AS [o0] ) AS [t0] - ORDER BY [t0].[Nickname], [t0].[SquadId]) OR ( + ORDER BY [t0].[Nickname], [t0].[SquadId]) OR (( SELECT TOP(1) [t0].[Rank] FROM ( SELECT [g0].[Nickname], [g0].[SquadId], [g0].[AssignedCityName], [g0].[CityOfBirthName], [g0].[FullName], [g0].[HasSoulPatch], [g0].[LeaderNickname], [g0].[LeaderSquadId], [g0].[Rank], N'Gear' AS [Discriminator] @@ -854,7 +854,7 @@ UNION ALL SELECT [o0].[Nickname], [o0].[SquadId], [o0].[AssignedCityName], [o0].[CityOfBirthName], [o0].[FullName], [o0].[HasSoulPatch], [o0].[LeaderNickname], [o0].[LeaderSquadId], [o0].[Rank], N'Officer' AS [Discriminator] FROM [Officers] AS [o0] ) AS [t0] - ORDER BY [t0].[Nickname], [t0].[SquadId]) IS NULL", + ORDER BY [t0].[Nickname], [t0].[SquadId]) IS NULL)", // @"SELECT [t].[Nickname], [t].[SquadId], [t].[AssignedCityName], [t].[CityOfBirthName], [t].[FullName], [t].[HasSoulPatch], [t].[LeaderNickname], [t].[LeaderSquadId], [t].[Rank], [t].[Discriminator] FROM ( @@ -882,7 +882,7 @@ UNION ALL SELECT [o0].[Nickname], [o0].[SquadId], [o0].[AssignedCityName], [o0].[CityOfBirthName], [o0].[FullName], [o0].[HasSoulPatch], [o0].[LeaderNickname], [o0].[LeaderSquadId], [o0].[Rank], N'Officer' AS [Discriminator] FROM [Officers] AS [o0] ) AS [t0] - ORDER BY [t0].[Nickname], [t0].[SquadId]) OR ( + ORDER BY [t0].[Nickname], [t0].[SquadId]) OR (( SELECT TOP(1) [t0].[Rank] FROM ( SELECT [g0].[Nickname], [g0].[SquadId], [g0].[AssignedCityName], [g0].[CityOfBirthName], [g0].[FullName], [g0].[HasSoulPatch], [g0].[LeaderNickname], [g0].[LeaderSquadId], [g0].[Rank], N'Gear' AS [Discriminator] @@ -891,7 +891,7 @@ UNION ALL SELECT [o0].[Nickname], [o0].[SquadId], [o0].[AssignedCityName], [o0].[CityOfBirthName], [o0].[FullName], [o0].[HasSoulPatch], [o0].[LeaderNickname], [o0].[LeaderSquadId], [o0].[Rank], N'Officer' AS [Discriminator] FROM [Officers] AS [o0] ) AS [t0] - ORDER BY [t0].[Nickname], [t0].[SquadId]) IS NULL"); + ORDER BY [t0].[Nickname], [t0].[SquadId]) IS NULL)"); } public override async Task Where_enum_has_flag_subquery_client_eval(bool async) @@ -925,7 +925,7 @@ UNION ALL SELECT [o0].[Nickname], [o0].[SquadId], [o0].[AssignedCityName], [o0].[CityOfBirthName], [o0].[FullName], [o0].[HasSoulPatch], [o0].[LeaderNickname], [o0].[LeaderSquadId], [o0].[Rank], N'Officer' AS [Discriminator] FROM [Officers] AS [o0] ) AS [t0] - ORDER BY [t0].[Nickname], [t0].[SquadId]) OR ( + ORDER BY [t0].[Nickname], [t0].[SquadId]) OR (( SELECT TOP(1) [t0].[Rank] FROM ( SELECT [g0].[Nickname], [g0].[SquadId], [g0].[AssignedCityName], [g0].[CityOfBirthName], [g0].[FullName], [g0].[HasSoulPatch], [g0].[LeaderNickname], [g0].[LeaderSquadId], [g0].[Rank], N'Gear' AS [Discriminator] @@ -934,7 +934,7 @@ UNION ALL SELECT [o0].[Nickname], [o0].[SquadId], [o0].[AssignedCityName], [o0].[CityOfBirthName], [o0].[FullName], [o0].[HasSoulPatch], [o0].[LeaderNickname], [o0].[LeaderSquadId], [o0].[Rank], N'Officer' AS [Discriminator] FROM [Officers] AS [o0] ) AS [t0] - ORDER BY [t0].[Nickname], [t0].[SquadId]) IS NULL"); + ORDER BY [t0].[Nickname], [t0].[SquadId]) IS NULL)"); } public override async Task Where_enum_has_flag_with_non_nullable_parameter(bool async) @@ -1054,7 +1054,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] @@ -1120,11 +1120,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) @@ -1157,7 +1157,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]"); @@ -1191,7 +1191,7 @@ UNION ALL SELECT [o].[Nickname], [o].[SquadId], [o].[AssignedCityName], [o].[CityOfBirthName], [o].[FullName], [o].[HasSoulPatch], [o].[LeaderNickname], [o].[LeaderSquadId], [o].[Rank], N'Officer' AS [Discriminator] FROM [Officers] AS [o] ) AS [t] -WHERE [t].[LeaderNickname] = N'Marcus' AND [t].[LeaderNickname] IS NOT NULL"); +WHERE [t].[LeaderNickname] = N'Marcus' AND ([t].[LeaderNickname] IS NOT NULL)"); } public override async Task Null_propagation_optimization2(bool async) @@ -1211,7 +1211,7 @@ FROM [Officers] AS [o] WHERE CASE WHEN [t].[LeaderNickname] IS NULL THEN NULL ELSE CASE - WHEN [t].[LeaderNickname] IS NOT NULL AND ([t].[LeaderNickname] LIKE N'%us') THEN CAST(1 AS bit) + WHEN ([t].[LeaderNickname] IS NOT NULL) AND ([t].[LeaderNickname] LIKE N'%us') THEN CAST(1 AS bit) ELSE CAST(0 AS bit) END END = CAST(1 AS bit)"); @@ -1257,10 +1257,10 @@ FROM [Officers] AS [o] WHERE CASE WHEN [t].[LeaderNickname] IS NULL THEN NULL ELSE CAST(LEN([t].[LeaderNickname]) AS int) -END = 5 AND CASE +END = 5 AND (CASE WHEN [t].[LeaderNickname] IS NULL THEN NULL ELSE CAST(LEN([t].[LeaderNickname]) AS int) -END IS NOT NULL"); +END IS NOT NULL)"); } public override async Task Null_propagation_optimization5(bool async) @@ -1280,10 +1280,10 @@ FROM [Officers] AS [o] WHERE CASE WHEN [t].[LeaderNickname] IS NOT NULL THEN CAST(LEN([t].[LeaderNickname]) AS int) ELSE NULL -END = 5 AND CASE +END = 5 AND (CASE WHEN [t].[LeaderNickname] IS NOT NULL THEN CAST(LEN([t].[LeaderNickname]) AS int) ELSE NULL -END IS NOT NULL"); +END IS NOT NULL)"); } public override async Task Null_propagation_optimization6(bool async) @@ -1303,10 +1303,10 @@ FROM [Officers] AS [o] WHERE CASE WHEN [t].[LeaderNickname] IS NOT NULL THEN CAST(LEN([t].[LeaderNickname]) AS int) ELSE NULL -END = 5 AND CASE +END = 5 AND (CASE WHEN [t].[LeaderNickname] IS NOT NULL THEN CAST(LEN([t].[LeaderNickname]) AS int) ELSE NULL -END IS NOT NULL"); +END IS NOT NULL)"); } public override async Task Select_null_propagation_optimization7(bool async) @@ -1410,7 +1410,7 @@ public override async Task Select_null_propagation_negative3(bool async) AssertSql( @"SELECT [t0].[Nickname], CASE - WHEN [t0].[Nickname] IS NOT NULL AND [t0].[SquadId] IS NOT NULL THEN CASE + WHEN ([t0].[Nickname] IS NOT NULL) AND ([t0].[SquadId] IS NOT NULL) THEN CASE WHEN [t0].[LeaderNickname] IS NOT NULL THEN CAST(1 AS bit) ELSE CAST(0 AS bit) END @@ -1439,7 +1439,7 @@ public override async Task Select_null_propagation_negative4(bool async) 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, [t0].[Nickname] FROM ( @@ -1465,7 +1465,7 @@ public override async Task Select_null_propagation_negative5(bool async) 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, [t0].[Nickname] FROM ( @@ -1599,7 +1599,7 @@ UNION ALL SELECT [o].[Nickname], [o].[SquadId] FROM [Officers] AS [o] ) 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] @@ -1775,7 +1775,7 @@ UNION ALL SELECT [o0].[Nickname], [o0].[SquadId] FROM [Officers] AS [o0] ) 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) @@ -1792,7 +1792,7 @@ UNION ALL SELECT [o].[Nickname], [o].[SquadId], [o].[AssignedCityName], [o].[CityOfBirthName], [o].[FullName], [o].[HasSoulPatch], [o].[LeaderNickname], [o].[LeaderSquadId], [o].[Rank], N'Officer' AS [Discriminator] FROM [Officers] AS [o] ) 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) @@ -1834,7 +1834,7 @@ UNION ALL SELECT [o0].[Nickname], [o0].[SquadId] FROM [Officers] AS [o0] ) 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) @@ -1851,7 +1851,7 @@ UNION ALL SELECT [o].[Nickname], [o].[SquadId] FROM [Officers] AS [o] ) 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) @@ -1868,7 +1868,7 @@ UNION ALL SELECT [o].[Nickname], [o].[SquadId] FROM [Officers] AS [o] ) 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) @@ -1893,7 +1893,7 @@ UNION ALL SELECT [o0].[Nickname], [o0].[SquadId] FROM [Officers] AS [o0] ) 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) @@ -2491,7 +2491,7 @@ UNION ALL SELECT [o].[Nickname], [o].[SquadId], [o].[CityOfBirthName] FROM [Officers] AS [o] ) 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) @@ -2855,7 +2855,7 @@ public override async Task Include_on_GroupJoin_SelectMany_DefaultIfEmpty_with_c // Issue#16897 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, [t0].[Nickname], [t0].[SquadId], [t0].[AssignedCityName], [t0].[CityOfBirthName], [t0].[FullName], [t0].[HasSoulPatch], [t0].[LeaderNickname], [t0].[LeaderSquadId], [t0].[Rank], [t0].[Discriminator], [t].[Nickname], [t].[SquadId], [w].[Id], [w].[AmmunitionType], [w].[IsAutomatic], [w].[Name], [w].[OwnerFullName], [w].[SynergyWithId], [t].[AssignedCityName], [t].[CityOfBirthName], [t].[FullName], [t].[HasSoulPatch], [t].[LeaderNickname], [t].[LeaderSquadId], [t].[Rank], [t].[Discriminator], [w0].[Id], [w0].[AmmunitionType], [w0].[IsAutomatic], [w0].[Name], [w0].[OwnerFullName], [w0].[SynergyWithId] FROM ( @@ -2883,7 +2883,7 @@ public override async Task Include_on_GroupJoin_SelectMany_DefaultIfEmpty_with_c AssertSql( @"SELECT [t].[Nickname], [t].[SquadId], [t].[AssignedCityName], [t].[CityOfBirthName], [t].[FullName], [t].[HasSoulPatch], [t].[LeaderNickname], [t].[LeaderSquadId], [t].[Rank], [t].[Discriminator], [t0].[Nickname], [t0].[SquadId], [w].[Id], [w].[AmmunitionType], [w].[IsAutomatic], [w].[Name], [w].[OwnerFullName], [w].[SynergyWithId], [t0].[AssignedCityName], [t0].[CityOfBirthName], [t0].[FullName], [t0].[HasSoulPatch], [t0].[LeaderNickname], [t0].[LeaderSquadId], [t0].[Rank], [t0].[Discriminator], [w0].[Id], [w0].[AmmunitionType], [w0].[IsAutomatic], [w0].[Name], [w0].[OwnerFullName], [w0].[SynergyWithId], [w1].[Id], [w1].[AmmunitionType], [w1].[IsAutomatic], [w1].[Name], [w1].[OwnerFullName], [w1].[SynergyWithId], [w2].[Id], [w2].[AmmunitionType], [w2].[IsAutomatic], [w2].[Name], [w2].[OwnerFullName], [w2].[SynergyWithId], 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, [w3].[Id], [w3].[AmmunitionType], [w3].[IsAutomatic], [w3].[Name], [w3].[OwnerFullName], [w3].[SynergyWithId], [w4].[Id], [w4].[AmmunitionType], [w4].[IsAutomatic], [w4].[Name], [w4].[OwnerFullName], [w4].[SynergyWithId] FROM ( @@ -2935,7 +2935,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]"); @@ -2955,7 +2955,7 @@ UNION ALL SELECT [o].[Nickname], [o].[SquadId], [o].[HasSoulPatch] FROM [Officers] AS [o] ) 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) @@ -3102,7 +3102,7 @@ UNION ALL SELECT [o].[Nickname], [o].[SquadId] FROM [Officers] AS [o] ) 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) @@ -3119,7 +3119,7 @@ UNION ALL SELECT [o].[Nickname], [o].[SquadId] FROM [Officers] AS [o] ) 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) @@ -3136,7 +3136,7 @@ UNION ALL SELECT [o].[Nickname], [o].[SquadId] FROM [Officers] AS [o] ) 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) @@ -3153,7 +3153,7 @@ UNION ALL SELECT [o].[Nickname], [o].[SquadId] FROM [Officers] AS [o] ) 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]"); } @@ -3171,7 +3171,7 @@ UNION ALL SELECT [o].[Nickname], [o].[SquadId] FROM [Officers] AS [o] ) 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) @@ -3188,7 +3188,7 @@ UNION ALL SELECT [o].[Nickname], [o].[SquadId] FROM [Officers] AS [o] ) 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]"); } @@ -3208,7 +3208,7 @@ UNION ALL SELECT [o].[Nickname], [o].[SquadId], [o].[AssignedCityName], [o].[CityOfBirthName], [o].[FullName], [o].[HasSoulPatch], [o].[LeaderNickname], [o].[LeaderSquadId], [o].[Rank], N'Officer' AS [Discriminator] FROM [Officers] AS [o] ) 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"); } @@ -3227,7 +3227,7 @@ UNION ALL SELECT [o].[Nickname], [o].[SquadId], [o].[HasSoulPatch] FROM [Officers] AS [o] ) 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) @@ -3244,7 +3244,7 @@ UNION ALL SELECT [o].[Nickname], [o].[SquadId] FROM [Officers] AS [o] ) 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 ( SELECT [g0].[Nickname], [g0].[SquadId], [g0].[AssignedCityName], [g0].[CityOfBirthName], [g0].[FullName], [g0].[HasSoulPatch], [g0].[LeaderNickname], [g0].[LeaderSquadId], [g0].[Rank], N'Gear' AS [Discriminator] @@ -3287,7 +3287,7 @@ FROM [Officers] AS [o] 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 [t0] ON [t].[FullName] = [t0].[OwnerFullName] WHERE [c].[Name] IN (N'Ephyra', N'Hanover') ORDER BY [t].[Nickname], [t].[SquadId], [c].[Name]"); @@ -3645,7 +3645,7 @@ UNION ALL FROM [Officers] AS [o] ) AS [t] LEFT JOIN [Tags] AS [t0] ON [t].[Nickname] = [t0].[GearNickName] AND [t].[SquadId] = [t0].[GearSquadId] -WHERE [t0].[Note] <> N'Foo' OR [t0].[Note] IS NULL"); +WHERE [t0].[Note] <> N'Foo' OR ([t0].[Note] IS NULL)"); } public override async Task Sum_with_optional_navigation_is_translated_to_sql(bool async) @@ -3662,7 +3662,7 @@ UNION ALL FROM [Officers] AS [o] ) AS [t] LEFT JOIN [Tags] AS [t0] ON [t].[Nickname] = [t0].[GearNickName] AND [t].[SquadId] = [t0].[GearSquadId] -WHERE [t0].[Note] <> N'Foo' OR [t0].[Note] IS NULL"); +WHERE [t0].[Note] <> N'Foo' OR ([t0].[Note] IS NULL)"); } public override async Task Count_with_optional_navigation_is_translated_to_sql(bool async) @@ -3679,7 +3679,7 @@ UNION ALL FROM [Officers] AS [o] ) AS [t] LEFT JOIN [Tags] AS [t0] ON [t].[Nickname] = [t0].[GearNickName] AND [t].[SquadId] = [t0].[GearSquadId] -WHERE [t0].[Note] <> N'Foo' OR [t0].[Note] IS NULL"); +WHERE [t0].[Note] <> N'Foo' OR ([t0].[Note] IS NULL)"); } public override async Task FirstOrDefault_with_manually_created_groupjoin_is_translated_to_sql(bool async) @@ -3735,7 +3735,7 @@ UNION ALL FROM [Officers] AS [o] ) AS [t] LEFT JOIN [Tags] AS [t0] ON [t].[Nickname] = [t0].[GearNickName] AND [t].[SquadId] = [t0].[GearSquadId] - WHERE [t0].[Note] = N'Foo' AND [t0].[Note] IS NOT NULL) THEN CAST(1 AS bit) + WHERE [t0].[Note] = N'Foo' AND ([t0].[Note] IS NOT NULL)) THEN CAST(1 AS bit) ELSE CAST(0 AS bit) END"); } @@ -3910,7 +3910,7 @@ FROM [Officers] AS [o] ) AS [t] INNER JOIN [Tags] AS [t0] ON [t].[Nickname] = [t0].[GearNickName] INNER JOIN [Tags] AS [t1] ON [t].[Nickname] = [t1].[GearNickName] -WHERE [t0].[GearNickName] <> N'Cole Train' OR [t0].[GearNickName] IS NULL +WHERE [t0].[GearNickName] <> N'Cole Train' OR ([t0].[GearNickName] IS NULL) ORDER BY [t].[Nickname], [t1].[Id]"); } @@ -4334,7 +4334,7 @@ UNION ALL FROM [Officers] AS [o] ) AS [t] LEFT JOIN [Cities] AS [c] ON [t].[AssignedCityName] = [c].[Name] -WHERE [t].[SquadId] < 2 AND ([c].[Name] = N'Ephyra' OR [c].[Name] IS NULL)"); +WHERE [t].[SquadId] < 2 AND ([c].[Name] = N'Ephyra' OR ([c].[Name] IS NULL))"); } public override async Task Optional_navigation_with_collection_composite_key(bool async) @@ -4360,7 +4360,7 @@ UNION ALL SELECT [o0].[Nickname], [o0].[SquadId], [o0].[AssignedCityName], [o0].[CityOfBirthName], [o0].[FullName], [o0].[HasSoulPatch], [o0].[LeaderNickname], [o0].[LeaderSquadId], [o0].[Rank], N'Officer' AS [Discriminator] FROM [Officers] AS [o0] ) AS [t1] - WHERE [t0].[Nickname] IS NOT NULL AND [t0].[SquadId] IS NOT NULL AND [t0].[Nickname] = [t1].[LeaderNickname] AND [t0].[SquadId] = [t1].[LeaderSquadId] AND [t1].[Nickname] = N'Dom') > 0"); + WHERE ([t0].[Nickname] IS NOT NULL) AND ([t0].[SquadId] IS NOT NULL) AND [t0].[Nickname] = [t1].[LeaderNickname] AND [t0].[SquadId] = [t1].[LeaderSquadId] AND [t1].[Nickname] = N'Dom') > 0"); } public override async Task Select_null_conditional_with_inheritance(bool async) @@ -4427,7 +4427,7 @@ FROM [Gears] AS [g0] UNION ALL SELECT [o0].[Nickname], [o0].[SquadId], [o0].[AssignedCityName], [o0].[CityOfBirthName], [o0].[FullName], [o0].[HasSoulPatch], [o0].[LeaderNickname], [o0].[LeaderSquadId], [o0].[Rank], N'Officer' AS [Discriminator] FROM [Officers] AS [o0] -) 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].[Id], [l0].[Name], [t].[Nickname], [t].[SquadId], [t0].[Nickname]"); } @@ -4452,7 +4452,7 @@ FROM [Gears] AS [g0] UNION ALL SELECT [o0].[Nickname], [o0].[SquadId], [o0].[AssignedCityName], [o0].[CityOfBirthName], [o0].[FullName], [o0].[HasSoulPatch], [o0].[LeaderNickname], [o0].[LeaderSquadId], [o0].[Rank], N'Officer' AS [Discriminator] FROM [Officers] AS [o0] -) 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].[Id], [l0].[Name], [t].[Nickname], [t].[SquadId], [t0].[Nickname]"); } @@ -4531,7 +4531,7 @@ UNION ALL FROM [Officers] AS [o0] ) AS [t2] INNER JOIN [Cities] AS [c] ON [t2].[CityOfBirthName] = [c].[Name] -) 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].[Name], [t0].[Nickname], [t0].[SquadId], [t1].[Nickname], [t1].[SquadId]"); } @@ -4727,7 +4727,7 @@ FROM [Gears] AS [g0] UNION ALL SELECT [o0].[Nickname], [o0].[SquadId], [o0].[AssignedCityName], [o0].[CityOfBirthName], [o0].[FullName], [o0].[HasSoulPatch], [o0].[LeaderNickname], [o0].[LeaderSquadId], [o0].[Rank], N'Officer' AS [Discriminator] FROM [Officers] AS [o0] -) 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].[Id], [l0].[Name], [t].[Nickname], [t].[SquadId], [t0].[Nickname]"); } @@ -4812,7 +4812,7 @@ FROM [Gears] AS [g0] UNION ALL SELECT [o0].[Nickname], [o0].[SquadId], [o0].[AssignedCityName], [o0].[CityOfBirthName], [o0].[FullName], [o0].[HasSoulPatch], [o0].[LeaderNickname], [o0].[LeaderSquadId], [o0].[Rank], N'Officer' AS [Discriminator] FROM [Officers] AS [o0] -) 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].[Id], [l0].[Name], [t].[Nickname], [t].[SquadId], [t0].[Nickname]"); } @@ -4850,7 +4850,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] @@ -4951,7 +4951,7 @@ FROM [Officers] AS [o] 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 [t0] ON [t].[FullName] = [t0].[OwnerFullName] WHERE [t].[Nickname] <> N'Marcus' ORDER BY [t].[Nickname], [t].[SquadId]"); @@ -4973,7 +4973,7 @@ FROM [Officers] AS [o] 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 [t0] ON [t].[FullName] = [t0].[OwnerFullName] WHERE [t].[Nickname] <> N'Marcus' ORDER BY [t].[Nickname], [t].[SquadId]"); @@ -4995,7 +4995,7 @@ FROM [Officers] AS [o] 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 [t0] ON [t].[FullName] = [t0].[OwnerFullName] WHERE [t].[Nickname] <> N'Marcus' ORDER BY [t].[Nickname], [t].[SquadId]"); @@ -5017,7 +5017,7 @@ FROM [Officers] AS [o] 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 [t0] ON [t].[FullName] = [t0].[OwnerFullName] WHERE [t].[Nickname] <> N'Marcus' ORDER BY [t].[Nickname], [t].[SquadId], [t0].[Name] DESC"); @@ -5064,7 +5064,7 @@ FROM [Officers] AS [o] 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 [t0] ON [t].[FullName] = [t0].[OwnerFullName] WHERE [t].[Nickname] <> N'Marcus' ORDER BY [t].[Nickname], [t].[SquadId]"); @@ -5086,7 +5086,7 @@ FROM [Officers] AS [o] 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 [t0] ON [t].[FullName] = [t0].[OwnerFullName] WHERE [t].[Nickname] <> N'Marcus' ORDER BY [t].[Nickname], [t].[SquadId]"); @@ -5108,7 +5108,7 @@ FROM [Officers] AS [o] 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 [t0] ON [t].[FullName] = [t0].[OwnerFullName] WHERE [t].[Nickname] <> N'Marcus' ORDER BY [t].[Nickname], [t].[SquadId]"); @@ -5240,7 +5240,7 @@ FROM [Officers] AS [o0] 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 [t2] ON [t0].[FullName] = [t2].[OwnerFullName] WHERE [t0].[FullName] <> N'Foo' ) AS [t1] ON [t].[Nickname] = [t1].[LeaderNickname] AND [t].[SquadId] = [t1].[LeaderSquadId] @@ -5456,7 +5456,7 @@ LEFT JOIN ( SELECT [w].[Id], [w].[AmmunitionType], [w].[IsAutomatic], [w].[Name], [w].[OwnerFullName], [w].[SynergyWithId], [t4].[Nickname], [t4].[SquadId], ( SELECT COUNT(*) FROM [Weapons] AS [w0] - WHERE [t4].[FullName] IS NOT NULL AND [t4].[FullName] = [w0].[OwnerFullName]) AS [c] + WHERE ([t4].[FullName] IS NOT NULL) AND [t4].[FullName] = [w0].[OwnerFullName]) AS [c] FROM [Weapons] AS [w] LEFT JOIN ( SELECT [g0].[Nickname], [g0].[SquadId], [g0].[FullName] @@ -5525,7 +5525,7 @@ UNION ALL SELECT [o3].[Nickname], [o3].[SquadId], [o3].[HasSoulPatch] FROM [Officers] AS [o3] ) AS [t7] ON [s].[Id] = [t7].[SquadId] - WHERE [w].[Name] <> N'Bar' OR [w].[Name] IS NULL + WHERE [w].[Name] <> N'Bar' OR ([w].[Name] IS NULL) ) AS [t5] ON [t4].[FullName] = [t5].[OwnerFullName] WHERE [t4].[FullName] <> N'Foo' ) AS [t3] ON [t].[Nickname] = [t3].[LeaderNickname] AND [t].[SquadId] = [t3].[LeaderSquadId] @@ -5623,7 +5623,7 @@ FROM [Officers] AS [o0] OUTER APPLY ( SELECT [w].[Name], [t0].[Nickname], [w].[Id] FROM [Weapons] AS [w] - WHERE [t0].[FullName] = [w].[OwnerFullName] AND ([w].[Name] <> N'Bar' OR [w].[Name] IS NULL) + WHERE [t0].[FullName] = [w].[OwnerFullName] AND ([w].[Name] <> N'Bar' OR ([w].[Name] IS NULL)) ) AS [t2] WHERE [t0].[FullName] <> N'Foo' ) AS [t1] ON [t].[Nickname] = [t1].[LeaderNickname] AND [t].[SquadId] = [t1].[LeaderSquadId] @@ -5652,7 +5652,7 @@ FROM [Officers] AS [o0] LEFT JOIN ( SELECT [w].[Name], [t].[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 [t2] ON [t0].[FullName] = [t2].[OwnerFullName] WHERE [t].[Nickname] = [t0].[LeaderNickname] AND [t].[SquadId] = [t0].[LeaderSquadId] AND [t0].[FullName] <> N'Foo' ) AS [t1] @@ -5676,7 +5676,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 [t0] ON [t].[FullName] = [t0].[OwnerFullName] LEFT JOIN ( SELECT [t2].[Nickname], [t2].[SquadId], [t2].[AssignedCityName], [t2].[CityOfBirthName], [t2].[FullName], [t2].[HasSoulPatch], [t2].[LeaderNickname], [t2].[LeaderSquadId], [t2].[Rank], [t2].[Discriminator] @@ -5841,7 +5841,7 @@ FROM [Gears] AS [g] UNION ALL SELECT [o0].[Nickname], [o0].[SquadId], [o0].[FullName], [o0].[LeaderNickname], [o0].[LeaderSquadId] FROM [Officers] AS [o0] -) 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]"); } @@ -6210,7 +6210,7 @@ UNION ALL SELECT [o].[Nickname], [o].[SquadId], [o].[AssignedCityName], [o].[CityOfBirthName], [o].[FullName], [o].[HasSoulPatch], [o].[LeaderNickname], [o].[LeaderSquadId], [o].[Rank], N'Officer' AS [Discriminator] FROM [Officers] AS [o] ) AS [t0] ON [t].[DefeatedByNickname] = [t0].[Nickname] AND [t].[DefeatedBySquadId] = [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))) ORDER BY [t1].[Note] ) AS [t2] LEFT JOIN [Weapons] AS [w] ON [t2].[FullName] = [w].[OwnerFullName] @@ -7394,7 +7394,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]"); } @@ -7418,7 +7418,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"); } @@ -7432,7 +7432,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"); } @@ -7882,7 +7882,7 @@ UNION ALL SELECT [o].[Nickname], [o].[SquadId] FROM [Officers] AS [o] ) AS [t0] ON [t].[GearNickName] = [t0].[Nickname] AND [t].[GearSquadId] = [t0].[SquadId] -WHERE SUBSTRING([t].[Note], 0 + 1, [t0].[SquadId]) = [t].[GearNickName] OR (([t].[Note] IS NULL OR [t0].[SquadId] IS NULL) AND [t].[GearNickName] IS NULL)"); +WHERE SUBSTRING([t].[Note], 0 + 1, [t0].[SquadId]) = [t].[GearNickName] OR ((([t].[Note] IS NULL) OR ([t0].[SquadId] IS NULL)) AND ([t].[GearNickName] IS NULL))"); } public override async Task @@ -7902,7 +7902,7 @@ UNION ALL FROM [Officers] AS [o] ) 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) @@ -7934,7 +7934,7 @@ FROM [Officers] AS [o] ) AS [t] LEFT JOIN [Tags] AS [t0] ON [t].[Nickname] = [t0].[GearNickName] AND [t].[SquadId] = [t0].[GearSquadId] LEFT JOIN [Tags] AS [t1] ON [t].[Nickname] = [t1].[GearNickName] AND [t].[SquadId] = [t1].[GearSquadId] -WHERE ([t0].[Note] <> N'Foo' OR [t0].[Note] IS NULL) AND ([t1].[Note] <> N'Bar' OR [t1].[Note] IS NULL)"); +WHERE ([t0].[Note] <> N'Foo' OR ([t0].[Note] IS NULL)) AND ([t1].[Note] <> N'Bar' OR ([t1].[Note] IS NULL))"); } public override async Task OfTypeNav2(bool async) @@ -7949,7 +7949,7 @@ FROM [Officers] AS [o] ) AS [t] LEFT JOIN [Tags] AS [t0] ON [t].[Nickname] = [t0].[GearNickName] AND [t].[SquadId] = [t0].[GearSquadId] LEFT JOIN [Cities] AS [c] ON [t].[AssignedCityName] = [c].[Name] -WHERE ([t0].[Note] <> N'Foo' OR [t0].[Note] IS NULL) AND ([c].[Location] <> 'Bar' OR [c].[Location] IS NULL)"); +WHERE ([t0].[Note] <> N'Foo' OR ([t0].[Note] IS NULL)) AND ([c].[Location] <> 'Bar' OR ([c].[Location] IS NULL))"); } public override async Task OfTypeNav3(bool async) @@ -7965,7 +7965,7 @@ FROM [Officers] AS [o] LEFT JOIN [Tags] AS [t0] ON [t].[Nickname] = [t0].[GearNickName] AND [t].[SquadId] = [t0].[GearSquadId] INNER JOIN [Weapons] AS [w] ON [t].[FullName] = [w].[OwnerFullName] LEFT JOIN [Tags] AS [t1] ON [t].[Nickname] = [t1].[GearNickName] AND [t].[SquadId] = [t1].[GearSquadId] -WHERE ([t0].[Note] <> N'Foo' OR [t0].[Note] IS NULL) AND ([t1].[Note] <> N'Bar' OR [t1].[Note] IS NULL)"); +WHERE ([t0].[Note] <> N'Foo' OR ([t0].[Note] IS NULL)) AND ([t1].[Note] <> N'Bar' OR ([t1].[Note] IS NULL))"); } public override async Task Nav_rewrite_Distinct_with_convert() @@ -7991,7 +7991,7 @@ public override async Task Nav_rewrite_with_convert1(bool async) FROM [LocustHordes] AS [l] LEFT JOIN [Cities] AS [c] ON [l].[CapitalName] = [c].[Name] LEFT JOIN [LocustCommanders] AS [l0] ON [l].[CommanderName] = [l0].[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) @@ -8003,7 +8003,7 @@ public override async Task Nav_rewrite_with_convert2(bool async) FROM [LocustHordes] AS [l] LEFT JOIN [Cities] AS [c] ON [l].[CapitalName] = [c].[Name] LEFT JOIN [LocustCommanders] AS [l0] ON [l].[CommanderName] = [l0].[Name] -WHERE ([c].[Name] <> N'Foo' OR [c].[Name] IS NULL) AND ([l0].[Name] <> N'Bar' OR [l0].[Name] IS NULL)"); +WHERE ([c].[Name] <> N'Foo' OR ([c].[Name] IS NULL)) AND ([l0].[Name] <> N'Bar' OR ([l0].[Name] IS NULL))"); } public override async Task Nav_rewrite_with_convert3(bool async) @@ -8015,7 +8015,7 @@ public override async Task Nav_rewrite_with_convert3(bool async) FROM [LocustHordes] AS [l] LEFT JOIN [Cities] AS [c] ON [l].[CapitalName] = [c].[Name] LEFT JOIN [LocustCommanders] AS [l0] ON [l].[CommanderName] = [l0].[Name] -WHERE ([c].[Name] <> N'Foo' OR [c].[Name] IS NULL) AND ([l0].[Name] <> N'Bar' OR [l0].[Name] IS NULL)"); +WHERE ([c].[Name] <> N'Foo' OR ([c].[Name] IS NULL)) AND ([l0].[Name] <> N'Bar' OR ([l0].[Name] IS NULL))"); } public override async Task Where_contains_on_navigation_with_composite_keys(bool async) @@ -8170,7 +8170,7 @@ public override async Task Left_join_projection_using_conditional_tracking(bool AssertSql( @"SELECT CASE - WHEN [t0].[Nickname] IS NULL OR [t0].[SquadId] IS NULL THEN CAST(1 AS bit) + WHEN ([t0].[Nickname] IS NULL) OR ([t0].[SquadId] IS NULL) THEN CAST(1 AS bit) ELSE CAST(0 AS bit) END, [t].[Nickname], [t].[SquadId], [t].[AssignedCityName], [t].[CityOfBirthName], [t].[FullName], [t].[HasSoulPatch], [t].[LeaderNickname], [t].[LeaderSquadId], [t].[Rank], [t].[Discriminator], [t0].[Nickname], [t0].[SquadId], [t0].[AssignedCityName], [t0].[CityOfBirthName], [t0].[FullName], [t0].[HasSoulPatch], [t0].[LeaderNickname], [t0].[LeaderSquadId], [t0].[Rank], [t0].[Discriminator] FROM ( @@ -8216,7 +8216,7 @@ FROM [Officers] AS [o0] ) AS [t3] ) 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]"); } @@ -8241,7 +8241,7 @@ FROM [Gears] AS [g0] UNION ALL SELECT [o0].[Nickname], [o0].[SquadId], [o0].[AssignedCityName], [o0].[CityOfBirthName], [o0].[FullName], [o0].[HasSoulPatch], [o0].[LeaderNickname], [o0].[LeaderSquadId], [o0].[Rank], N'Officer' AS [Discriminator] FROM [Officers] AS [o0] -) 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]"); } @@ -8259,7 +8259,7 @@ FROM [Gears] AS [g] UNION ALL SELECT [o].[Nickname], [o].[SquadId], [o].[AssignedCityName], [o].[CityOfBirthName], [o].[FullName], [o].[HasSoulPatch], [o].[LeaderNickname], [o].[LeaderSquadId], [o].[Rank], N'Officer' AS [Discriminator] FROM [Officers] AS [o] -) AS [t0] ON [t].[GearNickName] = [t0].[Nickname] AND [t].[GearSquadId] = [t0].[SquadId] AND [t].[Note] IS NOT NULL +) AS [t0] ON [t].[GearNickName] = [t0].[Nickname] AND [t].[GearSquadId] = [t0].[SquadId] AND ([t].[Note] IS NOT NULL) ORDER BY [t].[Id], [t0].[Nickname]"); } @@ -8398,7 +8398,7 @@ public override async Task Navigation_based_on_complex_expression6(bool async) AssertSql( @"SELECT CASE - WHEN [l0].[Name] = N'Queen Myrrah' AND [l0].[Name] IS NOT NULL THEN CAST(1 AS bit) + WHEN [l0].[Name] = N'Queen Myrrah' AND ([l0].[Name] IS NOT NULL) THEN CAST(1 AS bit) ELSE CAST(0 AS bit) END, [l0].[Name], [l0].[LocustHordeId], [l0].[ThreatLevel], [l0].[ThreatLevelByte], [l0].[ThreatLevelNullableByte], [l0].[DefeatedByNickname], [l0].[DefeatedBySquadId], [l0].[HighCommandId], [t].[Name], [t].[LocustHordeId], [t].[ThreatLevel], [t].[ThreatLevelByte], [t].[ThreatLevelNullableByte], [t].[DefeatedByNickname], [t].[DefeatedBySquadId], [t].[HighCommandId], [t].[Discriminator] FROM [LocustHordes] AS [l] @@ -8507,7 +8507,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] @@ -8987,7 +8987,7 @@ UNION ALL FROM [Officers] AS [o] ) AS [t] INNER JOIN [Cities] AS [c0] ON [t].[CityOfBirthName] = [c0].[Name] - ORDER BY [t].[Nickname]) OR ([c].[Name] IS NULL AND ( + ORDER BY [t].[Nickname]) OR (([c].[Name] IS NULL) AND (( SELECT TOP(1) [c0].[Name] FROM ( SELECT [g].[Nickname], [g].[SquadId], [g].[AssignedCityName], [g].[CityOfBirthName], [g].[FullName], [g].[HasSoulPatch], [g].[LeaderNickname], [g].[LeaderSquadId], [g].[Rank], N'Gear' AS [Discriminator] @@ -8997,7 +8997,7 @@ UNION ALL FROM [Officers] AS [o] ) AS [t] INNER JOIN [Cities] AS [c0] ON [t].[CityOfBirthName] = [c0].[Name] - ORDER BY [t].[Nickname]) IS NULL)"); + ORDER BY [t].[Nickname]) IS NULL))"); } public override async Task Bitwise_operation_with_non_null_parameter_optimizes_null_checks(bool async) @@ -9070,7 +9070,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) @@ -9252,10 +9252,10 @@ WHERE CASE WHEN ( SELECT TOP(1) [w].[Name] FROM [Weapons] AS [w] - WHERE [w].[Id] = [t].[SquadId]) = @__prm2_1 AND ( + WHERE [w].[Id] = [t].[SquadId]) = @__prm2_1 AND (( SELECT TOP(1) [w].[Name] FROM [Weapons] AS [w] - WHERE [w].[Id] = [t].[SquadId]) IS NOT NULL THEN CAST(1 AS bit) + WHERE [w].[Id] = [t].[SquadId]) IS NOT NULL) THEN CAST(1 AS bit) ELSE CAST(0 AS bit) END ELSE CAST(0 AS bit) @@ -9526,7 +9526,7 @@ UNION ALL SELECT [l2].[Name], [l2].[LocustHordeId], [l2].[ThreatLevel], [l2].[ThreatLevelByte], [l2].[ThreatLevelNullableByte], [l2].[DefeatedByNickname], [l2].[DefeatedBySquadId], [l2].[HighCommandId], N'LocustCommander' AS [Discriminator] FROM [LocustCommanders] AS [l2] ) AS [t0] - WHERE [t0].[ThreatLevelNullableByte] = [t].[ThreatLevelNullableByte] OR ([t0].[ThreatLevelNullableByte] IS NULL AND [t].[ThreatLevelNullableByte] IS NULL))"); + WHERE [t0].[ThreatLevelNullableByte] = [t].[ThreatLevelNullableByte] OR (([t0].[ThreatLevelNullableByte] IS NULL) AND ([t].[ThreatLevelNullableByte] IS NULL)))"); } public override async Task Contains_on_collection_of_nullable_byte_subquery_null_constant(bool async) @@ -9699,7 +9699,7 @@ UNION ALL SELECT [l2].[Name], [l2].[LocustHordeId], [l2].[ThreatLevel], [l2].[ThreatLevelByte], [l2].[ThreatLevelNullableByte], [l2].[DefeatedByNickname], [l2].[DefeatedBySquadId], [l2].[HighCommandId], N'LocustCommander' AS [Discriminator] FROM [LocustCommanders] AS [l2] ) AS [t2] - WHERE [t2].[ThreatLevelNullableByte] = [t].[ThreatLevelNullableByte] OR ([t2].[ThreatLevelNullableByte] IS NULL AND [t].[ThreatLevelNullableByte] IS NULL)) + WHERE [t2].[ThreatLevelNullableByte] = [t].[ThreatLevelNullableByte] OR (([t2].[ThreatLevelNullableByte] IS NULL) AND ([t].[ThreatLevelNullableByte] IS NULL))) ) AS [t1]"); } @@ -9734,7 +9734,7 @@ UNION ALL SELECT [l2].[Name], [l2].[LocustHordeId], [l2].[ThreatLevel], [l2].[ThreatLevelByte], [l2].[ThreatLevelNullableByte], [l2].[DefeatedByNickname], [l2].[DefeatedBySquadId], [l2].[HighCommandId], N'LocustCommander' AS [Discriminator] FROM [LocustCommanders] AS [l2] ) AS [t2] - WHERE [t2].[ThreatLevelNullableByte] = [t].[ThreatLevelNullableByte] OR ([t2].[ThreatLevelNullableByte] IS NULL AND [t].[ThreatLevelNullableByte] IS NULL))) + WHERE [t2].[ThreatLevelNullableByte] = [t].[ThreatLevelNullableByte] OR (([t2].[ThreatLevelNullableByte] IS NULL) AND ([t].[ThreatLevelNullableByte] IS NULL)))) ) AS [t1]"); } @@ -9812,7 +9812,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] @@ -9880,7 +9880,7 @@ UNION ALL SELECT [o].[Nickname], [o].[SquadId], [o].[AssignedCityName], [o].[CityOfBirthName], [o].[FullName], [o].[HasSoulPatch], [o].[LeaderNickname], [o].[LeaderSquadId], [o].[Rank], N'Officer' AS [Discriminator] FROM [Officers] AS [o] ) AS [t] -INNER JOIN [Weapons] AS [w] ON [t].[FullName] <> [w].[OwnerFullName] OR [w].[OwnerFullName] IS NULL +INNER JOIN [Weapons] AS [w] ON [t].[FullName] <> [w].[OwnerFullName] OR ([w].[OwnerFullName] IS NULL) ORDER BY [t].[Nickname], [w].[Id]"); } @@ -9897,7 +9897,7 @@ UNION ALL SELECT [o].[Nickname], [o].[SquadId], [o].[AssignedCityName], [o].[CityOfBirthName], [o].[FullName], [o].[HasSoulPatch], [o].[LeaderNickname], [o].[LeaderSquadId], [o].[Rank], N'Officer' AS [Discriminator] FROM [Officers] AS [o] ) AS [t] -LEFT JOIN [Weapons] AS [w] ON [t].[FullName] <> [w].[OwnerFullName] OR [w].[OwnerFullName] IS NULL +LEFT JOIN [Weapons] AS [w] ON [t].[FullName] <> [w].[OwnerFullName] OR ([w].[OwnerFullName] IS NULL) ORDER BY [t].[Nickname], [w].[Id]"); } @@ -9919,7 +9919,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 [t0] ON [t].[FullName] <> [t0].[OwnerFullName] OR [t0].[OwnerFullName] IS NULL +) AS [t0] ON [t].[FullName] <> [t0].[OwnerFullName] OR ([t0].[OwnerFullName] IS NULL) ORDER BY [t].[Nickname], [t0].[Id]"); } @@ -9936,7 +9936,7 @@ UNION ALL SELECT [o].[FullName] FROM [Officers] AS [o] ) AS [t] -LEFT JOIN [Weapons] AS [w] ON [t].[FullName] <> [w].[OwnerFullName] OR [w].[OwnerFullName] IS NULL"); +LEFT JOIN [Weapons] AS [w] ON [t].[FullName] <> [w].[OwnerFullName] OR ([w].[OwnerFullName] IS NULL)"); } public override async Task Filtered_collection_projection_with_order_comparison_predicate_converted_to_join(bool async) @@ -10006,7 +10006,7 @@ FROM [Officers] AS [o] CROSS APPLY ( SELECT TOP(3) [w].[Id], [w].[AmmunitionType], [w].[IsAutomatic], [w].[Name], [w].[OwnerFullName], [w].[SynergyWithId] FROM [Weapons] AS [w] - WHERE [w].[OwnerFullName] <> [t].[FullName] OR [w].[OwnerFullName] IS NULL + WHERE [w].[OwnerFullName] <> [t].[FullName] OR ([w].[OwnerFullName] IS NULL) ORDER BY [w].[Id] ) AS [t0] ORDER BY [t].[Nickname], [t0].[Id]"); @@ -10068,7 +10068,7 @@ UNION ALL SELECT [l0].[Name], [l0].[LocustHordeId], [l0].[ThreatLevel], [l0].[ThreatLevelByte], [l0].[ThreatLevelNullableByte], [l0].[DefeatedByNickname], [l0].[DefeatedBySquadId], [l0].[HighCommandId], N'LocustCommander' AS [Discriminator] FROM [LocustCommanders] AS [l0] ) AS [t] -WHERE [t].[Discriminator] = N'LocustCommander' AND ([t].[HighCommandId] <> 0 OR [t].[HighCommandId] IS NULL)", +WHERE [t].[Discriminator] = N'LocustCommander' AND ([t].[HighCommandId] <> 0 OR ([t].[HighCommandId] IS NULL))", // @"SELECT [t].[Name], [t].[LocustHordeId], [t].[ThreatLevel], [t].[ThreatLevelByte], [t].[ThreatLevelNullableByte], [t].[DefeatedByNickname], [t].[DefeatedBySquadId], [t].[HighCommandId], [t].[Discriminator] FROM ( @@ -10078,7 +10078,7 @@ UNION ALL SELECT [l0].[Name], [l0].[LocustHordeId], [l0].[ThreatLevel], [l0].[ThreatLevelByte], [l0].[ThreatLevelNullableByte], [l0].[DefeatedByNickname], [l0].[DefeatedBySquadId], [l0].[HighCommandId], N'LocustCommander' AS [Discriminator] FROM [LocustCommanders] AS [l0] ) AS [t] -WHERE [t].[Discriminator] = N'LocustCommander' AND ([t].[HighCommandId] <> 0 OR [t].[HighCommandId] IS NULL)"); +WHERE [t].[Discriminator] = N'LocustCommander' AND ([t].[HighCommandId] <> 0 OR ([t].[HighCommandId] IS NULL))"); } public override async Task Cast_to_derived_followed_by_include_and_FirstOrDefault(bool async) @@ -10224,7 +10224,7 @@ UNION ALL SELECT [o].[Nickname], [o].[SquadId] FROM [Officers] AS [o] ) AS [t0] ON [t].[DefeatedByNickname] = [t0].[Nickname] AND [t].[DefeatedBySquadId] = [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 Composite_key_entity_not_equal_null(bool async) @@ -10244,7 +10244,7 @@ UNION ALL SELECT [o].[Nickname], [o].[SquadId] FROM [Officers] AS [o] ) AS [t0] ON [t].[DefeatedByNickname] = [t0].[Nickname] AND [t].[DefeatedBySquadId] = [t0].[SquadId] -WHERE [t0].[Nickname] IS NOT NULL AND [t0].[SquadId] IS NOT NULL"); +WHERE ([t0].[Nickname] IS NOT NULL) AND ([t0].[SquadId] IS NOT NULL)"); } public override async Task Projecting_property_converted_to_nullable_with_comparison(bool async) @@ -10322,7 +10322,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 @@ -10478,10 +10478,10 @@ UNION ALL SELECT [o].[Nickname], [o].[SquadId], [o].[HasSoulPatch] FROM [Officers] AS [o] ) 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) @@ -10502,7 +10502,7 @@ UNION ALL FROM [Officers] AS [o] ) AS [t] LEFT JOIN [Tags] AS [t0] ON [t].[Nickname] = [t0].[GearNickName] AND [t].[SquadId] = [t0].[GearSquadId] -WHERE DATEPART(month, [t0].[IssueDate]) <> 5 OR [t0].[IssueDate] IS NULL +WHERE DATEPART(month, [t0].[IssueDate]) <> 5 OR ([t0].[IssueDate] IS NULL) ORDER BY [t].[Nickname]"); } @@ -10702,7 +10702,7 @@ public override async Task Project_navigation_defined_on_derived_from_entity_wit AssertSql( @"SELECT [t].[Name], [t].[LocustHordeId], [t].[ThreatLevel], [t].[ThreatLevelByte], [t].[ThreatLevelNullableByte], [t].[DefeatedByNickname], [t].[DefeatedBySquadId], [t].[HighCommandId], [t].[Discriminator], [t0].[Nickname], [t0].[SquadId], [t0].[AssignedCityName], [t0].[CityOfBirthName], [t0].[FullName], [t0].[HasSoulPatch], [t0].[LeaderNickname], [t0].[LeaderSquadId], [t0].[Rank], [t0].[Discriminator], CASE - WHEN [t0].[Nickname] IS NULL OR [t0].[SquadId] IS NULL THEN CAST(1 AS bit) + WHEN ([t0].[Nickname] IS NULL) OR ([t0].[SquadId] IS NULL) THEN CAST(1 AS bit) ELSE CAST(0 AS bit) END AS [IsNull], [l].[Id], [l].[CapitalName], [l].[Name], [l].[ServerAddress], [l].[CommanderName], [l].[Eradicated], CASE WHEN [l].[Id] IS NULL THEN CAST(1 AS bit) diff --git a/test/EFCore.SqlServer.FunctionalTests/Query/TPCManyToManyNoTrackingQuerySqlServerTest.cs b/test/EFCore.SqlServer.FunctionalTests/Query/TPCManyToManyNoTrackingQuerySqlServerTest.cs index 9c347fcc87e..c770174e779 100644 --- a/test/EFCore.SqlServer.FunctionalTests/Query/TPCManyToManyNoTrackingQuerySqlServerTest.cs +++ b/test/EFCore.SqlServer.FunctionalTests/Query/TPCManyToManyNoTrackingQuerySqlServerTest.cs @@ -106,7 +106,7 @@ UNION ALL SELECT [l].[Id], [l].[Name], [l].[Number], [l].[IsGreen], N'EntityLeaf' AS [Discriminator] FROM [Leaves] AS [l] ) 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) @@ -1974,7 +1974,7 @@ UNION ALL SELECT [u2].[Id], [u2].[Name], [u2].[Number], [u2].[IsGreen], N'UnidirectionalEntityLeaf' AS [Discriminator] FROM [UnidirectionalLeaves] AS [u2] ) AS [t] ON [u0].[UnidirectionalEntityBranchId] = [t].[Id] - WHERE [u].[Id] = [u0].[UnidirectionalEntityOneId] AND [t].[Name] IS NOT NULL AND ([t].[Name] LIKE N'L%')), [u].[Id]"); + WHERE [u].[Id] = [u0].[UnidirectionalEntityOneId] AND ([t].[Name] IS NOT NULL) AND ([t].[Name] LIKE N'L%')), [u].[Id]"); } public override async Task Skip_navigation_select_subquery_average_unidirectional(bool async) diff --git a/test/EFCore.SqlServer.FunctionalTests/Query/TPCManyToManyQuerySqlServerTest.cs b/test/EFCore.SqlServer.FunctionalTests/Query/TPCManyToManyQuerySqlServerTest.cs index 7b12e3c2ed3..ac4b1acb85c 100644 --- a/test/EFCore.SqlServer.FunctionalTests/Query/TPCManyToManyQuerySqlServerTest.cs +++ b/test/EFCore.SqlServer.FunctionalTests/Query/TPCManyToManyQuerySqlServerTest.cs @@ -106,7 +106,7 @@ UNION ALL SELECT [l].[Id], [l].[Name], [l].[Number], [l].[IsGreen], N'EntityLeaf' AS [Discriminator] FROM [Leaves] AS [l] ) 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) @@ -1973,7 +1973,7 @@ UNION ALL SELECT [u2].[Id], [u2].[Name], [u2].[Number], [u2].[IsGreen], N'UnidirectionalEntityLeaf' AS [Discriminator] FROM [UnidirectionalLeaves] AS [u2] ) AS [t] ON [u0].[UnidirectionalEntityBranchId] = [t].[Id] - WHERE [u].[Id] = [u0].[UnidirectionalEntityOneId] AND [t].[Name] IS NOT NULL AND ([t].[Name] LIKE N'L%')), [u].[Id]"); + WHERE [u].[Id] = [u0].[UnidirectionalEntityOneId] AND ([t].[Name] IS NOT NULL) AND ([t].[Name] LIKE N'L%')), [u].[Id]"); } public override async Task Skip_navigation_select_subquery_average_unidirectional(bool async) diff --git a/test/EFCore.SqlServer.FunctionalTests/Query/TPCRelationshipsQuerySqlServerTest.cs b/test/EFCore.SqlServer.FunctionalTests/Query/TPCRelationshipsQuerySqlServerTest.cs index c24b2bf86cc..1becf8b3a5b 100644 --- a/test/EFCore.SqlServer.FunctionalTests/Query/TPCRelationshipsQuerySqlServerTest.cs +++ b/test/EFCore.SqlServer.FunctionalTests/Query/TPCRelationshipsQuerySqlServerTest.cs @@ -110,7 +110,7 @@ FROM [DerivedEntities] AS [d1] LEFT JOIN [OwnedCollections] AS [o0] ON [t].[Id] = [o0].[BaseInheritanceRelationshipEntityId] LEFT JOIN [DerivedEntities_OwnedCollectionOnDerived] AS [d0] ON [t].[Id] = [d0].[DerivedInheritanceRelationshipEntityId] LEFT JOIN [CollectionsOnBase] AS [c] ON [t].[Id] = [c].[ParentId] -WHERE [t].[Name] <> N'Bar' OR [t].[Name] IS NULL +WHERE [t].[Name] <> N'Bar' OR ([t].[Name] IS NULL) ORDER BY [t].[Id], [o].[BaseInheritanceRelationshipEntityId], [d].[Id], [o0].[BaseInheritanceRelationshipEntityId], [o0].[Id], [d0].[DerivedInheritanceRelationshipEntityId], [d0].[Id]"); } @@ -132,7 +132,7 @@ FROM [DerivedEntities] AS [d1] LEFT JOIN [DerivedEntities] AS [d] ON [t].[Id] = [d].[Id] LEFT JOIN [OwnedCollections] AS [o0] ON [t].[Id] = [o0].[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], [o].[BaseInheritanceRelationshipEntityId], [d].[Id], [o0].[BaseInheritanceRelationshipEntityId], [o0].[Id], [d0].[DerivedInheritanceRelationshipEntityId]"); } @@ -288,7 +288,7 @@ UNION ALL SELECT [d2].[Id], [d2].[BaseParentId], [d2].[Name], [d2].[DerivedProperty], N'DerivedCollectionOnBase' AS [Discriminator] FROM [DerivedCollectionsOnBase] AS [d2] ) AS [t0] ON [t].[Id] = [t0].[BaseParentId] -WHERE [t].[Name] <> N'Bar' OR [t].[Name] IS NULL +WHERE [t].[Name] <> N'Bar' OR ([t].[Name] IS NULL) ORDER BY [t].[Id], [o].[BaseInheritanceRelationshipEntityId], [d].[Id], [o0].[BaseInheritanceRelationshipEntityId], [o0].[Id], [d0].[DerivedInheritanceRelationshipEntityId], [d0].[Id]"); } @@ -316,7 +316,7 @@ FROM [DerivedEntities] AS [d2] LEFT JOIN [DerivedEntities] AS [d] ON [t0].[Id] = [d].[Id] LEFT JOIN [OwnedCollections] AS [o0] ON [t0].[Id] = [o0].[BaseInheritanceRelationshipEntityId] LEFT JOIN [DerivedEntities_OwnedCollectionOnDerived] AS [d0] ON [t0].[Id] = [d0].[DerivedInheritanceRelationshipEntityId] -WHERE [t].[Name] <> N'Bar' OR [t].[Name] IS NULL +WHERE [t].[Name] <> N'Bar' OR ([t].[Name] IS NULL) ORDER BY [t].[Id], [t0].[Id], [o].[BaseInheritanceRelationshipEntityId], [d].[Id], [o0].[BaseInheritanceRelationshipEntityId], [o0].[Id], [d0].[DerivedInheritanceRelationshipEntityId]"); } @@ -422,7 +422,7 @@ FROM [DerivedEntities] AS [d1] LEFT JOIN [DerivedEntities] AS [d] ON [t].[Id] = [d].[Id] LEFT JOIN [OwnedCollections] AS [o0] ON [t].[Id] = [o0].[BaseInheritanceRelationshipEntityId] LEFT JOIN [DerivedEntities_OwnedCollectionOnDerived] AS [d0] ON [t].[Id] = [d0].[DerivedInheritanceRelationshipEntityId] -WHERE [t].[Name] <> N'Bar' OR [t].[Name] IS NULL +WHERE [t].[Name] <> N'Bar' OR ([t].[Name] IS NULL) ORDER BY [t].[Id], [r].[Id], [o].[BaseInheritanceRelationshipEntityId], [d].[Id], [o0].[BaseInheritanceRelationshipEntityId], [o0].[Id], [d0].[DerivedInheritanceRelationshipEntityId]"); } @@ -444,7 +444,7 @@ FROM [DerivedEntities] AS [d1] LEFT JOIN [DerivedEntities] AS [d] ON [t].[Id] = [d].[Id] LEFT JOIN [OwnedCollections] AS [o0] ON [t].[Id] = [o0].[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], [o].[BaseInheritanceRelationshipEntityId], [d].[Id], [o0].[BaseInheritanceRelationshipEntityId], [o0].[Id], [d0].[DerivedInheritanceRelationshipEntityId]"); } @@ -566,7 +566,7 @@ FROM [DerivedReferencesOnBase] AS [d1] LEFT JOIN [OwnedReferences] AS [o] ON [d].[Id] = [o].[BaseInheritanceRelationshipEntityId] LEFT JOIN [OwnedCollections] AS [o0] ON [d].[Id] = [o0].[BaseInheritanceRelationshipEntityId] LEFT JOIN [DerivedEntities_OwnedCollectionOnDerived] AS [d0] ON [d].[Id] = [d0].[DerivedInheritanceRelationshipEntityId] -WHERE [d].[Name] <> N'Bar' OR [d].[Name] IS NULL +WHERE [d].[Name] <> N'Bar' OR ([d].[Name] IS NULL) ORDER BY [d].[Id], [t].[Id], [o].[BaseInheritanceRelationshipEntityId], [o0].[BaseInheritanceRelationshipEntityId], [o0].[Id], [d0].[DerivedInheritanceRelationshipEntityId]"); } @@ -587,7 +587,7 @@ FROM [DerivedReferencesOnDerived] AS [d1] LEFT JOIN [OwnedReferences] AS [o] ON [d].[Id] = [o].[BaseInheritanceRelationshipEntityId] LEFT JOIN [OwnedCollections] AS [o0] ON [d].[Id] = [o0].[BaseInheritanceRelationshipEntityId] LEFT JOIN [DerivedEntities_OwnedCollectionOnDerived] AS [d0] ON [d].[Id] = [d0].[DerivedInheritanceRelationshipEntityId] -WHERE [d].[Name] <> N'Bar' OR [d].[Name] IS NULL +WHERE [d].[Name] <> N'Bar' OR ([d].[Name] IS NULL) ORDER BY [d].[Id], [t].[Id], [o].[BaseInheritanceRelationshipEntityId], [o0].[BaseInheritanceRelationshipEntityId], [o0].[Id], [d0].[DerivedInheritanceRelationshipEntityId]"); } @@ -602,7 +602,7 @@ FROM [DerivedEntities] AS [d] LEFT JOIN [OwnedReferences] AS [o] ON [d].[Id] = [o].[BaseInheritanceRelationshipEntityId] LEFT JOIN [OwnedCollections] AS [o0] ON [d].[Id] = [o0].[BaseInheritanceRelationshipEntityId] LEFT JOIN [DerivedEntities_OwnedCollectionOnDerived] AS [d1] ON [d].[Id] = [d1].[DerivedInheritanceRelationshipEntityId] -WHERE [d].[Name] <> N'Bar' OR [d].[Name] IS NULL +WHERE [d].[Name] <> N'Bar' OR ([d].[Name] IS NULL) ORDER BY [d].[Id], [d0].[Id], [o].[BaseInheritanceRelationshipEntityId], [o0].[BaseInheritanceRelationshipEntityId], [o0].[Id], [d1].[DerivedInheritanceRelationshipEntityId]"); } @@ -623,7 +623,7 @@ FROM [DerivedReferencesOnDerived] AS [d1] LEFT JOIN [OwnedReferences] AS [o] ON [d].[Id] = [o].[BaseInheritanceRelationshipEntityId] LEFT JOIN [OwnedCollections] AS [o0] ON [d].[Id] = [o0].[BaseInheritanceRelationshipEntityId] LEFT JOIN [DerivedEntities_OwnedCollectionOnDerived] AS [d0] ON [d].[Id] = [d0].[DerivedInheritanceRelationshipEntityId] -WHERE [t].[Name] <> N'Bar' OR [t].[Name] IS NULL +WHERE [t].[Name] <> N'Bar' OR ([t].[Name] IS NULL) ORDER BY [t].[Id], [d].[Id], [o].[BaseInheritanceRelationshipEntityId], [o0].[BaseInheritanceRelationshipEntityId], [o0].[Id], [d0].[DerivedInheritanceRelationshipEntityId]"); } @@ -678,7 +678,7 @@ FROM [DerivedReferencesOnBase] AS [d2] LEFT JOIN [DerivedEntities] AS [d] ON [t].[Id] = [d].[Id] LEFT JOIN [OwnedCollections] AS [o0] ON [t].[Id] = [o0].[BaseInheritanceRelationshipEntityId] LEFT JOIN [DerivedEntities_OwnedCollectionOnDerived] AS [d0] ON [t].[Id] = [d0].[DerivedInheritanceRelationshipEntityId] -WHERE [t].[Name] <> N'Bar' OR [t].[Name] IS NULL +WHERE [t].[Name] <> N'Bar' OR ([t].[Name] IS NULL) ORDER BY [t].[Id], [t0].[Id], [o].[BaseInheritanceRelationshipEntityId], [d].[Id], [o0].[BaseInheritanceRelationshipEntityId], [o0].[Id], [d0].[DerivedInheritanceRelationshipEntityId]"); } @@ -706,7 +706,7 @@ FROM [DerivedEntities] AS [d2] LEFT JOIN [DerivedEntities] AS [d] ON [t0].[Id] = [d].[Id] LEFT JOIN [OwnedCollections] AS [o0] ON [t0].[Id] = [o0].[BaseInheritanceRelationshipEntityId] LEFT JOIN [DerivedEntities_OwnedCollectionOnDerived] AS [d0] ON [t0].[Id] = [d0].[DerivedInheritanceRelationshipEntityId] -WHERE [t].[Name] <> N'Bar' OR [t].[Name] IS NULL +WHERE [t].[Name] <> N'Bar' OR ([t].[Name] IS NULL) ORDER BY [t].[Id], [t0].[Id], [o].[BaseInheritanceRelationshipEntityId], [d].[Id], [o0].[BaseInheritanceRelationshipEntityId], [o0].[Id], [d0].[DerivedInheritanceRelationshipEntityId]"); } @@ -1293,10 +1293,10 @@ FROM [DerivedEntities] AS [d0] ) AS [t] LEFT JOIN [OwnedReferences] AS [o] ON [t].[Id] = [o].[BaseInheritanceRelationshipEntityId] LEFT JOIN [DerivedEntities] AS [d] ON [t].[Id] = [d].[Id] -WHERE [t].[Name] <> N'Bar' OR [t].[Name] IS NULL +WHERE [t].[Name] <> N'Bar' OR ([t].[Name] IS NULL) ORDER BY [t].[Id], [o].[BaseInheritanceRelationshipEntityId], [d].[Id]", - // - @"SELECT [o0].[BaseInheritanceRelationshipEntityId], [o0].[Id], [o0].[Name], [t].[Id], [o].[BaseInheritanceRelationshipEntityId], [d].[Id] + // + @"SELECT [o0].[BaseInheritanceRelationshipEntityId], [o0].[Id], [o0].[Name], [t].[Id], [o].[BaseInheritanceRelationshipEntityId], [d].[Id] FROM ( SELECT [b].[Id], [b].[Name] FROM [BaseEntities] AS [b] @@ -1307,10 +1307,10 @@ FROM [DerivedEntities] AS [d0] LEFT JOIN [OwnedReferences] AS [o] ON [t].[Id] = [o].[BaseInheritanceRelationshipEntityId] LEFT JOIN [DerivedEntities] AS [d] ON [t].[Id] = [d].[Id] INNER JOIN [OwnedCollections] AS [o0] ON [t].[Id] = [o0].[BaseInheritanceRelationshipEntityId] -WHERE [t].[Name] <> N'Bar' OR [t].[Name] IS NULL +WHERE [t].[Name] <> N'Bar' OR ([t].[Name] IS NULL) ORDER BY [t].[Id], [o].[BaseInheritanceRelationshipEntityId], [d].[Id]", - // - @"SELECT [d0].[DerivedInheritanceRelationshipEntityId], [d0].[Id], [d0].[Name], [t].[Id], [o].[BaseInheritanceRelationshipEntityId], [d].[Id] + // + @"SELECT [d0].[DerivedInheritanceRelationshipEntityId], [d0].[Id], [d0].[Name], [t].[Id], [o].[BaseInheritanceRelationshipEntityId], [d].[Id] FROM ( SELECT [b].[Id], [b].[Name] FROM [BaseEntities] AS [b] @@ -1321,10 +1321,10 @@ FROM [DerivedEntities] AS [d1] LEFT JOIN [OwnedReferences] AS [o] ON [t].[Id] = [o].[BaseInheritanceRelationshipEntityId] LEFT JOIN [DerivedEntities] AS [d] ON [t].[Id] = [d].[Id] INNER JOIN [DerivedEntities_OwnedCollectionOnDerived] AS [d0] ON [t].[Id] = [d0].[DerivedInheritanceRelationshipEntityId] -WHERE [t].[Name] <> N'Bar' OR [t].[Name] IS NULL +WHERE [t].[Name] <> N'Bar' OR ([t].[Name] IS NULL) ORDER BY [t].[Id], [o].[BaseInheritanceRelationshipEntityId], [d].[Id]", - // - @"SELECT [t0].[Id], [t0].[BaseParentId], [t0].[Name], [t0].[DerivedProperty], [t0].[Discriminator], [t].[Id], [o].[BaseInheritanceRelationshipEntityId], [d].[Id] + // + @"SELECT [t0].[Id], [t0].[BaseParentId], [t0].[Name], [t0].[DerivedProperty], [t0].[Discriminator], [t].[Id], [o].[BaseInheritanceRelationshipEntityId], [d].[Id] FROM ( SELECT [b].[Id], [b].[Name] FROM [BaseEntities] AS [b] @@ -1341,7 +1341,7 @@ UNION ALL SELECT [d1].[Id], [d1].[BaseParentId], [d1].[Name], [d1].[DerivedProperty], N'DerivedCollectionOnBase' AS [Discriminator] FROM [DerivedCollectionsOnBase] AS [d1] ) AS [t0] ON [t].[Id] = [t0].[BaseParentId] -WHERE [t].[Name] <> N'Bar' OR [t].[Name] IS NULL +WHERE [t].[Name] <> N'Bar' OR ([t].[Name] IS NULL) ORDER BY [t].[Id], [o].[BaseInheritanceRelationshipEntityId], [d].[Id]"); } @@ -1367,10 +1367,10 @@ FROM [DerivedEntities] AS [d1] ) AS [t0] ON [t].[BaseParentId] = [t0].[Id] LEFT JOIN [OwnedReferences] AS [o] ON [t0].[Id] = [o].[BaseInheritanceRelationshipEntityId] LEFT JOIN [DerivedEntities] AS [d] ON [t0].[Id] = [d].[Id] -WHERE [t].[Name] <> N'Bar' OR [t].[Name] IS NULL +WHERE [t].[Name] <> N'Bar' OR ([t].[Name] IS NULL) ORDER BY [t].[Id], [t0].[Id], [o].[BaseInheritanceRelationshipEntityId], [d].[Id]", - // - @"SELECT [o0].[BaseInheritanceRelationshipEntityId], [o0].[Id], [o0].[Name], [t].[Id], [t0].[Id], [o].[BaseInheritanceRelationshipEntityId], [d].[Id] + // + @"SELECT [o0].[BaseInheritanceRelationshipEntityId], [o0].[Id], [o0].[Name], [t].[Id], [t0].[Id], [o].[BaseInheritanceRelationshipEntityId], [d].[Id] FROM ( SELECT [b].[Id], [b].[BaseParentId], [b].[Name] FROM [BaseCollectionsOnBase] AS [b] @@ -1388,10 +1388,10 @@ FROM [DerivedEntities] AS [d1] LEFT JOIN [OwnedReferences] AS [o] ON [t0].[Id] = [o].[BaseInheritanceRelationshipEntityId] LEFT JOIN [DerivedEntities] AS [d] ON [t0].[Id] = [d].[Id] INNER JOIN [OwnedCollections] AS [o0] ON [t0].[Id] = [o0].[BaseInheritanceRelationshipEntityId] -WHERE [t].[Name] <> N'Bar' OR [t].[Name] IS NULL +WHERE [t].[Name] <> N'Bar' OR ([t].[Name] IS NULL) ORDER BY [t].[Id], [t0].[Id], [o].[BaseInheritanceRelationshipEntityId], [d].[Id]", - // - @"SELECT [d0].[DerivedInheritanceRelationshipEntityId], [d0].[Id], [d0].[Name], [t].[Id], [t0].[Id], [o].[BaseInheritanceRelationshipEntityId], [d].[Id] + // + @"SELECT [d0].[DerivedInheritanceRelationshipEntityId], [d0].[Id], [d0].[Name], [t].[Id], [t0].[Id], [o].[BaseInheritanceRelationshipEntityId], [d].[Id] FROM ( SELECT [b].[Id], [b].[BaseParentId], [b].[Name] FROM [BaseCollectionsOnBase] AS [b] @@ -1409,7 +1409,7 @@ FROM [DerivedEntities] AS [d2] LEFT JOIN [OwnedReferences] AS [o] ON [t0].[Id] = [o].[BaseInheritanceRelationshipEntityId] LEFT JOIN [DerivedEntities] AS [d] ON [t0].[Id] = [d].[Id] INNER JOIN [DerivedEntities_OwnedCollectionOnDerived] AS [d0] ON [t0].[Id] = [d0].[DerivedInheritanceRelationshipEntityId] -WHERE [t].[Name] <> N'Bar' OR [t].[Name] IS NULL +WHERE [t].[Name] <> N'Bar' OR ([t].[Name] IS NULL) ORDER BY [t].[Id], [t0].[Id], [o].[BaseInheritanceRelationshipEntityId], [d].[Id]"); } @@ -1532,10 +1532,10 @@ FROM [DerivedEntities] AS [d0] ) AS [t] LEFT JOIN [OwnedReferences] AS [o] ON [t].[Id] = [o].[BaseInheritanceRelationshipEntityId] LEFT JOIN [DerivedEntities] AS [d] ON [t].[Id] = [d].[Id] -WHERE [t].[Name] <> N'Bar' OR [t].[Name] IS NULL +WHERE [t].[Name] <> N'Bar' OR ([t].[Name] IS NULL) ORDER BY [t].[Id], [o].[BaseInheritanceRelationshipEntityId], [d].[Id]", - // - @"SELECT [o0].[BaseInheritanceRelationshipEntityId], [o0].[Id], [o0].[Name], [t].[Id], [o].[BaseInheritanceRelationshipEntityId], [d].[Id] + // + @"SELECT [o0].[BaseInheritanceRelationshipEntityId], [o0].[Id], [o0].[Name], [t].[Id], [o].[BaseInheritanceRelationshipEntityId], [d].[Id] FROM ( SELECT [b].[Id], [b].[Name] FROM [BaseEntities] AS [b] @@ -1546,10 +1546,10 @@ FROM [DerivedEntities] AS [d0] LEFT JOIN [OwnedReferences] AS [o] ON [t].[Id] = [o].[BaseInheritanceRelationshipEntityId] LEFT JOIN [DerivedEntities] AS [d] ON [t].[Id] = [d].[Id] INNER JOIN [OwnedCollections] AS [o0] ON [t].[Id] = [o0].[BaseInheritanceRelationshipEntityId] -WHERE [t].[Name] <> N'Bar' OR [t].[Name] IS NULL +WHERE [t].[Name] <> N'Bar' OR ([t].[Name] IS NULL) ORDER BY [t].[Id], [o].[BaseInheritanceRelationshipEntityId], [d].[Id]", - // - @"SELECT [d0].[DerivedInheritanceRelationshipEntityId], [d0].[Id], [d0].[Name], [t].[Id], [o].[BaseInheritanceRelationshipEntityId], [d].[Id] + // + @"SELECT [d0].[DerivedInheritanceRelationshipEntityId], [d0].[Id], [d0].[Name], [t].[Id], [o].[BaseInheritanceRelationshipEntityId], [d].[Id] FROM ( SELECT [b].[Id], [b].[Name] FROM [BaseEntities] AS [b] @@ -1560,10 +1560,10 @@ FROM [DerivedEntities] AS [d1] LEFT JOIN [OwnedReferences] AS [o] ON [t].[Id] = [o].[BaseInheritanceRelationshipEntityId] LEFT JOIN [DerivedEntities] AS [d] ON [t].[Id] = [d].[Id] INNER JOIN [DerivedEntities_OwnedCollectionOnDerived] AS [d0] ON [t].[Id] = [d0].[DerivedInheritanceRelationshipEntityId] -WHERE [t].[Name] <> N'Bar' OR [t].[Name] IS NULL +WHERE [t].[Name] <> N'Bar' OR ([t].[Name] IS NULL) ORDER BY [t].[Id], [o].[BaseInheritanceRelationshipEntityId], [d].[Id]", - // - @"SELECT [c].[Id], [c].[Name], [c].[ParentId], [t].[Id], [o].[BaseInheritanceRelationshipEntityId], [d].[Id] + // + @"SELECT [c].[Id], [c].[Name], [c].[ParentId], [t].[Id], [o].[BaseInheritanceRelationshipEntityId], [d].[Id] FROM ( SELECT [b].[Id], [b].[Name] FROM [BaseEntities] AS [b] @@ -1574,7 +1574,7 @@ FROM [DerivedEntities] AS [d0] LEFT JOIN [OwnedReferences] AS [o] ON [t].[Id] = [o].[BaseInheritanceRelationshipEntityId] LEFT JOIN [DerivedEntities] AS [d] ON [t].[Id] = [d].[Id] INNER JOIN [CollectionsOnBase] AS [c] ON [t].[Id] = [c].[ParentId] -WHERE [t].[Name] <> N'Bar' OR [t].[Name] IS NULL +WHERE [t].[Name] <> N'Bar' OR ([t].[Name] IS NULL) ORDER BY [t].[Id], [o].[BaseInheritanceRelationshipEntityId], [d].[Id]"); } @@ -1594,10 +1594,10 @@ FROM [DerivedEntities] AS [d0] ) AS [t] ON [c].[ParentId] = [t].[Id] LEFT JOIN [OwnedReferences] AS [o] ON [t].[Id] = [o].[BaseInheritanceRelationshipEntityId] LEFT JOIN [DerivedEntities] AS [d] ON [t].[Id] = [d].[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], [o].[BaseInheritanceRelationshipEntityId], [d].[Id]", - // - @"SELECT [o0].[BaseInheritanceRelationshipEntityId], [o0].[Id], [o0].[Name], [c].[Id], [t].[Id], [o].[BaseInheritanceRelationshipEntityId], [d].[Id] + // + @"SELECT [o0].[BaseInheritanceRelationshipEntityId], [o0].[Id], [o0].[Name], [c].[Id], [t].[Id], [o].[BaseInheritanceRelationshipEntityId], [d].[Id] FROM [CollectionsOnBase] AS [c] LEFT JOIN ( SELECT [b].[Id] @@ -1609,10 +1609,10 @@ FROM [DerivedEntities] AS [d0] LEFT JOIN [OwnedReferences] AS [o] ON [t].[Id] = [o].[BaseInheritanceRelationshipEntityId] LEFT JOIN [DerivedEntities] AS [d] ON [t].[Id] = [d].[Id] INNER JOIN [OwnedCollections] AS [o0] ON [t].[Id] = [o0].[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], [o].[BaseInheritanceRelationshipEntityId], [d].[Id]", - // - @"SELECT [d0].[DerivedInheritanceRelationshipEntityId], [d0].[Id], [d0].[Name], [c].[Id], [t].[Id], [o].[BaseInheritanceRelationshipEntityId], [d].[Id] + // + @"SELECT [d0].[DerivedInheritanceRelationshipEntityId], [d0].[Id], [d0].[Name], [c].[Id], [t].[Id], [o].[BaseInheritanceRelationshipEntityId], [d].[Id] FROM [CollectionsOnBase] AS [c] LEFT JOIN ( SELECT [b].[Id] @@ -1624,7 +1624,7 @@ FROM [DerivedEntities] AS [d1] LEFT JOIN [OwnedReferences] AS [o] ON [t].[Id] = [o].[BaseInheritanceRelationshipEntityId] LEFT JOIN [DerivedEntities] AS [d] ON [t].[Id] = [d].[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], [o].[BaseInheritanceRelationshipEntityId], [d].[Id]"); } diff --git a/test/EFCore.SqlServer.FunctionalTests/Query/TPTFiltersInheritanceQuerySqlServerTest.cs b/test/EFCore.SqlServer.FunctionalTests/Query/TPTFiltersInheritanceQuerySqlServerTest.cs index cba033ec1c4..bf6fa770a99 100644 --- a/test/EFCore.SqlServer.FunctionalTests/Query/TPTFiltersInheritanceQuerySqlServerTest.cs +++ b/test/EFCore.SqlServer.FunctionalTests/Query/TPTFiltersInheritanceQuerySqlServerTest.cs @@ -48,7 +48,7 @@ FROM [Animals] AS [a] LEFT JOIN [Birds] AS [b] ON [a].[Id] = [b].[Id] LEFT JOIN [Eagle] AS [e] ON [a].[Id] = [e].[Id] LEFT JOIN [Kiwi] AS [k] ON [a].[Id] = [k].[Id] -WHERE [a].[CountryId] = 1 AND [k].[Id] IS NOT NULL"); +WHERE [a].[CountryId] = 1 AND ([k].[Id] IS NOT NULL)"); } public override async Task Can_use_is_kiwi_with_other_predicate(bool async) @@ -64,7 +64,7 @@ FROM [Animals] AS [a] LEFT JOIN [Birds] AS [b] ON [a].[Id] = [b].[Id] LEFT JOIN [Eagle] AS [e] ON [a].[Id] = [e].[Id] LEFT JOIN [Kiwi] AS [k] ON [a].[Id] = [k].[Id] -WHERE [a].[CountryId] = 1 AND [k].[Id] IS NOT NULL AND [a].[CountryId] = 1"); +WHERE [a].[CountryId] = 1 AND ([k].[Id] IS NOT NULL) AND [a].[CountryId] = 1"); } public override async Task Can_use_is_kiwi_in_projection(bool async) @@ -94,7 +94,7 @@ FROM [Animals] AS [a] LEFT JOIN [Birds] AS [b] ON [a].[Id] = [b].[Id] LEFT JOIN [Eagle] AS [e] ON [a].[Id] = [e].[Id] LEFT JOIN [Kiwi] AS [k] ON [a].[Id] = [k].[Id] -WHERE [a].[CountryId] = 1 AND ([k].[Id] IS NOT NULL OR [e].[Id] IS NOT NULL) +WHERE [a].[CountryId] = 1 AND (([k].[Id] IS NOT NULL) OR ([e].[Id] IS NOT NULL)) ORDER BY [a].[Species]"); } @@ -111,7 +111,7 @@ FROM [Animals] AS [a] LEFT JOIN [Birds] AS [b] ON [a].[Id] = [b].[Id] LEFT JOIN [Eagle] AS [e] ON [a].[Id] = [e].[Id] LEFT JOIN [Kiwi] AS [k] ON [a].[Id] = [k].[Id] -WHERE [a].[CountryId] = 1 AND [a].[CountryId] = 1 AND ([k].[Id] IS NOT NULL OR [e].[Id] IS NOT NULL) +WHERE [a].[CountryId] = 1 AND [a].[CountryId] = 1 AND (([k].[Id] IS NOT NULL) OR ([e].[Id] IS NOT NULL)) ORDER BY [a].[Species]"); } @@ -124,7 +124,7 @@ public override async Task Can_use_of_type_bird_with_projection(bool async) FROM [Animals] AS [a] LEFT JOIN [Eagle] AS [e] ON [a].[Id] = [e].[Id] LEFT JOIN [Kiwi] AS [k] ON [a].[Id] = [k].[Id] -WHERE [a].[CountryId] = 1 AND ([k].[Id] IS NOT NULL OR [e].[Id] IS NOT NULL)"); +WHERE [a].[CountryId] = 1 AND (([k].[Id] IS NOT NULL) OR ([e].[Id] 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].[Id] = [b].[Id] LEFT JOIN [Eagle] AS [e] ON [a].[Id] = [e].[Id] LEFT JOIN [Kiwi] AS [k] ON [a].[Id] = [k].[Id] -WHERE [a].[CountryId] = 1 AND ([k].[Id] IS NOT NULL OR [e].[Id] IS NOT NULL) +WHERE [a].[CountryId] = 1 AND (([k].[Id] IS NOT NULL) OR ([e].[Id] 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].[Id] = [b].[Id] LEFT JOIN [Kiwi] AS [k] ON [a].[Id] = [k].[Id] -WHERE [a].[CountryId] = 1 AND [k].[Id] IS NOT NULL"); +WHERE [a].[CountryId] = 1 AND ([k].[Id] 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 1c9c7a80bb2..e286e436332 100644 --- a/test/EFCore.SqlServer.FunctionalTests/Query/TPTGearsOfWarQuerySqlServerTest.cs +++ b/test/EFCore.SqlServer.FunctionalTests/Query/TPTGearsOfWarQuerySqlServerTest.cs @@ -60,7 +60,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) @@ -306,7 +306,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) @@ -324,7 +324,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) @@ -341,7 +341,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) @@ -465,7 +465,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]"); } @@ -749,15 +749,15 @@ FROM [Gears] AS [g0] 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' @@ -772,15 +772,15 @@ FROM [Gears] AS [g0] 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) @@ -801,15 +801,15 @@ FROM [Gears] AS [g0] 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) @@ -911,7 +911,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] @@ -977,11 +977,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) @@ -1014,7 +1014,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]"); @@ -1045,7 +1045,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) @@ -1062,7 +1062,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)"); @@ -1102,10 +1102,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) @@ -1122,10 +1122,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) @@ -1142,10 +1142,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) @@ -1216,7 +1216,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 @@ -1236,7 +1236,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] @@ -1253,7 +1253,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] @@ -1351,7 +1351,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] @@ -1470,7 +1470,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) @@ -1487,7 +1487,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) @@ -1520,7 +1520,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) @@ -1534,7 +1534,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) @@ -1548,7 +1548,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) @@ -1567,7 +1567,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) @@ -2071,7 +2071,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) @@ -2394,7 +2394,7 @@ public override async Task Include_on_GroupJoin_SelectMany_DefaultIfEmpty_with_c // Issue#16897 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], [t].[SquadId], [t].[AssignedCityName], [t].[CityOfBirthName], [t].[FullName], [t].[HasSoulPatch], [t].[LeaderNickname], [t].[LeaderSquadId], [t].[Rank], [t].[Discriminator], [g].[Nickname], [g].[SquadId], [w].[Id], [w].[AmmunitionType], [w].[IsAutomatic], [w].[Name], [w].[OwnerFullName], [w].[SynergyWithId], [g].[AssignedCityName], [g].[CityOfBirthName], [g].[FullName], [g].[HasSoulPatch], [g].[LeaderNickname], [g].[LeaderSquadId], [g].[Rank], CASE WHEN [o].[Nickname] IS NOT NULL THEN N'Officer' @@ -2421,7 +2421,7 @@ public override async Task Include_on_GroupJoin_SelectMany_DefaultIfEmpty_with_c @"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' END AS [Discriminator], [t].[Nickname], [t].[SquadId], [w].[Id], [w].[AmmunitionType], [w].[IsAutomatic], [w].[Name], [w].[OwnerFullName], [w].[SynergyWithId], [t].[AssignedCityName], [t].[CityOfBirthName], [t].[FullName], [t].[HasSoulPatch], [t].[LeaderNickname], [t].[LeaderSquadId], [t].[Rank], [t].[Discriminator], [w0].[Id], [w0].[AmmunitionType], [w0].[IsAutomatic], [w0].[Name], [w0].[OwnerFullName], [w0].[SynergyWithId], [w1].[Id], [w1].[AmmunitionType], [w1].[IsAutomatic], [w1].[Name], [w1].[OwnerFullName], [w1].[SynergyWithId], [w2].[Id], [w2].[AmmunitionType], [w2].[IsAutomatic], [w2].[Name], [w2].[OwnerFullName], [w2].[SynergyWithId], 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, [w3].[Id], [w3].[AmmunitionType], [w3].[IsAutomatic], [w3].[Name], [w3].[OwnerFullName], [w3].[SynergyWithId], [w4].[Id], [w4].[AmmunitionType], [w4].[IsAutomatic], [w4].[Name], [w4].[OwnerFullName], [w4].[SynergyWithId] FROM [Gears] AS [g] @@ -2468,7 +2468,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]"); @@ -2485,7 +2485,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) @@ -2608,7 +2608,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) @@ -2622,7 +2622,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) @@ -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_list_initializers(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) ORDER BY [t].[Note]"); } @@ -2665,7 +2665,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) @@ -2679,7 +2679,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]"); } @@ -2699,7 +2699,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"); } @@ -2715,7 +2715,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) @@ -2729,7 +2729,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] @@ -2761,7 +2761,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]"); @@ -3088,7 +3088,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) @@ -3099,7 +3099,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) @@ -3110,7 +3110,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) @@ -3156,7 +3156,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"); } @@ -3277,7 +3277,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]"); } @@ -3654,7 +3654,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) @@ -3685,7 +3685,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) @@ -3706,7 +3706,7 @@ FROM [Gears] AS [g] 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) @@ -3789,7 +3789,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]"); } @@ -3817,7 +3817,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]"); } @@ -3885,7 +3885,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]"); } @@ -4067,7 +4067,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]"); } @@ -4153,7 +4153,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]"); } @@ -4185,7 +4185,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] @@ -4253,7 +4253,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]"); @@ -4269,7 +4269,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]"); @@ -4285,7 +4285,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]"); @@ -4301,7 +4301,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"); @@ -4320,7 +4320,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]"); } @@ -4334,7 +4334,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]"); @@ -4350,7 +4350,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]"); @@ -4366,7 +4366,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]"); @@ -4481,7 +4481,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] @@ -4559,7 +4559,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] @@ -4588,7 +4588,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] @@ -4618,7 +4618,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] @@ -4644,14 +4644,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] @@ -4688,7 +4688,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] @@ -4700,7 +4700,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] @@ -4756,7 +4756,7 @@ FROM [Gears] AS [g0] OUTER APPLY ( SELECT [w].[Name], [g0].[Nickname], [w].[Id] FROM [Weapons] AS [w] - WHERE [g0].[FullName] = [w].[OwnerFullName] AND ([w].[Name] <> N'Bar' OR [w].[Name] IS NULL) + WHERE [g0].[FullName] = [w].[OwnerFullName] AND ([w].[Name] <> N'Bar' OR ([w].[Name] IS NULL)) ) AS [t] WHERE [g0].[FullName] <> N'Foo' ) AS [t0] ON [g].[Nickname] = [t0].[LeaderNickname] AND [g].[SquadId] = [t0].[LeaderSquadId] @@ -4778,7 +4778,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 [g].[Nickname] = [g0].[LeaderNickname] AND [g].[SquadId] = [g0].[LeaderSquadId] AND [g0].[FullName] <> N'Foo' ) AS [t0] @@ -4797,7 +4797,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 @@ -4938,7 +4938,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]"); } @@ -5162,7 +5162,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)"); } @@ -5180,7 +5180,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)"); } @@ -5206,7 +5206,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] @@ -6140,7 +6140,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]"); } @@ -6164,7 +6164,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"); } @@ -6178,7 +6178,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"); } @@ -6536,7 +6536,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 SUBSTRING([t].[Note], 0 + 1, [t0].[SquadId]) = [t].[GearNickName] OR (([t].[Note] IS NULL OR [t0].[SquadId] IS NULL) AND [t].[GearNickName] IS NULL)"); +WHERE SUBSTRING([t].[Note], 0 + 1, [t0].[SquadId]) = [t].[GearNickName] OR ((([t].[Note] IS NULL) OR ([t0].[SquadId] IS NULL)) AND ([t].[GearNickName] IS NULL))"); } public override async Task @@ -6553,7 +6553,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) @@ -6596,7 +6596,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) @@ -6611,7 +6611,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) @@ -6627,7 +6627,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 [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 Nav_rewrite_Distinct_with_convert() @@ -6658,7 +6658,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) @@ -6677,7 +6677,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) @@ -6696,7 +6696,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) @@ -6826,7 +6826,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' @@ -6866,7 +6866,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]"); } @@ -6891,7 +6891,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]"); } @@ -6909,7 +6909,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] -) AS [t0] ON [t].[GearNickName] = [t0].[Nickname] AND [t].[GearSquadId] = [t0].[SquadId] AND [t].[Note] IS NOT NULL +) AS [t0] ON [t].[GearNickName] = [t0].[Nickname] AND [t].[GearSquadId] = [t0].[SquadId] AND ([t].[Note] IS NOT NULL) ORDER BY [t].[Id], [t0].[Nickname]"); } @@ -7009,7 +7009,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) @@ -7084,7 +7084,7 @@ public override async Task Navigation_based_on_complex_expression6(bool async) AssertSql( @"SELECT CASE - WHEN [t0].[Name] = N'Queen Myrrah' AND [t0].[Name] IS NOT NULL THEN CAST(1 AS bit) + WHEN [t0].[Name] = N'Queen Myrrah' AND ([t0].[Name] IS NOT NULL) THEN CAST(1 AS bit) ELSE CAST(0 AS bit) END, [t0].[Name], [t0].[LocustHordeId], [t0].[ThreatLevel], [t0].[ThreatLevelByte], [t0].[ThreatLevelNullableByte], [t0].[DefeatedByNickname], [t0].[DefeatedBySquadId], [t0].[HighCommandId], [t].[Name], [t].[LocustHordeId], [t].[ThreatLevel], [t].[ThreatLevelByte], [t].[ThreatLevelNullableByte], [t].[DefeatedByNickname], [t].[DefeatedBySquadId], [t].[HighCommandId], [t].[Discriminator] FROM [Factions] AS [f] @@ -7198,7 +7198,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] @@ -7228,7 +7228,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) @@ -7561,12 +7561,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) @@ -7624,7 +7624,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) @@ -7795,10 +7795,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) @@ -8029,7 +8029,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) @@ -8144,7 +8144,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]"); } @@ -8165,7 +8165,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]"); } @@ -8231,7 +8231,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] @@ -8293,7 +8293,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]"); } @@ -8307,7 +8307,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]"); } @@ -8326,7 +8326,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]"); } @@ -8337,7 +8337,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) @@ -8386,7 +8386,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]"); @@ -8433,14 +8433,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) @@ -8565,7 +8565,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) @@ -8582,7 +8582,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) @@ -8651,7 +8651,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 @@ -8786,10 +8786,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) @@ -8804,7 +8804,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]"); } @@ -9000,7 +9000,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 24ab58949a5..21ff0791a0e 100644 --- a/test/EFCore.SqlServer.FunctionalTests/Query/TPTInheritanceQuerySqlServerTest.cs +++ b/test/EFCore.SqlServer.FunctionalTests/Query/TPTInheritanceQuerySqlServerTest.cs @@ -277,7 +277,7 @@ FROM [Animals] AS [a] LEFT JOIN [Birds] AS [b] ON [a].[Id] = [b].[Id] LEFT JOIN [Eagle] AS [e] ON [a].[Id] = [e].[Id] LEFT JOIN [Kiwi] AS [k] ON [a].[Id] = [k].[Id] -WHERE [k].[Id] IS NOT NULL AND [a].[CountryId] = 1"); +WHERE ([k].[Id] IS NOT NULL) AND [a].[CountryId] = 1"); } public override async Task Can_use_of_type_animal(bool async) @@ -309,7 +309,7 @@ FROM [Animals] AS [a] LEFT JOIN [Birds] AS [b] ON [a].[Id] = [b].[Id] LEFT JOIN [Eagle] AS [e] ON [a].[Id] = [e].[Id] LEFT JOIN [Kiwi] AS [k] ON [a].[Id] = [k].[Id] -WHERE [k].[Id] IS NOT NULL OR [e].[Id] IS NOT NULL +WHERE ([k].[Id] IS NOT NULL) OR ([e].[Id] IS NOT NULL) ORDER BY [a].[Species]"); } @@ -326,7 +326,7 @@ FROM [Animals] AS [a] LEFT JOIN [Birds] AS [b] ON [a].[Id] = [b].[Id] LEFT JOIN [Eagle] AS [e] ON [a].[Id] = [e].[Id] LEFT JOIN [Kiwi] AS [k] ON [a].[Id] = [k].[Id] -WHERE [k].[Id] IS NOT NULL OR [e].[Id] IS NOT NULL +WHERE ([k].[Id] IS NOT NULL) OR ([e].[Id] IS NOT NULL) ORDER BY [a].[Species]"); } @@ -343,7 +343,7 @@ FROM [Animals] AS [a] LEFT JOIN [Birds] AS [b] ON [a].[Id] = [b].[Id] LEFT JOIN [Eagle] AS [e] ON [a].[Id] = [e].[Id] LEFT JOIN [Kiwi] AS [k] ON [a].[Id] = [k].[Id] -WHERE [a].[CountryId] = 1 AND ([k].[Id] IS NOT NULL OR [e].[Id] IS NOT NULL) +WHERE [a].[CountryId] = 1 AND (([k].[Id] IS NOT NULL) OR ([e].[Id] IS NOT NULL)) ORDER BY [a].[Species]"); } @@ -357,7 +357,7 @@ FROM [Animals] AS [a] LEFT JOIN [Birds] AS [b] ON [a].[Id] = [b].[Id] LEFT JOIN [Eagle] AS [e] ON [a].[Id] = [e].[Id] LEFT JOIN [Kiwi] AS [k] ON [a].[Id] = [k].[Id] -WHERE [k].[Id] IS NOT NULL OR [e].[Id] IS NOT NULL"); +WHERE ([k].[Id] IS NOT NULL) OR ([e].[Id] IS NOT NULL)"); } public override async Task Can_use_of_type_kiwi(bool async) @@ -385,7 +385,7 @@ END AS [Discriminator] FROM [Animals] AS [a] LEFT JOIN [Birds] AS [b] ON [a].[Id] = [b].[Id] LEFT JOIN [Kiwi] AS [k] ON [a].[Id] = [k].[Id] -WHERE [k].[Id] IS NOT NULL AND [k].[FoundOn] = CAST(0 AS tinyint)"); +WHERE ([k].[Id] 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) @@ -399,7 +399,7 @@ END AS [Discriminator] FROM [Animals] AS [a] LEFT JOIN [Birds] AS [b] ON [a].[Id] = [b].[Id] LEFT JOIN [Kiwi] AS [k] ON [a].[Id] = [k].[Id] -WHERE [k].[Id] IS NOT NULL AND [k].[FoundOn] = CAST(1 AS tinyint)"); +WHERE ([k].[Id] IS NOT NULL) AND [k].[FoundOn] = CAST(1 AS tinyint)"); } public override async Task Can_use_of_type_rose(bool async) @@ -625,7 +625,7 @@ FROM [Animals] AS [a] LEFT JOIN [Birds] AS [b] ON [a].[Id] = [b].[Id] LEFT JOIN [Eagle] AS [e] ON [a].[Id] = [e].[Id] LEFT JOIN [Kiwi] AS [k] ON [a].[Id] = [k].[Id] -WHERE [k].[Id] IS NOT NULL AND [e].[Id] IS NOT NULL"); +WHERE ([k].[Id] IS NOT NULL) AND ([e].[Id] IS NOT NULL)"); } public override async Task Using_is_operator_with_of_type_on_multiple_type_with_no_result(bool async) @@ -640,7 +640,7 @@ FROM [Animals] AS [a] LEFT JOIN [Birds] AS [b] ON [a].[Id] = [b].[Id] LEFT JOIN [Eagle] AS [e] ON [a].[Id] = [e].[Id] LEFT JOIN [Kiwi] AS [k] ON [a].[Id] = [k].[Id] -WHERE [k].[Id] IS NOT NULL AND [e].[Id] IS NOT NULL"); +WHERE ([k].[Id] IS NOT NULL) AND ([e].[Id] IS NOT NULL)"); } public override async Task Using_OfType_on_multiple_type_with_no_result(bool async) diff --git a/test/EFCore.SqlServer.FunctionalTests/Query/TPTManyToManyNoTrackingQuerySqlServerTest.cs b/test/EFCore.SqlServer.FunctionalTests/Query/TPTManyToManyNoTrackingQuerySqlServerTest.cs index c96c9eaaf59..b034b5c33cd 100644 --- a/test/EFCore.SqlServer.FunctionalTests/Query/TPTManyToManyNoTrackingQuerySqlServerTest.cs +++ b/test/EFCore.SqlServer.FunctionalTests/Query/TPTManyToManyNoTrackingQuerySqlServerTest.cs @@ -108,7 +108,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) @@ -136,7 +136,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) @@ -1746,7 +1746,7 @@ FROM [Roots] AS [r] LEFT JOIN [Branch2s] AS [b0] ON [r].[Id] = [b0].[Id] LEFT JOIN [Leaves] AS [l] ON [r].[Id] = [l].[Id] LEFT JOIN [Leaf2s] AS [l0] ON [r].[Id] = [l0].[Id] -WHERE [l0].[Id] IS NULL AND [l].[Id] IS NULL AND [b].[Id] IS NULL"); +WHERE ([l0].[Id] IS NULL) AND ([l].[Id] IS NULL) AND ([b].[Id] IS NULL)"); } public override async Task GetType_in_hierarchy_in_intermediate_type(bool async) @@ -1764,7 +1764,7 @@ FROM [Roots] AS [r] LEFT JOIN [Branch2s] AS [b0] ON [r].[Id] = [b0].[Id] LEFT JOIN [Leaves] AS [l] ON [r].[Id] = [l].[Id] LEFT JOIN [Leaf2s] AS [l0] ON [r].[Id] = [l0].[Id] -WHERE [l].[Id] IS NULL AND [b].[Id] IS NOT NULL"); +WHERE ([l].[Id] IS NULL) AND ([b].[Id] IS NOT NULL)"); } public override async Task GetType_in_hierarchy_in_leaf_type(bool async) @@ -1927,7 +1927,7 @@ FROM [UnidirectionalRoots] AS [u1] INNER JOIN [UnidirectionalBranches] AS [u2] ON [u1].[Id] = [u2].[Id] LEFT JOIN [UnidirectionalLeaves] AS [u3] ON [u1].[Id] = [u3].[Id] ) AS [t] ON [u0].[UnidirectionalEntityBranchId] = [t].[Id] - WHERE [u].[Id] = [u0].[UnidirectionalEntityOneId] AND [t].[Name] IS NOT NULL AND ([t].[Name] LIKE N'L%')), [u].[Id]"); + WHERE [u].[Id] = [u0].[UnidirectionalEntityOneId] AND ([t].[Name] IS NOT NULL) AND ([t].[Name] LIKE N'L%')), [u].[Id]"); } public override async Task Skip_navigation_select_subquery_average_unidirectional(bool async) @@ -2407,7 +2407,7 @@ END AS [Discriminator] FROM [UnidirectionalRoots] AS [u] LEFT JOIN [UnidirectionalBranches] AS [u0] ON [u].[Id] = [u0].[Id] LEFT JOIN [UnidirectionalLeaves] AS [u1] ON [u].[Id] = [u1].[Id] -WHERE [u1].[Id] IS NULL AND [u0].[Id] IS NULL"); +WHERE ([u1].[Id] IS NULL) AND ([u0].[Id] IS NULL)"); } public override async Task GetType_in_hierarchy_in_intermediate_type_unidirectional(bool async) @@ -2422,7 +2422,7 @@ END AS [Discriminator] FROM [UnidirectionalRoots] AS [u] LEFT JOIN [UnidirectionalBranches] AS [u0] ON [u].[Id] = [u0].[Id] LEFT JOIN [UnidirectionalLeaves] AS [u1] ON [u].[Id] = [u1].[Id] -WHERE [u1].[Id] IS NULL AND [u0].[Id] IS NOT NULL"); +WHERE ([u1].[Id] IS NULL) AND ([u0].[Id] IS NOT NULL)"); } public override async Task GetType_in_hierarchy_in_leaf_type_unidirectional(bool async) diff --git a/test/EFCore.SqlServer.FunctionalTests/Query/TPTManyToManyQuerySqlServerTest.cs b/test/EFCore.SqlServer.FunctionalTests/Query/TPTManyToManyQuerySqlServerTest.cs index 41923bc5db1..a2e9cfa9e10 100644 --- a/test/EFCore.SqlServer.FunctionalTests/Query/TPTManyToManyQuerySqlServerTest.cs +++ b/test/EFCore.SqlServer.FunctionalTests/Query/TPTManyToManyQuerySqlServerTest.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) @@ -1751,7 +1751,7 @@ FROM [Roots] AS [r] LEFT JOIN [Branch2s] AS [b0] ON [r].[Id] = [b0].[Id] LEFT JOIN [Leaves] AS [l] ON [r].[Id] = [l].[Id] LEFT JOIN [Leaf2s] AS [l0] ON [r].[Id] = [l0].[Id] -WHERE [l0].[Id] IS NULL AND [l].[Id] IS NULL AND [b].[Id] IS NULL"); +WHERE ([l0].[Id] IS NULL) AND ([l].[Id] IS NULL) AND ([b].[Id] IS NULL)"); } public override async Task GetType_in_hierarchy_in_intermediate_type(bool async) @@ -1769,7 +1769,7 @@ FROM [Roots] AS [r] LEFT JOIN [Branch2s] AS [b0] ON [r].[Id] = [b0].[Id] LEFT JOIN [Leaves] AS [l] ON [r].[Id] = [l].[Id] LEFT JOIN [Leaf2s] AS [l0] ON [r].[Id] = [l0].[Id] -WHERE [l].[Id] IS NULL AND [b].[Id] IS NOT NULL"); +WHERE ([l].[Id] IS NULL) AND ([b].[Id] IS NOT NULL)"); } public override async Task GetType_in_hierarchy_in_leaf_type(bool async) @@ -1925,7 +1925,7 @@ FROM [UnidirectionalRoots] AS [u1] INNER JOIN [UnidirectionalBranches] AS [u2] ON [u1].[Id] = [u2].[Id] LEFT JOIN [UnidirectionalLeaves] AS [u3] ON [u1].[Id] = [u3].[Id] ) AS [t] ON [u0].[UnidirectionalEntityBranchId] = [t].[Id] - WHERE [u].[Id] = [u0].[UnidirectionalEntityOneId] AND [t].[Name] IS NOT NULL AND ([t].[Name] LIKE N'L%')), [u].[Id]"); + WHERE [u].[Id] = [u0].[UnidirectionalEntityOneId] AND ([t].[Name] IS NOT NULL) AND ([t].[Name] LIKE N'L%')), [u].[Id]"); } public override async Task Skip_navigation_select_subquery_average_unidirectional(bool async) @@ -2426,7 +2426,7 @@ END AS [Discriminator] FROM [UnidirectionalRoots] AS [u] LEFT JOIN [UnidirectionalBranches] AS [u0] ON [u].[Id] = [u0].[Id] LEFT JOIN [UnidirectionalLeaves] AS [u1] ON [u].[Id] = [u1].[Id] -WHERE [u1].[Id] IS NULL AND [u0].[Id] IS NULL"); +WHERE ([u1].[Id] IS NULL) AND ([u0].[Id] IS NULL)"); } public override async Task GetType_in_hierarchy_in_intermediate_type_unidirectional(bool async) @@ -2441,7 +2441,7 @@ END AS [Discriminator] FROM [UnidirectionalRoots] AS [u] LEFT JOIN [UnidirectionalBranches] AS [u0] ON [u].[Id] = [u0].[Id] LEFT JOIN [UnidirectionalLeaves] AS [u1] ON [u].[Id] = [u1].[Id] -WHERE [u1].[Id] IS NULL AND [u0].[Id] IS NOT NULL"); +WHERE ([u1].[Id] IS NULL) AND ([u0].[Id] IS NOT NULL)"); } public override async Task GetType_in_hierarchy_in_leaf_type_unidirectional(bool async) diff --git a/test/EFCore.SqlServer.FunctionalTests/Query/TPTRelationshipsQuerySqlServerTest.cs b/test/EFCore.SqlServer.FunctionalTests/Query/TPTRelationshipsQuerySqlServerTest.cs index b22194a9873..3025809cbc3 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,27 +1161,27 @@ 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] + // + @"SELECT [b1].[BaseInheritanceRelationshipEntityId], [b1].[Id], [b1].[Name], [b].[Id], [t].[Id] FROM [BaseCollectionsOnBase] AS [b] LEFT JOIN ( 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] + // + @"SELECT [d1].[DerivedInheritanceRelationshipEntityId], [d1].[Id], [d1].[Name], [b].[Id], [t].[Id] FROM [BaseCollectionsOnBase] AS [b] LEFT JOIN ( 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,27 +1294,27 @@ 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] + // + @"SELECT [b0].[BaseInheritanceRelationshipEntityId], [b0].[Id], [b0].[Name], [c].[Id], [t].[Id] FROM [CollectionsOnBase] AS [c] LEFT JOIN ( 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] + // + @"SELECT [d0].[DerivedInheritanceRelationshipEntityId], [d0].[Id], [d0].[Name], [c].[Id], [t].[Id] FROM [CollectionsOnBase] AS [c] LEFT JOIN ( 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 3fec739dfd9..0ed7b5b5506 100644 --- a/test/EFCore.SqlServer.FunctionalTests/Query/TemporalComplexNavigationsCollectionsQuerySqlServerTest.cs +++ b/test/EFCore.SqlServer.FunctionalTests/Query/TemporalComplexNavigationsCollectionsQuerySqlServerTest.cs @@ -88,7 +88,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] @@ -123,7 +123,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]"); } @@ -140,7 +140,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] @@ -239,7 +239,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] @@ -258,7 +258,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] @@ -322,7 +322,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] @@ -340,7 +340,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]"); } @@ -395,7 +395,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] @@ -653,7 +653,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]"); } @@ -782,7 +782,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] @@ -859,7 +859,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]"); } @@ -876,7 +876,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]"); } @@ -890,7 +890,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]"); @@ -1055,7 +1055,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 ( @@ -1063,7 +1063,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] @@ -1099,7 +1099,7 @@ public override async Task Complex_query_with_let_collection_projection_FirstOrD OUTER APPLY ( SELECT TOP(1) 1 AS [c], [l0].[Id] 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] OUTER APPLY ( SELECT [l1].[Name], [l1].[Id] @@ -1297,7 +1297,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] @@ -1355,7 +1355,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] @@ -1667,7 +1667,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] @@ -1709,7 +1709,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]"); } @@ -1835,7 +1835,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] @@ -2005,7 +2005,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] @@ -2014,7 +2014,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] @@ -2055,7 +2055,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 ( @@ -2063,7 +2063,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] @@ -2252,7 +2252,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] @@ -2357,7 +2357,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] @@ -2441,7 +2441,7 @@ public override async Task Projecting_collection_after_optional_reference_correl OUTER APPLY ( SELECT [l1].[Id] AS [ChildId], [l0].[Name] AS [ParentName] FROM [LevelThree] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' 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] ORDER BY [l].[Id], [l0].[Id]"); } @@ -2458,7 +2458,7 @@ public override async Task Projecting_collection_with_group_by_after_optional_re OUTER APPLY ( SELECT [l2].[Name] AS [Key], COUNT(*) AS [Count] FROM [LevelThree] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l2] - WHERE [l0].[Id] IS NOT NULL AND [l0].[Id] = [l2].[OneToMany_Optional_Inverse3Id] + WHERE ([l0].[Id] IS NOT NULL) AND [l0].[Id] = [l2].[OneToMany_Optional_Inverse3Id] GROUP BY [l2].[Name] ) AS [t] ORDER BY [l].[Id], [l0].[Id], [l1].[Id]"); @@ -2515,7 +2515,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]"); } @@ -2576,7 +2576,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] diff --git a/test/EFCore.SqlServer.FunctionalTests/Query/TemporalComplexNavigationsCollectionsSharedTypeQuerySqlServerTest.cs b/test/EFCore.SqlServer.FunctionalTests/Query/TemporalComplexNavigationsCollectionsSharedTypeQuerySqlServerTest.cs index 12b2d81a09d..3c3188dc177 100644 --- a/test/EFCore.SqlServer.FunctionalTests/Query/TemporalComplexNavigationsCollectionsSharedTypeQuerySqlServerTest.cs +++ b/test/EFCore.SqlServer.FunctionalTests/Query/TemporalComplexNavigationsCollectionsSharedTypeQuerySqlServerTest.cs @@ -51,21 +51,21 @@ OFFSET @__p_0 ROWS FETCH NEXT @__p_1 ROWS ONLY 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], [l0].[PeriodEnd], [l0].[PeriodStart] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l0] - WHERE [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 [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Level3_Name], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[OneToOne_Optional_PK_Inverse3Id], [l1].[PeriodEnd], [l1].[PeriodStart] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l1] - WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[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 [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], [l2].[PeriodEnd], [l2].[PeriodStart] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l2] - 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 [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_Required_Inverse3Id] ORDER BY [t].[Name], [t].[Id], [t0].[Id], [t1].[Id]"); } @@ -88,26 +88,26 @@ OFFSET @__p_0 ROWS FETCH NEXT @__p_1 ROWS ONLY 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], [l0].[PeriodEnd], [l0].[PeriodStart] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l0] - WHERE [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 [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], [l1].[PeriodEnd], [l1].[PeriodStart] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l1] - 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 [t1] ON [t].[Id] = [t1].[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], [l2].[PeriodEnd], [l2].[PeriodStart] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l2] - 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 [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 [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], [l3].[PeriodEnd], [l3].[PeriodStart] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l3] - 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].[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 = [t3].[OneToMany_Required_Inverse3Id] ORDER BY [t].[Name], [t].[Id], [t0].[Id], [t1].[Id], [t2].[Id]"); } @@ -130,21 +130,21 @@ OFFSET @__p_0 ROWS FETCH NEXT @__p_1 ROWS ONLY 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], [l0].[PeriodEnd], [l0].[PeriodStart] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l0] - WHERE [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 [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Level3_Name], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[OneToOne_Optional_PK_Inverse3Id], [l1].[PeriodEnd], [l1].[PeriodStart] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l1] - WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[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 [l2].[Id], [l2].[Level3_Optional_Id], [l2].[Level3_Required_Id], [l2].[Level4_Name], [l2].[OneToMany_Optional_Inverse4Id], [l2].[OneToMany_Required_Inverse4Id], [l2].[OneToOne_Optional_PK_Inverse4Id], [l2].[PeriodEnd], [l2].[PeriodStart] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l2] - WHERE [l2].[Level3_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse4Id] IS NOT NULL + WHERE ([l2].[Level3_Required_Id] IS NOT NULL) AND ([l2].[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] ORDER BY [t].[Name], [t].[Id], [t0].[Id], [t1].[Id]"); } @@ -161,7 +161,7 @@ LEFT JOIN ( FROM ( SELECT 1 AS [c], [l0].[Id], [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]) AS [row] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l0] - WHERE [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] @@ -171,8 +171,8 @@ OUTER APPLY ( WHERE EXISTS ( SELECT 1 FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l2] - 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 [l1].[Id] = [l2].[OneToMany_Optional_Inverse2Id] AND [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] + 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 [l1].[Id] = [l2].[OneToMany_Optional_Inverse2Id] AND [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] END) ) AS [t1] ORDER BY [l].[Id], [t0].[Id]"); @@ -220,7 +220,7 @@ OUTER APPLY ( FROM ( 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], [l0].[PeriodEnd], [l0].[PeriodStart] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l0] - WHERE [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 ( @@ -228,11 +228,11 @@ LEFT JOIN ( FROM ( SELECT [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Level3_Name], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[OneToOne_Optional_PK_Inverse3Id], [l1].[PeriodEnd], [l1].[PeriodStart], ROW_NUMBER() OVER(PARTITION BY [l1].[OneToMany_Required_Inverse3Id] ORDER BY [l1].[Level3_Name] DESC) AS [row] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l1] - WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL AND ([l1].[Level3_Name] <> N'Bar' OR [l1].[Level3_Name] IS NULL) + WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse3Id] IS NOT NULL) AND ([l1].[Level3_Name] <> N'Bar' OR ([l1].[Level3_Name] IS NULL)) ) AS [t1] WHERE 1 < [t1].[row] ) 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] ) AS [t2] ORDER BY [l].[Id], [t2].[Level2_Name], [t2].[Id], [t2].[OneToMany_Required_Inverse3Id], [t2].[Level3_Name] DESC"); @@ -250,7 +250,7 @@ LEFT JOIN ( 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], [l0].[PeriodEnd], [l0].[PeriodStart], ROW_NUMBER() OVER(PARTITION BY [l0].[OneToMany_Optional_Inverse2Id] ORDER BY [l0].[Level2_Name]) AS [row] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l0] - WHERE [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] @@ -259,7 +259,7 @@ LEFT JOIN ( FROM ( 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], [l1].[PeriodEnd], [l1].[PeriodStart], ROW_NUMBER() OVER(PARTITION BY [l1].[OneToMany_Required_Inverse2Id] ORDER BY [l1].[Level2_Name] DESC) AS [row] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l1] - 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 AND ([l1].[Level2_Name] <> N'Bar' OR [l1].[Level2_Name] IS 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) AND ([l1].[Level2_Name] <> N'Bar' OR ([l1].[Level2_Name] IS NULL)) ) AS [t2] WHERE 1 < [t2].[row] ) AS [t1] ON [l].[Id] = [t1].[OneToMany_Required_Inverse2Id] @@ -276,18 +276,18 @@ public override async Task Filtered_include_after_reference_navigation(bool asyn 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], [l0].[PeriodEnd], [l0].[PeriodStart] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l0] - WHERE [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], [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].[PeriodEnd], [t1].[PeriodStart] FROM ( SELECT [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Level3_Name], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[OneToOne_Optional_PK_Inverse3Id], [l1].[PeriodEnd], [l1].[PeriodStart], ROW_NUMBER() OVER(PARTITION BY [l1].[OneToMany_Optional_Inverse3Id] ORDER BY [l1].[Level3_Name]) AS [row] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l1] - WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL AND ([l1].[Level3_Name] <> N'Foo' OR [l1].[Level3_Name] IS NULL) + WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse3Id] IS NOT NULL) AND ([l1].[Level3_Name] <> N'Foo' OR ([l1].[Level3_Name] IS NULL)) ) AS [t1] WHERE 1 < [t1].[row] AND [t1].[row] <= 4 ) 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], [t0].[OneToMany_Optional_Inverse3Id], [t0].[Level3_Name]"); } @@ -303,27 +303,27 @@ 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].[PeriodEnd], [t].[PeriodStart], [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], [t0].[PeriodEnd] AS [PeriodEnd0], [t0].[PeriodStart] AS [PeriodStart0], [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].[PeriodEnd] AS [PeriodEnd1], [t1].[PeriodStart] AS [PeriodStart1], [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], [l0].[PeriodEnd], [l0].[PeriodStart], 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] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l0] - WHERE [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 ( SELECT [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Level3_Name], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[OneToOne_Optional_PK_Inverse3Id], [l1].[PeriodEnd], [l1].[PeriodStart] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l1] - WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[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 [l2].[Id], [l2].[Level3_Optional_Id], [l2].[Level3_Required_Id], [l2].[Level4_Name], [l2].[OneToMany_Optional_Inverse4Id], [l2].[OneToMany_Required_Inverse4Id], [l2].[OneToOne_Optional_PK_Inverse4Id], [l2].[PeriodEnd], [l2].[PeriodStart] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l2] - WHERE [l2].[Level3_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse4Id] IS NOT NULL AND [l2].[Id] > 1 + WHERE ([l2].[Level3_Required_Id] IS NOT NULL) AND ([l2].[OneToMany_Required_Inverse4Id] IS NOT NULL) AND [l2].[Id] > 1 ) 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] ) AS [t2] ORDER BY [l].[Id], [t2].[c], [t2].[Id], [t2].[Id0]"); @@ -340,12 +340,12 @@ 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].[PeriodEnd], [t].[PeriodStart], [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], [l0].[PeriodEnd], [l0].[PeriodStart], 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] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l0] - WHERE [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] @@ -363,12 +363,12 @@ 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].[PeriodEnd], [t].[PeriodStart], [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], [l0].[PeriodEnd], [l0].[PeriodStart], 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] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l0] - WHERE [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] @@ -387,7 +387,7 @@ LEFT JOIN ( 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], [l0].[PeriodEnd], [l0].[PeriodStart], ROW_NUMBER() OVER(PARTITION BY [l0].[OneToMany_Optional_Inverse2Id] ORDER BY [l0].[Level2_Name]) AS [row] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l0] - WHERE [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] @@ -406,7 +406,7 @@ LEFT JOIN ( 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], [l0].[PeriodEnd], [l0].[PeriodStart], ROW_NUMBER() OVER(PARTITION BY [l0].[OneToMany_Optional_Inverse2Id] ORDER BY [l0].[Level2_Name]) AS [row] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l0] - WHERE [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] @@ -425,7 +425,7 @@ LEFT JOIN ( 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], [l0].[PeriodEnd], [l0].[PeriodStart], ROW_NUMBER() OVER(PARTITION BY [l0].[OneToMany_Optional_Inverse2Id] ORDER BY [l0].[Level2_Name]) AS [row] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l0] - WHERE [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] @@ -442,7 +442,7 @@ public override async Task Filtered_include_basic_Where(bool async) 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], [l0].[PeriodEnd], [l0].[PeriodStart] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l0] - WHERE [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]"); } @@ -461,36 +461,36 @@ OUTER APPLY ( SELECT [t].[Id], [t].[Level2_Optional_Id], [t].[Level2_Required_Id], [t].[Level3_Name], [t].[OneToMany_Optional_Inverse3Id], [t].[OneToMany_Required_Inverse3Id], [t].[OneToOne_Optional_PK_Inverse3Id], [t].[PeriodEnd], [t].[PeriodStart], [t0].[Id] AS [Id0], [t0].[Level3_Optional_Id], [t0].[Level3_Required_Id], [t0].[Level4_Name], [t0].[OneToMany_Optional_Inverse4Id], [t0].[OneToMany_Required_Inverse4Id], [t0].[OneToOne_Optional_PK_Inverse4Id], [t0].[PeriodEnd] AS [PeriodEnd0], [t0].[PeriodStart] AS [PeriodStart0], [t1].[Id] AS [Id1], [t1].[Level3_Optional_Id] AS [Level3_Optional_Id0], [t1].[Level3_Required_Id] AS [Level3_Required_Id0], [t1].[Level4_Name] AS [Level4_Name0], [t1].[OneToMany_Optional_Inverse4Id] AS [OneToMany_Optional_Inverse4Id0], [t1].[OneToMany_Required_Inverse4Id] AS [OneToMany_Required_Inverse4Id0], [t1].[OneToOne_Optional_PK_Inverse4Id] AS [OneToOne_Optional_PK_Inverse4Id0], [t1].[PeriodEnd] AS [PeriodEnd1], [t1].[PeriodStart] AS [PeriodStart1], [t].[c] FROM ( SELECT TOP(1) [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Level3_Name], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[OneToOne_Optional_PK_Inverse3Id], [l1].[PeriodEnd], [l1].[PeriodStart], CASE - WHEN [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [l1].[Id] + WHEN ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [l1].[Id] END AS [c] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l1] - WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[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 = [l1].[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 [l1].[OneToMany_Optional_Inverse3Id] IS NULL)) AND ([l1].[Level3_Name] <> N'Foo' OR [l1].[Level3_Name] IS NULL) + WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[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 = [l1].[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 ([l1].[OneToMany_Optional_Inverse3Id] IS NULL))) AND ([l1].[Level3_Name] <> N'Foo' OR ([l1].[Level3_Name] IS NULL)) ORDER BY CASE - WHEN [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [l1].[Id] + WHEN ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [l1].[Id] END ) AS [t] LEFT JOIN ( SELECT [l2].[Id], [l2].[Level3_Optional_Id], [l2].[Level3_Required_Id], [l2].[Level4_Name], [l2].[OneToMany_Optional_Inverse4Id], [l2].[OneToMany_Required_Inverse4Id], [l2].[OneToOne_Optional_PK_Inverse4Id], [l2].[PeriodEnd], [l2].[PeriodStart] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l2] - WHERE [l2].[Level3_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse4Id] IS NOT NULL + WHERE ([l2].[Level3_Required_Id] IS NOT NULL) AND ([l2].[OneToMany_Required_Inverse4Id] IS NOT NULL) ) AS [t0] ON CASE - WHEN [t].[Level2_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [t].[Id] + WHEN ([t].[Level2_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [t].[Id] END = [t0].[OneToMany_Optional_Inverse4Id] LEFT JOIN ( SELECT [l3].[Id], [l3].[Level3_Optional_Id], [l3].[Level3_Required_Id], [l3].[Level4_Name], [l3].[OneToMany_Optional_Inverse4Id], [l3].[OneToMany_Required_Inverse4Id], [l3].[OneToOne_Optional_PK_Inverse4Id], [l3].[PeriodEnd], [l3].[PeriodStart] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l3] - WHERE [l3].[Level3_Required_Id] IS NOT NULL AND [l3].[OneToMany_Required_Inverse4Id] IS NOT NULL + WHERE ([l3].[Level3_Required_Id] IS NOT NULL) AND ([l3].[OneToMany_Required_Inverse4Id] IS NOT NULL) ) AS [t1] ON CASE - WHEN [t].[Level2_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [t].[Id] + WHEN ([t].[Level2_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [t].[Id] END = [t1].[OneToMany_Required_Inverse4Id] ) AS [t2] - WHERE [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 [t3] ON [l].[Id] = [t3].[OneToMany_Optional_Inverse2Id] ORDER BY [l].[Id], [t3].[Id], [t3].[c], [t3].[Id0], [t3].[Id00]"); } @@ -509,36 +509,36 @@ OUTER APPLY ( SELECT [t].[Id], [t].[Level2_Optional_Id], [t].[Level2_Required_Id], [t].[Level3_Name], [t].[OneToMany_Optional_Inverse3Id], [t].[OneToMany_Required_Inverse3Id], [t].[OneToOne_Optional_PK_Inverse3Id], [t].[PeriodEnd], [t].[PeriodStart], [t0].[Id] AS [Id0], [t0].[Level3_Optional_Id], [t0].[Level3_Required_Id], [t0].[Level4_Name], [t0].[OneToMany_Optional_Inverse4Id], [t0].[OneToMany_Required_Inverse4Id], [t0].[OneToOne_Optional_PK_Inverse4Id], [t0].[PeriodEnd] AS [PeriodEnd0], [t0].[PeriodStart] AS [PeriodStart0], [t1].[Id] AS [Id1], [t1].[Level3_Optional_Id] AS [Level3_Optional_Id0], [t1].[Level3_Required_Id] AS [Level3_Required_Id0], [t1].[Level4_Name] AS [Level4_Name0], [t1].[OneToMany_Optional_Inverse4Id] AS [OneToMany_Optional_Inverse4Id0], [t1].[OneToMany_Required_Inverse4Id] AS [OneToMany_Required_Inverse4Id0], [t1].[OneToOne_Optional_PK_Inverse4Id] AS [OneToOne_Optional_PK_Inverse4Id0], [t1].[PeriodEnd] AS [PeriodEnd1], [t1].[PeriodStart] AS [PeriodStart1], [t].[c] FROM ( SELECT TOP(1) [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Level3_Name], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[OneToOne_Optional_PK_Inverse3Id], [l1].[PeriodEnd], [l1].[PeriodStart], CASE - WHEN [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [l1].[Id] + WHEN ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [l1].[Id] END AS [c] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l1] - WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[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 = [l1].[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 [l1].[OneToMany_Optional_Inverse3Id] IS NULL)) AND ([l1].[Level3_Name] <> N'Foo' OR [l1].[Level3_Name] IS NULL) + WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[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 = [l1].[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 ([l1].[OneToMany_Optional_Inverse3Id] IS NULL))) AND ([l1].[Level3_Name] <> N'Foo' OR ([l1].[Level3_Name] IS NULL)) ORDER BY CASE - WHEN [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [l1].[Id] + WHEN ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [l1].[Id] END ) AS [t] LEFT JOIN ( SELECT [l2].[Id], [l2].[Level3_Optional_Id], [l2].[Level3_Required_Id], [l2].[Level4_Name], [l2].[OneToMany_Optional_Inverse4Id], [l2].[OneToMany_Required_Inverse4Id], [l2].[OneToOne_Optional_PK_Inverse4Id], [l2].[PeriodEnd], [l2].[PeriodStart] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l2] - WHERE [l2].[Level3_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse4Id] IS NOT NULL + WHERE ([l2].[Level3_Required_Id] IS NOT NULL) AND ([l2].[OneToMany_Required_Inverse4Id] IS NOT NULL) ) AS [t0] ON CASE - WHEN [t].[Level2_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [t].[Id] + WHEN ([t].[Level2_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [t].[Id] END = [t0].[OneToMany_Optional_Inverse4Id] LEFT JOIN ( SELECT [l3].[Id], [l3].[Level3_Optional_Id], [l3].[Level3_Required_Id], [l3].[Level4_Name], [l3].[OneToMany_Optional_Inverse4Id], [l3].[OneToMany_Required_Inverse4Id], [l3].[OneToOne_Optional_PK_Inverse4Id], [l3].[PeriodEnd], [l3].[PeriodStart] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l3] - WHERE [l3].[Level3_Required_Id] IS NOT NULL AND [l3].[OneToMany_Required_Inverse4Id] IS NOT NULL + WHERE ([l3].[Level3_Required_Id] IS NOT NULL) AND ([l3].[OneToMany_Required_Inverse4Id] IS NOT NULL) ) AS [t1] ON CASE - WHEN [t].[Level2_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [t].[Id] + WHEN ([t].[Level2_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [t].[Id] END = [t1].[OneToMany_Required_Inverse4Id] ) AS [t2] - WHERE [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 [t3] ON [l].[Id] = [t3].[OneToMany_Optional_Inverse2Id] ORDER BY [l].[Id], [t3].[Id], [t3].[c], [t3].[Id0], [t3].[Id00]"); } @@ -559,12 +559,12 @@ 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].[PeriodEnd], [t].[PeriodStart], [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], [l0].[PeriodEnd], [l0].[PeriodStart], 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] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l0] - WHERE [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] @@ -582,12 +582,12 @@ 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].[PeriodEnd], [t].[PeriodStart], [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], [l0].[PeriodEnd], [l0].[PeriodStart], 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] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l0] - WHERE [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] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l1] WHERE [l1].[Id] <> [l0].[Id]) > 1 @@ -622,27 +622,27 @@ 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].[PeriodEnd], [t].[PeriodStart], [t0].[Id] AS [Id0], [t1].[Id] AS [Id1], [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].[PeriodEnd] AS [PeriodEnd0], [t1].[PeriodStart] AS [PeriodStart0], [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], [t0].[PeriodEnd] AS [PeriodEnd1], [t0].[PeriodStart] AS [PeriodStart1], [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], [l0].[PeriodEnd], [l0].[PeriodStart], 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] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l0] - WHERE [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 ( SELECT [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Level3_Name], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[OneToOne_Optional_PK_Inverse3Id], [l1].[PeriodEnd], [l1].[PeriodStart] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l1] - WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[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 [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], [l2].[PeriodEnd], [l2].[PeriodStart] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l2] - 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 [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + WHEN ([t].[OneToOne_Required_PK_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] ) AS [t2] ORDER BY [l].[Id], [t2].[c], [t2].[Id], [t2].[Id0]"); @@ -658,18 +658,18 @@ public override async Task Filtered_include_on_ThenInclude(bool async) 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], [l0].[PeriodEnd], [l0].[PeriodStart] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l0] - WHERE [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], [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].[PeriodEnd], [t1].[PeriodStart] FROM ( SELECT [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Level3_Name], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[OneToOne_Optional_PK_Inverse3Id], [l1].[PeriodEnd], [l1].[PeriodStart], ROW_NUMBER() OVER(PARTITION BY [l1].[OneToMany_Optional_Inverse3Id] ORDER BY [l1].[Level3_Name]) AS [row] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l1] - WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL AND ([l1].[Level3_Name] <> N'Foo' OR [l1].[Level3_Name] IS NULL) + WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse3Id] IS NOT NULL) AND ([l1].[Level3_Name] <> N'Foo' OR ([l1].[Level3_Name] IS NULL)) ) AS [t1] WHERE 1 < [t1].[row] AND [t1].[row] <= 4 ) 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], [t0].[OneToMany_Optional_Inverse3Id], [t0].[Level3_Name]"); } @@ -686,7 +686,7 @@ LEFT JOIN ( 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], [l0].[PeriodEnd], [l0].[PeriodStart], ROW_NUMBER() OVER(PARTITION BY [l0].[OneToMany_Optional_Inverse2Id] ORDER BY [l0].[Id]) AS [row] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l0] - WHERE [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] @@ -705,7 +705,7 @@ LEFT JOIN ( 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], [l0].[PeriodEnd], [l0].[PeriodStart], ROW_NUMBER() OVER(PARTITION BY [l0].[OneToMany_Optional_Inverse2Id] ORDER BY [l0].[Id]) AS [row] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l0] - WHERE [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] @@ -730,15 +730,15 @@ OUTER APPLY ( FROM ( 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], [l0].[PeriodEnd], [l0].[PeriodStart] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l0] - WHERE [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 ( SELECT [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Level3_Name], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[OneToOne_Optional_PK_Inverse3Id], [l1].[PeriodEnd], [l1].[PeriodStart] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l1] - WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[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].[Level2_Optional_Id] ) AS [t1] ORDER BY [t].[Id], [t1].[Level2_Name] DESC, [t1].[Id]"); @@ -757,11 +757,11 @@ LEFT JOIN ( LEFT JOIN ( SELECT [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Level3_Name], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[OneToOne_Optional_PK_Inverse3Id], [l1].[PeriodEnd], [l1].[PeriodStart] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l1] - WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse3Id] IS NOT NULL) ) AS [t] 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 = [t].[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 [t0] ON [l].[Id] = [t0].[OneToMany_Optional_Inverse2Id] ORDER BY [l].[Id], [t0].[Level2_Name], [t0].[Id], [t0].[Level3_Name] DESC"); } @@ -779,12 +779,12 @@ 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].[PeriodEnd], [t].[PeriodStart], [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], [l0].[PeriodEnd], [l0].[PeriodStart], 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] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l0] - WHERE [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] @@ -808,14 +808,14 @@ OUTER APPLY ( FROM ( 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], [l0].[PeriodEnd], [l0].[PeriodStart] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l0] - WHERE [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 [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Level3_Name], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[OneToOne_Optional_PK_Inverse3Id], [l1].[PeriodEnd], [l1].[PeriodStart] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l1] - WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[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].[Level2_Optional_Id] ) AS [t1] ORDER BY [t].[Id], [t1].[Id]"); @@ -840,14 +840,14 @@ OUTER APPLY ( FROM ( 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], [l0].[PeriodEnd], [l0].[PeriodStart] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l0] - WHERE [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 [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Level3_Name], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[OneToOne_Optional_PK_Inverse3Id], [l1].[PeriodEnd], [l1].[PeriodStart] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l1] - WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[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].[Level2_Optional_Id] ) AS [t1] ORDER BY [t].[Id], [t1].[Id]"); @@ -866,11 +866,11 @@ LEFT JOIN ( LEFT JOIN ( SELECT [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Level3_Name], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[OneToOne_Optional_PK_Inverse3Id], [l1].[PeriodEnd], [l1].[PeriodStart] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l1] - WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse3Id] IS NOT NULL) ) AS [t] 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 = [t].[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 [t0] ON [l].[Id] = [t0].[OneToMany_Optional_Inverse2Id] ORDER BY [l].[Id], [t0].[Id], [t0].[Level3_Name]"); } @@ -886,14 +886,14 @@ 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].[PeriodEnd], [t].[PeriodStart] 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], [l0].[PeriodEnd], [l0].[PeriodStart], 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]) AS [row] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l0] - WHERE [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"); } @@ -907,7 +907,7 @@ public override async Task Filtered_include_OrderBy(bool async) 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], [l0].[PeriodEnd], [l0].[PeriodStart] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l0] - WHERE [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]"); } @@ -923,12 +923,12 @@ 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].[PeriodEnd], [t].[PeriodStart], [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], [l0].[PeriodEnd], [l0].[PeriodStart], 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] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l0] - WHERE [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] @@ -946,27 +946,27 @@ 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].[PeriodEnd], [t].[PeriodStart], [t0].[Id] AS [Id0], [t1].[Id] AS [Id1], [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].[PeriodEnd] AS [PeriodEnd0], [t1].[PeriodStart] AS [PeriodStart0], [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], [t0].[PeriodEnd] AS [PeriodEnd1], [t0].[PeriodStart] AS [PeriodStart1], [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], [l0].[PeriodEnd], [l0].[PeriodStart], 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] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l0] - WHERE [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 ( SELECT [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Level3_Name], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[OneToOne_Optional_PK_Inverse3Id], [l1].[PeriodEnd], [l1].[PeriodStart] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l1] - WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[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 [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], [l2].[PeriodEnd], [l2].[PeriodStart] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l2] - 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 [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + WHEN ([t].[OneToOne_Required_PK_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] ) AS [t2] ORDER BY [l].[Id], [t2].[c], [t2].[Id], [t2].[Id0]"); @@ -992,16 +992,16 @@ OUTER APPLY ( 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], [l0].[PeriodEnd], [l0].[PeriodStart] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l0] - WHERE [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] LEFT JOIN ( SELECT [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Level3_Name], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[OneToOne_Optional_PK_Inverse3Id], [l1].[PeriodEnd], [l1].[PeriodStart] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l1] - WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[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].[Level2_Optional_Id] ) AS [t1] ORDER BY [t].[Id] DESC, [t1].[Level2_Name] DESC, [t1].[Id]"); @@ -1017,14 +1017,14 @@ public override async Task Include_after_SelectMany(bool async) 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], [l0].[PeriodEnd], [l0].[PeriodStart] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l0] - WHERE [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 [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Level3_Name], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[OneToOne_Optional_PK_Inverse3Id], [l1].[PeriodEnd], [l1].[PeriodStart] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l1] - WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[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]"); } @@ -1042,11 +1042,11 @@ LEFT JOIN ( LEFT JOIN ( SELECT [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Level3_Name], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[OneToOne_Optional_PK_Inverse3Id], [l1].[PeriodEnd], [l1].[PeriodStart] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l1] - WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse3Id] IS NOT NULL) ) AS [t] 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 = [t].[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 [t0] ON [l].[Id] = [t0].[OneToMany_Optional_Inverse2Id] ORDER BY [l].[Id], [t0].[Id]"); } @@ -1061,7 +1061,7 @@ public override async Task Include_collection(bool async) 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], [l0].[PeriodEnd], [l0].[PeriodStart] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l0] - WHERE [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]"); } @@ -1079,18 +1079,18 @@ LEFT JOIN ( LEFT JOIN ( SELECT [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Level3_Name], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[OneToOne_Optional_PK_Inverse3Id], [l1].[PeriodEnd], [l1].[PeriodStart] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l1] - WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse3Id] IS NOT NULL) ) AS [t] 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 = [t].[OneToOne_Optional_PK_Inverse3Id] LEFT JOIN ( SELECT [l2].[Id], [l2].[Level3_Optional_Id], [l2].[Level3_Required_Id], [l2].[Level4_Name], [l2].[OneToMany_Optional_Inverse4Id], [l2].[OneToMany_Required_Inverse4Id], [l2].[OneToOne_Optional_PK_Inverse4Id], [l2].[PeriodEnd], [l2].[PeriodStart] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l2] - WHERE [l2].[Level3_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse4Id] IS NOT NULL + WHERE ([l2].[Level3_Required_Id] IS NOT NULL) AND ([l2].[OneToMany_Required_Inverse4Id] IS NOT NULL) ) AS [t0] ON CASE - WHEN [t].[Level2_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [t].[Id] + WHEN ([t].[Level2_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [t].[Id] END = [t0].[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 [t1] ON [l].[Id] = [t1].[OneToMany_Optional_Inverse2Id] ORDER BY [l].[Id], [t1].[Id], [t1].[Id0]"); } @@ -1108,32 +1108,32 @@ LEFT JOIN ( LEFT JOIN ( SELECT [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Level3_Name], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[OneToOne_Optional_PK_Inverse3Id], [l1].[PeriodEnd], [l1].[PeriodStart] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l1] - WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse3Id] IS NOT NULL) ) AS [t] 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 = [t].[OneToOne_Optional_PK_Inverse3Id] LEFT JOIN ( SELECT [l2].[Id], [l2].[Level3_Optional_Id], [l2].[Level3_Required_Id], [l2].[Level4_Name], [l2].[OneToMany_Optional_Inverse4Id], [l2].[OneToMany_Required_Inverse4Id], [l2].[OneToOne_Optional_PK_Inverse4Id], [l2].[PeriodEnd], [l2].[PeriodStart] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l2] - WHERE [l2].[Level3_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse4Id] IS NOT NULL + WHERE ([l2].[Level3_Required_Id] IS NOT NULL) AND ([l2].[OneToMany_Required_Inverse4Id] IS NOT NULL) ) AS [t0] ON CASE - WHEN [t].[Level2_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [t].[Id] + WHEN ([t].[Level2_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [t].[Id] END = [t0].[Level3_Optional_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], [l3].[PeriodEnd], [l3].[PeriodStart] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l3] - 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 [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].[Level2_Optional_Id] LEFT JOIN ( SELECT [l4].[Id], [l4].[Level3_Optional_Id], [l4].[Level3_Required_Id], [l4].[Level4_Name], [l4].[OneToMany_Optional_Inverse4Id], [l4].[OneToMany_Required_Inverse4Id], [l4].[OneToOne_Optional_PK_Inverse4Id], [l4].[PeriodEnd], [l4].[PeriodStart] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l4] - WHERE [l4].[Level3_Required_Id] IS NOT NULL AND [l4].[OneToMany_Required_Inverse4Id] IS NOT NULL + WHERE ([l4].[Level3_Required_Id] IS NOT NULL) AND ([l4].[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 [t3] ON [l].[Id] = [t3].[OneToMany_Optional_Inverse2Id] ORDER BY [l].[Id], [t3].[Id], [t3].[Id0], [t3].[Id1], [t3].[Id2]"); } @@ -1151,11 +1151,11 @@ LEFT JOIN ( LEFT JOIN ( SELECT [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Level3_Name], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[OneToOne_Optional_PK_Inverse3Id], [l1].[PeriodEnd], [l1].[PeriodStart] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l1] - WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse3Id] IS NOT NULL) ) AS [t] 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 = [t].[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 [t0] ON [l].[Id] = [t0].[OneToMany_Optional_Inverse2Id] ORDER BY [l].[Id], [t0].[Id]"); } @@ -1170,7 +1170,7 @@ public override async Task Include_collection_followed_by_projecting_the_include 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], [l0].[PeriodEnd], [l0].[PeriodStart] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l0] - WHERE [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]"); } @@ -1188,32 +1188,32 @@ LEFT JOIN ( LEFT JOIN ( SELECT [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Level3_Name], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[OneToOne_Optional_PK_Inverse3Id], [l1].[PeriodEnd], [l1].[PeriodStart] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l1] - WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse3Id] IS NOT NULL) ) AS [t] 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 = [t].[OneToOne_Optional_PK_Inverse3Id] LEFT JOIN ( SELECT [l2].[Id], [l2].[Level3_Optional_Id], [l2].[Level3_Required_Id], [l2].[Level4_Name], [l2].[OneToMany_Optional_Inverse4Id], [l2].[OneToMany_Required_Inverse4Id], [l2].[OneToOne_Optional_PK_Inverse4Id], [l2].[PeriodEnd], [l2].[PeriodStart] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l2] - WHERE [l2].[Level3_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse4Id] IS NOT NULL + WHERE ([l2].[Level3_Required_Id] IS NOT NULL) AND ([l2].[OneToMany_Required_Inverse4Id] IS NOT NULL) ) AS [t0] ON CASE - WHEN [t].[Level2_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [t].[Id] + WHEN ([t].[Level2_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [t].[Id] END = [t0].[Level3_Optional_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], [l3].[PeriodEnd], [l3].[PeriodStart] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l3] - 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 [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].[Level2_Optional_Id] LEFT JOIN ( SELECT [l4].[Id], [l4].[Level3_Optional_Id], [l4].[Level3_Required_Id], [l4].[Level4_Name], [l4].[OneToMany_Optional_Inverse4Id], [l4].[OneToMany_Required_Inverse4Id], [l4].[OneToOne_Optional_PK_Inverse4Id], [l4].[PeriodEnd], [l4].[PeriodStart] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l4] - WHERE [l4].[Level3_Required_Id] IS NOT NULL AND [l4].[OneToMany_Required_Inverse4Id] IS NOT NULL + WHERE ([l4].[Level3_Required_Id] IS NOT NULL) AND ([l4].[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 [t3] ON [l].[Id] = [t3].[OneToMany_Optional_Inverse2Id] ORDER BY [l].[Id], [t3].[Id], [t3].[Id0], [t3].[Id1], [t3].[Id2]"); } @@ -1231,18 +1231,18 @@ LEFT JOIN ( 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], [l3].[PeriodEnd], [l3].[PeriodStart] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l3] - 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 [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 = [t0].[OneToOne_Optional_PK_Inverse3Id] LEFT JOIN ( SELECT [l4].[Id], [l4].[Level3_Optional_Id], [l4].[Level3_Required_Id], [l4].[Level4_Name], [l4].[OneToMany_Optional_Inverse4Id], [l4].[OneToMany_Required_Inverse4Id], [l4].[OneToOne_Optional_PK_Inverse4Id], [l4].[PeriodEnd], [l4].[PeriodStart] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l4] - WHERE [l4].[Level3_Required_Id] IS NOT NULL AND [l4].[OneToMany_Required_Inverse4Id] IS NOT NULL + WHERE ([l4].[Level3_Required_Id] IS NOT NULL) AND ([l4].[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 [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 [l].[Id] = [t1].[OneToMany_Optional_Inverse2Id] WHERE ( SELECT COUNT(*) @@ -1250,11 +1250,11 @@ SELECT COUNT(*) LEFT JOIN ( SELECT [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Level3_Name], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[OneToOne_Optional_PK_Inverse3Id], [l1].[PeriodEnd], [l1].[PeriodStart] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l1] - WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse3Id] IS NOT NULL) ) AS [t] 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 = [t].[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 ([t].[Level3_Name] <> N'Foo' OR [t].[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 ([t].[Level3_Name] <> N'Foo' OR ([t].[Level3_Name] IS NULL))) > 0 ORDER BY [l].[Id], [t1].[Id], [t1].[Id0]"); } @@ -1271,11 +1271,11 @@ LEFT JOIN ( LEFT JOIN ( SELECT [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Level3_Name], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[OneToOne_Optional_PK_Inverse3Id], [l1].[PeriodEnd], [l1].[PeriodStart] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l1] - WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse3Id] IS NOT NULL) ) AS [t] 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 = [t].[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 [t0] ON [l].[Id] = [t0].[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], [l2].[PeriodEnd], [l2].[PeriodStart], [t2].[Id] AS [Id0], [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].[PeriodEnd] AS [PeriodEnd0], [t2].[PeriodStart] AS [PeriodStart0] @@ -1283,11 +1283,11 @@ LEFT JOIN ( 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], [l3].[PeriodEnd], [l3].[PeriodStart] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l3] - 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 [t2] ON 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 = [t2].[OneToOne_Optional_PK_Inverse3Id] - 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 [l].[Id] = [t1].[OneToMany_Optional_Inverse2Id] ORDER BY [l].[Id], [t0].[Id], [t0].[Id0], [t1].[Id]"); } @@ -1305,18 +1305,18 @@ LEFT JOIN ( LEFT JOIN ( SELECT [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Level3_Name], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[OneToOne_Optional_PK_Inverse3Id], [l1].[PeriodEnd], [l1].[PeriodStart] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l1] - WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse3Id] IS NOT NULL) ) AS [t] 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 = [t].[OneToOne_Optional_PK_Inverse3Id] LEFT JOIN ( SELECT [l2].[Id], [l2].[Level3_Optional_Id], [l2].[Level3_Required_Id], [l2].[Level4_Name], [l2].[OneToMany_Optional_Inverse4Id], [l2].[OneToMany_Required_Inverse4Id], [l2].[OneToOne_Optional_PK_Inverse4Id], [l2].[PeriodEnd], [l2].[PeriodStart] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l2] - WHERE [l2].[Level3_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse4Id] IS NOT NULL + WHERE ([l2].[Level3_Required_Id] IS NOT NULL) AND ([l2].[OneToMany_Required_Inverse4Id] IS NOT NULL) ) AS [t0] ON CASE - WHEN [t].[Level2_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [t].[Id] + WHEN ([t].[Level2_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [t].[Id] END = [t0].[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 [t1] ON [l].[Id] = [t1].[OneToMany_Optional_Inverse2Id] ORDER BY [l].[Id], [t1].[Id], [t1].[Id0]"); } @@ -1334,11 +1334,11 @@ LEFT JOIN ( LEFT JOIN ( SELECT [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Level3_Name], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[OneToOne_Optional_PK_Inverse3Id], [l1].[PeriodEnd], [l1].[PeriodStart] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l1] - WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse3Id] IS NOT NULL) ) AS [t] 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 = [t].[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 [t0] ON [l].[Id] = [t0].[OneToMany_Optional_Inverse2Id] ORDER BY [l].[Id], [t0].[Id]"); } @@ -1353,10 +1353,10 @@ public override async Task Include_collection_with_conditional_order_by(bool asy 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], [l0].[PeriodEnd], [l0].[PeriodStart] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l0] - WHERE [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]"); } @@ -1383,7 +1383,7 @@ LEFT JOIN ( 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], [l1].[PeriodEnd], [l1].[PeriodStart] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l1] - 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]"); } @@ -1398,7 +1398,7 @@ public override async Task Include_collection_with_groupby_in_subquery_and_filte SELECT [l].[Name] FROM [Level1] 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].[PeriodEnd], [t1].[PeriodStart] @@ -1411,7 +1411,7 @@ LEFT JOIN ( 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], [l1].[PeriodEnd], [l1].[PeriodStart] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l1] - 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]"); } @@ -1440,7 +1440,7 @@ WHERE [l0].[Id] > 3 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], [l1].[PeriodEnd], [l1].[PeriodStart] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l1] - 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]"); } @@ -1455,7 +1455,7 @@ public override async Task Include_nested_with_optional_navigation(bool async) 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], [l0].[PeriodEnd], [l0].[PeriodStart] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l0] - WHERE [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 [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Level3_Name], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[OneToOne_Optional_PK_Inverse3Id], [l1].[PeriodEnd], [l1].[PeriodStart], [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], [t1].[PeriodEnd] AS [PeriodEnd0], [t1].[PeriodStart] AS [PeriodStart0] @@ -1463,15 +1463,15 @@ LEFT JOIN ( LEFT JOIN ( SELECT [l2].[Id], [l2].[Level3_Optional_Id], [l2].[Level3_Required_Id], [l2].[Level4_Name], [l2].[OneToMany_Optional_Inverse4Id], [l2].[OneToMany_Required_Inverse4Id], [l2].[OneToOne_Optional_PK_Inverse4Id], [l2].[PeriodEnd], [l2].[PeriodStart] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l2] - WHERE [l2].[Level3_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse4Id] IS NOT NULL + WHERE ([l2].[Level3_Required_Id] IS NOT NULL) AND ([l2].[OneToMany_Required_Inverse4Id] IS NOT NULL) ) AS [t1] ON CASE - WHEN [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [l1].[Id] + WHEN ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [l1].[Id] END = [t1].[Level3_Required_Id] - WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[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] -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], [t0].[Id]"); } @@ -1485,12 +1485,12 @@ public override async Task Include_partially_added_before_Where_and_then_build_u 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] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l0] - WHERE [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 [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], [l1].[PeriodEnd], [l1].[PeriodStart] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l1] - 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 [t0] ON [l].[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], [l2].[PeriodEnd], [l2].[PeriodStart], [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], [t2].[PeriodEnd] AS [PeriodEnd0], [t2].[PeriodStart] AS [PeriodStart0] @@ -1498,18 +1498,18 @@ LEFT JOIN ( LEFT JOIN ( SELECT [l3].[Id], [l3].[Level3_Optional_Id], [l3].[Level3_Required_Id], [l3].[Level4_Name], [l3].[OneToMany_Optional_Inverse4Id], [l3].[OneToMany_Required_Inverse4Id], [l3].[OneToOne_Optional_PK_Inverse4Id], [l3].[PeriodEnd], [l3].[PeriodStart] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l3] - WHERE [l3].[Level3_Required_Id] IS NOT NULL AND [l3].[OneToMany_Required_Inverse4Id] IS NOT NULL + WHERE ([l3].[Level3_Required_Id] IS NOT NULL) AND ([l3].[OneToMany_Required_Inverse4Id] IS NOT NULL) ) AS [t2] 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 = [t2].[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 [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 CASE - WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + WHEN ([t].[OneToOne_Required_PK_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], [t0].[Id], [t1].[Id]"); } @@ -1524,27 +1524,27 @@ public override async Task Include_partially_added_before_Where_and_then_build_u 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] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l0] - WHERE [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 [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], [l1].[PeriodEnd], [l1].[PeriodStart] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l1] - 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 [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].[PeriodEnd], [t2].[PeriodStart], [t2].[c] FROM ( 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], [l2].[PeriodEnd], [l2].[PeriodStart], 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], 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] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l2] - 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 [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 [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], [l3].[PeriodEnd], [l3].[PeriodStart], [t4].[Id] AS [Id0], [t4].[Level3_Optional_Id], [t4].[Level3_Required_Id], [t4].[Level4_Name], [t4].[OneToMany_Optional_Inverse4Id], [t4].[OneToMany_Required_Inverse4Id], [t4].[OneToOne_Optional_PK_Inverse4Id], [t4].[PeriodEnd] AS [PeriodEnd0], [t4].[PeriodStart] AS [PeriodStart0] @@ -1552,18 +1552,18 @@ LEFT JOIN ( LEFT JOIN ( SELECT [l4].[Id], [l4].[Level3_Optional_Id], [l4].[Level3_Required_Id], [l4].[Level4_Name], [l4].[OneToMany_Optional_Inverse4Id], [l4].[OneToMany_Required_Inverse4Id], [l4].[OneToOne_Optional_PK_Inverse4Id], [l4].[PeriodEnd], [l4].[PeriodStart] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l4] - WHERE [l4].[Level3_Required_Id] IS NOT NULL AND [l4].[OneToMany_Required_Inverse4Id] IS NOT NULL + WHERE ([l4].[Level3_Required_Id] IS NOT NULL) AND ([l4].[OneToMany_Required_Inverse4Id] IS NOT NULL) ) AS [t4] ON CASE - WHEN [l3].[Level2_Required_Id] IS NOT NULL AND [l3].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [l3].[Id] + WHEN ([l3].[Level2_Required_Id] IS NOT NULL) AND ([l3].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [l3].[Id] END = [t4].[Level3_Optional_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 [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] 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], [t0].[Id], [t1].[OneToMany_Optional_Inverse3Id], [t1].[c], [t1].[Id], [t3].[Id]"); } @@ -1578,14 +1578,14 @@ public override async Task Include_reference_and_collection_order_by(bool async) 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], [l0].[PeriodEnd], [l0].[PeriodStart] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l0] - WHERE [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 [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Level3_Name], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[OneToOne_Optional_PK_Inverse3Id], [l1].[PeriodEnd], [l1].[PeriodStart] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l1] - WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[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]"); } @@ -1600,17 +1600,17 @@ public override async Task Include_reference_collection_order_by_reference_navig 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], [l0].[PeriodEnd], [l0].[PeriodStart] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l0] - WHERE [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 [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Level3_Name], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[OneToOne_Optional_PK_Inverse3Id], [l1].[PeriodEnd], [l1].[PeriodStart] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l1] - WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[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]"); } @@ -1624,14 +1624,14 @@ public override async Task Include_reference_followed_by_include_collection(bool 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], [l0].[PeriodEnd], [l0].[PeriodStart] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l0] - WHERE [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 [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Level3_Name], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[OneToOne_Optional_PK_Inverse3Id], [l1].[PeriodEnd], [l1].[PeriodStart] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l1] - WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[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]"); } @@ -1646,14 +1646,14 @@ public override async Task Include_reference_ThenInclude_collection_order_by(boo 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], [l0].[PeriodEnd], [l0].[PeriodStart] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l0] - WHERE [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 [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Level3_Name], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[OneToOne_Optional_PK_Inverse3Id], [l1].[PeriodEnd], [l1].[PeriodStart] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l1] - WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[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]"); } @@ -1671,18 +1671,18 @@ LEFT JOIN ( LEFT JOIN ( SELECT [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Level3_Name], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[OneToOne_Optional_PK_Inverse3Id], [l1].[PeriodEnd], [l1].[PeriodStart] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l1] - WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse3Id] IS NOT NULL) ) AS [t] 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 = [t].[OneToOne_Optional_PK_Inverse3Id] LEFT JOIN ( SELECT [l2].[Id], [l2].[Level3_Optional_Id], [l2].[Level3_Required_Id], [l2].[Level4_Name], [l2].[OneToMany_Optional_Inverse4Id], [l2].[OneToMany_Required_Inverse4Id], [l2].[OneToOne_Optional_PK_Inverse4Id], [l2].[PeriodEnd], [l2].[PeriodStart] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l2] - WHERE [l2].[Level3_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse4Id] IS NOT NULL + WHERE ([l2].[Level3_Required_Id] IS NOT NULL) AND ([l2].[OneToMany_Required_Inverse4Id] IS NOT NULL) ) AS [t0] ON CASE - WHEN [t].[Level2_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [t].[Id] + WHEN ([t].[Level2_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [t].[Id] END = [t0].[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 [t1] ON [l].[Id] = [t1].[OneToMany_Optional_Inverse2Id] ORDER BY [l].[Id], [t1].[Id1], [t1].[Id]"); } @@ -1697,19 +1697,19 @@ public override async Task Including_reference_navigation_and_projecting_collect 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], [l0].[PeriodEnd], [l0].[PeriodStart] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l0] - WHERE [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 [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Level3_Name], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[OneToOne_Optional_PK_Inverse3Id], [l1].[PeriodEnd], [l1].[PeriodStart] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l1] - WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[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 [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], [l2].[PeriodEnd], [l2].[PeriodStart] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l2] - 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 [l].[Id] = [t1].[OneToMany_Required_Inverse2Id] ORDER BY [l].[Id], [t].[Id], [t0].[Id]"); } @@ -1720,8 +1720,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], [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].[PeriodEnd], [t1].[PeriodStart] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l] LEFT JOIN ( @@ -1730,18 +1730,18 @@ LEFT JOIN ( LEFT JOIN ( SELECT [l1].[Id], [l1].[OneToOne_Required_PK_Date], [l1].[Level1_Required_Id], [l1].[OneToMany_Required_Inverse2Id] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l1] - 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 [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], [l2].[PeriodEnd], [l2].[PeriodStart] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l2] - 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].[OneToMany_Required_Inverse3Id] WHERE [l].[Name] IN (N'L1 01', N'L1 02') ORDER BY [l].[Id], [t0].[Id], [t0].[Id0]"); @@ -1763,19 +1763,19 @@ LEFT JOIN ( SELECT [t1].[Id], [t1].[c], [t1].[Id0], [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], [l0].[OneToMany_Required_Inverse2Id], ROW_NUMBER() OVER(PARTITION BY [l0].[OneToMany_Required_Inverse2Id] ORDER BY [l0].[Id]) AS [row] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l0] - WHERE [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 [l1].[OneToOne_Required_PK_Date] IS NOT NULL AND [l1].[Level1_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [l1].[Id] + WHEN ([l1].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l1].[Level1_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [l1].[Id] END AS [Id], [l1].[Id] AS [Id0], [l1].[OneToMany_Required_Inverse2Id] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l1] - 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 [t].[Id] = [t2].[OneToMany_Required_Inverse2Id] ORDER BY [t].[Id], [t0].[Id0]"); } @@ -1790,14 +1790,14 @@ public override async Task Multiple_complex_includes(bool async) 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], [l0].[PeriodEnd], [l0].[PeriodStart] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l0] - WHERE [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 [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Level3_Name], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[OneToOne_Optional_PK_Inverse3Id], [l1].[PeriodEnd], [l1].[PeriodStart] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l1] - WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[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 [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], [l2].[PeriodEnd], [l2].[PeriodStart], [t2].[Id] AS [Id0], [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].[PeriodEnd] AS [PeriodEnd0], [t2].[PeriodStart] AS [PeriodStart0] @@ -1805,11 +1805,11 @@ LEFT JOIN ( 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], [l3].[PeriodEnd], [l3].[PeriodStart] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l3] - 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 [t2] ON 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 = [t2].[Level2_Optional_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 [l].[Id] = [t1].[OneToMany_Optional_Inverse2Id] ORDER BY [l].[Id], [t].[Id], [t0].[Id], [t1].[Id]"); } @@ -1824,14 +1824,14 @@ public override async Task Multiple_complex_include_select(bool async) 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], [l0].[PeriodEnd], [l0].[PeriodStart] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l0] - WHERE [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 [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Level3_Name], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[OneToOne_Optional_PK_Inverse3Id], [l1].[PeriodEnd], [l1].[PeriodStart] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l1] - WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[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 [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], [l2].[PeriodEnd], [l2].[PeriodStart], [t2].[Id] AS [Id0], [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].[PeriodEnd] AS [PeriodEnd0], [t2].[PeriodStart] AS [PeriodStart0] @@ -1839,11 +1839,11 @@ LEFT JOIN ( 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], [l3].[PeriodEnd], [l3].[PeriodStart] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l3] - 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 [t2] ON 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 = [t2].[Level2_Optional_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 [l].[Id] = [t1].[OneToMany_Optional_Inverse2Id] ORDER BY [l].[Id], [t].[Id], [t0].[Id], [t1].[Id]"); } @@ -1858,42 +1858,42 @@ public override async Task Multiple_include_with_multiple_optional_navigations(b 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], [l0].[PeriodEnd], [l0].[PeriodStart] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l0] - WHERE [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 [l1].[Id], [l1].[Level3_Name], [l1].[OneToOne_Optional_PK_Inverse3Id] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l1] - WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[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 [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], [l2].[PeriodEnd], [l2].[PeriodStart] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l2] - 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 [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + WHEN ([t].[OneToOne_Required_PK_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] 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], [l3].[PeriodEnd], [l3].[PeriodStart] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l3] - WHERE [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 [l].[Id] = [t2].[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], [l4].[PeriodEnd], [l4].[PeriodStart] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l4] - 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 [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 [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], [l5].[PeriodEnd], [l5].[PeriodStart] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l5] - 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 [t4] 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 = [t4].[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], [t0].[Id], [t1].[Id], [t2].[Id], [t3].[Id]"); } @@ -1907,21 +1907,21 @@ public override async Task Multiple_optional_navigation_with_Include(bool async) LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[OneToMany_Required_Inverse2Id] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l0] - WHERE [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 [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Level3_Name], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[OneToOne_Optional_PK_Inverse3Id], [l1].[PeriodEnd], [l1].[PeriodStart] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l1] - WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[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 [l2].[Id], [l2].[Level3_Optional_Id], [l2].[Level3_Required_Id], [l2].[Level4_Name], [l2].[OneToMany_Optional_Inverse4Id], [l2].[OneToMany_Required_Inverse4Id], [l2].[OneToOne_Optional_PK_Inverse4Id], [l2].[PeriodEnd], [l2].[PeriodStart] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l2] - WHERE [l2].[Level3_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse4Id] IS NOT NULL + WHERE ([l2].[Level3_Required_Id] IS NOT NULL) AND ([l2].[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] ORDER BY [l].[Id], [t].[Id], [t0].[Id]"); } @@ -1936,21 +1936,21 @@ public override async Task Multiple_optional_navigation_with_string_based_Includ LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[OneToMany_Required_Inverse2Id] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l0] - WHERE [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 [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Level3_Name], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[OneToOne_Optional_PK_Inverse3Id], [l1].[PeriodEnd], [l1].[PeriodStart] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l1] - WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[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 [l2].[Id], [l2].[Level3_Optional_Id], [l2].[Level3_Required_Id], [l2].[Level4_Name], [l2].[OneToMany_Optional_Inverse4Id], [l2].[OneToMany_Required_Inverse4Id], [l2].[OneToOne_Optional_PK_Inverse4Id], [l2].[PeriodEnd], [l2].[PeriodStart] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l2] - WHERE [l2].[Level3_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse4Id] IS NOT NULL + WHERE ([l2].[Level3_Required_Id] IS NOT NULL) AND ([l2].[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] ORDER BY [l].[Id], [t].[Id], [t0].[Id]"); } @@ -1961,27 +1961,27 @@ 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], [t0].[Id], [t1].[Id], [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].[PeriodEnd], [t1].[PeriodStart] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l] INNER JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Required_Id], [l0].[OneToMany_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l0] - WHERE [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 [l1].[Id], [l1].[Level2_Required_Id], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l1] - WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[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 [l2].[Id], [l2].[Level3_Optional_Id], [l2].[Level3_Required_Id], [l2].[Level4_Name], [l2].[OneToMany_Optional_Inverse4Id], [l2].[OneToMany_Required_Inverse4Id], [l2].[OneToOne_Optional_PK_Inverse4Id], [l2].[PeriodEnd], [l2].[PeriodStart] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l2] - WHERE [l2].[Level3_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse4Id] IS NOT NULL + WHERE ([l2].[Level3_Required_Id] IS NOT NULL) AND ([l2].[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] ORDER BY [l].[Id], [t].[Id], [t0].[Id]"); } @@ -1996,28 +1996,28 @@ public override async Task Multiple_SelectMany_with_Include(bool async) INNER JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Required_Id], [l0].[OneToMany_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l0] - WHERE [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 [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Level3_Name], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[OneToOne_Optional_PK_Inverse3Id], [l1].[PeriodEnd], [l1].[PeriodStart] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l1] - WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[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 [l2].[Id], [l2].[Level3_Optional_Id], [l2].[Level3_Required_Id], [l2].[Level4_Name], [l2].[OneToMany_Optional_Inverse4Id], [l2].[OneToMany_Required_Inverse4Id], [l2].[OneToOne_Optional_PK_Inverse4Id], [l2].[PeriodEnd], [l2].[PeriodStart] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l2] - WHERE [l2].[Level3_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse4Id] IS NOT NULL + WHERE ([l2].[Level3_Required_Id] IS NOT NULL) AND ([l2].[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_Required_Id] LEFT JOIN ( SELECT [l3].[Id], [l3].[Level3_Optional_Id], [l3].[Level3_Required_Id], [l3].[Level4_Name], [l3].[OneToMany_Optional_Inverse4Id], [l3].[OneToMany_Required_Inverse4Id], [l3].[OneToOne_Optional_PK_Inverse4Id], [l3].[PeriodEnd], [l3].[PeriodStart] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l3] - WHERE [l3].[Level3_Required_Id] IS NOT NULL AND [l3].[OneToMany_Required_Inverse4Id] IS NOT NULL + WHERE ([l3].[Level3_Required_Id] IS NOT NULL) AND ([l3].[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], [t0].[Id], [t1].[Id]"); } @@ -2039,22 +2039,22 @@ LEFT JOIN ( INNER 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], [l2].[PeriodEnd], [l2].[PeriodStart] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l2] - 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].[OneToMany_Required_Inverse3Id] = CASE - WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + WHEN ([t].[OneToOne_Required_PK_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], [l3].[PeriodEnd], [l3].[PeriodStart] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l3] - 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 = [t0].[OneToMany_Optional_Inverse3Id] - WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse3Id] IS NOT NULL) ) 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] - WHERE [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 [t2] ON [l].[Id] = [t2].[OneToMany_Optional_Inverse2Id] ORDER BY [l].[Id], [t2].[Id], [t2].[Id0], [t2].[Id00]"); } @@ -2072,11 +2072,11 @@ LEFT JOIN ( LEFT JOIN ( SELECT [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Level3_Name], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[OneToOne_Optional_PK_Inverse3Id], [l1].[PeriodEnd], [l1].[PeriodStart] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l1] - WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse3Id] IS NOT NULL) ) AS [t] 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 = [t].[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 [t0] ON [l].[Id] = [t0].[OneToMany_Optional_Inverse2Id] ORDER BY [l].[Id], [t0].[Id]"); } @@ -2090,18 +2090,18 @@ public override async Task Null_check_in_anonymous_type_projection_should_not_be FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l] LEFT JOIN ( SELECT CASE - WHEN [t].[Level2_Required_Id] IS NULL OR [t].[OneToMany_Required_Inverse3Id] IS NULL THEN CAST(1 AS bit) + WHEN ([t].[Level2_Required_Id] IS NULL) OR ([t].[OneToMany_Required_Inverse3Id] IS NULL) THEN CAST(1 AS bit) ELSE CAST(0 AS bit) END AS [c], [t].[Level3_Name], [l0].[Id], [t].[Id] AS [Id0], [l0].[OneToMany_Optional_Inverse2Id] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l0] LEFT JOIN ( SELECT [l1].[Id], [l1].[Level2_Required_Id], [l1].[Level3_Name], [l1].[OneToMany_Required_Inverse3Id] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l1] - WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse3Id] IS NOT NULL) ) AS [t] 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 = [t].[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 [t0] ON [l].[Id] = [t0].[OneToMany_Optional_Inverse2Id] ORDER BY [l].[Id], [t0].[Id]"); } @@ -2115,18 +2115,18 @@ public override async Task Null_check_in_Dto_projection_should_not_be_removed(bo FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l] LEFT JOIN ( SELECT CASE - WHEN [t].[Level2_Required_Id] IS NULL OR [t].[OneToMany_Required_Inverse3Id] IS NULL THEN CAST(1 AS bit) + WHEN ([t].[Level2_Required_Id] IS NULL) OR ([t].[OneToMany_Required_Inverse3Id] IS NULL) THEN CAST(1 AS bit) ELSE CAST(0 AS bit) END AS [c], [t].[Level3_Name], [l0].[Id], [t].[Id] AS [Id0], [l0].[OneToMany_Optional_Inverse2Id] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l0] LEFT JOIN ( SELECT [l1].[Id], [l1].[Level2_Required_Id], [l1].[Level3_Name], [l1].[OneToMany_Required_Inverse3Id] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l1] - WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse3Id] IS NOT NULL) ) AS [t] 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 = [t].[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 [t0] ON [l].[Id] = [t0].[OneToMany_Optional_Inverse2Id] ORDER BY [l].[Id], [t0].[Id]"); } @@ -2141,14 +2141,14 @@ public override async Task Optional_navigation_with_Include_and_order(bool async 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], [l0].[PeriodEnd], [l0].[PeriodStart] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l0] - WHERE [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 [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Level3_Name], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[OneToOne_Optional_PK_Inverse3Id], [l1].[PeriodEnd], [l1].[PeriodStart] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l1] - WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[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]"); } @@ -2163,7 +2163,7 @@ public override async Task Optional_navigation_with_Include_ThenInclude(bool asy 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], [l0].[PeriodEnd], [l0].[PeriodStart] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l0] - WHERE [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 [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Level3_Name], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[OneToOne_Optional_PK_Inverse3Id], [l1].[PeriodEnd], [l1].[PeriodStart], [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], [t1].[PeriodEnd] AS [PeriodEnd0], [t1].[PeriodStart] AS [PeriodStart0] @@ -2171,13 +2171,13 @@ LEFT JOIN ( LEFT JOIN ( SELECT [l2].[Id], [l2].[Level3_Optional_Id], [l2].[Level3_Required_Id], [l2].[Level4_Name], [l2].[OneToMany_Optional_Inverse4Id], [l2].[OneToMany_Required_Inverse4Id], [l2].[OneToOne_Optional_PK_Inverse4Id], [l2].[PeriodEnd], [l2].[PeriodStart] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l2] - WHERE [l2].[Level3_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse4Id] IS NOT NULL + WHERE ([l2].[Level3_Required_Id] IS NOT NULL) AND ([l2].[OneToMany_Required_Inverse4Id] IS NOT NULL) ) AS [t1] ON CASE - WHEN [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [l1].[Id] + WHEN ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [l1].[Id] END = [t1].[Level3_Optional_Id] - WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[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], [t0].[Id]"); } @@ -2192,14 +2192,14 @@ public override async Task Optional_navigation_with_order_by_and_Include(bool as 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], [l0].[PeriodEnd], [l0].[PeriodStart] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l0] - WHERE [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 [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Level3_Name], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[OneToOne_Optional_PK_Inverse3Id], [l1].[PeriodEnd], [l1].[PeriodStart] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l1] - WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[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]"); } @@ -2214,14 +2214,14 @@ public override async Task Orderby_SelectMany_with_Include1(bool async) 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], [l0].[PeriodEnd], [l0].[PeriodStart] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l0] - WHERE [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 [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Level3_Name], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[OneToOne_Optional_PK_Inverse3Id], [l1].[PeriodEnd], [l1].[PeriodStart] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l1] - WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[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]"); } @@ -2240,7 +2240,7 @@ SELECT TOP(1) [l].[Id] 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], [l0].[PeriodEnd], [l0].[PeriodStart] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l0] - WHERE [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]"); } @@ -2255,12 +2255,12 @@ public override async Task Project_collection_and_include(bool async) 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], [l0].[PeriodEnd], [l0].[PeriodStart] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l0] - WHERE [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 [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], [l1].[PeriodEnd], [l1].[PeriodStart] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l1] - 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 [t0] ON [l].[Id] = [t0].[OneToMany_Optional_Inverse2Id] ORDER BY [l].[Id], [t].[Id]"); } @@ -2275,7 +2275,7 @@ public override async Task Project_collection_and_root_entity(bool async) 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], [l0].[PeriodEnd], [l0].[PeriodStart] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l0] - WHERE [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]"); } @@ -2290,7 +2290,7 @@ public override async Task Project_collection_navigation(bool async) 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], [l0].[PeriodEnd], [l0].[PeriodStart] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l0] - WHERE [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]"); } @@ -2305,7 +2305,7 @@ public override async Task Project_collection_navigation_composed(bool async) 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], [l0].[PeriodEnd], [l0].[PeriodStart] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l0] - WHERE [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]"); @@ -2321,14 +2321,14 @@ public override async Task Project_collection_navigation_nested(bool async) LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[OneToMany_Required_Inverse2Id] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l0] - WHERE [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 [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Level3_Name], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[OneToOne_Optional_PK_Inverse3Id], [l1].[PeriodEnd], [l1].[PeriodStart] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l1] - WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[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]"); } @@ -2343,14 +2343,14 @@ public override async Task Project_collection_navigation_nested_anonymous(bool a LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[OneToMany_Required_Inverse2Id] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l0] - WHERE [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 [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Level3_Name], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[OneToOne_Optional_PK_Inverse3Id], [l1].[PeriodEnd], [l1].[PeriodStart] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l1] - WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[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]"); } @@ -2365,18 +2365,18 @@ public override async Task Project_collection_navigation_nested_with_take(bool a LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[OneToMany_Required_Inverse2Id] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l0] - WHERE [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], [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].[PeriodEnd], [t1].[PeriodStart] FROM ( SELECT [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Level3_Name], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[OneToOne_Optional_PK_Inverse3Id], [l1].[PeriodEnd], [l1].[PeriodStart], ROW_NUMBER() OVER(PARTITION BY [l1].[OneToMany_Optional_Inverse3Id] ORDER BY [l1].[Id]) AS [row] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l1] - WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse3Id] IS NOT NULL) ) AS [t1] WHERE [t1].[row] <= 50 ) 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]"); } @@ -2391,14 +2391,14 @@ public override async Task Project_collection_navigation_using_ef_property(bool LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[OneToMany_Required_Inverse2Id] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l0] - WHERE [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 [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Level3_Name], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[OneToOne_Optional_PK_Inverse3Id], [l1].[PeriodEnd], [l1].[PeriodStart] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l1] - WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[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]"); } @@ -2413,14 +2413,14 @@ public override async Task Project_navigation_and_collection(bool async) 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], [l0].[PeriodEnd], [l0].[PeriodStart] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l0] - WHERE [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 [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Level3_Name], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[OneToOne_Optional_PK_Inverse3Id], [l1].[PeriodEnd], [l1].[PeriodStart] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l1] - WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[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]"); } @@ -2431,20 +2431,20 @@ 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], [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].[PeriodEnd], [t0].[PeriodStart] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l] INNER JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Required_Id], [l0].[OneToMany_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l0] - WHERE [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 [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Level3_Name], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[OneToOne_Optional_PK_Inverse3Id], [l1].[PeriodEnd], [l1].[PeriodStart] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l1] - WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[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]"); } @@ -2459,21 +2459,21 @@ public override async Task SelectMany_navigation_property_with_include_and_follo 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], [l0].[PeriodEnd], [l0].[PeriodStart] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l0] - WHERE [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 [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Level3_Name], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[OneToOne_Optional_PK_Inverse3Id], [l1].[PeriodEnd], [l1].[PeriodStart] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l1] - WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[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 [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], [l2].[PeriodEnd], [l2].[PeriodStart] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l2] - 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 [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + WHEN ([t].[OneToOne_Required_PK_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], [t0].[Id]"); } @@ -2488,14 +2488,14 @@ public override async Task SelectMany_with_Include1(bool async) 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], [l0].[PeriodEnd], [l0].[PeriodStart] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l0] - WHERE [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 [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Level3_Name], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[OneToOne_Optional_PK_Inverse3Id], [l1].[PeriodEnd], [l1].[PeriodStart] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l1] - WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[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]"); } @@ -2510,14 +2510,14 @@ public override async Task SelectMany_with_Include2(bool async) 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], [l0].[PeriodEnd], [l0].[PeriodStart] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l0] - WHERE [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 [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Level3_Name], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[OneToOne_Optional_PK_Inverse3Id], [l1].[PeriodEnd], [l1].[PeriodStart] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l1] - WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[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]"); } @@ -2531,14 +2531,14 @@ public override async Task SelectMany_with_Include_and_order_by(bool async) 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], [l0].[PeriodEnd], [l0].[PeriodStart] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l0] - WHERE [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 [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Level3_Name], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[OneToOne_Optional_PK_Inverse3Id], [l1].[PeriodEnd], [l1].[PeriodStart] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l1] - WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[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]"); } @@ -2553,21 +2553,21 @@ public override async Task SelectMany_with_Include_ThenInclude(bool async) 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], [l0].[PeriodEnd], [l0].[PeriodStart] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l0] - WHERE [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 [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Level3_Name], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[OneToOne_Optional_PK_Inverse3Id], [l1].[PeriodEnd], [l1].[PeriodStart] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l1] - WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[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 [l2].[Id], [l2].[Level3_Optional_Id], [l2].[Level3_Required_Id], [l2].[Level4_Name], [l2].[OneToMany_Optional_Inverse4Id], [l2].[OneToMany_Required_Inverse4Id], [l2].[OneToOne_Optional_PK_Inverse4Id], [l2].[PeriodEnd], [l2].[PeriodStart] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l2] - WHERE [l2].[Level3_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse4Id] IS NOT NULL + WHERE ([l2].[Level3_Required_Id] IS NOT NULL) AND ([l2].[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] ORDER BY [l].[Id], [t].[Id], [t0].[Id]"); } @@ -2582,14 +2582,14 @@ public override async Task SelectMany_with_navigation_and_Distinct(bool async) 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], [l0].[PeriodEnd], [l0].[PeriodStart] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l0] - WHERE [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 [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], [l1].[PeriodEnd], [l1].[PeriodStart] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l1] - 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 [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]"); } @@ -2603,14 +2603,14 @@ public override async Task SelectMany_with_order_by_and_Include(bool async) 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], [l0].[PeriodEnd], [l0].[PeriodStart] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l0] - WHERE [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 [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Level3_Name], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[OneToOne_Optional_PK_Inverse3Id], [l1].[PeriodEnd], [l1].[PeriodStart] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l1] - WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[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]"); } @@ -2624,10 +2624,10 @@ public override async Task Select_nav_prop_collection_one_to_many_required(bool FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' 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], [l0].[OneToMany_Required_Inverse2Id] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l0] - WHERE [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]"); } @@ -2643,21 +2643,21 @@ LEFT JOIN ( SELECT [t].[c], [t].[Id], [t].[OneToOne_Required_PK_Date], [t].[Level1_Required_Id], [t].[OneToMany_Required_Inverse2Id], [t].[OneToMany_Optional_Inverse2Id] FROM ( SELECT 1 AS [c], [l0].[Id], [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] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l0] - WHERE [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 [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [l1].[Id] + WHEN ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [l1].[Id] END AS [Id], [l1].[Id] AS [Id0], [l1].[OneToMany_Optional_Inverse3Id] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l1] - WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[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], [t1].[Id]"); } @@ -2671,32 +2671,32 @@ public override async Task Select_subquery_single_nested_subquery2(bool async) FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l] LEFT JOIN ( SELECT [l0].[Id], [t0].[Id] AS [Id0], [t1].[Id] AS [Id1], [t1].[Id0] AS [Id00], [t0].[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] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l0] LEFT JOIN ( SELECT [t].[c], [t].[Id], [t].[Level2_Required_Id], [t].[OneToMany_Required_Inverse3Id], [t].[OneToMany_Optional_Inverse3Id] FROM ( SELECT 1 AS [c], [l1].[Id], [l1].[Level2_Required_Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[OneToMany_Optional_Inverse3Id], ROW_NUMBER() OVER(PARTITION BY [l1].[OneToMany_Optional_Inverse3Id] ORDER BY CASE - WHEN [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [l1].[Id] + WHEN ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [l1].[Id] END) AS [row] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l1] - WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL + WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse3Id] IS NOT NULL) ) AS [t] WHERE [t].[row] <= 1 ) 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] LEFT JOIN ( SELECT CASE - WHEN [l2].[Level3_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse4Id] IS NOT NULL THEN [l2].[Id] + WHEN ([l2].[Level3_Required_Id] IS NOT NULL) AND ([l2].[OneToMany_Required_Inverse4Id] IS NOT NULL) THEN [l2].[Id] END AS [Id], [l2].[Id] AS [Id0], [l2].[OneToMany_Optional_Inverse4Id] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l2] - WHERE [l2].[Level3_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse4Id] IS NOT NULL + WHERE ([l2].[Level3_Required_Id] IS NOT NULL) AND ([l2].[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] - WHERE [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 [t2] ON [l].[Id] = [t2].[OneToMany_Optional_Inverse2Id] ORDER BY [l].[Id], [t2].[c0], [t2].[Id], [t2].[Id0], [t2].[Id1]"); } @@ -2781,7 +2781,7 @@ OUTER APPLY ( FROM ( SELECT [l0].[Date] FROM [Level1] 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 ( @@ -2789,7 +2789,7 @@ LEFT JOIN ( FROM ( SELECT [l1].[Id], [l1].[Date], [l1].[Name], [l1].[PeriodEnd], [l1].[PeriodStart], ROW_NUMBER() OVER(PARTITION BY [l1].[Date] ORDER BY [l1].[Name]) AS [row] FROM [Level1] 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] @@ -2842,7 +2842,7 @@ OFFSET 1 ROWS FETCH NEXT 5 ROWS ONLY 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], [l1].[PeriodEnd], [l1].[PeriodStart] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l1] - 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]"); @@ -2871,7 +2871,7 @@ OFFSET 1 ROWS FETCH NEXT 5 ROWS ONLY 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], [l1].[PeriodEnd], [l1].[PeriodStart] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l1] - 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]"); @@ -2893,16 +2893,16 @@ 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], [l0].[Id] AS [Id0], [l0].[Date], [l0].[Name] AS [Name0], [l0].[PeriodEnd], [l0].[PeriodStart], [t1].[Id] AS [Id1], [t1].[c] FROM ( SELECT [l1].[Id], [l1].[OneToOne_Required_PK_Date], [l1].[Level1_Required_Id], [l1].[Level2_Name], [l1].[OneToMany_Required_Inverse2Id], CASE - WHEN [l1].[OneToOne_Required_PK_Date] IS NOT NULL AND [l1].[Level1_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [l1].[Id] + WHEN ([l1].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l1].[Level1_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [l1].[Id] END AS [c] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l1] - 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 AND [t].[Id] = [l1].[OneToMany_Required_Inverse2Id] + 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) AND [t].[Id] = [l1].[OneToMany_Required_Inverse2Id] ORDER BY CASE - WHEN [l1].[OneToOne_Required_PK_Date] IS NOT NULL AND [l1].[Level1_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [l1].[Id] + WHEN ([l1].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l1].[Level1_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [l1].[Id] END OFFSET 1 ROWS FETCH NEXT 3 ROWS ONLY ) AS [t1] @@ -2945,7 +2945,7 @@ LEFT JOIN ( 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], [l0].[PeriodEnd], [l0].[PeriodStart], ROW_NUMBER() OVER(PARTITION BY [l0].[OneToMany_Optional_Inverse2Id] ORDER BY [l0].[Id]) AS [row] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l0] - WHERE [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] @@ -2989,16 +2989,16 @@ 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], [l0].[Id] AS [Id0], [l0].[Date], [l0].[Name] AS [Name0], [l0].[PeriodEnd], [l0].[PeriodStart], [t1].[Id] AS [Id1], [t1].[c] FROM ( SELECT TOP(3) [l1].[Id], [l1].[OneToOne_Required_PK_Date], [l1].[Level1_Required_Id], [l1].[Level2_Name], [l1].[OneToMany_Required_Inverse2Id], CASE - WHEN [l1].[OneToOne_Required_PK_Date] IS NOT NULL AND [l1].[Level1_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [l1].[Id] + WHEN ([l1].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l1].[Level1_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [l1].[Id] END AS [c] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l1] - 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 AND [t].[Id] = [l1].[OneToMany_Required_Inverse2Id] + 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) AND [t].[Id] = [l1].[OneToMany_Required_Inverse2Id] ORDER BY CASE - WHEN [l1].[OneToOne_Required_PK_Date] IS NOT NULL AND [l1].[Level1_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [l1].[Id] + WHEN ([l1].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l1].[Level1_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [l1].[Id] END ) AS [t1] INNER JOIN [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l0] ON [t1].[Level1_Required_Id] = [l0].[Id] diff --git a/test/EFCore.SqlServer.FunctionalTests/Query/TemporalGearsOfWarQuerySqlServerTest.cs b/test/EFCore.SqlServer.FunctionalTests/Query/TemporalGearsOfWarQuerySqlServerTest.cs index 8a7ef84a51f..60d5bd31726 100644 --- a/test/EFCore.SqlServer.FunctionalTests/Query/TemporalGearsOfWarQuerySqlServerTest.cs +++ b/test/EFCore.SqlServer.FunctionalTests/Query/TemporalGearsOfWarQuerySqlServerTest.cs @@ -350,11 +350,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) @@ -363,7 +363,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] @@ -401,7 +401,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"); } @@ -525,7 +525,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 @@ -602,7 +602,7 @@ public override async Task OfTypeNav1(bool async) 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] LEFT JOIN [Tags] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' 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 Select_subquery_int_with_outside_cast_and_coalesce(bool async) @@ -639,7 +639,7 @@ public override async Task Include_on_GroupJoin_SelectMany_DefaultIfEmpty_with_c 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], [g0].[SquadId], [g0].[AssignedCityName], [g0].[CityOfBirthName], [g0].[Discriminator], [g0].[FullName], [g0].[HasSoulPatch], [g0].[LeaderNickname], [g0].[LeaderSquadId], [g0].[PeriodEnd], [g0].[PeriodStart], [g0].[Rank], [g].[Nickname], [g].[SquadId], [w].[Id], [w].[AmmunitionType], [w].[IsAutomatic], [w].[Name], [w].[OwnerFullName], [w].[PeriodEnd], [w].[PeriodStart], [w].[SynergyWithId], [g].[AssignedCityName], [g].[CityOfBirthName], [g].[Discriminator], [g].[FullName], [g].[HasSoulPatch], [g].[LeaderNickname], [g].[LeaderSquadId], [g].[PeriodEnd], [g].[PeriodStart], [g].[Rank], [w0].[Id], [w0].[AmmunitionType], [w0].[IsAutomatic], [w0].[Name], [w0].[OwnerFullName], [w0].[PeriodEnd], [w0].[PeriodStart], [w0].[SynergyWithId] FROM [Gears] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [g] @@ -906,7 +906,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].[PeriodEnd], [g].[PeriodStart], [g].[Rank] FROM [Gears] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' 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 DateTimeOffset_DateAdd_AddMonths(bool async) @@ -934,7 +934,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 @@ -1004,7 +1004,7 @@ WHEN NOT EXISTS ( SELECT 1 FROM [Tags] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [t] LEFT JOIN [Gears] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' 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"); } @@ -1060,7 +1060,7 @@ LEFT JOIN ( LEFT JOIN ( SELECT [w].[Id], [w].[AmmunitionType], [w].[IsAutomatic], [w].[Name], [w].[OwnerFullName], [w].[PeriodEnd], [w].[PeriodStart], [w].[SynergyWithId] FROM [Weapons] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' 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] @@ -1158,10 +1158,10 @@ WHERE CASE WHEN ( SELECT TOP(1) [w].[Name] FROM [Weapons] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' 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] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' 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) @@ -1181,7 +1181,7 @@ SELECT [l].[Name] FROM [LocustLeaders] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' 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 DateTimeOffset_DateAdd_AddHours(bool async) @@ -1236,7 +1236,7 @@ public override async Task Negate_on_like_expression(bool async) AssertSql( @"SELECT [s].[Id], [s].[Banner], [s].[Banner5], [s].[InternalNumber], [s].[Name], [s].[PeriodEnd], [s].[PeriodStart] FROM [Squads] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' 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 Select_subquery_distinct_singleordefault_boolean2(bool async) @@ -1269,7 +1269,7 @@ public override async Task Project_navigation_defined_on_derived_from_entity_wit AssertSql( @"SELECT [l].[Name], [l].[Discriminator], [l].[LocustHordeId], [l].[PeriodEnd], [l].[PeriodStart], [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].[PeriodEnd], [g].[PeriodStart], [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].[PeriodEnd], [f].[PeriodStart], [f].[ServerAddress], [f].[CommanderName], [f].[Eradicated], CASE WHEN [f].[Id] IS NULL THEN CAST(1 AS bit) @@ -1294,10 +1294,10 @@ public override async Task Null_propagation_optimization6(bool async) 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_coalesce_with_anonymous_types(bool async) @@ -1362,7 +1362,7 @@ OUTER APPLY ( LEFT JOIN ( SELECT [w].[Name], [g].[Nickname], [w].[Id], [w].[OwnerFullName] FROM [Weapons] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' 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 [g].[Nickname] = [g0].[LeaderNickname] AND [g].[SquadId] = [g0].[LeaderSquadId] AND [g0].[FullName] <> N'Foo' ) AS [t0] @@ -1476,7 +1476,7 @@ public override async Task Optional_navigation_type_compensation_works_with_nega @"SELECT [t].[Id], [t].[GearNickName], [t].[GearSquadId], [t].[IssueDate], [t].[Note], [t].[PeriodEnd], [t].[PeriodStart] FROM [Tags] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [t] LEFT JOIN [Gears] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' 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 Project_one_value_type_from_empty_collection(bool async) @@ -1500,7 +1500,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].[PeriodEnd], [g].[PeriodStart], [g].[Rank] FROM [Gears] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [g] LEFT JOIN [Cities] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' 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 Subquery_containing_SelectMany_projecting_main_from_clause_gets_lifted(bool async) @@ -1540,7 +1540,7 @@ public override async Task Navigation_based_on_complex_expression6(bool async) AssertSql( @"SELECT CASE - WHEN [t0].[Name] = N'Queen Myrrah' AND [t0].[Name] IS NOT NULL THEN CAST(1 AS bit) + WHEN [t0].[Name] = N'Queen Myrrah' AND ([t0].[Name] IS NOT NULL) THEN CAST(1 AS bit) ELSE CAST(0 AS bit) END, [t0].[Name], [t0].[Discriminator], [t0].[LocustHordeId], [t0].[PeriodEnd], [t0].[PeriodStart], [t0].[ThreatLevel], [t0].[ThreatLevelByte], [t0].[ThreatLevelNullableByte], [t0].[DefeatedByNickname], [t0].[DefeatedBySquadId], [t0].[HighCommandId], [t].[Name], [t].[Discriminator], [t].[LocustHordeId], [t].[PeriodEnd], [t].[PeriodStart], [t].[ThreatLevel], [t].[ThreatLevelByte], [t].[ThreatLevelNullableByte], [t].[DefeatedByNickname], [t].[DefeatedBySquadId], [t].[HighCommandId] FROM [Factions] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [f] @@ -1678,7 +1678,7 @@ CROSS APPLY ( WHERE EXISTS ( SELECT 1 FROM [LocustLeaders] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' 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]"); } @@ -1706,7 +1706,7 @@ public override async Task Correlated_collections_basic_projection_explicit_to_l LEFT JOIN ( SELECT [w].[Id], [w].[AmmunitionType], [w].[IsAutomatic], [w].[Name], [w].[OwnerFullName], [w].[PeriodEnd], [w].[PeriodStart], [w].[SynergyWithId] FROM [Weapons] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' 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]"); @@ -1718,11 +1718,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] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' 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 Collection_navigation_access_on_derived_entity_using_cast(bool async) @@ -1747,7 +1747,7 @@ public override async Task String_compare_with_null_conditional_argument2(bool a FROM [Weapons] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [w] LEFT JOIN [Weapons] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' 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"); } @@ -1876,7 +1876,7 @@ public override async Task SelectMany_predicate_with_non_equality_comparison_wit CROSS APPLY ( SELECT TOP(3) [w].[Id], [w].[AmmunitionType], [w].[IsAutomatic], [w].[Name], [w].[OwnerFullName], [w].[PeriodEnd], [w].[PeriodStart], [w].[SynergyWithId] FROM [Weapons] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' 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]"); @@ -1916,7 +1916,7 @@ public override async Task Optional_navigation_type_compensation_works_with_proj @"SELECT [g].[SquadId] FROM [Tags] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [t] LEFT JOIN [Gears] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' 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 SelectMany_predicate_after_navigation_with_non_equality_comparison_DefaultIfEmpty_converted_to_left_join( @@ -1931,7 +1931,7 @@ LEFT JOIN ( SELECT [w0].[Id], [w0].[AmmunitionType], [w0].[IsAutomatic], [w0].[Name], [w0].[OwnerFullName], [w0].[PeriodEnd], [w0].[PeriodStart], [w0].[SynergyWithId] FROM [Weapons] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [w] LEFT JOIN [Weapons] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' 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]"); } @@ -1943,7 +1943,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].[PeriodEnd], [g0].[PeriodStart], [g0].[Rank] FROM [Tags] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [t] LEFT JOIN [Gears] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [g] ON [t].[GearNickName] = [g].[Nickname] AND [t].[GearSquadId] = [g].[SquadId] -LEFT JOIN [Gears] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' 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] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' 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]"); } @@ -2049,7 +2049,7 @@ public override async Task Select_Where_Navigation_Scalar_Equals_Navigation_Scal CROSS JOIN [Tags] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [t0] LEFT JOIN [Gears] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [g] ON [t].[GearNickName] = [g].[Nickname] AND [t].[GearSquadId] = [g].[SquadId] LEFT JOIN [Gears] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' 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 Left_join_projection_using_conditional_tracking(bool async) @@ -2058,7 +2058,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].[PeriodEnd], [g].[PeriodStart], [g].[Rank], [g0].[Nickname], [g0].[SquadId], [g0].[AssignedCityName], [g0].[CityOfBirthName], [g0].[Discriminator], [g0].[FullName], [g0].[HasSoulPatch], [g0].[LeaderNickname], [g0].[LeaderSquadId], [g0].[PeriodEnd], [g0].[PeriodStart], [g0].[Rank] FROM [Gears] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [g] @@ -2111,7 +2111,7 @@ public override async Task Correlated_collections_basic_projecting_single_proper LEFT JOIN ( SELECT [w].[Name], [w].[Id], [w].[OwnerFullName] FROM [Weapons] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' 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]"); @@ -2358,7 +2358,7 @@ public override async Task Distinct_with_optional_navigation_is_translated_to_sq @"SELECT DISTINCT [g].[HasSoulPatch] 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' OR [t].[Note] IS NULL"); +WHERE [t].[Note] <> N'Foo' OR ([t].[Note] IS NULL)"); } public override async Task Where_member_access_on_anonymous_type(bool async) @@ -2377,7 +2377,7 @@ public override async Task Include_on_GroupJoin_SelectMany_DefaultIfEmpty_with_c AssertSql( @"SELECT [g].[Nickname], [g].[SquadId], [g].[AssignedCityName], [g].[CityOfBirthName], [g].[Discriminator], [g].[FullName], [g].[HasSoulPatch], [g].[LeaderNickname], [g].[LeaderSquadId], [g].[PeriodEnd], [g].[PeriodStart], [g].[Rank], [g0].[Nickname], [g0].[SquadId], [w].[Id], [w].[AmmunitionType], [w].[IsAutomatic], [w].[Name], [w].[OwnerFullName], [w].[PeriodEnd], [w].[PeriodStart], [w].[SynergyWithId], [g0].[AssignedCityName], [g0].[CityOfBirthName], [g0].[Discriminator], [g0].[FullName], [g0].[HasSoulPatch], [g0].[LeaderNickname], [g0].[LeaderSquadId], [g0].[PeriodEnd], [g0].[PeriodStart], [g0].[Rank], [w0].[Id], [w0].[AmmunitionType], [w0].[IsAutomatic], [w0].[Name], [w0].[OwnerFullName], [w0].[PeriodEnd], [w0].[PeriodStart], [w0].[SynergyWithId], [w1].[Id], [w1].[AmmunitionType], [w1].[IsAutomatic], [w1].[Name], [w1].[OwnerFullName], [w1].[PeriodEnd], [w1].[PeriodStart], [w1].[SynergyWithId], [w2].[Id], [w2].[AmmunitionType], [w2].[IsAutomatic], [w2].[Name], [w2].[OwnerFullName], [w2].[PeriodEnd], [w2].[PeriodStart], [w2].[SynergyWithId], 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, [w3].[Id], [w3].[AmmunitionType], [w3].[IsAutomatic], [w3].[Name], [w3].[OwnerFullName], [w3].[PeriodEnd], [w3].[PeriodStart], [w3].[SynergyWithId], [w4].[Id], [w4].[AmmunitionType], [w4].[IsAutomatic], [w4].[Name], [w4].[OwnerFullName], [w4].[PeriodEnd], [w4].[PeriodStart], [w4].[SynergyWithId] FROM [Gears] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [g] @@ -2505,7 +2505,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].[PeriodEnd], [g].[PeriodStart], [g].[Rank] FROM [Tags] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [t] LEFT JOIN [Gears] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' 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 GroupBy_Property_Include_Select_Min(bool async) @@ -2646,7 +2646,7 @@ public override async Task Correlated_collections_basic_projecting_constant(bool LEFT JOIN ( SELECT N'BFG' AS [c], [w].[Id], [w].[OwnerFullName] FROM [Weapons] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' 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]"); @@ -2737,7 +2737,7 @@ public override async Task Bitwise_operation_with_null_arguments(bool async) SELECT [w].[Id], [w].[AmmunitionType], [w].[IsAutomatic], [w].[Name], [w].[OwnerFullName], [w].[PeriodEnd], [w].[PeriodStart], [w].[SynergyWithId] FROM [Weapons] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' 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) @@ -2837,7 +2837,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] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [w]"); @@ -2901,7 +2901,7 @@ LEFT JOIN ( LEFT JOIN [Squads] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [s] ON [g3].[SquadId] = [s].[Id] LEFT JOIN [Weapons] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [w0] ON [g3].[FullName] = [w0].[OwnerFullName] LEFT JOIN [Gears] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' 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] @@ -2957,7 +2957,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] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [w] @@ -2991,7 +2991,7 @@ public override async Task OfTypeNav2(bool async) 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] LEFT JOIN [Cities] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' 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 Enum_matching_take_value_gets_different_type_mapping(bool async) @@ -3027,7 +3027,7 @@ public override async Task Optional_navigation_type_compensation_works_with_list @"SELECT [g].[SquadId], [g].[SquadId] + 1 FROM [Tags] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [t] LEFT JOIN [Gears] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' 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]"); } @@ -3074,7 +3074,7 @@ public override async Task Correlated_collections_on_select_many(bool async) LEFT JOIN ( SELECT [w].[Id], [w].[AmmunitionType], [w].[IsAutomatic], [w].[Name], [w].[OwnerFullName], [w].[PeriodEnd], [w].[PeriodStart], [w].[SynergyWithId] FROM [Weapons] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' 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].[PeriodEnd], [g0].[PeriodStart], [g0].[Rank] @@ -3231,7 +3231,7 @@ LEFT JOIN ( FROM [Gears] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' 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]"); } @@ -3337,7 +3337,7 @@ public override async Task Optional_navigation_type_compensation_works_with_orde @"SELECT [t].[Id], [t].[GearNickName], [t].[GearSquadId], [t].[IssueDate], [t].[Note], [t].[PeriodEnd], [t].[PeriodStart] FROM [Tags] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [t] LEFT JOIN [Gears] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' 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]"); } @@ -3361,7 +3361,7 @@ public override async Task Correlated_collections_basic_projecting_constant_bool LEFT JOIN ( SELECT CAST(1 AS bit) AS [c], [w].[Id], [w].[OwnerFullName] FROM [Weapons] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' 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]"); @@ -3403,10 +3403,10 @@ public override async Task Null_propagation_optimization5(bool async) 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 Navigation_access_fk_on_derived_entity_using_cast(bool async) @@ -3444,7 +3444,7 @@ public override async Task FROM [Tags] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [t] LEFT JOIN [Gears] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [g] ON [t].[GearNickName] = [g].[Nickname] AND [t].[GearSquadId] = [g].[SquadId] LEFT JOIN [Squads] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' 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 Project_one_value_type_with_client_projection_from_empty_collection(bool async) @@ -3500,7 +3500,7 @@ SELECT [l].[Name] FROM [LocustLeaders] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' 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 Subquery_projecting_non_nullable_scalar_contains_non_nullable_value_doesnt_need_null_expansion(bool async) @@ -3547,7 +3547,7 @@ public override async Task Contains_on_collection_of_nullable_byte_subquery(bool WHERE EXISTS ( SELECT 1 FROM [LocustLeaders] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' 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 Where_datetimeoffset_now(bool async) @@ -3582,7 +3582,7 @@ public override async Task String_compare_with_null_conditional_argument(bool as FROM [Weapons] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [w] LEFT JOIN [Weapons] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' 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"); } @@ -3597,7 +3597,7 @@ public override async Task Correlated_collections_basic_projection_explicit_to_a LEFT JOIN ( SELECT [w].[Id], [w].[AmmunitionType], [w].[IsAutomatic], [w].[Name], [w].[OwnerFullName], [w].[PeriodEnd], [w].[PeriodStart], [w].[SynergyWithId] FROM [Weapons] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' 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]"); @@ -3663,7 +3663,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].[PeriodEnd], [w].[PeriodStart], [w].[SynergyWithId] FROM [Weapons] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' 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]"); } @@ -3738,7 +3738,7 @@ public override async Task Include_with_nested_navigation_in_order_by(bool async FROM [Weapons] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [w] LEFT JOIN [Gears] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [g] ON [w].[OwnerFullName] = [g].[FullName] LEFT JOIN [Cities] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' 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]"); } @@ -3772,7 +3772,7 @@ LEFT JOIN ( SELECT [w].[Id], [w].[AmmunitionType], [w].[IsAutomatic], [w].[Name], [w].[OwnerFullName], [w].[PeriodEnd], [w].[PeriodStart], [w].[SynergyWithId], [g2].[Nickname], [g2].[SquadId], ( SELECT COUNT(*) FROM [Weapons] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' 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] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [w] LEFT JOIN [Gears] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [g2] ON [w].[OwnerFullName] = [g2].[FullName] ) AS [t0] ON [g1].[FullName] = [t0].[OwnerFullName] @@ -3795,7 +3795,7 @@ LEFT JOIN ( SELECT [g0].[Nickname], [g0].[SquadId], [g0].[AssignedCityName], [g0].[CityOfBirthName], [g0].[Discriminator], [g0].[FullName], [g0].[HasSoulPatch], [g0].[LeaderNickname], [g0].[LeaderSquadId], [g0].[PeriodEnd], [g0].[PeriodStart], [g0].[Rank], [c].[Name], [c].[Location], [c].[Nation], [c].[PeriodEnd] AS [PeriodEnd0], [c].[PeriodStart] AS [PeriodStart0] FROM [Gears] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [g0] INNER JOIN [Cities] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' 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]"); } @@ -3871,7 +3871,7 @@ CROSS APPLY ( WHERE NOT (EXISTS ( SELECT 1 FROM [LocustLeaders] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' 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]"); } @@ -3885,7 +3885,7 @@ public override async Task Select_Where_Navigation_Equals_Navigation(bool async) CROSS JOIN [Tags] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [t0] LEFT JOIN [Gears] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [g] ON [t].[GearNickName] = [g].[Nickname] AND [t].[GearSquadId] = [g].[SquadId] LEFT JOIN [Gears] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' 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 Array_access_on_byte_array(bool async) @@ -4022,7 +4022,7 @@ public override async Task Optional_navigation_type_compensation_works_with_pred @"SELECT [t].[Id], [t].[GearNickName], [t].[GearSquadId], [t].[IssueDate], [t].[Note], [t].[PeriodEnd], [t].[PeriodStart] FROM [Tags] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [t] LEFT JOIN [Gears] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' 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 Nullable_bool_comparison_is_translated_to_server(bool async) @@ -4213,10 +4213,10 @@ public override async Task Null_propagation_optimization4(bool async) 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 Correlated_collection_with_distinct_projecting_identifier_column(bool async) @@ -4245,7 +4245,7 @@ public override async Task Optional_navigation_with_collection_composite_key(boo WHERE [g].[Discriminator] = N'Officer' AND ( SELECT COUNT(*) FROM [Gears] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' 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_as_operator(bool async) @@ -4296,7 +4296,7 @@ public override async Task Select_Where_Navigation_Scalar_Equals_Navigation_Scal CROSS JOIN [Tags] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [t0] LEFT JOIN [Gears] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [g] ON [t].[GearNickName] = [g].[Nickname] AND [t].[GearSquadId] = [g].[SquadId] LEFT JOIN [Gears] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' 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 Where_enum_has_flag_subquery_with_pushdown(bool async) @@ -4312,10 +4312,10 @@ SELECT TOP(1) [g0].[Rank] ORDER BY [g0].[Nickname], [g0].[SquadId])) = ( SELECT TOP(1) [g0].[Rank] FROM [Gears] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [g0] - ORDER BY [g0].[Nickname], [g0].[SquadId]) OR ( + ORDER BY [g0].[Nickname], [g0].[SquadId]) OR (( SELECT TOP(1) [g0].[Rank] FROM [Gears] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' 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].[PeriodEnd], [g].[PeriodStart], [g].[Rank] FROM [Gears] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [g] @@ -4325,10 +4325,10 @@ SELECT TOP(1) [g0].[Rank] ORDER BY [g0].[Nickname], [g0].[SquadId])) = ( SELECT TOP(1) [g0].[Rank] FROM [Gears] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [g0] - ORDER BY [g0].[Nickname], [g0].[SquadId]) OR ( + ORDER BY [g0].[Nickname], [g0].[SquadId]) OR (( SELECT TOP(1) [g0].[Rank] FROM [Gears] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [g0] - ORDER BY [g0].[Nickname], [g0].[SquadId]) IS NULL"); + ORDER BY [g0].[Nickname], [g0].[SquadId]) IS NULL)"); } public override async Task Select_null_parameter_is_not_null(bool async) @@ -4473,7 +4473,7 @@ public override async Task Select_Where_Navigation_Null(bool async) @"SELECT [t].[Id], [t].[GearNickName], [t].[GearSquadId], [t].[IssueDate], [t].[Note], [t].[PeriodEnd], [t].[PeriodStart] FROM [Tags] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [t] LEFT JOIN [Gears] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' 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 @@ -4685,7 +4685,7 @@ LEFT JOIN ( WHERE [l].[Discriminator] = N'LocustCommander' ) AS [t] ON [f].[CommanderName] = [t].[Name] LEFT JOIN [Gears] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [g] ON [t].[DefeatedByNickname] = [g].[Nickname] AND [t].[DefeatedBySquadId] = [g].[SquadId] -LEFT JOIN [Gears] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' 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] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' 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]"); } @@ -4718,7 +4718,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].[PeriodEnd], [w].[PeriodStart], [w].[SynergyWithId] FROM [Gears] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [g] -LEFT JOIN [Weapons] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [w] ON [g].[FullName] <> [w].[OwnerFullName] OR [w].[OwnerFullName] IS NULL"); +LEFT JOIN [Weapons] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [w] ON [g].[FullName] <> [w].[OwnerFullName] OR ([w].[OwnerFullName] IS NULL)"); } public override async Task Order_by_entity_qsre_with_other_orderbys(bool async) @@ -4763,11 +4763,11 @@ public override async Task FirstOrDefault_navigation_access_entity_equality_in_w SELECT TOP(1) [c0].[Name] FROM [Gears] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [g] INNER JOIN [Cities] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' 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] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [g] INNER JOIN [Cities] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [c0] ON [g].[CityOfBirthName] = [c0].[Name] - ORDER BY [g].[Nickname]) IS NULL)"); + ORDER BY [g].[Nickname]) IS NULL))"); } public override async Task SelectMany_predicate_with_non_equality_comparison_DefaultIfEmpty_converted_to_left_join(bool async) @@ -4777,7 +4777,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].[PeriodEnd], [g].[PeriodStart], [g].[Rank], [w].[Id], [w].[AmmunitionType], [w].[IsAutomatic], [w].[Name], [w].[OwnerFullName], [w].[PeriodEnd], [w].[PeriodStart], [w].[SynergyWithId] FROM [Gears] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [g] -LEFT JOIN [Weapons] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [w] ON [g].[FullName] <> [w].[OwnerFullName] OR [w].[OwnerFullName] IS NULL +LEFT JOIN [Weapons] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [w] ON [g].[FullName] <> [w].[OwnerFullName] OR ([w].[OwnerFullName] IS NULL) ORDER BY [g].[Nickname], [w].[Id]"); } @@ -4791,7 +4791,7 @@ public override async Task Correlated_collections_basic_projection(bool async) LEFT JOIN ( SELECT [w].[Id], [w].[AmmunitionType], [w].[IsAutomatic], [w].[Name], [w].[OwnerFullName], [w].[PeriodEnd], [w].[PeriodStart], [w].[SynergyWithId] FROM [Weapons] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' 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]"); @@ -4839,7 +4839,7 @@ public override async Task Enum_array_contains(bool async) @"SELECT [w].[Id], [w].[AmmunitionType], [w].[IsAutomatic], [w].[Name], [w].[OwnerFullName], [w].[PeriodEnd], [w].[PeriodStart], [w].[SynergyWithId] FROM [Weapons] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [w] LEFT JOIN [Weapons] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' 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))"); } public override async Task Sum_with_optional_navigation_is_translated_to_sql(bool async) @@ -4850,7 +4850,7 @@ public override async Task Sum_with_optional_navigation_is_translated_to_sql(boo @"SELECT COALESCE(SUM([g].[SquadId]), 0) 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' OR [t].[Note] IS NULL"); +WHERE [t].[Note] <> N'Foo' OR ([t].[Note] IS NULL)"); } public override async Task Where_TimeSpan_Milliseconds(bool async) @@ -4915,7 +4915,7 @@ LEFT JOIN ( WHERE [l].[Discriminator] = N'LocustCommander' ) AS [t] ON [f].[CommanderName] = [t].[Name] LEFT JOIN [Gears] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [g] ON [t].[DefeatedByNickname] = [g].[Nickname] AND [t].[DefeatedBySquadId] = [g].[SquadId] -LEFT JOIN [Gears] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' 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] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' 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]"); } @@ -4930,7 +4930,7 @@ ELSE NULL END FROM [Tags] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [t] LEFT JOIN [Gears] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [g] ON [t].[GearNickName] = [g].[Nickname] AND [t].[GearSquadId] = [g].[SquadId] -LEFT JOIN [Tags] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' 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] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' 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] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [g0] ON [t0].[GearNickName] = [g0].[Nickname] AND [t0].[GearSquadId] = [g0].[SquadId] LEFT JOIN [Cities] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [c] ON [g0].[AssignedCityName] = [c].[Name]"); } @@ -4981,7 +4981,7 @@ public override async Task Projecting_property_converted_to_nullable_into_member @"SELECT [g].[Nickname] 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 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]"); } @@ -5058,7 +5058,7 @@ public override async Task Count_with_optional_navigation_is_translated_to_sql(b @"SELECT COUNT(*) 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' OR [t].[Note] IS NULL"); +WHERE [t].[Note] <> N'Foo' OR ([t].[Note] IS NULL)"); } public override async Task Project_entity_and_collection_element(bool async) @@ -5100,7 +5100,7 @@ public override async Task Composite_key_entity_not_equal_null(bool async) @"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] LEFT JOIN [Gears] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' 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)"); } public override async Task Collection_with_inheritance_and_join_include_joined(bool async) @@ -5241,7 +5241,7 @@ public override async Task OfTypeNav3(bool async) 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] INNER JOIN [Weapons] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [w] ON [g].[FullName] = [w].[OwnerFullName] LEFT JOIN [Tags] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' 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 Streaming_correlated_collection_issue_11403(bool async) @@ -5402,7 +5402,7 @@ public override async Task Optional_navigation_type_compensation_works_with_arra @"SELECT [g].[SquadId] FROM [Tags] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [t] LEFT JOIN [Gears] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' 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 Select_subquery_distinct_singleordefault_boolean_with_pushdown(bool async) @@ -5725,7 +5725,7 @@ public override async Task Composite_key_entity_equal_null(bool async) @"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] LEFT JOIN [Gears] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' 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 Optional_navigation_type_compensation_works_with_contains(bool async) @@ -5736,7 +5736,7 @@ public override async Task Optional_navigation_type_compensation_works_with_cont @"SELECT [t].[Id], [t].[GearNickName], [t].[GearSquadId], [t].[IssueDate], [t].[Note], [t].[PeriodEnd], [t].[PeriodStart] FROM [Tags] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [t] LEFT JOIN [Gears] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' 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] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [g0] WHERE [g0].[SquadId] = [g].[SquadId])"); @@ -5750,7 +5750,7 @@ public override async Task Optional_navigation_type_compensation_works_with_DTOs @"SELECT [g].[SquadId] AS [Id] FROM [Tags] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [t] LEFT JOIN [Gears] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' 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 Non_unicode_string_literals_in_contains_is_used_for_non_unicode_column(bool async) @@ -5775,7 +5775,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].[PeriodEnd], [l].[PeriodStart], [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].[PeriodEnd] AS [PeriodEnd0], [g].[PeriodStart] AS [PeriodStart0], [g].[Rank], [t].[Id], [t].[Note] FROM [LocustLeaders] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l] LEFT JOIN [Gears] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [g] ON [l].[DefeatedByNickname] = [g].[Nickname] AND [l].[DefeatedBySquadId] = [g].[SquadId] - LEFT JOIN [Tags] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' 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] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' 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] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [w] ON [t0].[FullName] = [w].[OwnerFullName] @@ -6167,7 +6167,7 @@ public override async Task Subquery_containing_join_gets_lifted_clashing_names(b FROM [Gears] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [g] INNER JOIN [Tags] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [t] ON [g].[Nickname] = [t].[GearNickName] INNER JOIN [Tags] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' 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]"); } @@ -6224,7 +6224,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].[PeriodEnd], [g].[PeriodStart], [g].[Rank], [w].[Id], [w].[AmmunitionType], [w].[IsAutomatic], [w].[Name], [w].[OwnerFullName], [w].[PeriodEnd], [w].[PeriodStart], [w].[SynergyWithId] FROM [Gears] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [g] -INNER JOIN [Weapons] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [w] ON [g].[FullName] <> [w].[OwnerFullName] OR [w].[OwnerFullName] IS NULL +INNER JOIN [Weapons] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [w] ON [g].[FullName] <> [w].[OwnerFullName] OR ([w].[OwnerFullName] IS NULL) ORDER BY [g].[Nickname], [w].[Id]"); } @@ -6241,7 +6241,7 @@ LEFT JOIN ( FROM [LocustLeaders] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' 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 Concat_scalars_with_count(bool async) @@ -6267,7 +6267,7 @@ public override async Task Optional_navigation_type_compensation_works_with_proj @"SELECT [g].[SquadId] FROM [Tags] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [t] LEFT JOIN [Gears] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' 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 GroupJoin_Composite_Key(bool async) @@ -6343,7 +6343,7 @@ LEFT JOIN ( WHERE [l].[Discriminator] = N'LocustCommander' ) AS [t] ON [f].[CommanderName] = [t].[Name] LEFT JOIN [Gears] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [g] ON [t].[DefeatedByNickname] = [g].[Nickname] AND [t].[DefeatedBySquadId] = [g].[SquadId] -LEFT JOIN [Gears] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' 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] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' 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]"); } @@ -6575,7 +6575,7 @@ LEFT JOIN ( WHERE [l].[Discriminator] = N'LocustCommander' ) AS [t] ON [f].[CommanderName] = [t].[Name] LEFT JOIN [Gears] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [g] ON [t].[DefeatedByNickname] = [g].[Nickname] AND [t].[DefeatedBySquadId] = [g].[SquadId] -LEFT JOIN [Gears] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' 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] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' 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]"); } @@ -6592,7 +6592,7 @@ LEFT JOIN ( OUTER APPLY ( SELECT [w].[Name], [g0].[Nickname], [w].[Id] FROM [Weapons] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [w] - WHERE [g0].[FullName] = [w].[OwnerFullName] AND ([w].[Name] <> N'Bar' OR [w].[Name] IS NULL) + WHERE [g0].[FullName] = [w].[OwnerFullName] AND ([w].[Name] <> N'Bar' OR ([w].[Name] IS NULL)) ) AS [t] WHERE [g0].[FullName] <> N'Foo' ) AS [t0] ON [g].[Nickname] = [t0].[LeaderNickname] AND [g].[SquadId] = [t0].[LeaderSquadId] @@ -6637,7 +6637,7 @@ public override async Task Null_propagation_optimization2(bool async) 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)"); @@ -6775,10 +6775,10 @@ SELECT TOP(1) [g0].[Rank] ORDER BY [g0].[Nickname], [g0].[SquadId])) = ( SELECT TOP(1) [g0].[Rank] FROM [Gears] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [g0] - ORDER BY [g0].[Nickname], [g0].[SquadId]) OR ( + ORDER BY [g0].[Nickname], [g0].[SquadId]) OR (( SELECT TOP(1) [g0].[Rank] FROM [Gears] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [g0] - ORDER BY [g0].[Nickname], [g0].[SquadId]) IS NULL"); + ORDER BY [g0].[Nickname], [g0].[SquadId]) IS NULL)"); } public override async Task Correlated_collection_via_SelectMany_with_Distinct_missing_indentifying_columns_in_projection(bool async) @@ -6947,7 +6947,7 @@ public override async Task Singleton_Navigation_With_Member_Access(bool async) @"SELECT [g].[CityOfBirthName] AS [B] FROM [Tags] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [t] LEFT JOIN [Gears] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' 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 Join_on_entity_qsre_keys_composite_key(bool async) @@ -6976,7 +6976,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] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [t] @@ -7184,7 +7184,7 @@ public override async Task Select_Where_Navigation_Null_Reverse(bool async) @"SELECT [t].[Id], [t].[GearNickName], [t].[GearSquadId], [t].[IssueDate], [t].[Note], [t].[PeriodEnd], [t].[PeriodStart] FROM [Tags] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [t] LEFT JOIN [Gears] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' 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 Join_with_order_by_without_skip_or_take_nested(bool async) @@ -7296,7 +7296,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] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [w]"); @@ -7321,7 +7321,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] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [g] @@ -7470,7 +7470,7 @@ public override async Task Null_checks_in_correlated_predicate_are_correctly_tra AssertSql( @"SELECT [t].[Id], [g].[Nickname], [g].[SquadId], [g].[AssignedCityName], [g].[CityOfBirthName], [g].[Discriminator], [g].[FullName], [g].[HasSoulPatch], [g].[LeaderNickname], [g].[LeaderSquadId], [g].[PeriodEnd], [g].[PeriodStart], [g].[Rank] FROM [Tags] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [t] -LEFT JOIN [Gears] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [g] ON [t].[GearNickName] = [g].[Nickname] AND [t].[GearSquadId] = [g].[SquadId] AND [t].[Note] IS NOT NULL +LEFT JOIN [Gears] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [g] ON [t].[GearNickName] = [g].[Nickname] AND [t].[GearSquadId] = [g].[SquadId] AND ([t].[Note] IS NOT NULL) ORDER BY [t].[Id], [g].[Nickname]"); } @@ -7580,7 +7580,7 @@ public override async Task Select_correlated_filtered_collection(bool async) LEFT JOIN ( SELECT [w].[Id], [w].[AmmunitionType], [w].[IsAutomatic], [w].[Name], [w].[OwnerFullName], [w].[PeriodEnd], [w].[PeriodStart], [w].[SynergyWithId] FROM [Weapons] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' 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]"); @@ -7658,7 +7658,7 @@ public override async Task Null_semantics_is_correctly_applied_for_function_comp @"SELECT [t].[Id], [t].[GearNickName], [t].[GearSquadId], [t].[IssueDate], [t].[Note], [t].[PeriodEnd], [t].[PeriodStart] FROM [Tags] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [t] LEFT JOIN [Gears] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [g] ON [t].[GearNickName] = [g].[Nickname] AND [t].[GearSquadId] = [g].[SquadId] -WHERE SUBSTRING([t].[Note], 0 + 1, [g].[SquadId]) = [t].[GearNickName] OR (([t].[Note] IS NULL OR [g].[SquadId] IS NULL) AND [t].[GearNickName] IS NULL)"); +WHERE SUBSTRING([t].[Note], 0 + 1, [g].[SquadId]) = [t].[GearNickName] OR ((([t].[Note] IS NULL) OR ([g].[SquadId] IS NULL)) AND ([t].[GearNickName] IS NULL))"); } public override async Task Project_collection_navigation_with_inheritance1(bool async) @@ -7709,7 +7709,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] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [g] @@ -7860,7 +7860,7 @@ public override async Task Correlated_collections_basic_projection_ordered(bool LEFT JOIN ( SELECT [w].[Id], [w].[AmmunitionType], [w].[IsAutomatic], [w].[Name], [w].[OwnerFullName], [w].[PeriodEnd], [w].[PeriodStart], [w].[SynergyWithId] FROM [Weapons] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' 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"); @@ -7917,10 +7917,10 @@ public override async Task Projecting_property_converted_to_nullable_into_unary( @"SELECT [t].[Note] FROM [Tags] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [t] LEFT JOIN [Gears] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' 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) @@ -7939,7 +7939,7 @@ LEFT JOIN ( FROM [Gears] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [g] WHERE [g].[Discriminator] = N'Officer' ) AS [t0] ON [t].[GearNickName] = [t0].[Nickname] -LEFT JOIN [Gears] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' 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] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' 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]"); } diff --git a/test/EFCore.SqlServer.FunctionalTests/Query/TemporalManyToManyQuerySqlServerTest.cs b/test/EFCore.SqlServer.FunctionalTests/Query/TemporalManyToManyQuerySqlServerTest.cs index b6da36d475d..e3fe4b5f1d0 100644 --- a/test/EFCore.SqlServer.FunctionalTests/Query/TemporalManyToManyQuerySqlServerTest.cs +++ b/test/EFCore.SqlServer.FunctionalTests/Query/TemporalManyToManyQuerySqlServerTest.cs @@ -131,7 +131,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) @@ -159,7 +159,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/TemporalOwnedQuerySqlServerTest.cs b/test/EFCore.SqlServer.FunctionalTests/Query/TemporalOwnedQuerySqlServerTest.cs index 472999259ea..38f215d6782 100644 --- a/test/EFCore.SqlServer.FunctionalTests/Query/TemporalOwnedQuerySqlServerTest.cs +++ b/test/EFCore.SqlServer.FunctionalTests/Query/TemporalOwnedQuerySqlServerTest.cs @@ -263,7 +263,7 @@ LEFT JOIN ( FROM [Order] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [o0] LEFT JOIN [OrderDetail] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' 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]"); } @@ -294,7 +294,7 @@ SELECT COUNT(*) LEFT JOIN [OwnedPerson] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [o1] ON [o0].[ClientId] = [o1].[Id] LEFT JOIN [Planet] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [p0] ON [o1].[PersonAddress_Country_PlanetId] = [p0].[Id] LEFT JOIN [Star] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' 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].[Name], [p].[PeriodEnd], [p].[PeriodStart], [p].[StarId] + WHERE [o].[Id] = [o0].[ClientId] AND ([s].[Id] <> 42 OR ([s].[Id] IS NULL))) AS [Count], [p].[Id], [p].[Name], [p].[PeriodEnd], [p].[PeriodStart], [p].[StarId] FROM [OwnedPerson] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [o] LEFT JOIN [Planet] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [p] ON [o].[PersonAddress_Country_PlanetId] = [p].[Id] ORDER BY [o].[Id]"); @@ -313,7 +313,7 @@ LEFT JOIN ( FROM [Order] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [o0] LEFT JOIN [OrderDetail] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' 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]"); } @@ -1142,7 +1142,7 @@ public override async Task Projecting_collection_correlated_with_keyless_entity_ @"SELECT [b].[Throned_Value], [f].[Id], [b].[Id], [p].[Id], [p].[Name], [p].[PeriodEnd], [p].[PeriodStart], [p].[StarId] FROM [Fink] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [f] LEFT JOIN [Barton] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [b] ON [f].[BartonId] = [b].[Id] -LEFT JOIN [Planet] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [p] ON [b].[Throned_Value] <> [p].[Id] OR [b].[Throned_Value] IS NULL +LEFT JOIN [Planet] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' 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/TemporalTableSqlServerTest.cs b/test/EFCore.SqlServer.FunctionalTests/Query/TemporalTableSqlServerTest.cs index ffc240af576..3c2a12b5542 100644 --- a/test/EFCore.SqlServer.FunctionalTests/Query/TemporalTableSqlServerTest.cs +++ b/test/EFCore.SqlServer.FunctionalTests/Query/TemporalTableSqlServerTest.cs @@ -448,7 +448,7 @@ public virtual async Task Temporal_can_query_shared_derived_hierarchy(bool async AssertSql( @"SELECT [v].[Name], [v].[Capacity], [v].[FuelTank_Discriminator], [v].[End], [v].[FuelType], [v].[Start], [v].[GrainGeometry] FROM [Vehicles] FOR SYSTEM_TIME AS OF '2000-01-01T00:00:00.0000000' AS [v] -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)"); } protected Task> InitializeAsync( diff --git a/test/EFCore.SqlServer.FunctionalTests/Query/UdfDbFunctionSqlServerTests.cs b/test/EFCore.SqlServer.FunctionalTests/Query/UdfDbFunctionSqlServerTests.cs index 468b9e6d5cf..8551bc8d607 100644 --- a/test/EFCore.SqlServer.FunctionalTests/Query/UdfDbFunctionSqlServerTests.cs +++ b/test/EFCore.SqlServer.FunctionalTests/Query/UdfDbFunctionSqlServerTests.cs @@ -255,7 +255,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]"); } @@ -287,7 +287,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))"); } @@ -801,7 +801,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 3d9c3d35947..d5bf73cc561 100644 --- a/test/EFCore.SqlServer.FunctionalTests/TPTTableSplittingSqlServerTest.cs +++ b/test/EFCore.SqlServer.FunctionalTests/TPTTableSplittingSqlServerTest.cs @@ -126,7 +126,7 @@ public override async Task Can_query_shared_derived_nonhierarchy_all_required() AssertSql( @"SELECT [c].[VehicleName], [c].[Capacity], [c].[FuelType] FROM [CombustionEngines] AS [c] -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 15644cf86a4..d0daaac00d0 100644 --- a/test/EFCore.SqlServer.FunctionalTests/TableSplittingSqlServerTest.cs +++ b/test/EFCore.SqlServer.FunctionalTests/TableSplittingSqlServerTest.cs @@ -34,12 +34,12 @@ WHEN [t].[Active] IS NOT NULL THEN [t].[Name] LEFT JOIN ( SELECT [v2].[Name], [v2].[Computed], [v2].[Description], [v2].[Engine_Discriminator] FROM [Vehicles] AS [v2] - WHERE [v2].[Computed] IS NOT NULL AND [v2].[Engine_Discriminator] IS NOT NULL + WHERE ([v2].[Computed] IS NOT NULL) AND ([v2].[Engine_Discriminator] IS NOT NULL) ) AS [t0] ON [v].[Name] = [t0].[Name] LEFT JOIN ( SELECT [v3].[Name], [v3].[Capacity], [v3].[FuelTank_Discriminator], [v3].[FuelType], [v3].[GrainGeometry] FROM [Vehicles] AS [v3] - WHERE [v3].[Capacity] IS NOT NULL AND [v3].[FuelTank_Discriminator] IS NOT NULL + WHERE ([v3].[Capacity] IS NOT NULL) AND ([v3].[FuelTank_Discriminator] IS NOT NULL) ) AS [t1] ON [t0].[Name] = [t1].[Name] ORDER BY [v].[Name]"); } @@ -78,7 +78,7 @@ public override async Task Can_query_shared_derived_hierarchy() AssertSql( @"SELECT [v].[Name], [v].[Capacity], [v].[FuelTank_Discriminator], [v].[FuelType], [v].[GrainGeometry] FROM [Vehicles] AS [v] -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)"); } public override async Task Can_query_shared_derived_nonhierarchy() @@ -98,7 +98,7 @@ public override async Task Can_query_shared_derived_nonhierarchy_all_required() AssertSql( @"SELECT [v].[Name], [v].[Capacity], [v].[FuelType] FROM [Vehicles] AS [v] -WHERE [v].[Capacity] IS NOT NULL AND [v].[FuelType] IS NOT NULL"); +WHERE ([v].[Capacity] IS NOT NULL) AND ([v].[FuelType] IS NOT NULL)"); } public override async Task Can_change_dependent_instance_non_derived() diff --git a/test/EFCore.Sqlite.FunctionalTests/BulkUpdates/NonSharedModelBulkUpdatesSqliteTest.cs b/test/EFCore.Sqlite.FunctionalTests/BulkUpdates/NonSharedModelBulkUpdatesSqliteTest.cs index 7c96f4b153f..5a53f944c2e 100644 --- a/test/EFCore.Sqlite.FunctionalTests/BulkUpdates/NonSharedModelBulkUpdatesSqliteTest.cs +++ b/test/EFCore.Sqlite.FunctionalTests/BulkUpdates/NonSharedModelBulkUpdatesSqliteTest.cs @@ -45,7 +45,7 @@ WHERE EXISTS ( SELECT 1 FROM ""Posts"" AS ""p0"" LEFT JOIN ""Blogs"" AS ""b"" ON ""p0"".""BlogId"" = ""b"".""Id"" - WHERE ""b"".""Title"" IS NOT NULL AND (""b"".""Title"" LIKE 'Arthur%') AND ""p0"".""Id"" = ""p"".""Id"")"); + WHERE (""b"".""Title"" IS NOT NULL) AND (""b"".""Title"" LIKE 'Arthur%') AND ""p0"".""Id"" = ""p"".""Id"")"); } protected override DbContextOptionsBuilder AddOptions(DbContextOptionsBuilder builder) diff --git a/test/EFCore.Sqlite.FunctionalTests/BulkUpdates/NorthwindBulkUpdatesSqliteTest.cs b/test/EFCore.Sqlite.FunctionalTests/BulkUpdates/NorthwindBulkUpdatesSqliteTest.cs index 1795ff9fa90..347c784ad7a 100644 --- a/test/EFCore.Sqlite.FunctionalTests/BulkUpdates/NorthwindBulkUpdatesSqliteTest.cs +++ b/test/EFCore.Sqlite.FunctionalTests/BulkUpdates/NorthwindBulkUpdatesSqliteTest.cs @@ -193,7 +193,7 @@ public override async Task Delete_Where_predicate_with_GroupBy_aggregate(bool as SELECT ( SELECT ""o1"".""OrderID"" FROM ""Orders"" AS ""o1"" - WHERE ""o0"".""CustomerID"" = ""o1"".""CustomerID"" OR (""o0"".""CustomerID"" IS NULL AND ""o1"".""CustomerID"" IS NULL) + WHERE ""o0"".""CustomerID"" = ""o1"".""CustomerID"" OR ((""o0"".""CustomerID"" IS NULL) AND (""o1"".""CustomerID"" IS NULL)) LIMIT 1) FROM ""Orders"" AS ""o0"" GROUP BY ""o0"".""CustomerID"" @@ -218,7 +218,7 @@ GROUP BY ""o2"".""CustomerID"" HAVING COUNT(*) > 9 AND ( SELECT ""o3"".""OrderID"" FROM ""Orders"" AS ""o3"" - WHERE ""o2"".""CustomerID"" = ""o3"".""CustomerID"" OR (""o2"".""CustomerID"" IS NULL AND ""o3"".""CustomerID"" IS NULL) + WHERE ""o2"".""CustomerID"" = ""o3"".""CustomerID"" OR ((""o2"".""CustomerID"" IS NULL) AND (""o3"".""CustomerID"" IS NULL)) LIMIT 1) = ""o1"".""OrderID"") AND ""o0"".""OrderID"" = ""o"".""OrderID"" AND ""o0"".""ProductID"" = ""o"".""ProductID"")"); } @@ -324,7 +324,7 @@ SELECT 1 FROM ""Order Details"" AS ""o0"" INNER JOIN ""Orders"" AS ""o1"" ON ""o0"".""OrderID"" = ""o1"".""OrderID"" LEFT JOIN ""Customers"" AS ""c"" ON ""o1"".""CustomerID"" = ""c"".""CustomerID"" - WHERE ""c"".""CustomerID"" IS NOT NULL AND (""c"".""CustomerID"" LIKE 'F%') AND ""o0"".""OrderID"" = ""o"".""OrderID"" AND ""o0"".""ProductID"" = ""o"".""ProductID"")"); + WHERE (""c"".""CustomerID"" IS NOT NULL) AND (""c"".""CustomerID"" LIKE 'F%') AND ""o0"".""OrderID"" = ""o"".""OrderID"" AND ""o0"".""ProductID"" = ""o"".""ProductID"")"); } public override async Task Delete_Union(bool async) @@ -455,7 +455,7 @@ SELECT 1 FROM ""Order Details"" AS ""o0"" INNER JOIN ""Orders"" AS ""o1"" ON ""o0"".""OrderID"" = ""o1"".""OrderID"" LEFT JOIN ""Customers"" AS ""c"" ON ""o1"".""CustomerID"" = ""c"".""CustomerID"" - WHERE ""c"".""City"" IS NOT NULL AND (""c"".""City"" LIKE 'Se%') AND ""o0"".""OrderID"" = ""o"".""OrderID"" AND ""o0"".""ProductID"" = ""o"".""ProductID"")"); + WHERE (""c"".""City"" IS NOT NULL) AND (""c"".""City"" LIKE 'Se%') AND ""o0"".""OrderID"" = ""o"".""OrderID"" AND ""o0"".""ProductID"" = ""o"".""ProductID"")"); } public override async Task Delete_with_join(bool async) @@ -804,7 +804,7 @@ public override async Task Update_Where_GroupBy_First_set_constant(bool async) SELECT ( SELECT ""o0"".""CustomerID"" 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)) LIMIT 1) FROM ""Orders"" AS ""o"" GROUP BY ""o"".""CustomerID"" @@ -834,7 +834,7 @@ HAVING COUNT(*) > 11 AND ( SELECT ""c0"".""CustomerID"" FROM ""Orders"" AS ""o0"" LEFT JOIN ""Customers"" AS ""c0"" ON ""o0"".""CustomerID"" = ""c0"".""CustomerID"" - 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)) LIMIT 1) = ""c"".""CustomerID"")"); } diff --git a/test/EFCore.Sqlite.FunctionalTests/BulkUpdates/TPTFiltersInheritanceBulkUpdatesSqliteTest.cs b/test/EFCore.Sqlite.FunctionalTests/BulkUpdates/TPTFiltersInheritanceBulkUpdatesSqliteTest.cs index 507ba7e78c0..c74dbbce06c 100644 --- a/test/EFCore.Sqlite.FunctionalTests/BulkUpdates/TPTFiltersInheritanceBulkUpdatesSqliteTest.cs +++ b/test/EFCore.Sqlite.FunctionalTests/BulkUpdates/TPTFiltersInheritanceBulkUpdatesSqliteTest.cs @@ -57,7 +57,7 @@ SELECT COUNT(*) LEFT JOIN ""Birds"" AS ""b"" ON ""a"".""Id"" = ""b"".""Id"" LEFT JOIN ""Eagle"" AS ""e"" ON ""a"".""Id"" = ""e"".""Id"" LEFT JOIN ""Kiwi"" AS ""k"" ON ""a"".""Id"" = ""k"".""Id"" - WHERE ""a"".""CountryId"" = 1 AND ""c"".""Id"" = ""a"".""CountryId"" AND ""k"".""Id"" IS NOT NULL AND ""a"".""CountryId"" > 0) > 0"); + WHERE ""a"".""CountryId"" = 1 AND ""c"".""Id"" = ""a"".""CountryId"" AND (""k"".""Id"" IS NOT NULL) AND ""a"".""CountryId"" > 0) > 0"); } public override async Task Delete_where_keyless_entity_mapped_to_sql_query(bool async) @@ -145,7 +145,7 @@ SELECT COUNT(*) LEFT JOIN ""Birds"" AS ""b"" ON ""a"".""Id"" = ""b"".""Id"" LEFT JOIN ""Eagle"" AS ""e"" ON ""a"".""Id"" = ""e"".""Id"" LEFT JOIN ""Kiwi"" AS ""k"" ON ""a"".""Id"" = ""k"".""Id"" - WHERE ""a"".""CountryId"" = 1 AND ""c"".""Id"" = ""a"".""CountryId"" AND ""k"".""Id"" IS NOT NULL AND ""a"".""CountryId"" > 0) > 0"); + WHERE ""a"".""CountryId"" = 1 AND ""c"".""Id"" = ""a"".""CountryId"" AND (""k"".""Id"" IS NOT NULL) AND ""a"".""CountryId"" > 0) > 0"); } public override async Task Update_where_keyless_entity_mapped_to_sql_query(bool async) diff --git a/test/EFCore.Sqlite.FunctionalTests/BulkUpdates/TPTInheritanceBulkUpdatesSqliteTest.cs b/test/EFCore.Sqlite.FunctionalTests/BulkUpdates/TPTInheritanceBulkUpdatesSqliteTest.cs index ad97957f08d..8221221af94 100644 --- a/test/EFCore.Sqlite.FunctionalTests/BulkUpdates/TPTInheritanceBulkUpdatesSqliteTest.cs +++ b/test/EFCore.Sqlite.FunctionalTests/BulkUpdates/TPTInheritanceBulkUpdatesSqliteTest.cs @@ -128,7 +128,7 @@ SELECT COUNT(*) LEFT JOIN ""Birds"" AS ""b"" ON ""a"".""Id"" = ""b"".""Id"" LEFT JOIN ""Eagle"" AS ""e"" ON ""a"".""Id"" = ""e"".""Id"" LEFT JOIN ""Kiwi"" AS ""k"" ON ""a"".""Id"" = ""k"".""Id"" - WHERE ""c"".""Id"" = ""a"".""CountryId"" AND ""k"".""Id"" IS NOT NULL AND ""a"".""CountryId"" > 0) > 0"); + WHERE ""c"".""Id"" = ""a"".""CountryId"" AND (""k"".""Id"" IS NOT NULL) AND ""a"".""CountryId"" > 0) > 0"); } public override async Task Update_where_keyless_entity_mapped_to_sql_query(bool async) diff --git a/test/EFCore.Sqlite.FunctionalTests/Query/GearsOfWarQuerySqliteTest.cs b/test/EFCore.Sqlite.FunctionalTests/Query/GearsOfWarQuerySqliteTest.cs index fe92ce567a6..3c767f5ac28 100644 --- a/test/EFCore.Sqlite.FunctionalTests/Query/GearsOfWarQuerySqliteTest.cs +++ b/test/EFCore.Sqlite.FunctionalTests/Query/GearsOfWarQuerySqliteTest.cs @@ -372,7 +372,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) @@ -690,7 +690,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"" <> 'K.I.A.' OR ""t"".""Note"" IS NULL"); +WHERE ""t"".""Note"" <> 'K.I.A.' OR (""t"".""Note"" IS NULL)"); } public override async Task Include_with_join_and_inheritance_with_orderby_before_and_after_include(bool async) @@ -786,7 +786,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', '70534E05-782C-4052-8720-C2C54481CE5F', 'A7BE028A-0CF2-448F-AB55-CE8BC5D8CF69', 'A8AD98F9-E023-4E2A-9A70-C2728455BD34', 'B39A6FBA-9026-4D69-828E-FD7068673E57', 'DF36F493-463F-4123-83F9-6B135DEEB7BA')"); +WHERE (""c"".""Location"" IS NOT NULL) AND ""t"".""Id"" IN ('34C8D86E-A4AC-4BE5-827F-584DDA348A07', '70534E05-782C-4052-8720-C2C54481CE5F', 'A7BE028A-0CF2-448F-AB55-CE8BC5D8CF69', 'A8AD98F9-E023-4E2A-9A70-C2728455BD34', 'B39A6FBA-9026-4D69-828E-FD7068673E57', 'DF36F493-463F-4123-83F9-6B135DEEB7BA')"); } public override async Task Projecting_nullable_bool_in_conditional_works(bool async) @@ -795,7 +795,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 0 END AS ""Prop"" FROM ""Tags"" AS ""t"" @@ -828,7 +828,7 @@ public override async Task Correlated_collections_basic_projection_explicit_to_a LEFT JOIN ( SELECT ""w"".""Id"", ""w"".""AmmunitionType"", ""w"".""IsAutomatic"", ""w"".""Name"", ""w"".""OwnerFullName"", ""w"".""SynergyWithId"" FROM ""Weapons"" AS ""w"" - WHERE ""w"".""IsAutomatic"" OR ""w"".""Name"" <> 'foo' OR ""w"".""Name"" IS NULL + WHERE ""w"".""IsAutomatic"" OR ""w"".""Name"" <> 'foo' OR (""w"".""Name"" IS NULL) ) AS ""t"" ON ""g"".""FullName"" = ""t"".""OwnerFullName"" WHERE ""g"".""Nickname"" <> 'Marcus' ORDER BY ""g"".""Nickname"", ""g"".""SquadId"""); @@ -923,10 +923,10 @@ public override async Task Null_propagation_optimization6(bool async) WHERE CASE WHEN ""g"".""LeaderNickname"" IS NOT NULL THEN length(""g"".""LeaderNickname"") ELSE NULL -END = 5 AND CASE +END = 5 AND (CASE WHEN ""g"".""LeaderNickname"" IS NOT NULL THEN length(""g"".""LeaderNickname"") ELSE NULL -END IS NOT NULL"); +END IS NOT NULL)"); } public override async Task GroupBy_Property_Include_Select_Min(bool async) @@ -978,7 +978,7 @@ public override async Task Correlated_collections_basic_projecting_constant_bool LEFT JOIN ( SELECT 1 AS ""c"", ""w"".""Id"", ""w"".""OwnerFullName"" FROM ""Weapons"" AS ""w"" - WHERE ""w"".""IsAutomatic"" OR ""w"".""Name"" <> 'foo' OR ""w"".""Name"" IS NULL + WHERE ""w"".""IsAutomatic"" OR ""w"".""Name"" <> 'foo' OR (""w"".""Name"" IS NULL) ) AS ""t"" ON ""g"".""FullName"" = ""t"".""OwnerFullName"" WHERE ""g"".""Nickname"" <> 'Marcus' ORDER BY ""g"".""Nickname"", ""g"".""SquadId"""); @@ -1203,7 +1203,7 @@ public override async Task OfTypeNav3(bool async) 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"" <> 'Foo' OR ""t"".""Note"" IS NULL) AND ""g"".""Discriminator"" = 'Officer' AND (""t0"".""Note"" <> 'Bar' OR ""t0"".""Note"" IS NULL)"); +WHERE (""t"".""Note"" <> 'Foo' OR (""t"".""Note"" IS NULL)) AND ""g"".""Discriminator"" = 'Officer' AND (""t0"".""Note"" <> 'Bar' OR (""t0"".""Note"" IS NULL))"); } public override async Task ToString_guid_property_projection(bool async) @@ -1234,7 +1234,7 @@ public override async Task Optional_navigation_type_compensation_works_with_all( SELECT 1 FROM ""Tags"" AS ""t"" LEFT JOIN ""Gears"" AS ""g"" ON ""t"".""GearNickName"" = ""g"".""Nickname"" AND ""t"".""GearSquadId"" = ""g"".""SquadId"" - WHERE (""t"".""Note"" <> 'K.I.A.' OR ""t"".""Note"" IS NULL) AND NOT (""g"".""HasSoulPatch""))"); + WHERE (""t"".""Note"" <> 'K.I.A.' OR (""t"".""Note"" IS NULL)) AND NOT (""g"".""HasSoulPatch""))"); } public override async Task Collection_navigation_access_on_derived_entity_using_cast_in_SelectMany(bool async) @@ -1384,7 +1384,7 @@ public override async Task Correlated_collections_basic_projection_ordered(bool LEFT JOIN ( SELECT ""w"".""Id"", ""w"".""AmmunitionType"", ""w"".""IsAutomatic"", ""w"".""Name"", ""w"".""OwnerFullName"", ""w"".""SynergyWithId"" FROM ""Weapons"" AS ""w"" - WHERE ""w"".""IsAutomatic"" OR ""w"".""Name"" <> 'foo' OR ""w"".""Name"" IS NULL + WHERE ""w"".""IsAutomatic"" OR ""w"".""Name"" <> 'foo' OR (""w"".""Name"" IS NULL) ) AS ""t"" ON ""g"".""FullName"" = ""t"".""OwnerFullName"" WHERE ""g"".""Nickname"" <> 'Marcus' ORDER BY ""g"".""Nickname"", ""g"".""SquadId"", ""t"".""Name"" DESC"); @@ -1475,7 +1475,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"" = 'Marcus' AND (""g"".""CityOfBirthName"" <> 'Ephyra' OR ""g"".""CityOfBirthName"" IS NULL)"); +WHERE ""g"".""Nickname"" = 'Marcus' AND (""g"".""CityOfBirthName"" <> 'Ephyra' OR (""g"".""CityOfBirthName"" IS NULL))"); } public override async Task String_compare_with_null_conditional_argument2(bool async) @@ -1486,7 +1486,7 @@ public override async Task String_compare_with_null_conditional_argument2(bool a @"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"" -ORDER BY 'Marcus'' Lancer' = ""w0"".""Name"" AND ""w0"".""Name"" IS NOT NULL"); +ORDER BY 'Marcus'' Lancer' = ""w0"".""Name"" AND (""w0"".""Name"" IS NOT NULL)"); } public override async Task Entity_equality_empty(bool async) @@ -1635,7 +1635,7 @@ public override async Task Left_join_projection_using_conditional_tracking(bool await base.Left_join_projection_using_conditional_tracking(async); AssertSql( - @"SELECT ""g0"".""Nickname"" IS NULL OR ""g0"".""SquadId"" IS NULL, ""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"" + @"SELECT (""g0"".""Nickname"" IS NULL) OR (""g0"".""SquadId"" IS NULL), ""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"" LEFT JOIN ""Gears"" AS ""g0"" ON ""g"".""LeaderNickname"" = ""g0"".""Nickname"""); } @@ -1649,7 +1649,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"" <> 'Foo' OR ""t"".""Note"" IS NULL) AND ""g"".""Discriminator"" = 'Officer' AND (""t0"".""Note"" <> 'Bar' OR ""t0"".""Note"" IS NULL)"); +WHERE (""t"".""Note"" <> 'Foo' OR (""t"".""Note"" IS NULL)) AND ""g"".""Discriminator"" = 'Officer' AND (""t0"".""Note"" <> 'Bar' OR (""t0"".""Note"" IS NULL))"); } public override async Task Select_subquery_distinct_singleordefault_boolean_empty_with_pushdown(bool async) @@ -1731,7 +1731,7 @@ public override async Task Correlated_collections_basic_projecting_single_proper LEFT JOIN ( SELECT ""w"".""Name"", ""w"".""Id"", ""w"".""OwnerFullName"" FROM ""Weapons"" AS ""w"" - WHERE ""w"".""IsAutomatic"" OR ""w"".""Name"" <> 'foo' OR ""w"".""Name"" IS NULL + WHERE ""w"".""IsAutomatic"" OR ""w"".""Name"" <> 'foo' OR (""w"".""Name"" IS NULL) ) AS ""t"" ON ""g"".""FullName"" = ""t"".""OwnerFullName"" WHERE ""g"".""Nickname"" <> 'Marcus' ORDER BY ""g"".""Nickname"", ""g"".""SquadId"""); @@ -1849,7 +1849,7 @@ public override async Task Select_multiple_conditions(bool async) await base.Select_multiple_conditions(async); AssertSql( - @"SELECT ""w"".""Id"", NOT (""w"".""IsAutomatic"") AND ""w"".""SynergyWithId"" = 1 AND ""w"".""SynergyWithId"" IS NOT NULL AS ""IsCartridge"" + @"SELECT ""w"".""Id"", NOT (""w"".""IsAutomatic"") AND ""w"".""SynergyWithId"" = 1 AND (""w"".""SynergyWithId"" IS NOT NULL) AS ""IsCartridge"" FROM ""Weapons"" AS ""w"""); } @@ -1903,7 +1903,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"""); } @@ -1952,10 +1952,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 NOT (CASE +END IS NOT NULL) AND NOT (CASE WHEN ""t"".""GearNickName"" IS NOT NULL THEN ""g"".""HasSoulPatch"" ELSE NULL END) @@ -1977,11 +1977,11 @@ public override async Task Where_enum_has_flag_subquery_client_eval(bool async) SELECT ""g0"".""Rank"" FROM ""Gears"" AS ""g0"" ORDER BY ""g0"".""Nickname"", ""g0"".""SquadId"" - LIMIT 1) OR ( + LIMIT 1) OR (( SELECT ""g0"".""Rank"" FROM ""Gears"" AS ""g0"" ORDER BY ""g0"".""Nickname"", ""g0"".""SquadId"" - LIMIT 1) IS NULL"); + LIMIT 1) IS NULL)"); } public override async Task Navigation_access_via_EFProperty_on_derived_entity_using_cast(bool async) @@ -2146,7 +2146,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"" <> 'K.I.A.' OR ""t"".""Note"" IS NULL) AND EXISTS ( +WHERE (""t"".""Note"" <> 'K.I.A.' OR (""t"".""Note"" IS NULL)) AND EXISTS ( SELECT 1 FROM ""Gears"" AS ""g0"" WHERE ""g0"".""SquadId"" = ""g"".""SquadId"")"); @@ -2191,7 +2191,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"" OR ""w"".""Name"" <> 'foo' OR ""w"".""Name"" IS NULL + WHERE ""w"".""IsAutomatic"" OR ""w"".""Name"" <> '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"" @@ -2361,7 +2361,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"" <> 'Cole Train' OR ""t"".""GearNickName"" IS NULL +WHERE ""t"".""GearNickName"" <> 'Cole Train' OR (""t"".""GearNickName"" IS NULL) ORDER BY ""g"".""Nickname"", ""t0"".""Id"""); } @@ -2449,7 +2449,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"" = 'Ephyra' OR ""c"".""Name"" IS NULL)"); +WHERE ""g"".""SquadId"" < 2 AND (""c"".""Name"" = 'Ephyra' OR (""c"".""Name"" IS NULL))"); } public override async Task Include_after_Select_throws(bool async) @@ -2652,7 +2652,7 @@ LEFT JOIN ( FROM ""LocustLeaders"" AS ""l"" WHERE ""l"".""Discriminator"" = 'LocustCommander' ) AS ""t"" ON ""f"".""CommanderName"" = ""t"".""Name"" -WHERE ""c"".""Name"" <> 'Foo' OR ""c"".""Name"" IS NULL"); +WHERE ""c"".""Name"" <> 'Foo' OR (""c"".""Name"" IS NULL)"); } public override async Task Optional_navigation_type_compensation_works_with_orderby(bool async) @@ -2663,7 +2663,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"" <> 'K.I.A.' OR ""t"".""Note"" IS NULL +WHERE ""t"".""Note"" <> 'K.I.A.' OR (""t"".""Note"" IS NULL) ORDER BY ""g"".""SquadId"""); } @@ -2695,7 +2695,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))"); } public override async Task Include_multiple_one_to_one_optional_and_one_to_one_required(bool async) @@ -2728,7 +2728,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"" <> 'Foo' OR ""t"".""Note"" IS NULL"); +WHERE ""t"".""Note"" <> 'Foo' OR (""t"".""Note"" IS NULL)"); } public override async Task ToString_boolean_property_non_nullable(bool async) @@ -2767,7 +2767,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"""); } @@ -2808,7 +2808,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"" <> 'K.I.A.' OR ""t"".""Note"" IS NULL) AND NOT (""g"".""HasSoulPatch"")"); +WHERE (""t"".""Note"" <> 'K.I.A.' OR (""t"".""Note"" IS NULL)) AND NOT (""g"".""HasSoulPatch"")"); } public override async Task Include_collection_on_derived_type_using_string(bool async) @@ -2892,7 +2892,7 @@ public override async Task Null_propagation_optimization2(bool async) FROM ""Gears"" AS ""g"" WHERE CASE WHEN ""g"".""LeaderNickname"" IS NULL THEN NULL - ELSE ""g"".""LeaderNickname"" IS NOT NULL AND (""g"".""LeaderNickname"" LIKE '%us') + ELSE (""g"".""LeaderNickname"" IS NOT NULL) AND (""g"".""LeaderNickname"" LIKE '%us') END = 1"); } @@ -2925,7 +2925,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"" = 'Officer' ORDER BY ""t"".""Id"", ""g"".""Nickname"", ""g"".""SquadId"", ""t0"".""Nickname"""); } @@ -2984,7 +2984,7 @@ public override async Task 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 substr(""t"".""Note"", 0 + 1, length(""s"".""Name"")) = ""t"".""GearNickName"" OR ((""t"".""Note"" IS NULL OR ""s"".""Name"" IS NULL) AND ""t"".""GearNickName"" IS NULL)"); +WHERE substr(""t"".""Note"", 0 + 1, length(""s"".""Name"")) = ""t"".""GearNickName"" OR (((""t"".""Note"" IS NULL) OR (""s"".""Name"" IS NULL)) AND (""t"".""GearNickName"" IS NULL))"); } public override async Task OrderBy_bool_coming_from_optional_navigation(bool async) @@ -3237,7 +3237,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', '70534E05-782C-4052-8720-C2C54481CE5F', 'A7BE028A-0CF2-448F-AB55-CE8BC5D8CF69', 'A8AD98F9-E023-4E2A-9A70-C2728455BD34', 'B39A6FBA-9026-4D69-828E-FD7068673E57', 'DF36F493-463F-4123-83F9-6B135DEEB7BA')"); +WHERE (""t"".""Id"" IS NOT NULL) AND ""t"".""Id"" IN ('34C8D86E-A4AC-4BE5-827F-584DDA348A07', '70534E05-782C-4052-8720-C2C54481CE5F', 'A7BE028A-0CF2-448F-AB55-CE8BC5D8CF69', 'A8AD98F9-E023-4E2A-9A70-C2728455BD34', 'B39A6FBA-9026-4D69-828E-FD7068673E57', 'DF36F493-463F-4123-83F9-6B135DEEB7BA')"); } public override async Task Coalesce_operator_in_projection_with_other_conditions(bool async) @@ -3245,7 +3245,7 @@ public override async Task Coalesce_operator_in_projection_with_other_conditions await base.Coalesce_operator_in_projection_with_other_conditions(async); AssertSql( - @"SELECT ""w"".""AmmunitionType"" = 1 AND ""w"".""AmmunitionType"" IS NOT NULL AND COALESCE(""w"".""IsAutomatic"", 0) + @"SELECT ""w"".""AmmunitionType"" = 1 AND (""w"".""AmmunitionType"" IS NOT NULL) AND COALESCE(""w"".""IsAutomatic"", 0) FROM ""Weapons"" AS ""w"""); } @@ -3340,7 +3340,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 Include_with_join_and_inheritance1(bool async) @@ -3459,7 +3459,7 @@ LEFT JOIN ( FROM ""LocustLeaders"" AS ""l"" WHERE ""l"".""Discriminator"" = 'LocustCommander' ) AS ""t"" ON ""f"".""CommanderName"" = ""t"".""Name"" -WHERE (""c"".""Name"" <> 'Foo' OR ""c"".""Name"" IS NULL) AND (""t"".""Name"" <> 'Bar' OR ""t"".""Name"" IS NULL)"); +WHERE (""c"".""Name"" <> 'Foo' OR (""c"".""Name"" IS NULL)) AND (""t"".""Name"" <> 'Bar' OR (""t"".""Name"" IS NULL))"); } public override async Task Correlated_collections_with_funky_orderby_complex_scenario1(bool async) @@ -3518,7 +3518,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"" <> 'K.I.A.' OR ""t"".""Note"" IS NULL"); +WHERE ""t"".""Note"" <> 'K.I.A.' OR (""t"".""Note"" IS NULL)"); } public override async Task Bool_projection_from_subquery_treated_appropriately_in_where(bool async) @@ -3635,12 +3635,12 @@ public override async Task FirstOrDefault_navigation_access_entity_equality_in_w FROM ""Gears"" AS ""g"" INNER JOIN ""Cities"" AS ""c0"" ON ""g"".""CityOfBirthName"" = ""c0"".""Name"" ORDER BY ""g"".""Nickname"" - LIMIT 1) OR (""c"".""Name"" IS NULL AND ( + LIMIT 1) OR ((""c"".""Name"" IS NULL) AND (( SELECT ""c0"".""Name"" FROM ""Gears"" AS ""g"" INNER JOIN ""Cities"" AS ""c0"" ON ""g"".""CityOfBirthName"" = ""c0"".""Name"" ORDER BY ""g"".""Nickname"" - LIMIT 1) IS NULL)"); + LIMIT 1) IS NULL))"); } public override async Task Nav_rewrite_with_convert2(bool async) @@ -3656,7 +3656,7 @@ LEFT JOIN ( FROM ""LocustLeaders"" AS ""l"" WHERE ""l"".""Discriminator"" = 'LocustCommander' ) AS ""t"" ON ""f"".""CommanderName"" = ""t"".""Name"" -WHERE (""c"".""Name"" <> 'Foo' OR ""c"".""Name"" IS NULL) AND (""t"".""Name"" <> 'Bar' OR ""t"".""Name"" IS NULL)"); +WHERE (""c"".""Name"" <> 'Foo' OR (""c"".""Name"" IS NULL)) AND (""t"".""Name"" <> 'Bar' OR (""t"".""Name"" IS NULL))"); } public override async Task Contains_on_collection_of_byte_subquery(bool async) @@ -3715,7 +3715,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"""); } @@ -3778,7 +3778,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 Collection_with_inheritance_and_join_include_joined(bool async) @@ -3873,7 +3873,7 @@ public override async Task Include_on_GroupJoin_SelectMany_DefaultIfEmpty_with_c await base.Include_on_GroupJoin_SelectMany_DefaultIfEmpty_with_conditional_result(async); AssertSql( - @"SELECT ""g0"".""Nickname"" IS NOT NULL AND ""g0"".""SquadId"" IS NOT NULL, ""g0"".""Nickname"", ""g0"".""SquadId"", ""g0"".""AssignedCityName"", ""g0"".""CityOfBirthName"", ""g0"".""Discriminator"", ""g0"".""FullName"", ""g0"".""HasSoulPatch"", ""g0"".""LeaderNickname"", ""g0"".""LeaderSquadId"", ""g0"".""Rank"", ""g"".""Nickname"", ""g"".""SquadId"", ""w"".""Id"", ""w"".""AmmunitionType"", ""w"".""IsAutomatic"", ""w"".""Name"", ""w"".""OwnerFullName"", ""w"".""SynergyWithId"", ""g"".""AssignedCityName"", ""g"".""CityOfBirthName"", ""g"".""Discriminator"", ""g"".""FullName"", ""g"".""HasSoulPatch"", ""g"".""LeaderNickname"", ""g"".""LeaderSquadId"", ""g"".""Rank"", ""w0"".""Id"", ""w0"".""AmmunitionType"", ""w0"".""IsAutomatic"", ""w0"".""Name"", ""w0"".""OwnerFullName"", ""w0"".""SynergyWithId"" + @"SELECT (""g0"".""Nickname"" IS NOT NULL) AND (""g0"".""SquadId"" IS NOT NULL), ""g0"".""Nickname"", ""g0"".""SquadId"", ""g0"".""AssignedCityName"", ""g0"".""CityOfBirthName"", ""g0"".""Discriminator"", ""g0"".""FullName"", ""g0"".""HasSoulPatch"", ""g0"".""LeaderNickname"", ""g0"".""LeaderSquadId"", ""g0"".""Rank"", ""g"".""Nickname"", ""g"".""SquadId"", ""w"".""Id"", ""w"".""AmmunitionType"", ""w"".""IsAutomatic"", ""w"".""Name"", ""w"".""OwnerFullName"", ""w"".""SynergyWithId"", ""g"".""AssignedCityName"", ""g"".""CityOfBirthName"", ""g"".""Discriminator"", ""g"".""FullName"", ""g"".""HasSoulPatch"", ""g"".""LeaderNickname"", ""g"".""LeaderSquadId"", ""g"".""Rank"", ""w0"".""Id"", ""w0"".""AmmunitionType"", ""w0"".""IsAutomatic"", ""w0"".""Name"", ""w0"".""OwnerFullName"", ""w0"".""SynergyWithId"" FROM ""Gears"" AS ""g"" LEFT JOIN ""Gears"" AS ""g0"" ON ""g"".""LeaderNickname"" = ""g0"".""Nickname"" LEFT JOIN ""Weapons"" AS ""w"" ON ""g0"".""FullName"" = ""w"".""OwnerFullName"" @@ -3998,7 +3998,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"""); } @@ -4195,7 +4195,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"" = 'Marcus' AND (""g"".""CityOfBirthName"" <> 'Ephyra' OR ""g"".""CityOfBirthName"" IS NULL)"); +WHERE ""g"".""Nickname"" = 'Marcus' AND (""g"".""CityOfBirthName"" <> 'Ephyra' OR (""g"".""CityOfBirthName"" IS NULL))"); } public override async Task GroupBy_Property_Include_Select_Sum(bool async) @@ -4228,7 +4228,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', '70534E05-782C-4052-8720-C2C54481CE5F', 'A7BE028A-0CF2-448F-AB55-CE8BC5D8CF69', 'A8AD98F9-E023-4E2A-9A70-C2728455BD34', 'B39A6FBA-9026-4D69-828E-FD7068673E57', 'DF36F493-463F-4123-83F9-6B135DEEB7BA')"); +WHERE (""t"".""Id"" IS NOT NULL) AND ""t"".""Id"" IN ('34C8D86E-A4AC-4BE5-827F-584DDA348A07', '70534E05-782C-4052-8720-C2C54481CE5F', 'A7BE028A-0CF2-448F-AB55-CE8BC5D8CF69', 'A8AD98F9-E023-4E2A-9A70-C2728455BD34', 'B39A6FBA-9026-4D69-828E-FD7068673E57', 'DF36F493-463F-4123-83F9-6B135DEEB7BA')"); } public override async Task Projecting_property_converted_to_nullable_into_new_array(bool async) @@ -4284,7 +4284,7 @@ public override async Task Double_order_by_on_string_compare(bool async) AssertSql( @"SELECT ""w"".""Id"", ""w"".""AmmunitionType"", ""w"".""IsAutomatic"", ""w"".""Name"", ""w"".""OwnerFullName"", ""w"".""SynergyWithId"" FROM ""Weapons"" AS ""w"" -ORDER BY ""w"".""Name"" = 'Marcus'' Lancer' AND ""w"".""Name"" IS NOT NULL, ""w"".""Id"""); +ORDER BY ""w"".""Name"" = 'Marcus'' Lancer' AND (""w"".""Name"" IS NOT NULL), ""w"".""Id"""); } public override async Task Take_without_orderby_followed_by_orderBy_is_pushed_down3(bool async) @@ -4410,7 +4410,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"" <> 'K.I.A.' OR ""t"".""Note"" IS NULL"); +WHERE ""t"".""Note"" <> 'K.I.A.' OR (""t"".""Note"" IS NULL)"); } public override async Task Navigation_access_on_derived_materialized_entity_using_cast(bool async) @@ -4461,7 +4461,7 @@ public override async Task Null_semantics_is_correctly_applied_for_function_comp @"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 substr(""t"".""Note"", 0 + 1, ""g"".""SquadId"") = ""t"".""GearNickName"" OR ((""t"".""Note"" IS NULL OR ""g"".""SquadId"" IS NULL) AND ""t"".""GearNickName"" IS NULL)"); +WHERE substr(""t"".""Note"", 0 + 1, ""g"".""SquadId"") = ""t"".""GearNickName"" OR (((""t"".""Note"" IS NULL) OR (""g"".""SquadId"" IS NULL)) AND (""t"".""GearNickName"" IS NULL))"); } public override async Task Checked_context_with_cast_does_not_fail(bool async) @@ -4495,7 +4495,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 ""g0"".""LeaderNickname"" IS NOT NULL + WHEN (""g0"".""Nickname"" IS NOT NULL) AND (""g0"".""SquadId"" IS NOT NULL) THEN ""g0"".""LeaderNickname"" IS NOT NULL ELSE NULL END AS ""Condition"" FROM ""Gears"" AS ""g"" @@ -4568,7 +4568,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"""); } @@ -4592,7 +4592,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"" <> 'K.I.A.' OR ""t"".""Note"" IS NULL) AND ""g"".""HasSoulPatch"""); +WHERE (""t"".""Note"" <> 'K.I.A.' OR (""t"".""Note"" IS NULL)) AND ""g"".""HasSoulPatch"""); } public override async Task Where_subquery_distinct_last_boolean(bool async) @@ -4645,11 +4645,11 @@ public override async Task Where_enum_has_flag_subquery_with_pushdown(bool async SELECT ""g0"".""Rank"" FROM ""Gears"" AS ""g0"" ORDER BY ""g0"".""Nickname"", ""g0"".""SquadId"" - LIMIT 1) OR ( + LIMIT 1) OR (( SELECT ""g0"".""Rank"" FROM ""Gears"" AS ""g0"" ORDER BY ""g0"".""Nickname"", ""g0"".""SquadId"" - LIMIT 1) IS NULL", + LIMIT 1) 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"" @@ -4661,11 +4661,11 @@ public override async Task Where_enum_has_flag_subquery_with_pushdown(bool async SELECT ""g0"".""Rank"" FROM ""Gears"" AS ""g0"" ORDER BY ""g0"".""Nickname"", ""g0"".""SquadId"" - LIMIT 1) OR ( + LIMIT 1) OR (( SELECT ""g0"".""Rank"" FROM ""Gears"" AS ""g0"" ORDER BY ""g0"".""Nickname"", ""g0"".""SquadId"" - LIMIT 1) IS NULL"); + LIMIT 1) IS NULL)"); } public override async Task Null_semantics_on_nullable_bool_from_left_join_subquery_is_fully_applied(bool async) @@ -4711,7 +4711,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"" <> 'Paduk' OR ""g"".""Nickname"" IS NULL +WHERE ""g"".""Nickname"" <> 'Paduk' OR (""g"".""Nickname"" IS NULL) ORDER BY ""c"".""Name"", ""w"".""Id"""); } @@ -4831,7 +4831,7 @@ public override async Task String_compare_with_null_conditional_argument(bool as @"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"" -ORDER BY ""w0"".""Name"" = 'Marcus'' Lancer' AND ""w0"".""Name"" IS NOT NULL"); +ORDER BY ""w0"".""Name"" = 'Marcus'' Lancer' AND (""w0"".""Name"" IS NOT NULL)"); } public override async Task Project_one_value_type_from_empty_collection(bool async) @@ -4872,7 +4872,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"" = 'Officer' ORDER BY ""t"".""Id"", ""g"".""Nickname"", ""g"".""SquadId"", ""g0"".""Nickname"""); } @@ -4893,7 +4893,7 @@ public override async Task Null_checks_in_correlated_predicate_are_correctly_tra AssertSql( @"SELECT ""t"".""Id"", ""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"" AND ""t"".""Note"" IS NOT NULL +LEFT JOIN ""Gears"" AS ""g"" ON ""t"".""GearNickName"" = ""g"".""Nickname"" AND ""t"".""GearSquadId"" = ""g"".""SquadId"" AND (""t"".""Note"" IS NOT NULL) ORDER BY ""t"".""Id"", ""g"".""Nickname"""); } @@ -4902,7 +4902,7 @@ public override async Task Project_navigation_defined_on_derived_from_entity_wit await base.Project_navigation_defined_on_derived_from_entity_with_inheritance_using_soft_cast(async); 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"", ""g"".""Nickname"" IS NULL OR ""g"".""SquadId"" IS NULL AS ""IsNull"", ""f"".""Id"", ""f"".""CapitalName"", ""f"".""Discriminator"", ""f"".""Name"", ""f"".""ServerAddress"", ""f"".""CommanderName"", ""f"".""Eradicated"", ""f"".""Id"" IS NULL AS ""IsNull"", ""l0"".""Id"", ""l0"".""IsOperational"", ""l0"".""Name"", ""l0"".""Id"" IS NULL AS ""IsNull"" + @"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"", (""g"".""Nickname"" IS NULL) OR (""g"".""SquadId"" IS NULL) AS ""IsNull"", ""f"".""Id"", ""f"".""CapitalName"", ""f"".""Discriminator"", ""f"".""Name"", ""f"".""ServerAddress"", ""f"".""CommanderName"", ""f"".""Eradicated"", ""f"".""Id"" IS NULL AS ""IsNull"", ""l0"".""Id"", ""l0"".""IsOperational"", ""l0"".""Name"", ""l0"".""Id"" IS NULL AS ""IsNull"" FROM ""LocustLeaders"" AS ""l"" LEFT JOIN ""Gears"" AS ""g"" ON ""l"".""DefeatedByNickname"" = ""g"".""Nickname"" AND ""l"".""DefeatedBySquadId"" = ""g"".""SquadId"" LEFT JOIN ""Factions"" AS ""f"" ON ""l"".""Name"" = ""f"".""CommanderName"" @@ -4932,7 +4932,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"" <> 'Foo' OR ""t"".""Note"" IS NULL"); +WHERE ""t"".""Note"" <> 'Foo' OR (""t"".""Note"" IS NULL)"); } public override async Task Composite_key_entity_equal(bool async) @@ -5047,11 +5047,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"" = 'LocustCommander' AND (""l"".""HighCommandId"" <> 0 OR ""l"".""HighCommandId"" IS NULL)", +WHERE ""l"".""Discriminator"" = '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"" = 'LocustCommander' AND (""l"".""HighCommandId"" <> 0 OR ""l"".""HighCommandId"" IS NULL)"); +WHERE ""l"".""Discriminator"" = 'LocustCommander' AND (""l"".""HighCommandId"" <> 0 OR (""l"".""HighCommandId"" IS NULL))"); } public override async Task DateTimeOffset_DateAdd_AddSeconds(bool async) @@ -5342,7 +5342,7 @@ public override async Task Include_on_GroupJoin_SelectMany_DefaultIfEmpty_with_c await base.Include_on_GroupJoin_SelectMany_DefaultIfEmpty_with_complex_projection_result(async); AssertSql( - @"SELECT ""g"".""Nickname"", ""g"".""SquadId"", ""g"".""AssignedCityName"", ""g"".""CityOfBirthName"", ""g"".""Discriminator"", ""g"".""FullName"", ""g"".""HasSoulPatch"", ""g"".""LeaderNickname"", ""g"".""LeaderSquadId"", ""g"".""Rank"", ""g0"".""Nickname"", ""g0"".""SquadId"", ""w"".""Id"", ""w"".""AmmunitionType"", ""w"".""IsAutomatic"", ""w"".""Name"", ""w"".""OwnerFullName"", ""w"".""SynergyWithId"", ""g0"".""AssignedCityName"", ""g0"".""CityOfBirthName"", ""g0"".""Discriminator"", ""g0"".""FullName"", ""g0"".""HasSoulPatch"", ""g0"".""LeaderNickname"", ""g0"".""LeaderSquadId"", ""g0"".""Rank"", ""w0"".""Id"", ""w0"".""AmmunitionType"", ""w0"".""IsAutomatic"", ""w0"".""Name"", ""w0"".""OwnerFullName"", ""w0"".""SynergyWithId"", ""w1"".""Id"", ""w1"".""AmmunitionType"", ""w1"".""IsAutomatic"", ""w1"".""Name"", ""w1"".""OwnerFullName"", ""w1"".""SynergyWithId"", ""w2"".""Id"", ""w2"".""AmmunitionType"", ""w2"".""IsAutomatic"", ""w2"".""Name"", ""w2"".""OwnerFullName"", ""w2"".""SynergyWithId"", ""g0"".""Nickname"" IS NOT NULL AND ""g0"".""SquadId"" IS NOT NULL, ""w3"".""Id"", ""w3"".""AmmunitionType"", ""w3"".""IsAutomatic"", ""w3"".""Name"", ""w3"".""OwnerFullName"", ""w3"".""SynergyWithId"", ""w4"".""Id"", ""w4"".""AmmunitionType"", ""w4"".""IsAutomatic"", ""w4"".""Name"", ""w4"".""OwnerFullName"", ""w4"".""SynergyWithId"" + @"SELECT ""g"".""Nickname"", ""g"".""SquadId"", ""g"".""AssignedCityName"", ""g"".""CityOfBirthName"", ""g"".""Discriminator"", ""g"".""FullName"", ""g"".""HasSoulPatch"", ""g"".""LeaderNickname"", ""g"".""LeaderSquadId"", ""g"".""Rank"", ""g0"".""Nickname"", ""g0"".""SquadId"", ""w"".""Id"", ""w"".""AmmunitionType"", ""w"".""IsAutomatic"", ""w"".""Name"", ""w"".""OwnerFullName"", ""w"".""SynergyWithId"", ""g0"".""AssignedCityName"", ""g0"".""CityOfBirthName"", ""g0"".""Discriminator"", ""g0"".""FullName"", ""g0"".""HasSoulPatch"", ""g0"".""LeaderNickname"", ""g0"".""LeaderSquadId"", ""g0"".""Rank"", ""w0"".""Id"", ""w0"".""AmmunitionType"", ""w0"".""IsAutomatic"", ""w0"".""Name"", ""w0"".""OwnerFullName"", ""w0"".""SynergyWithId"", ""w1"".""Id"", ""w1"".""AmmunitionType"", ""w1"".""IsAutomatic"", ""w1"".""Name"", ""w1"".""OwnerFullName"", ""w1"".""SynergyWithId"", ""w2"".""Id"", ""w2"".""AmmunitionType"", ""w2"".""IsAutomatic"", ""w2"".""Name"", ""w2"".""OwnerFullName"", ""w2"".""SynergyWithId"", (""g0"".""Nickname"" IS NOT NULL) AND (""g0"".""SquadId"" IS NOT NULL), ""w3"".""Id"", ""w3"".""AmmunitionType"", ""w3"".""IsAutomatic"", ""w3"".""Name"", ""w3"".""OwnerFullName"", ""w3"".""SynergyWithId"", ""w4"".""Id"", ""w4"".""AmmunitionType"", ""w4"".""IsAutomatic"", ""w4"".""Name"", ""w4"".""OwnerFullName"", ""w4"".""SynergyWithId"" FROM ""Gears"" AS ""g"" LEFT JOIN ""Gears"" AS ""g0"" ON ""g"".""LeaderNickname"" = ""g0"".""Nickname"" LEFT JOIN ""Weapons"" AS ""w"" ON ""g"".""FullName"" = ""w"".""OwnerFullName"" @@ -5552,7 +5552,7 @@ public override async Task Correlated_collections_basic_projection_explicit_to_l LEFT JOIN ( SELECT ""w"".""Id"", ""w"".""AmmunitionType"", ""w"".""IsAutomatic"", ""w"".""Name"", ""w"".""OwnerFullName"", ""w"".""SynergyWithId"" FROM ""Weapons"" AS ""w"" - WHERE ""w"".""IsAutomatic"" OR ""w"".""Name"" <> 'foo' OR ""w"".""Name"" IS NULL + WHERE ""w"".""IsAutomatic"" OR ""w"".""Name"" <> 'foo' OR (""w"".""Name"" IS NULL) ) AS ""t"" ON ""g"".""FullName"" = ""t"".""OwnerFullName"" WHERE ""g"".""Nickname"" <> 'Marcus' ORDER BY ""g"".""Nickname"", ""g"".""SquadId"""); @@ -5613,7 +5613,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"" = 'LocustCommander' AND ""g"".""Nickname"" IS NOT NULL AND ""g"".""SquadId"" IS NOT NULL"); +WHERE ""l"".""Discriminator"" = 'LocustCommander' AND (""g"".""Nickname"" IS NOT NULL) AND (""g"".""SquadId"" IS NOT NULL)"); } public override async Task Where_nullable_enum_with_non_nullable_parameter(bool async) @@ -5774,11 +5774,11 @@ WHERE CASE SELECT ""w"".""Name"" FROM ""Weapons"" AS ""w"" WHERE ""w"".""Id"" = ""g"".""SquadId"" - LIMIT 1) = @__prm2_1 AND ( + LIMIT 1) = @__prm2_1 AND (( SELECT ""w"".""Name"" FROM ""Weapons"" AS ""w"" WHERE ""w"".""Id"" = ""g"".""SquadId"" - LIMIT 1) IS NOT NULL + LIMIT 1) IS NOT NULL) ELSE 0 END"); } @@ -5794,7 +5794,7 @@ public override async Task Select_correlated_filtered_collection(bool async) LEFT JOIN ( SELECT ""w"".""Id"", ""w"".""AmmunitionType"", ""w"".""IsAutomatic"", ""w"".""Name"", ""w"".""OwnerFullName"", ""w"".""SynergyWithId"" FROM ""Weapons"" AS ""w"" - WHERE ""w"".""Name"" <> 'Lancer' OR ""w"".""Name"" IS NULL + WHERE ""w"".""Name"" <> 'Lancer' OR (""w"".""Name"" IS NULL) ) AS ""t"" ON ""g"".""FullName"" = ""t"".""OwnerFullName"" WHERE ""c"".""Name"" IN ('Ephyra', 'Hanover') ORDER BY ""g"".""Nickname"", ""g"".""SquadId"", ""c"".""Name"""); @@ -5814,7 +5814,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"" @@ -5905,7 +5905,7 @@ public override async Task Accessing_property_of_optional_navigation_in_child_pr await base.Accessing_property_of_optional_navigation_in_child_projection_works(async); AssertSql( - @"SELECT ""g"".""Nickname"" IS NOT NULL AND ""g"".""SquadId"" IS NOT NULL, ""t"".""Id"", ""g"".""Nickname"", ""g"".""SquadId"", ""t0"".""Nickname"", ""t0"".""Id"", ""t0"".""SquadId"" + @"SELECT (""g"".""Nickname"" IS NOT NULL) AND (""g"".""SquadId"" IS NOT NULL), ""t"".""Id"", ""g"".""Nickname"", ""g"".""SquadId"", ""t0"".""Nickname"", ""t0"".""Id"", ""t0"".""SquadId"" FROM ""Tags"" AS ""t"" LEFT JOIN ""Gears"" AS ""g"" ON ""t"".""GearNickName"" = ""g"".""Nickname"" AND ""t"".""GearSquadId"" = ""g"".""SquadId"" LEFT JOIN ( @@ -5929,7 +5929,7 @@ LEFT JOIN ( WHERE ""l"".""Discriminator"" = '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"""); } @@ -5943,7 +5943,7 @@ public override async Task Select_Where_Navigation_Scalar_Equals_Navigation_Scal 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_required_navigation_on_derived_type(bool async) @@ -5995,7 +5995,7 @@ LEFT JOIN ( 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"" <> 'Bar' OR ""w"".""Name"" IS NULL + WHERE ""w"".""Name"" <> 'Bar' OR (""w"".""Name"" IS NULL) ) AS ""t1"" ON ""g2"".""FullName"" = ""t1"".""OwnerFullName"" WHERE ""g2"".""FullName"" <> 'Foo' ) AS ""t0"" ON ""g"".""Nickname"" = ""t0"".""LeaderNickname"" AND ""g"".""SquadId"" = ""t0"".""LeaderSquadId"" @@ -6035,7 +6035,7 @@ public override async Task Bitwise_operation_with_null_arguments(bool async) 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) @@ -6065,7 +6065,7 @@ public override async Task Optional_navigation_with_collection_composite_key(boo WHERE ""g"".""Discriminator"" = '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"" = '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"" = 'Dom') > 0"); } public override async Task Include_with_order_by_constant(bool async) @@ -6091,7 +6091,7 @@ public override async Task Include_on_derived_type_with_order_by_and_paging(bool 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"" 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"" LIMIT @__p_0 ) AS ""t0"" @@ -6278,7 +6278,7 @@ LEFT JOIN ( FROM ""Gears"" AS ""g"" WHERE ""g"".""Discriminator"" = '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"""); } @@ -6428,7 +6428,7 @@ public override async Task Select_null_propagation_negative4(bool async) await base.Select_null_propagation_negative4(async); AssertSql( - @"SELECT ""g0"".""Nickname"" IS NOT NULL AND ""g0"".""SquadId"" IS NOT NULL, ""g0"".""Nickname"" + @"SELECT (""g0"".""Nickname"" IS NOT NULL) AND (""g0"".""SquadId"" IS NOT NULL), ""g0"".""Nickname"" FROM ""Gears"" AS ""g"" LEFT JOIN ""Gears"" AS ""g0"" ON ""g"".""HasSoulPatch"" ORDER BY ""g0"".""Nickname"""); @@ -6444,10 +6444,10 @@ public override async Task Null_propagation_optimization5(bool async) WHERE CASE WHEN ""g"".""LeaderNickname"" IS NOT NULL THEN length(""g"".""LeaderNickname"") ELSE NULL -END = 5 AND CASE +END = 5 AND (CASE WHEN ""g"".""LeaderNickname"" IS NOT NULL THEN length(""g"".""LeaderNickname"") ELSE NULL -END IS NOT NULL"); +END IS NOT NULL)"); } public override async Task Non_unicode_string_literal_is_used_for_non_unicode_column(bool async) @@ -6507,7 +6507,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 CAST(strftime('%m', ""t"".""IssueDate"") AS INTEGER) <> 5 OR ""t"".""IssueDate"" IS NULL +WHERE CAST(strftime('%m', ""t"".""IssueDate"") AS INTEGER) <> 5 OR (""t"".""IssueDate"" IS NULL) ORDER BY ""g"".""Nickname"""); } @@ -6539,7 +6539,7 @@ LEFT JOIN ( WHERE ""l"".""Discriminator"" = '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"""); } @@ -6573,7 +6573,7 @@ public override async Task Contains_on_collection_of_nullable_byte_subquery(bool 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 FirstOrDefault_over_int_compared_to_zero(bool async) @@ -6596,11 +6596,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 'Yes' + WHEN (""w"".""AmmunitionType"" IS NOT NULL) AND ""w"".""AmmunitionType"" = 1 THEN 'Yes' ELSE '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 Filter_on_subquery_projecting_one_value_type_from_empty_collection(bool async) @@ -6703,7 +6703,7 @@ public override async Task Correlated_collections_basic_projecting_constant(bool LEFT JOIN ( SELECT 'BFG' AS ""c"", ""w"".""Id"", ""w"".""OwnerFullName"" FROM ""Weapons"" AS ""w"" - WHERE ""w"".""IsAutomatic"" OR ""w"".""Name"" <> 'foo' OR ""w"".""Name"" IS NULL + WHERE ""w"".""IsAutomatic"" OR ""w"".""Name"" <> 'foo' OR (""w"".""Name"" IS NULL) ) AS ""t"" ON ""g"".""FullName"" = ""t"".""OwnerFullName"" WHERE ""g"".""Nickname"" <> 'Marcus' ORDER BY ""g"".""Nickname"", ""g"".""SquadId"""); @@ -6759,7 +6759,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"" = 'LocustCommander' AND (""g"".""Nickname"" IS NULL OR ""g"".""SquadId"" IS NULL)"); +WHERE ""l"".""Discriminator"" = 'LocustCommander' AND ((""g"".""Nickname"" IS NULL) OR (""g"".""SquadId"" IS NULL))"); } public override async Task Coalesce_used_with_non_unicode_string_column_and_constant(bool async) @@ -7078,7 +7078,7 @@ public override async Task Select_comparison_with_null(bool async) AssertSql( @"@__ammunitionType_0='1' (Nullable = true) -SELECT ""w"".""Id"", ""w"".""AmmunitionType"" = @__ammunitionType_0 AND ""w"".""AmmunitionType"" IS NOT NULL AS ""Cartridge"" +SELECT ""w"".""Id"", ""w"".""AmmunitionType"" = @__ammunitionType_0 AND (""w"".""AmmunitionType"" IS NOT NULL) AS ""Cartridge"" FROM ""Weapons"" AS ""w"" WHERE ""w"".""AmmunitionType"" = @__ammunitionType_0", // @@ -7096,7 +7096,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"" <> 'Foo' OR ""t"".""Note"" IS NULL) AND ""g"".""Discriminator"" = 'Officer' AND (""c"".""Location"" <> 'Bar' OR ""c"".""Location"" IS NULL)"); +WHERE (""t"".""Note"" <> 'Foo' OR (""t"".""Note"" IS NULL)) AND ""g"".""Discriminator"" = 'Officer' AND (""c"".""Location"" <> 'Bar' OR (""c"".""Location"" IS NULL))"); } public override async Task Correlated_collections_basic_projection(bool async) @@ -7109,7 +7109,7 @@ public override async Task Correlated_collections_basic_projection(bool async) LEFT JOIN ( SELECT ""w"".""Id"", ""w"".""AmmunitionType"", ""w"".""IsAutomatic"", ""w"".""Name"", ""w"".""OwnerFullName"", ""w"".""SynergyWithId"" FROM ""Weapons"" AS ""w"" - WHERE ""w"".""IsAutomatic"" OR ""w"".""Name"" <> 'foo' OR ""w"".""Name"" IS NULL + WHERE ""w"".""IsAutomatic"" OR ""w"".""Name"" <> 'foo' OR (""w"".""Name"" IS NULL) ) AS ""t"" ON ""g"".""FullName"" = ""t"".""OwnerFullName"" WHERE ""g"".""Nickname"" <> 'Marcus' ORDER BY ""g"".""Nickname"", ""g"".""SquadId"""); @@ -7125,10 +7125,10 @@ public override async Task Null_propagation_optimization4(bool async) WHERE CASE WHEN ""g"".""LeaderNickname"" IS NULL THEN NULL ELSE length(""g"".""LeaderNickname"") -END = 5 AND CASE +END = 5 AND (CASE WHEN ""g"".""LeaderNickname"" IS NULL THEN NULL ELSE length(""g"".""LeaderNickname"") -END IS NOT NULL"); +END IS NOT NULL)"); } public override async Task Projecting_required_string_column_compared_to_null_parameter(bool async) @@ -7148,7 +7148,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 Where_subquery_distinct_firstordefault_boolean_with_pushdown(bool async) @@ -7174,7 +7174,7 @@ public override async Task Select_null_propagation_negative5(bool async) await base.Select_null_propagation_negative5(async); AssertSql( - @"SELECT ""g0"".""Nickname"" IS NOT NULL AND ""g0"".""SquadId"" IS NOT NULL, ""g0"".""Nickname"" + @"SELECT (""g0"".""Nickname"" IS NOT NULL) AND (""g0"".""SquadId"" IS NOT NULL), ""g0"".""Nickname"" FROM ""Gears"" AS ""g"" LEFT JOIN ""Gears"" AS ""g0"" ON ""g"".""HasSoulPatch"" ORDER BY ""g0"".""Nickname"""); @@ -7205,7 +7205,7 @@ LEFT JOIN ( WHERE ""l"".""Discriminator"" = '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"""); } @@ -7303,7 +7303,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"" = 'Marcus' AND ""g"".""LeaderNickname"" IS NOT NULL"); +WHERE ""g"".""LeaderNickname"" = 'Marcus' AND (""g"".""LeaderNickname"" IS NOT NULL)"); } public override async Task Project_collection_navigation_with_inheritance3(bool async) @@ -7319,7 +7319,7 @@ LEFT JOIN ( WHERE ""l"".""Discriminator"" = '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"""); } @@ -7403,7 +7403,7 @@ LEFT JOIN ( LEFT JOIN ( SELECT ""w"".""Id"", ""w"".""AmmunitionType"", ""w"".""IsAutomatic"", ""w"".""Name"", ""w"".""OwnerFullName"", ""w"".""SynergyWithId"" FROM ""Weapons"" AS ""w"" - WHERE ""w"".""Name"" <> 'Bar' OR ""w"".""Name"" IS NULL + WHERE ""w"".""Name"" <> 'Bar' OR (""w"".""Name"" IS NULL) ) AS ""t"" ON ""g0"".""FullName"" = ""t"".""OwnerFullName"" WHERE ""g0"".""FullName"" <> 'Foo' ) AS ""t0"" ON ""g"".""Nickname"" = ""t0"".""LeaderNickname"" AND ""g"".""SquadId"" = ""t0"".""LeaderSquadId"" @@ -7432,7 +7432,7 @@ public override async Task Select_Where_Navigation_Scalar_Equals_Navigation_Scal 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 Conditional_with_conditions_evaluating_to_false_gets_optimized(bool async) @@ -7526,7 +7526,7 @@ public override async Task Select_Where_Navigation_Equals_Navigation(bool async) 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 Complex_GroupBy_after_set_operator_using_result_selector(bool async) @@ -7561,7 +7561,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"" <> 'K.I.A.' OR ""t"".""Note"" IS NULL"); +WHERE ""t"".""Note"" <> 'K.I.A.' OR (""t"".""Note"" IS NULL)"); } public override async Task Cast_to_derived_type_causes_client_eval(bool async) @@ -7631,7 +7631,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"" <> 'K.I.A.' OR ""t"".""Note"" IS NULL +WHERE ""t"".""Note"" <> 'K.I.A.' OR (""t"".""Note"" IS NULL) ORDER BY ""t"".""Note"""); } @@ -7641,7 +7641,7 @@ public override async Task Projecting_property_converted_to_nullable_with_condit AssertSql( @"SELECT CASE - WHEN ""t"".""Note"" <> 'K.I.A.' OR ""t"".""Note"" IS NULL THEN CASE + WHEN ""t"".""Note"" <> 'K.I.A.' OR (""t"".""Note"" IS NULL) THEN CASE WHEN ""t"".""GearNickName"" IS NOT NULL THEN ""g"".""SquadId"" ELSE NULL END @@ -7660,7 +7660,7 @@ public override async Task All_with_optional_navigation_is_translated_to_sql(boo SELECT 1 FROM ""Gears"" AS ""g"" LEFT JOIN ""Tags"" AS ""t"" ON ""g"".""Nickname"" = ""t"".""GearNickName"" AND ""g"".""SquadId"" = ""t"".""GearSquadId"" - WHERE ""t"".""Note"" = 'Foo' AND ""t"".""Note"" IS NOT NULL)"); + WHERE ""t"".""Note"" = 'Foo' AND (""t"".""Note"" IS NOT NULL))"); } public override async Task Count_with_optional_navigation_is_translated_to_sql(bool async) @@ -7671,7 +7671,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"" <> 'Foo' OR ""t"".""Note"" IS NULL"); +WHERE ""t"".""Note"" <> 'Foo' OR (""t"".""Note"" IS NULL)"); } public override async Task Select_null_parameter(bool async) @@ -7944,7 +7944,7 @@ public override async Task Navigation_based_on_complex_expression6(bool async) await base.Navigation_based_on_complex_expression6(async); AssertSql( - @"SELECT ""t0"".""Name"" = 'Queen Myrrah' AND ""t0"".""Name"" IS NOT NULL, ""t0"".""Name"", ""t0"".""Discriminator"", ""t0"".""LocustHordeId"", ""t0"".""ThreatLevel"", ""t0"".""ThreatLevelByte"", ""t0"".""ThreatLevelNullableByte"", ""t0"".""DefeatedByNickname"", ""t0"".""DefeatedBySquadId"", ""t0"".""HighCommandId"", ""t"".""Name"", ""t"".""Discriminator"", ""t"".""LocustHordeId"", ""t"".""ThreatLevel"", ""t"".""ThreatLevelByte"", ""t"".""ThreatLevelNullableByte"", ""t"".""DefeatedByNickname"", ""t"".""DefeatedBySquadId"", ""t"".""HighCommandId"" + @"SELECT ""t0"".""Name"" = 'Queen Myrrah' AND (""t0"".""Name"" IS NOT NULL), ""t0"".""Name"", ""t0"".""Discriminator"", ""t0"".""LocustHordeId"", ""t0"".""ThreatLevel"", ""t0"".""ThreatLevelByte"", ""t0"".""ThreatLevelNullableByte"", ""t0"".""DefeatedByNickname"", ""t0"".""DefeatedBySquadId"", ""t0"".""HighCommandId"", ""t"".""Name"", ""t"".""Discriminator"", ""t"".""LocustHordeId"", ""t"".""ThreatLevel"", ""t"".""ThreatLevelByte"", ""t"".""ThreatLevelNullableByte"", ""t"".""DefeatedByNickname"", ""t"".""DefeatedBySquadId"", ""t"".""HighCommandId"" FROM ""Factions"" AS ""f"" CROSS JOIN ( SELECT ""l"".""Name"", ""l"".""Discriminator"", ""l"".""LocustHordeId"", ""l"".""ThreatLevel"", ""l"".""ThreatLevelByte"", ""l"".""ThreatLevelNullableByte"", ""l"".""DefeatedByNickname"", ""l"".""DefeatedBySquadId"", ""l"".""HighCommandId"" diff --git a/test/EFCore.Sqlite.FunctionalTests/Query/NorthwindFunctionsQuerySqliteTest.cs b/test/EFCore.Sqlite.FunctionalTests/Query/NorthwindFunctionsQuerySqliteTest.cs index 3946fac4630..f86dc168a00 100644 --- a/test/EFCore.Sqlite.FunctionalTests/Query/NorthwindFunctionsQuerySqliteTest.cs +++ b/test/EFCore.Sqlite.FunctionalTests/Query/NorthwindFunctionsQuerySqliteTest.cs @@ -193,7 +193,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) @@ -203,7 +203,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) @@ -213,7 +213,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) @@ -223,7 +223,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) @@ -233,7 +233,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) @@ -243,7 +243,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) @@ -253,7 +253,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) @@ -263,7 +263,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) @@ -389,7 +389,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) @@ -731,7 +731,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) @@ -739,7 +739,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"""); } @@ -750,7 +750,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 ce780e19e20..032b273aae9 100644 --- a/test/EFCore.Sqlite.FunctionalTests/Query/NorthwindMiscellaneousQuerySqliteTest.cs +++ b/test/EFCore.Sqlite.FunctionalTests/Query/NorthwindMiscellaneousQuerySqliteTest.cs @@ -27,7 +27,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 277d2737b4b..7821a64085e 100644 --- a/test/EFCore.Sqlite.FunctionalTests/Query/NorthwindQueryFiltersQuerySqliteTest.cs +++ b/test/EFCore.Sqlite.FunctionalTests/Query/NorthwindQueryFiltersQuerySqliteTest.cs @@ -24,7 +24,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 68f71cc847b..eea2decc032 100644 --- a/test/EFCore.Sqlite.FunctionalTests/Query/NorthwindWhereQuerySqliteTest.cs +++ b/test/EFCore.Sqlite.FunctionalTests/Query/NorthwindWhereQuerySqliteTest.cs @@ -185,7 +185,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/TPCGearsOfWarQuerySqliteTest.cs b/test/EFCore.Sqlite.FunctionalTests/Query/TPCGearsOfWarQuerySqliteTest.cs index 027896f02f0..fa3c72ebdb2 100644 --- a/test/EFCore.Sqlite.FunctionalTests/Query/TPCGearsOfWarQuerySqliteTest.cs +++ b/test/EFCore.Sqlite.FunctionalTests/Query/TPCGearsOfWarQuerySqliteTest.cs @@ -234,7 +234,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/TPTGearsOfWarQuerySqliteTest.cs b/test/EFCore.Sqlite.FunctionalTests/Query/TPTGearsOfWarQuerySqliteTest.cs index 7a6846b83d2..6353da76c7e 100644 --- a/test/EFCore.Sqlite.FunctionalTests/Query/TPTGearsOfWarQuerySqliteTest.cs +++ b/test/EFCore.Sqlite.FunctionalTests/Query/TPTGearsOfWarQuerySqliteTest.cs @@ -234,7 +234,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)