From ea046afc9185f8a41f3bd6c97ac302d2f7bd911c Mon Sep 17 00:00:00 2001 From: Smit Patel Date: Fri, 12 Nov 2021 16:50:42 -0800 Subject: [PATCH] Query: Avoid parethesis around binary operations when used with AND/OR Sqlite/Postgre => AND - OR 2 most lowest priority operation in that order SqlServer => Same as Sqlite except IN/LIKE which are below AND and same as OR LIKE always puts parentheses around it. And IN evaluated left to right if first works. If 2nd then first one has to be same type as item (to cause `a OR b IN ...`) to evaluate OR first. That implies bool type and SqlServer cannot have bool value directly due to search condition so it always converts to `a = (1 as bit) OR b IN ...` which doesn't cause priority issue. --- .../Query/QuerySqlGenerator.cs | 27 +- .../Query/NorthwindWhereQueryCosmosTest.cs | 30 + .../Query/GearsOfWarQueryTestBase.cs | 20 + .../Query/NorthwindWhereQueryTestBase.cs | 43 + .../CustomConvertersSqlServerTest.cs | 4 +- .../FindSqlServerTest.cs | 12 +- .../LazyLoadProxySqlServerTest.cs | 8 +- .../LoadSqlServerTest.cs | 24 +- ...avigationsCollectionsQuerySqlServerTest.cs | 78 +- ...CollectionsSharedTypeQuerySqlServerTest.cs | 28 +- ...tionsCollectionsSplitQuerySqlServerTest.cs | 122 +- .../ComplexNavigationsQuerySqlServerTest.cs | 124 +- ...NavigationsSharedTypeQuerySqlServerTest.cs | 74 +- .../Query/CompositeKeysQuerySqlServerTest.cs | 76 +- .../CompositeKeysSplitQuerySqlServerTest.cs | 134 +- .../FiltersInheritanceQuerySqlServerTest.cs | 10 +- .../Query/FromSqlQuerySqlServerTest.cs | 8 +- .../Query/FunkyDataQuerySqlServerTest.cs | 72 +- .../Query/GearsOfWarQuerySqlServerTest.cs | 706 ++++----- ...eteMappingInheritanceQuerySqlServerTest.cs | 28 +- .../Query/InheritanceQuerySqlServerTest.cs | 12 +- ...eritanceRelationshipsQuerySqlServerTest.cs | 52 +- .../ManyToManyNoTrackingQuerySqlServerTest.cs | 92 +- .../Query/ManyToManyQuerySqlServerTest.cs | 96 +- ...indAggregateOperatorsQuerySqlServerTest.cs | 68 +- .../NorthwindCompiledQuerySqlServerTest.cs | 14 +- .../NorthwindDbFunctionsQuerySqlServerTest.cs | 4 +- .../NorthwindFunctionsQuerySqlServerTest.cs | 244 ++-- .../NorthwindGroupByQuerySqlServerTest.cs | 38 +- .../NorthwindIncludeQuerySqlServerTest.cs | 10 +- .../Query/NorthwindJoinQuerySqlServerTest.cs | 6 +- ...thwindKeylessEntitiesQuerySqlServerTest.cs | 4 +- ...orthwindMiscellaneousQuerySqlServerTest.cs | 166 +-- .../NorthwindNavigationsQuerySqlServerTest.cs | 28 +- ...NorthwindQueryFiltersQuerySqlServerTest.cs | 44 +- .../NorthwindSelectQuerySqlServerTest.cs | 48 +- ...NorthwindSplitIncludeQuerySqlServerTest.cs | 16 +- .../Query/NorthwindWhereQuerySqlServerTest.cs | 124 +- .../Query/NullSemanticsQuerySqlServerTest.cs | 390 +++-- .../Query/OwnedQuerySqlServerTest.cs | 98 +- .../Query/QueryBugsTest.cs | 62 +- .../QueryFilterFuncletizationSqlServerTest.cs | 22 +- .../Query/SharedTypeQuerySqlServerTest.cs | 4 +- .../Query/SimpleQuerySqlServerTest.cs | 6 +- ...TPTFiltersInheritanceQuerySqlServerTest.cs | 14 +- .../Query/TPTGearsOfWarQuerySqlServerTest.cs | 1260 +++++++++-------- .../Query/TPTInheritanceQuerySqlServerTest.cs | 8 +- ...TManyToManyNoTrackingQuerySqlServerTest.cs | 92 +- .../Query/TPTManyToManyQuerySqlServerTest.cs | 92 +- .../TPTRelationshipsQuerySqlServerTest.cs | 52 +- ...avigationsCollectionsQuerySqlServerTest.cs | 2 +- ...ralFiltersInheritanceQuerySqlServerTest.cs | 11 +- .../TemporalGearsOfWarQuerySqlServerTest.cs | 14 +- .../TemporalManyToManyQuerySqlServerTest.cs | 58 +- .../Query/UdfDbFunctionSqlServerTests.cs | 4 +- .../CustomConvertersSqliteTest.cs | 4 +- .../Query/FromSqlQuerySqliteTest.cs | 4 +- .../NorthwindFunctionsQuerySqliteTest.cs | 32 +- .../NorthwindMiscellaneousQuerySqliteTest.cs | 2 +- .../NorthwindQueryFiltersQuerySqliteTest.cs | 2 +- .../Query/NorthwindWhereQuerySqliteTest.cs | 2 +- 61 files changed, 2542 insertions(+), 2387 deletions(-) diff --git a/src/EFCore.Relational/Query/QuerySqlGenerator.cs b/src/EFCore.Relational/Query/QuerySqlGenerator.cs index f57e880b956..d41c2245c3a 100644 --- a/src/EFCore.Relational/Query/QuerySqlGenerator.cs +++ b/src/EFCore.Relational/Query/QuerySqlGenerator.cs @@ -804,19 +804,20 @@ protected virtual bool RequiresParentheses(SqlExpression outerExpression, SqlExp case SqlBinaryExpression sqlBinaryExpression: { - //if (outerExpression is SqlBinaryExpression outerBinary) - //{ - // if (outerBinary.OperatorType == ExpressionType.AndAlso) - // { - // return sqlBinaryExpression.OperatorType == ExpressionType.OrElse; - // } - - // if (outerBinary.OperatorType == ExpressionType.OrElse) - // { - // // Precedence-wise AND is above OR but we still add parenthesis for ease of understanding - // return sqlBinaryExpression.OperatorType == ExpressionType.AndAlso; - // } - //} + if (outerExpression is SqlBinaryExpression outerBinary) + { + // Math, bitwise, comparison and equality operators have higher precedence + if (outerBinary.OperatorType == ExpressionType.AndAlso) + { + return sqlBinaryExpression.OperatorType == ExpressionType.OrElse; + } + + if (outerBinary.OperatorType == ExpressionType.OrElse) + { + // Precedence-wise AND is above OR but we still add parenthesis for ease of understanding + return sqlBinaryExpression.OperatorType == ExpressionType.AndAlso; + } + } return true; } diff --git a/test/EFCore.Cosmos.FunctionalTests/Query/NorthwindWhereQueryCosmosTest.cs b/test/EFCore.Cosmos.FunctionalTests/Query/NorthwindWhereQueryCosmosTest.cs index a6c505d7041..1868e213cdd 100644 --- a/test/EFCore.Cosmos.FunctionalTests/Query/NorthwindWhereQueryCosmosTest.cs +++ b/test/EFCore.Cosmos.FunctionalTests/Query/NorthwindWhereQueryCosmosTest.cs @@ -2300,6 +2300,36 @@ public override Task Last_over_custom_projection_compared_to_not_null(bool async return base.Last_over_custom_projection_compared_to_not_null(async); } + public override async Task Where_Contains_and_comparison(bool async) + { + await base.Where_Contains_and_comparison(async); + + AssertSql( + @"SELECT c +FROM root c +WHERE ((c[""Discriminator""] = ""Customer"") AND (c[""CustomerID""] IN (""ALFKI"", ""FISSA"") AND (c[""City""] = ""Seattle"")))"); + } + + public override async Task Where_Contains_or_comparison(bool async) + { + await base.Where_Contains_or_comparison(async); + + AssertSql( + @"SELECT c +FROM root c +WHERE ((c[""Discriminator""] = ""Customer"") AND (c[""CustomerID""] IN (""ALFKI"", ""FISSA"") OR (c[""City""] = ""Seattle"")))"); + } + + public override Task Where_Like_and_comparison(bool async) + { + return AssertTranslationFailed(() => base.Where_Like_and_comparison(async)); + } + + public override Task Where_Like_or_comparison(bool async) + { + return AssertTranslationFailed(() => base.Where_Like_or_comparison(async)); + } + private void AssertSql(params string[] expected) => Fixture.TestSqlLoggerFactory.AssertBaseline(expected); diff --git a/test/EFCore.Specification.Tests/Query/GearsOfWarQueryTestBase.cs b/test/EFCore.Specification.Tests/Query/GearsOfWarQueryTestBase.cs index 51805c3b8a7..a443f24af37 100644 --- a/test/EFCore.Specification.Tests/Query/GearsOfWarQueryTestBase.cs +++ b/test/EFCore.Specification.Tests/Query/GearsOfWarQueryTestBase.cs @@ -9282,6 +9282,26 @@ public virtual Task Where_equals_method_on_nullable_with_object_overload(bool as ss => ss.Set().Where(m => m.Rating.Equals(null))); } + [ConditionalTheory] + [MemberData(nameof(IsAsyncData))] + public virtual Task Where_bool_column_and_Contains(bool async) + { + var values = new[] { false, true }; + return AssertQuery( + async, + ss => ss.Set().Where(g => g.HasSoulPatch && values.Contains(g.HasSoulPatch))); + } + + [ConditionalTheory] + [MemberData(nameof(IsAsyncData))] + public virtual Task Where_bool_column_or_Contains(bool async) + { + var values = new[] { false, true }; + return AssertQuery( + async, + ss => ss.Set().Where(g => g.HasSoulPatch && values.Contains(g.HasSoulPatch))); + } + protected GearsOfWarContext CreateContext() => Fixture.CreateContext(); diff --git a/test/EFCore.Specification.Tests/Query/NorthwindWhereQueryTestBase.cs b/test/EFCore.Specification.Tests/Query/NorthwindWhereQueryTestBase.cs index 6ded26eb0f5..1ed208b9493 100644 --- a/test/EFCore.Specification.Tests/Query/NorthwindWhereQueryTestBase.cs +++ b/test/EFCore.Specification.Tests/Query/NorthwindWhereQueryTestBase.cs @@ -2672,5 +2672,48 @@ public virtual Task Last_over_custom_projection_compared_to_not_null(bool async) private string StringMethod(string arg) => arg; + + [ConditionalTheory] + [MemberData(nameof(IsAsyncData))] + public virtual Task Where_Contains_and_comparison(bool async) + { + var customerIds = new[] { "ALFKI", "FISSA" }; + return AssertQuery( + async, + ss => ss.Set().Where(c => customerIds.Contains(c.CustomerID) && c.City == "Seattle")); + } + + [ConditionalTheory] + [MemberData(nameof(IsAsyncData))] + public virtual Task Where_Contains_or_comparison(bool async) + { + var customerIds = new[] { "ALFKI", "FISSA" }; + return AssertQuery( + async, + ss => ss.Set().Where(c => customerIds.Contains(c.CustomerID) || c.City == "Seattle"), + entryCount: 3); + } + + [ConditionalTheory] + [MemberData(nameof(IsAsyncData))] + public virtual Task Where_Like_and_comparison(bool async) + { + return AssertQuery( + async, + ss => ss.Set().Where(c => EF.Functions.Like(c.CustomerID, "F%") && c.City == "Seattle"), + ss => ss.Set().Where(c => c.CustomerID.StartsWith("F") && c.City == "Seattle"), + entryCount: 0); + } + + [ConditionalTheory] + [MemberData(nameof(IsAsyncData))] + public virtual Task Where_Like_or_comparison(bool async) + { + return AssertQuery( + async, + ss => ss.Set().Where(c => EF.Functions.Like(c.CustomerID, "F%") || c.City == "Seattle"), + ss => ss.Set().Where(c => c.CustomerID.StartsWith("F") || c.City == "Seattle"), + entryCount: 9); + } } } diff --git a/test/EFCore.SqlServer.FunctionalTests/CustomConvertersSqlServerTest.cs b/test/EFCore.SqlServer.FunctionalTests/CustomConvertersSqlServerTest.cs index 85fa725ba65..36dd301902e 100644 --- a/test/EFCore.SqlServer.FunctionalTests/CustomConvertersSqlServerTest.cs +++ b/test/EFCore.SqlServer.FunctionalTests/CustomConvertersSqlServerTest.cs @@ -220,7 +220,7 @@ public override void Value_conversion_is_appropriately_used_for_join_condition() SELECT [b].[Url] FROM [Blog] AS [b] -INNER JOIN [Post] AS [p] ON (([b].[BlogId] = [p].[BlogId]) AND ([b].[IsVisible] = N'Y')) AND ([b].[BlogId] = @__blogId_0) +INNER JOIN [Post] AS [p] ON [b].[BlogId] = [p].[BlogId] AND [b].[IsVisible] = N'Y' AND [b].[BlogId] = @__blogId_0 WHERE [b].[IsVisible] = N'Y'"); } @@ -234,7 +234,7 @@ public override void Value_conversion_is_appropriately_used_for_left_join_condit SELECT [b].[Url] FROM [Blog] AS [b] -LEFT JOIN [Post] AS [p] ON (([b].[BlogId] = [p].[BlogId]) AND ([b].[IsVisible] = N'Y')) AND ([b].[BlogId] = @__blogId_0) +LEFT JOIN [Post] AS [p] ON [b].[BlogId] = [p].[BlogId] AND [b].[IsVisible] = N'Y' AND [b].[BlogId] = @__blogId_0 WHERE [b].[IsVisible] = N'Y'"); } diff --git a/test/EFCore.SqlServer.FunctionalTests/FindSqlServerTest.cs b/test/EFCore.SqlServer.FunctionalTests/FindSqlServerTest.cs index e564bc68031..3db6d081ff6 100644 --- a/test/EFCore.SqlServer.FunctionalTests/FindSqlServerTest.cs +++ b/test/EFCore.SqlServer.FunctionalTests/FindSqlServerTest.cs @@ -167,7 +167,7 @@ public override void Find_composite_key_from_store() SELECT TOP(1) [c].[Id1], [c].[Id2], [c].[Foo] FROM [CompositeKey] AS [c] -WHERE ([c].[Id1] = @__p_0) AND ([c].[Id2] = @__p_1)"); +WHERE [c].[Id1] = @__p_0 AND [c].[Id2] = @__p_1"); } public override void Returns_null_for_composite_key_not_in_store() @@ -180,7 +180,7 @@ public override void Returns_null_for_composite_key_not_in_store() SELECT TOP(1) [c].[Id1], [c].[Id2], [c].[Foo] FROM [CompositeKey] AS [c] -WHERE ([c].[Id1] = @__p_0) AND ([c].[Id2] = @__p_1)"); +WHERE [c].[Id1] = @__p_0 AND [c].[Id2] = @__p_1"); } public override void Find_base_type_tracked() @@ -230,7 +230,7 @@ public override void Find_derived_type_from_store() SELECT TOP(1) [b].[Id], [b].[Discriminator], [b].[Foo], [b].[Boo] FROM [BaseType] AS [b] -WHERE ([b].[Discriminator] = N'DerivedType') AND ([b].[Id] = @__p_0)"); +WHERE [b].[Discriminator] = N'DerivedType' AND [b].[Id] = @__p_0"); } public override void Returns_null_for_derived_type_not_in_store() @@ -242,7 +242,7 @@ public override void Returns_null_for_derived_type_not_in_store() SELECT TOP(1) [b].[Id], [b].[Discriminator], [b].[Foo], [b].[Boo] FROM [BaseType] AS [b] -WHERE ([b].[Discriminator] = N'DerivedType') AND ([b].[Id] = @__p_0)"); +WHERE [b].[Discriminator] = N'DerivedType' AND [b].[Id] = @__p_0"); } public override void Find_base_type_using_derived_set_tracked() @@ -254,7 +254,7 @@ public override void Find_base_type_using_derived_set_tracked() SELECT TOP(1) [b].[Id], [b].[Discriminator], [b].[Foo], [b].[Boo] FROM [BaseType] AS [b] -WHERE ([b].[Discriminator] = N'DerivedType') AND ([b].[Id] = @__p_0)"); +WHERE [b].[Discriminator] = N'DerivedType' AND [b].[Id] = @__p_0"); } public override void Find_base_type_using_derived_set_from_store() @@ -266,7 +266,7 @@ public override void Find_base_type_using_derived_set_from_store() SELECT TOP(1) [b].[Id], [b].[Discriminator], [b].[Foo], [b].[Boo] FROM [BaseType] AS [b] -WHERE ([b].[Discriminator] = N'DerivedType') AND ([b].[Id] = @__p_0)"); +WHERE [b].[Discriminator] = N'DerivedType' AND [b].[Id] = @__p_0"); } public override void Find_derived_type_using_base_set_tracked() diff --git a/test/EFCore.SqlServer.FunctionalTests/LazyLoadProxySqlServerTest.cs b/test/EFCore.SqlServer.FunctionalTests/LazyLoadProxySqlServerTest.cs index 5cf3f4c6df7..b9f08393c83 100644 --- a/test/EFCore.SqlServer.FunctionalTests/LazyLoadProxySqlServerTest.cs +++ b/test/EFCore.SqlServer.FunctionalTests/LazyLoadProxySqlServerTest.cs @@ -320,7 +320,7 @@ public override void Lazy_load_collection_composite_key(EntityState state) SELECT [c].[Id], [c].[ParentAlternateId], [c].[ParentId] FROM [ChildCompositeKey] AS [c] -WHERE ([c].[ParentAlternateId] = @__p_0) AND ([c].[ParentId] = @__p_1)"); +WHERE [c].[ParentAlternateId] = @__p_0 AND [c].[ParentId] = @__p_1"); } public override void Lazy_load_many_to_one_reference_to_principal_composite_key(EntityState state) @@ -333,7 +333,7 @@ public override void Lazy_load_many_to_one_reference_to_principal_composite_key( SELECT [p].[Id], [p].[AlternateId], [p].[Discriminator] FROM [Parent] AS [p] -WHERE ([p].[AlternateId] = @__p_0) AND ([p].[Id] = @__p_1)"); +WHERE [p].[AlternateId] = @__p_0 AND [p].[Id] = @__p_1"); } public override void Lazy_load_one_to_one_reference_to_principal_composite_key(EntityState state) @@ -346,7 +346,7 @@ public override void Lazy_load_one_to_one_reference_to_principal_composite_key(E SELECT [p].[Id], [p].[AlternateId], [p].[Discriminator] FROM [Parent] AS [p] -WHERE ([p].[AlternateId] = @__p_0) AND ([p].[Id] = @__p_1)"); +WHERE [p].[AlternateId] = @__p_0 AND [p].[Id] = @__p_1"); } public override void Lazy_load_one_to_one_reference_to_dependent_composite_key(EntityState state) @@ -359,7 +359,7 @@ public override void Lazy_load_one_to_one_reference_to_dependent_composite_key(E SELECT [s].[Id], [s].[ParentAlternateId], [s].[ParentId] FROM [SingleCompositeKey] AS [s] -WHERE ([s].[ParentAlternateId] = @__p_0) AND ([s].[ParentId] = @__p_1)"); +WHERE [s].[ParentAlternateId] = @__p_0 AND [s].[ParentId] = @__p_1"); } public override void Lazy_load_many_to_one_reference_to_principal_null_FK_composite_key(EntityState state) diff --git a/test/EFCore.SqlServer.FunctionalTests/LoadSqlServerTest.cs b/test/EFCore.SqlServer.FunctionalTests/LoadSqlServerTest.cs index 8ceb2fd8495..09609d8a7e8 100644 --- a/test/EFCore.SqlServer.FunctionalTests/LoadSqlServerTest.cs +++ b/test/EFCore.SqlServer.FunctionalTests/LoadSqlServerTest.cs @@ -318,7 +318,7 @@ public override void Lazy_load_collection_composite_key(EntityState state) SELECT [c].[Id], [c].[ParentAlternateId], [c].[ParentId] FROM [ChildCompositeKey] AS [c] -WHERE ([c].[ParentAlternateId] = @__p_0) AND ([c].[ParentId] = @__p_1)"); +WHERE [c].[ParentAlternateId] = @__p_0 AND [c].[ParentId] = @__p_1"); } public override void Lazy_load_many_to_one_reference_to_principal_composite_key(EntityState state) @@ -331,7 +331,7 @@ public override void Lazy_load_many_to_one_reference_to_principal_composite_key( SELECT [p].[Id], [p].[AlternateId] FROM [Parent] AS [p] -WHERE ([p].[AlternateId] = @__p_0) AND ([p].[Id] = @__p_1)"); +WHERE [p].[AlternateId] = @__p_0 AND [p].[Id] = @__p_1"); } public override void Lazy_load_one_to_one_reference_to_principal_composite_key(EntityState state) @@ -344,7 +344,7 @@ public override void Lazy_load_one_to_one_reference_to_principal_composite_key(E SELECT [p].[Id], [p].[AlternateId] FROM [Parent] AS [p] -WHERE ([p].[AlternateId] = @__p_0) AND ([p].[Id] = @__p_1)"); +WHERE [p].[AlternateId] = @__p_0 AND [p].[Id] = @__p_1"); } public override void Lazy_load_one_to_one_reference_to_dependent_composite_key(EntityState state) @@ -357,7 +357,7 @@ public override void Lazy_load_one_to_one_reference_to_dependent_composite_key(E SELECT [s].[Id], [s].[ParentAlternateId], [s].[ParentId] FROM [SingleCompositeKey] AS [s] -WHERE ([s].[ParentAlternateId] = @__p_0) AND ([s].[ParentId] = @__p_1)"); +WHERE [s].[ParentAlternateId] = @__p_0 AND [s].[ParentId] = @__p_1"); } public override void Lazy_load_many_to_one_reference_to_principal_null_FK_composite_key(EntityState state) @@ -1321,7 +1321,7 @@ public override async Task Load_collection_composite_key(EntityState state, bool SELECT [c].[Id], [c].[ParentAlternateId], [c].[ParentId] FROM [ChildCompositeKey] AS [c] -WHERE ([c].[ParentAlternateId] = @__p_0) AND ([c].[ParentId] = @__p_1)"); +WHERE [c].[ParentAlternateId] = @__p_0 AND [c].[ParentId] = @__p_1"); } public override async Task Load_many_to_one_reference_to_principal_composite_key(EntityState state, bool async) @@ -1334,7 +1334,7 @@ public override async Task Load_many_to_one_reference_to_principal_composite_key SELECT [p].[Id], [p].[AlternateId] FROM [Parent] AS [p] -WHERE ([p].[AlternateId] = @__p_0) AND ([p].[Id] = @__p_1)"); +WHERE [p].[AlternateId] = @__p_0 AND [p].[Id] = @__p_1"); } public override async Task Load_one_to_one_reference_to_principal_composite_key(EntityState state, bool async) @@ -1347,7 +1347,7 @@ public override async Task Load_one_to_one_reference_to_principal_composite_key( SELECT [p].[Id], [p].[AlternateId] FROM [Parent] AS [p] -WHERE ([p].[AlternateId] = @__p_0) AND ([p].[Id] = @__p_1)"); +WHERE [p].[AlternateId] = @__p_0 AND [p].[Id] = @__p_1"); } public override async Task Load_one_to_one_reference_to_dependent_composite_key(EntityState state, bool async) @@ -1360,7 +1360,7 @@ public override async Task Load_one_to_one_reference_to_dependent_composite_key( SELECT [s].[Id], [s].[ParentAlternateId], [s].[ParentId] FROM [SingleCompositeKey] AS [s] -WHERE ([s].[ParentAlternateId] = @__p_0) AND ([s].[ParentId] = @__p_1)"); +WHERE [s].[ParentAlternateId] = @__p_0 AND [s].[ParentId] = @__p_1"); } public override async Task Load_collection_using_Query_composite_key(EntityState state, bool async) @@ -1373,7 +1373,7 @@ public override async Task Load_collection_using_Query_composite_key(EntityState SELECT [c].[Id], [c].[ParentAlternateId], [c].[ParentId] FROM [ChildCompositeKey] AS [c] -WHERE ([c].[ParentAlternateId] = @__p_0) AND ([c].[ParentId] = @__p_1)"); +WHERE [c].[ParentAlternateId] = @__p_0 AND [c].[ParentId] = @__p_1"); } public override async Task Load_many_to_one_reference_to_principal_using_Query_composite_key(EntityState state, bool async) @@ -1386,7 +1386,7 @@ public override async Task Load_many_to_one_reference_to_principal_using_Query_c SELECT TOP(2) [p].[Id], [p].[AlternateId] FROM [Parent] AS [p] -WHERE ([p].[AlternateId] = @__p_0) AND ([p].[Id] = @__p_1)"); +WHERE [p].[AlternateId] = @__p_0 AND [p].[Id] = @__p_1"); } public override async Task Load_one_to_one_reference_to_principal_using_Query_composite_key(EntityState state, bool async) @@ -1399,7 +1399,7 @@ public override async Task Load_one_to_one_reference_to_principal_using_Query_co SELECT TOP(2) [p].[Id], [p].[AlternateId] FROM [Parent] AS [p] -WHERE ([p].[AlternateId] = @__p_0) AND ([p].[Id] = @__p_1)"); +WHERE [p].[AlternateId] = @__p_0 AND [p].[Id] = @__p_1"); } public override async Task Load_one_to_one_reference_to_dependent_using_Query_composite_key(EntityState state, bool async) @@ -1412,7 +1412,7 @@ public override async Task Load_one_to_one_reference_to_dependent_using_Query_co SELECT TOP(2) [s].[Id], [s].[ParentAlternateId], [s].[ParentId] FROM [SingleCompositeKey] AS [s] -WHERE ([s].[ParentAlternateId] = @__p_0) AND ([s].[ParentId] = @__p_1)"); +WHERE [s].[ParentAlternateId] = @__p_0 AND [s].[ParentId] = @__p_1"); } public override async Task Load_many_to_one_reference_to_principal_null_FK_composite_key(EntityState state, bool async) diff --git a/test/EFCore.SqlServer.FunctionalTests/Query/ComplexNavigationsCollectionsQuerySqlServerTest.cs b/test/EFCore.SqlServer.FunctionalTests/Query/ComplexNavigationsCollectionsQuerySqlServerTest.cs index c7acb67ed6b..53debe01ec6 100644 --- a/test/EFCore.SqlServer.FunctionalTests/Query/ComplexNavigationsCollectionsQuerySqlServerTest.cs +++ b/test/EFCore.SqlServer.FunctionalTests/Query/ComplexNavigationsCollectionsQuerySqlServerTest.cs @@ -179,7 +179,7 @@ LEFT JOIN ( FROM [LevelThree] AS [l1] LEFT JOIN [LevelFour] AS [l2] ON [l1].[Id] = [l2].[Level3_Required_Id] ) AS [t] ON [l0].[Id] = [t].[OneToMany_Required_Inverse3Id] -WHERE ([l0].[Name] <> N'L2 09') OR [l0].[Name] IS NULL +WHERE [l0].[Name] <> N'L2 09' OR [l0].[Name] IS NULL ORDER BY [l].[Id], [l0].[Id], [t].[Id]"); } @@ -260,7 +260,7 @@ FROM [LevelOne] AS [l] LEFT JOIN [LevelTwo] AS [l3] ON [l].[Id] = [l3].[Level1_Optional_Id] LEFT JOIN [LevelThree] AS [l4] ON [l3].[Id] = [l4].[Level2_Optional_Id] LEFT JOIN [LevelThree] AS [l5] ON [l0].[Id] = [l5].[OneToMany_Optional_Inverse3Id] -WHERE ([l1].[Name] <> N'Foo') OR [l1].[Name] IS NULL +WHERE [l1].[Name] <> N'Foo' OR [l1].[Name] IS NULL ORDER BY [l].[Id], [l0].[Id], [l1].[Id], [l2].[Id], [l3].[Id], [l4].[Id]"); } @@ -478,7 +478,7 @@ LEFT JOIN ( FROM [LevelTwo] AS [l15] WHERE [l15].[Id] <> 42 ) AS [t1] ON [t].[Id2] = [t1].[OneToMany_Optional_Self_Inverse2Id] -WHERE ([l11].[Name] <> N'Foo') OR [l11].[Name] IS NULL +WHERE [l11].[Name] <> N'Foo' OR [l11].[Name] IS NULL ORDER BY [l12].[Id], [l].[Id], [l0].[Id], [l1].[Id], [l2].[Id], [t].[Id], [t].[Id0], [t].[Id1], [t].[Id2], [t0].[Id], [t0].[Id0], [t0].[Id1], [t0].[Id2], [l11].[Id], [l13].[Id], [l14].[Id]"); } @@ -539,7 +539,7 @@ FROM [LevelOne] AS [l] LEFT JOIN ( SELECT [l0].[Id], [l0].[Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[Name], [l0].[OneToMany_Optional_Inverse2Id], [l0].[OneToMany_Optional_Self_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToMany_Required_Self_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id], [l0].[OneToOne_Optional_Self2Id] FROM [LevelTwo] AS [l0] - WHERE ([l0].[Name] <> N'Foo') OR [l0].[Name] IS NULL + WHERE [l0].[Name] <> N'Foo' OR [l0].[Name] IS NULL ) AS [t] ON [l].[Id] = [t].[OneToMany_Optional_Inverse2Id] WHERE [l].[Id] < 3 ORDER BY [l].[Id]"); @@ -710,7 +710,7 @@ public override async Task Include_collection_with_groupby_in_subquery_and_filte SELECT [l].[Name] FROM [LevelOne] AS [l] GROUP BY [l].[Name] - HAVING ([l].[Name] <> N'Foo') OR [l].[Name] IS NULL + HAVING [l].[Name] <> N'Foo' OR [l].[Name] IS NULL ) AS [t] LEFT JOIN ( SELECT [t1].[Id], [t1].[Date], [t1].[Name], [t1].[OneToMany_Optional_Self_Inverse1Id], [t1].[OneToMany_Required_Self_Inverse1Id], [t1].[OneToOne_Optional_Self1Id] @@ -1035,7 +1035,7 @@ FROM [LevelTwo] AS [l2] SELECT COUNT(*) FROM [LevelTwo] AS [l0] LEFT JOIN [LevelThree] AS [l1] ON [l0].[Id] = [l1].[OneToOne_Optional_PK_Inverse3Id] - WHERE ([l].[Id] = [l0].[OneToMany_Optional_Inverse2Id]) AND (([l1].[Name] <> N'Foo') OR [l1].[Name] IS NULL)) > 0 + WHERE [l].[Id] = [l0].[OneToMany_Optional_Inverse2Id] AND ([l1].[Name] <> N'Foo' OR [l1].[Name] IS NULL)) > 0 ORDER BY [l].[Id], [t].[Id], [t].[Id0]"); } @@ -1239,7 +1239,7 @@ 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], ROW_NUMBER() OVER(PARTITION BY [l0].[OneToMany_Optional_Inverse2Id] ORDER BY [l0].[Name]) AS [row] FROM [LevelTwo] AS [l0] ) AS [t] - WHERE (1 < [t].[row]) AND ([t].[row] <= 4) + WHERE 1 < [t].[row] AND [t].[row] <= 4 ) AS [t0] ON [l].[Id] = [t0].[OneToMany_Optional_Inverse2Id] ORDER BY [l].[Id], [t0].[OneToMany_Optional_Inverse2Id], [t0].[Name]"); } @@ -1293,9 +1293,9 @@ 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) + WHERE 1 < [t].[row] AND [t].[row] <= 4 ) AS [t0] ON [l0].[Id] = [t0].[OneToMany_Optional_Inverse3Id] ORDER BY [l].[Id], [l0].[Id], [t0].[OneToMany_Optional_Inverse3Id], [t0].[Name]"); } @@ -1313,9 +1313,9 @@ 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) + WHERE 1 < [t].[row] AND [t].[row] <= 4 ) AS [t0] ON [l0].[Id] = [t0].[OneToMany_Optional_Inverse3Id] ORDER BY [l].[Id], [l0].[Id], [t0].[OneToMany_Optional_Inverse3Id], [t0].[Name]"); } @@ -1332,7 +1332,7 @@ LEFT JOIN ( FROM ( SELECT [l0].[Id], [l0].[Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[Name], [l0].[OneToMany_Optional_Inverse2Id], [l0].[OneToMany_Optional_Self_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToMany_Required_Self_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id], [l0].[OneToOne_Optional_Self2Id], ROW_NUMBER() OVER(PARTITION BY [l0].[OneToMany_Optional_Inverse2Id] ORDER BY [l0].[Name]) AS [row] FROM [LevelTwo] AS [l0] - WHERE ([l0].[Name] <> N'Foo') OR [l0].[Name] IS NULL + WHERE [l0].[Name] <> N'Foo' OR [l0].[Name] IS NULL ) AS [t] WHERE [t].[row] <= 3 ) AS [t0] ON [l].[Id] = [t0].[OneToMany_Optional_Inverse2Id] @@ -1341,7 +1341,7 @@ LEFT JOIN ( FROM ( SELECT [l1].[Id], [l1].[Date], [l1].[Level1_Optional_Id], [l1].[Level1_Required_Id], [l1].[Name], [l1].[OneToMany_Optional_Inverse2Id], [l1].[OneToMany_Optional_Self_Inverse2Id], [l1].[OneToMany_Required_Inverse2Id], [l1].[OneToMany_Required_Self_Inverse2Id], [l1].[OneToOne_Optional_PK_Inverse2Id], [l1].[OneToOne_Optional_Self2Id], ROW_NUMBER() OVER(PARTITION BY [l1].[OneToMany_Required_Inverse2Id] ORDER BY [l1].[Name] DESC) AS [row] FROM [LevelTwo] AS [l1] - WHERE ([l1].[Name] <> N'Bar') OR [l1].[Name] IS NULL + WHERE [l1].[Name] <> N'Bar' OR [l1].[Name] IS NULL ) AS [t2] WHERE 1 < [t2].[row] ) AS [t1] ON [l].[Id] = [t1].[OneToMany_Required_Inverse2Id] @@ -1360,7 +1360,7 @@ OUTER APPLY ( FROM ( SELECT TOP(3) [l0].[Id], [l0].[Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[Name], [l0].[OneToMany_Optional_Inverse2Id], [l0].[OneToMany_Optional_Self_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToMany_Required_Self_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id], [l0].[OneToOne_Optional_Self2Id] FROM [LevelTwo] AS [l0] - WHERE ([l].[Id] = [l0].[OneToMany_Optional_Inverse2Id]) AND (([l0].[Name] <> N'Foo') OR [l0].[Name] IS NULL) + WHERE [l].[Id] = [l0].[OneToMany_Optional_Inverse2Id] AND ([l0].[Name] <> N'Foo' OR [l0].[Name] IS NULL) ORDER BY [l0].[Name] ) AS [t] LEFT JOIN ( @@ -1368,7 +1368,7 @@ LEFT JOIN ( FROM ( SELECT [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Name], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Optional_Self_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[OneToMany_Required_Self_Inverse3Id], [l1].[OneToOne_Optional_PK_Inverse3Id], [l1].[OneToOne_Optional_Self3Id], ROW_NUMBER() OVER(PARTITION BY [l1].[OneToMany_Required_Inverse3Id] ORDER BY [l1].[Name] DESC) AS [row] FROM [LevelThree] AS [l1] - WHERE ([l1].[Name] <> N'Bar') OR [l1].[Name] IS NULL + WHERE [l1].[Name] <> N'Bar' OR [l1].[Name] IS NULL ) AS [t1] WHERE 1 < [t1].[row] ) AS [t0] ON [t].[Id] = [t0].[OneToMany_Required_Inverse3Id] @@ -1388,7 +1388,7 @@ LEFT JOIN ( FROM ( SELECT [l0].[Id], [l0].[Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[Name], [l0].[OneToMany_Optional_Inverse2Id], [l0].[OneToMany_Optional_Self_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToMany_Required_Self_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id], [l0].[OneToOne_Optional_Self2Id], ROW_NUMBER() OVER(PARTITION BY [l0].[OneToMany_Optional_Inverse2Id] ORDER BY [l0].[Id] DESC) AS [row] FROM [LevelTwo] AS [l0] - WHERE ([l0].[Name] <> N'Foo') OR [l0].[Name] IS NULL + WHERE [l0].[Name] <> N'Foo' OR [l0].[Name] IS NULL ) AS [t] WHERE [t].[row] <= 2 ) AS [t0] ON [l].[Id] = [t0].[OneToMany_Optional_Inverse2Id] @@ -1407,7 +1407,7 @@ OUTER APPLY ( FROM ( SELECT TOP(2) [l2].[Id], [l2].[Date], [l2].[Level1_Optional_Id], [l2].[Level1_Required_Id], [l2].[Name], [l2].[OneToMany_Optional_Inverse2Id], [l2].[OneToMany_Optional_Self_Inverse2Id], [l2].[OneToMany_Required_Inverse2Id], [l2].[OneToMany_Required_Self_Inverse2Id], [l2].[OneToOne_Optional_PK_Inverse2Id], [l2].[OneToOne_Optional_Self2Id] FROM [LevelTwo] AS [l2] - WHERE ([l].[Id] = [l2].[OneToMany_Optional_Inverse2Id]) AND (([l2].[Name] <> N'Foo') OR [l2].[Name] IS NULL) + WHERE [l].[Id] = [l2].[OneToMany_Optional_Inverse2Id] AND ([l2].[Name] <> N'Foo' OR [l2].[Name] IS NULL) ORDER BY [l2].[Id] ) AS [t] LEFT JOIN [LevelThree] AS [l0] ON [t].[Id] = [l0].[Level2_Required_Id] @@ -1430,7 +1430,7 @@ OUTER APPLY ( FROM ( SELECT TOP(2) [l2].[Id], [l2].[Date], [l2].[Level1_Optional_Id], [l2].[Level1_Required_Id], [l2].[Name], [l2].[OneToMany_Optional_Inverse2Id], [l2].[OneToMany_Optional_Self_Inverse2Id], [l2].[OneToMany_Required_Inverse2Id], [l2].[OneToMany_Required_Self_Inverse2Id], [l2].[OneToOne_Optional_PK_Inverse2Id], [l2].[OneToOne_Optional_Self2Id] FROM [LevelTwo] AS [l2] - WHERE ([l].[Id] = [l2].[OneToMany_Optional_Inverse2Id]) AND (([l2].[Name] <> N'Foo') OR [l2].[Name] IS NULL) + WHERE [l].[Id] = [l2].[OneToMany_Optional_Inverse2Id] AND ([l2].[Name] <> N'Foo' OR [l2].[Name] IS NULL) ORDER BY [l2].[Id] ) AS [t] LEFT JOIN [LevelThree] AS [l0] ON [t].[Id] = [l0].[Level2_Required_Id] @@ -1451,7 +1451,7 @@ LEFT JOIN ( FROM ( SELECT [l0].[Id], [l0].[Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[Name], [l0].[OneToMany_Optional_Inverse2Id], [l0].[OneToMany_Optional_Self_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToMany_Required_Self_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id], [l0].[OneToOne_Optional_Self2Id], ROW_NUMBER() OVER(PARTITION BY [l0].[OneToMany_Optional_Inverse2Id] ORDER BY [l0].[Id]) AS [row] FROM [LevelTwo] AS [l0] - WHERE ([l0].[Name] <> N'Foo') OR [l0].[Name] IS NULL + WHERE [l0].[Name] <> N'Foo' OR [l0].[Name] IS NULL ) AS [t] WHERE [t].[row] <= 3 ) AS [t0] ON [l].[Id] = [t0].[OneToMany_Optional_Inverse2Id] @@ -1470,7 +1470,7 @@ LEFT JOIN ( FROM ( SELECT [l0].[Id], [l0].[Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[Name], [l0].[OneToMany_Optional_Inverse2Id], [l0].[OneToMany_Optional_Self_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToMany_Required_Self_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id], [l0].[OneToOne_Optional_Self2Id], ROW_NUMBER() OVER(PARTITION BY [l0].[OneToMany_Optional_Inverse2Id] ORDER BY [l0].[Id]) AS [row] FROM [LevelTwo] AS [l0] - WHERE ([l0].[Name] <> N'Foo') OR [l0].[Name] IS NULL + WHERE [l0].[Name] <> N'Foo' OR [l0].[Name] IS NULL ) AS [t] WHERE [t].[row] <= 3 ) AS [t0] ON [l].[Id] = [t0].[OneToMany_Optional_Inverse2Id] @@ -1489,7 +1489,7 @@ OUTER APPLY ( FROM ( SELECT TOP(1) [l1].[Id], [l1].[Date], [l1].[Level1_Optional_Id], [l1].[Level1_Required_Id], [l1].[Name], [l1].[OneToMany_Optional_Inverse2Id], [l1].[OneToMany_Optional_Self_Inverse2Id], [l1].[OneToMany_Required_Inverse2Id], [l1].[OneToMany_Required_Self_Inverse2Id], [l1].[OneToOne_Optional_PK_Inverse2Id], [l1].[OneToOne_Optional_Self2Id] FROM [LevelTwo] AS [l1] - WHERE ([l].[Id] = [l1].[OneToMany_Optional_Inverse2Id]) AND (([l1].[Name] <> N'Foo') OR [l1].[Name] IS NULL) + WHERE [l].[Id] = [l1].[OneToMany_Optional_Inverse2Id] AND ([l1].[Name] <> N'Foo' OR [l1].[Name] IS NULL) ORDER BY [l1].[Id] ) AS [t] LEFT JOIN [LevelThree] AS [l0] ON [t].[Id] = [l0].[OneToOne_Optional_PK_Inverse3Id] @@ -1517,7 +1517,7 @@ OUTER APPLY ( FROM ( SELECT TOP(1) [l3].[Id], [l3].[Level2_Optional_Id], [l3].[Level2_Required_Id], [l3].[Name], [l3].[OneToMany_Optional_Inverse3Id], [l3].[OneToMany_Optional_Self_Inverse3Id], [l3].[OneToMany_Required_Inverse3Id], [l3].[OneToMany_Required_Self_Inverse3Id], [l3].[OneToOne_Optional_PK_Inverse3Id], [l3].[OneToOne_Optional_Self3Id] FROM [LevelThree] AS [l3] - WHERE ([l0].[Id] = [l3].[OneToMany_Optional_Inverse3Id]) AND (([l3].[Name] <> N'Foo') OR [l3].[Name] IS NULL) + WHERE [l0].[Id] = [l3].[OneToMany_Optional_Inverse3Id] AND ([l3].[Name] <> N'Foo' OR [l3].[Name] IS NULL) ORDER BY [l3].[Id] ) AS [t] LEFT JOIN [LevelFour] AS [l1] ON [t].[Id] = [l1].[OneToMany_Optional_Inverse4Id] @@ -1542,7 +1542,7 @@ OUTER APPLY ( FROM ( SELECT TOP(1) [l3].[Id], [l3].[Level2_Optional_Id], [l3].[Level2_Required_Id], [l3].[Name], [l3].[OneToMany_Optional_Inverse3Id], [l3].[OneToMany_Optional_Self_Inverse3Id], [l3].[OneToMany_Required_Inverse3Id], [l3].[OneToMany_Required_Self_Inverse3Id], [l3].[OneToOne_Optional_PK_Inverse3Id], [l3].[OneToOne_Optional_Self3Id] FROM [LevelThree] AS [l3] - WHERE ([l0].[Id] = [l3].[OneToMany_Optional_Inverse3Id]) AND (([l3].[Name] <> N'Foo') OR [l3].[Name] IS NULL) + WHERE [l0].[Id] = [l3].[OneToMany_Optional_Inverse3Id] AND ([l3].[Name] <> N'Foo' OR [l3].[Name] IS NULL) ORDER BY [l3].[Id] ) AS [t] LEFT JOIN [LevelFour] AS [l1] ON [t].[Id] = [l1].[OneToMany_Optional_Inverse4Id] @@ -1566,7 +1566,7 @@ LEFT JOIN ( FROM ( SELECT [l0].[Id], [l0].[Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[Name], [l0].[OneToMany_Optional_Inverse2Id], [l0].[OneToMany_Optional_Self_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToMany_Required_Self_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id], [l0].[OneToOne_Optional_Self2Id], ROW_NUMBER() OVER(PARTITION BY [l0].[OneToMany_Optional_Inverse2Id] ORDER BY [l0].[Id]) AS [row] FROM [LevelTwo] AS [l0] - WHERE ([l0].[Name] <> @__prm_0) OR [l0].[Name] IS NULL + WHERE [l0].[Name] <> @__prm_0 OR [l0].[Name] IS NULL ) AS [t] WHERE [t].[row] <= 3 ) AS [t0] ON [l].[Id] = [t0].[OneToMany_Optional_Inverse2Id] @@ -1655,7 +1655,7 @@ LEFT JOIN ( FROM ( SELECT 1 AS [c], [l0].[Id], [l0].[OneToMany_Optional_Inverse2Id], ROW_NUMBER() OVER(PARTITION BY [l0].[OneToMany_Optional_Inverse2Id] ORDER BY [l0].[Id]) AS [row] FROM [LevelTwo] AS [l0] - WHERE ([l0].[Name] <> N'Foo') OR [l0].[Name] IS NULL + WHERE [l0].[Name] <> N'Foo' OR [l0].[Name] IS NULL ) AS [t] WHERE [t].[row] <= 1 ) AS [t0] ON [l].[Id] = [t0].[OneToMany_Optional_Inverse2Id] @@ -1665,7 +1665,7 @@ FROM [LevelOne] AS [l1] WHERE EXISTS ( SELECT 1 FROM [LevelTwo] AS [l2] - WHERE ([l1].[Id] = [l2].[OneToMany_Optional_Inverse2Id]) AND ([l2].[Id] = [t0].[Id])) + WHERE [l1].[Id] = [l2].[OneToMany_Optional_Inverse2Id] AND [l2].[Id] = [t0].[Id]) ) AS [t1] ORDER BY [l].[Id], [t0].[Id]"); } @@ -1703,7 +1703,7 @@ LEFT JOIN ( FROM [LevelTwo] AS [l15] WHERE [l15].[Id] <> 42 ) AS [t1] ON [t].[Id2] = [t1].[OneToMany_Optional_Self_Inverse2Id] -WHERE ([l11].[Name] <> N'Foo') OR [l11].[Name] IS NULL +WHERE [l11].[Name] <> N'Foo' OR [l11].[Name] IS NULL ORDER BY [l12].[Id], [l].[Id], [l0].[Id], [l1].[Id], [l2].[Id], [t].[Id], [t].[Id0], [t].[Id1], [t].[Id2], [t0].[Id], [t0].[Id0], [t0].[Id1], [t0].[Id2], [l11].[Id], [l13].[Id], [l14].[Id]"); } @@ -1942,7 +1942,7 @@ LEFT JOIN ( SELECT [l0].[Id], [l0].[Date], [l0].[Name], [l0].[OneToMany_Optional_Self_Inverse1Id], [l0].[OneToMany_Required_Self_Inverse1Id], [l0].[OneToOne_Optional_Self1Id], ROW_NUMBER() OVER(PARTITION BY [l0].[Date] ORDER BY [l0].[Name]) AS [row] FROM [LevelOne] AS [l0] ) AS [t1] - WHERE (1 < [t1].[row]) AND ([t1].[row] <= 6) + WHERE 1 < [t1].[row] AND [t1].[row] <= 6 ) AS [t0] ON [t].[Date] = [t0].[Date] ORDER BY [t].[Date], [t0].[Date], [t0].[Name]"); } @@ -1988,7 +1988,7 @@ LEFT JOIN ( SELECT [l0].[Id], [l0].[Date], [l0].[Name], [l0].[OneToMany_Optional_Self_Inverse1Id], [l0].[OneToMany_Required_Self_Inverse1Id], [l0].[OneToOne_Optional_Self1Id], ROW_NUMBER() OVER(PARTITION BY [l0].[Date] ORDER BY [l0].[Name]) AS [row] FROM [LevelOne] AS [l0] ) AS [t1] - WHERE (1 < [t1].[row]) AND ([t1].[row] <= 6) + WHERE 1 < [t1].[row] AND [t1].[row] <= 6 ) AS [t0] ON [t].[Date] = [t0].[Date] ORDER BY [t].[Date], [t0].[Date], [t0].[Name]"); } @@ -2010,7 +2010,7 @@ LEFT JOIN ( SELECT [l0].[Name], [l0].[Id], [l0].[Date], ROW_NUMBER() OVER(PARTITION BY [l0].[Date] ORDER BY [l0].[Name]) AS [row] FROM [LevelOne] AS [l0] ) AS [t1] - WHERE (1 < [t1].[row]) AND ([t1].[row] <= 6) + WHERE 1 < [t1].[row] AND [t1].[row] <= 6 ) AS [t0] ON [t].[Date] = [t0].[Date] ORDER BY [t].[Date], [t0].[Date], [t0].[Name]"); } @@ -2077,7 +2077,7 @@ OUTER APPLY ( FROM ( SELECT [l0].[Date] FROM [LevelOne] AS [l0] - WHERE ([l0].[Name] = [l].[Name]) OR ([l0].[Name] IS NULL AND [l].[Name] IS NULL) + WHERE [l0].[Name] = [l].[Name] OR ([l0].[Name] IS NULL AND [l].[Name] IS NULL) GROUP BY [l0].[Date] ) AS [t] LEFT JOIN ( @@ -2085,9 +2085,9 @@ 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) + WHERE 1 < [t1].[row] AND [t1].[row] <= 6 ) AS [t0] ON [t].[Date] = [t0].[Date] ) AS [t2] ORDER BY [l].[Id], [t2].[Date], [t2].[Date0], [t2].[Name]"); @@ -2107,7 +2107,7 @@ LEFT JOIN ( FROM [LevelThree] AS [l2] LEFT JOIN [LevelFour] AS [l3] ON [l2].[Id] = [l3].[Level3_Optional_Id] ) AS [t] ON [l1].[Id] = [t].[OneToMany_Optional_Inverse3Id] -WHERE ([l0].[Id] < 3) OR ([l1].[Id] > 8) +WHERE [l0].[Id] < 3 OR [l1].[Id] > 8 ORDER BY [l].[Id], [l0].[Id], [l1].[Id], [t].[Id]"); } @@ -2133,7 +2133,7 @@ LEFT JOIN ( FROM [LevelThree] AS [l3] LEFT JOIN [LevelFour] AS [l4] ON [l3].[Id] = [l4].[Level3_Optional_Id] ) AS [t1] ON [l1].[Id] = [t1].[OneToMany_Required_Inverse3Id] -WHERE ([l0].[Id] < 3) OR ([l1].[Id] > 8) +WHERE [l0].[Id] < 3 OR [l1].[Id] > 8 ORDER BY [l].[Id], [l0].[Id], [l1].[Id], [t0].[OneToMany_Optional_Inverse3Id], [t0].[Id], [t1].[Id]"); } @@ -2169,7 +2169,7 @@ LEFT JOIN ( FROM [LevelTwo] AS [l0] ) AS [t] WHERE [t].[row] <= 1 -) AS [t0] ON ([l].[Id] = [t0].[OneToMany_Optional_Inverse2Id]) AND ([l].[Id] = [t0].[Id])"); +) AS [t0] ON [l].[Id] = [t0].[OneToMany_Optional_Inverse2Id] AND [l].[Id] = [t0].[Id]"); } public override async Task SelectMany_with_predicate_and_DefaultIfEmpty_projecting_root_collection_element_and_another_collection( @@ -2183,7 +2183,7 @@ FROM [LevelOne] AS [l] OUTER APPLY ( SELECT [l0].[Id], [l0].[Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[Name], [l0].[OneToMany_Optional_Inverse2Id], [l0].[OneToMany_Optional_Self_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToMany_Required_Self_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id], [l0].[OneToOne_Optional_Self2Id] FROM [LevelTwo] AS [l0] - WHERE ([l0].[Level1_Required_Id] = ([l].[Id] * 2)) OR (CAST(LEN([l0].[Name]) AS int) = [l0].[Id]) + WHERE [l0].[Level1_Required_Id] = ([l].[Id] * 2) OR CAST(LEN([l0].[Name]) AS int) = [l0].[Id] ) AS [t] LEFT JOIN [LevelTwo] AS [l1] ON [l].[Id] = [l1].[OneToMany_Optional_Inverse2Id] ORDER BY [l].[Id], [t].[Id]"); @@ -2206,7 +2206,7 @@ FROM [LevelTwo] AS [l2] WHEN EXISTS ( SELECT 1 FROM [LevelTwo] AS [l3] - WHERE ([l].[Id] = [l3].[OneToMany_Optional_Inverse2Id]) AND ([l3].[Id] = 2)) THEN CAST(1 AS bit) + WHERE [l].[Id] = [l3].[OneToMany_Optional_Inverse2Id] AND [l3].[Id] = 2) THEN CAST(1 AS bit) ELSE CAST(0 AS bit) END AS [c1], [l0].[Id] AS [Id0] FROM [LevelOne] AS [l] @@ -2225,7 +2225,7 @@ FROM [LevelTwo] AS [l6] WHEN EXISTS ( SELECT 1 FROM [LevelTwo] AS [l7] - WHERE ([t1].[Id] = [l7].[OneToMany_Optional_Inverse2Id]) AND ([l7].[Id] = 2)) THEN CAST(1 AS bit) + WHERE [t1].[Id] = [l7].[OneToMany_Optional_Inverse2Id] AND [l7].[Id] = 2) THEN CAST(1 AS bit) ELSE CAST(0 AS bit) END AS [IsLevel2There], [l4].[Id] AS [Id0] FROM ( diff --git a/test/EFCore.SqlServer.FunctionalTests/Query/ComplexNavigationsCollectionsSharedTypeQuerySqlServerTest.cs b/test/EFCore.SqlServer.FunctionalTests/Query/ComplexNavigationsCollectionsSharedTypeQuerySqlServerTest.cs index f55151a5a32..12148664123 100644 --- a/test/EFCore.SqlServer.FunctionalTests/Query/ComplexNavigationsCollectionsSharedTypeQuerySqlServerTest.cs +++ b/test/EFCore.SqlServer.FunctionalTests/Query/ComplexNavigationsCollectionsSharedTypeQuerySqlServerTest.cs @@ -69,7 +69,7 @@ INNER JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[Level2_Name], [l0].[OneToMany_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id], [l1].[Id] AS [Id0] FROM [Level1] AS [l0] INNER JOIN [Level1] AS [l1] ON [l0].[Id] = [l1].[Id] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] ON [l].[Id] = [t].[OneToMany_Optional_Inverse2Id] LEFT JOIN ( SELECT [l2].[Id], [l2].[Level2_Optional_Id], [l2].[Level2_Required_Id], [l2].[Level3_Name], [l2].[OneToMany_Optional_Inverse3Id], [l2].[OneToMany_Required_Inverse3Id], [l2].[OneToOne_Optional_PK_Inverse3Id], [t1].[Id] AS [Id0], [t1].[Id0] AS [Id00] @@ -78,11 +78,11 @@ INNER JOIN ( SELECT [l3].[Id], [l4].[Id] AS [Id0] FROM [Level1] AS [l3] INNER JOIN [Level1] AS [l4] ON [l3].[Id] = [l4].[Id] - WHERE ([l3].[OneToOne_Required_PK_Date] IS NOT NULL AND [l3].[Level1_Required_Id] IS NOT NULL) AND [l3].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE [l3].[OneToOne_Required_PK_Date] IS NOT NULL AND [l3].[Level1_Required_Id] IS NOT NULL AND [l3].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t1] ON [l2].[Id] = [t1].[Id] WHERE [l2].[Level2_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse3Id] IS NOT NULL ) AS [t0] ON CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] END = [t0].[OneToMany_Optional_Inverse3Id] ORDER BY [l].[Id], [t].[Id], [t].[Id0], [t0].[Id], [t0].[Id0]"); } @@ -98,15 +98,15 @@ INNER JOIN ( SELECT DISTINCT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[Level2_Name], [l0].[OneToMany_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id] FROM [Level1] AS [l0] INNER JOIN [Level1] AS [l1] ON [l0].[Id] = [l1].[Id] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] ON [l].[Id] = [t].[OneToMany_Optional_Inverse2Id] LEFT JOIN ( SELECT [l2].[Id], [l2].[OneToOne_Required_PK_Date], [l2].[Level1_Optional_Id], [l2].[Level1_Required_Id], [l2].[Level2_Name], [l2].[OneToMany_Optional_Inverse2Id], [l2].[OneToMany_Required_Inverse2Id], [l2].[OneToOne_Optional_PK_Inverse2Id], [l3].[Id] AS [Id0] FROM [Level1] AS [l2] INNER JOIN [Level1] AS [l3] ON [l2].[Id] = [l3].[Id] - WHERE ([l2].[OneToOne_Required_PK_Date] IS NOT NULL AND [l2].[Level1_Required_Id] IS NOT NULL) AND [l2].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE [l2].[OneToOne_Required_PK_Date] IS NOT NULL AND [l2].[Level1_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t0] ON [l].[Id] = [t0].[OneToMany_Optional_Inverse2Id] -WHERE ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL +WHERE [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL ORDER BY [l].[Id], [t].[Id], [t0].[Id]"); } @@ -125,17 +125,17 @@ ORDER BY [l].[Id] ) AS [t] OUTER APPLY ( SELECT CASE - WHEN ([t1].[OneToOne_Required_PK_Date] IS NOT NULL AND [t1].[Level1_Required_Id] IS NOT NULL) AND [t1].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t1].[Id] + WHEN [t1].[OneToOne_Required_PK_Date] IS NOT NULL AND [t1].[Level1_Required_Id] IS NOT NULL AND [t1].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t1].[Id] END AS [Id], [t1].[Level2_Name] AS [Name], [t1].[OneToMany_Required_Inverse2Id] AS [Level1Id], [t1].[Level1_Required_Id] AS [Level2Id], [l1].[Id] AS [Id0], [l1].[Date], [l1].[Name] AS [Name0], [t1].[Id] AS [Id1], [t1].[Id0] AS [Id00], [t1].[c] FROM ( SELECT TOP(3) [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Required_Id], [l0].[Level2_Name], [l0].[OneToMany_Required_Inverse2Id], [l2].[Id] AS [Id0], CASE - WHEN ([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [l0].[Id] + WHEN [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [l0].[Id] END AS [c] FROM [Level1] AS [l0] INNER JOIN [Level1] AS [l2] ON [l0].[Id] = [l2].[Id] - WHERE (([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) AND ([t].[Id] = [l0].[OneToMany_Required_Inverse2Id]) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL AND [t].[Id] = [l0].[OneToMany_Required_Inverse2Id] ORDER BY CASE - WHEN ([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [l0].[Id] + WHEN [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [l0].[Id] END ) AS [t1] INNER JOIN [Level1] AS [l1] ON [t1].[Level1_Required_Id] = [l1].[Id] @@ -159,17 +159,17 @@ OFFSET @__p_0 ROWS FETCH NEXT @__p_0 ROWS ONLY ) AS [t] OUTER APPLY ( SELECT CASE - WHEN ([t1].[OneToOne_Required_PK_Date] IS NOT NULL AND [t1].[Level1_Required_Id] IS NOT NULL) AND [t1].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t1].[Id] + WHEN [t1].[OneToOne_Required_PK_Date] IS NOT NULL AND [t1].[Level1_Required_Id] IS NOT NULL AND [t1].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t1].[Id] END AS [Id], [t1].[Level2_Name] AS [Name], [t1].[OneToMany_Required_Inverse2Id] AS [Level1Id], [t1].[Level1_Required_Id] AS [Level2Id], [l1].[Id] AS [Id0], [l1].[Date], [l1].[Name] AS [Name0], [t1].[Id] AS [Id1], [t1].[Id0] AS [Id00], [t1].[c] FROM ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Required_Id], [l0].[Level2_Name], [l0].[OneToMany_Required_Inverse2Id], [l2].[Id] AS [Id0], CASE - WHEN ([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [l0].[Id] + WHEN [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [l0].[Id] END AS [c] FROM [Level1] AS [l0] INNER JOIN [Level1] AS [l2] ON [l0].[Id] = [l2].[Id] - WHERE (([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) AND ([t].[Id] = [l0].[OneToMany_Required_Inverse2Id]) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL AND [t].[Id] = [l0].[OneToMany_Required_Inverse2Id] ORDER BY CASE - WHEN ([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [l0].[Id] + WHEN [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [l0].[Id] END OFFSET 1 ROWS FETCH NEXT 3 ROWS ONLY ) AS [t1] diff --git a/test/EFCore.SqlServer.FunctionalTests/Query/ComplexNavigationsCollectionsSplitQuerySqlServerTest.cs b/test/EFCore.SqlServer.FunctionalTests/Query/ComplexNavigationsCollectionsSplitQuerySqlServerTest.cs index 7a154854c8f..25582a46364 100644 --- a/test/EFCore.SqlServer.FunctionalTests/Query/ComplexNavigationsCollectionsSplitQuerySqlServerTest.cs +++ b/test/EFCore.SqlServer.FunctionalTests/Query/ComplexNavigationsCollectionsSplitQuerySqlServerTest.cs @@ -162,7 +162,7 @@ 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], ROW_NUMBER() OVER(PARTITION BY [l0].[OneToMany_Optional_Inverse2Id] ORDER BY [l0].[Name]) AS [row] FROM [LevelTwo] AS [l0] ) AS [t] - WHERE (1 < [t].[row]) AND ([t].[row] <= 4) + WHERE 1 < [t].[row] AND [t].[row] <= 4 ) AS [t0] ON [l].[Id] = [t0].[OneToMany_Optional_Inverse2Id] ORDER BY [l].[Id], [t0].[OneToMany_Optional_Inverse2Id], [t0].[Name]"); } @@ -229,9 +229,9 @@ 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) + WHERE 1 < [t].[row] AND [t].[row] <= 4 ) AS [t0] ON [l0].[Id] = [t0].[OneToMany_Optional_Inverse3Id] ORDER BY [l].[Id], [l0].[Id], [t0].[OneToMany_Optional_Inverse3Id], [t0].[Name]"); } @@ -254,9 +254,9 @@ 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) + WHERE 1 < [t].[row] AND [t].[row] <= 4 ) AS [t0] ON [l0].[Id] = [t0].[OneToMany_Optional_Inverse3Id] ORDER BY [l].[Id], [l0].[Id], [t0].[OneToMany_Optional_Inverse3Id], [t0].[Name]"); } @@ -277,7 +277,7 @@ INNER JOIN ( FROM ( SELECT [l0].[Id], [l0].[Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[Name], [l0].[OneToMany_Optional_Inverse2Id], [l0].[OneToMany_Optional_Self_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToMany_Required_Self_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id], [l0].[OneToOne_Optional_Self2Id], ROW_NUMBER() OVER(PARTITION BY [l0].[OneToMany_Optional_Inverse2Id] ORDER BY [l0].[Name]) AS [row] FROM [LevelTwo] AS [l0] - WHERE ([l0].[Name] <> N'Foo') OR [l0].[Name] IS NULL + WHERE [l0].[Name] <> N'Foo' OR [l0].[Name] IS NULL ) AS [t] WHERE [t].[row] <= 3 ) AS [t0] ON [l].[Id] = [t0].[OneToMany_Optional_Inverse2Id] @@ -290,7 +290,7 @@ INNER JOIN ( FROM ( SELECT [l0].[Id], [l0].[Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[Name], [l0].[OneToMany_Optional_Inverse2Id], [l0].[OneToMany_Optional_Self_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToMany_Required_Self_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id], [l0].[OneToOne_Optional_Self2Id], ROW_NUMBER() OVER(PARTITION BY [l0].[OneToMany_Required_Inverse2Id] ORDER BY [l0].[Name] DESC) AS [row] FROM [LevelTwo] AS [l0] - WHERE ([l0].[Name] <> N'Bar') OR [l0].[Name] IS NULL + WHERE [l0].[Name] <> N'Bar' OR [l0].[Name] IS NULL ) AS [t] WHERE 1 < [t].[row] ) AS [t0] ON [l].[Id] = [t0].[OneToMany_Required_Inverse2Id] @@ -313,7 +313,7 @@ INNER JOIN ( FROM ( SELECT [l0].[Id], [l0].[Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[Name], [l0].[OneToMany_Optional_Inverse2Id], [l0].[OneToMany_Optional_Self_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToMany_Required_Self_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id], [l0].[OneToOne_Optional_Self2Id], ROW_NUMBER() OVER(PARTITION BY [l0].[OneToMany_Optional_Inverse2Id] ORDER BY [l0].[Name]) AS [row] FROM [LevelTwo] AS [l0] - WHERE ([l0].[Name] <> N'Foo') OR [l0].[Name] IS NULL + WHERE [l0].[Name] <> N'Foo' OR [l0].[Name] IS NULL ) AS [t] WHERE [t].[row] <= 3 ) AS [t0] ON [l].[Id] = [t0].[OneToMany_Optional_Inverse2Id] @@ -326,7 +326,7 @@ INNER JOIN ( FROM ( SELECT [l0].[Id], [l0].[Name], [l0].[OneToMany_Optional_Inverse2Id], ROW_NUMBER() OVER(PARTITION BY [l0].[OneToMany_Optional_Inverse2Id] ORDER BY [l0].[Name]) AS [row] FROM [LevelTwo] AS [l0] - WHERE ([l0].[Name] <> N'Foo') OR [l0].[Name] IS NULL + WHERE [l0].[Name] <> N'Foo' OR [l0].[Name] IS NULL ) AS [t] WHERE [t].[row] <= 3 ) AS [t0] ON [l].[Id] = [t0].[OneToMany_Optional_Inverse2Id] @@ -335,7 +335,7 @@ INNER JOIN ( FROM ( SELECT [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Name], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Optional_Self_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[OneToMany_Required_Self_Inverse3Id], [l1].[OneToOne_Optional_PK_Inverse3Id], [l1].[OneToOne_Optional_Self3Id], ROW_NUMBER() OVER(PARTITION BY [l1].[OneToMany_Required_Inverse3Id] ORDER BY [l1].[Name] DESC) AS [row] FROM [LevelThree] AS [l1] - WHERE ([l1].[Name] <> N'Bar') OR [l1].[Name] IS NULL + WHERE [l1].[Name] <> N'Bar' OR [l1].[Name] IS NULL ) AS [t2] WHERE 1 < [t2].[row] ) AS [t1] ON [t0].[Id] = [t1].[OneToMany_Required_Inverse3Id] @@ -358,7 +358,7 @@ INNER JOIN ( FROM ( SELECT [l0].[Id], [l0].[Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[Name], [l0].[OneToMany_Optional_Inverse2Id], [l0].[OneToMany_Optional_Self_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToMany_Required_Self_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id], [l0].[OneToOne_Optional_Self2Id], ROW_NUMBER() OVER(PARTITION BY [l0].[OneToMany_Optional_Inverse2Id] ORDER BY [l0].[Id] DESC) AS [row] FROM [LevelTwo] AS [l0] - WHERE ([l0].[Name] <> N'Foo') OR [l0].[Name] IS NULL + WHERE [l0].[Name] <> N'Foo' OR [l0].[Name] IS NULL ) AS [t] WHERE [t].[row] <= 2 ) AS [t0] ON [l].[Id] = [t0].[OneToMany_Optional_Inverse2Id] @@ -381,7 +381,7 @@ CROSS APPLY ( FROM ( SELECT TOP(2) [l1].[Id], [l1].[Date], [l1].[Level1_Optional_Id], [l1].[Level1_Required_Id], [l1].[Name], [l1].[OneToMany_Optional_Inverse2Id], [l1].[OneToMany_Optional_Self_Inverse2Id], [l1].[OneToMany_Required_Inverse2Id], [l1].[OneToMany_Required_Self_Inverse2Id], [l1].[OneToOne_Optional_PK_Inverse2Id], [l1].[OneToOne_Optional_Self2Id] FROM [LevelTwo] AS [l1] - WHERE ([l].[Id] = [l1].[OneToMany_Optional_Inverse2Id]) AND (([l1].[Name] <> N'Foo') OR [l1].[Name] IS NULL) + WHERE [l].[Id] = [l1].[OneToMany_Optional_Inverse2Id] AND ([l1].[Name] <> N'Foo' OR [l1].[Name] IS NULL) ORDER BY [l1].[Id] ) AS [t] LEFT JOIN [LevelThree] AS [l0] ON [t].[Id] = [l0].[Level2_Required_Id] @@ -395,7 +395,7 @@ CROSS APPLY ( FROM ( SELECT TOP(2) [l1].[Id] FROM [LevelTwo] AS [l1] - WHERE ([l].[Id] = [l1].[OneToMany_Optional_Inverse2Id]) AND (([l1].[Name] <> N'Foo') OR [l1].[Name] IS NULL) + WHERE [l].[Id] = [l1].[OneToMany_Optional_Inverse2Id] AND ([l1].[Name] <> N'Foo' OR [l1].[Name] IS NULL) ORDER BY [l1].[Id] ) AS [t] LEFT JOIN [LevelThree] AS [l0] ON [t].[Id] = [l0].[Level2_Required_Id] @@ -422,7 +422,7 @@ CROSS APPLY ( FROM ( SELECT TOP(2) [l1].[Id], [l1].[Date], [l1].[Level1_Optional_Id], [l1].[Level1_Required_Id], [l1].[Name], [l1].[OneToMany_Optional_Inverse2Id], [l1].[OneToMany_Optional_Self_Inverse2Id], [l1].[OneToMany_Required_Inverse2Id], [l1].[OneToMany_Required_Self_Inverse2Id], [l1].[OneToOne_Optional_PK_Inverse2Id], [l1].[OneToOne_Optional_Self2Id] FROM [LevelTwo] AS [l1] - WHERE ([l].[Id] = [l1].[OneToMany_Optional_Inverse2Id]) AND (([l1].[Name] <> N'Foo') OR [l1].[Name] IS NULL) + WHERE [l].[Id] = [l1].[OneToMany_Optional_Inverse2Id] AND ([l1].[Name] <> N'Foo' OR [l1].[Name] IS NULL) ORDER BY [l1].[Id] ) AS [t] LEFT JOIN [LevelThree] AS [l0] ON [t].[Id] = [l0].[Level2_Required_Id] @@ -436,7 +436,7 @@ CROSS APPLY ( FROM ( SELECT TOP(2) [l1].[Id] FROM [LevelTwo] AS [l1] - WHERE ([l].[Id] = [l1].[OneToMany_Optional_Inverse2Id]) AND (([l1].[Name] <> N'Foo') OR [l1].[Name] IS NULL) + WHERE [l].[Id] = [l1].[OneToMany_Optional_Inverse2Id] AND ([l1].[Name] <> N'Foo' OR [l1].[Name] IS NULL) ORDER BY [l1].[Id] ) AS [t] LEFT JOIN [LevelThree] AS [l0] ON [t].[Id] = [l0].[Level2_Required_Id] @@ -461,7 +461,7 @@ INNER JOIN ( FROM ( SELECT [l0].[Id], [l0].[Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[Name], [l0].[OneToMany_Optional_Inverse2Id], [l0].[OneToMany_Optional_Self_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToMany_Required_Self_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id], [l0].[OneToOne_Optional_Self2Id], ROW_NUMBER() OVER(PARTITION BY [l0].[OneToMany_Optional_Inverse2Id] ORDER BY [l0].[Id]) AS [row] FROM [LevelTwo] AS [l0] - WHERE ([l0].[Name] <> N'Foo') OR [l0].[Name] IS NULL + WHERE [l0].[Name] <> N'Foo' OR [l0].[Name] IS NULL ) AS [t] WHERE [t].[row] <= 3 ) AS [t0] ON [l].[Id] = [t0].[OneToMany_Optional_Inverse2Id] @@ -484,7 +484,7 @@ INNER JOIN ( FROM ( SELECT [l0].[Id], [l0].[Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[Name], [l0].[OneToMany_Optional_Inverse2Id], [l0].[OneToMany_Optional_Self_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToMany_Required_Self_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id], [l0].[OneToOne_Optional_Self2Id], ROW_NUMBER() OVER(PARTITION BY [l0].[OneToMany_Optional_Inverse2Id] ORDER BY [l0].[Id]) AS [row] FROM [LevelTwo] AS [l0] - WHERE ([l0].[Name] <> N'Foo') OR [l0].[Name] IS NULL + WHERE [l0].[Name] <> N'Foo' OR [l0].[Name] IS NULL ) AS [t] WHERE [t].[row] <= 3 ) AS [t0] ON [l].[Id] = [t0].[OneToMany_Optional_Inverse2Id] @@ -507,7 +507,7 @@ CROSS APPLY ( FROM ( SELECT TOP(1) [l1].[Id], [l1].[Date], [l1].[Level1_Optional_Id], [l1].[Level1_Required_Id], [l1].[Name], [l1].[OneToMany_Optional_Inverse2Id], [l1].[OneToMany_Optional_Self_Inverse2Id], [l1].[OneToMany_Required_Inverse2Id], [l1].[OneToMany_Required_Self_Inverse2Id], [l1].[OneToOne_Optional_PK_Inverse2Id], [l1].[OneToOne_Optional_Self2Id] FROM [LevelTwo] AS [l1] - WHERE ([l].[Id] = [l1].[OneToMany_Optional_Inverse2Id]) AND (([l1].[Name] <> N'Foo') OR [l1].[Name] IS NULL) + WHERE [l].[Id] = [l1].[OneToMany_Optional_Inverse2Id] AND ([l1].[Name] <> N'Foo' OR [l1].[Name] IS NULL) ORDER BY [l1].[Id] ) AS [t] LEFT JOIN [LevelThree] AS [l0] ON [t].[Id] = [l0].[OneToOne_Optional_PK_Inverse3Id] @@ -521,7 +521,7 @@ CROSS APPLY ( FROM ( SELECT TOP(1) [l1].[Id] FROM [LevelTwo] AS [l1] - WHERE ([l].[Id] = [l1].[OneToMany_Optional_Inverse2Id]) AND (([l1].[Name] <> N'Foo') OR [l1].[Name] IS NULL) + WHERE [l].[Id] = [l1].[OneToMany_Optional_Inverse2Id] AND ([l1].[Name] <> N'Foo' OR [l1].[Name] IS NULL) ORDER BY [l1].[Id] ) AS [t] LEFT JOIN [LevelThree] AS [l0] ON [t].[Id] = [l0].[OneToOne_Optional_PK_Inverse3Id] @@ -556,7 +556,7 @@ INNER JOIN ( FROM ( SELECT [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Name], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Optional_Self_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[OneToMany_Required_Self_Inverse3Id], [l1].[OneToOne_Optional_PK_Inverse3Id], [l1].[OneToOne_Optional_Self3Id], ROW_NUMBER() OVER(PARTITION BY [l1].[OneToMany_Optional_Inverse3Id] ORDER BY [l1].[Id]) AS [row] FROM [LevelThree] AS [l1] - WHERE ([l1].[Name] <> N'Foo') OR [l1].[Name] IS NULL + WHERE [l1].[Name] <> N'Foo' OR [l1].[Name] IS NULL ) AS [t] WHERE [t].[row] <= 1 ) AS [t0] ON [l0].[Id] = [t0].[OneToMany_Optional_Inverse3Id] @@ -570,7 +570,7 @@ INNER JOIN ( FROM ( SELECT [l1].[Id], [l1].[OneToMany_Optional_Inverse3Id], ROW_NUMBER() OVER(PARTITION BY [l1].[OneToMany_Optional_Inverse3Id] ORDER BY [l1].[Id]) AS [row] FROM [LevelThree] AS [l1] - WHERE ([l1].[Name] <> N'Foo') OR [l1].[Name] IS NULL + WHERE [l1].[Name] <> N'Foo' OR [l1].[Name] IS NULL ) AS [t] WHERE [t].[row] <= 1 ) AS [t0] ON [l0].[Id] = [t0].[OneToMany_Optional_Inverse3Id] @@ -585,7 +585,7 @@ INNER JOIN ( FROM ( SELECT [l1].[Id], [l1].[OneToMany_Optional_Inverse3Id], ROW_NUMBER() OVER(PARTITION BY [l1].[OneToMany_Optional_Inverse3Id] ORDER BY [l1].[Id]) AS [row] FROM [LevelThree] AS [l1] - WHERE ([l1].[Name] <> N'Foo') OR [l1].[Name] IS NULL + WHERE [l1].[Name] <> N'Foo' OR [l1].[Name] IS NULL ) AS [t] WHERE [t].[row] <= 1 ) AS [t0] ON [l0].[Id] = [t0].[OneToMany_Optional_Inverse3Id] @@ -615,7 +615,7 @@ INNER JOIN ( FROM ( SELECT [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Name], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Optional_Self_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[OneToMany_Required_Self_Inverse3Id], [l1].[OneToOne_Optional_PK_Inverse3Id], [l1].[OneToOne_Optional_Self3Id], ROW_NUMBER() OVER(PARTITION BY [l1].[OneToMany_Optional_Inverse3Id] ORDER BY [l1].[Id]) AS [row] FROM [LevelThree] AS [l1] - WHERE ([l1].[Name] <> N'Foo') OR [l1].[Name] IS NULL + WHERE [l1].[Name] <> N'Foo' OR [l1].[Name] IS NULL ) AS [t] WHERE [t].[row] <= 1 ) AS [t0] ON [l0].[Id] = [t0].[OneToMany_Optional_Inverse3Id] @@ -629,7 +629,7 @@ INNER JOIN ( FROM ( SELECT [l1].[Id], [l1].[OneToMany_Optional_Inverse3Id], ROW_NUMBER() OVER(PARTITION BY [l1].[OneToMany_Optional_Inverse3Id] ORDER BY [l1].[Id]) AS [row] FROM [LevelThree] AS [l1] - WHERE ([l1].[Name] <> N'Foo') OR [l1].[Name] IS NULL + WHERE [l1].[Name] <> N'Foo' OR [l1].[Name] IS NULL ) AS [t] WHERE [t].[row] <= 1 ) AS [t0] ON [l0].[Id] = [t0].[OneToMany_Optional_Inverse3Id] @@ -644,7 +644,7 @@ INNER JOIN ( FROM ( SELECT [l1].[Id], [l1].[OneToMany_Optional_Inverse3Id], ROW_NUMBER() OVER(PARTITION BY [l1].[OneToMany_Optional_Inverse3Id] ORDER BY [l1].[Id]) AS [row] FROM [LevelThree] AS [l1] - WHERE ([l1].[Name] <> N'Foo') OR [l1].[Name] IS NULL + WHERE [l1].[Name] <> N'Foo' OR [l1].[Name] IS NULL ) AS [t] WHERE [t].[row] <= 1 ) AS [t0] ON [l0].[Id] = [t0].[OneToMany_Optional_Inverse3Id] @@ -670,7 +670,7 @@ INNER JOIN ( FROM ( SELECT [l0].[Id], [l0].[Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[Name], [l0].[OneToMany_Optional_Inverse2Id], [l0].[OneToMany_Optional_Self_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToMany_Required_Self_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id], [l0].[OneToOne_Optional_Self2Id], ROW_NUMBER() OVER(PARTITION BY [l0].[OneToMany_Optional_Inverse2Id] ORDER BY [l0].[Id]) AS [row] FROM [LevelTwo] AS [l0] - WHERE ([l0].[Name] <> @__prm_0) OR [l0].[Name] IS NULL + WHERE [l0].[Name] <> @__prm_0 OR [l0].[Name] IS NULL ) AS [t] WHERE [t].[row] <= 3 ) AS [t0] ON [l].[Id] = [t0].[OneToMany_Optional_Inverse2Id] @@ -759,7 +759,7 @@ CROSS APPLY [LevelTwo] AS [l0] @"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], [l].[Id], [l0].[Id] FROM [LevelOne] AS [l] CROSS APPLY [LevelTwo] AS [l0] -INNER JOIN [LevelThree] AS [l1] ON ([l0].[Id] = [l1].[OneToMany_Optional_Inverse3Id]) AND ([l].[Id] <> [l1].[Id]) +INNER JOIN [LevelThree] AS [l1] ON [l0].[Id] = [l1].[OneToMany_Optional_Inverse3Id] AND [l].[Id] <> [l1].[Id] ORDER BY [l].[Id], [l0].[Id]"); } @@ -808,7 +808,7 @@ FROM [LevelFour] AS [l7] LEFT JOIN [LevelThree] AS [l12] ON [t].[Id2] = [l12].[Level2_Optional_Id] LEFT JOIN [LevelTwo] AS [l13] ON [t0].[Level2_Optional_Id0] = [l13].[Id] LEFT JOIN [LevelThree] AS [l14] ON [l13].[Id] = [l14].[Level2_Required_Id] -WHERE ([l11].[Name] <> N'Foo') OR [l11].[Name] IS NULL +WHERE [l11].[Name] <> N'Foo' OR [l11].[Name] IS NULL ORDER BY [l12].[Id], [l].[Id], [l0].[Id], [l1].[Id], [l2].[Id], [t].[Id], [t].[Id0], [t].[Id1], [t].[Id2], [t0].[Id], [t0].[Id0], [t0].[Id1], [t0].[Id2], [l11].[Id], [l13].[Id], [l14].[Id]", // @"SELECT [t1].[Id], [t1].[Date], [t1].[Level1_Optional_Id], [t1].[Level1_Required_Id], [t1].[Name], [t1].[OneToMany_Optional_Inverse2Id], [t1].[OneToMany_Optional_Self_Inverse2Id], [t1].[OneToMany_Required_Inverse2Id], [t1].[OneToMany_Required_Self_Inverse2Id], [t1].[OneToOne_Optional_PK_Inverse2Id], [t1].[OneToOne_Optional_Self2Id], [l].[Id], [l0].[Id], [l1].[Id], [l2].[Id], [t].[Id], [t].[Id0], [t].[Id1], [t].[Id2], [t0].[Id], [t0].[Id0], [t0].[Id1], [t0].[Id2], [l11].[Id], [l12].[Id], [l13].[Id], [l14].[Id] @@ -839,7 +839,7 @@ INNER JOIN ( FROM [LevelTwo] AS [l15] WHERE [l15].[Id] <> 42 ) AS [t1] ON [t].[Id2] = [t1].[OneToMany_Optional_Self_Inverse2Id] -WHERE ([l11].[Name] <> N'Foo') OR [l11].[Name] IS NULL +WHERE [l11].[Name] <> N'Foo' OR [l11].[Name] IS NULL ORDER BY [l12].[Id], [l].[Id], [l0].[Id], [l1].[Id], [l2].[Id], [t].[Id], [t].[Id0], [t].[Id1], [t].[Id2], [t0].[Id], [t0].[Id0], [t0].[Id1], [t0].[Id2], [l11].[Id], [l13].[Id], [l14].[Id]"); } @@ -948,7 +948,7 @@ FROM [LevelOne] AS [l] INNER JOIN ( SELECT [l0].[Id], [l0].[Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[Name], [l0].[OneToMany_Optional_Inverse2Id], [l0].[OneToMany_Optional_Self_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToMany_Required_Self_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id], [l0].[OneToOne_Optional_Self2Id] FROM [LevelTwo] AS [l0] - WHERE ([l0].[Name] <> N'Foo') OR [l0].[Name] IS NULL + WHERE [l0].[Name] <> N'Foo' OR [l0].[Name] IS NULL ) AS [t] ON [l].[Id] = [t].[OneToMany_Optional_Inverse2Id] WHERE [l].[Id] < 3 ORDER BY [l].[Id]"); @@ -1303,7 +1303,7 @@ LEFT JOIN ( FROM ( SELECT 1 AS [c], [l0].[Id], [l0].[OneToMany_Optional_Inverse2Id], ROW_NUMBER() OVER(PARTITION BY [l0].[OneToMany_Optional_Inverse2Id] ORDER BY [l0].[Id]) AS [row] FROM [LevelTwo] AS [l0] - WHERE ([l0].[Name] <> N'Foo') OR [l0].[Name] IS NULL + WHERE [l0].[Name] <> N'Foo' OR [l0].[Name] IS NULL ) AS [t] WHERE [t].[row] <= 1 ) AS [t0] ON [l].[Id] = [t0].[OneToMany_Optional_Inverse2Id] @@ -1316,7 +1316,7 @@ LEFT JOIN ( FROM ( SELECT [l0].[Id], [l0].[OneToMany_Optional_Inverse2Id], ROW_NUMBER() OVER(PARTITION BY [l0].[OneToMany_Optional_Inverse2Id] ORDER BY [l0].[Id]) AS [row] FROM [LevelTwo] AS [l0] - WHERE ([l0].[Name] <> N'Foo') OR [l0].[Name] IS NULL + WHERE [l0].[Name] <> N'Foo' OR [l0].[Name] IS NULL ) AS [t] WHERE [t].[row] <= 1 ) AS [t0] ON [l].[Id] = [t0].[OneToMany_Optional_Inverse2Id] @@ -1326,7 +1326,7 @@ FROM [LevelOne] AS [l1] WHERE EXISTS ( SELECT 1 FROM [LevelTwo] AS [l2] - WHERE ([l1].[Id] = [l2].[OneToMany_Optional_Inverse2Id]) AND ([l2].[Id] = [t0].[Id])) + WHERE [l1].[Id] = [l2].[OneToMany_Optional_Inverse2Id] AND [l2].[Id] = [t0].[Id]) ) AS [t1] ORDER BY [l].[Id], [t0].[Id]"); } @@ -1359,7 +1359,7 @@ FROM [LevelFour] AS [l7] LEFT JOIN [LevelThree] AS [l12] ON [t].[Id2] = [l12].[Level2_Optional_Id] LEFT JOIN [LevelTwo] AS [l13] ON [t0].[Level2_Optional_Id0] = [l13].[Id] LEFT JOIN [LevelThree] AS [l14] ON [l13].[Id] = [l14].[Level2_Required_Id] -WHERE ([l11].[Name] <> N'Foo') OR [l11].[Name] IS NULL +WHERE [l11].[Name] <> N'Foo' OR [l11].[Name] IS NULL ORDER BY [l12].[Id], [l].[Id], [l0].[Id], [l1].[Id], [l2].[Id], [t].[Id], [t].[Id0], [t].[Id1], [t].[Id2], [t0].[Id], [t0].[Id0], [t0].[Id1], [t0].[Id2], [l11].[Id], [l13].[Id], [l14].[Id]", // @"SELECT [t1].[Id], [t1].[Date], [t1].[Level1_Optional_Id], [t1].[Level1_Required_Id], [t1].[Name], [t1].[OneToMany_Optional_Inverse2Id], [t1].[OneToMany_Optional_Self_Inverse2Id], [t1].[OneToMany_Required_Inverse2Id], [t1].[OneToMany_Required_Self_Inverse2Id], [t1].[OneToOne_Optional_PK_Inverse2Id], [t1].[OneToOne_Optional_Self2Id], [l].[Id], [l0].[Id], [l1].[Id], [l2].[Id], [t].[Id], [t].[Id0], [t].[Id1], [t].[Id2], [t0].[Id], [t0].[Id0], [t0].[Id1], [t0].[Id2], [l11].[Id], [l12].[Id], [l13].[Id], [l14].[Id] @@ -1390,7 +1390,7 @@ INNER JOIN ( FROM [LevelTwo] AS [l15] WHERE [l15].[Id] <> 42 ) AS [t1] ON [t].[Id2] = [t1].[OneToMany_Optional_Self_Inverse2Id] -WHERE ([l11].[Name] <> N'Foo') OR [l11].[Name] IS NULL +WHERE [l11].[Name] <> N'Foo' OR [l11].[Name] IS NULL ORDER BY [l12].[Id], [l].[Id], [l0].[Id], [l1].[Id], [l2].[Id], [t].[Id], [t].[Id0], [t].[Id1], [t].[Id2], [t0].[Id], [t0].[Id0], [t0].[Id1], [t0].[Id2], [l11].[Id], [l13].[Id], [l14].[Id]"); } @@ -1683,7 +1683,7 @@ public override async Task Include_nested_with_optional_navigation(bool async) @"SELECT [l].[Id], [l].[Date], [l].[Name], [l].[OneToMany_Optional_Self_Inverse1Id], [l].[OneToMany_Required_Self_Inverse1Id], [l].[OneToOne_Optional_Self1Id], [l0].[Id], [l0].[Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[Name], [l0].[OneToMany_Optional_Inverse2Id], [l0].[OneToMany_Optional_Self_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToMany_Required_Self_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id], [l0].[OneToOne_Optional_Self2Id] FROM [LevelOne] AS [l] LEFT JOIN [LevelTwo] AS [l0] ON [l].[Id] = [l0].[Level1_Optional_Id] -WHERE ([l0].[Name] <> N'L2 09') OR [l0].[Name] IS NULL +WHERE [l0].[Name] <> N'L2 09' OR [l0].[Name] IS NULL ORDER BY [l].[Id], [l0].[Id]", // @"SELECT [t].[Id], [t].[Level2_Optional_Id], [t].[Level2_Required_Id], [t].[Name], [t].[OneToMany_Optional_Inverse3Id], [t].[OneToMany_Optional_Self_Inverse3Id], [t].[OneToMany_Required_Inverse3Id], [t].[OneToMany_Required_Self_Inverse3Id], [t].[OneToOne_Optional_PK_Inverse3Id], [t].[OneToOne_Optional_Self3Id], [t].[Id0], [t].[Level3_Optional_Id], [t].[Level3_Required_Id], [t].[Name0], [t].[OneToMany_Optional_Inverse4Id], [t].[OneToMany_Optional_Self_Inverse4Id], [t].[OneToMany_Required_Inverse4Id], [t].[OneToMany_Required_Self_Inverse4Id], [t].[OneToOne_Optional_PK_Inverse4Id], [t].[OneToOne_Optional_Self4Id], [l].[Id], [l0].[Id] @@ -1694,7 +1694,7 @@ INNER JOIN ( FROM [LevelThree] AS [l1] LEFT JOIN [LevelFour] AS [l2] ON [l1].[Id] = [l2].[Level3_Required_Id] ) AS [t] ON [l0].[Id] = [t].[OneToMany_Required_Inverse3Id] -WHERE ([l0].[Name] <> N'L2 09') OR [l0].[Name] IS NULL +WHERE [l0].[Name] <> N'L2 09' OR [l0].[Name] IS NULL ORDER BY [l].[Id], [l0].[Id]"); } @@ -1842,7 +1842,7 @@ FROM [LevelOne] AS [l] LEFT JOIN [LevelThree] AS [l2] ON [l0].[Id] = [l2].[Level2_Optional_Id] LEFT JOIN [LevelTwo] AS [l3] ON [l].[Id] = [l3].[Level1_Optional_Id] LEFT JOIN [LevelThree] AS [l4] ON [l3].[Id] = [l4].[Level2_Optional_Id] -WHERE ([l1].[Name] <> N'Foo') OR [l1].[Name] IS NULL +WHERE [l1].[Name] <> N'Foo' OR [l1].[Name] IS NULL ORDER BY [l].[Id], [l0].[Id], [l1].[Id], [l2].[Id], [l3].[Id], [l4].[Id]", // @"SELECT [l5].[Id], [l5].[Level2_Optional_Id], [l5].[Level2_Required_Id], [l5].[Name], [l5].[OneToMany_Optional_Inverse3Id], [l5].[OneToMany_Optional_Self_Inverse3Id], [l5].[OneToMany_Required_Inverse3Id], [l5].[OneToMany_Required_Self_Inverse3Id], [l5].[OneToOne_Optional_PK_Inverse3Id], [l5].[OneToOne_Optional_Self3Id], [l].[Id], [l0].[Id], [l1].[Id], [l2].[Id], [l3].[Id], [l4].[Id] @@ -1853,7 +1853,7 @@ FROM [LevelOne] AS [l] LEFT JOIN [LevelTwo] AS [l3] ON [l].[Id] = [l3].[Level1_Optional_Id] LEFT JOIN [LevelThree] AS [l4] ON [l3].[Id] = [l4].[Level2_Optional_Id] INNER JOIN [LevelThree] AS [l5] ON [l0].[Id] = [l5].[OneToMany_Optional_Inverse3Id] -WHERE ([l1].[Name] <> N'Foo') OR [l1].[Name] IS NULL +WHERE [l1].[Name] <> N'Foo' OR [l1].[Name] IS NULL ORDER BY [l].[Id], [l0].[Id], [l1].[Id], [l2].[Id], [l3].[Id], [l4].[Id]"); } @@ -2320,7 +2320,7 @@ public override async Task Include_collection_with_groupby_in_subquery_and_filte SELECT [l].[Name] FROM [LevelOne] AS [l] GROUP BY [l].[Name] - HAVING ([l].[Name] <> N'Foo') OR [l].[Name] IS NULL + HAVING [l].[Name] <> N'Foo' OR [l].[Name] IS NULL ) AS [t] LEFT JOIN ( SELECT [t1].[Id], [t1].[Date], [t1].[Name], [t1].[OneToMany_Optional_Self_Inverse1Id], [t1].[OneToMany_Required_Self_Inverse1Id], [t1].[OneToOne_Optional_Self1Id] @@ -2337,7 +2337,7 @@ FROM [LevelOne] AS [l0] SELECT [l].[Name] FROM [LevelOne] AS [l] GROUP BY [l].[Name] - HAVING ([l].[Name] <> N'Foo') OR [l].[Name] IS NULL + HAVING [l].[Name] <> N'Foo' OR [l].[Name] IS NULL ) AS [t] LEFT JOIN ( SELECT [t1].[Id], [t1].[Name] @@ -2677,7 +2677,7 @@ FROM [LevelOne] AS [l] SELECT COUNT(*) FROM [LevelTwo] AS [l0] LEFT JOIN [LevelThree] AS [l1] ON [l0].[Id] = [l1].[OneToOne_Optional_PK_Inverse3Id] - WHERE ([l].[Id] = [l0].[OneToMany_Optional_Inverse2Id]) AND (([l1].[Name] <> N'Foo') OR [l1].[Name] IS NULL)) > 0 + WHERE [l].[Id] = [l0].[OneToMany_Optional_Inverse2Id] AND ([l1].[Name] <> N'Foo' OR [l1].[Name] IS NULL)) > 0 ORDER BY [l].[Id]", // @"SELECT [t].[Id], [t].[Date], [t].[Level1_Optional_Id], [t].[Level1_Required_Id], [t].[Name], [t].[OneToMany_Optional_Inverse2Id], [t].[OneToMany_Optional_Self_Inverse2Id], [t].[OneToMany_Required_Inverse2Id], [t].[OneToMany_Required_Self_Inverse2Id], [t].[OneToOne_Optional_PK_Inverse2Id], [t].[OneToOne_Optional_Self2Id], [t].[Id0], [t].[Level2_Optional_Id], [t].[Level2_Required_Id], [t].[Name0], [t].[OneToMany_Optional_Inverse3Id], [t].[OneToMany_Optional_Self_Inverse3Id], [t].[OneToMany_Required_Inverse3Id], [t].[OneToMany_Required_Self_Inverse3Id], [t].[OneToOne_Optional_PK_Inverse3Id], [t].[OneToOne_Optional_Self3Id], [t].[Id1], [t].[Level3_Optional_Id], [t].[Level3_Required_Id], [t].[Name1], [t].[OneToMany_Optional_Inverse4Id], [t].[OneToMany_Optional_Self_Inverse4Id], [t].[OneToMany_Required_Inverse4Id], [t].[OneToMany_Required_Self_Inverse4Id], [t].[OneToOne_Optional_PK_Inverse4Id], [t].[OneToOne_Optional_Self4Id], [l].[Id] @@ -2692,7 +2692,7 @@ FROM [LevelTwo] AS [l2] SELECT COUNT(*) FROM [LevelTwo] AS [l0] LEFT JOIN [LevelThree] AS [l1] ON [l0].[Id] = [l1].[OneToOne_Optional_PK_Inverse3Id] - WHERE ([l].[Id] = [l0].[OneToMany_Optional_Inverse2Id]) AND (([l1].[Name] <> N'Foo') OR [l1].[Name] IS NULL)) > 0 + WHERE [l].[Id] = [l0].[OneToMany_Optional_Inverse2Id] AND ([l1].[Name] <> N'Foo' OR [l1].[Name] IS NULL)) > 0 ORDER BY [l].[Id]"); } @@ -3015,7 +3015,7 @@ INNER JOIN ( SELECT [l0].[Id], [l0].[Date], [l0].[Name], [l0].[OneToMany_Optional_Self_Inverse1Id], [l0].[OneToMany_Required_Self_Inverse1Id], [l0].[OneToOne_Optional_Self1Id], ROW_NUMBER() OVER(PARTITION BY [l0].[Date] ORDER BY [l0].[Name]) AS [row] FROM [LevelOne] AS [l0] ) AS [t1] - WHERE (1 < [t1].[row]) AND ([t1].[row] <= 6) + WHERE 1 < [t1].[row] AND [t1].[row] <= 6 ) AS [t0] ON [t].[Date] = [t0].[Date] ORDER BY [t].[Date], [t0].[Date], [t0].[Name]"); } @@ -3071,7 +3071,7 @@ INNER JOIN ( SELECT [l0].[Id], [l0].[Date], [l0].[Name], [l0].[OneToMany_Optional_Self_Inverse1Id], [l0].[OneToMany_Required_Self_Inverse1Id], [l0].[OneToOne_Optional_Self1Id], ROW_NUMBER() OVER(PARTITION BY [l0].[Date] ORDER BY [l0].[Name]) AS [row] FROM [LevelOne] AS [l0] ) AS [t1] - WHERE (1 < [t1].[row]) AND ([t1].[row] <= 6) + WHERE 1 < [t1].[row] AND [t1].[row] <= 6 ) AS [t0] ON [t].[Date] = [t0].[Date] ORDER BY [t].[Date], [t0].[Date], [t0].[Name]"); } @@ -3098,7 +3098,7 @@ INNER JOIN ( SELECT [l0].[Name], [l0].[Date], ROW_NUMBER() OVER(PARTITION BY [l0].[Date] ORDER BY [l0].[Name]) AS [row] FROM [LevelOne] AS [l0] ) AS [t1] - WHERE (1 < [t1].[row]) AND ([t1].[row] <= 6) + WHERE 1 < [t1].[row] AND [t1].[row] <= 6 ) AS [t0] ON [t].[Date] = [t0].[Date] ORDER BY [t].[Date], [t0].[Date], [t0].[Name]"); } @@ -3125,7 +3125,7 @@ INNER JOIN ( SELECT [l0].[Id], [l0].[Date], [l0].[Name], [l0].[OneToMany_Optional_Self_Inverse1Id], [l0].[OneToMany_Required_Self_Inverse1Id], [l0].[OneToOne_Optional_Self1Id], ROW_NUMBER() OVER(PARTITION BY [l0].[Date] ORDER BY [l0].[Name]) AS [row] FROM [LevelOne] AS [l0] ) AS [t1] - WHERE (1 < [t1].[row]) AND ([t1].[row] <= 6) + WHERE 1 < [t1].[row] AND [t1].[row] <= 6 ) AS [t0] ON [t].[Date] = [t0].[Date] ORDER BY [t].[Date], [t0].[Date], [t0].[Name], [t0].[Id]"); } @@ -3174,7 +3174,7 @@ FROM [LevelOne] AS [l] CROSS APPLY ( SELECT [l0].[Date] FROM [LevelOne] AS [l0] - WHERE ([l0].[Name] = [l].[Name]) OR ([l0].[Name] IS NULL AND [l].[Name] IS NULL) + WHERE [l0].[Name] = [l].[Name] OR ([l0].[Name] IS NULL AND [l].[Name] IS NULL) GROUP BY [l0].[Date] ) AS [t] ORDER BY [l].[Id], [t].[Date]", @@ -3184,7 +3184,7 @@ FROM [LevelOne] AS [l] CROSS APPLY ( SELECT [l0].[Date] FROM [LevelOne] AS [l0] - WHERE ([l0].[Name] = [l].[Name]) OR ([l0].[Name] IS NULL AND [l].[Name] IS NULL) + WHERE [l0].[Name] = [l].[Name] OR ([l0].[Name] IS NULL AND [l].[Name] IS NULL) GROUP BY [l0].[Date] ) AS [t] INNER JOIN ( @@ -3193,8 +3193,8 @@ INNER JOIN ( 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].[Name], [l1].[Date] ORDER BY [l1].[Name]) AS [row] 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]) + 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] ORDER BY [l].[Id], [t].[Date], [t0].[Name], [t0].[Date]"); } @@ -3207,7 +3207,7 @@ public override async Task Include_partially_added_before_Where_and_then_build_u FROM [LevelOne] AS [l] LEFT JOIN [LevelTwo] AS [l0] ON [l].[Id] = [l0].[OneToOne_Optional_PK_Inverse2Id] LEFT JOIN [LevelTwo] AS [l1] ON [l].[Id] = [l1].[Level1_Optional_Id] -WHERE ([l0].[Id] < 3) OR ([l1].[Id] > 8) +WHERE [l0].[Id] < 3 OR [l1].[Id] > 8 ORDER BY [l].[Id], [l0].[Id], [l1].[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], [l1].[Id] @@ -3219,7 +3219,7 @@ INNER JOIN ( FROM [LevelThree] AS [l2] LEFT JOIN [LevelFour] AS [l3] ON [l2].[Id] = [l3].[Level3_Optional_Id] ) AS [t] ON [l1].[Id] = [t].[OneToMany_Optional_Inverse3Id] -WHERE ([l0].[Id] < 3) OR ([l1].[Id] > 8) +WHERE [l0].[Id] < 3 OR [l1].[Id] > 8 ORDER BY [l].[Id], [l0].[Id], [l1].[Id]"); } @@ -3232,7 +3232,7 @@ public override async Task Include_partially_added_before_Where_and_then_build_u FROM [LevelOne] AS [l] LEFT JOIN [LevelTwo] AS [l0] ON [l].[Id] = [l0].[OneToOne_Optional_PK_Inverse2Id] LEFT JOIN [LevelTwo] AS [l1] ON [l].[Id] = [l1].[Level1_Optional_Id] -WHERE ([l0].[Id] < 3) OR ([l1].[Id] > 8) +WHERE [l0].[Id] < 3 OR [l1].[Id] > 8 ORDER BY [l].[Id], [l0].[Id], [l1].[Id]", // @"SELECT [t0].[Id], [t0].[Level2_Optional_Id], [t0].[Level2_Required_Id], [t0].[Name], [t0].[OneToMany_Optional_Inverse3Id], [t0].[OneToMany_Optional_Self_Inverse3Id], [t0].[OneToMany_Required_Inverse3Id], [t0].[OneToMany_Required_Self_Inverse3Id], [t0].[OneToOne_Optional_PK_Inverse3Id], [t0].[OneToOne_Optional_Self3Id], [l].[Id], [l0].[Id], [l1].[Id] @@ -3247,7 +3247,7 @@ FROM [LevelThree] AS [l2] ) AS [t] WHERE [t].[row] <= 3 ) AS [t0] ON [l1].[Id] = [t0].[OneToMany_Optional_Inverse3Id] -WHERE ([l0].[Id] < 3) OR ([l1].[Id] > 8) +WHERE [l0].[Id] < 3 OR [l1].[Id] > 8 ORDER BY [l].[Id], [l0].[Id], [l1].[Id], [t0].[OneToMany_Optional_Inverse3Id], [t0].[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], [l1].[Id] @@ -3259,7 +3259,7 @@ INNER JOIN ( FROM [LevelThree] AS [l2] LEFT JOIN [LevelFour] AS [l3] ON [l2].[Id] = [l3].[Level3_Optional_Id] ) AS [t] ON [l1].[Id] = [t].[OneToMany_Required_Inverse3Id] -WHERE ([l0].[Id] < 3) OR ([l1].[Id] > 8) +WHERE [l0].[Id] < 3 OR [l1].[Id] > 8 ORDER BY [l].[Id], [l0].[Id], [l1].[Id]"); } @@ -3299,7 +3299,7 @@ LEFT JOIN ( FROM [LevelTwo] AS [l0] ) AS [t] WHERE [t].[row] <= 1 -) AS [t0] ON ([l].[Id] = [t0].[OneToMany_Optional_Inverse2Id]) AND ([l].[Id] = [t0].[Id])"); +) AS [t0] ON [l].[Id] = [t0].[OneToMany_Optional_Inverse2Id] AND [l].[Id] = [t0].[Id]"); } public override async Task SelectMany_with_predicate_and_DefaultIfEmpty_projecting_root_collection_element_and_another_collection( @@ -3313,7 +3313,7 @@ FROM [LevelOne] AS [l] OUTER APPLY ( SELECT [l0].[Id], [l0].[Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[Name], [l0].[OneToMany_Optional_Inverse2Id], [l0].[OneToMany_Optional_Self_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToMany_Required_Self_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id], [l0].[OneToOne_Optional_Self2Id] FROM [LevelTwo] AS [l0] - WHERE ([l0].[Level1_Required_Id] = ([l].[Id] * 2)) OR (CAST(LEN([l0].[Name]) AS int) = [l0].[Id]) + WHERE [l0].[Level1_Required_Id] = ([l].[Id] * 2) OR CAST(LEN([l0].[Name]) AS int) = [l0].[Id] ) AS [t] ORDER BY [l].[Id], [t].[Id]", // @@ -3322,7 +3322,7 @@ FROM [LevelOne] AS [l] OUTER APPLY ( SELECT [l0].[Id] FROM [LevelTwo] AS [l0] - WHERE ([l0].[Level1_Required_Id] = ([l].[Id] * 2)) OR (CAST(LEN([l0].[Name]) AS int) = [l0].[Id]) + WHERE [l0].[Level1_Required_Id] = ([l].[Id] * 2) OR CAST(LEN([l0].[Name]) AS int) = [l0].[Id] ) AS [t] INNER JOIN [LevelTwo] AS [l1] ON [l].[Id] = [l1].[OneToMany_Optional_Inverse2Id] ORDER BY [l].[Id], [t].[Id]"); @@ -3343,7 +3343,7 @@ FROM [LevelTwo] AS [l2] WHEN EXISTS ( SELECT 1 FROM [LevelTwo] AS [l3] - WHERE ([l].[Id] = [l3].[OneToMany_Optional_Inverse2Id]) AND ([l3].[Id] = 2)) THEN CAST(1 AS bit) + WHERE [l].[Id] = [l3].[OneToMany_Optional_Inverse2Id] AND [l3].[Id] = 2) THEN CAST(1 AS bit) ELSE CAST(0 AS bit) END, [l0].[Id] FROM [LevelOne] AS [l] @@ -3370,7 +3370,7 @@ FROM [LevelTwo] AS [l3] WHEN EXISTS ( SELECT 1 FROM [LevelTwo] AS [l4] - WHERE ([t1].[Id] = [l4].[OneToMany_Optional_Inverse2Id]) AND ([l4].[Id] = 2)) THEN CAST(1 AS bit) + WHERE [t1].[Id] = [l4].[OneToMany_Optional_Inverse2Id] AND [l4].[Id] = 2) THEN CAST(1 AS bit) ELSE CAST(0 AS bit) END AS [IsLevel2There] FROM ( diff --git a/test/EFCore.SqlServer.FunctionalTests/Query/ComplexNavigationsQuerySqlServerTest.cs b/test/EFCore.SqlServer.FunctionalTests/Query/ComplexNavigationsQuerySqlServerTest.cs index e4b3cb28818..8495a148030 100644 --- a/test/EFCore.SqlServer.FunctionalTests/Query/ComplexNavigationsQuerySqlServerTest.cs +++ b/test/EFCore.SqlServer.FunctionalTests/Query/ComplexNavigationsQuerySqlServerTest.cs @@ -297,7 +297,7 @@ public override async Task Method_call_on_optional_navigation_translates_to_null @"SELECT [l].[Id], [l].[Date], [l].[Name], [l].[OneToMany_Optional_Self_Inverse1Id], [l].[OneToMany_Required_Self_Inverse1Id], [l].[OneToOne_Optional_Self1Id] FROM [LevelOne] AS [l] LEFT JOIN [LevelTwo] AS [l0] ON [l].[Id] = [l0].[Level1_Optional_Id] -WHERE ([l0].[Name] = N'') OR ([l0].[Name] IS NOT NULL AND (LEFT([l0].[Name], LEN([l0].[Name])) = [l0].[Name]))"); +WHERE [l0].[Name] = N'' OR ([l0].[Name] IS NOT NULL AND LEFT([l0].[Name], LEN([l0].[Name])) = [l0].[Name])"); } public override async Task Optional_navigation_inside_method_call_translated_to_join_keeps_original_nullability(bool async) @@ -587,7 +587,7 @@ public override async Task Where_nav_prop_reference_optional1_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 07')"); +WHERE [l0].[Name] = N'L2 05' OR [l1].[Name] = N'L2 07'"); } public override async Task Where_nav_prop_reference_optional2(bool async) @@ -598,7 +598,7 @@ public override async Task Where_nav_prop_reference_optional2(bool async) @"SELECT [l].[Id] FROM [LevelOne] AS [l] LEFT JOIN [LevelTwo] AS [l0] ON [l].[Id] = [l0].[Level1_Optional_Id] -WHERE ([l0].[Name] = N'L2 05') OR (([l0].[Name] <> N'L2 42') OR [l0].[Name] IS NULL)"); +WHERE [l0].[Name] = N'L2 05' OR [l0].[Name] <> N'L2 42' OR [l0].[Name] IS NULL"); } public override async Task Where_nav_prop_reference_optional2_via_DefaultIfEmpty(bool async) @@ -610,7 +610,7 @@ public override async Task Where_nav_prop_reference_optional2_via_DefaultIfEmpty FROM [LevelOne] AS [l] LEFT JOIN [LevelTwo] AS [l0] ON [l].[Id] = [l0].[Level1_Optional_Id] LEFT JOIN [LevelTwo] AS [l1] ON [l].[Id] = [l1].[Level1_Optional_Id] -WHERE ([l0].[Name] = N'L2 05') OR (([l1].[Name] <> N'L2 42') OR [l1].[Name] IS NULL)"); +WHERE [l0].[Name] = N'L2 05' OR [l1].[Name] <> N'L2 42' OR [l1].[Name] IS NULL"); } public override async Task Select_multiple_nav_prop_reference_optional(bool async) @@ -633,7 +633,7 @@ public override async Task Where_multiple_nav_prop_reference_optional_member_com FROM [LevelOne] AS [l] LEFT JOIN [LevelTwo] AS [l0] ON [l].[Id] = [l0].[Level1_Optional_Id] LEFT JOIN [LevelThree] AS [l1] ON [l0].[Id] = [l1].[Level2_Optional_Id] -WHERE ([l1].[Name] <> N'L3 05') OR [l1].[Name] IS NULL"); +WHERE [l1].[Name] <> N'L3 05' OR [l1].[Name] IS NULL"); } public override async Task Where_multiple_nav_prop_reference_optional_member_compared_to_null(bool async) @@ -751,7 +751,7 @@ public override async Task Where_multiple_nav_prop_optional_required(bool async) FROM [LevelOne] AS [l] LEFT JOIN [LevelTwo] AS [l0] ON [l].[Id] = [l0].[Level1_Optional_Id] LEFT JOIN [LevelThree] AS [l1] ON [l0].[Id] = [l1].[Level2_Required_Id] -WHERE ([l1].[Name] <> N'L3 05') OR [l1].[Name] IS NULL"); +WHERE [l1].[Name] <> N'L3 05' OR [l1].[Name] IS NULL"); } public override async Task SelectMany_navigation_comparison1(bool async) @@ -799,7 +799,7 @@ FROM [LevelOne] AS [l] CROSS JOIN [LevelTwo] AS [l0] LEFT JOIN [LevelTwo] AS [l1] ON [l].[Id] = [l1].[Level1_Optional_Id] INNER JOIN [LevelOne] AS [l2] ON [l0].[Level1_Required_Id] = [l2].[Id] -WHERE ([l1].[Name] = N'L2 01') OR (([l2].[Name] <> N'Bar') OR [l2].[Name] IS NULL)"); +WHERE [l1].[Name] = N'L2 01' OR [l2].[Name] <> N'Bar' OR [l2].[Name] IS NULL"); } public override async Task Where_complex_predicate_with_with_nav_prop_and_OrElse2(bool async) @@ -811,7 +811,7 @@ public override async Task Where_complex_predicate_with_with_nav_prop_and_OrElse FROM [LevelOne] AS [l] LEFT JOIN [LevelTwo] AS [l0] ON [l].[Id] = [l0].[Level1_Optional_Id] LEFT JOIN [LevelThree] AS [l1] ON [l0].[Id] = [l1].[Level2_Required_Id] -WHERE ([l1].[Name] = N'L3 05') OR (([l0].[Name] <> N'L2 05') OR [l0].[Name] IS NULL)"); +WHERE [l1].[Name] = N'L3 05' OR [l0].[Name] <> N'L2 05' OR [l0].[Name] IS NULL"); } public override async Task Where_complex_predicate_with_with_nav_prop_and_OrElse3(bool async) @@ -824,7 +824,7 @@ FROM [LevelOne] AS [l] LEFT JOIN [LevelTwo] AS [l0] ON [l].[Id] = [l0].[Level1_Optional_Id] LEFT JOIN [LevelTwo] AS [l1] ON [l].[Id] = [l1].[Level1_Required_Id] LEFT JOIN [LevelThree] AS [l2] ON [l1].[Id] = [l2].[Level2_Optional_Id] -WHERE (([l0].[Name] <> N'L2 05') OR [l0].[Name] IS NULL) OR ([l2].[Name] = N'L3 05')"); +WHERE [l0].[Name] <> N'L2 05' OR [l0].[Name] IS NULL OR [l2].[Name] = N'L3 05'"); } public override async Task Where_complex_predicate_with_with_nav_prop_and_OrElse4(bool async) @@ -837,7 +837,7 @@ FROM [LevelThree] AS [l] LEFT JOIN [LevelTwo] AS [l0] ON [l].[Level2_Optional_Id] = [l0].[Id] INNER JOIN [LevelTwo] AS [l1] ON [l].[Level2_Required_Id] = [l1].[Id] LEFT JOIN [LevelOne] AS [l2] ON [l1].[Level1_Optional_Id] = [l2].[Id] -WHERE (([l0].[Name] <> N'L2 05') OR [l0].[Name] IS NULL) OR ([l2].[Name] = N'L1 05')"); +WHERE [l0].[Name] <> N'L2 05' OR [l0].[Name] IS NULL OR [l2].[Name] = N'L1 05'"); } public override async Task Complex_navigations_with_predicate_projected_into_anonymous_type(bool async) @@ -850,7 +850,7 @@ FROM [LevelOne] AS [l] LEFT JOIN [LevelTwo] AS [l0] ON [l].[Id] = [l0].[Level1_Required_Id] LEFT JOIN [LevelThree] AS [l1] ON [l0].[Id] = [l1].[Level2_Required_Id] LEFT JOIN [LevelThree] AS [l2] ON [l0].[Id] = [l2].[Level2_Optional_Id] -WHERE (([l1].[Id] = [l2].[Id]) OR ([l1].[Id] IS NULL AND [l2].[Id] IS NULL)) AND (([l2].[Id] <> 7) OR [l2].[Id] IS NULL)"); +WHERE ([l1].[Id] = [l2].[Id] OR ([l1].[Id] IS NULL AND [l2].[Id] IS NULL)) AND ([l2].[Id] <> 7 OR [l2].[Id] IS NULL)"); } public override async Task Complex_navigations_with_predicate_projected_into_anonymous_type2(bool async) @@ -863,7 +863,7 @@ FROM [LevelThree] AS [l] INNER JOIN [LevelTwo] AS [l0] ON [l].[Level2_Required_Id] = [l0].[Id] INNER JOIN [LevelOne] AS [l1] ON [l0].[Level1_Required_Id] = [l1].[Id] LEFT JOIN [LevelOne] AS [l2] ON [l0].[Level1_Optional_Id] = [l2].[Id] -WHERE ([l1].[Id] = [l2].[Id]) AND (([l2].[Id] <> 7) OR [l2].[Id] IS NULL)"); +WHERE [l1].[Id] = [l2].[Id] AND ([l2].[Id] <> 7 OR [l2].[Id] IS NULL)"); } public override async Task Optional_navigation_projected_into_DTO(bool async) @@ -982,7 +982,7 @@ public override async Task Include_with_optional_navigation(bool async) @"SELECT [l].[Id], [l].[Date], [l].[Name], [l].[OneToMany_Optional_Self_Inverse1Id], [l].[OneToMany_Required_Self_Inverse1Id], [l].[OneToOne_Optional_Self1Id], [l0].[Id], [l0].[Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[Name], [l0].[OneToMany_Optional_Inverse2Id], [l0].[OneToMany_Optional_Self_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToMany_Required_Self_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id], [l0].[OneToOne_Optional_Self2Id] FROM [LevelOne] AS [l] LEFT JOIN [LevelTwo] AS [l0] ON [l].[Id] = [l0].[Level1_Optional_Id] -WHERE ([l0].[Name] <> N'L2 05') OR [l0].[Name] IS NULL"); +WHERE [l0].[Name] <> N'L2 05' OR [l0].[Name] IS NULL"); } public override async Task Join_flattening_bug_4539(bool async) @@ -1140,7 +1140,7 @@ FROM [LevelOne] AS [l] WHERE ( SELECT COUNT(*) FROM [LevelThree] AS [l1] - WHERE [l0].[Id] IS NOT NULL AND ([l0].[Id] = [l1].[OneToMany_Optional_Inverse3Id])) > 0"); + WHERE [l0].[Id] IS NOT NULL AND [l0].[Id] = [l1].[OneToMany_Optional_Inverse3Id]) > 0"); } public override async Task Where_navigation_property_to_collection2(bool async) @@ -1366,7 +1366,7 @@ SELECT TOP(@__p_0) [l].[Name] FROM [LevelTwo] AS [l] INNER JOIN [LevelOne] AS [l0] ON [l].[Level1_Required_Id] = [l0].[Id] INNER JOIN [LevelThree] AS [l1] ON [l0].[Id] = [l1].[Level2_Required_Id] -WHERE ([l0].[Name] = N'L1 03') AND ([l1].[Name] = N'L3 08') +WHERE [l0].[Name] = N'L1 03' AND [l1].[Name] = N'L3 08' ORDER BY [l0].[Id]"); } @@ -1382,7 +1382,7 @@ SELECT TOP(@__p_0) [l0].[Name] FROM [LevelTwo] AS [l] INNER JOIN [LevelOne] AS [l0] ON [l].[Level1_Required_Id] = [l0].[Id] INNER JOIN [LevelThree] AS [l1] ON [l0].[Id] = [l1].[Level2_Required_Id] -WHERE ([l0].[Name] = N'L1 03') AND ([l1].[Name] = N'L3 08') +WHERE [l0].[Name] = N'L1 03' AND [l1].[Name] = N'L3 08' ORDER BY [l0].[Id]"); } @@ -1744,7 +1744,7 @@ SELECT 1 FROM ( SELECT DISTINCT [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Name], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Optional_Self_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[OneToMany_Required_Self_Inverse3Id], [l1].[OneToOne_Optional_PK_Inverse3Id], [l1].[OneToOne_Optional_Self3Id] FROM [LevelThree] AS [l1] - WHERE [l0].[Id] IS NOT NULL AND ([l0].[Id] = [l1].[OneToMany_Optional_Inverse3Id]) + WHERE [l0].[Id] IS NOT NULL AND [l0].[Id] = [l1].[OneToMany_Optional_Inverse3Id] ) AS [t] WHERE [t].[Id] = 1)"); } @@ -1760,7 +1760,7 @@ FROM [LevelOne] AS [l] WHERE EXISTS ( SELECT DISTINCT 1 FROM [LevelThree] AS [l1] - WHERE ([l0].[Id] IS NOT NULL AND ([l0].[Id] = [l1].[OneToMany_Optional_Inverse3Id])) AND (CAST(LEN([l1].[Name]) AS int) = 1))"); + WHERE [l0].[Id] IS NOT NULL AND [l0].[Id] = [l1].[OneToMany_Optional_Inverse3Id] AND CAST(LEN([l1].[Name]) AS int) = 1)"); } public override async Task Required_navigation_on_a_subquery_with_First_in_projection(bool async) @@ -1799,11 +1799,11 @@ public override async Task Required_navigation_on_a_subquery_with_First_in_predi AssertSql( @"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] FROM [LevelTwo] AS [l] -WHERE ([l].[Id] = 7) AND (( +WHERE [l].[Id] = 7 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]) = N'L1 02')"); + ORDER BY [l0].[Id]) = N'L1 02'"); } public override async Task Manually_created_left_join_propagates_nullability_to_navigations(bool async) @@ -1815,7 +1815,7 @@ public override async Task Manually_created_left_join_propagates_nullability_to_ FROM [LevelOne] AS [l] LEFT JOIN [LevelTwo] AS [l0] ON [l].[Id] = [l0].[Level1_Optional_Id] LEFT JOIN [LevelOne] AS [l1] ON [l0].[Level1_Required_Id] = [l1].[Id] -WHERE ([l1].[Name] <> N'L3 02') OR [l1].[Name] IS NULL"); +WHERE [l1].[Name] <> N'L3 02' OR [l1].[Name] IS NULL"); } public override async Task Optional_navigation_propagates_nullability_to_manually_created_left_join1(bool async) @@ -2026,13 +2026,13 @@ public override async Task GroupJoin_in_subquery_with_client_result_operator(boo AssertSql( @"SELECT [l].[Name] FROM [LevelOne] AS [l] -WHERE (( +WHERE ( SELECT COUNT(*) FROM ( SELECT DISTINCT [l0].[Id], [l0].[Date], [l0].[Name], [l0].[OneToMany_Optional_Self_Inverse1Id], [l0].[OneToMany_Required_Self_Inverse1Id], [l0].[OneToOne_Optional_Self1Id] FROM [LevelOne] AS [l0] LEFT JOIN [LevelTwo] AS [l1] ON [l0].[Id] = [l1].[Level1_Optional_Id] - ) AS [t]) > 7) AND ([l].[Id] < 3)"); + ) AS [t]) > 7 AND [l].[Id] < 3"); } public override async Task GroupJoin_in_subquery_with_client_projection(bool async) @@ -2141,7 +2141,7 @@ public override async Task Optional_navigation_in_subquery_with_unrelated_projec SELECT TOP(@__p_0) [l].[Id] FROM [LevelOne] AS [l] LEFT JOIN [LevelTwo] AS [l0] ON [l].[Id] = [l0].[Level1_Optional_Id] -WHERE ([l0].[Name] <> N'Foo') OR [l0].[Name] IS NULL +WHERE [l0].[Name] <> N'Foo' OR [l0].[Name] IS NULL ORDER BY [l].[Id]"); } @@ -2155,7 +2155,7 @@ public override async Task Explicit_GroupJoin_in_subquery_with_unrelated_project SELECT TOP(@__p_0) [l].[Id] FROM [LevelOne] AS [l] LEFT JOIN [LevelTwo] AS [l0] ON [l].[Id] = [l0].[Level1_Optional_Id] -WHERE ([l0].[Name] <> N'Foo') OR [l0].[Name] IS NULL +WHERE [l0].[Name] <> N'Foo' OR [l0].[Name] IS NULL ORDER BY [l].[Id]"); } @@ -2169,7 +2169,7 @@ public override async Task Explicit_GroupJoin_in_subquery_with_unrelated_project SELECT DISTINCT [l].[Id], [l].[Date], [l].[Name], [l].[OneToMany_Optional_Self_Inverse1Id], [l].[OneToMany_Required_Self_Inverse1Id], [l].[OneToOne_Optional_Self1Id] FROM [LevelOne] AS [l] LEFT JOIN [LevelTwo] AS [l0] ON [l].[Id] = [l0].[Level1_Optional_Id] - WHERE ([l0].[Name] <> N'Foo') OR [l0].[Name] IS NULL + WHERE [l0].[Name] <> N'Foo' OR [l0].[Name] IS NULL ) AS [t]"); } @@ -2181,7 +2181,7 @@ public override async Task Explicit_GroupJoin_in_subquery_with_unrelated_project @"SELECT DISTINCT [l].[Id] FROM [LevelOne] AS [l] LEFT JOIN [LevelTwo] AS [l0] ON [l].[Id] = [l0].[Level1_Optional_Id] -WHERE ([l0].[Name] <> N'Foo') OR [l0].[Name] IS NULL"); +WHERE [l0].[Name] <> N'Foo' OR [l0].[Name] IS NULL"); } public override async Task Explicit_GroupJoin_in_subquery_with_unrelated_projection4(bool async) @@ -2196,7 +2196,7 @@ SELECT TOP(@__p_0) [t].[Id] SELECT DISTINCT [l].[Id] FROM [LevelOne] AS [l] LEFT JOIN [LevelTwo] AS [l0] ON [l].[Id] = [l0].[Level1_Optional_Id] - WHERE ([l0].[Name] <> N'Foo') OR [l0].[Name] IS NULL + WHERE [l0].[Name] <> N'Foo' OR [l0].[Name] IS NULL ) AS [t] ORDER BY [t].[Id]"); } @@ -2255,7 +2255,7 @@ public override async Task Join_condition_optimizations_applied_correctly_when_a AssertSql( @"SELECT [l].[Id], [l].[Date], [l].[Name], [l].[OneToMany_Optional_Self_Inverse1Id], [l].[OneToMany_Required_Self_Inverse1Id], [l].[OneToOne_Optional_Self1Id] FROM [LevelOne] AS [l] -INNER JOIN [LevelTwo] AS [l0] ON ([l].[OneToMany_Optional_Self_Inverse1Id] = [l0].[Level1_Optional_Id]) OR ([l].[OneToMany_Optional_Self_Inverse1Id] IS NULL AND [l0].[Level1_Optional_Id] IS NULL)"); +INNER JOIN [LevelTwo] AS [l0] ON [l].[OneToMany_Optional_Self_Inverse1Id] = [l0].[Level1_Optional_Id] OR ([l].[OneToMany_Optional_Self_Inverse1Id] IS NULL AND [l0].[Level1_Optional_Id] IS NULL)"); } public override async Task Join_condition_optimizations_applied_correctly_when_anonymous_type_with_multiple_properties(bool async) @@ -2265,7 +2265,7 @@ public override async Task Join_condition_optimizations_applied_correctly_when_a AssertSql( @"SELECT [l].[Id], [l].[Date], [l].[Name], [l].[OneToMany_Optional_Self_Inverse1Id], [l].[OneToMany_Required_Self_Inverse1Id], [l].[OneToOne_Optional_Self1Id] FROM [LevelOne] AS [l] -INNER JOIN [LevelTwo] AS [l0] ON (([l].[OneToMany_Optional_Self_Inverse1Id] = [l0].[Level1_Optional_Id]) OR ([l].[OneToMany_Optional_Self_Inverse1Id] IS NULL AND [l0].[Level1_Optional_Id] IS NULL)) AND (([l].[OneToOne_Optional_Self1Id] = [l0].[OneToMany_Optional_Self_Inverse2Id]) OR ([l].[OneToOne_Optional_Self1Id] IS NULL AND [l0].[OneToMany_Optional_Self_Inverse2Id] IS NULL))"); +INNER JOIN [LevelTwo] AS [l0] ON ([l].[OneToMany_Optional_Self_Inverse1Id] = [l0].[Level1_Optional_Id] OR ([l].[OneToMany_Optional_Self_Inverse1Id] IS NULL AND [l0].[Level1_Optional_Id] IS NULL)) AND ([l].[OneToOne_Optional_Self1Id] = [l0].[OneToMany_Optional_Self_Inverse2Id] OR ([l].[OneToOne_Optional_Self1Id] IS NULL AND [l0].[OneToMany_Optional_Self_Inverse2Id] IS NULL))"); } public override async Task Nested_group_join_with_take(bool async) @@ -2294,7 +2294,7 @@ public override async Task Navigation_with_same_navigation_compared_to_null(bool @"SELECT [l].[Id] FROM [LevelTwo] AS [l] INNER JOIN [LevelOne] AS [l0] ON [l].[OneToMany_Required_Inverse2Id] = [l0].[Id] -WHERE ([l0].[Name] <> N'L1 07') OR [l0].[Name] IS NULL"); +WHERE [l0].[Name] <> N'L1 07' OR [l0].[Name] IS NULL"); } public override async Task Multi_level_navigation_compared_to_null(bool async) @@ -2318,7 +2318,7 @@ public override async Task Multi_level_navigation_with_same_navigation_compared_ FROM [LevelThree] AS [l] LEFT JOIN [LevelTwo] AS [l0] ON [l].[OneToMany_Optional_Inverse3Id] = [l0].[Id] LEFT JOIN [LevelOne] AS [l1] ON [l0].[Level1_Required_Id] = [l1].[Id] -WHERE (([l1].[Name] <> N'L1 07') OR [l1].[Name] IS NULL) AND [l1].[Id] IS NOT NULL"); +WHERE ([l1].[Name] <> N'L1 07' OR [l1].[Name] IS NULL) AND [l1].[Id] IS NOT NULL"); } public override async Task Navigations_compared_to_each_other1(bool async) @@ -2367,7 +2367,7 @@ FROM [LevelTwo] AS [l] WHERE EXISTS ( SELECT 1 FROM [LevelFour] AS [l1] - WHERE [l0].[Id] IS NOT NULL AND ([l0].[Id] = [l1].[OneToMany_Optional_Inverse4Id]))"); + WHERE [l0].[Id] IS NOT NULL AND [l0].[Id] = [l1].[OneToMany_Optional_Inverse4Id])"); } public override async Task Navigations_compared_to_each_other5(bool async) @@ -2382,7 +2382,7 @@ FROM [LevelTwo] AS [l] WHERE EXISTS ( SELECT 1 FROM [LevelFour] AS [l2] - WHERE [l0].[Id] IS NOT NULL AND ([l0].[Id] = [l2].[OneToMany_Optional_Inverse4Id]))"); + WHERE [l0].[Id] IS NOT NULL AND [l0].[Id] = [l2].[OneToMany_Optional_Inverse4Id])"); } public override async Task Level4_Include(bool async) @@ -2422,11 +2422,11 @@ public override async Task Select_subquery_with_client_eval_and_navigation2(bool AssertSql( @"SELECT CASE - WHEN (( + WHEN ( 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] @@ -2492,7 +2492,7 @@ public override async Task Project_collection_navigation_count(bool async) @"SELECT [l].[Id], ( SELECT COUNT(*) FROM [LevelThree] AS [l1] - WHERE [l0].[Id] IS NOT NULL AND ([l0].[Id] = [l1].[OneToMany_Optional_Inverse3Id])) AS [Count] + WHERE [l0].[Id] IS NOT NULL AND [l0].[Id] = [l1].[OneToMany_Optional_Inverse3Id]) AS [Count] FROM [LevelOne] AS [l] LEFT JOIN [LevelTwo] AS [l0] ON [l].[Id] = [l0].[Level1_Optional_Id]"); } @@ -2766,7 +2766,7 @@ public override async Task Include8(bool async) @"SELECT [l].[Id], [l].[Date], [l].[Level1_Optional_Id], [l].[Level1_Required_Id], [l].[Name], [l].[OneToMany_Optional_Inverse2Id], [l].[OneToMany_Optional_Self_Inverse2Id], [l].[OneToMany_Required_Inverse2Id], [l].[OneToMany_Required_Self_Inverse2Id], [l].[OneToOne_Optional_PK_Inverse2Id], [l].[OneToOne_Optional_Self2Id], [l0].[Id], [l0].[Date], [l0].[Name], [l0].[OneToMany_Optional_Self_Inverse1Id], [l0].[OneToMany_Required_Self_Inverse1Id], [l0].[OneToOne_Optional_Self1Id] FROM [LevelTwo] AS [l] LEFT JOIN [LevelOne] AS [l0] ON [l].[Level1_Optional_Id] = [l0].[Id] -WHERE ([l0].[Name] <> N'Fubar') OR [l0].[Name] IS NULL"); +WHERE [l0].[Name] <> N'Fubar' OR [l0].[Name] IS NULL"); } public override async Task Include9(bool async) @@ -2777,7 +2777,7 @@ public override async Task Include9(bool async) @"SELECT [l].[Id], [l].[Date], [l].[Level1_Optional_Id], [l].[Level1_Required_Id], [l].[Name], [l].[OneToMany_Optional_Inverse2Id], [l].[OneToMany_Optional_Self_Inverse2Id], [l].[OneToMany_Required_Inverse2Id], [l].[OneToMany_Required_Self_Inverse2Id], [l].[OneToOne_Optional_PK_Inverse2Id], [l].[OneToOne_Optional_Self2Id], [l0].[Id], [l0].[Date], [l0].[Name], [l0].[OneToMany_Optional_Self_Inverse1Id], [l0].[OneToMany_Required_Self_Inverse1Id], [l0].[OneToOne_Optional_Self1Id] FROM [LevelTwo] AS [l] LEFT JOIN [LevelOne] AS [l0] ON [l].[Level1_Optional_Id] = [l0].[Id] -WHERE ([l0].[Name] <> N'Fubar') OR [l0].[Name] IS NULL"); +WHERE [l0].[Name] <> N'Fubar' OR [l0].[Name] IS NULL"); } public override async Task Include10(bool async) @@ -2892,7 +2892,7 @@ public override async Task Include18_2(bool async) SELECT DISTINCT [l].[Id], [l].[Date], [l].[Name], [l].[OneToMany_Optional_Self_Inverse1Id], [l].[OneToMany_Required_Self_Inverse1Id], [l].[OneToOne_Optional_Self1Id] FROM [LevelOne] AS [l] LEFT JOIN [LevelTwo] AS [l0] ON [l].[Id] = [l0].[Level1_Required_Id] - WHERE ([l0].[Name] <> N'Foo') OR [l0].[Name] IS NULL + WHERE [l0].[Name] <> N'Foo' OR [l0].[Name] IS NULL ) AS [t] LEFT JOIN [LevelTwo] AS [l1] ON [t].[Id] = [l1].[Level1_Optional_Id]"); } @@ -3023,7 +3023,7 @@ public override async Task Include_with_all_method_include_gets_ignored(bool isA WHEN NOT EXISTS ( SELECT 1 FROM [LevelOne] AS [l] - WHERE ([l].[Name] = N'Foo') AND [l].[Name] IS NOT NULL) THEN CAST(1 AS bit) + WHERE [l].[Name] = N'Foo' AND [l].[Name] IS NOT NULL) THEN CAST(1 AS bit) ELSE CAST(0 AS bit) END"); } @@ -3059,7 +3059,7 @@ public override async Task Member_pushdown_chain_3_levels_deep(bool async) 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] -WHERE (( +WHERE ( SELECT TOP(1) ( SELECT TOP(1) ( SELECT TOP(1) [l2].[Name] @@ -3071,7 +3071,7 @@ FROM [LevelThree] AS [l1] ORDER BY [l1].[Id]) FROM [LevelTwo] AS [l0] WHERE [l0].[Level1_Optional_Id] = [l].[Id] - ORDER BY [l0].[Id]) <> N'Foo') OR ( + ORDER BY [l0].[Id]) <> N'Foo' OR ( SELECT TOP(1) ( SELECT TOP(1) ( SELECT TOP(1) [l2].[Name] @@ -3153,11 +3153,11 @@ FROM [LevelThree] AS [l0] WHERE EXISTS ( SELECT 1 FROM [LevelTwo] AS [l1] - WHERE [l].[Id] = [l1].[OneToMany_Optional_Inverse2Id]) AND ((( + WHERE [l].[Id] = [l1].[OneToMany_Optional_Inverse2Id]) 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] @@ -3246,7 +3246,7 @@ FROM [LevelOne] AS [l] ORDER BY ( SELECT COUNT(*) FROM [LevelThree] AS [l2] - WHERE [l0].[Id] IS NOT NULL AND ([l0].[Id] = [l2].[OneToMany_Required_Inverse3Id])), [l1].[Name]"); + WHERE [l0].[Id] IS NOT NULL AND [l0].[Id] = [l2].[OneToMany_Required_Inverse3Id]), [l1].[Name]"); } public override async Task Null_conditional_is_not_applied_explicitly_for_optional_navigation(bool async) @@ -3257,7 +3257,7 @@ public override async Task Null_conditional_is_not_applied_explicitly_for_option @"SELECT [l].[Id], [l].[Date], [l].[Name], [l].[OneToMany_Optional_Self_Inverse1Id], [l].[OneToMany_Required_Self_Inverse1Id], [l].[OneToOne_Optional_Self1Id] FROM [LevelOne] AS [l] LEFT JOIN [LevelTwo] AS [l0] ON [l].[Id] = [l0].[Level1_Optional_Id] -WHERE [l0].[Id] IS NOT NULL AND ([l0].[Name] = N'L2 01')"); +WHERE [l0].[Id] IS NOT NULL AND [l0].[Name] = N'L2 01'"); } public override async Task Sum_with_selector_cast_using_as(bool async) @@ -3303,7 +3303,7 @@ FROM [LevelOne] AS [l] INNER JOIN [LevelTwo] AS [l0] ON [l].[Id] = [l0].[Level1_Required_Id] INNER JOIN [LevelThree] AS [l1] ON [l0].[Id] = [l1].[Level2_Required_Id] INNER JOIN [LevelFour] AS [l2] ON [l1].[Id] = [l2].[Level3_Required_Id] -LEFT JOIN [LevelOne] AS [l3] ON ([l0].[Id] >= [l3].[Id]) AND (([l2].[Name] = [l3].[Name]) OR ([l2].[Name] IS NULL AND [l3].[Name] IS NULL))"); +LEFT JOIN [LevelOne] AS [l3] ON [l0].[Id] >= [l3].[Id] AND ([l2].[Name] = [l3].[Name] OR ([l2].[Name] IS NULL AND [l3].[Name] IS NULL))"); } public override async Task Nested_SelectMany_correlated_with_join_table_correctly_translated_to_apply(bool async) @@ -3369,7 +3369,7 @@ WHEN EXISTS ( SELECT 1 FROM [LevelOne] AS [l1] LEFT JOIN [LevelTwo] AS [l2] ON [l1].[Id] = [l2].[Level1_Optional_Id] - WHERE ([l2].[Name] = [l0].[Name]) OR ([l2].[Name] IS NULL AND [l0].[Name] IS NULL)) THEN CAST(1 AS bit) + WHERE [l2].[Name] = [l0].[Name] OR ([l2].[Name] IS NULL AND [l0].[Name] IS NULL)) THEN CAST(1 AS bit) ELSE CAST(0 AS bit) END AS [Contains] FROM [LevelOne] AS [l] @@ -3386,7 +3386,7 @@ WHEN EXISTS ( SELECT 1 FROM [LevelOne] AS [l2] LEFT JOIN [LevelTwo] AS [l3] ON [l2].[Id] = [l3].[Level1_Optional_Id] - WHERE ([l3].[Id] = [l1].[Id]) OR ([l3].[Id] IS NULL AND [l1].[Id] IS NULL)) THEN CAST(1 AS bit) + WHERE [l3].[Id] = [l1].[Id] OR ([l3].[Id] IS NULL AND [l1].[Id] IS NULL)) THEN CAST(1 AS bit) ELSE CAST(0 AS bit) END AS [Contains] FROM [LevelOne] AS [l] @@ -3430,7 +3430,7 @@ public override async Task GroupBy_aggregate_where_required_relationship(bool as FROM [LevelTwo] AS [l] INNER JOIN [LevelOne] AS [l0] ON [l].[OneToMany_Required_Inverse2Id] = [l0].[Id] GROUP BY [l0].[Id] -HAVING (MAX([l].[Id]) <> 2) OR MAX([l].[Id]) IS NULL"); +HAVING MAX([l].[Id]) <> 2 OR MAX([l].[Id]) IS NULL"); } public override async Task GroupBy_aggregate_where_required_relationship_2(bool async) @@ -3442,7 +3442,7 @@ public override async Task GroupBy_aggregate_where_required_relationship_2(bool 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]) > 2)"); +HAVING MAX([l].[Id]) < 2 OR MAX([l].[Id]) > 2"); } public override async Task Member_over_null_check_ternary_and_nested_dto_type(bool async) @@ -3474,10 +3474,10 @@ ELSE CAST(0 AS bit) 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 (CASE +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"); @@ -3533,7 +3533,7 @@ FROM [LevelThree] AS [l0] WHERE EXISTS ( SELECT 1 FROM [LevelTwo] AS [l1] - WHERE ([l].[Id] = [l1].[OneToMany_Required_Inverse2Id]) AND ([l1].[Id] = [l0].[Level2_Required_Id])) + WHERE [l].[Id] = [l1].[OneToMany_Required_Inverse2Id] AND [l1].[Id] = [l0].[Level2_Required_Id]) ) AS [t] LEFT JOIN [LevelTwo] AS [l2] ON [l].[Id] = [l2].[OneToMany_Required_Inverse2Id] ORDER BY [l].[Id], [t].[Id]"); @@ -3564,10 +3564,10 @@ INNER JOIN ( SELECT [l0].[Id] % 3 AS [Key], COALESCE(SUM([l0].[Id]), 0) AS [Sum] FROM [LevelTwo] AS [l0] GROUP BY [l0].[Id] % 3 -) AS [t] ON ([l].[Id] = [t].[Key]) AND (CAST(1 AS bit) = CASE +) AS [t] ON [l].[Id] = [t].[Key] AND CAST(1 AS bit) = CASE WHEN [t].[Sum] > 10 THEN CAST(1 AS bit) ELSE CAST(0 AS bit) -END)"); +END"); } public override async Task Multiple_joins_groupby_predicate(bool async) @@ -3586,7 +3586,7 @@ LEFT JOIN ( FROM [LevelThree] AS [l1] GROUP BY [l1].[Name] ) AS [t] ON [l].[Name] = [t].[Key] -WHERE [l0].[Name] IS NOT NULL OR ([t].[Count] > 0)"); +WHERE [l0].[Name] IS NOT NULL OR [t].[Count] > 0"); } public override async Task Collection_FirstOrDefault_property_accesses_in_projection(bool async) @@ -3597,7 +3597,7 @@ public override async Task Collection_FirstOrDefault_property_accesses_in_projec @"SELECT [l].[Id], ( SELECT TOP(1) [l0].[Name] FROM [LevelTwo] AS [l0] - WHERE ([l].[Id] = [l0].[OneToMany_Optional_Inverse2Id]) AND ([l0].[Name] = N'L2 02')) AS [Pushdown] + WHERE [l].[Id] = [l0].[OneToMany_Optional_Inverse2Id] AND [l0].[Name] = N'L2 02') AS [Pushdown] FROM [LevelOne] AS [l] WHERE [l].[Id] < 3"); } @@ -3654,13 +3654,13 @@ FROM [LevelThree] AS [l0] WHERE EXISTS ( SELECT 1 FROM [LevelTwo] AS [l1] - WHERE ([l].[Id] = [l1].[OneToMany_Optional_Inverse2Id]) AND ([l1].[Name] = N'L2 02')) AND ((( + WHERE [l].[Id] = [l1].[OneToMany_Optional_Inverse2Id] AND [l1].[Name] = N'L2 02') AND (( SELECT TOP(1) [l2].[Id] FROM [LevelTwo] AS [l2] - WHERE ([l].[Id] = [l2].[OneToMany_Optional_Inverse2Id]) AND ([l2].[Name] = N'L2 02')) = [l0].[OneToMany_Optional_Inverse3Id]) OR (( + WHERE [l].[Id] = [l2].[OneToMany_Optional_Inverse2Id] AND [l2].[Name] = N'L2 02') = [l0].[OneToMany_Optional_Inverse3Id] OR (( SELECT TOP(1) [l2].[Id] FROM [LevelTwo] AS [l2] - WHERE ([l].[Id] = [l2].[OneToMany_Optional_Inverse2Id]) AND ([l2].[Name] = N'L2 02')) IS NULL AND [l0].[OneToMany_Optional_Inverse3Id] IS NULL)) + WHERE [l].[Id] = [l2].[OneToMany_Optional_Inverse2Id] AND [l2].[Name] = N'L2 02') IS NULL AND [l0].[OneToMany_Optional_Inverse3Id] IS NULL)) ORDER BY [l0].[Id]) AS [Pushdown] FROM [LevelOne] AS [l] WHERE [l].[Id] < 2"); diff --git a/test/EFCore.SqlServer.FunctionalTests/Query/ComplexNavigationsSharedTypeQuerySqlServerTest.cs b/test/EFCore.SqlServer.FunctionalTests/Query/ComplexNavigationsSharedTypeQuerySqlServerTest.cs index a7a80bb8fd8..43e3ccb3261 100644 --- a/test/EFCore.SqlServer.FunctionalTests/Query/ComplexNavigationsSharedTypeQuerySqlServerTest.cs +++ b/test/EFCore.SqlServer.FunctionalTests/Query/ComplexNavigationsSharedTypeQuerySqlServerTest.cs @@ -38,9 +38,9 @@ LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[Level2_Name], [l0].[OneToMany_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id] FROM [Level1] AS [l0] INNER JOIN [Level1] AS [l1] ON [l0].[Id] = [l1].[Id] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] ON [l].[Id] = CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] END"); } @@ -63,9 +63,9 @@ LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[Level2_Name], [l0].[OneToMany_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id] FROM [Level1] AS [l0] INNER JOIN [Level1] AS [l1] ON [l0].[Id] = [l1].[Id] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] ON [l].[Id] = CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] END LEFT JOIN ( SELECT [l2].[Id], [l2].[Level2_Optional_Id], [l2].[Level2_Required_Id], [l2].[Level3_Name], [l2].[OneToMany_Optional_Inverse3Id], [l2].[OneToMany_Required_Inverse3Id], [l2].[OneToOne_Optional_PK_Inverse3Id] @@ -74,11 +74,11 @@ INNER JOIN ( SELECT [l3].[Id] FROM [Level1] AS [l3] INNER JOIN [Level1] AS [l4] ON [l3].[Id] = [l4].[Id] - WHERE ([l3].[OneToOne_Required_PK_Date] IS NOT NULL AND [l3].[Level1_Required_Id] IS NOT NULL) AND [l3].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE [l3].[OneToOne_Required_PK_Date] IS NOT NULL AND [l3].[Level1_Required_Id] IS NOT NULL AND [l3].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t1] ON [l2].[Id] = [t1].[Id] WHERE [l2].[Level2_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse3Id] IS NOT NULL ) AS [t0] ON CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_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] END"); @@ -95,9 +95,9 @@ LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Required_Id], [l0].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l0] INNER JOIN [Level1] AS [l1] ON [l0].[Id] = [l1].[Id] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] ON [l].[Id] = CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] END LEFT JOIN ( SELECT [l2].[Id], [l2].[Level2_Required_Id], [l2].[Level3_Name], [l2].[OneToMany_Required_Inverse3Id] @@ -106,11 +106,11 @@ INNER JOIN ( SELECT [l3].[Id] FROM [Level1] AS [l3] INNER JOIN [Level1] AS [l4] ON [l3].[Id] = [l4].[Id] - WHERE ([l3].[OneToOne_Required_PK_Date] IS NOT NULL AND [l3].[Level1_Required_Id] IS NOT NULL) AND [l3].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE [l3].[OneToOne_Required_PK_Date] IS NOT NULL AND [l3].[Level1_Required_Id] IS NOT NULL AND [l3].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t1] ON [l2].[Id] = [t1].[Id] WHERE [l2].[Level2_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse3Id] IS NOT NULL ) AS [t0] ON CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_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] END @@ -128,9 +128,9 @@ LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Required_Id], [l0].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l0] INNER JOIN [Level1] AS [l1] ON [l0].[Id] = [l1].[Id] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] ON [l].[Id] = CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] END LEFT JOIN ( SELECT [l2].[Id], [l2].[Level2_Required_Id], [l2].[Level3_Name], [l2].[OneToMany_Required_Inverse3Id] @@ -139,11 +139,11 @@ INNER JOIN ( SELECT [l3].[Id] FROM [Level1] AS [l3] INNER JOIN [Level1] AS [l4] ON [l3].[Id] = [l4].[Id] - WHERE ([l3].[OneToOne_Required_PK_Date] IS NOT NULL AND [l3].[Level1_Required_Id] IS NOT NULL) AND [l3].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE [l3].[OneToOne_Required_PK_Date] IS NOT NULL AND [l3].[Level1_Required_Id] IS NOT NULL AND [l3].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t1] ON [l2].[Id] = [t1].[Id] WHERE [l2].[Level2_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse3Id] IS NOT NULL ) AS [t0] ON CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_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] END @@ -151,13 +151,13 @@ LEFT JOIN ( SELECT [l5].[Id], [l5].[OneToOne_Required_PK_Date], [l5].[Level1_Required_Id], [l5].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l5] INNER JOIN [Level1] AS [l6] ON [l5].[Id] = [l6].[Id] - WHERE ([l5].[OneToOne_Required_PK_Date] IS NOT NULL AND [l5].[Level1_Required_Id] IS NOT NULL) AND [l5].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE [l5].[OneToOne_Required_PK_Date] IS NOT NULL AND [l5].[Level1_Required_Id] IS NOT NULL AND [l5].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t2] ON [l].[Id] = CASE - WHEN ([t2].[OneToOne_Required_PK_Date] IS NOT NULL AND [t2].[Level1_Required_Id] IS NOT NULL) AND [t2].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t2].[Id] + WHEN [t2].[OneToOne_Required_PK_Date] IS NOT NULL AND [t2].[Level1_Required_Id] IS NOT NULL AND [t2].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t2].[Id] END GROUP BY [t0].[Level3_Name] HAVING MIN(COALESCE(CASE - WHEN ([t2].[OneToOne_Required_PK_Date] IS NOT NULL AND [t2].[Level1_Required_Id] IS NOT NULL) AND [t2].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t2].[Id] + WHEN [t2].[OneToOne_Required_PK_Date] IS NOT NULL AND [t2].[Level1_Required_Id] IS NOT NULL AND [t2].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t2].[Id] END, 0)) > 0"); } @@ -172,9 +172,9 @@ LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[Level2_Name], [l0].[OneToMany_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id] FROM [Level1] AS [l0] INNER JOIN [Level1] AS [l1] ON [l0].[Id] = [l1].[Id] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL) AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] ON [l].[Id] = CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] END LEFT JOIN ( SELECT [l2].[Id], [l2].[Level2_Optional_Id], [l2].[Level2_Required_Id], [l2].[Level3_Name], [l2].[OneToMany_Optional_Inverse3Id], [l2].[OneToMany_Required_Inverse3Id], [l2].[OneToOne_Optional_PK_Inverse3Id] @@ -183,11 +183,11 @@ INNER JOIN ( SELECT [l3].[Id] FROM [Level1] AS [l3] INNER JOIN [Level1] AS [l4] ON [l3].[Id] = [l4].[Id] - WHERE ([l3].[OneToOne_Required_PK_Date] IS NOT NULL AND [l3].[Level1_Required_Id] IS NOT NULL) AND [l3].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE [l3].[OneToOne_Required_PK_Date] IS NOT NULL AND [l3].[Level1_Required_Id] IS NOT NULL AND [l3].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t1] ON [l2].[Id] = [t1].[Id] WHERE [l2].[Level2_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse3Id] IS NOT NULL ) AS [t0] ON CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_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] END @@ -201,7 +201,7 @@ INNER JOIN ( SELECT [l7].[Id] FROM [Level1] AS [l7] INNER JOIN [Level1] AS [l8] ON [l7].[Id] = [l8].[Id] - WHERE ([l7].[OneToOne_Required_PK_Date] IS NOT NULL AND [l7].[Level1_Required_Id] IS NOT NULL) AND [l7].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE [l7].[OneToOne_Required_PK_Date] IS NOT NULL AND [l7].[Level1_Required_Id] IS NOT NULL AND [l7].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t4] ON [l6].[Id] = [t4].[Id] WHERE [l6].[Level2_Required_Id] IS NOT NULL AND [l6].[OneToMany_Required_Inverse3Id] IS NOT NULL ) AS [t3] ON [l5].[Id] = [t3].[Id] @@ -231,11 +231,11 @@ LEFT JOIN ( SELECT [l1].[Id], [l1].[OneToOne_Required_PK_Date], [l1].[Level1_Optional_Id], [l1].[Level1_Required_Id], [l1].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l1] INNER JOIN [Level1] AS [l2] ON [l1].[Id] = [l2].[Id] - WHERE ([l1].[OneToOne_Required_PK_Date] IS NOT NULL AND [l1].[Level1_Required_Id] IS NOT NULL) AND [l1].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE [l1].[OneToOne_Required_PK_Date] IS NOT NULL AND [l1].[Level1_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] ON [l0].[Id] = CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] END - WHERE ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t0] ON [l].[Id] = [t0].[Level1_Optional_Id] ORDER BY [l].[Id] ) AS [t1] @@ -246,13 +246,13 @@ LEFT JOIN ( SELECT [l4].[Id], [l4].[OneToOne_Required_PK_Date], [l4].[Level1_Optional_Id], [l4].[Level1_Required_Id], [l4].[Level2_Name], [l4].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l4] INNER JOIN [Level1] AS [l5] ON [l4].[Id] = [l5].[Id] - WHERE ([l4].[OneToOne_Required_PK_Date] IS NOT NULL AND [l4].[Level1_Required_Id] IS NOT NULL) AND [l4].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE [l4].[OneToOne_Required_PK_Date] IS NOT NULL AND [l4].[Level1_Required_Id] IS NOT NULL AND [l4].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t3] ON [l3].[Id] = CASE - WHEN ([t3].[OneToOne_Required_PK_Date] IS NOT NULL AND [t3].[Level1_Required_Id] IS NOT NULL) AND [t3].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t3].[Id] + WHEN [t3].[OneToOne_Required_PK_Date] IS NOT NULL AND [t3].[Level1_Required_Id] IS NOT NULL AND [t3].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t3].[Id] END - WHERE ([t3].[OneToOne_Required_PK_Date] IS NOT NULL AND [t3].[Level1_Required_Id] IS NOT NULL) AND [t3].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE [t3].[OneToOne_Required_PK_Date] IS NOT NULL AND [t3].[Level1_Required_Id] IS NOT NULL AND [t3].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t2] ON CASE - WHEN ([t1].[OneToOne_Required_PK_Date] IS NOT NULL AND [t1].[Level1_Required_Id] IS NOT NULL) AND [t1].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t1].[Id00] + WHEN [t1].[OneToOne_Required_PK_Date] IS NOT NULL AND [t1].[Level1_Required_Id] IS NOT NULL AND [t1].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t1].[Id00] END = [t2].[Level1_Optional_Id] ORDER BY [t1].[Id]"); } @@ -273,13 +273,13 @@ LEFT JOIN ( SELECT [l1].[Id], [l1].[OneToOne_Required_PK_Date], [l1].[Level1_Optional_Id], [l1].[Level1_Required_Id], [l1].[Level2_Name], [l1].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l1] INNER JOIN [Level1] AS [l2] ON [l1].[Id] = [l2].[Id] - WHERE ([l1].[OneToOne_Required_PK_Date] IS NOT NULL AND [l1].[Level1_Required_Id] IS NOT NULL) AND [l1].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE [l1].[OneToOne_Required_PK_Date] IS NOT NULL AND [l1].[Level1_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] ON [l0].[Id] = CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] END - WHERE ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t0] ON [l].[Id] = [t0].[Level1_Optional_Id] - WHERE ([t0].[Level2_Name] <> N'Foo') OR [t0].[Level2_Name] IS NULL + WHERE [t0].[Level2_Name] <> N'Foo' OR [t0].[Level2_Name] IS NULL ) AS [t1]"); } @@ -289,7 +289,7 @@ public override async Task Result_operator_nav_prop_reference_optional_via_Defau AssertSql( @"SELECT COALESCE(SUM(CASE - WHEN ([t0].[OneToOne_Required_PK_Date] IS NULL OR [t0].[Level1_Required_Id] IS NULL) OR [t0].[OneToMany_Required_Inverse2Id] IS NULL THEN 0 + WHEN [t0].[OneToOne_Required_PK_Date] IS NULL OR [t0].[Level1_Required_Id] IS NULL OR [t0].[OneToMany_Required_Inverse2Id] IS NULL THEN 0 ELSE [t0].[Level1_Required_Id] END), 0) FROM [Level1] AS [l] @@ -300,11 +300,11 @@ LEFT JOIN ( SELECT [l1].[Id], [l1].[OneToOne_Required_PK_Date], [l1].[Level1_Optional_Id], [l1].[Level1_Required_Id], [l1].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l1] INNER JOIN [Level1] AS [l2] ON [l1].[Id] = [l2].[Id] - WHERE ([l1].[OneToOne_Required_PK_Date] IS NOT NULL AND [l1].[Level1_Required_Id] IS NOT NULL) AND [l1].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE [l1].[OneToOne_Required_PK_Date] IS NOT NULL AND [l1].[Level1_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] ON [l0].[Id] = CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] END - WHERE ([t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL) AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL + WHERE [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t0] ON [l].[Id] = [t0].[Level1_Optional_Id]"); } diff --git a/test/EFCore.SqlServer.FunctionalTests/Query/CompositeKeysQuerySqlServerTest.cs b/test/EFCore.SqlServer.FunctionalTests/Query/CompositeKeysQuerySqlServerTest.cs index 764b1fe8dc6..a21a4ce0c43 100644 --- a/test/EFCore.SqlServer.FunctionalTests/Query/CompositeKeysQuerySqlServerTest.cs +++ b/test/EFCore.SqlServer.FunctionalTests/Query/CompositeKeysQuerySqlServerTest.cs @@ -27,8 +27,8 @@ public override async Task Projecting_multiple_collections_same_level_top_level_ AssertSql( @"SELECT [c].[Name], [c].[Id1], [c].[Id2], [c0].[Id1], [c0].[Id2], [c0].[Date], [c0].[Level1_Optional_Id1], [c0].[Level1_Optional_Id2], [c0].[Level1_Required_Id1], [c0].[Level1_Required_Id2], [c0].[Name], [c0].[OneToMany_Optional_Inverse2Id1], [c0].[OneToMany_Optional_Inverse2Id2], [c0].[OneToMany_Optional_Self_Inverse2Id1], [c0].[OneToMany_Optional_Self_Inverse2Id2], [c0].[OneToMany_Required_Inverse2Id1], [c0].[OneToMany_Required_Inverse2Id2], [c0].[OneToMany_Required_Self_Inverse2Id1], [c0].[OneToMany_Required_Self_Inverse2Id2], [c0].[OneToOne_Optional_PK_Inverse2Id1], [c0].[OneToOne_Optional_PK_Inverse2Id2], [c0].[OneToOne_Optional_Self2Id1], [c0].[OneToOne_Optional_Self2Id2], [c1].[Id1], [c1].[Id2], [c1].[Date], [c1].[Level1_Optional_Id1], [c1].[Level1_Optional_Id2], [c1].[Level1_Required_Id1], [c1].[Level1_Required_Id2], [c1].[Name], [c1].[OneToMany_Optional_Inverse2Id1], [c1].[OneToMany_Optional_Inverse2Id2], [c1].[OneToMany_Optional_Self_Inverse2Id1], [c1].[OneToMany_Optional_Self_Inverse2Id2], [c1].[OneToMany_Required_Inverse2Id1], [c1].[OneToMany_Required_Inverse2Id2], [c1].[OneToMany_Required_Self_Inverse2Id1], [c1].[OneToMany_Required_Self_Inverse2Id2], [c1].[OneToOne_Optional_PK_Inverse2Id1], [c1].[OneToOne_Optional_PK_Inverse2Id2], [c1].[OneToOne_Optional_Self2Id1], [c1].[OneToOne_Optional_Self2Id2] FROM [CompositeOnes] AS [c] -LEFT JOIN [CompositeTwos] AS [c0] ON ([c].[Id1] = [c0].[OneToMany_Optional_Inverse2Id1]) AND ([c].[Id2] = [c0].[OneToMany_Optional_Inverse2Id2]) -LEFT JOIN [CompositeTwos] AS [c1] ON ([c].[Id1] = [c1].[OneToMany_Required_Inverse2Id1]) AND ([c].[Id2] = [c1].[OneToMany_Required_Inverse2Id2]) +LEFT JOIN [CompositeTwos] AS [c0] ON [c].[Id1] = [c0].[OneToMany_Optional_Inverse2Id1] AND [c].[Id2] = [c0].[OneToMany_Optional_Inverse2Id2] +LEFT JOIN [CompositeTwos] AS [c1] ON [c].[Id1] = [c1].[OneToMany_Required_Inverse2Id1] AND [c].[Id2] = [c1].[OneToMany_Required_Inverse2Id2] ORDER BY [c].[Id2], [c].[Id1], [c0].[Id1], [c0].[Id2], [c1].[Id1]"); } @@ -39,8 +39,8 @@ public override async Task Projecting_multiple_collections_same_level_top_level_ AssertSql( @"SELECT [c].[Name], [c].[Id1], [c].[Id2], [c0].[Id1], [c0].[Id2], [c0].[Date], [c0].[Level1_Optional_Id1], [c0].[Level1_Optional_Id2], [c0].[Level1_Required_Id1], [c0].[Level1_Required_Id2], [c0].[Name], [c0].[OneToMany_Optional_Inverse2Id1], [c0].[OneToMany_Optional_Inverse2Id2], [c0].[OneToMany_Optional_Self_Inverse2Id1], [c0].[OneToMany_Optional_Self_Inverse2Id2], [c0].[OneToMany_Required_Inverse2Id1], [c0].[OneToMany_Required_Inverse2Id2], [c0].[OneToMany_Required_Self_Inverse2Id1], [c0].[OneToMany_Required_Self_Inverse2Id2], [c0].[OneToOne_Optional_PK_Inverse2Id1], [c0].[OneToOne_Optional_PK_Inverse2Id2], [c0].[OneToOne_Optional_Self2Id1], [c0].[OneToOne_Optional_Self2Id2], [c1].[Id1], [c1].[Id2], [c1].[Date], [c1].[Level1_Optional_Id1], [c1].[Level1_Optional_Id2], [c1].[Level1_Required_Id1], [c1].[Level1_Required_Id2], [c1].[Name], [c1].[OneToMany_Optional_Inverse2Id1], [c1].[OneToMany_Optional_Inverse2Id2], [c1].[OneToMany_Optional_Self_Inverse2Id1], [c1].[OneToMany_Optional_Self_Inverse2Id2], [c1].[OneToMany_Required_Inverse2Id1], [c1].[OneToMany_Required_Inverse2Id2], [c1].[OneToMany_Required_Self_Inverse2Id1], [c1].[OneToMany_Required_Self_Inverse2Id2], [c1].[OneToOne_Optional_PK_Inverse2Id1], [c1].[OneToOne_Optional_PK_Inverse2Id2], [c1].[OneToOne_Optional_Self2Id1], [c1].[OneToOne_Optional_Self2Id2] FROM [CompositeOnes] AS [c] -LEFT JOIN [CompositeTwos] AS [c0] ON ([c].[Id1] = [c0].[OneToMany_Optional_Inverse2Id1]) AND ([c].[Id2] = [c0].[OneToMany_Optional_Inverse2Id2]) -LEFT JOIN [CompositeTwos] AS [c1] ON ([c].[Id1] = [c1].[OneToMany_Required_Inverse2Id1]) AND ([c].[Id2] = [c1].[OneToMany_Required_Inverse2Id2]) +LEFT JOIN [CompositeTwos] AS [c0] ON [c].[Id1] = [c0].[OneToMany_Optional_Inverse2Id1] AND [c].[Id2] = [c0].[OneToMany_Optional_Inverse2Id2] +LEFT JOIN [CompositeTwos] AS [c1] ON [c].[Id1] = [c1].[OneToMany_Required_Inverse2Id1] AND [c].[Id2] = [c1].[OneToMany_Required_Inverse2Id2] ORDER BY [c].[Id2], [c].[Id1] DESC, [c0].[Id1], [c0].[Id2], [c1].[Id1]"); } @@ -51,8 +51,8 @@ public override async Task Projecting_multiple_collections_with_ordering_same_le AssertSql( @"SELECT [c].[Name], [c].[Id1], [c].[Id2], [c0].[Id1], [c0].[Id2], [c0].[Date], [c0].[Level1_Optional_Id1], [c0].[Level1_Optional_Id2], [c0].[Level1_Required_Id1], [c0].[Level1_Required_Id2], [c0].[Name], [c0].[OneToMany_Optional_Inverse2Id1], [c0].[OneToMany_Optional_Inverse2Id2], [c0].[OneToMany_Optional_Self_Inverse2Id1], [c0].[OneToMany_Optional_Self_Inverse2Id2], [c0].[OneToMany_Required_Inverse2Id1], [c0].[OneToMany_Required_Inverse2Id2], [c0].[OneToMany_Required_Self_Inverse2Id1], [c0].[OneToMany_Required_Self_Inverse2Id2], [c0].[OneToOne_Optional_PK_Inverse2Id1], [c0].[OneToOne_Optional_PK_Inverse2Id2], [c0].[OneToOne_Optional_Self2Id1], [c0].[OneToOne_Optional_Self2Id2], [c1].[Id1], [c1].[Id2], [c1].[Date], [c1].[Level1_Optional_Id1], [c1].[Level1_Optional_Id2], [c1].[Level1_Required_Id1], [c1].[Level1_Required_Id2], [c1].[Name], [c1].[OneToMany_Optional_Inverse2Id1], [c1].[OneToMany_Optional_Inverse2Id2], [c1].[OneToMany_Optional_Self_Inverse2Id1], [c1].[OneToMany_Optional_Self_Inverse2Id2], [c1].[OneToMany_Required_Inverse2Id1], [c1].[OneToMany_Required_Inverse2Id2], [c1].[OneToMany_Required_Self_Inverse2Id1], [c1].[OneToMany_Required_Self_Inverse2Id2], [c1].[OneToOne_Optional_PK_Inverse2Id1], [c1].[OneToOne_Optional_PK_Inverse2Id2], [c1].[OneToOne_Optional_Self2Id1], [c1].[OneToOne_Optional_Self2Id2] FROM [CompositeOnes] AS [c] -LEFT JOIN [CompositeTwos] AS [c0] ON ([c].[Id1] = [c0].[OneToMany_Optional_Inverse2Id1]) AND ([c].[Id2] = [c0].[OneToMany_Optional_Inverse2Id2]) -LEFT JOIN [CompositeTwos] AS [c1] ON ([c].[Id1] = [c1].[OneToMany_Required_Inverse2Id1]) AND ([c].[Id2] = [c1].[OneToMany_Required_Inverse2Id2]) +LEFT JOIN [CompositeTwos] AS [c0] ON [c].[Id1] = [c0].[OneToMany_Optional_Inverse2Id1] AND [c].[Id2] = [c0].[OneToMany_Optional_Inverse2Id2] +LEFT JOIN [CompositeTwos] AS [c1] ON [c].[Id1] = [c1].[OneToMany_Required_Inverse2Id1] AND [c].[Id2] = [c1].[OneToMany_Required_Inverse2Id2] ORDER BY [c].[Id1], [c].[Id2], [c0].[Id2], [c0].[Id1], [c1].[Name] DESC, [c1].[Id1]"); } @@ -63,8 +63,8 @@ public override async Task Projecting_multiple_collections_with_ordering_same_le AssertSql( @"SELECT [c].[Name], [c].[Id1], [c].[Id2], [c0].[Id1], [c0].[Id2], [c0].[Date], [c0].[Level1_Optional_Id1], [c0].[Level1_Optional_Id2], [c0].[Level1_Required_Id1], [c0].[Level1_Required_Id2], [c0].[Name], [c0].[OneToMany_Optional_Inverse2Id1], [c0].[OneToMany_Optional_Inverse2Id2], [c0].[OneToMany_Optional_Self_Inverse2Id1], [c0].[OneToMany_Optional_Self_Inverse2Id2], [c0].[OneToMany_Required_Inverse2Id1], [c0].[OneToMany_Required_Inverse2Id2], [c0].[OneToMany_Required_Self_Inverse2Id1], [c0].[OneToMany_Required_Self_Inverse2Id2], [c0].[OneToOne_Optional_PK_Inverse2Id1], [c0].[OneToOne_Optional_PK_Inverse2Id2], [c0].[OneToOne_Optional_Self2Id1], [c0].[OneToOne_Optional_Self2Id2], [c1].[Id1], [c1].[Id2], [c1].[Date], [c1].[Level1_Optional_Id1], [c1].[Level1_Optional_Id2], [c1].[Level1_Required_Id1], [c1].[Level1_Required_Id2], [c1].[Name], [c1].[OneToMany_Optional_Inverse2Id1], [c1].[OneToMany_Optional_Inverse2Id2], [c1].[OneToMany_Optional_Self_Inverse2Id1], [c1].[OneToMany_Optional_Self_Inverse2Id2], [c1].[OneToMany_Required_Inverse2Id1], [c1].[OneToMany_Required_Inverse2Id2], [c1].[OneToMany_Required_Self_Inverse2Id1], [c1].[OneToMany_Required_Self_Inverse2Id2], [c1].[OneToOne_Optional_PK_Inverse2Id1], [c1].[OneToOne_Optional_PK_Inverse2Id2], [c1].[OneToOne_Optional_Self2Id1], [c1].[OneToOne_Optional_Self2Id2] FROM [CompositeOnes] AS [c] -LEFT JOIN [CompositeTwos] AS [c0] ON ([c].[Id1] = [c0].[OneToMany_Optional_Inverse2Id1]) AND ([c].[Id2] = [c0].[OneToMany_Optional_Inverse2Id2]) -LEFT JOIN [CompositeTwos] AS [c1] ON ([c].[Id1] = [c1].[OneToMany_Required_Inverse2Id1]) AND ([c].[Id2] = [c1].[OneToMany_Required_Inverse2Id2]) +LEFT JOIN [CompositeTwos] AS [c0] ON [c].[Id1] = [c0].[OneToMany_Optional_Inverse2Id1] AND [c].[Id2] = [c0].[OneToMany_Optional_Inverse2Id2] +LEFT JOIN [CompositeTwos] AS [c1] ON [c].[Id1] = [c1].[OneToMany_Required_Inverse2Id1] AND [c].[Id2] = [c1].[OneToMany_Required_Inverse2Id2] ORDER BY [c].[Id2], [c].[Id1], [c0].[Id2], [c0].[Id1], [c1].[Name] DESC, [c1].[Id1]"); } @@ -78,8 +78,8 @@ FROM [CompositeOnes] AS [c] LEFT JOIN ( SELECT [c0].[Name], [c0].[Id1], [c0].[Id2], [c1].[Id1] AS [Id10], [c1].[Id2] AS [Id20], [c1].[Level2_Optional_Id1], [c1].[Level2_Optional_Id2], [c1].[Level2_Required_Id1], [c1].[Level2_Required_Id2], [c1].[Name] AS [Name0], [c1].[OneToMany_Optional_Inverse3Id1], [c1].[OneToMany_Optional_Inverse3Id2], [c1].[OneToMany_Optional_Self_Inverse3Id1], [c1].[OneToMany_Optional_Self_Inverse3Id2], [c1].[OneToMany_Required_Inverse3Id1], [c1].[OneToMany_Required_Inverse3Id2], [c1].[OneToMany_Required_Self_Inverse3Id1], [c1].[OneToMany_Required_Self_Inverse3Id2], [c1].[OneToOne_Optional_PK_Inverse3Id1], [c1].[OneToOne_Optional_PK_Inverse3Id2], [c1].[OneToOne_Optional_Self3Id1], [c1].[OneToOne_Optional_Self3Id2], [c0].[OneToMany_Optional_Inverse2Id1], [c0].[OneToMany_Optional_Inverse2Id2] FROM [CompositeTwos] AS [c0] - LEFT JOIN [CompositeThrees] AS [c1] ON ([c0].[Id1] = [c1].[OneToMany_Required_Inverse3Id1]) AND ([c0].[Id2] = [c1].[OneToMany_Required_Inverse3Id2]) -) AS [t] ON ([c].[Id1] = [t].[OneToMany_Optional_Inverse2Id1]) AND ([c].[Id2] = [t].[OneToMany_Optional_Inverse2Id2]) + LEFT JOIN [CompositeThrees] AS [c1] ON [c0].[Id1] = [c1].[OneToMany_Required_Inverse3Id1] AND [c0].[Id2] = [c1].[OneToMany_Required_Inverse3Id2] +) AS [t] ON [c].[Id1] = [t].[OneToMany_Optional_Inverse2Id1] AND [c].[Id2] = [t].[OneToMany_Optional_Inverse2Id2] ORDER BY [c].[Id2], [c].[Id1], [t].[Id2], [t].[Id1], [t].[Id20] DESC"); } @@ -96,32 +96,32 @@ FROM [CompositeTwos] AS [c0] LEFT JOIN ( SELECT [c1].[Name], [c1].[Id1], [c1].[Id2], [c2].[Id1] AS [Id10], [c2].[Id2] AS [Id20], [c2].[Level3_Optional_Id1], [c2].[Level3_Optional_Id2], [c2].[Level3_Required_Id1], [c2].[Level3_Required_Id2], [c2].[Name] AS [Name0], [c2].[OneToMany_Optional_Inverse4Id1], [c2].[OneToMany_Optional_Inverse4Id2], [c2].[OneToMany_Optional_Self_Inverse4Id1], [c2].[OneToMany_Optional_Self_Inverse4Id2], [c2].[OneToMany_Required_Inverse4Id1], [c2].[OneToMany_Required_Inverse4Id2], [c2].[OneToMany_Required_Self_Inverse4Id1], [c2].[OneToMany_Required_Self_Inverse4Id2], [c2].[OneToOne_Optional_PK_Inverse4Id1], [c2].[OneToOne_Optional_PK_Inverse4Id2], [c2].[OneToOne_Optional_Self4Id1], [c2].[OneToOne_Optional_Self4Id2], [c3].[Id1] AS [Id11], [c3].[Id2] AS [Id21], [c3].[Level3_Optional_Id1] AS [Level3_Optional_Id10], [c3].[Level3_Optional_Id2] AS [Level3_Optional_Id20], [c3].[Level3_Required_Id1] AS [Level3_Required_Id10], [c3].[Level3_Required_Id2] AS [Level3_Required_Id20], [c3].[Name] AS [Name1], [c3].[OneToMany_Optional_Inverse4Id1] AS [OneToMany_Optional_Inverse4Id10], [c3].[OneToMany_Optional_Inverse4Id2] AS [OneToMany_Optional_Inverse4Id20], [c3].[OneToMany_Optional_Self_Inverse4Id1] AS [OneToMany_Optional_Self_Inverse4Id10], [c3].[OneToMany_Optional_Self_Inverse4Id2] AS [OneToMany_Optional_Self_Inverse4Id20], [c3].[OneToMany_Required_Inverse4Id1] AS [OneToMany_Required_Inverse4Id10], [c3].[OneToMany_Required_Inverse4Id2] AS [OneToMany_Required_Inverse4Id20], [c3].[OneToMany_Required_Self_Inverse4Id1] AS [OneToMany_Required_Self_Inverse4Id10], [c3].[OneToMany_Required_Self_Inverse4Id2] AS [OneToMany_Required_Self_Inverse4Id20], [c3].[OneToOne_Optional_PK_Inverse4Id1] AS [OneToOne_Optional_PK_Inverse4Id10], [c3].[OneToOne_Optional_PK_Inverse4Id2] AS [OneToOne_Optional_PK_Inverse4Id20], [c3].[OneToOne_Optional_Self4Id1] AS [OneToOne_Optional_Self4Id10], [c3].[OneToOne_Optional_Self4Id2] AS [OneToOne_Optional_Self4Id20], [c1].[OneToMany_Required_Inverse3Id1], [c1].[OneToMany_Required_Inverse3Id2] FROM [CompositeThrees] AS [c1] - LEFT JOIN [CompositeFours] AS [c2] ON ([c1].[Id1] = [c2].[OneToMany_Optional_Inverse4Id1]) AND ([c1].[Id2] = [c2].[OneToMany_Optional_Inverse4Id2]) - LEFT JOIN [CompositeFours] AS [c3] ON ([c1].[Id1] = [c3].[OneToMany_Required_Inverse4Id1]) AND ([c1].[Id2] = [c3].[OneToMany_Required_Inverse4Id2]) - ) AS [t] ON ([c0].[Id1] = [t].[OneToMany_Required_Inverse3Id1]) AND ([c0].[Id2] = [t].[OneToMany_Required_Inverse3Id2]) + LEFT JOIN [CompositeFours] AS [c2] ON [c1].[Id1] = [c2].[OneToMany_Optional_Inverse4Id1] AND [c1].[Id2] = [c2].[OneToMany_Optional_Inverse4Id2] + LEFT JOIN [CompositeFours] AS [c3] ON [c1].[Id1] = [c3].[OneToMany_Required_Inverse4Id1] AND [c1].[Id2] = [c3].[OneToMany_Required_Inverse4Id2] + ) AS [t] ON [c0].[Id1] = [t].[OneToMany_Required_Inverse3Id1] AND [c0].[Id2] = [t].[OneToMany_Required_Inverse3Id2] LEFT JOIN ( SELECT [c4].[Name], [c4].[Id1], [c4].[Id2], [c5].[Id1] AS [Id10], [c5].[Id2] AS [Id20], [c5].[Level3_Optional_Id1], [c5].[Level3_Optional_Id2], [c5].[Level3_Required_Id1], [c5].[Level3_Required_Id2], [c5].[Name] AS [Name0], [c5].[OneToMany_Optional_Inverse4Id1], [c5].[OneToMany_Optional_Inverse4Id2], [c5].[OneToMany_Optional_Self_Inverse4Id1], [c5].[OneToMany_Optional_Self_Inverse4Id2], [c5].[OneToMany_Required_Inverse4Id1], [c5].[OneToMany_Required_Inverse4Id2], [c5].[OneToMany_Required_Self_Inverse4Id1], [c5].[OneToMany_Required_Self_Inverse4Id2], [c5].[OneToOne_Optional_PK_Inverse4Id1], [c5].[OneToOne_Optional_PK_Inverse4Id2], [c5].[OneToOne_Optional_Self4Id1], [c5].[OneToOne_Optional_Self4Id2], [c6].[Id1] AS [Id11], [c6].[Id2] AS [Id21], [c6].[Level3_Optional_Id1] AS [Level3_Optional_Id10], [c6].[Level3_Optional_Id2] AS [Level3_Optional_Id20], [c6].[Level3_Required_Id1] AS [Level3_Required_Id10], [c6].[Level3_Required_Id2] AS [Level3_Required_Id20], [c6].[Name] AS [Name1], [c6].[OneToMany_Optional_Inverse4Id1] AS [OneToMany_Optional_Inverse4Id10], [c6].[OneToMany_Optional_Inverse4Id2] AS [OneToMany_Optional_Inverse4Id20], [c6].[OneToMany_Optional_Self_Inverse4Id1] AS [OneToMany_Optional_Self_Inverse4Id10], [c6].[OneToMany_Optional_Self_Inverse4Id2] AS [OneToMany_Optional_Self_Inverse4Id20], [c6].[OneToMany_Required_Inverse4Id1] AS [OneToMany_Required_Inverse4Id10], [c6].[OneToMany_Required_Inverse4Id2] AS [OneToMany_Required_Inverse4Id20], [c6].[OneToMany_Required_Self_Inverse4Id1] AS [OneToMany_Required_Self_Inverse4Id10], [c6].[OneToMany_Required_Self_Inverse4Id2] AS [OneToMany_Required_Self_Inverse4Id20], [c6].[OneToOne_Optional_PK_Inverse4Id1] AS [OneToOne_Optional_PK_Inverse4Id10], [c6].[OneToOne_Optional_PK_Inverse4Id2] AS [OneToOne_Optional_PK_Inverse4Id20], [c6].[OneToOne_Optional_Self4Id1] AS [OneToOne_Optional_Self4Id10], [c6].[OneToOne_Optional_Self4Id2] AS [OneToOne_Optional_Self4Id20], [c4].[OneToMany_Optional_Inverse3Id1], [c4].[OneToMany_Optional_Inverse3Id2] FROM [CompositeThrees] AS [c4] - LEFT JOIN [CompositeFours] AS [c5] ON ([c4].[Id1] = [c5].[OneToMany_Required_Inverse4Id1]) AND ([c4].[Id2] = [c5].[OneToMany_Required_Inverse4Id2]) - LEFT JOIN [CompositeFours] AS [c6] ON ([c4].[Id1] = [c6].[OneToMany_Optional_Inverse4Id1]) AND ([c4].[Id2] = [c6].[OneToMany_Optional_Inverse4Id2]) - ) AS [t0] ON ([c0].[Id1] = [t0].[OneToMany_Optional_Inverse3Id1]) AND ([c0].[Id2] = [t0].[OneToMany_Optional_Inverse3Id2]) -) AS [t1] ON ([c].[Id1] = [t1].[OneToMany_Optional_Inverse2Id1]) AND ([c].[Id2] = [t1].[OneToMany_Optional_Inverse2Id2]) + LEFT JOIN [CompositeFours] AS [c5] ON [c4].[Id1] = [c5].[OneToMany_Required_Inverse4Id1] AND [c4].[Id2] = [c5].[OneToMany_Required_Inverse4Id2] + LEFT JOIN [CompositeFours] AS [c6] ON [c4].[Id1] = [c6].[OneToMany_Optional_Inverse4Id1] AND [c4].[Id2] = [c6].[OneToMany_Optional_Inverse4Id2] + ) AS [t0] ON [c0].[Id1] = [t0].[OneToMany_Optional_Inverse3Id1] AND [c0].[Id2] = [t0].[OneToMany_Optional_Inverse3Id2] +) AS [t1] ON [c].[Id1] = [t1].[OneToMany_Optional_Inverse2Id1] AND [c].[Id2] = [t1].[OneToMany_Optional_Inverse2Id2] LEFT JOIN ( SELECT [c7].[Name], [c7].[Id1], [c7].[Id2], [t3].[Name] AS [Name0], [t3].[Id1] AS [Id10], [t3].[Id2] AS [Id20], [t3].[Id10] AS [Id100], [t3].[Id20] AS [Id200], [t3].[Level3_Optional_Id1], [t3].[Level3_Optional_Id2], [t3].[Level3_Required_Id1], [t3].[Level3_Required_Id2], [t3].[Name0] AS [Name00], [t3].[OneToMany_Optional_Inverse4Id1], [t3].[OneToMany_Optional_Inverse4Id2], [t3].[OneToMany_Optional_Self_Inverse4Id1], [t3].[OneToMany_Optional_Self_Inverse4Id2], [t3].[OneToMany_Required_Inverse4Id1], [t3].[OneToMany_Required_Inverse4Id2], [t3].[OneToMany_Required_Self_Inverse4Id1], [t3].[OneToMany_Required_Self_Inverse4Id2], [t3].[OneToOne_Optional_PK_Inverse4Id1], [t3].[OneToOne_Optional_PK_Inverse4Id2], [t3].[OneToOne_Optional_Self4Id1], [t3].[OneToOne_Optional_Self4Id2], [t3].[Id11], [t3].[Id21], [t3].[Level3_Optional_Id10], [t3].[Level3_Optional_Id20], [t3].[Level3_Required_Id10], [t3].[Level3_Required_Id20], [t3].[Name1], [t3].[OneToMany_Optional_Inverse4Id10], [t3].[OneToMany_Optional_Inverse4Id20], [t3].[OneToMany_Optional_Self_Inverse4Id10], [t3].[OneToMany_Optional_Self_Inverse4Id20], [t3].[OneToMany_Required_Inverse4Id10], [t3].[OneToMany_Required_Inverse4Id20], [t3].[OneToMany_Required_Self_Inverse4Id10], [t3].[OneToMany_Required_Self_Inverse4Id20], [t3].[OneToOne_Optional_PK_Inverse4Id10], [t3].[OneToOne_Optional_PK_Inverse4Id20], [t3].[OneToOne_Optional_Self4Id10], [t3].[OneToOne_Optional_Self4Id20], [t4].[Name] AS [Name2], [t4].[Id1] AS [Id12], [t4].[Id2] AS [Id22], [t4].[Id10] AS [Id101], [t4].[Id20] AS [Id201], [t4].[Level3_Optional_Id1] AS [Level3_Optional_Id11], [t4].[Level3_Optional_Id2] AS [Level3_Optional_Id21], [t4].[Level3_Required_Id1] AS [Level3_Required_Id11], [t4].[Level3_Required_Id2] AS [Level3_Required_Id21], [t4].[Name0] AS [Name01], [t4].[OneToMany_Optional_Inverse4Id1] AS [OneToMany_Optional_Inverse4Id11], [t4].[OneToMany_Optional_Inverse4Id2] AS [OneToMany_Optional_Inverse4Id21], [t4].[OneToMany_Optional_Self_Inverse4Id1] AS [OneToMany_Optional_Self_Inverse4Id11], [t4].[OneToMany_Optional_Self_Inverse4Id2] AS [OneToMany_Optional_Self_Inverse4Id21], [t4].[OneToMany_Required_Inverse4Id1] AS [OneToMany_Required_Inverse4Id11], [t4].[OneToMany_Required_Inverse4Id2] AS [OneToMany_Required_Inverse4Id21], [t4].[OneToMany_Required_Self_Inverse4Id1] AS [OneToMany_Required_Self_Inverse4Id11], [t4].[OneToMany_Required_Self_Inverse4Id2] AS [OneToMany_Required_Self_Inverse4Id21], [t4].[OneToOne_Optional_PK_Inverse4Id1] AS [OneToOne_Optional_PK_Inverse4Id11], [t4].[OneToOne_Optional_PK_Inverse4Id2] AS [OneToOne_Optional_PK_Inverse4Id21], [t4].[OneToOne_Optional_Self4Id1] AS [OneToOne_Optional_Self4Id11], [t4].[OneToOne_Optional_Self4Id2] AS [OneToOne_Optional_Self4Id21], [t4].[Id11] AS [Id110], [t4].[Id21] AS [Id210], [t4].[Level3_Optional_Id10] AS [Level3_Optional_Id100], [t4].[Level3_Optional_Id20] AS [Level3_Optional_Id200], [t4].[Level3_Required_Id10] AS [Level3_Required_Id100], [t4].[Level3_Required_Id20] AS [Level3_Required_Id200], [t4].[Name1] AS [Name10], [t4].[OneToMany_Optional_Inverse4Id10] AS [OneToMany_Optional_Inverse4Id100], [t4].[OneToMany_Optional_Inverse4Id20] AS [OneToMany_Optional_Inverse4Id200], [t4].[OneToMany_Optional_Self_Inverse4Id10] AS [OneToMany_Optional_Self_Inverse4Id100], [t4].[OneToMany_Optional_Self_Inverse4Id20] AS [OneToMany_Optional_Self_Inverse4Id200], [t4].[OneToMany_Required_Inverse4Id10] AS [OneToMany_Required_Inverse4Id100], [t4].[OneToMany_Required_Inverse4Id20] AS [OneToMany_Required_Inverse4Id200], [t4].[OneToMany_Required_Self_Inverse4Id10] AS [OneToMany_Required_Self_Inverse4Id100], [t4].[OneToMany_Required_Self_Inverse4Id20] AS [OneToMany_Required_Self_Inverse4Id200], [t4].[OneToOne_Optional_PK_Inverse4Id10] AS [OneToOne_Optional_PK_Inverse4Id100], [t4].[OneToOne_Optional_PK_Inverse4Id20] AS [OneToOne_Optional_PK_Inverse4Id200], [t4].[OneToOne_Optional_Self4Id10] AS [OneToOne_Optional_Self4Id100], [t4].[OneToOne_Optional_Self4Id20] AS [OneToOne_Optional_Self4Id200], [c7].[OneToMany_Required_Inverse2Id1], [c7].[OneToMany_Required_Inverse2Id2] FROM [CompositeTwos] AS [c7] LEFT JOIN ( SELECT [c8].[Name], [c8].[Id1], [c8].[Id2], [c9].[Id1] AS [Id10], [c9].[Id2] AS [Id20], [c9].[Level3_Optional_Id1], [c9].[Level3_Optional_Id2], [c9].[Level3_Required_Id1], [c9].[Level3_Required_Id2], [c9].[Name] AS [Name0], [c9].[OneToMany_Optional_Inverse4Id1], [c9].[OneToMany_Optional_Inverse4Id2], [c9].[OneToMany_Optional_Self_Inverse4Id1], [c9].[OneToMany_Optional_Self_Inverse4Id2], [c9].[OneToMany_Required_Inverse4Id1], [c9].[OneToMany_Required_Inverse4Id2], [c9].[OneToMany_Required_Self_Inverse4Id1], [c9].[OneToMany_Required_Self_Inverse4Id2], [c9].[OneToOne_Optional_PK_Inverse4Id1], [c9].[OneToOne_Optional_PK_Inverse4Id2], [c9].[OneToOne_Optional_Self4Id1], [c9].[OneToOne_Optional_Self4Id2], [c10].[Id1] AS [Id11], [c10].[Id2] AS [Id21], [c10].[Level3_Optional_Id1] AS [Level3_Optional_Id10], [c10].[Level3_Optional_Id2] AS [Level3_Optional_Id20], [c10].[Level3_Required_Id1] AS [Level3_Required_Id10], [c10].[Level3_Required_Id2] AS [Level3_Required_Id20], [c10].[Name] AS [Name1], [c10].[OneToMany_Optional_Inverse4Id1] AS [OneToMany_Optional_Inverse4Id10], [c10].[OneToMany_Optional_Inverse4Id2] AS [OneToMany_Optional_Inverse4Id20], [c10].[OneToMany_Optional_Self_Inverse4Id1] AS [OneToMany_Optional_Self_Inverse4Id10], [c10].[OneToMany_Optional_Self_Inverse4Id2] AS [OneToMany_Optional_Self_Inverse4Id20], [c10].[OneToMany_Required_Inverse4Id1] AS [OneToMany_Required_Inverse4Id10], [c10].[OneToMany_Required_Inverse4Id2] AS [OneToMany_Required_Inverse4Id20], [c10].[OneToMany_Required_Self_Inverse4Id1] AS [OneToMany_Required_Self_Inverse4Id10], [c10].[OneToMany_Required_Self_Inverse4Id2] AS [OneToMany_Required_Self_Inverse4Id20], [c10].[OneToOne_Optional_PK_Inverse4Id1] AS [OneToOne_Optional_PK_Inverse4Id10], [c10].[OneToOne_Optional_PK_Inverse4Id2] AS [OneToOne_Optional_PK_Inverse4Id20], [c10].[OneToOne_Optional_Self4Id1] AS [OneToOne_Optional_Self4Id10], [c10].[OneToOne_Optional_Self4Id2] AS [OneToOne_Optional_Self4Id20], [c8].[OneToMany_Optional_Inverse3Id1], [c8].[OneToMany_Optional_Inverse3Id2] FROM [CompositeThrees] AS [c8] - LEFT JOIN [CompositeFours] AS [c9] ON ([c8].[Id1] = [c9].[OneToMany_Required_Inverse4Id1]) AND ([c8].[Id2] = [c9].[OneToMany_Required_Inverse4Id2]) - LEFT JOIN [CompositeFours] AS [c10] ON ([c8].[Id1] = [c10].[OneToMany_Optional_Inverse4Id1]) AND ([c8].[Id2] = [c10].[OneToMany_Optional_Inverse4Id2]) - ) AS [t3] ON ([c7].[Id1] = [t3].[OneToMany_Optional_Inverse3Id1]) AND ([c7].[Id2] = [t3].[OneToMany_Optional_Inverse3Id2]) + LEFT JOIN [CompositeFours] AS [c9] ON [c8].[Id1] = [c9].[OneToMany_Required_Inverse4Id1] AND [c8].[Id2] = [c9].[OneToMany_Required_Inverse4Id2] + LEFT JOIN [CompositeFours] AS [c10] ON [c8].[Id1] = [c10].[OneToMany_Optional_Inverse4Id1] AND [c8].[Id2] = [c10].[OneToMany_Optional_Inverse4Id2] + ) AS [t3] ON [c7].[Id1] = [t3].[OneToMany_Optional_Inverse3Id1] AND [c7].[Id2] = [t3].[OneToMany_Optional_Inverse3Id2] LEFT JOIN ( SELECT [c11].[Name], [c11].[Id1], [c11].[Id2], [c12].[Id1] AS [Id10], [c12].[Id2] AS [Id20], [c12].[Level3_Optional_Id1], [c12].[Level3_Optional_Id2], [c12].[Level3_Required_Id1], [c12].[Level3_Required_Id2], [c12].[Name] AS [Name0], [c12].[OneToMany_Optional_Inverse4Id1], [c12].[OneToMany_Optional_Inverse4Id2], [c12].[OneToMany_Optional_Self_Inverse4Id1], [c12].[OneToMany_Optional_Self_Inverse4Id2], [c12].[OneToMany_Required_Inverse4Id1], [c12].[OneToMany_Required_Inverse4Id2], [c12].[OneToMany_Required_Self_Inverse4Id1], [c12].[OneToMany_Required_Self_Inverse4Id2], [c12].[OneToOne_Optional_PK_Inverse4Id1], [c12].[OneToOne_Optional_PK_Inverse4Id2], [c12].[OneToOne_Optional_Self4Id1], [c12].[OneToOne_Optional_Self4Id2], [c13].[Id1] AS [Id11], [c13].[Id2] AS [Id21], [c13].[Level3_Optional_Id1] AS [Level3_Optional_Id10], [c13].[Level3_Optional_Id2] AS [Level3_Optional_Id20], [c13].[Level3_Required_Id1] AS [Level3_Required_Id10], [c13].[Level3_Required_Id2] AS [Level3_Required_Id20], [c13].[Name] AS [Name1], [c13].[OneToMany_Optional_Inverse4Id1] AS [OneToMany_Optional_Inverse4Id10], [c13].[OneToMany_Optional_Inverse4Id2] AS [OneToMany_Optional_Inverse4Id20], [c13].[OneToMany_Optional_Self_Inverse4Id1] AS [OneToMany_Optional_Self_Inverse4Id10], [c13].[OneToMany_Optional_Self_Inverse4Id2] AS [OneToMany_Optional_Self_Inverse4Id20], [c13].[OneToMany_Required_Inverse4Id1] AS [OneToMany_Required_Inverse4Id10], [c13].[OneToMany_Required_Inverse4Id2] AS [OneToMany_Required_Inverse4Id20], [c13].[OneToMany_Required_Self_Inverse4Id1] AS [OneToMany_Required_Self_Inverse4Id10], [c13].[OneToMany_Required_Self_Inverse4Id2] AS [OneToMany_Required_Self_Inverse4Id20], [c13].[OneToOne_Optional_PK_Inverse4Id1] AS [OneToOne_Optional_PK_Inverse4Id10], [c13].[OneToOne_Optional_PK_Inverse4Id2] AS [OneToOne_Optional_PK_Inverse4Id20], [c13].[OneToOne_Optional_Self4Id1] AS [OneToOne_Optional_Self4Id10], [c13].[OneToOne_Optional_Self4Id2] AS [OneToOne_Optional_Self4Id20], [c11].[OneToMany_Optional_Inverse3Id1], [c11].[OneToMany_Optional_Inverse3Id2] FROM [CompositeThrees] AS [c11] - LEFT JOIN [CompositeFours] AS [c12] ON ([c11].[Id1] = [c12].[OneToMany_Optional_Inverse4Id1]) AND ([c11].[Id2] = [c12].[OneToMany_Optional_Inverse4Id2]) - LEFT JOIN [CompositeFours] AS [c13] ON ([c11].[Id1] = [c13].[OneToMany_Required_Inverse4Id1]) AND ([c11].[Id2] = [c13].[OneToMany_Required_Inverse4Id2]) - ) AS [t4] ON ([c7].[Id1] = [t4].[OneToMany_Optional_Inverse3Id1]) AND ([c7].[Id2] = [t4].[OneToMany_Optional_Inverse3Id2]) -) AS [t2] ON ([c].[Id1] = [t2].[OneToMany_Required_Inverse2Id1]) AND ([c].[Id2] = [t2].[OneToMany_Required_Inverse2Id2]) + LEFT JOIN [CompositeFours] AS [c12] ON [c11].[Id1] = [c12].[OneToMany_Optional_Inverse4Id1] AND [c11].[Id2] = [c12].[OneToMany_Optional_Inverse4Id2] + LEFT JOIN [CompositeFours] AS [c13] ON [c11].[Id1] = [c13].[OneToMany_Required_Inverse4Id1] AND [c11].[Id2] = [c13].[OneToMany_Required_Inverse4Id2] + ) AS [t4] ON [c7].[Id1] = [t4].[OneToMany_Optional_Inverse3Id1] AND [c7].[Id2] = [t4].[OneToMany_Optional_Inverse3Id2] +) AS [t2] ON [c].[Id1] = [t2].[OneToMany_Required_Inverse2Id1] AND [c].[Id2] = [t2].[OneToMany_Required_Inverse2Id2] ORDER BY [c].[Id1], [c].[Id2], [t1].[Id1], [t1].[Id2], [t1].[Id10], [t1].[Id20], [t1].[Id100], [t1].[Id200], [t1].[Id11], [t1].[Id21], [t1].[Id12], [t1].[Id22], [t1].[Id101], [t1].[Id201], [t1].[Id110], [t1].[Id210], [t2].[Id1], [t2].[Id2], [t2].[Id10], [t2].[Id20], [t2].[Id100], [t2].[Id200], [t2].[Id11], [t2].[Id21], [t2].[Id12], [t2].[Id22], [t2].[Id101], [t2].[Id201], [t2].[Id110]"); } @@ -138,32 +138,32 @@ FROM [CompositeTwos] AS [c0] LEFT JOIN ( SELECT [c1].[Id1], [c1].[Id2], [c2].[Id1] AS [Id10], [c2].[Id2] AS [Id20], [c2].[Level3_Optional_Id1], [c2].[Level3_Optional_Id2], [c2].[Level3_Required_Id1], [c2].[Level3_Required_Id2], [c2].[Name], [c2].[OneToMany_Optional_Inverse4Id1], [c2].[OneToMany_Optional_Inverse4Id2], [c2].[OneToMany_Optional_Self_Inverse4Id1], [c2].[OneToMany_Optional_Self_Inverse4Id2], [c2].[OneToMany_Required_Inverse4Id1], [c2].[OneToMany_Required_Inverse4Id2], [c2].[OneToMany_Required_Self_Inverse4Id1], [c2].[OneToMany_Required_Self_Inverse4Id2], [c2].[OneToOne_Optional_PK_Inverse4Id1], [c2].[OneToOne_Optional_PK_Inverse4Id2], [c2].[OneToOne_Optional_Self4Id1], [c2].[OneToOne_Optional_Self4Id2], [c3].[Id1] AS [Id11], [c3].[Id2] AS [Id21], [c3].[Level3_Optional_Id1] AS [Level3_Optional_Id10], [c3].[Level3_Optional_Id2] AS [Level3_Optional_Id20], [c3].[Level3_Required_Id1] AS [Level3_Required_Id10], [c3].[Level3_Required_Id2] AS [Level3_Required_Id20], [c3].[Name] AS [Name0], [c3].[OneToMany_Optional_Inverse4Id1] AS [OneToMany_Optional_Inverse4Id10], [c3].[OneToMany_Optional_Inverse4Id2] AS [OneToMany_Optional_Inverse4Id20], [c3].[OneToMany_Optional_Self_Inverse4Id1] AS [OneToMany_Optional_Self_Inverse4Id10], [c3].[OneToMany_Optional_Self_Inverse4Id2] AS [OneToMany_Optional_Self_Inverse4Id20], [c3].[OneToMany_Required_Inverse4Id1] AS [OneToMany_Required_Inverse4Id10], [c3].[OneToMany_Required_Inverse4Id2] AS [OneToMany_Required_Inverse4Id20], [c3].[OneToMany_Required_Self_Inverse4Id1] AS [OneToMany_Required_Self_Inverse4Id10], [c3].[OneToMany_Required_Self_Inverse4Id2] AS [OneToMany_Required_Self_Inverse4Id20], [c3].[OneToOne_Optional_PK_Inverse4Id1] AS [OneToOne_Optional_PK_Inverse4Id10], [c3].[OneToOne_Optional_PK_Inverse4Id2] AS [OneToOne_Optional_PK_Inverse4Id20], [c3].[OneToOne_Optional_Self4Id1] AS [OneToOne_Optional_Self4Id10], [c3].[OneToOne_Optional_Self4Id2] AS [OneToOne_Optional_Self4Id20], [c1].[OneToMany_Required_Inverse3Id1], [c1].[OneToMany_Required_Inverse3Id2] FROM [CompositeThrees] AS [c1] - LEFT JOIN [CompositeFours] AS [c2] ON ([c1].[Id1] = [c2].[OneToMany_Optional_Inverse4Id1]) AND ([c1].[Id2] = [c2].[OneToMany_Optional_Inverse4Id2]) - LEFT JOIN [CompositeFours] AS [c3] ON ([c1].[Id1] = [c3].[OneToMany_Required_Inverse4Id1]) AND ([c1].[Id2] = [c3].[OneToMany_Required_Inverse4Id2]) - ) AS [t] ON ([c0].[Id1] = [t].[OneToMany_Required_Inverse3Id1]) AND ([c0].[Id2] = [t].[OneToMany_Required_Inverse3Id2]) + LEFT JOIN [CompositeFours] AS [c2] ON [c1].[Id1] = [c2].[OneToMany_Optional_Inverse4Id1] AND [c1].[Id2] = [c2].[OneToMany_Optional_Inverse4Id2] + LEFT JOIN [CompositeFours] AS [c3] ON [c1].[Id1] = [c3].[OneToMany_Required_Inverse4Id1] AND [c1].[Id2] = [c3].[OneToMany_Required_Inverse4Id2] + ) AS [t] ON [c0].[Id1] = [t].[OneToMany_Required_Inverse3Id1] AND [c0].[Id2] = [t].[OneToMany_Required_Inverse3Id2] LEFT JOIN ( SELECT [c4].[Name], [c4].[Id1], [c4].[Id2], [c5].[Id1] AS [Id10], [c5].[Id2] AS [Id20], [c5].[Level3_Optional_Id1], [c5].[Level3_Optional_Id2], [c5].[Level3_Required_Id1], [c5].[Level3_Required_Id2], [c5].[Name] AS [Name0], [c5].[OneToMany_Optional_Inverse4Id1], [c5].[OneToMany_Optional_Inverse4Id2], [c5].[OneToMany_Optional_Self_Inverse4Id1], [c5].[OneToMany_Optional_Self_Inverse4Id2], [c5].[OneToMany_Required_Inverse4Id1], [c5].[OneToMany_Required_Inverse4Id2], [c5].[OneToMany_Required_Self_Inverse4Id1], [c5].[OneToMany_Required_Self_Inverse4Id2], [c5].[OneToOne_Optional_PK_Inverse4Id1], [c5].[OneToOne_Optional_PK_Inverse4Id2], [c5].[OneToOne_Optional_Self4Id1], [c5].[OneToOne_Optional_Self4Id2], [c6].[Id1] AS [Id11], [c6].[Id2] AS [Id21], [c6].[Level3_Optional_Id1] AS [Level3_Optional_Id10], [c6].[Level3_Optional_Id2] AS [Level3_Optional_Id20], [c6].[Level3_Required_Id1] AS [Level3_Required_Id10], [c6].[Level3_Required_Id2] AS [Level3_Required_Id20], [c6].[Name] AS [Name1], [c6].[OneToMany_Optional_Inverse4Id1] AS [OneToMany_Optional_Inverse4Id10], [c6].[OneToMany_Optional_Inverse4Id2] AS [OneToMany_Optional_Inverse4Id20], [c6].[OneToMany_Optional_Self_Inverse4Id1] AS [OneToMany_Optional_Self_Inverse4Id10], [c6].[OneToMany_Optional_Self_Inverse4Id2] AS [OneToMany_Optional_Self_Inverse4Id20], [c6].[OneToMany_Required_Inverse4Id1] AS [OneToMany_Required_Inverse4Id10], [c6].[OneToMany_Required_Inverse4Id2] AS [OneToMany_Required_Inverse4Id20], [c6].[OneToMany_Required_Self_Inverse4Id1] AS [OneToMany_Required_Self_Inverse4Id10], [c6].[OneToMany_Required_Self_Inverse4Id2] AS [OneToMany_Required_Self_Inverse4Id20], [c6].[OneToOne_Optional_PK_Inverse4Id1] AS [OneToOne_Optional_PK_Inverse4Id10], [c6].[OneToOne_Optional_PK_Inverse4Id2] AS [OneToOne_Optional_PK_Inverse4Id20], [c6].[OneToOne_Optional_Self4Id1] AS [OneToOne_Optional_Self4Id10], [c6].[OneToOne_Optional_Self4Id2] AS [OneToOne_Optional_Self4Id20], [c4].[OneToMany_Optional_Inverse3Id1], [c4].[OneToMany_Optional_Inverse3Id2] FROM [CompositeThrees] AS [c4] - LEFT JOIN [CompositeFours] AS [c5] ON ([c4].[Id1] = [c5].[OneToMany_Required_Inverse4Id1]) AND ([c4].[Id2] = [c5].[OneToMany_Required_Inverse4Id2]) - LEFT JOIN [CompositeFours] AS [c6] ON ([c4].[Id1] = [c6].[OneToMany_Optional_Inverse4Id1]) AND ([c4].[Id2] = [c6].[OneToMany_Optional_Inverse4Id2]) - ) AS [t0] ON ([c0].[Id1] = [t0].[OneToMany_Optional_Inverse3Id1]) AND ([c0].[Id2] = [t0].[OneToMany_Optional_Inverse3Id2]) -) AS [t1] ON ([c].[Id1] = [t1].[OneToMany_Optional_Inverse2Id1]) AND ([c].[Id2] = [t1].[OneToMany_Optional_Inverse2Id2]) + LEFT JOIN [CompositeFours] AS [c5] ON [c4].[Id1] = [c5].[OneToMany_Required_Inverse4Id1] AND [c4].[Id2] = [c5].[OneToMany_Required_Inverse4Id2] + LEFT JOIN [CompositeFours] AS [c6] ON [c4].[Id1] = [c6].[OneToMany_Optional_Inverse4Id1] AND [c4].[Id2] = [c6].[OneToMany_Optional_Inverse4Id2] + ) AS [t0] ON [c0].[Id1] = [t0].[OneToMany_Optional_Inverse3Id1] AND [c0].[Id2] = [t0].[OneToMany_Optional_Inverse3Id2] +) AS [t1] ON [c].[Id1] = [t1].[OneToMany_Optional_Inverse2Id1] AND [c].[Id2] = [t1].[OneToMany_Optional_Inverse2Id2] LEFT JOIN ( SELECT [c7].[Name], [c7].[Id1], [c7].[Id2], [t3].[Name] AS [Name0], [t3].[Id1] AS [Id10], [t3].[Id2] AS [Id20], [t3].[Id10] AS [Id100], [t3].[Id20] AS [Id200], [t3].[Level3_Optional_Id1], [t3].[Level3_Optional_Id2], [t3].[Level3_Required_Id1], [t3].[Level3_Required_Id2], [t3].[Name0] AS [Name00], [t3].[OneToMany_Optional_Inverse4Id1], [t3].[OneToMany_Optional_Inverse4Id2], [t3].[OneToMany_Optional_Self_Inverse4Id1], [t3].[OneToMany_Optional_Self_Inverse4Id2], [t3].[OneToMany_Required_Inverse4Id1], [t3].[OneToMany_Required_Inverse4Id2], [t3].[OneToMany_Required_Self_Inverse4Id1], [t3].[OneToMany_Required_Self_Inverse4Id2], [t3].[OneToOne_Optional_PK_Inverse4Id1], [t3].[OneToOne_Optional_PK_Inverse4Id2], [t3].[OneToOne_Optional_Self4Id1], [t3].[OneToOne_Optional_Self4Id2], [t3].[Id11], [t3].[Id21], [t3].[Level3_Optional_Id10], [t3].[Level3_Optional_Id20], [t3].[Level3_Required_Id10], [t3].[Level3_Required_Id20], [t3].[Name1], [t3].[OneToMany_Optional_Inverse4Id10], [t3].[OneToMany_Optional_Inverse4Id20], [t3].[OneToMany_Optional_Self_Inverse4Id10], [t3].[OneToMany_Optional_Self_Inverse4Id20], [t3].[OneToMany_Required_Inverse4Id10], [t3].[OneToMany_Required_Inverse4Id20], [t3].[OneToMany_Required_Self_Inverse4Id10], [t3].[OneToMany_Required_Self_Inverse4Id20], [t3].[OneToOne_Optional_PK_Inverse4Id10], [t3].[OneToOne_Optional_PK_Inverse4Id20], [t3].[OneToOne_Optional_Self4Id10], [t3].[OneToOne_Optional_Self4Id20], [t4].[Name] AS [Name2], [t4].[Id1] AS [Id12], [t4].[Id2] AS [Id22], [t4].[Id10] AS [Id101], [t4].[Id20] AS [Id201], [t4].[Level3_Optional_Id1] AS [Level3_Optional_Id11], [t4].[Level3_Optional_Id2] AS [Level3_Optional_Id21], [t4].[Level3_Required_Id1] AS [Level3_Required_Id11], [t4].[Level3_Required_Id2] AS [Level3_Required_Id21], [t4].[Name0] AS [Name01], [t4].[OneToMany_Optional_Inverse4Id1] AS [OneToMany_Optional_Inverse4Id11], [t4].[OneToMany_Optional_Inverse4Id2] AS [OneToMany_Optional_Inverse4Id21], [t4].[OneToMany_Optional_Self_Inverse4Id1] AS [OneToMany_Optional_Self_Inverse4Id11], [t4].[OneToMany_Optional_Self_Inverse4Id2] AS [OneToMany_Optional_Self_Inverse4Id21], [t4].[OneToMany_Required_Inverse4Id1] AS [OneToMany_Required_Inverse4Id11], [t4].[OneToMany_Required_Inverse4Id2] AS [OneToMany_Required_Inverse4Id21], [t4].[OneToMany_Required_Self_Inverse4Id1] AS [OneToMany_Required_Self_Inverse4Id11], [t4].[OneToMany_Required_Self_Inverse4Id2] AS [OneToMany_Required_Self_Inverse4Id21], [t4].[OneToOne_Optional_PK_Inverse4Id1] AS [OneToOne_Optional_PK_Inverse4Id11], [t4].[OneToOne_Optional_PK_Inverse4Id2] AS [OneToOne_Optional_PK_Inverse4Id21], [t4].[OneToOne_Optional_Self4Id1] AS [OneToOne_Optional_Self4Id11], [t4].[OneToOne_Optional_Self4Id2] AS [OneToOne_Optional_Self4Id21], [t4].[Id11] AS [Id110], [t4].[Id21] AS [Id210], [t4].[Level3_Optional_Id10] AS [Level3_Optional_Id100], [t4].[Level3_Optional_Id20] AS [Level3_Optional_Id200], [t4].[Level3_Required_Id10] AS [Level3_Required_Id100], [t4].[Level3_Required_Id20] AS [Level3_Required_Id200], [t4].[Name1] AS [Name10], [t4].[OneToMany_Optional_Inverse4Id10] AS [OneToMany_Optional_Inverse4Id100], [t4].[OneToMany_Optional_Inverse4Id20] AS [OneToMany_Optional_Inverse4Id200], [t4].[OneToMany_Optional_Self_Inverse4Id10] AS [OneToMany_Optional_Self_Inverse4Id100], [t4].[OneToMany_Optional_Self_Inverse4Id20] AS [OneToMany_Optional_Self_Inverse4Id200], [t4].[OneToMany_Required_Inverse4Id10] AS [OneToMany_Required_Inverse4Id100], [t4].[OneToMany_Required_Inverse4Id20] AS [OneToMany_Required_Inverse4Id200], [t4].[OneToMany_Required_Self_Inverse4Id10] AS [OneToMany_Required_Self_Inverse4Id100], [t4].[OneToMany_Required_Self_Inverse4Id20] AS [OneToMany_Required_Self_Inverse4Id200], [t4].[OneToOne_Optional_PK_Inverse4Id10] AS [OneToOne_Optional_PK_Inverse4Id100], [t4].[OneToOne_Optional_PK_Inverse4Id20] AS [OneToOne_Optional_PK_Inverse4Id200], [t4].[OneToOne_Optional_Self4Id10] AS [OneToOne_Optional_Self4Id100], [t4].[OneToOne_Optional_Self4Id20] AS [OneToOne_Optional_Self4Id200], CAST(LEN([c7].[Name]) AS int) AS [c], [t4].[c] AS [c0], [c7].[OneToMany_Required_Inverse2Id1], [c7].[OneToMany_Required_Inverse2Id2] FROM [CompositeTwos] AS [c7] LEFT JOIN ( SELECT [c8].[Name], [c8].[Id1], [c8].[Id2], [c9].[Id1] AS [Id10], [c9].[Id2] AS [Id20], [c9].[Level3_Optional_Id1], [c9].[Level3_Optional_Id2], [c9].[Level3_Required_Id1], [c9].[Level3_Required_Id2], [c9].[Name] AS [Name0], [c9].[OneToMany_Optional_Inverse4Id1], [c9].[OneToMany_Optional_Inverse4Id2], [c9].[OneToMany_Optional_Self_Inverse4Id1], [c9].[OneToMany_Optional_Self_Inverse4Id2], [c9].[OneToMany_Required_Inverse4Id1], [c9].[OneToMany_Required_Inverse4Id2], [c9].[OneToMany_Required_Self_Inverse4Id1], [c9].[OneToMany_Required_Self_Inverse4Id2], [c9].[OneToOne_Optional_PK_Inverse4Id1], [c9].[OneToOne_Optional_PK_Inverse4Id2], [c9].[OneToOne_Optional_Self4Id1], [c9].[OneToOne_Optional_Self4Id2], [c10].[Id1] AS [Id11], [c10].[Id2] AS [Id21], [c10].[Level3_Optional_Id1] AS [Level3_Optional_Id10], [c10].[Level3_Optional_Id2] AS [Level3_Optional_Id20], [c10].[Level3_Required_Id1] AS [Level3_Required_Id10], [c10].[Level3_Required_Id2] AS [Level3_Required_Id20], [c10].[Name] AS [Name1], [c10].[OneToMany_Optional_Inverse4Id1] AS [OneToMany_Optional_Inverse4Id10], [c10].[OneToMany_Optional_Inverse4Id2] AS [OneToMany_Optional_Inverse4Id20], [c10].[OneToMany_Optional_Self_Inverse4Id1] AS [OneToMany_Optional_Self_Inverse4Id10], [c10].[OneToMany_Optional_Self_Inverse4Id2] AS [OneToMany_Optional_Self_Inverse4Id20], [c10].[OneToMany_Required_Inverse4Id1] AS [OneToMany_Required_Inverse4Id10], [c10].[OneToMany_Required_Inverse4Id2] AS [OneToMany_Required_Inverse4Id20], [c10].[OneToMany_Required_Self_Inverse4Id1] AS [OneToMany_Required_Self_Inverse4Id10], [c10].[OneToMany_Required_Self_Inverse4Id2] AS [OneToMany_Required_Self_Inverse4Id20], [c10].[OneToOne_Optional_PK_Inverse4Id1] AS [OneToOne_Optional_PK_Inverse4Id10], [c10].[OneToOne_Optional_PK_Inverse4Id2] AS [OneToOne_Optional_PK_Inverse4Id20], [c10].[OneToOne_Optional_Self4Id1] AS [OneToOne_Optional_Self4Id10], [c10].[OneToOne_Optional_Self4Id2] AS [OneToOne_Optional_Self4Id20], [c8].[OneToMany_Optional_Inverse3Id1], [c8].[OneToMany_Optional_Inverse3Id2] FROM [CompositeThrees] AS [c8] - LEFT JOIN [CompositeFours] AS [c9] ON ([c8].[Id1] = [c9].[OneToMany_Required_Inverse4Id1]) AND ([c8].[Id2] = [c9].[OneToMany_Required_Inverse4Id2]) - LEFT JOIN [CompositeFours] AS [c10] ON ([c8].[Id1] = [c10].[OneToMany_Optional_Inverse4Id1]) AND ([c8].[Id2] = [c10].[OneToMany_Optional_Inverse4Id2]) - ) AS [t3] ON ([c7].[Id1] = [t3].[OneToMany_Optional_Inverse3Id1]) AND ([c7].[Id2] = [t3].[OneToMany_Optional_Inverse3Id2]) + LEFT JOIN [CompositeFours] AS [c9] ON [c8].[Id1] = [c9].[OneToMany_Required_Inverse4Id1] AND [c8].[Id2] = [c9].[OneToMany_Required_Inverse4Id2] + LEFT JOIN [CompositeFours] AS [c10] ON [c8].[Id1] = [c10].[OneToMany_Optional_Inverse4Id1] AND [c8].[Id2] = [c10].[OneToMany_Optional_Inverse4Id2] + ) AS [t3] ON [c7].[Id1] = [t3].[OneToMany_Optional_Inverse3Id1] AND [c7].[Id2] = [t3].[OneToMany_Optional_Inverse3Id2] LEFT JOIN ( SELECT [c11].[Name], [c11].[Id1], [c11].[Id2], [c12].[Id1] AS [Id10], [c12].[Id2] AS [Id20], [c12].[Level3_Optional_Id1], [c12].[Level3_Optional_Id2], [c12].[Level3_Required_Id1], [c12].[Level3_Required_Id2], [c12].[Name] AS [Name0], [c12].[OneToMany_Optional_Inverse4Id1], [c12].[OneToMany_Optional_Inverse4Id2], [c12].[OneToMany_Optional_Self_Inverse4Id1], [c12].[OneToMany_Optional_Self_Inverse4Id2], [c12].[OneToMany_Required_Inverse4Id1], [c12].[OneToMany_Required_Inverse4Id2], [c12].[OneToMany_Required_Self_Inverse4Id1], [c12].[OneToMany_Required_Self_Inverse4Id2], [c12].[OneToOne_Optional_PK_Inverse4Id1], [c12].[OneToOne_Optional_PK_Inverse4Id2], [c12].[OneToOne_Optional_Self4Id1], [c12].[OneToOne_Optional_Self4Id2], [c13].[Id1] AS [Id11], [c13].[Id2] AS [Id21], [c13].[Level3_Optional_Id1] AS [Level3_Optional_Id10], [c13].[Level3_Optional_Id2] AS [Level3_Optional_Id20], [c13].[Level3_Required_Id1] AS [Level3_Required_Id10], [c13].[Level3_Required_Id2] AS [Level3_Required_Id20], [c13].[Name] AS [Name1], [c13].[OneToMany_Optional_Inverse4Id1] AS [OneToMany_Optional_Inverse4Id10], [c13].[OneToMany_Optional_Inverse4Id2] AS [OneToMany_Optional_Inverse4Id20], [c13].[OneToMany_Optional_Self_Inverse4Id1] AS [OneToMany_Optional_Self_Inverse4Id10], [c13].[OneToMany_Optional_Self_Inverse4Id2] AS [OneToMany_Optional_Self_Inverse4Id20], [c13].[OneToMany_Required_Inverse4Id1] AS [OneToMany_Required_Inverse4Id10], [c13].[OneToMany_Required_Inverse4Id2] AS [OneToMany_Required_Inverse4Id20], [c13].[OneToMany_Required_Self_Inverse4Id1] AS [OneToMany_Required_Self_Inverse4Id10], [c13].[OneToMany_Required_Self_Inverse4Id2] AS [OneToMany_Required_Self_Inverse4Id20], [c13].[OneToOne_Optional_PK_Inverse4Id1] AS [OneToOne_Optional_PK_Inverse4Id10], [c13].[OneToOne_Optional_PK_Inverse4Id2] AS [OneToOne_Optional_PK_Inverse4Id20], [c13].[OneToOne_Optional_Self4Id1] AS [OneToOne_Optional_Self4Id10], [c13].[OneToOne_Optional_Self4Id2] AS [OneToOne_Optional_Self4Id20], [c13].[Id1] + CAST([c13].[Id2] AS nvarchar(450)) AS [c], [c11].[OneToMany_Optional_Inverse3Id1], [c11].[OneToMany_Optional_Inverse3Id2] FROM [CompositeThrees] AS [c11] - LEFT JOIN [CompositeFours] AS [c12] ON ([c11].[Id1] = [c12].[OneToMany_Optional_Inverse4Id1]) AND ([c11].[Id2] = [c12].[OneToMany_Optional_Inverse4Id2]) - LEFT JOIN [CompositeFours] AS [c13] ON ([c11].[Id1] = [c13].[OneToMany_Required_Inverse4Id1]) AND ([c11].[Id2] = [c13].[OneToMany_Required_Inverse4Id2]) - ) AS [t4] ON ([c7].[Id1] = [t4].[OneToMany_Optional_Inverse3Id1]) AND ([c7].[Id2] = [t4].[OneToMany_Optional_Inverse3Id2]) -) AS [t2] ON ([c].[Id1] = [t2].[OneToMany_Required_Inverse2Id1]) AND ([c].[Id2] = [t2].[OneToMany_Required_Inverse2Id2]) + LEFT JOIN [CompositeFours] AS [c12] ON [c11].[Id1] = [c12].[OneToMany_Optional_Inverse4Id1] AND [c11].[Id2] = [c12].[OneToMany_Optional_Inverse4Id2] + LEFT JOIN [CompositeFours] AS [c13] ON [c11].[Id1] = [c13].[OneToMany_Required_Inverse4Id1] AND [c11].[Id2] = [c13].[OneToMany_Required_Inverse4Id2] + ) AS [t4] ON [c7].[Id1] = [t4].[OneToMany_Optional_Inverse3Id1] AND [c7].[Id2] = [t4].[OneToMany_Optional_Inverse3Id2] +) AS [t2] ON [c].[Id1] = [t2].[OneToMany_Required_Inverse2Id1] AND [c].[Id2] = [t2].[OneToMany_Required_Inverse2Id2] ORDER BY [c].[Name], [c].[Id1], [c].[Id2], [t1].[Id1], [t1].[Id2], [t1].[Id20] DESC, [t1].[Id10] DESC, [t1].[Id100], [t1].[Id200], [t1].[Id11], [t1].[Id21], [t1].[Id12], [t1].[Id22], [t1].[Id101], [t1].[Id201], [t1].[Id110], [t1].[Id210], [t2].[c], [t2].[Id1], [t2].[Id2], [t2].[Id10], [t2].[Id20], [t2].[Id100], [t2].[Id200], [t2].[Id11], [t2].[Id21], [t2].[Id12], [t2].[Id22], [t2].[Id101], [t2].[Id201], [t2].[c0] DESC, [t2].[Id110]"); } diff --git a/test/EFCore.SqlServer.FunctionalTests/Query/CompositeKeysSplitQuerySqlServerTest.cs b/test/EFCore.SqlServer.FunctionalTests/Query/CompositeKeysSplitQuerySqlServerTest.cs index 39767153cbd..8747f5bccb3 100644 --- a/test/EFCore.SqlServer.FunctionalTests/Query/CompositeKeysSplitQuerySqlServerTest.cs +++ b/test/EFCore.SqlServer.FunctionalTests/Query/CompositeKeysSplitQuerySqlServerTest.cs @@ -31,13 +31,13 @@ FROM [CompositeOnes] AS [c] // @"SELECT [c0].[Name], [c].[Id1], [c].[Id2], [c0].[Id1], [c0].[Id2] FROM [CompositeOnes] AS [c] -INNER JOIN [CompositeTwos] AS [c0] ON ([c].[Id1] = [c0].[OneToMany_Optional_Inverse2Id1]) AND ([c].[Id2] = [c0].[OneToMany_Optional_Inverse2Id2]) +INNER JOIN [CompositeTwos] AS [c0] ON [c].[Id1] = [c0].[OneToMany_Optional_Inverse2Id1] AND [c].[Id2] = [c0].[OneToMany_Optional_Inverse2Id2] ORDER BY [c].[Id2], [c].[Id1], [c0].[Id2], [c0].[Id1]", // @"SELECT [c1].[Id1], [c1].[Id2], [c1].[Level2_Optional_Id1], [c1].[Level2_Optional_Id2], [c1].[Level2_Required_Id1], [c1].[Level2_Required_Id2], [c1].[Name], [c1].[OneToMany_Optional_Inverse3Id1], [c1].[OneToMany_Optional_Inverse3Id2], [c1].[OneToMany_Optional_Self_Inverse3Id1], [c1].[OneToMany_Optional_Self_Inverse3Id2], [c1].[OneToMany_Required_Inverse3Id1], [c1].[OneToMany_Required_Inverse3Id2], [c1].[OneToMany_Required_Self_Inverse3Id1], [c1].[OneToMany_Required_Self_Inverse3Id2], [c1].[OneToOne_Optional_PK_Inverse3Id1], [c1].[OneToOne_Optional_PK_Inverse3Id2], [c1].[OneToOne_Optional_Self3Id1], [c1].[OneToOne_Optional_Self3Id2], [c].[Id1], [c].[Id2], [c0].[Id1], [c0].[Id2] FROM [CompositeOnes] AS [c] -INNER JOIN [CompositeTwos] AS [c0] ON ([c].[Id1] = [c0].[OneToMany_Optional_Inverse2Id1]) AND ([c].[Id2] = [c0].[OneToMany_Optional_Inverse2Id2]) -INNER JOIN [CompositeThrees] AS [c1] ON ([c0].[Id1] = [c1].[OneToMany_Required_Inverse3Id1]) AND ([c0].[Id2] = [c1].[OneToMany_Required_Inverse3Id2]) +INNER JOIN [CompositeTwos] AS [c0] ON [c].[Id1] = [c0].[OneToMany_Optional_Inverse2Id1] AND [c].[Id2] = [c0].[OneToMany_Optional_Inverse2Id2] +INNER JOIN [CompositeThrees] AS [c1] ON [c0].[Id1] = [c1].[OneToMany_Required_Inverse3Id1] AND [c0].[Id2] = [c1].[OneToMany_Required_Inverse3Id2] ORDER BY [c].[Id2], [c].[Id1], [c0].[Id2], [c0].[Id1], [c1].[Id2] DESC"); } @@ -52,78 +52,78 @@ FROM [CompositeOnes] AS [c] // @"SELECT [c0].[Name], [c].[Id1], [c].[Id2], [c0].[Id1], [c0].[Id2] FROM [CompositeOnes] AS [c] -INNER JOIN [CompositeTwos] AS [c0] ON ([c].[Id1] = [c0].[OneToMany_Optional_Inverse2Id1]) AND ([c].[Id2] = [c0].[OneToMany_Optional_Inverse2Id2]) +INNER JOIN [CompositeTwos] AS [c0] ON [c].[Id1] = [c0].[OneToMany_Optional_Inverse2Id1] AND [c].[Id2] = [c0].[OneToMany_Optional_Inverse2Id2] ORDER BY [c].[Id1], [c].[Id2], [c0].[Id1], [c0].[Id2]", // @"SELECT [c1].[Name], [c].[Id1], [c].[Id2], [c0].[Id1], [c0].[Id2], [c1].[Id1], [c1].[Id2] FROM [CompositeOnes] AS [c] -INNER JOIN [CompositeTwos] AS [c0] ON ([c].[Id1] = [c0].[OneToMany_Optional_Inverse2Id1]) AND ([c].[Id2] = [c0].[OneToMany_Optional_Inverse2Id2]) -INNER JOIN [CompositeThrees] AS [c1] ON ([c0].[Id1] = [c1].[OneToMany_Required_Inverse3Id1]) AND ([c0].[Id2] = [c1].[OneToMany_Required_Inverse3Id2]) +INNER JOIN [CompositeTwos] AS [c0] ON [c].[Id1] = [c0].[OneToMany_Optional_Inverse2Id1] AND [c].[Id2] = [c0].[OneToMany_Optional_Inverse2Id2] +INNER JOIN [CompositeThrees] AS [c1] ON [c0].[Id1] = [c1].[OneToMany_Required_Inverse3Id1] AND [c0].[Id2] = [c1].[OneToMany_Required_Inverse3Id2] ORDER BY [c].[Id1], [c].[Id2], [c0].[Id1], [c0].[Id2], [c1].[Id1], [c1].[Id2]", // @"SELECT [c1].[Name], [c].[Id1], [c].[Id2], [c0].[Id1], [c0].[Id2], [c1].[Id1], [c1].[Id2] FROM [CompositeOnes] AS [c] -INNER JOIN [CompositeTwos] AS [c0] ON ([c].[Id1] = [c0].[OneToMany_Optional_Inverse2Id1]) AND ([c].[Id2] = [c0].[OneToMany_Optional_Inverse2Id2]) -INNER JOIN [CompositeThrees] AS [c1] ON ([c0].[Id1] = [c1].[OneToMany_Optional_Inverse3Id1]) AND ([c0].[Id2] = [c1].[OneToMany_Optional_Inverse3Id2]) +INNER JOIN [CompositeTwos] AS [c0] ON [c].[Id1] = [c0].[OneToMany_Optional_Inverse2Id1] AND [c].[Id2] = [c0].[OneToMany_Optional_Inverse2Id2] +INNER JOIN [CompositeThrees] AS [c1] ON [c0].[Id1] = [c1].[OneToMany_Optional_Inverse3Id1] AND [c0].[Id2] = [c1].[OneToMany_Optional_Inverse3Id2] ORDER BY [c].[Id1], [c].[Id2], [c0].[Id1], [c0].[Id2], [c1].[Id1], [c1].[Id2]", // @"SELECT [c2].[Id1], [c2].[Id2], [c2].[Level3_Optional_Id1], [c2].[Level3_Optional_Id2], [c2].[Level3_Required_Id1], [c2].[Level3_Required_Id2], [c2].[Name], [c2].[OneToMany_Optional_Inverse4Id1], [c2].[OneToMany_Optional_Inverse4Id2], [c2].[OneToMany_Optional_Self_Inverse4Id1], [c2].[OneToMany_Optional_Self_Inverse4Id2], [c2].[OneToMany_Required_Inverse4Id1], [c2].[OneToMany_Required_Inverse4Id2], [c2].[OneToMany_Required_Self_Inverse4Id1], [c2].[OneToMany_Required_Self_Inverse4Id2], [c2].[OneToOne_Optional_PK_Inverse4Id1], [c2].[OneToOne_Optional_PK_Inverse4Id2], [c2].[OneToOne_Optional_Self4Id1], [c2].[OneToOne_Optional_Self4Id2], [c].[Id1], [c].[Id2], [c0].[Id1], [c0].[Id2], [c1].[Id1], [c1].[Id2] FROM [CompositeOnes] AS [c] -INNER JOIN [CompositeTwos] AS [c0] ON ([c].[Id1] = [c0].[OneToMany_Optional_Inverse2Id1]) AND ([c].[Id2] = [c0].[OneToMany_Optional_Inverse2Id2]) -INNER JOIN [CompositeThrees] AS [c1] ON ([c0].[Id1] = [c1].[OneToMany_Optional_Inverse3Id1]) AND ([c0].[Id2] = [c1].[OneToMany_Optional_Inverse3Id2]) -INNER JOIN [CompositeFours] AS [c2] ON ([c1].[Id1] = [c2].[OneToMany_Required_Inverse4Id1]) AND ([c1].[Id2] = [c2].[OneToMany_Required_Inverse4Id2]) +INNER JOIN [CompositeTwos] AS [c0] ON [c].[Id1] = [c0].[OneToMany_Optional_Inverse2Id1] AND [c].[Id2] = [c0].[OneToMany_Optional_Inverse2Id2] +INNER JOIN [CompositeThrees] AS [c1] ON [c0].[Id1] = [c1].[OneToMany_Optional_Inverse3Id1] AND [c0].[Id2] = [c1].[OneToMany_Optional_Inverse3Id2] +INNER JOIN [CompositeFours] AS [c2] ON [c1].[Id1] = [c2].[OneToMany_Required_Inverse4Id1] AND [c1].[Id2] = [c2].[OneToMany_Required_Inverse4Id2] ORDER BY [c].[Id1], [c].[Id2], [c0].[Id1], [c0].[Id2], [c1].[Id1], [c1].[Id2]", // @"SELECT [c2].[Id1], [c2].[Id2], [c2].[Level3_Optional_Id1], [c2].[Level3_Optional_Id2], [c2].[Level3_Required_Id1], [c2].[Level3_Required_Id2], [c2].[Name], [c2].[OneToMany_Optional_Inverse4Id1], [c2].[OneToMany_Optional_Inverse4Id2], [c2].[OneToMany_Optional_Self_Inverse4Id1], [c2].[OneToMany_Optional_Self_Inverse4Id2], [c2].[OneToMany_Required_Inverse4Id1], [c2].[OneToMany_Required_Inverse4Id2], [c2].[OneToMany_Required_Self_Inverse4Id1], [c2].[OneToMany_Required_Self_Inverse4Id2], [c2].[OneToOne_Optional_PK_Inverse4Id1], [c2].[OneToOne_Optional_PK_Inverse4Id2], [c2].[OneToOne_Optional_Self4Id1], [c2].[OneToOne_Optional_Self4Id2], [c].[Id1], [c].[Id2], [c0].[Id1], [c0].[Id2], [c1].[Id1], [c1].[Id2] FROM [CompositeOnes] AS [c] -INNER JOIN [CompositeTwos] AS [c0] ON ([c].[Id1] = [c0].[OneToMany_Optional_Inverse2Id1]) AND ([c].[Id2] = [c0].[OneToMany_Optional_Inverse2Id2]) -INNER JOIN [CompositeThrees] AS [c1] ON ([c0].[Id1] = [c1].[OneToMany_Optional_Inverse3Id1]) AND ([c0].[Id2] = [c1].[OneToMany_Optional_Inverse3Id2]) -INNER JOIN [CompositeFours] AS [c2] ON ([c1].[Id1] = [c2].[OneToMany_Optional_Inverse4Id1]) AND ([c1].[Id2] = [c2].[OneToMany_Optional_Inverse4Id2]) +INNER JOIN [CompositeTwos] AS [c0] ON [c].[Id1] = [c0].[OneToMany_Optional_Inverse2Id1] AND [c].[Id2] = [c0].[OneToMany_Optional_Inverse2Id2] +INNER JOIN [CompositeThrees] AS [c1] ON [c0].[Id1] = [c1].[OneToMany_Optional_Inverse3Id1] AND [c0].[Id2] = [c1].[OneToMany_Optional_Inverse3Id2] +INNER JOIN [CompositeFours] AS [c2] ON [c1].[Id1] = [c2].[OneToMany_Optional_Inverse4Id1] AND [c1].[Id2] = [c2].[OneToMany_Optional_Inverse4Id2] ORDER BY [c].[Id1], [c].[Id2], [c0].[Id1], [c0].[Id2], [c1].[Id1], [c1].[Id2]", // @"SELECT [c0].[Name], [c].[Id1], [c].[Id2], [c0].[Id1], [c0].[Id2] FROM [CompositeOnes] AS [c] -INNER JOIN [CompositeTwos] AS [c0] ON ([c].[Id1] = [c0].[OneToMany_Required_Inverse2Id1]) AND ([c].[Id2] = [c0].[OneToMany_Required_Inverse2Id2]) +INNER JOIN [CompositeTwos] AS [c0] ON [c].[Id1] = [c0].[OneToMany_Required_Inverse2Id1] AND [c].[Id2] = [c0].[OneToMany_Required_Inverse2Id2] ORDER BY [c].[Id1], [c].[Id2], [c0].[Id1], [c0].[Id2]", // @"SELECT [c1].[Name], [c].[Id1], [c].[Id2], [c0].[Id1], [c0].[Id2], [c1].[Id1], [c1].[Id2] FROM [CompositeOnes] AS [c] -INNER JOIN [CompositeTwos] AS [c0] ON ([c].[Id1] = [c0].[OneToMany_Required_Inverse2Id1]) AND ([c].[Id2] = [c0].[OneToMany_Required_Inverse2Id2]) -INNER JOIN [CompositeThrees] AS [c1] ON ([c0].[Id1] = [c1].[OneToMany_Optional_Inverse3Id1]) AND ([c0].[Id2] = [c1].[OneToMany_Optional_Inverse3Id2]) +INNER JOIN [CompositeTwos] AS [c0] ON [c].[Id1] = [c0].[OneToMany_Required_Inverse2Id1] AND [c].[Id2] = [c0].[OneToMany_Required_Inverse2Id2] +INNER JOIN [CompositeThrees] AS [c1] ON [c0].[Id1] = [c1].[OneToMany_Optional_Inverse3Id1] AND [c0].[Id2] = [c1].[OneToMany_Optional_Inverse3Id2] ORDER BY [c].[Id1], [c].[Id2], [c0].[Id1], [c0].[Id2], [c1].[Id1], [c1].[Id2]", // @"SELECT [c2].[Id1], [c2].[Id2], [c2].[Level3_Optional_Id1], [c2].[Level3_Optional_Id2], [c2].[Level3_Required_Id1], [c2].[Level3_Required_Id2], [c2].[Name], [c2].[OneToMany_Optional_Inverse4Id1], [c2].[OneToMany_Optional_Inverse4Id2], [c2].[OneToMany_Optional_Self_Inverse4Id1], [c2].[OneToMany_Optional_Self_Inverse4Id2], [c2].[OneToMany_Required_Inverse4Id1], [c2].[OneToMany_Required_Inverse4Id2], [c2].[OneToMany_Required_Self_Inverse4Id1], [c2].[OneToMany_Required_Self_Inverse4Id2], [c2].[OneToOne_Optional_PK_Inverse4Id1], [c2].[OneToOne_Optional_PK_Inverse4Id2], [c2].[OneToOne_Optional_Self4Id1], [c2].[OneToOne_Optional_Self4Id2], [c].[Id1], [c].[Id2], [c0].[Id1], [c0].[Id2], [c1].[Id1], [c1].[Id2] FROM [CompositeOnes] AS [c] -INNER JOIN [CompositeTwos] AS [c0] ON ([c].[Id1] = [c0].[OneToMany_Required_Inverse2Id1]) AND ([c].[Id2] = [c0].[OneToMany_Required_Inverse2Id2]) -INNER JOIN [CompositeThrees] AS [c1] ON ([c0].[Id1] = [c1].[OneToMany_Optional_Inverse3Id1]) AND ([c0].[Id2] = [c1].[OneToMany_Optional_Inverse3Id2]) -INNER JOIN [CompositeFours] AS [c2] ON ([c1].[Id1] = [c2].[OneToMany_Required_Inverse4Id1]) AND ([c1].[Id2] = [c2].[OneToMany_Required_Inverse4Id2]) +INNER JOIN [CompositeTwos] AS [c0] ON [c].[Id1] = [c0].[OneToMany_Required_Inverse2Id1] AND [c].[Id2] = [c0].[OneToMany_Required_Inverse2Id2] +INNER JOIN [CompositeThrees] AS [c1] ON [c0].[Id1] = [c1].[OneToMany_Optional_Inverse3Id1] AND [c0].[Id2] = [c1].[OneToMany_Optional_Inverse3Id2] +INNER JOIN [CompositeFours] AS [c2] ON [c1].[Id1] = [c2].[OneToMany_Required_Inverse4Id1] AND [c1].[Id2] = [c2].[OneToMany_Required_Inverse4Id2] ORDER BY [c].[Id1], [c].[Id2], [c0].[Id1], [c0].[Id2], [c1].[Id1], [c1].[Id2]", // @"SELECT [c2].[Id1], [c2].[Id2], [c2].[Level3_Optional_Id1], [c2].[Level3_Optional_Id2], [c2].[Level3_Required_Id1], [c2].[Level3_Required_Id2], [c2].[Name], [c2].[OneToMany_Optional_Inverse4Id1], [c2].[OneToMany_Optional_Inverse4Id2], [c2].[OneToMany_Optional_Self_Inverse4Id1], [c2].[OneToMany_Optional_Self_Inverse4Id2], [c2].[OneToMany_Required_Inverse4Id1], [c2].[OneToMany_Required_Inverse4Id2], [c2].[OneToMany_Required_Self_Inverse4Id1], [c2].[OneToMany_Required_Self_Inverse4Id2], [c2].[OneToOne_Optional_PK_Inverse4Id1], [c2].[OneToOne_Optional_PK_Inverse4Id2], [c2].[OneToOne_Optional_Self4Id1], [c2].[OneToOne_Optional_Self4Id2], [c].[Id1], [c].[Id2], [c0].[Id1], [c0].[Id2], [c1].[Id1], [c1].[Id2] FROM [CompositeOnes] AS [c] -INNER JOIN [CompositeTwos] AS [c0] ON ([c].[Id1] = [c0].[OneToMany_Required_Inverse2Id1]) AND ([c].[Id2] = [c0].[OneToMany_Required_Inverse2Id2]) -INNER JOIN [CompositeThrees] AS [c1] ON ([c0].[Id1] = [c1].[OneToMany_Optional_Inverse3Id1]) AND ([c0].[Id2] = [c1].[OneToMany_Optional_Inverse3Id2]) -INNER JOIN [CompositeFours] AS [c2] ON ([c1].[Id1] = [c2].[OneToMany_Optional_Inverse4Id1]) AND ([c1].[Id2] = [c2].[OneToMany_Optional_Inverse4Id2]) +INNER JOIN [CompositeTwos] AS [c0] ON [c].[Id1] = [c0].[OneToMany_Required_Inverse2Id1] AND [c].[Id2] = [c0].[OneToMany_Required_Inverse2Id2] +INNER JOIN [CompositeThrees] AS [c1] ON [c0].[Id1] = [c1].[OneToMany_Optional_Inverse3Id1] AND [c0].[Id2] = [c1].[OneToMany_Optional_Inverse3Id2] +INNER JOIN [CompositeFours] AS [c2] ON [c1].[Id1] = [c2].[OneToMany_Optional_Inverse4Id1] AND [c1].[Id2] = [c2].[OneToMany_Optional_Inverse4Id2] ORDER BY [c].[Id1], [c].[Id2], [c0].[Id1], [c0].[Id2], [c1].[Id1], [c1].[Id2]", // @"SELECT [c1].[Name], [c].[Id1], [c].[Id2], [c0].[Id1], [c0].[Id2], [c1].[Id1], [c1].[Id2] FROM [CompositeOnes] AS [c] -INNER JOIN [CompositeTwos] AS [c0] ON ([c].[Id1] = [c0].[OneToMany_Required_Inverse2Id1]) AND ([c].[Id2] = [c0].[OneToMany_Required_Inverse2Id2]) -INNER JOIN [CompositeThrees] AS [c1] ON ([c0].[Id1] = [c1].[OneToMany_Optional_Inverse3Id1]) AND ([c0].[Id2] = [c1].[OneToMany_Optional_Inverse3Id2]) +INNER JOIN [CompositeTwos] AS [c0] ON [c].[Id1] = [c0].[OneToMany_Required_Inverse2Id1] AND [c].[Id2] = [c0].[OneToMany_Required_Inverse2Id2] +INNER JOIN [CompositeThrees] AS [c1] ON [c0].[Id1] = [c1].[OneToMany_Optional_Inverse3Id1] AND [c0].[Id2] = [c1].[OneToMany_Optional_Inverse3Id2] ORDER BY [c].[Id1], [c].[Id2], [c0].[Id1], [c0].[Id2], [c1].[Id1], [c1].[Id2]", // @"SELECT [c2].[Id1], [c2].[Id2], [c2].[Level3_Optional_Id1], [c2].[Level3_Optional_Id2], [c2].[Level3_Required_Id1], [c2].[Level3_Required_Id2], [c2].[Name], [c2].[OneToMany_Optional_Inverse4Id1], [c2].[OneToMany_Optional_Inverse4Id2], [c2].[OneToMany_Optional_Self_Inverse4Id1], [c2].[OneToMany_Optional_Self_Inverse4Id2], [c2].[OneToMany_Required_Inverse4Id1], [c2].[OneToMany_Required_Inverse4Id2], [c2].[OneToMany_Required_Self_Inverse4Id1], [c2].[OneToMany_Required_Self_Inverse4Id2], [c2].[OneToOne_Optional_PK_Inverse4Id1], [c2].[OneToOne_Optional_PK_Inverse4Id2], [c2].[OneToOne_Optional_Self4Id1], [c2].[OneToOne_Optional_Self4Id2], [c].[Id1], [c].[Id2], [c0].[Id1], [c0].[Id2], [c1].[Id1], [c1].[Id2] FROM [CompositeOnes] AS [c] -INNER JOIN [CompositeTwos] AS [c0] ON ([c].[Id1] = [c0].[OneToMany_Required_Inverse2Id1]) AND ([c].[Id2] = [c0].[OneToMany_Required_Inverse2Id2]) -INNER JOIN [CompositeThrees] AS [c1] ON ([c0].[Id1] = [c1].[OneToMany_Optional_Inverse3Id1]) AND ([c0].[Id2] = [c1].[OneToMany_Optional_Inverse3Id2]) -INNER JOIN [CompositeFours] AS [c2] ON ([c1].[Id1] = [c2].[OneToMany_Optional_Inverse4Id1]) AND ([c1].[Id2] = [c2].[OneToMany_Optional_Inverse4Id2]) +INNER JOIN [CompositeTwos] AS [c0] ON [c].[Id1] = [c0].[OneToMany_Required_Inverse2Id1] AND [c].[Id2] = [c0].[OneToMany_Required_Inverse2Id2] +INNER JOIN [CompositeThrees] AS [c1] ON [c0].[Id1] = [c1].[OneToMany_Optional_Inverse3Id1] AND [c0].[Id2] = [c1].[OneToMany_Optional_Inverse3Id2] +INNER JOIN [CompositeFours] AS [c2] ON [c1].[Id1] = [c2].[OneToMany_Optional_Inverse4Id1] AND [c1].[Id2] = [c2].[OneToMany_Optional_Inverse4Id2] ORDER BY [c].[Id1], [c].[Id2], [c0].[Id1], [c0].[Id2], [c1].[Id1], [c1].[Id2]", // @"SELECT [c2].[Id1], [c2].[Id2], [c2].[Level3_Optional_Id1], [c2].[Level3_Optional_Id2], [c2].[Level3_Required_Id1], [c2].[Level3_Required_Id2], [c2].[Name], [c2].[OneToMany_Optional_Inverse4Id1], [c2].[OneToMany_Optional_Inverse4Id2], [c2].[OneToMany_Optional_Self_Inverse4Id1], [c2].[OneToMany_Optional_Self_Inverse4Id2], [c2].[OneToMany_Required_Inverse4Id1], [c2].[OneToMany_Required_Inverse4Id2], [c2].[OneToMany_Required_Self_Inverse4Id1], [c2].[OneToMany_Required_Self_Inverse4Id2], [c2].[OneToOne_Optional_PK_Inverse4Id1], [c2].[OneToOne_Optional_PK_Inverse4Id2], [c2].[OneToOne_Optional_Self4Id1], [c2].[OneToOne_Optional_Self4Id2], [c].[Id1], [c].[Id2], [c0].[Id1], [c0].[Id2], [c1].[Id1], [c1].[Id2] FROM [CompositeOnes] AS [c] -INNER JOIN [CompositeTwos] AS [c0] ON ([c].[Id1] = [c0].[OneToMany_Required_Inverse2Id1]) AND ([c].[Id2] = [c0].[OneToMany_Required_Inverse2Id2]) -INNER JOIN [CompositeThrees] AS [c1] ON ([c0].[Id1] = [c1].[OneToMany_Optional_Inverse3Id1]) AND ([c0].[Id2] = [c1].[OneToMany_Optional_Inverse3Id2]) -INNER JOIN [CompositeFours] AS [c2] ON ([c1].[Id1] = [c2].[OneToMany_Required_Inverse4Id1]) AND ([c1].[Id2] = [c2].[OneToMany_Required_Inverse4Id2]) +INNER JOIN [CompositeTwos] AS [c0] ON [c].[Id1] = [c0].[OneToMany_Required_Inverse2Id1] AND [c].[Id2] = [c0].[OneToMany_Required_Inverse2Id2] +INNER JOIN [CompositeThrees] AS [c1] ON [c0].[Id1] = [c1].[OneToMany_Optional_Inverse3Id1] AND [c0].[Id2] = [c1].[OneToMany_Optional_Inverse3Id2] +INNER JOIN [CompositeFours] AS [c2] ON [c1].[Id1] = [c2].[OneToMany_Required_Inverse4Id1] AND [c1].[Id2] = [c2].[OneToMany_Required_Inverse4Id2] ORDER BY [c].[Id1], [c].[Id2], [c0].[Id1], [c0].[Id2], [c1].[Id1], [c1].[Id2]"); } @@ -138,78 +138,78 @@ FROM [CompositeOnes] AS [c] // @"SELECT [c0].[Name], [c].[Id1], [c].[Id2], [c0].[Id1], [c0].[Id2] FROM [CompositeOnes] AS [c] -INNER JOIN [CompositeTwos] AS [c0] ON ([c].[Id1] = [c0].[OneToMany_Optional_Inverse2Id1]) AND ([c].[Id2] = [c0].[OneToMany_Optional_Inverse2Id2]) +INNER JOIN [CompositeTwos] AS [c0] ON [c].[Id1] = [c0].[OneToMany_Optional_Inverse2Id1] AND [c].[Id2] = [c0].[OneToMany_Optional_Inverse2Id2] ORDER BY [c].[Name], [c].[Id1], [c].[Id2], [c0].[Id1], [c0].[Id2]", // @"SELECT [c].[Id1], [c].[Id2], [c0].[Id1], [c0].[Id2], [c1].[Id1], [c1].[Id2] FROM [CompositeOnes] AS [c] -INNER JOIN [CompositeTwos] AS [c0] ON ([c].[Id1] = [c0].[OneToMany_Optional_Inverse2Id1]) AND ([c].[Id2] = [c0].[OneToMany_Optional_Inverse2Id2]) -INNER JOIN [CompositeThrees] AS [c1] ON ([c0].[Id1] = [c1].[OneToMany_Required_Inverse3Id1]) AND ([c0].[Id2] = [c1].[OneToMany_Required_Inverse3Id2]) +INNER JOIN [CompositeTwos] AS [c0] ON [c].[Id1] = [c0].[OneToMany_Optional_Inverse2Id1] AND [c].[Id2] = [c0].[OneToMany_Optional_Inverse2Id2] +INNER JOIN [CompositeThrees] AS [c1] ON [c0].[Id1] = [c1].[OneToMany_Required_Inverse3Id1] AND [c0].[Id2] = [c1].[OneToMany_Required_Inverse3Id2] ORDER BY [c].[Name], [c].[Id1], [c].[Id2], [c0].[Id1], [c0].[Id2], [c1].[Id2] DESC, [c1].[Id1] DESC", // @"SELECT [c1].[Name], [c].[Id1], [c].[Id2], [c0].[Id1], [c0].[Id2], [c1].[Id1], [c1].[Id2] FROM [CompositeOnes] AS [c] -INNER JOIN [CompositeTwos] AS [c0] ON ([c].[Id1] = [c0].[OneToMany_Optional_Inverse2Id1]) AND ([c].[Id2] = [c0].[OneToMany_Optional_Inverse2Id2]) -INNER JOIN [CompositeThrees] AS [c1] ON ([c0].[Id1] = [c1].[OneToMany_Optional_Inverse3Id1]) AND ([c0].[Id2] = [c1].[OneToMany_Optional_Inverse3Id2]) +INNER JOIN [CompositeTwos] AS [c0] ON [c].[Id1] = [c0].[OneToMany_Optional_Inverse2Id1] AND [c].[Id2] = [c0].[OneToMany_Optional_Inverse2Id2] +INNER JOIN [CompositeThrees] AS [c1] ON [c0].[Id1] = [c1].[OneToMany_Optional_Inverse3Id1] AND [c0].[Id2] = [c1].[OneToMany_Optional_Inverse3Id2] ORDER BY [c].[Name], [c].[Id1], [c].[Id2], [c0].[Id1], [c0].[Id2], [c1].[Id1], [c1].[Id2]", // @"SELECT [c2].[Id1], [c2].[Id2], [c2].[Level3_Optional_Id1], [c2].[Level3_Optional_Id2], [c2].[Level3_Required_Id1], [c2].[Level3_Required_Id2], [c2].[Name], [c2].[OneToMany_Optional_Inverse4Id1], [c2].[OneToMany_Optional_Inverse4Id2], [c2].[OneToMany_Optional_Self_Inverse4Id1], [c2].[OneToMany_Optional_Self_Inverse4Id2], [c2].[OneToMany_Required_Inverse4Id1], [c2].[OneToMany_Required_Inverse4Id2], [c2].[OneToMany_Required_Self_Inverse4Id1], [c2].[OneToMany_Required_Self_Inverse4Id2], [c2].[OneToOne_Optional_PK_Inverse4Id1], [c2].[OneToOne_Optional_PK_Inverse4Id2], [c2].[OneToOne_Optional_Self4Id1], [c2].[OneToOne_Optional_Self4Id2], [c].[Id1], [c].[Id2], [c0].[Id1], [c0].[Id2], [c1].[Id1], [c1].[Id2] FROM [CompositeOnes] AS [c] -INNER JOIN [CompositeTwos] AS [c0] ON ([c].[Id1] = [c0].[OneToMany_Optional_Inverse2Id1]) AND ([c].[Id2] = [c0].[OneToMany_Optional_Inverse2Id2]) -INNER JOIN [CompositeThrees] AS [c1] ON ([c0].[Id1] = [c1].[OneToMany_Optional_Inverse3Id1]) AND ([c0].[Id2] = [c1].[OneToMany_Optional_Inverse3Id2]) -INNER JOIN [CompositeFours] AS [c2] ON ([c1].[Id1] = [c2].[OneToMany_Required_Inverse4Id1]) AND ([c1].[Id2] = [c2].[OneToMany_Required_Inverse4Id2]) +INNER JOIN [CompositeTwos] AS [c0] ON [c].[Id1] = [c0].[OneToMany_Optional_Inverse2Id1] AND [c].[Id2] = [c0].[OneToMany_Optional_Inverse2Id2] +INNER JOIN [CompositeThrees] AS [c1] ON [c0].[Id1] = [c1].[OneToMany_Optional_Inverse3Id1] AND [c0].[Id2] = [c1].[OneToMany_Optional_Inverse3Id2] +INNER JOIN [CompositeFours] AS [c2] ON [c1].[Id1] = [c2].[OneToMany_Required_Inverse4Id1] AND [c1].[Id2] = [c2].[OneToMany_Required_Inverse4Id2] ORDER BY [c].[Name], [c].[Id1], [c].[Id2], [c0].[Id1], [c0].[Id2], [c1].[Id1], [c1].[Id2]", // @"SELECT [c2].[Id1], [c2].[Id2], [c2].[Level3_Optional_Id1], [c2].[Level3_Optional_Id2], [c2].[Level3_Required_Id1], [c2].[Level3_Required_Id2], [c2].[Name], [c2].[OneToMany_Optional_Inverse4Id1], [c2].[OneToMany_Optional_Inverse4Id2], [c2].[OneToMany_Optional_Self_Inverse4Id1], [c2].[OneToMany_Optional_Self_Inverse4Id2], [c2].[OneToMany_Required_Inverse4Id1], [c2].[OneToMany_Required_Inverse4Id2], [c2].[OneToMany_Required_Self_Inverse4Id1], [c2].[OneToMany_Required_Self_Inverse4Id2], [c2].[OneToOne_Optional_PK_Inverse4Id1], [c2].[OneToOne_Optional_PK_Inverse4Id2], [c2].[OneToOne_Optional_Self4Id1], [c2].[OneToOne_Optional_Self4Id2], [c].[Id1], [c].[Id2], [c0].[Id1], [c0].[Id2], [c1].[Id1], [c1].[Id2] FROM [CompositeOnes] AS [c] -INNER JOIN [CompositeTwos] AS [c0] ON ([c].[Id1] = [c0].[OneToMany_Optional_Inverse2Id1]) AND ([c].[Id2] = [c0].[OneToMany_Optional_Inverse2Id2]) -INNER JOIN [CompositeThrees] AS [c1] ON ([c0].[Id1] = [c1].[OneToMany_Optional_Inverse3Id1]) AND ([c0].[Id2] = [c1].[OneToMany_Optional_Inverse3Id2]) -INNER JOIN [CompositeFours] AS [c2] ON ([c1].[Id1] = [c2].[OneToMany_Optional_Inverse4Id1]) AND ([c1].[Id2] = [c2].[OneToMany_Optional_Inverse4Id2]) +INNER JOIN [CompositeTwos] AS [c0] ON [c].[Id1] = [c0].[OneToMany_Optional_Inverse2Id1] AND [c].[Id2] = [c0].[OneToMany_Optional_Inverse2Id2] +INNER JOIN [CompositeThrees] AS [c1] ON [c0].[Id1] = [c1].[OneToMany_Optional_Inverse3Id1] AND [c0].[Id2] = [c1].[OneToMany_Optional_Inverse3Id2] +INNER JOIN [CompositeFours] AS [c2] ON [c1].[Id1] = [c2].[OneToMany_Optional_Inverse4Id1] AND [c1].[Id2] = [c2].[OneToMany_Optional_Inverse4Id2] ORDER BY [c].[Name], [c].[Id1], [c].[Id2], [c0].[Id1], [c0].[Id2], [c1].[Id1], [c1].[Id2]", // @"SELECT [c0].[Name], [c].[Id1], [c].[Id2], [c0].[Id1], [c0].[Id2] FROM [CompositeOnes] AS [c] -INNER JOIN [CompositeTwos] AS [c0] ON ([c].[Id1] = [c0].[OneToMany_Required_Inverse2Id1]) AND ([c].[Id2] = [c0].[OneToMany_Required_Inverse2Id2]) +INNER JOIN [CompositeTwos] AS [c0] ON [c].[Id1] = [c0].[OneToMany_Required_Inverse2Id1] AND [c].[Id2] = [c0].[OneToMany_Required_Inverse2Id2] ORDER BY [c].[Name], [c].[Id1], [c].[Id2], CAST(LEN([c0].[Name]) AS int), [c0].[Id1], [c0].[Id2]", // @"SELECT [c1].[Name], [c].[Id1], [c].[Id2], [c0].[Id1], [c0].[Id2], [c1].[Id1], [c1].[Id2] FROM [CompositeOnes] AS [c] -INNER JOIN [CompositeTwos] AS [c0] ON ([c].[Id1] = [c0].[OneToMany_Required_Inverse2Id1]) AND ([c].[Id2] = [c0].[OneToMany_Required_Inverse2Id2]) -INNER JOIN [CompositeThrees] AS [c1] ON ([c0].[Id1] = [c1].[OneToMany_Optional_Inverse3Id1]) AND ([c0].[Id2] = [c1].[OneToMany_Optional_Inverse3Id2]) +INNER JOIN [CompositeTwos] AS [c0] ON [c].[Id1] = [c0].[OneToMany_Required_Inverse2Id1] AND [c].[Id2] = [c0].[OneToMany_Required_Inverse2Id2] +INNER JOIN [CompositeThrees] AS [c1] ON [c0].[Id1] = [c1].[OneToMany_Optional_Inverse3Id1] AND [c0].[Id2] = [c1].[OneToMany_Optional_Inverse3Id2] ORDER BY [c].[Name], [c].[Id1], [c].[Id2], CAST(LEN([c0].[Name]) AS int), [c0].[Id1], [c0].[Id2], [c1].[Id1], [c1].[Id2]", // @"SELECT [c2].[Id1], [c2].[Id2], [c2].[Level3_Optional_Id1], [c2].[Level3_Optional_Id2], [c2].[Level3_Required_Id1], [c2].[Level3_Required_Id2], [c2].[Name], [c2].[OneToMany_Optional_Inverse4Id1], [c2].[OneToMany_Optional_Inverse4Id2], [c2].[OneToMany_Optional_Self_Inverse4Id1], [c2].[OneToMany_Optional_Self_Inverse4Id2], [c2].[OneToMany_Required_Inverse4Id1], [c2].[OneToMany_Required_Inverse4Id2], [c2].[OneToMany_Required_Self_Inverse4Id1], [c2].[OneToMany_Required_Self_Inverse4Id2], [c2].[OneToOne_Optional_PK_Inverse4Id1], [c2].[OneToOne_Optional_PK_Inverse4Id2], [c2].[OneToOne_Optional_Self4Id1], [c2].[OneToOne_Optional_Self4Id2], [c].[Id1], [c].[Id2], [c0].[Id1], [c0].[Id2], [c1].[Id1], [c1].[Id2] FROM [CompositeOnes] AS [c] -INNER JOIN [CompositeTwos] AS [c0] ON ([c].[Id1] = [c0].[OneToMany_Required_Inverse2Id1]) AND ([c].[Id2] = [c0].[OneToMany_Required_Inverse2Id2]) -INNER JOIN [CompositeThrees] AS [c1] ON ([c0].[Id1] = [c1].[OneToMany_Optional_Inverse3Id1]) AND ([c0].[Id2] = [c1].[OneToMany_Optional_Inverse3Id2]) -INNER JOIN [CompositeFours] AS [c2] ON ([c1].[Id1] = [c2].[OneToMany_Required_Inverse4Id1]) AND ([c1].[Id2] = [c2].[OneToMany_Required_Inverse4Id2]) +INNER JOIN [CompositeTwos] AS [c0] ON [c].[Id1] = [c0].[OneToMany_Required_Inverse2Id1] AND [c].[Id2] = [c0].[OneToMany_Required_Inverse2Id2] +INNER JOIN [CompositeThrees] AS [c1] ON [c0].[Id1] = [c1].[OneToMany_Optional_Inverse3Id1] AND [c0].[Id2] = [c1].[OneToMany_Optional_Inverse3Id2] +INNER JOIN [CompositeFours] AS [c2] ON [c1].[Id1] = [c2].[OneToMany_Required_Inverse4Id1] AND [c1].[Id2] = [c2].[OneToMany_Required_Inverse4Id2] ORDER BY [c].[Name], [c].[Id1], [c].[Id2], CAST(LEN([c0].[Name]) AS int), [c0].[Id1], [c0].[Id2], [c1].[Id1], [c1].[Id2]", // @"SELECT [c2].[Id1], [c2].[Id2], [c2].[Level3_Optional_Id1], [c2].[Level3_Optional_Id2], [c2].[Level3_Required_Id1], [c2].[Level3_Required_Id2], [c2].[Name], [c2].[OneToMany_Optional_Inverse4Id1], [c2].[OneToMany_Optional_Inverse4Id2], [c2].[OneToMany_Optional_Self_Inverse4Id1], [c2].[OneToMany_Optional_Self_Inverse4Id2], [c2].[OneToMany_Required_Inverse4Id1], [c2].[OneToMany_Required_Inverse4Id2], [c2].[OneToMany_Required_Self_Inverse4Id1], [c2].[OneToMany_Required_Self_Inverse4Id2], [c2].[OneToOne_Optional_PK_Inverse4Id1], [c2].[OneToOne_Optional_PK_Inverse4Id2], [c2].[OneToOne_Optional_Self4Id1], [c2].[OneToOne_Optional_Self4Id2], [c].[Id1], [c].[Id2], [c0].[Id1], [c0].[Id2], [c1].[Id1], [c1].[Id2] FROM [CompositeOnes] AS [c] -INNER JOIN [CompositeTwos] AS [c0] ON ([c].[Id1] = [c0].[OneToMany_Required_Inverse2Id1]) AND ([c].[Id2] = [c0].[OneToMany_Required_Inverse2Id2]) -INNER JOIN [CompositeThrees] AS [c1] ON ([c0].[Id1] = [c1].[OneToMany_Optional_Inverse3Id1]) AND ([c0].[Id2] = [c1].[OneToMany_Optional_Inverse3Id2]) -INNER JOIN [CompositeFours] AS [c2] ON ([c1].[Id1] = [c2].[OneToMany_Optional_Inverse4Id1]) AND ([c1].[Id2] = [c2].[OneToMany_Optional_Inverse4Id2]) +INNER JOIN [CompositeTwos] AS [c0] ON [c].[Id1] = [c0].[OneToMany_Required_Inverse2Id1] AND [c].[Id2] = [c0].[OneToMany_Required_Inverse2Id2] +INNER JOIN [CompositeThrees] AS [c1] ON [c0].[Id1] = [c1].[OneToMany_Optional_Inverse3Id1] AND [c0].[Id2] = [c1].[OneToMany_Optional_Inverse3Id2] +INNER JOIN [CompositeFours] AS [c2] ON [c1].[Id1] = [c2].[OneToMany_Optional_Inverse4Id1] AND [c1].[Id2] = [c2].[OneToMany_Optional_Inverse4Id2] ORDER BY [c].[Name], [c].[Id1], [c].[Id2], CAST(LEN([c0].[Name]) AS int), [c0].[Id1], [c0].[Id2], [c1].[Id1], [c1].[Id2]", // @"SELECT [c1].[Name], [c].[Id1], [c].[Id2], [c0].[Id1], [c0].[Id2], [c1].[Id1], [c1].[Id2] FROM [CompositeOnes] AS [c] -INNER JOIN [CompositeTwos] AS [c0] ON ([c].[Id1] = [c0].[OneToMany_Required_Inverse2Id1]) AND ([c].[Id2] = [c0].[OneToMany_Required_Inverse2Id2]) -INNER JOIN [CompositeThrees] AS [c1] ON ([c0].[Id1] = [c1].[OneToMany_Optional_Inverse3Id1]) AND ([c0].[Id2] = [c1].[OneToMany_Optional_Inverse3Id2]) +INNER JOIN [CompositeTwos] AS [c0] ON [c].[Id1] = [c0].[OneToMany_Required_Inverse2Id1] AND [c].[Id2] = [c0].[OneToMany_Required_Inverse2Id2] +INNER JOIN [CompositeThrees] AS [c1] ON [c0].[Id1] = [c1].[OneToMany_Optional_Inverse3Id1] AND [c0].[Id2] = [c1].[OneToMany_Optional_Inverse3Id2] ORDER BY [c].[Name], [c].[Id1], [c].[Id2], CAST(LEN([c0].[Name]) AS int), [c0].[Id1], [c0].[Id2], [c1].[Id1], [c1].[Id2]", // @"SELECT [c2].[Id1], [c2].[Id2], [c2].[Level3_Optional_Id1], [c2].[Level3_Optional_Id2], [c2].[Level3_Required_Id1], [c2].[Level3_Required_Id2], [c2].[Name], [c2].[OneToMany_Optional_Inverse4Id1], [c2].[OneToMany_Optional_Inverse4Id2], [c2].[OneToMany_Optional_Self_Inverse4Id1], [c2].[OneToMany_Optional_Self_Inverse4Id2], [c2].[OneToMany_Required_Inverse4Id1], [c2].[OneToMany_Required_Inverse4Id2], [c2].[OneToMany_Required_Self_Inverse4Id1], [c2].[OneToMany_Required_Self_Inverse4Id2], [c2].[OneToOne_Optional_PK_Inverse4Id1], [c2].[OneToOne_Optional_PK_Inverse4Id2], [c2].[OneToOne_Optional_Self4Id1], [c2].[OneToOne_Optional_Self4Id2], [c].[Id1], [c].[Id2], [c0].[Id1], [c0].[Id2], [c1].[Id1], [c1].[Id2] FROM [CompositeOnes] AS [c] -INNER JOIN [CompositeTwos] AS [c0] ON ([c].[Id1] = [c0].[OneToMany_Required_Inverse2Id1]) AND ([c].[Id2] = [c0].[OneToMany_Required_Inverse2Id2]) -INNER JOIN [CompositeThrees] AS [c1] ON ([c0].[Id1] = [c1].[OneToMany_Optional_Inverse3Id1]) AND ([c0].[Id2] = [c1].[OneToMany_Optional_Inverse3Id2]) -INNER JOIN [CompositeFours] AS [c2] ON ([c1].[Id1] = [c2].[OneToMany_Optional_Inverse4Id1]) AND ([c1].[Id2] = [c2].[OneToMany_Optional_Inverse4Id2]) +INNER JOIN [CompositeTwos] AS [c0] ON [c].[Id1] = [c0].[OneToMany_Required_Inverse2Id1] AND [c].[Id2] = [c0].[OneToMany_Required_Inverse2Id2] +INNER JOIN [CompositeThrees] AS [c1] ON [c0].[Id1] = [c1].[OneToMany_Optional_Inverse3Id1] AND [c0].[Id2] = [c1].[OneToMany_Optional_Inverse3Id2] +INNER JOIN [CompositeFours] AS [c2] ON [c1].[Id1] = [c2].[OneToMany_Optional_Inverse4Id1] AND [c1].[Id2] = [c2].[OneToMany_Optional_Inverse4Id2] ORDER BY [c].[Name], [c].[Id1], [c].[Id2], CAST(LEN([c0].[Name]) AS int), [c0].[Id1], [c0].[Id2], [c1].[Id1], [c1].[Id2]", // @"SELECT [c2].[Id1], [c2].[Id2], [c2].[Level3_Optional_Id1], [c2].[Level3_Optional_Id2], [c2].[Level3_Required_Id1], [c2].[Level3_Required_Id2], [c2].[Name], [c2].[OneToMany_Optional_Inverse4Id1], [c2].[OneToMany_Optional_Inverse4Id2], [c2].[OneToMany_Optional_Self_Inverse4Id1], [c2].[OneToMany_Optional_Self_Inverse4Id2], [c2].[OneToMany_Required_Inverse4Id1], [c2].[OneToMany_Required_Inverse4Id2], [c2].[OneToMany_Required_Self_Inverse4Id1], [c2].[OneToMany_Required_Self_Inverse4Id2], [c2].[OneToOne_Optional_PK_Inverse4Id1], [c2].[OneToOne_Optional_PK_Inverse4Id2], [c2].[OneToOne_Optional_Self4Id1], [c2].[OneToOne_Optional_Self4Id2], [c].[Id1], [c].[Id2], [c0].[Id1], [c0].[Id2], [c1].[Id1], [c1].[Id2] FROM [CompositeOnes] AS [c] -INNER JOIN [CompositeTwos] AS [c0] ON ([c].[Id1] = [c0].[OneToMany_Required_Inverse2Id1]) AND ([c].[Id2] = [c0].[OneToMany_Required_Inverse2Id2]) -INNER JOIN [CompositeThrees] AS [c1] ON ([c0].[Id1] = [c1].[OneToMany_Optional_Inverse3Id1]) AND ([c0].[Id2] = [c1].[OneToMany_Optional_Inverse3Id2]) -INNER JOIN [CompositeFours] AS [c2] ON ([c1].[Id1] = [c2].[OneToMany_Required_Inverse4Id1]) AND ([c1].[Id2] = [c2].[OneToMany_Required_Inverse4Id2]) +INNER JOIN [CompositeTwos] AS [c0] ON [c].[Id1] = [c0].[OneToMany_Required_Inverse2Id1] AND [c].[Id2] = [c0].[OneToMany_Required_Inverse2Id2] +INNER JOIN [CompositeThrees] AS [c1] ON [c0].[Id1] = [c1].[OneToMany_Optional_Inverse3Id1] AND [c0].[Id2] = [c1].[OneToMany_Optional_Inverse3Id2] +INNER JOIN [CompositeFours] AS [c2] ON [c1].[Id1] = [c2].[OneToMany_Required_Inverse4Id1] AND [c1].[Id2] = [c2].[OneToMany_Required_Inverse4Id2] ORDER BY [c].[Name], [c].[Id1], [c].[Id2], CAST(LEN([c0].[Name]) AS int), [c0].[Id1], [c0].[Id2], [c1].[Id1], [c1].[Id2], [c2].[Id1] + CAST([c2].[Id2] AS nvarchar(450)) DESC"); } @@ -224,12 +224,12 @@ FROM [CompositeOnes] AS [c] // @"SELECT [c0].[Id1], [c0].[Id2], [c0].[Date], [c0].[Level1_Optional_Id1], [c0].[Level1_Optional_Id2], [c0].[Level1_Required_Id1], [c0].[Level1_Required_Id2], [c0].[Name], [c0].[OneToMany_Optional_Inverse2Id1], [c0].[OneToMany_Optional_Inverse2Id2], [c0].[OneToMany_Optional_Self_Inverse2Id1], [c0].[OneToMany_Optional_Self_Inverse2Id2], [c0].[OneToMany_Required_Inverse2Id1], [c0].[OneToMany_Required_Inverse2Id2], [c0].[OneToMany_Required_Self_Inverse2Id1], [c0].[OneToMany_Required_Self_Inverse2Id2], [c0].[OneToOne_Optional_PK_Inverse2Id1], [c0].[OneToOne_Optional_PK_Inverse2Id2], [c0].[OneToOne_Optional_Self2Id1], [c0].[OneToOne_Optional_Self2Id2], [c].[Id1], [c].[Id2] FROM [CompositeOnes] AS [c] -INNER JOIN [CompositeTwos] AS [c0] ON ([c].[Id1] = [c0].[OneToMany_Optional_Inverse2Id1]) AND ([c].[Id2] = [c0].[OneToMany_Optional_Inverse2Id2]) +INNER JOIN [CompositeTwos] AS [c0] ON [c].[Id1] = [c0].[OneToMany_Optional_Inverse2Id1] AND [c].[Id2] = [c0].[OneToMany_Optional_Inverse2Id2] ORDER BY [c].[Id2], [c].[Id1]", // @"SELECT [c0].[Id1], [c0].[Id2], [c0].[Date], [c0].[Level1_Optional_Id1], [c0].[Level1_Optional_Id2], [c0].[Level1_Required_Id1], [c0].[Level1_Required_Id2], [c0].[Name], [c0].[OneToMany_Optional_Inverse2Id1], [c0].[OneToMany_Optional_Inverse2Id2], [c0].[OneToMany_Optional_Self_Inverse2Id1], [c0].[OneToMany_Optional_Self_Inverse2Id2], [c0].[OneToMany_Required_Inverse2Id1], [c0].[OneToMany_Required_Inverse2Id2], [c0].[OneToMany_Required_Self_Inverse2Id1], [c0].[OneToMany_Required_Self_Inverse2Id2], [c0].[OneToOne_Optional_PK_Inverse2Id1], [c0].[OneToOne_Optional_PK_Inverse2Id2], [c0].[OneToOne_Optional_Self2Id1], [c0].[OneToOne_Optional_Self2Id2], [c].[Id1], [c].[Id2] FROM [CompositeOnes] AS [c] -INNER JOIN [CompositeTwos] AS [c0] ON ([c].[Id1] = [c0].[OneToMany_Required_Inverse2Id1]) AND ([c].[Id2] = [c0].[OneToMany_Required_Inverse2Id2]) +INNER JOIN [CompositeTwos] AS [c0] ON [c].[Id1] = [c0].[OneToMany_Required_Inverse2Id1] AND [c].[Id2] = [c0].[OneToMany_Required_Inverse2Id2] ORDER BY [c].[Id2], [c].[Id1]"); } @@ -244,12 +244,12 @@ FROM [CompositeOnes] AS [c] // @"SELECT [c0].[Id1], [c0].[Id2], [c0].[Date], [c0].[Level1_Optional_Id1], [c0].[Level1_Optional_Id2], [c0].[Level1_Required_Id1], [c0].[Level1_Required_Id2], [c0].[Name], [c0].[OneToMany_Optional_Inverse2Id1], [c0].[OneToMany_Optional_Inverse2Id2], [c0].[OneToMany_Optional_Self_Inverse2Id1], [c0].[OneToMany_Optional_Self_Inverse2Id2], [c0].[OneToMany_Required_Inverse2Id1], [c0].[OneToMany_Required_Inverse2Id2], [c0].[OneToMany_Required_Self_Inverse2Id1], [c0].[OneToMany_Required_Self_Inverse2Id2], [c0].[OneToOne_Optional_PK_Inverse2Id1], [c0].[OneToOne_Optional_PK_Inverse2Id2], [c0].[OneToOne_Optional_Self2Id1], [c0].[OneToOne_Optional_Self2Id2], [c].[Id1], [c].[Id2] FROM [CompositeOnes] AS [c] -INNER JOIN [CompositeTwos] AS [c0] ON ([c].[Id1] = [c0].[OneToMany_Optional_Inverse2Id1]) AND ([c].[Id2] = [c0].[OneToMany_Optional_Inverse2Id2]) +INNER JOIN [CompositeTwos] AS [c0] ON [c].[Id1] = [c0].[OneToMany_Optional_Inverse2Id1] AND [c].[Id2] = [c0].[OneToMany_Optional_Inverse2Id2] ORDER BY [c].[Id2], [c].[Id1] DESC", // @"SELECT [c0].[Id1], [c0].[Id2], [c0].[Date], [c0].[Level1_Optional_Id1], [c0].[Level1_Optional_Id2], [c0].[Level1_Required_Id1], [c0].[Level1_Required_Id2], [c0].[Name], [c0].[OneToMany_Optional_Inverse2Id1], [c0].[OneToMany_Optional_Inverse2Id2], [c0].[OneToMany_Optional_Self_Inverse2Id1], [c0].[OneToMany_Optional_Self_Inverse2Id2], [c0].[OneToMany_Required_Inverse2Id1], [c0].[OneToMany_Required_Inverse2Id2], [c0].[OneToMany_Required_Self_Inverse2Id1], [c0].[OneToMany_Required_Self_Inverse2Id2], [c0].[OneToOne_Optional_PK_Inverse2Id1], [c0].[OneToOne_Optional_PK_Inverse2Id2], [c0].[OneToOne_Optional_Self2Id1], [c0].[OneToOne_Optional_Self2Id2], [c].[Id1], [c].[Id2] FROM [CompositeOnes] AS [c] -INNER JOIN [CompositeTwos] AS [c0] ON ([c].[Id1] = [c0].[OneToMany_Required_Inverse2Id1]) AND ([c].[Id2] = [c0].[OneToMany_Required_Inverse2Id2]) +INNER JOIN [CompositeTwos] AS [c0] ON [c].[Id1] = [c0].[OneToMany_Required_Inverse2Id1] AND [c].[Id2] = [c0].[OneToMany_Required_Inverse2Id2] ORDER BY [c].[Id2], [c].[Id1] DESC"); } @@ -264,12 +264,12 @@ FROM [CompositeOnes] AS [c] // @"SELECT [c0].[Id1], [c0].[Id2], [c0].[Date], [c0].[Level1_Optional_Id1], [c0].[Level1_Optional_Id2], [c0].[Level1_Required_Id1], [c0].[Level1_Required_Id2], [c0].[Name], [c0].[OneToMany_Optional_Inverse2Id1], [c0].[OneToMany_Optional_Inverse2Id2], [c0].[OneToMany_Optional_Self_Inverse2Id1], [c0].[OneToMany_Optional_Self_Inverse2Id2], [c0].[OneToMany_Required_Inverse2Id1], [c0].[OneToMany_Required_Inverse2Id2], [c0].[OneToMany_Required_Self_Inverse2Id1], [c0].[OneToMany_Required_Self_Inverse2Id2], [c0].[OneToOne_Optional_PK_Inverse2Id1], [c0].[OneToOne_Optional_PK_Inverse2Id2], [c0].[OneToOne_Optional_Self2Id1], [c0].[OneToOne_Optional_Self2Id2], [c].[Id1], [c].[Id2] FROM [CompositeOnes] AS [c] -INNER JOIN [CompositeTwos] AS [c0] ON ([c].[Id1] = [c0].[OneToMany_Optional_Inverse2Id1]) AND ([c].[Id2] = [c0].[OneToMany_Optional_Inverse2Id2]) +INNER JOIN [CompositeTwos] AS [c0] ON [c].[Id1] = [c0].[OneToMany_Optional_Inverse2Id1] AND [c].[Id2] = [c0].[OneToMany_Optional_Inverse2Id2] ORDER BY [c].[Id1], [c].[Id2], [c0].[Id2]", // @"SELECT [c0].[Id1], [c0].[Id2], [c0].[Date], [c0].[Level1_Optional_Id1], [c0].[Level1_Optional_Id2], [c0].[Level1_Required_Id1], [c0].[Level1_Required_Id2], [c0].[Name], [c0].[OneToMany_Optional_Inverse2Id1], [c0].[OneToMany_Optional_Inverse2Id2], [c0].[OneToMany_Optional_Self_Inverse2Id1], [c0].[OneToMany_Optional_Self_Inverse2Id2], [c0].[OneToMany_Required_Inverse2Id1], [c0].[OneToMany_Required_Inverse2Id2], [c0].[OneToMany_Required_Self_Inverse2Id1], [c0].[OneToMany_Required_Self_Inverse2Id2], [c0].[OneToOne_Optional_PK_Inverse2Id1], [c0].[OneToOne_Optional_PK_Inverse2Id2], [c0].[OneToOne_Optional_Self2Id1], [c0].[OneToOne_Optional_Self2Id2], [c].[Id1], [c].[Id2] FROM [CompositeOnes] AS [c] -INNER JOIN [CompositeTwos] AS [c0] ON ([c].[Id1] = [c0].[OneToMany_Required_Inverse2Id1]) AND ([c].[Id2] = [c0].[OneToMany_Required_Inverse2Id2]) +INNER JOIN [CompositeTwos] AS [c0] ON [c].[Id1] = [c0].[OneToMany_Required_Inverse2Id1] AND [c].[Id2] = [c0].[OneToMany_Required_Inverse2Id2] ORDER BY [c].[Id1], [c].[Id2], [c0].[Name] DESC"); } @@ -284,12 +284,12 @@ FROM [CompositeOnes] AS [c] // @"SELECT [c0].[Id1], [c0].[Id2], [c0].[Date], [c0].[Level1_Optional_Id1], [c0].[Level1_Optional_Id2], [c0].[Level1_Required_Id1], [c0].[Level1_Required_Id2], [c0].[Name], [c0].[OneToMany_Optional_Inverse2Id1], [c0].[OneToMany_Optional_Inverse2Id2], [c0].[OneToMany_Optional_Self_Inverse2Id1], [c0].[OneToMany_Optional_Self_Inverse2Id2], [c0].[OneToMany_Required_Inverse2Id1], [c0].[OneToMany_Required_Inverse2Id2], [c0].[OneToMany_Required_Self_Inverse2Id1], [c0].[OneToMany_Required_Self_Inverse2Id2], [c0].[OneToOne_Optional_PK_Inverse2Id1], [c0].[OneToOne_Optional_PK_Inverse2Id2], [c0].[OneToOne_Optional_Self2Id1], [c0].[OneToOne_Optional_Self2Id2], [c].[Id1], [c].[Id2] FROM [CompositeOnes] AS [c] -INNER JOIN [CompositeTwos] AS [c0] ON ([c].[Id1] = [c0].[OneToMany_Optional_Inverse2Id1]) AND ([c].[Id2] = [c0].[OneToMany_Optional_Inverse2Id2]) +INNER JOIN [CompositeTwos] AS [c0] ON [c].[Id1] = [c0].[OneToMany_Optional_Inverse2Id1] AND [c].[Id2] = [c0].[OneToMany_Optional_Inverse2Id2] ORDER BY [c].[Id2], [c].[Id1], [c0].[Id2]", // @"SELECT [c0].[Id1], [c0].[Id2], [c0].[Date], [c0].[Level1_Optional_Id1], [c0].[Level1_Optional_Id2], [c0].[Level1_Required_Id1], [c0].[Level1_Required_Id2], [c0].[Name], [c0].[OneToMany_Optional_Inverse2Id1], [c0].[OneToMany_Optional_Inverse2Id2], [c0].[OneToMany_Optional_Self_Inverse2Id1], [c0].[OneToMany_Optional_Self_Inverse2Id2], [c0].[OneToMany_Required_Inverse2Id1], [c0].[OneToMany_Required_Inverse2Id2], [c0].[OneToMany_Required_Self_Inverse2Id1], [c0].[OneToMany_Required_Self_Inverse2Id2], [c0].[OneToOne_Optional_PK_Inverse2Id1], [c0].[OneToOne_Optional_PK_Inverse2Id2], [c0].[OneToOne_Optional_Self2Id1], [c0].[OneToOne_Optional_Self2Id2], [c].[Id1], [c].[Id2] FROM [CompositeOnes] AS [c] -INNER JOIN [CompositeTwos] AS [c0] ON ([c].[Id1] = [c0].[OneToMany_Required_Inverse2Id1]) AND ([c].[Id2] = [c0].[OneToMany_Required_Inverse2Id2]) +INNER JOIN [CompositeTwos] AS [c0] ON [c].[Id1] = [c0].[OneToMany_Required_Inverse2Id1] AND [c].[Id2] = [c0].[OneToMany_Required_Inverse2Id2] ORDER BY [c].[Id2], [c].[Id1], [c0].[Name] DESC"); } diff --git a/test/EFCore.SqlServer.FunctionalTests/Query/FiltersInheritanceQuerySqlServerTest.cs b/test/EFCore.SqlServer.FunctionalTests/Query/FiltersInheritanceQuerySqlServerTest.cs index 9211dd6fe16..79f079f13bf 100644 --- a/test/EFCore.SqlServer.FunctionalTests/Query/FiltersInheritanceQuerySqlServerTest.cs +++ b/test/EFCore.SqlServer.FunctionalTests/Query/FiltersInheritanceQuerySqlServerTest.cs @@ -33,7 +33,7 @@ public override async Task Can_use_is_kiwi(bool async) AssertSql( @"SELECT [a].[Species], [a].[CountryId], [a].[Discriminator], [a].[Name], [a].[EagleId], [a].[IsFlightless], [a].[Group], [a].[FoundOn] FROM [Animals] AS [a] -WHERE ([a].[CountryId] = 1) AND ([a].[Discriminator] = N'Kiwi')"); +WHERE [a].[CountryId] = 1 AND [a].[Discriminator] = N'Kiwi'"); } public override async Task Can_use_is_kiwi_with_other_predicate(bool async) @@ -43,7 +43,7 @@ public override async Task Can_use_is_kiwi_with_other_predicate(bool async) AssertSql( @"SELECT [a].[Species], [a].[CountryId], [a].[Discriminator], [a].[Name], [a].[EagleId], [a].[IsFlightless], [a].[Group], [a].[FoundOn] FROM [Animals] AS [a] -WHERE ([a].[CountryId] = 1) AND (([a].[Discriminator] = N'Kiwi') AND ([a].[CountryId] = 1))"); +WHERE [a].[CountryId] = 1 AND [a].[Discriminator] = N'Kiwi' AND [a].[CountryId] = 1"); } public override async Task Can_use_is_kiwi_in_projection(bool async) @@ -77,7 +77,7 @@ public override async Task Can_use_of_type_bird_predicate(bool async) AssertSql( @"SELECT [a].[Species], [a].[CountryId], [a].[Discriminator], [a].[Name], [a].[EagleId], [a].[IsFlightless], [a].[Group], [a].[FoundOn] FROM [Animals] AS [a] -WHERE ([a].[CountryId] = 1) AND ([a].[CountryId] = 1) +WHERE [a].[CountryId] = 1 AND [a].[CountryId] = 1 ORDER BY [a].[Species]"); } @@ -109,7 +109,7 @@ public override async Task Can_use_of_type_kiwi(bool async) AssertSql( @"SELECT [a].[Species], [a].[CountryId], [a].[Discriminator], [a].[Name], [a].[EagleId], [a].[IsFlightless], [a].[FoundOn] FROM [Animals] AS [a] -WHERE ([a].[CountryId] = 1) AND ([a].[Discriminator] = N'Kiwi')"); +WHERE [a].[CountryId] = 1 AND [a].[Discriminator] = N'Kiwi'"); } public override async Task Can_use_derived_set(bool async) @@ -119,7 +119,7 @@ public override async Task Can_use_derived_set(bool async) AssertSql( @"SELECT [a].[Species], [a].[CountryId], [a].[Discriminator], [a].[Name], [a].[EagleId], [a].[IsFlightless], [a].[Group] FROM [Animals] AS [a] -WHERE ([a].[Discriminator] = N'Eagle') AND ([a].[CountryId] = 1)"); +WHERE [a].[Discriminator] = N'Eagle' AND [a].[CountryId] = 1"); } private void AssertSql(params string[] expected) diff --git a/test/EFCore.SqlServer.FunctionalTests/Query/FromSqlQuerySqlServerTest.cs b/test/EFCore.SqlServer.FunctionalTests/Query/FromSqlQuerySqlServerTest.cs index 0f2b1d5ae7f..5023a38db4b 100644 --- a/test/EFCore.SqlServer.FunctionalTests/Query/FromSqlQuerySqlServerTest.cs +++ b/test/EFCore.SqlServer.FunctionalTests/Query/FromSqlQuerySqlServerTest.cs @@ -153,7 +153,7 @@ public override async Task FromSqlRaw_composed_contains2(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].[CustomerID] = N'ALFKI') AND EXISTS ( +WHERE [c].[CustomerID] = N'ALFKI' AND EXISTS ( SELECT 1 FROM ( SELECT * FROM ""Orders"" @@ -447,7 +447,7 @@ public override async Task FromSqlRaw_composed_with_nullable_predicate(bool asyn FROM ( SELECT * FROM ""Customers"" ) AS [m] -WHERE ([m].[ContactName] = [m].[CompanyName]) OR ([m].[ContactName] IS NULL AND [m].[CompanyName] IS NULL)"); +WHERE [m].[ContactName] = [m].[CompanyName] OR ([m].[ContactName] IS NULL AND [m].[CompanyName] IS NULL)"); } public override async Task FromSqlRaw_with_dbParameter(bool async) @@ -568,7 +568,7 @@ SELECT [m].[OrderID] SELECT [o].[OrderID] FROM [Orders] AS [o] -WHERE ([o].[OrderID] <= @__max_0) AND EXISTS ( +WHERE [o].[OrderID] <= @__max_0 AND EXISTS ( SELECT 1 FROM ( SELECT * FROM ""Orders"" WHERE ""OrderID"" >= @p0 @@ -580,7 +580,7 @@ SELECT 1 SELECT [o].[OrderID] FROM [Orders] AS [o] -WHERE ([o].[OrderID] <= @__max_0) AND EXISTS ( +WHERE [o].[OrderID] <= @__max_0 AND EXISTS ( SELECT 1 FROM ( SELECT * FROM ""Orders"" WHERE ""OrderID"" >= @p0 diff --git a/test/EFCore.SqlServer.FunctionalTests/Query/FunkyDataQuerySqlServerTest.cs b/test/EFCore.SqlServer.FunctionalTests/Query/FunkyDataQuerySqlServerTest.cs index f3d8ed331f6..c43efa036fb 100644 --- a/test/EFCore.SqlServer.FunctionalTests/Query/FunkyDataQuerySqlServerTest.cs +++ b/test/EFCore.SqlServer.FunctionalTests/Query/FunkyDataQuerySqlServerTest.cs @@ -69,45 +69,45 @@ public override async Task String_contains_on_argument_with_wildcard_parameter(b SELECT [f].[FirstName] FROM [FunkyCustomers] AS [f] -WHERE (@__prm1_0 LIKE N'') OR (CHARINDEX(@__prm1_0, [f].[FirstName]) > 0)", +WHERE (@__prm1_0 LIKE N'') OR CHARINDEX(@__prm1_0, [f].[FirstName]) > 0", // @"@__prm2_0='a_' (Size = 4000) SELECT [f].[FirstName] FROM [FunkyCustomers] AS [f] -WHERE (@__prm2_0 LIKE N'') OR (CHARINDEX(@__prm2_0, [f].[FirstName]) > 0)", +WHERE (@__prm2_0 LIKE N'') OR CHARINDEX(@__prm2_0, [f].[FirstName]) > 0", // @"SELECT [f].[FirstName] FROM [FunkyCustomers] AS [f] -WHERE (NULL LIKE N'') OR (CHARINDEX(NULL, [f].[FirstName]) > 0)", +WHERE (NULL LIKE N'') OR CHARINDEX(NULL, [f].[FirstName]) > 0", // @"@__prm4_0='' (Size = 4000) SELECT [f].[FirstName] FROM [FunkyCustomers] AS [f] -WHERE (@__prm4_0 LIKE N'') OR (CHARINDEX(@__prm4_0, [f].[FirstName]) > 0)", +WHERE (@__prm4_0 LIKE N'') OR CHARINDEX(@__prm4_0, [f].[FirstName]) > 0", // @"@__prm5_0='_Ba_' (Size = 4000) SELECT [f].[FirstName] FROM [FunkyCustomers] AS [f] -WHERE (@__prm5_0 LIKE N'') OR (CHARINDEX(@__prm5_0, [f].[FirstName]) > 0)", +WHERE (@__prm5_0 LIKE N'') OR CHARINDEX(@__prm5_0, [f].[FirstName]) > 0", // @"@__prm6_0='%B%a%r' (Size = 4000) SELECT [f].[FirstName] FROM [FunkyCustomers] AS [f] -WHERE NOT ((@__prm6_0 LIKE N'') OR (CHARINDEX(@__prm6_0, [f].[FirstName]) > 0))", +WHERE NOT ((@__prm6_0 LIKE N'') OR CHARINDEX(@__prm6_0, [f].[FirstName]) > 0)", // @"@__prm7_0='' (Size = 4000) SELECT [f].[FirstName] FROM [FunkyCustomers] AS [f] -WHERE NOT ((@__prm7_0 LIKE N'') OR (CHARINDEX(@__prm7_0, [f].[FirstName]) > 0))", +WHERE NOT ((@__prm7_0 LIKE N'') OR CHARINDEX(@__prm7_0, [f].[FirstName]) > 0)", // @"SELECT [f].[FirstName] FROM [FunkyCustomers] AS [f] -WHERE NOT ((NULL LIKE N'') OR (CHARINDEX(NULL, [f].[FirstName]) > 0))"); +WHERE NOT ((NULL LIKE N'') OR CHARINDEX(NULL, [f].[FirstName]) > 0)"); } public override async Task String_contains_on_argument_with_wildcard_column(bool async) @@ -118,7 +118,7 @@ public override async Task String_contains_on_argument_with_wildcard_column(bool @"SELECT [f].[FirstName] AS [fn], [f0].[LastName] AS [ln] FROM [FunkyCustomers] AS [f] CROSS JOIN [FunkyCustomers] AS [f0] -WHERE ([f0].[LastName] LIKE N'') OR (CHARINDEX([f0].[LastName], [f].[FirstName]) > 0)"); +WHERE ([f0].[LastName] LIKE N'') OR CHARINDEX([f0].[LastName], [f].[FirstName]) > 0"); } public override async Task String_contains_on_argument_with_wildcard_column_negated(bool async) @@ -129,7 +129,7 @@ public override async Task String_contains_on_argument_with_wildcard_column_nega @"SELECT [f].[FirstName] AS [fn], [f0].[LastName] AS [ln] FROM [FunkyCustomers] AS [f] CROSS JOIN [FunkyCustomers] AS [f0] -WHERE NOT (([f0].[LastName] LIKE N'') OR (CHARINDEX([f0].[LastName], [f].[FirstName]) > 0))"); +WHERE NOT (([f0].[LastName] LIKE N'') OR CHARINDEX([f0].[LastName], [f].[FirstName]) > 0)"); } public override async Task String_starts_with_on_argument_with_wildcard_constant(bool async) @@ -178,13 +178,13 @@ public override async Task String_starts_with_on_argument_with_wildcard_paramete SELECT [f].[FirstName] FROM [FunkyCustomers] AS [f] -WHERE (@__prm1_0 = N'') OR ([f].[FirstName] IS NOT NULL AND (LEFT([f].[FirstName], LEN(@__prm1_0)) = @__prm1_0))", +WHERE @__prm1_0 = N'' OR ([f].[FirstName] IS NOT NULL AND LEFT([f].[FirstName], LEN(@__prm1_0)) = @__prm1_0)", // @"@__prm2_0='a_' (Size = 4000) SELECT [f].[FirstName] FROM [FunkyCustomers] AS [f] -WHERE (@__prm2_0 = N'') OR ([f].[FirstName] IS NOT NULL AND (LEFT([f].[FirstName], LEN(@__prm2_0)) = @__prm2_0))", +WHERE @__prm2_0 = N'' OR ([f].[FirstName] IS NOT NULL AND LEFT([f].[FirstName], LEN(@__prm2_0)) = @__prm2_0)", // @"SELECT [f].[FirstName] FROM [FunkyCustomers] AS [f] @@ -194,25 +194,25 @@ FROM [FunkyCustomers] AS [f] SELECT [f].[FirstName] FROM [FunkyCustomers] AS [f] -WHERE (@__prm4_0 = N'') OR ([f].[FirstName] IS NOT NULL AND (LEFT([f].[FirstName], LEN(@__prm4_0)) = @__prm4_0))", +WHERE @__prm4_0 = N'' OR ([f].[FirstName] IS NOT NULL AND LEFT([f].[FirstName], LEN(@__prm4_0)) = @__prm4_0)", // @"@__prm5_0='_Ba_' (Size = 4000) SELECT [f].[FirstName] FROM [FunkyCustomers] AS [f] -WHERE (@__prm5_0 = N'') OR ([f].[FirstName] IS NOT NULL AND (LEFT([f].[FirstName], LEN(@__prm5_0)) = @__prm5_0))", +WHERE @__prm5_0 = N'' OR ([f].[FirstName] IS NOT NULL AND LEFT([f].[FirstName], LEN(@__prm5_0)) = @__prm5_0)", // @"@__prm6_0='%B%a%r' (Size = 4000) SELECT [f].[FirstName] FROM [FunkyCustomers] AS [f] -WHERE (@__prm6_0 <> N'') AND ([f].[FirstName] IS NOT NULL AND (LEFT([f].[FirstName], LEN(@__prm6_0)) <> @__prm6_0))", +WHERE @__prm6_0 <> N'' AND [f].[FirstName] IS NOT NULL AND LEFT([f].[FirstName], LEN(@__prm6_0)) <> @__prm6_0", // @"@__prm7_0='' (Size = 4000) SELECT [f].[FirstName] FROM [FunkyCustomers] AS [f] -WHERE (@__prm7_0 <> N'') AND ([f].[FirstName] IS NOT NULL AND (LEFT([f].[FirstName], LEN(@__prm7_0)) <> @__prm7_0))", +WHERE @__prm7_0 <> N'' AND [f].[FirstName] IS NOT NULL AND LEFT([f].[FirstName], LEN(@__prm7_0)) <> @__prm7_0", // @"SELECT [f].[FirstName] FROM [FunkyCustomers] AS [f] @@ -240,23 +240,23 @@ WHERE [f].[FirstName] IS NOT NULL AND ([f].[FirstName] LIKE N'B\[\[a^%' ESCAPE N SELECT [f].[Id], [f].[FirstName], [f].[LastName], [f].[NullableBool] FROM [FunkyCustomers] AS [f] -WHERE (@__prm1_0 = N'') OR ([f].[FirstName] IS NOT NULL AND (LEFT([f].[FirstName], LEN(@__prm1_0)) = @__prm1_0))", +WHERE @__prm1_0 = N'' OR ([f].[FirstName] IS NOT NULL AND LEFT([f].[FirstName], LEN(@__prm1_0)) = @__prm1_0)", // @"@__prm2_0='B[' (Size = 4000) SELECT [f].[Id], [f].[FirstName], [f].[LastName], [f].[NullableBool] FROM [FunkyCustomers] AS [f] -WHERE (@__prm2_0 = N'') OR ([f].[FirstName] IS NOT NULL AND (LEFT([f].[FirstName], LEN(@__prm2_0)) = @__prm2_0))", +WHERE @__prm2_0 = N'' OR ([f].[FirstName] IS NOT NULL AND LEFT([f].[FirstName], LEN(@__prm2_0)) = @__prm2_0)", // @"@__prm3_0='B[[a^' (Size = 4000) SELECT [f].[Id], [f].[FirstName], [f].[LastName], [f].[NullableBool] FROM [FunkyCustomers] AS [f] -WHERE (@__prm3_0 = N'') OR ([f].[FirstName] IS NOT NULL AND (LEFT([f].[FirstName], LEN(@__prm3_0)) = @__prm3_0))", +WHERE @__prm3_0 = N'' OR ([f].[FirstName] IS NOT NULL AND LEFT([f].[FirstName], LEN(@__prm3_0)) = @__prm3_0)", // @"SELECT [f].[Id], [f].[FirstName], [f].[LastName], [f].[NullableBool] FROM [FunkyCustomers] AS [f] -WHERE ([f].[LastName] = N'') OR ([f].[FirstName] IS NOT NULL AND ([f].[LastName] IS NOT NULL AND (LEFT([f].[FirstName], LEN([f].[LastName])) = [f].[LastName])))"); +WHERE [f].[LastName] = N'' OR ([f].[FirstName] IS NOT NULL AND [f].[LastName] IS NOT NULL AND LEFT([f].[FirstName], LEN([f].[LastName])) = [f].[LastName])"); } public override async Task String_starts_with_on_argument_with_wildcard_column(bool async) @@ -267,7 +267,7 @@ public override async Task String_starts_with_on_argument_with_wildcard_column(b @"SELECT [f].[FirstName] AS [fn], [f0].[LastName] AS [ln] FROM [FunkyCustomers] AS [f] CROSS JOIN [FunkyCustomers] AS [f0] -WHERE ([f0].[LastName] = N'') OR ([f].[FirstName] IS NOT NULL AND ([f0].[LastName] IS NOT NULL AND (LEFT([f].[FirstName], LEN([f0].[LastName])) = [f0].[LastName])))"); +WHERE [f0].[LastName] = N'' OR ([f].[FirstName] IS NOT NULL AND [f0].[LastName] IS NOT NULL AND LEFT([f].[FirstName], LEN([f0].[LastName])) = [f0].[LastName])"); } public override async Task String_starts_with_on_argument_with_wildcard_column_negated(bool async) @@ -278,7 +278,7 @@ public override async Task String_starts_with_on_argument_with_wildcard_column_n @"SELECT [f].[FirstName] AS [fn], [f0].[LastName] AS [ln] FROM [FunkyCustomers] AS [f] CROSS JOIN [FunkyCustomers] AS [f0] -WHERE (([f0].[LastName] <> N'') OR [f0].[LastName] IS NULL) AND ([f].[FirstName] IS NOT NULL AND ([f0].[LastName] IS NOT NULL AND (LEFT([f].[FirstName], LEN([f0].[LastName])) <> [f0].[LastName])))"); +WHERE ([f0].[LastName] <> N'' OR [f0].[LastName] IS NULL) AND [f].[FirstName] IS NOT NULL AND [f0].[LastName] IS NOT NULL AND LEFT([f].[FirstName], LEN([f0].[LastName])) <> [f0].[LastName]"); } public override async Task String_ends_with_on_argument_with_wildcard_constant(bool async) @@ -327,13 +327,13 @@ public override async Task String_ends_with_on_argument_with_wildcard_parameter( SELECT [f].[FirstName] FROM [FunkyCustomers] AS [f] -WHERE (@__prm1_0 = N'') OR ([f].[FirstName] IS NOT NULL AND (RIGHT([f].[FirstName], LEN(@__prm1_0)) = @__prm1_0))", +WHERE @__prm1_0 = N'' OR ([f].[FirstName] IS NOT NULL AND RIGHT([f].[FirstName], LEN(@__prm1_0)) = @__prm1_0)", // @"@__prm2_0='a_' (Size = 4000) SELECT [f].[FirstName] FROM [FunkyCustomers] AS [f] -WHERE (@__prm2_0 = N'') OR ([f].[FirstName] IS NOT NULL AND (RIGHT([f].[FirstName], LEN(@__prm2_0)) = @__prm2_0))", +WHERE @__prm2_0 = N'' OR ([f].[FirstName] IS NOT NULL AND RIGHT([f].[FirstName], LEN(@__prm2_0)) = @__prm2_0)", // @"SELECT [f].[FirstName] FROM [FunkyCustomers] AS [f] @@ -343,25 +343,25 @@ FROM [FunkyCustomers] AS [f] SELECT [f].[FirstName] FROM [FunkyCustomers] AS [f] -WHERE (@__prm4_0 = N'') OR ([f].[FirstName] IS NOT NULL AND (RIGHT([f].[FirstName], LEN(@__prm4_0)) = @__prm4_0))", +WHERE @__prm4_0 = N'' OR ([f].[FirstName] IS NOT NULL AND RIGHT([f].[FirstName], LEN(@__prm4_0)) = @__prm4_0)", // @"@__prm5_0='_Ba_' (Size = 4000) SELECT [f].[FirstName] FROM [FunkyCustomers] AS [f] -WHERE (@__prm5_0 = N'') OR ([f].[FirstName] IS NOT NULL AND (RIGHT([f].[FirstName], LEN(@__prm5_0)) = @__prm5_0))", +WHERE @__prm5_0 = N'' OR ([f].[FirstName] IS NOT NULL AND RIGHT([f].[FirstName], LEN(@__prm5_0)) = @__prm5_0)", // @"@__prm6_0='%B%a%r' (Size = 4000) SELECT [f].[FirstName] FROM [FunkyCustomers] AS [f] -WHERE (@__prm6_0 <> N'') AND ([f].[FirstName] IS NOT NULL AND (RIGHT([f].[FirstName], LEN(@__prm6_0)) <> @__prm6_0))", +WHERE @__prm6_0 <> N'' AND [f].[FirstName] IS NOT NULL AND RIGHT([f].[FirstName], LEN(@__prm6_0)) <> @__prm6_0", // @"@__prm7_0='' (Size = 4000) SELECT [f].[FirstName] FROM [FunkyCustomers] AS [f] -WHERE (@__prm7_0 <> N'') AND ([f].[FirstName] IS NOT NULL AND (RIGHT([f].[FirstName], LEN(@__prm7_0)) <> @__prm7_0))", +WHERE @__prm7_0 <> N'' AND [f].[FirstName] IS NOT NULL AND RIGHT([f].[FirstName], LEN(@__prm7_0)) <> @__prm7_0", // @"SELECT [f].[FirstName] FROM [FunkyCustomers] AS [f] @@ -376,7 +376,7 @@ public override async Task String_ends_with_on_argument_with_wildcard_column(boo @"SELECT [f].[FirstName] AS [fn], [f0].[LastName] AS [ln] FROM [FunkyCustomers] AS [f] CROSS JOIN [FunkyCustomers] AS [f0] -WHERE ([f0].[LastName] = N'') OR ([f].[FirstName] IS NOT NULL AND ([f0].[LastName] IS NOT NULL AND (RIGHT([f].[FirstName], LEN([f0].[LastName])) = [f0].[LastName])))"); +WHERE [f0].[LastName] = N'' OR ([f].[FirstName] IS NOT NULL AND [f0].[LastName] IS NOT NULL AND RIGHT([f].[FirstName], LEN([f0].[LastName])) = [f0].[LastName])"); } public override async Task String_ends_with_on_argument_with_wildcard_column_negated(bool async) @@ -387,7 +387,7 @@ public override async Task String_ends_with_on_argument_with_wildcard_column_neg @"SELECT [f].[FirstName] AS [fn], [f0].[LastName] AS [ln] FROM [FunkyCustomers] AS [f] CROSS JOIN [FunkyCustomers] AS [f0] -WHERE (([f0].[LastName] <> N'') OR [f0].[LastName] IS NULL) AND ([f].[FirstName] IS NOT NULL AND ([f0].[LastName] IS NOT NULL AND (RIGHT([f].[FirstName], LEN([f0].[LastName])) <> [f0].[LastName])))"); +WHERE ([f0].[LastName] <> N'' OR [f0].[LastName] IS NULL) AND [f].[FirstName] IS NOT NULL AND [f0].[LastName] IS NOT NULL AND RIGHT([f].[FirstName], LEN([f0].[LastName])) <> [f0].[LastName]"); } public override async Task String_ends_with_inside_conditional(bool async) @@ -399,7 +399,7 @@ public override async Task String_ends_with_inside_conditional(bool async) FROM [FunkyCustomers] AS [f] CROSS JOIN [FunkyCustomers] AS [f0] WHERE CASE - WHEN ([f0].[LastName] = N'') OR ([f].[FirstName] IS NOT NULL AND ([f0].[LastName] IS NOT NULL AND (RIGHT([f].[FirstName], LEN([f0].[LastName])) = [f0].[LastName]))) THEN CAST(1 AS bit) + WHEN [f0].[LastName] = N'' OR ([f].[FirstName] IS NOT NULL AND [f0].[LastName] IS NOT NULL AND RIGHT([f].[FirstName], LEN([f0].[LastName])) = [f0].[LastName]) THEN CAST(1 AS bit) ELSE CAST(0 AS bit) END = CAST(1 AS bit)"); } @@ -413,7 +413,7 @@ public override async Task String_ends_with_inside_conditional_negated(bool asyn FROM [FunkyCustomers] AS [f] CROSS JOIN [FunkyCustomers] AS [f0] WHERE CASE - WHEN (([f0].[LastName] <> N'') OR [f0].[LastName] IS NULL) AND ([f].[FirstName] IS NOT NULL AND ([f0].[LastName] IS NOT NULL AND (RIGHT([f].[FirstName], LEN([f0].[LastName])) <> [f0].[LastName]))) THEN CAST(1 AS bit) + WHEN ([f0].[LastName] <> N'' OR [f0].[LastName] IS NULL) AND [f].[FirstName] IS NOT NULL AND [f0].[LastName] IS NOT NULL AND RIGHT([f].[FirstName], LEN([f0].[LastName])) <> [f0].[LastName] THEN CAST(1 AS bit) ELSE CAST(0 AS bit) END = CAST(1 AS bit)"); } @@ -427,7 +427,7 @@ public override async Task String_ends_with_equals_nullable_column(bool async) FROM [FunkyCustomers] AS [f] CROSS JOIN [FunkyCustomers] AS [f0] WHERE CASE - WHEN (([f0].[LastName] = N'') AND [f0].[LastName] IS NOT NULL) OR ([f].[FirstName] IS NOT NULL AND ([f0].[LastName] IS NOT NULL AND (RIGHT([f].[FirstName], LEN([f0].[LastName])) = [f0].[LastName]))) THEN CAST(1 AS bit) + WHEN ([f0].[LastName] = N'' AND [f0].[LastName] IS NOT NULL) OR ([f].[FirstName] IS NOT NULL AND [f0].[LastName] IS NOT NULL AND RIGHT([f].[FirstName], LEN([f0].[LastName])) = [f0].[LastName]) THEN CAST(1 AS bit) ELSE CAST(0 AS bit) END = [f].[NullableBool]"); } @@ -440,10 +440,10 @@ public override async Task String_ends_with_not_equals_nullable_column(bool asyn @"SELECT [f].[Id], [f].[FirstName], [f].[LastName], [f].[NullableBool], [f0].[Id], [f0].[FirstName], [f0].[LastName], [f0].[NullableBool] 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) +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) ELSE CAST(0 AS bit) -END <> [f].[NullableBool]) OR ([f].[NullableBool] IS NULL)"); +END <> [f].[NullableBool] OR ([f].[NullableBool] IS NULL)"); } public override async Task String_FirstOrDefault_and_LastOrDefault(bool async) diff --git a/test/EFCore.SqlServer.FunctionalTests/Query/GearsOfWarQuerySqlServerTest.cs b/test/EFCore.SqlServer.FunctionalTests/Query/GearsOfWarQuerySqlServerTest.cs index 7bc0b549a99..cc7c2bd0eee 100644 --- a/test/EFCore.SqlServer.FunctionalTests/Query/GearsOfWarQuerySqlServerTest.cs +++ b/test/EFCore.SqlServer.FunctionalTests/Query/GearsOfWarQuerySqlServerTest.cs @@ -71,7 +71,7 @@ public override async Task Include_multiple_one_to_one_and_one_to_many(bool asyn AssertSql( @"SELECT [t].[Id], [t].[GearNickName], [t].[GearSquadId], [t].[IssueDate], [t].[Note], [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 [Tags] AS [t] -LEFT JOIN [Gears] AS [g] ON ([t].[GearNickName] = [g].[Nickname]) AND ([t].[GearSquadId] = [g].[SquadId]) +LEFT JOIN [Gears] AS [g] ON [t].[GearNickName] = [g].[Nickname] AND [t].[GearSquadId] = [g].[SquadId] LEFT JOIN [Weapons] AS [w] ON [g].[FullName] = [w].[OwnerFullName] ORDER BY [t].[Id], [g].[Nickname], [g].[SquadId]"); } @@ -83,7 +83,7 @@ public override async Task Include_multiple_one_to_one_optional_and_one_to_one_r AssertSql( @"SELECT [t].[Id], [t].[GearNickName], [t].[GearSquadId], [t].[IssueDate], [t].[Note], [g].[Nickname], [g].[SquadId], [g].[AssignedCityName], [g].[CityOfBirthName], [g].[Discriminator], [g].[FullName], [g].[HasSoulPatch], [g].[LeaderNickname], [g].[LeaderSquadId], [g].[Rank], [s].[Id], [s].[Banner], [s].[Banner5], [s].[InternalNumber], [s].[Name] FROM [Tags] AS [t] -LEFT JOIN [Gears] AS [g] ON ([t].[GearNickName] = [g].[Nickname]) AND ([t].[GearSquadId] = [g].[SquadId]) +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]"); } @@ -131,7 +131,7 @@ public override async Task Include_navigation_on_derived_type(bool 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], [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].[Nickname] = [g0].[LeaderNickname]) AND ([g].[SquadId] = [g0].[LeaderSquadId]) +LEFT JOIN [Gears] AS [g0] ON [g].[Nickname] = [g0].[LeaderNickname] AND [g].[SquadId] = [g0].[LeaderSquadId] WHERE [g].[Discriminator] = N'Officer' ORDER BY [g].[Nickname], [g].[SquadId], [g0].[Nickname]"); } @@ -143,7 +143,7 @@ public override async Task String_based_Include_navigation_on_derived_type(bool 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], [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].[Nickname] = [g0].[LeaderNickname]) AND ([g].[SquadId] = [g0].[LeaderSquadId]) +LEFT JOIN [Gears] AS [g0] ON [g].[Nickname] = [g0].[LeaderNickname] AND [g].[SquadId] = [g0].[LeaderSquadId] WHERE [g].[Discriminator] = N'Officer' ORDER BY [g].[Nickname], [g].[SquadId], [g0].[Nickname]"); } @@ -155,7 +155,7 @@ public override async Task Select_Where_Navigation_Included(bool async) AssertSql( @"SELECT [t].[Id], [t].[GearNickName], [t].[GearSquadId], [t].[IssueDate], [t].[Note], [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]) +LEFT JOIN [Gears] AS [g] ON [t].[GearNickName] = [g].[Nickname] AND [t].[GearSquadId] = [g].[SquadId] WHERE [g].[Nickname] = N'Marcus'"); } @@ -166,7 +166,7 @@ public override async Task Include_with_join_reference1(bool async) AssertSql( @"SELECT [g].[Nickname], [g].[SquadId], [g].[AssignedCityName], [g].[CityOfBirthName], [g].[Discriminator], [g].[FullName], [g].[HasSoulPatch], [g].[LeaderNickname], [g].[LeaderSquadId], [g].[Rank], [c].[Name], [c].[Location], [c].[Nation] FROM [Gears] AS [g] -INNER JOIN [Tags] AS [t] ON ([g].[SquadId] = [t].[GearSquadId]) AND ([g].[Nickname] = [t].[GearNickName]) +INNER JOIN [Tags] AS [t] ON [g].[SquadId] = [t].[GearSquadId] AND [g].[Nickname] = [t].[GearNickName] INNER JOIN [Cities] AS [c] ON [g].[CityOfBirthName] = [c].[Name]"); } @@ -177,7 +177,7 @@ public override async Task Include_with_join_reference2(bool async) AssertSql( @"SELECT [g].[Nickname], [g].[SquadId], [g].[AssignedCityName], [g].[CityOfBirthName], [g].[Discriminator], [g].[FullName], [g].[HasSoulPatch], [g].[LeaderNickname], [g].[LeaderSquadId], [g].[Rank], [c].[Name], [c].[Location], [c].[Nation] FROM [Tags] AS [t] -INNER JOIN [Gears] AS [g] ON ([t].[GearSquadId] = [g].[SquadId]) AND ([t].[GearNickName] = [g].[Nickname]) +INNER JOIN [Gears] AS [g] ON [t].[GearSquadId] = [g].[SquadId] AND [t].[GearNickName] = [g].[Nickname] INNER JOIN [Cities] AS [c] ON [g].[CityOfBirthName] = [c].[Name]"); } @@ -188,7 +188,7 @@ public override async Task Include_with_join_collection1(bool async) AssertSql( @"SELECT [g].[Nickname], [g].[SquadId], [g].[AssignedCityName], [g].[CityOfBirthName], [g].[Discriminator], [g].[FullName], [g].[HasSoulPatch], [g].[LeaderNickname], [g].[LeaderSquadId], [g].[Rank], [t].[Id], [w].[Id], [w].[AmmunitionType], [w].[IsAutomatic], [w].[Name], [w].[OwnerFullName], [w].[SynergyWithId] FROM [Gears] AS [g] -INNER JOIN [Tags] AS [t] ON ([g].[SquadId] = [t].[GearSquadId]) AND ([g].[Nickname] = [t].[GearNickName]) +INNER JOIN [Tags] AS [t] ON [g].[SquadId] = [t].[GearSquadId] AND [g].[Nickname] = [t].[GearNickName] LEFT JOIN [Weapons] AS [w] ON [g].[FullName] = [w].[OwnerFullName] ORDER BY [g].[Nickname], [g].[SquadId], [t].[Id]"); } @@ -200,7 +200,7 @@ public override async Task Include_with_join_collection2(bool async) AssertSql( @"SELECT [g].[Nickname], [g].[SquadId], [g].[AssignedCityName], [g].[CityOfBirthName], [g].[Discriminator], [g].[FullName], [g].[HasSoulPatch], [g].[LeaderNickname], [g].[LeaderSquadId], [g].[Rank], [t].[Id], [w].[Id], [w].[AmmunitionType], [w].[IsAutomatic], [w].[Name], [w].[OwnerFullName], [w].[SynergyWithId] FROM [Tags] AS [t] -INNER JOIN [Gears] AS [g] ON ([t].[GearSquadId] = [g].[SquadId]) AND ([t].[GearNickName] = [g].[Nickname]) +INNER JOIN [Gears] AS [g] ON [t].[GearSquadId] = [g].[SquadId] AND [t].[GearNickName] = [g].[Nickname] LEFT JOIN [Weapons] AS [w] ON [g].[FullName] = [w].[OwnerFullName] ORDER BY [t].[Id], [g].[Nickname], [g].[SquadId]"); } @@ -215,7 +215,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]) +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')"); } @@ -230,7 +230,7 @@ public override async Task Include_where_list_contains_navigation2(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] 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]) +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')"); } @@ -244,7 +244,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]) +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')"); } @@ -255,7 +255,7 @@ public override async Task Include_with_join_multi_level(bool async) AssertSql( @"SELECT [g].[Nickname], [g].[SquadId], [g].[AssignedCityName], [g].[CityOfBirthName], [g].[Discriminator], [g].[FullName], [g].[HasSoulPatch], [g].[LeaderNickname], [g].[LeaderSquadId], [g].[Rank], [c].[Name], [c].[Location], [c].[Nation], [t].[Id], [g0].[Nickname], [g0].[SquadId], [g0].[AssignedCityName], [g0].[CityOfBirthName], [g0].[Discriminator], [g0].[FullName], [g0].[HasSoulPatch], [g0].[LeaderNickname], [g0].[LeaderSquadId], [g0].[Rank] FROM [Gears] AS [g] -INNER JOIN [Tags] AS [t] ON ([g].[SquadId] = [t].[GearSquadId]) AND ([g].[Nickname] = [t].[GearNickName]) +INNER JOIN [Tags] AS [t] ON [g].[SquadId] = [t].[GearSquadId] AND [g].[Nickname] = [t].[GearNickName] INNER JOIN [Cities] AS [c] ON [g].[CityOfBirthName] = [c].[Name] LEFT JOIN [Gears] AS [g0] ON [c].[Name] = [g0].[AssignedCityName] ORDER BY [g].[Nickname], [g].[SquadId], [t].[Id], [c].[Name], [g0].[Nickname]"); @@ -272,7 +272,7 @@ INNER JOIN ( 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].[Discriminator] = N'Officer' -) AS [t0] ON ([t].[GearSquadId] = [t0].[SquadId]) AND ([t].[GearNickName] = [t0].[Nickname]) +) AS [t0] ON [t].[GearSquadId] = [t0].[SquadId] AND [t].[GearNickName] = [t0].[Nickname] INNER JOIN [Cities] AS [c] ON [t0].[CityOfBirthName] = [c].[Name]"); } @@ -287,8 +287,8 @@ INNER JOIN ( 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].[Discriminator] = N'Officer' -) AS [t0] ON ([t].[GearSquadId] = [t0].[SquadId]) AND ([t].[GearNickName] = [t0].[Nickname]) -LEFT JOIN [Gears] AS [g0] ON ([t0].[Nickname] = [g0].[LeaderNickname]) AND ([t0].[SquadId] = [g0].[LeaderSquadId]) +) AS [t0] ON [t].[GearSquadId] = [t0].[SquadId] AND [t].[GearNickName] = [t0].[Nickname] +LEFT JOIN [Gears] AS [g0] ON [t0].[Nickname] = [g0].[LeaderNickname] AND [t0].[SquadId] = [g0].[LeaderSquadId] ORDER BY [t0].[HasSoulPatch], [t0].[Nickname] DESC, [t].[Id], [t0].[SquadId], [g0].[Nickname]"); } @@ -299,7 +299,7 @@ public override async Task Include_with_join_and_inheritance2(bool async) AssertSql( @"SELECT [g].[Nickname], [g].[SquadId], [g].[AssignedCityName], [g].[CityOfBirthName], [g].[Discriminator], [g].[FullName], [g].[HasSoulPatch], [g].[LeaderNickname], [g].[LeaderSquadId], [g].[Rank], [t].[Id], [w].[Id], [w].[AmmunitionType], [w].[IsAutomatic], [w].[Name], [w].[OwnerFullName], [w].[SynergyWithId] FROM [Gears] AS [g] -INNER JOIN [Tags] AS [t] ON ([g].[SquadId] = [t].[GearSquadId]) AND ([g].[Nickname] = [t].[GearNickName]) +INNER JOIN [Tags] AS [t] ON [g].[SquadId] = [t].[GearSquadId] AND [g].[Nickname] = [t].[GearNickName] LEFT JOIN [Weapons] AS [w] ON [g].[FullName] = [w].[OwnerFullName] WHERE [g].[Discriminator] = N'Officer' ORDER BY [g].[Nickname], [g].[SquadId], [t].[Id]"); @@ -316,8 +316,8 @@ INNER JOIN ( 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].[Discriminator] = N'Officer' -) AS [t0] ON ([t].[GearSquadId] = [t0].[SquadId]) AND ([t].[GearNickName] = [t0].[Nickname]) -LEFT JOIN [Gears] AS [g0] ON ([t0].[Nickname] = [g0].[LeaderNickname]) AND ([t0].[SquadId] = [g0].[LeaderSquadId]) +) AS [t0] ON [t].[GearSquadId] = [t0].[SquadId] AND [t].[GearNickName] = [t0].[Nickname] +LEFT JOIN [Gears] AS [g0] ON [t0].[Nickname] = [g0].[LeaderNickname] AND [t0].[SquadId] = [g0].[LeaderSquadId] ORDER BY [t].[Id], [t0].[Nickname], [t0].[SquadId], [g0].[Nickname]"); } @@ -330,7 +330,7 @@ public override async Task Include_with_nested_navigation_in_order_by(bool async FROM [Weapons] AS [w] LEFT JOIN [Gears] AS [g] ON [w].[OwnerFullName] = [g].[FullName] LEFT JOIN [Cities] AS [c] ON [g].[CityOfBirthName] = [c].[Name] -WHERE ([g].[Nickname] <> N'Paduk') OR [g].[Nickname] IS NULL +WHERE [g].[Nickname] <> N'Paduk' OR [g].[Nickname] IS NULL ORDER BY [c].[Name], [w].[Id]"); } @@ -557,26 +557,26 @@ public override async Task Where_enum_has_flag_subquery_with_pushdown(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].[Rank] & ( +WHERE ([g].[Rank] & ( SELECT TOP(1) [g0].[Rank] 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", // @"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 ((2 & ( +WHERE (2 & ( SELECT TOP(1) [g0].[Rank] 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"); @@ -589,13 +589,13 @@ public override async Task Where_enum_has_flag_subquery_client_eval(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].[Rank] & ( +WHERE ([g].[Rank] & ( SELECT TOP(1) [g0].[Rank] 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"); @@ -688,7 +688,7 @@ public override async Task Select_comparison_with_null(bool async) @"@__ammunitionType_0='1' (Nullable = true) SELECT [w].[Id], CASE - WHEN ([w].[AmmunitionType] = @__ammunitionType_0) AND [w].[AmmunitionType] IS NOT NULL THEN CAST(1 AS bit) + WHEN [w].[AmmunitionType] = @__ammunitionType_0 AND [w].[AmmunitionType] IS NOT NULL THEN CAST(1 AS bit) ELSE CAST(0 AS bit) END AS [Cartridge] FROM [Weapons] AS [w] @@ -754,11 +754,11 @@ public override async Task Select_ternary_operation_with_has_value_not_null(bool AssertSql( @"SELECT [w].[Id], CASE - WHEN [w].[AmmunitionType] IS NOT NULL AND ([w].[AmmunitionType] = 1) THEN N'Yes' + WHEN [w].[AmmunitionType] IS NOT NULL AND [w].[AmmunitionType] = 1 THEN N'Yes' ELSE N'No' END AS [IsCartridge] FROM [Weapons] AS [w] -WHERE [w].[AmmunitionType] IS NOT NULL AND ([w].[AmmunitionType] = 1)"); +WHERE [w].[AmmunitionType] IS NOT NULL AND [w].[AmmunitionType] = 1"); } public override async Task Select_ternary_operation_multiple_conditions(bool async) @@ -767,7 +767,7 @@ public override async Task Select_ternary_operation_multiple_conditions(bool asy AssertSql( @"SELECT [w].[Id], CASE - WHEN ([w].[AmmunitionType] = 2) AND ([w].[SynergyWithId] = 1) THEN N'Yes' + WHEN [w].[AmmunitionType] = 2 AND [w].[SynergyWithId] = 1 THEN N'Yes' ELSE N'No' END AS [IsCartridge] FROM [Weapons] AS [w]"); @@ -779,7 +779,7 @@ public override async Task Select_ternary_operation_multiple_conditions_2(bool a AssertSql( @"SELECT [w].[Id], CASE - WHEN ([w].[IsAutomatic] = CAST(0 AS bit)) AND ([w].[SynergyWithId] = 1) THEN N'Yes' + WHEN [w].[IsAutomatic] = CAST(0 AS bit) AND [w].[SynergyWithId] = 1 THEN N'Yes' ELSE N'No' END AS [IsCartridge] FROM [Weapons] AS [w]"); @@ -791,7 +791,7 @@ public override async Task Select_multiple_conditions(bool async) AssertSql( @"SELECT [w].[Id], CASE - WHEN ([w].[IsAutomatic] = CAST(0 AS bit)) AND (([w].[SynergyWithId] = 1) AND [w].[SynergyWithId] IS NOT NULL) THEN CAST(1 AS bit) + WHEN [w].[IsAutomatic] = CAST(0 AS bit) AND [w].[SynergyWithId] = 1 AND [w].[SynergyWithId] IS NOT NULL THEN CAST(1 AS bit) ELSE CAST(0 AS bit) END AS [IsCartridge] FROM [Weapons] AS [w]"); @@ -819,7 +819,7 @@ public override async Task Null_propagation_optimization1(bool async) AssertSql( @"SELECT [g].[Nickname], [g].[SquadId], [g].[AssignedCityName], [g].[CityOfBirthName], [g].[Discriminator], [g].[FullName], [g].[HasSoulPatch], [g].[LeaderNickname], [g].[LeaderSquadId], [g].[Rank] FROM [Gears] AS [g] -WHERE ([g].[LeaderNickname] = N'Marcus') AND [g].[LeaderNickname] IS NOT NULL"); +WHERE [g].[LeaderNickname] = N'Marcus' AND [g].[LeaderNickname] IS NOT NULL"); } public override async Task Null_propagation_optimization2(bool async) @@ -864,10 +864,10 @@ public override async Task Null_propagation_optimization4(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 (CASE +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"); @@ -881,10 +881,10 @@ public override async Task Null_propagation_optimization5(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 (CASE +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"); @@ -898,10 +898,10 @@ public override async Task Null_propagation_optimization6(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 (CASE +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"); @@ -1048,7 +1048,7 @@ WHEN [s].[Id] IS NOT NULL THEN [c].[Name] ELSE NULL END FROM [Tags] AS [t] -LEFT JOIN [Gears] AS [g] ON ([t].[GearNickName] = [g].[Nickname]) AND ([t].[GearSquadId] = [g].[SquadId]) +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] LEFT JOIN [Cities] AS [c] ON [g].[AssignedCityName] = [c].[Name]"); } @@ -1075,7 +1075,7 @@ public override async Task Select_null_propagation_works_for_navigations_with_co AssertSql( @"SELECT [g].[Nickname] FROM [Tags] AS [t] -LEFT JOIN [Gears] AS [g] ON ([t].[GearNickName] = [g].[Nickname]) AND ([t].[GearSquadId] = [g].[SquadId])"); +LEFT JOIN [Gears] AS [g] ON [t].[GearNickName] = [g].[Nickname] AND [t].[GearSquadId] = [g].[SquadId]"); } public override async Task Select_null_propagation_works_for_multiple_navigations_with_composite_keys(bool async) @@ -1088,9 +1088,9 @@ WHEN [c].[Name] IS NOT NULL THEN [c].[Name] 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 [Gears] AS [g0] ON ([t0].[GearNickName] = [g0].[Nickname]) AND ([t0].[GearSquadId] = [g0].[SquadId]) +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 [Gears] AS [g0] ON [t0].[GearNickName] = [g0].[Nickname] AND [t0].[GearSquadId] = [g0].[SquadId] LEFT JOIN [Cities] AS [c] ON [g0].[AssignedCityName] = [c].[Name]"); } @@ -1198,9 +1198,9 @@ public override async Task Select_Where_Navigation_Scalar_Equals_Navigation_Scal @"SELECT [t].[Id], [t].[GearNickName], [t].[GearSquadId], [t].[IssueDate], [t].[Note], [t0].[Id], [t0].[GearNickName], [t0].[GearSquadId], [t0].[IssueDate], [t0].[Note] 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)"); +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)"); } public override async Task Select_Singleton_Navigation_With_Member_Access(bool async) @@ -1210,8 +1210,8 @@ public override async Task Select_Singleton_Navigation_With_Member_Access(bool a AssertSql( @"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)"); +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)"); } public override async Task Select_Where_Navigation(bool async) @@ -1221,7 +1221,7 @@ public override async Task Select_Where_Navigation(bool async) AssertSql( @"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]) +LEFT JOIN [Gears] AS [g] ON [t].[GearNickName] = [g].[Nickname] AND [t].[GearSquadId] = [g].[SquadId] WHERE [g].[Nickname] = N'Marcus'"); } @@ -1233,9 +1233,9 @@ public override async Task Select_Where_Navigation_Equals_Navigation(bool async) @"SELECT [t].[Id], [t].[GearNickName], [t].[GearSquadId], [t].[IssueDate], [t].[Note], [t0].[Id], [t0].[GearNickName], [t0].[GearSquadId], [t0].[IssueDate], [t0].[Note] 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))"); +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))"); } public override async Task Select_Where_Navigation_Null(bool async) @@ -1245,7 +1245,7 @@ public override async Task Select_Where_Navigation_Null(bool async) AssertSql( @"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]) +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"); } @@ -1256,7 +1256,7 @@ public override async Task Select_Where_Navigation_Null_Reverse(bool async) AssertSql( @"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]) +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"); } @@ -1268,9 +1268,9 @@ public override async Task Select_Where_Navigation_Scalar_Equals_Navigation_Scal @"SELECT [t].[Id] AS [Id1], [t0].[Id] AS [Id2] 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)"); +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)"); } public override async Task Optional_Navigation_Null_Coalesce_To_Clr_Type(bool async) @@ -1319,14 +1319,14 @@ public override async Task Where_subquery_distinct_firstordefault_boolean(bool a 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].[HasSoulPatch] = CAST(1 AS bit)) AND (COALESCE(( +WHERE [g].[HasSoulPatch] = CAST(1 AS bit) AND COALESCE(( SELECT TOP(1) [t].[IsAutomatic] FROM ( SELECT DISTINCT [w].[Id], [w].[AmmunitionType], [w].[IsAutomatic], [w].[Name], [w].[OwnerFullName], [w].[SynergyWithId] FROM [Weapons] AS [w] WHERE [g].[FullName] = [w].[OwnerFullName] ) AS [t] - ORDER BY [t].[Id]), CAST(0 AS bit)) = CAST(1 AS bit))"); + ORDER BY [t].[Id]), CAST(0 AS bit)) = CAST(1 AS bit)"); } public override async Task Where_subquery_distinct_firstordefault_boolean_with_pushdown(bool async) @@ -1336,14 +1336,14 @@ public override async Task Where_subquery_distinct_firstordefault_boolean_with_p 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].[HasSoulPatch] = CAST(1 AS bit)) AND (( +WHERE [g].[HasSoulPatch] = CAST(1 AS bit) AND ( SELECT TOP(1) [t].[IsAutomatic] FROM ( SELECT DISTINCT [w].[Id], [w].[AmmunitionType], [w].[IsAutomatic], [w].[Name], [w].[OwnerFullName], [w].[SynergyWithId] FROM [Weapons] AS [w] WHERE [g].[FullName] = [w].[OwnerFullName] ) AS [t] - ORDER BY [t].[Id]) = CAST(1 AS bit))"); + ORDER BY [t].[Id]) = CAST(1 AS bit)"); } public override async Task Where_subquery_distinct_first_boolean(bool async) @@ -1353,14 +1353,14 @@ public override async Task Where_subquery_distinct_first_boolean(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].[HasSoulPatch] = CAST(1 AS bit)) AND (( +WHERE [g].[HasSoulPatch] = CAST(1 AS bit) AND ( SELECT TOP(1) [t].[IsAutomatic] FROM ( SELECT DISTINCT [w].[Id], [w].[AmmunitionType], [w].[IsAutomatic], [w].[Name], [w].[OwnerFullName], [w].[SynergyWithId] FROM [Weapons] AS [w] WHERE [g].[FullName] = [w].[OwnerFullName] ) AS [t] - ORDER BY [t].[Id]) = CAST(1 AS bit)) + ORDER BY [t].[Id]) = CAST(1 AS bit) ORDER BY [g].[Nickname]"); } @@ -1371,13 +1371,13 @@ public override async Task Where_subquery_distinct_singleordefault_boolean1(bool 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].[HasSoulPatch] = CAST(1 AS bit)) AND (COALESCE(( +WHERE [g].[HasSoulPatch] = CAST(1 AS bit) AND COALESCE(( SELECT TOP(1) [t].[IsAutomatic] FROM ( SELECT DISTINCT [w].[Id], [w].[AmmunitionType], [w].[IsAutomatic], [w].[Name], [w].[OwnerFullName], [w].[SynergyWithId] FROM [Weapons] AS [w] - WHERE ([g].[FullName] = [w].[OwnerFullName]) AND ([w].[Name] LIKE N'%Lancer%') - ) AS [t]), CAST(0 AS bit)) = CAST(1 AS bit)) + WHERE [g].[FullName] = [w].[OwnerFullName] AND ([w].[Name] LIKE N'%Lancer%') + ) AS [t]), CAST(0 AS bit)) = CAST(1 AS bit) ORDER BY [g].[Nickname]"); } @@ -1388,10 +1388,10 @@ public override async Task Where_subquery_distinct_singleordefault_boolean2(bool 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].[HasSoulPatch] = CAST(1 AS bit)) AND (COALESCE(( +WHERE [g].[HasSoulPatch] = CAST(1 AS bit) AND COALESCE(( SELECT DISTINCT TOP(1) [w].[IsAutomatic] FROM [Weapons] AS [w] - WHERE ([g].[FullName] = [w].[OwnerFullName]) AND ([w].[Name] LIKE N'%Lancer%')), CAST(0 AS bit)) = CAST(1 AS bit)) + WHERE [g].[FullName] = [w].[OwnerFullName] AND ([w].[Name] LIKE N'%Lancer%')), CAST(0 AS bit)) = CAST(1 AS bit) ORDER BY [g].[Nickname]"); } @@ -1402,13 +1402,13 @@ public override async Task Where_subquery_distinct_singleordefault_boolean_with_ 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].[HasSoulPatch] = CAST(1 AS bit)) AND (( +WHERE [g].[HasSoulPatch] = CAST(1 AS bit) AND ( SELECT TOP(1) [t].[IsAutomatic] FROM ( SELECT DISTINCT [w].[Id], [w].[AmmunitionType], [w].[IsAutomatic], [w].[Name], [w].[OwnerFullName], [w].[SynergyWithId] FROM [Weapons] AS [w] - WHERE ([g].[FullName] = [w].[OwnerFullName]) AND ([w].[Name] LIKE N'%Lancer%') - ) AS [t]) = CAST(1 AS bit)) + WHERE [g].[FullName] = [w].[OwnerFullName] AND ([w].[Name] LIKE N'%Lancer%') + ) AS [t]) = CAST(1 AS bit) ORDER BY [g].[Nickname]"); } @@ -1437,14 +1437,14 @@ public override async Task Where_subquery_distinct_last_boolean(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].[HasSoulPatch] = CAST(0 AS bit)) AND (( +WHERE [g].[HasSoulPatch] = CAST(0 AS bit) AND ( SELECT TOP(1) [t].[IsAutomatic] FROM ( SELECT DISTINCT [w].[Id], [w].[AmmunitionType], [w].[IsAutomatic], [w].[Name], [w].[OwnerFullName], [w].[SynergyWithId] FROM [Weapons] AS [w] WHERE [g].[FullName] = [w].[OwnerFullName] ) AS [t] - ORDER BY [t].[Id] DESC) = CAST(1 AS bit)) + ORDER BY [t].[Id] DESC) = CAST(1 AS bit) ORDER BY [g].[Nickname]"); } @@ -1455,14 +1455,14 @@ public override async Task Where_subquery_distinct_orderby_firstordefault_boolea 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].[HasSoulPatch] = CAST(1 AS bit)) AND (COALESCE(( +WHERE [g].[HasSoulPatch] = CAST(1 AS bit) AND COALESCE(( SELECT TOP(1) [t].[IsAutomatic] FROM ( SELECT DISTINCT [w].[Id], [w].[AmmunitionType], [w].[IsAutomatic], [w].[Name], [w].[OwnerFullName], [w].[SynergyWithId] FROM [Weapons] AS [w] WHERE [g].[FullName] = [w].[OwnerFullName] ) AS [t] - ORDER BY [t].[Id]), CAST(0 AS bit)) = CAST(1 AS bit))"); + ORDER BY [t].[Id]), CAST(0 AS bit)) = CAST(1 AS bit)"); } public override async Task Where_subquery_distinct_orderby_firstordefault_boolean_with_pushdown(bool async) @@ -1472,14 +1472,14 @@ public override async Task Where_subquery_distinct_orderby_firstordefault_boolea 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].[HasSoulPatch] = CAST(1 AS bit)) AND (( +WHERE [g].[HasSoulPatch] = CAST(1 AS bit) AND ( SELECT TOP(1) [t].[IsAutomatic] FROM ( SELECT DISTINCT [w].[Id], [w].[AmmunitionType], [w].[IsAutomatic], [w].[Name], [w].[OwnerFullName], [w].[SynergyWithId] FROM [Weapons] AS [w] WHERE [g].[FullName] = [w].[OwnerFullName] ) AS [t] - ORDER BY [t].[Id]) = CAST(1 AS bit))"); + ORDER BY [t].[Id]) = CAST(1 AS bit)"); } public override async Task Where_subquery_union_firstordefault_boolean(bool async) @@ -1489,7 +1489,7 @@ public override async Task Where_subquery_union_firstordefault_boolean(bool asyn 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].[HasSoulPatch] = CAST(1 AS bit)) AND (( +WHERE [g].[HasSoulPatch] = CAST(1 AS bit) AND ( SELECT TOP(1) [t].[IsAutomatic] FROM ( SELECT [w].[Id], [w].[AmmunitionType], [w].[IsAutomatic], [w].[Name], [w].[OwnerFullName], [w].[SynergyWithId] @@ -1500,7 +1500,7 @@ FROM [Weapons] AS [w] FROM [Weapons] AS [w0] WHERE [g].[FullName] = [w0].[OwnerFullName] ) AS [t] - ORDER BY [t].[Id]) = CAST(1 AS bit))"); + ORDER BY [t].[Id]) = CAST(1 AS bit)"); } public override async Task Where_subquery_join_firstordefault_boolean(bool async) @@ -1510,7 +1510,7 @@ public override async Task Where_subquery_join_firstordefault_boolean(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].[HasSoulPatch] = CAST(1 AS bit)) AND (( +WHERE [g].[HasSoulPatch] = CAST(1 AS bit) AND ( SELECT TOP(1) [w].[IsAutomatic] FROM [Weapons] AS [w] INNER JOIN ( @@ -1519,7 +1519,7 @@ FROM [Weapons] AS [w0] WHERE [g].[FullName] = [w0].[OwnerFullName] ) AS [t] ON [w].[Id] = [t].[Id] WHERE [g].[FullName] = [w].[OwnerFullName] - ORDER BY [w].[Id]) = CAST(1 AS bit))"); + ORDER BY [w].[Id]) = CAST(1 AS bit)"); } public override async Task Where_subquery_left_join_firstordefault_boolean(bool async) @@ -1529,7 +1529,7 @@ public override async Task Where_subquery_left_join_firstordefault_boolean(bool 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].[HasSoulPatch] = CAST(1 AS bit)) AND (( +WHERE [g].[HasSoulPatch] = CAST(1 AS bit) AND ( SELECT TOP(1) [w].[IsAutomatic] FROM [Weapons] AS [w] LEFT JOIN ( @@ -1538,7 +1538,7 @@ FROM [Weapons] AS [w0] WHERE [g].[FullName] = [w0].[OwnerFullName] ) AS [t] ON [w].[Id] = [t].[Id] WHERE [g].[FullName] = [w].[OwnerFullName] - ORDER BY [w].[Id]) = CAST(1 AS bit))"); + ORDER BY [w].[Id]) = CAST(1 AS bit)"); } public override async Task Where_subquery_concat_firstordefault_boolean(bool async) @@ -1548,7 +1548,7 @@ public override async Task Where_subquery_concat_firstordefault_boolean(bool asy 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].[HasSoulPatch] = CAST(1 AS bit)) AND (( +WHERE [g].[HasSoulPatch] = CAST(1 AS bit) AND ( SELECT TOP(1) [t].[IsAutomatic] FROM ( SELECT [w].[Id], [w].[AmmunitionType], [w].[IsAutomatic], [w].[Name], [w].[OwnerFullName], [w].[SynergyWithId] @@ -1559,7 +1559,7 @@ UNION ALL FROM [Weapons] AS [w0] WHERE [g].[FullName] = [w0].[OwnerFullName] ) AS [t] - ORDER BY [t].[Id]) = CAST(1 AS bit))"); + ORDER BY [t].[Id]) = CAST(1 AS bit)"); } public override async Task Concat_with_count(bool async) @@ -1672,11 +1672,11 @@ SELECT COUNT(*) FROM ( SELECT [g0].[Nickname], [g0].[SquadId], [g0].[AssignedCityName], [g0].[CityOfBirthName], [g0].[Discriminator], [g0].[FullName], [g0].[HasSoulPatch], [g0].[LeaderNickname], [g0].[LeaderSquadId], [g0].[Rank] FROM [Gears] AS [g0] - WHERE ([g].[Nickname] = [g0].[LeaderNickname]) AND ([g].[SquadId] = [g0].[LeaderSquadId]) + WHERE [g].[Nickname] = [g0].[LeaderNickname] AND [g].[SquadId] = [g0].[LeaderSquadId] UNION SELECT [g1].[Nickname], [g1].[SquadId], [g1].[AssignedCityName], [g1].[CityOfBirthName], [g1].[Discriminator], [g1].[FullName], [g1].[HasSoulPatch], [g1].[LeaderNickname], [g1].[LeaderSquadId], [g1].[Rank] FROM [Gears] AS [g1] - WHERE ([g].[Nickname] = [g1].[LeaderNickname]) AND ([g].[SquadId] = [g1].[LeaderSquadId]) + WHERE [g].[Nickname] = [g1].[LeaderNickname] AND [g].[SquadId] = [g1].[LeaderSquadId] ) AS [t]) FROM [Gears] AS [g] WHERE [g].[Discriminator] = N'Officer'"); @@ -1706,8 +1706,8 @@ public override async Task Singleton_Navigation_With_Member_Access(bool async) AssertSql( @"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)"); +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)"); } public override async Task GroupJoin_Composite_Key(bool async) @@ -1717,7 +1717,7 @@ public override async Task GroupJoin_Composite_Key(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 [Tags] AS [t] -INNER JOIN [Gears] AS [g] ON ([t].[GearNickName] = [g].[Nickname]) AND ([t].[GearSquadId] = [g].[SquadId])"); +INNER JOIN [Gears] AS [g] ON [t].[GearNickName] = [g].[Nickname] AND [t].[GearSquadId] = [g].[SquadId]"); } public override async Task Join_navigation_translated_to_subquery_composite_key(bool async) @@ -1730,7 +1730,7 @@ FROM [Gears] AS [g] INNER JOIN ( SELECT [t].[Note], [g0].[FullName] FROM [Tags] AS [t] - LEFT JOIN [Gears] AS [g0] ON ([t].[GearNickName] = [g0].[Nickname]) AND ([t].[GearSquadId] = [g0].[SquadId]) + LEFT JOIN [Gears] AS [g0] ON [t].[GearNickName] = [g0].[Nickname] AND [t].[GearSquadId] = [g0].[SquadId] ) AS [t0] ON [g].[FullName] = [t0].[FullName]"); } @@ -1744,7 +1744,7 @@ FROM [Gears] AS [g] INNER JOIN ( SELECT [t].[Note], [g0].[FullName] FROM [Tags] AS [t] - LEFT JOIN [Gears] AS [g0] ON ([t].[GearNickName] = [g0].[Nickname]) AND ([t].[GearSquadId] = [g0].[SquadId]) + LEFT JOIN [Gears] AS [g0] ON [t].[GearNickName] = [g0].[Nickname] AND [t].[GearSquadId] = [g0].[SquadId] ) AS [t0] ON [g].[FullName] = [t0].[FullName]"); } @@ -1780,8 +1780,8 @@ INNER JOIN ( 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].[Discriminator] = N'Officer' -) AS [t0] ON ([t].[GearSquadId] = [t0].[SquadId]) AND ([t].[GearNickName] = [t0].[Nickname]) -LEFT JOIN [Tags] AS [t1] ON ([t0].[Nickname] = [t1].[GearNickName]) AND ([t0].[SquadId] = [t1].[GearSquadId])"); +) AS [t0] ON [t].[GearSquadId] = [t0].[SquadId] AND [t].[GearNickName] = [t0].[Nickname] +LEFT JOIN [Tags] AS [t1] ON [t0].[Nickname] = [t1].[GearNickName] AND [t0].[SquadId] = [t1].[GearSquadId]"); } public override async Task Collection_with_inheritance_and_join_include_source(bool async) @@ -1791,8 +1791,8 @@ public override async Task Collection_with_inheritance_and_join_include_source(b AssertSql( @"SELECT [g].[Nickname], [g].[SquadId], [g].[AssignedCityName], [g].[CityOfBirthName], [g].[Discriminator], [g].[FullName], [g].[HasSoulPatch], [g].[LeaderNickname], [g].[LeaderSquadId], [g].[Rank], [t0].[Id], [t0].[GearNickName], [t0].[GearSquadId], [t0].[IssueDate], [t0].[Note] FROM [Gears] AS [g] -INNER JOIN [Tags] AS [t] ON ([g].[SquadId] = [t].[GearSquadId]) AND ([g].[Nickname] = [t].[GearNickName]) -LEFT JOIN [Tags] AS [t0] ON ([g].[Nickname] = [t0].[GearNickName]) AND ([g].[SquadId] = [t0].[GearSquadId]) +INNER JOIN [Tags] AS [t] ON [g].[SquadId] = [t].[GearSquadId] AND [g].[Nickname] = [t].[GearNickName] +LEFT JOIN [Tags] AS [t0] ON [g].[Nickname] = [t0].[GearNickName] AND [g].[SquadId] = [t0].[GearSquadId] WHERE [g].[Discriminator] = N'Officer'"); } @@ -1845,10 +1845,10 @@ public override async Task Non_unicode_string_literals_is_used_for_non_unicode_c AssertSql( @"SELECT [c].[Name], [c].[Location], [c].[Nation] FROM [Cities] AS [c] -WHERE ([c].[Location] = 'Unknown') AND (( +WHERE [c].[Location] = 'Unknown' AND ( SELECT COUNT(*) FROM [Gears] AS [g] - WHERE ([c].[Name] = [g].[CityOfBirthName]) AND ([g].[Nickname] = N'Paduk')) = 1)"); + WHERE [c].[Name] = [g].[CityOfBirthName] AND [g].[Nickname] = N'Paduk') = 1"); } public override async Task Non_unicode_string_literals_is_used_for_non_unicode_column_in_subquery(bool async) @@ -1859,7 +1859,7 @@ public override async Task Non_unicode_string_literals_is_used_for_non_unicode_c @"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] INNER JOIN [Cities] AS [c] ON [g].[CityOfBirthName] = [c].[Name] -WHERE ([g].[Nickname] = N'Marcus') AND ([c].[Location] = 'Jacinto''s location')"); +WHERE [g].[Nickname] = N'Marcus' AND [c].[Location] = 'Jacinto''s location'"); } public override async Task Non_unicode_string_literals_is_used_for_non_unicode_column_with_contains(bool async) @@ -2063,7 +2063,7 @@ public override async Task Coalesce_operator_in_predicate_with_other_conditions( AssertSql( @"SELECT [w].[Id], [w].[AmmunitionType], [w].[IsAutomatic], [w].[Name], [w].[OwnerFullName], [w].[SynergyWithId] FROM [Weapons] AS [w] -WHERE ([w].[AmmunitionType] = 1) AND (COALESCE([w].[IsAutomatic], CAST(0 AS bit)) = CAST(1 AS bit))"); +WHERE [w].[AmmunitionType] = 1 AND COALESCE([w].[IsAutomatic], CAST(0 AS bit)) = CAST(1 AS bit)"); } public override async Task Coalesce_operator_in_projection_with_other_conditions(bool async) @@ -2072,7 +2072,7 @@ public override async Task Coalesce_operator_in_projection_with_other_conditions AssertSql( @"SELECT CASE - WHEN (([w].[AmmunitionType] = 1) AND [w].[AmmunitionType] IS NOT NULL) AND (COALESCE([w].[IsAutomatic], CAST(0 AS bit)) = CAST(1 AS bit)) THEN CAST(1 AS bit) + WHEN [w].[AmmunitionType] = 1 AND [w].[AmmunitionType] IS NOT NULL AND COALESCE([w].[IsAutomatic], CAST(0 AS bit)) = CAST(1 AS bit) THEN CAST(1 AS bit) ELSE CAST(0 AS bit) END FROM [Weapons] AS [w]"); @@ -2085,8 +2085,8 @@ public override async Task Optional_navigation_type_compensation_works_with_pred AssertSql( @"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))"); +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)"); } public override async Task Optional_navigation_type_compensation_works_with_predicate2(bool async) @@ -2096,7 +2096,7 @@ public override async Task Optional_navigation_type_compensation_works_with_pred AssertSql( @"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]) +LEFT JOIN [Gears] AS [g] ON [t].[GearNickName] = [g].[Nickname] AND [t].[GearSquadId] = [g].[SquadId] WHERE [g].[HasSoulPatch] = CAST(1 AS bit)"); } @@ -2107,7 +2107,7 @@ public override async Task Optional_navigation_type_compensation_works_with_pred AssertSql( @"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]) +LEFT JOIN [Gears] AS [g] ON [t].[GearNickName] = [g].[Nickname] AND [t].[GearSquadId] = [g].[SquadId] WHERE [g].[HasSoulPatch] = CAST(0 AS bit)"); } @@ -2118,7 +2118,7 @@ public override async Task Optional_navigation_type_compensation_works_with_pred AssertSql( @"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]) +LEFT JOIN [Gears] AS [g] ON [t].[GearNickName] = [g].[Nickname] AND [t].[GearSquadId] = [g].[SquadId] WHERE CASE WHEN [g].[HasSoulPatch] = CAST(1 AS bit) THEN CAST(1 AS bit) ELSE [g].[HasSoulPatch] @@ -2132,7 +2132,7 @@ public override async Task Optional_navigation_type_compensation_works_with_pred AssertSql( @"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]) +LEFT JOIN [Gears] AS [g] ON [t].[GearNickName] = [g].[Nickname] AND [t].[GearSquadId] = [g].[SquadId] WHERE CASE WHEN [g].[HasSoulPatch] = CAST(0 AS bit) THEN CAST(0 AS bit) ELSE [g].[HasSoulPatch] @@ -2146,7 +2146,7 @@ public override async Task Optional_navigation_type_compensation_works_with_cond AssertSql( @"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]) +LEFT JOIN [Gears] AS [g] ON [t].[GearNickName] = [g].[Nickname] AND [t].[GearSquadId] = [g].[SquadId] WHERE CASE WHEN [g].[HasSoulPatch] = CAST(1 AS bit) THEN CAST(1 AS bit) ELSE CAST(0 AS bit) @@ -2160,8 +2160,8 @@ public override async Task Optional_navigation_type_compensation_works_with_bina AssertSql( @"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].[HasSoulPatch] = CAST(1 AS bit)) OR ([t].[Note] LIKE N'%Cole%')"); +LEFT JOIN [Gears] AS [g] ON [t].[GearNickName] = [g].[Nickname] AND [t].[GearSquadId] = [g].[SquadId] +WHERE [g].[HasSoulPatch] = CAST(1 AS bit) OR ([t].[Note] LIKE N'%Cole%')"); } public override async Task Optional_navigation_type_compensation_works_with_binary_and_expression(bool async) @@ -2170,11 +2170,11 @@ public override async Task Optional_navigation_type_compensation_works_with_bina AssertSql( @"SELECT CASE - WHEN ([g].[HasSoulPatch] = CAST(1 AS bit)) AND ([t].[Note] LIKE N'%Cole%') THEN CAST(1 AS bit) + WHEN [g].[HasSoulPatch] = CAST(1 AS bit) AND ([t].[Note] LIKE N'%Cole%') THEN CAST(1 AS bit) ELSE CAST(0 AS bit) END FROM [Tags] AS [t] -LEFT JOIN [Gears] AS [g] ON ([t].[GearNickName] = [g].[Nickname]) AND ([t].[GearSquadId] = [g].[SquadId])"); +LEFT JOIN [Gears] AS [g] ON [t].[GearNickName] = [g].[Nickname] AND [t].[GearSquadId] = [g].[SquadId]"); } public override async Task Optional_navigation_type_compensation_works_with_projection(bool async) @@ -2184,8 +2184,8 @@ public override async Task Optional_navigation_type_compensation_works_with_proj AssertSql( @"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"); +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"); } public override async Task Optional_navigation_type_compensation_works_with_projection_into_anonymous_type(bool async) @@ -2195,8 +2195,8 @@ public override async Task Optional_navigation_type_compensation_works_with_proj AssertSql( @"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"); +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"); } public override async Task Optional_navigation_type_compensation_works_with_DTOs(bool async) @@ -2206,8 +2206,8 @@ public override async Task Optional_navigation_type_compensation_works_with_DTOs AssertSql( @"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"); +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"); } public override async Task Optional_navigation_type_compensation_works_with_list_initializers(bool async) @@ -2217,8 +2217,8 @@ public override async Task Optional_navigation_type_compensation_works_with_list AssertSql( @"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 +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 ORDER BY [t].[Note]"); } @@ -2229,8 +2229,8 @@ public override async Task Optional_navigation_type_compensation_works_with_arra AssertSql( @"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"); +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"); } public override async Task Optional_navigation_type_compensation_works_with_orderby(bool async) @@ -2240,8 +2240,8 @@ public override async Task Optional_navigation_type_compensation_works_with_orde AssertSql( @"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 +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 ORDER BY [g].[SquadId]"); } @@ -2254,8 +2254,8 @@ public override async Task Optional_navigation_type_compensation_works_with_all( 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) + 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) ELSE CAST(0 AS bit) END"); } @@ -2267,8 +2267,8 @@ public override async Task Optional_navigation_type_compensation_works_with_nega AssertSql( @"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))"); +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)"); } public override async Task Optional_navigation_type_compensation_works_with_contains(bool async) @@ -2278,8 +2278,8 @@ public override async Task Optional_navigation_type_compensation_works_with_cont AssertSql( @"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 ( +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 ( SELECT 1 FROM [Gears] AS [g0] WHERE [g0].[SquadId] = [g].[SquadId])"); @@ -2403,7 +2403,7 @@ FROM [Gears] AS [g] LEFT JOIN ( SELECT [w].[Id], [w].[AmmunitionType], [w].[IsAutomatic], [w].[Name], [w].[OwnerFullName], [w].[SynergyWithId] FROM [Weapons] AS [w] - WHERE ([w].[Name] <> N'Lancer') OR [w].[Name] IS NULL + WHERE [w].[Name] <> N'Lancer' OR [w].[Name] IS NULL ) AS [t] ON [g].[FullName] = [t].[OwnerFullName] WHERE [c].[Name] IN (N'Ephyra', N'Hanover') ORDER BY [g].[Nickname], [g].[SquadId], [c].[Name]"); @@ -2420,7 +2420,7 @@ LEFT JOIN ( SELECT [g0].[Nickname], [g0].[SquadId], [g0].[AssignedCityName], [g0].[CityOfBirthName], [g0].[Discriminator], [g0].[FullName], [g0].[HasSoulPatch], [g0].[LeaderNickname], [g0].[LeaderSquadId], [g0].[Rank] FROM [Gears] AS [g0] WHERE [g0].[Nickname] <> N'Dom' -) AS [t] ON ([g].[Nickname] = [t].[LeaderNickname]) AND ([g].[SquadId] = [t].[LeaderSquadId]) +) AS [t] ON [g].[Nickname] = [t].[LeaderNickname] AND [g].[SquadId] = [t].[LeaderSquadId] WHERE [g].[Discriminator] = N'Officer' ORDER BY [g].[Nickname], [g].[SquadId], [t].[Nickname]"); } @@ -2696,7 +2696,7 @@ public override async Task Complex_predicate_with_AndAlso_and_nullable_bool_prop @"SELECT [w].[Id], [w].[AmmunitionType], [w].[IsAutomatic], [w].[Name], [w].[OwnerFullName], [w].[SynergyWithId] FROM [Weapons] AS [w] LEFT JOIN [Gears] AS [g] ON [w].[OwnerFullName] = [g].[FullName] -WHERE ([w].[Id] <> 50) AND ([g].[HasSoulPatch] = CAST(0 AS bit))"); +WHERE [w].[Id] <> 50 AND [g].[HasSoulPatch] = CAST(0 AS bit)"); } public override async Task Distinct_with_optional_navigation_is_translated_to_sql(bool async) @@ -2706,8 +2706,8 @@ public override async Task Distinct_with_optional_navigation_is_translated_to_sq AssertSql( @"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"); +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"); } public override async Task Sum_with_optional_navigation_is_translated_to_sql(bool async) @@ -2717,8 +2717,8 @@ public override async Task Sum_with_optional_navigation_is_translated_to_sql(boo AssertSql( @"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"); +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"); } public override async Task Count_with_optional_navigation_is_translated_to_sql(bool async) @@ -2728,8 +2728,8 @@ public override async Task Count_with_optional_navigation_is_translated_to_sql(b AssertSql( @"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"); +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"); } public override async Task FirstOrDefault_with_manually_created_groupjoin_is_translated_to_sql(bool async) @@ -2753,8 +2753,8 @@ FROM [Squads] AS [s] WHERE NOT (EXISTS ( SELECT 1 FROM [Gears] AS [g] - LEFT JOIN [Tags] AS [t] ON ([g].[Nickname] = [t].[GearNickName]) AND ([g].[SquadId] = [t].[GearSquadId]) - WHERE ([s].[Id] = [g].[SquadId]) AND ([t].[Note] = N'Dom''s Tag')))"); + LEFT JOIN [Tags] AS [t] ON [g].[Nickname] = [t].[GearNickName] AND [g].[SquadId] = [t].[GearSquadId] + WHERE [s].[Id] = [g].[SquadId] AND [t].[Note] = N'Dom''s Tag'))"); } public override async Task All_with_optional_navigation_is_translated_to_sql(bool async) @@ -2766,8 +2766,8 @@ public override async Task All_with_optional_navigation_is_translated_to_sql(boo 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) + 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) ELSE CAST(0 AS bit) END"); } @@ -2822,8 +2822,8 @@ public override async Task Where_is_properly_lifted_from_subquery_created_by_inc AssertSql( @"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 ([g].[FullName] <> N'Augustus Cole') AND ([g].[HasSoulPatch] = CAST(0 AS bit)) +LEFT JOIN [Tags] AS [t] ON [g].[Nickname] = [t].[GearNickName] AND [g].[SquadId] = [t].[GearSquadId] +WHERE [g].[FullName] <> N'Augustus Cole' AND [g].[HasSoulPatch] = CAST(0 AS bit) ORDER BY [g].[FullName]"); } @@ -2835,7 +2835,7 @@ public override async Task Subquery_is_lifted_from_main_from_clause_of_SelectMan @"SELECT [g].[FullName] AS [Name1], [g0].[FullName] AS [Name2] FROM [Gears] AS [g] CROSS JOIN [Gears] AS [g0] -WHERE ([g].[HasSoulPatch] = CAST(1 AS bit)) AND ([g0].[HasSoulPatch] = CAST(0 AS bit)) +WHERE [g].[HasSoulPatch] = CAST(1 AS bit) AND [g0].[HasSoulPatch] = CAST(0 AS bit) ORDER BY [g].[FullName]"); } @@ -2882,7 +2882,7 @@ public override async Task Subquery_containing_join_gets_lifted_clashing_names(b FROM [Gears] AS [g] INNER JOIN [Tags] AS [t] ON [g].[Nickname] = [t].[GearNickName] INNER JOIN [Tags] AS [t0] ON [g].[Nickname] = [t0].[GearNickName] -WHERE ([t].[GearNickName] <> N'Cole Train') OR [t].[GearNickName] IS NULL +WHERE [t].[GearNickName] <> N'Cole Train' OR [t].[GearNickName] IS NULL ORDER BY [g].[Nickname], [t0].[Id]"); } @@ -2897,7 +2897,7 @@ FROM [Gears] AS [g] WHERE EXISTS ( SELECT 1 FROM [Weapons] AS [w] - WHERE [g].[FullName] = [w].[OwnerFullName]) AND ([g].[HasSoulPatch] = CAST(0 AS bit)) + WHERE [g].[FullName] = [w].[OwnerFullName]) AND [g].[HasSoulPatch] = CAST(0 AS bit) ORDER BY [g].[Nickname]"); } @@ -2909,7 +2909,7 @@ public override async Task Subquery_is_lifted_from_additional_from_clause(bool a @"SELECT [g].[FullName] AS [Name1], [g0].[FullName] AS [Name2] FROM [Gears] AS [g] CROSS JOIN [Gears] AS [g0] -WHERE ([g].[HasSoulPatch] = CAST(1 AS bit)) AND ([g0].[HasSoulPatch] = CAST(0 AS bit)) +WHERE [g].[HasSoulPatch] = CAST(1 AS bit) AND [g0].[HasSoulPatch] = CAST(0 AS bit) ORDER BY [g].[FullName]"); } @@ -3230,7 +3230,7 @@ public override async Task Comparing_two_collection_navigations_composite_key(bo @"SELECT [g].[Nickname] AS [Nickname1], [g0].[Nickname] AS [Nickname2] FROM [Gears] AS [g] CROSS JOIN [Gears] AS [g0] -WHERE ([g].[Nickname] = [g0].[Nickname]) AND ([g].[SquadId] = [g0].[SquadId]) +WHERE [g].[Nickname] = [g0].[Nickname] AND [g].[SquadId] = [g0].[SquadId] ORDER BY [g].[Nickname]"); } @@ -3251,8 +3251,8 @@ LEFT JOIN ( FROM [LocustLeaders] AS [l] WHERE [l].[Discriminator] = N'LocustCommander' ) AS [t0] ON [f].[CommanderName] = [t0].[Name] -LEFT JOIN [Gears] AS [g0] ON ([t0].[DefeatedByNickname] = [g0].[Nickname]) AND ([t0].[DefeatedBySquadId] = [g0].[SquadId]) -WHERE ([t].[HasSoulPatch] = CAST(1 AS bit)) AND (([g0].[Nickname] = [t].[Nickname]) AND ([g0].[SquadId] = [t].[SquadId]))"); +LEFT JOIN [Gears] AS [g0] ON [t0].[DefeatedByNickname] = [g0].[Nickname] AND [t0].[DefeatedBySquadId] = [g0].[SquadId] +WHERE [t].[HasSoulPatch] = CAST(1 AS bit) AND [g0].[Nickname] = [t].[Nickname] AND [g0].[SquadId] = [t].[SquadId]"); } public override async Task Comparing_entities_using_Equals_inheritance(bool async) @@ -3267,7 +3267,7 @@ CROSS JOIN ( FROM [Gears] AS [g0] WHERE [g0].[Discriminator] = N'Officer' ) AS [t] -WHERE ([g].[Nickname] = [t].[Nickname]) AND ([g].[SquadId] = [t].[SquadId]) +WHERE [g].[Nickname] = [t].[Nickname] AND [g].[SquadId] = [t].[SquadId] ORDER BY [g].[Nickname], [t].[Nickname]"); } @@ -3279,7 +3279,7 @@ public override async Task Contains_on_nullable_array_produces_correct_sql(bool @"SELECT [g].[Nickname], [g].[SquadId], [g].[AssignedCityName], [g].[CityOfBirthName], [g].[Discriminator], [g].[FullName], [g].[HasSoulPatch], [g].[LeaderNickname], [g].[LeaderSquadId], [g].[Rank] FROM [Gears] AS [g] LEFT JOIN [Cities] AS [c] ON [g].[AssignedCityName] = [c].[Name] -WHERE ([g].[SquadId] < 2) AND (([c].[Name] = N'Ephyra') OR [c].[Name] IS NULL)"); +WHERE [g].[SquadId] < 2 AND ([c].[Name] = N'Ephyra' OR [c].[Name] IS NULL)"); } public override async Task Optional_navigation_with_collection_composite_key(bool async) @@ -3289,11 +3289,11 @@ public override async Task Optional_navigation_with_collection_composite_key(boo AssertSql( @"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].[Discriminator] = N'Officer') AND (( +LEFT JOIN [Gears] AS [g] ON [t].[GearNickName] = [g].[Nickname] AND [t].[GearSquadId] = [g].[SquadId] +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) @@ -3349,8 +3349,8 @@ LEFT JOIN ( 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 [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] ORDER BY [f].[Id], [t].[Name], [g].[Nickname], [g].[SquadId], [g0].[Nickname]"); } @@ -3366,8 +3366,8 @@ LEFT JOIN ( 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 [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] ORDER BY [f].[Id], [t].[Name], [g].[Nickname], [g].[SquadId], [g0].[Nickname]"); } @@ -3378,7 +3378,7 @@ public override async Task Include_reference_on_derived_type_using_string(bool a 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] FROM [LocustLeaders] AS [l] -LEFT JOIN [Gears] AS [g] ON ([l].[DefeatedByNickname] = [g].[Nickname]) AND ([l].[DefeatedBySquadId] = [g].[SquadId])"); +LEFT JOIN [Gears] AS [g] ON [l].[DefeatedByNickname] = [g].[Nickname] AND [l].[DefeatedBySquadId] = [g].[SquadId]"); } public override async Task Include_reference_on_derived_type_using_string_nested1(bool async) @@ -3388,7 +3388,7 @@ public override async Task Include_reference_on_derived_type_using_string_nested 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], [s].[Id], [s].[Banner], [s].[Banner5], [s].[InternalNumber], [s].[Name] FROM [LocustLeaders] AS [l] -LEFT JOIN [Gears] AS [g] ON ([l].[DefeatedByNickname] = [g].[Nickname]) AND ([l].[DefeatedBySquadId] = [g].[SquadId]) +LEFT JOIN [Gears] AS [g] ON [l].[DefeatedByNickname] = [g].[Nickname] AND [l].[DefeatedBySquadId] = [g].[SquadId] LEFT JOIN [Squads] AS [s] ON [g].[SquadId] = [s].[Id]"); } @@ -3399,12 +3399,12 @@ public override async Task Include_reference_on_derived_type_using_string_nested 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], [t].[Nickname], [t].[SquadId], [t].[AssignedCityName], [t].[CityOfBirthName], [t].[Discriminator], [t].[FullName], [t].[HasSoulPatch], [t].[LeaderNickname], [t].[LeaderSquadId], [t].[Rank], [t].[Name], [t].[Location], [t].[Nation] FROM [LocustLeaders] AS [l] -LEFT JOIN [Gears] AS [g] ON ([l].[DefeatedByNickname] = [g].[Nickname]) AND ([l].[DefeatedBySquadId] = [g].[SquadId]) +LEFT JOIN [Gears] AS [g] ON [l].[DefeatedByNickname] = [g].[Nickname] AND [l].[DefeatedBySquadId] = [g].[SquadId] 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]"); } @@ -3415,7 +3415,7 @@ public override async Task Include_reference_on_derived_type_using_lambda(bool a 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] FROM [LocustLeaders] AS [l] -LEFT JOIN [Gears] AS [g] ON ([l].[DefeatedByNickname] = [g].[Nickname]) AND ([l].[DefeatedBySquadId] = [g].[SquadId])"); +LEFT JOIN [Gears] AS [g] ON [l].[DefeatedByNickname] = [g].[Nickname] AND [l].[DefeatedBySquadId] = [g].[SquadId]"); } public override async Task Include_reference_on_derived_type_using_lambda_with_soft_cast(bool async) @@ -3425,7 +3425,7 @@ public override async Task Include_reference_on_derived_type_using_lambda_with_s 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] FROM [LocustLeaders] AS [l] -LEFT JOIN [Gears] AS [g] ON ([l].[DefeatedByNickname] = [g].[Nickname]) AND ([l].[DefeatedBySquadId] = [g].[SquadId])"); +LEFT JOIN [Gears] AS [g] ON [l].[DefeatedByNickname] = [g].[Nickname] AND [l].[DefeatedBySquadId] = [g].[SquadId]"); } public override async Task Include_reference_on_derived_type_using_lambda_with_tracking(bool async) @@ -3435,7 +3435,7 @@ public override async Task Include_reference_on_derived_type_using_lambda_with_t 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] FROM [LocustLeaders] AS [l] -LEFT JOIN [Gears] AS [g] ON ([l].[DefeatedByNickname] = [g].[Nickname]) AND ([l].[DefeatedBySquadId] = [g].[SquadId])"); +LEFT JOIN [Gears] AS [g] ON [l].[DefeatedByNickname] = [g].[Nickname] AND [l].[DefeatedBySquadId] = [g].[SquadId]"); } public override async Task Include_collection_on_derived_type_using_string(bool async) @@ -3445,7 +3445,7 @@ public override async Task Include_collection_on_derived_type_using_string(bool 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], [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].[Nickname] = [g0].[LeaderNickname]) AND ([g].[SquadId] = [g0].[LeaderSquadId]) +LEFT JOIN [Gears] AS [g0] ON [g].[Nickname] = [g0].[LeaderNickname] AND [g].[SquadId] = [g0].[LeaderSquadId] ORDER BY [g].[Nickname], [g].[SquadId], [g0].[Nickname]"); } @@ -3456,7 +3456,7 @@ public override async Task Include_collection_on_derived_type_using_lambda(bool 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], [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].[Nickname] = [g0].[LeaderNickname]) AND ([g].[SquadId] = [g0].[LeaderSquadId]) +LEFT JOIN [Gears] AS [g0] ON [g].[Nickname] = [g0].[LeaderNickname] AND [g].[SquadId] = [g0].[LeaderSquadId] ORDER BY [g].[Nickname], [g].[SquadId], [g0].[Nickname]"); } @@ -3467,7 +3467,7 @@ public override async Task Include_collection_on_derived_type_using_lambda_with_ 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], [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].[Nickname] = [g0].[LeaderNickname]) AND ([g].[SquadId] = [g0].[LeaderSquadId]) +LEFT JOIN [Gears] AS [g0] ON [g].[Nickname] = [g0].[LeaderNickname] AND [g].[SquadId] = [g0].[LeaderSquadId] ORDER BY [g].[Nickname], [g].[SquadId], [g0].[Nickname]"); } @@ -3478,7 +3478,7 @@ public override async Task Include_base_navigation_on_derived_entity(bool async) AssertSql( @"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], [w].[Id], [w].[AmmunitionType], [w].[IsAutomatic], [w].[Name], [w].[OwnerFullName], [w].[SynergyWithId] FROM [Gears] AS [g] -LEFT JOIN [Tags] AS [t] ON ([g].[Nickname] = [t].[GearNickName]) AND ([g].[SquadId] = [t].[GearSquadId]) +LEFT JOIN [Tags] AS [t] ON [g].[Nickname] = [t].[GearNickName] AND [g].[SquadId] = [t].[GearSquadId] LEFT JOIN [Weapons] AS [w] ON [g].[FullName] = [w].[OwnerFullName] ORDER BY [g].[Nickname], [g].[SquadId], [t].[Id]"); } @@ -3490,7 +3490,7 @@ public override async Task ThenInclude_collection_on_derived_after_base_referenc AssertSql( @"SELECT [t].[Id], [t].[GearNickName], [t].[GearSquadId], [t].[IssueDate], [t].[Note], [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 [Tags] AS [t] -LEFT JOIN [Gears] AS [g] ON ([t].[GearNickName] = [g].[Nickname]) AND ([t].[GearSquadId] = [g].[SquadId]) +LEFT JOIN [Gears] AS [g] ON [t].[GearNickName] = [g].[Nickname] AND [t].[GearSquadId] = [g].[SquadId] LEFT JOIN [Weapons] AS [w] ON [g].[FullName] = [w].[OwnerFullName] ORDER BY [t].[Id], [g].[Nickname], [g].[SquadId]"); } @@ -3507,8 +3507,8 @@ LEFT JOIN ( 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 [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] ORDER BY [f].[Id], [t].[Name], [g].[Nickname], [g].[SquadId], [g0].[Nickname]"); } @@ -3522,8 +3522,8 @@ FROM [Gears] AS [g] LEFT JOIN ( SELECT [g0].[Nickname], [g0].[SquadId], [g0].[AssignedCityName], [g0].[CityOfBirthName], [g0].[Discriminator], [g0].[FullName], [g0].[HasSoulPatch], [g0].[LeaderNickname], [g0].[LeaderSquadId], [g0].[Rank], [g1].[Nickname] AS [Nickname0], [g1].[SquadId] AS [SquadId0], [g1].[AssignedCityName] AS [AssignedCityName0], [g1].[CityOfBirthName] AS [CityOfBirthName0], [g1].[Discriminator] AS [Discriminator0], [g1].[FullName] AS [FullName0], [g1].[HasSoulPatch] AS [HasSoulPatch0], [g1].[LeaderNickname] AS [LeaderNickname0], [g1].[LeaderSquadId] AS [LeaderSquadId0], [g1].[Rank] AS [Rank0] FROM [Gears] AS [g0] - LEFT JOIN [Gears] AS [g1] ON ([g0].[Nickname] = [g1].[LeaderNickname]) AND ([g0].[SquadId] = [g1].[LeaderSquadId]) -) AS [t] ON ([g].[Nickname] = [t].[LeaderNickname]) AND ([g].[SquadId] = [t].[LeaderSquadId]) + LEFT JOIN [Gears] AS [g1] ON [g0].[Nickname] = [g1].[LeaderNickname] AND [g0].[SquadId] = [g1].[LeaderSquadId] +) AS [t] ON [g].[Nickname] = [t].[LeaderNickname] AND [g].[SquadId] = [t].[LeaderSquadId] ORDER BY [g].[Nickname], [g].[SquadId], [t].[Nickname], [t].[SquadId], [t].[Nickname0]"); } @@ -3537,7 +3537,7 @@ FROM [Factions] AS [f] LEFT JOIN ( 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] FROM [LocustLeaders] AS [l] - LEFT JOIN [Gears] AS [g] ON ([l].[DefeatedByNickname] = [g].[Nickname]) AND ([l].[DefeatedBySquadId] = [g].[SquadId]) + LEFT JOIN [Gears] AS [g] ON [l].[DefeatedByNickname] = [g].[Nickname] AND [l].[DefeatedBySquadId] = [g].[SquadId] ) AS [t] ON [f].[Id] = [t].[LocustHordeId] ORDER BY [f].[Id], [t].[Name], [t].[Nickname]"); } @@ -3554,8 +3554,8 @@ LEFT JOIN ( 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 [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] ORDER BY [f].[Id], [t].[Name], [g].[Nickname], [g].[SquadId], [g0].[Nickname]"); } @@ -3571,7 +3571,7 @@ LEFT JOIN ( FROM [Gears] AS [g0] INNER JOIN [Squads] AS [s] ON [g0].[SquadId] = [s].[Id] LEFT JOIN [SquadMissions] AS [s0] ON [s].[Id] = [s0].[SquadId] -) AS [t] ON ([g].[Nickname] = [t].[LeaderNickname]) AND ([g].[SquadId] = [t].[LeaderSquadId]) +) AS [t] ON [g].[Nickname] = [t].[LeaderNickname] AND [g].[SquadId] = [t].[LeaderSquadId] ORDER BY [g].[Nickname], [g].[SquadId], [t].[Nickname], [t].[SquadId], [t].[Id], [t].[SquadId0]"); } @@ -3585,7 +3585,7 @@ WHEN [g].[Nickname] IS NOT NULL AND [g].[SquadId] IS NOT NULL THEN [g].[HasSoulP ELSE CAST(0 AS bit) END AS [Prop] FROM [Tags] AS [t] -LEFT JOIN [Gears] AS [g] ON ([t].[GearNickName] = [g].[Nickname]) AND ([t].[GearSquadId] = [g].[SquadId])"); +LEFT JOIN [Gears] AS [g] ON [t].[GearNickName] = [g].[Nickname] AND [t].[GearSquadId] = [g].[SquadId]"); } public override async Task Enum_ToString_is_client_eval(bool async) @@ -3671,7 +3671,7 @@ FROM [Gears] AS [g] LEFT JOIN ( SELECT [w].[Id], [w].[AmmunitionType], [w].[IsAutomatic], [w].[Name], [w].[OwnerFullName], [w].[SynergyWithId] FROM [Weapons] AS [w] - WHERE ([w].[IsAutomatic] = CAST(1 AS bit)) OR (([w].[Name] <> N'foo') OR [w].[Name] IS NULL) + WHERE [w].[IsAutomatic] = CAST(1 AS bit) OR [w].[Name] <> N'foo' OR [w].[Name] IS NULL ) AS [t] ON [g].[FullName] = [t].[OwnerFullName] WHERE [g].[Nickname] <> N'Marcus' ORDER BY [g].[Nickname], [g].[SquadId]"); @@ -3687,7 +3687,7 @@ FROM [Gears] AS [g] LEFT JOIN ( SELECT [w].[Id], [w].[AmmunitionType], [w].[IsAutomatic], [w].[Name], [w].[OwnerFullName], [w].[SynergyWithId] FROM [Weapons] AS [w] - WHERE ([w].[IsAutomatic] = CAST(1 AS bit)) OR (([w].[Name] <> N'foo') OR [w].[Name] IS NULL) + WHERE [w].[IsAutomatic] = CAST(1 AS bit) OR [w].[Name] <> N'foo' OR [w].[Name] IS NULL ) AS [t] ON [g].[FullName] = [t].[OwnerFullName] WHERE [g].[Nickname] <> N'Marcus' ORDER BY [g].[Nickname], [g].[SquadId]"); @@ -3703,7 +3703,7 @@ FROM [Gears] AS [g] LEFT JOIN ( SELECT [w].[Id], [w].[AmmunitionType], [w].[IsAutomatic], [w].[Name], [w].[OwnerFullName], [w].[SynergyWithId] FROM [Weapons] AS [w] - WHERE ([w].[IsAutomatic] = CAST(1 AS bit)) OR (([w].[Name] <> N'foo') OR [w].[Name] IS NULL) + WHERE [w].[IsAutomatic] = CAST(1 AS bit) OR [w].[Name] <> N'foo' OR [w].[Name] IS NULL ) AS [t] ON [g].[FullName] = [t].[OwnerFullName] WHERE [g].[Nickname] <> N'Marcus' ORDER BY [g].[Nickname], [g].[SquadId]"); @@ -3719,7 +3719,7 @@ FROM [Gears] AS [g] LEFT JOIN ( SELECT [w].[Id], [w].[AmmunitionType], [w].[IsAutomatic], [w].[Name], [w].[OwnerFullName], [w].[SynergyWithId] FROM [Weapons] AS [w] - WHERE ([w].[IsAutomatic] = CAST(1 AS bit)) OR (([w].[Name] <> N'foo') OR [w].[Name] IS NULL) + WHERE [w].[IsAutomatic] = CAST(1 AS bit) OR [w].[Name] <> N'foo' OR [w].[Name] IS NULL ) AS [t] ON [g].[FullName] = [t].[OwnerFullName] WHERE [g].[Nickname] <> N'Marcus' ORDER BY [g].[Nickname], [g].[SquadId], [t].[Name] DESC"); @@ -3736,8 +3736,8 @@ LEFT JOIN ( SELECT [g0].[Nickname], [g0].[FullName], [g0].[SquadId], [g0].[LeaderNickname], [g0].[LeaderSquadId] FROM [Gears] AS [g0] WHERE [g0].[HasSoulPatch] = CAST(0 AS bit) -) AS [t] ON ([g].[Nickname] = [t].[LeaderNickname]) AND ([g].[SquadId] = [t].[LeaderSquadId]) -WHERE ([g].[Discriminator] = N'Officer') AND ([g].[Nickname] <> N'Foo') +) AS [t] ON [g].[Nickname] = [t].[LeaderNickname] AND [g].[SquadId] = [t].[LeaderSquadId] +WHERE [g].[Discriminator] = N'Officer' AND [g].[Nickname] <> N'Foo' ORDER BY [g].[Nickname], [g].[SquadId], [t].[Nickname]"); } @@ -3751,7 +3751,7 @@ FROM [Gears] AS [g] LEFT JOIN ( SELECT [w].[Name], [w].[Id], [w].[OwnerFullName] FROM [Weapons] AS [w] - WHERE ([w].[IsAutomatic] = CAST(1 AS bit)) OR (([w].[Name] <> N'foo') OR [w].[Name] IS NULL) + WHERE [w].[IsAutomatic] = CAST(1 AS bit) OR [w].[Name] <> N'foo' OR [w].[Name] IS NULL ) AS [t] ON [g].[FullName] = [t].[OwnerFullName] WHERE [g].[Nickname] <> N'Marcus' ORDER BY [g].[Nickname], [g].[SquadId]"); @@ -3767,7 +3767,7 @@ FROM [Gears] AS [g] LEFT JOIN ( SELECT N'BFG' AS [c], [w].[Id], [w].[OwnerFullName] FROM [Weapons] AS [w] - WHERE ([w].[IsAutomatic] = CAST(1 AS bit)) OR (([w].[Name] <> N'foo') OR [w].[Name] IS NULL) + WHERE [w].[IsAutomatic] = CAST(1 AS bit) OR [w].[Name] <> N'foo' OR [w].[Name] IS NULL ) AS [t] ON [g].[FullName] = [t].[OwnerFullName] WHERE [g].[Nickname] <> N'Marcus' ORDER BY [g].[Nickname], [g].[SquadId]"); @@ -3783,7 +3783,7 @@ FROM [Gears] AS [g] LEFT JOIN ( SELECT CAST(1 AS bit) AS [c], [w].[Id], [w].[OwnerFullName] FROM [Weapons] AS [w] - WHERE ([w].[IsAutomatic] = CAST(1 AS bit)) OR (([w].[Name] <> N'foo') OR [w].[Name] IS NULL) + WHERE [w].[IsAutomatic] = CAST(1 AS bit) OR [w].[Name] <> N'foo' OR [w].[Name] IS NULL ) AS [t] ON [g].[FullName] = [t].[OwnerFullName] WHERE [g].[Nickname] <> N'Marcus' ORDER BY [g].[Nickname], [g].[SquadId]"); @@ -3894,10 +3894,10 @@ 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]) +) AS [t0] ON [g].[Nickname] = [t0].[LeaderNickname] AND [g].[SquadId] = [t0].[LeaderSquadId] WHERE [g].[Discriminator] = N'Officer' ORDER BY [g].[HasSoulPatch] DESC, [g].[Nickname], [g].[SquadId], [t0].[Rank], [t0].[Nickname], [t0].[SquadId], [t0].[IsAutomatic]"); } @@ -3954,7 +3954,7 @@ LEFT JOIN ( FROM [Weapons] AS [w] WHERE [w].[IsAutomatic] = CAST(1 AS bit) ) AS [t] ON [g].[FullName] = [t].[OwnerFullName] -LEFT JOIN [Gears] AS [g0] ON ([g].[Nickname] = [g0].[LeaderNickname]) AND ([g].[SquadId] = [g0].[LeaderSquadId]) +LEFT JOIN [Gears] AS [g0] ON [g].[Nickname] = [g0].[LeaderNickname] AND [g].[SquadId] = [g0].[LeaderSquadId] WHERE [g].[Discriminator] = N'Officer' ORDER BY [g].[FullName], [g].[Nickname], [g].[SquadId], [t].[Id], [g0].[FullName], [g0].[Nickname]"); } @@ -3966,11 +3966,11 @@ public override async Task Multiple_orderby_with_navigation_expansion_on_one_of_ AssertSql( @"SELECT [g].[FullName] FROM [Gears] AS [g] -LEFT JOIN [Tags] AS [t] ON ([g].[Nickname] = [t].[GearNickName]) AND ([g].[SquadId] = [t].[GearSquadId]) -WHERE ([g].[Discriminator] = N'Officer') AND EXISTS ( +LEFT JOIN [Tags] AS [t] ON [g].[Nickname] = [t].[GearNickName] AND [g].[SquadId] = [t].[GearSquadId] +WHERE [g].[Discriminator] = N'Officer' AND EXISTS ( SELECT 1 FROM [Gears] AS [g0] - WHERE ([g].[Nickname] = [g0].[LeaderNickname]) AND ([g].[SquadId] = [g0].[LeaderSquadId])) + WHERE [g].[Nickname] = [g0].[LeaderNickname] AND [g].[SquadId] = [g0].[LeaderSquadId]) ORDER BY [g].[HasSoulPatch] DESC, [t].[Note]"); } @@ -3981,17 +3981,17 @@ public override async Task Multiple_orderby_with_navigation_expansion_on_one_of_ AssertSql( @"SELECT [g].[FullName], [g].[Nickname], [g].[SquadId], [t].[Id], [g1].[Nickname], [g1].[SquadId], [t0].[Id], [t0].[AmmunitionType], [t0].[IsAutomatic], [t0].[Name], [t0].[OwnerFullName], [t0].[SynergyWithId], [t0].[Nickname], [t0].[SquadId] FROM [Gears] AS [g] -LEFT JOIN [Tags] AS [t] ON ([g].[Nickname] = [t].[GearNickName]) AND ([g].[SquadId] = [t].[GearSquadId]) -LEFT JOIN [Gears] AS [g1] ON ([t].[GearNickName] = [g1].[Nickname]) AND ([t].[GearSquadId] = [g1].[SquadId]) +LEFT JOIN [Tags] AS [t] ON [g].[Nickname] = [t].[GearNickName] AND [g].[SquadId] = [t].[GearSquadId] +LEFT JOIN [Gears] AS [g1] ON [t].[GearNickName] = [g1].[Nickname] AND [t].[GearSquadId] = [g1].[SquadId] LEFT JOIN ( SELECT [w].[Id], [w].[AmmunitionType], [w].[IsAutomatic], [w].[Name], [w].[OwnerFullName], [w].[SynergyWithId], [g2].[Nickname], [g2].[SquadId] FROM [Weapons] AS [w] LEFT JOIN [Gears] AS [g2] ON [w].[OwnerFullName] = [g2].[FullName] ) AS [t0] ON [g1].[FullName] = [t0].[OwnerFullName] -WHERE ([g].[Discriminator] = N'Officer') AND EXISTS ( +WHERE [g].[Discriminator] = N'Officer' AND EXISTS ( SELECT 1 FROM [Gears] AS [g0] - WHERE ([g].[Nickname] = [g0].[LeaderNickname]) AND ([g].[SquadId] = [g0].[LeaderSquadId])) + WHERE [g].[Nickname] = [g0].[LeaderNickname] AND [g].[SquadId] = [g0].[LeaderSquadId]) ORDER BY [g].[HasSoulPatch] DESC, [t].[Note], [g].[Nickname], [g].[SquadId], [t].[Id], [g1].[Nickname], [g1].[SquadId], [t0].[IsAutomatic], [t0].[Nickname] DESC, [t0].[Id]"); } @@ -4003,17 +4003,17 @@ public override async Task Multiple_orderby_with_navigation_expansion_on_one_of_ AssertSql( @"SELECT [g].[FullName], [g].[Nickname], [g].[SquadId], [t].[Id], [g1].[Nickname], [g1].[SquadId], [t0].[Id], [t0].[AmmunitionType], [t0].[IsAutomatic], [t0].[Name], [t0].[OwnerFullName], [t0].[SynergyWithId], [t0].[Nickname], [t0].[SquadId] FROM [Gears] AS [g] -LEFT JOIN [Tags] AS [t] ON ([g].[Nickname] = [t].[GearNickName]) AND ([g].[SquadId] = [t].[GearSquadId]) -LEFT JOIN [Gears] AS [g1] ON ([t].[GearNickName] = [g1].[Nickname]) AND ([t].[GearSquadId] = [g1].[SquadId]) +LEFT JOIN [Tags] AS [t] ON [g].[Nickname] = [t].[GearNickName] AND [g].[SquadId] = [t].[GearSquadId] +LEFT JOIN [Gears] AS [g1] ON [t].[GearNickName] = [g1].[Nickname] AND [t].[GearSquadId] = [g1].[SquadId] LEFT JOIN ( SELECT [w].[Id], [w].[AmmunitionType], [w].[IsAutomatic], [w].[Name], [w].[OwnerFullName], [w].[SynergyWithId], [g2].[Nickname], [g2].[SquadId] FROM [Weapons] AS [w] LEFT JOIN [Gears] AS [g2] ON [w].[OwnerFullName] = [g2].[FullName] ) AS [t0] ON [g1].[FullName] = [t0].[OwnerFullName] -WHERE ([g].[Discriminator] = N'Officer') AND EXISTS ( +WHERE [g].[Discriminator] = N'Officer' AND EXISTS ( SELECT 1 FROM [Gears] AS [g0] - WHERE ([g].[Nickname] = [g0].[LeaderNickname]) AND ([g].[SquadId] = [g0].[LeaderSquadId])) + WHERE [g].[Nickname] = [g0].[LeaderNickname] AND [g].[SquadId] = [g0].[LeaderSquadId]) ORDER BY [g].[HasSoulPatch] DESC, [t].[Note], [g].[Nickname], [g].[SquadId], [t].[Id], [g1].[Nickname], [g1].[SquadId], [t0].[IsAutomatic], [t0].[Nickname] DESC, [t0].[Id]"); } @@ -4025,20 +4025,20 @@ public override async Task Multiple_orderby_with_navigation_expansion_on_one_of_ AssertSql( @"SELECT [g].[FullName], [g].[Nickname], [g].[SquadId], [t].[Id], [g1].[Nickname], [g1].[SquadId], [t0].[Id], [t0].[AmmunitionType], [t0].[IsAutomatic], [t0].[Name], [t0].[OwnerFullName], [t0].[SynergyWithId], [t0].[Nickname], [t0].[SquadId] FROM [Gears] AS [g] -LEFT JOIN [Tags] AS [t] ON ([g].[Nickname] = [t].[GearNickName]) AND ([g].[SquadId] = [t].[GearSquadId]) -LEFT JOIN [Gears] AS [g1] ON ([t].[GearNickName] = [g1].[Nickname]) AND ([t].[GearSquadId] = [g1].[SquadId]) +LEFT JOIN [Tags] AS [t] ON [g].[Nickname] = [t].[GearNickName] AND [g].[SquadId] = [t].[GearSquadId] +LEFT JOIN [Gears] AS [g1] ON [t].[GearNickName] = [g1].[Nickname] AND [t].[GearSquadId] = [g1].[SquadId] 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] -WHERE ([g].[Discriminator] = N'Officer') AND EXISTS ( +WHERE [g].[Discriminator] = N'Officer' AND EXISTS ( SELECT 1 FROM [Gears] AS [g0] - WHERE ([g].[Nickname] = [g0].[LeaderNickname]) AND ([g].[SquadId] = [g0].[LeaderSquadId])) + WHERE [g].[Nickname] = [g0].[LeaderNickname] AND [g].[SquadId] = [g0].[LeaderSquadId]) ORDER BY [g].[HasSoulPatch] DESC, [t].[Note], [g].[Nickname], [g].[SquadId], [t].[Id], [g1].[Nickname], [g1].[SquadId], [t0].[Id] DESC, [t0].[c], [t0].[Nickname]"); } @@ -4049,8 +4049,8 @@ public override async Task Correlated_collections_multiple_nested_complex_collec AssertSql( @"SELECT [g].[FullName], [g].[Nickname], [g].[SquadId], [t].[Id], [g1].[Nickname], [g1].[SquadId], [t0].[FullName], [t0].[Nickname], [t0].[SquadId], [t0].[Id], [t0].[Nickname0], [t0].[SquadId0], [t0].[Id0], [t0].[Name], [t0].[IsAutomatic], [t0].[Id1], [t0].[Nickname00], [t0].[HasSoulPatch], [t0].[SquadId00], [t2].[Id], [t2].[AmmunitionType], [t2].[IsAutomatic], [t2].[Name], [t2].[OwnerFullName], [t2].[SynergyWithId], [t2].[Nickname], [t2].[SquadId] FROM [Gears] AS [g] -LEFT JOIN [Tags] AS [t] ON ([g].[Nickname] = [t].[GearNickName]) AND ([g].[SquadId] = [t].[GearSquadId]) -LEFT JOIN [Gears] AS [g1] ON ([t].[GearNickName] = [g1].[Nickname]) AND ([t].[GearSquadId] = [g1].[SquadId]) +LEFT JOIN [Tags] AS [t] ON [g].[Nickname] = [t].[GearNickName] AND [g].[SquadId] = [t].[GearSquadId] +LEFT JOIN [Gears] AS [g1] ON [t].[GearNickName] = [g1].[Nickname] AND [t].[GearSquadId] = [g1].[SquadId] LEFT JOIN ( SELECT [g2].[FullName], [g2].[Nickname], [g2].[SquadId], [t1].[Id], [t1].[Nickname] AS [Nickname0], [t1].[SquadId] AS [SquadId0], [t1].[Id0], [t1].[Name], [t1].[IsAutomatic], [t1].[Id1], [t1].[Nickname0] AS [Nickname00], [t1].[HasSoulPatch], [t1].[SquadId0] AS [SquadId00], [g2].[Rank], [t1].[IsAutomatic0], [g2].[LeaderNickname], [g2].[LeaderSquadId] FROM [Gears] AS [g2] @@ -4061,19 +4061,19 @@ 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]) +) AS [t0] ON [g].[Nickname] = [t0].[LeaderNickname] AND [g].[SquadId] = [t0].[LeaderSquadId] LEFT JOIN ( SELECT [w1].[Id], [w1].[AmmunitionType], [w1].[IsAutomatic], [w1].[Name], [w1].[OwnerFullName], [w1].[SynergyWithId], [g5].[Nickname], [g5].[SquadId] FROM [Weapons] AS [w1] LEFT JOIN [Gears] AS [g5] ON [w1].[OwnerFullName] = [g5].[FullName] ) AS [t2] ON [g1].[FullName] = [t2].[OwnerFullName] -WHERE ([g].[Discriminator] = N'Officer') AND EXISTS ( +WHERE [g].[Discriminator] = N'Officer' AND EXISTS ( SELECT 1 FROM [Gears] AS [g0] - WHERE ([g].[Nickname] = [g0].[LeaderNickname]) AND ([g].[SquadId] = [g0].[LeaderSquadId])) + WHERE [g].[Nickname] = [g0].[LeaderNickname] AND [g].[SquadId] = [g0].[LeaderSquadId]) ORDER BY [g].[HasSoulPatch] DESC, [t].[Note], [g].[Nickname], [g].[SquadId], [t].[Id], [g1].[Nickname], [g1].[SquadId], [t0].[Rank], [t0].[Nickname], [t0].[SquadId], [t0].[IsAutomatic0], [t0].[Id], [t0].[Nickname0], [t0].[SquadId0], [t0].[Id0], [t0].[Id1], [t0].[Nickname00], [t0].[SquadId00], [t2].[IsAutomatic], [t2].[Nickname] DESC, [t2].[Id]"); } @@ -4087,7 +4087,7 @@ FROM [Gears] AS [g] OUTER APPLY ( SELECT [g0].[FullName] AS [ReportName], [g].[FullName] AS [OfficerName], [g0].[Nickname], [g0].[SquadId] FROM [Gears] AS [g0] - WHERE ([g].[Nickname] = [g0].[LeaderNickname]) AND ([g].[SquadId] = [g0].[LeaderSquadId]) + WHERE [g].[Nickname] = [g0].[LeaderNickname] AND [g].[SquadId] = [g0].[LeaderSquadId] ) AS [t] WHERE [g].[Discriminator] = N'Officer' ORDER BY [g].[Nickname], [g].[SquadId], [t].[Nickname]"); @@ -4103,7 +4103,7 @@ FROM [Gears] AS [g] OUTER APPLY ( SELECT [g0].[FullName] AS [ReportName], [g0].[Nickname], [g0].[SquadId] FROM [Gears] AS [g0] - WHERE ([g].[FullName] <> N'Foo') AND (([g].[Nickname] = [g0].[LeaderNickname]) AND ([g].[SquadId] = [g0].[LeaderSquadId])) + WHERE [g].[FullName] <> N'Foo' AND [g].[Nickname] = [g0].[LeaderNickname] AND [g].[SquadId] = [g0].[LeaderSquadId] ) AS [t] WHERE [g].[Discriminator] = N'Officer' ORDER BY [g].[Nickname], [g].[SquadId], [t].[Nickname]"); @@ -4122,10 +4122,10 @@ FROM [Gears] AS [g0] OUTER APPLY ( SELECT [w].[Name], [g0].[Nickname], [w].[Id] FROM [Weapons] AS [w] - WHERE (([w].[Name] <> N'Bar') OR [w].[Name] IS NULL) AND ([g0].[FullName] = [w].[OwnerFullName]) + WHERE ([w].[Name] <> N'Bar' OR [w].[Name] IS NULL) AND [g0].[FullName] = [w].[OwnerFullName] ) AS [t] WHERE [g0].[FullName] <> N'Foo' -) AS [t0] ON ([g].[Nickname] = [t0].[LeaderNickname]) AND ([g].[SquadId] = [t0].[LeaderSquadId]) +) AS [t0] ON [g].[Nickname] = [t0].[LeaderNickname] AND [g].[SquadId] = [t0].[LeaderSquadId] WHERE [g].[Discriminator] = N'Officer' ORDER BY [g].[Nickname], [g].[SquadId], [t0].[Nickname], [t0].[SquadId]"); } @@ -4143,9 +4143,9 @@ FROM [Gears] AS [g0] LEFT JOIN ( SELECT [w].[Name], [g].[Nickname], [w].[Id], [w].[OwnerFullName] FROM [Weapons] AS [w] - WHERE ([w].[Name] <> N'Bar') OR [w].[Name] IS NULL + WHERE [w].[Name] <> N'Bar' OR [w].[Name] IS NULL ) AS [t] ON [g0].[FullName] = [t].[OwnerFullName] - WHERE ([g0].[FullName] <> N'Foo') AND (([g].[Nickname] = [g0].[LeaderNickname]) AND ([g].[SquadId] = [g0].[LeaderSquadId])) + WHERE [g0].[FullName] <> N'Foo' AND [g].[Nickname] = [g0].[LeaderNickname] AND [g].[SquadId] = [g0].[LeaderSquadId] ) AS [t0] WHERE [g].[Discriminator] = N'Officer' ORDER BY [g].[Nickname], [g].[SquadId], [t0].[Nickname], [t0].[SquadId]"); @@ -4162,7 +4162,7 @@ CROSS JOIN [Squads] AS [s] LEFT JOIN ( SELECT [w].[Id], [w].[AmmunitionType], [w].[IsAutomatic], [w].[Name], [w].[OwnerFullName], [w].[SynergyWithId] FROM [Weapons] AS [w] - WHERE ([w].[IsAutomatic] = CAST(1 AS bit)) OR (([w].[Name] <> N'foo') OR [w].[Name] IS NULL) + WHERE [w].[IsAutomatic] = CAST(1 AS bit) OR [w].[Name] <> N'foo' OR [w].[Name] IS NULL ) AS [t] ON [g].[FullName] = [t].[OwnerFullName] LEFT JOIN ( SELECT [g0].[Nickname], [g0].[SquadId], [g0].[AssignedCityName], [g0].[CityOfBirthName], [g0].[Discriminator], [g0].[FullName], [g0].[HasSoulPatch], [g0].[LeaderNickname], [g0].[LeaderSquadId], [g0].[Rank] @@ -4294,7 +4294,7 @@ LEFT JOIN ( FROM [Gears] AS [g] WHERE [g].[Discriminator] = N'Officer' ) AS [t0] ON [t].[GearNickName] = [t0].[Nickname] -LEFT JOIN [Gears] AS [g0] ON (([t0].[Nickname] = [g0].[LeaderNickname]) OR ([t0].[Nickname] IS NULL AND [g0].[LeaderNickname] IS NULL)) AND ([t0].[SquadId] = [g0].[LeaderSquadId]) +LEFT JOIN [Gears] AS [g0] ON ([t0].[Nickname] = [g0].[LeaderNickname] OR ([t0].[Nickname] IS NULL AND [g0].[LeaderNickname] IS NULL)) AND [t0].[SquadId] = [g0].[LeaderSquadId] ORDER BY [t].[Id], [t0].[Nickname], [t0].[SquadId], [g0].[Nickname]"); } @@ -4375,7 +4375,7 @@ FROM [Weapons] AS [w] LEFT JOIN [Squads] AS [s] ON [g1].[SquadId] = [s].[Id] LEFT JOIN [Gears] AS [g2] ON [s].[Id] = [g2].[SquadId] ) AS [t] ON [g0].[FullName] = [t].[OwnerFullName] -) AS [t0] ON ([g].[Nickname] = [t0].[LeaderNickname]) AND ([g].[SquadId] = [t0].[LeaderSquadId]) +) AS [t0] ON [g].[Nickname] = [t0].[LeaderNickname] AND [g].[SquadId] = [t0].[LeaderSquadId] WHERE [g].[Discriminator] = N'Officer' ORDER BY [g].[Nickname], [g].[SquadId], [t0].[Nickname], [t0].[SquadId], [t0].[Id], [t0].[Nickname0], [t0].[SquadId0], [t0].[Id0], [t0].[Nickname00]"); } @@ -4414,7 +4414,7 @@ FROM [Weapons] AS [w] LEFT JOIN [Squads] AS [s] ON [g1].[SquadId] = [s].[Id] LEFT JOIN [Gears] AS [g2] ON [s].[Id] = [g2].[SquadId] ) AS [t] ON [g0].[FullName] = [t].[OwnerFullName] -) AS [t0] ON ([g].[Nickname] = [t0].[LeaderNickname]) AND ([g].[SquadId] = [t0].[LeaderSquadId]) +) AS [t0] ON [g].[Nickname] = [t0].[LeaderNickname] AND [g].[SquadId] = [t0].[LeaderSquadId] WHERE [g].[Discriminator] = N'Officer' ORDER BY [g].[HasSoulPatch], [g].[LeaderNickname], [g].[FullName], [g].[Nickname], [g].[SquadId], [t0].[FullName], [t0].[HasSoulPatch0] DESC, [t0].[Nickname], [t0].[SquadId], [t0].[IsAutomatic], [t0].[Name] DESC, [t0].[Id], [t0].[Nickname0], [t0].[SquadId0], [t0].[Id0], [t0].[Nickname00]"); } @@ -4485,7 +4485,7 @@ INNER JOIN ( FROM [Factions] AS [f] WHERE [f].[Name] = N'Swarm' ) AS [t] ON [l].[Name] = [t].[CommanderName] -WHERE ([t].[Eradicated] <> CAST(1 AS bit)) OR ([t].[Eradicated] IS NULL)"); +WHERE [t].[Eradicated] <> CAST(1 AS bit) OR ([t].[Eradicated] IS NULL)"); } public override async Task Null_semantics_on_nullable_bool_from_left_join_subquery_is_fully_applied(bool async) @@ -4500,7 +4500,7 @@ LEFT JOIN ( FROM [Factions] AS [f] WHERE [f].[Name] = N'Swarm' ) AS [t] ON [l].[Name] = [t].[CommanderName] -WHERE ([t].[Eradicated] <> CAST(1 AS bit)) OR ([t].[Eradicated] IS NULL)"); +WHERE [t].[Eradicated] <> CAST(1 AS bit) OR ([t].[Eradicated] IS NULL)"); } public override async Task Include_on_derived_type_with_order_by_and_paging(bool async) @@ -4514,8 +4514,8 @@ public override async Task Include_on_derived_type_with_order_by_and_paging(bool FROM ( 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 [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)) ORDER BY [t].[Note] ) AS [t0] LEFT JOIN [Weapons] AS [w] ON [t0].[FullName] = [w].[OwnerFullName] @@ -4614,7 +4614,7 @@ ELSE COALESCE([g].[HasSoulPatch], CAST(1 AS bit)) ELSE CAST(0 AS bit) END AS [c] FROM [Tags] AS [t] -LEFT JOIN [Gears] AS [g] ON ([t].[GearNickName] = [g].[Nickname]) AND ([t].[GearSquadId] = [g].[SquadId])"); +LEFT JOIN [Gears] AS [g] ON [t].[GearNickName] = [g].[Nickname] AND [t].[GearSquadId] = [g].[SquadId]"); } public override async Task Order_by_entity_qsre(bool async) @@ -4680,7 +4680,7 @@ public override async Task Join_on_entity_qsre_keys_composite_key(bool async) AssertSql( @"SELECT [g].[FullName] AS [GearName1], [g0].[FullName] AS [GearName2] FROM [Gears] AS [g] -INNER JOIN [Gears] AS [g0] ON ([g].[Nickname] = [g0].[Nickname]) AND ([g].[SquadId] = [g0].[SquadId])"); +INNER JOIN [Gears] AS [g0] ON [g].[Nickname] = [g0].[Nickname] AND [g].[SquadId] = [g0].[SquadId]"); } public override async Task Join_on_entity_qsre_keys_inheritance(bool async) @@ -4694,7 +4694,7 @@ INNER JOIN ( SELECT [g0].[Nickname], [g0].[SquadId], [g0].[FullName] FROM [Gears] AS [g0] WHERE [g0].[Discriminator] = N'Officer' -) AS [t] ON ([g].[Nickname] = [t].[Nickname]) AND ([g].[SquadId] = [t].[SquadId])"); +) AS [t] ON [g].[Nickname] = [t].[Nickname] AND [g].[SquadId] = [t].[SquadId]"); } public override async Task Join_on_entity_qsre_keys_outer_key_is_navigation(bool async) @@ -4732,9 +4732,9 @@ FROM [Gears] AS [g] INNER JOIN ( SELECT [t].[Note], [g0].[Nickname], [g0].[SquadId] FROM [Tags] AS [t] - LEFT JOIN [Gears] AS [g0] ON ([t].[GearNickName] = [g0].[Nickname]) AND ([t].[GearSquadId] = [g0].[SquadId]) + LEFT JOIN [Gears] AS [g0] ON [t].[GearNickName] = [g0].[Nickname] AND [t].[GearSquadId] = [g0].[SquadId] WHERE [t].[Note] IN (N'Cole''s Tag', N'Dom''s Tag') -) AS [t0] ON ([g].[Nickname] = [t0].[Nickname]) AND ([g].[SquadId] = [t0].[SquadId])"); +) AS [t0] ON [g].[Nickname] = [t0].[Nickname] AND [g].[SquadId] = [t0].[SquadId]"); } public override async Task Join_on_entity_qsre_keys_inner_key_is_nested_navigation(bool async) @@ -4795,7 +4795,7 @@ public override async Task Project_one_value_type_from_empty_collection(bool asy @"SELECT [s].[Name], COALESCE(( SELECT TOP(1) [g].[SquadId] FROM [Gears] AS [g] - WHERE ([s].[Id] = [g].[SquadId]) AND ([g].[HasSoulPatch] = CAST(1 AS bit))), 0) AS [SquadId] + WHERE [s].[Id] = [g].[SquadId] AND [g].[HasSoulPatch] = CAST(1 AS bit)), 0) AS [SquadId] FROM [Squads] AS [s] WHERE [s].[Name] = N'Kilo'"); } @@ -4808,7 +4808,7 @@ public override async Task Project_one_value_type_converted_to_nullable_from_emp @"SELECT [s].[Name], ( SELECT TOP(1) [g].[SquadId] FROM [Gears] AS [g] - WHERE ([s].[Id] = [g].[SquadId]) AND ([g].[HasSoulPatch] = CAST(1 AS bit))) AS [SquadId] + WHERE [s].[Id] = [g].[SquadId] AND [g].[HasSoulPatch] = CAST(1 AS bit)) AS [SquadId] FROM [Squads] AS [s] WHERE [s].[Name] = N'Kilo'"); } @@ -4854,7 +4854,7 @@ public override async Task Select_subquery_projecting_single_constant_int(bool a @"SELECT [s].[Name], COALESCE(( SELECT TOP(1) 42 FROM [Gears] AS [g] - WHERE ([s].[Id] = [g].[SquadId]) AND ([g].[HasSoulPatch] = CAST(1 AS bit))), 0) AS [Gear] + WHERE [s].[Id] = [g].[SquadId] AND [g].[HasSoulPatch] = CAST(1 AS bit)), 0) AS [Gear] FROM [Squads] AS [s]"); } @@ -4866,7 +4866,7 @@ public override async Task Select_subquery_projecting_single_constant_string(boo @"SELECT [s].[Name], ( SELECT TOP(1) N'Foo' FROM [Gears] AS [g] - WHERE ([s].[Id] = [g].[SquadId]) AND ([g].[HasSoulPatch] = CAST(1 AS bit))) AS [Gear] + WHERE [s].[Id] = [g].[SquadId] AND [g].[HasSoulPatch] = CAST(1 AS bit)) AS [Gear] FROM [Squads] AS [s]"); } @@ -4878,7 +4878,7 @@ public override async Task Select_subquery_projecting_single_constant_bool(bool @"SELECT [s].[Name], COALESCE(( SELECT TOP(1) CAST(1 AS bit) FROM [Gears] AS [g] - WHERE ([s].[Id] = [g].[SquadId]) AND ([g].[HasSoulPatch] = CAST(1 AS bit))), CAST(0 AS bit)) AS [Gear] + WHERE [s].[Id] = [g].[SquadId] AND [g].[HasSoulPatch] = CAST(1 AS bit)), CAST(0 AS bit)) AS [Gear] FROM [Squads] AS [s]"); } @@ -4983,7 +4983,7 @@ public override async Task Include_collection_OrderBy_aggregate(bool 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], [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].[Nickname] = [g0].[LeaderNickname]) AND ([g].[SquadId] = [g0].[LeaderSquadId]) +LEFT JOIN [Gears] AS [g0] ON [g].[Nickname] = [g0].[LeaderNickname] AND [g].[SquadId] = [g0].[LeaderSquadId] WHERE [g].[Discriminator] = N'Officer' ORDER BY ( SELECT COUNT(*) @@ -4998,7 +4998,7 @@ public override async Task Include_collection_with_complex_OrderBy2(bool 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], [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].[Nickname] = [g0].[LeaderNickname]) AND ([g].[SquadId] = [g0].[LeaderSquadId]) +LEFT JOIN [Gears] AS [g0] ON [g].[Nickname] = [g0].[LeaderNickname] AND [g].[SquadId] = [g0].[LeaderSquadId] WHERE [g].[Discriminator] = N'Officer' ORDER BY ( SELECT TOP(1) [w].[IsAutomatic] @@ -5014,7 +5014,7 @@ public override async Task Include_collection_with_complex_OrderBy3(bool 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], [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].[Nickname] = [g0].[LeaderNickname]) AND ([g].[SquadId] = [g0].[LeaderSquadId]) +LEFT JOIN [Gears] AS [g0] ON [g].[Nickname] = [g0].[LeaderNickname] AND [g].[SquadId] = [g0].[LeaderSquadId] WHERE [g].[Discriminator] = N'Officer' ORDER BY COALESCE(( SELECT TOP(1) [w].[IsAutomatic] @@ -5034,7 +5034,7 @@ LEFT JOIN ( SELECT [g0].[Nickname], [g0].[SquadId], [g0].[AssignedCityName], [g0].[CityOfBirthName], [g0].[Discriminator], [g0].[FullName], [g0].[HasSoulPatch], [g0].[LeaderNickname], [g0].[LeaderSquadId], [g0].[Rank] FROM [Gears] AS [g0] WHERE [g0].[HasSoulPatch] = CAST(0 AS bit) -) AS [t] ON ([g].[Nickname] = [t].[LeaderNickname]) AND ([g].[SquadId] = [t].[LeaderSquadId]) +) AS [t] ON [g].[Nickname] = [t].[LeaderNickname] AND [g].[SquadId] = [t].[LeaderSquadId] WHERE [g].[Discriminator] = N'Officer' ORDER BY ( SELECT COUNT(*) @@ -5053,15 +5053,15 @@ LEFT JOIN ( SELECT [g1].[Nickname], [g1].[SquadId], [g1].[AssignedCityName], [g1].[CityOfBirthName], [g1].[Discriminator], [g1].[FullName], [g1].[HasSoulPatch], [g1].[LeaderNickname], [g1].[LeaderSquadId], [g1].[Rank] FROM [Gears] AS [g1] WHERE [g1].[HasSoulPatch] = CAST(0 AS bit) -) AS [t] ON ([g].[Nickname] = [t].[LeaderNickname]) AND ([g].[SquadId] = [t].[LeaderSquadId]) +) AS [t] ON [g].[Nickname] = [t].[LeaderNickname] AND [g].[SquadId] = [t].[LeaderSquadId] WHERE [g].[Discriminator] = N'Officer' ORDER BY ( SELECT COUNT(*) FROM [Weapons] AS [w] - WHERE ([g].[FullName] = [w].[OwnerFullName]) AND ([w].[IsAutomatic] = COALESCE(( + WHERE [g].[FullName] = [w].[OwnerFullName] AND [w].[IsAutomatic] = COALESCE(( SELECT TOP(1) [g0].[HasSoulPatch] FROM [Gears] AS [g0] - WHERE [g0].[Nickname] = N'Marcus'), CAST(0 AS bit)))), [g].[Nickname], [g].[SquadId], [t].[Nickname]"); + WHERE [g0].[Nickname] = N'Marcus'), CAST(0 AS bit))), [g].[Nickname], [g].[SquadId], [t].[Nickname]"); } public override async Task Cast_to_derived_type_after_OfType_works(bool async) @@ -5164,7 +5164,7 @@ public override async Task Select_subquery_boolean_empty(bool async) @"SELECT COALESCE(( SELECT TOP(1) [w].[IsAutomatic] FROM [Weapons] AS [w] - WHERE ([g].[FullName] = [w].[OwnerFullName]) AND ([w].[Name] = N'BFG') + WHERE [g].[FullName] = [w].[OwnerFullName] AND [w].[Name] = N'BFG' ORDER BY [w].[Id]), CAST(0 AS bit)) FROM [Gears] AS [g]"); } @@ -5177,7 +5177,7 @@ public override async Task Select_subquery_boolean_empty_with_pushdown(bool asyn @"SELECT ( SELECT TOP(1) [w].[IsAutomatic] FROM [Weapons] AS [w] - WHERE ([g].[FullName] = [w].[OwnerFullName]) AND ([w].[Name] = N'BFG') + WHERE [g].[FullName] = [w].[OwnerFullName] AND [w].[Name] = N'BFG' ORDER BY [w].[Id]) FROM [Gears] AS [g]"); } @@ -5192,7 +5192,7 @@ SELECT TOP(1) [t].[IsAutomatic] FROM ( SELECT DISTINCT [w].[Id], [w].[AmmunitionType], [w].[IsAutomatic], [w].[Name], [w].[OwnerFullName], [w].[SynergyWithId] FROM [Weapons] AS [w] - WHERE ([g].[FullName] = [w].[OwnerFullName]) AND ([w].[Name] LIKE N'%Lancer%') + WHERE [g].[FullName] = [w].[OwnerFullName] AND ([w].[Name] LIKE N'%Lancer%') ) AS [t]), CAST(0 AS bit)) FROM [Gears] AS [g] WHERE [g].[HasSoulPatch] = CAST(1 AS bit)"); @@ -5206,7 +5206,7 @@ public override async Task Select_subquery_distinct_singleordefault_boolean2(boo @"SELECT COALESCE(( SELECT DISTINCT TOP(1) [w].[IsAutomatic] FROM [Weapons] AS [w] - WHERE ([g].[FullName] = [w].[OwnerFullName]) AND ([w].[Name] LIKE N'%Lancer%')), CAST(0 AS bit)) + WHERE [g].[FullName] = [w].[OwnerFullName] AND ([w].[Name] LIKE N'%Lancer%')), CAST(0 AS bit)) FROM [Gears] AS [g] WHERE [g].[HasSoulPatch] = CAST(1 AS bit)"); } @@ -5221,7 +5221,7 @@ SELECT TOP(1) [t].[IsAutomatic] FROM ( SELECT DISTINCT [w].[Id], [w].[AmmunitionType], [w].[IsAutomatic], [w].[Name], [w].[OwnerFullName], [w].[SynergyWithId] FROM [Weapons] AS [w] - WHERE ([g].[FullName] = [w].[OwnerFullName]) AND ([w].[Name] LIKE N'%Lancer%') + WHERE [g].[FullName] = [w].[OwnerFullName] AND ([w].[Name] LIKE N'%Lancer%') ) AS [t]) FROM [Gears] AS [g] WHERE [g].[HasSoulPatch] = CAST(1 AS bit)"); @@ -5237,7 +5237,7 @@ SELECT TOP(1) [t].[IsAutomatic] FROM ( SELECT DISTINCT [w].[Id], [w].[AmmunitionType], [w].[IsAutomatic], [w].[Name], [w].[OwnerFullName], [w].[SynergyWithId] FROM [Weapons] AS [w] - WHERE ([g].[FullName] = [w].[OwnerFullName]) AND ([w].[Name] = N'BFG') + WHERE [g].[FullName] = [w].[OwnerFullName] AND [w].[Name] = N'BFG' ) AS [t]), CAST(0 AS bit)) FROM [Gears] AS [g] WHERE [g].[HasSoulPatch] = CAST(1 AS bit)"); @@ -5251,7 +5251,7 @@ public override async Task Select_subquery_distinct_singleordefault_boolean_empt @"SELECT COALESCE(( SELECT DISTINCT TOP(1) [w].[IsAutomatic] FROM [Weapons] AS [w] - WHERE ([g].[FullName] = [w].[OwnerFullName]) AND ([w].[Name] = N'BFG')), CAST(0 AS bit)) + WHERE [g].[FullName] = [w].[OwnerFullName] AND [w].[Name] = N'BFG'), CAST(0 AS bit)) FROM [Gears] AS [g] WHERE [g].[HasSoulPatch] = CAST(1 AS bit)"); } @@ -5266,7 +5266,7 @@ SELECT TOP(1) [t].[IsAutomatic] FROM ( SELECT DISTINCT [w].[Id], [w].[AmmunitionType], [w].[IsAutomatic], [w].[Name], [w].[OwnerFullName], [w].[SynergyWithId] FROM [Weapons] AS [w] - WHERE ([g].[FullName] = [w].[OwnerFullName]) AND ([w].[Name] = N'BFG') + WHERE [g].[FullName] = [w].[OwnerFullName] AND [w].[Name] = N'BFG' ) AS [t]) FROM [Gears] AS [g] WHERE [g].[HasSoulPatch] = CAST(1 AS bit)"); @@ -5363,7 +5363,7 @@ public override async Task Double_order_by_on_string_compare(bool async) @"SELECT [w].[Id], [w].[AmmunitionType], [w].[IsAutomatic], [w].[Name], [w].[OwnerFullName], [w].[SynergyWithId] FROM [Weapons] AS [w] ORDER BY CASE - WHEN ([w].[Name] = N'Marcus'' Lancer') AND [w].[Name] IS NOT NULL THEN CAST(1 AS bit) + WHEN [w].[Name] = N'Marcus'' Lancer' AND [w].[Name] IS NOT NULL THEN CAST(1 AS bit) ELSE CAST(0 AS bit) END, [w].[Id]"); } @@ -5387,7 +5387,7 @@ public override async Task String_compare_with_null_conditional_argument(bool as FROM [Weapons] AS [w] LEFT JOIN [Weapons] AS [w0] ON [w].[SynergyWithId] = [w0].[Id] ORDER BY CASE - WHEN ([w0].[Name] = N'Marcus'' Lancer') AND [w0].[Name] IS NOT NULL THEN CAST(1 AS bit) + WHEN [w0].[Name] = N'Marcus'' Lancer' AND [w0].[Name] IS NOT NULL THEN CAST(1 AS bit) ELSE CAST(0 AS bit) END"); } @@ -5401,7 +5401,7 @@ public override async Task String_compare_with_null_conditional_argument2(bool a FROM [Weapons] AS [w] LEFT JOIN [Weapons] AS [w0] ON [w].[SynergyWithId] = [w0].[Id] ORDER BY CASE - WHEN (N'Marcus'' Lancer' = [w0].[Name]) AND [w0].[Name] IS NOT NULL THEN CAST(1 AS bit) + WHEN N'Marcus'' Lancer' = [w0].[Name] AND [w0].[Name] IS NOT NULL THEN CAST(1 AS bit) ELSE CAST(0 AS bit) END"); } @@ -5581,7 +5581,7 @@ public override async Task Include_with_client_method_and_member_access_still_ap AssertSql( @"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])"); +LEFT JOIN [Tags] AS [t] ON [g].[Nickname] = [t].[GearNickName] AND [g].[SquadId] = [t].[GearSquadId]"); } public override async Task Include_with_projection_of_unmapped_property_still_gets_applied(bool async) @@ -5702,10 +5702,10 @@ public override async Task Filter_with_complex_predicate_containing_subquery(boo 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].[FullName] <> N'Dom') AND EXISTS ( +WHERE [g].[FullName] <> N'Dom' AND EXISTS ( SELECT 1 FROM [Weapons] AS [w] - WHERE ([g].[FullName] = [w].[OwnerFullName]) AND ([w].[IsAutomatic] = CAST(1 AS bit)))"); + WHERE [g].[FullName] = [w].[OwnerFullName] AND [w].[IsAutomatic] = CAST(1 AS bit))"); } public override async Task Query_with_complex_let_containing_ordering_and_filter_projecting_firstOrDefault_element_of_let( @@ -5717,7 +5717,7 @@ public override async Task Query_with_complex_let_containing_ordering_and_filter @"SELECT [g].[Nickname], ( SELECT TOP(1) [w].[Name] FROM [Weapons] AS [w] - WHERE ([g].[FullName] = [w].[OwnerFullName]) AND ([w].[IsAutomatic] = CAST(1 AS bit)) + WHERE [g].[FullName] = [w].[OwnerFullName] AND [w].[IsAutomatic] = CAST(1 AS bit) ORDER BY [w].[AmmunitionType] DESC) AS [WeaponName] FROM [Gears] AS [g] WHERE [g].[Nickname] <> N'Dom'"); @@ -5741,9 +5741,9 @@ await base.Null_semantics_is_correctly_applied_for_function_comparisons_that_tak AssertSql( @"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]) +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) @@ -5781,9 +5781,9 @@ public override async Task OfTypeNav1(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] -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)"); +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)"); } public override async Task OfTypeNav2(bool async) @@ -5793,9 +5793,9 @@ public override async Task OfTypeNav2(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] -LEFT JOIN [Tags] AS [t] ON ([g].[Nickname] = [t].[GearNickName]) AND ([g].[SquadId] = [t].[GearSquadId]) +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) @@ -5805,10 +5805,10 @@ public override async Task OfTypeNav3(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] -LEFT JOIN [Tags] AS [t] ON ([g].[Nickname] = [t].[GearNickName]) AND ([g].[SquadId] = [t].[GearSquadId]) +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)"); +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)"); } public override void Nav_rewrite_Distinct_with_convert() @@ -5840,7 +5840,7 @@ LEFT JOIN ( FROM [LocustLeaders] AS [l] WHERE [l].[Discriminator] = N'LocustCommander' ) AS [t] ON [f].[CommanderName] = [t].[Name] -WHERE ([c].[Name] <> N'Foo') OR [c].[Name] IS NULL"); +WHERE [c].[Name] <> N'Foo' OR [c].[Name] IS NULL"); } public override async Task Nav_rewrite_with_convert2(bool async) @@ -5856,7 +5856,7 @@ SELECT [l].[Name] FROM [LocustLeaders] AS [l] WHERE [l].[Discriminator] = N'LocustCommander' ) AS [t] ON [f].[CommanderName] = [t].[Name] -WHERE (([c].[Name] <> N'Foo') OR [c].[Name] IS NULL) AND (([t].[Name] <> N'Bar') OR [t].[Name] IS NULL)"); +WHERE ([c].[Name] <> N'Foo' OR [c].[Name] IS NULL) AND ([t].[Name] <> N'Bar' OR [t].[Name] IS NULL)"); } public override async Task Nav_rewrite_with_convert3(bool async) @@ -5872,7 +5872,7 @@ SELECT [l].[Name] FROM [LocustLeaders] AS [l] WHERE [l].[Discriminator] = N'LocustCommander' ) AS [t] ON [f].[CommanderName] = [t].[Name] -WHERE (([c].[Name] <> N'Foo') OR [c].[Name] IS NULL) AND (([t].[Name] <> N'Bar') OR [t].[Name] IS NULL)"); +WHERE ([c].[Name] <> N'Foo' OR [c].[Name] IS NULL) AND ([t].[Name] <> N'Bar' OR [t].[Name] IS NULL)"); } public override async Task Where_contains_on_navigation_with_composite_keys(bool async) @@ -5902,7 +5902,7 @@ FROM [Gears] AS [g] ORDER BY ( SELECT TOP(1) [w].[Name] FROM [Weapons] AS [w] - WHERE ([g].[FullName] = [w].[OwnerFullName]) AND ([w].[Name] LIKE N'%Gnasher%')), [g].[Nickname], [g].[SquadId]"); + WHERE [g].[FullName] = [w].[OwnerFullName] AND ([w].[Name] LIKE N'%Gnasher%')), [g].[Nickname], [g].[SquadId]"); } public override async Task Anonymous_projection_take_followed_by_projecting_single_element_from_collection_navigation(bool async) @@ -5936,7 +5936,7 @@ public override async Task DateTimeOffset_Contains_Less_than_Greater_than(bool a SELECT [m].[Id], [m].[BriefingDocument], [m].[BriefingDocumentFileExtension], [m].[CodeName], [m].[Duration], [m].[Rating], [m].[Timeline] FROM [Missions] AS [m] -WHERE ((@__start_0 <= CAST(CONVERT(date, [m].[Timeline]) AS datetimeoffset)) AND ([m].[Timeline] < @__end_1)) AND ([m].[Timeline] = '1902-01-02T10:00:00.1234567+01:30')"); +WHERE @__start_0 <= CAST(CONVERT(date, [m].[Timeline]) AS datetimeoffset) AND [m].[Timeline] < @__end_1 AND [m].[Timeline] = '1902-01-02T10:00:00.1234567+01:30'"); } public override async Task Navigation_inside_interpolated_string_expanded(bool async) @@ -5982,7 +5982,7 @@ public override async Task Project_collection_navigation_nested_with_take_compos AssertSql( @"SELECT [t].[Id], [g].[Nickname], [g].[SquadId], [t0].[Nickname], [t0].[SquadId], [t0].[AssignedCityName], [t0].[CityOfBirthName], [t0].[Discriminator], [t0].[FullName], [t0].[HasSoulPatch], [t0].[LeaderNickname], [t0].[LeaderSquadId], [t0].[Rank] FROM [Tags] AS [t] -LEFT JOIN [Gears] AS [g] ON ([t].[GearNickName] = [g].[Nickname]) AND ([t].[GearSquadId] = [g].[SquadId]) +LEFT JOIN [Gears] AS [g] ON [t].[GearNickName] = [g].[Nickname] AND [t].[GearSquadId] = [g].[SquadId] LEFT JOIN ( SELECT [t1].[Nickname], [t1].[SquadId], [t1].[AssignedCityName], [t1].[CityOfBirthName], [t1].[Discriminator], [t1].[FullName], [t1].[HasSoulPatch], [t1].[LeaderNickname], [t1].[LeaderSquadId], [t1].[Rank] FROM ( @@ -5990,7 +5990,7 @@ LEFT JOIN ( FROM [Gears] AS [g0] ) AS [t1] WHERE [t1].[row] <= 50 -) AS [t0] ON (([g].[Nickname] = [t0].[LeaderNickname]) OR ([g].[Nickname] IS NULL AND [t0].[LeaderNickname] IS NULL)) AND ([g].[SquadId] = [t0].[LeaderSquadId]) +) AS [t0] ON ([g].[Nickname] = [t0].[LeaderNickname] OR ([g].[Nickname] IS NULL AND [t0].[LeaderNickname] IS NULL)) AND [g].[SquadId] = [t0].[LeaderSquadId] WHERE [g].[Discriminator] = N'Officer' ORDER BY [t].[Id], [g].[Nickname], [g].[SquadId], [t0].[Nickname]"); } @@ -6002,8 +6002,8 @@ public override async Task Project_collection_navigation_nested_composite_key(bo AssertSql( @"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 [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] WHERE [g].[Discriminator] = N'Officer' ORDER BY [t].[Id], [g].[Nickname], [g].[SquadId], [g0].[Nickname]"); } @@ -6015,7 +6015,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]) +LEFT JOIN [Gears] AS [g] ON [t].[GearNickName] = [g].[Nickname] AND [t].[GearSquadId] = [g].[SquadId] ORDER BY [t].[Id], [g].[Nickname]"); } @@ -6190,7 +6190,7 @@ INNER JOIN ( FROM [Gears] AS [g0] LEFT JOIN [Cities] AS [c] ON [g0].[AssignedCityName] = [c].[Name] WHERE [g0].[Discriminator] = N'Officer' -) AS [t] ON ([g].[Nickname] = [t].[LeaderNickname]) AND ([g].[SquadId] = [t].[LeaderSquadId]) +) AS [t] ON [g].[Nickname] = [t].[LeaderNickname] AND [g].[SquadId] = [t].[LeaderSquadId] WHERE [g].[Discriminator] = N'Officer'"); } @@ -6200,7 +6200,7 @@ public override async Task Nullable_bool_comparison_is_translated_to_server(bool AssertSql( @"SELECT CASE - WHEN ([f].[Eradicated] = CAST(1 AS bit)) AND ([f].[Eradicated] IS NOT NULL) THEN CAST(1 AS bit) + WHEN [f].[Eradicated] = CAST(1 AS bit) AND ([f].[Eradicated] IS NOT NULL) THEN CAST(1 AS bit) ELSE CAST(0 AS bit) END AS [IsEradicated] FROM [Factions] AS [f]"); @@ -6228,7 +6228,7 @@ public override async Task Reference_include_chain_loads_correctly_when_middle_i AssertSql( @"SELECT [t].[Id], [t].[GearNickName], [t].[GearSquadId], [t].[IssueDate], [t].[Note], [g].[Nickname], [g].[SquadId], [g].[AssignedCityName], [g].[CityOfBirthName], [g].[Discriminator], [g].[FullName], [g].[HasSoulPatch], [g].[LeaderNickname], [g].[LeaderSquadId], [g].[Rank], [s].[Id], [s].[Banner], [s].[Banner5], [s].[InternalNumber], [s].[Name] FROM [Tags] AS [t] -LEFT JOIN [Gears] AS [g] ON ([t].[GearNickName] = [g].[Nickname]) AND ([t].[GearSquadId] = [g].[SquadId]) +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] ORDER BY [t].[Note]"); } @@ -6243,7 +6243,7 @@ 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] -LEFT JOIN [Gears] AS [g] ON ([t].[GearNickName] = [g].[Nickname]) AND ([t].[GearSquadId] = [g].[SquadId]) +LEFT JOIN [Gears] AS [g] ON [t].[GearNickName] = [g].[Nickname] AND [t].[GearSquadId] = [g].[SquadId] LEFT JOIN ( SELECT [g0].[Nickname], [w].[Id], [g0].[SquadId], [w].[OwnerFullName] FROM [Weapons] AS [w] @@ -6262,7 +6262,7 @@ FROM [Cities] AS [c] WHERE EXISTS ( SELECT 1 FROM [Gears] AS [g] - WHERE (([c].[Name] = [g].[CityOfBirthName]) AND ([g].[Discriminator] = N'Officer')) AND ([g].[Nickname] = N'Marcus'))"); + WHERE [c].[Name] = [g].[CityOfBirthName] AND [g].[Discriminator] = N'Officer' AND [g].[Nickname] = N'Marcus')"); } public override async Task Query_reusing_parameter_doesnt_declare_duplicate_parameter(bool async) @@ -6276,7 +6276,7 @@ public override async Task Query_reusing_parameter_doesnt_declare_duplicate_para FROM ( SELECT DISTINCT [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].[Nickname] <> @__prm_Inner_Nickname_0) AND ([g].[Nickname] <> @__prm_Inner_Nickname_0) + WHERE [g].[Nickname] <> @__prm_Inner_Nickname_0 AND [g].[Nickname] <> @__prm_Inner_Nickname_0 ) AS [t] ORDER BY [t].[FullName]"); } @@ -6296,7 +6296,7 @@ FROM [Gears] AS [g] WHERE EXISTS ( SELECT 1 FROM [Squads] AS [s0] - WHERE ([s0].[Id] = @__squadId_0) AND ([s0].[Id] = [s].[Id])) + WHERE [s0].[Id] = @__squadId_0 AND [s0].[Id] = [s].[Id]) UNION ALL SELECT [g0].[Nickname], [g0].[SquadId], [g0].[AssignedCityName], [g0].[CityOfBirthName], [g0].[Discriminator], [g0].[FullName], [g0].[HasSoulPatch], [g0].[LeaderNickname], [g0].[LeaderSquadId], [g0].[Rank] FROM [Gears] AS [g0] @@ -6304,7 +6304,7 @@ FROM [Gears] AS [g0] WHERE EXISTS ( SELECT 1 FROM [Squads] AS [s2] - WHERE ([s2].[Id] = @__squadId_0) AND ([s2].[Id] = [s1].[Id])) + WHERE [s2].[Id] = @__squadId_0 AND [s2].[Id] = [s1].[Id]) ) AS [t] ORDER BY [t].[FullName]"); } @@ -6321,7 +6321,7 @@ FROM [Squads] AS [s] WHERE EXISTS ( SELECT 1 FROM [Gears] AS [g] - WHERE (([s].[Id] = [g].[SquadId]) AND ([g].[SquadId] = @__gearId_0)) AND ([g].[SquadId] = @__gearId_0))"); + WHERE [s].[Id] = [g].[SquadId] AND [g].[SquadId] = @__gearId_0 AND [g].[SquadId] = @__gearId_0)"); } public override async Task Query_reusing_parameter_doesnt_declare_duplicate_parameter_complex(bool async) @@ -6426,7 +6426,7 @@ public override async Task GroupBy_with_boolean_groupin_key_thru_navigation_acce AssertSql( @"SELECT [g].[HasSoulPatch], LOWER([s].[Name]) AS [Name] FROM [Tags] AS [t] -LEFT JOIN [Gears] AS [g] ON ([t].[GearNickName] = [g].[Nickname]) AND ([t].[GearSquadId] = [g].[SquadId]) +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] GROUP BY [g].[HasSoulPatch], [s].[Name]"); } @@ -6546,11 +6546,11 @@ public override async Task FirstOrDefault_navigation_access_entity_equality_in_w @"SELECT [f].[Id], [f].[CapitalName], [f].[Discriminator], [f].[Name], [f].[ServerAddress], [f].[CommanderName], [f].[Eradicated] FROM [Factions] AS [f] LEFT JOIN [Cities] AS [c] ON [f].[CapitalName] = [c].[Name] -WHERE ([c].[Name] = ( +WHERE [c].[Name] = ( 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] @@ -6609,7 +6609,7 @@ FROM [Weapons] AS [w] SELECT [w].[Id], [w].[AmmunitionType], [w].[IsAutomatic], [w].[Name], [w].[OwnerFullName], [w].[SynergyWithId] FROM [Weapons] AS [w] -WHERE (([w].[AmmunitionType] & @__prm_0) <> 0) OR [w].[AmmunitionType] IS NULL", +WHERE ([w].[AmmunitionType] & @__prm_0) <> 0 OR [w].[AmmunitionType] IS NULL", // @"@__prm_0='1' (Nullable = true) @@ -6657,10 +6657,10 @@ ELSE NULL END AS [IsEradicated], [f].[CommanderName], [f].[Name] FROM [LocustLeaders] AS [l] INNER JOIN [Factions] AS [f] ON [l].[Name] = [f].[CommanderName] -WHERE (CASE +WHERE CASE WHEN [f].[Name] = N'Locust' THEN CAST(1 AS bit) ELSE NULL -END <> CAST(1 AS bit)) OR (CASE +END <> CAST(1 AS bit) OR (CASE WHEN [f].[Name] = N'Locust' THEN CAST(1 AS bit) ELSE NULL END IS NULL)"); @@ -6759,10 +6759,10 @@ public override async Task Conditional_expression_with_test_being_simplified_to_ FROM [Gears] AS [g] WHERE CASE WHEN [g].[HasSoulPatch] = @__prm_0 THEN CASE - WHEN (( + 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) @@ -6982,7 +6982,7 @@ FROM [LocustLeaders] AS [l] WHERE EXISTS ( SELECT 1 FROM [LocustLeaders] AS [l0] - WHERE ([l0].[ThreatLevelNullableByte] = [l].[ThreatLevelNullableByte]) OR ([l0].[ThreatLevelNullableByte] IS NULL AND [l].[ThreatLevelNullableByte] IS NULL))"); + WHERE [l0].[ThreatLevelNullableByte] = [l].[ThreatLevelNullableByte] OR ([l0].[ThreatLevelNullableByte] IS NULL AND [l].[ThreatLevelNullableByte] IS NULL))"); } public override async Task Contains_on_collection_of_nullable_byte_subquery_null_constant(bool async) @@ -7071,7 +7071,7 @@ FROM [Gears] AS [g] WHERE EXISTS ( SELECT 1 FROM [LocustLeaders] AS [l0] - WHERE ([l0].[ThreatLevelNullableByte] = [l].[ThreatLevelNullableByte]) OR ([l0].[ThreatLevelNullableByte] IS NULL AND [l].[ThreatLevelNullableByte] IS NULL)) + WHERE [l0].[ThreatLevelNullableByte] = [l].[ThreatLevelNullableByte] OR ([l0].[ThreatLevelNullableByte] IS NULL AND [l].[ThreatLevelNullableByte] IS NULL)) ) AS [t]"); } @@ -7088,7 +7088,7 @@ FROM [Gears] AS [g] WHERE NOT (EXISTS ( SELECT 1 FROM [LocustLeaders] AS [l0] - WHERE ([l0].[ThreatLevelNullableByte] = [l].[ThreatLevelNullableByte]) OR ([l0].[ThreatLevelNullableByte] IS NULL AND [l].[ThreatLevelNullableByte] IS NULL))) + WHERE [l0].[ThreatLevelNullableByte] = [l].[ThreatLevelNullableByte] OR ([l0].[ThreatLevelNullableByte] IS NULL AND [l].[ThreatLevelNullableByte] IS NULL))) ) AS [t]"); } @@ -7148,7 +7148,7 @@ public override async Task Enum_array_contains(bool async) @"SELECT [w].[Id], [w].[AmmunitionType], [w].[IsAutomatic], [w].[Name], [w].[OwnerFullName], [w].[SynergyWithId] FROM [Weapons] AS [w] LEFT JOIN [Weapons] AS [w0] ON [w].[SynergyWithId] = [w0].[Id] -WHERE [w0].[Id] IS NOT NULL AND (([w0].[AmmunitionType] = 1) OR [w0].[AmmunitionType] IS NULL)"); +WHERE [w0].[Id] IS NOT NULL AND ([w0].[AmmunitionType] = 1 OR [w0].[AmmunitionType] IS NULL)"); } [ConditionalTheory] @@ -7204,7 +7204,7 @@ public override async Task SelectMany_predicate_with_non_equality_comparison_con AssertSql( @"SELECT [g].[Nickname], [g].[SquadId], [g].[AssignedCityName], [g].[CityOfBirthName], [g].[Discriminator], [g].[FullName], [g].[HasSoulPatch], [g].[LeaderNickname], [g].[LeaderSquadId], [g].[Rank], [w].[Id], [w].[AmmunitionType], [w].[IsAutomatic], [w].[Name], [w].[OwnerFullName], [w].[SynergyWithId] FROM [Gears] AS [g] -INNER JOIN [Weapons] AS [w] ON ([g].[FullName] <> [w].[OwnerFullName]) OR [w].[OwnerFullName] IS NULL +INNER JOIN [Weapons] AS [w] ON [g].[FullName] <> [w].[OwnerFullName] OR [w].[OwnerFullName] IS NULL ORDER BY [g].[Nickname], [w].[Id]"); } @@ -7215,7 +7215,7 @@ public override async Task SelectMany_predicate_with_non_equality_comparison_Def AssertSql( @"SELECT [g].[Nickname], [g].[SquadId], [g].[AssignedCityName], [g].[CityOfBirthName], [g].[Discriminator], [g].[FullName], [g].[HasSoulPatch], [g].[LeaderNickname], [g].[LeaderSquadId], [g].[Rank], [w].[Id], [w].[AmmunitionType], [w].[IsAutomatic], [w].[Name], [w].[OwnerFullName], [w].[SynergyWithId] FROM [Gears] AS [g] -LEFT JOIN [Weapons] AS [w] ON ([g].[FullName] <> [w].[OwnerFullName]) OR [w].[OwnerFullName] IS NULL +LEFT JOIN [Weapons] AS [w] ON [g].[FullName] <> [w].[OwnerFullName] OR [w].[OwnerFullName] IS NULL ORDER BY [g].[Nickname], [w].[Id]"); } @@ -7231,7 +7231,7 @@ LEFT JOIN ( SELECT [w0].[Id], [w0].[AmmunitionType], [w0].[IsAutomatic], [w0].[Name], [w0].[OwnerFullName], [w0].[SynergyWithId] FROM [Weapons] AS [w] LEFT JOIN [Weapons] AS [w0] ON [w].[SynergyWithId] = [w0].[Id] -) AS [t] ON ([g].[FullName] <> [t].[OwnerFullName]) OR [t].[OwnerFullName] IS NULL +) AS [t] ON [g].[FullName] <> [t].[OwnerFullName] OR [t].[OwnerFullName] IS NULL ORDER BY [g].[Nickname], [t].[Id]"); } @@ -7242,7 +7242,7 @@ public override async Task SelectMany_without_result_selector_and_non_equality_c AssertSql( @"SELECT [w].[Id], [w].[AmmunitionType], [w].[IsAutomatic], [w].[Name], [w].[OwnerFullName], [w].[SynergyWithId] FROM [Gears] AS [g] -LEFT JOIN [Weapons] AS [w] ON ([g].[FullName] <> [w].[OwnerFullName]) OR [w].[OwnerFullName] IS NULL"); +LEFT JOIN [Weapons] AS [w] ON [g].[FullName] <> [w].[OwnerFullName] OR [w].[OwnerFullName] IS NULL"); } public override async Task Filtered_collection_projection_with_order_comparison_predicate_converted_to_join(bool async) @@ -7252,7 +7252,7 @@ public override async Task Filtered_collection_projection_with_order_comparison_ AssertSql( @"SELECT [g].[Nickname], [g].[SquadId], [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]) AND ([g].[SquadId] < [w].[Id]) +LEFT JOIN [Weapons] AS [w] ON [g].[FullName] = [w].[OwnerFullName] AND [g].[SquadId] < [w].[Id] ORDER BY [g].[Nickname], [g].[SquadId]"); } @@ -7263,7 +7263,7 @@ public override async Task Filtered_collection_projection_with_order_comparison_ AssertSql( @"SELECT [g].[Nickname], [g].[SquadId], [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]) AND ([g].[SquadId] <= [w].[Id]) +LEFT JOIN [Weapons] AS [w] ON [g].[FullName] = [w].[OwnerFullName] AND [g].[SquadId] <= [w].[Id] ORDER BY [g].[Nickname], [g].[SquadId]"); } @@ -7274,7 +7274,7 @@ public override async Task Filtered_collection_projection_with_order_comparison_ AssertSql( @"SELECT [g].[Nickname], [g].[SquadId], [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]) AND ([g].[SquadId] >= [w].[Id]) +LEFT JOIN [Weapons] AS [w] ON [g].[FullName] = [w].[OwnerFullName] AND [g].[SquadId] >= [w].[Id] ORDER BY [g].[Nickname], [g].[SquadId]"); } @@ -7288,7 +7288,7 @@ FROM [Gears] AS [g] CROSS APPLY ( SELECT TOP(3) [w].[Id], [w].[AmmunitionType], [w].[IsAutomatic], [w].[Name], [w].[OwnerFullName], [w].[SynergyWithId] FROM [Weapons] AS [w] - WHERE ([w].[OwnerFullName] <> [g].[FullName]) OR [w].[OwnerFullName] IS NULL + WHERE [w].[OwnerFullName] <> [g].[FullName] OR [w].[OwnerFullName] IS NULL ORDER BY [w].[Id] ) AS [t] ORDER BY [g].[Nickname], [t].[Id]"); @@ -7301,10 +7301,10 @@ public override async Task FirstOrDefault_over_int_compared_to_zero(bool async) AssertSql( @"SELECT [s].[Name] FROM [Squads] AS [s] -WHERE ([s].[Name] = N'Kilo') AND (COALESCE(( +WHERE [s].[Name] = N'Kilo' AND COALESCE(( SELECT TOP(1) [g].[SquadId] FROM [Gears] AS [g] - WHERE ([s].[Id] = [g].[SquadId]) AND ([g].[HasSoulPatch] = CAST(1 AS bit))), 0) <> 0)"); + WHERE [s].[Id] = [g].[SquadId] AND [g].[HasSoulPatch] = CAST(1 AS bit)), 0) <> 0"); } public override async Task Correlated_collection_with_inner_collection_references_element_two_levels_up(bool async) @@ -7317,7 +7317,7 @@ FROM [Gears] AS [g] OUTER APPLY ( SELECT [g0].[FullName] AS [ReportName], [g].[FullName] AS [OfficerName], [g0].[Nickname], [g0].[SquadId] FROM [Gears] AS [g0] - WHERE ([g].[Nickname] = [g0].[LeaderNickname]) AND ([g].[SquadId] = [g0].[LeaderSquadId]) + WHERE [g].[Nickname] = [g0].[LeaderNickname] AND [g].[SquadId] = [g0].[LeaderSquadId] ) AS [t] WHERE [g].[Discriminator] = N'Officer' ORDER BY [g].[Nickname], [g].[SquadId], [t].[Nickname]"); @@ -7330,11 +7330,11 @@ public override async Task Accessing_derived_property_using_hard_and_soft_cast(b AssertSql( @"SELECT [l].[Name], [l].[Discriminator], [l].[LocustHordeId], [l].[ThreatLevel], [l].[ThreatLevelByte], [l].[ThreatLevelNullableByte], [l].[DefeatedByNickname], [l].[DefeatedBySquadId], [l].[HighCommandId] FROM [LocustLeaders] AS [l] -WHERE ([l].[Discriminator] = N'LocustCommander') AND (([l].[HighCommandId] <> 0) OR [l].[HighCommandId] IS NULL)", +WHERE [l].[Discriminator] = N'LocustCommander' AND ([l].[HighCommandId] <> 0 OR [l].[HighCommandId] IS NULL)", // @"SELECT [l].[Name], [l].[Discriminator], [l].[LocustHordeId], [l].[ThreatLevel], [l].[ThreatLevelByte], [l].[ThreatLevelNullableByte], [l].[DefeatedByNickname], [l].[DefeatedBySquadId], [l].[HighCommandId] FROM [LocustLeaders] AS [l] -WHERE ([l].[Discriminator] = N'LocustCommander') AND (([l].[HighCommandId] <> 0) OR [l].[HighCommandId] IS NULL)"); +WHERE [l].[Discriminator] = N'LocustCommander' AND ([l].[HighCommandId] <> 0 OR [l].[HighCommandId] IS NULL)"); } public override async Task Cast_to_derived_followed_by_include_and_FirstOrDefault(bool async) @@ -7344,7 +7344,7 @@ public override async Task Cast_to_derived_followed_by_include_and_FirstOrDefaul AssertSql( @"SELECT TOP(1) [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] FROM [LocustLeaders] AS [l] -LEFT JOIN [Gears] AS [g] ON ([l].[DefeatedByNickname] = [g].[Nickname]) AND ([l].[DefeatedBySquadId] = [g].[SquadId]) +LEFT JOIN [Gears] AS [g] ON [l].[DefeatedByNickname] = [g].[Nickname] AND [l].[DefeatedBySquadId] = [g].[SquadId] WHERE [l].[Name] LIKE N'%Queen%'"); } @@ -7378,7 +7378,7 @@ FROM [Tags] AS [t1] WHERE [t1].[GearNickName] = [g].[FullName] ORDER BY [t1].[Id]), '0001-01-01T00:00:00.0000000') AS [invalidTagIssueDate] FROM [Gears] AS [g] -LEFT JOIN [Tags] AS [t] ON ([g].[Nickname] = [t].[GearNickName]) AND ([g].[SquadId] = [t].[GearSquadId]) +LEFT JOIN [Tags] AS [t] ON [g].[Nickname] = [t].[GearNickName] AND [g].[SquadId] = [t].[GearSquadId] WHERE [t].[IssueDate] > COALESCE(( SELECT TOP(1) [t0].[IssueDate] FROM [Tags] AS [t0] @@ -7449,7 +7449,7 @@ public override async Task Composite_key_entity_equal(bool async) @"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], [g0].[AssignedCityName], [g0].[CityOfBirthName], [g0].[Discriminator], [g0].[FullName], [g0].[HasSoulPatch], [g0].[LeaderNickname], [g0].[LeaderSquadId], [g0].[Rank] FROM [Gears] AS [g] CROSS JOIN [Gears] AS [g0] -WHERE ([g].[Nickname] = [g0].[Nickname]) AND ([g].[SquadId] = [g0].[SquadId])"); +WHERE [g].[Nickname] = [g0].[Nickname] AND [g].[SquadId] = [g0].[SquadId]"); } public override async Task Composite_key_entity_not_equal(bool async) @@ -7460,7 +7460,7 @@ public override async Task Composite_key_entity_not_equal(bool async) @"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], [g0].[AssignedCityName], [g0].[CityOfBirthName], [g0].[Discriminator], [g0].[FullName], [g0].[HasSoulPatch], [g0].[LeaderNickname], [g0].[LeaderSquadId], [g0].[Rank] FROM [Gears] AS [g] CROSS JOIN [Gears] AS [g0] -WHERE ([g].[Nickname] <> [g0].[Nickname]) OR ([g].[SquadId] <> [g0].[SquadId])"); +WHERE [g].[Nickname] <> [g0].[Nickname] OR [g].[SquadId] <> [g0].[SquadId]"); } public override async Task Composite_key_entity_equal_null(bool async) @@ -7470,8 +7470,8 @@ public override async Task Composite_key_entity_equal_null(bool async) AssertSql( @"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)"); +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)"); } public override async Task Composite_key_entity_not_equal_null(bool async) @@ -7481,8 +7481,8 @@ public override async Task Composite_key_entity_not_equal_null(bool async) AssertSql( @"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)"); +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"); } [ConditionalFact] @@ -7555,7 +7555,7 @@ WHEN [t].[GearNickName] IS NOT NULL THEN CAST(1 AS bit) ELSE CAST(0 AS bit) END, [g].[Nickname], [g].[SquadId], [g].[HasSoulPatch] FROM [Tags] AS [t] -LEFT JOIN [Gears] AS [g] ON ([t].[GearNickName] = [g].[Nickname]) AND ([t].[GearSquadId] = [g].[SquadId]) +LEFT JOIN [Gears] AS [g] ON [t].[GearNickName] = [g].[Nickname] AND [t].[GearSquadId] = [g].[SquadId] WHERE CASE WHEN [t].[GearNickName] IS NOT NULL THEN [g].[SquadId] ELSE NULL @@ -7572,7 +7572,7 @@ WHEN [t].[GearNickName] IS NOT NULL THEN CAST(1 AS bit) ELSE CAST(0 AS bit) END, [g].[Nickname], [g].[SquadId], [g].[HasSoulPatch] FROM [Tags] AS [t] -LEFT JOIN [Gears] AS [g] ON ([t].[GearNickName] = [g].[Nickname]) AND ([t].[GearSquadId] = [g].[SquadId]) +LEFT JOIN [Gears] AS [g] ON [t].[GearNickName] = [g].[Nickname] AND [t].[GearSquadId] = [g].[SquadId] WHERE (CASE WHEN [t].[GearNickName] IS NOT NULL THEN [g].[SquadId] ELSE NULL @@ -7589,7 +7589,7 @@ WHEN [t].[GearNickName] IS NOT NULL THEN [g].[SquadId] ELSE NULL END + 1 AS [Value] FROM [Tags] AS [t] -LEFT JOIN [Gears] AS [g] ON ([t].[GearNickName] = [g].[Nickname]) AND ([t].[GearSquadId] = [g].[SquadId]) +LEFT JOIN [Gears] AS [g] ON [t].[GearNickName] = [g].[Nickname] AND [t].[GearSquadId] = [g].[SquadId] WHERE CASE WHEN [t].[GearNickName] IS NOT NULL THEN [g].[Nickname] ELSE NULL @@ -7602,14 +7602,14 @@ 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 ELSE -1 END FROM [Tags] AS [t] -LEFT JOIN [Gears] AS [g] ON ([t].[GearNickName] = [g].[Nickname]) AND ([t].[GearSquadId] = [g].[SquadId])"); +LEFT JOIN [Gears] AS [g] ON [t].[GearNickName] = [g].[Nickname] AND [t].[GearSquadId] = [g].[SquadId]"); } public override async Task Projecting_property_converted_to_nullable_with_function_call(bool async) @@ -7622,7 +7622,7 @@ WHEN [t].[GearNickName] IS NOT NULL THEN [g].[Nickname] ELSE NULL END, 0 + 1, 3) FROM [Tags] AS [t] -LEFT JOIN [Gears] AS [g] ON ([t].[GearNickName] = [g].[Nickname]) AND ([t].[GearSquadId] = [g].[SquadId])"); +LEFT JOIN [Gears] AS [g] ON [t].[GearNickName] = [g].[Nickname] AND [t].[GearSquadId] = [g].[SquadId]"); } public override async Task Projecting_property_converted_to_nullable_with_function_call2(bool async) @@ -7635,7 +7635,7 @@ WHEN [t].[GearNickName] IS NOT NULL THEN [g].[SquadId] ELSE NULL END) AS [Function] FROM [Tags] AS [t] -LEFT JOIN [Gears] AS [g] ON ([t].[GearNickName] = [g].[Nickname]) AND ([t].[GearSquadId] = [g].[SquadId]) +LEFT JOIN [Gears] AS [g] ON [t].[GearNickName] = [g].[Nickname] AND [t].[GearSquadId] = [g].[SquadId] WHERE CASE WHEN [t].[GearNickName] IS NOT NULL THEN [g].[Nickname] ELSE NULL @@ -7658,7 +7658,7 @@ WHEN [t].[GearNickName] IS NOT NULL THEN [g].[SquadId] ELSE NULL END + 1 FROM [Tags] AS [t] -LEFT JOIN [Gears] AS [g] ON ([t].[GearNickName] = [g].[Nickname]) AND ([t].[GearSquadId] = [g].[SquadId]) +LEFT JOIN [Gears] AS [g] ON [t].[GearNickName] = [g].[Nickname] AND [t].[GearSquadId] = [g].[SquadId] WHERE CASE WHEN [t].[GearNickName] IS NOT NULL THEN [g].[Nickname] ELSE NULL @@ -7676,7 +7676,7 @@ WHEN [t].[GearNickName] IS NOT NULL THEN [g].[SquadId] ELSE NULL END AS [Id] FROM [Tags] AS [t] -LEFT JOIN [Gears] AS [g] ON ([t].[GearNickName] = [g].[Nickname]) AND ([t].[GearSquadId] = [g].[SquadId]) +LEFT JOIN [Gears] AS [g] ON [t].[GearNickName] = [g].[Nickname] AND [t].[GearSquadId] = [g].[SquadId] WHERE CASE WHEN [t].[GearNickName] IS NOT NULL THEN [g].[Nickname] ELSE NULL @@ -7700,7 +7700,7 @@ WHEN [t].[GearNickName] IS NOT NULL THEN [g].[SquadId] ELSE NULL END + 1 FROM [Tags] AS [t] -LEFT JOIN [Gears] AS [g] ON ([t].[GearNickName] = [g].[Nickname]) AND ([t].[GearSquadId] = [g].[SquadId]) +LEFT JOIN [Gears] AS [g] ON [t].[GearNickName] = [g].[Nickname] AND [t].[GearSquadId] = [g].[SquadId] WHERE CASE WHEN [t].[GearNickName] IS NOT NULL THEN [g].[Nickname] ELSE NULL @@ -7715,14 +7715,14 @@ public override async Task Projecting_property_converted_to_nullable_into_unary( AssertSql( @"SELECT [t].[Note] FROM [Tags] AS [t] -LEFT JOIN [Gears] AS [g] ON ([t].[GearNickName] = [g].[Nickname]) AND ([t].[GearSquadId] = [g].[SquadId]) +LEFT JOIN [Gears] AS [g] ON [t].[GearNickName] = [g].[Nickname] AND [t].[GearSquadId] = [g].[SquadId] 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)) +END = CAST(0 AS bit) ORDER BY [t].[Note]"); } @@ -7733,8 +7733,8 @@ public override async Task Projecting_property_converted_to_nullable_into_member AssertSql( @"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 +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 ORDER BY [g].[Nickname]"); } @@ -7748,7 +7748,7 @@ WHEN [t].[GearNickName] IS NOT NULL THEN CAST(1 AS bit) ELSE CAST(0 AS bit) END, [g].[Nickname], [g].[SquadId], [g].[HasSoulPatch] FROM [Tags] AS [t] -LEFT JOIN [Gears] AS [g] ON ([t].[GearNickName] = [g].[Nickname]) AND ([t].[GearSquadId] = [g].[SquadId]) +LEFT JOIN [Gears] AS [g] ON [t].[GearNickName] = [g].[Nickname] AND [t].[GearSquadId] = [g].[SquadId] WHERE CASE WHEN [t].[GearNickName] IS NOT NULL THEN [g].[Nickname] ELSE NULL @@ -8136,7 +8136,7 @@ WHEN [s].[Id] IS NULL THEN CAST(1 AS bit) ELSE CAST(0 AS bit) END AS [IsNull] FROM [Gears] AS [g] -LEFT JOIN [Tags] AS [t] ON ([g].[Nickname] = [t].[GearNickName]) AND ([g].[SquadId] = [t].[GearSquadId]) +LEFT JOIN [Tags] AS [t] ON [g].[Nickname] = [t].[GearNickName] AND [g].[SquadId] = [t].[GearSquadId] LEFT JOIN [Cities] AS [c] ON [g].[CityOfBirthName] = [c].[Name] LEFT JOIN [Squads] AS [s] ON [g].[SquadId] = [s].[Id]"); } @@ -8157,7 +8157,7 @@ WHEN [l0].[Id] IS NULL THEN CAST(1 AS bit) ELSE CAST(0 AS bit) END AS [IsNull] FROM [LocustLeaders] AS [l] -LEFT JOIN [Gears] AS [g] ON ([l].[DefeatedByNickname] = [g].[Nickname]) AND ([l].[DefeatedBySquadId] = [g].[SquadId]) +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] LEFT JOIN [LocustHighCommands] AS [l0] ON [l].[HighCommandId] = [l0].[Id]"); } @@ -8187,6 +8187,26 @@ OFFSET @__p_0 ROWS FETCH NEXT @__p_1 ROWS ONLY ORDER BY [t0].[Nickname], [t0].[SquadId], [t0].[HasSoulPatch0]"); } + public override async Task Where_bool_column_and_Contains(bool async) + { + await base.Where_bool_column_and_Contains(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].[HasSoulPatch] = CAST(1 AS bit) AND [g].[HasSoulPatch] IN (CAST(0 AS bit), CAST(1 AS bit))"); + } + + public override async Task Where_bool_column_or_Contains(bool async) + { + await base.Where_bool_column_or_Contains(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].[HasSoulPatch] = CAST(1 AS bit) AND [g].[HasSoulPatch] IN (CAST(0 AS bit), CAST(1 AS bit))"); + } + private void AssertSql(params string[] expected) => Fixture.TestSqlLoggerFactory.AssertBaseline(expected); } diff --git a/test/EFCore.SqlServer.FunctionalTests/Query/IncompleteMappingInheritanceQuerySqlServerTest.cs b/test/EFCore.SqlServer.FunctionalTests/Query/IncompleteMappingInheritanceQuerySqlServerTest.cs index 305bc613809..ed450c6d091 100644 --- a/test/EFCore.SqlServer.FunctionalTests/Query/IncompleteMappingInheritanceQuerySqlServerTest.cs +++ b/test/EFCore.SqlServer.FunctionalTests/Query/IncompleteMappingInheritanceQuerySqlServerTest.cs @@ -112,7 +112,7 @@ public override async Task Can_use_is_kiwi(bool async) AssertSql( @"SELECT [a].[Species], [a].[CountryId], [a].[Discriminator], [a].[Name], [a].[EagleId], [a].[IsFlightless], [a].[Group], [a].[FoundOn] FROM [Animals] AS [a] -WHERE [a].[Discriminator] IN (N'Eagle', N'Kiwi') AND ([a].[Discriminator] = N'Kiwi')"); +WHERE [a].[Discriminator] IN (N'Eagle', N'Kiwi') AND [a].[Discriminator] = N'Kiwi'"); } public override async Task Can_use_is_kiwi_with_cast(bool async) @@ -135,7 +135,7 @@ public override async Task Can_use_is_kiwi_with_other_predicate(bool async) AssertSql( @"SELECT [a].[Species], [a].[CountryId], [a].[Discriminator], [a].[Name], [a].[EagleId], [a].[IsFlightless], [a].[Group], [a].[FoundOn] FROM [Animals] AS [a] -WHERE [a].[Discriminator] IN (N'Eagle', N'Kiwi') AND (([a].[Discriminator] = N'Kiwi') AND ([a].[CountryId] = 1))"); +WHERE [a].[Discriminator] IN (N'Eagle', N'Kiwi') AND [a].[Discriminator] = N'Kiwi' AND [a].[CountryId] = 1"); } public override async Task Can_use_is_kiwi_in_projection(bool async) @@ -169,7 +169,7 @@ public override async Task Can_use_of_type_bird_predicate(bool async) AssertSql( @"SELECT [a].[Species], [a].[CountryId], [a].[Discriminator], [a].[Name], [a].[EagleId], [a].[IsFlightless], [a].[Group], [a].[FoundOn] FROM [Animals] AS [a] -WHERE ([a].[Discriminator] IN (N'Eagle', N'Kiwi') AND ([a].[CountryId] = 1)) AND [a].[Discriminator] IN (N'Eagle', N'Kiwi') +WHERE [a].[Discriminator] IN (N'Eagle', N'Kiwi') AND [a].[CountryId] = 1 AND [a].[Discriminator] IN (N'Eagle', N'Kiwi') ORDER BY [a].[Species]"); } @@ -201,7 +201,7 @@ public override async Task Can_use_of_type_kiwi(bool async) AssertSql( @"SELECT [a].[Species], [a].[CountryId], [a].[Discriminator], [a].[Name], [a].[EagleId], [a].[IsFlightless], [a].[FoundOn] FROM [Animals] AS [a] -WHERE [a].[Discriminator] IN (N'Eagle', N'Kiwi') AND ([a].[Discriminator] = N'Kiwi')"); +WHERE [a].[Discriminator] IN (N'Eagle', N'Kiwi') AND [a].[Discriminator] = N'Kiwi'"); } public override async Task Can_use_of_type_rose(bool async) @@ -211,7 +211,7 @@ public override async Task Can_use_of_type_rose(bool async) AssertSql( @"SELECT [p].[Species], [p].[CountryId], [p].[Genus], [p].[Name], [p].[HasThorns] FROM [Plants] AS [p] -WHERE [p].[Genus] IN (1, 0) AND ([p].[Genus] = 0)"); +WHERE [p].[Genus] IN (1, 0) AND [p].[Genus] = 0"); } public override async Task Can_query_all_animals(bool async) @@ -255,7 +255,7 @@ public override async Task Can_filter_all_animals(bool async) AssertSql( @"SELECT [a].[Species], [a].[CountryId], [a].[Discriminator], [a].[Name], [a].[EagleId], [a].[IsFlightless], [a].[Group], [a].[FoundOn] FROM [Animals] AS [a] -WHERE [a].[Discriminator] IN (N'Eagle', N'Kiwi') AND ([a].[Name] = N'Great spotted kiwi') +WHERE [a].[Discriminator] IN (N'Eagle', N'Kiwi') AND [a].[Name] = N'Great spotted kiwi' ORDER BY [a].[Species]"); } @@ -332,7 +332,7 @@ public override async Task Can_use_of_type_kiwi_where_north_on_derived_property( AssertSql( @"SELECT [a].[Species], [a].[CountryId], [a].[Discriminator], [a].[Name], [a].[EagleId], [a].[IsFlightless], [a].[FoundOn] FROM [Animals] AS [a] -WHERE ([a].[Discriminator] IN (N'Eagle', N'Kiwi') AND ([a].[Discriminator] = N'Kiwi')) AND ([a].[FoundOn] = CAST(0 AS tinyint))"); +WHERE [a].[Discriminator] IN (N'Eagle', N'Kiwi') AND [a].[Discriminator] = N'Kiwi' AND [a].[FoundOn] = CAST(0 AS tinyint)"); } public override async Task Can_use_of_type_kiwi_where_south_on_derived_property(bool async) @@ -342,7 +342,7 @@ public override async Task Can_use_of_type_kiwi_where_south_on_derived_property( AssertSql( @"SELECT [a].[Species], [a].[CountryId], [a].[Discriminator], [a].[Name], [a].[EagleId], [a].[IsFlightless], [a].[FoundOn] FROM [Animals] AS [a] -WHERE ([a].[Discriminator] IN (N'Eagle', N'Kiwi') AND ([a].[Discriminator] = N'Kiwi')) AND ([a].[FoundOn] = CAST(1 AS tinyint))"); +WHERE [a].[Discriminator] IN (N'Eagle', N'Kiwi') AND [a].[Discriminator] = N'Kiwi' AND [a].[FoundOn] = CAST(1 AS tinyint)"); } public override async Task Discriminator_used_when_projection_over_derived_type(bool async) @@ -372,7 +372,7 @@ public override async Task Discriminator_used_when_projection_over_of_type(bool AssertSql( @"SELECT [a].[FoundOn] FROM [Animals] AS [a] -WHERE [a].[Discriminator] IN (N'Eagle', N'Kiwi') AND ([a].[Discriminator] = N'Kiwi')"); +WHERE [a].[Discriminator] IN (N'Eagle', N'Kiwi') AND [a].[Discriminator] = N'Kiwi'"); } public override void Can_insert_update_delete() @@ -398,7 +398,7 @@ INSERT INTO [Animals] ([Species], [CountryId], [Discriminator], [EagleId], [Foun // @"SELECT TOP(2) [a].[Species], [a].[CountryId], [a].[Discriminator], [a].[Name], [a].[EagleId], [a].[IsFlightless], [a].[FoundOn] FROM [Animals] AS [a] -WHERE ([a].[Discriminator] = N'Kiwi') AND ([a].[Species] LIKE N'%owenii')", +WHERE [a].[Discriminator] = N'Kiwi' AND ([a].[Species] LIKE N'%owenii')", // @"@p1='Apteryx owenii' (Nullable = false) (Size = 100) @p0='Aquila chrysaetos canadensis' (Size = 100) @@ -410,7 +410,7 @@ FROM [Animals] AS [a] // @"SELECT TOP(2) [a].[Species], [a].[CountryId], [a].[Discriminator], [a].[Name], [a].[EagleId], [a].[IsFlightless], [a].[FoundOn] FROM [Animals] AS [a] -WHERE ([a].[Discriminator] = N'Kiwi') AND ([a].[Species] LIKE N'%owenii')", +WHERE [a].[Discriminator] = N'Kiwi' AND ([a].[Species] LIKE N'%owenii')", // @"@p0='Apteryx owenii' (Nullable = false) (Size = 100) @@ -421,7 +421,7 @@ DELETE FROM [Animals] // @"SELECT COUNT(*) FROM [Animals] AS [a] -WHERE ([a].[Discriminator] = N'Kiwi') AND ([a].[Species] LIKE N'%owenii')"); +WHERE [a].[Discriminator] = N'Kiwi' AND ([a].[Species] LIKE N'%owenii')"); } public override async Task Byte_enum_value_constant_used_in_projection(bool async) @@ -546,10 +546,10 @@ public override async Task Is_operator_on_result_of_FirstOrDefault(bool async) AssertSql( @"SELECT [a].[Species], [a].[CountryId], [a].[Discriminator], [a].[Name], [a].[EagleId], [a].[IsFlightless], [a].[Group], [a].[FoundOn] FROM [Animals] AS [a] -WHERE [a].[Discriminator] IN (N'Eagle', N'Kiwi') AND (( +WHERE [a].[Discriminator] IN (N'Eagle', N'Kiwi') AND ( SELECT TOP(1) [a0].[Discriminator] FROM [Animals] AS [a0] - WHERE [a0].[Discriminator] IN (N'Eagle', N'Kiwi') AND ([a0].[Name] = N'Great spotted kiwi')) = N'Kiwi') + WHERE [a0].[Discriminator] IN (N'Eagle', N'Kiwi') AND [a0].[Name] = N'Great spotted kiwi') = N'Kiwi' ORDER BY [a].[Species]"); } diff --git a/test/EFCore.SqlServer.FunctionalTests/Query/InheritanceQuerySqlServerTest.cs b/test/EFCore.SqlServer.FunctionalTests/Query/InheritanceQuerySqlServerTest.cs index 5d769fb46f0..d1a61390f48 100644 --- a/test/EFCore.SqlServer.FunctionalTests/Query/InheritanceQuerySqlServerTest.cs +++ b/test/EFCore.SqlServer.FunctionalTests/Query/InheritanceQuerySqlServerTest.cs @@ -125,7 +125,7 @@ public override async Task Can_use_is_kiwi_with_other_predicate(bool async) AssertSql( @"SELECT [a].[Species], [a].[CountryId], [a].[Discriminator], [a].[Name], [a].[EagleId], [a].[IsFlightless], [a].[Group], [a].[FoundOn] FROM [Animals] AS [a] -WHERE ([a].[Discriminator] = N'Kiwi') AND ([a].[CountryId] = 1)"); +WHERE [a].[Discriminator] = N'Kiwi' AND [a].[CountryId] = 1"); } public override async Task Can_use_is_kiwi_in_projection(bool async) @@ -307,7 +307,7 @@ public override async Task Can_use_of_type_kiwi_where_north_on_derived_property( AssertSql( @"SELECT [a].[Species], [a].[CountryId], [a].[Discriminator], [a].[Name], [a].[EagleId], [a].[IsFlightless], [a].[FoundOn] FROM [Animals] AS [a] -WHERE ([a].[Discriminator] = N'Kiwi') AND ([a].[FoundOn] = CAST(0 AS tinyint))"); +WHERE [a].[Discriminator] = N'Kiwi' AND [a].[FoundOn] = CAST(0 AS tinyint)"); } public override async Task Can_use_of_type_kiwi_where_south_on_derived_property(bool async) @@ -317,7 +317,7 @@ public override async Task Can_use_of_type_kiwi_where_south_on_derived_property( AssertSql( @"SELECT [a].[Species], [a].[CountryId], [a].[Discriminator], [a].[Name], [a].[EagleId], [a].[IsFlightless], [a].[FoundOn] FROM [Animals] AS [a] -WHERE ([a].[Discriminator] = N'Kiwi') AND ([a].[FoundOn] = CAST(1 AS tinyint))"); +WHERE [a].[Discriminator] = N'Kiwi' AND [a].[FoundOn] = CAST(1 AS tinyint)"); } public override async Task Discriminator_used_when_projection_over_derived_type(bool async) @@ -372,7 +372,7 @@ INSERT INTO [Animals] ([Species], [CountryId], [Discriminator], [EagleId], [Foun // @"SELECT TOP(2) [a].[Species], [a].[CountryId], [a].[Discriminator], [a].[Name], [a].[EagleId], [a].[IsFlightless], [a].[FoundOn] FROM [Animals] AS [a] -WHERE ([a].[Discriminator] = N'Kiwi') AND ([a].[Species] LIKE N'%owenii')", +WHERE [a].[Discriminator] = N'Kiwi' AND ([a].[Species] LIKE N'%owenii')", // @"@p1='Apteryx owenii' (Nullable = false) (Size = 100) @p0='Aquila chrysaetos canadensis' (Size = 100) @@ -384,7 +384,7 @@ FROM [Animals] AS [a] // @"SELECT TOP(2) [a].[Species], [a].[CountryId], [a].[Discriminator], [a].[Name], [a].[EagleId], [a].[IsFlightless], [a].[FoundOn] FROM [Animals] AS [a] -WHERE ([a].[Discriminator] = N'Kiwi') AND ([a].[Species] LIKE N'%owenii')", +WHERE [a].[Discriminator] = N'Kiwi' AND ([a].[Species] LIKE N'%owenii')", // @"@p0='Apteryx owenii' (Nullable = false) (Size = 100) @@ -395,7 +395,7 @@ DELETE FROM [Animals] // @"SELECT COUNT(*) FROM [Animals] AS [a] -WHERE ([a].[Discriminator] = N'Kiwi') AND ([a].[Species] LIKE N'%owenii')"); +WHERE [a].[Discriminator] = N'Kiwi' AND ([a].[Species] LIKE N'%owenii')"); } public override async Task Byte_enum_value_constant_used_in_projection(bool async) diff --git a/test/EFCore.SqlServer.FunctionalTests/Query/InheritanceRelationshipsQuerySqlServerTest.cs b/test/EFCore.SqlServer.FunctionalTests/Query/InheritanceRelationshipsQuerySqlServerTest.cs index 0b4f59e8685..f7e35a948f1 100644 --- a/test/EFCore.SqlServer.FunctionalTests/Query/InheritanceRelationshipsQuerySqlServerTest.cs +++ b/test/EFCore.SqlServer.FunctionalTests/Query/InheritanceRelationshipsQuerySqlServerTest.cs @@ -90,7 +90,7 @@ FROM [BaseEntities] AS [b] LEFT JOIN [BaseReferencesOnBase] AS [b0] ON [b].[Id] = [b0].[BaseParentId] LEFT JOIN [BaseEntities_OwnedCollectionOnBase] AS [b1] ON [b].[Id] = [b1].[BaseInheritanceRelationshipEntityId] LEFT JOIN [BaseEntities_OwnedCollectionOnDerived] AS [b2] ON [b].[Id] = [b2].[DerivedInheritanceRelationshipEntityId] -WHERE ([b].[Name] <> N'Bar') OR [b].[Name] IS NULL +WHERE [b].[Name] <> N'Bar' OR [b].[Name] IS NULL ORDER BY [b].[Id], [b0].[Id], [b1].[BaseInheritanceRelationshipEntityId], [b1].[Id], [b2].[DerivedInheritanceRelationshipEntityId]"); } @@ -104,7 +104,7 @@ FROM [BaseReferencesOnBase] AS [b] LEFT JOIN [BaseEntities] AS [b0] ON [b].[BaseParentId] = [b0].[Id] LEFT JOIN [BaseEntities_OwnedCollectionOnBase] AS [b1] ON [b0].[Id] = [b1].[BaseInheritanceRelationshipEntityId] LEFT JOIN [BaseEntities_OwnedCollectionOnDerived] AS [b2] ON [b0].[Id] = [b2].[DerivedInheritanceRelationshipEntityId] -WHERE ([b].[Name] <> N'Bar') OR [b].[Name] IS NULL +WHERE [b].[Name] <> N'Bar' OR [b].[Name] IS NULL ORDER BY [b].[Id], [b0].[Id], [b1].[BaseInheritanceRelationshipEntityId], [b1].[Id], [b2].[DerivedInheritanceRelationshipEntityId]"); } @@ -144,7 +144,7 @@ FROM [BaseEntities] AS [b] LEFT JOIN [ReferencesOnBase] AS [r] ON [b].[Id] = [r].[ParentId] LEFT JOIN [BaseEntities_OwnedCollectionOnBase] AS [b0] ON [b].[Id] = [b0].[BaseInheritanceRelationshipEntityId] LEFT JOIN [BaseEntities_OwnedCollectionOnDerived] AS [b1] ON [b].[Id] = [b1].[DerivedInheritanceRelationshipEntityId] -WHERE ([b].[Name] <> N'Bar') OR [b].[Name] IS NULL +WHERE [b].[Name] <> N'Bar' OR [b].[Name] IS NULL ORDER BY [b].[Id], [r].[Id], [b0].[BaseInheritanceRelationshipEntityId], [b0].[Id], [b1].[DerivedInheritanceRelationshipEntityId]"); } @@ -158,7 +158,7 @@ FROM [ReferencesOnBase] AS [r] LEFT JOIN [BaseEntities] AS [b] ON [r].[ParentId] = [b].[Id] LEFT JOIN [BaseEntities_OwnedCollectionOnBase] AS [b0] ON [b].[Id] = [b0].[BaseInheritanceRelationshipEntityId] LEFT JOIN [BaseEntities_OwnedCollectionOnDerived] AS [b1] ON [b].[Id] = [b1].[DerivedInheritanceRelationshipEntityId] -WHERE ([r].[Name] <> N'Bar') OR [r].[Name] IS NULL +WHERE [r].[Name] <> N'Bar' OR [r].[Name] IS NULL ORDER BY [r].[Id], [b].[Id], [b0].[BaseInheritanceRelationshipEntityId], [b0].[Id], [b1].[DerivedInheritanceRelationshipEntityId]"); } @@ -198,7 +198,7 @@ FROM [BaseEntities] AS [b] LEFT JOIN [BaseEntities_OwnedCollectionOnBase] AS [b0] ON [b].[Id] = [b0].[BaseInheritanceRelationshipEntityId] LEFT JOIN [BaseEntities_OwnedCollectionOnDerived] AS [b1] ON [b].[Id] = [b1].[DerivedInheritanceRelationshipEntityId] LEFT JOIN [BaseCollectionsOnBase] AS [b2] ON [b].[Id] = [b2].[BaseParentId] -WHERE ([b].[Name] <> N'Bar') OR [b].[Name] IS NULL +WHERE [b].[Name] <> N'Bar' OR [b].[Name] IS NULL ORDER BY [b].[Id], [b0].[BaseInheritanceRelationshipEntityId], [b0].[Id], [b1].[DerivedInheritanceRelationshipEntityId], [b1].[Id]"); } @@ -212,7 +212,7 @@ FROM [BaseCollectionsOnBase] AS [b] LEFT JOIN [BaseEntities] AS [b0] ON [b].[BaseParentId] = [b0].[Id] LEFT JOIN [BaseEntities_OwnedCollectionOnBase] AS [b1] ON [b0].[Id] = [b1].[BaseInheritanceRelationshipEntityId] LEFT JOIN [BaseEntities_OwnedCollectionOnDerived] AS [b2] ON [b0].[Id] = [b2].[DerivedInheritanceRelationshipEntityId] -WHERE ([b].[Name] <> N'Bar') OR [b].[Name] IS NULL +WHERE [b].[Name] <> N'Bar' OR [b].[Name] IS NULL ORDER BY [b].[Id], [b0].[Id], [b1].[BaseInheritanceRelationshipEntityId], [b1].[Id], [b2].[DerivedInheritanceRelationshipEntityId]"); } @@ -252,7 +252,7 @@ FROM [BaseEntities] AS [b] LEFT JOIN [BaseEntities_OwnedCollectionOnBase] AS [b0] ON [b].[Id] = [b0].[BaseInheritanceRelationshipEntityId] LEFT JOIN [BaseEntities_OwnedCollectionOnDerived] AS [b1] ON [b].[Id] = [b1].[DerivedInheritanceRelationshipEntityId] LEFT JOIN [CollectionsOnBase] AS [c] ON [b].[Id] = [c].[ParentId] -WHERE ([b].[Name] <> N'Bar') OR [b].[Name] IS NULL +WHERE [b].[Name] <> N'Bar' OR [b].[Name] IS NULL ORDER BY [b].[Id], [b0].[BaseInheritanceRelationshipEntityId], [b0].[Id], [b1].[DerivedInheritanceRelationshipEntityId], [b1].[Id]"); } @@ -266,7 +266,7 @@ FROM [CollectionsOnBase] AS [c] LEFT JOIN [BaseEntities] AS [b] ON [c].[ParentId] = [b].[Id] LEFT JOIN [BaseEntities_OwnedCollectionOnBase] AS [b0] ON [b].[Id] = [b0].[BaseInheritanceRelationshipEntityId] LEFT JOIN [BaseEntities_OwnedCollectionOnDerived] AS [b1] ON [b].[Id] = [b1].[DerivedInheritanceRelationshipEntityId] -WHERE ([c].[Name] <> N'Bar') OR [c].[Name] IS NULL +WHERE [c].[Name] <> N'Bar' OR [c].[Name] IS NULL ORDER BY [c].[Id], [b].[Id], [b0].[BaseInheritanceRelationshipEntityId], [b0].[Id], [b1].[DerivedInheritanceRelationshipEntityId]"); } @@ -343,7 +343,7 @@ FROM [BaseEntities] AS [b] LEFT JOIN [BaseReferencesOnBase] AS [b0] ON [b].[Id] = [b0].[BaseParentId] LEFT JOIN [BaseEntities_OwnedCollectionOnBase] AS [b1] ON [b].[Id] = [b1].[BaseInheritanceRelationshipEntityId] LEFT JOIN [BaseEntities_OwnedCollectionOnDerived] AS [b2] ON [b].[Id] = [b2].[DerivedInheritanceRelationshipEntityId] -WHERE ([b].[Discriminator] = N'DerivedInheritanceRelationshipEntity') AND (([b].[Name] <> N'Bar') OR [b].[Name] IS NULL) +WHERE [b].[Discriminator] = N'DerivedInheritanceRelationshipEntity' AND ([b].[Name] <> N'Bar' OR [b].[Name] IS NULL) ORDER BY [b].[Id], [b0].[Id], [b1].[BaseInheritanceRelationshipEntityId], [b1].[Id], [b2].[DerivedInheritanceRelationshipEntityId]"); } @@ -357,7 +357,7 @@ FROM [BaseEntities] AS [b] LEFT JOIN [BaseReferencesOnDerived] AS [b0] ON [b].[Id] = [b0].[BaseParentId] LEFT JOIN [BaseEntities_OwnedCollectionOnBase] AS [b1] ON [b].[Id] = [b1].[BaseInheritanceRelationshipEntityId] LEFT JOIN [BaseEntities_OwnedCollectionOnDerived] AS [b2] ON [b].[Id] = [b2].[DerivedInheritanceRelationshipEntityId] -WHERE ([b].[Discriminator] = N'DerivedInheritanceRelationshipEntity') AND (([b].[Name] <> N'Bar') OR [b].[Name] IS NULL) +WHERE [b].[Discriminator] = N'DerivedInheritanceRelationshipEntity' AND ([b].[Name] <> N'Bar' OR [b].[Name] IS NULL) ORDER BY [b].[Id], [b0].[Id], [b1].[BaseInheritanceRelationshipEntityId], [b1].[Id], [b2].[DerivedInheritanceRelationshipEntityId]"); } @@ -375,7 +375,7 @@ FROM [BaseReferencesOnDerived] AS [b0] ) AS [t] ON [b].[Id] = [t].[DerivedInheritanceRelationshipEntityId] LEFT JOIN [BaseEntities_OwnedCollectionOnBase] AS [b1] ON [b].[Id] = [b1].[BaseInheritanceRelationshipEntityId] LEFT JOIN [BaseEntities_OwnedCollectionOnDerived] AS [b2] ON [b].[Id] = [b2].[DerivedInheritanceRelationshipEntityId] -WHERE ([b].[Discriminator] = N'DerivedInheritanceRelationshipEntity') AND (([b].[Name] <> N'Bar') OR [b].[Name] IS NULL) +WHERE [b].[Discriminator] = N'DerivedInheritanceRelationshipEntity' AND ([b].[Name] <> N'Bar' OR [b].[Name] IS NULL) ORDER BY [b].[Id], [t].[Id], [b1].[BaseInheritanceRelationshipEntityId], [b1].[Id], [b2].[DerivedInheritanceRelationshipEntityId]"); } @@ -393,7 +393,7 @@ FROM [BaseEntities] AS [b0] ) AS [t] ON [b].[BaseParentId] = [t].[Id] LEFT JOIN [BaseEntities_OwnedCollectionOnBase] AS [b1] ON [t].[Id] = [b1].[BaseInheritanceRelationshipEntityId] LEFT JOIN [BaseEntities_OwnedCollectionOnDerived] AS [b2] ON [t].[Id] = [b2].[DerivedInheritanceRelationshipEntityId] -WHERE ([b].[Name] <> N'Bar') OR [b].[Name] IS NULL +WHERE [b].[Name] <> N'Bar' OR [b].[Name] IS NULL ORDER BY [b].[Id], [t].[Id], [b1].[BaseInheritanceRelationshipEntityId], [b1].[Id], [b2].[DerivedInheritanceRelationshipEntityId]"); } @@ -752,25 +752,25 @@ public override async Task Include_collection_with_inheritance_with_filter_split AssertSql( @"SELECT [b].[Id], [b].[Discriminator], [b].[Name], [b].[BaseId], [b].[OwnedReferenceOnBase_Id], [b].[OwnedReferenceOnBase_Name], [b].[OwnedReferenceOnDerived_Id], [b].[OwnedReferenceOnDerived_Name] FROM [BaseEntities] AS [b] -WHERE ([b].[Name] <> N'Bar') OR [b].[Name] IS NULL +WHERE [b].[Name] <> N'Bar' OR [b].[Name] IS NULL ORDER BY [b].[Id]", // @"SELECT [b0].[BaseInheritanceRelationshipEntityId], [b0].[Id], [b0].[Name], [b].[Id] FROM [BaseEntities] AS [b] INNER JOIN [BaseEntities_OwnedCollectionOnBase] AS [b0] ON [b].[Id] = [b0].[BaseInheritanceRelationshipEntityId] -WHERE ([b].[Name] <> N'Bar') OR [b].[Name] IS NULL +WHERE [b].[Name] <> N'Bar' OR [b].[Name] IS NULL ORDER BY [b].[Id]", // @"SELECT [b0].[DerivedInheritanceRelationshipEntityId], [b0].[Id], [b0].[Name], [b].[Id] FROM [BaseEntities] AS [b] INNER JOIN [BaseEntities_OwnedCollectionOnDerived] AS [b0] ON [b].[Id] = [b0].[DerivedInheritanceRelationshipEntityId] -WHERE ([b].[Name] <> N'Bar') OR [b].[Name] IS NULL +WHERE [b].[Name] <> N'Bar' OR [b].[Name] IS NULL ORDER BY [b].[Id]", // @"SELECT [b0].[Id], [b0].[BaseParentId], [b0].[Discriminator], [b0].[Name], [b0].[DerivedProperty], [b].[Id] FROM [BaseEntities] AS [b] INNER JOIN [BaseCollectionsOnBase] AS [b0] ON [b].[Id] = [b0].[BaseParentId] -WHERE ([b].[Name] <> N'Bar') OR [b].[Name] IS NULL +WHERE [b].[Name] <> N'Bar' OR [b].[Name] IS NULL ORDER BY [b].[Id]"); } @@ -782,21 +782,21 @@ public override async Task Include_collection_with_inheritance_with_filter_rever @"SELECT [b].[Id], [b].[BaseParentId], [b].[Discriminator], [b].[Name], [b].[DerivedProperty], [b0].[Id], [b0].[Discriminator], [b0].[Name], [b0].[BaseId], [b0].[OwnedReferenceOnBase_Id], [b0].[OwnedReferenceOnBase_Name], [b0].[OwnedReferenceOnDerived_Id], [b0].[OwnedReferenceOnDerived_Name] FROM [BaseCollectionsOnBase] AS [b] LEFT JOIN [BaseEntities] AS [b0] ON [b].[BaseParentId] = [b0].[Id] -WHERE ([b].[Name] <> N'Bar') OR [b].[Name] IS NULL +WHERE [b].[Name] <> N'Bar' OR [b].[Name] IS NULL ORDER BY [b].[Id], [b0].[Id]", // @"SELECT [b1].[BaseInheritanceRelationshipEntityId], [b1].[Id], [b1].[Name], [b].[Id], [b0].[Id] FROM [BaseCollectionsOnBase] AS [b] LEFT JOIN [BaseEntities] AS [b0] ON [b].[BaseParentId] = [b0].[Id] INNER JOIN [BaseEntities_OwnedCollectionOnBase] AS [b1] ON [b0].[Id] = [b1].[BaseInheritanceRelationshipEntityId] -WHERE ([b].[Name] <> N'Bar') OR [b].[Name] IS NULL +WHERE [b].[Name] <> N'Bar' OR [b].[Name] IS NULL ORDER BY [b].[Id], [b0].[Id]", // @"SELECT [b1].[DerivedInheritanceRelationshipEntityId], [b1].[Id], [b1].[Name], [b].[Id], [b0].[Id] FROM [BaseCollectionsOnBase] AS [b] LEFT JOIN [BaseEntities] AS [b0] ON [b].[BaseParentId] = [b0].[Id] INNER JOIN [BaseEntities_OwnedCollectionOnDerived] AS [b1] ON [b0].[Id] = [b1].[DerivedInheritanceRelationshipEntityId] -WHERE ([b].[Name] <> N'Bar') OR [b].[Name] IS NULL +WHERE [b].[Name] <> N'Bar' OR [b].[Name] IS NULL ORDER BY [b].[Id], [b0].[Id]"); } @@ -855,25 +855,25 @@ public override async Task Include_collection_without_inheritance_with_filter_sp AssertSql( @"SELECT [b].[Id], [b].[Discriminator], [b].[Name], [b].[BaseId], [b].[OwnedReferenceOnBase_Id], [b].[OwnedReferenceOnBase_Name], [b].[OwnedReferenceOnDerived_Id], [b].[OwnedReferenceOnDerived_Name] FROM [BaseEntities] AS [b] -WHERE ([b].[Name] <> N'Bar') OR [b].[Name] IS NULL +WHERE [b].[Name] <> N'Bar' OR [b].[Name] IS NULL ORDER BY [b].[Id]", // @"SELECT [b0].[BaseInheritanceRelationshipEntityId], [b0].[Id], [b0].[Name], [b].[Id] FROM [BaseEntities] AS [b] INNER JOIN [BaseEntities_OwnedCollectionOnBase] AS [b0] ON [b].[Id] = [b0].[BaseInheritanceRelationshipEntityId] -WHERE ([b].[Name] <> N'Bar') OR [b].[Name] IS NULL +WHERE [b].[Name] <> N'Bar' OR [b].[Name] IS NULL ORDER BY [b].[Id]", // @"SELECT [b0].[DerivedInheritanceRelationshipEntityId], [b0].[Id], [b0].[Name], [b].[Id] FROM [BaseEntities] AS [b] INNER JOIN [BaseEntities_OwnedCollectionOnDerived] AS [b0] ON [b].[Id] = [b0].[DerivedInheritanceRelationshipEntityId] -WHERE ([b].[Name] <> N'Bar') OR [b].[Name] IS NULL +WHERE [b].[Name] <> N'Bar' OR [b].[Name] IS NULL ORDER BY [b].[Id]", // @"SELECT [c].[Id], [c].[Name], [c].[ParentId], [b].[Id] FROM [BaseEntities] AS [b] INNER JOIN [CollectionsOnBase] AS [c] ON [b].[Id] = [c].[ParentId] -WHERE ([b].[Name] <> N'Bar') OR [b].[Name] IS NULL +WHERE [b].[Name] <> N'Bar' OR [b].[Name] IS NULL ORDER BY [b].[Id]"); } @@ -885,21 +885,21 @@ public override async Task Include_collection_without_inheritance_with_filter_re @"SELECT [c].[Id], [c].[Name], [c].[ParentId], [b].[Id], [b].[Discriminator], [b].[Name], [b].[BaseId], [b].[OwnedReferenceOnBase_Id], [b].[OwnedReferenceOnBase_Name], [b].[OwnedReferenceOnDerived_Id], [b].[OwnedReferenceOnDerived_Name] FROM [CollectionsOnBase] AS [c] LEFT JOIN [BaseEntities] AS [b] ON [c].[ParentId] = [b].[Id] -WHERE ([c].[Name] <> N'Bar') OR [c].[Name] IS NULL +WHERE [c].[Name] <> N'Bar' OR [c].[Name] IS NULL ORDER BY [c].[Id], [b].[Id]", // @"SELECT [b0].[BaseInheritanceRelationshipEntityId], [b0].[Id], [b0].[Name], [c].[Id], [b].[Id] FROM [CollectionsOnBase] AS [c] LEFT JOIN [BaseEntities] AS [b] ON [c].[ParentId] = [b].[Id] INNER JOIN [BaseEntities_OwnedCollectionOnBase] AS [b0] ON [b].[Id] = [b0].[BaseInheritanceRelationshipEntityId] -WHERE ([c].[Name] <> N'Bar') OR [c].[Name] IS NULL +WHERE [c].[Name] <> N'Bar' OR [c].[Name] IS NULL ORDER BY [c].[Id], [b].[Id]", // @"SELECT [b0].[DerivedInheritanceRelationshipEntityId], [b0].[Id], [b0].[Name], [c].[Id], [b].[Id] FROM [CollectionsOnBase] AS [c] LEFT JOIN [BaseEntities] AS [b] ON [c].[ParentId] = [b].[Id] INNER JOIN [BaseEntities_OwnedCollectionOnDerived] AS [b0] ON [b].[Id] = [b0].[DerivedInheritanceRelationshipEntityId] -WHERE ([c].[Name] <> N'Bar') OR [c].[Name] IS NULL +WHERE [c].[Name] <> N'Bar' OR [c].[Name] IS NULL ORDER BY [c].[Id], [b].[Id]"); } diff --git a/test/EFCore.SqlServer.FunctionalTests/Query/ManyToManyNoTrackingQuerySqlServerTest.cs b/test/EFCore.SqlServer.FunctionalTests/Query/ManyToManyNoTrackingQuerySqlServerTest.cs index d02a9b82f7d..875ab4b0f2a 100644 --- a/test/EFCore.SqlServer.FunctionalTests/Query/ManyToManyNoTrackingQuerySqlServerTest.cs +++ b/test/EFCore.SqlServer.FunctionalTests/Query/ManyToManyNoTrackingQuerySqlServerTest.cs @@ -30,7 +30,7 @@ WHERE NOT EXISTS ( SELECT 1 FROM [JoinOneToTwo] AS [j] INNER JOIN [EntityTwos] AS [e0] ON [j].[TwoId] = [e0].[Id] - WHERE ([e].[Id] = [j].[OneId]) AND NOT ([e0].[Name] LIKE N'%B%'))"); + WHERE [e].[Id] = [j].[OneId] AND NOT ([e0].[Name] LIKE N'%B%'))"); } public override async Task Skip_navigation_any_without_predicate(bool async) @@ -44,7 +44,7 @@ WHERE EXISTS ( SELECT 1 FROM [JoinOneToThreePayloadFull] AS [j] INNER JOIN [EntityThrees] AS [e0] ON [j].[ThreeId] = [e0].[Id] - WHERE ([e].[Id] = [j].[OneId]) AND ([e0].[Name] LIKE N'%B%'))"); + WHERE [e].[Id] = [j].[OneId] AND ([e0].[Name] LIKE N'%B%'))"); } public override async Task Skip_navigation_any_with_predicate(bool async) @@ -58,7 +58,7 @@ WHERE EXISTS ( SELECT 1 FROM [EntityOneEntityTwo] AS [e0] INNER JOIN [EntityTwos] AS [e1] ON [e0].[TwoSkipSharedId] = [e1].[Id] - WHERE ([e].[Id] = [e0].[OneSkipSharedId]) AND ([e1].[Name] LIKE N'%B%'))"); + WHERE [e].[Id] = [e0].[OneSkipSharedId] AND ([e1].[Name] LIKE N'%B%'))"); } public override async Task Skip_navigation_contains(bool async) @@ -72,7 +72,7 @@ WHERE EXISTS ( SELECT 1 FROM [JoinOneToThreePayloadFullShared] AS [j] INNER JOIN [EntityThrees] AS [e0] ON [j].[ThreeId] = [e0].[Id] - WHERE ([e].[Id] = [j].[OneId]) AND ([e0].[Id] = 1))"); + WHERE [e].[Id] = [j].[OneId] AND [e0].[Id] = 1)"); } public override async Task Skip_navigation_count_without_predicate(bool async) @@ -104,7 +104,7 @@ INNER JOIN ( FROM [EntityRoots] AS [e0] WHERE [e0].[Discriminator] IN (N'EntityBranch', N'EntityLeaf') ) AS [t] ON [j].[EntityBranchId] = [t].[Id] - WHERE ([e].[Id] = [j].[EntityOneId]) AND ([t].[Name] IS NOT NULL AND ([t].[Name] LIKE N'L%'))), [e].[Id]"); + WHERE [e].[Id] = [j].[EntityOneId] AND [t].[Name] IS NOT NULL AND ([t].[Name] LIKE N'L%')), [e].[Id]"); } public override async Task Skip_navigation_long_count_without_predicate(bool async) @@ -132,7 +132,7 @@ ORDER BY ( SELECT COUNT_BIG(*) FROM [EntityTwoEntityTwo] AS [e0] INNER JOIN [EntityTwos] AS [e1] ON [e0].[SelfSkipSharedLeftId] = [e1].[Id] - WHERE ([e].[Id] = [e0].[SelfSkipSharedRightId]) AND ([e1].[Name] IS NOT NULL AND ([e1].[Name] LIKE N'L%'))) DESC, [e].[Id]"); + WHERE [e].[Id] = [e0].[SelfSkipSharedRightId] AND [e1].[Name] IS NOT NULL AND ([e1].[Name] LIKE N'L%')) DESC, [e].[Id]"); } public override async Task Skip_navigation_select_many_average(bool async) @@ -145,7 +145,7 @@ FROM [EntityTwos] AS [e] INNER JOIN ( SELECT [e1].[Key1], [e0].[TwoSkipSharedId] FROM [EntityCompositeKeyEntityTwo] AS [e0] - INNER JOIN [EntityCompositeKeys] AS [e1] ON (([e0].[CompositeKeySkipSharedKey1] = [e1].[Key1]) AND ([e0].[CompositeKeySkipSharedKey2] = [e1].[Key2])) AND ([e0].[CompositeKeySkipSharedKey3] = [e1].[Key3]) + INNER JOIN [EntityCompositeKeys] AS [e1] ON [e0].[CompositeKeySkipSharedKey1] = [e1].[Key1] AND [e0].[CompositeKeySkipSharedKey2] = [e1].[Key2] AND [e0].[CompositeKeySkipSharedKey3] = [e1].[Key3] ) AS [t] ON [e].[Id] = [t].[TwoSkipSharedId]"); } @@ -159,7 +159,7 @@ FROM [EntityThrees] AS [e] INNER JOIN ( SELECT [e0].[Key1], [j].[ThreeId] FROM [JoinThreeToCompositeKeyFull] AS [j] - INNER JOIN [EntityCompositeKeys] AS [e0] ON (([j].[CompositeId1] = [e0].[Key1]) AND ([j].[CompositeId2] = [e0].[Key2])) AND ([j].[CompositeId3] = [e0].[Key3]) + INNER JOIN [EntityCompositeKeys] AS [e0] ON [j].[CompositeId1] = [e0].[Key1] AND [j].[CompositeId2] = [e0].[Key2] AND [j].[CompositeId3] = [e0].[Key3] ) AS [t] ON [e].[Id] = [t].[ThreeId]"); } @@ -187,7 +187,7 @@ FROM [EntityRoots] AS [e] INNER JOIN ( SELECT [e1].[Key1], [e0].[RootSkipSharedId] FROM [EntityCompositeKeyEntityRoot] AS [e0] - INNER JOIN [EntityCompositeKeys] AS [e1] ON (([e0].[CompositeKeySkipSharedKey1] = [e1].[Key1]) AND ([e0].[CompositeKeySkipSharedKey2] = [e1].[Key2])) AND ([e0].[CompositeKeySkipSharedKey3] = [e1].[Key3]) + INNER JOIN [EntityCompositeKeys] AS [e1] ON [e0].[CompositeKeySkipSharedKey1] = [e1].[Key1] AND [e0].[CompositeKeySkipSharedKey2] = [e1].[Key2] AND [e0].[CompositeKeySkipSharedKey3] = [e1].[Key3] ) AS [t] ON [e].[Id] = [t].[RootSkipSharedId]"); } @@ -199,7 +199,7 @@ public override async Task Skip_navigation_select_subquery_average(bool async) @"SELECT ( SELECT AVG(CAST([e0].[Key1] AS float)) FROM [JoinCompositeKeyToLeaf] AS [j] - INNER JOIN [EntityCompositeKeys] AS [e0] ON (([j].[CompositeId1] = [e0].[Key1]) AND ([j].[CompositeId2] = [e0].[Key2])) AND ([j].[CompositeId3] = [e0].[Key3]) + INNER JOIN [EntityCompositeKeys] AS [e0] ON [j].[CompositeId1] = [e0].[Key1] AND [j].[CompositeId2] = [e0].[Key2] AND [j].[CompositeId3] = [e0].[Key3] WHERE [e].[Id] = [j].[LeafId]) FROM [EntityRoots] AS [e] WHERE [e].[Discriminator] = N'EntityLeaf'"); @@ -334,7 +334,7 @@ INNER JOIN ( FROM [EntityRoots] AS [e0] WHERE [e0].[Discriminator] = N'EntityLeaf' ) AS [t] ON [j].[LeafId] = [t].[Id] -) AS [t0] ON (([e].[Key1] = [t0].[CompositeId1]) AND ([e].[Key2] = [t0].[CompositeId2])) AND ([e].[Key3] = [t0].[CompositeId3]) +) AS [t0] ON [e].[Key1] = [t0].[CompositeId1] AND [e].[Key2] = [t0].[CompositeId2] AND [e].[Key3] = [t0].[CompositeId3] ORDER BY [e].[Key1], [e].[Key2], [e].[Key3], [t0].[LeafId], [t0].[CompositeId1], [t0].[CompositeId2], [t0].[CompositeId3]"); } @@ -350,7 +350,7 @@ LEFT JOIN ( FROM [EntityCompositeKeyEntityRoot] AS [e0] INNER JOIN [EntityRoots] AS [e1] ON [e0].[RootSkipSharedId] = [e1].[Id] WHERE [e1].[Discriminator] = N'EntityLeaf' -) AS [t] ON (([e].[Key1] = [t].[CompositeKeySkipSharedKey1]) AND ([e].[Key2] = [t].[CompositeKeySkipSharedKey2])) AND ([e].[Key3] = [t].[CompositeKeySkipSharedKey3]) +) AS [t] ON [e].[Key1] = [t].[CompositeKeySkipSharedKey1] AND [e].[Key2] = [t].[CompositeKeySkipSharedKey2] AND [e].[Key3] = [t].[CompositeKeySkipSharedKey3] ORDER BY [e].[Key1], [e].[Key2], [e].[Key3], [t].[RootSkipSharedId], [t].[CompositeKeySkipSharedKey1], [t].[CompositeKeySkipSharedKey2], [t].[CompositeKeySkipSharedKey3]"); } @@ -380,12 +380,12 @@ LEFT JOIN [EntityCompositeKeys] AS [e0] ON ( SELECT TOP(1) [e2].[Id] FROM [EntityCompositeKeyEntityTwo] AS [e1] INNER JOIN [EntityTwos] AS [e2] ON [e1].[TwoSkipSharedId] = [e2].[Id] - WHERE (([e].[Key1] = [e1].[CompositeKeySkipSharedKey1]) AND ([e].[Key2] = [e1].[CompositeKeySkipSharedKey2])) AND ([e].[Key3] = [e1].[CompositeKeySkipSharedKey3]) + WHERE [e].[Key1] = [e1].[CompositeKeySkipSharedKey1] AND [e].[Key2] = [e1].[CompositeKeySkipSharedKey2] AND [e].[Key3] = [e1].[CompositeKeySkipSharedKey3] ORDER BY [e2].[Id]) = ( SELECT TOP(1) [e3].[Id] FROM [JoinThreeToCompositeKeyFull] AS [j] INNER JOIN [EntityThrees] AS [e3] ON [j].[ThreeId] = [e3].[Id] - WHERE (([e0].[Key1] = [j].[CompositeId1]) AND ([e0].[Key2] = [j].[CompositeId2])) AND ([e0].[Key3] = [j].[CompositeId3]) + WHERE [e0].[Key1] = [j].[CompositeId1] AND [e0].[Key2] = [j].[CompositeId2] AND [e0].[Key3] = [j].[CompositeId3] ORDER BY [e3].[Id]) ORDER BY [e].[Key1], [e0].[Key1], [e].[Key2], [e0].[Key2]"); } @@ -468,7 +468,7 @@ INNER JOIN ( FROM [JoinOneToThreePayloadFullShared] AS [j] INNER JOIN [EntityThrees] AS [e0] ON [j].[ThreeId] = [e0].[Id] ) AS [t] - WHERE (2 < [t].[row]) AND ([t].[row] <= 5) + WHERE 2 < [t].[row] AND [t].[row] <= 5 ) AS [t0] ON [e].[Id] = [t0].[OneId]"); } @@ -540,7 +540,7 @@ FROM [EntityTwoEntityTwo] AS [e1] LEFT JOIN ( SELECT [e4].[Key1], [e4].[Key2], [e4].[Key3], [e4].[Name], [e3].[TwoSkipSharedId], [e3].[CompositeKeySkipSharedKey1], [e3].[CompositeKeySkipSharedKey2], [e3].[CompositeKeySkipSharedKey3] FROM [EntityCompositeKeyEntityTwo] AS [e3] - INNER JOIN [EntityCompositeKeys] AS [e4] ON (([e3].[CompositeKeySkipSharedKey1] = [e4].[Key1]) AND ([e3].[CompositeKeySkipSharedKey2] = [e4].[Key2])) AND ([e3].[CompositeKeySkipSharedKey3] = [e4].[Key3]) + INNER JOIN [EntityCompositeKeys] AS [e4] ON [e3].[CompositeKeySkipSharedKey1] = [e4].[Key1] AND [e3].[CompositeKeySkipSharedKey2] = [e4].[Key2] AND [e3].[CompositeKeySkipSharedKey3] = [e4].[Key3] ) AS [t1] ON [e].[Id] = [t1].[TwoSkipSharedId] ORDER BY [e].[Id], [t].[ThreeId], [t].[TwoId], [t].[Id], [t0].[SelfSkipSharedLeftId], [t0].[SelfSkipSharedRightId], [t0].[Id], [t1].[TwoSkipSharedId], [t1].[CompositeKeySkipSharedKey1], [t1].[CompositeKeySkipSharedKey2], [t1].[CompositeKeySkipSharedKey3], [t1].[Key1], [t1].[Key2]"); } @@ -557,7 +557,7 @@ LEFT JOIN ( FROM ( SELECT [e0].[Key1], [e0].[Key2], [e0].[Key3], [e0].[Name], [j].[ThreeId], ROW_NUMBER() OVER(PARTITION BY [j].[ThreeId] ORDER BY [e0].[Key1], [e0].[Key2]) AS [row] FROM [JoinThreeToCompositeKeyFull] AS [j] - INNER JOIN [EntityCompositeKeys] AS [e0] ON (([j].[CompositeId1] = [e0].[Key1]) AND ([j].[CompositeId2] = [e0].[Key2])) AND ([j].[CompositeId3] = [e0].[Key3]) + INNER JOIN [EntityCompositeKeys] AS [e0] ON [j].[CompositeId1] = [e0].[Key1] AND [j].[CompositeId2] = [e0].[Key2] AND [j].[CompositeId3] = [e0].[Key3] ) AS [t] WHERE [t].[row] <= 1 ) AS [t0] ON [e].[Id] = [t0].[ThreeId] @@ -575,7 +575,7 @@ LEFT JOIN ( SELECT [e1].[Id], [e1].[Discriminator], [e1].[Name], [e1].[Number], [e1].[IsGreen], [e0].[RootSkipSharedId], [e0].[CompositeKeySkipSharedKey1], [e0].[CompositeKeySkipSharedKey2], [e0].[CompositeKeySkipSharedKey3] FROM [EntityCompositeKeyEntityRoot] AS [e0] INNER JOIN [EntityRoots] AS [e1] ON [e0].[RootSkipSharedId] = [e1].[Id] -) AS [t] ON (([e].[Key1] = [t].[CompositeKeySkipSharedKey1]) AND ([e].[Key2] = [t].[CompositeKeySkipSharedKey2])) AND ([e].[Key3] = [t].[CompositeKeySkipSharedKey3]) +) AS [t] ON [e].[Key1] = [t].[CompositeKeySkipSharedKey1] AND [e].[Key2] = [t].[CompositeKeySkipSharedKey2] AND [e].[Key3] = [t].[CompositeKeySkipSharedKey3] ORDER BY [e].[Key1], [e].[Key2], [e].[Key3], [t].[RootSkipSharedId], [t].[CompositeKeySkipSharedKey1], [t].[CompositeKeySkipSharedKey2], [t].[CompositeKeySkipSharedKey3]"); } @@ -615,7 +615,7 @@ LEFT JOIN ( FROM [JoinOneToBranch] AS [j0] INNER JOIN [EntityOnes] AS [e1] ON [j0].[EntityOneId] = [e1].[Id] ) AS [t0] ON [t].[Id] = [t0].[EntityBranchId] -) AS [t1] ON (([e].[Key1] = [t1].[CompositeId1]) AND ([e].[Key2] = [t1].[CompositeId2])) AND ([e].[Key3] = [t1].[CompositeId3]) +) AS [t1] ON [e].[Key1] = [t1].[CompositeId1] AND [e].[Key2] = [t1].[CompositeId2] AND [e].[Key3] = [t1].[CompositeId3] ORDER BY [e].[Key1], [e].[Key2], [e].[Key3], [t1].[LeafId], [t1].[CompositeId1], [t1].[CompositeId2], [t1].[CompositeId3], [t1].[Id], [t1].[EntityBranchId], [t1].[EntityOneId]"); } @@ -721,7 +721,7 @@ FROM [EntityCompositeKeyEntityTwo] AS [e0] INNER JOIN [EntityTwos] AS [e1] ON [e0].[TwoSkipSharedId] = [e1].[Id] ) AS [t] WHERE [t].[row] <= 2 -) AS [t0] ON (([e].[Key1] = [t0].[CompositeKeySkipSharedKey1]) AND ([e].[Key2] = [t0].[CompositeKeySkipSharedKey2])) AND ([e].[Key3] = [t0].[CompositeKeySkipSharedKey3]) +) AS [t0] ON [e].[Key1] = [t0].[CompositeKeySkipSharedKey1] AND [e].[Key2] = [t0].[CompositeKeySkipSharedKey2] AND [e].[Key3] = [t0].[CompositeKeySkipSharedKey3] ORDER BY [e].[Key1], [e].[Key2], [e].[Key3], [t0].[CompositeKeySkipSharedKey1], [t0].[CompositeKeySkipSharedKey2], [t0].[CompositeKeySkipSharedKey3], [t0].[Id]"); } @@ -739,8 +739,8 @@ LEFT JOIN ( FROM [JoinThreeToCompositeKeyFull] AS [j] INNER JOIN [EntityThrees] AS [e0] ON [j].[ThreeId] = [e0].[Id] ) AS [t] - WHERE (1 < [t].[row]) AND ([t].[row] <= 3) -) AS [t0] ON (([e].[Key1] = [t0].[CompositeId1]) AND ([e].[Key2] = [t0].[CompositeId2])) AND ([e].[Key3] = [t0].[CompositeId3]) + WHERE 1 < [t].[row] AND [t].[row] <= 3 +) AS [t0] ON [e].[Key1] = [t0].[CompositeId1] AND [e].[Key2] = [t0].[CompositeId2] AND [e].[Key3] = [t0].[CompositeId3] ORDER BY [e].[Key1], [e].[Key2], [e].[Key3], [t0].[CompositeId1], [t0].[CompositeId2], [t0].[CompositeId3], [t0].[Id]"); } @@ -775,7 +775,7 @@ FROM [EntityRoots] AS [e] LEFT JOIN ( SELECT [e1].[Key1], [e1].[Key2], [e1].[Key3], [e1].[Name], [e0].[RootSkipSharedId], [e0].[CompositeKeySkipSharedKey1], [e0].[CompositeKeySkipSharedKey2], [e0].[CompositeKeySkipSharedKey3], [t0].[Id], [t0].[CollectionInverseId], [t0].[Name] AS [Name0], [t0].[ReferenceInverseId], [t0].[Id0], [t0].[CompositeId1], [t0].[CompositeId2], [t0].[CompositeId3] FROM [EntityCompositeKeyEntityRoot] AS [e0] - INNER JOIN [EntityCompositeKeys] AS [e1] ON (([e0].[CompositeKeySkipSharedKey1] = [e1].[Key1]) AND ([e0].[CompositeKeySkipSharedKey2] = [e1].[Key2])) AND ([e0].[CompositeKeySkipSharedKey3] = [e1].[Key3]) + INNER JOIN [EntityCompositeKeys] AS [e1] ON [e0].[CompositeKeySkipSharedKey1] = [e1].[Key1] AND [e0].[CompositeKeySkipSharedKey2] = [e1].[Key2] AND [e0].[CompositeKeySkipSharedKey3] = [e1].[Key3] LEFT JOIN ( SELECT [t].[Id], [t].[CollectionInverseId], [t].[Name], [t].[ReferenceInverseId], [t].[Id0], [t].[CompositeId1], [t].[CompositeId2], [t].[CompositeId3] FROM ( @@ -783,8 +783,8 @@ LEFT JOIN ( FROM [JoinThreeToCompositeKeyFull] AS [j] INNER JOIN [EntityThrees] AS [e2] ON [j].[ThreeId] = [e2].[Id] ) AS [t] - WHERE (1 < [t].[row]) AND ([t].[row] <= 3) - ) AS [t0] ON (([e1].[Key1] = [t0].[CompositeId1]) AND ([e1].[Key2] = [t0].[CompositeId2])) AND ([e1].[Key3] = [t0].[CompositeId3]) + WHERE 1 < [t].[row] AND [t].[row] <= 3 + ) AS [t0] ON [e1].[Key1] = [t0].[CompositeId1] AND [e1].[Key2] = [t0].[CompositeId2] AND [e1].[Key3] = [t0].[CompositeId3] ) AS [t1] ON [e].[Id] = [t1].[RootSkipSharedId] ORDER BY [e].[Id], [t1].[RootSkipSharedId], [t1].[CompositeKeySkipSharedKey1], [t1].[CompositeKeySkipSharedKey2], [t1].[CompositeKeySkipSharedKey3], [t1].[Key1], [t1].[Key2], [t1].[Key3], [t1].[CompositeId1], [t1].[CompositeId2], [t1].[CompositeId3], [t1].[Id]"); } @@ -799,12 +799,12 @@ FROM [EntityRoots] AS [e] LEFT JOIN ( SELECT [e0].[Key1], [e0].[Key2], [e0].[Key3], [e0].[Name], [j].[LeafId], [j].[CompositeId1], [j].[CompositeId2], [j].[CompositeId3], [t].[Id], [t].[CollectionInverseId], [t].[ExtraId], [t].[Name] AS [Name0], [t].[ReferenceInverseId], [t].[TwoSkipSharedId], [t].[CompositeKeySkipSharedKey1], [t].[CompositeKeySkipSharedKey2], [t].[CompositeKeySkipSharedKey3] FROM [JoinCompositeKeyToLeaf] AS [j] - INNER JOIN [EntityCompositeKeys] AS [e0] ON (([j].[CompositeId1] = [e0].[Key1]) AND ([j].[CompositeId2] = [e0].[Key2])) AND ([j].[CompositeId3] = [e0].[Key3]) + INNER JOIN [EntityCompositeKeys] AS [e0] ON [j].[CompositeId1] = [e0].[Key1] AND [j].[CompositeId2] = [e0].[Key2] AND [j].[CompositeId3] = [e0].[Key3] LEFT JOIN ( SELECT [e2].[Id], [e2].[CollectionInverseId], [e2].[ExtraId], [e2].[Name], [e2].[ReferenceInverseId], [e1].[TwoSkipSharedId], [e1].[CompositeKeySkipSharedKey1], [e1].[CompositeKeySkipSharedKey2], [e1].[CompositeKeySkipSharedKey3] FROM [EntityCompositeKeyEntityTwo] AS [e1] INNER JOIN [EntityTwos] AS [e2] ON [e1].[TwoSkipSharedId] = [e2].[Id] - ) AS [t] ON (([e0].[Key1] = [t].[CompositeKeySkipSharedKey1]) AND ([e0].[Key2] = [t].[CompositeKeySkipSharedKey2])) AND ([e0].[Key3] = [t].[CompositeKeySkipSharedKey3]) + ) AS [t] ON [e0].[Key1] = [t].[CompositeKeySkipSharedKey1] AND [e0].[Key2] = [t].[CompositeKeySkipSharedKey2] AND [e0].[Key3] = [t].[CompositeKeySkipSharedKey3] WHERE [e0].[Key1] < 5 ) AS [t0] ON [e].[Id] = [t0].[LeafId] WHERE [e].[Discriminator] = N'EntityLeaf' @@ -857,7 +857,7 @@ LEFT JOIN ( FROM [JoinTwoToThree] AS [j0] INNER JOIN [EntityThrees] AS [e1] ON [j0].[ThreeId] = [e1].[Id] ) AS [t] - WHERE (1 < [t].[row]) AND ([t].[row] <= 3) + WHERE 1 < [t].[row] AND [t].[row] <= 3 ) AS [t0] ON [e0].[Id] = [t0].[TwoId] WHERE [e0].[Id] < 10 ) AS [t1] ON [e].[Id] = [t1].[OneId] @@ -900,7 +900,7 @@ LEFT JOIN ( FROM [JoinOneToTwo] AS [j0] INNER JOIN [EntityTwos] AS [e1] ON [j0].[TwoId] = [e1].[Id] ) AS [t] - WHERE (1 < [t].[row]) AND ([t].[row] <= 3) + WHERE 1 < [t].[row] AND [t].[row] <= 3 ) AS [t0] ON [e0].[Id] = [t0].[OneId] LEFT JOIN ( SELECT [t2].[Id], [t2].[Discriminator], [t2].[Name], [t2].[Number], [t2].[IsGreen], [j1].[EntityBranchId], [j1].[EntityOneId] @@ -988,7 +988,7 @@ INNER JOIN ( SELECT [e1].[Id], [e1].[Discriminator], [e1].[Name], [e1].[Number], [e1].[IsGreen], [e0].[CompositeKeySkipSharedKey1], [e0].[CompositeKeySkipSharedKey2], [e0].[CompositeKeySkipSharedKey3] FROM [EntityCompositeKeyEntityRoot] AS [e0] INNER JOIN [EntityRoots] AS [e1] ON [e0].[RootSkipSharedId] = [e1].[Id] -) AS [t] ON (([e].[Key1] = [t].[CompositeKeySkipSharedKey1]) AND ([e].[Key2] = [t].[CompositeKeySkipSharedKey2])) AND ([e].[Key3] = [t].[CompositeKeySkipSharedKey3]) +) AS [t] ON [e].[Key1] = [t].[CompositeKeySkipSharedKey1] AND [e].[Key2] = [t].[CompositeKeySkipSharedKey2] AND [e].[Key3] = [t].[CompositeKeySkipSharedKey3] ORDER BY [e].[Key1], [e].[Key2], [e].[Key3]"); } @@ -1031,7 +1031,7 @@ INNER JOIN ( FROM [EntityRoots] AS [e0] WHERE [e0].[Discriminator] = N'EntityLeaf' ) AS [t] ON [j].[LeafId] = [t].[Id] -) AS [t0] ON (([e].[Key1] = [t0].[CompositeId1]) AND ([e].[Key2] = [t0].[CompositeId2])) AND ([e].[Key3] = [t0].[CompositeId3]) +) AS [t0] ON [e].[Key1] = [t0].[CompositeId1] AND [e].[Key2] = [t0].[CompositeId2] AND [e].[Key3] = [t0].[CompositeId3] ORDER BY [e].[Key1], [e].[Key2], [e].[Key3], [t0].[LeafId], [t0].[CompositeId1], [t0].[CompositeId2], [t0].[CompositeId3], [t0].[Id]", // @"SELECT [t1].[Id], [t1].[Name], [e].[Key1], [e].[Key2], [e].[Key3], [t0].[LeafId], [t0].[CompositeId1], [t0].[CompositeId2], [t0].[CompositeId3], [t0].[Id] @@ -1044,7 +1044,7 @@ SELECT [e0].[Id] FROM [EntityRoots] AS [e0] WHERE [e0].[Discriminator] = N'EntityLeaf' ) AS [t] ON [j].[LeafId] = [t].[Id] -) AS [t0] ON (([e].[Key1] = [t0].[CompositeId1]) AND ([e].[Key2] = [t0].[CompositeId2])) AND ([e].[Key3] = [t0].[CompositeId3]) +) AS [t0] ON [e].[Key1] = [t0].[CompositeId1] AND [e].[Key2] = [t0].[CompositeId2] AND [e].[Key3] = [t0].[CompositeId3] INNER JOIN ( SELECT [e1].[Id], [e1].[Name], [j0].[EntityBranchId] FROM [JoinOneToBranch] AS [j0] @@ -1190,7 +1190,7 @@ FROM [EntityCompositeKeyEntityTwo] AS [e0] INNER JOIN [EntityTwos] AS [e1] ON [e0].[TwoSkipSharedId] = [e1].[Id] ) AS [t] WHERE [t].[row] <= 2 -) AS [t0] ON (([e].[Key1] = [t0].[CompositeKeySkipSharedKey1]) AND ([e].[Key2] = [t0].[CompositeKeySkipSharedKey2])) AND ([e].[Key3] = [t0].[CompositeKeySkipSharedKey3]) +) AS [t0] ON [e].[Key1] = [t0].[CompositeKeySkipSharedKey1] AND [e].[Key2] = [t0].[CompositeKeySkipSharedKey2] AND [e].[Key3] = [t0].[CompositeKeySkipSharedKey3] ORDER BY [e].[Key1], [e].[Key2], [e].[Key3], [t0].[CompositeKeySkipSharedKey1], [t0].[CompositeKeySkipSharedKey2], [t0].[CompositeKeySkipSharedKey3], [t0].[Id]"); } @@ -1212,8 +1212,8 @@ INNER JOIN ( FROM [JoinThreeToCompositeKeyFull] AS [j] INNER JOIN [EntityThrees] AS [e0] ON [j].[ThreeId] = [e0].[Id] ) AS [t] - WHERE (1 < [t].[row]) AND ([t].[row] <= 3) -) AS [t0] ON (([e].[Key1] = [t0].[CompositeId1]) AND ([e].[Key2] = [t0].[CompositeId2])) AND ([e].[Key3] = [t0].[CompositeId3]) + WHERE 1 < [t].[row] AND [t].[row] <= 3 +) AS [t0] ON [e].[Key1] = [t0].[CompositeId1] AND [e].[Key2] = [t0].[CompositeId2] AND [e].[Key3] = [t0].[CompositeId3] ORDER BY [e].[Key1], [e].[Key2], [e].[Key3], [t0].[CompositeId1], [t0].[CompositeId2], [t0].[CompositeId3], [t0].[Id]"); } @@ -1265,7 +1265,7 @@ FROM [EntityRoots] AS [e] INNER JOIN ( SELECT [e1].[Key1], [e1].[Key2], [e1].[Key3], [e1].[Name], [e0].[RootSkipSharedId], [e0].[CompositeKeySkipSharedKey1], [e0].[CompositeKeySkipSharedKey2], [e0].[CompositeKeySkipSharedKey3] FROM [EntityCompositeKeyEntityRoot] AS [e0] - INNER JOIN [EntityCompositeKeys] AS [e1] ON (([e0].[CompositeKeySkipSharedKey1] = [e1].[Key1]) AND ([e0].[CompositeKeySkipSharedKey2] = [e1].[Key2])) AND ([e0].[CompositeKeySkipSharedKey3] = [e1].[Key3]) + INNER JOIN [EntityCompositeKeys] AS [e1] ON [e0].[CompositeKeySkipSharedKey1] = [e1].[Key1] AND [e0].[CompositeKeySkipSharedKey2] = [e1].[Key2] AND [e0].[CompositeKeySkipSharedKey3] = [e1].[Key3] ) AS [t] ON [e].[Id] = [t].[RootSkipSharedId] ORDER BY [e].[Id], [t].[RootSkipSharedId], [t].[CompositeKeySkipSharedKey1], [t].[CompositeKeySkipSharedKey2], [t].[CompositeKeySkipSharedKey3], [t].[Key1], [t].[Key2], [t].[Key3]", // @@ -1274,7 +1274,7 @@ FROM [EntityRoots] AS [e] INNER JOIN ( SELECT [e1].[Key1], [e1].[Key2], [e1].[Key3], [e0].[RootSkipSharedId], [e0].[CompositeKeySkipSharedKey1], [e0].[CompositeKeySkipSharedKey2], [e0].[CompositeKeySkipSharedKey3] FROM [EntityCompositeKeyEntityRoot] AS [e0] - INNER JOIN [EntityCompositeKeys] AS [e1] ON (([e0].[CompositeKeySkipSharedKey1] = [e1].[Key1]) AND ([e0].[CompositeKeySkipSharedKey2] = [e1].[Key2])) AND ([e0].[CompositeKeySkipSharedKey3] = [e1].[Key3]) + INNER JOIN [EntityCompositeKeys] AS [e1] ON [e0].[CompositeKeySkipSharedKey1] = [e1].[Key1] AND [e0].[CompositeKeySkipSharedKey2] = [e1].[Key2] AND [e0].[CompositeKeySkipSharedKey3] = [e1].[Key3] ) AS [t] ON [e].[Id] = [t].[RootSkipSharedId] INNER JOIN ( SELECT [t1].[Id], [t1].[CollectionInverseId], [t1].[Name], [t1].[ReferenceInverseId], [t1].[CompositeId1], [t1].[CompositeId2], [t1].[CompositeId3] @@ -1283,8 +1283,8 @@ INNER JOIN ( FROM [JoinThreeToCompositeKeyFull] AS [j] INNER JOIN [EntityThrees] AS [e2] ON [j].[ThreeId] = [e2].[Id] ) AS [t1] - WHERE (1 < [t1].[row]) AND ([t1].[row] <= 3) -) AS [t0] ON (([t].[Key1] = [t0].[CompositeId1]) AND ([t].[Key2] = [t0].[CompositeId2])) AND ([t].[Key3] = [t0].[CompositeId3]) + WHERE 1 < [t1].[row] AND [t1].[row] <= 3 +) AS [t0] ON [t].[Key1] = [t0].[CompositeId1] AND [t].[Key2] = [t0].[CompositeId2] AND [t].[Key3] = [t0].[CompositeId3] ORDER BY [e].[Id], [t].[RootSkipSharedId], [t].[CompositeKeySkipSharedKey1], [t].[CompositeKeySkipSharedKey2], [t].[CompositeKeySkipSharedKey3], [t].[Key1], [t].[Key2], [t].[Key3], [t0].[CompositeId1], [t0].[CompositeId2], [t0].[CompositeId3], [t0].[Id]"); } @@ -1303,7 +1303,7 @@ FROM [EntityRoots] AS [e] INNER JOIN ( SELECT [e0].[Key1], [e0].[Key2], [e0].[Key3], [e0].[Name], [j].[LeafId], [j].[CompositeId1], [j].[CompositeId2], [j].[CompositeId3] FROM [JoinCompositeKeyToLeaf] AS [j] - INNER JOIN [EntityCompositeKeys] AS [e0] ON (([j].[CompositeId1] = [e0].[Key1]) AND ([j].[CompositeId2] = [e0].[Key2])) AND ([j].[CompositeId3] = [e0].[Key3]) + INNER JOIN [EntityCompositeKeys] AS [e0] ON [j].[CompositeId1] = [e0].[Key1] AND [j].[CompositeId2] = [e0].[Key2] AND [j].[CompositeId3] = [e0].[Key3] WHERE [e0].[Key1] < 5 ) AS [t] ON [e].[Id] = [t].[LeafId] WHERE [e].[Discriminator] = N'EntityLeaf' @@ -1314,14 +1314,14 @@ FROM [EntityRoots] AS [e] INNER JOIN ( SELECT [e0].[Key1], [e0].[Key2], [e0].[Key3], [j].[LeafId], [j].[CompositeId1], [j].[CompositeId2], [j].[CompositeId3] FROM [JoinCompositeKeyToLeaf] AS [j] - INNER JOIN [EntityCompositeKeys] AS [e0] ON (([j].[CompositeId1] = [e0].[Key1]) AND ([j].[CompositeId2] = [e0].[Key2])) AND ([j].[CompositeId3] = [e0].[Key3]) + INNER JOIN [EntityCompositeKeys] AS [e0] ON [j].[CompositeId1] = [e0].[Key1] AND [j].[CompositeId2] = [e0].[Key2] AND [j].[CompositeId3] = [e0].[Key3] WHERE [e0].[Key1] < 5 ) AS [t] ON [e].[Id] = [t].[LeafId] INNER JOIN ( SELECT [e2].[Id], [e2].[CollectionInverseId], [e2].[ExtraId], [e2].[Name], [e2].[ReferenceInverseId], [e1].[CompositeKeySkipSharedKey1], [e1].[CompositeKeySkipSharedKey2], [e1].[CompositeKeySkipSharedKey3] FROM [EntityCompositeKeyEntityTwo] AS [e1] INNER JOIN [EntityTwos] AS [e2] ON [e1].[TwoSkipSharedId] = [e2].[Id] -) AS [t0] ON (([t].[Key1] = [t0].[CompositeKeySkipSharedKey1]) AND ([t].[Key2] = [t0].[CompositeKeySkipSharedKey2])) AND ([t].[Key3] = [t0].[CompositeKeySkipSharedKey3]) +) AS [t0] ON [t].[Key1] = [t0].[CompositeKeySkipSharedKey1] AND [t].[Key2] = [t0].[CompositeKeySkipSharedKey2] AND [t].[Key3] = [t0].[CompositeKeySkipSharedKey3] WHERE [e].[Discriminator] = N'EntityLeaf' ORDER BY [e].[Id], [t].[LeafId], [t].[CompositeId1], [t].[CompositeId2], [t].[CompositeId3], [t].[Key1], [t].[Key2], [t].[Key3]"); } @@ -1344,7 +1344,7 @@ INNER JOIN ( FROM [JoinOneToTwo] AS [j] INNER JOIN [EntityTwos] AS [e0] ON [j].[TwoId] = [e0].[Id] ) AS [t] - WHERE (1 < [t].[row]) AND ([t].[row] <= 3) + WHERE 1 < [t].[row] AND [t].[row] <= 3 ) AS [t0] ON [e].[Id] = [t0].[OneId] ORDER BY [e].[Id], [t0].[OneId], [t0].[Id], [t0].[TwoId]", // @@ -1357,7 +1357,7 @@ INNER JOIN ( FROM [JoinOneToTwo] AS [j] INNER JOIN [EntityTwos] AS [e0] ON [j].[TwoId] = [e0].[Id] ) AS [t] - WHERE (1 < [t].[row]) AND ([t].[row] <= 3) + WHERE 1 < [t].[row] AND [t].[row] <= 3 ) AS [t0] ON [e].[Id] = [t0].[OneId] INNER JOIN ( SELECT [e1].[Id], [e1].[CollectionInverseId], [e1].[Name], [e1].[ReferenceInverseId], [j0].[TwoId] @@ -1402,7 +1402,7 @@ INNER JOIN ( FROM [JoinTwoToThree] AS [j0] INNER JOIN [EntityThrees] AS [e1] ON [j0].[ThreeId] = [e1].[Id] ) AS [t1] - WHERE (1 < [t1].[row]) AND ([t1].[row] <= 3) + WHERE 1 < [t1].[row] AND [t1].[row] <= 3 ) AS [t0] ON [t].[Id] = [t0].[TwoId] ORDER BY [e].[Id], [t].[OneId], [t].[TwoId], [t].[Id], [t0].[TwoId], [t0].[Id]"); } @@ -1474,7 +1474,7 @@ INNER JOIN ( FROM [JoinOneToTwo] AS [j0] INNER JOIN [EntityTwos] AS [e1] ON [j0].[TwoId] = [e1].[Id] ) AS [t1] - WHERE (1 < [t1].[row]) AND ([t1].[row] <= 3) + WHERE 1 < [t1].[row] AND [t1].[row] <= 3 ) AS [t0] ON [t].[Id] = [t0].[OneId] ORDER BY [e].[Id], [t].[OneId], [t].[ThreeId], [t].[Id], [t0].[OneId], [t0].[Id]", // diff --git a/test/EFCore.SqlServer.FunctionalTests/Query/ManyToManyQuerySqlServerTest.cs b/test/EFCore.SqlServer.FunctionalTests/Query/ManyToManyQuerySqlServerTest.cs index 968f9fcd21e..8cb3789bca3 100644 --- a/test/EFCore.SqlServer.FunctionalTests/Query/ManyToManyQuerySqlServerTest.cs +++ b/test/EFCore.SqlServer.FunctionalTests/Query/ManyToManyQuerySqlServerTest.cs @@ -29,7 +29,7 @@ WHERE NOT EXISTS ( SELECT 1 FROM [JoinOneToTwo] AS [j] INNER JOIN [EntityTwos] AS [e0] ON [j].[TwoId] = [e0].[Id] - WHERE ([e].[Id] = [j].[OneId]) AND NOT ([e0].[Name] LIKE N'%B%'))"); + WHERE [e].[Id] = [j].[OneId] AND NOT ([e0].[Name] LIKE N'%B%'))"); } public override async Task Skip_navigation_any_without_predicate(bool async) @@ -43,7 +43,7 @@ WHERE EXISTS ( SELECT 1 FROM [JoinOneToThreePayloadFull] AS [j] INNER JOIN [EntityThrees] AS [e0] ON [j].[ThreeId] = [e0].[Id] - WHERE ([e].[Id] = [j].[OneId]) AND ([e0].[Name] LIKE N'%B%'))"); + WHERE [e].[Id] = [j].[OneId] AND ([e0].[Name] LIKE N'%B%'))"); } public override async Task Skip_navigation_any_with_predicate(bool async) @@ -57,7 +57,7 @@ WHERE EXISTS ( SELECT 1 FROM [EntityOneEntityTwo] AS [e0] INNER JOIN [EntityTwos] AS [e1] ON [e0].[TwoSkipSharedId] = [e1].[Id] - WHERE ([e].[Id] = [e0].[OneSkipSharedId]) AND ([e1].[Name] LIKE N'%B%'))"); + WHERE [e].[Id] = [e0].[OneSkipSharedId] AND ([e1].[Name] LIKE N'%B%'))"); } public override async Task Skip_navigation_contains(bool async) @@ -71,7 +71,7 @@ WHERE EXISTS ( SELECT 1 FROM [JoinOneToThreePayloadFullShared] AS [j] INNER JOIN [EntityThrees] AS [e0] ON [j].[ThreeId] = [e0].[Id] - WHERE ([e].[Id] = [j].[OneId]) AND ([e0].[Id] = 1))"); + WHERE [e].[Id] = [j].[OneId] AND [e0].[Id] = 1)"); } public override async Task Skip_navigation_count_without_predicate(bool async) @@ -103,7 +103,7 @@ INNER JOIN ( FROM [EntityRoots] AS [e0] WHERE [e0].[Discriminator] IN (N'EntityBranch', N'EntityLeaf') ) AS [t] ON [j].[EntityBranchId] = [t].[Id] - WHERE ([e].[Id] = [j].[EntityOneId]) AND ([t].[Name] IS NOT NULL AND ([t].[Name] LIKE N'L%'))), [e].[Id]"); + WHERE [e].[Id] = [j].[EntityOneId] AND [t].[Name] IS NOT NULL AND ([t].[Name] LIKE N'L%')), [e].[Id]"); } public override async Task Skip_navigation_long_count_without_predicate(bool async) @@ -131,7 +131,7 @@ ORDER BY ( SELECT COUNT_BIG(*) FROM [EntityTwoEntityTwo] AS [e0] INNER JOIN [EntityTwos] AS [e1] ON [e0].[SelfSkipSharedLeftId] = [e1].[Id] - WHERE ([e].[Id] = [e0].[SelfSkipSharedRightId]) AND ([e1].[Name] IS NOT NULL AND ([e1].[Name] LIKE N'L%'))) DESC, [e].[Id]"); + WHERE [e].[Id] = [e0].[SelfSkipSharedRightId] AND [e1].[Name] IS NOT NULL AND ([e1].[Name] LIKE N'L%')) DESC, [e].[Id]"); } public override async Task Skip_navigation_select_many_average(bool async) @@ -144,7 +144,7 @@ FROM [EntityTwos] AS [e] INNER JOIN ( SELECT [e1].[Key1], [e0].[TwoSkipSharedId] FROM [EntityCompositeKeyEntityTwo] AS [e0] - INNER JOIN [EntityCompositeKeys] AS [e1] ON (([e0].[CompositeKeySkipSharedKey1] = [e1].[Key1]) AND ([e0].[CompositeKeySkipSharedKey2] = [e1].[Key2])) AND ([e0].[CompositeKeySkipSharedKey3] = [e1].[Key3]) + INNER JOIN [EntityCompositeKeys] AS [e1] ON [e0].[CompositeKeySkipSharedKey1] = [e1].[Key1] AND [e0].[CompositeKeySkipSharedKey2] = [e1].[Key2] AND [e0].[CompositeKeySkipSharedKey3] = [e1].[Key3] ) AS [t] ON [e].[Id] = [t].[TwoSkipSharedId]"); } @@ -158,7 +158,7 @@ FROM [EntityThrees] AS [e] INNER JOIN ( SELECT [e0].[Key1], [j].[ThreeId] FROM [JoinThreeToCompositeKeyFull] AS [j] - INNER JOIN [EntityCompositeKeys] AS [e0] ON (([j].[CompositeId1] = [e0].[Key1]) AND ([j].[CompositeId2] = [e0].[Key2])) AND ([j].[CompositeId3] = [e0].[Key3]) + INNER JOIN [EntityCompositeKeys] AS [e0] ON [j].[CompositeId1] = [e0].[Key1] AND [j].[CompositeId2] = [e0].[Key2] AND [j].[CompositeId3] = [e0].[Key3] ) AS [t] ON [e].[Id] = [t].[ThreeId]"); } @@ -186,7 +186,7 @@ FROM [EntityRoots] AS [e] INNER JOIN ( SELECT [e1].[Key1], [e0].[RootSkipSharedId] FROM [EntityCompositeKeyEntityRoot] AS [e0] - INNER JOIN [EntityCompositeKeys] AS [e1] ON (([e0].[CompositeKeySkipSharedKey1] = [e1].[Key1]) AND ([e0].[CompositeKeySkipSharedKey2] = [e1].[Key2])) AND ([e0].[CompositeKeySkipSharedKey3] = [e1].[Key3]) + INNER JOIN [EntityCompositeKeys] AS [e1] ON [e0].[CompositeKeySkipSharedKey1] = [e1].[Key1] AND [e0].[CompositeKeySkipSharedKey2] = [e1].[Key2] AND [e0].[CompositeKeySkipSharedKey3] = [e1].[Key3] ) AS [t] ON [e].[Id] = [t].[RootSkipSharedId]"); } @@ -198,7 +198,7 @@ public override async Task Skip_navigation_select_subquery_average(bool async) @"SELECT ( SELECT AVG(CAST([e0].[Key1] AS float)) FROM [JoinCompositeKeyToLeaf] AS [j] - INNER JOIN [EntityCompositeKeys] AS [e0] ON (([j].[CompositeId1] = [e0].[Key1]) AND ([j].[CompositeId2] = [e0].[Key2])) AND ([j].[CompositeId3] = [e0].[Key3]) + INNER JOIN [EntityCompositeKeys] AS [e0] ON [j].[CompositeId1] = [e0].[Key1] AND [j].[CompositeId2] = [e0].[Key2] AND [j].[CompositeId3] = [e0].[Key3] WHERE [e].[Id] = [j].[LeafId]) FROM [EntityRoots] AS [e] WHERE [e].[Discriminator] = N'EntityLeaf'"); @@ -333,7 +333,7 @@ INNER JOIN ( FROM [EntityRoots] AS [e0] WHERE [e0].[Discriminator] = N'EntityLeaf' ) AS [t] ON [j].[LeafId] = [t].[Id] -) AS [t0] ON (([e].[Key1] = [t0].[CompositeId1]) AND ([e].[Key2] = [t0].[CompositeId2])) AND ([e].[Key3] = [t0].[CompositeId3]) +) AS [t0] ON [e].[Key1] = [t0].[CompositeId1] AND [e].[Key2] = [t0].[CompositeId2] AND [e].[Key3] = [t0].[CompositeId3] ORDER BY [e].[Key1], [e].[Key2], [e].[Key3], [t0].[LeafId], [t0].[CompositeId1], [t0].[CompositeId2], [t0].[CompositeId3]"); } @@ -349,7 +349,7 @@ LEFT JOIN ( FROM [EntityCompositeKeyEntityRoot] AS [e0] INNER JOIN [EntityRoots] AS [e1] ON [e0].[RootSkipSharedId] = [e1].[Id] WHERE [e1].[Discriminator] = N'EntityLeaf' -) AS [t] ON (([e].[Key1] = [t].[CompositeKeySkipSharedKey1]) AND ([e].[Key2] = [t].[CompositeKeySkipSharedKey2])) AND ([e].[Key3] = [t].[CompositeKeySkipSharedKey3]) +) AS [t] ON [e].[Key1] = [t].[CompositeKeySkipSharedKey1] AND [e].[Key2] = [t].[CompositeKeySkipSharedKey2] AND [e].[Key3] = [t].[CompositeKeySkipSharedKey3] ORDER BY [e].[Key1], [e].[Key2], [e].[Key3], [t].[RootSkipSharedId], [t].[CompositeKeySkipSharedKey1], [t].[CompositeKeySkipSharedKey2], [t].[CompositeKeySkipSharedKey3]"); } @@ -379,12 +379,12 @@ LEFT JOIN [EntityCompositeKeys] AS [e0] ON ( SELECT TOP(1) [e2].[Id] FROM [EntityCompositeKeyEntityTwo] AS [e1] INNER JOIN [EntityTwos] AS [e2] ON [e1].[TwoSkipSharedId] = [e2].[Id] - WHERE (([e].[Key1] = [e1].[CompositeKeySkipSharedKey1]) AND ([e].[Key2] = [e1].[CompositeKeySkipSharedKey2])) AND ([e].[Key3] = [e1].[CompositeKeySkipSharedKey3]) + WHERE [e].[Key1] = [e1].[CompositeKeySkipSharedKey1] AND [e].[Key2] = [e1].[CompositeKeySkipSharedKey2] AND [e].[Key3] = [e1].[CompositeKeySkipSharedKey3] ORDER BY [e2].[Id]) = ( SELECT TOP(1) [e3].[Id] FROM [JoinThreeToCompositeKeyFull] AS [j] INNER JOIN [EntityThrees] AS [e3] ON [j].[ThreeId] = [e3].[Id] - WHERE (([e0].[Key1] = [j].[CompositeId1]) AND ([e0].[Key2] = [j].[CompositeId2])) AND ([e0].[Key3] = [j].[CompositeId3]) + WHERE [e0].[Key1] = [j].[CompositeId1] AND [e0].[Key2] = [j].[CompositeId2] AND [e0].[Key3] = [j].[CompositeId3] ORDER BY [e3].[Id]) ORDER BY [e].[Key1], [e0].[Key1], [e].[Key2], [e0].[Key2]"); } @@ -467,7 +467,7 @@ INNER JOIN ( FROM [JoinOneToThreePayloadFullShared] AS [j] INNER JOIN [EntityThrees] AS [e0] ON [j].[ThreeId] = [e0].[Id] ) AS [t] - WHERE (2 < [t].[row]) AND ([t].[row] <= 5) + WHERE 2 < [t].[row] AND [t].[row] <= 5 ) AS [t0] ON [e].[Id] = [t0].[OneId]"); } @@ -539,7 +539,7 @@ FROM [EntityTwoEntityTwo] AS [e1] LEFT JOIN ( SELECT [e4].[Key1], [e4].[Key2], [e4].[Key3], [e4].[Name], [e3].[TwoSkipSharedId], [e3].[CompositeKeySkipSharedKey1], [e3].[CompositeKeySkipSharedKey2], [e3].[CompositeKeySkipSharedKey3] FROM [EntityCompositeKeyEntityTwo] AS [e3] - INNER JOIN [EntityCompositeKeys] AS [e4] ON (([e3].[CompositeKeySkipSharedKey1] = [e4].[Key1]) AND ([e3].[CompositeKeySkipSharedKey2] = [e4].[Key2])) AND ([e3].[CompositeKeySkipSharedKey3] = [e4].[Key3]) + INNER JOIN [EntityCompositeKeys] AS [e4] ON [e3].[CompositeKeySkipSharedKey1] = [e4].[Key1] AND [e3].[CompositeKeySkipSharedKey2] = [e4].[Key2] AND [e3].[CompositeKeySkipSharedKey3] = [e4].[Key3] ) AS [t1] ON [e].[Id] = [t1].[TwoSkipSharedId] ORDER BY [e].[Id], [t].[ThreeId], [t].[TwoId], [t].[Id], [t0].[SelfSkipSharedLeftId], [t0].[SelfSkipSharedRightId], [t0].[Id], [t1].[TwoSkipSharedId], [t1].[CompositeKeySkipSharedKey1], [t1].[CompositeKeySkipSharedKey2], [t1].[CompositeKeySkipSharedKey3], [t1].[Key1], [t1].[Key2]"); } @@ -556,7 +556,7 @@ LEFT JOIN ( FROM ( SELECT [e0].[Key1], [e0].[Key2], [e0].[Key3], [e0].[Name], [j].[ThreeId], ROW_NUMBER() OVER(PARTITION BY [j].[ThreeId] ORDER BY [e0].[Key1], [e0].[Key2]) AS [row] FROM [JoinThreeToCompositeKeyFull] AS [j] - INNER JOIN [EntityCompositeKeys] AS [e0] ON (([j].[CompositeId1] = [e0].[Key1]) AND ([j].[CompositeId2] = [e0].[Key2])) AND ([j].[CompositeId3] = [e0].[Key3]) + INNER JOIN [EntityCompositeKeys] AS [e0] ON [j].[CompositeId1] = [e0].[Key1] AND [j].[CompositeId2] = [e0].[Key2] AND [j].[CompositeId3] = [e0].[Key3] ) AS [t] WHERE [t].[row] <= 1 ) AS [t0] ON [e].[Id] = [t0].[ThreeId] @@ -574,7 +574,7 @@ LEFT JOIN ( SELECT [e0].[RootSkipSharedId], [e0].[CompositeKeySkipSharedKey1], [e0].[CompositeKeySkipSharedKey2], [e0].[CompositeKeySkipSharedKey3], [e1].[Id], [e1].[Discriminator], [e1].[Name], [e1].[Number], [e1].[IsGreen] FROM [EntityCompositeKeyEntityRoot] AS [e0] INNER JOIN [EntityRoots] AS [e1] ON [e0].[RootSkipSharedId] = [e1].[Id] -) AS [t] ON (([e].[Key1] = [t].[CompositeKeySkipSharedKey1]) AND ([e].[Key2] = [t].[CompositeKeySkipSharedKey2])) AND ([e].[Key3] = [t].[CompositeKeySkipSharedKey3]) +) AS [t] ON [e].[Key1] = [t].[CompositeKeySkipSharedKey1] AND [e].[Key2] = [t].[CompositeKeySkipSharedKey2] AND [e].[Key3] = [t].[CompositeKeySkipSharedKey3] ORDER BY [e].[Key1], [e].[Key2], [e].[Key3], [t].[RootSkipSharedId], [t].[CompositeKeySkipSharedKey1], [t].[CompositeKeySkipSharedKey2], [t].[CompositeKeySkipSharedKey3]"); } @@ -614,7 +614,7 @@ LEFT JOIN ( FROM [JoinOneToBranch] AS [j0] INNER JOIN [EntityOnes] AS [e1] ON [j0].[EntityOneId] = [e1].[Id] ) AS [t0] ON [t].[Id] = [t0].[EntityBranchId] -) AS [t1] ON (([e].[Key1] = [t1].[CompositeId1]) AND ([e].[Key2] = [t1].[CompositeId2])) AND ([e].[Key3] = [t1].[CompositeId3]) +) AS [t1] ON [e].[Key1] = [t1].[CompositeId1] AND [e].[Key2] = [t1].[CompositeId2] AND [e].[Key3] = [t1].[CompositeId3] ORDER BY [e].[Key1], [e].[Key2], [e].[Key3], [t1].[LeafId], [t1].[CompositeId1], [t1].[CompositeId2], [t1].[CompositeId3], [t1].[Id], [t1].[EntityBranchId], [t1].[EntityOneId]"); } @@ -720,7 +720,7 @@ FROM [EntityCompositeKeyEntityTwo] AS [e0] INNER JOIN [EntityTwos] AS [e1] ON [e0].[TwoSkipSharedId] = [e1].[Id] ) AS [t] WHERE [t].[row] <= 2 -) AS [t0] ON (([e].[Key1] = [t0].[CompositeKeySkipSharedKey1]) AND ([e].[Key2] = [t0].[CompositeKeySkipSharedKey2])) AND ([e].[Key3] = [t0].[CompositeKeySkipSharedKey3]) +) AS [t0] ON [e].[Key1] = [t0].[CompositeKeySkipSharedKey1] AND [e].[Key2] = [t0].[CompositeKeySkipSharedKey2] AND [e].[Key3] = [t0].[CompositeKeySkipSharedKey3] ORDER BY [e].[Key1], [e].[Key2], [e].[Key3], [t0].[CompositeKeySkipSharedKey1], [t0].[CompositeKeySkipSharedKey2], [t0].[CompositeKeySkipSharedKey3], [t0].[Id]"); } @@ -738,8 +738,8 @@ LEFT JOIN ( FROM [JoinThreeToCompositeKeyFull] AS [j] INNER JOIN [EntityThrees] AS [e0] ON [j].[ThreeId] = [e0].[Id] ) AS [t] - WHERE (1 < [t].[row]) AND ([t].[row] <= 3) -) AS [t0] ON (([e].[Key1] = [t0].[CompositeId1]) AND ([e].[Key2] = [t0].[CompositeId2])) AND ([e].[Key3] = [t0].[CompositeId3]) + WHERE 1 < [t].[row] AND [t].[row] <= 3 +) AS [t0] ON [e].[Key1] = [t0].[CompositeId1] AND [e].[Key2] = [t0].[CompositeId2] AND [e].[Key3] = [t0].[CompositeId3] ORDER BY [e].[Key1], [e].[Key2], [e].[Key3], [t0].[CompositeId1], [t0].[CompositeId2], [t0].[CompositeId3], [t0].[Id0]"); } @@ -774,7 +774,7 @@ FROM [EntityRoots] AS [e] LEFT JOIN ( SELECT [e0].[RootSkipSharedId], [e0].[CompositeKeySkipSharedKey1], [e0].[CompositeKeySkipSharedKey2], [e0].[CompositeKeySkipSharedKey3], [e1].[Key1], [e1].[Key2], [e1].[Key3], [e1].[Name], [t0].[Id], [t0].[CompositeId1], [t0].[CompositeId2], [t0].[CompositeId3], [t0].[ThreeId], [t0].[Id0], [t0].[CollectionInverseId], [t0].[Name] AS [Name0], [t0].[ReferenceInverseId] FROM [EntityCompositeKeyEntityRoot] AS [e0] - INNER JOIN [EntityCompositeKeys] AS [e1] ON (([e0].[CompositeKeySkipSharedKey1] = [e1].[Key1]) AND ([e0].[CompositeKeySkipSharedKey2] = [e1].[Key2])) AND ([e0].[CompositeKeySkipSharedKey3] = [e1].[Key3]) + INNER JOIN [EntityCompositeKeys] AS [e1] ON [e0].[CompositeKeySkipSharedKey1] = [e1].[Key1] AND [e0].[CompositeKeySkipSharedKey2] = [e1].[Key2] AND [e0].[CompositeKeySkipSharedKey3] = [e1].[Key3] LEFT JOIN ( SELECT [t].[Id], [t].[CompositeId1], [t].[CompositeId2], [t].[CompositeId3], [t].[ThreeId], [t].[Id0], [t].[CollectionInverseId], [t].[Name], [t].[ReferenceInverseId] FROM ( @@ -782,8 +782,8 @@ LEFT JOIN ( FROM [JoinThreeToCompositeKeyFull] AS [j] INNER JOIN [EntityThrees] AS [e2] ON [j].[ThreeId] = [e2].[Id] ) AS [t] - WHERE (1 < [t].[row]) AND ([t].[row] <= 3) - ) AS [t0] ON (([e1].[Key1] = [t0].[CompositeId1]) AND ([e1].[Key2] = [t0].[CompositeId2])) AND ([e1].[Key3] = [t0].[CompositeId3]) + WHERE 1 < [t].[row] AND [t].[row] <= 3 + ) AS [t0] ON [e1].[Key1] = [t0].[CompositeId1] AND [e1].[Key2] = [t0].[CompositeId2] AND [e1].[Key3] = [t0].[CompositeId3] ) AS [t1] ON [e].[Id] = [t1].[RootSkipSharedId] ORDER BY [e].[Id], [t1].[RootSkipSharedId], [t1].[CompositeKeySkipSharedKey1], [t1].[CompositeKeySkipSharedKey2], [t1].[CompositeKeySkipSharedKey3], [t1].[Key1], [t1].[Key2], [t1].[Key3], [t1].[CompositeId1], [t1].[CompositeId2], [t1].[CompositeId3], [t1].[Id0]"); } @@ -798,12 +798,12 @@ FROM [EntityRoots] AS [e] LEFT JOIN ( SELECT [j].[LeafId], [j].[CompositeId1], [j].[CompositeId2], [j].[CompositeId3], [e0].[Key1], [e0].[Key2], [e0].[Key3], [e0].[Name], [t].[TwoSkipSharedId], [t].[CompositeKeySkipSharedKey1], [t].[CompositeKeySkipSharedKey2], [t].[CompositeKeySkipSharedKey3], [t].[Id], [t].[CollectionInverseId], [t].[ExtraId], [t].[Name] AS [Name0], [t].[ReferenceInverseId] FROM [JoinCompositeKeyToLeaf] AS [j] - INNER JOIN [EntityCompositeKeys] AS [e0] ON (([j].[CompositeId1] = [e0].[Key1]) AND ([j].[CompositeId2] = [e0].[Key2])) AND ([j].[CompositeId3] = [e0].[Key3]) + INNER JOIN [EntityCompositeKeys] AS [e0] ON [j].[CompositeId1] = [e0].[Key1] AND [j].[CompositeId2] = [e0].[Key2] AND [j].[CompositeId3] = [e0].[Key3] LEFT JOIN ( SELECT [e1].[TwoSkipSharedId], [e1].[CompositeKeySkipSharedKey1], [e1].[CompositeKeySkipSharedKey2], [e1].[CompositeKeySkipSharedKey3], [e2].[Id], [e2].[CollectionInverseId], [e2].[ExtraId], [e2].[Name], [e2].[ReferenceInverseId] FROM [EntityCompositeKeyEntityTwo] AS [e1] INNER JOIN [EntityTwos] AS [e2] ON [e1].[TwoSkipSharedId] = [e2].[Id] - ) AS [t] ON (([e0].[Key1] = [t].[CompositeKeySkipSharedKey1]) AND ([e0].[Key2] = [t].[CompositeKeySkipSharedKey2])) AND ([e0].[Key3] = [t].[CompositeKeySkipSharedKey3]) + ) AS [t] ON [e0].[Key1] = [t].[CompositeKeySkipSharedKey1] AND [e0].[Key2] = [t].[CompositeKeySkipSharedKey2] AND [e0].[Key3] = [t].[CompositeKeySkipSharedKey3] WHERE [e0].[Key1] < 5 ) AS [t0] ON [e].[Id] = [t0].[LeafId] WHERE [e].[Discriminator] = N'EntityLeaf' @@ -855,7 +855,7 @@ LEFT JOIN ( FROM [JoinTwoToThree] AS [j0] INNER JOIN [EntityThrees] AS [e1] ON [j0].[ThreeId] = [e1].[Id] ) AS [t] - WHERE (1 < [t].[row]) AND ([t].[row] <= 3) + WHERE 1 < [t].[row] AND [t].[row] <= 3 ) AS [t0] ON [e0].[Id] = [t0].[TwoId] WHERE [e0].[Id] < 10 ) AS [t1] ON [e].[Id] = [t1].[OneId] @@ -898,7 +898,7 @@ LEFT JOIN ( FROM [JoinOneToTwo] AS [j0] INNER JOIN [EntityTwos] AS [e1] ON [j0].[TwoId] = [e1].[Id] ) AS [t] - WHERE (1 < [t].[row]) AND ([t].[row] <= 3) + WHERE 1 < [t].[row] AND [t].[row] <= 3 ) AS [t0] ON [e0].[Id] = [t0].[OneId] LEFT JOIN ( SELECT [j1].[EntityBranchId], [j1].[EntityOneId], [t2].[Id], [t2].[Discriminator], [t2].[Name], [t2].[Number], [t2].[IsGreen] @@ -986,7 +986,7 @@ INNER JOIN ( SELECT [e0].[RootSkipSharedId], [e0].[CompositeKeySkipSharedKey1], [e0].[CompositeKeySkipSharedKey2], [e0].[CompositeKeySkipSharedKey3], [e1].[Id], [e1].[Discriminator], [e1].[Name], [e1].[Number], [e1].[IsGreen] FROM [EntityCompositeKeyEntityRoot] AS [e0] INNER JOIN [EntityRoots] AS [e1] ON [e0].[RootSkipSharedId] = [e1].[Id] -) AS [t] ON (([e].[Key1] = [t].[CompositeKeySkipSharedKey1]) AND ([e].[Key2] = [t].[CompositeKeySkipSharedKey2])) AND ([e].[Key3] = [t].[CompositeKeySkipSharedKey3]) +) AS [t] ON [e].[Key1] = [t].[CompositeKeySkipSharedKey1] AND [e].[Key2] = [t].[CompositeKeySkipSharedKey2] AND [e].[Key3] = [t].[CompositeKeySkipSharedKey3] ORDER BY [e].[Key1], [e].[Key2], [e].[Key3]"); } @@ -1029,7 +1029,7 @@ INNER JOIN ( FROM [EntityRoots] AS [e0] WHERE [e0].[Discriminator] = N'EntityLeaf' ) AS [t] ON [j].[LeafId] = [t].[Id] -) AS [t0] ON (([e].[Key1] = [t0].[CompositeId1]) AND ([e].[Key2] = [t0].[CompositeId2])) AND ([e].[Key3] = [t0].[CompositeId3]) +) AS [t0] ON [e].[Key1] = [t0].[CompositeId1] AND [e].[Key2] = [t0].[CompositeId2] AND [e].[Key3] = [t0].[CompositeId3] ORDER BY [e].[Key1], [e].[Key2], [e].[Key3], [t0].[LeafId], [t0].[CompositeId1], [t0].[CompositeId2], [t0].[CompositeId3], [t0].[Id]", // @"SELECT [t1].[EntityBranchId], [t1].[EntityOneId], [t1].[Id], [t1].[Name], [e].[Key1], [e].[Key2], [e].[Key3], [t0].[LeafId], [t0].[CompositeId1], [t0].[CompositeId2], [t0].[CompositeId3], [t0].[Id] @@ -1042,7 +1042,7 @@ SELECT [e0].[Id] FROM [EntityRoots] AS [e0] WHERE [e0].[Discriminator] = N'EntityLeaf' ) AS [t] ON [j].[LeafId] = [t].[Id] -) AS [t0] ON (([e].[Key1] = [t0].[CompositeId1]) AND ([e].[Key2] = [t0].[CompositeId2])) AND ([e].[Key3] = [t0].[CompositeId3]) +) AS [t0] ON [e].[Key1] = [t0].[CompositeId1] AND [e].[Key2] = [t0].[CompositeId2] AND [e].[Key3] = [t0].[CompositeId3] INNER JOIN ( SELECT [j0].[EntityBranchId], [j0].[EntityOneId], [e1].[Id], [e1].[Name] FROM [JoinOneToBranch] AS [j0] @@ -1188,7 +1188,7 @@ FROM [EntityCompositeKeyEntityTwo] AS [e0] INNER JOIN [EntityTwos] AS [e1] ON [e0].[TwoSkipSharedId] = [e1].[Id] ) AS [t] WHERE [t].[row] <= 2 -) AS [t0] ON (([e].[Key1] = [t0].[CompositeKeySkipSharedKey1]) AND ([e].[Key2] = [t0].[CompositeKeySkipSharedKey2])) AND ([e].[Key3] = [t0].[CompositeKeySkipSharedKey3]) +) AS [t0] ON [e].[Key1] = [t0].[CompositeKeySkipSharedKey1] AND [e].[Key2] = [t0].[CompositeKeySkipSharedKey2] AND [e].[Key3] = [t0].[CompositeKeySkipSharedKey3] ORDER BY [e].[Key1], [e].[Key2], [e].[Key3], [t0].[CompositeKeySkipSharedKey1], [t0].[CompositeKeySkipSharedKey2], [t0].[CompositeKeySkipSharedKey3], [t0].[Id]"); } @@ -1210,8 +1210,8 @@ INNER JOIN ( FROM [JoinThreeToCompositeKeyFull] AS [j] INNER JOIN [EntityThrees] AS [e0] ON [j].[ThreeId] = [e0].[Id] ) AS [t] - WHERE (1 < [t].[row]) AND ([t].[row] <= 3) -) AS [t0] ON (([e].[Key1] = [t0].[CompositeId1]) AND ([e].[Key2] = [t0].[CompositeId2])) AND ([e].[Key3] = [t0].[CompositeId3]) + WHERE 1 < [t].[row] AND [t].[row] <= 3 +) AS [t0] ON [e].[Key1] = [t0].[CompositeId1] AND [e].[Key2] = [t0].[CompositeId2] AND [e].[Key3] = [t0].[CompositeId3] ORDER BY [e].[Key1], [e].[Key2], [e].[Key3], [t0].[CompositeId1], [t0].[CompositeId2], [t0].[CompositeId3], [t0].[Id0]"); } @@ -1263,7 +1263,7 @@ FROM [EntityRoots] AS [e] INNER JOIN ( SELECT [e0].[RootSkipSharedId], [e0].[CompositeKeySkipSharedKey1], [e0].[CompositeKeySkipSharedKey2], [e0].[CompositeKeySkipSharedKey3], [e1].[Key1], [e1].[Key2], [e1].[Key3], [e1].[Name] FROM [EntityCompositeKeyEntityRoot] AS [e0] - INNER JOIN [EntityCompositeKeys] AS [e1] ON (([e0].[CompositeKeySkipSharedKey1] = [e1].[Key1]) AND ([e0].[CompositeKeySkipSharedKey2] = [e1].[Key2])) AND ([e0].[CompositeKeySkipSharedKey3] = [e1].[Key3]) + INNER JOIN [EntityCompositeKeys] AS [e1] ON [e0].[CompositeKeySkipSharedKey1] = [e1].[Key1] AND [e0].[CompositeKeySkipSharedKey2] = [e1].[Key2] AND [e0].[CompositeKeySkipSharedKey3] = [e1].[Key3] ) AS [t] ON [e].[Id] = [t].[RootSkipSharedId] ORDER BY [e].[Id], [t].[RootSkipSharedId], [t].[CompositeKeySkipSharedKey1], [t].[CompositeKeySkipSharedKey2], [t].[CompositeKeySkipSharedKey3], [t].[Key1], [t].[Key2], [t].[Key3]", // @@ -1272,7 +1272,7 @@ FROM [EntityRoots] AS [e] INNER JOIN ( SELECT [e0].[RootSkipSharedId], [e0].[CompositeKeySkipSharedKey1], [e0].[CompositeKeySkipSharedKey2], [e0].[CompositeKeySkipSharedKey3], [e1].[Key1], [e1].[Key2], [e1].[Key3] FROM [EntityCompositeKeyEntityRoot] AS [e0] - INNER JOIN [EntityCompositeKeys] AS [e1] ON (([e0].[CompositeKeySkipSharedKey1] = [e1].[Key1]) AND ([e0].[CompositeKeySkipSharedKey2] = [e1].[Key2])) AND ([e0].[CompositeKeySkipSharedKey3] = [e1].[Key3]) + INNER JOIN [EntityCompositeKeys] AS [e1] ON [e0].[CompositeKeySkipSharedKey1] = [e1].[Key1] AND [e0].[CompositeKeySkipSharedKey2] = [e1].[Key2] AND [e0].[CompositeKeySkipSharedKey3] = [e1].[Key3] ) AS [t] ON [e].[Id] = [t].[RootSkipSharedId] INNER JOIN ( SELECT [t1].[Id], [t1].[CompositeId1], [t1].[CompositeId2], [t1].[CompositeId3], [t1].[ThreeId], [t1].[Id0], [t1].[CollectionInverseId], [t1].[Name], [t1].[ReferenceInverseId] @@ -1281,8 +1281,8 @@ INNER JOIN ( FROM [JoinThreeToCompositeKeyFull] AS [j] INNER JOIN [EntityThrees] AS [e2] ON [j].[ThreeId] = [e2].[Id] ) AS [t1] - WHERE (1 < [t1].[row]) AND ([t1].[row] <= 3) -) AS [t0] ON (([t].[Key1] = [t0].[CompositeId1]) AND ([t].[Key2] = [t0].[CompositeId2])) AND ([t].[Key3] = [t0].[CompositeId3]) + WHERE 1 < [t1].[row] AND [t1].[row] <= 3 +) AS [t0] ON [t].[Key1] = [t0].[CompositeId1] AND [t].[Key2] = [t0].[CompositeId2] AND [t].[Key3] = [t0].[CompositeId3] ORDER BY [e].[Id], [t].[RootSkipSharedId], [t].[CompositeKeySkipSharedKey1], [t].[CompositeKeySkipSharedKey2], [t].[CompositeKeySkipSharedKey3], [t].[Key1], [t].[Key2], [t].[Key3], [t0].[CompositeId1], [t0].[CompositeId2], [t0].[CompositeId3], [t0].[Id0]"); } @@ -1301,7 +1301,7 @@ FROM [EntityRoots] AS [e] INNER JOIN ( SELECT [j].[LeafId], [j].[CompositeId1], [j].[CompositeId2], [j].[CompositeId3], [e0].[Key1], [e0].[Key2], [e0].[Key3], [e0].[Name] FROM [JoinCompositeKeyToLeaf] AS [j] - INNER JOIN [EntityCompositeKeys] AS [e0] ON (([j].[CompositeId1] = [e0].[Key1]) AND ([j].[CompositeId2] = [e0].[Key2])) AND ([j].[CompositeId3] = [e0].[Key3]) + INNER JOIN [EntityCompositeKeys] AS [e0] ON [j].[CompositeId1] = [e0].[Key1] AND [j].[CompositeId2] = [e0].[Key2] AND [j].[CompositeId3] = [e0].[Key3] WHERE [e0].[Key1] < 5 ) AS [t] ON [e].[Id] = [t].[LeafId] WHERE [e].[Discriminator] = N'EntityLeaf' @@ -1312,14 +1312,14 @@ FROM [EntityRoots] AS [e] INNER JOIN ( SELECT [j].[LeafId], [j].[CompositeId1], [j].[CompositeId2], [j].[CompositeId3], [e0].[Key1], [e0].[Key2], [e0].[Key3] FROM [JoinCompositeKeyToLeaf] AS [j] - INNER JOIN [EntityCompositeKeys] AS [e0] ON (([j].[CompositeId1] = [e0].[Key1]) AND ([j].[CompositeId2] = [e0].[Key2])) AND ([j].[CompositeId3] = [e0].[Key3]) + INNER JOIN [EntityCompositeKeys] AS [e0] ON [j].[CompositeId1] = [e0].[Key1] AND [j].[CompositeId2] = [e0].[Key2] AND [j].[CompositeId3] = [e0].[Key3] WHERE [e0].[Key1] < 5 ) AS [t] ON [e].[Id] = [t].[LeafId] INNER JOIN ( SELECT [e1].[TwoSkipSharedId], [e1].[CompositeKeySkipSharedKey1], [e1].[CompositeKeySkipSharedKey2], [e1].[CompositeKeySkipSharedKey3], [e2].[Id], [e2].[CollectionInverseId], [e2].[ExtraId], [e2].[Name], [e2].[ReferenceInverseId] FROM [EntityCompositeKeyEntityTwo] AS [e1] INNER JOIN [EntityTwos] AS [e2] ON [e1].[TwoSkipSharedId] = [e2].[Id] -) AS [t0] ON (([t].[Key1] = [t0].[CompositeKeySkipSharedKey1]) AND ([t].[Key2] = [t0].[CompositeKeySkipSharedKey2])) AND ([t].[Key3] = [t0].[CompositeKeySkipSharedKey3]) +) AS [t0] ON [t].[Key1] = [t0].[CompositeKeySkipSharedKey1] AND [t].[Key2] = [t0].[CompositeKeySkipSharedKey2] AND [t].[Key3] = [t0].[CompositeKeySkipSharedKey3] WHERE [e].[Discriminator] = N'EntityLeaf' ORDER BY [e].[Id], [t].[LeafId], [t].[CompositeId1], [t].[CompositeId2], [t].[CompositeId3], [t].[Key1], [t].[Key2], [t].[Key3]"); } @@ -1342,7 +1342,7 @@ INNER JOIN ( FROM [JoinOneToTwo] AS [j] INNER JOIN [EntityTwos] AS [e0] ON [j].[TwoId] = [e0].[Id] ) AS [t] - WHERE (1 < [t].[row]) AND ([t].[row] <= 3) + WHERE 1 < [t].[row] AND [t].[row] <= 3 ) AS [t0] ON [e].[Id] = [t0].[OneId] ORDER BY [e].[Id], [t0].[OneId], [t0].[Id], [t0].[TwoId]", // @@ -1355,7 +1355,7 @@ INNER JOIN ( FROM [JoinOneToTwo] AS [j] INNER JOIN [EntityTwos] AS [e0] ON [j].[TwoId] = [e0].[Id] ) AS [t] - WHERE (1 < [t].[row]) AND ([t].[row] <= 3) + WHERE 1 < [t].[row] AND [t].[row] <= 3 ) AS [t0] ON [e].[Id] = [t0].[OneId] INNER JOIN ( SELECT [j0].[ThreeId], [j0].[TwoId], [e1].[Id], [e1].[CollectionInverseId], [e1].[Name], [e1].[ReferenceInverseId] @@ -1400,7 +1400,7 @@ INNER JOIN ( FROM [JoinTwoToThree] AS [j0] INNER JOIN [EntityThrees] AS [e1] ON [j0].[ThreeId] = [e1].[Id] ) AS [t1] - WHERE (1 < [t1].[row]) AND ([t1].[row] <= 3) + WHERE 1 < [t1].[row] AND [t1].[row] <= 3 ) AS [t0] ON [t].[Id] = [t0].[TwoId] ORDER BY [e].[Id], [t].[OneId], [t].[TwoId], [t].[Id], [t0].[TwoId], [t0].[Id]"); } @@ -1472,7 +1472,7 @@ INNER JOIN ( FROM [JoinOneToTwo] AS [j0] INNER JOIN [EntityTwos] AS [e1] ON [j0].[TwoId] = [e1].[Id] ) AS [t1] - WHERE (1 < [t1].[row]) AND ([t1].[row] <= 3) + WHERE 1 < [t1].[row] AND [t1].[row] <= 3 ) AS [t0] ON [t].[Id] = [t0].[OneId] ORDER BY [e].[Id], [t].[OneId], [t].[ThreeId], [t].[Id], [t0].[OneId], [t0].[Id]", // @@ -1577,7 +1577,7 @@ LEFT JOIN ( SELECT [e0].[Id], [e0].[CollectionInverseId], [e0].[ExtraId], [e0].[Name], [e0].[ReferenceInverseId], [j].[OneId] FROM [JoinOneToTwo] AS [j] INNER JOIN [EntityTwos] AS [e0] ON [j].[TwoId] = [e0].[Id] -) AS [t] ON ([e].[Id] = [t].[OneId]) AND ([e].[Id] <> [t].[Id])"); +) AS [t] ON [e].[Id] = [t].[OneId] AND [e].[Id] <> [t].[Id]"); } public override async Task Contains_on_skip_collection_navigation(bool async) @@ -1593,7 +1593,7 @@ WHERE EXISTS ( SELECT 1 FROM [JoinOneToTwo] AS [j] INNER JOIN [EntityTwos] AS [e0] ON [j].[TwoId] = [e0].[Id] - WHERE ([e].[Id] = [j].[OneId]) AND ([e0].[Id] = @__entity_equality_two_0_Id))"); + WHERE [e].[Id] = [j].[OneId] AND [e0].[Id] = @__entity_equality_two_0_Id)"); } private void AssertSql(params string[] expected) diff --git a/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindAggregateOperatorsQuerySqlServerTest.cs b/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindAggregateOperatorsQuerySqlServerTest.cs index 1432d62b34c..0446fcb1adc 100644 --- a/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindAggregateOperatorsQuerySqlServerTest.cs +++ b/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindAggregateOperatorsQuerySqlServerTest.cs @@ -254,7 +254,7 @@ public override async Task Min_no_data_subquery(bool async) @"SELECT ( SELECT MIN([o].[OrderID]) FROM [Orders] AS [o] - WHERE ([c].[CustomerID] = [o].[CustomerID]) AND ([o].[OrderID] = -1)) + WHERE [c].[CustomerID] = [o].[CustomerID] AND [o].[OrderID] = -1) FROM [Customers] AS [c]"); } @@ -296,7 +296,7 @@ public override async Task Max_no_data_subquery(bool async) @"SELECT ( SELECT MAX([o].[OrderID]) FROM [Orders] AS [o] - WHERE ([c].[CustomerID] = [o].[CustomerID]) AND ([o].[OrderID] = -1)) + WHERE [c].[CustomerID] = [o].[CustomerID] AND [o].[OrderID] = -1) FROM [Customers] AS [c]"); } @@ -338,7 +338,7 @@ public override async Task Average_no_data_subquery(bool async) @"SELECT ( SELECT AVG(CAST([o].[OrderID] AS float)) FROM [Orders] AS [o] - WHERE ([c].[CustomerID] = [o].[CustomerID]) AND ([o].[OrderID] = -1)) + WHERE [c].[CustomerID] = [o].[CustomerID] AND [o].[OrderID] = -1) FROM [Customers] AS [c]"); } @@ -542,7 +542,7 @@ public override async Task Select_All(bool async) WHEN NOT EXISTS ( SELECT 1 FROM [Orders] AS [o] - WHERE ([o].[CustomerID] <> N'ALFKI') OR [o].[CustomerID] IS NULL) THEN CAST(1 AS bit) + WHERE [o].[CustomerID] <> N'ALFKI' OR [o].[CustomerID] IS NULL) THEN CAST(1 AS bit) ELSE CAST(0 AS bit) END"); } @@ -1089,7 +1089,7 @@ public override async Task OrderBy_Where_Count_with_predicate(bool async) AssertSql( @"SELECT COUNT(*) FROM [Orders] AS [o] -WHERE ([o].[OrderID] > 10) AND (([o].[CustomerID] <> N'ALFKI') OR [o].[CustomerID] IS NULL)"); +WHERE [o].[OrderID] > 10 AND ([o].[CustomerID] <> N'ALFKI' OR [o].[CustomerID] IS NULL)"); } public override async Task Distinct(bool async) @@ -1200,10 +1200,10 @@ public override async Task FirstOrDefault_inside_subquery_gets_server_evaluated( 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].[CustomerID] = N'ALFKI') AND (( +WHERE [c].[CustomerID] = N'ALFKI' AND ( SELECT TOP(1) [o].[CustomerID] FROM [Orders] AS [o] - WHERE ([c].[CustomerID] = [o].[CustomerID]) AND ([o].[CustomerID] = N'ALFKI')) = N'ALFKI')"); + WHERE [c].[CustomerID] = [o].[CustomerID] AND [o].[CustomerID] = N'ALFKI') = N'ALFKI'"); } public override async Task Multiple_collection_navigation_with_FirstOrDefault_chained(bool async) @@ -1219,11 +1219,11 @@ FROM [Order Details] AS [o] WHERE EXISTS ( SELECT 1 FROM [Orders] AS [o0] - WHERE [c].[CustomerID] = [o0].[CustomerID]) AND (( + WHERE [c].[CustomerID] = [o0].[CustomerID]) AND ( SELECT TOP(1) [o1].[OrderID] FROM [Orders] AS [o1] WHERE [c].[CustomerID] = [o1].[CustomerID] - ORDER BY [o1].[OrderID]) = [o].[OrderID]) + ORDER BY [o1].[OrderID]) = [o].[OrderID] ORDER BY [o].[ProductID] ) AS [t] WHERE [c].[CustomerID] LIKE N'F%' @@ -1241,11 +1241,11 @@ FROM [Order Details] AS [o] WHERE EXISTS ( SELECT 1 FROM [Orders] AS [o0] - WHERE [c].[CustomerID] = [o0].[CustomerID]) AND (( + WHERE [c].[CustomerID] = [o0].[CustomerID]) AND ( SELECT TOP(1) [o1].[OrderID] FROM [Orders] AS [o1] WHERE [c].[CustomerID] = [o1].[CustomerID] - ORDER BY [o1].[OrderID]) = [o].[OrderID]) + ORDER BY [o1].[OrderID]) = [o].[OrderID] ORDER BY [o].[ProductID]) FROM [Customers] AS [c] WHERE [c].[CustomerID] LIKE N'A%' @@ -1259,10 +1259,10 @@ public override async Task First_inside_subquery_gets_client_evaluated(bool asyn 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].[CustomerID] = N'ALFKI') AND (( +WHERE [c].[CustomerID] = N'ALFKI' AND ( SELECT TOP(1) [o].[CustomerID] FROM [Orders] AS [o] - WHERE ([c].[CustomerID] = [o].[CustomerID]) AND ([o].[CustomerID] = N'ALFKI')) = N'ALFKI')"); + WHERE [c].[CustomerID] = [o].[CustomerID] AND [o].[CustomerID] = N'ALFKI') = N'ALFKI'"); } public override async Task Last(bool async) @@ -1366,14 +1366,14 @@ FROM [Customers] AS [c] WHERE EXISTS ( SELECT 1 FROM [Customers] AS [c0] - WHERE [c0].[City] IN (N'London', N'Buenos Aires') AND ([c0].[CustomerID] = [c].[CustomerID]))", + WHERE [c0].[City] IN (N'London', N'Buenos Aires') AND [c0].[CustomerID] = [c].[CustomerID])", // @"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 EXISTS ( SELECT 1 FROM [Customers] AS [c0] - WHERE ([c0].[City] = N'London') AND ([c0].[CustomerID] = [c].[CustomerID]))"); + WHERE [c0].[City] = N'London' AND [c0].[CustomerID] = [c].[CustomerID])"); } public override async Task Contains_with_local_uint_array_closure(bool async) @@ -1698,7 +1698,7 @@ SELECT CASE WHEN EXISTS ( SELECT 1 FROM [Orders] AS [o] - WHERE ([o].[CustomerID] = N'VINET') AND ([o].[OrderID] = @__entity_equality_p_0_OrderID)) THEN CAST(1 AS bit) + WHERE [o].[CustomerID] = N'VINET' AND [o].[OrderID] = @__entity_equality_p_0_OrderID) THEN CAST(1 AS bit) ELSE CAST(0 AS bit) END"); } @@ -1715,7 +1715,7 @@ FROM [Customers] AS [c] WHERE EXISTS ( SELECT 1 FROM [Orders] AS [o] - WHERE ([c].[CustomerID] = [o].[CustomerID]) AND ([o].[OrderID] = @__entity_equality_someOrder_0_OrderID))"); + WHERE [c].[CustomerID] = [o].[CustomerID] AND [o].[OrderID] = @__entity_equality_someOrder_0_OrderID)"); } public override async Task List_Contains_with_constant_list(bool async) @@ -1836,7 +1836,7 @@ FROM [Orders] AS [o] WHERE EXISTS ( SELECT 1 FROM [Orders] AS [o0] - WHERE ([o0].[CustomerID] = N'VINET') AND [o0].[CustomerID] IS NULL)"); + WHERE [o0].[CustomerID] = N'VINET' AND [o0].[CustomerID] IS NULL)"); } public override async Task Contains_over_entityType_with_null_should_rewrite_to_identity_equality_subquery_negated(bool async) @@ -1849,7 +1849,7 @@ FROM [Orders] AS [o] WHERE NOT (EXISTS ( SELECT 1 FROM [Orders] AS [o0] - WHERE ([o0].[CustomerID] = N'VINET') AND [o0].[CustomerID] IS NULL))"); + WHERE [o0].[CustomerID] = N'VINET' AND [o0].[CustomerID] IS NULL))"); } public override async Task Contains_over_entityType_with_null_should_rewrite_to_identity_equality_subquery_complex(bool async) @@ -1863,13 +1863,13 @@ WHERE CASE WHEN EXISTS ( SELECT 1 FROM [Orders] AS [o0] - WHERE ([o0].[CustomerID] = N'VINET') AND [o0].[CustomerID] IS NULL) THEN CAST(1 AS bit) + WHERE [o0].[CustomerID] = N'VINET' AND [o0].[CustomerID] IS NULL) THEN CAST(1 AS bit) ELSE CAST(0 AS bit) END = CASE WHEN EXISTS ( SELECT 1 FROM [Orders] AS [o1] - WHERE (([o1].[CustomerID] <> N'VINET') OR [o1].[CustomerID] IS NULL) AND [o1].[CustomerID] IS NULL) THEN CAST(1 AS bit) + WHERE ([o1].[CustomerID] <> N'VINET' OR [o1].[CustomerID] IS NULL) AND [o1].[CustomerID] IS NULL) THEN CAST(1 AS bit) ELSE CAST(0 AS bit) END"); } @@ -1883,7 +1883,7 @@ public override async Task Contains_over_nullable_scalar_with_null_in_subquery_t WHEN EXISTS ( SELECT 1 FROM [Orders] AS [o0] - WHERE ([o0].[CustomerID] = N'VINET') AND [o0].[CustomerID] IS NULL) THEN CAST(1 AS bit) + WHERE [o0].[CustomerID] = N'VINET' AND [o0].[CustomerID] IS NULL) THEN CAST(1 AS bit) ELSE CAST(0 AS bit) END FROM [Orders] AS [o]"); @@ -1905,10 +1905,10 @@ public override async Task Contains_over_entityType_should_materialize_when_comp AssertSql( @"SELECT [o].[OrderID], [o].[ProductID], [o].[Discount], [o].[Quantity], [o].[UnitPrice] FROM [Order Details] AS [o] -WHERE ([o].[ProductID] = 42) AND EXISTS ( +WHERE [o].[ProductID] = 42 AND EXISTS ( SELECT 1 FROM [Order Details] AS [o0] - WHERE ([o0].[OrderID] = [o].[OrderID]) AND ([o0].[ProductID] = [o].[ProductID]))"); + WHERE [o0].[OrderID] = [o].[OrderID] AND [o0].[ProductID] = [o].[ProductID])"); } public override async Task Contains_over_entityType_should_materialize_when_composite2(bool async) @@ -1918,10 +1918,10 @@ public override async Task Contains_over_entityType_should_materialize_when_comp AssertSql( @"SELECT [o].[OrderID], [o].[ProductID], [o].[Discount], [o].[Quantity], [o].[UnitPrice] FROM [Order Details] AS [o] -WHERE ([o].[ProductID] = 42) AND EXISTS ( +WHERE [o].[ProductID] = 42 AND EXISTS ( SELECT 1 FROM [Order Details] AS [o0] - WHERE ([o0].[OrderID] > 42) AND (([o0].[OrderID] = [o].[OrderID]) AND ([o0].[ProductID] = [o].[ProductID])))"); + WHERE [o0].[OrderID] > 42 AND [o0].[OrderID] = [o].[OrderID] AND [o0].[ProductID] = [o].[ProductID])"); } public override async Task String_FirstOrDefault_in_projection_does_not_do_client_eval(bool async) @@ -1979,11 +1979,11 @@ public override async Task Where_subquery_where_any(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'México D.F.') AND [c].[CustomerID] IN (N'ABCDE', N'ALFKI', N'ANATR')", +WHERE [c].[City] = N'México D.F.' AND [c].[CustomerID] IN (N'ABCDE', N'ALFKI', N'ANATR')", // @"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'México D.F.') AND [c].[CustomerID] IN (N'ABCDE', N'ALFKI', N'ANATR')"); +WHERE [c].[City] = N'México D.F.' AND [c].[CustomerID] IN (N'ABCDE', N'ALFKI', N'ANATR')"); } public override async Task Where_subquery_all_not_equals_operator(bool async) @@ -2023,11 +2023,11 @@ public override async Task Where_subquery_where_all(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'México D.F.') AND [c].[CustomerID] NOT IN (N'ABCDE', N'ALFKI', N'ANATR')", +WHERE [c].[City] = N'México D.F.' AND [c].[CustomerID] NOT IN (N'ABCDE', N'ALFKI', N'ANATR')", // @"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'México D.F.') AND [c].[CustomerID] NOT IN (N'ABCDE', N'ALFKI', N'ANATR')"); +WHERE [c].[City] = N'México D.F.' AND [c].[CustomerID] NOT IN (N'ABCDE', N'ALFKI', N'ANATR')"); } public override async Task Cast_to_same_Type_Count_works(bool async) @@ -2070,11 +2070,11 @@ public override async Task Collection_Last_member_access_in_projection_translate 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].[CustomerID] LIKE N'F%') AND (( +WHERE ([c].[CustomerID] LIKE N'F%') AND ( SELECT TOP(1) [o].[CustomerID] FROM [Orders] AS [o] WHERE [c].[CustomerID] = [o].[CustomerID] - ORDER BY [o].[OrderID]) = [c].[CustomerID])"); + ORDER BY [o].[OrderID]) = [c].[CustomerID]"); } public override async Task Collection_LastOrDefault_member_access_in_projection_translated(bool async) @@ -2084,11 +2084,11 @@ public override async Task Collection_LastOrDefault_member_access_in_projection_ 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].[CustomerID] LIKE N'F%') AND (( +WHERE ([c].[CustomerID] LIKE N'F%') AND ( SELECT TOP(1) [o].[CustomerID] FROM [Orders] AS [o] WHERE [c].[CustomerID] = [o].[CustomerID] - ORDER BY [o].[OrderID]) = [c].[CustomerID])"); + ORDER BY [o].[OrderID]) = [c].[CustomerID]"); } public override async Task Sum_over_explicit_cast_over_column(bool async) diff --git a/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindCompiledQuerySqlServerTest.cs b/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindCompiledQuerySqlServerTest.cs index 4a84ceb1aac..cf886b4eb88 100644 --- a/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindCompiledQuerySqlServerTest.cs +++ b/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindCompiledQuerySqlServerTest.cs @@ -208,7 +208,7 @@ public override async Task Compiled_query_with_max_parameters() 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].[CustomerID] = @__s1) OR ([c].[CustomerID] = @__s2)) OR ([c].[CustomerID] = @__s3)) OR ([c].[CustomerID] = @__s4)) OR ([c].[CustomerID] = @__s5)) OR ([c].[CustomerID] = @__s6)) OR ([c].[CustomerID] = @__s7)) OR ([c].[CustomerID] = @__s8)) OR ([c].[CustomerID] = @__s9)) OR ([c].[CustomerID] = @__s10)) OR ([c].[CustomerID] = @__s11)) OR ([c].[CustomerID] = @__s12)) OR ([c].[CustomerID] = @__s13)) OR ([c].[CustomerID] = @__s14)) OR ([c].[CustomerID] = @__s15)", +WHERE [c].[CustomerID] = @__s1 OR [c].[CustomerID] = @__s2 OR [c].[CustomerID] = @__s3 OR [c].[CustomerID] = @__s4 OR [c].[CustomerID] = @__s5 OR [c].[CustomerID] = @__s6 OR [c].[CustomerID] = @__s7 OR [c].[CustomerID] = @__s8 OR [c].[CustomerID] = @__s9 OR [c].[CustomerID] = @__s10 OR [c].[CustomerID] = @__s11 OR [c].[CustomerID] = @__s12 OR [c].[CustomerID] = @__s13 OR [c].[CustomerID] = @__s14 OR [c].[CustomerID] = @__s15", // @"@__s1='ALFKI' (Size = 5) (DbType = StringFixedLength) @__s2='ANATR' (Size = 5) (DbType = StringFixedLength) @@ -229,7 +229,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], [o].[OrderID], [o].[CustomerID], [o].[EmployeeID], [o].[OrderDate] FROM [Customers] AS [c] LEFT JOIN [Orders] AS [o] ON [c].[CustomerID] = [o].[CustomerID] -WHERE (((((((((((((([c].[CustomerID] = @__s1) OR ([c].[CustomerID] = @__s2)) OR ([c].[CustomerID] = @__s3)) OR ([c].[CustomerID] = @__s4)) OR ([c].[CustomerID] = @__s5)) OR ([c].[CustomerID] = @__s6)) OR ([c].[CustomerID] = @__s7)) OR ([c].[CustomerID] = @__s8)) OR ([c].[CustomerID] = @__s9)) OR ([c].[CustomerID] = @__s10)) OR ([c].[CustomerID] = @__s11)) OR ([c].[CustomerID] = @__s12)) OR ([c].[CustomerID] = @__s13)) OR ([c].[CustomerID] = @__s14)) OR ([c].[CustomerID] = @__s15) +WHERE [c].[CustomerID] = @__s1 OR [c].[CustomerID] = @__s2 OR [c].[CustomerID] = @__s3 OR [c].[CustomerID] = @__s4 OR [c].[CustomerID] = @__s5 OR [c].[CustomerID] = @__s6 OR [c].[CustomerID] = @__s7 OR [c].[CustomerID] = @__s8 OR [c].[CustomerID] = @__s9 OR [c].[CustomerID] = @__s10 OR [c].[CustomerID] = @__s11 OR [c].[CustomerID] = @__s12 OR [c].[CustomerID] = @__s13 OR [c].[CustomerID] = @__s14 OR [c].[CustomerID] = @__s15 ORDER BY [c].[CustomerID]", // @"@__s1='ALFKI' (Size = 5) (DbType = StringFixedLength) @@ -250,7 +250,7 @@ FROM [Customers] AS [c] SELECT COUNT(*) FROM [Customers] AS [c] -WHERE (((((((((((((([c].[CustomerID] = @__s1) OR ([c].[CustomerID] = @__s2)) OR ([c].[CustomerID] = @__s3)) OR ([c].[CustomerID] = @__s4)) OR ([c].[CustomerID] = @__s5)) OR ([c].[CustomerID] = @__s6)) OR ([c].[CustomerID] = @__s7)) OR ([c].[CustomerID] = @__s8)) OR ([c].[CustomerID] = @__s9)) OR ([c].[CustomerID] = @__s10)) OR ([c].[CustomerID] = @__s11)) OR ([c].[CustomerID] = @__s12)) OR ([c].[CustomerID] = @__s13)) OR ([c].[CustomerID] = @__s14)) OR ([c].[CustomerID] = @__s15)", +WHERE [c].[CustomerID] = @__s1 OR [c].[CustomerID] = @__s2 OR [c].[CustomerID] = @__s3 OR [c].[CustomerID] = @__s4 OR [c].[CustomerID] = @__s5 OR [c].[CustomerID] = @__s6 OR [c].[CustomerID] = @__s7 OR [c].[CustomerID] = @__s8 OR [c].[CustomerID] = @__s9 OR [c].[CustomerID] = @__s10 OR [c].[CustomerID] = @__s11 OR [c].[CustomerID] = @__s12 OR [c].[CustomerID] = @__s13 OR [c].[CustomerID] = @__s14 OR [c].[CustomerID] = @__s15", // @"@__s1='ALFKI' (Size = 5) (DbType = StringFixedLength) @__s2='ANATR' (Size = 5) (DbType = StringFixedLength) @@ -270,7 +270,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].[CustomerID] = @__s1) OR ([c].[CustomerID] = @__s2)) OR ([c].[CustomerID] = @__s3)) OR ([c].[CustomerID] = @__s4)) OR ([c].[CustomerID] = @__s5)) OR ([c].[CustomerID] = @__s6)) OR ([c].[CustomerID] = @__s7)) OR ([c].[CustomerID] = @__s8)) OR ([c].[CustomerID] = @__s9)) OR ([c].[CustomerID] = @__s10)) OR ([c].[CustomerID] = @__s11)) OR ([c].[CustomerID] = @__s12)) OR ([c].[CustomerID] = @__s13)) OR ([c].[CustomerID] = @__s14)) OR ([c].[CustomerID] = @__s15)", +WHERE [c].[CustomerID] = @__s1 OR [c].[CustomerID] = @__s2 OR [c].[CustomerID] = @__s3 OR [c].[CustomerID] = @__s4 OR [c].[CustomerID] = @__s5 OR [c].[CustomerID] = @__s6 OR [c].[CustomerID] = @__s7 OR [c].[CustomerID] = @__s8 OR [c].[CustomerID] = @__s9 OR [c].[CustomerID] = @__s10 OR [c].[CustomerID] = @__s11 OR [c].[CustomerID] = @__s12 OR [c].[CustomerID] = @__s13 OR [c].[CustomerID] = @__s14 OR [c].[CustomerID] = @__s15", // @"@__s1='ALFKI' (Size = 5) (DbType = StringFixedLength) @__s2='ANATR' (Size = 5) (DbType = StringFixedLength) @@ -291,7 +291,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], [o].[OrderID], [o].[CustomerID], [o].[EmployeeID], [o].[OrderDate] FROM [Customers] AS [c] LEFT JOIN [Orders] AS [o] ON [c].[CustomerID] = [o].[CustomerID] -WHERE (((((((((((((([c].[CustomerID] = @__s1) OR ([c].[CustomerID] = @__s2)) OR ([c].[CustomerID] = @__s3)) OR ([c].[CustomerID] = @__s4)) OR ([c].[CustomerID] = @__s5)) OR ([c].[CustomerID] = @__s6)) OR ([c].[CustomerID] = @__s7)) OR ([c].[CustomerID] = @__s8)) OR ([c].[CustomerID] = @__s9)) OR ([c].[CustomerID] = @__s10)) OR ([c].[CustomerID] = @__s11)) OR ([c].[CustomerID] = @__s12)) OR ([c].[CustomerID] = @__s13)) OR ([c].[CustomerID] = @__s14)) OR ([c].[CustomerID] = @__s15) +WHERE [c].[CustomerID] = @__s1 OR [c].[CustomerID] = @__s2 OR [c].[CustomerID] = @__s3 OR [c].[CustomerID] = @__s4 OR [c].[CustomerID] = @__s5 OR [c].[CustomerID] = @__s6 OR [c].[CustomerID] = @__s7 OR [c].[CustomerID] = @__s8 OR [c].[CustomerID] = @__s9 OR [c].[CustomerID] = @__s10 OR [c].[CustomerID] = @__s11 OR [c].[CustomerID] = @__s12 OR [c].[CustomerID] = @__s13 OR [c].[CustomerID] = @__s14 OR [c].[CustomerID] = @__s15 ORDER BY [c].[CustomerID]", // @"@__s1='ALFKI' (Size = 5) (DbType = StringFixedLength) @@ -312,7 +312,7 @@ FROM [Customers] AS [c] SELECT COUNT(*) FROM [Customers] AS [c] -WHERE (((((((((((((([c].[CustomerID] = @__s1) OR ([c].[CustomerID] = @__s2)) OR ([c].[CustomerID] = @__s3)) OR ([c].[CustomerID] = @__s4)) OR ([c].[CustomerID] = @__s5)) OR ([c].[CustomerID] = @__s6)) OR ([c].[CustomerID] = @__s7)) OR ([c].[CustomerID] = @__s8)) OR ([c].[CustomerID] = @__s9)) OR ([c].[CustomerID] = @__s10)) OR ([c].[CustomerID] = @__s11)) OR ([c].[CustomerID] = @__s12)) OR ([c].[CustomerID] = @__s13)) OR ([c].[CustomerID] = @__s14)) OR ([c].[CustomerID] = @__s15)", +WHERE [c].[CustomerID] = @__s1 OR [c].[CustomerID] = @__s2 OR [c].[CustomerID] = @__s3 OR [c].[CustomerID] = @__s4 OR [c].[CustomerID] = @__s5 OR [c].[CustomerID] = @__s6 OR [c].[CustomerID] = @__s7 OR [c].[CustomerID] = @__s8 OR [c].[CustomerID] = @__s9 OR [c].[CustomerID] = @__s10 OR [c].[CustomerID] = @__s11 OR [c].[CustomerID] = @__s12 OR [c].[CustomerID] = @__s13 OR [c].[CustomerID] = @__s14 OR [c].[CustomerID] = @__s15", // @"@__s1='ALFKI' (Size = 5) (DbType = StringFixedLength) @__s2='ANATR' (Size = 5) (DbType = StringFixedLength) @@ -331,7 +331,7 @@ FROM [Customers] AS [c] SELECT COUNT(*) FROM [Customers] AS [c] -WHERE ((((((((((((([c].[CustomerID] = @__s1) OR ([c].[CustomerID] = @__s2)) OR ([c].[CustomerID] = @__s3)) OR ([c].[CustomerID] = @__s4)) OR ([c].[CustomerID] = @__s5)) OR ([c].[CustomerID] = @__s6)) OR ([c].[CustomerID] = @__s7)) OR ([c].[CustomerID] = @__s8)) OR ([c].[CustomerID] = @__s9)) OR ([c].[CustomerID] = @__s10)) OR ([c].[CustomerID] = @__s11)) OR ([c].[CustomerID] = @__s12)) OR ([c].[CustomerID] = @__s13)) OR ([c].[CustomerID] = @__s14)"); +WHERE [c].[CustomerID] = @__s1 OR [c].[CustomerID] = @__s2 OR [c].[CustomerID] = @__s3 OR [c].[CustomerID] = @__s4 OR [c].[CustomerID] = @__s5 OR [c].[CustomerID] = @__s6 OR [c].[CustomerID] = @__s7 OR [c].[CustomerID] = @__s8 OR [c].[CustomerID] = @__s9 OR [c].[CustomerID] = @__s10 OR [c].[CustomerID] = @__s11 OR [c].[CustomerID] = @__s12 OR [c].[CustomerID] = @__s13 OR [c].[CustomerID] = @__s14"); } public override void MakeBinary_does_not_throw_for_unsupported_operator() diff --git a/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindDbFunctionsQuerySqlServerTest.cs b/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindDbFunctionsQuerySqlServerTest.cs index 6864d304a54..bb9ecc397f7 100644 --- a/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindDbFunctionsQuerySqlServerTest.cs +++ b/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindDbFunctionsQuerySqlServerTest.cs @@ -248,7 +248,7 @@ public void FreeText_through_navigation() @"SELECT TOP(1) [e].[EmployeeID], [e].[City], [e].[Country], [e].[FirstName], [e].[ReportsTo], [e].[Title] FROM [Employees] AS [e] LEFT JOIN [Employees] AS [e0] ON [e].[ReportsTo] = [e0].[EmployeeID] -WHERE (FREETEXT([e0].[Title], N'President') AND FREETEXT([e].[Title], N'Inside')) AND ([e].[FirstName] LIKE N'%Lau%') +WHERE FREETEXT([e0].[Title], N'President') AND FREETEXT([e].[Title], N'Inside') AND ([e].[FirstName] LIKE N'%Lau%') ORDER BY [e].[EmployeeID] DESC"); } @@ -270,7 +270,7 @@ public void FreeText_through_navigation_with_language_terms() @"SELECT TOP(1) [e].[EmployeeID], [e].[City], [e].[Country], [e].[FirstName], [e].[ReportsTo], [e].[Title] FROM [Employees] AS [e] LEFT JOIN [Employees] AS [e0] ON [e].[ReportsTo] = [e0].[EmployeeID] -WHERE (FREETEXT([e0].[Title], N'President', LANGUAGE 1033) AND FREETEXT([e].[Title], N'Inside', LANGUAGE 1031)) AND ([e].[FirstName] LIKE N'%Lau%')"); +WHERE FREETEXT([e0].[Title], N'President', LANGUAGE 1033) AND FREETEXT([e].[Title], N'Inside', LANGUAGE 1031) AND ([e].[FirstName] LIKE N'%Lau%')"); } [ConditionalFact] diff --git a/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindFunctionsQuerySqlServerTest.cs b/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindFunctionsQuerySqlServerTest.cs index b47dc97c0e4..db8a3a8e87b 100644 --- a/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindFunctionsQuerySqlServerTest.cs +++ b/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindFunctionsQuerySqlServerTest.cs @@ -44,7 +44,7 @@ public override async Task String_StartsWith_Identity(bool async) AssertSql( @"SELECT [c].[CustomerID], [c].[Address], [c].[City], [c].[CompanyName], [c].[ContactName], [c].[ContactTitle], [c].[Country], [c].[Fax], [c].[Phone], [c].[PostalCode], [c].[Region] FROM [Customers] AS [c] -WHERE ([c].[ContactName] = N'') OR ([c].[ContactName] IS NOT NULL AND (LEFT([c].[ContactName], LEN([c].[ContactName])) = [c].[ContactName]))"); +WHERE [c].[ContactName] = N'' OR ([c].[ContactName] IS NOT NULL AND LEFT([c].[ContactName], LEN([c].[ContactName])) = [c].[ContactName])"); } public override async Task String_StartsWith_Column(bool async) @@ -54,7 +54,7 @@ public override async Task String_StartsWith_Column(bool async) AssertSql( @"SELECT [c].[CustomerID], [c].[Address], [c].[City], [c].[CompanyName], [c].[ContactName], [c].[ContactTitle], [c].[Country], [c].[Fax], [c].[Phone], [c].[PostalCode], [c].[Region] FROM [Customers] AS [c] -WHERE ([c].[ContactName] = N'') OR ([c].[ContactName] IS NOT NULL AND (LEFT([c].[ContactName], LEN([c].[ContactName])) = [c].[ContactName]))"); +WHERE [c].[ContactName] = N'' OR ([c].[ContactName] IS NOT NULL AND LEFT([c].[ContactName], LEN([c].[ContactName])) = [c].[ContactName])"); } public override async Task String_StartsWith_MethodCall(bool async) @@ -84,7 +84,7 @@ public override async Task String_EndsWith_Identity(bool async) AssertSql( @"SELECT [c].[CustomerID], [c].[Address], [c].[City], [c].[CompanyName], [c].[ContactName], [c].[ContactTitle], [c].[Country], [c].[Fax], [c].[Phone], [c].[PostalCode], [c].[Region] FROM [Customers] AS [c] -WHERE ([c].[ContactName] = N'') OR ([c].[ContactName] IS NOT NULL AND (RIGHT([c].[ContactName], LEN([c].[ContactName])) = [c].[ContactName]))"); +WHERE [c].[ContactName] = N'' OR ([c].[ContactName] IS NOT NULL AND RIGHT([c].[ContactName], LEN([c].[ContactName])) = [c].[ContactName])"); } public override async Task String_EndsWith_Column(bool async) @@ -94,7 +94,7 @@ public override async Task String_EndsWith_Column(bool async) AssertSql( @"SELECT [c].[CustomerID], [c].[Address], [c].[City], [c].[CompanyName], [c].[ContactName], [c].[ContactTitle], [c].[Country], [c].[Fax], [c].[Phone], [c].[PostalCode], [c].[Region] FROM [Customers] AS [c] -WHERE ([c].[ContactName] = N'') OR ([c].[ContactName] IS NOT NULL AND (RIGHT([c].[ContactName], LEN([c].[ContactName])) = [c].[ContactName]))"); +WHERE [c].[ContactName] = N'' OR ([c].[ContactName] IS NOT NULL AND RIGHT([c].[ContactName], LEN([c].[ContactName])) = [c].[ContactName])"); } public override async Task String_EndsWith_MethodCall(bool async) @@ -128,7 +128,7 @@ public override async Task String_Contains_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] LIKE N'') OR (CHARINDEX([c].[ContactName], [c].[ContactName]) > 0)"); +WHERE ([c].[ContactName] LIKE N'') OR CHARINDEX([c].[ContactName], [c].[ContactName]) > 0"); } public override async Task String_Contains_Column(bool async) @@ -138,7 +138,7 @@ public override async Task String_Contains_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] LIKE N'') OR (CHARINDEX([c].[ContactName], [c].[ContactName]) > 0)"); +WHERE ([c].[ContactName] LIKE N'') OR CHARINDEX([c].[ContactName], [c].[ContactName]) > 0"); } public override async Task String_Contains_constant_with_whitespace(bool async) @@ -160,7 +160,7 @@ public override async Task String_Contains_parameter_with_whitespace(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 (@__pattern_0 LIKE N'') OR (CHARINDEX(@__pattern_0, [c].[ContactName]) > 0)"); +WHERE (@__pattern_0 LIKE N'') OR CHARINDEX(@__pattern_0, [c].[ContactName]) > 0"); } public override async Task String_FirstOrDefault_MethodCall(bool async) @@ -366,11 +366,11 @@ public override async Task String_Compare_multi_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].[CustomerID] >= N'ALFKI') AND ([c].[CustomerID] < N'CACTU')", +WHERE [c].[CustomerID] >= N'ALFKI' AND [c].[CustomerID] < N'CACTU'", // @"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) @@ -542,11 +542,11 @@ public override async Task String_Compare_to_multi_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].[CustomerID] >= N'ALFKI') AND ([c].[CustomerID] < N'CACTU')", +WHERE [c].[CustomerID] >= N'ALFKI' AND [c].[CustomerID] < N'CACTU'", // @"SELECT [c].[CustomerID], [c].[Address], [c].[City], [c].[CompanyName], [c].[ContactName], [c].[ContactTitle], [c].[Country], [c].[Fax], [c].[Phone], [c].[PostalCode], [c].[Region] FROM [Customers] AS [c] -WHERE ([c].[ContactTitle] = N'Owner') AND (([c].[Country] <> N'USA') OR [c].[Country] IS NULL)"); +WHERE [c].[ContactTitle] = N'Owner' AND ([c].[Country] <> N'USA' OR [c].[Country] IS NULL)"); } public override async Task DateTime_Compare_to_simple_zero(bool async, bool compareTo) @@ -564,7 +564,7 @@ FROM [Orders] AS [o] SELECT [o].[OrderID], [o].[CustomerID], [o].[EmployeeID], [o].[OrderDate] FROM [Orders] AS [o] -WHERE ([o].[OrderDate] <> @__myDatetime_0) OR [o].[OrderDate] IS NULL", +WHERE [o].[OrderDate] <> @__myDatetime_0 OR [o].[OrderDate] IS NULL", // @"@__myDatetime_0='1998-05-04T00:00:00.0000000' (DbType = DateTime) @@ -650,7 +650,7 @@ public override async Task Where_math_abs2(bool async) AssertSql( @"SELECT [o].[OrderID], [o].[ProductID], [o].[Discount], [o].[Quantity], [o].[UnitPrice] FROM [Order Details] AS [o] -WHERE ([o].[UnitPrice] < 7.0) AND (ABS([o].[Quantity]) > CAST(10 AS smallint))"); +WHERE [o].[UnitPrice] < 7.0 AND ABS([o].[Quantity]) > CAST(10 AS smallint)"); } public override async Task Where_math_abs3(bool async) @@ -660,7 +660,7 @@ public override async Task Where_math_abs3(bool async) AssertSql( @"SELECT [o].[OrderID], [o].[ProductID], [o].[Discount], [o].[Quantity], [o].[UnitPrice] FROM [Order Details] AS [o] -WHERE ([o].[Quantity] < CAST(5 AS smallint)) AND (ABS([o].[UnitPrice]) > 10.0)"); +WHERE [o].[Quantity] < CAST(5 AS smallint) AND ABS([o].[UnitPrice]) > 10.0"); } public override async Task Where_math_abs_uncorrelated(bool async) @@ -670,7 +670,7 @@ public override async Task Where_math_abs_uncorrelated(bool async) AssertSql( @"SELECT [o].[OrderID], [o].[ProductID], [o].[Discount], [o].[Quantity], [o].[UnitPrice] FROM [Order Details] AS [o] -WHERE ([o].[UnitPrice] < 7.0) AND (10 < [o].[ProductID])"); +WHERE [o].[UnitPrice] < 7.0 AND 10 < [o].[ProductID]"); } public override async Task Where_math_ceiling1(bool async) @@ -680,7 +680,7 @@ public override async Task Where_math_ceiling1(bool async) AssertSql( @"SELECT [o].[OrderID], [o].[ProductID], [o].[Discount], [o].[Quantity], [o].[UnitPrice] FROM [Order Details] AS [o] -WHERE ([o].[UnitPrice] < 7.0) AND (CEILING(CAST([o].[Discount] AS float)) > 0.0E0)"); +WHERE [o].[UnitPrice] < 7.0 AND CEILING(CAST([o].[Discount] AS float)) > 0.0E0"); } public override async Task Where_math_ceiling2(bool async) @@ -690,7 +690,7 @@ public override async Task Where_math_ceiling2(bool async) AssertSql( @"SELECT [o].[OrderID], [o].[ProductID], [o].[Discount], [o].[Quantity], [o].[UnitPrice] FROM [Order Details] AS [o] -WHERE ([o].[Quantity] < CAST(5 AS smallint)) AND (CEILING([o].[UnitPrice]) > 10.0)"); +WHERE [o].[Quantity] < CAST(5 AS smallint) AND CEILING([o].[UnitPrice]) > 10.0"); } public override async Task Where_math_floor(bool async) @@ -700,7 +700,7 @@ public override async Task Where_math_floor(bool async) AssertSql( @"SELECT [o].[OrderID], [o].[ProductID], [o].[Discount], [o].[Quantity], [o].[UnitPrice] FROM [Order Details] AS [o] -WHERE ([o].[Quantity] < CAST(5 AS smallint)) AND (FLOOR([o].[UnitPrice]) > 10.0)"); +WHERE [o].[Quantity] < CAST(5 AS smallint) AND FLOOR([o].[UnitPrice]) > 10.0"); } public override async Task Where_math_power(bool async) @@ -731,7 +731,7 @@ public override async Task Where_math_round(bool async) AssertSql( @"SELECT [o].[OrderID], [o].[ProductID], [o].[Discount], [o].[Quantity], [o].[UnitPrice] FROM [Order Details] AS [o] -WHERE ([o].[Quantity] < CAST(5 AS smallint)) AND (ROUND([o].[UnitPrice], 0) > 10.0)"); +WHERE [o].[Quantity] < CAST(5 AS smallint) AND ROUND([o].[UnitPrice], 0) > 10.0"); } public override async Task Select_math_round_int(bool async) @@ -771,7 +771,7 @@ public override async Task Where_math_truncate(bool async) AssertSql( @"SELECT [o].[OrderID], [o].[ProductID], [o].[Discount], [o].[Quantity], [o].[UnitPrice] FROM [Order Details] AS [o] -WHERE ([o].[Quantity] < CAST(5 AS smallint)) AND (ROUND([o].[UnitPrice], 0, 1) > 10.0)"); +WHERE [o].[Quantity] < CAST(5 AS smallint) AND ROUND([o].[UnitPrice], 0, 1) > 10.0"); } public override async Task Where_math_exp(bool async) @@ -781,7 +781,7 @@ public override async Task Where_math_exp(bool async) AssertSql( @"SELECT [o].[OrderID], [o].[ProductID], [o].[Discount], [o].[Quantity], [o].[UnitPrice] FROM [Order Details] AS [o] -WHERE ([o].[OrderID] = 11077) AND (EXP(CAST([o].[Discount] AS float)) > 1.0E0)"); +WHERE [o].[OrderID] = 11077 AND EXP(CAST([o].[Discount] AS float)) > 1.0E0"); } public override async Task Where_math_log10(bool async) @@ -791,7 +791,7 @@ public override async Task Where_math_log10(bool async) AssertSql( @"SELECT [o].[OrderID], [o].[ProductID], [o].[Discount], [o].[Quantity], [o].[UnitPrice] FROM [Order Details] AS [o] -WHERE (([o].[OrderID] = 11077) AND ([o].[Discount] > CAST(0 AS real))) AND (LOG10(CAST([o].[Discount] AS float)) < 0.0E0)"); +WHERE [o].[OrderID] = 11077 AND [o].[Discount] > CAST(0 AS real) AND LOG10(CAST([o].[Discount] AS float)) < 0.0E0"); } public override async Task Where_math_log(bool async) @@ -801,7 +801,7 @@ public override async Task Where_math_log(bool async) AssertSql( @"SELECT [o].[OrderID], [o].[ProductID], [o].[Discount], [o].[Quantity], [o].[UnitPrice] FROM [Order Details] AS [o] -WHERE (([o].[OrderID] = 11077) AND ([o].[Discount] > CAST(0 AS real))) AND (LOG(CAST([o].[Discount] AS float)) < 0.0E0)"); +WHERE [o].[OrderID] = 11077 AND [o].[Discount] > CAST(0 AS real) AND LOG(CAST([o].[Discount] AS float)) < 0.0E0"); } public override async Task Where_math_log_new_base(bool async) @@ -811,7 +811,7 @@ public override async Task Where_math_log_new_base(bool async) AssertSql( @"SELECT [o].[OrderID], [o].[ProductID], [o].[Discount], [o].[Quantity], [o].[UnitPrice] FROM [Order Details] AS [o] -WHERE (([o].[OrderID] = 11077) AND ([o].[Discount] > CAST(0 AS real))) AND (LOG(CAST([o].[Discount] AS float), 7.0E0) < 0.0E0)"); +WHERE [o].[OrderID] = 11077 AND [o].[Discount] > CAST(0 AS real) AND LOG(CAST([o].[Discount] AS float), 7.0E0) < 0.0E0"); } public override async Task Where_math_sqrt(bool async) @@ -821,7 +821,7 @@ public override async Task Where_math_sqrt(bool async) AssertSql( @"SELECT [o].[OrderID], [o].[ProductID], [o].[Discount], [o].[Quantity], [o].[UnitPrice] FROM [Order Details] AS [o] -WHERE ([o].[OrderID] = 11077) AND (SQRT(CAST([o].[Discount] AS float)) > 0.0E0)"); +WHERE [o].[OrderID] = 11077 AND SQRT(CAST([o].[Discount] AS float)) > 0.0E0"); } public override async Task Where_math_acos(bool async) @@ -831,7 +831,7 @@ public override async Task Where_math_acos(bool async) AssertSql( @"SELECT [o].[OrderID], [o].[ProductID], [o].[Discount], [o].[Quantity], [o].[UnitPrice] FROM [Order Details] AS [o] -WHERE ([o].[OrderID] = 11077) AND (ACOS(CAST([o].[Discount] AS float)) > 1.0E0)"); +WHERE [o].[OrderID] = 11077 AND ACOS(CAST([o].[Discount] AS float)) > 1.0E0"); } public override async Task Where_math_asin(bool async) @@ -841,7 +841,7 @@ public override async Task Where_math_asin(bool async) AssertSql( @"SELECT [o].[OrderID], [o].[ProductID], [o].[Discount], [o].[Quantity], [o].[UnitPrice] FROM [Order Details] AS [o] -WHERE ([o].[OrderID] = 11077) AND (ASIN(CAST([o].[Discount] AS float)) > 0.0E0)"); +WHERE [o].[OrderID] = 11077 AND ASIN(CAST([o].[Discount] AS float)) > 0.0E0"); } public override async Task Where_math_atan(bool async) @@ -851,7 +851,7 @@ public override async Task Where_math_atan(bool async) AssertSql( @"SELECT [o].[OrderID], [o].[ProductID], [o].[Discount], [o].[Quantity], [o].[UnitPrice] FROM [Order Details] AS [o] -WHERE ([o].[OrderID] = 11077) AND (ATAN(CAST([o].[Discount] AS float)) > 0.0E0)"); +WHERE [o].[OrderID] = 11077 AND ATAN(CAST([o].[Discount] AS float)) > 0.0E0"); } public override async Task Where_math_atan2(bool async) @@ -861,7 +861,7 @@ public override async Task Where_math_atan2(bool async) AssertSql( @"SELECT [o].[OrderID], [o].[ProductID], [o].[Discount], [o].[Quantity], [o].[UnitPrice] FROM [Order Details] AS [o] -WHERE ([o].[OrderID] = 11077) AND (ATN2(CAST([o].[Discount] AS float), 1.0E0) > 0.0E0)"); +WHERE [o].[OrderID] = 11077 AND ATN2(CAST([o].[Discount] AS float), 1.0E0) > 0.0E0"); } public override async Task Where_math_cos(bool async) @@ -871,7 +871,7 @@ public override async Task Where_math_cos(bool async) AssertSql( @"SELECT [o].[OrderID], [o].[ProductID], [o].[Discount], [o].[Quantity], [o].[UnitPrice] FROM [Order Details] AS [o] -WHERE ([o].[OrderID] = 11077) AND (COS(CAST([o].[Discount] AS float)) > 0.0E0)"); +WHERE [o].[OrderID] = 11077 AND COS(CAST([o].[Discount] AS float)) > 0.0E0"); } public override async Task Where_math_sin(bool async) @@ -881,7 +881,7 @@ public override async Task Where_math_sin(bool async) AssertSql( @"SELECT [o].[OrderID], [o].[ProductID], [o].[Discount], [o].[Quantity], [o].[UnitPrice] FROM [Order Details] AS [o] -WHERE ([o].[OrderID] = 11077) AND (SIN(CAST([o].[Discount] AS float)) > 0.0E0)"); +WHERE [o].[OrderID] = 11077 AND SIN(CAST([o].[Discount] AS float)) > 0.0E0"); } public override async Task Where_math_tan(bool async) @@ -891,7 +891,7 @@ public override async Task Where_math_tan(bool async) AssertSql( @"SELECT [o].[OrderID], [o].[ProductID], [o].[Discount], [o].[Quantity], [o].[UnitPrice] FROM [Order Details] AS [o] -WHERE ([o].[OrderID] = 11077) AND (TAN(CAST([o].[Discount] AS float)) > 0.0E0)"); +WHERE [o].[OrderID] = 11077 AND TAN(CAST([o].[Discount] AS float)) > 0.0E0"); } public override async Task Where_math_sign(bool async) @@ -901,7 +901,7 @@ public override async Task Where_math_sign(bool async) AssertSql( @"SELECT [o].[OrderID], [o].[ProductID], [o].[Discount], [o].[Quantity], [o].[UnitPrice] FROM [Order Details] AS [o] -WHERE ([o].[OrderID] = 11077) AND (SIGN([o].[Discount]) > 0)"); +WHERE [o].[OrderID] = 11077 AND SIGN([o].[Discount]) > 0"); } [ConditionalTheory(Skip = "Issue#17328")] @@ -929,7 +929,7 @@ public override async Task Where_mathf_ceiling1(bool async) AssertSql( @"SELECT [o].[OrderID], [o].[ProductID], [o].[Discount], [o].[Quantity], [o].[UnitPrice] FROM [Order Details] AS [o] -WHERE ([o].[UnitPrice] < 7.0) AND (CEILING([o].[Discount]) > CAST(0 AS real))"); +WHERE [o].[UnitPrice] < 7.0 AND CEILING([o].[Discount]) > CAST(0 AS real)"); } public override async Task Where_mathf_floor(bool async) @@ -939,7 +939,7 @@ public override async Task Where_mathf_floor(bool async) AssertSql( @"SELECT [o].[OrderID], [o].[ProductID], [o].[Discount], [o].[Quantity], [o].[UnitPrice] FROM [Order Details] AS [o] -WHERE ([o].[Quantity] < CAST(5 AS smallint)) AND (FLOOR(CAST([o].[UnitPrice] AS real)) > CAST(10 AS real))"); +WHERE [o].[Quantity] < CAST(5 AS smallint) AND FLOOR(CAST([o].[UnitPrice] AS real)) > CAST(10 AS real)"); } public override async Task Where_mathf_power(bool async) @@ -999,7 +999,7 @@ public override async Task Where_mathf_truncate(bool async) AssertSql( @"SELECT [o].[OrderID], [o].[ProductID], [o].[Discount], [o].[Quantity], [o].[UnitPrice] FROM [Order Details] AS [o] -WHERE ([o].[Quantity] < CAST(5 AS smallint)) AND (CAST(ROUND(CAST([o].[UnitPrice] AS real), 0, 1) AS real) > CAST(10 AS real))"); +WHERE [o].[Quantity] < CAST(5 AS smallint) AND CAST(ROUND(CAST([o].[UnitPrice] AS real), 0, 1) AS real) > CAST(10 AS real)"); } public override async Task Select_mathf_truncate(bool async) @@ -1019,7 +1019,7 @@ public override async Task Where_mathf_exp(bool async) AssertSql( @"SELECT [o].[OrderID], [o].[ProductID], [o].[Discount], [o].[Quantity], [o].[UnitPrice] FROM [Order Details] AS [o] -WHERE ([o].[OrderID] = 11077) AND (EXP([o].[Discount]) > CAST(1 AS real))"); +WHERE [o].[OrderID] = 11077 AND EXP([o].[Discount]) > CAST(1 AS real)"); } public override async Task Where_mathf_log10(bool async) @@ -1029,7 +1029,7 @@ public override async Task Where_mathf_log10(bool async) AssertSql( @"SELECT [o].[OrderID], [o].[ProductID], [o].[Discount], [o].[Quantity], [o].[UnitPrice] FROM [Order Details] AS [o] -WHERE (([o].[OrderID] = 11077) AND ([o].[Discount] > CAST(0 AS real))) AND (LOG10([o].[Discount]) < CAST(0 AS real))"); +WHERE [o].[OrderID] = 11077 AND [o].[Discount] > CAST(0 AS real) AND LOG10([o].[Discount]) < CAST(0 AS real)"); } public override async Task Where_mathf_log(bool async) @@ -1039,7 +1039,7 @@ public override async Task Where_mathf_log(bool async) AssertSql( @"SELECT [o].[OrderID], [o].[ProductID], [o].[Discount], [o].[Quantity], [o].[UnitPrice] FROM [Order Details] AS [o] -WHERE (([o].[OrderID] = 11077) AND ([o].[Discount] > CAST(0 AS real))) AND (LOG([o].[Discount]) < CAST(0 AS real))"); +WHERE [o].[OrderID] = 11077 AND [o].[Discount] > CAST(0 AS real) AND LOG([o].[Discount]) < CAST(0 AS real)"); } public override async Task Where_mathf_log_new_base(bool async) @@ -1049,7 +1049,7 @@ public override async Task Where_mathf_log_new_base(bool async) AssertSql( @"SELECT [o].[OrderID], [o].[ProductID], [o].[Discount], [o].[Quantity], [o].[UnitPrice] FROM [Order Details] AS [o] -WHERE (([o].[OrderID] = 11077) AND ([o].[Discount] > CAST(0 AS real))) AND (LOG([o].[Discount], CAST(7 AS real)) < CAST(0 AS real))"); +WHERE [o].[OrderID] = 11077 AND [o].[Discount] > CAST(0 AS real) AND LOG([o].[Discount], CAST(7 AS real)) < CAST(0 AS real)"); } public override async Task Where_mathf_sqrt(bool async) @@ -1059,7 +1059,7 @@ public override async Task Where_mathf_sqrt(bool async) AssertSql( @"SELECT [o].[OrderID], [o].[ProductID], [o].[Discount], [o].[Quantity], [o].[UnitPrice] FROM [Order Details] AS [o] -WHERE ([o].[OrderID] = 11077) AND (SQRT([o].[Discount]) > CAST(0 AS real))"); +WHERE [o].[OrderID] = 11077 AND SQRT([o].[Discount]) > CAST(0 AS real)"); } public override async Task Where_mathf_acos(bool async) @@ -1069,7 +1069,7 @@ public override async Task Where_mathf_acos(bool async) AssertSql( @"SELECT [o].[OrderID], [o].[ProductID], [o].[Discount], [o].[Quantity], [o].[UnitPrice] FROM [Order Details] AS [o] -WHERE ([o].[OrderID] = 11077) AND (ACOS([o].[Discount]) > CAST(1 AS real))"); +WHERE [o].[OrderID] = 11077 AND ACOS([o].[Discount]) > CAST(1 AS real)"); } public override async Task Where_mathf_asin(bool async) @@ -1079,7 +1079,7 @@ public override async Task Where_mathf_asin(bool async) AssertSql( @"SELECT [o].[OrderID], [o].[ProductID], [o].[Discount], [o].[Quantity], [o].[UnitPrice] FROM [Order Details] AS [o] -WHERE ([o].[OrderID] = 11077) AND (ASIN([o].[Discount]) > CAST(0 AS real))"); +WHERE [o].[OrderID] = 11077 AND ASIN([o].[Discount]) > CAST(0 AS real)"); } public override async Task Where_mathf_atan(bool async) @@ -1089,7 +1089,7 @@ public override async Task Where_mathf_atan(bool async) AssertSql( @"SELECT [o].[OrderID], [o].[ProductID], [o].[Discount], [o].[Quantity], [o].[UnitPrice] FROM [Order Details] AS [o] -WHERE ([o].[OrderID] = 11077) AND (ATAN([o].[Discount]) > CAST(0 AS real))"); +WHERE [o].[OrderID] = 11077 AND ATAN([o].[Discount]) > CAST(0 AS real)"); } public override async Task Where_mathf_atan2(bool async) @@ -1099,7 +1099,7 @@ public override async Task Where_mathf_atan2(bool async) AssertSql( @"SELECT [o].[OrderID], [o].[ProductID], [o].[Discount], [o].[Quantity], [o].[UnitPrice] FROM [Order Details] AS [o] -WHERE ([o].[OrderID] = 11077) AND (ATN2([o].[Discount], CAST(1 AS real)) > CAST(0 AS real))"); +WHERE [o].[OrderID] = 11077 AND ATN2([o].[Discount], CAST(1 AS real)) > CAST(0 AS real)"); } public override async Task Where_mathf_cos(bool async) @@ -1109,7 +1109,7 @@ public override async Task Where_mathf_cos(bool async) AssertSql( @"SELECT [o].[OrderID], [o].[ProductID], [o].[Discount], [o].[Quantity], [o].[UnitPrice] FROM [Order Details] AS [o] -WHERE ([o].[OrderID] = 11077) AND (COS([o].[Discount]) > CAST(0 AS real))"); +WHERE [o].[OrderID] = 11077 AND COS([o].[Discount]) > CAST(0 AS real)"); } public override async Task Where_mathf_sin(bool async) @@ -1119,7 +1119,7 @@ public override async Task Where_mathf_sin(bool async) AssertSql( @"SELECT [o].[OrderID], [o].[ProductID], [o].[Discount], [o].[Quantity], [o].[UnitPrice] FROM [Order Details] AS [o] -WHERE ([o].[OrderID] = 11077) AND (SIN([o].[Discount]) > CAST(0 AS real))"); +WHERE [o].[OrderID] = 11077 AND SIN([o].[Discount]) > CAST(0 AS real)"); } public override async Task Where_mathf_tan(bool async) @@ -1129,7 +1129,7 @@ public override async Task Where_mathf_tan(bool async) AssertSql( @"SELECT [o].[OrderID], [o].[ProductID], [o].[Discount], [o].[Quantity], [o].[UnitPrice] FROM [Order Details] AS [o] -WHERE ([o].[OrderID] = 11077) AND (TAN([o].[Discount]) > CAST(0 AS real))"); +WHERE [o].[OrderID] = 11077 AND TAN([o].[Discount]) > CAST(0 AS real)"); } public override async Task Where_mathf_sign(bool async) @@ -1139,7 +1139,7 @@ public override async Task Where_mathf_sign(bool async) AssertSql( @"SELECT [o].[OrderID], [o].[ProductID], [o].[Discount], [o].[Quantity], [o].[UnitPrice] FROM [Order Details] AS [o] -WHERE ([o].[OrderID] = 11077) AND (SIGN([o].[Discount]) > 0)"); +WHERE [o].[OrderID] = 11077 AND SIGN([o].[Discount]) > 0"); } public override async Task Where_guid_newguid(bool async) @@ -1189,35 +1189,35 @@ public override async Task Convert_ToBoolean(bool async) AssertSql( @"SELECT [o].[OrderID], [o].[CustomerID], [o].[EmployeeID], [o].[OrderDate] FROM [Orders] AS [o] -WHERE ([o].[CustomerID] = N'ALFKI') AND (CONVERT(bit, CONVERT(bit, [o].[OrderID] % 3)) = CAST(1 AS bit))", +WHERE [o].[CustomerID] = N'ALFKI' AND CONVERT(bit, CONVERT(bit, [o].[OrderID] % 3)) = CAST(1 AS bit)", // @"SELECT [o].[OrderID], [o].[CustomerID], [o].[EmployeeID], [o].[OrderDate] FROM [Orders] AS [o] -WHERE ([o].[CustomerID] = N'ALFKI') AND (CONVERT(bit, CONVERT(tinyint, [o].[OrderID] % 3)) = CAST(1 AS bit))", +WHERE [o].[CustomerID] = N'ALFKI' AND CONVERT(bit, CONVERT(tinyint, [o].[OrderID] % 3)) = CAST(1 AS bit)", // @"SELECT [o].[OrderID], [o].[CustomerID], [o].[EmployeeID], [o].[OrderDate] FROM [Orders] AS [o] -WHERE ([o].[CustomerID] = N'ALFKI') AND (CONVERT(bit, CONVERT(decimal(18, 2), [o].[OrderID] % 3)) = CAST(1 AS bit))", +WHERE [o].[CustomerID] = N'ALFKI' AND CONVERT(bit, CONVERT(decimal(18, 2), [o].[OrderID] % 3)) = CAST(1 AS bit)", // @"SELECT [o].[OrderID], [o].[CustomerID], [o].[EmployeeID], [o].[OrderDate] FROM [Orders] AS [o] -WHERE ([o].[CustomerID] = N'ALFKI') AND (CONVERT(bit, CONVERT(float, [o].[OrderID] % 3)) = CAST(1 AS bit))", +WHERE [o].[CustomerID] = N'ALFKI' AND CONVERT(bit, CONVERT(float, [o].[OrderID] % 3)) = CAST(1 AS bit)", // @"SELECT [o].[OrderID], [o].[CustomerID], [o].[EmployeeID], [o].[OrderDate] FROM [Orders] AS [o] -WHERE ([o].[CustomerID] = N'ALFKI') AND (CONVERT(bit, CAST(CONVERT(float, [o].[OrderID] % 3) AS real)) = CAST(1 AS bit))", +WHERE [o].[CustomerID] = N'ALFKI' AND CONVERT(bit, CAST(CONVERT(float, [o].[OrderID] % 3) AS real)) = CAST(1 AS bit)", // @"SELECT [o].[OrderID], [o].[CustomerID], [o].[EmployeeID], [o].[OrderDate] FROM [Orders] AS [o] -WHERE ([o].[CustomerID] = N'ALFKI') AND (CONVERT(bit, CONVERT(smallint, [o].[OrderID] % 3)) = CAST(1 AS bit))", +WHERE [o].[CustomerID] = N'ALFKI' AND CONVERT(bit, CONVERT(smallint, [o].[OrderID] % 3)) = CAST(1 AS bit)", // @"SELECT [o].[OrderID], [o].[CustomerID], [o].[EmployeeID], [o].[OrderDate] FROM [Orders] AS [o] -WHERE ([o].[CustomerID] = N'ALFKI') AND (CONVERT(bit, CONVERT(int, [o].[OrderID] % 3)) = CAST(1 AS bit))", +WHERE [o].[CustomerID] = N'ALFKI' AND CONVERT(bit, CONVERT(int, [o].[OrderID] % 3)) = CAST(1 AS bit)", // @"SELECT [o].[OrderID], [o].[CustomerID], [o].[EmployeeID], [o].[OrderDate] FROM [Orders] AS [o] -WHERE ([o].[CustomerID] = N'ALFKI') AND (CONVERT(bit, CONVERT(bigint, [o].[OrderID] % 3)) = CAST(1 AS bit))"); +WHERE [o].[CustomerID] = N'ALFKI' AND CONVERT(bit, CONVERT(bigint, [o].[OrderID] % 3)) = CAST(1 AS bit)"); } public override async Task Convert_ToByte(bool async) @@ -1227,39 +1227,39 @@ public override async Task Convert_ToByte(bool async) AssertSql( @"SELECT [o].[OrderID], [o].[CustomerID], [o].[EmployeeID], [o].[OrderDate] FROM [Orders] AS [o] -WHERE ([o].[CustomerID] = N'ALFKI') AND (CONVERT(tinyint, CONVERT(bit, [o].[OrderID] % 1)) >= CAST(0 AS tinyint))", +WHERE [o].[CustomerID] = N'ALFKI' AND CONVERT(tinyint, CONVERT(bit, [o].[OrderID] % 1)) >= CAST(0 AS tinyint)", // @"SELECT [o].[OrderID], [o].[CustomerID], [o].[EmployeeID], [o].[OrderDate] FROM [Orders] AS [o] -WHERE ([o].[CustomerID] = N'ALFKI') AND (CONVERT(tinyint, CONVERT(tinyint, [o].[OrderID] % 1)) >= CAST(0 AS tinyint))", +WHERE [o].[CustomerID] = N'ALFKI' AND CONVERT(tinyint, CONVERT(tinyint, [o].[OrderID] % 1)) >= CAST(0 AS tinyint)", // @"SELECT [o].[OrderID], [o].[CustomerID], [o].[EmployeeID], [o].[OrderDate] FROM [Orders] AS [o] -WHERE ([o].[CustomerID] = N'ALFKI') AND (CONVERT(tinyint, CONVERT(decimal(18, 2), [o].[OrderID] % 1)) >= CAST(0 AS tinyint))", +WHERE [o].[CustomerID] = N'ALFKI' AND CONVERT(tinyint, CONVERT(decimal(18, 2), [o].[OrderID] % 1)) >= CAST(0 AS tinyint)", // @"SELECT [o].[OrderID], [o].[CustomerID], [o].[EmployeeID], [o].[OrderDate] FROM [Orders] AS [o] -WHERE ([o].[CustomerID] = N'ALFKI') AND (CONVERT(tinyint, CONVERT(float, [o].[OrderID] % 1)) >= CAST(0 AS tinyint))", +WHERE [o].[CustomerID] = N'ALFKI' AND CONVERT(tinyint, CONVERT(float, [o].[OrderID] % 1)) >= CAST(0 AS tinyint)", // @"SELECT [o].[OrderID], [o].[CustomerID], [o].[EmployeeID], [o].[OrderDate] FROM [Orders] AS [o] -WHERE ([o].[CustomerID] = N'ALFKI') AND (CONVERT(tinyint, CAST(CONVERT(float, [o].[OrderID] % 1) AS real)) >= CAST(0 AS tinyint))", +WHERE [o].[CustomerID] = N'ALFKI' AND CONVERT(tinyint, CAST(CONVERT(float, [o].[OrderID] % 1) AS real)) >= CAST(0 AS tinyint)", // @"SELECT [o].[OrderID], [o].[CustomerID], [o].[EmployeeID], [o].[OrderDate] FROM [Orders] AS [o] -WHERE ([o].[CustomerID] = N'ALFKI') AND (CONVERT(tinyint, CONVERT(smallint, [o].[OrderID] % 1)) >= CAST(0 AS tinyint))", +WHERE [o].[CustomerID] = N'ALFKI' AND CONVERT(tinyint, CONVERT(smallint, [o].[OrderID] % 1)) >= CAST(0 AS tinyint)", // @"SELECT [o].[OrderID], [o].[CustomerID], [o].[EmployeeID], [o].[OrderDate] FROM [Orders] AS [o] -WHERE ([o].[CustomerID] = N'ALFKI') AND (CONVERT(tinyint, CONVERT(int, [o].[OrderID] % 1)) >= CAST(0 AS tinyint))", +WHERE [o].[CustomerID] = N'ALFKI' AND CONVERT(tinyint, CONVERT(int, [o].[OrderID] % 1)) >= CAST(0 AS tinyint)", // @"SELECT [o].[OrderID], [o].[CustomerID], [o].[EmployeeID], [o].[OrderDate] FROM [Orders] AS [o] -WHERE ([o].[CustomerID] = N'ALFKI') AND (CONVERT(tinyint, CONVERT(bigint, [o].[OrderID] % 1)) >= CAST(0 AS tinyint))", +WHERE [o].[CustomerID] = N'ALFKI' AND CONVERT(tinyint, CONVERT(bigint, [o].[OrderID] % 1)) >= CAST(0 AS tinyint)", // @"SELECT [o].[OrderID], [o].[CustomerID], [o].[EmployeeID], [o].[OrderDate] FROM [Orders] AS [o] -WHERE ([o].[CustomerID] = N'ALFKI') AND (CONVERT(tinyint, CONVERT(nvarchar(max), [o].[OrderID] % 1)) >= CAST(0 AS tinyint))"); +WHERE [o].[CustomerID] = N'ALFKI' AND CONVERT(tinyint, CONVERT(nvarchar(max), [o].[OrderID] % 1)) >= CAST(0 AS tinyint)"); } public override async Task Convert_ToDecimal(bool async) @@ -1269,39 +1269,39 @@ public override async Task Convert_ToDecimal(bool async) AssertSql( @"SELECT [o].[OrderID], [o].[CustomerID], [o].[EmployeeID], [o].[OrderDate] FROM [Orders] AS [o] -WHERE ([o].[CustomerID] = N'ALFKI') AND (CONVERT(decimal(18, 2), CONVERT(bit, [o].[OrderID] % 1)) >= 0.0)", +WHERE [o].[CustomerID] = N'ALFKI' AND CONVERT(decimal(18, 2), CONVERT(bit, [o].[OrderID] % 1)) >= 0.0", // @"SELECT [o].[OrderID], [o].[CustomerID], [o].[EmployeeID], [o].[OrderDate] FROM [Orders] AS [o] -WHERE ([o].[CustomerID] = N'ALFKI') AND (CONVERT(decimal(18, 2), CONVERT(tinyint, [o].[OrderID] % 1)) >= 0.0)", +WHERE [o].[CustomerID] = N'ALFKI' AND CONVERT(decimal(18, 2), CONVERT(tinyint, [o].[OrderID] % 1)) >= 0.0", // @"SELECT [o].[OrderID], [o].[CustomerID], [o].[EmployeeID], [o].[OrderDate] FROM [Orders] AS [o] -WHERE ([o].[CustomerID] = N'ALFKI') AND (CONVERT(decimal(18, 2), CONVERT(decimal(18, 2), [o].[OrderID] % 1)) >= 0.0)", +WHERE [o].[CustomerID] = N'ALFKI' AND CONVERT(decimal(18, 2), CONVERT(decimal(18, 2), [o].[OrderID] % 1)) >= 0.0", // @"SELECT [o].[OrderID], [o].[CustomerID], [o].[EmployeeID], [o].[OrderDate] FROM [Orders] AS [o] -WHERE ([o].[CustomerID] = N'ALFKI') AND (CONVERT(decimal(18, 2), CONVERT(float, [o].[OrderID] % 1)) >= 0.0)", +WHERE [o].[CustomerID] = N'ALFKI' AND CONVERT(decimal(18, 2), CONVERT(float, [o].[OrderID] % 1)) >= 0.0", // @"SELECT [o].[OrderID], [o].[CustomerID], [o].[EmployeeID], [o].[OrderDate] FROM [Orders] AS [o] -WHERE ([o].[CustomerID] = N'ALFKI') AND (CONVERT(decimal(18, 2), CAST(CONVERT(float, [o].[OrderID] % 1) AS real)) >= 0.0)", +WHERE [o].[CustomerID] = N'ALFKI' AND CONVERT(decimal(18, 2), CAST(CONVERT(float, [o].[OrderID] % 1) AS real)) >= 0.0", // @"SELECT [o].[OrderID], [o].[CustomerID], [o].[EmployeeID], [o].[OrderDate] FROM [Orders] AS [o] -WHERE ([o].[CustomerID] = N'ALFKI') AND (CONVERT(decimal(18, 2), CONVERT(smallint, [o].[OrderID] % 1)) >= 0.0)", +WHERE [o].[CustomerID] = N'ALFKI' AND CONVERT(decimal(18, 2), CONVERT(smallint, [o].[OrderID] % 1)) >= 0.0", // @"SELECT [o].[OrderID], [o].[CustomerID], [o].[EmployeeID], [o].[OrderDate] FROM [Orders] AS [o] -WHERE ([o].[CustomerID] = N'ALFKI') AND (CONVERT(decimal(18, 2), CONVERT(int, [o].[OrderID] % 1)) >= 0.0)", +WHERE [o].[CustomerID] = N'ALFKI' AND CONVERT(decimal(18, 2), CONVERT(int, [o].[OrderID] % 1)) >= 0.0", // @"SELECT [o].[OrderID], [o].[CustomerID], [o].[EmployeeID], [o].[OrderDate] FROM [Orders] AS [o] -WHERE ([o].[CustomerID] = N'ALFKI') AND (CONVERT(decimal(18, 2), CONVERT(bigint, [o].[OrderID] % 1)) >= 0.0)", +WHERE [o].[CustomerID] = N'ALFKI' AND CONVERT(decimal(18, 2), CONVERT(bigint, [o].[OrderID] % 1)) >= 0.0", // @"SELECT [o].[OrderID], [o].[CustomerID], [o].[EmployeeID], [o].[OrderDate] FROM [Orders] AS [o] -WHERE ([o].[CustomerID] = N'ALFKI') AND (CONVERT(decimal(18, 2), CONVERT(nvarchar(max), [o].[OrderID] % 1)) >= 0.0)"); +WHERE [o].[CustomerID] = N'ALFKI' AND CONVERT(decimal(18, 2), CONVERT(nvarchar(max), [o].[OrderID] % 1)) >= 0.0"); } public override async Task Convert_ToDouble(bool async) @@ -1311,39 +1311,39 @@ public override async Task Convert_ToDouble(bool async) AssertSql( @"SELECT [o].[OrderID], [o].[CustomerID], [o].[EmployeeID], [o].[OrderDate] FROM [Orders] AS [o] -WHERE ([o].[CustomerID] = N'ALFKI') AND (CONVERT(float, CONVERT(bit, [o].[OrderID] % 1)) >= 0.0E0)", +WHERE [o].[CustomerID] = N'ALFKI' AND CONVERT(float, CONVERT(bit, [o].[OrderID] % 1)) >= 0.0E0", // @"SELECT [o].[OrderID], [o].[CustomerID], [o].[EmployeeID], [o].[OrderDate] FROM [Orders] AS [o] -WHERE ([o].[CustomerID] = N'ALFKI') AND (CONVERT(float, CONVERT(tinyint, [o].[OrderID] % 1)) >= 0.0E0)", +WHERE [o].[CustomerID] = N'ALFKI' AND CONVERT(float, CONVERT(tinyint, [o].[OrderID] % 1)) >= 0.0E0", // @"SELECT [o].[OrderID], [o].[CustomerID], [o].[EmployeeID], [o].[OrderDate] FROM [Orders] AS [o] -WHERE ([o].[CustomerID] = N'ALFKI') AND (CONVERT(float, CONVERT(decimal(18, 2), [o].[OrderID] % 1)) >= 0.0E0)", +WHERE [o].[CustomerID] = N'ALFKI' AND CONVERT(float, CONVERT(decimal(18, 2), [o].[OrderID] % 1)) >= 0.0E0", // @"SELECT [o].[OrderID], [o].[CustomerID], [o].[EmployeeID], [o].[OrderDate] FROM [Orders] AS [o] -WHERE ([o].[CustomerID] = N'ALFKI') AND (CONVERT(float, CONVERT(float, [o].[OrderID] % 1)) >= 0.0E0)", +WHERE [o].[CustomerID] = N'ALFKI' AND CONVERT(float, CONVERT(float, [o].[OrderID] % 1)) >= 0.0E0", // @"SELECT [o].[OrderID], [o].[CustomerID], [o].[EmployeeID], [o].[OrderDate] FROM [Orders] AS [o] -WHERE ([o].[CustomerID] = N'ALFKI') AND (CONVERT(float, CAST(CONVERT(float, [o].[OrderID] % 1) AS real)) >= 0.0E0)", +WHERE [o].[CustomerID] = N'ALFKI' AND CONVERT(float, CAST(CONVERT(float, [o].[OrderID] % 1) AS real)) >= 0.0E0", // @"SELECT [o].[OrderID], [o].[CustomerID], [o].[EmployeeID], [o].[OrderDate] FROM [Orders] AS [o] -WHERE ([o].[CustomerID] = N'ALFKI') AND (CONVERT(float, CONVERT(smallint, [o].[OrderID] % 1)) >= 0.0E0)", +WHERE [o].[CustomerID] = N'ALFKI' AND CONVERT(float, CONVERT(smallint, [o].[OrderID] % 1)) >= 0.0E0", // @"SELECT [o].[OrderID], [o].[CustomerID], [o].[EmployeeID], [o].[OrderDate] FROM [Orders] AS [o] -WHERE ([o].[CustomerID] = N'ALFKI') AND (CONVERT(float, CONVERT(int, [o].[OrderID] % 1)) >= 0.0E0)", +WHERE [o].[CustomerID] = N'ALFKI' AND CONVERT(float, CONVERT(int, [o].[OrderID] % 1)) >= 0.0E0", // @"SELECT [o].[OrderID], [o].[CustomerID], [o].[EmployeeID], [o].[OrderDate] FROM [Orders] AS [o] -WHERE ([o].[CustomerID] = N'ALFKI') AND (CONVERT(float, CONVERT(bigint, [o].[OrderID] % 1)) >= 0.0E0)", +WHERE [o].[CustomerID] = N'ALFKI' AND CONVERT(float, CONVERT(bigint, [o].[OrderID] % 1)) >= 0.0E0", // @"SELECT [o].[OrderID], [o].[CustomerID], [o].[EmployeeID], [o].[OrderDate] FROM [Orders] AS [o] -WHERE ([o].[CustomerID] = N'ALFKI') AND (CONVERT(float, CONVERT(nvarchar(max), [o].[OrderID] % 1)) >= 0.0E0)"); +WHERE [o].[CustomerID] = N'ALFKI' AND CONVERT(float, CONVERT(nvarchar(max), [o].[OrderID] % 1)) >= 0.0E0"); } public override async Task Convert_ToInt16(bool async) @@ -1353,39 +1353,39 @@ public override async Task Convert_ToInt16(bool async) AssertSql( @"SELECT [o].[OrderID], [o].[CustomerID], [o].[EmployeeID], [o].[OrderDate] FROM [Orders] AS [o] -WHERE ([o].[CustomerID] = N'ALFKI') AND (CONVERT(smallint, CONVERT(bit, [o].[OrderID] % 1)) >= CAST(0 AS smallint))", +WHERE [o].[CustomerID] = N'ALFKI' AND CONVERT(smallint, CONVERT(bit, [o].[OrderID] % 1)) >= CAST(0 AS smallint)", // @"SELECT [o].[OrderID], [o].[CustomerID], [o].[EmployeeID], [o].[OrderDate] FROM [Orders] AS [o] -WHERE ([o].[CustomerID] = N'ALFKI') AND (CONVERT(smallint, CONVERT(tinyint, [o].[OrderID] % 1)) >= CAST(0 AS smallint))", +WHERE [o].[CustomerID] = N'ALFKI' AND CONVERT(smallint, CONVERT(tinyint, [o].[OrderID] % 1)) >= CAST(0 AS smallint)", // @"SELECT [o].[OrderID], [o].[CustomerID], [o].[EmployeeID], [o].[OrderDate] FROM [Orders] AS [o] -WHERE ([o].[CustomerID] = N'ALFKI') AND (CONVERT(smallint, CONVERT(decimal(18, 2), [o].[OrderID] % 1)) >= CAST(0 AS smallint))", +WHERE [o].[CustomerID] = N'ALFKI' AND CONVERT(smallint, CONVERT(decimal(18, 2), [o].[OrderID] % 1)) >= CAST(0 AS smallint)", // @"SELECT [o].[OrderID], [o].[CustomerID], [o].[EmployeeID], [o].[OrderDate] FROM [Orders] AS [o] -WHERE ([o].[CustomerID] = N'ALFKI') AND (CONVERT(smallint, CONVERT(float, [o].[OrderID] % 1)) >= CAST(0 AS smallint))", +WHERE [o].[CustomerID] = N'ALFKI' AND CONVERT(smallint, CONVERT(float, [o].[OrderID] % 1)) >= CAST(0 AS smallint)", // @"SELECT [o].[OrderID], [o].[CustomerID], [o].[EmployeeID], [o].[OrderDate] FROM [Orders] AS [o] -WHERE ([o].[CustomerID] = N'ALFKI') AND (CONVERT(smallint, CAST(CONVERT(float, [o].[OrderID] % 1) AS real)) >= CAST(0 AS smallint))", +WHERE [o].[CustomerID] = N'ALFKI' AND CONVERT(smallint, CAST(CONVERT(float, [o].[OrderID] % 1) AS real)) >= CAST(0 AS smallint)", // @"SELECT [o].[OrderID], [o].[CustomerID], [o].[EmployeeID], [o].[OrderDate] FROM [Orders] AS [o] -WHERE ([o].[CustomerID] = N'ALFKI') AND (CONVERT(smallint, CONVERT(smallint, [o].[OrderID] % 1)) >= CAST(0 AS smallint))", +WHERE [o].[CustomerID] = N'ALFKI' AND CONVERT(smallint, CONVERT(smallint, [o].[OrderID] % 1)) >= CAST(0 AS smallint)", // @"SELECT [o].[OrderID], [o].[CustomerID], [o].[EmployeeID], [o].[OrderDate] FROM [Orders] AS [o] -WHERE ([o].[CustomerID] = N'ALFKI') AND (CONVERT(smallint, CONVERT(int, [o].[OrderID] % 1)) >= CAST(0 AS smallint))", +WHERE [o].[CustomerID] = N'ALFKI' AND CONVERT(smallint, CONVERT(int, [o].[OrderID] % 1)) >= CAST(0 AS smallint)", // @"SELECT [o].[OrderID], [o].[CustomerID], [o].[EmployeeID], [o].[OrderDate] FROM [Orders] AS [o] -WHERE ([o].[CustomerID] = N'ALFKI') AND (CONVERT(smallint, CONVERT(bigint, [o].[OrderID] % 1)) >= CAST(0 AS smallint))", +WHERE [o].[CustomerID] = N'ALFKI' AND CONVERT(smallint, CONVERT(bigint, [o].[OrderID] % 1)) >= CAST(0 AS smallint)", // @"SELECT [o].[OrderID], [o].[CustomerID], [o].[EmployeeID], [o].[OrderDate] FROM [Orders] AS [o] -WHERE ([o].[CustomerID] = N'ALFKI') AND (CONVERT(smallint, CONVERT(nvarchar(max), [o].[OrderID] % 1)) >= CAST(0 AS smallint))"); +WHERE [o].[CustomerID] = N'ALFKI' AND CONVERT(smallint, CONVERT(nvarchar(max), [o].[OrderID] % 1)) >= CAST(0 AS smallint)"); } public override async Task Convert_ToInt32(bool async) @@ -1395,39 +1395,39 @@ public override async Task Convert_ToInt32(bool async) AssertSql( @"SELECT [o].[OrderID], [o].[CustomerID], [o].[EmployeeID], [o].[OrderDate] FROM [Orders] AS [o] -WHERE ([o].[CustomerID] = N'ALFKI') AND (CONVERT(int, CONVERT(bit, [o].[OrderID] % 1)) >= 0)", +WHERE [o].[CustomerID] = N'ALFKI' AND CONVERT(int, CONVERT(bit, [o].[OrderID] % 1)) >= 0", // @"SELECT [o].[OrderID], [o].[CustomerID], [o].[EmployeeID], [o].[OrderDate] FROM [Orders] AS [o] -WHERE ([o].[CustomerID] = N'ALFKI') AND (CONVERT(int, CONVERT(tinyint, [o].[OrderID] % 1)) >= 0)", +WHERE [o].[CustomerID] = N'ALFKI' AND CONVERT(int, CONVERT(tinyint, [o].[OrderID] % 1)) >= 0", // @"SELECT [o].[OrderID], [o].[CustomerID], [o].[EmployeeID], [o].[OrderDate] FROM [Orders] AS [o] -WHERE ([o].[CustomerID] = N'ALFKI') AND (CONVERT(int, CONVERT(decimal(18, 2), [o].[OrderID] % 1)) >= 0)", +WHERE [o].[CustomerID] = N'ALFKI' AND CONVERT(int, CONVERT(decimal(18, 2), [o].[OrderID] % 1)) >= 0", // @"SELECT [o].[OrderID], [o].[CustomerID], [o].[EmployeeID], [o].[OrderDate] FROM [Orders] AS [o] -WHERE ([o].[CustomerID] = N'ALFKI') AND (CONVERT(int, CONVERT(float, [o].[OrderID] % 1)) >= 0)", +WHERE [o].[CustomerID] = N'ALFKI' AND CONVERT(int, CONVERT(float, [o].[OrderID] % 1)) >= 0", // @"SELECT [o].[OrderID], [o].[CustomerID], [o].[EmployeeID], [o].[OrderDate] FROM [Orders] AS [o] -WHERE ([o].[CustomerID] = N'ALFKI') AND (CONVERT(int, CAST(CONVERT(float, [o].[OrderID] % 1) AS real)) >= 0)", +WHERE [o].[CustomerID] = N'ALFKI' AND CONVERT(int, CAST(CONVERT(float, [o].[OrderID] % 1) AS real)) >= 0", // @"SELECT [o].[OrderID], [o].[CustomerID], [o].[EmployeeID], [o].[OrderDate] FROM [Orders] AS [o] -WHERE ([o].[CustomerID] = N'ALFKI') AND (CONVERT(int, CONVERT(smallint, [o].[OrderID] % 1)) >= 0)", +WHERE [o].[CustomerID] = N'ALFKI' AND CONVERT(int, CONVERT(smallint, [o].[OrderID] % 1)) >= 0", // @"SELECT [o].[OrderID], [o].[CustomerID], [o].[EmployeeID], [o].[OrderDate] FROM [Orders] AS [o] -WHERE ([o].[CustomerID] = N'ALFKI') AND (CONVERT(int, CONVERT(int, [o].[OrderID] % 1)) >= 0)", +WHERE [o].[CustomerID] = N'ALFKI' AND CONVERT(int, CONVERT(int, [o].[OrderID] % 1)) >= 0", // @"SELECT [o].[OrderID], [o].[CustomerID], [o].[EmployeeID], [o].[OrderDate] FROM [Orders] AS [o] -WHERE ([o].[CustomerID] = N'ALFKI') AND (CONVERT(int, CONVERT(bigint, [o].[OrderID] % 1)) >= 0)", +WHERE [o].[CustomerID] = N'ALFKI' AND CONVERT(int, CONVERT(bigint, [o].[OrderID] % 1)) >= 0", // @"SELECT [o].[OrderID], [o].[CustomerID], [o].[EmployeeID], [o].[OrderDate] FROM [Orders] AS [o] -WHERE ([o].[CustomerID] = N'ALFKI') AND (CONVERT(int, CONVERT(nvarchar(max), [o].[OrderID] % 1)) >= 0)"); +WHERE [o].[CustomerID] = N'ALFKI' AND CONVERT(int, CONVERT(nvarchar(max), [o].[OrderID] % 1)) >= 0"); } public override async Task Convert_ToInt64(bool async) @@ -1437,39 +1437,39 @@ public override async Task Convert_ToInt64(bool async) AssertSql( @"SELECT [o].[OrderID], [o].[CustomerID], [o].[EmployeeID], [o].[OrderDate] FROM [Orders] AS [o] -WHERE ([o].[CustomerID] = N'ALFKI') AND (CONVERT(bigint, CONVERT(bit, [o].[OrderID] % 1)) >= CAST(0 AS bigint))", +WHERE [o].[CustomerID] = N'ALFKI' AND CONVERT(bigint, CONVERT(bit, [o].[OrderID] % 1)) >= CAST(0 AS bigint)", // @"SELECT [o].[OrderID], [o].[CustomerID], [o].[EmployeeID], [o].[OrderDate] FROM [Orders] AS [o] -WHERE ([o].[CustomerID] = N'ALFKI') AND (CONVERT(bigint, CONVERT(tinyint, [o].[OrderID] % 1)) >= CAST(0 AS bigint))", +WHERE [o].[CustomerID] = N'ALFKI' AND CONVERT(bigint, CONVERT(tinyint, [o].[OrderID] % 1)) >= CAST(0 AS bigint)", // @"SELECT [o].[OrderID], [o].[CustomerID], [o].[EmployeeID], [o].[OrderDate] FROM [Orders] AS [o] -WHERE ([o].[CustomerID] = N'ALFKI') AND (CONVERT(bigint, CONVERT(decimal(18, 2), [o].[OrderID] % 1)) >= CAST(0 AS bigint))", +WHERE [o].[CustomerID] = N'ALFKI' AND CONVERT(bigint, CONVERT(decimal(18, 2), [o].[OrderID] % 1)) >= CAST(0 AS bigint)", // @"SELECT [o].[OrderID], [o].[CustomerID], [o].[EmployeeID], [o].[OrderDate] FROM [Orders] AS [o] -WHERE ([o].[CustomerID] = N'ALFKI') AND (CONVERT(bigint, CONVERT(float, [o].[OrderID] % 1)) >= CAST(0 AS bigint))", +WHERE [o].[CustomerID] = N'ALFKI' AND CONVERT(bigint, CONVERT(float, [o].[OrderID] % 1)) >= CAST(0 AS bigint)", // @"SELECT [o].[OrderID], [o].[CustomerID], [o].[EmployeeID], [o].[OrderDate] FROM [Orders] AS [o] -WHERE ([o].[CustomerID] = N'ALFKI') AND (CONVERT(bigint, CAST(CONVERT(float, [o].[OrderID] % 1) AS real)) >= CAST(0 AS bigint))", +WHERE [o].[CustomerID] = N'ALFKI' AND CONVERT(bigint, CAST(CONVERT(float, [o].[OrderID] % 1) AS real)) >= CAST(0 AS bigint)", // @"SELECT [o].[OrderID], [o].[CustomerID], [o].[EmployeeID], [o].[OrderDate] FROM [Orders] AS [o] -WHERE ([o].[CustomerID] = N'ALFKI') AND (CONVERT(bigint, CONVERT(smallint, [o].[OrderID] % 1)) >= CAST(0 AS bigint))", +WHERE [o].[CustomerID] = N'ALFKI' AND CONVERT(bigint, CONVERT(smallint, [o].[OrderID] % 1)) >= CAST(0 AS bigint)", // @"SELECT [o].[OrderID], [o].[CustomerID], [o].[EmployeeID], [o].[OrderDate] FROM [Orders] AS [o] -WHERE ([o].[CustomerID] = N'ALFKI') AND (CONVERT(bigint, CONVERT(int, [o].[OrderID] % 1)) >= CAST(0 AS bigint))", +WHERE [o].[CustomerID] = N'ALFKI' AND CONVERT(bigint, CONVERT(int, [o].[OrderID] % 1)) >= CAST(0 AS bigint)", // @"SELECT [o].[OrderID], [o].[CustomerID], [o].[EmployeeID], [o].[OrderDate] FROM [Orders] AS [o] -WHERE ([o].[CustomerID] = N'ALFKI') AND (CONVERT(bigint, CONVERT(bigint, [o].[OrderID] % 1)) >= CAST(0 AS bigint))", +WHERE [o].[CustomerID] = N'ALFKI' AND CONVERT(bigint, CONVERT(bigint, [o].[OrderID] % 1)) >= CAST(0 AS bigint)", // @"SELECT [o].[OrderID], [o].[CustomerID], [o].[EmployeeID], [o].[OrderDate] FROM [Orders] AS [o] -WHERE ([o].[CustomerID] = N'ALFKI') AND (CONVERT(bigint, CONVERT(nvarchar(max), [o].[OrderID] % 1)) >= CAST(0 AS bigint))"); +WHERE [o].[CustomerID] = N'ALFKI' AND CONVERT(bigint, CONVERT(nvarchar(max), [o].[OrderID] % 1)) >= CAST(0 AS bigint)"); } public override async Task Convert_ToString(bool async) @@ -1479,43 +1479,43 @@ public override async Task Convert_ToString(bool async) AssertSql( @"SELECT [o].[OrderID], [o].[CustomerID], [o].[EmployeeID], [o].[OrderDate] FROM [Orders] AS [o] -WHERE ([o].[CustomerID] = N'ALFKI') AND (CONVERT(nvarchar(max), CONVERT(bit, [o].[OrderID] % 1)) <> N'10')", +WHERE [o].[CustomerID] = N'ALFKI' AND CONVERT(nvarchar(max), CONVERT(bit, [o].[OrderID] % 1)) <> N'10'", // @"SELECT [o].[OrderID], [o].[CustomerID], [o].[EmployeeID], [o].[OrderDate] FROM [Orders] AS [o] -WHERE ([o].[CustomerID] = N'ALFKI') AND (CONVERT(nvarchar(max), CONVERT(tinyint, [o].[OrderID] % 1)) <> N'10')", +WHERE [o].[CustomerID] = N'ALFKI' AND CONVERT(nvarchar(max), CONVERT(tinyint, [o].[OrderID] % 1)) <> N'10'", // @"SELECT [o].[OrderID], [o].[CustomerID], [o].[EmployeeID], [o].[OrderDate] FROM [Orders] AS [o] -WHERE ([o].[CustomerID] = N'ALFKI') AND (CONVERT(nvarchar(max), CONVERT(decimal(18, 2), [o].[OrderID] % 1)) <> N'10')", +WHERE [o].[CustomerID] = N'ALFKI' AND CONVERT(nvarchar(max), CONVERT(decimal(18, 2), [o].[OrderID] % 1)) <> N'10'", // @"SELECT [o].[OrderID], [o].[CustomerID], [o].[EmployeeID], [o].[OrderDate] FROM [Orders] AS [o] -WHERE ([o].[CustomerID] = N'ALFKI') AND (CONVERT(nvarchar(max), CONVERT(float, [o].[OrderID] % 1)) <> N'10')", +WHERE [o].[CustomerID] = N'ALFKI' AND CONVERT(nvarchar(max), CONVERT(float, [o].[OrderID] % 1)) <> N'10'", // @"SELECT [o].[OrderID], [o].[CustomerID], [o].[EmployeeID], [o].[OrderDate] FROM [Orders] AS [o] -WHERE ([o].[CustomerID] = N'ALFKI') AND (CONVERT(nvarchar(max), CAST(CONVERT(float, [o].[OrderID] % 1) AS real)) <> N'10')", +WHERE [o].[CustomerID] = N'ALFKI' AND CONVERT(nvarchar(max), CAST(CONVERT(float, [o].[OrderID] % 1) AS real)) <> N'10'", // @"SELECT [o].[OrderID], [o].[CustomerID], [o].[EmployeeID], [o].[OrderDate] FROM [Orders] AS [o] -WHERE ([o].[CustomerID] = N'ALFKI') AND (CONVERT(nvarchar(max), CONVERT(smallint, [o].[OrderID] % 1)) <> N'10')", +WHERE [o].[CustomerID] = N'ALFKI' AND CONVERT(nvarchar(max), CONVERT(smallint, [o].[OrderID] % 1)) <> N'10'", // @"SELECT [o].[OrderID], [o].[CustomerID], [o].[EmployeeID], [o].[OrderDate] FROM [Orders] AS [o] -WHERE ([o].[CustomerID] = N'ALFKI') AND (CONVERT(nvarchar(max), CONVERT(int, [o].[OrderID] % 1)) <> N'10')", +WHERE [o].[CustomerID] = N'ALFKI' AND CONVERT(nvarchar(max), CONVERT(int, [o].[OrderID] % 1)) <> N'10'", // @"SELECT [o].[OrderID], [o].[CustomerID], [o].[EmployeeID], [o].[OrderDate] FROM [Orders] AS [o] -WHERE ([o].[CustomerID] = N'ALFKI') AND (CONVERT(nvarchar(max), CONVERT(bigint, [o].[OrderID] % 1)) <> N'10')", +WHERE [o].[CustomerID] = N'ALFKI' AND CONVERT(nvarchar(max), CONVERT(bigint, [o].[OrderID] % 1)) <> N'10'", // @"SELECT [o].[OrderID], [o].[CustomerID], [o].[EmployeeID], [o].[OrderDate] FROM [Orders] AS [o] -WHERE ([o].[CustomerID] = N'ALFKI') AND (CONVERT(nvarchar(max), CONVERT(nvarchar(max), [o].[OrderID] % 1)) <> N'10')", +WHERE [o].[CustomerID] = N'ALFKI' AND CONVERT(nvarchar(max), CONVERT(nvarchar(max), [o].[OrderID] % 1)) <> N'10'", // @"SELECT [o].[OrderID], [o].[CustomerID], [o].[EmployeeID], [o].[OrderDate] FROM [Orders] AS [o] -WHERE ([o].[CustomerID] = N'ALFKI') AND ((CONVERT(nvarchar(max), [o].[OrderDate]) LIKE N'%1997%') OR (CONVERT(nvarchar(max), [o].[OrderDate]) LIKE N'%1998%'))"); +WHERE [o].[CustomerID] = N'ALFKI' AND ((CONVERT(nvarchar(max), [o].[OrderDate]) LIKE N'%1997%') OR (CONVERT(nvarchar(max), [o].[OrderDate]) LIKE N'%1998%'))"); } public override async Task Indexof_with_emptystring(bool async) @@ -1712,7 +1712,7 @@ public override async Task IsNullOrWhiteSpace_in_predicate(bool async) AssertSql( @"SELECT [c].[CustomerID], [c].[Address], [c].[City], [c].[CompanyName], [c].[ContactName], [c].[ContactTitle], [c].[Country], [c].[Fax], [c].[Phone], [c].[PostalCode], [c].[Region] FROM [Customers] AS [c] -WHERE [c].[Region] IS NULL OR ([c].[Region] = N'')"); +WHERE [c].[Region] IS NULL OR [c].[Region] = N''"); } public override async Task IsNullOrWhiteSpace_in_predicate_on_non_nullable_column(bool async) diff --git a/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindGroupByQuerySqlServerTest.cs b/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindGroupByQuerySqlServerTest.cs index b4e721eebf9..99f76cf854e 100644 --- a/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindGroupByQuerySqlServerTest.cs +++ b/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindGroupByQuerySqlServerTest.cs @@ -1295,7 +1295,7 @@ WHERE EXISTS ( SELECT 1 FROM [Orders] AS [o0] GROUP BY [o0].[CustomerID] - HAVING (COUNT(*) > 30) AND (([o0].[CustomerID] = [o].[CustomerID]) OR ([o0].[CustomerID] IS NULL AND [o].[CustomerID] IS NULL)))"); + HAVING COUNT(*) > 30 AND ([o0].[CustomerID] = [o].[CustomerID] OR ([o0].[CustomerID] IS NULL AND [o].[CustomerID] IS NULL)))"); } public override async Task GroupBy_aggregate_Pushdown(bool async) @@ -1684,7 +1684,7 @@ WHEN NOT EXISTS ( SELECT 1 FROM [Orders] AS [o] GROUP BY [o].[CustomerID] - HAVING ([o].[CustomerID] <> N'ALFKI') OR [o].[CustomerID] IS NULL) THEN CAST(1 AS bit) + HAVING [o].[CustomerID] <> N'ALFKI' OR [o].[CustomerID] IS NULL) THEN CAST(1 AS bit) ELSE CAST(0 AS bit) END"); } @@ -1767,7 +1767,7 @@ public override async Task GroupBy_Where_Count_with_predicate(bool async) AssertSql( @"SELECT COUNT(CASE - WHEN (([o].[OrderID] < 10300) AND [o].[OrderDate] IS NOT NULL) AND (DATEPART(year, [o].[OrderDate]) = 1997) THEN 1 + WHEN [o].[OrderID] < 10300 AND [o].[OrderDate] IS NOT NULL AND DATEPART(year, [o].[OrderDate]) = 1997 THEN 1 END) FROM [Orders] AS [o] GROUP BY [o].[CustomerID]"); @@ -1779,7 +1779,7 @@ public override async Task GroupBy_Where_Where_Count(bool async) AssertSql( @"SELECT COUNT(CASE - WHEN (([o].[OrderID] < 10300) AND [o].[OrderDate] IS NOT NULL) AND (DATEPART(year, [o].[OrderDate]) = 1997) THEN 1 + WHEN [o].[OrderID] < 10300 AND [o].[OrderDate] IS NOT NULL AND DATEPART(year, [o].[OrderDate]) = 1997 THEN 1 END) FROM [Orders] AS [o] GROUP BY [o].[CustomerID]"); @@ -1791,7 +1791,7 @@ public override async Task GroupBy_Where_Select_Where_Count(bool async) AssertSql( @"SELECT COUNT(CASE - WHEN (([o].[OrderID] < 10300) AND [o].[OrderDate] IS NOT NULL) AND (DATEPART(year, [o].[OrderDate]) = 1997) THEN 1 + WHEN [o].[OrderID] < 10300 AND [o].[OrderDate] IS NOT NULL AND DATEPART(year, [o].[OrderDate]) = 1997 THEN 1 END) FROM [Orders] AS [o] GROUP BY [o].[CustomerID]"); @@ -1803,7 +1803,7 @@ public override async Task GroupBy_Where_Select_Where_Select_Min(bool async) AssertSql( @"SELECT MIN(CASE - WHEN (([o].[OrderID] < 10300) AND [o].[OrderDate] IS NOT NULL) AND (DATEPART(year, [o].[OrderDate]) = 1997) THEN [o].[OrderID] + WHEN [o].[OrderID] < 10300 AND [o].[OrderDate] IS NOT NULL AND DATEPART(year, [o].[OrderDate]) = 1997 THEN [o].[OrderID] END) FROM [Orders] AS [o] GROUP BY [o].[CustomerID]"); @@ -1894,9 +1894,9 @@ 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) +WHERE [e].[Title] = N'Sales Representative' AND [e].[EmployeeID] = 1 GROUP BY [e].[Title]"); } @@ -1909,7 +1909,7 @@ public override async Task GroupBy_Shadow2(bool async) FROM ( SELECT [e].[Title] FROM [Employees] AS [e] - WHERE ([e].[Title] = N'Sales Representative') AND ([e].[EmployeeID] = 1) + WHERE [e].[Title] = N'Sales Representative' AND [e].[EmployeeID] = 1 GROUP BY [e].[Title] ) AS [t] LEFT JOIN ( @@ -1917,7 +1917,7 @@ LEFT JOIN ( FROM ( SELECT [e0].[EmployeeID], [e0].[City], [e0].[Country], [e0].[FirstName], [e0].[ReportsTo], [e0].[Title], ROW_NUMBER() OVER(PARTITION BY [e0].[Title] ORDER BY [e0].[EmployeeID]) AS [row] FROM [Employees] AS [e0] - WHERE ([e0].[Title] = N'Sales Representative') AND ([e0].[EmployeeID] = 1) + WHERE [e0].[Title] = N'Sales Representative' AND [e0].[EmployeeID] = 1 ) AS [t1] WHERE [t1].[row] <= 1 ) AS [t0] ON [t].[Title] = [t0].[Title]"); @@ -1931,7 +1931,7 @@ public override async Task GroupBy_Shadow3(bool async) @"SELECT ( SELECT TOP(1) [e0].[Title] FROM [Employees] AS [e0] - WHERE ([e0].[EmployeeID] = 1) AND ([e].[EmployeeID] = [e0].[EmployeeID])) + WHERE [e0].[EmployeeID] = 1 AND [e].[EmployeeID] = [e0].[EmployeeID]) FROM [Employees] AS [e] WHERE [e].[EmployeeID] = 1 GROUP BY [e].[EmployeeID]"); @@ -1982,7 +1982,7 @@ LEFT JOIN ( SELECT [c0].[CustomerID], [c0].[Address], [c0].[City], [c0].[CompanyName], [c0].[ContactName], [c0].[ContactTitle], [c0].[Country], [c0].[Fax], [c0].[Phone], [c0].[PostalCode], [c0].[Region] FROM [Customers] AS [c0] WHERE [c0].[CustomerID] LIKE N'A%' -) AS [t0] ON ([t].[City] = [t0].[City]) OR ([t].[City] IS NULL AND [t0].[City] IS NULL) +) AS [t0] ON [t].[City] = [t0].[City] OR ([t].[City] IS NULL AND [t0].[City] IS NULL) ORDER BY [t].[City]"); } @@ -2054,7 +2054,7 @@ SELECT DISTINCT MAX(DISTINCT ([t].[OrderDate])) FROM ( SELECT DISTINCT [o0].[OrderID], [o0].[CustomerID], [o0].[EmployeeID], [o0].[OrderDate] FROM [Orders] AS [o0] - WHERE ([o].[CustomerID] = [o0].[CustomerID]) OR ([o].[CustomerID] IS NULL AND [o0].[CustomerID] IS NULL) + WHERE [o].[CustomerID] = [o0].[CustomerID] OR ([o].[CustomerID] IS NULL AND [o0].[CustomerID] IS NULL) ) AS [t]) AS [Max] FROM [Orders] AS [o] GROUP BY [o].[CustomerID]"); @@ -2260,7 +2260,7 @@ public override async Task GroupBy_Count_in_projection(bool async) WHEN EXISTS ( SELECT 1 FROM [Order Details] AS [o0] - WHERE ([o].[OrderID] = [o0].[OrderID]) AND ([o0].[ProductID] < 25)) THEN CAST(1 AS bit) + WHERE [o].[OrderID] = [o0].[OrderID] AND [o0].[ProductID] < 25) THEN CAST(1 AS bit) ELSE CAST(0 AS bit) END AS [HasOrderDetails], CASE WHEN ( @@ -2269,7 +2269,7 @@ SELECT COUNT(*) SELECT [p].[ProductName] FROM [Order Details] AS [o1] INNER JOIN [Products] AS [p] ON [o1].[ProductID] = [p].[ProductID] - WHERE ([o].[OrderID] = [o1].[OrderID]) AND ([o1].[ProductID] < 25) + WHERE [o].[OrderID] = [o1].[OrderID] AND [o1].[ProductID] < 25 GROUP BY [p].[ProductName] ) AS [t]) > 1 THEN CAST(1 AS bit) ELSE CAST(0 AS bit) @@ -2457,7 +2457,7 @@ public override async Task GroupBy_Min_Where_optional_relationship_2(bool async) FROM [Orders] AS [o] LEFT JOIN [Customers] AS [c] ON [o].[CustomerID] = [c].[CustomerID] GROUP BY [c].[CustomerID] -HAVING (COUNT(*) < 2) OR (COUNT(*) > 2)"); +HAVING COUNT(*) < 2 OR COUNT(*) > 2"); } public override async Task GroupBy_aggregate_over_a_subquery(bool async) @@ -2498,7 +2498,7 @@ public override async Task GroupBy_aggregate_join_with_group_result(bool async) FROM [Orders] AS [o] GROUP BY [o].[CustomerID] ) AS [t] -INNER JOIN [Orders] AS [o0] ON (([t].[Key] = [o0].[CustomerID]) OR ([t].[Key] IS NULL AND [o0].[CustomerID] IS NULL)) AND (([t].[LastOrderDate] = [o0].[OrderDate]) OR ([t].[LastOrderDate] IS NULL AND [o0].[OrderDate] IS NULL))"); +INNER JOIN [Orders] AS [o0] ON ([t].[Key] = [o0].[CustomerID] OR ([t].[Key] IS NULL AND [o0].[CustomerID] IS NULL)) AND ([t].[LastOrderDate] = [o0].[OrderDate] OR ([t].[LastOrderDate] IS NULL AND [o0].[OrderDate] IS NULL))"); } public override async Task GroupBy_aggregate_from_right_side_of_join(bool async) @@ -2695,7 +2695,7 @@ public override async Task Where_select_function_groupby_followed_by_another_sel WHEN (2020 - DATEPART(year, [o].[OrderDate])) <= 30 THEN [o].[OrderID] ELSE 0 END), 0) AS [Sum1], COALESCE(SUM(CASE - WHEN ((2020 - DATEPART(year, [o].[OrderDate])) > 30) AND ((2020 - DATEPART(year, [o].[OrderDate])) <= 60) THEN [o].[OrderID] + WHEN (2020 - DATEPART(year, [o].[OrderDate])) > 30 AND (2020 - DATEPART(year, [o].[OrderDate])) <= 60 THEN [o].[OrderID] ELSE 0 END), 0) AS [Sum2] FROM [Orders] AS [o] @@ -2880,7 +2880,7 @@ SELECT MIN([o1].[OrderID] / 100) FROM [Order Details] AS [o1] INNER JOIN [Orders] AS [o2] ON [o1].[OrderID] = [o2].[OrderID] LEFT JOIN [Customers] AS [c1] ON [o2].[CustomerID] = [c1].[CustomerID] - WHERE ([c1].[CustomerID] = N'ALFKI') AND ([t].[ProductID] = [o1].[ProductID])) + WHERE [c1].[CustomerID] = N'ALFKI' AND [t].[ProductID] = [o1].[ProductID]) ) AS [t0] ORDER BY [t].[ProductID], [t0].[CustomerID]"); } diff --git a/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindIncludeQuerySqlServerTest.cs b/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindIncludeQuerySqlServerTest.cs index 65da90cd110..78967653b26 100644 --- a/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindIncludeQuerySqlServerTest.cs +++ b/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindIncludeQuerySqlServerTest.cs @@ -37,7 +37,7 @@ LEFT JOIN ( FROM [Order Details] AS [o] INNER JOIN [Orders] AS [o0] ON [o].[OrderID] = [o0].[OrderID] ) AS [t] ON [p].[ProductID] = [t].[ProductID] -WHERE (([p].[ProductID] % 17) = 5) AND ([p].[UnitPrice] < 20.0) +WHERE ([p].[ProductID] % 17) = 5 AND [p].[UnitPrice] < 20.0 ORDER BY [p].[ProductID], [t].[OrderID], [t].[ProductID]"); } @@ -222,7 +222,7 @@ 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] LEFT JOIN [Orders] AS [o1] ON [c].[CustomerID] = [o1].[CustomerID] -WHERE (([o].[OrderID] % 23) = 13) AND ([o].[UnitPrice] < 10.0) +WHERE ([o].[OrderID] % 23) = 13 AND [o].[UnitPrice] < 10.0 ORDER BY [o].[OrderID], [o].[ProductID], [o0].[OrderID], [c].[CustomerID]"); } @@ -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] @@ -928,10 +928,10 @@ SELECT COUNT(*) FROM [Orders] AS [o0] WHERE [c].[CustomerID] = [o0].[CustomerID]) AS [TotalOrders] FROM [Customers] AS [c] -WHERE ([c].[ContactTitle] = N'Owner') AND (( +WHERE [c].[ContactTitle] = N'Owner' AND ( SELECT COUNT(*) FROM [Orders] AS [o] - WHERE [c].[CustomerID] = [o].[CustomerID]) > 2) + WHERE [c].[CustomerID] = [o].[CustomerID]) > 2 ORDER BY [c].[CustomerID]"); } diff --git a/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindJoinQuerySqlServerTest.cs b/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindJoinQuerySqlServerTest.cs index 0253a116cca..54f8c2300a9 100644 --- a/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindJoinQuerySqlServerTest.cs +++ b/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindJoinQuerySqlServerTest.cs @@ -200,7 +200,7 @@ public override async Task Join_composite_key(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], [o].[OrderID], [o].[CustomerID], [o].[EmployeeID], [o].[OrderDate] FROM [Customers] AS [c] -INNER JOIN [Orders] AS [o] ON ([c].[CustomerID] = [o].[CustomerID]) AND ([c].[CustomerID] = [o].[CustomerID]) +INNER JOIN [Orders] AS [o] ON [c].[CustomerID] = [o].[CustomerID] AND [c].[CustomerID] = [o].[CustomerID] WHERE [c].[CustomerID] LIKE N'F%'"); } @@ -373,7 +373,7 @@ public override async Task GroupJoin_Where_OrderBy(bool async) @"SELECT [o].[OrderID], [o].[CustomerID], [o].[EmployeeID], [o].[OrderDate] FROM [Customers] AS [c] INNER JOIN [Orders] AS [o] ON [c].[CustomerID] = [o].[CustomerID] -WHERE ([o].[CustomerID] = N'ALFKI') OR ([c].[CustomerID] = N'ANATR') +WHERE [o].[CustomerID] = N'ALFKI' OR [c].[CustomerID] = N'ANATR' ORDER BY [c].[City]"); } @@ -728,7 +728,7 @@ FROM [Customers] AS [c] ) AS [t] OUTER APPLY ( SELECT CASE - WHEN ([t1].[CustomerID] = [c0].[City]) OR ([t1].[CustomerID] IS NULL AND [c0].[City] IS NULL) THEN N'A' + WHEN [t1].[CustomerID] = [c0].[City] OR ([t1].[CustomerID] IS NULL AND [c0].[City] IS NULL) THEN N'A' ELSE N'B' END AS [Title], [t1].[OrderID], [c0].[CustomerID], [t1].[OrderDate] FROM ( diff --git a/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindKeylessEntitiesQuerySqlServerTest.cs b/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindKeylessEntitiesQuerySqlServerTest.cs index 84ac5ce173c..d46f6758af0 100644 --- a/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindKeylessEntitiesQuerySqlServerTest.cs +++ b/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindKeylessEntitiesQuerySqlServerTest.cs @@ -124,7 +124,7 @@ public override async Task KeylessEntity_select_where_navigation_multi_level(boo WHERE EXISTS ( SELECT 1 FROM [Orders] AS [o] - WHERE [c].[CustomerID] IS NOT NULL AND ([c].[CustomerID] = [o].[CustomerID]))"); + WHERE [c].[CustomerID] IS NOT NULL AND [c].[CustomerID] = [o].[CustomerID])"); } [ConditionalFact] @@ -172,7 +172,7 @@ SELECT TOP(@__p_0) [m].[City], [m].[ContactName] WHERE EXISTS ( SELECT 1 FROM [Customers] AS [c] - WHERE ([c].[City] = [m].[City]) OR ([c].[City] IS NULL AND [m].[City] IS NULL)) + WHERE [c].[City] = [m].[City] OR ([c].[City] IS NULL AND [m].[City] IS NULL)) ORDER BY [m].[ContactName]"); } diff --git a/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindMiscellaneousQuerySqlServerTest.cs b/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindMiscellaneousQuerySqlServerTest.cs index c76b8f78aac..499bd5bca9c 100644 --- a/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindMiscellaneousQuerySqlServerTest.cs +++ b/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindMiscellaneousQuerySqlServerTest.cs @@ -146,7 +146,7 @@ public override async Task Entity_equality_local_composite_key(bool async) SELECT [o].[OrderID], [o].[ProductID], [o].[Discount], [o].[Quantity], [o].[UnitPrice] FROM [Order Details] AS [o] -WHERE ([o].[OrderID] = @__entity_equality_local_0_OrderID) AND ([o].[ProductID] = @__entity_equality_local_0_ProductID)"); +WHERE [o].[OrderID] = @__entity_equality_local_0_OrderID AND [o].[ProductID] = @__entity_equality_local_0_ProductID"); } public override async Task Entity_equality_local_double_check(bool async) @@ -158,7 +158,7 @@ public override async Task Entity_equality_local_double_check(bool async) SELECT [c].[CustomerID] FROM [Customers] AS [c] -WHERE ([c].[CustomerID] = @__entity_equality_local_0_CustomerID) AND (@__entity_equality_local_0_CustomerID = [c].[CustomerID])"); +WHERE [c].[CustomerID] = @__entity_equality_local_0_CustomerID AND @__entity_equality_local_0_CustomerID = [c].[CustomerID]"); } public override async Task Join_with_entity_equality_local_on_both_sources(bool async) @@ -195,7 +195,7 @@ public override async Task Entity_equality_local_inline_composite_key(bool async AssertSql( @"SELECT [o].[OrderID], [o].[ProductID], [o].[Discount], [o].[Quantity], [o].[UnitPrice] FROM [Order Details] AS [o] -WHERE ([o].[OrderID] = 10248) AND ([o].[ProductID] = 11)"); +WHERE [o].[OrderID] = 10248 AND [o].[ProductID] = 11"); } public override async Task Entity_equality_null(bool async) @@ -428,10 +428,10 @@ public override async Task Where_query_composition(bool async) AssertSql( @"SELECT [e].[EmployeeID], [e].[City], [e].[Country], [e].[FirstName], [e].[ReportsTo], [e].[Title] FROM [Employees] AS [e] -WHERE ([e].[FirstName] = ( +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)"); @@ -593,7 +593,7 @@ FROM [Employees] AS [e] WHERE ( SELECT TOP(1) [e0].[EmployeeID] FROM [Employees] AS [e0] - WHERE ([e0].[EmployeeID] <> [e].[ReportsTo]) OR [e].[ReportsTo] IS NULL) = 0"); + WHERE [e0].[EmployeeID] <> [e].[ReportsTo] OR [e].[ReportsTo] IS NULL) = 0"); } public override async Task Where_query_composition_entity_equality_multiple_elements_Single(bool async) @@ -606,7 +606,7 @@ FROM [Employees] AS [e] WHERE ( SELECT TOP(1) [e0].[EmployeeID] FROM [Employees] AS [e0] - WHERE ([e0].[EmployeeID] <> [e].[ReportsTo]) OR [e].[ReportsTo] IS NULL) = 0"); + WHERE [e0].[EmployeeID] <> [e].[ReportsTo] OR [e].[ReportsTo] IS NULL) = 0"); } public override async Task Where_query_composition_entity_equality_multiple_elements_FirstOrDefault(bool async) @@ -619,7 +619,7 @@ FROM [Employees] AS [e] WHERE ( SELECT TOP(1) [e0].[EmployeeID] FROM [Employees] AS [e0] - WHERE ([e0].[EmployeeID] <> [e].[ReportsTo]) OR [e].[ReportsTo] IS NULL) = 0"); + WHERE [e0].[EmployeeID] <> [e].[ReportsTo] OR [e].[ReportsTo] IS NULL) = 0"); } public override async Task Where_query_composition_entity_equality_multiple_elements_First(bool async) @@ -632,7 +632,7 @@ FROM [Employees] AS [e] WHERE ( SELECT TOP(1) [e0].[EmployeeID] FROM [Employees] AS [e0] - WHERE ([e0].[EmployeeID] <> [e].[ReportsTo]) OR [e].[ReportsTo] IS NULL) = 0"); + WHERE [e0].[EmployeeID] <> [e].[ReportsTo] OR [e].[ReportsTo] IS NULL) = 0"); } public override async Task Where_query_composition2(bool async) @@ -647,10 +647,10 @@ public override async Task Where_query_composition2(bool async) SELECT TOP(@__p_0) [e].[EmployeeID], [e].[City], [e].[Country], [e].[FirstName], [e].[ReportsTo], [e].[Title] FROM [Employees] AS [e] ) AS [t] -WHERE ([t].[FirstName] = ( +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)"); @@ -668,10 +668,10 @@ public override async Task Where_query_composition2_FirstOrDefault(bool async) SELECT TOP(@__p_0) [e].[EmployeeID], [e].[City], [e].[Country], [e].[FirstName], [e].[ReportsTo], [e].[Title] FROM [Employees] AS [e] ) AS [t] -WHERE ([t].[FirstName] = ( +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)"); @@ -689,10 +689,10 @@ public override async Task Where_query_composition2_FirstOrDefault_with_anonymou SELECT TOP(@__p_0) [e].[EmployeeID], [e].[City], [e].[Country], [e].[FirstName], [e].[ReportsTo], [e].[Title] FROM [Employees] AS [e] ) AS [t] -WHERE ([t].[FirstName] = ( +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)"); @@ -731,13 +731,13 @@ public override void Select_Where_Subquery_Deep_Single() SELECT TOP(@__p_0) [o].[OrderID], [o].[ProductID], [o].[Discount], [o].[Quantity], [o].[UnitPrice] FROM [Order Details] AS [o] -WHERE ([o].[OrderID] = 10344) AND (( +WHERE [o].[OrderID] = 10344 AND ( SELECT TOP(1) ( SELECT TOP(1) [c].[City] FROM [Customers] AS [c] WHERE [o0].[CustomerID] = [c].[CustomerID]) FROM [Orders] AS [o0] - WHERE [o].[OrderID] = [o0].[OrderID]) = N'Seattle')"); + WHERE [o].[OrderID] = [o0].[OrderID]) = N'Seattle'"); } public override void Select_Where_Subquery_Deep_First() @@ -778,7 +778,7 @@ SELECT TOP(2) [o0].[OrderID], [o0].[ProductID], [o0].[Discount], [o0].[Quantity] FROM [Order Details] AS [o0] ORDER BY [o0].[OrderID] ) AS [t0] - WHERE (( + WHERE ( SELECT TOP(1) [c].[Country] FROM [Customers] AS [c] WHERE [c].[CustomerID] = [t].[CustomerID] @@ -787,7 +787,7 @@ 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] @@ -930,7 +930,7 @@ ORDER BY CASE WHEN EXISTS ( SELECT 1 FROM [Orders] AS [o] - WHERE ([c].[CustomerID] = [o].[CustomerID]) AND ([o].[OrderID] > 11000)) THEN CAST(1 AS bit) + WHERE [c].[CustomerID] = [o].[CustomerID] AND [o].[OrderID] > 11000) THEN CAST(1 AS bit) ELSE CAST(0 AS bit) END, [c].[CustomerID]"); } @@ -1354,7 +1354,7 @@ 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%')))"); @@ -1370,7 +1370,7 @@ FROM [Customers] AS [c] WHERE NOT (EXISTS ( SELECT 1 FROM [Orders] AS [o] - WHERE [o].[CustomerID] IS NOT NULL AND ([o].[CustomerID] LIKE N'A%'))) AND (([c].[City] <> N'London') OR [c].[City] IS NULL)"); + WHERE [o].[CustomerID] IS NOT NULL AND ([o].[CustomerID] LIKE N'A%'))) AND ([c].[City] <> N'London' OR [c].[City] IS NULL)"); } public override async Task Any_nested(bool async) @@ -1393,7 +1393,7 @@ 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%'))"); @@ -1409,7 +1409,7 @@ FROM [Customers] AS [c] WHERE EXISTS ( SELECT 1 FROM [Orders] AS [o] - WHERE [o].[CustomerID] IS NOT NULL AND ([o].[CustomerID] LIKE N'A%')) AND (([c].[City] <> N'London') OR [c].[City] IS NULL)"); + WHERE [o].[CustomerID] IS NOT NULL AND ([o].[CustomerID] LIKE N'A%')) AND ([c].[City] <> N'London' OR [c].[City] IS NULL)"); } public override void Any_with_multiple_conditions_still_uses_exists() @@ -1419,10 +1419,10 @@ public override void Any_with_multiple_conditions_still_uses_exists() 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') AND EXISTS ( +WHERE [c].[City] = N'London' AND EXISTS ( SELECT 1 FROM [Orders] AS [o] - WHERE ([c].[CustomerID] = [o].[CustomerID]) AND ([o].[EmployeeID] = 1))"); + WHERE [c].[CustomerID] = [o].[CustomerID] AND [o].[EmployeeID] = 1)"); } public override async Task All_top_level(bool async) @@ -1448,7 +1448,7 @@ public override async Task All_top_level_column(bool async) WHEN NOT EXISTS ( SELECT 1 FROM [Customers] AS [c] - WHERE (([c].[ContactName] <> N'') OR [c].[ContactName] IS NULL) AND ([c].[ContactName] IS NULL OR (LEFT([c].[ContactName], LEN([c].[ContactName])) <> [c].[ContactName]))) THEN CAST(1 AS bit) + WHERE ([c].[ContactName] <> N'' OR [c].[ContactName] IS NULL) AND ([c].[ContactName] IS NULL OR LEFT([c].[ContactName], LEN([c].[ContactName])) <> [c].[ContactName])) THEN CAST(1 AS bit) ELSE CAST(0 AS bit) END"); } @@ -1501,7 +1501,7 @@ public override async Task Where_select_many_or(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 ([e].[City] = N'London')"); +WHERE [c].[City] = N'London' OR [e].[City] = N'London'"); } public override async Task Where_select_many_or2(bool async) @@ -1548,7 +1548,7 @@ public override async Task Where_select_many_or_with_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], [e].[EmployeeID], [e].[City], [e].[Country], [e].[FirstName], [e].[ReportsTo], [e].[Title] FROM [Customers] AS [c] CROSS JOIN [Employees] AS [e] -WHERE ((([c].[City] = @__london_0) OR ([c].[City] = N'Berlin')) OR ([c].[City] = N'Seattle')) OR ([c].[City] = @__lisboa_1)"); +WHERE [c].[City] = @__london_0 OR [c].[City] = N'Berlin' OR [c].[City] = N'Seattle' OR [c].[City] = @__lisboa_1"); } public override async Task SelectMany_simple_subquery(bool async) @@ -1672,10 +1672,10 @@ public override async Task Where_Join_Any(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].[CustomerID] = N'ALFKI') AND EXISTS ( +WHERE [c].[CustomerID] = N'ALFKI' AND EXISTS ( SELECT 1 FROM [Orders] AS [o] - WHERE ([c].[CustomerID] = [o].[CustomerID]) AND ([o].[OrderDate] = '2008-10-24T00:00:00.000'))"); + WHERE [c].[CustomerID] = [o].[CustomerID] AND [o].[OrderDate] = '2008-10-24T00:00:00.000')"); } public override async Task Where_Join_Exists(bool async) @@ -1823,7 +1823,7 @@ public override async Task SelectMany_cartesian_product_with_ordering(bool async @"SELECT [c].[CustomerID], [c].[Address], [c].[City], [c].[CompanyName], [c].[ContactName], [c].[ContactTitle], [c].[Country], [c].[Fax], [c].[Phone], [c].[PostalCode], [c].[Region], [e].[City] FROM [Customers] AS [c] CROSS JOIN [Employees] AS [e] -WHERE ([c].[City] = [e].[City]) OR ([c].[City] IS NULL AND [e].[City] IS NULL) +WHERE [c].[City] = [e].[City] OR ([c].[City] IS NULL AND [e].[City] IS NULL) ORDER BY [e].[City], [c].[CustomerID] DESC"); } @@ -2226,7 +2226,7 @@ public override async Task OrderBy_correlated_subquery2(bool async) AssertSql( @"SELECT [o].[OrderID], [o].[CustomerID], [o].[EmployeeID], [o].[OrderDate] FROM [Orders] AS [o] -WHERE ([o].[OrderID] <= 10250) AND ((( +WHERE [o].[OrderID] <= 10250 AND (( SELECT TOP(1) [c].[City] FROM [Customers] AS [c] ORDER BY CASE @@ -2235,7 +2235,7 @@ SELECT 1 FROM [Customers] AS [c0] WHERE [c0].[CustomerID] = N'ALFKI') THEN CAST(1 AS bit) ELSE CAST(0 AS bit) - END) <> N'Nowhere') OR ( + END) <> N'Nowhere' OR ( SELECT TOP(1) [c].[City] FROM [Customers] AS [c] ORDER BY CASE @@ -2432,7 +2432,7 @@ FROM [Products] AS [p] WHERE EXISTS ( SELECT 1 FROM [Order Details] AS [o] - WHERE ([o].[ProductID] = [p].[ProductID]) AND ([o].[Quantity] = CAST(5 AS smallint)))"); + WHERE [o].[ProductID] = [p].[ProductID] AND [o].[Quantity] = CAST(5 AS smallint))"); } public override async Task Select_many_cross_join_same_collection(bool async) @@ -2520,7 +2520,7 @@ public override async Task OrderBy_comparison_operator(bool async) @"SELECT [c].[CustomerID], [c].[Address], [c].[City], [c].[CompanyName], [c].[ContactName], [c].[ContactTitle], [c].[Country], [c].[Fax], [c].[Phone], [c].[PostalCode], [c].[Region] FROM [Customers] AS [c] ORDER BY CASE - WHEN ([c].[Region] = N'ASK') AND [c].[Region] IS NOT NULL THEN CAST(1 AS bit) + WHEN [c].[Region] = N'ASK' AND [c].[Region] IS NOT NULL THEN CAST(1 AS bit) ELSE CAST(0 AS bit) END"); } @@ -2702,7 +2702,7 @@ public override async Task Environment_newline_is_funcletized(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 (@__NewLine_0 LIKE N'') OR (CHARINDEX(@__NewLine_0, [c].[CustomerID]) > 0)"); +WHERE (@__NewLine_0 LIKE N'') OR CHARINDEX(@__NewLine_0, [c].[CustomerID]) > 0"); } public override async Task Concat_string_int(bool async) @@ -2840,13 +2840,13 @@ public override async Task Where_bitwise_or_with_logical_or(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 ((CASE +WHERE (CASE WHEN [c].[CustomerID] = N'ALFKI' THEN CAST(1 AS bit) ELSE CAST(0 AS bit) END | CASE WHEN [c].[CustomerID] = N'ANATR' THEN CAST(1 AS bit) ELSE CAST(0 AS bit) -END) = CAST(1 AS bit)) OR ([c].[CustomerID] = N'ANTON')"); +END) = CAST(1 AS bit) OR [c].[CustomerID] = N'ANTON'"); } public override async Task Where_bitwise_and_with_logical_and(bool async) @@ -2856,13 +2856,13 @@ public override async Task Where_bitwise_and_with_logical_and(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 ((CASE +WHERE (CASE WHEN [c].[CustomerID] = N'ALFKI' THEN CAST(1 AS bit) ELSE CAST(0 AS bit) END & CASE WHEN [c].[CustomerID] = N'ANATR' THEN CAST(1 AS bit) ELSE CAST(0 AS bit) -END) = CAST(1 AS bit)) AND ([c].[CustomerID] = N'ANTON')"); +END) = CAST(1 AS bit) AND [c].[CustomerID] = N'ANTON'"); } public override async Task Where_bitwise_or_with_logical_and(bool async) @@ -2872,13 +2872,13 @@ public override async Task Where_bitwise_or_with_logical_and(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 ((CASE +WHERE (CASE WHEN [c].[CustomerID] = N'ALFKI' THEN CAST(1 AS bit) ELSE CAST(0 AS bit) END | CASE WHEN [c].[CustomerID] = N'ANATR' THEN CAST(1 AS bit) ELSE CAST(0 AS bit) -END) = CAST(1 AS bit)) AND ([c].[Country] = N'Germany')"); +END) = CAST(1 AS bit) AND [c].[Country] = N'Germany'"); } public override async Task Where_bitwise_and_with_logical_or(bool async) @@ -2888,13 +2888,13 @@ public override async Task Where_bitwise_and_with_logical_or(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 ((CASE +WHERE (CASE WHEN [c].[CustomerID] = N'ALFKI' THEN CAST(1 AS bit) ELSE CAST(0 AS bit) END & CASE WHEN [c].[CustomerID] = N'ANATR' THEN CAST(1 AS bit) ELSE CAST(0 AS bit) -END) = CAST(1 AS bit)) OR ([c].[CustomerID] = N'ANTON')"); +END) = CAST(1 AS bit) OR [c].[CustomerID] = N'ANTON'"); } public override async Task Where_bitwise_binary_not(bool async) @@ -2935,13 +2935,13 @@ public override async Task Select_bitwise_or_with_logical_or(bool async) AssertSql( @"SELECT [c].[CustomerID], CASE - WHEN ((CASE + WHEN (CASE WHEN [c].[CustomerID] = N'ALFKI' THEN CAST(1 AS bit) ELSE CAST(0 AS bit) END | CASE WHEN [c].[CustomerID] = N'ANATR' THEN CAST(1 AS bit) ELSE CAST(0 AS bit) - END) = CAST(1 AS bit)) OR ([c].[CustomerID] = N'ANTON') THEN CAST(1 AS bit) + END) = CAST(1 AS bit) OR [c].[CustomerID] = N'ANTON' THEN CAST(1 AS bit) ELSE CAST(0 AS bit) END AS [Value] FROM [Customers] AS [c] @@ -2954,13 +2954,13 @@ public override async Task Select_bitwise_and_with_logical_and(bool async) AssertSql( @"SELECT [c].[CustomerID], CASE - WHEN ((CASE + WHEN (CASE WHEN [c].[CustomerID] = N'ALFKI' THEN CAST(1 AS bit) ELSE CAST(0 AS bit) END & CASE WHEN [c].[CustomerID] = N'ANATR' THEN CAST(1 AS bit) ELSE CAST(0 AS bit) - END) = CAST(1 AS bit)) AND ([c].[CustomerID] = N'ANTON') THEN CAST(1 AS bit) + END) = CAST(1 AS bit) AND [c].[CustomerID] = N'ANTON' THEN CAST(1 AS bit) ELSE CAST(0 AS bit) END AS [Value] FROM [Customers] AS [c] @@ -2989,7 +2989,7 @@ public override async Task Parameter_extraction_short_circuits_1(bool async) SELECT [o].[OrderID], [o].[CustomerID], [o].[EmployeeID], [o].[OrderDate] FROM [Orders] AS [o] -WHERE ([o].[OrderID] < 10400) AND (([o].[OrderDate] IS NOT NULL AND (DATEPART(month, [o].[OrderDate]) = @__dateFilter_Value_Month_0)) AND (DATEPART(year, [o].[OrderDate]) = @__dateFilter_Value_Year_1))", +WHERE [o].[OrderID] < 10400 AND [o].[OrderDate] IS NOT NULL AND DATEPART(month, [o].[OrderDate]) = @__dateFilter_Value_Month_0 AND DATEPART(year, [o].[OrderDate]) = @__dateFilter_Value_Year_1", // @"SELECT [o].[OrderID], [o].[CustomerID], [o].[EmployeeID], [o].[OrderDate] FROM [Orders] AS [o] @@ -3006,7 +3006,7 @@ public override async Task Parameter_extraction_short_circuits_2(bool async) SELECT [o].[OrderID], [o].[CustomerID], [o].[EmployeeID], [o].[OrderDate] FROM [Orders] AS [o] -WHERE ([o].[OrderID] < 10400) AND (([o].[OrderDate] IS NOT NULL AND (DATEPART(month, [o].[OrderDate]) = @__dateFilter_Value_Month_0)) AND (DATEPART(year, [o].[OrderDate]) = @__dateFilter_Value_Year_1))", +WHERE [o].[OrderID] < 10400 AND [o].[OrderDate] IS NOT NULL AND DATEPART(month, [o].[OrderDate]) = @__dateFilter_Value_Month_0 AND DATEPART(year, [o].[OrderDate]) = @__dateFilter_Value_Year_1", // @"SELECT [o].[OrderID], [o].[CustomerID], [o].[EmployeeID], [o].[OrderDate] FROM [Orders] AS [o] @@ -3023,7 +3023,7 @@ public override async Task Parameter_extraction_short_circuits_3(bool async) SELECT [o].[OrderID], [o].[CustomerID], [o].[EmployeeID], [o].[OrderDate] FROM [Orders] AS [o] -WHERE ([o].[OrderID] < 10400) OR (([o].[OrderDate] IS NOT NULL AND (DATEPART(month, [o].[OrderDate]) = @__dateFilter_Value_Month_0)) AND (DATEPART(year, [o].[OrderDate]) = @__dateFilter_Value_Year_1))", +WHERE [o].[OrderID] < 10400 OR ([o].[OrderDate] IS NOT NULL AND DATEPART(month, [o].[OrderDate]) = @__dateFilter_Value_Month_0 AND DATEPART(year, [o].[OrderDate]) = @__dateFilter_Value_Year_1)", // @"SELECT [o].[OrderID], [o].[CustomerID], [o].[EmployeeID], [o].[OrderDate] FROM [Orders] AS [o]"); @@ -3229,7 +3229,7 @@ public override async Task Select_expression_references_are_updated_correctly_wi SELECT DISTINCT DATEPART(year, [o].[OrderDate]) FROM [Orders] AS [o] -WHERE [o].[OrderDate] IS NOT NULL AND (DATEPART(year, [o].[OrderDate]) < @__nextYear_0)"); +WHERE [o].[OrderDate] IS NOT NULL AND DATEPART(year, [o].[OrderDate]) < @__nextYear_0"); } public override async Task DefaultIfEmpty_without_group_join(bool async) @@ -3299,7 +3299,7 @@ WHERE [o].[OrderID] > 15000 ) AS [t] ON 1 = 1 ) AS [t0] LEFT JOIN [Orders] AS [o0] ON [c].[CustomerID] = [o0].[CustomerID] -WHERE ([c].[City] = N'Seattle') AND ([t0].[OrderID] IS NOT NULL AND [o0].[OrderID] IS NOT NULL) +WHERE [c].[City] = N'Seattle' AND [t0].[OrderID] IS NOT NULL AND [o0].[OrderID] IS NOT NULL ORDER BY [t0].[OrderID], [o0].[OrderDate]"); } @@ -3326,7 +3326,7 @@ OUTER APPLY ( FROM [Orders] AS [o0] WHERE [o0].[OrderID] <= CAST(LEN([c].[CustomerID]) AS int) ) AS [t1] -WHERE ([c].[City] = N'Seattle') AND ([t0].[OrderID] IS NOT NULL AND [t1].[OrderID] IS NOT NULL) +WHERE [c].[City] = N'Seattle' AND [t0].[OrderID] IS NOT NULL AND [t1].[OrderID] IS NOT NULL ORDER BY [t0].[OrderID], [t1].[OrderDate]"); } @@ -3599,11 +3599,11 @@ public override async Task Contains_with_subquery_involving_join_binds_to_correc AssertSql( @"SELECT [o].[OrderID], [o].[CustomerID], [o].[EmployeeID], [o].[OrderDate] FROM [Orders] AS [o] -WHERE ([o].[OrderID] > 11000) AND EXISTS ( +WHERE [o].[OrderID] > 11000 AND EXISTS ( SELECT 1 FROM [Order Details] AS [o0] INNER JOIN [Products] AS [p] ON [o0].[ProductID] = [p].[ProductID] - WHERE ([p].[ProductName] = N'Chai') AND ([o0].[OrderID] = [o].[OrderID]))"); + WHERE [p].[ProductName] = N'Chai' AND [o0].[OrderID] = [o].[OrderID])"); } public override async Task Complex_query_with_repeated_query_model_compiles_correctly(bool async) @@ -3613,7 +3613,7 @@ public override async Task Complex_query_with_repeated_query_model_compiles_corr 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].[CustomerID] = N'ALFKI') AND EXISTS ( +WHERE [c].[CustomerID] = N'ALFKI' AND EXISTS ( SELECT 1 FROM [Customers] AS [c0] WHERE EXISTS ( @@ -3628,7 +3628,7 @@ public override async Task Complex_query_with_repeated_nested_query_model_compil 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].[CustomerID] = N'ALFKI') AND EXISTS ( +WHERE [c].[CustomerID] = N'ALFKI' AND EXISTS ( SELECT 1 FROM [Customers] AS [c0] WHERE EXISTS ( @@ -4235,7 +4235,7 @@ public override async Task Comparing_to_fixed_string_parameter(bool async) SELECT [c].[CustomerID] FROM [Customers] AS [c] -WHERE (@__prefix_0 = N'') OR (LEFT([c].[CustomerID], LEN(@__prefix_0)) = @__prefix_0)"); +WHERE @__prefix_0 = N'' OR LEFT([c].[CustomerID], LEN(@__prefix_0)) = @__prefix_0"); } public override async Task Comparing_entities_using_Equals(bool async) @@ -4246,7 +4246,7 @@ public override async Task Comparing_entities_using_Equals(bool async) @"SELECT [c].[CustomerID] AS [Id1], [c0].[CustomerID] AS [Id2] FROM [Customers] AS [c] CROSS JOIN [Customers] AS [c0] -WHERE ([c].[CustomerID] LIKE N'ALFKI%') AND ([c].[CustomerID] = [c0].[CustomerID]) +WHERE ([c].[CustomerID] LIKE N'ALFKI%') AND [c].[CustomerID] = [c0].[CustomerID] ORDER BY [c].[CustomerID]"); } @@ -4282,7 +4282,7 @@ FROM [Orders] AS [o] CROSS JOIN [Orders] AS [o0] LEFT JOIN [Customers] AS [c] ON [o].[CustomerID] = [c].[CustomerID] LEFT JOIN [Customers] AS [c0] ON [o0].[CustomerID] = [c0].[CustomerID] -WHERE ([o].[CustomerID] IS NOT NULL AND ([o].[CustomerID] LIKE N'A%')) AND (([c].[CustomerID] = [c0].[CustomerID]) OR ([c].[CustomerID] IS NULL AND [c0].[CustomerID] IS NULL)) +WHERE [o].[CustomerID] IS NOT NULL AND ([o].[CustomerID] LIKE N'A%') AND ([c].[CustomerID] = [c0].[CustomerID] OR ([c].[CustomerID] IS NULL AND [c0].[CustomerID] IS NULL)) ORDER BY [o].[OrderID], [o0].[OrderID]"); } @@ -4296,7 +4296,7 @@ FROM [Orders] AS [o] CROSS JOIN [Orders] AS [o0] LEFT JOIN [Customers] AS [c] ON [o].[CustomerID] = [c].[CustomerID] LEFT JOIN [Customers] AS [c0] ON [o0].[CustomerID] = [c0].[CustomerID] -WHERE ([o].[CustomerID] IS NOT NULL AND ([o].[CustomerID] LIKE N'A%')) AND (([c].[CustomerID] = [c0].[CustomerID]) OR ([c].[CustomerID] IS NULL AND [c0].[CustomerID] IS NULL)) +WHERE [o].[CustomerID] IS NOT NULL AND ([o].[CustomerID] LIKE N'A%') AND ([c].[CustomerID] = [c0].[CustomerID] OR ([c].[CustomerID] IS NULL AND [c0].[CustomerID] IS NULL)) ORDER BY [o].[OrderID], [o0].[OrderID]"); } @@ -4341,7 +4341,7 @@ public override async Task Comparing_collection_navigation_to_null_complex(bool FROM [Order Details] AS [o] INNER JOIN [Orders] AS [o0] ON [o].[OrderID] = [o0].[OrderID] LEFT JOIN [Customers] AS [c] ON [o0].[CustomerID] = [c].[CustomerID] -WHERE ([o].[OrderID] < 10250) AND [c].[CustomerID] IS NOT NULL +WHERE [o].[OrderID] < 10250 AND [c].[CustomerID] IS NOT NULL ORDER BY [o].[OrderID], [o].[ProductID]"); } @@ -4363,7 +4363,7 @@ public override async Task Compare_two_collection_navigations_with_different_que @"SELECT [c].[CustomerID] AS [Id1], [c0].[CustomerID] AS [Id2] FROM [Customers] AS [c] CROSS JOIN [Customers] AS [c0] -WHERE (([c].[CustomerID] = N'ALFKI') AND ([c0].[CustomerID] = N'ALFKI')) AND ([c].[CustomerID] = [c0].[CustomerID])"); +WHERE [c].[CustomerID] = N'ALFKI' AND [c0].[CustomerID] = N'ALFKI' AND [c].[CustomerID] = [c0].[CustomerID]"); } public override async Task Compare_two_collection_navigations_using_equals(bool async) @@ -4374,7 +4374,7 @@ public override async Task Compare_two_collection_navigations_using_equals(bool @"SELECT [c].[CustomerID] AS [Id1], [c0].[CustomerID] AS [Id2] FROM [Customers] AS [c] CROSS JOIN [Customers] AS [c0] -WHERE (([c].[CustomerID] = N'ALFKI') AND ([c0].[CustomerID] = N'ALFKI')) AND ([c].[CustomerID] = [c0].[CustomerID])"); +WHERE [c].[CustomerID] = N'ALFKI' AND [c0].[CustomerID] = N'ALFKI' AND [c].[CustomerID] = [c0].[CustomerID]"); } public override async Task Compare_two_collection_navigations_with_different_property_chains(bool async) @@ -4386,7 +4386,7 @@ public override async Task Compare_two_collection_navigations_with_different_pro FROM [Customers] AS [c] CROSS JOIN [Orders] AS [o] LEFT JOIN [Customers] AS [c0] ON [o].[CustomerID] = [c0].[CustomerID] -WHERE ([c].[CustomerID] = N'ALFKI') AND ([c].[CustomerID] = [c0].[CustomerID]) +WHERE [c].[CustomerID] = N'ALFKI' AND [c].[CustomerID] = [c0].[CustomerID] ORDER BY [c].[CustomerID], [o].[OrderID]"); } @@ -4439,10 +4439,10 @@ public override async Task Complex_nested_query_properly_binds_to_grandparent_wh @"SELECT [c].[CustomerID], ( SELECT COUNT(*) FROM [Orders] AS [o] - WHERE ([c].[CustomerID] = [o].[CustomerID]) AND (( + WHERE [c].[CustomerID] = [o].[CustomerID] AND ( SELECT COUNT(*) FROM [Orders] AS [o0] - WHERE [c].[CustomerID] = [o0].[CustomerID]) > 0)) AS [OuterOrders] + WHERE [c].[CustomerID] = [o0].[CustomerID]) > 0) AS [OuterOrders] FROM [Customers] AS [c] WHERE [c].[CustomerID] = N'ALFKI'"); } @@ -4492,7 +4492,7 @@ INNER JOIN ( FROM [Customers] AS [c] WHERE [c].[CustomerID] = N'ALFKI' ) AS [t] ON [o].[CustomerID] = [t].[CustomerID] - WHERE ([o].[OrderID] > 690) AND ([o].[OrderID] < 710) + WHERE [o].[OrderID] > 690 AND [o].[OrderID] < 710 ) AS [t0]"); } @@ -4533,12 +4533,12 @@ public override async Task Let_subquery_with_multiple_occurrences(bool async) @"SELECT ( SELECT COUNT(*) FROM [Order Details] AS [o1] - WHERE ([o].[OrderID] = [o1].[OrderID]) AND ([o1].[Quantity] < CAST(10 AS smallint))) AS [Count] + WHERE [o].[OrderID] = [o1].[OrderID] AND [o1].[Quantity] < CAST(10 AS smallint)) AS [Count] FROM [Orders] AS [o] WHERE EXISTS ( SELECT 1 FROM [Order Details] AS [o0] - WHERE ([o].[OrderID] = [o0].[OrderID]) AND ([o0].[Quantity] < CAST(10 AS smallint)))"); + WHERE [o].[OrderID] = [o0].[OrderID] AND [o0].[Quantity] < CAST(10 AS smallint))"); } public override async Task Let_entity_equality_to_null(bool async) @@ -4569,11 +4569,11 @@ FROM [Orders] AS [o0] WHERE [c].[CustomerID] = [o0].[CustomerID] ORDER BY [o0].[OrderDate]) AS [A] FROM [Customers] AS [c] -WHERE ([c].[CustomerID] LIKE N'A%') AND ((( +WHERE ([c].[CustomerID] LIKE N'A%') AND (( 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] @@ -4644,7 +4644,7 @@ FROM [Customers] AS [c] WHERE ( SELECT COUNT(*) FROM [Orders] AS [o] - WHERE ([c].[CustomerID] = [o].[CustomerID]) AND ([c].[CustomerID] = [o].[CustomerID])) > 0"); + WHERE [c].[CustomerID] = [o].[CustomerID] AND [c].[CustomerID] = [o].[CustomerID]) > 0"); } public override async Task Convert_to_nullable_on_nullable_value_is_ignored(bool async) @@ -4972,7 +4972,7 @@ public override async Task Checked_context_with_arithmetic_does_not_fail(bool is AssertSql( @"SELECT [o].[OrderID], [o].[ProductID], [o].[Discount], [o].[Quantity], [o].[UnitPrice] FROM [Order Details] AS [o] -WHERE ((([o].[Quantity] + CAST(1 AS smallint)) = CAST(5 AS smallint)) AND (([o].[Quantity] - CAST(1 AS smallint)) = CAST(3 AS smallint))) AND (([o].[Quantity] * CAST(1 AS smallint)) = [o].[Quantity]) +WHERE ([o].[Quantity] + CAST(1 AS smallint)) = CAST(5 AS smallint) AND ([o].[Quantity] - CAST(1 AS smallint)) = CAST(3 AS smallint) AND ([o].[Quantity] * CAST(1 AS smallint)) = [o].[Quantity] ORDER BY [o].[OrderID]"); } @@ -5071,7 +5071,7 @@ LEFT JOIN ( SELECT [o].[OrderID], [o].[CustomerID], [o].[EmployeeID], [o].[OrderDate], ROW_NUMBER() OVER(PARTITION BY [o].[CustomerID] ORDER BY [o].[OrderDate], [o].[OrderID]) AS [row] FROM [Orders] AS [o] ) AS [t] - WHERE (2 < [t].[row]) AND ([t].[row] <= 3) + WHERE 2 < [t].[row] AND [t].[row] <= 3 ) AS [t0] ON [c].[CustomerID] = [t0].[CustomerID]"); } @@ -5128,21 +5128,21 @@ public override async Task Pending_selector_in_cardinality_reducing_method_is_ap WHEN EXISTS ( SELECT 1 FROM [Orders] AS [o] - WHERE (EXISTS ( + WHERE EXISTS ( SELECT 1 FROM [Orders] AS [o0] LEFT JOIN [Customers] AS [c0] ON [o0].[CustomerID] = [c0].[CustomerID] - WHERE [c].[CustomerID] = [o0].[CustomerID]) AND ((( + WHERE [c].[CustomerID] = [o0].[CustomerID]) 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] @@ -5278,12 +5278,12 @@ FROM [Customers] AS [c] CROSS APPLY ( SELECT TOP(9) [e].[City], [t0].[City] AS [c1] FROM [Employees] AS [e] - WHERE ([t0].[City] = [e].[City]) OR ([t0].[City] IS NULL AND [e].[City] IS NULL) + WHERE [t0].[City] = [e].[City] OR ([t0].[City] IS NULL AND [e].[City] IS NULL) ) AS [t1] CROSS APPLY ( SELECT TOP(9) [t0].[City], [e0].[EmployeeID] FROM [Employees] AS [e0] - WHERE ([t1].[City] = [e0].[City]) OR ([t1].[City] IS NULL AND [e0].[City] IS NULL) + WHERE [t1].[City] = [e0].[City] OR ([t1].[City] IS NULL AND [e0].[City] IS NULL) ) AS [t2]"); } diff --git a/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindNavigationsQuerySqlServerTest.cs b/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindNavigationsQuerySqlServerTest.cs index 7329ed7a2e3..13e48f30ae0 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) @@ -497,7 +497,7 @@ FROM [Customers] AS [c] WHERE EXISTS ( SELECT 1 FROM [Orders] AS [o] - WHERE ([c].[CustomerID] = [o].[CustomerID]) AND ([o].[OrderID] > 0))"); + WHERE [c].[CustomerID] = [o].[CustomerID] AND [o].[OrderID] > 0)"); } public override async Task Collection_select_nav_prop_all(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) @@ -603,7 +603,7 @@ FROM [Order Details] AS [o0] WHEN EXISTS ( SELECT 1 FROM [Order Details] AS [o1] - WHERE ([o].[OrderID] = [o1].[OrderID]) AND ([o1].[UnitPrice] > 10.0)) THEN CAST(1 AS bit) + WHERE [o].[OrderID] = [o1].[OrderID] AND [o1].[UnitPrice] > 10.0) THEN CAST(1 AS bit) ELSE CAST(0 AS bit) END AS [any], CASE WHEN [o].[CustomerID] = N'ALFKI' THEN N'50' @@ -612,7 +612,7 @@ ELSE N'10' WHEN NOT EXISTS ( SELECT 1 FROM [Order Details] AS [o2] - WHERE ([o].[OrderID] = [o2].[OrderID]) AND ([o2].[OrderID] <> 42)) THEN CAST(1 AS bit) + WHERE [o].[OrderID] = [o2].[OrderID] AND [o2].[OrderID] <> 42) THEN CAST(1 AS bit) ELSE CAST(0 AS bit) END AS [all], ( SELECT COUNT_BIG(*) @@ -852,12 +852,12 @@ public override void Navigation_in_subquery_referencing_outer_query() @"SELECT [o].[OrderID], [o].[CustomerID], [o].[EmployeeID], [o].[OrderDate] FROM [Orders] AS [o] LEFT JOIN [Customers] AS [c] ON [o].[CustomerID] = [c].[CustomerID] -WHERE (( +WHERE ( SELECT COUNT(*) FROM [Order Details] AS [o0] INNER JOIN [Orders] AS [o1] ON [o0].[OrderID] = [o1].[OrderID] LEFT JOIN [Customers] AS [c0] ON [o1].[CustomerID] = [c0].[CustomerID] - WHERE ([c].[Country] = [c0].[Country]) OR ([c].[Country] IS NULL AND [c0].[Country] IS NULL)) > 0) AND [o].[OrderID] IN (10643, 10692)"); + WHERE [c].[Country] = [c0].[Country] OR ([c].[Country] IS NULL AND [c0].[Country] IS NULL)) > 0 AND [o].[OrderID] IN (10643, 10692)"); } public override async Task Project_single_scalar_value_subquery_is_properly_inlined(bool async) @@ -954,7 +954,7 @@ FROM [Orders] AS [o] WHERE ( SELECT COUNT(*) FROM [Orders] AS [o0] - WHERE ([c].[CustomerID] IS NOT NULL AND ([c].[CustomerID] = [o0].[CustomerID])) AND ([o0].[OrderID] > 10260)) > 30"); + WHERE [c].[CustomerID] IS NOT NULL AND [c].[CustomerID] = [o0].[CustomerID] AND [o0].[OrderID] > 10260) > 30"); } public override async Task Multiple_include_with_multiple_optional_navigations(bool async) diff --git a/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindQueryFiltersQuerySqlServerTest.cs b/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindQueryFiltersQuerySqlServerTest.cs index fd532180a09..2059e43098f 100644 --- a/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindQueryFiltersQuerySqlServerTest.cs +++ b/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindQueryFiltersQuerySqlServerTest.cs @@ -30,7 +30,7 @@ public override async Task Count_query(bool async) SELECT COUNT(*) FROM [Customers] AS [c] -WHERE (@__ef_filter__TenantPrefix_0 = N'') OR ([c].[CompanyName] IS NOT NULL AND (LEFT([c].[CompanyName], LEN(@__ef_filter__TenantPrefix_0)) = @__ef_filter__TenantPrefix_0))"); +WHERE @__ef_filter__TenantPrefix_0 = N'' OR ([c].[CompanyName] IS NOT NULL AND LEFT([c].[CompanyName], LEN(@__ef_filter__TenantPrefix_0)) = @__ef_filter__TenantPrefix_0)"); } public override async Task Materialized_query(bool async) @@ -42,7 +42,7 @@ public override async Task Materialized_query(bool async) SELECT [c].[CustomerID], [c].[Address], [c].[City], [c].[CompanyName], [c].[ContactName], [c].[ContactTitle], [c].[Country], [c].[Fax], [c].[Phone], [c].[PostalCode], [c].[Region] FROM [Customers] AS [c] -WHERE (@__ef_filter__TenantPrefix_0 = N'') OR ([c].[CompanyName] IS NOT NULL AND (LEFT([c].[CompanyName], LEN(@__ef_filter__TenantPrefix_0)) = @__ef_filter__TenantPrefix_0))"); +WHERE @__ef_filter__TenantPrefix_0 = N'' OR ([c].[CompanyName] IS NOT NULL AND LEFT([c].[CompanyName], LEN(@__ef_filter__TenantPrefix_0)) = @__ef_filter__TenantPrefix_0)"); } public override async Task Find(bool async) @@ -55,7 +55,7 @@ public override async Task Find(bool async) SELECT TOP(1) [c].[CustomerID], [c].[Address], [c].[City], [c].[CompanyName], [c].[ContactName], [c].[ContactTitle], [c].[Country], [c].[Fax], [c].[Phone], [c].[PostalCode], [c].[Region] FROM [Customers] AS [c] -WHERE ((@__ef_filter__TenantPrefix_0 = N'') OR ([c].[CompanyName] IS NOT NULL AND (LEFT([c].[CompanyName], LEN(@__ef_filter__TenantPrefix_0)) = @__ef_filter__TenantPrefix_0))) AND ([c].[CustomerID] = @__p_0)"); +WHERE (@__ef_filter__TenantPrefix_0 = N'' OR ([c].[CompanyName] IS NOT NULL AND LEFT([c].[CompanyName], LEN(@__ef_filter__TenantPrefix_0)) = @__ef_filter__TenantPrefix_0)) AND [c].[CustomerID] = @__p_0"); } public override async Task Materialized_query_parameter(bool async) @@ -67,7 +67,7 @@ public override async Task Materialized_query_parameter(bool async) SELECT [c].[CustomerID], [c].[Address], [c].[City], [c].[CompanyName], [c].[ContactName], [c].[ContactTitle], [c].[Country], [c].[Fax], [c].[Phone], [c].[PostalCode], [c].[Region] FROM [Customers] AS [c] -WHERE (@__ef_filter__TenantPrefix_0 = N'') OR ([c].[CompanyName] IS NOT NULL AND (LEFT([c].[CompanyName], LEN(@__ef_filter__TenantPrefix_0)) = @__ef_filter__TenantPrefix_0))"); +WHERE @__ef_filter__TenantPrefix_0 = N'' OR ([c].[CompanyName] IS NOT NULL AND LEFT([c].[CompanyName], LEN(@__ef_filter__TenantPrefix_0)) = @__ef_filter__TenantPrefix_0)"); } public override async Task Materialized_query_parameter_new_context(bool async) @@ -79,13 +79,13 @@ public override async Task Materialized_query_parameter_new_context(bool async) SELECT [c].[CustomerID], [c].[Address], [c].[City], [c].[CompanyName], [c].[ContactName], [c].[ContactTitle], [c].[Country], [c].[Fax], [c].[Phone], [c].[PostalCode], [c].[Region] FROM [Customers] AS [c] -WHERE (@__ef_filter__TenantPrefix_0 = N'') OR ([c].[CompanyName] IS NOT NULL AND (LEFT([c].[CompanyName], LEN(@__ef_filter__TenantPrefix_0)) = @__ef_filter__TenantPrefix_0))", +WHERE @__ef_filter__TenantPrefix_0 = N'' OR ([c].[CompanyName] IS NOT NULL AND LEFT([c].[CompanyName], LEN(@__ef_filter__TenantPrefix_0)) = @__ef_filter__TenantPrefix_0)", // @"@__ef_filter__TenantPrefix_0='T' (Size = 4000) SELECT [c].[CustomerID], [c].[Address], [c].[City], [c].[CompanyName], [c].[ContactName], [c].[ContactTitle], [c].[Country], [c].[Fax], [c].[Phone], [c].[PostalCode], [c].[Region] FROM [Customers] AS [c] -WHERE (@__ef_filter__TenantPrefix_0 = N'') OR ([c].[CompanyName] IS NOT NULL AND (LEFT([c].[CompanyName], LEN(@__ef_filter__TenantPrefix_0)) = @__ef_filter__TenantPrefix_0))"); +WHERE @__ef_filter__TenantPrefix_0 = N'' OR ([c].[CompanyName] IS NOT NULL AND LEFT([c].[CompanyName], LEN(@__ef_filter__TenantPrefix_0)) = @__ef_filter__TenantPrefix_0)"); } public override async Task Projection_query_parameter(bool async) @@ -97,7 +97,7 @@ public override async Task Projection_query_parameter(bool async) SELECT [c].[CustomerID] FROM [Customers] AS [c] -WHERE (@__ef_filter__TenantPrefix_0 = N'') OR ([c].[CompanyName] IS NOT NULL AND (LEFT([c].[CompanyName], LEN(@__ef_filter__TenantPrefix_0)) = @__ef_filter__TenantPrefix_0))"); +WHERE @__ef_filter__TenantPrefix_0 = N'' OR ([c].[CompanyName] IS NOT NULL AND LEFT([c].[CompanyName], LEN(@__ef_filter__TenantPrefix_0)) = @__ef_filter__TenantPrefix_0)"); } public override async Task Projection_query(bool async) @@ -109,7 +109,7 @@ public override async Task Projection_query(bool async) SELECT [c].[CustomerID] FROM [Customers] AS [c] -WHERE (@__ef_filter__TenantPrefix_0 = N'') OR ([c].[CompanyName] IS NOT NULL AND (LEFT([c].[CompanyName], LEN(@__ef_filter__TenantPrefix_0)) = @__ef_filter__TenantPrefix_0))"); +WHERE @__ef_filter__TenantPrefix_0 = N'' OR ([c].[CompanyName] IS NOT NULL AND LEFT([c].[CompanyName], LEN(@__ef_filter__TenantPrefix_0)) = @__ef_filter__TenantPrefix_0)"); } public override async Task Include_query(bool async) @@ -127,11 +127,11 @@ FROM [Orders] AS [o] LEFT JOIN ( SELECT [c0].[CustomerID], [c0].[CompanyName] FROM [Customers] AS [c0] - WHERE (@__ef_filter__TenantPrefix_0 = N'') OR ([c0].[CompanyName] IS NOT NULL AND (LEFT([c0].[CompanyName], LEN(@__ef_filter__TenantPrefix_0)) = @__ef_filter__TenantPrefix_0)) + WHERE @__ef_filter__TenantPrefix_0 = N'' OR ([c0].[CompanyName] IS NOT NULL AND LEFT([c0].[CompanyName], LEN(@__ef_filter__TenantPrefix_0)) = @__ef_filter__TenantPrefix_0) ) AS [t] ON [o].[CustomerID] = [t].[CustomerID] WHERE [t].[CustomerID] IS NOT NULL -) AS [t0] ON [t0].[CompanyName] IS NOT NULL AND ([c].[CustomerID] = [t0].[CustomerID]) -WHERE (@__ef_filter__TenantPrefix_0 = N'') OR ([c].[CompanyName] IS NOT NULL AND (LEFT([c].[CompanyName], LEN(@__ef_filter__TenantPrefix_0)) = @__ef_filter__TenantPrefix_0)) +) AS [t0] ON [t0].[CompanyName] IS NOT NULL AND [c].[CustomerID] = [t0].[CustomerID] +WHERE @__ef_filter__TenantPrefix_0 = N'' OR ([c].[CompanyName] IS NOT NULL AND LEFT([c].[CompanyName], LEN(@__ef_filter__TenantPrefix_0)) = @__ef_filter__TenantPrefix_0) ORDER BY [c].[CustomerID], [t0].[OrderID]"); } @@ -158,7 +158,7 @@ FROM [Orders] AS [o] LEFT JOIN ( SELECT [c].[CustomerID], [c].[Address], [c].[City], [c].[CompanyName], [c].[ContactName], [c].[ContactTitle], [c].[Country], [c].[Fax], [c].[Phone], [c].[PostalCode], [c].[Region] FROM [Customers] AS [c] - WHERE (@__ef_filter__TenantPrefix_0 = N'') OR ([c].[CompanyName] IS NOT NULL AND (LEFT([c].[CompanyName], LEN(@__ef_filter__TenantPrefix_0)) = @__ef_filter__TenantPrefix_0)) + WHERE @__ef_filter__TenantPrefix_0 = N'' OR ([c].[CompanyName] IS NOT NULL AND LEFT([c].[CompanyName], LEN(@__ef_filter__TenantPrefix_0)) = @__ef_filter__TenantPrefix_0) ) AS [t] ON [o].[CustomerID] = [t].[CustomerID] WHERE [t].[CustomerID] IS NOT NULL AND [t].[CompanyName] IS NOT NULL"); } @@ -179,7 +179,7 @@ FROM [Orders] AS [o0] LEFT JOIN ( SELECT [c].[CustomerID], [c].[CompanyName] FROM [Customers] AS [c] - WHERE (@__ef_filter__TenantPrefix_1 = N'') OR ([c].[CompanyName] IS NOT NULL AND (LEFT([c].[CompanyName], LEN(@__ef_filter__TenantPrefix_1)) = @__ef_filter__TenantPrefix_1)) + WHERE @__ef_filter__TenantPrefix_1 = N'' OR ([c].[CompanyName] IS NOT NULL AND LEFT([c].[CompanyName], LEN(@__ef_filter__TenantPrefix_1)) = @__ef_filter__TenantPrefix_1) ) AS [t] ON [o0].[CustomerID] = [t].[CustomerID] WHERE [t].[CustomerID] IS NOT NULL AND [t].[CompanyName] IS NOT NULL ) AS [t0] ON [o].[OrderID] = [t0].[OrderID] @@ -202,10 +202,10 @@ FROM [Orders] AS [o] LEFT JOIN ( SELECT [c0].[CustomerID], [c0].[CompanyName] FROM [Customers] AS [c0] - WHERE (@__ef_filter__TenantPrefix_0 = N'') OR ([c0].[CompanyName] IS NOT NULL AND (LEFT([c0].[CompanyName], LEN(@__ef_filter__TenantPrefix_0)) = @__ef_filter__TenantPrefix_0)) + WHERE @__ef_filter__TenantPrefix_0 = N'' OR ([c0].[CompanyName] IS NOT NULL AND LEFT([c0].[CompanyName], LEN(@__ef_filter__TenantPrefix_0)) = @__ef_filter__TenantPrefix_0) ) AS [t] ON [o].[CustomerID] = [t].[CustomerID] WHERE [t].[CustomerID] IS NOT NULL -) AS [t0] ON [t0].[CompanyName] IS NOT NULL AND ([c].[CustomerID] = [t0].[CustomerID]) +) AS [t0] ON [t0].[CompanyName] IS NOT NULL AND [c].[CustomerID] = [t0].[CustomerID] INNER JOIN ( SELECT [o0].[OrderID], [o0].[Discount] FROM [Order Details] AS [o0] @@ -215,13 +215,13 @@ FROM [Orders] AS [o1] LEFT JOIN ( SELECT [c1].[CustomerID], [c1].[CompanyName] FROM [Customers] AS [c1] - WHERE (@__ef_filter__TenantPrefix_0 = N'') OR ([c1].[CompanyName] IS NOT NULL AND (LEFT([c1].[CompanyName], LEN(@__ef_filter__TenantPrefix_0)) = @__ef_filter__TenantPrefix_0)) + WHERE @__ef_filter__TenantPrefix_0 = N'' OR ([c1].[CompanyName] IS NOT NULL AND LEFT([c1].[CompanyName], LEN(@__ef_filter__TenantPrefix_0)) = @__ef_filter__TenantPrefix_0) ) AS [t3] ON [o1].[CustomerID] = [t3].[CustomerID] WHERE [t3].[CustomerID] IS NOT NULL AND [t3].[CompanyName] IS NOT NULL ) AS [t2] ON [o0].[OrderID] = [t2].[OrderID] WHERE [o0].[Quantity] > @__ef_filter___quantity_1 ) AS [t1] ON [t0].[OrderID] = [t1].[OrderID] -WHERE ((@__ef_filter__TenantPrefix_0 = N'') OR ([c].[CompanyName] IS NOT NULL AND (LEFT([c].[CompanyName], LEN(@__ef_filter__TenantPrefix_0)) = @__ef_filter__TenantPrefix_0))) AND ([t1].[Discount] < CAST(10 AS real))"); +WHERE (@__ef_filter__TenantPrefix_0 = N'' OR ([c].[CompanyName] IS NOT NULL AND LEFT([c].[CompanyName], LEN(@__ef_filter__TenantPrefix_0)) = @__ef_filter__TenantPrefix_0)) AND [t1].[Discount] < CAST(10 AS real)"); } [ConditionalFact] @@ -241,7 +241,7 @@ public void FromSql_is_composed() FROM ( select * from Customers ) AS [m] -WHERE (@__ef_filter__TenantPrefix_0 = N'') OR ([m].[CompanyName] IS NOT NULL AND (LEFT([m].[CompanyName], LEN(@__ef_filter__TenantPrefix_0)) = @__ef_filter__TenantPrefix_0))"); +WHERE @__ef_filter__TenantPrefix_0 = N'' OR ([m].[CompanyName] IS NOT NULL AND LEFT([m].[CompanyName], LEN(@__ef_filter__TenantPrefix_0)) = @__ef_filter__TenantPrefix_0)"); } [ConditionalFact] @@ -264,7 +264,7 @@ public void FromSql_is_composed_when_filter_has_navigation() LEFT JOIN ( SELECT [c].[CustomerID], [c].[CompanyName] FROM [Customers] AS [c] - WHERE (@__ef_filter__TenantPrefix_0 = N'') OR ([c].[CompanyName] IS NOT NULL AND (LEFT([c].[CompanyName], LEN(@__ef_filter__TenantPrefix_0)) = @__ef_filter__TenantPrefix_0)) + WHERE @__ef_filter__TenantPrefix_0 = N'' OR ([c].[CompanyName] IS NOT NULL AND LEFT([c].[CompanyName], LEN(@__ef_filter__TenantPrefix_0)) = @__ef_filter__TenantPrefix_0) ) AS [t] ON [m].[CustomerID] = [t].[CustomerID] WHERE [t].[CustomerID] IS NOT NULL AND [t].[CompanyName] IS NOT NULL"); } @@ -279,14 +279,14 @@ public override void Compiled_query() SELECT [c].[CustomerID], [c].[Address], [c].[City], [c].[CompanyName], [c].[ContactName], [c].[ContactTitle], [c].[Country], [c].[Fax], [c].[Phone], [c].[PostalCode], [c].[Region] FROM [Customers] AS [c] -WHERE ((@__ef_filter__TenantPrefix_0 = N'') OR ([c].[CompanyName] IS NOT NULL AND (LEFT([c].[CompanyName], LEN(@__ef_filter__TenantPrefix_0)) = @__ef_filter__TenantPrefix_0))) AND ([c].[CustomerID] = @__customerID)", +WHERE (@__ef_filter__TenantPrefix_0 = N'' OR ([c].[CompanyName] IS NOT NULL AND LEFT([c].[CompanyName], LEN(@__ef_filter__TenantPrefix_0)) = @__ef_filter__TenantPrefix_0)) AND [c].[CustomerID] = @__customerID", // @"@__ef_filter__TenantPrefix_0='B' (Size = 4000) @__customerID='BLAUS' (Size = 5) (DbType = StringFixedLength) SELECT [c].[CustomerID], [c].[Address], [c].[City], [c].[CompanyName], [c].[ContactName], [c].[ContactTitle], [c].[Country], [c].[Fax], [c].[Phone], [c].[PostalCode], [c].[Region] FROM [Customers] AS [c] -WHERE ((@__ef_filter__TenantPrefix_0 = N'') OR ([c].[CompanyName] IS NOT NULL AND (LEFT([c].[CompanyName], LEN(@__ef_filter__TenantPrefix_0)) = @__ef_filter__TenantPrefix_0))) AND ([c].[CustomerID] = @__customerID)"); +WHERE (@__ef_filter__TenantPrefix_0 = N'' OR ([c].[CompanyName] IS NOT NULL AND LEFT([c].[CompanyName], LEN(@__ef_filter__TenantPrefix_0)) = @__ef_filter__TenantPrefix_0)) AND [c].[CustomerID] = @__customerID"); } public override async Task Entity_Equality(bool async) @@ -301,7 +301,7 @@ FROM [Orders] AS [o] LEFT JOIN ( SELECT [c].[CustomerID], [c].[CompanyName] FROM [Customers] AS [c] - WHERE (@__ef_filter__TenantPrefix_0 = N'') OR ([c].[CompanyName] IS NOT NULL AND (LEFT([c].[CompanyName], LEN(@__ef_filter__TenantPrefix_0)) = @__ef_filter__TenantPrefix_0)) + WHERE @__ef_filter__TenantPrefix_0 = N'' OR ([c].[CompanyName] IS NOT NULL AND LEFT([c].[CompanyName], LEN(@__ef_filter__TenantPrefix_0)) = @__ef_filter__TenantPrefix_0) ) AS [t] ON [o].[CustomerID] = [t].[CustomerID] WHERE [t].[CustomerID] IS NOT NULL AND [t].[CompanyName] IS NOT NULL"); } diff --git a/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindSelectQuerySqlServerTest.cs b/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindSelectQuerySqlServerTest.cs index caff165231e..30c33b60dab 100644 --- a/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindSelectQuerySqlServerTest.cs +++ b/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindSelectQuerySqlServerTest.cs @@ -318,7 +318,7 @@ public override void Select_nested_collection_multi_level2() @"SELECT ( SELECT TOP(1) [o].[OrderDate] FROM [Orders] AS [o] - WHERE ([c].[CustomerID] = [o].[CustomerID]) AND ([o].[OrderID] < 10500)) AS [OrderDates] + WHERE [c].[CustomerID] = [o].[CustomerID] AND [o].[OrderID] < 10500) AS [OrderDates] FROM [Customers] AS [c] WHERE [c].[CustomerID] LIKE N'A%'"); } @@ -331,7 +331,7 @@ public override void Select_nested_collection_multi_level3() @"SELECT ( SELECT TOP(1) [o].[OrderDate] FROM [Orders] AS [o] - WHERE ([o].[OrderID] < 10500) AND ([c].[CustomerID] = [o].[CustomerID])) AS [OrderDates] + WHERE [o].[OrderID] < 10500 AND [c].[CustomerID] = [o].[CustomerID]) AS [OrderDates] FROM [Customers] AS [c] WHERE [c].[CustomerID] LIKE N'A%'"); } @@ -345,9 +345,9 @@ public override void Select_nested_collection_multi_level4() SELECT TOP(1) ( SELECT COUNT(*) FROM [Order Details] AS [o0] - WHERE ([o].[OrderID] = [o0].[OrderID]) AND ([o0].[OrderID] > 10)) + WHERE [o].[OrderID] = [o0].[OrderID] AND [o0].[OrderID] > 10) FROM [Orders] AS [o] - WHERE ([c].[CustomerID] = [o].[CustomerID]) AND ([o].[OrderID] < 10500)), 0) AS [Order] + WHERE [c].[CustomerID] = [o].[CustomerID] AND [o].[OrderID] < 10500), 0) AS [Order] FROM [Customers] AS [c] WHERE [c].[CustomerID] LIKE N'A%'"); } @@ -361,15 +361,15 @@ public override void Select_nested_collection_multi_level5() SELECT TOP(1) COALESCE(( SELECT TOP(1) [o0].[ProductID] FROM [Order Details] AS [o0] - WHERE ([o].[OrderID] = [o0].[OrderID]) AND (([o0].[OrderID] <> ( + WHERE [o].[OrderID] = [o0].[OrderID] AND ([o0].[OrderID] <> ( SELECT COUNT(*) FROM [Orders] AS [o1] - WHERE [c].[CustomerID] = [o1].[CustomerID])) OR ( + WHERE [c].[CustomerID] = [o1].[CustomerID]) OR ( SELECT COUNT(*) FROM [Orders] AS [o1] WHERE [c].[CustomerID] = [o1].[CustomerID]) IS NULL)), 0) FROM [Orders] AS [o] - WHERE ([c].[CustomerID] = [o].[CustomerID]) AND ([o].[OrderID] < 10500)), 0) AS [Order] + WHERE [c].[CustomerID] = [o].[CustomerID] AND [o].[OrderID] < 10500), 0) AS [Order] FROM [Customers] AS [c] WHERE [c].[CustomerID] LIKE N'A%'"); } @@ -383,9 +383,9 @@ public override void Select_nested_collection_multi_level6() SELECT TOP(1) COALESCE(( SELECT TOP(1) [o0].[ProductID] FROM [Order Details] AS [o0] - WHERE ([o].[OrderID] = [o0].[OrderID]) AND ([o0].[OrderID] <> CAST(LEN([c].[CustomerID]) AS int))), 0) + WHERE [o].[OrderID] = [o0].[OrderID] AND [o0].[OrderID] <> CAST(LEN([c].[CustomerID]) AS int)), 0) FROM [Orders] AS [o] - WHERE ([c].[CustomerID] = [o].[CustomerID]) AND ([o].[OrderID] < 10500)), 0) AS [Order] + WHERE [c].[CustomerID] = [o].[CustomerID] AND [o].[OrderID] < 10500), 0) AS [Order] FROM [Customers] AS [c] WHERE [c].[CustomerID] LIKE N'A%'"); } @@ -952,7 +952,7 @@ public override async Task Projecting_nullable_struct(bool async) AssertSql( @"SELECT [o].[CustomerID], CASE - WHEN ([o].[CustomerID] = N'ALFKI') AND [o].[CustomerID] IS NOT NULL THEN CAST(1 AS bit) + WHEN [o].[CustomerID] = N'ALFKI' AND [o].[CustomerID] IS NOT NULL THEN CAST(1 AS bit) ELSE CAST(0 AS bit) END, [o].[OrderID], CAST(LEN([o].[CustomerID]) AS int) FROM [Orders] AS [o]"); @@ -1058,7 +1058,7 @@ FROM [Customers] AS [c] OUTER APPLY ( SELECT [c].[City] FROM [Orders] AS [o] - WHERE ([c].[CustomerID] <> [o].[CustomerID]) OR [o].[CustomerID] IS NULL + WHERE [c].[CustomerID] <> [o].[CustomerID] OR [o].[CustomerID] IS NULL ) AS [t]"); } @@ -1072,7 +1072,7 @@ FROM [Customers] AS [c] OUTER APPLY ( SELECT TOP(2) [o].[OrderID], [o].[CustomerID], [o].[EmployeeID], [o].[OrderDate] FROM [Orders] AS [o] - WHERE ([c].[CustomerID] <> [o].[CustomerID]) OR [o].[CustomerID] IS NULL + WHERE [c].[CustomerID] <> [o].[CustomerID] OR [o].[CustomerID] IS NULL ORDER BY [c].[City], [o].[OrderID] ) AS [t]"); } @@ -1577,10 +1577,10 @@ LEFT JOIN ( FROM [Orders] AS [o0] WHERE [o0].[OrderID] < 10750 ) AS [t] ON [c].[CustomerID] = [t].[CustomerID] -WHERE ([c].[CustomerID] LIKE N'A%') AND (( +WHERE ([c].[CustomerID] LIKE N'A%') AND ( SELECT COUNT(*) FROM [Orders] AS [o] - WHERE ([o].[CustomerID] = [c].[CustomerID]) AND ([o].[OrderID] < 11000)) > 0) + WHERE [o].[CustomerID] = [c].[CustomerID] AND [o].[OrderID] < 11000) > 0 ORDER BY [c].[CustomerID]"); } @@ -1590,7 +1590,7 @@ public override async Task Projection_custom_type_in_both_sides_of_ternary(bool AssertSql( @"SELECT CASE - WHEN ([c].[City] = N'Seattle') AND [c].[City] IS NOT NULL THEN CAST(1 AS bit) + WHEN [c].[City] = N'Seattle' AND [c].[City] IS NOT NULL THEN CAST(1 AS bit) ELSE CAST(0 AS bit) END FROM [Customers] AS [c] @@ -1788,7 +1788,7 @@ FROM [Orders] AS [o] OUTER APPLY ( SELECT [t].[CustomerID], [o0].[OrderID], [o0].[OrderDate] FROM [Orders] AS [o0] - WHERE [o0].[OrderID] IN (10248, 10249, 10250) AND (([t].[CustomerID] = [o0].[CustomerID]) OR ([t].[CustomerID] IS NULL AND [o0].[CustomerID] IS NULL)) + WHERE [o0].[OrderID] IN (10248, 10249, 10250) AND ([t].[CustomerID] = [o0].[CustomerID] OR ([t].[CustomerID] IS NULL AND [o0].[CustomerID] IS NULL)) ) AS [t0] ORDER BY [t].[CustomerID], [t0].[OrderID]"); } @@ -1806,7 +1806,7 @@ FROM [Orders] AS [o] OUTER APPLY ( SELECT [t].[OrderID] AS [Outer], [o0].[OrderID] AS [Inner], [o0].[OrderDate] FROM [Orders] AS [o0] - WHERE [o0].[OrderID] IN (10248, 10249, 10250) AND ([t].[OrderID] = [o0].[OrderID]) + WHERE [o0].[OrderID] IN (10248, 10249, 10250) AND [t].[OrderID] = [o0].[OrderID] ) AS [t0] ORDER BY [t].[OrderID]"); } @@ -1824,7 +1824,7 @@ FROM [Orders] AS [o] OUTER APPLY ( SELECT [t].[OrderDate] AS [Outer1], [t].[CustomerID] AS [Outer2], [o0].[OrderID] AS [Inner], [o0].[OrderDate] FROM [Orders] AS [o0] - WHERE [o0].[OrderID] IN (10248, 10249, 10250) AND (([t].[CustomerID] = [o0].[CustomerID]) OR ([t].[CustomerID] IS NULL AND [o0].[CustomerID] IS NULL)) + WHERE [o0].[OrderID] IN (10248, 10249, 10250) AND ([t].[CustomerID] = [o0].[CustomerID] OR ([t].[CustomerID] IS NULL AND [o0].[CustomerID] IS NULL)) ) AS [t0] ORDER BY [t].[OrderDate], [t].[CustomerID]"); } @@ -1861,7 +1861,7 @@ FROM [Orders] AS [o] OUTER APPLY ( SELECT [t].[OrderID] AS [Outer], [o0].[OrderID] AS [Inner], [o0].[OrderDate] FROM [Orders] AS [o0] - WHERE [o0].[OrderID] IN (10248, 10249, 10250) AND ([t].[OrderID] = [o0].[OrderID]) + WHERE [o0].[OrderID] IN (10248, 10249, 10250) AND [t].[OrderID] = [o0].[OrderID] ) AS [t0] ORDER BY [t].[OrderID]"); } @@ -1881,7 +1881,7 @@ OUTER APPLY ( FROM [Orders] AS [o0] WHERE [o].[CustomerID] = [c].[CustomerID] ) AS [t] - WHERE (DATEPART(year, [o].[OrderDate]) = 1997) AND ([c].[CustomerID] = [o].[CustomerID]) + WHERE DATEPART(year, [o].[OrderDate]) = 1997 AND [c].[CustomerID] = [o].[CustomerID] ) AS [t0] WHERE [c].[City] = N'London' ORDER BY [c].[CustomerID], [t0].[OrderID], [t0].[OrderID00]"); @@ -1903,12 +1903,12 @@ OUTER APPLY ( FROM ( SELECT DISTINCT [o].[OrderID], [o].[CustomerID], [o].[EmployeeID], [o].[OrderDate] FROM [Orders] AS [o] - WHERE (([o].[CustomerID] = [t].[City]) OR ([o].[CustomerID] IS NULL AND [t].[City] IS NULL)) AND (DATEPART(year, [o].[OrderDate]) = 1997) + WHERE ([o].[CustomerID] = [t].[City] OR ([o].[CustomerID] IS NULL AND [t].[City] IS NULL)) AND DATEPART(year, [o].[OrderDate]) = 1997 ) AS [t0] OUTER APPLY ( SELECT [t0].[OrderID], [o0].[OrderID] AS [OrderID0] FROM [Orders] AS [o0] - WHERE ([t0].[CustomerID] = [t].[City]) OR ([t0].[CustomerID] IS NULL AND [t].[City] IS NULL) + WHERE [t0].[CustomerID] = [t].[City] OR ([t0].[CustomerID] IS NULL AND [t].[City] IS NULL) ) AS [t2] ) AS [t1] ORDER BY [t].[City], [t1].[OrderID], [t1].[OrderID00]"); @@ -2005,7 +2005,7 @@ ORDER BY [c].[CustomerID] ) AS [t] OUTER APPLY ( SELECT CASE - WHEN ([t1].[CustomerID] = [c0].[CustomerID]) OR ([t1].[CustomerID] IS NULL AND [c0].[CustomerID] IS NULL) THEN N'A' + WHEN [t1].[CustomerID] = [c0].[CustomerID] OR ([t1].[CustomerID] IS NULL AND [c0].[CustomerID] IS NULL) THEN N'A' ELSE N'B' END AS [Title], [t1].[OrderID], [c0].[CustomerID], [t1].[OrderDate] FROM ( @@ -2045,7 +2045,7 @@ public override async Task Client_projection_with_string_initialization_with_sca @"SELECT [c].[CustomerID], ( SELECT TOP(1) [o].[OrderDate] FROM [Orders] AS [o] - WHERE ([c].[CustomerID] = [o].[CustomerID]) AND ([o].[OrderID] < 11000)), [c].[City], N'test' + COALESCE([c].[City], N'') + WHERE [c].[CustomerID] = [o].[CustomerID] AND [o].[OrderID] < 11000), [c].[City], N'test' + COALESCE([c].[City], N'') FROM [Customers] AS [c] WHERE [c].[CustomerID] LIKE N'F%'"); } diff --git a/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindSplitIncludeQuerySqlServerTest.cs b/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindSplitIncludeQuerySqlServerTest.cs index 1dd81937eaf..ce1e629af8a 100644 --- a/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindSplitIncludeQuerySqlServerTest.cs +++ b/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindSplitIncludeQuerySqlServerTest.cs @@ -30,7 +30,7 @@ public override async Task Include_list(bool async) AssertSql( @"SELECT [p].[ProductID], [p].[Discontinued], [p].[ProductName], [p].[SupplierID], [p].[UnitPrice], [p].[UnitsInStock] FROM [Products] AS [p] -WHERE (([p].[ProductID] % 17) = 5) AND ([p].[UnitPrice] < 20.0) +WHERE ([p].[ProductID] % 17) = 5 AND [p].[UnitPrice] < 20.0 ORDER BY [p].[ProductID]", // @"SELECT [t].[OrderID], [t].[ProductID], [t].[Discount], [t].[Quantity], [t].[UnitPrice], [t].[OrderID0], [t].[CustomerID], [t].[EmployeeID], [t].[OrderDate], [p].[ProductID] @@ -40,7 +40,7 @@ INNER JOIN ( FROM [Order Details] AS [o] INNER JOIN [Orders] AS [o0] ON [o].[OrderID] = [o0].[OrderID] ) AS [t] ON [p].[ProductID] = [t].[ProductID] -WHERE (([p].[ProductID] % 17) = 5) AND ([p].[UnitPrice] < 20.0) +WHERE ([p].[ProductID] % 17) = 5 AND [p].[UnitPrice] < 20.0 ORDER BY [p].[ProductID]"); } @@ -248,7 +248,7 @@ public override async Task Include_references_and_collection_multi_level(bool as 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] % 23) = 13) AND ([o].[UnitPrice] < 10.0) +WHERE ([o].[OrderID] % 23) = 13 AND [o].[UnitPrice] < 10.0 ORDER BY [o].[OrderID], [o].[ProductID], [o0].[OrderID], [c].[CustomerID]", // @"SELECT [o1].[OrderID], [o1].[CustomerID], [o1].[EmployeeID], [o1].[OrderDate], [o].[OrderID], [o].[ProductID], [o0].[OrderID], [c].[CustomerID] @@ -256,7 +256,7 @@ 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] INNER JOIN [Orders] AS [o1] ON [c].[CustomerID] = [o1].[CustomerID] -WHERE (([o].[OrderID] % 23) = 13) AND ([o].[UnitPrice] < 10.0) +WHERE ([o].[OrderID] % 23) = 13 AND [o].[UnitPrice] < 10.0 ORDER BY [o].[OrderID], [o].[ProductID], [o0].[OrderID], [c].[CustomerID]"); } @@ -948,7 +948,7 @@ FROM [Customers] AS [c] OUTER APPLY ( SELECT TOP(5) [o].[OrderID] FROM [Orders] AS [o] - WHERE ([o].[CustomerID] <> [c].[CustomerID]) OR [o].[CustomerID] IS NULL + WHERE [o].[CustomerID] <> [c].[CustomerID] OR [o].[CustomerID] IS NULL ORDER BY [c].[CustomerID] ) AS [t] WHERE [c].[CustomerID] LIKE N'F%' @@ -959,7 +959,7 @@ FROM [Customers] AS [c] OUTER APPLY ( SELECT TOP(5) [o].[OrderID] FROM [Orders] AS [o] - WHERE ([o].[CustomerID] <> [c].[CustomerID]) OR [o].[CustomerID] IS NULL + WHERE [o].[CustomerID] <> [c].[CustomerID] OR [o].[CustomerID] IS NULL ORDER BY [c].[CustomerID] ) AS [t] INNER JOIN [Orders] AS [o0] ON [c].[CustomerID] = [o0].[CustomerID] @@ -1232,10 +1232,10 @@ SELECT COUNT(*) FROM [Orders] AS [o0] WHERE [c].[CustomerID] = [o0].[CustomerID]) AS [TotalOrders] FROM [Customers] AS [c] -WHERE ([c].[ContactTitle] = N'Owner') AND (( +WHERE [c].[ContactTitle] = N'Owner' AND ( SELECT COUNT(*) FROM [Orders] AS [o] - WHERE [c].[CustomerID] = [o].[CustomerID]) > 2) + WHERE [c].[CustomerID] = [o].[CustomerID]) > 2 ORDER BY [c].[CustomerID]"); } diff --git a/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindWhereQuerySqlServerTest.cs b/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindWhereQuerySqlServerTest.cs index fbe4bbabdeb..4543235fe1b 100644 --- a/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindWhereQuerySqlServerTest.cs +++ b/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindWhereQuerySqlServerTest.cs @@ -44,7 +44,7 @@ FROM [Customers] AS [c] WHERE EXISTS ( SELECT 1 FROM [Orders] AS [o] - WHERE ([c].[CustomerID] = [o].[CustomerID]) AND ([o].[CustomerID] = N'ALFKI'))"); + WHERE [c].[CustomerID] = [o].[CustomerID] AND [o].[CustomerID] = N'ALFKI')"); } public override async Task Where_simple_closure(bool async) @@ -400,7 +400,7 @@ FROM [Customers] AS [c] WHERE EXISTS ( SELECT 1 FROM [Orders] AS [o] - WHERE ([o].[CustomerID] = @__customerID_0) AND ([o].[CustomerID] = [c].[CustomerID]))", + WHERE [o].[CustomerID] = @__customerID_0 AND [o].[CustomerID] = [c].[CustomerID])", // @"@__customerID_0='ANATR' (Size = 5) (DbType = StringFixedLength) @@ -409,7 +409,7 @@ FROM [Customers] AS [c] WHERE EXISTS ( SELECT 1 FROM [Orders] AS [o] - WHERE ([o].[CustomerID] = @__customerID_0) AND ([o].[CustomerID] = [c].[CustomerID]))"); + WHERE [o].[CustomerID] = @__customerID_0 AND [o].[CustomerID] = [c].[CustomerID])"); } public override async Task Where_bitwise_or(bool async) @@ -480,10 +480,10 @@ public override async Task Where_shadow_subquery_FirstOrDefault(bool async) AssertSql( @"SELECT [e].[EmployeeID], [e].[City], [e].[Country], [e].[FirstName], [e].[ReportsTo], [e].[Title] FROM [Employees] AS [e] -WHERE ([e].[Title] = ( +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)"); @@ -677,10 +677,10 @@ 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 (CASE +WHERE CASE WHEN N'Sea' = N'' THEN 0 ELSE CAST(CHARINDEX(N'Sea', [c].[City]) AS int) - 1 -END <> -1) OR CASE +END <> -1 OR CASE WHEN N'Sea' = N'' THEN 0 ELSE CAST(CHARINDEX(N'Sea', [c].[City]) AS int) - 1 END IS NULL"); @@ -949,7 +949,7 @@ public override async Task Where_identity_comparison(bool async) AssertSql( @"SELECT [c].[CustomerID], [c].[Address], [c].[City], [c].[CompanyName], [c].[ContactName], [c].[ContactTitle], [c].[Country], [c].[Fax], [c].[Phone], [c].[PostalCode], [c].[Region] FROM [Customers] AS [c] -WHERE ([c].[City] = [c].[City]) OR [c].[City] IS NULL"); +WHERE [c].[City] = [c].[City] OR [c].[City] IS NULL"); } public override async Task Where_in_optimization_multiple(bool async) @@ -960,7 +960,7 @@ public override async Task Where_in_optimization_multiple(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] IN (N'London', N'Berlin') OR ([c].[CustomerID] = N'ALFKI')) OR ([c].[CustomerID] = N'ABCDE')"); +WHERE [c].[City] IN (N'London', N'Berlin') OR [c].[CustomerID] = N'ALFKI' OR [c].[CustomerID] = N'ABCDE'"); } public override async Task Where_not_in_optimization1(bool async) @@ -971,7 +971,7 @@ public override async Task Where_not_in_optimization1(bool async) @"SELECT [c].[CustomerID], [c].[Address], [c].[City], [c].[CompanyName], [c].[ContactName], [c].[ContactTitle], [c].[Country], [c].[Fax], [c].[Phone], [c].[PostalCode], [c].[Region], [e].[EmployeeID], [e].[City], [e].[Country], [e].[FirstName], [e].[ReportsTo], [e].[Title] FROM [Customers] AS [c] CROSS JOIN [Employees] AS [e] -WHERE (([c].[City] <> N'London') OR [c].[City] IS NULL) AND (([e].[City] <> N'London') OR [e].[City] IS NULL)"); +WHERE ([c].[City] <> N'London' OR [c].[City] IS NULL) AND ([e].[City] <> N'London' OR [e].[City] IS NULL)"); } public override async Task Where_not_in_optimization2(bool async) @@ -1015,7 +1015,7 @@ public override async Task Where_select_many_and(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') AND ([c].[Country] = N'UK')) AND (([e].[City] = N'London') AND ([e].[Country] = N'UK'))"); +WHERE [c].[City] = N'London' AND [c].[Country] = N'UK' AND [e].[City] = N'London' AND [e].[Country] = N'UK'"); } public override async Task Where_primitive(bool async) @@ -1100,7 +1100,7 @@ public override async Task Where_bool_member_in_complex_predicate(bool async) AssertSql( @"SELECT [p].[ProductID], [p].[Discontinued], [p].[ProductName], [p].[SupplierID], [p].[UnitPrice], [p].[UnitsInStock] FROM [Products] AS [p] -WHERE (([p].[ProductID] > 100) AND ([p].[Discontinued] = CAST(1 AS bit))) OR ([p].[Discontinued] = CAST(1 AS bit))"); +WHERE ([p].[ProductID] > 100 AND [p].[Discontinued] = CAST(1 AS bit)) OR [p].[Discontinued] = CAST(1 AS bit)"); } public override async Task Where_bool_member_compared_to_binary_expression(bool async) @@ -1206,7 +1206,7 @@ public override async Task Where_de_morgan_or_optimized(bool async) AssertSql( @"SELECT [p].[ProductID], [p].[Discontinued], [p].[ProductName], [p].[SupplierID], [p].[UnitPrice], [p].[UnitsInStock] FROM [Products] AS [p] -WHERE ([p].[Discontinued] = CAST(0 AS bit)) AND ([p].[ProductID] >= 20)"); +WHERE [p].[Discontinued] = CAST(0 AS bit) AND [p].[ProductID] >= 20"); } public override async Task Where_de_morgan_and_optimized(bool async) @@ -1216,7 +1216,7 @@ public override async Task Where_de_morgan_and_optimized(bool async) AssertSql( @"SELECT [p].[ProductID], [p].[Discontinued], [p].[ProductName], [p].[SupplierID], [p].[UnitPrice], [p].[UnitsInStock] FROM [Products] AS [p] -WHERE ([p].[Discontinued] = CAST(0 AS bit)) OR ([p].[ProductID] >= 20)"); +WHERE [p].[Discontinued] = CAST(0 AS bit) OR [p].[ProductID] >= 20"); } public override async Task Where_complex_negated_expression_optimized(bool async) @@ -1226,7 +1226,7 @@ public override async Task Where_complex_negated_expression_optimized(bool async AssertSql( @"SELECT [p].[ProductID], [p].[Discontinued], [p].[ProductName], [p].[SupplierID], [p].[UnitPrice], [p].[UnitsInStock] FROM [Products] AS [p] -WHERE (([p].[Discontinued] = CAST(0 AS bit)) AND ([p].[ProductID] < 60)) AND ([p].[ProductID] > 30)"); +WHERE [p].[Discontinued] = CAST(0 AS bit) AND [p].[ProductID] < 60 AND [p].[ProductID] > 30"); } public override async Task Where_short_member_comparison(bool async) @@ -1436,7 +1436,7 @@ public override async Task Where_ternary_boolean_condition_with_another_conditio SELECT [p].[ProductID], [p].[Discontinued], [p].[ProductName], [p].[SupplierID], [p].[UnitPrice], [p].[UnitsInStock] FROM [Products] AS [p] -WHERE ([p].[ProductID] < @__productId_0) AND ([p].[UnitsInStock] >= CAST(20 AS smallint))"); +WHERE [p].[ProductID] < @__productId_0 AND [p].[UnitsInStock] >= CAST(20 AS smallint)"); } public override async Task Where_ternary_boolean_condition_with_false_as_result_true(bool async) @@ -1547,7 +1547,7 @@ public override async Task Where_compare_null(bool async) AssertSql( @"SELECT [c].[CustomerID], [c].[Address], [c].[City], [c].[CompanyName], [c].[ContactName], [c].[ContactTitle], [c].[Country], [c].[Fax], [c].[Phone], [c].[PostalCode], [c].[Region] FROM [Customers] AS [c] -WHERE [c].[City] IS NULL AND ([c].[Country] = N'UK')"); +WHERE [c].[City] IS NULL AND [c].[Country] = N'UK'"); } public override async Task Where_compare_null_with_cast_to_object(bool async) @@ -1586,7 +1586,7 @@ public override async Task Where_chain(bool async) AssertSql( @"SELECT [o].[OrderID], [o].[CustomerID], [o].[EmployeeID], [o].[OrderDate] FROM [Orders] AS [o] -WHERE ([o].[CustomerID] = N'QUICK') AND ([o].[OrderDate] > '1998-01-01T00:00:00.000')"); +WHERE [o].[CustomerID] = N'QUICK' AND [o].[OrderDate] > '1998-01-01T00:00:00.000'"); } public override void Where_navigation_contains() @@ -1682,7 +1682,7 @@ FROM [Customers] AS [c] WHERE EXISTS ( SELECT 1 FROM [Orders] AS [o0] - WHERE ([c].[CustomerID] = [o0].[CustomerID]) AND ([o0].[OrderID] = [o].[OrderID])))"); + WHERE [c].[CustomerID] = [o0].[CustomerID] AND [o0].[OrderID] = [o].[OrderID]))"); } public override async Task Where_subquery_FirstOrDefault_is_null(bool async) @@ -1864,7 +1864,7 @@ FROM [Customers] AS [c] WHERE EXISTS ( SELECT 1 FROM [Orders] AS [o] - WHERE ([o].[CustomerID] = [c].[CustomerID]) AND ([o].[CustomerID] = N'ALFKI')) + WHERE [o].[CustomerID] = [c].[CustomerID] AND [o].[CustomerID] = N'ALFKI') ORDER BY [c].[CustomerID]"); } @@ -1894,7 +1894,7 @@ FROM [Customers] AS [c] WHERE EXISTS ( SELECT 1 FROM [Orders] AS [o] - WHERE ([o].[CustomerID] = [c].[CustomerID]) AND ([o].[CustomerID] = N'ALFKI')) + WHERE [o].[CustomerID] = [c].[CustomerID] AND [o].[CustomerID] = N'ALFKI') ORDER BY [c].[CustomerID]"); } @@ -1924,7 +1924,7 @@ FROM [Customers] AS [c] WHERE EXISTS ( SELECT 1 FROM [Orders] AS [o] - WHERE ([o].[CustomerID] = [c].[CustomerID]) AND ([o].[CustomerID] = N'ALFKI')) + WHERE [o].[CustomerID] = [c].[CustomerID] AND [o].[CustomerID] = N'ALFKI') ORDER BY [c].[CustomerID]"); } @@ -1939,7 +1939,7 @@ FROM [Customers] AS [c] WHERE NOT (EXISTS ( SELECT 1 FROM [Orders] AS [o] - WHERE ([o].[CustomerID] = [c].[CustomerID]) AND ([o].[CustomerID] = N'ALFKI'))) + WHERE [o].[CustomerID] = [c].[CustomerID] AND [o].[CustomerID] = N'ALFKI')) ORDER BY [c].[CustomerID]"); } @@ -1981,10 +1981,10 @@ public override async Task Where_collection_navigation_ToList_Count(bool async) @"SELECT [o].[OrderID], [o1].[OrderID], [o1].[ProductID], [o1].[Discount], [o1].[Quantity], [o1].[UnitPrice] FROM [Orders] AS [o] LEFT JOIN [Order Details] AS [o1] ON [o].[OrderID] = [o1].[OrderID] -WHERE ([o].[OrderID] < 10300) AND (( +WHERE [o].[OrderID] < 10300 AND ( SELECT COUNT(*) FROM [Order Details] AS [o0] - WHERE [o].[OrderID] = [o0].[OrderID]) = 0) + WHERE [o].[OrderID] = [o0].[OrderID]) = 0 ORDER BY [o].[OrderID], [o1].[OrderID]"); } @@ -2001,7 +2001,7 @@ FROM [Customers] AS [c] WHERE EXISTS ( SELECT 1 FROM [Orders] AS [o] - WHERE ([c].[CustomerID] = [o].[CustomerID]) AND ([o].[OrderID] = @__entity_equality_order_0_OrderID)) + WHERE [c].[CustomerID] = [o].[CustomerID] AND [o].[OrderID] = @__entity_equality_order_0_OrderID) ORDER BY [c].[CustomerID], [o0].[OrderID]"); } @@ -2013,10 +2013,10 @@ public override async Task Where_collection_navigation_ToArray_Count(bool async) @"SELECT [o].[OrderID], [o1].[OrderID], [o1].[ProductID], [o1].[Discount], [o1].[Quantity], [o1].[UnitPrice] FROM [Orders] AS [o] LEFT JOIN [Order Details] AS [o1] ON [o].[OrderID] = [o1].[OrderID] -WHERE ([o].[OrderID] < 10300) AND (( +WHERE [o].[OrderID] < 10300 AND ( SELECT COUNT(*) FROM [Order Details] AS [o0] - WHERE [o].[OrderID] = [o0].[OrderID]) = 0) + WHERE [o].[OrderID] = [o0].[OrderID]) = 0 ORDER BY [o].[OrderID], [o1].[OrderID]"); } @@ -2033,7 +2033,7 @@ FROM [Customers] AS [c] WHERE EXISTS ( SELECT 1 FROM [Orders] AS [o] - WHERE ([c].[CustomerID] = [o].[CustomerID]) AND ([o].[OrderID] = @__entity_equality_order_0_OrderID)) + WHERE [c].[CustomerID] = [o].[CustomerID] AND [o].[OrderID] = @__entity_equality_order_0_OrderID) ORDER BY [c].[CustomerID], [o0].[OrderID]"); } @@ -2045,10 +2045,10 @@ public override async Task Where_collection_navigation_AsEnumerable_Count(bool a @"SELECT [o].[OrderID], [o1].[OrderID], [o1].[ProductID], [o1].[Discount], [o1].[Quantity], [o1].[UnitPrice] FROM [Orders] AS [o] LEFT JOIN [Order Details] AS [o1] ON [o].[OrderID] = [o1].[OrderID] -WHERE ([o].[OrderID] < 10300) AND (( +WHERE [o].[OrderID] < 10300 AND ( SELECT COUNT(*) FROM [Order Details] AS [o0] - WHERE [o].[OrderID] = [o0].[OrderID]) = 0) + WHERE [o].[OrderID] = [o0].[OrderID]) = 0 ORDER BY [o].[OrderID], [o1].[OrderID]"); } @@ -2065,7 +2065,7 @@ FROM [Customers] AS [c] WHERE EXISTS ( SELECT 1 FROM [Orders] AS [o] - WHERE ([c].[CustomerID] = [o].[CustomerID]) AND ([o].[OrderID] = @__entity_equality_order_0_OrderID)) + WHERE [c].[CustomerID] = [o].[CustomerID] AND [o].[OrderID] = @__entity_equality_order_0_OrderID) ORDER BY [c].[CustomerID], [o0].[OrderID]"); } @@ -2077,10 +2077,10 @@ public override async Task Where_collection_navigation_ToList_Count_member(bool @"SELECT [o].[OrderID], [o1].[OrderID], [o1].[ProductID], [o1].[Discount], [o1].[Quantity], [o1].[UnitPrice] FROM [Orders] AS [o] LEFT JOIN [Order Details] AS [o1] ON [o].[OrderID] = [o1].[OrderID] -WHERE ([o].[OrderID] < 10300) AND (( +WHERE [o].[OrderID] < 10300 AND ( SELECT COUNT(*) FROM [Order Details] AS [o0] - WHERE [o].[OrderID] = [o0].[OrderID]) = 0) + WHERE [o].[OrderID] = [o0].[OrderID]) = 0 ORDER BY [o].[OrderID], [o1].[OrderID]"); } @@ -2092,10 +2092,10 @@ public override async Task Where_collection_navigation_ToArray_Length_member(boo @"SELECT [o].[OrderID], [o1].[OrderID], [o1].[ProductID], [o1].[Discount], [o1].[Quantity], [o1].[UnitPrice] FROM [Orders] AS [o] LEFT JOIN [Order Details] AS [o1] ON [o].[OrderID] = [o1].[OrderID] -WHERE ([o].[OrderID] < 10300) AND (( +WHERE [o].[OrderID] < 10300 AND ( SELECT COUNT(*) FROM [Order Details] AS [o0] - WHERE [o].[OrderID] = [o0].[OrderID]) = 0) + WHERE [o].[OrderID] = [o0].[OrderID]) = 0 ORDER BY [o].[OrderID], [o1].[OrderID]"); } @@ -2191,7 +2191,7 @@ public override async Task Multiple_AndAlso_on_same_column_converted_to_in_using 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].[CustomerID] <> @__prm1_0) AND ([c].[CustomerID] <> @__prm2_1)) AND ([c].[CustomerID] <> @__prm3_2)"); +WHERE [c].[CustomerID] <> @__prm1_0 AND [c].[CustomerID] <> @__prm2_1 AND [c].[CustomerID] <> @__prm3_2"); } public override async Task Array_of_parameters_Contains_OrElse_comparison_with_constant_gets_combined_to_one_in(bool async) @@ -2202,7 +2202,7 @@ public override async Task Array_of_parameters_Contains_OrElse_comparison_with_c 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].[CustomerID] IN (N'ALFKI', N'ANATR') OR ([c].[CustomerID] = N'ANTON')"); +WHERE [c].[CustomerID] IN (N'ALFKI', N'ANATR') OR [c].[CustomerID] = N'ANTON'"); } public override async Task Multiple_OrElse_on_same_column_with_null_parameter_comparison_converted_to_in(bool async) @@ -2213,7 +2213,7 @@ public override async Task Multiple_OrElse_on_same_column_with_null_parameter_co AssertSql( @"SELECT [c].[CustomerID], [c].[Address], [c].[City], [c].[CompanyName], [c].[ContactName], [c].[ContactTitle], [c].[Country], [c].[Fax], [c].[Phone], [c].[PostalCode], [c].[Region] FROM [Customers] AS [c] -WHERE ([c].[Region] IN (N'WA', N'OR') OR [c].[Region] IS NULL) OR ([c].[Region] = N'BC')"); +WHERE [c].[Region] IN (N'WA', N'OR') OR [c].[Region] IS NULL OR [c].[Region] = N'BC'"); } public override async Task Parameter_array_Contains_OrElse_comparison_with_constant(bool async) @@ -2223,7 +2223,7 @@ public override async Task Parameter_array_Contains_OrElse_comparison_with_const 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].[CustomerID] IN (N'ALFKI', N'ANATR') OR ([c].[CustomerID] = N'ANTON')"); +WHERE [c].[CustomerID] IN (N'ALFKI', N'ANATR') OR [c].[CustomerID] = N'ANTON'"); } public override async Task Parameter_array_Contains_OrElse_comparison_with_parameter_with_overlap(bool async) @@ -2236,7 +2236,7 @@ public override async Task Parameter_array_Contains_OrElse_comparison_with_param 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].[CustomerID] = @__prm1_0) OR [c].[CustomerID] IN (N'ALFKI', N'ANATR')) OR ([c].[CustomerID] = @__prm2_2)"); +WHERE [c].[CustomerID] = @__prm1_0 OR [c].[CustomerID] IN (N'ALFKI', N'ANATR') OR [c].[CustomerID] = @__prm2_2"); } public override async Task Two_sets_of_comparison_combine_correctly(bool async) @@ -2256,7 +2256,7 @@ public override async Task Two_sets_of_comparison_combine_correctly2(bool async) AssertSql( @"SELECT [c].[CustomerID], [c].[Address], [c].[City], [c].[CompanyName], [c].[ContactName], [c].[ContactTitle], [c].[Country], [c].[Fax], [c].[Phone], [c].[PostalCode], [c].[Region] FROM [Customers] AS [c] -WHERE ([c].[Region] <> N'WA') AND [c].[Region] IS NOT NULL"); +WHERE [c].[Region] <> N'WA' AND [c].[Region] IS NOT NULL"); } public override async Task Filter_with_EF_Property_using_closure_for_property_name(bool async) @@ -2461,6 +2461,46 @@ FROM [Orders] AS [o] WHERE [c].[CustomerID] = [o].[CustomerID])"); } + public override async Task Where_Contains_and_comparison(bool async) + { + await base.Where_Contains_and_comparison(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].[CustomerID] IN (N'ALFKI', N'FISSA') AND [c].[City] = N'Seattle'"); + } + + public override async Task Where_Contains_or_comparison(bool async) + { + await base.Where_Contains_or_comparison(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].[CustomerID] IN (N'ALFKI', N'FISSA') OR [c].[City] = N'Seattle'"); + } + + public override async Task Where_Like_and_comparison(bool async) + { + await base.Where_Like_and_comparison(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].[CustomerID] LIKE N'F%') AND [c].[City] = N'Seattle'"); + } + + public override async Task Where_Like_or_comparison(bool async) + { + await base.Where_Like_or_comparison(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].[CustomerID] LIKE N'F%') OR [c].[City] = N'Seattle'"); + } + private void AssertSql(params string[] expected) => Fixture.TestSqlLoggerFactory.AssertBaseline(expected); diff --git a/test/EFCore.SqlServer.FunctionalTests/Query/NullSemanticsQuerySqlServerTest.cs b/test/EFCore.SqlServer.FunctionalTests/Query/NullSemanticsQuerySqlServerTest.cs index 78959800600..33977477ddd 100644 --- a/test/EFCore.SqlServer.FunctionalTests/Query/NullSemanticsQuerySqlServerTest.cs +++ b/test/EFCore.SqlServer.FunctionalTests/Query/NullSemanticsQuerySqlServerTest.cs @@ -37,7 +37,7 @@ FROM [Entities1] AS [e] // @"SELECT [e].[Id] FROM [Entities1] AS [e] -WHERE ([e].[NullableBoolA] = [e].[NullableBoolB]) OR (([e].[NullableBoolA] IS NULL) AND ([e].[NullableBoolB] IS NULL))"); +WHERE [e].[NullableBoolA] = [e].[NullableBoolB] OR (([e].[NullableBoolA] IS NULL) AND ([e].[NullableBoolB] IS NULL))"); } public override async Task Compare_negated_bool_with_bool_equal(bool async) @@ -51,15 +51,15 @@ FROM [Entities1] AS [e] // @"SELECT [e].[Id] FROM [Entities1] AS [e] -WHERE ([e].[BoolA] <> [e].[NullableBoolB]) AND ([e].[NullableBoolB] IS NOT NULL)", +WHERE [e].[BoolA] <> [e].[NullableBoolB] AND ([e].[NullableBoolB] IS NOT NULL)", // @"SELECT [e].[Id] FROM [Entities1] AS [e] -WHERE ([e].[NullableBoolA] <> [e].[BoolB]) AND ([e].[NullableBoolA] IS NOT NULL)", +WHERE [e].[NullableBoolA] <> [e].[BoolB] AND ([e].[NullableBoolA] IS NOT NULL)", // @"SELECT [e].[Id] FROM [Entities1] AS [e] -WHERE (([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))"); +WHERE ([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))"); } public override async Task Compare_bool_with_negated_bool_equal(bool async) @@ -73,15 +73,15 @@ FROM [Entities1] AS [e] // @"SELECT [e].[Id] FROM [Entities1] AS [e] -WHERE ([e].[BoolA] <> [e].[NullableBoolB]) AND ([e].[NullableBoolB] IS NOT NULL)", +WHERE [e].[BoolA] <> [e].[NullableBoolB] AND ([e].[NullableBoolB] IS NOT NULL)", // @"SELECT [e].[Id] FROM [Entities1] AS [e] -WHERE ([e].[NullableBoolA] <> [e].[BoolB]) AND ([e].[NullableBoolA] IS NOT NULL)", +WHERE [e].[NullableBoolA] <> [e].[BoolB] AND ([e].[NullableBoolA] IS NOT NULL)", // @"SELECT [e].[Id] FROM [Entities1] AS [e] -WHERE (([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))"); +WHERE ([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))"); } public override async Task Compare_negated_bool_with_negated_bool_equal(bool async) @@ -95,15 +95,15 @@ FROM [Entities1] AS [e] // @"SELECT [e].[Id] FROM [Entities1] AS [e] -WHERE ([e].[BoolA] = [e].[NullableBoolB]) AND ([e].[NullableBoolB] IS NOT NULL)", +WHERE [e].[BoolA] = [e].[NullableBoolB] AND ([e].[NullableBoolB] IS NOT NULL)", // @"SELECT [e].[Id] FROM [Entities1] AS [e] -WHERE ([e].[NullableBoolA] = [e].[BoolB]) AND ([e].[NullableBoolA] IS NOT NULL)", +WHERE [e].[NullableBoolA] = [e].[BoolB] AND ([e].[NullableBoolA] IS NOT NULL)", // @"SELECT [e].[Id] FROM [Entities1] AS [e] -WHERE (([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))"); +WHERE ([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))"); } public override async Task Compare_bool_with_bool_equal_negated(bool async) @@ -117,15 +117,15 @@ FROM [Entities1] AS [e] // @"SELECT [e].[Id] FROM [Entities1] AS [e] -WHERE ([e].[BoolA] <> [e].[NullableBoolB]) OR ([e].[NullableBoolB] IS NULL)", +WHERE [e].[BoolA] <> [e].[NullableBoolB] OR ([e].[NullableBoolB] IS NULL)", // @"SELECT [e].[Id] FROM [Entities1] AS [e] -WHERE ([e].[NullableBoolA] <> [e].[BoolB]) OR ([e].[NullableBoolA] IS NULL)", +WHERE [e].[NullableBoolA] <> [e].[BoolB] OR ([e].[NullableBoolA] IS NULL)", // @"SELECT [e].[Id] FROM [Entities1] AS [e] -WHERE (([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))"); +WHERE ([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))"); } public override async Task Compare_negated_bool_with_bool_equal_negated(bool async) @@ -139,15 +139,15 @@ FROM [Entities1] AS [e] // @"SELECT [e].[Id] FROM [Entities1] AS [e] -WHERE ([e].[BoolA] = [e].[NullableBoolB]) OR ([e].[NullableBoolB] IS NULL)", +WHERE [e].[BoolA] = [e].[NullableBoolB] OR ([e].[NullableBoolB] IS NULL)", // @"SELECT [e].[Id] FROM [Entities1] AS [e] -WHERE ([e].[NullableBoolA] = [e].[BoolB]) OR ([e].[NullableBoolA] IS NULL)", +WHERE [e].[NullableBoolA] = [e].[BoolB] OR ([e].[NullableBoolA] IS NULL)", // @"SELECT [e].[Id] FROM [Entities1] AS [e] -WHERE (([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))"); +WHERE ([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))"); } public override async Task Compare_bool_with_negated_bool_equal_negated(bool async) @@ -161,15 +161,15 @@ FROM [Entities1] AS [e] // @"SELECT [e].[Id] FROM [Entities1] AS [e] -WHERE ([e].[BoolA] = [e].[NullableBoolB]) OR ([e].[NullableBoolB] IS NULL)", +WHERE [e].[BoolA] = [e].[NullableBoolB] OR ([e].[NullableBoolB] IS NULL)", // @"SELECT [e].[Id] FROM [Entities1] AS [e] -WHERE ([e].[NullableBoolA] = [e].[BoolB]) OR ([e].[NullableBoolA] IS NULL)", +WHERE [e].[NullableBoolA] = [e].[BoolB] OR ([e].[NullableBoolA] IS NULL)", // @"SELECT [e].[Id] FROM [Entities1] AS [e] -WHERE (([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))"); +WHERE ([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))"); } public override async Task Compare_negated_bool_with_negated_bool_equal_negated(bool async) @@ -183,15 +183,15 @@ FROM [Entities1] AS [e] // @"SELECT [e].[Id] FROM [Entities1] AS [e] -WHERE ([e].[BoolA] <> [e].[NullableBoolB]) OR ([e].[NullableBoolB] IS NULL)", +WHERE [e].[BoolA] <> [e].[NullableBoolB] OR ([e].[NullableBoolB] IS NULL)", // @"SELECT [e].[Id] FROM [Entities1] AS [e] -WHERE ([e].[NullableBoolA] <> [e].[BoolB]) OR ([e].[NullableBoolA] IS NULL)", +WHERE [e].[NullableBoolA] <> [e].[BoolB] OR ([e].[NullableBoolA] IS NULL)", // @"SELECT [e].[Id] FROM [Entities1] AS [e] -WHERE (([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))"); +WHERE ([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))"); } public override async Task Compare_bool_with_bool_not_equal(bool async) @@ -205,15 +205,15 @@ FROM [Entities1] AS [e] // @"SELECT [e].[Id] FROM [Entities1] AS [e] -WHERE ([e].[BoolA] <> [e].[NullableBoolB]) OR ([e].[NullableBoolB] IS NULL)", +WHERE [e].[BoolA] <> [e].[NullableBoolB] OR ([e].[NullableBoolB] IS NULL)", // @"SELECT [e].[Id] FROM [Entities1] AS [e] -WHERE ([e].[NullableBoolA] <> [e].[BoolB]) OR ([e].[NullableBoolA] IS NULL)", +WHERE [e].[NullableBoolA] <> [e].[BoolB] OR ([e].[NullableBoolA] IS NULL)", // @"SELECT [e].[Id] FROM [Entities1] AS [e] -WHERE (([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))"); +WHERE ([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))"); } public override async Task Compare_negated_bool_with_bool_not_equal(bool async) @@ -227,15 +227,15 @@ FROM [Entities1] AS [e] // @"SELECT [e].[Id] FROM [Entities1] AS [e] -WHERE ([e].[BoolA] = [e].[NullableBoolB]) OR ([e].[NullableBoolB] IS NULL)", +WHERE [e].[BoolA] = [e].[NullableBoolB] OR ([e].[NullableBoolB] IS NULL)", // @"SELECT [e].[Id] FROM [Entities1] AS [e] -WHERE ([e].[NullableBoolA] = [e].[BoolB]) OR ([e].[NullableBoolA] IS NULL)", +WHERE [e].[NullableBoolA] = [e].[BoolB] OR ([e].[NullableBoolA] IS NULL)", // @"SELECT [e].[Id] FROM [Entities1] AS [e] -WHERE (([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))"); +WHERE ([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))"); } public override async Task Compare_bool_with_negated_bool_not_equal(bool async) @@ -249,15 +249,15 @@ FROM [Entities1] AS [e] // @"SELECT [e].[Id] FROM [Entities1] AS [e] -WHERE ([e].[BoolA] = [e].[NullableBoolB]) OR ([e].[NullableBoolB] IS NULL)", +WHERE [e].[BoolA] = [e].[NullableBoolB] OR ([e].[NullableBoolB] IS NULL)", // @"SELECT [e].[Id] FROM [Entities1] AS [e] -WHERE ([e].[NullableBoolA] = [e].[BoolB]) OR ([e].[NullableBoolA] IS NULL)", +WHERE [e].[NullableBoolA] = [e].[BoolB] OR ([e].[NullableBoolA] IS NULL)", // @"SELECT [e].[Id] FROM [Entities1] AS [e] -WHERE (([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))"); +WHERE ([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))"); } public override async Task Compare_negated_bool_with_negated_bool_not_equal(bool async) @@ -271,15 +271,15 @@ FROM [Entities1] AS [e] // @"SELECT [e].[Id] FROM [Entities1] AS [e] -WHERE ([e].[BoolA] <> [e].[NullableBoolB]) OR ([e].[NullableBoolB] IS NULL)", +WHERE [e].[BoolA] <> [e].[NullableBoolB] OR ([e].[NullableBoolB] IS NULL)", // @"SELECT [e].[Id] FROM [Entities1] AS [e] -WHERE ([e].[NullableBoolA] <> [e].[BoolB]) OR ([e].[NullableBoolA] IS NULL)", +WHERE [e].[NullableBoolA] <> [e].[BoolB] OR ([e].[NullableBoolA] IS NULL)", // @"SELECT [e].[Id] FROM [Entities1] AS [e] -WHERE (([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))"); +WHERE ([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))"); } public override async Task Compare_bool_with_bool_not_equal_negated(bool async) @@ -293,15 +293,15 @@ FROM [Entities1] AS [e] // @"SELECT [e].[Id] FROM [Entities1] AS [e] -WHERE ([e].[BoolA] = [e].[NullableBoolB]) AND ([e].[NullableBoolB] IS NOT NULL)", +WHERE [e].[BoolA] = [e].[NullableBoolB] AND ([e].[NullableBoolB] IS NOT NULL)", // @"SELECT [e].[Id] FROM [Entities1] AS [e] -WHERE ([e].[NullableBoolA] = [e].[BoolB]) AND ([e].[NullableBoolA] IS NOT NULL)", +WHERE [e].[NullableBoolA] = [e].[BoolB] AND ([e].[NullableBoolA] IS NOT NULL)", // @"SELECT [e].[Id] FROM [Entities1] AS [e] -WHERE (([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))"); +WHERE ([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))"); } public override async Task Compare_negated_bool_with_bool_not_equal_negated(bool async) @@ -315,15 +315,15 @@ FROM [Entities1] AS [e] // @"SELECT [e].[Id] FROM [Entities1] AS [e] -WHERE ([e].[BoolA] <> [e].[NullableBoolB]) AND ([e].[NullableBoolB] IS NOT NULL)", +WHERE [e].[BoolA] <> [e].[NullableBoolB] AND ([e].[NullableBoolB] IS NOT NULL)", // @"SELECT [e].[Id] FROM [Entities1] AS [e] -WHERE ([e].[NullableBoolA] <> [e].[BoolB]) AND ([e].[NullableBoolA] IS NOT NULL)", +WHERE [e].[NullableBoolA] <> [e].[BoolB] AND ([e].[NullableBoolA] IS NOT NULL)", // @"SELECT [e].[Id] FROM [Entities1] AS [e] -WHERE (([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))"); +WHERE ([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))"); } public override async Task Compare_bool_with_negated_bool_not_equal_negated(bool async) @@ -337,15 +337,15 @@ FROM [Entities1] AS [e] // @"SELECT [e].[Id] FROM [Entities1] AS [e] -WHERE ([e].[BoolA] <> [e].[NullableBoolB]) AND ([e].[NullableBoolB] IS NOT NULL)", +WHERE [e].[BoolA] <> [e].[NullableBoolB] AND ([e].[NullableBoolB] IS NOT NULL)", // @"SELECT [e].[Id] FROM [Entities1] AS [e] -WHERE ([e].[NullableBoolA] <> [e].[BoolB]) AND ([e].[NullableBoolA] IS NOT NULL)", +WHERE [e].[NullableBoolA] <> [e].[BoolB] AND ([e].[NullableBoolA] IS NOT NULL)", // @"SELECT [e].[Id] FROM [Entities1] AS [e] -WHERE (([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))"); +WHERE ([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))"); } public override async Task Compare_negated_bool_with_negated_bool_not_equal_negated(bool async) @@ -359,15 +359,15 @@ FROM [Entities1] AS [e] // @"SELECT [e].[Id] FROM [Entities1] AS [e] -WHERE ([e].[BoolA] = [e].[NullableBoolB]) AND ([e].[NullableBoolB] IS NOT NULL)", +WHERE [e].[BoolA] = [e].[NullableBoolB] AND ([e].[NullableBoolB] IS NOT NULL)", // @"SELECT [e].[Id] FROM [Entities1] AS [e] -WHERE ([e].[NullableBoolA] = [e].[BoolB]) AND ([e].[NullableBoolA] IS NOT NULL)", +WHERE [e].[NullableBoolA] = [e].[BoolB] AND ([e].[NullableBoolA] IS NOT NULL)", // @"SELECT [e].[Id] FROM [Entities1] AS [e] -WHERE (([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))"); +WHERE ([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))"); } public override async Task Compare_equals_method(bool async) @@ -389,7 +389,7 @@ FROM [Entities1] AS [e] // @"SELECT [e].[Id] FROM [Entities1] AS [e] -WHERE ([e].[NullableBoolA] = [e].[NullableBoolB]) OR (([e].[NullableBoolA] IS NULL) AND ([e].[NullableBoolB] IS NULL))"); +WHERE [e].[NullableBoolA] = [e].[NullableBoolB] OR (([e].[NullableBoolA] IS NULL) AND ([e].[NullableBoolB] IS NULL))"); } public override async Task Compare_equals_method_static(bool async) @@ -411,7 +411,7 @@ FROM [Entities1] AS [e] // @"SELECT [e].[Id] FROM [Entities1] AS [e] -WHERE ([e].[NullableBoolA] = [e].[NullableBoolB]) OR (([e].[NullableBoolA] IS NULL) AND ([e].[NullableBoolB] IS NULL))"); +WHERE [e].[NullableBoolA] = [e].[NullableBoolB] OR (([e].[NullableBoolA] IS NULL) AND ([e].[NullableBoolB] IS NULL))"); } public override async Task Compare_equals_method_negated(bool async) @@ -425,15 +425,15 @@ FROM [Entities1] AS [e] // @"SELECT [e].[Id] FROM [Entities1] AS [e] -WHERE ([e].[BoolA] <> [e].[NullableBoolB]) OR ([e].[NullableBoolB] IS NULL)", +WHERE [e].[BoolA] <> [e].[NullableBoolB] OR ([e].[NullableBoolB] IS NULL)", // @"SELECT [e].[Id] FROM [Entities1] AS [e] -WHERE ([e].[NullableBoolA] <> [e].[BoolB]) OR ([e].[NullableBoolA] IS NULL)", +WHERE [e].[NullableBoolA] <> [e].[BoolB] OR ([e].[NullableBoolA] IS NULL)", // @"SELECT [e].[Id] FROM [Entities1] AS [e] -WHERE (([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))"); +WHERE ([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))"); } public override async Task Compare_equals_method_negated_static(bool async) @@ -447,15 +447,15 @@ FROM [Entities1] AS [e] // @"SELECT [e].[Id] FROM [Entities1] AS [e] -WHERE ([e].[BoolA] <> [e].[NullableBoolB]) OR ([e].[NullableBoolB] IS NULL)", +WHERE [e].[BoolA] <> [e].[NullableBoolB] OR ([e].[NullableBoolB] IS NULL)", // @"SELECT [e].[Id] FROM [Entities1] AS [e] -WHERE ([e].[NullableBoolA] <> [e].[BoolB]) OR ([e].[NullableBoolA] IS NULL)", +WHERE [e].[NullableBoolA] <> [e].[BoolB] OR ([e].[NullableBoolA] IS NULL)", // @"SELECT [e].[Id] FROM [Entities1] AS [e] -WHERE (([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))"); +WHERE ([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))"); } public override async Task Compare_complex_equal_equal_equal(bool async) @@ -476,20 +476,20 @@ ELSE CAST(0 AS bit) @"SELECT [e].[Id] FROM [Entities1] AS [e] WHERE CASE - WHEN ([e].[NullableBoolA] = [e].[BoolB]) AND ([e].[NullableBoolA] IS NOT NULL) THEN CAST(1 AS bit) + 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", // @"SELECT [e].[Id] FROM [Entities1] AS [e] 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) + 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,20 +512,20 @@ ELSE CAST(0 AS bit) @"SELECT [e].[Id] FROM [Entities1] AS [e] WHERE CASE - WHEN ([e].[NullableBoolA] = [e].[BoolB]) AND ([e].[NullableBoolA] IS NOT NULL) THEN CAST(1 AS bit) + 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", // @"SELECT [e].[Id] FROM [Entities1] AS [e] 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) + 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,20 +548,20 @@ ELSE CAST(0 AS bit) @"SELECT [e].[Id] FROM [Entities1] AS [e] WHERE CASE - WHEN ([e].[NullableBoolA] <> [e].[BoolB]) OR ([e].[NullableBoolA] IS NULL) THEN CAST(1 AS bit) + 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", // @"SELECT [e].[Id] FROM [Entities1] AS [e] 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) + 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,20 +584,20 @@ ELSE CAST(0 AS bit) @"SELECT [e].[Id] FROM [Entities1] AS [e] WHERE CASE - WHEN ([e].[NullableBoolA] <> [e].[BoolB]) OR ([e].[NullableBoolA] IS NULL) THEN CAST(1 AS bit) + 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", // @"SELECT [e].[Id] FROM [Entities1] AS [e] 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) + 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,20 +620,20 @@ ELSE CAST(0 AS bit) @"SELECT [e].[Id] FROM [Entities1] AS [e] WHERE CASE - WHEN ([e].[NullableBoolA] <> [e].[BoolB]) OR ([e].[NullableBoolA] IS NULL) THEN CAST(1 AS bit) + 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", // @"SELECT [e].[Id] FROM [Entities1] AS [e] 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) + 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,20 +656,20 @@ ELSE CAST(0 AS bit) @"SELECT [e].[Id] FROM [Entities1] AS [e] WHERE CASE - WHEN ([e].[NullableBoolA] <> [e].[BoolB]) OR ([e].[NullableBoolA] IS NULL) THEN CAST(1 AS bit) + 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", // @"SELECT [e].[Id] FROM [Entities1] AS [e] 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) + WHEN ([e].[NullableBoolA] <> [e].[NullableBoolB] OR ([e].[NullableBoolA] IS NULL) OR ([e].[NullableBoolB] IS NULL)) AND (([e].[NullableBoolA] IS NOT NULL) OR ([e].[NullableBoolB] IS NOT NULL)) THEN CAST(1 AS bit) ELSE CAST(0 AS bit) END <> CASE - WHEN (([e].[NullableIntA] <> [e].[NullableIntB]) OR ([e].[NullableIntA] IS NULL OR [e].[NullableIntB] IS NULL)) AND ([e].[NullableIntA] IS NOT NULL OR [e].[NullableIntB] IS NOT NULL) THEN CAST(1 AS bit) + WHEN ([e].[NullableIntA] <> [e].[NullableIntB] OR [e].[NullableIntA] IS NULL OR [e].[NullableIntB] IS NULL) AND ([e].[NullableIntA] IS NOT NULL OR [e].[NullableIntB] IS NOT NULL) THEN CAST(1 AS bit) ELSE CAST(0 AS bit) END"); } @@ -713,7 +713,7 @@ public override async Task Contains_with_local_array_closure_with_null(bool asyn AssertSql( @"SELECT [e].[Id] FROM [Entities1] AS [e] -WHERE ([e].[NullableStringA] = N'Foo') OR [e].[NullableStringA] IS NULL"); +WHERE [e].[NullableStringA] = N'Foo' OR [e].[NullableStringA] IS NULL"); } public override async Task Contains_with_local_array_closure_false_with_null(bool async) @@ -723,7 +723,7 @@ public override async Task Contains_with_local_array_closure_false_with_null(boo AssertSql( @"SELECT [e].[Id] FROM [Entities1] AS [e] -WHERE ([e].[NullableStringA] <> N'Foo') AND [e].[NullableStringA] IS NOT NULL"); +WHERE [e].[NullableStringA] <> N'Foo' AND [e].[NullableStringA] IS NOT NULL"); } public override async Task Contains_with_local_nullable_array_closure_negated(bool async) @@ -733,7 +733,7 @@ public override async Task Contains_with_local_nullable_array_closure_negated(bo AssertSql( @"SELECT [e].[Id] FROM [Entities1] AS [e] -WHERE ([e].[NullableStringA] <> N'Foo') OR [e].[NullableStringA] IS NULL"); +WHERE [e].[NullableStringA] <> N'Foo' OR [e].[NullableStringA] IS NULL"); } public override async Task Contains_with_local_array_closure_with_multiple_nulls(bool async) @@ -743,7 +743,7 @@ public override async Task Contains_with_local_array_closure_with_multiple_nulls AssertSql( @"SELECT [e].[Id] FROM [Entities1] AS [e] -WHERE ([e].[NullableStringA] = N'Foo') OR [e].[NullableStringA] IS NULL"); +WHERE [e].[NullableStringA] = N'Foo' OR [e].[NullableStringA] IS NULL"); } public override async Task Where_multiple_ors_with_null(bool async) @@ -773,7 +773,7 @@ public override async Task Where_multiple_ors_with_nullable_parameter(bool async AssertSql( @"SELECT [e].[Id] FROM [Entities1] AS [e] -WHERE ([e].[NullableStringA] = N'Foo') OR [e].[NullableStringA] IS NULL"); +WHERE [e].[NullableStringA] = N'Foo' OR [e].[NullableStringA] IS NULL"); } public override async Task Where_multiple_ands_with_nullable_parameter_and_constant(bool async) @@ -785,7 +785,7 @@ public override async Task Where_multiple_ands_with_nullable_parameter_and_const SELECT [e].[Id] FROM [Entities1] AS [e] -WHERE ((([e].[NullableStringA] <> N'Foo') OR [e].[NullableStringA] IS NULL) AND [e].[NullableStringA] IS NOT NULL) AND ([e].[NullableStringA] <> @__prm3_2)"); +WHERE ([e].[NullableStringA] <> N'Foo' OR [e].[NullableStringA] IS NULL) AND [e].[NullableStringA] IS NOT NULL AND [e].[NullableStringA] <> @__prm3_2"); } public override async Task Where_multiple_ands_with_nullable_parameter_and_constant_not_optimized(bool async) @@ -797,7 +797,7 @@ public override async Task Where_multiple_ands_with_nullable_parameter_and_const SELECT [e].[Id] FROM [Entities1] AS [e] -WHERE (([e].[NullableStringB] IS NOT NULL AND (([e].[NullableStringA] <> N'Foo') OR [e].[NullableStringA] IS NULL)) AND [e].[NullableStringA] IS NOT NULL) AND ([e].[NullableStringA] <> @__prm3_2)"); +WHERE [e].[NullableStringB] IS NOT NULL AND ([e].[NullableStringA] <> N'Foo' OR [e].[NullableStringA] IS NULL) AND [e].[NullableStringA] IS NOT NULL AND [e].[NullableStringA] <> @__prm3_2"); } public override async Task Where_coalesce(bool async) @@ -837,7 +837,7 @@ public override async Task Where_equal_with_coalesce(bool async) AssertSql( @"SELECT [e].[Id] FROM [Entities1] AS [e] -WHERE (COALESCE([e].[NullableStringA], [e].[NullableStringB]) = [e].[NullableStringC]) OR (([e].[NullableStringA] IS NULL AND [e].[NullableStringB] IS NULL) AND [e].[NullableStringC] IS NULL)"); +WHERE COALESCE([e].[NullableStringA], [e].[NullableStringB]) = [e].[NullableStringC] OR ([e].[NullableStringA] IS NULL AND [e].[NullableStringB] IS NULL AND [e].[NullableStringC] IS NULL)"); } public override async Task Where_not_equal_with_coalesce(bool async) @@ -847,7 +847,7 @@ public override async Task Where_not_equal_with_coalesce(bool async) AssertSql( @"SELECT [e].[Id] FROM [Entities1] AS [e] -WHERE ((COALESCE([e].[NullableStringA], [e].[NullableStringB]) <> [e].[NullableStringC]) OR (([e].[NullableStringA] IS NULL AND [e].[NullableStringB] IS NULL) OR [e].[NullableStringC] IS NULL)) AND (([e].[NullableStringA] IS NOT NULL OR [e].[NullableStringB] IS NOT NULL) OR [e].[NullableStringC] IS NOT NULL)"); +WHERE (COALESCE([e].[NullableStringA], [e].[NullableStringB]) <> [e].[NullableStringC] OR ([e].[NullableStringA] IS NULL AND [e].[NullableStringB] IS NULL) OR [e].[NullableStringC] IS NULL) AND ([e].[NullableStringA] IS NOT NULL OR [e].[NullableStringB] IS NOT NULL OR [e].[NullableStringC] IS NOT NULL)"); } public override async Task Where_equal_with_coalesce_both_sides(bool async) @@ -867,7 +867,7 @@ public override async Task Where_not_equal_with_coalesce_both_sides(bool async) AssertSql( @"SELECT [e].[Id] FROM [Entities1] AS [e] -WHERE ((COALESCE([e].[NullableIntA], [e].[NullableIntB]) <> COALESCE([e].[NullableIntC], [e].[NullableIntB])) OR (([e].[NullableIntA] IS NULL AND [e].[NullableIntB] IS NULL) OR ([e].[NullableIntC] IS NULL AND [e].[NullableIntB] IS NULL))) AND (([e].[NullableIntA] IS NOT NULL OR [e].[NullableIntB] IS NOT NULL) OR ([e].[NullableIntC] IS NOT NULL OR [e].[NullableIntB] IS NOT NULL))"); +WHERE (COALESCE([e].[NullableIntA], [e].[NullableIntB]) <> COALESCE([e].[NullableIntC], [e].[NullableIntB]) OR ([e].[NullableIntA] IS NULL AND [e].[NullableIntB] IS NULL) OR ([e].[NullableIntC] IS NULL AND [e].[NullableIntB] IS NULL)) AND ([e].[NullableIntA] IS NOT NULL OR [e].[NullableIntB] IS NOT NULL OR [e].[NullableIntC] IS NOT NULL OR [e].[NullableIntB] IS NOT NULL)"); } public override async Task Where_equal_with_conditional(bool async) @@ -877,11 +877,11 @@ public override async Task Where_equal_with_conditional(bool async) AssertSql( @"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] +WHERE CASE + 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)"); } @@ -893,14 +893,14 @@ public override async Task Where_not_equal_with_conditional(bool async) AssertSql( @"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] +WHERE ([e].[NullableStringC] <> CASE + 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)"); } @@ -912,10 +912,10 @@ public override async Task Where_equal_with_conditional_non_nullable(bool async) AssertSql( @"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] +WHERE [e].[NullableStringC] <> CASE + 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) @@ -925,7 +925,7 @@ public override async Task Where_equal_with_and_and_contains(bool async) AssertSql( @"SELECT [e].[Id] FROM [Entities1] AS [e] -WHERE (([e].[NullableStringB] LIKE N'') OR (CHARINDEX([e].[NullableStringB], [e].[NullableStringA]) > 0)) AND ([e].[BoolA] = CAST(1 AS bit))"); +WHERE (([e].[NullableStringB] LIKE N'') OR CHARINDEX([e].[NullableStringB], [e].[NullableStringA]) > 0) AND [e].[BoolA] = CAST(1 AS bit)"); } public override async Task Null_comparison_in_selector_with_relational_nulls(bool async) @@ -934,7 +934,7 @@ public override async Task Null_comparison_in_selector_with_relational_nulls(boo AssertSql( @"SELECT CASE - WHEN ([e].[NullableStringA] <> N'Foo') OR [e].[NullableStringA] IS NULL THEN CAST(1 AS bit) + WHEN [e].[NullableStringA] <> N'Foo' OR [e].[NullableStringA] IS NULL THEN CAST(1 AS bit) ELSE CAST(0 AS bit) END FROM [Entities1] AS [e]"); @@ -948,10 +948,10 @@ public override async Task Null_comparison_in_order_by_with_relational_nulls(boo @"SELECT [e].[Id], [e].[BoolA], [e].[BoolB], [e].[BoolC], [e].[IntA], [e].[IntB], [e].[IntC], [e].[NullableBoolA], [e].[NullableBoolB], [e].[NullableBoolC], [e].[NullableIntA], [e].[NullableIntB], [e].[NullableIntC], [e].[NullableStringA], [e].[NullableStringB], [e].[NullableStringC], [e].[StringA], [e].[StringB], [e].[StringC] FROM [Entities1] AS [e] ORDER BY CASE - WHEN ([e].[NullableStringA] <> N'Foo') OR [e].[NullableStringA] IS NULL THEN CAST(1 AS bit) + WHEN [e].[NullableStringA] <> N'Foo' OR [e].[NullableStringA] IS NULL THEN CAST(1 AS bit) ELSE CAST(0 AS bit) END, CASE - WHEN ([e].[NullableIntB] <> 10) OR [e].[NullableIntB] IS NULL THEN CAST(1 AS bit) + WHEN [e].[NullableIntB] <> 10 OR [e].[NullableIntB] IS NULL THEN CAST(1 AS bit) ELSE CAST(0 AS bit) END"); } @@ -1062,7 +1062,7 @@ public override async Task Where_nullable_bool_with_null_check(bool async) AssertSql( @"SELECT [e].[Id] FROM [Entities1] AS [e] -WHERE ([e].[NullableBoolA] IS NOT NULL) AND ([e].[NullableBoolA] = CAST(1 AS bit))"); +WHERE ([e].[NullableBoolA] IS NOT NULL) AND [e].[NullableBoolA] = CAST(1 AS bit)"); } public override void Where_equal_using_relational_null_semantics_with_parameter() @@ -1186,7 +1186,7 @@ public override void Switching_null_semantics_produces_different_cache_entry() AssertSql( @"SELECT [e].[Id] FROM [Entities1] AS [e] -WHERE ([e].[NullableBoolA] = [e].[NullableBoolB]) OR (([e].[NullableBoolA] IS NULL) AND ([e].[NullableBoolB] IS NULL))", +WHERE [e].[NullableBoolA] = [e].[NullableBoolB] OR (([e].[NullableBoolA] IS NULL) AND ([e].[NullableBoolB] IS NULL))", // @"SELECT [e].[Id] FROM [Entities1] AS [e] @@ -1251,49 +1251,36 @@ public override async Task Null_semantics_applied_when_comparing_function_with_n AssertSql( @"SELECT [e].[Id] FROM [Entities1] AS [e] -WHERE (CASE +WHERE CASE WHEN N'oo' = N'' THEN 0 ELSE CAST(CHARINDEX(N'oo', [e].[NullableStringA]) AS int) - 1 -END = [e].[NullableIntA]) OR (CASE +END = [e].[NullableIntA] OR (CASE WHEN N'oo' = N'' THEN 0 ELSE CAST(CHARINDEX(N'oo', [e].[NullableStringA]) AS int) - 1 END IS NULL AND [e].[NullableIntA] IS NULL)", // @"SELECT [e].[Id] FROM [Entities1] AS [e] -WHERE (CASE +WHERE CASE WHEN N'ar' = N'' THEN 0 ELSE CAST(CHARINDEX(N'ar', [e].[NullableStringA]) AS int) - 1 -END = [e].[NullableIntA]) OR (CASE +END = [e].[NullableIntA] OR (CASE WHEN N'ar' = N'' THEN 0 ELSE CAST(CHARINDEX(N'ar', [e].[NullableStringA]) AS int) - 1 END IS NULL AND [e].[NullableIntA] IS NULL)", // @"SELECT [e].[Id] FROM [Entities1] AS [e] -WHERE ((CASE +WHERE (CASE WHEN N'oo' = N'' THEN 0 ELSE CAST(CHARINDEX(N'oo', [e].[NullableStringA]) AS int) - 1 -END <> [e].[NullableIntB]) OR (CASE +END <> [e].[NullableIntB] OR CASE WHEN N'oo' = N'' THEN 0 ELSE CAST(CHARINDEX(N'oo', [e].[NullableStringA]) AS int) - 1 -END IS NULL OR [e].[NullableIntB] IS NULL)) AND (CASE +END IS NULL OR [e].[NullableIntB] IS NULL) AND (CASE WHEN N'oo' = N'' THEN 0 ELSE CAST(CHARINDEX(N'oo', [e].[NullableStringA]) AS int) - 1 END IS NOT NULL OR [e].[NullableIntB] IS NOT NULL)"); - // issue #18773 - // AssertSql( - // @"SELECT [e].[Id] - //FROM [Entities1] AS [e] - //WHERE ((CHARINDEX(N'oo', [e].[NullableStringA]) - 1) = [e].[NullableIntA]) OR ([e].[NullableStringA] IS NULL AND [e].[NullableIntA] IS NULL)", - // // - // @"SELECT [e].[Id] - //FROM [Entities1] AS [e] - //WHERE ((CHARINDEX(N'ar', [e].[NullableStringA]) - 1) = [e].[NullableIntA]) OR ([e].[NullableStringA] IS NULL AND [e].[NullableIntA] IS NULL)", - // // - // @"SELECT [e].[Id] - //FROM [Entities1] AS [e] - //WHERE (((CHARINDEX(N'oo', [e].[NullableStringA]) - 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) @@ -1324,13 +1311,13 @@ public override async Task Null_semantics_applied_when_comparing_two_functions_w AssertSql( @"SELECT [e].[Id] FROM [Entities1] AS [e] -WHERE (CASE +WHERE CASE WHEN N'oo' = N'' THEN 0 ELSE CAST(CHARINDEX(N'oo', [e].[NullableStringA]) AS int) - 1 END = CASE WHEN N'ar' = N'' THEN 0 ELSE CAST(CHARINDEX(N'ar', [e].[NullableStringB]) AS int) - 1 -END) OR (CASE +END OR (CASE WHEN N'oo' = N'' THEN 0 ELSE CAST(CHARINDEX(N'oo', [e].[NullableStringA]) AS int) - 1 END IS NULL AND CASE @@ -1340,19 +1327,19 @@ ELSE CAST(CHARINDEX(N'ar', [e].[NullableStringB]) AS int) - 1 // @"SELECT [e].[Id] FROM [Entities1] AS [e] -WHERE ((CASE +WHERE (CASE WHEN N'oo' = N'' THEN 0 ELSE CAST(CHARINDEX(N'oo', [e].[NullableStringA]) AS int) - 1 END <> CASE WHEN N'ar' = N'' THEN 0 ELSE CAST(CHARINDEX(N'ar', [e].[NullableStringB]) AS int) - 1 -END) OR (CASE +END OR CASE WHEN N'oo' = N'' THEN 0 ELSE CAST(CHARINDEX(N'oo', [e].[NullableStringA]) AS int) - 1 END IS NULL OR CASE WHEN N'ar' = N'' THEN 0 ELSE CAST(CHARINDEX(N'ar', [e].[NullableStringB]) AS int) - 1 -END IS NULL)) AND (CASE +END IS NULL) AND (CASE WHEN N'oo' = N'' THEN 0 ELSE CAST(CHARINDEX(N'oo', [e].[NullableStringA]) AS int) - 1 END IS NOT NULL OR CASE @@ -1362,38 +1349,25 @@ ELSE CAST(CHARINDEX(N'ar', [e].[NullableStringB]) AS int) - 1 // @"SELECT [e].[Id] FROM [Entities1] AS [e] -WHERE ((CASE +WHERE (CASE WHEN N'oo' = N'' THEN 0 ELSE CAST(CHARINDEX(N'oo', [e].[NullableStringA]) AS int) - 1 END <> CASE WHEN N'ar' = N'' THEN 0 ELSE CAST(CHARINDEX(N'ar', [e].[NullableStringA]) AS int) - 1 -END) OR (CASE +END OR CASE WHEN N'oo' = N'' THEN 0 ELSE CAST(CHARINDEX(N'oo', [e].[NullableStringA]) AS int) - 1 END IS NULL OR CASE WHEN N'ar' = N'' THEN 0 ELSE CAST(CHARINDEX(N'ar', [e].[NullableStringA]) AS int) - 1 -END IS NULL)) AND (CASE +END IS NULL) AND (CASE WHEN N'oo' = N'' THEN 0 ELSE CAST(CHARINDEX(N'oo', [e].[NullableStringA]) AS int) - 1 END IS NOT NULL OR CASE WHEN N'ar' = N'' THEN 0 ELSE CAST(CHARINDEX(N'ar', [e].[NullableStringA]) AS int) - 1 END IS NOT NULL)"); - // issue #18773 - // AssertSql( - // @"SELECT [e].[Id] - //FROM [Entities1] AS [e] - //WHERE ((CHARINDEX(N'oo', [e].[NullableStringA]) - 1) = (CHARINDEX(N'ar', [e].[NullableStringB]) - 1)) OR ([e].[NullableStringA] IS NULL AND [e].[NullableStringB] IS NULL)", - // // - // @"SELECT [e].[Id] - //FROM [Entities1] AS [e] - //WHERE (((CHARINDEX(N'oo', [e].[NullableStringA]) - 1) <> (CHARINDEX(N'ar', [e].[NullableStringB]) - 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 (((CHARINDEX(N'oo', [e].[NullableStringA]) - 1) <> (CHARINDEX(N'ar', [e].[NullableStringA]) - 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) @@ -1403,11 +1377,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) @@ -1421,15 +1395,15 @@ FROM [Entities1] AS [e] // @"SELECT [e].[Id] FROM [Entities1] AS [e] -WHERE ([e].[NullableBoolA] = COALESCE([e].[NullableBoolB], [e].[NullableBoolC])) OR (([e].[NullableBoolA] IS NULL) AND (([e].[NullableBoolB] IS NULL) AND ([e].[NullableBoolC] IS NULL)))", +WHERE [e].[NullableBoolA] = COALESCE([e].[NullableBoolB], [e].[NullableBoolC]) OR (([e].[NullableBoolA] IS NULL) AND ([e].[NullableBoolB] IS NULL) AND ([e].[NullableBoolC] IS NULL))", // @"SELECT [e].[Id] FROM [Entities1] AS [e] -WHERE (COALESCE([e].[NullableBoolB], [e].[BoolC]) <> [e].[NullableBoolA]) OR ([e].[NullableBoolA] IS NULL)", +WHERE COALESCE([e].[NullableBoolB], [e].[BoolC]) <> [e].[NullableBoolA] OR ([e].[NullableBoolA] IS NULL)", // @"SELECT [e].[Id] FROM [Entities1] AS [e] -WHERE ((COALESCE([e].[NullableBoolB], [e].[NullableBoolC]) <> [e].[NullableBoolA]) OR ((([e].[NullableBoolB] IS NULL) AND ([e].[NullableBoolC] IS NULL)) OR ([e].[NullableBoolA] IS NULL))) AND ((([e].[NullableBoolB] IS NOT NULL) OR ([e].[NullableBoolC] IS NOT NULL)) OR ([e].[NullableBoolA] IS NOT NULL))"); +WHERE (COALESCE([e].[NullableBoolB], [e].[NullableBoolC]) <> [e].[NullableBoolA] OR (([e].[NullableBoolB] IS NULL) AND ([e].[NullableBoolC] IS NULL)) OR ([e].[NullableBoolA] IS NULL)) AND (([e].[NullableBoolB] IS NOT NULL) OR ([e].[NullableBoolC] IS NOT NULL) OR ([e].[NullableBoolA] IS NOT NULL))"); } public override async Task Null_semantics_conditional(bool async) @@ -1447,7 +1421,7 @@ ELSE [e].[NullableBoolC] @"SELECT [e].[Id] FROM [Entities1] AS [e] 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 [e].[BoolB] + 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 [e].[BoolB] ELSE [e].[BoolC] END = [e].[BoolA]", // @@ -1456,13 +1430,13 @@ FROM [Entities1] AS [e] WHERE CASE WHEN CASE WHEN [e].[BoolA] = CAST(1 AS bit) THEN 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) + 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 ELSE [e].[BoolC] END <> [e].[BoolB] THEN [e].[BoolA] ELSE CASE - WHEN (([e].[NullableBoolB] = [e].[NullableBoolC]) AND (([e].[NullableBoolB] IS NOT NULL) AND ([e].[NullableBoolC] IS NOT NULL))) OR (([e].[NullableBoolB] IS NULL) AND ([e].[NullableBoolC] IS NULL)) THEN CAST(1 AS bit) + WHEN ([e].[NullableBoolB] = [e].[NullableBoolC] AND ([e].[NullableBoolB] IS NOT NULL) AND ([e].[NullableBoolC] IS NOT NULL)) OR (([e].[NullableBoolB] IS NULL) AND ([e].[NullableBoolC] IS NULL)) THEN CAST(1 AS bit) ELSE CAST(0 AS bit) END END = CAST(1 AS bit)"); @@ -1475,7 +1449,7 @@ public override async Task Null_semantics_function(bool async) AssertSql( @"SELECT [e].[Id] FROM [Entities1] AS [e] -WHERE ((SUBSTRING([e].[NullableStringA], 0 + 1, [e].[IntA]) <> [e].[NullableStringB]) OR ([e].[NullableStringA] IS NULL OR [e].[NullableStringB] IS NULL)) AND ([e].[NullableStringA] IS NOT NULL OR [e].[NullableStringB] IS NOT NULL)"); +WHERE (SUBSTRING([e].[NullableStringA], 0 + 1, [e].[IntA]) <> [e].[NullableStringB] OR [e].[NullableStringA] IS NULL OR [e].[NullableStringB] IS NULL) AND ([e].[NullableStringA] IS NOT NULL OR [e].[NullableStringB] IS NOT NULL)"); } public override async Task Null_semantics_join_with_composite_key(bool async) @@ -1485,10 +1459,10 @@ 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]))"); +END = COALESCE([e0].[NullableBoolA], [e0].[BoolC])"); } public override async Task Null_semantics_contains(bool async) @@ -1608,23 +1582,23 @@ public override async Task Null_semantics_with_null_check_simple(bool async) AssertSql( @"SELECT [e].[Id] FROM [Entities1] AS [e] -WHERE [e].[NullableIntA] IS NOT NULL AND ([e].[NullableIntA] = [e].[NullableIntB])", +WHERE [e].[NullableIntA] IS NOT NULL AND [e].[NullableIntA] = [e].[NullableIntB]", // @"SELECT [e].[Id] FROM [Entities1] AS [e] -WHERE [e].[NullableIntA] IS NOT NULL AND (([e].[NullableIntA] <> [e].[NullableIntB]) OR [e].[NullableIntB] IS NULL)", +WHERE [e].[NullableIntA] IS NOT NULL AND ([e].[NullableIntA] <> [e].[NullableIntB] OR [e].[NullableIntB] IS NULL)", // @"SELECT [e].[Id] FROM [Entities1] AS [e] -WHERE [e].[NullableIntA] IS NOT NULL AND ([e].[NullableIntA] = [e].[IntC])", +WHERE [e].[NullableIntA] IS NOT NULL AND [e].[NullableIntA] = [e].[IntC]", // @"SELECT [e].[Id] FROM [Entities1] AS [e] -WHERE ([e].[NullableIntA] IS NOT NULL AND [e].[NullableIntB] IS NOT NULL) AND ([e].[NullableIntA] = [e].[NullableIntB])", +WHERE [e].[NullableIntA] IS NOT NULL AND [e].[NullableIntB] IS NOT NULL AND [e].[NullableIntA] = [e].[NullableIntB]", // @"SELECT [e].[Id] FROM [Entities1] AS [e] -WHERE ([e].[NullableIntA] IS NOT NULL AND [e].[NullableIntB] IS NOT NULL) AND ([e].[NullableIntA] <> [e].[NullableIntB])"); +WHERE [e].[NullableIntA] IS NOT NULL AND [e].[NullableIntB] IS NOT NULL AND [e].[NullableIntA] <> [e].[NullableIntB]"); } public override async Task Null_semantics_with_null_check_complex(bool async) @@ -1634,15 +1608,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) @@ -1652,11 +1626,11 @@ public override async Task Null_semantics_with_null_check_complex2(bool async) AssertSql( @"SELECT [e].[Id] FROM [Entities1] AS [e] -WHERE (((([e].[NullableBoolA] IS NOT NULL) AND ([e].[NullableBoolB] IS NOT NULL)) AND (([e].[NullableBoolB] <> [e].[NullableBoolA]) OR ([e].[NullableBoolC] IS NOT NULL))) AND (([e].[NullableBoolC] <> [e].[NullableBoolB]) OR ([e].[NullableBoolC] IS NULL))) OR (([e].[NullableBoolC] <> [e].[BoolB]) OR ([e].[NullableBoolC] IS NULL))", +WHERE (([e].[NullableBoolA] IS NOT NULL) AND ([e].[NullableBoolB] IS NOT NULL) AND ([e].[NullableBoolB] <> [e].[NullableBoolA] OR ([e].[NullableBoolC] IS NOT NULL)) AND ([e].[NullableBoolC] <> [e].[NullableBoolB] OR ([e].[NullableBoolC] IS NULL))) OR [e].[NullableBoolC] <> [e].[BoolB] OR ([e].[NullableBoolC] IS NULL)", // @"SELECT [e].[Id] FROM [Entities1] AS [e] -WHERE (((([e].[NullableBoolA] IS NOT NULL) AND ([e].[NullableBoolB] IS NOT NULL)) AND (([e].[NullableBoolB] <> [e].[NullableBoolA]) OR ([e].[NullableBoolC] IS NOT NULL))) AND (([e].[NullableBoolC] <> [e].[NullableBoolB]) OR ([e].[NullableBoolC] IS NULL))) OR (([e].[NullableBoolB] <> [e].[BoolB]) OR ([e].[NullableBoolB] IS NULL))"); +WHERE (([e].[NullableBoolA] IS NOT NULL) AND ([e].[NullableBoolB] IS NOT NULL) AND ([e].[NullableBoolB] <> [e].[NullableBoolA] OR ([e].[NullableBoolC] IS NOT NULL)) AND ([e].[NullableBoolC] <> [e].[NullableBoolB] OR ([e].[NullableBoolC] IS NULL))) OR [e].[NullableBoolB] <> [e].[BoolB] OR ([e].[NullableBoolB] IS NULL)"); } public override async Task IsNull_on_complex_expression(bool async) @@ -1736,7 +1710,7 @@ public override async Task Nullable_column_info_propagates_inside_binary_AndAlso AssertSql( @"SELECT [e].[Id] FROM [Entities1] AS [e] -WHERE ([e].[NullableStringA] IS NOT NULL AND [e].[NullableStringB] IS NOT NULL) AND ([e].[NullableStringA] <> [e].[NullableStringB])"); +WHERE [e].[NullableStringA] IS NOT NULL AND [e].[NullableStringB] IS NOT NULL AND [e].[NullableStringA] <> [e].[NullableStringB]"); } public override async Task Nullable_column_info_doesnt_propagate_inside_binary_OrElse(bool async) @@ -1746,7 +1720,7 @@ public override async Task Nullable_column_info_doesnt_propagate_inside_binary_O AssertSql( @"SELECT [e].[Id] FROM [Entities1] AS [e] -WHERE ([e].[NullableStringA] IS NOT NULL OR [e].[NullableStringB] IS NOT NULL) AND ((([e].[NullableStringA] <> [e].[NullableStringB]) OR ([e].[NullableStringA] IS NULL OR [e].[NullableStringB] IS NULL)) AND ([e].[NullableStringA] IS NOT NULL OR [e].[NullableStringB] IS NOT NULL))"); +WHERE ([e].[NullableStringA] IS NOT NULL OR [e].[NullableStringB] IS NOT NULL) AND ([e].[NullableStringA] <> [e].[NullableStringB] OR [e].[NullableStringA] IS NULL OR [e].[NullableStringB] IS NULL) AND ([e].[NullableStringA] IS NOT NULL OR [e].[NullableStringB] IS NOT NULL)"); } public override async Task Nullable_column_info_propagates_inside_binary_OrElse_when_info_is_duplicated(bool async) @@ -1756,11 +1730,11 @@ public override async Task Nullable_column_info_propagates_inside_binary_OrElse_ AssertSql( @"SELECT [e].[Id] FROM [Entities1] AS [e] -WHERE (([e].[NullableStringA] IS NOT NULL AND [e].[NullableStringB] IS NOT NULL) OR [e].[NullableStringA] IS NOT NULL) AND (([e].[NullableStringA] <> [e].[NullableStringB]) OR [e].[NullableStringB] IS NULL)", +WHERE (([e].[NullableStringA] IS NOT NULL AND [e].[NullableStringB] IS NOT NULL) OR [e].[NullableStringA] IS NOT NULL) AND ([e].[NullableStringA] <> [e].[NullableStringB] OR [e].[NullableStringB] IS NULL)", // @"SELECT [e].[Id] FROM [Entities1] AS [e] -WHERE (([e].[NullableStringA] IS NOT NULL AND [e].[NullableStringB] IS NOT NULL) OR ([e].[NullableStringB] IS NOT NULL AND [e].[NullableStringA] IS NOT NULL)) AND ([e].[NullableStringA] <> [e].[NullableStringB])"); +WHERE (([e].[NullableStringA] IS NOT NULL AND [e].[NullableStringB] IS NOT NULL) OR ([e].[NullableStringB] IS NOT NULL AND [e].[NullableStringA] IS NOT NULL)) AND [e].[NullableStringA] <> [e].[NullableStringB]"); } public override async Task Nullable_column_info_propagates_inside_conditional(bool async) @@ -1787,7 +1761,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]"); @@ -1801,7 +1775,7 @@ public override async Task Nullable_column_info_doesnt_propagate_between_differe @"SELECT [e].[Id] FROM [Entities1] AS [e] INNER JOIN [Entities1] AS [e0] ON [e].[NullableBoolA] IS NULL -WHERE (([e].[NullableBoolA] <> [e0].[NullableBoolB]) OR (([e].[NullableBoolA] IS NULL) OR ([e0].[NullableBoolB] IS NULL))) AND (([e].[NullableBoolA] IS NOT NULL) OR ([e0].[NullableBoolB] IS NOT NULL))"); +WHERE ([e].[NullableBoolA] <> [e0].[NullableBoolB] OR ([e].[NullableBoolA] IS NULL) OR ([e0].[NullableBoolB] IS NULL)) AND (([e].[NullableBoolA] IS NOT NULL) OR ([e0].[NullableBoolB] IS NOT NULL))"); } public override async Task Nullable_column_info_propagation_complex(bool async) @@ -1811,7 +1785,7 @@ public override async Task Nullable_column_info_propagation_complex(bool async) AssertSql( @"SELECT [e].[Id] FROM [Entities1] AS [e] -WHERE (([e].[NullableStringA] IS NOT NULL AND ([e].[NullableBoolB] IS NOT NULL)) AND [e].[NullableStringC] IS NOT NULL) AND (([e].[NullableBoolB] <> [e].[NullableBoolC]) OR ([e].[NullableBoolC] IS NULL))"); +WHERE [e].[NullableStringA] IS NOT NULL AND ([e].[NullableBoolB] IS NOT NULL) AND [e].[NullableStringC] IS NOT NULL AND ([e].[NullableBoolB] <> [e].[NullableBoolC] OR ([e].[NullableBoolC] IS NULL))"); } public override async Task Empty_subquery_with_contains_returns_false(bool async) @@ -1840,7 +1814,7 @@ public override async Task Nullable_string_FirstOrDefault_compared_to_nullable_s AssertSql( @"SELECT [e].[Id], [e].[BoolA], [e].[BoolB], [e].[BoolC], [e].[IntA], [e].[IntB], [e].[IntC], [e].[NullableBoolA], [e].[NullableBoolB], [e].[NullableBoolC], [e].[NullableIntA], [e].[NullableIntB], [e].[NullableIntC], [e].[NullableStringA], [e].[NullableStringB], [e].[NullableStringC], [e].[StringA], [e].[StringB], [e].[StringC] FROM [Entities1] AS [e] -WHERE (SUBSTRING([e].[NullableStringA], 1, 1) = SUBSTRING([e].[NullableStringB], LEN([e].[NullableStringB]), 1)) OR ([e].[NullableStringA] IS NULL AND [e].[NullableStringB] IS NULL)"); +WHERE SUBSTRING([e].[NullableStringA], 1, 1) = SUBSTRING([e].[NullableStringB], LEN([e].[NullableStringB]), 1) OR ([e].[NullableStringA] IS NULL AND [e].[NullableStringB] IS NULL)"); } public override async Task Null_semantics_applied_to_CompareTo_equality(bool async) @@ -1850,19 +1824,19 @@ public override async Task Null_semantics_applied_to_CompareTo_equality(bool asy AssertSql( @"SELECT [e].[Id], [e].[BoolA], [e].[BoolB], [e].[BoolC], [e].[IntA], [e].[IntB], [e].[IntC], [e].[NullableBoolA], [e].[NullableBoolB], [e].[NullableBoolC], [e].[NullableIntA], [e].[NullableIntB], [e].[NullableIntC], [e].[NullableStringA], [e].[NullableStringB], [e].[NullableStringC], [e].[StringA], [e].[StringB], [e].[StringC] FROM [Entities1] AS [e] -WHERE ([e].[NullableStringA] = [e].[NullableStringB]) OR ([e].[NullableStringA] IS NULL AND [e].[NullableStringB] IS NULL)", +WHERE [e].[NullableStringA] = [e].[NullableStringB] OR ([e].[NullableStringA] IS NULL AND [e].[NullableStringB] IS NULL)", // @"SELECT [e].[Id], [e].[BoolA], [e].[BoolB], [e].[BoolC], [e].[IntA], [e].[IntB], [e].[IntC], [e].[NullableBoolA], [e].[NullableBoolB], [e].[NullableBoolC], [e].[NullableIntA], [e].[NullableIntB], [e].[NullableIntC], [e].[NullableStringA], [e].[NullableStringB], [e].[NullableStringC], [e].[StringA], [e].[StringB], [e].[StringC] FROM [Entities1] AS [e] -WHERE ([e].[NullableStringA] = [e].[NullableStringB]) OR ([e].[NullableStringA] IS NULL AND [e].[NullableStringB] IS NULL)", +WHERE [e].[NullableStringA] = [e].[NullableStringB] OR ([e].[NullableStringA] IS NULL AND [e].[NullableStringB] IS NULL)", // @"SELECT [e].[Id], [e].[BoolA], [e].[BoolB], [e].[BoolC], [e].[IntA], [e].[IntB], [e].[IntC], [e].[NullableBoolA], [e].[NullableBoolB], [e].[NullableBoolC], [e].[NullableIntA], [e].[NullableIntB], [e].[NullableIntC], [e].[NullableStringA], [e].[NullableStringB], [e].[NullableStringC], [e].[StringA], [e].[StringB], [e].[StringC] FROM [Entities1] AS [e] -WHERE (([e].[NullableStringA] <> [e].[NullableStringB]) OR ([e].[NullableStringA] IS NULL OR [e].[NullableStringB] IS NULL)) AND ([e].[NullableStringA] IS NOT NULL OR [e].[NullableStringB] IS NOT NULL)", +WHERE ([e].[NullableStringA] <> [e].[NullableStringB] OR [e].[NullableStringA] IS NULL OR [e].[NullableStringB] IS NULL) AND ([e].[NullableStringA] IS NOT NULL OR [e].[NullableStringB] IS NOT NULL)", // @"SELECT [e].[Id], [e].[BoolA], [e].[BoolB], [e].[BoolC], [e].[IntA], [e].[IntB], [e].[IntC], [e].[NullableBoolA], [e].[NullableBoolB], [e].[NullableBoolC], [e].[NullableIntA], [e].[NullableIntB], [e].[NullableIntC], [e].[NullableStringA], [e].[NullableStringB], [e].[NullableStringC], [e].[StringA], [e].[StringB], [e].[StringC] FROM [Entities1] AS [e] -WHERE (([e].[NullableStringA] <> [e].[NullableStringB]) OR ([e].[NullableStringA] IS NULL OR [e].[NullableStringB] IS NULL)) AND ([e].[NullableStringA] IS NOT NULL OR [e].[NullableStringB] IS NOT NULL)"); +WHERE ([e].[NullableStringA] <> [e].[NullableStringB] OR [e].[NullableStringA] IS NULL OR [e].[NullableStringB] IS NULL) AND ([e].[NullableStringA] IS NOT NULL OR [e].[NullableStringB] IS NOT NULL)"); } public override async Task Nested_CompareTo_optimized(bool async) @@ -1872,19 +1846,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) @@ -1914,7 +1888,7 @@ public override async Task Multiple_non_equality_comparisons_including_null_comp AssertSql( @"SELECT [e].[Id], [e].[BoolA], [e].[BoolB], [e].[BoolC], [e].[IntA], [e].[IntB], [e].[IntC], [e].[NullableBoolA], [e].[NullableBoolB], [e].[NullableBoolC], [e].[NullableIntA], [e].[NullableIntB], [e].[NullableIntC], [e].[NullableStringA], [e].[NullableStringB], [e].[NullableStringC], [e].[StringA], [e].[StringB], [e].[StringC] FROM [Entities1] AS [e] -WHERE ([e].[NullableIntA] <> 1) AND [e].[NullableIntA] IS NOT NULL"); +WHERE [e].[NullableIntA] <> 1 AND [e].[NullableIntA] IS NOT NULL"); } public override async Task Multiple_non_equality_comparisons_without_null_comparison_work_for_relational_null_semantics(bool async) @@ -1934,7 +1908,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) @@ -2130,7 +2104,7 @@ public override async Task Is_null_on_column_followed_by_OrElse_optimizes_nullab AssertSql( @"SELECT [e].[Id], [e].[BoolA], [e].[BoolB], [e].[BoolC], [e].[IntA], [e].[IntB], [e].[IntC], [e].[NullableBoolA], [e].[NullableBoolB], [e].[NullableBoolC], [e].[NullableIntA], [e].[NullableIntB], [e].[NullableIntC], [e].[NullableStringA], [e].[NullableStringB], [e].[NullableStringC], [e].[StringA], [e].[StringB], [e].[StringC] FROM [Entities1] AS [e] -WHERE [e].[NullableStringA] IS NOT NULL AND ([e].[NullableStringA] = N'Foo')"); +WHERE [e].[NullableStringA] IS NOT NULL AND [e].[NullableStringA] = N'Foo'"); } public override async Task Is_null_on_column_followed_by_OrElse_optimizes_nullability_negative(bool async) @@ -2140,7 +2114,7 @@ public override async Task Is_null_on_column_followed_by_OrElse_optimizes_nullab AssertSql( @"SELECT [e].[Id], [e].[BoolA], [e].[BoolB], [e].[BoolC], [e].[IntA], [e].[IntB], [e].[IntC], [e].[NullableBoolA], [e].[NullableBoolB], [e].[NullableBoolC], [e].[NullableIntA], [e].[NullableIntB], [e].[NullableIntC], [e].[NullableStringA], [e].[NullableStringB], [e].[NullableStringC], [e].[StringA], [e].[StringB], [e].[StringC] FROM [Entities1] AS [e] -WHERE [e].[NullableStringA] IS NOT NULL OR (([e].[NullableStringA] = N'Foo') AND [e].[NullableStringA] IS NOT NULL)"); +WHERE [e].[NullableStringA] IS NOT NULL OR ([e].[NullableStringA] = N'Foo' AND [e].[NullableStringA] IS NOT NULL)"); } public override async Task Is_null_on_column_followed_by_OrElse_optimizes_nullability_nested(bool async) @@ -2150,7 +2124,7 @@ public override async Task Is_null_on_column_followed_by_OrElse_optimizes_nullab AssertSql( @"SELECT [e].[Id], [e].[BoolA], [e].[BoolB], [e].[BoolC], [e].[IntA], [e].[IntB], [e].[IntC], [e].[NullableBoolA], [e].[NullableBoolB], [e].[NullableBoolC], [e].[NullableIntA], [e].[NullableIntB], [e].[NullableIntC], [e].[NullableStringA], [e].[NullableStringB], [e].[NullableStringC], [e].[StringA], [e].[StringB], [e].[StringC] FROM [Entities1] AS [e] -WHERE ([e].[NullableStringA] IS NULL OR [e].[NullableStringB] IS NULL) OR ([e].[NullableStringA] <> [e].[NullableStringB])"); +WHERE [e].[NullableStringA] IS NULL OR [e].[NullableStringB] IS NULL OR [e].[NullableStringA] <> [e].[NullableStringB]"); } public override async Task Is_null_on_column_followed_by_OrElse_optimizes_nullability_intersection(bool async) @@ -2160,7 +2134,7 @@ public override async Task Is_null_on_column_followed_by_OrElse_optimizes_nullab AssertSql( @"SELECT [e].[Id], [e].[BoolA], [e].[BoolB], [e].[BoolC], [e].[IntA], [e].[IntB], [e].[IntC], [e].[NullableBoolA], [e].[NullableBoolB], [e].[NullableBoolC], [e].[NullableIntA], [e].[NullableIntB], [e].[NullableIntC], [e].[NullableStringA], [e].[NullableStringB], [e].[NullableStringC], [e].[StringA], [e].[StringB], [e].[StringC] FROM [Entities1] AS [e] -WHERE ([e].[NullableStringA] IS NULL AND ((([e].[StringA] = N'Foo') OR [e].[NullableStringA] IS NULL) OR [e].[NullableStringB] IS NULL)) OR (([e].[NullableStringA] <> [e].[NullableStringB]) OR [e].[NullableStringB] IS NULL)"); +WHERE ([e].[NullableStringA] IS NULL AND ([e].[StringA] = N'Foo' OR [e].[NullableStringA] IS NULL OR [e].[NullableStringB] IS NULL)) OR [e].[NullableStringA] <> [e].[NullableStringB] OR [e].[NullableStringB] IS NULL"); } public override async Task Is_null_on_column_followed_by_OrElse_optimizes_nullability_conditional(bool async) @@ -2173,11 +2147,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)"); @@ -2193,11 +2167,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 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] = [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)"); @@ -2212,11 +2186,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 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] = [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)"); @@ -2230,16 +2204,16 @@ 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].[NullableBoolA] IS NULL) OR (CASE +WHERE ([e].[NullableBoolA] IS NULL) OR CASE WHEN [e].[NullableBoolB] IS NULL THEN CASE - WHEN ([e].[NullableBoolB] <> [e].[NullableBoolA]) OR ([e].[NullableBoolB] IS NULL) THEN CAST(1 AS bit) + WHEN [e].[NullableBoolB] <> [e].[NullableBoolA] OR ([e].[NullableBoolB] IS NULL) THEN CAST(1 AS bit) ELSE CAST(0 AS bit) END ELSE CASE - WHEN ([e].[NullableBoolA] <> [e].[NullableBoolB]) OR ([e].[NullableBoolB] IS NULL) THEN CAST(1 AS bit) + WHEN [e].[NullableBoolA] <> [e].[NullableBoolB] OR ([e].[NullableBoolB] IS NULL) THEN CAST(1 AS bit) ELSE CAST(0 AS bit) END -END = CAST(1 AS bit))"); +END = CAST(1 AS bit)"); } public override async Task Is_null_on_column_followed_by_OrElse_optimizes_nullability_conditional_nested(bool async) @@ -2256,11 +2230,11 @@ WHEN [e].[NullableBoolA] IS NULL THEN CASE ELSE CAST(0 AS bit) END WHEN [e].[NullableBoolC] IS NULL THEN CASE - WHEN (([e].[NullableBoolA] <> [e].[NullableBoolC]) OR (([e].[NullableBoolA] IS NULL) OR ([e].[NullableBoolC] IS NULL))) AND (([e].[NullableBoolA] IS NOT NULL) OR ([e].[NullableBoolC] IS NOT NULL)) THEN CAST(1 AS bit) + WHEN ([e].[NullableBoolA] <> [e].[NullableBoolC] OR ([e].[NullableBoolA] IS NULL) OR ([e].[NullableBoolC] IS NULL)) AND (([e].[NullableBoolA] IS NOT NULL) OR ([e].[NullableBoolC] IS NOT NULL)) THEN CAST(1 AS bit) ELSE CAST(0 AS bit) END ELSE CASE - WHEN (([e].[NullableBoolC] <> [e].[NullableBoolA]) OR (([e].[NullableBoolC] IS NULL) OR ([e].[NullableBoolA] IS NULL))) AND (([e].[NullableBoolC] IS NOT NULL) OR ([e].[NullableBoolA] IS NOT NULL)) THEN CAST(1 AS bit) + WHEN ([e].[NullableBoolC] <> [e].[NullableBoolA] OR ([e].[NullableBoolC] IS NULL) OR ([e].[NullableBoolA] IS NULL)) AND (([e].[NullableBoolC] IS NOT NULL) OR ([e].[NullableBoolA] IS NOT NULL)) THEN CAST(1 AS bit) ELSE CAST(0 AS bit) END END = CAST(1 AS bit)"); @@ -2272,7 +2246,7 @@ public override async Task Sum_function_is_always_considered_non_nullable(bool a AssertSql( @"SELECT [e].[NullableIntA] AS [Key], CASE - WHEN (COALESCE(SUM([e].[IntA]), 0) <> [e].[NullableIntA]) OR [e].[NullableIntA] IS NULL THEN CAST(1 AS bit) + WHEN COALESCE(SUM([e].[IntA]), 0) <> [e].[NullableIntA] OR [e].[NullableIntA] IS NULL THEN CAST(1 AS bit) ELSE CAST(0 AS bit) END AS [Sum] FROM [Entities1] AS [e] @@ -2286,7 +2260,7 @@ public override async Task Nullability_is_computed_correctly_for_chained_coalesc AssertSql( @"SELECT [e].[Id], [e].[BoolA], [e].[BoolB], [e].[BoolC], [e].[IntA], [e].[IntB], [e].[IntC], [e].[NullableBoolA], [e].[NullableBoolB], [e].[NullableBoolC], [e].[NullableIntA], [e].[NullableIntB], [e].[NullableIntC], [e].[NullableStringA], [e].[NullableStringB], [e].[NullableStringC], [e].[StringA], [e].[StringB], [e].[StringC] FROM [Entities1] AS [e] -WHERE (COALESCE([e].[NullableIntA], [e].[NullableIntB], [e].[IntC]) <> [e].[NullableIntC]) OR [e].[NullableIntC] IS NULL"); +WHERE COALESCE([e].[NullableIntA], [e].[NullableIntB], [e].[IntC]) <> [e].[NullableIntC] OR [e].[NullableIntC] IS NULL"); } public override async Task Nullability_check_is_computed_correctly_for_chained_coalesce(bool async) @@ -2296,11 +2270,11 @@ public override async Task Nullability_check_is_computed_correctly_for_chained_c AssertSql( @"SELECT [e].[Id] FROM [Entities1] AS [e] -WHERE ([e].[NullableIntA] IS NULL AND [e].[NullableIntB] IS NULL) AND [e].[NullableIntC] IS NULL", +WHERE [e].[NullableIntA] IS NULL AND [e].[NullableIntB] IS NULL AND [e].[NullableIntC] IS NULL", // @"SELECT [e].[Id] FROM [Entities1] AS [e] -WHERE ([e].[NullableIntA] IS NOT NULL OR [e].[NullableIntB] IS NOT NULL) OR [e].[NullableIntC] IS NOT NULL"); +WHERE [e].[NullableIntA] IS NOT NULL OR [e].[NullableIntB] IS NOT NULL OR [e].[NullableIntC] IS NOT NULL"); } public override async Task Coalesce_on_self_gets_simplified(bool async) diff --git a/test/EFCore.SqlServer.FunctionalTests/Query/OwnedQuerySqlServerTest.cs b/test/EFCore.SqlServer.FunctionalTests/Query/OwnedQuerySqlServerTest.cs index 6647fb21fea..04cc7355584 100644 --- a/test/EFCore.SqlServer.FunctionalTests/Query/OwnedQuerySqlServerTest.cs +++ b/test/EFCore.SqlServer.FunctionalTests/Query/OwnedQuerySqlServerTest.cs @@ -33,7 +33,7 @@ FROM [OwnedPerson] AS [o0] LEFT JOIN ( SELECT [o1].[ClientId], [o1].[Id], [o1].[OrderDate], [o2].[OrderClientId], [o2].[OrderId], [o2].[Id] AS [Id0], [o2].[Detail] FROM [Order] AS [o1] - LEFT JOIN [OrderDetail] AS [o2] ON ([o1].[ClientId] = [o2].[OrderClientId]) AND ([o1].[Id] = [o2].[OrderId]) + LEFT JOIN [OrderDetail] AS [o2] ON [o1].[ClientId] = [o2].[OrderClientId] AND [o1].[Id] = [o2].[OrderId] ) AS [t0] ON [o].[Id] = [t0].[ClientId] WHERE 0 = 1 ORDER BY [o].[Id], [t].[Id], [t0].[ClientId], [t0].[Id], [t0].[OrderClientId], [t0].[OrderId]"); @@ -50,7 +50,7 @@ FROM [OwnedPerson] AS [o] LEFT JOIN ( SELECT [o0].[ClientId], [o0].[Id], [o0].[OrderDate], [o1].[OrderClientId], [o1].[OrderId], [o1].[Id] AS [Id0], [o1].[Detail] FROM [Order] AS [o0] - LEFT JOIN [OrderDetail] AS [o1] ON ([o0].[ClientId] = [o1].[OrderClientId]) AND ([o0].[Id] = [o1].[OrderId]) + LEFT JOIN [OrderDetail] AS [o1] ON [o0].[ClientId] = [o1].[OrderClientId] AND [o0].[Id] = [o1].[OrderId] ) AS [t] ON [o].[Id] = [t].[ClientId] ORDER BY [o].[Id], [t].[ClientId], [t].[Id], [t].[OrderClientId], [t].[OrderId]"); } @@ -74,7 +74,7 @@ FROM [OwnedPerson] AS [o] LEFT JOIN ( SELECT [o0].[ClientId], [o0].[Id], [o0].[OrderDate], [o1].[OrderClientId], [o1].[OrderId], [o1].[Id] AS [Id0], [o1].[Detail] FROM [Order] AS [o0] - LEFT JOIN [OrderDetail] AS [o1] ON ([o0].[ClientId] = [o1].[OrderClientId]) AND ([o0].[Id] = [o1].[OrderId]) + LEFT JOIN [OrderDetail] AS [o1] ON [o0].[ClientId] = [o1].[OrderClientId] AND [o0].[Id] = [o1].[OrderId] ) AS [t] ON [o].[Id] = [t].[ClientId] WHERE [o].[Discriminator] IN (N'Branch', N'LeafA') ORDER BY [o].[Id], [t].[ClientId], [t].[Id], [t].[OrderClientId], [t].[OrderId]"); @@ -90,7 +90,7 @@ FROM [OwnedPerson] AS [o] LEFT JOIN ( SELECT [o0].[ClientId], [o0].[Id], [o0].[OrderDate], [o1].[OrderClientId], [o1].[OrderId], [o1].[Id] AS [Id0], [o1].[Detail] FROM [Order] AS [o0] - LEFT JOIN [OrderDetail] AS [o1] ON ([o0].[ClientId] = [o1].[OrderClientId]) AND ([o0].[Id] = [o1].[OrderId]) + LEFT JOIN [OrderDetail] AS [o1] ON [o0].[ClientId] = [o1].[OrderClientId] AND [o0].[Id] = [o1].[OrderId] ) AS [t] ON [o].[Id] = [t].[ClientId] WHERE [o].[Discriminator] IN (N'Branch', N'LeafA') ORDER BY [o].[Id], [t].[ClientId], [t].[Id], [t].[OrderClientId], [t].[OrderId]"); @@ -106,7 +106,7 @@ FROM [OwnedPerson] AS [o] LEFT JOIN ( SELECT [o0].[ClientId], [o0].[Id], [o0].[OrderDate], [o1].[OrderClientId], [o1].[OrderId], [o1].[Id] AS [Id0], [o1].[Detail] FROM [Order] AS [o0] - LEFT JOIN [OrderDetail] AS [o1] ON ([o0].[ClientId] = [o1].[OrderClientId]) AND ([o0].[Id] = [o1].[OrderId]) + LEFT JOIN [OrderDetail] AS [o1] ON [o0].[ClientId] = [o1].[OrderClientId] AND [o0].[Id] = [o1].[OrderId] ) AS [t] ON [o].[Id] = [t].[ClientId] WHERE [o].[Discriminator] = N'LeafA' ORDER BY [o].[Id], [t].[ClientId], [t].[Id], [t].[OrderClientId], [t].[OrderId]"); @@ -131,7 +131,7 @@ ORDER BY [t].[Id] LEFT JOIN ( SELECT [o0].[ClientId], [o0].[Id], [o0].[OrderDate], [o1].[OrderClientId], [o1].[OrderId], [o1].[Id] AS [Id0], [o1].[Detail] FROM [Order] AS [o0] - LEFT JOIN [OrderDetail] AS [o1] ON ([o0].[ClientId] = [o1].[OrderClientId]) AND ([o0].[Id] = [o1].[OrderId]) + LEFT JOIN [OrderDetail] AS [o1] ON [o0].[ClientId] = [o1].[OrderClientId] AND [o0].[Id] = [o1].[OrderId] ) AS [t1] ON [t0].[Id] = [t1].[ClientId] ORDER BY [t0].[Id], [t1].[ClientId], [t1].[Id], [t1].[OrderClientId], [t1].[OrderId]"); } @@ -156,7 +156,7 @@ FROM [OwnedPerson] AS [o] LEFT JOIN ( SELECT [o0].[ClientId], [o0].[Id], [o0].[OrderDate], [o1].[OrderClientId], [o1].[OrderId], [o1].[Id] AS [Id0], [o1].[Detail] FROM [Order] AS [o0] - LEFT JOIN [OrderDetail] AS [o1] ON ([o0].[ClientId] = [o1].[OrderClientId]) AND ([o0].[Id] = [o1].[OrderId]) + LEFT JOIN [OrderDetail] AS [o1] ON [o0].[ClientId] = [o1].[OrderClientId] AND [o0].[Id] = [o1].[OrderId] ) AS [t] ON [o].[Id] = [t].[ClientId] WHERE [o].[PersonAddress_Country_Name] = N'USA' ORDER BY [o].[Id], [t].[ClientId], [t].[Id], [t].[OrderClientId], [t].[OrderId]"); @@ -172,7 +172,7 @@ FROM [OwnedPerson] AS [o] LEFT JOIN ( SELECT [o1].[ClientId], [o1].[Id], [o1].[OrderDate], [o2].[OrderClientId], [o2].[OrderId], [o2].[Id] AS [Id0], [o2].[Detail] FROM [Order] AS [o1] - LEFT JOIN [OrderDetail] AS [o2] ON ([o1].[ClientId] = [o2].[OrderClientId]) AND ([o1].[Id] = [o2].[OrderId]) + LEFT JOIN [OrderDetail] AS [o2] ON [o1].[ClientId] = [o2].[OrderClientId] AND [o1].[Id] = [o2].[OrderId] ) AS [t] ON [o].[Id] = [t].[ClientId] WHERE ( SELECT COUNT(*) @@ -220,7 +220,7 @@ public override async Task SelectMany_on_owned_collection(bool async) @"SELECT [o0].[ClientId], [o0].[Id], [o0].[OrderDate], [o].[Id], [o1].[OrderClientId], [o1].[OrderId], [o1].[Id], [o1].[Detail] FROM [OwnedPerson] AS [o] INNER JOIN [Order] AS [o0] ON [o].[Id] = [o0].[ClientId] -LEFT JOIN [OrderDetail] AS [o1] ON ([o0].[ClientId] = [o1].[OrderClientId]) AND ([o0].[Id] = [o1].[OrderId]) +LEFT JOIN [OrderDetail] AS [o1] ON [o0].[ClientId] = [o1].[OrderClientId] AND [o0].[Id] = [o1].[OrderId] ORDER BY [o].[Id], [o0].[ClientId], [o0].[Id], [o1].[OrderClientId], [o1].[OrderId]"); } @@ -245,9 +245,9 @@ FROM [OwnedPerson] AS [o] LEFT JOIN ( SELECT [o0].[ClientId], [o0].[Id], [o0].[OrderDate], [o1].[OrderClientId], [o1].[OrderId], [o1].[Id] AS [Id0], [o1].[Detail] FROM [Order] AS [o0] - LEFT JOIN [OrderDetail] AS [o1] ON ([o0].[ClientId] = [o1].[OrderClientId]) AND ([o0].[Id] = [o1].[OrderId]) + 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]"); } @@ -262,7 +262,7 @@ FROM [OwnedPerson] AS [o] LEFT JOIN ( SELECT [o0].[ClientId], [o0].[Id], [o0].[OrderDate], [o1].[OrderClientId], [o1].[OrderId], [o1].[Id] AS [Id0], [o1].[Detail] FROM [Order] AS [o0] - LEFT JOIN [OrderDetail] AS [o1] ON ([o0].[ClientId] = [o1].[OrderClientId]) AND ([o0].[Id] = [o1].[OrderId]) + LEFT JOIN [OrderDetail] AS [o1] ON [o0].[ClientId] = [o1].[OrderClientId] AND [o0].[Id] = [o1].[OrderId] ) AS [t] ON [o].[Id] = [t].[ClientId] ORDER BY [o].[Id], [p].[Id], [t].[ClientId], [t].[Id], [t].[OrderClientId], [t].[OrderId]"); } @@ -278,7 +278,7 @@ FROM [Order] AS [o0] LEFT JOIN [OwnedPerson] AS [o1] ON [o0].[ClientId] = [o1].[Id] LEFT JOIN [Planet] AS [p0] ON [o1].[PersonAddress_Country_PlanetId] = [p0].[Id] LEFT JOIN [Star] AS [s] ON [p0].[StarId] = [s].[Id] - WHERE ([o].[Id] = [o0].[ClientId]) AND (([s].[Id] <> 42) OR [s].[Id] IS NULL)) AS [Count], [p].[Id], [p].[StarId] + WHERE [o].[Id] = [o0].[ClientId] AND ([s].[Id] <> 42 OR [s].[Id] IS NULL)) AS [Count], [p].[Id], [p].[StarId] FROM [OwnedPerson] AS [o] LEFT JOIN [Planet] AS [p] ON [o].[PersonAddress_Country_PlanetId] = [p].[Id] ORDER BY [o].[Id]"); @@ -295,9 +295,9 @@ FROM [OwnedPerson] AS [o] LEFT JOIN ( SELECT [o0].[ClientId], [o0].[Id], [o0].[OrderDate], [o1].[OrderClientId], [o1].[OrderId], [o1].[Id] AS [Id0], [o1].[Detail] FROM [Order] AS [o0] - LEFT JOIN [OrderDetail] AS [o1] ON ([o0].[ClientId] = [o1].[OrderClientId]) AND ([o0].[Id] = [o1].[OrderId]) + 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]"); } @@ -397,7 +397,7 @@ FROM [OwnedPerson] AS [o] LEFT JOIN ( SELECT [o0].[ClientId], [o0].[Id], [o0].[OrderDate], [o1].[OrderClientId], [o1].[OrderId], [o1].[Id] AS [Id0], [o1].[Detail] FROM [Order] AS [o0] - LEFT JOIN [OrderDetail] AS [o1] ON ([o0].[ClientId] = [o1].[OrderClientId]) AND ([o0].[Id] = [o1].[OrderId]) + LEFT JOIN [OrderDetail] AS [o1] ON [o0].[ClientId] = [o1].[OrderClientId] AND [o0].[Id] = [o1].[OrderId] ) AS [t] ON [o].[Id] = [t].[ClientId] WHERE [o].[Discriminator] = N'LeafA' ORDER BY [o].[Id], [t].[ClientId], [t].[Id], [t].[OrderClientId], [t].[OrderId]"); @@ -424,7 +424,7 @@ OFFSET @__p_1 ROWS FETCH NEXT @__p_2 ROWS ONLY LEFT JOIN ( SELECT [o0].[ClientId], [o0].[Id], [o0].[OrderDate], [o1].[OrderClientId], [o1].[OrderId], [o1].[Id] AS [Id0], [o1].[Detail] FROM [Order] AS [o0] - LEFT JOIN [OrderDetail] AS [o1] ON ([o0].[ClientId] = [o1].[OrderClientId]) AND ([o0].[Id] = [o1].[OrderId]) + LEFT JOIN [OrderDetail] AS [o1] ON [o0].[ClientId] = [o1].[OrderClientId] AND [o0].[Id] = [o1].[OrderId] ) AS [t0] ON [t].[Id] = [t0].[ClientId] ORDER BY [t].[Id], [t0].[ClientId], [t0].[Id], [t0].[OrderClientId], [t0].[OrderId]"); } @@ -439,7 +439,7 @@ FROM [OwnedPerson] AS [o] LEFT JOIN ( SELECT [o0].[ClientId], [o0].[Id], [o0].[OrderDate], [o1].[OrderClientId], [o1].[OrderId], [o1].[Id] AS [Id0], [o1].[Detail] FROM [Order] AS [o0] - LEFT JOIN [OrderDetail] AS [o1] ON ([o0].[ClientId] = [o1].[OrderClientId]) AND ([o0].[Id] = [o1].[OrderId]) + LEFT JOIN [OrderDetail] AS [o1] ON [o0].[ClientId] = [o1].[OrderClientId] AND [o0].[Id] = [o1].[OrderId] ) AS [t] ON [o].[Id] = [t].[ClientId] WHERE [o].[Id] = 1 ORDER BY [o].[Id], [t].[ClientId], [t].[Id], [t].[OrderClientId], [t].[OrderId]"); @@ -462,7 +462,7 @@ OFFSET @__p_0 ROWS LEFT JOIN ( SELECT [o0].[ClientId], [o0].[Id], [o0].[OrderDate], [o1].[OrderClientId], [o1].[OrderId], [o1].[Id] AS [Id0], [o1].[Detail] FROM [Order] AS [o0] - LEFT JOIN [OrderDetail] AS [o1] ON ([o0].[ClientId] = [o1].[OrderClientId]) AND ([o0].[Id] = [o1].[OrderId]) + LEFT JOIN [OrderDetail] AS [o1] ON [o0].[ClientId] = [o1].[OrderClientId] AND [o0].[Id] = [o1].[OrderId] ) AS [t0] ON [t].[Id] = [t0].[ClientId] ORDER BY [t].[Id], [t0].[ClientId], [t0].[Id], [t0].[OrderClientId], [t0].[OrderId]"); } @@ -483,7 +483,7 @@ ORDER BY [o].[Id] LEFT JOIN ( SELECT [o0].[ClientId], [o0].[Id], [o0].[OrderDate], [o1].[OrderClientId], [o1].[OrderId], [o1].[Id] AS [Id0], [o1].[Detail] FROM [Order] AS [o0] - LEFT JOIN [OrderDetail] AS [o1] ON ([o0].[ClientId] = [o1].[OrderClientId]) AND ([o0].[Id] = [o1].[OrderId]) + LEFT JOIN [OrderDetail] AS [o1] ON [o0].[ClientId] = [o1].[OrderClientId] AND [o0].[Id] = [o1].[OrderId] ) AS [t0] ON [t].[Id] = [t0].[ClientId] ORDER BY [t].[Id], [t0].[ClientId], [t0].[Id], [t0].[OrderClientId], [t0].[OrderId]"); } @@ -506,7 +506,7 @@ OFFSET @__p_0 ROWS FETCH NEXT @__p_1 ROWS ONLY LEFT JOIN ( SELECT [o0].[ClientId], [o0].[Id], [o0].[OrderDate], [o1].[OrderClientId], [o1].[OrderId], [o1].[Id] AS [Id0], [o1].[Detail] FROM [Order] AS [o0] - LEFT JOIN [OrderDetail] AS [o1] ON ([o0].[ClientId] = [o1].[OrderClientId]) AND ([o0].[Id] = [o1].[OrderId]) + LEFT JOIN [OrderDetail] AS [o1] ON [o0].[ClientId] = [o1].[OrderClientId] AND [o0].[Id] = [o1].[OrderId] ) AS [t0] ON [t].[Id] = [t0].[ClientId] ORDER BY [t].[Id], [t0].[ClientId], [t0].[Id], [t0].[OrderClientId], [t0].[OrderId]"); } @@ -528,7 +528,7 @@ OFFSET @__p_0 ROWS LEFT JOIN ( SELECT [o0].[ClientId], [o0].[Id], [o0].[OrderDate], [o1].[OrderClientId], [o1].[OrderId], [o1].[Id] AS [Id0], [o1].[Detail] FROM [Order] AS [o0] - LEFT JOIN [OrderDetail] AS [o1] ON ([o0].[ClientId] = [o1].[OrderClientId]) AND ([o0].[Id] = [o1].[OrderId]) + LEFT JOIN [OrderDetail] AS [o1] ON [o0].[ClientId] = [o1].[OrderClientId] AND [o0].[Id] = [o1].[OrderId] ) AS [t0] ON [t].[Id] = [t0].[ClientId] ORDER BY [t].[Id], [t0].[ClientId], [t0].[Id], [t0].[OrderClientId], [t0].[OrderId]"); } @@ -549,7 +549,7 @@ ORDER BY [o].[Id] LEFT JOIN ( SELECT [o0].[ClientId], [o0].[Id], [o0].[OrderDate], [o1].[OrderClientId], [o1].[OrderId], [o1].[Id] AS [Id0], [o1].[Detail] FROM [Order] AS [o0] - LEFT JOIN [OrderDetail] AS [o1] ON ([o0].[ClientId] = [o1].[OrderClientId]) AND ([o0].[Id] = [o1].[OrderId]) + LEFT JOIN [OrderDetail] AS [o1] ON [o0].[ClientId] = [o1].[OrderClientId] AND [o0].[Id] = [o1].[OrderId] ) AS [t0] ON [t].[Id] = [t0].[ClientId] ORDER BY [t].[Id], [t0].[ClientId], [t0].[Id], [t0].[OrderClientId], [t0].[OrderId]"); } @@ -572,7 +572,7 @@ OFFSET @__p_0 ROWS FETCH NEXT @__p_1 ROWS ONLY LEFT JOIN ( SELECT [o0].[ClientId], [o0].[Id], [o0].[OrderDate], [o1].[OrderClientId], [o1].[OrderId], [o1].[Id] AS [Id0], [o1].[Detail] FROM [Order] AS [o0] - LEFT JOIN [OrderDetail] AS [o1] ON ([o0].[ClientId] = [o1].[OrderClientId]) AND ([o0].[Id] = [o1].[OrderId]) + LEFT JOIN [OrderDetail] AS [o1] ON [o0].[ClientId] = [o1].[OrderClientId] AND [o0].[Id] = [o1].[OrderId] ) AS [t0] ON [t].[Id] = [t0].[ClientId] ORDER BY [t].[Id], [t0].[ClientId], [t0].[Id], [t0].[OrderClientId], [t0].[OrderId]"); } @@ -585,11 +585,11 @@ public override async Task Where_owned_collection_navigation_ToList_Count(bool a @"SELECT [o].[Id], [o0].[ClientId], [o0].[Id], [o2].[OrderClientId], [o2].[OrderId], [o2].[Id], [o2].[Detail] FROM [OwnedPerson] AS [o] INNER JOIN [Order] AS [o0] ON [o].[Id] = [o0].[ClientId] -LEFT JOIN [OrderDetail] AS [o2] ON ([o0].[ClientId] = [o2].[OrderClientId]) AND ([o0].[Id] = [o2].[OrderId]) +LEFT JOIN [OrderDetail] AS [o2] ON [o0].[ClientId] = [o2].[OrderClientId] AND [o0].[Id] = [o2].[OrderId] WHERE ( SELECT COUNT(*) FROM [OrderDetail] AS [o1] - WHERE ([o0].[ClientId] = [o1].[OrderClientId]) AND ([o0].[Id] = [o1].[OrderId])) = 0 + WHERE [o0].[ClientId] = [o1].[OrderClientId] AND [o0].[Id] = [o1].[OrderId]) = 0 ORDER BY [o].[Id], [o0].[ClientId], [o0].[Id], [o2].[OrderClientId], [o2].[OrderId]"); } @@ -601,11 +601,11 @@ public override async Task Where_collection_navigation_ToArray_Count(bool async) @"SELECT [o].[Id], [o0].[ClientId], [o0].[Id], [o2].[OrderClientId], [o2].[OrderId], [o2].[Id], [o2].[Detail] FROM [OwnedPerson] AS [o] INNER JOIN [Order] AS [o0] ON [o].[Id] = [o0].[ClientId] -LEFT JOIN [OrderDetail] AS [o2] ON ([o0].[ClientId] = [o2].[OrderClientId]) AND ([o0].[Id] = [o2].[OrderId]) +LEFT JOIN [OrderDetail] AS [o2] ON [o0].[ClientId] = [o2].[OrderClientId] AND [o0].[Id] = [o2].[OrderId] WHERE ( SELECT COUNT(*) FROM [OrderDetail] AS [o1] - WHERE ([o0].[ClientId] = [o1].[OrderClientId]) AND ([o0].[Id] = [o1].[OrderId])) = 0 + WHERE [o0].[ClientId] = [o1].[OrderClientId] AND [o0].[Id] = [o1].[OrderId]) = 0 ORDER BY [o].[Id], [o0].[ClientId], [o0].[Id], [o2].[OrderClientId], [o2].[OrderId]"); } @@ -617,11 +617,11 @@ public override async Task Where_collection_navigation_AsEnumerable_Count(bool a @"SELECT [o].[Id], [o0].[ClientId], [o0].[Id], [o2].[OrderClientId], [o2].[OrderId], [o2].[Id], [o2].[Detail] FROM [OwnedPerson] AS [o] INNER JOIN [Order] AS [o0] ON [o].[Id] = [o0].[ClientId] -LEFT JOIN [OrderDetail] AS [o2] ON ([o0].[ClientId] = [o2].[OrderClientId]) AND ([o0].[Id] = [o2].[OrderId]) +LEFT JOIN [OrderDetail] AS [o2] ON [o0].[ClientId] = [o2].[OrderClientId] AND [o0].[Id] = [o2].[OrderId] WHERE ( SELECT COUNT(*) FROM [OrderDetail] AS [o1] - WHERE ([o0].[ClientId] = [o1].[OrderClientId]) AND ([o0].[Id] = [o1].[OrderId])) = 0 + WHERE [o0].[ClientId] = [o1].[OrderClientId] AND [o0].[Id] = [o1].[OrderId]) = 0 ORDER BY [o].[Id], [o0].[ClientId], [o0].[Id], [o2].[OrderClientId], [o2].[OrderId]"); } @@ -633,11 +633,11 @@ public override async Task Where_collection_navigation_ToList_Count_member(bool @"SELECT [o].[Id], [o0].[ClientId], [o0].[Id], [o2].[OrderClientId], [o2].[OrderId], [o2].[Id], [o2].[Detail] FROM [OwnedPerson] AS [o] INNER JOIN [Order] AS [o0] ON [o].[Id] = [o0].[ClientId] -LEFT JOIN [OrderDetail] AS [o2] ON ([o0].[ClientId] = [o2].[OrderClientId]) AND ([o0].[Id] = [o2].[OrderId]) +LEFT JOIN [OrderDetail] AS [o2] ON [o0].[ClientId] = [o2].[OrderClientId] AND [o0].[Id] = [o2].[OrderId] WHERE ( SELECT COUNT(*) FROM [OrderDetail] AS [o1] - WHERE ([o0].[ClientId] = [o1].[OrderClientId]) AND ([o0].[Id] = [o1].[OrderId])) = 0 + WHERE [o0].[ClientId] = [o1].[OrderClientId] AND [o0].[Id] = [o1].[OrderId]) = 0 ORDER BY [o].[Id], [o0].[ClientId], [o0].[Id], [o2].[OrderClientId], [o2].[OrderId]"); } @@ -649,11 +649,11 @@ public override async Task Where_collection_navigation_ToArray_Length_member(boo @"SELECT [o].[Id], [o0].[ClientId], [o0].[Id], [o2].[OrderClientId], [o2].[OrderId], [o2].[Id], [o2].[Detail] FROM [OwnedPerson] AS [o] INNER JOIN [Order] AS [o0] ON [o].[Id] = [o0].[ClientId] -LEFT JOIN [OrderDetail] AS [o2] ON ([o0].[ClientId] = [o2].[OrderClientId]) AND ([o0].[Id] = [o2].[OrderId]) +LEFT JOIN [OrderDetail] AS [o2] ON [o0].[ClientId] = [o2].[OrderClientId] AND [o0].[Id] = [o2].[OrderId] WHERE ( SELECT COUNT(*) FROM [OrderDetail] AS [o1] - WHERE ([o0].[ClientId] = [o1].[OrderClientId]) AND ([o0].[Id] = [o1].[OrderId])) = 0 + WHERE [o0].[ClientId] = [o1].[OrderClientId] AND [o0].[Id] = [o1].[OrderId]) = 0 ORDER BY [o].[Id], [o0].[ClientId], [o0].[Id], [o2].[OrderClientId], [o2].[OrderId]"); } @@ -667,7 +667,7 @@ FROM [OwnedPerson] AS [o] LEFT JOIN ( SELECT [o0].[ClientId], [o0].[Id], [o0].[OrderDate], [o1].[OrderClientId], [o1].[OrderId], [o1].[Id] AS [Id0], [o1].[Detail] FROM [Order] AS [o0] - LEFT JOIN [OrderDetail] AS [o1] ON ([o0].[ClientId] = [o1].[OrderClientId]) AND ([o0].[Id] = [o1].[OrderId]) + LEFT JOIN [OrderDetail] AS [o1] ON [o0].[ClientId] = [o1].[OrderClientId] AND [o0].[Id] = [o1].[OrderId] ) AS [t] ON [o].[Id] = [t].[ClientId] WHERE [o].[Name] = N'Mona Cy' ORDER BY [o].[Id], [t].[ClientId], [t].[Id], [t].[OrderClientId], [t].[OrderId]"); @@ -739,7 +739,7 @@ FROM [OwnedPerson] AS [o] LEFT JOIN ( SELECT [o0].[ClientId], [o0].[Id], [o0].[OrderDate], [o1].[OrderClientId], [o1].[OrderId], [o1].[Id] AS [Id0], [o1].[Detail] FROM [Order] AS [o0] - LEFT JOIN [OrderDetail] AS [o1] ON ([o0].[ClientId] = [o1].[OrderClientId]) AND ([o0].[Id] = [o1].[OrderId]) + LEFT JOIN [OrderDetail] AS [o1] ON [o0].[ClientId] = [o1].[OrderClientId] AND [o0].[Id] = [o1].[OrderId] ) AS [t] ON [o].[Id] = [t].[ClientId] ORDER BY [o].[Name], [o].[Id], [t].[ClientId], [t].[Id], [t].[OrderClientId], [t].[OrderId]"); } @@ -865,7 +865,7 @@ FROM [OwnedPerson] AS [o] WHERE ( SELECT COUNT(*) FROM [Order] AS [o0] - WHERE ([o].[Id] = [o0].[ClientId]) AND (DATEPART(year, [o0].[OrderDate]) = 2018)) = 1"); + WHERE [o].[Id] = [o0].[ClientId] AND DATEPART(year, [o0].[OrderDate]) = 2018) = 1"); } public override async Task Query_for_base_type_loads_all_owned_navs_split(bool async) @@ -885,7 +885,7 @@ FROM [OwnedPerson] AS [o] @"SELECT [o1].[OrderClientId], [o1].[OrderId], [o1].[Id], [o1].[Detail], [o].[Id], [o0].[ClientId], [o0].[Id] FROM [OwnedPerson] AS [o] INNER JOIN [Order] AS [o0] ON [o].[Id] = [o0].[ClientId] -INNER JOIN [OrderDetail] AS [o1] ON ([o0].[ClientId] = [o1].[OrderClientId]) AND ([o0].[Id] = [o1].[OrderId]) +INNER JOIN [OrderDetail] AS [o1] ON [o0].[ClientId] = [o1].[OrderClientId] AND [o0].[Id] = [o1].[OrderId] ORDER BY [o].[Id], [o0].[ClientId], [o0].[Id]"); } @@ -908,7 +908,7 @@ WHERE [o].[Discriminator] IN (N'Branch', N'LeafA') @"SELECT [o1].[OrderClientId], [o1].[OrderId], [o1].[Id], [o1].[Detail], [o].[Id], [o0].[ClientId], [o0].[Id] FROM [OwnedPerson] AS [o] INNER JOIN [Order] AS [o0] ON [o].[Id] = [o0].[ClientId] -INNER JOIN [OrderDetail] AS [o1] ON ([o0].[ClientId] = [o1].[OrderClientId]) AND ([o0].[Id] = [o1].[OrderId]) +INNER JOIN [OrderDetail] AS [o1] ON [o0].[ClientId] = [o1].[OrderClientId] AND [o0].[Id] = [o1].[OrderId] WHERE [o].[Discriminator] IN (N'Branch', N'LeafA') ORDER BY [o].[Id], [o0].[ClientId], [o0].[Id]"); } @@ -953,7 +953,7 @@ FROM [OwnedPerson] AS [o] ORDER BY [t].[Id] ) AS [t0] INNER JOIN [Order] AS [o0] ON [t0].[Id] = [o0].[ClientId] -INNER JOIN [OrderDetail] AS [o1] ON ([o0].[ClientId] = [o1].[OrderClientId]) AND ([o0].[Id] = [o1].[OrderId]) +INNER JOIN [OrderDetail] AS [o1] ON [o0].[ClientId] = [o1].[OrderClientId] AND [o0].[Id] = [o1].[OrderId] ORDER BY [t0].[Id], [o0].[ClientId], [o0].[Id]"); } @@ -977,7 +977,7 @@ FROM [OwnedPerson] AS [o] FROM [OwnedPerson] AS [o] LEFT JOIN [Planet] AS [p] ON [o].[PersonAddress_Country_PlanetId] = [p].[Id] INNER JOIN [Order] AS [o0] ON [o].[Id] = [o0].[ClientId] -INNER JOIN [OrderDetail] AS [o1] ON ([o0].[ClientId] = [o1].[OrderClientId]) AND ([o0].[Id] = [o1].[OrderId]) +INNER JOIN [OrderDetail] AS [o1] ON [o0].[ClientId] = [o1].[OrderClientId] AND [o0].[Id] = [o1].[OrderId] ORDER BY [o].[Id], [p].[Id], [o0].[ClientId], [o0].[Id]"); } @@ -1017,7 +1017,7 @@ FROM [OwnedPerson] AS [o] @"SELECT [o1].[OrderClientId], [o1].[OrderId], [o1].[Id], [o1].[Detail], [o].[Id], [o0].[ClientId], [o0].[Id] FROM [OwnedPerson] AS [o] INNER JOIN [Order] AS [o0] ON [o].[Id] = [o0].[ClientId] -INNER JOIN [OrderDetail] AS [o1] ON ([o0].[ClientId] = [o1].[OrderClientId]) AND ([o0].[Id] = [o1].[OrderId]) +INNER JOIN [OrderDetail] AS [o1] ON [o0].[ClientId] = [o1].[OrderClientId] AND [o0].[Id] = [o1].[OrderId] WHERE [o].[Discriminator] = N'LeafA' ORDER BY [o].[Id], [o0].[ClientId], [o0].[Id]"); } @@ -1041,7 +1041,7 @@ FROM [OwnedPerson] AS [o] @"SELECT [o1].[OrderClientId], [o1].[OrderId], [o1].[Id], [o1].[Detail], [o].[Id], [o0].[ClientId], [o0].[Id] FROM [OwnedPerson] AS [o] INNER JOIN [Order] AS [o0] ON [o].[Id] = [o0].[ClientId] -INNER JOIN [OrderDetail] AS [o1] ON ([o0].[ClientId] = [o1].[OrderClientId]) AND ([o0].[Id] = [o1].[OrderId]) +INNER JOIN [OrderDetail] AS [o1] ON [o0].[ClientId] = [o1].[OrderClientId] AND [o0].[Id] = [o1].[OrderId] WHERE [o].[Id] = 1 ORDER BY [o].[Id], [o0].[ClientId], [o0].[Id]"); } @@ -1065,7 +1065,7 @@ FROM [OwnedPerson] AS [o] @"SELECT [o1].[OrderClientId], [o1].[OrderId], [o1].[Id], [o1].[Detail], [o].[Id], [o0].[ClientId], [o0].[Id] FROM [OwnedPerson] AS [o] INNER JOIN [Order] AS [o0] ON [o].[Id] = [o0].[ClientId] -INNER JOIN [OrderDetail] AS [o1] ON ([o0].[ClientId] = [o1].[OrderClientId]) AND ([o0].[Id] = [o1].[OrderId]) +INNER JOIN [OrderDetail] AS [o1] ON [o0].[ClientId] = [o1].[OrderClientId] AND [o0].[Id] = [o1].[OrderId] WHERE [o].[Name] = N'Mona Cy' ORDER BY [o].[Id], [o0].[ClientId], [o0].[Id]"); } @@ -1095,7 +1095,7 @@ FROM [OwnedPerson] AS [o] LEFT JOIN ( SELECT [o0].[ClientId], [o0].[Id], [o0].[OrderDate], [o1].[OrderClientId], [o1].[OrderId], [o1].[Id] AS [Id0], [o1].[Detail] FROM [Order] AS [o0] - LEFT JOIN [OrderDetail] AS [o1] ON ([o0].[ClientId] = [o1].[OrderClientId]) AND ([o0].[Id] = [o1].[OrderId]) + LEFT JOIN [OrderDetail] AS [o1] ON [o0].[ClientId] = [o1].[OrderClientId] AND [o0].[Id] = [o1].[OrderId] ) AS [t] ON [o].[Id] = [t].[ClientId] ORDER BY [o].[PersonAddress_PlaceType], [o].[Id], [t].[ClientId], [t].[Id], [t].[OrderClientId], [t].[OrderId]"); } @@ -1156,7 +1156,7 @@ WHEN [t4].[LeafAAddress_LeafType] IS NOT NULL THEN [t4].[Id] LEFT JOIN ( SELECT [o7].[ClientId], [o7].[Id], [o7].[OrderDate], [o8].[OrderClientId], [o8].[OrderId], [o8].[Id] AS [Id0], [o8].[Detail] FROM [Order] AS [o7] - LEFT JOIN [OrderDetail] AS [o8] ON ([o7].[ClientId] = [o8].[OrderClientId]) AND ([o7].[Id] = [o8].[OrderId]) + LEFT JOIN [OrderDetail] AS [o8] ON [o7].[ClientId] = [o8].[OrderClientId] AND [o7].[Id] = [o8].[OrderId] ) AS [t6] ON [m].[Id] = [t6].[ClientId] ORDER BY [m].[Id], [t].[Id], [t].[Id0], [t0].[Id], [t0].[Id0], [t2].[Id], [t2].[Id0], [t4].[Id], [t4].[Id0], [t6].[ClientId], [t6].[Id], [t6].[OrderClientId], [t6].[OrderId]"); } @@ -1169,7 +1169,7 @@ public override async Task Projecting_collection_correlated_with_keyless_entity_ @"SELECT [b].[Throned_Value], [f].[Id], [b].[Id], [p].[Id], [p].[StarId] FROM [Fink] AS [f] LEFT JOIN [Barton] AS [b] ON [f].[BartonId] = [b].[Id] -LEFT JOIN [Planet] AS [p] ON ([b].[Throned_Value] <> [p].[Id]) OR [b].[Throned_Value] IS NULL +LEFT JOIN [Planet] AS [p] ON [b].[Throned_Value] <> [p].[Id] OR [b].[Throned_Value] IS NULL ORDER BY [f].[Id], [b].[Id]"); } @@ -1183,7 +1183,7 @@ FROM [OwnedPerson] AS [o] LEFT JOIN ( SELECT [o0].[ClientId], [o0].[Id], [o0].[OrderDate], [o1].[OrderClientId], [o1].[OrderId], [o1].[Id] AS [Id0], [o1].[Detail] FROM [Order] AS [o0] - LEFT JOIN [OrderDetail] AS [o1] ON ([o0].[ClientId] = [o1].[OrderClientId]) AND ([o0].[Id] = [o1].[OrderId]) + LEFT JOIN [OrderDetail] AS [o1] ON [o0].[ClientId] = [o1].[OrderClientId] AND [o0].[Id] = [o1].[OrderId] ) AS [t] ON [o].[Id] = [t].[ClientId] WHERE [o].[PersonAddress_ZipCode] = 38654 ORDER BY [o].[Id], [t].[ClientId], [t].[Id], [t].[OrderClientId], [t].[OrderId]"); @@ -1199,7 +1199,7 @@ FROM [OwnedPerson] AS [o] LEFT JOIN ( SELECT [o0].[ClientId], [o0].[Id], [o0].[OrderDate], [o1].[OrderClientId], [o1].[OrderId], [o1].[Id] AS [Id0], [o1].[Detail] FROM [Order] AS [o0] - LEFT JOIN [OrderDetail] AS [o1] ON ([o0].[ClientId] = [o1].[OrderClientId]) AND ([o0].[Id] = [o1].[OrderId]) + LEFT JOIN [OrderDetail] AS [o1] ON [o0].[ClientId] = [o1].[OrderClientId] AND [o0].[Id] = [o1].[OrderId] ) AS [t] ON [o].[Id] = [t].[ClientId] WHERE [o].[PersonAddress_ZipCode] = 38654 ORDER BY [o].[Id], [t].[ClientId], [t].[Id], [t].[OrderClientId], [t].[OrderId]"); diff --git a/test/EFCore.SqlServer.FunctionalTests/Query/QueryBugsTest.cs b/test/EFCore.SqlServer.FunctionalTests/Query/QueryBugsTest.cs index 78dce73d5f1..fbbb9bf3035 100644 --- a/test/EFCore.SqlServer.FunctionalTests/Query/QueryBugsTest.cs +++ b/test/EFCore.SqlServer.FunctionalTests/Query/QueryBugsTest.cs @@ -74,7 +74,7 @@ public async Task Where_equals_DateTime_Now(bool async) AssertSql( @"SELECT [d].[Id], [d].[DateTime], [d].[DateTime2], [d].[DateTime2_0], [d].[DateTime2_1], [d].[DateTime2_2], [d].[DateTime2_3], [d].[DateTime2_4], [d].[DateTime2_5], [d].[DateTime2_6], [d].[DateTime2_7], [d].[SmallDateTime] FROM [Dates] AS [d] -WHERE ((([d].[DateTime2_2] = GETDATE()) OR ([d].[DateTime2_7] = GETDATE())) OR ([d].[DateTime] = GETDATE())) OR ([d].[SmallDateTime] = GETDATE())"); +WHERE [d].[DateTime2_2] = GETDATE() OR [d].[DateTime2_7] = GETDATE() OR [d].[DateTime] = GETDATE() OR [d].[SmallDateTime] = GETDATE()"); } [ConditionalTheory] @@ -100,7 +100,7 @@ public async Task Where_not_equals_DateTime_Now(bool async) AssertSql( @"SELECT [d].[Id], [d].[DateTime], [d].[DateTime2], [d].[DateTime2_0], [d].[DateTime2_1], [d].[DateTime2_2], [d].[DateTime2_3], [d].[DateTime2_4], [d].[DateTime2_5], [d].[DateTime2_6], [d].[DateTime2_7], [d].[SmallDateTime] FROM [Dates] AS [d] -WHERE ((([d].[DateTime2_2] <> GETDATE()) AND ([d].[DateTime2_7] <> GETDATE())) AND ([d].[DateTime] <> GETDATE())) AND ([d].[SmallDateTime] <> GETDATE())"); +WHERE [d].[DateTime2_2] <> GETDATE() AND [d].[DateTime2_7] <> GETDATE() AND [d].[DateTime] <> GETDATE() AND [d].[SmallDateTime] <> GETDATE()"); } [ConditionalTheory] @@ -133,7 +133,7 @@ public async Task Where_equals_new_DateTime(bool async) AssertSql( @"SELECT [d].[Id], [d].[DateTime], [d].[DateTime2], [d].[DateTime2_0], [d].[DateTime2_1], [d].[DateTime2_2], [d].[DateTime2_3], [d].[DateTime2_4], [d].[DateTime2_5], [d].[DateTime2_6], [d].[DateTime2_7], [d].[SmallDateTime] FROM [Dates] AS [d] -WHERE (((((((((([d].[SmallDateTime] = '1970-09-03T12:00:00') AND ([d].[DateTime] = '1971-09-03T12:00:10.220')) AND ([d].[DateTime2] = '1972-09-03T12:00:10.3330000')) AND ([d].[DateTime2_0] = '1973-09-03T12:00:10')) AND ([d].[DateTime2_1] = '1974-09-03T12:00:10.5')) AND ([d].[DateTime2_2] = '1975-09-03T12:00:10.66')) AND ([d].[DateTime2_3] = '1976-09-03T12:00:10.777')) AND ([d].[DateTime2_4] = '1977-09-03T12:00:10.8880')) AND ([d].[DateTime2_5] = '1978-09-03T12:00:10.99900')) AND ([d].[DateTime2_6] = '1979-09-03T12:00:10.111000')) AND ([d].[DateTime2_7] = '1980-09-03T12:00:10.2220000')"); +WHERE [d].[SmallDateTime] = '1970-09-03T12:00:00' AND [d].[DateTime] = '1971-09-03T12:00:10.220' AND [d].[DateTime2] = '1972-09-03T12:00:10.3330000' AND [d].[DateTime2_0] = '1973-09-03T12:00:10' AND [d].[DateTime2_1] = '1974-09-03T12:00:10.5' AND [d].[DateTime2_2] = '1975-09-03T12:00:10.66' AND [d].[DateTime2_3] = '1976-09-03T12:00:10.777' AND [d].[DateTime2_4] = '1977-09-03T12:00:10.8880' AND [d].[DateTime2_5] = '1978-09-03T12:00:10.99900' AND [d].[DateTime2_6] = '1979-09-03T12:00:10.111000' AND [d].[DateTime2_7] = '1980-09-03T12:00:10.2220000'"); } [ConditionalTheory] @@ -181,7 +181,7 @@ public async Task Where_contains_DateTime_literals(bool async) AssertSql( @"SELECT [d].[Id], [d].[DateTime], [d].[DateTime2], [d].[DateTime2_0], [d].[DateTime2_1], [d].[DateTime2_2], [d].[DateTime2_3], [d].[DateTime2_4], [d].[DateTime2_5], [d].[DateTime2_6], [d].[DateTime2_7], [d].[SmallDateTime] FROM [Dates] AS [d] -WHERE ((((((((([d].[SmallDateTime] IN ('1970-09-03T12:00:00', '1971-09-03T12:00:10', '1972-09-03T12:00:10', '1973-09-03T12:00:10', '1974-09-03T12:00:10', '1975-09-03T12:00:10', '1976-09-03T12:00:10', '1977-09-03T12:00:10', '1978-09-03T12:00:10', '1979-09-03T12:00:10', '1980-09-03T12:00:10') AND [d].[DateTime] IN ('1970-09-03T12:00:00.000', '1971-09-03T12:00:10.220', '1972-09-03T12:00:10.333', '1973-09-03T12:00:10.000', '1974-09-03T12:00:10.500', '1975-09-03T12:00:10.660', '1976-09-03T12:00:10.777', '1977-09-03T12:00:10.888', '1978-09-03T12:00:10.999', '1979-09-03T12:00:10.111', '1980-09-03T12:00:10.222')) AND [d].[DateTime2] IN ('1970-09-03T12:00:00.0000000', '1971-09-03T12:00:10.2200000', '1972-09-03T12:00:10.3330000', '1973-09-03T12:00:10.0000000', '1974-09-03T12:00:10.5000000', '1975-09-03T12:00:10.6600000', '1976-09-03T12:00:10.7770000', '1977-09-03T12:00:10.8880000', '1978-09-03T12:00:10.9990000', '1979-09-03T12:00:10.1110000', '1980-09-03T12:00:10.2220000')) AND [d].[DateTime2_0] IN ('1970-09-03T12:00:00', '1971-09-03T12:00:10', '1972-09-03T12:00:10', '1973-09-03T12:00:10', '1974-09-03T12:00:10', '1975-09-03T12:00:10', '1976-09-03T12:00:10', '1977-09-03T12:00:10', '1978-09-03T12:00:10', '1979-09-03T12:00:10', '1980-09-03T12:00:10')) AND [d].[DateTime2_1] IN ('1970-09-03T12:00:00.0', '1971-09-03T12:00:10.2', '1972-09-03T12:00:10.3', '1973-09-03T12:00:10.0', '1974-09-03T12:00:10.5', '1975-09-03T12:00:10.6', '1976-09-03T12:00:10.7', '1977-09-03T12:00:10.8', '1978-09-03T12:00:10.9', '1979-09-03T12:00:10.1', '1980-09-03T12:00:10.2')) AND [d].[DateTime2_2] IN ('1970-09-03T12:00:00.00', '1971-09-03T12:00:10.22', '1972-09-03T12:00:10.33', '1973-09-03T12:00:10.00', '1974-09-03T12:00:10.50', '1975-09-03T12:00:10.66', '1976-09-03T12:00:10.77', '1977-09-03T12:00:10.88', '1978-09-03T12:00:10.99', '1979-09-03T12:00:10.11', '1980-09-03T12:00:10.22')) AND [d].[DateTime2_3] IN ('1970-09-03T12:00:00.000', '1971-09-03T12:00:10.220', '1972-09-03T12:00:10.333', '1973-09-03T12:00:10.000', '1974-09-03T12:00:10.500', '1975-09-03T12:00:10.660', '1976-09-03T12:00:10.777', '1977-09-03T12:00:10.888', '1978-09-03T12:00:10.999', '1979-09-03T12:00:10.111', '1980-09-03T12:00:10.222')) AND [d].[DateTime2_4] IN ('1970-09-03T12:00:00.0000', '1971-09-03T12:00:10.2200', '1972-09-03T12:00:10.3330', '1973-09-03T12:00:10.0000', '1974-09-03T12:00:10.5000', '1975-09-03T12:00:10.6600', '1976-09-03T12:00:10.7770', '1977-09-03T12:00:10.8880', '1978-09-03T12:00:10.9990', '1979-09-03T12:00:10.1110', '1980-09-03T12:00:10.2220')) AND [d].[DateTime2_5] IN ('1970-09-03T12:00:00.00000', '1971-09-03T12:00:10.22000', '1972-09-03T12:00:10.33300', '1973-09-03T12:00:10.00000', '1974-09-03T12:00:10.50000', '1975-09-03T12:00:10.66000', '1976-09-03T12:00:10.77700', '1977-09-03T12:00:10.88800', '1978-09-03T12:00:10.99900', '1979-09-03T12:00:10.11100', '1980-09-03T12:00:10.22200')) AND [d].[DateTime2_6] IN ('1970-09-03T12:00:00.000000', '1971-09-03T12:00:10.220000', '1972-09-03T12:00:10.333000', '1973-09-03T12:00:10.000000', '1974-09-03T12:00:10.500000', '1975-09-03T12:00:10.660000', '1976-09-03T12:00:10.777000', '1977-09-03T12:00:10.888000', '1978-09-03T12:00:10.999000', '1979-09-03T12:00:10.111000', '1980-09-03T12:00:10.222000')) AND [d].[DateTime2_7] IN ('1970-09-03T12:00:00.0000000', '1971-09-03T12:00:10.2200000', '1972-09-03T12:00:10.3330000', '1973-09-03T12:00:10.0000000', '1974-09-03T12:00:10.5000000', '1975-09-03T12:00:10.6600000', '1976-09-03T12:00:10.7770000', '1977-09-03T12:00:10.8880000', '1978-09-03T12:00:10.9990000', '1979-09-03T12:00:10.1110000', '1980-09-03T12:00:10.2220000')"); +WHERE [d].[SmallDateTime] IN ('1970-09-03T12:00:00', '1971-09-03T12:00:10', '1972-09-03T12:00:10', '1973-09-03T12:00:10', '1974-09-03T12:00:10', '1975-09-03T12:00:10', '1976-09-03T12:00:10', '1977-09-03T12:00:10', '1978-09-03T12:00:10', '1979-09-03T12:00:10', '1980-09-03T12:00:10') AND [d].[DateTime] IN ('1970-09-03T12:00:00.000', '1971-09-03T12:00:10.220', '1972-09-03T12:00:10.333', '1973-09-03T12:00:10.000', '1974-09-03T12:00:10.500', '1975-09-03T12:00:10.660', '1976-09-03T12:00:10.777', '1977-09-03T12:00:10.888', '1978-09-03T12:00:10.999', '1979-09-03T12:00:10.111', '1980-09-03T12:00:10.222') AND [d].[DateTime2] IN ('1970-09-03T12:00:00.0000000', '1971-09-03T12:00:10.2200000', '1972-09-03T12:00:10.3330000', '1973-09-03T12:00:10.0000000', '1974-09-03T12:00:10.5000000', '1975-09-03T12:00:10.6600000', '1976-09-03T12:00:10.7770000', '1977-09-03T12:00:10.8880000', '1978-09-03T12:00:10.9990000', '1979-09-03T12:00:10.1110000', '1980-09-03T12:00:10.2220000') AND [d].[DateTime2_0] IN ('1970-09-03T12:00:00', '1971-09-03T12:00:10', '1972-09-03T12:00:10', '1973-09-03T12:00:10', '1974-09-03T12:00:10', '1975-09-03T12:00:10', '1976-09-03T12:00:10', '1977-09-03T12:00:10', '1978-09-03T12:00:10', '1979-09-03T12:00:10', '1980-09-03T12:00:10') AND [d].[DateTime2_1] IN ('1970-09-03T12:00:00.0', '1971-09-03T12:00:10.2', '1972-09-03T12:00:10.3', '1973-09-03T12:00:10.0', '1974-09-03T12:00:10.5', '1975-09-03T12:00:10.6', '1976-09-03T12:00:10.7', '1977-09-03T12:00:10.8', '1978-09-03T12:00:10.9', '1979-09-03T12:00:10.1', '1980-09-03T12:00:10.2') AND [d].[DateTime2_2] IN ('1970-09-03T12:00:00.00', '1971-09-03T12:00:10.22', '1972-09-03T12:00:10.33', '1973-09-03T12:00:10.00', '1974-09-03T12:00:10.50', '1975-09-03T12:00:10.66', '1976-09-03T12:00:10.77', '1977-09-03T12:00:10.88', '1978-09-03T12:00:10.99', '1979-09-03T12:00:10.11', '1980-09-03T12:00:10.22') AND [d].[DateTime2_3] IN ('1970-09-03T12:00:00.000', '1971-09-03T12:00:10.220', '1972-09-03T12:00:10.333', '1973-09-03T12:00:10.000', '1974-09-03T12:00:10.500', '1975-09-03T12:00:10.660', '1976-09-03T12:00:10.777', '1977-09-03T12:00:10.888', '1978-09-03T12:00:10.999', '1979-09-03T12:00:10.111', '1980-09-03T12:00:10.222') AND [d].[DateTime2_4] IN ('1970-09-03T12:00:00.0000', '1971-09-03T12:00:10.2200', '1972-09-03T12:00:10.3330', '1973-09-03T12:00:10.0000', '1974-09-03T12:00:10.5000', '1975-09-03T12:00:10.6600', '1976-09-03T12:00:10.7770', '1977-09-03T12:00:10.8880', '1978-09-03T12:00:10.9990', '1979-09-03T12:00:10.1110', '1980-09-03T12:00:10.2220') AND [d].[DateTime2_5] IN ('1970-09-03T12:00:00.00000', '1971-09-03T12:00:10.22000', '1972-09-03T12:00:10.33300', '1973-09-03T12:00:10.00000', '1974-09-03T12:00:10.50000', '1975-09-03T12:00:10.66000', '1976-09-03T12:00:10.77700', '1977-09-03T12:00:10.88800', '1978-09-03T12:00:10.99900', '1979-09-03T12:00:10.11100', '1980-09-03T12:00:10.22200') AND [d].[DateTime2_6] IN ('1970-09-03T12:00:00.000000', '1971-09-03T12:00:10.220000', '1972-09-03T12:00:10.333000', '1973-09-03T12:00:10.000000', '1974-09-03T12:00:10.500000', '1975-09-03T12:00:10.660000', '1976-09-03T12:00:10.777000', '1977-09-03T12:00:10.888000', '1978-09-03T12:00:10.999000', '1979-09-03T12:00:10.111000', '1980-09-03T12:00:10.222000') AND [d].[DateTime2_7] IN ('1970-09-03T12:00:00.0000000', '1971-09-03T12:00:10.2200000', '1972-09-03T12:00:10.3330000', '1973-09-03T12:00:10.0000000', '1974-09-03T12:00:10.5000000', '1975-09-03T12:00:10.6600000', '1976-09-03T12:00:10.7770000', '1977-09-03T12:00:10.8880000', '1978-09-03T12:00:10.9990000', '1979-09-03T12:00:10.1110000', '1980-09-03T12:00:10.2220000')"); } protected class DateTimeContext : DbContext @@ -550,7 +550,7 @@ public async Task Include_on_entity_with_composite_key_One_To_Many_Issues_925_92 AssertSql( @"SELECT [c].[FirstName], [c].[LastName], [o].[Id], [o].[CustomerFirstName], [o].[CustomerLastName], [o].[Name] FROM [Customer] AS [c] -LEFT JOIN [Order] AS [o] ON ([c].[FirstName] = [o].[CustomerFirstName]) AND ([c].[LastName] = [o].[CustomerLastName]) +LEFT JOIN [Order] AS [o] ON [c].[FirstName] = [o].[CustomerFirstName] AND [c].[LastName] = [o].[CustomerLastName] ORDER BY [c].[FirstName], [c].[LastName]"); } @@ -573,7 +573,7 @@ public async Task Include_on_entity_with_composite_key_Many_To_One_Issues_925_92 AssertSql( @"SELECT [o].[Id], [o].[CustomerFirstName], [o].[CustomerLastName], [o].[Name], [c].[FirstName], [c].[LastName] FROM [Order] AS [o] -LEFT JOIN [Customer] AS [c] ON ([o].[CustomerFirstName] = [c].[FirstName]) AND ([o].[CustomerLastName] = [c].[LastName])"); +LEFT JOIN [Customer] AS [c] ON [o].[CustomerFirstName] = [c].[FirstName] AND [o].[CustomerLastName] = [c].[LastName]"); } private class MyContext925 : DbContext @@ -1961,7 +1961,7 @@ FROM [Entities] AS [e] WHERE EXISTS ( SELECT 1 FROM [Entities] AS [e0] - WHERE ([e0].[Id] = @__id_0) AND ([e0].[Id] = [e].[Id]))", + WHERE [e0].[Id] = @__id_0 AND [e0].[Id] = [e].[Id])", // @"@__id_0='2' @@ -1970,7 +1970,7 @@ FROM [Entities] AS [e] WHERE EXISTS ( SELECT 1 FROM [Entities] AS [e0] - WHERE ([e0].[Id] = @__id_0) AND ([e0].[Id] = [e].[Id]))"); + WHERE [e0].[Id] = @__id_0 AND [e0].[Id] = [e].[Id])"); } } @@ -2989,7 +2989,7 @@ FROM [Factions] AS [f] WHERE EXISTS ( SELECT 1 FROM [Leaders] AS [l] - WHERE ([l].[Name] IS NOT NULL AND ([l].[Name] LIKE N'Bran%')) AND ([l].[Name] = N'Crach an Craite'))"); + WHERE [l].[Name] IS NOT NULL AND ([l].[Name] LIKE N'Bran%') AND [l].[Name] = N'Crach an Craite')"); } } @@ -4736,7 +4736,7 @@ public virtual async Task Self_reference_in_query_filter_works() FROM [EntitiesWithQueryFilterSelfReference] AS [e] WHERE EXISTS ( SELECT 1 - FROM [EntitiesWithQueryFilterSelfReference] AS [e0]) AND (([e].[Name] <> N'Foo') OR [e].[Name] IS NULL)"); + FROM [EntitiesWithQueryFilterSelfReference] AS [e0]) AND ([e].[Name] <> N'Foo' OR [e].[Name] IS NULL)"); } using (var context = contextFactory.CreateContext()) @@ -4753,7 +4753,7 @@ SELECT 1 FROM [EntitiesWithQueryFilterSelfReference] AS [e0] WHERE EXISTS ( SELECT 1 - FROM [EntitiesWithQueryFilterSelfReference] AS [e1])) AND (([e].[Name] <> N'Foo') OR [e].[Name] IS NULL)"); + FROM [EntitiesWithQueryFilterSelfReference] AS [e1])) AND ([e].[Name] <> N'Foo' OR [e].[Name] IS NULL)"); } } @@ -5351,10 +5351,10 @@ FROM [Things] AS [t] WHERE EXISTS ( SELECT 1 FROM [Values] AS [v] - WHERE [e].[Id] = [v].[Entity11023Id]) AND ((( + WHERE [e].[Id] = [v].[Entity11023Id]) AND (( SELECT TOP(1) [v0].[Id] FROM [Values] AS [v0] - WHERE [e].[Id] = [v0].[Entity11023Id]) = [t].[Value11023Id]) OR (( + WHERE [e].[Id] = [v0].[Entity11023Id]) = [t].[Value11023Id] OR (( SELECT TOP(1) [v0].[Id] FROM [Values] AS [v0] WHERE [e].[Id] = [v0].[Entity11023Id]) IS NULL AND [t].[Value11023Id] IS NULL)) @@ -5600,17 +5600,17 @@ public virtual async Task Let_multiple_references_with_reference_to_outer() @"SELECT ( SELECT TOP(1) [c].[Id] FROM [CompetitionSeasons] AS [c] - WHERE ([c].[StartDate] <= [a].[DateTime]) AND ([a].[DateTime] < [c].[EndDate])), [a].[Id], [a0].[Id], [t].[Id], [t].[ActivityTypeId], [t].[CompetitionSeasonId], [t].[Points], [t].[Id0] + WHERE [c].[StartDate] <= [a].[DateTime] AND [a].[DateTime] < [c].[EndDate]), [a].[Id], [a0].[Id], [t].[Id], [t].[ActivityTypeId], [t].[CompetitionSeasonId], [t].[Points], [t].[Id0] FROM [Activities] AS [a] INNER JOIN [ActivityType12456] AS [a0] ON [a].[ActivityTypeId] = [a0].[Id] OUTER APPLY ( SELECT [a1].[Id], [a1].[ActivityTypeId], [a1].[CompetitionSeasonId], [a1].[Points], [c0].[Id] AS [Id0] FROM [ActivityTypePoints12456] AS [a1] INNER JOIN [CompetitionSeasons] AS [c0] ON [a1].[CompetitionSeasonId] = [c0].[Id] - WHERE ([c0].[Id] = ( + WHERE [c0].[Id] = ( SELECT TOP(1) [c1].[Id] FROM [CompetitionSeasons] AS [c1] - WHERE ([c1].[StartDate] <= [a].[DateTime]) AND ([a].[DateTime] < [c1].[EndDate]))) AND ([a0].[Id] = [a1].[ActivityTypeId]) + WHERE [c1].[StartDate] <= [a].[DateTime] AND [a].[DateTime] < [c1].[EndDate]) AND [a0].[Id] = [a1].[ActivityTypeId] ) AS [t] ORDER BY [a].[Id], [a0].[Id], [t].[Id]"); } @@ -5641,14 +5641,14 @@ FROM [CompetitionSeasons] AS [c1] @"SELECT [a].[Id], [a].[ActivityTypeId], [a].[DateTime], [a].[Points], ( SELECT TOP(1) [c].[Id] FROM [CompetitionSeasons] AS [c] - WHERE ([c].[StartDate] <= [a].[DateTime]) AND ([a].[DateTime] < [c].[EndDate])) AS [CompetitionSeasonId], COALESCE([a].[Points], ( + WHERE [c].[StartDate] <= [a].[DateTime] AND [a].[DateTime] < [c].[EndDate]) AS [CompetitionSeasonId], COALESCE([a].[Points], ( SELECT TOP(1) [a1].[Points] FROM [ActivityTypePoints12456] AS [a1] INNER JOIN [CompetitionSeasons] AS [c0] ON [a1].[CompetitionSeasonId] = [c0].[Id] - WHERE ([a0].[Id] = [a1].[ActivityTypeId]) AND ([c0].[Id] = ( + WHERE [a0].[Id] = [a1].[ActivityTypeId] AND [c0].[Id] = ( SELECT TOP(1) [c1].[Id] FROM [CompetitionSeasons] AS [c1] - WHERE ([c1].[StartDate] <= [a].[DateTime]) AND ([a].[DateTime] < [c1].[EndDate])))), 0) AS [Points] + WHERE [c1].[StartDate] <= [a].[DateTime] AND [a].[DateTime] < [c1].[EndDate])), 0) AS [Points] FROM [Activities] AS [a] INNER JOIN [ActivityType12456] AS [a0] ON [a].[ActivityTypeId] = [a0].[Id]"); } @@ -5753,7 +5753,7 @@ LEFT JOIN ( WHEN COALESCE(( SELECT MAX([d2].[GameNumber]) FROM [DbGame] AS [d2] - WHERE [d1].[Id] IS NOT NULL AND ([d1].[Id] = [d2].[SeasonId])), 0) > 10 THEN CAST(1 AS bit) + WHERE [d1].[Id] IS NOT NULL AND [d1].[Id] = [d2].[SeasonId]), 0) > 10 THEN CAST(1 AS bit) ELSE CAST(0 AS bit) END AS [IsPastTradeDeadline], [d].[DbTradeId] FROM [DbTradeAsset] AS [d] @@ -5941,7 +5941,7 @@ FROM [Offers] AS [o] WHERE EXISTS ( SELECT 1 FROM [OfferActions] AS [o0] - WHERE ([o].[Id] = [o0].[OfferId]) AND ([o0].[Action] = @__action_0))"); + WHERE [o].[Id] = [o0].[OfferId] AND [o0].[Action] = @__action_0)"); } } @@ -6250,7 +6250,7 @@ FROM [CustomerFilters] AS [c] SELECT COUNT(*) FROM [Customers] AS [c0] LEFT JOIN [CustomerMemberships] AS [c1] ON [c0].[Id] = [c1].[CustomerId] - WHERE [c1].[Id] IS NOT NULL AND ([c0].[Id] = [c].[CustomerId])) > 0"); + WHERE [c1].[Id] IS NOT NULL AND [c0].[Id] = [c].[CustomerId]) > 0"); } using (var context = contextFactory.CreateContext()) @@ -7106,12 +7106,12 @@ public virtual async Task Using_explicit_interface_implementation_as_navigation_ WHEN EXISTS ( SELECT 1 FROM [CoverIllustrations] AS [c] - WHERE ([b0].[Id] = [c].[CoverId]) AND ([c].[State] >= 2)) THEN CAST(1 AS bit) + WHERE [b0].[Id] = [c].[CoverId] AND [c].[State] >= 2) THEN CAST(1 AS bit) ELSE CAST(0 AS bit) END, ( SELECT TOP(1) [c0].[Uri] FROM [CoverIllustrations] AS [c0] - WHERE ([b0].[Id] = [c0].[CoverId]) AND ([c0].[State] >= 2)) + WHERE [b0].[Id] = [c0].[CoverId] AND [c0].[State] >= 2) FROM [Books] AS [b] INNER JOIN [BookCovers] AS [b0] ON [b].[FrontCoverId] = [b0].[Id] WHERE [b].[Id] = 1"); @@ -7314,13 +7314,13 @@ public virtual async Task Invoke_inside_query_filter_gets_correctly_evaluated_du SELECT [e].[Id], [e].[Name], [e].[TenantId] FROM [Entities] AS [e] -WHERE (([e].[Name] <> N'Foo') OR [e].[Name] IS NULL) AND ([e].[TenantId] = @__ef_filter__p_0)", +WHERE ([e].[Name] <> N'Foo' OR [e].[Name] IS NULL) AND [e].[TenantId] = @__ef_filter__p_0", // @"@__ef_filter__p_0='2' SELECT [e].[Id], [e].[Name], [e].[TenantId] FROM [Entities] AS [e] -WHERE (([e].[Name] <> N'Foo') OR [e].[Name] IS NULL) AND ([e].[TenantId] = @__ef_filter__p_0)"); +WHERE ([e].[Name] <> N'Foo' OR [e].[Name] IS NULL) AND [e].[TenantId] = @__ef_filter__p_0"); } } @@ -7898,7 +7898,7 @@ FROM [Autos] AS [a] FROM [EqualAutos] AS [e] LEFT JOIN [Autos] AS [a] ON [e].[AutoId] = [a].[Id] LEFT JOIN [Autos] AS [a0] ON [e].[AnotherAutoId] = [a0].[Id] -WHERE (([a].[Id] = @__entity_equality_a_0_Id) AND ([a0].[Id] = @__entity_equality_b_1_Id)) OR (([a].[Id] = @__entity_equality_b_1_Id) AND ([a0].[Id] = @__entity_equality_a_0_Id))"); +WHERE ([a].[Id] = @__entity_equality_a_0_Id AND [a0].[Id] = @__entity_equality_b_1_Id) OR ([a].[Id] = @__entity_equality_b_1_Id AND [a0].[Id] = @__entity_equality_a_0_Id)"); } } @@ -9449,12 +9449,12 @@ OUTER APPLY ( SELECT [m0].[Id], [m0].[Budget], [m0].[Description], [m0].[DurationInMins], [m0].[Name], [m0].[PosterUrl], [m0].[Rating], [m0].[ReleaseDate], [m0].[Revenue] FROM [MovieActorEntity] AS [m] INNER JOIN [MovieEntity] AS [m0] ON [m].[MovieId] = [m0].[Id] - WHERE [t].[Id0] IS NOT NULL AND ([t].[Id0] = [m].[ActorId]) + WHERE [t].[Id0] IS NOT NULL AND [t].[Id0] = [m].[ActorId] UNION SELECT [m2].[Id], [m2].[Budget], [m2].[Description], [m2].[DurationInMins], [m2].[Name], [m2].[PosterUrl], [m2].[Rating], [m2].[ReleaseDate], [m2].[Revenue] FROM [MovieDirectorEntity] AS [m1] INNER JOIN [MovieEntity] AS [m2] ON [m1].[MovieId] = [m2].[Id] - WHERE [t].[Id1] IS NOT NULL AND ([t].[Id1] = [m1].[DirectorId]) + WHERE [t].[Id1] IS NOT NULL AND [t].[Id1] = [m1].[DirectorId] ) AS [t0] ORDER BY [t].[Id], [t].[Id0], [t].[Id1], [p0].[Id]"); } @@ -9588,7 +9588,7 @@ SELECT TOP(2) ( SELECT COUNT(*) FROM [Cars] AS [c] INNER JOIN [Taxis] AS [t0] ON [c].[Id] = [t0].[CarId] - WHERE ([u].[Id] = [c].[EUserId]) AND (([t0].[ReportText] <> N'') OR [t0].[ReportText] IS NULL)) AS [c], [u].[Id] + WHERE [u].[Id] = [c].[EUserId] AND ([t0].[ReportText] <> N'' OR [t0].[ReportText] IS NULL)) AS [c], [u].[Id] FROM [Users] AS [u] ) AS [t] OUTER APPLY ( @@ -9720,7 +9720,7 @@ public virtual async Task SelectMany_and_collection_in_projection_in_FirstOrDefa FROM ( SELECT TOP(2) [o].[Id] FROM [Orders] AS [o] - WHERE ([o].[ExternalReferenceId] = @__referenceId_0) AND ([o].[CustomerId] = @__customerId_1) + WHERE [o].[ExternalReferenceId] = @__referenceId_0 AND [o].[CustomerId] = @__customerId_1 ) AS [t] OUTER APPLY ( SELECT [i].[Id], [t1].[Image], [t1].[Id] AS [Id0], [t1].[Id0] AS [Id00] diff --git a/test/EFCore.SqlServer.FunctionalTests/Query/QueryFilterFuncletizationSqlServerTest.cs b/test/EFCore.SqlServer.FunctionalTests/Query/QueryFilterFuncletizationSqlServerTest.cs index 020bb282554..ce70ae45fb0 100644 --- a/test/EFCore.SqlServer.FunctionalTests/Query/QueryFilterFuncletizationSqlServerTest.cs +++ b/test/EFCore.SqlServer.FunctionalTests/Query/QueryFilterFuncletizationSqlServerTest.cs @@ -32,7 +32,7 @@ public override void DbContext_property_parameter_does_not_clash_with_closure_pa SELECT [f].[Id], [f].[IsEnabled] FROM [FieldFilter] AS [f] -WHERE ([f].[IsEnabled] = @__ef_filter__Field_0) AND ([f].[IsEnabled] = @__Field_0)"); +WHERE [f].[IsEnabled] = @__ef_filter__Field_0 AND [f].[IsEnabled] = @__Field_0"); } public override void DbContext_field_is_parameterized() @@ -167,21 +167,21 @@ public override void DbContext_complex_expression_is_parameterized() SELECT [c].[Id], [c].[IsEnabled] FROM [ComplexFilter] AS [c] -WHERE ([c].[IsEnabled] = @__ef_filter__Property_0) AND (@__ef_filter__p_1 = CAST(1 AS bit))", +WHERE [c].[IsEnabled] = @__ef_filter__Property_0 AND @__ef_filter__p_1 = CAST(1 AS bit)", // @"@__ef_filter__Property_0='True' @__ef_filter__p_1='True' SELECT [c].[Id], [c].[IsEnabled] FROM [ComplexFilter] AS [c] -WHERE ([c].[IsEnabled] = @__ef_filter__Property_0) AND (@__ef_filter__p_1 = CAST(1 AS bit))", +WHERE [c].[IsEnabled] = @__ef_filter__Property_0 AND @__ef_filter__p_1 = CAST(1 AS bit)", // @"@__ef_filter__Property_0='True' @__ef_filter__p_1='False' SELECT [c].[Id], [c].[IsEnabled] FROM [ComplexFilter] AS [c] -WHERE ([c].[IsEnabled] = @__ef_filter__Property_0) AND (@__ef_filter__p_1 = CAST(1 AS bit))"); +WHERE [c].[IsEnabled] = @__ef_filter__Property_0 AND @__ef_filter__p_1 = CAST(1 AS bit)"); } public override void DbContext_property_based_filter_does_not_short_circuit() @@ -194,20 +194,20 @@ public override void DbContext_property_based_filter_does_not_short_circuit() SELECT [s].[Id], [s].[IsDeleted], [s].[IsModerated] FROM [ShortCircuitFilter] AS [s] -WHERE ([s].[IsDeleted] = CAST(0 AS bit)) AND ((@__ef_filter__p_0 = CAST(1 AS bit)) OR (@__ef_filter__IsModerated_1 = [s].[IsModerated]))", +WHERE [s].[IsDeleted] = CAST(0 AS bit) AND (@__ef_filter__p_0 = CAST(1 AS bit) OR @__ef_filter__IsModerated_1 = [s].[IsModerated])", // @"@__ef_filter__p_0='False' @__ef_filter__IsModerated_1='False' (Nullable = true) SELECT [s].[Id], [s].[IsDeleted], [s].[IsModerated] FROM [ShortCircuitFilter] AS [s] -WHERE ([s].[IsDeleted] = CAST(0 AS bit)) AND ((@__ef_filter__p_0 = CAST(1 AS bit)) OR (@__ef_filter__IsModerated_1 = [s].[IsModerated]))", +WHERE [s].[IsDeleted] = CAST(0 AS bit) AND (@__ef_filter__p_0 = CAST(1 AS bit) OR @__ef_filter__IsModerated_1 = [s].[IsModerated])", // @"@__ef_filter__p_0='True' SELECT [s].[Id], [s].[IsDeleted], [s].[IsModerated] FROM [ShortCircuitFilter] AS [s] -WHERE ([s].[IsDeleted] = CAST(0 AS bit)) AND (@__ef_filter__p_0 = CAST(1 AS bit))"); +WHERE [s].[IsDeleted] = CAST(0 AS bit) AND @__ef_filter__p_0 = CAST(1 AS bit)"); } public override void EntityTypeConfiguration_DbContext_field_is_parameterized() @@ -375,7 +375,7 @@ FROM [Dependents] AS [d] WHERE EXISTS ( SELECT 1 FROM [MultiContextFilter] AS [m] - WHERE (([m].[IsEnabled] = @__ef_filter__Property_0) AND ([m].[BossId] = 1)) AND ([m].[BossId] = [d].[PrincipalSetFilterId])) AND ([d].[PrincipalSetFilterId] = [p].[Id]))"); + WHERE [m].[IsEnabled] = @__ef_filter__Property_0 AND [m].[BossId] = 1 AND [m].[BossId] = [d].[PrincipalSetFilterId]) AND [d].[PrincipalSetFilterId] = [p].[Id])"); } public override void Using_Context_set_method_in_filter_works() @@ -390,7 +390,7 @@ FROM [Dependents] AS [d] WHERE EXISTS ( SELECT 1 FROM [MultiContextFilter] AS [m] - WHERE (([m].[IsEnabled] = @__ef_filter__Property_0) AND ([m].[BossId] = 1)) AND ([m].[BossId] = [d].[PrincipalSetFilterId]))"); + WHERE [m].[IsEnabled] = @__ef_filter__Property_0 AND [m].[BossId] = 1 AND [m].[BossId] = [d].[PrincipalSetFilterId])"); } public override void Static_member_from_dbContext_is_inlined() @@ -442,13 +442,13 @@ public override void Using_multiple_context_in_filter_parametrize_only_current_c SELECT [m].[Id], [m].[BossId], [m].[IsEnabled] FROM [MultiContextFilter] AS [m] -WHERE ([m].[IsEnabled] = @__ef_filter__Property_0) AND ([m].[BossId] = 1)", +WHERE [m].[IsEnabled] = @__ef_filter__Property_0 AND [m].[BossId] = 1", // @"@__ef_filter__Property_0='True' SELECT [m].[Id], [m].[BossId], [m].[IsEnabled] FROM [MultiContextFilter] AS [m] -WHERE ([m].[IsEnabled] = @__ef_filter__Property_0) AND ([m].[BossId] = 1)"); +WHERE [m].[IsEnabled] = @__ef_filter__Property_0 AND [m].[BossId] = 1"); } private void AssertSql(params string[] expected) diff --git a/test/EFCore.SqlServer.FunctionalTests/Query/SharedTypeQuerySqlServerTest.cs b/test/EFCore.SqlServer.FunctionalTests/Query/SharedTypeQuerySqlServerTest.cs index 07f8b2d53ff..b7739fb6ce9 100644 --- a/test/EFCore.SqlServer.FunctionalTests/Query/SharedTypeQuerySqlServerTest.cs +++ b/test/EFCore.SqlServer.FunctionalTests/Query/SharedTypeQuerySqlServerTest.cs @@ -20,7 +20,7 @@ FROM [ViewQuery24601] AS [v] WHERE EXISTS ( SELECT 1 FROM [STET] AS [s] - WHERE ([s].[Value] = [v].[Value]) OR ([s].[Value] IS NULL AND [v].[Value] IS NULL))"); + WHERE [s].[Value] = [v].[Value] OR ([s].[Value] IS NULL AND [v].[Value] IS NULL))"); } public override async Task Can_use_shared_type_entity_type_in_query_filter_with_from_sql(bool async) @@ -35,7 +35,7 @@ SELECT 1 FROM ( Select * from STET ) AS [s] - WHERE ([s].[Value] = [v].[Value]) OR ([s].[Value] IS NULL AND [v].[Value] IS NULL))"); + WHERE [s].[Value] = [v].[Value] OR ([s].[Value] IS NULL AND [v].[Value] IS NULL))"); } } } diff --git a/test/EFCore.SqlServer.FunctionalTests/Query/SimpleQuerySqlServerTest.cs b/test/EFCore.SqlServer.FunctionalTests/Query/SimpleQuerySqlServerTest.cs index 44de35cb755..3116efbe0ab 100644 --- a/test/EFCore.SqlServer.FunctionalTests/Query/SimpleQuerySqlServerTest.cs +++ b/test/EFCore.SqlServer.FunctionalTests/Query/SimpleQuerySqlServerTest.cs @@ -118,7 +118,7 @@ FROM [Memberships] AS [m] WHERE EXISTS ( SELECT 1 FROM [Memberships] AS [m0] - WHERE ([m0].[UserId] = @__currentUserId_0) AND ([m0].[GroupId] = [m].[GroupId])) AND ([u0].[Id] = [u].[Id])) THEN CAST(1 AS bit) + WHERE [m0].[UserId] = @__currentUserId_0 AND [m0].[GroupId] = [m].[GroupId]) AND [u0].[Id] = [u].[Id]) THEN CAST(1 AS bit) ELSE CAST(0 AS bit) END AS [HasAccess] FROM [Users] AS [u]"); @@ -141,7 +141,7 @@ WHERE EXISTS ( SELECT 1 FROM [Memberships] AS [m0] INNER JOIN [Groups] AS [g0] ON [m0].[GroupId] = [g0].[Id] - WHERE ([m0].[UserId] = @__currentUserId_0) AND ([g0].[Id] = [g].[Id])) AND ([u0].[Id] = [u].[Id])) THEN CAST(1 AS bit) + WHERE [m0].[UserId] = @__currentUserId_0 AND [g0].[Id] = [g].[Id]) AND [u0].[Id] = [u].[Id]) THEN CAST(1 AS bit) ELSE CAST(0 AS bit) END AS [HasAccess] FROM [Users] AS [u]"); @@ -162,7 +162,7 @@ FROM [Memberships] AS [m] WHERE EXISTS ( SELECT 1 FROM [Memberships] AS [m0] - WHERE ([m0].[UserId] = @__currentUserId_0) AND ([m0].[GroupId] = [m].[GroupId])) AND ([u0].[Id] = [u].[Id])) THEN CAST(1 AS bit) + WHERE [m0].[UserId] = @__currentUserId_0 AND [m0].[GroupId] = [m].[GroupId]) AND [u0].[Id] = [u].[Id]) THEN CAST(1 AS bit) ELSE CAST(0 AS bit) END AS [HasAccess] FROM [Users] AS [u]"); diff --git a/test/EFCore.SqlServer.FunctionalTests/Query/TPTFiltersInheritanceQuerySqlServerTest.cs b/test/EFCore.SqlServer.FunctionalTests/Query/TPTFiltersInheritanceQuerySqlServerTest.cs index f2fe0a418dc..3c8ce4c2fdd 100644 --- a/test/EFCore.SqlServer.FunctionalTests/Query/TPTFiltersInheritanceQuerySqlServerTest.cs +++ b/test/EFCore.SqlServer.FunctionalTests/Query/TPTFiltersInheritanceQuerySqlServerTest.cs @@ -47,7 +47,7 @@ FROM [Animals] AS [a] LEFT JOIN [Birds] AS [b] ON [a].[Species] = [b].[Species] LEFT JOIN [Eagle] AS [e] ON [a].[Species] = [e].[Species] LEFT JOIN [Kiwi] AS [k] ON [a].[Species] = [k].[Species] -WHERE ([a].[CountryId] = 1) AND [k].[Species] IS NOT NULL"); +WHERE [a].[CountryId] = 1 AND [k].[Species] IS NOT NULL"); } public override async Task Can_use_is_kiwi_with_other_predicate(bool async) @@ -63,7 +63,7 @@ FROM [Animals] AS [a] LEFT JOIN [Birds] AS [b] ON [a].[Species] = [b].[Species] LEFT JOIN [Eagle] AS [e] ON [a].[Species] = [e].[Species] LEFT JOIN [Kiwi] AS [k] ON [a].[Species] = [k].[Species] -WHERE ([a].[CountryId] = 1) AND ([k].[Species] IS NOT NULL AND ([a].[CountryId] = 1))"); +WHERE [a].[CountryId] = 1 AND [k].[Species] IS NOT NULL AND [a].[CountryId] = 1"); } public override async Task Can_use_is_kiwi_in_projection(bool async) @@ -93,7 +93,7 @@ FROM [Animals] AS [a] LEFT JOIN [Birds] AS [b] ON [a].[Species] = [b].[Species] LEFT JOIN [Eagle] AS [e] ON [a].[Species] = [e].[Species] LEFT JOIN [Kiwi] AS [k] ON [a].[Species] = [k].[Species] -WHERE ([a].[CountryId] = 1) AND ([k].[Species] IS NOT NULL OR [e].[Species] IS NOT NULL) +WHERE [a].[CountryId] = 1 AND ([k].[Species] IS NOT NULL OR [e].[Species] IS NOT NULL) ORDER BY [a].[Species]"); } @@ -110,7 +110,7 @@ FROM [Animals] AS [a] LEFT JOIN [Birds] AS [b] ON [a].[Species] = [b].[Species] LEFT JOIN [Eagle] AS [e] ON [a].[Species] = [e].[Species] LEFT JOIN [Kiwi] AS [k] ON [a].[Species] = [k].[Species] -WHERE (([a].[CountryId] = 1) AND ([a].[CountryId] = 1)) AND ([k].[Species] IS NOT NULL OR [e].[Species] IS NOT NULL) +WHERE [a].[CountryId] = 1 AND [a].[CountryId] = 1 AND ([k].[Species] IS NOT NULL OR [e].[Species] IS NOT NULL) ORDER BY [a].[Species]"); } @@ -124,7 +124,7 @@ FROM [Animals] AS [a] LEFT JOIN [Birds] AS [b] ON [a].[Species] = [b].[Species] LEFT JOIN [Eagle] AS [e] ON [a].[Species] = [e].[Species] LEFT JOIN [Kiwi] AS [k] ON [a].[Species] = [k].[Species] -WHERE ([a].[CountryId] = 1) AND ([k].[Species] IS NOT NULL OR [e].[Species] IS NOT NULL)"); +WHERE [a].[CountryId] = 1 AND ([k].[Species] IS NOT NULL OR [e].[Species] IS NOT NULL)"); } public override async Task Can_use_of_type_bird_first(bool async) @@ -140,7 +140,7 @@ FROM [Animals] AS [a] LEFT JOIN [Birds] AS [b] ON [a].[Species] = [b].[Species] LEFT JOIN [Eagle] AS [e] ON [a].[Species] = [e].[Species] LEFT JOIN [Kiwi] AS [k] ON [a].[Species] = [k].[Species] -WHERE ([a].[CountryId] = 1) AND ([k].[Species] IS NOT NULL OR [e].[Species] IS NOT NULL) +WHERE [a].[CountryId] = 1 AND ([k].[Species] IS NOT NULL OR [e].[Species] IS NOT NULL) ORDER BY [a].[Species]"); } @@ -155,7 +155,7 @@ END AS [Discriminator] FROM [Animals] AS [a] LEFT JOIN [Birds] AS [b] ON [a].[Species] = [b].[Species] LEFT JOIN [Kiwi] AS [k] ON [a].[Species] = [k].[Species] -WHERE ([a].[CountryId] = 1) AND [k].[Species] IS NOT NULL"); +WHERE [a].[CountryId] = 1 AND [k].[Species] IS NOT NULL"); } public override async Task Can_use_derived_set(bool async) diff --git a/test/EFCore.SqlServer.FunctionalTests/Query/TPTGearsOfWarQuerySqlServerTest.cs b/test/EFCore.SqlServer.FunctionalTests/Query/TPTGearsOfWarQuerySqlServerTest.cs index cf617713a70..c60e4062998 100644 --- a/test/EFCore.SqlServer.FunctionalTests/Query/TPTGearsOfWarQuerySqlServerTest.cs +++ b/test/EFCore.SqlServer.FunctionalTests/Query/TPTGearsOfWarQuerySqlServerTest.cs @@ -62,7 +62,7 @@ public override async Task Entity_equality_empty(bool async) 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]) +LEFT JOIN [Officers] AS [o] ON [g].[Nickname] = [o].[Nickname] AND [g].[SquadId] = [o].[SquadId] WHERE 0 = 1"); } @@ -78,8 +78,8 @@ LEFT JOIN ( 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]) + 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] LEFT JOIN [Weapons] AS [w] ON [t0].[FullName] = [w].[OwnerFullName] ORDER BY [t].[Id], [t0].[Nickname], [t0].[SquadId]"); } @@ -96,8 +96,8 @@ LEFT JOIN ( 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]) + 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] LEFT JOIN [Squads] AS [s] ON [t0].[SquadId] = [s].[Id]"); } @@ -110,14 +110,14 @@ public override async Task Include_multiple_circular(bool async) WHEN [o].[Nickname] IS NOT NULL THEN N'Officer' END AS [Discriminator], [c].[Name], [c].[Location], [c].[Nation], [t].[Nickname], [t].[SquadId], [t].[AssignedCityName], [t].[CityOfBirthName], [t].[FullName], [t].[HasSoulPatch], [t].[LeaderNickname], [t].[LeaderSquadId], [t].[Rank], [t].[Discriminator] FROM [Gears] AS [g] -LEFT JOIN [Officers] AS [o] ON ([g].[Nickname] = [o].[Nickname]) AND ([g].[SquadId] = [o].[SquadId]) +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 ( SELECT [g0].[Nickname], [g0].[SquadId], [g0].[AssignedCityName], [g0].[CityOfBirthName], [g0].[FullName], [g0].[HasSoulPatch], [g0].[LeaderNickname], [g0].[LeaderSquadId], [g0].[Rank], CASE 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]) + LEFT JOIN [Officers] AS [o0] ON [g0].[Nickname] = [o0].[Nickname] AND [g0].[SquadId] = [o0].[SquadId] ) AS [t] ON [c].[Name] = [t].[AssignedCityName] ORDER BY [g].[Nickname], [g].[SquadId], [c].[Name], [t].[Nickname]"); } @@ -131,14 +131,14 @@ public override async Task Include_multiple_circular_with_filter(bool async) WHEN [o].[Nickname] IS NOT NULL THEN N'Officer' END AS [Discriminator], [c].[Name], [c].[Location], [c].[Nation], [t].[Nickname], [t].[SquadId], [t].[AssignedCityName], [t].[CityOfBirthName], [t].[FullName], [t].[HasSoulPatch], [t].[LeaderNickname], [t].[LeaderSquadId], [t].[Rank], [t].[Discriminator] FROM [Gears] AS [g] -LEFT JOIN [Officers] AS [o] ON ([g].[Nickname] = [o].[Nickname]) AND ([g].[SquadId] = [o].[SquadId]) +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 ( SELECT [g0].[Nickname], [g0].[SquadId], [g0].[AssignedCityName], [g0].[CityOfBirthName], [g0].[FullName], [g0].[HasSoulPatch], [g0].[LeaderNickname], [g0].[LeaderSquadId], [g0].[Rank], CASE 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]) + LEFT JOIN [Officers] AS [o0] ON [g0].[Nickname] = [o0].[Nickname] AND [g0].[SquadId] = [o0].[SquadId] ) AS [t] ON [c].[Name] = [t].[AssignedCityName] WHERE [g].[Nickname] = N'Marcus' ORDER BY [g].[Nickname], [g].[SquadId], [c].[Name], [t].[Nickname]"); @@ -153,7 +153,7 @@ public override async Task Include_using_alternate_key(bool async) 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 [Officers] AS [o] ON [g].[Nickname] = [o].[Nickname] AND [g].[SquadId] = [o].[SquadId] LEFT JOIN [Weapons] AS [w] ON [g].[FullName] = [w].[OwnerFullName] WHERE [g].[Nickname] = N'Marcus' ORDER BY [g].[Nickname], [g].[SquadId]"); @@ -168,14 +168,14 @@ public override async Task Include_navigation_on_derived_type(bool async) WHEN [o].[Nickname] IS NOT NULL THEN N'Officer' END AS [Discriminator], [t].[Nickname], [t].[SquadId], [t].[AssignedCityName], [t].[CityOfBirthName], [t].[FullName], [t].[HasSoulPatch], [t].[LeaderNickname], [t].[LeaderSquadId], [t].[Rank], [t].[Discriminator] FROM [Gears] AS [g] -LEFT JOIN [Officers] AS [o] ON ([g].[Nickname] = [o].[Nickname]) AND ([g].[SquadId] = [o].[SquadId]) +LEFT JOIN [Officers] AS [o] ON [g].[Nickname] = [o].[Nickname] AND [g].[SquadId] = [o].[SquadId] LEFT JOIN ( SELECT [g0].[Nickname], [g0].[SquadId], [g0].[AssignedCityName], [g0].[CityOfBirthName], [g0].[FullName], [g0].[HasSoulPatch], [g0].[LeaderNickname], [g0].[LeaderSquadId], [g0].[Rank], CASE 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 [t] ON ([g].[Nickname] = [t].[LeaderNickname]) AND ([g].[SquadId] = [t].[LeaderSquadId]) + LEFT JOIN [Officers] AS [o0] ON [g0].[Nickname] = [o0].[Nickname] AND [g0].[SquadId] = [o0].[SquadId] +) AS [t] ON [g].[Nickname] = [t].[LeaderNickname] AND [g].[SquadId] = [t].[LeaderSquadId] WHERE [o].[Nickname] IS NOT NULL ORDER BY [g].[Nickname], [g].[SquadId], [t].[Nickname]"); } @@ -189,14 +189,14 @@ public override async Task String_based_Include_navigation_on_derived_type(bool WHEN [o].[Nickname] IS NOT NULL THEN N'Officer' END AS [Discriminator], [t].[Nickname], [t].[SquadId], [t].[AssignedCityName], [t].[CityOfBirthName], [t].[FullName], [t].[HasSoulPatch], [t].[LeaderNickname], [t].[LeaderSquadId], [t].[Rank], [t].[Discriminator] FROM [Gears] AS [g] -LEFT JOIN [Officers] AS [o] ON ([g].[Nickname] = [o].[Nickname]) AND ([g].[SquadId] = [o].[SquadId]) +LEFT JOIN [Officers] AS [o] ON [g].[Nickname] = [o].[Nickname] AND [g].[SquadId] = [o].[SquadId] LEFT JOIN ( SELECT [g0].[Nickname], [g0].[SquadId], [g0].[AssignedCityName], [g0].[CityOfBirthName], [g0].[FullName], [g0].[HasSoulPatch], [g0].[LeaderNickname], [g0].[LeaderSquadId], [g0].[Rank], CASE 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 [t] ON ([g].[Nickname] = [t].[LeaderNickname]) AND ([g].[SquadId] = [t].[LeaderSquadId]) + LEFT JOIN [Officers] AS [o0] ON [g0].[Nickname] = [o0].[Nickname] AND [g0].[SquadId] = [o0].[SquadId] +) AS [t] ON [g].[Nickname] = [t].[LeaderNickname] AND [g].[SquadId] = [t].[LeaderSquadId] WHERE [o].[Nickname] IS NOT NULL ORDER BY [g].[Nickname], [g].[SquadId], [t].[Nickname]"); } @@ -213,8 +213,8 @@ LEFT JOIN ( 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]) + 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'"); } @@ -227,8 +227,8 @@ public override async Task Include_with_join_reference1(bool async) WHEN [o].[Nickname] IS NOT NULL THEN N'Officer' END AS [Discriminator], [c].[Name], [c].[Location], [c].[Nation] FROM [Gears] AS [g] -LEFT JOIN [Officers] AS [o] ON ([g].[Nickname] = [o].[Nickname]) AND ([g].[SquadId] = [o].[SquadId]) -INNER JOIN [Tags] AS [t] ON ([g].[SquadId] = [t].[GearSquadId]) AND ([g].[Nickname] = [t].[GearNickName]) +LEFT JOIN [Officers] AS [o] ON [g].[Nickname] = [o].[Nickname] AND [g].[SquadId] = [o].[SquadId] +INNER JOIN [Tags] AS [t] ON [g].[SquadId] = [t].[GearSquadId] AND [g].[Nickname] = [t].[GearNickName] INNER JOIN [Cities] AS [c] ON [g].[CityOfBirthName] = [c].[Name]"); } @@ -244,8 +244,8 @@ INNER JOIN ( 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].[GearSquadId] = [t0].[SquadId]) AND ([t].[GearNickName] = [t0].[Nickname]) + LEFT JOIN [Officers] AS [o] ON [g].[Nickname] = [o].[Nickname] AND [g].[SquadId] = [o].[SquadId] +) AS [t0] ON [t].[GearSquadId] = [t0].[SquadId] AND [t].[GearNickName] = [t0].[Nickname] INNER JOIN [Cities] AS [c] ON [t0].[CityOfBirthName] = [c].[Name]"); } @@ -258,8 +258,8 @@ public override async Task Include_with_join_collection1(bool async) WHEN [o].[Nickname] IS NOT NULL THEN N'Officer' END AS [Discriminator], [t].[Id], [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 [Tags] AS [t] ON ([g].[SquadId] = [t].[GearSquadId]) AND ([g].[Nickname] = [t].[GearNickName]) +LEFT JOIN [Officers] AS [o] ON [g].[Nickname] = [o].[Nickname] AND [g].[SquadId] = [o].[SquadId] +INNER JOIN [Tags] AS [t] ON [g].[SquadId] = [t].[GearSquadId] AND [g].[Nickname] = [t].[GearNickName] LEFT JOIN [Weapons] AS [w] ON [g].[FullName] = [w].[OwnerFullName] ORDER BY [g].[Nickname], [g].[SquadId], [t].[Id]"); } @@ -276,8 +276,8 @@ INNER JOIN ( 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].[GearSquadId] = [t0].[SquadId]) AND ([t].[GearNickName] = [t0].[Nickname]) + LEFT JOIN [Officers] AS [o] ON [g].[Nickname] = [o].[Nickname] AND [g].[SquadId] = [o].[SquadId] +) AS [t0] ON [t].[GearSquadId] = [t0].[SquadId] AND [t].[GearNickName] = [t0].[Nickname] LEFT JOIN [Weapons] AS [w] ON [t0].[FullName] = [w].[OwnerFullName] ORDER BY [t].[Id], [t0].[Nickname], [t0].[SquadId]"); } @@ -294,8 +294,8 @@ public override async Task Include_where_list_contains_navigation(bool async) WHEN [o].[Nickname] IS NOT NULL THEN N'Officer' END AS [Discriminator], [t].[Id], [t].[GearNickName], [t].[GearSquadId], [t].[IssueDate], [t].[Note] 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 [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')"); } @@ -311,9 +311,9 @@ public override async Task Include_where_list_contains_navigation2(bool async) WHEN [o].[Nickname] IS NOT NULL THEN N'Officer' END AS [Discriminator], [t].[Id], [t].[GearNickName], [t].[GearSquadId], [t].[IssueDate], [t].[Note] FROM [Gears] AS [g] -LEFT JOIN [Officers] AS [o] ON ([g].[Nickname] = [o].[Nickname]) AND ([g].[SquadId] = [o].[SquadId]) +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]) +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')"); } @@ -329,8 +329,8 @@ public override async Task Navigation_accessed_twice_outside_and_inside_subquery 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]) -LEFT JOIN [Tags] AS [t] ON ([g].[Nickname] = [t].[GearNickName]) AND ([g].[SquadId] = [t].[GearSquadId]) +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')"); } @@ -343,15 +343,15 @@ public override async Task Include_with_join_multi_level(bool async) WHEN [o].[Nickname] IS NOT NULL THEN N'Officer' END AS [Discriminator], [c].[Name], [c].[Location], [c].[Nation], [t].[Id], [t0].[Nickname], [t0].[SquadId], [t0].[AssignedCityName], [t0].[CityOfBirthName], [t0].[FullName], [t0].[HasSoulPatch], [t0].[LeaderNickname], [t0].[LeaderSquadId], [t0].[Rank], [t0].[Discriminator] FROM [Gears] AS [g] -LEFT JOIN [Officers] AS [o] ON ([g].[Nickname] = [o].[Nickname]) AND ([g].[SquadId] = [o].[SquadId]) -INNER JOIN [Tags] AS [t] ON ([g].[SquadId] = [t].[GearSquadId]) AND ([g].[Nickname] = [t].[GearNickName]) +LEFT JOIN [Officers] AS [o] ON [g].[Nickname] = [o].[Nickname] AND [g].[SquadId] = [o].[SquadId] +INNER JOIN [Tags] AS [t] ON [g].[SquadId] = [t].[GearSquadId] AND [g].[Nickname] = [t].[GearNickName] INNER JOIN [Cities] AS [c] ON [g].[CityOfBirthName] = [c].[Name] LEFT JOIN ( SELECT [g0].[Nickname], [g0].[SquadId], [g0].[AssignedCityName], [g0].[CityOfBirthName], [g0].[FullName], [g0].[HasSoulPatch], [g0].[LeaderNickname], [g0].[LeaderSquadId], [g0].[Rank], CASE 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]) + LEFT JOIN [Officers] AS [o0] ON [g0].[Nickname] = [o0].[Nickname] AND [g0].[SquadId] = [o0].[SquadId] ) AS [t0] ON [c].[Name] = [t0].[AssignedCityName] ORDER BY [g].[Nickname], [g].[SquadId], [t].[Id], [c].[Name], [t0].[Nickname]"); } @@ -368,9 +368,9 @@ INNER JOIN ( 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]) + LEFT JOIN [Officers] AS [o] ON [g].[Nickname] = [o].[Nickname] AND [g].[SquadId] = [o].[SquadId] WHERE [o].[Nickname] IS NOT NULL -) AS [t0] ON ([t].[GearSquadId] = [t0].[SquadId]) AND ([t].[GearNickName] = [t0].[Nickname]) +) AS [t0] ON [t].[GearSquadId] = [t0].[SquadId] AND [t].[GearNickName] = [t0].[Nickname] INNER JOIN [Cities] AS [c] ON [t0].[CityOfBirthName] = [c].[Name]"); } @@ -386,16 +386,16 @@ INNER JOIN ( 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]) + LEFT JOIN [Officers] AS [o] ON [g].[Nickname] = [o].[Nickname] AND [g].[SquadId] = [o].[SquadId] WHERE [o].[Nickname] IS NOT NULL -) AS [t0] ON ([t].[GearSquadId] = [t0].[SquadId]) AND ([t].[GearNickName] = [t0].[Nickname]) +) AS [t0] ON [t].[GearSquadId] = [t0].[SquadId] AND [t].[GearNickName] = [t0].[Nickname] LEFT JOIN ( SELECT [g0].[Nickname], [g0].[SquadId], [g0].[AssignedCityName], [g0].[CityOfBirthName], [g0].[FullName], [g0].[HasSoulPatch], [g0].[LeaderNickname], [g0].[LeaderSquadId], [g0].[Rank], CASE 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]) AND ([t0].[SquadId] = [t1].[LeaderSquadId]) + LEFT JOIN [Officers] AS [o0] ON [g0].[Nickname] = [o0].[Nickname] AND [g0].[SquadId] = [o0].[SquadId] +) AS [t1] ON [t0].[Nickname] = [t1].[LeaderNickname] AND [t0].[SquadId] = [t1].[LeaderSquadId] ORDER BY [t0].[HasSoulPatch], [t0].[Nickname] DESC, [t].[Id], [t0].[SquadId], [t1].[Nickname]"); } @@ -408,8 +408,8 @@ public override async Task Include_with_join_and_inheritance2(bool async) WHEN [o].[Nickname] IS NOT NULL THEN N'Officer' END AS [Discriminator], [t].[Id], [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 [Tags] AS [t] ON ([g].[SquadId] = [t].[GearSquadId]) AND ([g].[Nickname] = [t].[GearNickName]) +LEFT JOIN [Officers] AS [o] ON [g].[Nickname] = [o].[Nickname] AND [g].[SquadId] = [o].[SquadId] +INNER JOIN [Tags] AS [t] ON [g].[SquadId] = [t].[GearSquadId] AND [g].[Nickname] = [t].[GearNickName] LEFT JOIN [Weapons] AS [w] ON [g].[FullName] = [w].[OwnerFullName] WHERE [o].[Nickname] IS NOT NULL ORDER BY [g].[Nickname], [g].[SquadId], [t].[Id]"); @@ -427,16 +427,16 @@ INNER JOIN ( 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]) + LEFT JOIN [Officers] AS [o] ON [g].[Nickname] = [o].[Nickname] AND [g].[SquadId] = [o].[SquadId] WHERE [o].[Nickname] IS NOT NULL -) AS [t0] ON ([t].[GearSquadId] = [t0].[SquadId]) AND ([t].[GearNickName] = [t0].[Nickname]) +) AS [t0] ON [t].[GearSquadId] = [t0].[SquadId] AND [t].[GearNickName] = [t0].[Nickname] LEFT JOIN ( SELECT [g0].[Nickname], [g0].[SquadId], [g0].[AssignedCityName], [g0].[CityOfBirthName], [g0].[FullName], [g0].[HasSoulPatch], [g0].[LeaderNickname], [g0].[LeaderSquadId], [g0].[Rank], CASE 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]) AND ([t0].[SquadId] = [t1].[LeaderSquadId]) + LEFT JOIN [Officers] AS [o0] ON [g0].[Nickname] = [o0].[Nickname] AND [g0].[SquadId] = [o0].[SquadId] +) AS [t1] ON [t0].[Nickname] = [t1].[LeaderNickname] AND [t0].[SquadId] = [t1].[LeaderSquadId] ORDER BY [t].[Id], [t0].[Nickname], [t0].[SquadId], [t1].[Nickname]"); } @@ -452,10 +452,10 @@ LEFT JOIN ( 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]) + 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]"); } @@ -468,7 +468,7 @@ public override async Task Where_enum(bool async) 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]) +LEFT JOIN [Officers] AS [o] ON [g].[Nickname] = [o].[Nickname] AND [g].[SquadId] = [o].[SquadId] WHERE [g].[Rank] = 4"); } @@ -529,14 +529,14 @@ public override async Task Where_bitwise_and_enum(bool async) 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]) +LEFT JOIN [Officers] AS [o] ON [g].[Nickname] = [o].[Nickname] AND [g].[SquadId] = [o].[SquadId] WHERE ([g].[Rank] & 2) > 0", // @"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] FROM [Gears] AS [g] -LEFT JOIN [Officers] AS [o] ON ([g].[Nickname] = [o].[Nickname]) AND ([g].[SquadId] = [o].[SquadId]) +LEFT JOIN [Officers] AS [o] ON [g].[Nickname] = [o].[Nickname] AND [g].[SquadId] = [o].[SquadId] WHERE ([g].[Rank] & 2) = 2"); } @@ -549,21 +549,21 @@ public override async Task Where_bitwise_and_integral(bool async) 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]) +LEFT JOIN [Officers] AS [o] ON [g].[Nickname] = [o].[Nickname] AND [g].[SquadId] = [o].[SquadId] WHERE ([g].[Rank] & 1) = 1", // @"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] FROM [Gears] AS [g] -LEFT JOIN [Officers] AS [o] ON ([g].[Nickname] = [o].[Nickname]) AND ([g].[SquadId] = [o].[SquadId]) +LEFT JOIN [Officers] AS [o] ON [g].[Nickname] = [o].[Nickname] AND [g].[SquadId] = [o].[SquadId] WHERE (CAST([g].[Rank] AS bigint) & CAST(1 AS bigint)) = CAST(1 AS bigint)", // @"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] FROM [Gears] AS [g] -LEFT JOIN [Officers] AS [o] ON ([g].[Nickname] = [o].[Nickname]) AND ([g].[SquadId] = [o].[SquadId]) +LEFT JOIN [Officers] AS [o] ON [g].[Nickname] = [o].[Nickname] AND [g].[SquadId] = [o].[SquadId] WHERE (CAST([g].[Rank] AS smallint) & CAST(1 AS smallint)) = CAST(1 AS smallint)"); } @@ -624,7 +624,7 @@ public override async Task Where_bitwise_or_enum(bool async) 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]) +LEFT JOIN [Officers] AS [o] ON [g].[Nickname] = [o].[Nickname] AND [g].[SquadId] = [o].[SquadId] WHERE ([g].[Rank] | 2) > 0"); } @@ -653,35 +653,35 @@ public override async Task Where_enum_has_flag(bool async) 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]) +LEFT JOIN [Officers] AS [o] ON [g].[Nickname] = [o].[Nickname] AND [g].[SquadId] = [o].[SquadId] WHERE ([g].[Rank] & 2) = 2", // @"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] FROM [Gears] AS [g] -LEFT JOIN [Officers] AS [o] ON ([g].[Nickname] = [o].[Nickname]) AND ([g].[SquadId] = [o].[SquadId]) +LEFT JOIN [Officers] AS [o] ON [g].[Nickname] = [o].[Nickname] AND [g].[SquadId] = [o].[SquadId] WHERE ([g].[Rank] & 18) = 18", // @"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] FROM [Gears] AS [g] -LEFT JOIN [Officers] AS [o] ON ([g].[Nickname] = [o].[Nickname]) AND ([g].[SquadId] = [o].[SquadId]) +LEFT JOIN [Officers] AS [o] ON [g].[Nickname] = [o].[Nickname] AND [g].[SquadId] = [o].[SquadId] WHERE ([g].[Rank] & 1) = 1", // @"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] FROM [Gears] AS [g] -LEFT JOIN [Officers] AS [o] ON ([g].[Nickname] = [o].[Nickname]) AND ([g].[SquadId] = [o].[SquadId]) +LEFT JOIN [Officers] AS [o] ON [g].[Nickname] = [o].[Nickname] AND [g].[SquadId] = [o].[SquadId] WHERE ([g].[Rank] & 1) = 1", // @"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] FROM [Gears] AS [g] -LEFT JOIN [Officers] AS [o] ON ([g].[Nickname] = [o].[Nickname]) AND ([g].[SquadId] = [o].[SquadId]) +LEFT JOIN [Officers] AS [o] ON [g].[Nickname] = [o].[Nickname] AND [g].[SquadId] = [o].[SquadId] WHERE (2 & [g].[Rank]) = [g].[Rank]"); } @@ -694,30 +694,30 @@ public override async Task Where_enum_has_flag_subquery(bool async) 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]) +LEFT JOIN [Officers] AS [o] ON [g].[Nickname] = [o].[Nickname] AND [g].[SquadId] = [o].[SquadId] WHERE ([g].[Rank] & COALESCE(( SELECT TOP(1) [g0].[Rank] FROM [Gears] AS [g0] - LEFT JOIN [Officers] AS [o0] ON ([g0].[Nickname] = [o0].[Nickname]) AND ([g0].[SquadId] = [o0].[SquadId]) + LEFT JOIN [Officers] AS [o0] ON [g0].[Nickname] = [o0].[Nickname] AND [g0].[SquadId] = [o0].[SquadId] ORDER BY [g0].[Nickname], [g0].[SquadId]), 0)) = COALESCE(( SELECT TOP(1) [g0].[Rank] FROM [Gears] AS [g0] - LEFT JOIN [Officers] AS [o0] ON ([g0].[Nickname] = [o0].[Nickname]) AND ([g0].[SquadId] = [o0].[SquadId]) + LEFT JOIN [Officers] AS [o0] ON [g0].[Nickname] = [o0].[Nickname] AND [g0].[SquadId] = [o0].[SquadId] ORDER BY [g0].[Nickname], [g0].[SquadId]), 0)", // @"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] FROM [Gears] AS [g] -LEFT JOIN [Officers] AS [o] ON ([g].[Nickname] = [o].[Nickname]) AND ([g].[SquadId] = [o].[SquadId]) +LEFT JOIN [Officers] AS [o] ON [g].[Nickname] = [o].[Nickname] AND [g].[SquadId] = [o].[SquadId] WHERE (2 & COALESCE(( SELECT TOP(1) [g0].[Rank] FROM [Gears] AS [g0] - LEFT JOIN [Officers] AS [o0] ON ([g0].[Nickname] = [o0].[Nickname]) AND ([g0].[SquadId] = [o0].[SquadId]) + LEFT JOIN [Officers] AS [o0] ON [g0].[Nickname] = [o0].[Nickname] AND [g0].[SquadId] = [o0].[SquadId] ORDER BY [g0].[Nickname], [g0].[SquadId]), 0)) = COALESCE(( SELECT TOP(1) [g0].[Rank] FROM [Gears] AS [g0] - LEFT JOIN [Officers] AS [o0] ON ([g0].[Nickname] = [o0].[Nickname]) AND ([g0].[SquadId] = [o0].[SquadId]) + LEFT JOIN [Officers] AS [o0] ON [g0].[Nickname] = [o0].[Nickname] AND [g0].[SquadId] = [o0].[SquadId] ORDER BY [g0].[Nickname], [g0].[SquadId]), 0)"); } @@ -730,46 +730,46 @@ public override async Task Where_enum_has_flag_subquery_with_pushdown(bool async 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].[Rank] & ( +LEFT JOIN [Officers] AS [o] ON [g].[Nickname] = [o].[Nickname] AND [g].[SquadId] = [o].[SquadId] +WHERE ([g].[Rank] & ( SELECT TOP(1) [g0].[Rank] FROM [Gears] AS [g0] - LEFT JOIN [Officers] AS [o0] ON ([g0].[Nickname] = [o0].[Nickname]) AND ([g0].[SquadId] = [o0].[SquadId]) + LEFT JOIN [Officers] AS [o0] ON [g0].[Nickname] = [o0].[Nickname] AND [g0].[SquadId] = [o0].[SquadId] ORDER BY [g0].[Nickname], [g0].[SquadId])) = ( 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 (( + LEFT JOIN [Officers] AS [o0] ON [g0].[Nickname] = [o0].[Nickname] AND [g0].[SquadId] = [o0].[SquadId] + 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]) + LEFT JOIN [Officers] AS [o0] ON [g0].[Nickname] = [o0].[Nickname] AND [g0].[SquadId] = [o0].[SquadId] 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]) + LEFT JOIN [Officers] AS [o0] ON [g0].[Nickname] = [o0].[Nickname] AND [g0].[SquadId] = [o0].[SquadId] 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' END AS [Discriminator] FROM [Gears] AS [g] -LEFT JOIN [Officers] AS [o] ON ([g].[Nickname] = [o].[Nickname]) AND ([g].[SquadId] = [o].[SquadId]) -WHERE ((2 & ( +LEFT JOIN [Officers] AS [o] ON [g].[Nickname] = [o].[Nickname] AND [g].[SquadId] = [o].[SquadId] +WHERE (2 & ( SELECT TOP(1) [g0].[Rank] FROM [Gears] AS [g0] - LEFT JOIN [Officers] AS [o0] ON ([g0].[Nickname] = [o0].[Nickname]) AND ([g0].[SquadId] = [o0].[SquadId]) + LEFT JOIN [Officers] AS [o0] ON [g0].[Nickname] = [o0].[Nickname] AND [g0].[SquadId] = [o0].[SquadId] ORDER BY [g0].[Nickname], [g0].[SquadId])) = ( 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 (( + LEFT JOIN [Officers] AS [o0] ON [g0].[Nickname] = [o0].[Nickname] AND [g0].[SquadId] = [o0].[SquadId] + 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]) + LEFT JOIN [Officers] AS [o0] ON [g0].[Nickname] = [o0].[Nickname] AND [g0].[SquadId] = [o0].[SquadId] 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]) + LEFT JOIN [Officers] AS [o0] ON [g0].[Nickname] = [o0].[Nickname] AND [g0].[SquadId] = [o0].[SquadId] ORDER BY [g0].[Nickname], [g0].[SquadId]) IS NULL)"); } @@ -782,23 +782,23 @@ public override async Task Where_enum_has_flag_subquery_client_eval(bool async) 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].[Rank] & ( +LEFT JOIN [Officers] AS [o] ON [g].[Nickname] = [o].[Nickname] AND [g].[SquadId] = [o].[SquadId] +WHERE ([g].[Rank] & ( SELECT TOP(1) [g0].[Rank] FROM [Gears] AS [g0] - LEFT JOIN [Officers] AS [o0] ON ([g0].[Nickname] = [o0].[Nickname]) AND ([g0].[SquadId] = [o0].[SquadId]) + LEFT JOIN [Officers] AS [o0] ON [g0].[Nickname] = [o0].[Nickname] AND [g0].[SquadId] = [o0].[SquadId] ORDER BY [g0].[Nickname], [g0].[SquadId])) = ( 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 (( + LEFT JOIN [Officers] AS [o0] ON [g0].[Nickname] = [o0].[Nickname] AND [g0].[SquadId] = [o0].[SquadId] + 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]) + LEFT JOIN [Officers] AS [o0] ON [g0].[Nickname] = [o0].[Nickname] AND [g0].[SquadId] = [o0].[SquadId] 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]) + LEFT JOIN [Officers] AS [o0] ON [g0].[Nickname] = [o0].[Nickname] AND [g0].[SquadId] = [o0].[SquadId] ORDER BY [g0].[Nickname], [g0].[SquadId]) IS NULL)"); } @@ -813,7 +813,7 @@ public override async Task Where_enum_has_flag_with_non_nullable_parameter(bool 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]) +LEFT JOIN [Officers] AS [o] ON [g].[Nickname] = [o].[Nickname] AND [g].[SquadId] = [o].[SquadId] WHERE ([g].[Rank] & @__parameter_0) = @__parameter_0"); } @@ -828,7 +828,7 @@ public override async Task Where_has_flag_with_nullable_parameter(bool async) 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]) +LEFT JOIN [Officers] AS [o] ON [g].[Nickname] = [o].[Nickname] AND [g].[SquadId] = [o].[SquadId] WHERE ([g].[Rank] & @__parameter_0) = @__parameter_0"); } @@ -857,7 +857,7 @@ public override async Task Where_count_subquery_without_collision(bool async) 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]) +LEFT JOIN [Officers] AS [o] ON [g].[Nickname] = [o].[Nickname] AND [g].[SquadId] = [o].[SquadId] WHERE ( SELECT COUNT(*) FROM [Weapons] AS [w] @@ -873,7 +873,7 @@ public override async Task Where_any_subquery_without_collision(bool async) 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]) +LEFT JOIN [Officers] AS [o] ON [g].[Nickname] = [o].[Nickname] AND [g].[SquadId] = [o].[SquadId] WHERE EXISTS ( SELECT 1 FROM [Weapons] AS [w] @@ -901,7 +901,7 @@ public override async Task Select_comparison_with_null(bool async) @"@__ammunitionType_0='1' (Nullable = true) SELECT [w].[Id], CASE - WHEN ([w].[AmmunitionType] = @__ammunitionType_0) AND [w].[AmmunitionType] IS NOT NULL THEN CAST(1 AS bit) + WHEN [w].[AmmunitionType] = @__ammunitionType_0 AND [w].[AmmunitionType] IS NOT NULL THEN CAST(1 AS bit) ELSE CAST(0 AS bit) END AS [Cartridge] FROM [Weapons] AS [w] @@ -967,11 +967,11 @@ public override async Task Select_ternary_operation_with_has_value_not_null(bool AssertSql( @"SELECT [w].[Id], CASE - WHEN [w].[AmmunitionType] IS NOT NULL AND ([w].[AmmunitionType] = 1) THEN N'Yes' + WHEN [w].[AmmunitionType] IS NOT NULL AND [w].[AmmunitionType] = 1 THEN N'Yes' ELSE N'No' END AS [IsCartridge] FROM [Weapons] AS [w] -WHERE [w].[AmmunitionType] IS NOT NULL AND ([w].[AmmunitionType] = 1)"); +WHERE [w].[AmmunitionType] IS NOT NULL AND [w].[AmmunitionType] = 1"); } public override async Task Select_ternary_operation_multiple_conditions(bool async) @@ -980,7 +980,7 @@ public override async Task Select_ternary_operation_multiple_conditions(bool asy AssertSql( @"SELECT [w].[Id], CASE - WHEN ([w].[AmmunitionType] = 2) AND ([w].[SynergyWithId] = 1) THEN N'Yes' + WHEN [w].[AmmunitionType] = 2 AND [w].[SynergyWithId] = 1 THEN N'Yes' ELSE N'No' END AS [IsCartridge] FROM [Weapons] AS [w]"); @@ -992,7 +992,7 @@ public override async Task Select_ternary_operation_multiple_conditions_2(bool a AssertSql( @"SELECT [w].[Id], CASE - WHEN ([w].[IsAutomatic] = CAST(0 AS bit)) AND ([w].[SynergyWithId] = 1) THEN N'Yes' + WHEN [w].[IsAutomatic] = CAST(0 AS bit) AND [w].[SynergyWithId] = 1 THEN N'Yes' ELSE N'No' END AS [IsCartridge] FROM [Weapons] AS [w]"); @@ -1004,7 +1004,7 @@ public override async Task Select_multiple_conditions(bool async) AssertSql( @"SELECT [w].[Id], CASE - WHEN ([w].[IsAutomatic] = CAST(0 AS bit)) AND (([w].[SynergyWithId] = 1) AND [w].[SynergyWithId] IS NOT NULL) THEN CAST(1 AS bit) + WHEN [w].[IsAutomatic] = CAST(0 AS bit) AND [w].[SynergyWithId] = 1 AND [w].[SynergyWithId] IS NOT NULL THEN CAST(1 AS bit) ELSE CAST(0 AS bit) END AS [IsCartridge] FROM [Weapons] AS [w]"); @@ -1034,8 +1034,8 @@ public override async Task Null_propagation_optimization1(bool async) 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"); +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"); } public override async Task Null_propagation_optimization2(bool async) @@ -1048,7 +1048,7 @@ public override async Task Null_propagation_optimization2(bool async) 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]) +LEFT JOIN [Officers] AS [o] ON [g].[Nickname] = [o].[Nickname] AND [g].[SquadId] = [o].[SquadId] WHERE CASE WHEN [g].[LeaderNickname] IS NULL THEN NULL ELSE CASE @@ -1068,7 +1068,7 @@ public override async Task Null_propagation_optimization3(bool async) 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]) +LEFT JOIN [Officers] AS [o] ON [g].[Nickname] = [o].[Nickname] AND [g].[SquadId] = [o].[SquadId] WHERE CASE WHEN [g].[LeaderNickname] IS NOT NULL THEN CASE WHEN [g].[LeaderNickname] LIKE N'%us' THEN CAST(1 AS bit) @@ -1088,11 +1088,11 @@ public override async Task Null_propagation_optimization4(bool async) 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 (CASE +LEFT JOIN [Officers] AS [o] ON [g].[Nickname] = [o].[Nickname] AND [g].[SquadId] = [o].[SquadId] +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"); @@ -1108,11 +1108,11 @@ public override async Task Null_propagation_optimization5(bool async) 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 (CASE +LEFT JOIN [Officers] AS [o] ON [g].[Nickname] = [o].[Nickname] AND [g].[SquadId] = [o].[SquadId] +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"); @@ -1128,11 +1128,11 @@ public override async Task Null_propagation_optimization6(bool async) 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 (CASE +LEFT JOIN [Officers] AS [o] ON [g].[Nickname] = [o].[Nickname] AND [g].[SquadId] = [o].[SquadId] +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"); @@ -1294,7 +1294,7 @@ FROM [Tags] AS [t] LEFT JOIN ( SELECT [g].[Nickname], [g].[SquadId], [g].[AssignedCityName] FROM [Gears] AS [g] -) AS [t0] ON ([t].[GearNickName] = [t0].[Nickname]) AND ([t].[GearSquadId] = [t0].[SquadId]) +) AS [t0] ON [t].[GearNickName] = [t0].[Nickname] AND [t].[GearSquadId] = [t0].[SquadId] LEFT JOIN [Squads] AS [s] ON [t0].[SquadId] = [s].[Id] LEFT JOIN [Cities] AS [c] ON [t0].[AssignedCityName] = [c].[Name]"); } @@ -1324,7 +1324,7 @@ FROM [Tags] AS [t] LEFT JOIN ( SELECT [g].[Nickname], [g].[SquadId] FROM [Gears] AS [g] -) AS [t0] ON ([t].[GearNickName] = [t0].[Nickname]) AND ([t].[GearSquadId] = [t0].[SquadId])"); +) AS [t0] ON [t].[GearNickName] = [t0].[Nickname] AND [t].[GearSquadId] = [t0].[SquadId]"); } public override async Task Select_null_propagation_works_for_multiple_navigations_with_composite_keys(bool async) @@ -1340,12 +1340,12 @@ FROM [Tags] AS [t] 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)) +) 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 ( SELECT [g0].[Nickname], [g0].[SquadId], [g0].[AssignedCityName] FROM [Gears] AS [g0] -) AS [t2] ON ([t1].[GearNickName] = [t2].[Nickname]) AND ([t1].[GearSquadId] = [t2].[SquadId]) +) AS [t2] ON [t1].[GearNickName] = [t2].[Nickname] AND [t1].[GearSquadId] = [t2].[SquadId] LEFT JOIN [Cities] AS [c] ON [t2].[AssignedCityName] = [c].[Name]"); } @@ -1456,12 +1456,12 @@ CROSS JOIN [Tags] AS [t0] LEFT JOIN ( SELECT [g].[Nickname], [g].[SquadId] FROM [Gears] AS [g] -) AS [t1] ON ([t].[GearNickName] = [t1].[Nickname]) AND ([t].[GearSquadId] = [t1].[SquadId]) +) AS [t1] ON [t].[GearNickName] = [t1].[Nickname] AND [t].[GearSquadId] = [t1].[SquadId] 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)"); +) 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)"); } public override async Task Select_Singleton_Navigation_With_Member_Access(bool async) @@ -1476,9 +1476,9 @@ LEFT JOIN ( 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]) -WHERE ([t0].[Nickname] = N'Marcus') AND (([t0].[CityOfBirthName] <> N'Ephyra') OR [t0].[CityOfBirthName] IS NULL)"); + 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)"); } public override async Task Select_Where_Navigation(bool async) @@ -1491,7 +1491,7 @@ FROM [Tags] AS [t] LEFT JOIN ( SELECT [g].[Nickname], [g].[SquadId] FROM [Gears] AS [g] -) AS [t0] ON ([t].[GearNickName] = [t0].[Nickname]) AND ([t].[GearSquadId] = [t0].[SquadId]) +) AS [t0] ON [t].[GearNickName] = [t0].[Nickname] AND [t].[GearSquadId] = [t0].[SquadId] WHERE [t0].[Nickname] = N'Marcus'"); } @@ -1506,12 +1506,12 @@ CROSS JOIN [Tags] AS [t0] LEFT JOIN ( SELECT [g].[Nickname], [g].[SquadId] FROM [Gears] AS [g] -) AS [t1] ON ([t].[GearNickName] = [t1].[Nickname]) AND ([t].[GearSquadId] = [t1].[SquadId]) +) AS [t1] ON [t].[GearNickName] = [t1].[Nickname] AND [t].[GearSquadId] = [t1].[SquadId] 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))"); +) 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))"); } public override async Task Select_Where_Navigation_Null(bool async) @@ -1524,7 +1524,7 @@ FROM [Tags] AS [t] LEFT JOIN ( SELECT [g].[Nickname], [g].[SquadId] FROM [Gears] AS [g] -) AS [t0] ON ([t].[GearNickName] = [t0].[Nickname]) AND ([t].[GearSquadId] = [t0].[SquadId]) +) AS [t0] ON [t].[GearNickName] = [t0].[Nickname] AND [t].[GearSquadId] = [t0].[SquadId] WHERE [t0].[Nickname] IS NULL OR [t0].[SquadId] IS NULL"); } @@ -1538,7 +1538,7 @@ FROM [Tags] AS [t] LEFT JOIN ( SELECT [g].[Nickname], [g].[SquadId] FROM [Gears] AS [g] -) AS [t0] ON ([t].[GearNickName] = [t0].[Nickname]) AND ([t].[GearSquadId] = [t0].[SquadId]) +) AS [t0] ON [t].[GearNickName] = [t0].[Nickname] AND [t].[GearSquadId] = [t0].[SquadId] WHERE [t0].[Nickname] IS NULL OR [t0].[SquadId] IS NULL"); } @@ -1553,12 +1553,12 @@ CROSS JOIN [Tags] AS [t0] LEFT JOIN ( SELECT [g].[Nickname], [g].[SquadId] FROM [Gears] AS [g] -) AS [t1] ON ([t].[GearNickName] = [t1].[Nickname]) AND ([t].[GearSquadId] = [t1].[SquadId]) +) AS [t1] ON [t].[GearNickName] = [t1].[Nickname] AND [t].[GearSquadId] = [t1].[SquadId] 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)"); +) 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)"); } public override async Task Optional_Navigation_Null_Coalesce_To_Clr_Type(bool async) @@ -1581,7 +1581,7 @@ public override async Task Where_subquery_boolean(bool async) 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]) +LEFT JOIN [Officers] AS [o] ON [g].[Nickname] = [o].[Nickname] AND [g].[SquadId] = [o].[SquadId] WHERE COALESCE(( SELECT TOP(1) [w].[IsAutomatic] FROM [Weapons] AS [w] @@ -1598,7 +1598,7 @@ public override async Task Where_subquery_boolean_with_pushdown(bool async) 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]) +LEFT JOIN [Officers] AS [o] ON [g].[Nickname] = [o].[Nickname] AND [g].[SquadId] = [o].[SquadId] WHERE ( SELECT TOP(1) [w].[IsAutomatic] FROM [Weapons] AS [w] @@ -1615,15 +1615,15 @@ public override async Task Where_subquery_distinct_firstordefault_boolean(bool a 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].[HasSoulPatch] = CAST(1 AS bit)) AND (COALESCE(( +LEFT JOIN [Officers] AS [o] ON [g].[Nickname] = [o].[Nickname] AND [g].[SquadId] = [o].[SquadId] +WHERE [g].[HasSoulPatch] = CAST(1 AS bit) AND COALESCE(( SELECT TOP(1) [t].[IsAutomatic] FROM ( SELECT DISTINCT [w].[Id], [w].[AmmunitionType], [w].[IsAutomatic], [w].[Name], [w].[OwnerFullName], [w].[SynergyWithId] FROM [Weapons] AS [w] WHERE [g].[FullName] = [w].[OwnerFullName] ) AS [t] - ORDER BY [t].[Id]), CAST(0 AS bit)) = CAST(1 AS bit))"); + ORDER BY [t].[Id]), CAST(0 AS bit)) = CAST(1 AS bit)"); } public override async Task Where_subquery_distinct_firstordefault_boolean_with_pushdown(bool async) @@ -1635,15 +1635,15 @@ public override async Task Where_subquery_distinct_firstordefault_boolean_with_p 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].[HasSoulPatch] = CAST(1 AS bit)) AND (( +LEFT JOIN [Officers] AS [o] ON [g].[Nickname] = [o].[Nickname] AND [g].[SquadId] = [o].[SquadId] +WHERE [g].[HasSoulPatch] = CAST(1 AS bit) AND ( SELECT TOP(1) [t].[IsAutomatic] FROM ( SELECT DISTINCT [w].[Id], [w].[AmmunitionType], [w].[IsAutomatic], [w].[Name], [w].[OwnerFullName], [w].[SynergyWithId] FROM [Weapons] AS [w] WHERE [g].[FullName] = [w].[OwnerFullName] ) AS [t] - ORDER BY [t].[Id]) = CAST(1 AS bit))"); + ORDER BY [t].[Id]) = CAST(1 AS bit)"); } public override async Task Where_subquery_distinct_first_boolean(bool async) @@ -1655,15 +1655,15 @@ public override async Task Where_subquery_distinct_first_boolean(bool async) 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].[HasSoulPatch] = CAST(1 AS bit)) AND (( +LEFT JOIN [Officers] AS [o] ON [g].[Nickname] = [o].[Nickname] AND [g].[SquadId] = [o].[SquadId] +WHERE [g].[HasSoulPatch] = CAST(1 AS bit) AND ( SELECT TOP(1) [t].[IsAutomatic] FROM ( SELECT DISTINCT [w].[Id], [w].[AmmunitionType], [w].[IsAutomatic], [w].[Name], [w].[OwnerFullName], [w].[SynergyWithId] FROM [Weapons] AS [w] WHERE [g].[FullName] = [w].[OwnerFullName] ) AS [t] - ORDER BY [t].[Id]) = CAST(1 AS bit)) + ORDER BY [t].[Id]) = CAST(1 AS bit) ORDER BY [g].[Nickname]"); } @@ -1676,14 +1676,14 @@ public override async Task Where_subquery_distinct_singleordefault_boolean1(bool 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].[HasSoulPatch] = CAST(1 AS bit)) AND (COALESCE(( +LEFT JOIN [Officers] AS [o] ON [g].[Nickname] = [o].[Nickname] AND [g].[SquadId] = [o].[SquadId] +WHERE [g].[HasSoulPatch] = CAST(1 AS bit) AND COALESCE(( SELECT TOP(1) [t].[IsAutomatic] FROM ( SELECT DISTINCT [w].[Id], [w].[AmmunitionType], [w].[IsAutomatic], [w].[Name], [w].[OwnerFullName], [w].[SynergyWithId] FROM [Weapons] AS [w] - WHERE ([g].[FullName] = [w].[OwnerFullName]) AND ([w].[Name] LIKE N'%Lancer%') - ) AS [t]), CAST(0 AS bit)) = CAST(1 AS bit)) + WHERE [g].[FullName] = [w].[OwnerFullName] AND ([w].[Name] LIKE N'%Lancer%') + ) AS [t]), CAST(0 AS bit)) = CAST(1 AS bit) ORDER BY [g].[Nickname]"); } @@ -1696,11 +1696,11 @@ public override async Task Where_subquery_distinct_singleordefault_boolean2(bool 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].[HasSoulPatch] = CAST(1 AS bit)) AND (COALESCE(( +LEFT JOIN [Officers] AS [o] ON [g].[Nickname] = [o].[Nickname] AND [g].[SquadId] = [o].[SquadId] +WHERE [g].[HasSoulPatch] = CAST(1 AS bit) AND COALESCE(( SELECT DISTINCT TOP(1) [w].[IsAutomatic] FROM [Weapons] AS [w] - WHERE ([g].[FullName] = [w].[OwnerFullName]) AND ([w].[Name] LIKE N'%Lancer%')), CAST(0 AS bit)) = CAST(1 AS bit)) + WHERE [g].[FullName] = [w].[OwnerFullName] AND ([w].[Name] LIKE N'%Lancer%')), CAST(0 AS bit)) = CAST(1 AS bit) ORDER BY [g].[Nickname]"); } @@ -1713,14 +1713,14 @@ public override async Task Where_subquery_distinct_singleordefault_boolean_with_ 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].[HasSoulPatch] = CAST(1 AS bit)) AND (( +LEFT JOIN [Officers] AS [o] ON [g].[Nickname] = [o].[Nickname] AND [g].[SquadId] = [o].[SquadId] +WHERE [g].[HasSoulPatch] = CAST(1 AS bit) AND ( SELECT TOP(1) [t].[IsAutomatic] FROM ( SELECT DISTINCT [w].[Id], [w].[AmmunitionType], [w].[IsAutomatic], [w].[Name], [w].[OwnerFullName], [w].[SynergyWithId] FROM [Weapons] AS [w] - WHERE ([g].[FullName] = [w].[OwnerFullName]) AND ([w].[Name] LIKE N'%Lancer%') - ) AS [t]) = CAST(1 AS bit)) + WHERE [g].[FullName] = [w].[OwnerFullName] AND ([w].[Name] LIKE N'%Lancer%') + ) AS [t]) = CAST(1 AS bit) ORDER BY [g].[Nickname]"); } @@ -1733,7 +1733,7 @@ public override async Task Where_subquery_distinct_lastordefault_boolean(bool as 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]) +LEFT JOIN [Officers] AS [o] ON [g].[Nickname] = [o].[Nickname] AND [g].[SquadId] = [o].[SquadId] WHERE ( SELECT TOP(1) [t].[IsAutomatic] FROM ( @@ -1754,15 +1754,15 @@ public override async Task Where_subquery_distinct_last_boolean(bool async) 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].[HasSoulPatch] = CAST(0 AS bit)) AND (( +LEFT JOIN [Officers] AS [o] ON [g].[Nickname] = [o].[Nickname] AND [g].[SquadId] = [o].[SquadId] +WHERE [g].[HasSoulPatch] = CAST(0 AS bit) AND ( SELECT TOP(1) [t].[IsAutomatic] FROM ( SELECT DISTINCT [w].[Id], [w].[AmmunitionType], [w].[IsAutomatic], [w].[Name], [w].[OwnerFullName], [w].[SynergyWithId] FROM [Weapons] AS [w] WHERE [g].[FullName] = [w].[OwnerFullName] ) AS [t] - ORDER BY [t].[Id] DESC) = CAST(1 AS bit)) + ORDER BY [t].[Id] DESC) = CAST(1 AS bit) ORDER BY [g].[Nickname]"); } @@ -1775,15 +1775,15 @@ public override async Task Where_subquery_distinct_orderby_firstordefault_boolea 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].[HasSoulPatch] = CAST(1 AS bit)) AND (COALESCE(( +LEFT JOIN [Officers] AS [o] ON [g].[Nickname] = [o].[Nickname] AND [g].[SquadId] = [o].[SquadId] +WHERE [g].[HasSoulPatch] = CAST(1 AS bit) AND COALESCE(( SELECT TOP(1) [t].[IsAutomatic] FROM ( SELECT DISTINCT [w].[Id], [w].[AmmunitionType], [w].[IsAutomatic], [w].[Name], [w].[OwnerFullName], [w].[SynergyWithId] FROM [Weapons] AS [w] WHERE [g].[FullName] = [w].[OwnerFullName] ) AS [t] - ORDER BY [t].[Id]), CAST(0 AS bit)) = CAST(1 AS bit))"); + ORDER BY [t].[Id]), CAST(0 AS bit)) = CAST(1 AS bit)"); } public override async Task Where_subquery_distinct_orderby_firstordefault_boolean_with_pushdown(bool async) @@ -1795,15 +1795,15 @@ public override async Task Where_subquery_distinct_orderby_firstordefault_boolea 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].[HasSoulPatch] = CAST(1 AS bit)) AND (( +LEFT JOIN [Officers] AS [o] ON [g].[Nickname] = [o].[Nickname] AND [g].[SquadId] = [o].[SquadId] +WHERE [g].[HasSoulPatch] = CAST(1 AS bit) AND ( SELECT TOP(1) [t].[IsAutomatic] FROM ( SELECT DISTINCT [w].[Id], [w].[AmmunitionType], [w].[IsAutomatic], [w].[Name], [w].[OwnerFullName], [w].[SynergyWithId] FROM [Weapons] AS [w] WHERE [g].[FullName] = [w].[OwnerFullName] ) AS [t] - ORDER BY [t].[Id]) = CAST(1 AS bit))"); + ORDER BY [t].[Id]) = CAST(1 AS bit)"); } public override async Task Where_subquery_union_firstordefault_boolean(bool async) @@ -1815,8 +1815,8 @@ public override async Task Where_subquery_union_firstordefault_boolean(bool asyn 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].[HasSoulPatch] = CAST(1 AS bit)) AND (( +LEFT JOIN [Officers] AS [o] ON [g].[Nickname] = [o].[Nickname] AND [g].[SquadId] = [o].[SquadId] +WHERE [g].[HasSoulPatch] = CAST(1 AS bit) AND ( SELECT TOP(1) [t].[IsAutomatic] FROM ( SELECT [w].[Id], [w].[AmmunitionType], [w].[IsAutomatic], [w].[Name], [w].[OwnerFullName], [w].[SynergyWithId] @@ -1827,7 +1827,7 @@ FROM [Weapons] AS [w] FROM [Weapons] AS [w0] WHERE [g].[FullName] = [w0].[OwnerFullName] ) AS [t] - ORDER BY [t].[Id]) = CAST(1 AS bit))"); + ORDER BY [t].[Id]) = CAST(1 AS bit)"); } public override async Task Where_subquery_join_firstordefault_boolean(bool async) @@ -1839,8 +1839,8 @@ public override async Task Where_subquery_join_firstordefault_boolean(bool async 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].[HasSoulPatch] = CAST(1 AS bit)) AND (( +LEFT JOIN [Officers] AS [o] ON [g].[Nickname] = [o].[Nickname] AND [g].[SquadId] = [o].[SquadId] +WHERE [g].[HasSoulPatch] = CAST(1 AS bit) AND ( SELECT TOP(1) [w].[IsAutomatic] FROM [Weapons] AS [w] INNER JOIN ( @@ -1849,7 +1849,7 @@ FROM [Weapons] AS [w0] WHERE [g].[FullName] = [w0].[OwnerFullName] ) AS [t] ON [w].[Id] = [t].[Id] WHERE [g].[FullName] = [w].[OwnerFullName] - ORDER BY [w].[Id]) = CAST(1 AS bit))"); + ORDER BY [w].[Id]) = CAST(1 AS bit)"); } public override async Task Where_subquery_left_join_firstordefault_boolean(bool async) @@ -1861,8 +1861,8 @@ public override async Task Where_subquery_left_join_firstordefault_boolean(bool 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].[HasSoulPatch] = CAST(1 AS bit)) AND (( +LEFT JOIN [Officers] AS [o] ON [g].[Nickname] = [o].[Nickname] AND [g].[SquadId] = [o].[SquadId] +WHERE [g].[HasSoulPatch] = CAST(1 AS bit) AND ( SELECT TOP(1) [w].[IsAutomatic] FROM [Weapons] AS [w] LEFT JOIN ( @@ -1871,7 +1871,7 @@ FROM [Weapons] AS [w0] WHERE [g].[FullName] = [w0].[OwnerFullName] ) AS [t] ON [w].[Id] = [t].[Id] WHERE [g].[FullName] = [w].[OwnerFullName] - ORDER BY [w].[Id]) = CAST(1 AS bit))"); + ORDER BY [w].[Id]) = CAST(1 AS bit)"); } public override async Task Where_subquery_concat_firstordefault_boolean(bool async) @@ -1883,8 +1883,8 @@ public override async Task Where_subquery_concat_firstordefault_boolean(bool asy 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].[HasSoulPatch] = CAST(1 AS bit)) AND (( +LEFT JOIN [Officers] AS [o] ON [g].[Nickname] = [o].[Nickname] AND [g].[SquadId] = [o].[SquadId] +WHERE [g].[HasSoulPatch] = CAST(1 AS bit) AND ( SELECT TOP(1) [t].[IsAutomatic] FROM ( SELECT [w].[Id], [w].[AmmunitionType], [w].[IsAutomatic], [w].[Name], [w].[OwnerFullName], [w].[SynergyWithId] @@ -1895,7 +1895,7 @@ UNION ALL FROM [Weapons] AS [w0] WHERE [g].[FullName] = [w0].[OwnerFullName] ) AS [t] - ORDER BY [t].[Id]) = CAST(1 AS bit))"); + ORDER BY [t].[Id]) = CAST(1 AS bit)"); } public override async Task Concat_with_count(bool async) @@ -1909,13 +1909,13 @@ public override async Task Concat_with_count(bool async) 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]) + LEFT JOIN [Officers] AS [o] ON [g].[Nickname] = [o].[Nickname] AND [g].[SquadId] = [o].[SquadId] UNION ALL SELECT [g0].[Nickname], [g0].[SquadId], [g0].[AssignedCityName], [g0].[CityOfBirthName], [g0].[FullName], [g0].[HasSoulPatch], [g0].[LeaderNickname], [g0].[LeaderSquadId], [g0].[Rank], CASE 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]) + LEFT JOIN [Officers] AS [o0] ON [g0].[Nickname] = [o0].[Nickname] AND [g0].[SquadId] = [o0].[SquadId] ) AS [t]"); } @@ -1928,11 +1928,11 @@ public override async Task Concat_scalars_with_count(bool async) FROM ( SELECT [g].[Nickname] FROM [Gears] AS [g] - LEFT JOIN [Officers] AS [o] ON ([g].[Nickname] = [o].[Nickname]) AND ([g].[SquadId] = [o].[SquadId]) + LEFT JOIN [Officers] AS [o] ON [g].[Nickname] = [o].[Nickname] AND [g].[SquadId] = [o].[SquadId] UNION ALL SELECT [g0].[FullName] AS [Nickname] FROM [Gears] AS [g0] - LEFT JOIN [Officers] AS [o0] ON ([g0].[Nickname] = [o0].[Nickname]) AND ([g0].[SquadId] = [o0].[SquadId]) + LEFT JOIN [Officers] AS [o0] ON [g0].[Nickname] = [o0].[Nickname] AND [g0].[SquadId] = [o0].[SquadId] ) AS [t]"); } @@ -1947,13 +1947,13 @@ public override async Task Concat_anonymous_with_count(bool async) WHEN [o].[Nickname] IS NOT NULL THEN N'Officer' END AS [Discriminator], [g].[Nickname] AS [Name] FROM [Gears] AS [g] - LEFT JOIN [Officers] AS [o] ON ([g].[Nickname] = [o].[Nickname]) AND ([g].[SquadId] = [o].[SquadId]) + LEFT JOIN [Officers] AS [o] ON [g].[Nickname] = [o].[Nickname] AND [g].[SquadId] = [o].[SquadId] UNION ALL SELECT [g0].[Nickname], [g0].[SquadId], [g0].[AssignedCityName], [g0].[CityOfBirthName], [g0].[FullName], [g0].[HasSoulPatch], [g0].[LeaderNickname], [g0].[LeaderSquadId], [g0].[Rank], CASE WHEN [o0].[Nickname] IS NOT NULL THEN N'Officer' END AS [Discriminator], [g0].[FullName] AS [Name] FROM [Gears] AS [g0] - LEFT JOIN [Officers] AS [o0] ON ([g0].[Nickname] = [o0].[Nickname]) AND ([g0].[SquadId] = [o0].[SquadId]) + LEFT JOIN [Officers] AS [o0] ON [g0].[Nickname] = [o0].[Nickname] AND [g0].[SquadId] = [o0].[SquadId] ) AS [t]"); } @@ -1968,13 +1968,13 @@ public override async Task Concat_with_scalar_projection(bool async) 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]) + LEFT JOIN [Officers] AS [o] ON [g].[Nickname] = [o].[Nickname] AND [g].[SquadId] = [o].[SquadId] UNION ALL SELECT [g0].[Nickname], [g0].[SquadId], [g0].[AssignedCityName], [g0].[CityOfBirthName], [g0].[FullName], [g0].[HasSoulPatch], [g0].[LeaderNickname], [g0].[LeaderSquadId], [g0].[Rank], CASE 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]) + LEFT JOIN [Officers] AS [o0] ON [g0].[Nickname] = [o0].[Nickname] AND [g0].[SquadId] = [o0].[SquadId] ) AS [t]"); } @@ -2030,18 +2030,18 @@ SELECT COUNT(*) 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]) - WHERE ([g].[Nickname] = [g0].[LeaderNickname]) AND ([g].[SquadId] = [g0].[LeaderSquadId]) + LEFT JOIN [Officers] AS [o0] ON [g0].[Nickname] = [o0].[Nickname] AND [g0].[SquadId] = [o0].[SquadId] + WHERE [g].[Nickname] = [g0].[LeaderNickname] AND [g].[SquadId] = [g0].[LeaderSquadId] UNION SELECT [g1].[Nickname], [g1].[SquadId], [g1].[AssignedCityName], [g1].[CityOfBirthName], [g1].[FullName], [g1].[HasSoulPatch], [g1].[LeaderNickname], [g1].[LeaderSquadId], [g1].[Rank], CASE WHEN [o1].[Nickname] IS NOT NULL THEN N'Officer' END AS [Discriminator] FROM [Gears] AS [g1] - LEFT JOIN [Officers] AS [o1] ON ([g1].[Nickname] = [o1].[Nickname]) AND ([g1].[SquadId] = [o1].[SquadId]) - WHERE ([g].[Nickname] = [g1].[LeaderNickname]) AND ([g].[SquadId] = [g1].[LeaderSquadId]) + LEFT JOIN [Officers] AS [o1] ON [g1].[Nickname] = [o1].[Nickname] AND [g1].[SquadId] = [o1].[SquadId] + WHERE [g].[Nickname] = [g1].[LeaderNickname] AND [g].[SquadId] = [g1].[LeaderSquadId] ) AS [t]) FROM [Gears] AS [g] -LEFT JOIN [Officers] AS [o] ON ([g].[Nickname] = [o].[Nickname]) AND ([g].[SquadId] = [o].[SquadId]) +LEFT JOIN [Officers] AS [o] ON [g].[Nickname] = [o].[Nickname] AND [g].[SquadId] = [o].[SquadId] WHERE [o].[Nickname] IS NOT NULL"); } @@ -2072,8 +2072,8 @@ FROM [Tags] AS [t] 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)"); +) 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)"); } public override async Task GroupJoin_Composite_Key(bool async) @@ -2088,8 +2088,8 @@ INNER JOIN ( 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])"); + 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]"); } public override async Task Join_navigation_translated_to_subquery_composite_key(bool async) @@ -2105,7 +2105,7 @@ FROM [Tags] AS [t] LEFT JOIN ( SELECT [g0].[Nickname], [g0].[SquadId], [g0].[FullName] FROM [Gears] AS [g0] - ) AS [t0] ON ([t].[GearNickName] = [t0].[Nickname]) AND ([t].[GearSquadId] = [t0].[SquadId]) + ) AS [t0] ON [t].[GearNickName] = [t0].[Nickname] AND [t].[GearSquadId] = [t0].[SquadId] ) AS [t1] ON [g].[FullName] = [t1].[FullName]"); } @@ -2122,7 +2122,7 @@ FROM [Tags] AS [t] LEFT JOIN ( SELECT [g0].[Nickname], [g0].[SquadId], [g0].[FullName] FROM [Gears] AS [g0] - ) AS [t0] ON ([t].[GearNickName] = [t0].[Nickname]) AND ([t].[GearSquadId] = [t0].[SquadId]) + ) AS [t0] ON [t].[GearNickName] = [t0].[Nickname] AND [t].[GearSquadId] = [t0].[SquadId] ) AS [t1] ON [g].[FullName] = [t1].[FullName]"); } @@ -2162,10 +2162,10 @@ INNER JOIN ( 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]) + LEFT JOIN [Officers] AS [o] ON [g].[Nickname] = [o].[Nickname] AND [g].[SquadId] = [o].[SquadId] WHERE [o].[Nickname] IS NOT NULL -) AS [t0] ON ([t].[GearSquadId] = [t0].[SquadId]) AND ([t].[GearNickName] = [t0].[Nickname]) -LEFT JOIN [Tags] AS [t1] ON ([t0].[Nickname] = [t1].[GearNickName]) AND ([t0].[SquadId] = [t1].[GearSquadId])"); +) AS [t0] ON [t].[GearSquadId] = [t0].[SquadId] AND [t].[GearNickName] = [t0].[Nickname] +LEFT JOIN [Tags] AS [t1] ON [t0].[Nickname] = [t1].[GearNickName] AND [t0].[SquadId] = [t1].[GearSquadId]"); } public override async Task Collection_with_inheritance_and_join_include_source(bool async) @@ -2177,9 +2177,9 @@ public override async Task Collection_with_inheritance_and_join_include_source(b WHEN [o].[Nickname] IS NOT NULL THEN N'Officer' END AS [Discriminator], [t0].[Id], [t0].[GearNickName], [t0].[GearSquadId], [t0].[IssueDate], [t0].[Note] FROM [Gears] AS [g] -LEFT JOIN [Officers] AS [o] ON ([g].[Nickname] = [o].[Nickname]) AND ([g].[SquadId] = [o].[SquadId]) -INNER JOIN [Tags] AS [t] ON ([g].[SquadId] = [t].[GearSquadId]) AND ([g].[Nickname] = [t].[GearNickName]) -LEFT JOIN [Tags] AS [t0] ON ([g].[Nickname] = [t0].[GearNickName]) AND ([g].[SquadId] = [t0].[GearSquadId]) +LEFT JOIN [Officers] AS [o] ON [g].[Nickname] = [o].[Nickname] AND [g].[SquadId] = [o].[SquadId] +INNER JOIN [Tags] AS [t] ON [g].[SquadId] = [t].[GearSquadId] AND [g].[Nickname] = [t].[GearNickName] +LEFT JOIN [Tags] AS [t0] ON [g].[Nickname] = [t0].[GearNickName] AND [g].[SquadId] = [t0].[GearSquadId] WHERE [o].[Nickname] IS NOT NULL"); } @@ -2232,11 +2232,11 @@ public override async Task Non_unicode_string_literals_is_used_for_non_unicode_c AssertSql( @"SELECT [c].[Name], [c].[Location], [c].[Nation] FROM [Cities] AS [c] -WHERE ([c].[Location] = 'Unknown') AND (( +WHERE [c].[Location] = 'Unknown' AND ( SELECT COUNT(*) 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 ([g].[Nickname] = N'Paduk')) = 1)"); + LEFT JOIN [Officers] AS [o] ON [g].[Nickname] = [o].[Nickname] AND [g].[SquadId] = [o].[SquadId] + WHERE [c].[Name] = [g].[CityOfBirthName] AND [g].[Nickname] = N'Paduk') = 1"); } public override async Task Non_unicode_string_literals_is_used_for_non_unicode_column_in_subquery(bool async) @@ -2248,9 +2248,9 @@ public override async Task Non_unicode_string_literals_is_used_for_non_unicode_c 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]) +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] -WHERE ([g].[Nickname] = N'Marcus') AND ([c].[Location] = 'Jacinto''s location')"); +WHERE [g].[Nickname] = N'Marcus' AND [c].[Location] = 'Jacinto''s location'"); } public override async Task Non_unicode_string_literals_is_used_for_non_unicode_column_with_contains(bool async) @@ -2283,13 +2283,13 @@ public override void Include_on_GroupJoin_SelectMany_DefaultIfEmpty_with_coalesc 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 [Officers] AS [o] ON [g].[Nickname] = [o].[Nickname] AND [g].[SquadId] = [o].[SquadId] LEFT JOIN ( SELECT [g0].[Nickname], [g0].[SquadId], [g0].[AssignedCityName], [g0].[CityOfBirthName], [g0].[FullName], [g0].[HasSoulPatch], [g0].[LeaderNickname], [g0].[LeaderSquadId], [g0].[Rank], CASE 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]) + LEFT JOIN [Officers] AS [o0] ON [g0].[Nickname] = [o0].[Nickname] AND [g0].[SquadId] = [o0].[SquadId] ) AS [t] ON [g].[LeaderNickname] = [t].[Nickname] LEFT JOIN [Weapons] AS [w] ON [g].[FullName] = [w].[OwnerFullName] ORDER BY [g].[Nickname], [g].[SquadId], [t].[Nickname], [t].[SquadId]"); @@ -2305,13 +2305,13 @@ public override void Include_on_GroupJoin_SelectMany_DefaultIfEmpty_with_coalesc 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]) +LEFT JOIN [Officers] AS [o] ON [g].[Nickname] = [o].[Nickname] AND [g].[SquadId] = [o].[SquadId] LEFT JOIN ( SELECT [g0].[Nickname], [g0].[SquadId], [g0].[AssignedCityName], [g0].[CityOfBirthName], [g0].[FullName], [g0].[HasSoulPatch], [g0].[LeaderNickname], [g0].[LeaderSquadId], [g0].[Rank], CASE 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]) + LEFT JOIN [Officers] AS [o0] ON [g0].[Nickname] = [o0].[Nickname] AND [g0].[SquadId] = [o0].[SquadId] ) AS [t] ON [g].[LeaderNickname] = [t].[Nickname] LEFT JOIN [Weapons] AS [w] ON [t].[FullName] = [w].[OwnerFullName] ORDER BY [g].[Nickname], [g].[SquadId], [t].[Nickname], [t].[SquadId]"); @@ -2327,13 +2327,13 @@ public override async Task Include_on_GroupJoin_SelectMany_DefaultIfEmpty_with_c WHEN [o].[Nickname] IS NOT NULL THEN N'Officer' END AS [Discriminator], [w0].[Id], [w0].[AmmunitionType], [w0].[IsAutomatic], [w0].[Name], [w0].[OwnerFullName], [w0].[SynergyWithId] FROM [Gears] AS [g] -LEFT JOIN [Officers] AS [o] ON ([g].[Nickname] = [o].[Nickname]) AND ([g].[SquadId] = [o].[SquadId]) +LEFT JOIN [Officers] AS [o] ON [g].[Nickname] = [o].[Nickname] AND [g].[SquadId] = [o].[SquadId] LEFT JOIN ( SELECT [g0].[Nickname], [g0].[SquadId], [g0].[AssignedCityName], [g0].[CityOfBirthName], [g0].[FullName], [g0].[HasSoulPatch], [g0].[LeaderNickname], [g0].[LeaderSquadId], [g0].[Rank], CASE 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]) + LEFT JOIN [Officers] AS [o0] ON [g0].[Nickname] = [o0].[Nickname] AND [g0].[SquadId] = [o0].[SquadId] ) AS [t] ON [g].[LeaderNickname] = [t].[Nickname] LEFT JOIN [Weapons] AS [w] ON [t].[FullName] = [w].[OwnerFullName] LEFT JOIN [Weapons] AS [w0] ON [g].[FullName] = [w0].[OwnerFullName] @@ -2395,13 +2395,13 @@ public override async Task Include_on_GroupJoin_SelectMany_DefaultIfEmpty_with_i WHEN [o].[Nickname] IS NOT NULL THEN N'Officer' END AS [Discriminator], [w0].[Id], [w0].[AmmunitionType], [w0].[IsAutomatic], [w0].[Name], [w0].[OwnerFullName], [w0].[SynergyWithId] FROM [Gears] AS [g] -LEFT JOIN [Officers] AS [o] ON ([g].[Nickname] = [o].[Nickname]) AND ([g].[SquadId] = [o].[SquadId]) +LEFT JOIN [Officers] AS [o] ON [g].[Nickname] = [o].[Nickname] AND [g].[SquadId] = [o].[SquadId] LEFT JOIN ( SELECT [g0].[Nickname], [g0].[SquadId], [g0].[AssignedCityName], [g0].[CityOfBirthName], [g0].[FullName], [g0].[HasSoulPatch], [g0].[LeaderNickname], [g0].[LeaderSquadId], [g0].[Rank], CASE 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]) + LEFT JOIN [Officers] AS [o0] ON [g0].[Nickname] = [o0].[Nickname] AND [g0].[SquadId] = [o0].[SquadId] WHERE [o0].[Nickname] IS NOT NULL ) AS [t] ON [g].[LeaderNickname] = [t].[Nickname] LEFT JOIN [Weapons] AS [w] ON [t].[FullName] = [w].[OwnerFullName] @@ -2487,7 +2487,7 @@ public override async Task Coalesce_operator_in_predicate_with_other_conditions( AssertSql( @"SELECT [w].[Id], [w].[AmmunitionType], [w].[IsAutomatic], [w].[Name], [w].[OwnerFullName], [w].[SynergyWithId] FROM [Weapons] AS [w] -WHERE ([w].[AmmunitionType] = 1) AND (COALESCE([w].[IsAutomatic], CAST(0 AS bit)) = CAST(1 AS bit))"); +WHERE [w].[AmmunitionType] = 1 AND COALESCE([w].[IsAutomatic], CAST(0 AS bit)) = CAST(1 AS bit)"); } public override async Task Coalesce_operator_in_projection_with_other_conditions(bool async) @@ -2496,7 +2496,7 @@ public override async Task Coalesce_operator_in_projection_with_other_conditions AssertSql( @"SELECT CASE - WHEN (([w].[AmmunitionType] = 1) AND [w].[AmmunitionType] IS NOT NULL) AND (COALESCE([w].[IsAutomatic], CAST(0 AS bit)) = CAST(1 AS bit)) THEN CAST(1 AS bit) + WHEN [w].[AmmunitionType] = 1 AND [w].[AmmunitionType] IS NOT NULL AND COALESCE([w].[IsAutomatic], CAST(0 AS bit)) = CAST(1 AS bit) THEN CAST(1 AS bit) ELSE CAST(0 AS bit) END FROM [Weapons] AS [w]"); @@ -2512,8 +2512,8 @@ FROM [Tags] AS [t] 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))"); +) 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)"); } public override async Task Optional_navigation_type_compensation_works_with_predicate2(bool async) @@ -2526,7 +2526,7 @@ FROM [Tags] AS [t] 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]) +) AS [t0] ON [t].[GearNickName] = [t0].[Nickname] AND [t].[GearSquadId] = [t0].[SquadId] WHERE [t0].[HasSoulPatch] = CAST(1 AS bit)"); } @@ -2540,7 +2540,7 @@ FROM [Tags] AS [t] 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]) +) AS [t0] ON [t].[GearNickName] = [t0].[Nickname] AND [t].[GearSquadId] = [t0].[SquadId] WHERE [t0].[HasSoulPatch] = CAST(0 AS bit)"); } @@ -2554,7 +2554,7 @@ FROM [Tags] AS [t] 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]) +) AS [t0] ON [t].[GearNickName] = [t0].[Nickname] AND [t].[GearSquadId] = [t0].[SquadId] WHERE CASE WHEN [t0].[HasSoulPatch] = CAST(1 AS bit) THEN CAST(1 AS bit) ELSE [t0].[HasSoulPatch] @@ -2571,7 +2571,7 @@ FROM [Tags] AS [t] 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]) +) AS [t0] ON [t].[GearNickName] = [t0].[Nickname] AND [t].[GearSquadId] = [t0].[SquadId] WHERE CASE WHEN [t0].[HasSoulPatch] = CAST(0 AS bit) THEN CAST(0 AS bit) ELSE [t0].[HasSoulPatch] @@ -2588,7 +2588,7 @@ FROM [Tags] AS [t] 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]) +) AS [t0] ON [t].[GearNickName] = [t0].[Nickname] AND [t].[GearSquadId] = [t0].[SquadId] WHERE CASE WHEN [t0].[HasSoulPatch] = CAST(1 AS bit) THEN CAST(1 AS bit) ELSE CAST(0 AS bit) @@ -2605,8 +2605,8 @@ FROM [Tags] AS [t] 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 ([t0].[HasSoulPatch] = CAST(1 AS bit)) OR ([t].[Note] LIKE N'%Cole%')"); +) AS [t0] ON [t].[GearNickName] = [t0].[Nickname] AND [t].[GearSquadId] = [t0].[SquadId] +WHERE [t0].[HasSoulPatch] = CAST(1 AS bit) OR ([t].[Note] LIKE N'%Cole%')"); } public override async Task Optional_navigation_type_compensation_works_with_binary_and_expression(bool async) @@ -2615,14 +2615,14 @@ public override async Task Optional_navigation_type_compensation_works_with_bina AssertSql( @"SELECT CASE - WHEN ([t0].[HasSoulPatch] = CAST(1 AS bit)) AND ([t].[Note] LIKE N'%Cole%') THEN CAST(1 AS bit) + WHEN [t0].[HasSoulPatch] = CAST(1 AS bit) AND ([t].[Note] LIKE N'%Cole%') THEN CAST(1 AS bit) ELSE CAST(0 AS bit) END FROM [Tags] AS [t] 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])"); +) AS [t0] ON [t].[GearNickName] = [t0].[Nickname] AND [t].[GearSquadId] = [t0].[SquadId]"); } public override async Task Optional_navigation_type_compensation_works_with_projection(bool async) @@ -2635,8 +2635,8 @@ FROM [Tags] AS [t] 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"); +) AS [t0] ON [t].[GearNickName] = [t0].[Nickname] AND [t].[GearSquadId] = [t0].[SquadId] +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) @@ -2649,8 +2649,8 @@ FROM [Tags] AS [t] 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"); +) AS [t0] ON [t].[GearNickName] = [t0].[Nickname] AND [t].[GearSquadId] = [t0].[SquadId] +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) @@ -2663,8 +2663,8 @@ FROM [Tags] AS [t] 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"); +) AS [t0] ON [t].[GearNickName] = [t0].[Nickname] AND [t].[GearSquadId] = [t0].[SquadId] +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) @@ -2677,8 +2677,8 @@ FROM [Tags] AS [t] 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 +) AS [t0] ON [t].[GearNickName] = [t0].[Nickname] AND [t].[GearSquadId] = [t0].[SquadId] +WHERE [t].[Note] <> N'K.I.A.' OR [t].[Note] IS NULL ORDER BY [t].[Note]"); } @@ -2692,8 +2692,8 @@ FROM [Tags] AS [t] 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"); +) AS [t0] ON [t].[GearNickName] = [t0].[Nickname] AND [t].[GearSquadId] = [t0].[SquadId] +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) @@ -2706,8 +2706,8 @@ FROM [Tags] AS [t] 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 +) AS [t0] ON [t].[GearNickName] = [t0].[Nickname] AND [t].[GearSquadId] = [t0].[SquadId] +WHERE [t].[Note] <> N'K.I.A.' OR [t].[Note] IS NULL ORDER BY [t0].[SquadId]"); } @@ -2725,9 +2725,9 @@ LEFT JOIN ( 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]) - WHERE (([t].[Note] <> N'K.I.A.') OR [t].[Note] IS NULL) AND ([t0].[HasSoulPatch] = CAST(0 AS bit))) THEN CAST(1 AS bit) + 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) ELSE CAST(0 AS bit) END"); } @@ -2742,8 +2742,8 @@ FROM [Tags] AS [t] 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))"); +) 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)"); } public override async Task Optional_navigation_type_compensation_works_with_contains(bool async) @@ -2756,11 +2756,11 @@ FROM [Tags] AS [t] 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 ( +) 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 ( SELECT 1 FROM [Gears] AS [g0] - LEFT JOIN [Officers] AS [o0] ON ([g0].[Nickname] = [o0].[Nickname]) AND ([g0].[SquadId] = [o0].[SquadId]) + LEFT JOIN [Officers] AS [o0] ON [g0].[Nickname] = [o0].[Nickname] AND [g0].[SquadId] = [o0].[SquadId] WHERE [g0].[SquadId] = [t0].[SquadId])"); } @@ -2882,7 +2882,7 @@ FROM [Gears] AS [g] LEFT JOIN ( SELECT [w].[Id], [w].[AmmunitionType], [w].[IsAutomatic], [w].[Name], [w].[OwnerFullName], [w].[SynergyWithId] FROM [Weapons] AS [w] - WHERE ([w].[Name] <> N'Lancer') OR [w].[Name] IS NULL + WHERE [w].[Name] <> N'Lancer' OR [w].[Name] IS NULL ) AS [t] ON [g].[FullName] = [t].[OwnerFullName] WHERE [c].[Name] IN (N'Ephyra', N'Hanover') ORDER BY [g].[Nickname], [g].[SquadId], [c].[Name]"); @@ -2895,15 +2895,15 @@ public override async Task Select_correlated_filtered_collection_with_composite_ AssertSql( @"SELECT [g].[Nickname], [g].[SquadId], [t].[Nickname], [t].[SquadId], [t].[AssignedCityName], [t].[CityOfBirthName], [t].[FullName], [t].[HasSoulPatch], [t].[LeaderNickname], [t].[LeaderSquadId], [t].[Rank], [t].[Discriminator] FROM [Gears] AS [g] -LEFT JOIN [Officers] AS [o] ON ([g].[Nickname] = [o].[Nickname]) AND ([g].[SquadId] = [o].[SquadId]) +LEFT JOIN [Officers] AS [o] ON [g].[Nickname] = [o].[Nickname] AND [g].[SquadId] = [o].[SquadId] LEFT JOIN ( SELECT [g0].[Nickname], [g0].[SquadId], [g0].[AssignedCityName], [g0].[CityOfBirthName], [g0].[FullName], [g0].[HasSoulPatch], [g0].[LeaderNickname], [g0].[LeaderSquadId], [g0].[Rank], CASE 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]) + LEFT JOIN [Officers] AS [o0] ON [g0].[Nickname] = [o0].[Nickname] AND [g0].[SquadId] = [o0].[SquadId] WHERE [g0].[Nickname] <> N'Dom' -) AS [t] ON ([g].[Nickname] = [t].[LeaderNickname]) AND ([g].[SquadId] = [t].[LeaderSquadId]) +) AS [t] ON [g].[Nickname] = [t].[LeaderNickname] AND [g].[SquadId] = [t].[LeaderSquadId] WHERE [o].[Nickname] IS NOT NULL ORDER BY [g].[Nickname], [g].[SquadId], [t].[Nickname]"); } @@ -2920,7 +2920,7 @@ LEFT JOIN ( 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]) + LEFT JOIN [Officers] AS [o] ON [g].[Nickname] = [o].[Nickname] AND [g].[SquadId] = [o].[SquadId] ) AS [t0] ON [t].[GearNickName] = [t0].[Nickname] ORDER BY [t].[Note], [t].[Id], [t0].[Nickname]"); } @@ -2934,7 +2934,7 @@ public override async Task Join_predicate_value_equals_condition(bool async) 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]) +LEFT JOIN [Officers] AS [o] ON [g].[Nickname] = [o].[Nickname] AND [g].[SquadId] = [o].[SquadId] INNER JOIN [Weapons] AS [w] ON [w].[SynergyWithId] IS NOT NULL"); } @@ -2947,7 +2947,7 @@ public override async Task Join_predicate_value(bool async) 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]) +LEFT JOIN [Officers] AS [o] ON [g].[Nickname] = [o].[Nickname] AND [g].[SquadId] = [o].[SquadId] INNER JOIN [Weapons] AS [w] ON [g].[HasSoulPatch] = CAST(1 AS bit)"); } @@ -2960,7 +2960,7 @@ public override async Task Join_predicate_condition_equals_condition(bool async) 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]) +LEFT JOIN [Officers] AS [o] ON [g].[Nickname] = [o].[Nickname] AND [g].[SquadId] = [o].[SquadId] INNER JOIN [Weapons] AS [w] ON [w].[SynergyWithId] IS NOT NULL"); } @@ -2973,7 +2973,7 @@ public override async Task Left_join_predicate_value_equals_condition(bool async 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]) +LEFT JOIN [Officers] AS [o] ON [g].[Nickname] = [o].[Nickname] AND [g].[SquadId] = [o].[SquadId] LEFT JOIN [Weapons] AS [w] ON [w].[SynergyWithId] IS NOT NULL"); } @@ -2986,7 +2986,7 @@ public override async Task Left_join_predicate_value(bool async) 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]) +LEFT JOIN [Officers] AS [o] ON [g].[Nickname] = [o].[Nickname] AND [g].[SquadId] = [o].[SquadId] LEFT JOIN [Weapons] AS [w] ON [g].[HasSoulPatch] = CAST(1 AS bit)"); } @@ -2999,7 +2999,7 @@ public override async Task Left_join_predicate_condition_equals_condition(bool a 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]) +LEFT JOIN [Officers] AS [o] ON [g].[Nickname] = [o].[Nickname] AND [g].[SquadId] = [o].[SquadId] LEFT JOIN [Weapons] AS [w] ON [w].[SynergyWithId] IS NOT NULL"); } @@ -3206,7 +3206,7 @@ LEFT JOIN ( SELECT [g].[FullName], [g].[HasSoulPatch] FROM [Gears] AS [g] ) AS [t] ON [w].[OwnerFullName] = [t].[FullName] -WHERE ([w].[Id] <> 50) AND ([t].[HasSoulPatch] = CAST(0 AS bit))"); +WHERE [w].[Id] <> 50 AND [t].[HasSoulPatch] = CAST(0 AS bit)"); } public override async Task Distinct_with_optional_navigation_is_translated_to_sql(bool async) @@ -3216,8 +3216,8 @@ public override async Task Distinct_with_optional_navigation_is_translated_to_sq AssertSql( @"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"); +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"); } public override async Task Sum_with_optional_navigation_is_translated_to_sql(bool async) @@ -3227,8 +3227,8 @@ public override async Task Sum_with_optional_navigation_is_translated_to_sql(boo AssertSql( @"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"); +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"); } public override async Task Count_with_optional_navigation_is_translated_to_sql(bool async) @@ -3238,8 +3238,8 @@ public override async Task Count_with_optional_navigation_is_translated_to_sql(b AssertSql( @"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"); +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"); } public override async Task FirstOrDefault_with_manually_created_groupjoin_is_translated_to_sql(bool async) @@ -3254,7 +3254,7 @@ LEFT JOIN ( 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]) + LEFT JOIN [Officers] AS [o] ON [g].[Nickname] = [o].[Nickname] AND [g].[SquadId] = [o].[SquadId] ) AS [t] ON [s].[Id] = [t].[SquadId] WHERE [s].[Name] = N'Kilo'"); } @@ -3269,9 +3269,9 @@ FROM [Squads] AS [s] WHERE NOT (EXISTS ( 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 ([s].[Id] = [g].[SquadId]) AND ([t].[Note] = N'Dom''s Tag')))"); + 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 [s].[Id] = [g].[SquadId] AND [t].[Note] = N'Dom''s Tag'))"); } public override async Task All_with_optional_navigation_is_translated_to_sql(bool async) @@ -3283,9 +3283,9 @@ public override async Task All_with_optional_navigation_is_translated_to_sql(boo WHEN NOT EXISTS ( 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) + 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) ELSE CAST(0 AS bit) END"); } @@ -3342,9 +3342,9 @@ public override async Task Where_is_properly_lifted_from_subquery_created_by_inc WHEN [o].[Nickname] IS NOT NULL THEN N'Officer' END AS [Discriminator], [t].[Id], [t].[GearNickName], [t].[GearSquadId], [t].[IssueDate], [t].[Note] 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 ([g].[FullName] <> N'Augustus Cole') AND ([g].[HasSoulPatch] = CAST(0 AS bit)) +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 [g].[FullName] <> N'Augustus Cole' AND [g].[HasSoulPatch] = CAST(0 AS bit) ORDER BY [g].[FullName]"); } @@ -3359,7 +3359,7 @@ CROSS JOIN ( SELECT [g0].[FullName], [g0].[HasSoulPatch] FROM [Gears] AS [g0] ) AS [t] -WHERE ([g].[HasSoulPatch] = CAST(1 AS bit)) AND ([t].[HasSoulPatch] = CAST(0 AS bit)) +WHERE [g].[HasSoulPatch] = CAST(1 AS bit) AND [t].[HasSoulPatch] = CAST(0 AS bit) ORDER BY [g].[FullName]"); } @@ -3406,7 +3406,7 @@ public override async Task Subquery_containing_join_gets_lifted_clashing_names(b FROM [Gears] AS [g] INNER JOIN [Tags] AS [t] ON [g].[Nickname] = [t].[GearNickName] INNER JOIN [Tags] AS [t0] ON [g].[Nickname] = [t0].[GearNickName] -WHERE ([t].[GearNickName] <> N'Cole Train') OR [t].[GearNickName] IS NULL +WHERE [t].[GearNickName] <> N'Cole Train' OR [t].[GearNickName] IS NULL ORDER BY [g].[Nickname], [t0].[Id]"); } @@ -3419,12 +3419,12 @@ public override async Task Subquery_created_by_include_gets_lifted_nested(bool a WHEN [o].[Nickname] IS NOT NULL THEN N'Officer' END AS [Discriminator], [c].[Name], [c].[Location], [c].[Nation] FROM [Gears] AS [g] -LEFT JOIN [Officers] AS [o] ON ([g].[Nickname] = [o].[Nickname]) AND ([g].[SquadId] = [o].[SquadId]) +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] WHERE EXISTS ( SELECT 1 FROM [Weapons] AS [w] - WHERE [g].[FullName] = [w].[OwnerFullName]) AND ([g].[HasSoulPatch] = CAST(0 AS bit)) + WHERE [g].[FullName] = [w].[OwnerFullName]) AND [g].[HasSoulPatch] = CAST(0 AS bit) ORDER BY [g].[Nickname]"); } @@ -3439,7 +3439,7 @@ CROSS JOIN ( SELECT [g0].[FullName], [g0].[HasSoulPatch] FROM [Gears] AS [g0] ) AS [t] -WHERE ([g].[HasSoulPatch] = CAST(1 AS bit)) AND ([t].[HasSoulPatch] = CAST(0 AS bit)) +WHERE [g].[HasSoulPatch] = CAST(1 AS bit) AND [t].[HasSoulPatch] = CAST(0 AS bit) ORDER BY [g].[FullName]"); } @@ -3780,7 +3780,7 @@ public override async Task Distinct_on_subquery_doesnt_get_lifted(bool async) 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]) + LEFT JOIN [Officers] AS [o] ON [g].[Nickname] = [o].[Nickname] AND [g].[SquadId] = [o].[SquadId] ) AS [t]"); } @@ -3805,7 +3805,7 @@ CROSS JOIN ( SELECT [g0].[Nickname], [g0].[SquadId] FROM [Gears] AS [g0] ) AS [t] -WHERE ([g].[Nickname] = [t].[Nickname]) AND ([g].[SquadId] = [t].[SquadId]) +WHERE [g].[Nickname] = [t].[Nickname] AND [g].[SquadId] = [t].[SquadId] ORDER BY [g].[Nickname]"); } @@ -3820,7 +3820,7 @@ FROM [Factions] AS [f] CROSS JOIN ( SELECT [g].[Nickname], [g].[SquadId], [g].[HasSoulPatch] FROM [Gears] AS [g] - LEFT JOIN [Officers] AS [o] ON ([g].[Nickname] = [o].[Nickname]) AND ([g].[SquadId] = [o].[SquadId]) + LEFT JOIN [Officers] AS [o] ON [g].[Nickname] = [o].[Nickname] AND [g].[SquadId] = [o].[SquadId] WHERE [o].[Nickname] IS NOT NULL ) AS [t] LEFT JOIN ( @@ -3831,8 +3831,8 @@ FROM [LocustLeaders] AS [l0] 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]))"); +) 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]"); } public override async Task Comparing_entities_using_Equals_inheritance(bool async) @@ -3845,10 +3845,10 @@ FROM [Gears] AS [g] CROSS JOIN ( SELECT [g0].[Nickname], [g0].[SquadId] FROM [Gears] AS [g0] - LEFT JOIN [Officers] AS [o0] ON ([g0].[Nickname] = [o0].[Nickname]) AND ([g0].[SquadId] = [o0].[SquadId]) + LEFT JOIN [Officers] AS [o0] ON [g0].[Nickname] = [o0].[Nickname] AND [g0].[SquadId] = [o0].[SquadId] WHERE [o0].[Nickname] IS NOT NULL ) AS [t] -WHERE ([g].[Nickname] = [t].[Nickname]) AND ([g].[SquadId] = [t].[SquadId]) +WHERE [g].[Nickname] = [t].[Nickname] AND [g].[SquadId] = [t].[SquadId] ORDER BY [g].[Nickname], [t].[Nickname]"); } @@ -3861,9 +3861,9 @@ public override async Task Contains_on_nullable_array_produces_correct_sql(bool 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]) +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) @@ -3878,13 +3878,13 @@ LEFT JOIN ( 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]) -WHERE ([t0].[Discriminator] = N'Officer') AND (( + 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].[Discriminator] = N'Officer' AND ( 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)"); + 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"); } public override async Task Select_null_conditional_with_inheritance(bool async) @@ -3960,14 +3960,14 @@ FROM [LocustLeaders] AS [l0] LEFT JOIN ( SELECT [g].[Nickname], [g].[SquadId] FROM [Gears] AS [g] -) AS [t0] ON ([t].[DefeatedByNickname] = [t0].[Nickname]) AND ([t].[DefeatedBySquadId] = [t0].[SquadId]) +) AS [t0] ON [t].[DefeatedByNickname] = [t0].[Nickname] AND [t].[DefeatedBySquadId] = [t0].[SquadId] LEFT JOIN ( SELECT [g0].[Nickname], [g0].[SquadId], [g0].[AssignedCityName], [g0].[CityOfBirthName], [g0].[FullName], [g0].[HasSoulPatch], [g0].[LeaderNickname], [g0].[LeaderSquadId], [g0].[Rank], CASE 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]) + 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] WHERE [l].[Id] IS NOT NULL ORDER BY [f].[Id], [t].[Name], [t0].[Nickname], [t0].[SquadId], [t1].[Nickname]"); } @@ -3988,14 +3988,14 @@ FROM [LocustLeaders] AS [l0] LEFT JOIN ( SELECT [g].[Nickname], [g].[SquadId] FROM [Gears] AS [g] -) AS [t0] ON ([t].[DefeatedByNickname] = [t0].[Nickname]) AND ([t].[DefeatedBySquadId] = [t0].[SquadId]) +) AS [t0] ON [t].[DefeatedByNickname] = [t0].[Nickname] AND [t].[DefeatedBySquadId] = [t0].[SquadId] LEFT JOIN ( SELECT [g0].[Nickname], [g0].[SquadId], [g0].[AssignedCityName], [g0].[CityOfBirthName], [g0].[FullName], [g0].[HasSoulPatch], [g0].[LeaderNickname], [g0].[LeaderSquadId], [g0].[Rank], CASE 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]) + 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] WHERE [l].[Id] IS NOT NULL ORDER BY [f].[Id], [t].[Name], [t0].[Nickname], [t0].[SquadId], [t1].[Nickname]"); } @@ -4015,8 +4015,8 @@ LEFT JOIN ( 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 [t] ON ([l0].[DefeatedByNickname] = [t].[Nickname]) AND ([l0].[DefeatedBySquadId] = [t].[SquadId])"); + 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]"); } public override async Task Include_reference_on_derived_type_using_string_nested1(bool async) @@ -4034,8 +4034,8 @@ LEFT JOIN ( 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 [t] ON ([l0].[DefeatedByNickname] = [t].[Nickname]) AND ([l0].[DefeatedBySquadId] = [t].[SquadId]) + 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 [Squads] AS [s] ON [t].[SquadId] = [s].[Id]"); } @@ -4054,16 +4054,16 @@ LEFT JOIN ( 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 [t] ON ([l0].[DefeatedByNickname] = [t].[Nickname]) AND ([l0].[DefeatedBySquadId] = [t].[SquadId]) + 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 ( SELECT [g0].[Nickname], [g0].[SquadId], [g0].[AssignedCityName], [g0].[CityOfBirthName], [g0].[FullName], [g0].[HasSoulPatch], [g0].[LeaderNickname], [g0].[LeaderSquadId], [g0].[Rank], CASE WHEN [o0].[Nickname] IS NOT NULL THEN N'Officer' END AS [Discriminator], [c].[Name], [c].[Location], [c].[Nation] FROM [Gears] AS [g0] - LEFT JOIN [Officers] AS [o0] ON ([g0].[Nickname] = [o0].[Nickname]) AND ([g0].[SquadId] = [o0].[SquadId]) + 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]"); } @@ -4082,8 +4082,8 @@ LEFT JOIN ( 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 [t] ON ([l0].[DefeatedByNickname] = [t].[Nickname]) AND ([l0].[DefeatedBySquadId] = [t].[SquadId])"); + 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]"); } public override async Task Include_reference_on_derived_type_using_lambda_with_soft_cast(bool async) @@ -4101,8 +4101,8 @@ LEFT JOIN ( 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 [t] ON ([l0].[DefeatedByNickname] = [t].[Nickname]) AND ([l0].[DefeatedBySquadId] = [t].[SquadId])"); + 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]"); } public override async Task Include_reference_on_derived_type_using_lambda_with_tracking(bool async) @@ -4120,8 +4120,8 @@ LEFT JOIN ( 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 [t] ON ([l0].[DefeatedByNickname] = [t].[Nickname]) AND ([l0].[DefeatedBySquadId] = [t].[SquadId])"); + 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]"); } public override async Task Include_collection_on_derived_type_using_string(bool async) @@ -4133,14 +4133,14 @@ public override async Task Include_collection_on_derived_type_using_string(bool WHEN [o].[Nickname] IS NOT NULL THEN N'Officer' END AS [Discriminator], [t].[Nickname], [t].[SquadId], [t].[AssignedCityName], [t].[CityOfBirthName], [t].[FullName], [t].[HasSoulPatch], [t].[LeaderNickname], [t].[LeaderSquadId], [t].[Rank], [t].[Discriminator] FROM [Gears] AS [g] -LEFT JOIN [Officers] AS [o] ON ([g].[Nickname] = [o].[Nickname]) AND ([g].[SquadId] = [o].[SquadId]) +LEFT JOIN [Officers] AS [o] ON [g].[Nickname] = [o].[Nickname] AND [g].[SquadId] = [o].[SquadId] LEFT JOIN ( SELECT [g0].[Nickname], [g0].[SquadId], [g0].[AssignedCityName], [g0].[CityOfBirthName], [g0].[FullName], [g0].[HasSoulPatch], [g0].[LeaderNickname], [g0].[LeaderSquadId], [g0].[Rank], CASE 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 [t] ON ([g].[Nickname] = [t].[LeaderNickname]) AND ([g].[SquadId] = [t].[LeaderSquadId]) + LEFT JOIN [Officers] AS [o0] ON [g0].[Nickname] = [o0].[Nickname] AND [g0].[SquadId] = [o0].[SquadId] +) AS [t] ON [g].[Nickname] = [t].[LeaderNickname] AND [g].[SquadId] = [t].[LeaderSquadId] ORDER BY [g].[Nickname], [g].[SquadId], [t].[Nickname]"); } @@ -4153,14 +4153,14 @@ public override async Task Include_collection_on_derived_type_using_lambda(bool WHEN [o].[Nickname] IS NOT NULL THEN N'Officer' END AS [Discriminator], [t].[Nickname], [t].[SquadId], [t].[AssignedCityName], [t].[CityOfBirthName], [t].[FullName], [t].[HasSoulPatch], [t].[LeaderNickname], [t].[LeaderSquadId], [t].[Rank], [t].[Discriminator] FROM [Gears] AS [g] -LEFT JOIN [Officers] AS [o] ON ([g].[Nickname] = [o].[Nickname]) AND ([g].[SquadId] = [o].[SquadId]) +LEFT JOIN [Officers] AS [o] ON [g].[Nickname] = [o].[Nickname] AND [g].[SquadId] = [o].[SquadId] LEFT JOIN ( SELECT [g0].[Nickname], [g0].[SquadId], [g0].[AssignedCityName], [g0].[CityOfBirthName], [g0].[FullName], [g0].[HasSoulPatch], [g0].[LeaderNickname], [g0].[LeaderSquadId], [g0].[Rank], CASE 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 [t] ON ([g].[Nickname] = [t].[LeaderNickname]) AND ([g].[SquadId] = [t].[LeaderSquadId]) + LEFT JOIN [Officers] AS [o0] ON [g0].[Nickname] = [o0].[Nickname] AND [g0].[SquadId] = [o0].[SquadId] +) AS [t] ON [g].[Nickname] = [t].[LeaderNickname] AND [g].[SquadId] = [t].[LeaderSquadId] ORDER BY [g].[Nickname], [g].[SquadId], [t].[Nickname]"); } @@ -4173,14 +4173,14 @@ public override async Task Include_collection_on_derived_type_using_lambda_with_ WHEN [o].[Nickname] IS NOT NULL THEN N'Officer' END AS [Discriminator], [t].[Nickname], [t].[SquadId], [t].[AssignedCityName], [t].[CityOfBirthName], [t].[FullName], [t].[HasSoulPatch], [t].[LeaderNickname], [t].[LeaderSquadId], [t].[Rank], [t].[Discriminator] FROM [Gears] AS [g] -LEFT JOIN [Officers] AS [o] ON ([g].[Nickname] = [o].[Nickname]) AND ([g].[SquadId] = [o].[SquadId]) +LEFT JOIN [Officers] AS [o] ON [g].[Nickname] = [o].[Nickname] AND [g].[SquadId] = [o].[SquadId] LEFT JOIN ( SELECT [g0].[Nickname], [g0].[SquadId], [g0].[AssignedCityName], [g0].[CityOfBirthName], [g0].[FullName], [g0].[HasSoulPatch], [g0].[LeaderNickname], [g0].[LeaderSquadId], [g0].[Rank], CASE 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 [t] ON ([g].[Nickname] = [t].[LeaderNickname]) AND ([g].[SquadId] = [t].[LeaderSquadId]) + LEFT JOIN [Officers] AS [o0] ON [g0].[Nickname] = [o0].[Nickname] AND [g0].[SquadId] = [o0].[SquadId] +) AS [t] ON [g].[Nickname] = [t].[LeaderNickname] AND [g].[SquadId] = [t].[LeaderSquadId] ORDER BY [g].[Nickname], [g].[SquadId], [t].[Nickname]"); } @@ -4193,8 +4193,8 @@ public override async Task Include_base_navigation_on_derived_entity(bool async) WHEN [o].[Nickname] IS NOT NULL THEN N'Officer' END AS [Discriminator], [t].[Id], [t].[GearNickName], [t].[GearSquadId], [t].[IssueDate], [t].[Note], [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 [Tags] AS [t] ON ([g].[Nickname] = [t].[GearNickName]) AND ([g].[SquadId] = [t].[GearSquadId]) +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 [Weapons] AS [w] ON [g].[FullName] = [w].[OwnerFullName] ORDER BY [g].[Nickname], [g].[SquadId], [t].[Id]"); } @@ -4211,8 +4211,8 @@ LEFT JOIN ( 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]) + 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] LEFT JOIN [Weapons] AS [w] ON [t0].[FullName] = [w].[OwnerFullName] ORDER BY [t].[Id], [t0].[Nickname], [t0].[SquadId]"); } @@ -4237,15 +4237,15 @@ LEFT JOIN ( 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].[DefeatedByNickname] = [t0].[Nickname]) AND ([t].[DefeatedBySquadId] = [t0].[SquadId]) + LEFT JOIN [Officers] AS [o] ON [g].[Nickname] = [o].[Nickname] AND [g].[SquadId] = [o].[SquadId] +) AS [t0] ON [t].[DefeatedByNickname] = [t0].[Nickname] AND [t].[DefeatedBySquadId] = [t0].[SquadId] LEFT JOIN ( SELECT [g0].[Nickname], [g0].[SquadId], [g0].[AssignedCityName], [g0].[CityOfBirthName], [g0].[FullName], [g0].[HasSoulPatch], [g0].[LeaderNickname], [g0].[LeaderSquadId], [g0].[Rank], CASE 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]) + 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] ORDER BY [f].[Id], [t].[Name], [t0].[Nickname], [t0].[SquadId], [t1].[Nickname]"); } @@ -4258,21 +4258,21 @@ public override async Task ThenInclude_collection_on_derived_after_derived_colle WHEN [o].[Nickname] IS NOT NULL THEN N'Officer' END AS [Discriminator], [t0].[Nickname], [t0].[SquadId], [t0].[AssignedCityName], [t0].[CityOfBirthName], [t0].[FullName], [t0].[HasSoulPatch], [t0].[LeaderNickname], [t0].[LeaderSquadId], [t0].[Rank], [t0].[Discriminator], [t0].[Nickname0], [t0].[SquadId0], [t0].[AssignedCityName0], [t0].[CityOfBirthName0], [t0].[FullName0], [t0].[HasSoulPatch0], [t0].[LeaderNickname0], [t0].[LeaderSquadId0], [t0].[Rank0], [t0].[Discriminator0] FROM [Gears] AS [g] -LEFT JOIN [Officers] AS [o] ON ([g].[Nickname] = [o].[Nickname]) AND ([g].[SquadId] = [o].[SquadId]) +LEFT JOIN [Officers] AS [o] ON [g].[Nickname] = [o].[Nickname] AND [g].[SquadId] = [o].[SquadId] LEFT JOIN ( SELECT [g0].[Nickname], [g0].[SquadId], [g0].[AssignedCityName], [g0].[CityOfBirthName], [g0].[FullName], [g0].[HasSoulPatch], [g0].[LeaderNickname], [g0].[LeaderSquadId], [g0].[Rank], CASE WHEN [o0].[Nickname] IS NOT NULL THEN N'Officer' END AS [Discriminator], [t].[Nickname] AS [Nickname0], [t].[SquadId] AS [SquadId0], [t].[AssignedCityName] AS [AssignedCityName0], [t].[CityOfBirthName] AS [CityOfBirthName0], [t].[FullName] AS [FullName0], [t].[HasSoulPatch] AS [HasSoulPatch0], [t].[LeaderNickname] AS [LeaderNickname0], [t].[LeaderSquadId] AS [LeaderSquadId0], [t].[Rank] AS [Rank0], [t].[Discriminator] AS [Discriminator0] FROM [Gears] AS [g0] - LEFT JOIN [Officers] AS [o0] ON ([g0].[Nickname] = [o0].[Nickname]) AND ([g0].[SquadId] = [o0].[SquadId]) + LEFT JOIN [Officers] AS [o0] ON [g0].[Nickname] = [o0].[Nickname] AND [g0].[SquadId] = [o0].[SquadId] LEFT JOIN ( SELECT [g1].[Nickname], [g1].[SquadId], [g1].[AssignedCityName], [g1].[CityOfBirthName], [g1].[FullName], [g1].[HasSoulPatch], [g1].[LeaderNickname], [g1].[LeaderSquadId], [g1].[Rank], CASE WHEN [o1].[Nickname] IS NOT NULL THEN N'Officer' END AS [Discriminator] FROM [Gears] AS [g1] - LEFT JOIN [Officers] AS [o1] ON ([g1].[Nickname] = [o1].[Nickname]) AND ([g1].[SquadId] = [o1].[SquadId]) - ) AS [t] ON ([g0].[Nickname] = [t].[LeaderNickname]) AND ([g0].[SquadId] = [t].[LeaderSquadId]) -) AS [t0] ON ([g].[Nickname] = [t0].[LeaderNickname]) AND ([g].[SquadId] = [t0].[LeaderSquadId]) + LEFT JOIN [Officers] AS [o1] ON [g1].[Nickname] = [o1].[Nickname] AND [g1].[SquadId] = [o1].[SquadId] + ) AS [t] ON [g0].[Nickname] = [t].[LeaderNickname] AND [g0].[SquadId] = [t].[LeaderSquadId] +) AS [t0] ON [g].[Nickname] = [t0].[LeaderNickname] AND [g].[SquadId] = [t0].[LeaderSquadId] ORDER BY [g].[Nickname], [g].[SquadId], [t0].[Nickname], [t0].[SquadId], [t0].[Nickname0]"); } @@ -4297,8 +4297,8 @@ LEFT JOIN ( 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 [t] ON ([l1].[DefeatedByNickname] = [t].[Nickname]) AND ([l1].[DefeatedBySquadId] = [t].[SquadId]) + LEFT JOIN [Officers] AS [o] ON [g].[Nickname] = [o].[Nickname] AND [g].[SquadId] = [o].[SquadId] + ) AS [t] ON [l1].[DefeatedByNickname] = [t].[Nickname] AND [l1].[DefeatedBySquadId] = [t].[SquadId] ) AS [t0] ON [f].[Id] = [t0].[LocustHordeId] ORDER BY [f].[Id], [t0].[Name], [t0].[Nickname]"); } @@ -4323,15 +4323,15 @@ LEFT JOIN ( 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].[DefeatedByNickname] = [t0].[Nickname]) AND ([t].[DefeatedBySquadId] = [t0].[SquadId]) + LEFT JOIN [Officers] AS [o] ON [g].[Nickname] = [o].[Nickname] AND [g].[SquadId] = [o].[SquadId] +) AS [t0] ON [t].[DefeatedByNickname] = [t0].[Nickname] AND [t].[DefeatedBySquadId] = [t0].[SquadId] LEFT JOIN ( SELECT [g0].[Nickname], [g0].[SquadId], [g0].[AssignedCityName], [g0].[CityOfBirthName], [g0].[FullName], [g0].[HasSoulPatch], [g0].[LeaderNickname], [g0].[LeaderSquadId], [g0].[Rank], CASE 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]) + 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] ORDER BY [f].[Id], [t].[Name], [t0].[Nickname], [t0].[SquadId], [t1].[Nickname]"); } @@ -4344,16 +4344,16 @@ public override async Task Include_on_derived_multi_level(bool async) WHEN [o].[Nickname] IS NOT NULL THEN N'Officer' END AS [Discriminator], [t].[Nickname], [t].[SquadId], [t].[AssignedCityName], [t].[CityOfBirthName], [t].[FullName], [t].[HasSoulPatch], [t].[LeaderNickname], [t].[LeaderSquadId], [t].[Rank], [t].[Discriminator], [t].[Id], [t].[Banner], [t].[Banner5], [t].[InternalNumber], [t].[Name], [t].[SquadId0], [t].[MissionId] FROM [Gears] AS [g] -LEFT JOIN [Officers] AS [o] ON ([g].[Nickname] = [o].[Nickname]) AND ([g].[SquadId] = [o].[SquadId]) +LEFT JOIN [Officers] AS [o] ON [g].[Nickname] = [o].[Nickname] AND [g].[SquadId] = [o].[SquadId] LEFT JOIN ( SELECT [g0].[Nickname], [g0].[SquadId], [g0].[AssignedCityName], [g0].[CityOfBirthName], [g0].[FullName], [g0].[HasSoulPatch], [g0].[LeaderNickname], [g0].[LeaderSquadId], [g0].[Rank], CASE WHEN [o0].[Nickname] IS NOT NULL THEN N'Officer' END AS [Discriminator], [s].[Id], [s].[Banner], [s].[Banner5], [s].[InternalNumber], [s].[Name], [s0].[SquadId] AS [SquadId0], [s0].[MissionId] FROM [Gears] AS [g0] - LEFT JOIN [Officers] AS [o0] ON ([g0].[Nickname] = [o0].[Nickname]) AND ([g0].[SquadId] = [o0].[SquadId]) + LEFT JOIN [Officers] AS [o0] ON [g0].[Nickname] = [o0].[Nickname] AND [g0].[SquadId] = [o0].[SquadId] INNER JOIN [Squads] AS [s] ON [g0].[SquadId] = [s].[Id] LEFT JOIN [SquadMissions] AS [s0] ON [s].[Id] = [s0].[SquadId] -) AS [t] ON ([g].[Nickname] = [t].[LeaderNickname]) AND ([g].[SquadId] = [t].[LeaderSquadId]) +) AS [t] ON [g].[Nickname] = [t].[LeaderNickname] AND [g].[SquadId] = [t].[LeaderSquadId] ORDER BY [g].[Nickname], [g].[SquadId], [t].[Nickname], [t].[SquadId], [t].[Id], [t].[SquadId0]"); } @@ -4370,7 +4370,7 @@ FROM [Tags] AS [t] 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])"); +) AS [t0] ON [t].[GearNickName] = [t0].[Nickname] AND [t].[GearSquadId] = [t0].[SquadId]"); } public override async Task Enum_ToString_is_client_eval(bool async) @@ -4431,7 +4431,7 @@ FROM [Gears] AS [g] LEFT JOIN ( SELECT [w].[Id], [w].[AmmunitionType], [w].[IsAutomatic], [w].[Name], [w].[OwnerFullName], [w].[SynergyWithId] FROM [Weapons] AS [w] - WHERE ([w].[IsAutomatic] = CAST(1 AS bit)) OR (([w].[Name] <> N'foo') OR [w].[Name] IS NULL) + WHERE [w].[IsAutomatic] = CAST(1 AS bit) OR [w].[Name] <> N'foo' OR [w].[Name] IS NULL ) AS [t] ON [g].[FullName] = [t].[OwnerFullName] WHERE [g].[Nickname] <> N'Marcus' ORDER BY [g].[Nickname], [g].[SquadId]"); @@ -4447,7 +4447,7 @@ FROM [Gears] AS [g] LEFT JOIN ( SELECT [w].[Id], [w].[AmmunitionType], [w].[IsAutomatic], [w].[Name], [w].[OwnerFullName], [w].[SynergyWithId] FROM [Weapons] AS [w] - WHERE ([w].[IsAutomatic] = CAST(1 AS bit)) OR (([w].[Name] <> N'foo') OR [w].[Name] IS NULL) + WHERE [w].[IsAutomatic] = CAST(1 AS bit) OR [w].[Name] <> N'foo' OR [w].[Name] IS NULL ) AS [t] ON [g].[FullName] = [t].[OwnerFullName] WHERE [g].[Nickname] <> N'Marcus' ORDER BY [g].[Nickname], [g].[SquadId]"); @@ -4463,7 +4463,7 @@ FROM [Gears] AS [g] LEFT JOIN ( SELECT [w].[Id], [w].[AmmunitionType], [w].[IsAutomatic], [w].[Name], [w].[OwnerFullName], [w].[SynergyWithId] FROM [Weapons] AS [w] - WHERE ([w].[IsAutomatic] = CAST(1 AS bit)) OR (([w].[Name] <> N'foo') OR [w].[Name] IS NULL) + WHERE [w].[IsAutomatic] = CAST(1 AS bit) OR [w].[Name] <> N'foo' OR [w].[Name] IS NULL ) AS [t] ON [g].[FullName] = [t].[OwnerFullName] WHERE [g].[Nickname] <> N'Marcus' ORDER BY [g].[Nickname], [g].[SquadId]"); @@ -4479,7 +4479,7 @@ FROM [Gears] AS [g] LEFT JOIN ( SELECT [w].[Id], [w].[AmmunitionType], [w].[IsAutomatic], [w].[Name], [w].[OwnerFullName], [w].[SynergyWithId] FROM [Weapons] AS [w] - WHERE ([w].[IsAutomatic] = CAST(1 AS bit)) OR (([w].[Name] <> N'foo') OR [w].[Name] IS NULL) + WHERE [w].[IsAutomatic] = CAST(1 AS bit) OR [w].[Name] <> N'foo' OR [w].[Name] IS NULL ) AS [t] ON [g].[FullName] = [t].[OwnerFullName] WHERE [g].[Nickname] <> N'Marcus' ORDER BY [g].[Nickname], [g].[SquadId], [t].[Name] DESC"); @@ -4492,13 +4492,13 @@ public override async Task Correlated_collections_basic_projection_composite_key AssertSql( @"SELECT [g].[Nickname], [g].[SquadId], [t].[Nickname], [t].[FullName], [t].[SquadId] FROM [Gears] AS [g] -LEFT JOIN [Officers] AS [o] ON ([g].[Nickname] = [o].[Nickname]) AND ([g].[SquadId] = [o].[SquadId]) +LEFT JOIN [Officers] AS [o] ON [g].[Nickname] = [o].[Nickname] AND [g].[SquadId] = [o].[SquadId] LEFT JOIN ( SELECT [g0].[Nickname], [g0].[FullName], [g0].[SquadId], [g0].[LeaderNickname], [g0].[LeaderSquadId] 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') +) AS [t] ON [g].[Nickname] = [t].[LeaderNickname] AND [g].[SquadId] = [t].[LeaderSquadId] +WHERE [o].[Nickname] IS NOT NULL AND [g].[Nickname] <> N'Foo' ORDER BY [g].[Nickname], [g].[SquadId], [t].[Nickname]"); } @@ -4512,7 +4512,7 @@ FROM [Gears] AS [g] LEFT JOIN ( SELECT [w].[Name], [w].[Id], [w].[OwnerFullName] FROM [Weapons] AS [w] - WHERE ([w].[IsAutomatic] = CAST(1 AS bit)) OR (([w].[Name] <> N'foo') OR [w].[Name] IS NULL) + WHERE [w].[IsAutomatic] = CAST(1 AS bit) OR [w].[Name] <> N'foo' OR [w].[Name] IS NULL ) AS [t] ON [g].[FullName] = [t].[OwnerFullName] WHERE [g].[Nickname] <> N'Marcus' ORDER BY [g].[Nickname], [g].[SquadId]"); @@ -4528,7 +4528,7 @@ FROM [Gears] AS [g] LEFT JOIN ( SELECT N'BFG' AS [c], [w].[Id], [w].[OwnerFullName] FROM [Weapons] AS [w] - WHERE ([w].[IsAutomatic] = CAST(1 AS bit)) OR (([w].[Name] <> N'foo') OR [w].[Name] IS NULL) + WHERE [w].[IsAutomatic] = CAST(1 AS bit) OR [w].[Name] <> N'foo' OR [w].[Name] IS NULL ) AS [t] ON [g].[FullName] = [t].[OwnerFullName] WHERE [g].[Nickname] <> N'Marcus' ORDER BY [g].[Nickname], [g].[SquadId]"); @@ -4544,7 +4544,7 @@ FROM [Gears] AS [g] LEFT JOIN ( SELECT CAST(1 AS bit) AS [c], [w].[Id], [w].[OwnerFullName] FROM [Weapons] AS [w] - WHERE ([w].[IsAutomatic] = CAST(1 AS bit)) OR (([w].[Name] <> N'foo') OR [w].[Name] IS NULL) + WHERE [w].[IsAutomatic] = CAST(1 AS bit) OR [w].[Name] <> N'foo' OR [w].[Name] IS NULL ) AS [t] ON [g].[FullName] = [t].[OwnerFullName] WHERE [g].[Nickname] <> N'Marcus' ORDER BY [g].[Nickname], [g].[SquadId]"); @@ -4652,17 +4652,17 @@ public override async Task Correlated_collections_nested_with_custom_ordering(bo AssertSql( @"SELECT [g].[FullName], [g].[Nickname], [g].[SquadId], [t0].[FullName], [t0].[Nickname], [t0].[SquadId], [t0].[Id], [t0].[AmmunitionType], [t0].[IsAutomatic], [t0].[Name], [t0].[OwnerFullName], [t0].[SynergyWithId] FROM [Gears] AS [g] -LEFT JOIN [Officers] AS [o] ON ([g].[Nickname] = [o].[Nickname]) AND ([g].[SquadId] = [o].[SquadId]) +LEFT JOIN [Officers] AS [o] ON [g].[Nickname] = [o].[Nickname] AND [g].[SquadId] = [o].[SquadId] LEFT JOIN ( SELECT [g0].[FullName], [g0].[Nickname], [g0].[SquadId], [t].[Id], [t].[AmmunitionType], [t].[IsAutomatic], [t].[Name], [t].[OwnerFullName], [t].[SynergyWithId], [g0].[Rank], [g0].[LeaderNickname], [g0].[LeaderSquadId] 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]) +) AS [t0] ON [g].[Nickname] = [t0].[LeaderNickname] AND [g].[SquadId] = [t0].[LeaderSquadId] WHERE [o].[Nickname] IS NOT NULL ORDER BY [g].[HasSoulPatch] DESC, [g].[Nickname], [g].[SquadId], [t0].[Rank], [t0].[Nickname], [t0].[SquadId], [t0].[IsAutomatic]"); } @@ -4714,7 +4714,7 @@ public override async Task Correlated_collections_different_collections_projecte AssertSql( @"SELECT [g].[Nickname], [g].[SquadId], [t].[Name], [t].[IsAutomatic], [t].[Id], [t0].[Nickname], [t0].[Rank], [t0].[SquadId] FROM [Gears] AS [g] -LEFT JOIN [Officers] AS [o] ON ([g].[Nickname] = [o].[Nickname]) AND ([g].[SquadId] = [o].[SquadId]) +LEFT JOIN [Officers] AS [o] ON [g].[Nickname] = [o].[Nickname] AND [g].[SquadId] = [o].[SquadId] LEFT JOIN ( SELECT [w].[Name], [w].[IsAutomatic], [w].[Id], [w].[OwnerFullName] FROM [Weapons] AS [w] @@ -4723,7 +4723,7 @@ FROM [Weapons] AS [w] LEFT JOIN ( SELECT [g0].[Nickname], [g0].[Rank], [g0].[SquadId], [g0].[FullName], [g0].[LeaderNickname], [g0].[LeaderSquadId] FROM [Gears] AS [g0] -) AS [t0] ON ([g].[Nickname] = [t0].[LeaderNickname]) AND ([g].[SquadId] = [t0].[LeaderSquadId]) +) AS [t0] ON [g].[Nickname] = [t0].[LeaderNickname] AND [g].[SquadId] = [t0].[LeaderSquadId] WHERE [o].[Nickname] IS NOT NULL ORDER BY [g].[FullName], [g].[Nickname], [g].[SquadId], [t].[Id], [t0].[FullName], [t0].[Nickname]"); } @@ -4735,13 +4735,13 @@ public override async Task Multiple_orderby_with_navigation_expansion_on_one_of_ AssertSql( @"SELECT [g].[FullName] 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 [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 ( SELECT 1 FROM [Gears] AS [g0] - LEFT JOIN [Officers] AS [o0] ON ([g0].[Nickname] = [o0].[Nickname]) AND ([g0].[SquadId] = [o0].[SquadId]) - WHERE ([g].[Nickname] = [g0].[LeaderNickname]) AND ([g].[SquadId] = [g0].[LeaderSquadId])) + LEFT JOIN [Officers] AS [o0] ON [g0].[Nickname] = [o0].[Nickname] AND [g0].[SquadId] = [o0].[SquadId] + WHERE [g].[Nickname] = [g0].[LeaderNickname] AND [g].[SquadId] = [g0].[LeaderSquadId]) ORDER BY [g].[HasSoulPatch] DESC, [t].[Note]"); } @@ -4752,12 +4752,12 @@ public override async Task Multiple_orderby_with_navigation_expansion_on_one_of_ AssertSql( @"SELECT [g].[FullName], [g].[Nickname], [g].[SquadId], [t].[Id], [t0].[Nickname], [t0].[SquadId], [t1].[Id], [t1].[AmmunitionType], [t1].[IsAutomatic], [t1].[Name], [t1].[OwnerFullName], [t1].[SynergyWithId], [t1].[Nickname], [t1].[SquadId] 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 [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 ( SELECT [g1].[Nickname], [g1].[SquadId], [g1].[FullName] FROM [Gears] AS [g1] -) AS [t0] ON ([t].[GearNickName] = [t0].[Nickname]) AND ([t].[GearSquadId] = [t0].[SquadId]) +) AS [t0] ON [t].[GearNickName] = [t0].[Nickname] AND [t].[GearSquadId] = [t0].[SquadId] LEFT JOIN ( SELECT [w].[Id], [w].[AmmunitionType], [w].[IsAutomatic], [w].[Name], [w].[OwnerFullName], [w].[SynergyWithId], [t2].[Nickname], [t2].[SquadId] FROM [Weapons] AS [w] @@ -4769,8 +4769,8 @@ FROM [Gears] AS [g2] 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]) - WHERE ([g].[Nickname] = [g0].[LeaderNickname]) AND ([g].[SquadId] = [g0].[LeaderSquadId])) + LEFT JOIN [Officers] AS [o0] ON [g0].[Nickname] = [o0].[Nickname] AND [g0].[SquadId] = [o0].[SquadId] + WHERE [g].[Nickname] = [g0].[LeaderNickname] AND [g].[SquadId] = [g0].[LeaderSquadId]) ORDER BY [g].[HasSoulPatch] DESC, [t].[Note], [g].[Nickname], [g].[SquadId], [t].[Id], [t0].[Nickname], [t0].[SquadId], [t1].[IsAutomatic], [t1].[Nickname] DESC, [t1].[Id]"); } @@ -4782,12 +4782,12 @@ public override async Task Multiple_orderby_with_navigation_expansion_on_one_of_ AssertSql( @"SELECT [g].[FullName], [g].[Nickname], [g].[SquadId], [t].[Id], [t0].[Nickname], [t0].[SquadId], [t1].[Id], [t1].[AmmunitionType], [t1].[IsAutomatic], [t1].[Name], [t1].[OwnerFullName], [t1].[SynergyWithId], [t1].[Nickname], [t1].[SquadId] 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 [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 ( SELECT [g1].[Nickname], [g1].[SquadId], [g1].[FullName] FROM [Gears] AS [g1] -) AS [t0] ON ([t].[GearNickName] = [t0].[Nickname]) AND ([t].[GearSquadId] = [t0].[SquadId]) +) AS [t0] ON [t].[GearNickName] = [t0].[Nickname] AND [t].[GearSquadId] = [t0].[SquadId] LEFT JOIN ( SELECT [w].[Id], [w].[AmmunitionType], [w].[IsAutomatic], [w].[Name], [w].[OwnerFullName], [w].[SynergyWithId], [t2].[Nickname], [t2].[SquadId] FROM [Weapons] AS [w] @@ -4799,8 +4799,8 @@ FROM [Gears] AS [g2] 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]) - WHERE ([g].[Nickname] = [g0].[LeaderNickname]) AND ([g].[SquadId] = [g0].[LeaderSquadId])) + LEFT JOIN [Officers] AS [o0] ON [g0].[Nickname] = [o0].[Nickname] AND [g0].[SquadId] = [o0].[SquadId] + WHERE [g].[Nickname] = [g0].[LeaderNickname] AND [g].[SquadId] = [g0].[LeaderSquadId]) ORDER BY [g].[HasSoulPatch] DESC, [t].[Note], [g].[Nickname], [g].[SquadId], [t].[Id], [t0].[Nickname], [t0].[SquadId], [t1].[IsAutomatic], [t1].[Nickname] DESC, [t1].[Id]"); } @@ -4812,17 +4812,17 @@ public override async Task Multiple_orderby_with_navigation_expansion_on_one_of_ AssertSql( @"SELECT [g].[FullName], [g].[Nickname], [g].[SquadId], [t].[Id], [t0].[Nickname], [t0].[SquadId], [t1].[Id], [t1].[AmmunitionType], [t1].[IsAutomatic], [t1].[Name], [t1].[OwnerFullName], [t1].[SynergyWithId], [t1].[Nickname], [t1].[SquadId] 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 [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 ( SELECT [g1].[Nickname], [g1].[SquadId], [g1].[FullName] FROM [Gears] AS [g1] -) AS [t0] ON ([t].[GearNickName] = [t0].[Nickname]) AND ([t].[GearSquadId] = [t0].[SquadId]) +) AS [t0] ON [t].[GearNickName] = [t0].[Nickname] AND [t].[GearSquadId] = [t0].[SquadId] 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] @@ -4832,8 +4832,8 @@ FROM [Gears] AS [g2] 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]) - WHERE ([g].[Nickname] = [g0].[LeaderNickname]) AND ([g].[SquadId] = [g0].[LeaderSquadId])) + LEFT JOIN [Officers] AS [o0] ON [g0].[Nickname] = [o0].[Nickname] AND [g0].[SquadId] = [o0].[SquadId] + WHERE [g].[Nickname] = [g0].[LeaderNickname] AND [g].[SquadId] = [g0].[LeaderSquadId]) ORDER BY [g].[HasSoulPatch] DESC, [t].[Note], [g].[Nickname], [g].[SquadId], [t].[Id], [t0].[Nickname], [t0].[SquadId], [t1].[Id] DESC, [t1].[c], [t1].[Nickname]"); } @@ -4844,12 +4844,12 @@ public override async Task Correlated_collections_multiple_nested_complex_collec AssertSql( @"SELECT [g].[FullName], [g].[Nickname], [g].[SquadId], [t].[Id], [t0].[Nickname], [t0].[SquadId], [t2].[FullName], [t2].[Nickname], [t2].[SquadId], [t2].[Id], [t2].[Nickname0], [t2].[SquadId0], [t2].[Id0], [t2].[Name], [t2].[IsAutomatic], [t2].[Id1], [t2].[Nickname00], [t2].[HasSoulPatch], [t2].[SquadId00], [t5].[Id], [t5].[AmmunitionType], [t5].[IsAutomatic], [t5].[Name], [t5].[OwnerFullName], [t5].[SynergyWithId], [t5].[Nickname], [t5].[SquadId] 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 [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 ( SELECT [g1].[Nickname], [g1].[SquadId], [g1].[FullName] FROM [Gears] AS [g1] -) AS [t0] ON ([t].[GearNickName] = [t0].[Nickname]) AND ([t].[GearSquadId] = [t0].[SquadId]) +) AS [t0] ON [t].[GearNickName] = [t0].[Nickname] AND [t].[GearSquadId] = [t0].[SquadId] LEFT JOIN ( SELECT [g2].[FullName], [g2].[Nickname], [g2].[SquadId], [t1].[Id], [t1].[Nickname] AS [Nickname0], [t1].[SquadId] AS [SquadId0], [t1].[Id0], [t1].[Name], [t1].[IsAutomatic], [t1].[Id1], [t1].[Nickname0] AS [Nickname00], [t1].[HasSoulPatch], [t1].[SquadId0] AS [SquadId00], [g2].[Rank], [t1].[IsAutomatic0], [g2].[LeaderNickname], [g2].[LeaderSquadId] FROM [Gears] AS [g2] @@ -4866,10 +4866,10 @@ 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]) +) AS [t2] ON [g].[Nickname] = [t2].[LeaderNickname] AND [g].[SquadId] = [t2].[LeaderSquadId] LEFT JOIN ( SELECT [w1].[Id], [w1].[AmmunitionType], [w1].[IsAutomatic], [w1].[Name], [w1].[OwnerFullName], [w1].[SynergyWithId], [t6].[Nickname], [t6].[SquadId] FROM [Weapons] AS [w1] @@ -4881,8 +4881,8 @@ FROM [Gears] AS [g5] 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]) - WHERE ([g].[Nickname] = [g0].[LeaderNickname]) AND ([g].[SquadId] = [g0].[LeaderSquadId])) + LEFT JOIN [Officers] AS [o0] ON [g0].[Nickname] = [o0].[Nickname] AND [g0].[SquadId] = [o0].[SquadId] + WHERE [g].[Nickname] = [g0].[LeaderNickname] AND [g].[SquadId] = [g0].[LeaderSquadId]) ORDER BY [g].[HasSoulPatch] DESC, [t].[Note], [g].[Nickname], [g].[SquadId], [t].[Id], [t0].[Nickname], [t0].[SquadId], [t2].[Rank], [t2].[Nickname], [t2].[SquadId], [t2].[IsAutomatic0], [t2].[Id], [t2].[Nickname0], [t2].[SquadId0], [t2].[Id0], [t2].[Id1], [t2].[Nickname00], [t2].[SquadId00], [t5].[IsAutomatic], [t5].[Nickname] DESC, [t5].[Id]"); } @@ -4893,11 +4893,11 @@ public override async Task Correlated_collections_inner_subquery_selector_refere AssertSql( @"SELECT [g].[FullName], [g].[Nickname], [g].[SquadId], [t].[ReportName], [t].[OfficerName], [t].[Nickname], [t].[SquadId] FROM [Gears] AS [g] -LEFT JOIN [Officers] AS [o] ON ([g].[Nickname] = [o].[Nickname]) AND ([g].[SquadId] = [o].[SquadId]) +LEFT JOIN [Officers] AS [o] ON [g].[Nickname] = [o].[Nickname] AND [g].[SquadId] = [o].[SquadId] OUTER APPLY ( SELECT [g0].[FullName] AS [ReportName], [g].[FullName] AS [OfficerName], [g0].[Nickname], [g0].[SquadId] FROM [Gears] AS [g0] - WHERE ([g].[Nickname] = [g0].[LeaderNickname]) AND ([g].[SquadId] = [g0].[LeaderSquadId]) + WHERE [g].[Nickname] = [g0].[LeaderNickname] AND [g].[SquadId] = [g0].[LeaderSquadId] ) AS [t] WHERE [o].[Nickname] IS NOT NULL ORDER BY [g].[Nickname], [g].[SquadId], [t].[Nickname]"); @@ -4910,11 +4910,11 @@ public override async Task Correlated_collections_inner_subquery_predicate_refer AssertSql( @"SELECT [g].[FullName], [g].[Nickname], [g].[SquadId], [t].[ReportName], [t].[Nickname], [t].[SquadId] FROM [Gears] AS [g] -LEFT JOIN [Officers] AS [o] ON ([g].[Nickname] = [o].[Nickname]) AND ([g].[SquadId] = [o].[SquadId]) +LEFT JOIN [Officers] AS [o] ON [g].[Nickname] = [o].[Nickname] AND [g].[SquadId] = [o].[SquadId] OUTER APPLY ( SELECT [g0].[FullName] AS [ReportName], [g0].[Nickname], [g0].[SquadId] FROM [Gears] AS [g0] - WHERE ([g].[FullName] <> N'Foo') AND (([g].[Nickname] = [g0].[LeaderNickname]) AND ([g].[SquadId] = [g0].[LeaderSquadId])) + WHERE [g].[FullName] <> N'Foo' AND [g].[Nickname] = [g0].[LeaderNickname] AND [g].[SquadId] = [g0].[LeaderSquadId] ) AS [t] WHERE [o].[Nickname] IS NOT NULL ORDER BY [g].[Nickname], [g].[SquadId], [t].[Nickname]"); @@ -4927,17 +4927,17 @@ public override async Task Correlated_collections_nested_inner_subquery_referenc AssertSql( @"SELECT [g].[FullName], [g].[Nickname], [g].[SquadId], [t0].[FullName], [t0].[Nickname], [t0].[SquadId], [t0].[Name], [t0].[Nickname0], [t0].[Id] FROM [Gears] AS [g] -LEFT JOIN [Officers] AS [o] ON ([g].[Nickname] = [o].[Nickname]) AND ([g].[SquadId] = [o].[SquadId]) +LEFT JOIN [Officers] AS [o] ON [g].[Nickname] = [o].[Nickname] AND [g].[SquadId] = [o].[SquadId] LEFT JOIN ( SELECT [g0].[FullName], [g0].[Nickname], [g0].[SquadId], [t].[Name], [t].[Nickname] AS [Nickname0], [t].[Id], [g0].[LeaderNickname], [g0].[LeaderSquadId] FROM [Gears] AS [g0] OUTER APPLY ( SELECT [w].[Name], [g0].[Nickname], [w].[Id] FROM [Weapons] AS [w] - WHERE (([w].[Name] <> N'Bar') OR [w].[Name] IS NULL) AND ([g0].[FullName] = [w].[OwnerFullName]) + WHERE ([w].[Name] <> N'Bar' OR [w].[Name] IS NULL) AND [g0].[FullName] = [w].[OwnerFullName] ) AS [t] WHERE [g0].[FullName] <> N'Foo' -) AS [t0] ON ([g].[Nickname] = [t0].[LeaderNickname]) AND ([g].[SquadId] = [t0].[LeaderSquadId]) +) AS [t0] ON [g].[Nickname] = [t0].[LeaderNickname] AND [g].[SquadId] = [t0].[LeaderSquadId] WHERE [o].[Nickname] IS NOT NULL ORDER BY [g].[Nickname], [g].[SquadId], [t0].[Nickname], [t0].[SquadId]"); } @@ -4949,16 +4949,16 @@ public override async Task Correlated_collections_nested_inner_subquery_referenc AssertSql( @"SELECT [g].[FullName], [g].[Nickname], [g].[SquadId], [t0].[FullName], [t0].[Nickname], [t0].[SquadId], [t0].[Name], [t0].[Nickname0], [t0].[Id] FROM [Gears] AS [g] -LEFT JOIN [Officers] AS [o] ON ([g].[Nickname] = [o].[Nickname]) AND ([g].[SquadId] = [o].[SquadId]) +LEFT JOIN [Officers] AS [o] ON [g].[Nickname] = [o].[Nickname] AND [g].[SquadId] = [o].[SquadId] OUTER APPLY ( SELECT [g0].[FullName], [g0].[Nickname], [g0].[SquadId], [t].[Name], [t].[Nickname] AS [Nickname0], [t].[Id] FROM [Gears] AS [g0] LEFT JOIN ( SELECT [w].[Name], [g].[Nickname], [w].[Id], [w].[OwnerFullName] FROM [Weapons] AS [w] - WHERE ([w].[Name] <> N'Bar') OR [w].[Name] IS NULL + WHERE [w].[Name] <> N'Bar' OR [w].[Name] IS NULL ) AS [t] ON [g0].[FullName] = [t].[OwnerFullName] - WHERE ([g0].[FullName] <> N'Foo') AND (([g].[Nickname] = [g0].[LeaderNickname]) AND ([g].[SquadId] = [g0].[LeaderSquadId])) + WHERE [g0].[FullName] <> N'Foo' AND [g].[Nickname] = [g0].[LeaderNickname] AND [g].[SquadId] = [g0].[LeaderSquadId] ) AS [t0] WHERE [o].[Nickname] IS NOT NULL ORDER BY [g].[Nickname], [g].[SquadId], [t0].[Nickname], [t0].[SquadId]"); @@ -4975,14 +4975,14 @@ 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 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]) + LEFT JOIN [Officers] AS [o0] ON [g0].[Nickname] = [o0].[Nickname] AND [g0].[SquadId] = [o0].[SquadId] WHERE [g0].[HasSoulPatch] = CAST(0 AS bit) ) AS [t0] ON [s].[Id] = [t0].[SquadId] WHERE [g].[HasSoulPatch] = CAST(1 AS bit) @@ -5053,7 +5053,7 @@ OUTER APPLY ( 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]) + LEFT JOIN [Officers] AS [o] ON [g].[Nickname] = [o].[Nickname] AND [g].[SquadId] = [o].[SquadId] WHERE [s].[Id] = [g].[SquadId] ORDER BY [g].[Nickname] OFFSET 0 ROWS @@ -5070,7 +5070,7 @@ public override async Task Correlated_collections_with_FirstOrDefault(bool async @"SELECT ( SELECT TOP(1) [g].[FullName] FROM [Gears] AS [g] - LEFT JOIN [Officers] AS [o] ON ([g].[Nickname] = [o].[Nickname]) AND ([g].[SquadId] = [o].[SquadId]) + LEFT JOIN [Officers] AS [o] ON [g].[Nickname] = [o].[Nickname] AND [g].[SquadId] = [o].[SquadId] WHERE [s].[Id] = [g].[SquadId] ORDER BY [g].[Nickname]) FROM [Squads] AS [s] @@ -5118,13 +5118,13 @@ FROM [Tags] AS [t] LEFT JOIN ( SELECT [g].[Nickname], [g].[SquadId] FROM [Gears] AS [g] - LEFT JOIN [Officers] AS [o] ON ([g].[Nickname] = [o].[Nickname]) AND ([g].[SquadId] = [o].[SquadId]) + LEFT JOIN [Officers] AS [o] ON [g].[Nickname] = [o].[Nickname] AND [g].[SquadId] = [o].[SquadId] WHERE [o].[Nickname] IS NOT NULL ) AS [t0] ON [t].[GearNickName] = [t0].[Nickname] 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]"); } @@ -5207,7 +5207,7 @@ public override async Task Correlated_collections_complex_scenario2(bool async) AssertSql( @"SELECT [g].[FullName], [g].[Nickname], [g].[SquadId], [t2].[FullName], [t2].[Nickname], [t2].[SquadId], [t2].[Id], [t2].[Nickname0], [t2].[SquadId0], [t2].[Id0], [t2].[Nickname00], [t2].[HasSoulPatch], [t2].[SquadId00] FROM [Gears] AS [g] -LEFT JOIN [Officers] AS [o] ON ([g].[Nickname] = [o].[Nickname]) AND ([g].[SquadId] = [o].[SquadId]) +LEFT JOIN [Officers] AS [o] ON [g].[Nickname] = [o].[Nickname] AND [g].[SquadId] = [o].[SquadId] LEFT JOIN ( SELECT [g0].[FullName], [g0].[Nickname], [g0].[SquadId], [t1].[Id], [t1].[Nickname] AS [Nickname0], [t1].[SquadId] AS [SquadId0], [t1].[Id0], [t1].[Nickname0] AS [Nickname00], [t1].[HasSoulPatch], [t1].[SquadId0] AS [SquadId00], [g0].[LeaderNickname], [g0].[LeaderSquadId] FROM [Gears] AS [g0] @@ -5224,7 +5224,7 @@ LEFT JOIN ( FROM [Gears] AS [g2] ) AS [t0] ON [s].[Id] = [t0].[SquadId] ) AS [t1] ON [g0].[FullName] = [t1].[OwnerFullName] -) AS [t2] ON ([g].[Nickname] = [t2].[LeaderNickname]) AND ([g].[SquadId] = [t2].[LeaderSquadId]) +) AS [t2] ON [g].[Nickname] = [t2].[LeaderNickname] AND [g].[SquadId] = [t2].[LeaderSquadId] WHERE [o].[Nickname] IS NOT NULL ORDER BY [g].[Nickname], [g].[SquadId], [t2].[Nickname], [t2].[SquadId], [t2].[Id], [t2].[Nickname0], [t2].[SquadId0], [t2].[Id0], [t2].[Nickname00]"); } @@ -5259,7 +5259,7 @@ public override async Task Correlated_collections_with_funky_orderby_complex_sce AssertSql( @"SELECT [g].[FullName], [g].[Nickname], [g].[SquadId], [t2].[FullName], [t2].[Nickname], [t2].[SquadId], [t2].[Id], [t2].[Nickname0], [t2].[SquadId0], [t2].[Id0], [t2].[Nickname00], [t2].[HasSoulPatch], [t2].[SquadId00] FROM [Gears] AS [g] -LEFT JOIN [Officers] AS [o] ON ([g].[Nickname] = [o].[Nickname]) AND ([g].[SquadId] = [o].[SquadId]) +LEFT JOIN [Officers] AS [o] ON [g].[Nickname] = [o].[Nickname] AND [g].[SquadId] = [o].[SquadId] LEFT JOIN ( SELECT [g0].[FullName], [g0].[Nickname], [g0].[SquadId], [t1].[Id], [t1].[Nickname] AS [Nickname0], [t1].[SquadId] AS [SquadId0], [t1].[Id0], [t1].[Nickname0] AS [Nickname00], [t1].[HasSoulPatch], [t1].[SquadId0] AS [SquadId00], [g0].[HasSoulPatch] AS [HasSoulPatch0], [t1].[IsAutomatic], [t1].[Name], [g0].[LeaderNickname], [g0].[LeaderSquadId] FROM [Gears] AS [g0] @@ -5276,7 +5276,7 @@ LEFT JOIN ( FROM [Gears] AS [g2] ) AS [t0] ON [s].[Id] = [t0].[SquadId] ) AS [t1] ON [g0].[FullName] = [t1].[OwnerFullName] -) AS [t2] ON ([g].[Nickname] = [t2].[LeaderNickname]) AND ([g].[SquadId] = [t2].[LeaderSquadId]) +) AS [t2] ON [g].[Nickname] = [t2].[LeaderNickname] AND [g].[SquadId] = [t2].[LeaderSquadId] WHERE [o].[Nickname] IS NOT NULL ORDER BY [g].[HasSoulPatch], [g].[LeaderNickname], [g].[FullName], [g].[Nickname], [g].[SquadId], [t2].[FullName], [t2].[HasSoulPatch0] DESC, [t2].[Nickname], [t2].[SquadId], [t2].[IsAutomatic], [t2].[Name] DESC, [t2].[Id], [t2].[Nickname0], [t2].[SquadId0], [t2].[Id0], [t2].[Nickname00]"); } @@ -5348,9 +5348,9 @@ 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)"); +WHERE [t].[Eradicated] <> CAST(1 AS bit) OR ([t].[Eradicated] IS NULL)"); } public override async Task Null_semantics_on_nullable_bool_from_left_join_subquery_is_fully_applied(bool async) @@ -5366,9 +5366,9 @@ 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)"); +WHERE [t].[Eradicated] <> CAST(1 AS bit) OR ([t].[Eradicated] IS NULL)"); } public override async Task Include_on_derived_type_with_order_by_and_paging(bool async) @@ -5390,9 +5390,9 @@ LEFT JOIN ( 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 [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 [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)) ORDER BY [t0].[Note] ) AS [t1] LEFT JOIN [Weapons] AS [w] ON [t1].[FullName] = [w].[OwnerFullName] @@ -5441,7 +5441,7 @@ public override async Task Outer_parameter_in_join_key(bool async) AssertSql( @"SELECT [g].[Nickname], [g].[SquadId], [t1].[Note], [t1].[Id], [t1].[Nickname], [t1].[SquadId] FROM [Gears] AS [g] -LEFT JOIN [Officers] AS [o] ON ([g].[Nickname] = [o].[Nickname]) AND ([g].[SquadId] = [o].[SquadId]) +LEFT JOIN [Officers] AS [o] ON [g].[Nickname] = [o].[Nickname] AND [g].[SquadId] = [o].[SquadId] OUTER APPLY ( SELECT [t].[Note], [t].[Id], [t0].[Nickname], [t0].[SquadId] FROM [Tags] AS [t] @@ -5461,7 +5461,7 @@ public override async Task Outer_parameter_in_join_key_inner_and_outer(bool asyn AssertSql( @"SELECT [g].[Nickname], [g].[SquadId], [t1].[Note], [t1].[Id], [t1].[Nickname], [t1].[SquadId] FROM [Gears] AS [g] -LEFT JOIN [Officers] AS [o] ON ([g].[Nickname] = [o].[Nickname]) AND ([g].[SquadId] = [o].[SquadId]) +LEFT JOIN [Officers] AS [o] ON [g].[Nickname] = [o].[Nickname] AND [g].[SquadId] = [o].[SquadId] OUTER APPLY ( SELECT [t].[Note], [t].[Id], [t0].[Nickname], [t0].[SquadId] FROM [Tags] AS [t] @@ -5481,7 +5481,7 @@ public override async Task Outer_parameter_in_group_join_with_DefaultIfEmpty(boo AssertSql( @"SELECT [g].[Nickname], [g].[SquadId], [t1].[Note], [t1].[Id], [t1].[Nickname], [t1].[SquadId] FROM [Gears] AS [g] -LEFT JOIN [Officers] AS [o] ON ([g].[Nickname] = [o].[Nickname]) AND ([g].[SquadId] = [o].[SquadId]) +LEFT JOIN [Officers] AS [o] ON [g].[Nickname] = [o].[Nickname] AND [g].[SquadId] = [o].[SquadId] OUTER APPLY ( SELECT [t].[Note], [t].[Id], [t0].[Nickname], [t0].[SquadId] FROM [Tags] AS [t] @@ -5510,7 +5510,7 @@ FROM [Tags] AS [t] 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])"); +) AS [t0] ON [t].[GearNickName] = [t0].[Nickname] AND [t].[GearSquadId] = [t0].[SquadId]"); } public override async Task Order_by_entity_qsre(bool async) @@ -5586,7 +5586,7 @@ FROM [Gears] AS [g] INNER JOIN ( SELECT [g0].[Nickname], [g0].[SquadId], [g0].[FullName] FROM [Gears] AS [g0] -) AS [t] ON ([g].[Nickname] = [t].[Nickname]) AND ([g].[SquadId] = [t].[SquadId])"); +) AS [t] ON [g].[Nickname] = [t].[Nickname] AND [g].[SquadId] = [t].[SquadId]"); } public override async Task Join_on_entity_qsre_keys_inheritance(bool async) @@ -5599,9 +5599,9 @@ FROM [Gears] AS [g] INNER JOIN ( SELECT [g0].[Nickname], [g0].[SquadId], [g0].[FullName] FROM [Gears] AS [g0] - LEFT JOIN [Officers] AS [o0] ON ([g0].[Nickname] = [o0].[Nickname]) AND ([g0].[SquadId] = [o0].[SquadId]) + LEFT JOIN [Officers] AS [o0] ON [g0].[Nickname] = [o0].[Nickname] AND [g0].[SquadId] = [o0].[SquadId] WHERE [o0].[Nickname] IS NOT NULL -) AS [t] ON ([g].[Nickname] = [t].[Nickname]) AND ([g].[SquadId] = [t].[SquadId])"); +) AS [t] ON [g].[Nickname] = [t].[Nickname] AND [g].[SquadId] = [t].[SquadId]"); } public override async Task Join_on_entity_qsre_keys_outer_key_is_navigation(bool async) @@ -5642,9 +5642,9 @@ FROM [Tags] AS [t] LEFT JOIN ( SELECT [g0].[Nickname], [g0].[SquadId] FROM [Gears] AS [g0] - ) AS [t0] ON ([t].[GearNickName] = [t0].[Nickname]) AND ([t].[GearSquadId] = [t0].[SquadId]) + ) AS [t0] ON [t].[GearNickName] = [t0].[Nickname] AND [t].[GearSquadId] = [t0].[SquadId] WHERE [t].[Note] IN (N'Cole''s Tag', N'Dom''s Tag') -) AS [t1] ON ([g].[Nickname] = [t1].[Nickname]) AND ([g].[SquadId] = [t1].[SquadId])"); +) AS [t1] ON [g].[Nickname] = [t1].[Nickname] AND [g].[SquadId] = [t1].[SquadId]"); } public override async Task Join_on_entity_qsre_keys_inner_key_is_nested_navigation(bool async) @@ -5711,8 +5711,8 @@ public override async Task Project_one_value_type_from_empty_collection(bool asy @"SELECT [s].[Name], COALESCE(( SELECT TOP(1) [g].[SquadId] FROM [Gears] AS [g] - LEFT JOIN [Officers] AS [o] ON ([g].[Nickname] = [o].[Nickname]) AND ([g].[SquadId] = [o].[SquadId]) - WHERE ([s].[Id] = [g].[SquadId]) AND ([g].[HasSoulPatch] = CAST(1 AS bit))), 0) AS [SquadId] + LEFT JOIN [Officers] AS [o] ON [g].[Nickname] = [o].[Nickname] AND [g].[SquadId] = [o].[SquadId] + WHERE [s].[Id] = [g].[SquadId] AND [g].[HasSoulPatch] = CAST(1 AS bit)), 0) AS [SquadId] FROM [Squads] AS [s] WHERE [s].[Name] = N'Kilo'"); } @@ -5725,8 +5725,8 @@ public override async Task Project_one_value_type_converted_to_nullable_from_emp @"SELECT [s].[Name], ( SELECT TOP(1) [g].[SquadId] FROM [Gears] AS [g] - LEFT JOIN [Officers] AS [o] ON ([g].[Nickname] = [o].[Nickname]) AND ([g].[SquadId] = [o].[SquadId]) - WHERE ([s].[Id] = [g].[SquadId]) AND ([g].[HasSoulPatch] = CAST(1 AS bit))) AS [SquadId] + LEFT JOIN [Officers] AS [o] ON [g].[Nickname] = [o].[Nickname] AND [g].[SquadId] = [o].[SquadId] + WHERE [s].[Id] = [g].[SquadId] AND [g].[HasSoulPatch] = CAST(1 AS bit)) AS [SquadId] FROM [Squads] AS [s] WHERE [s].[Name] = N'Kilo'"); } @@ -5772,8 +5772,8 @@ public override async Task Select_subquery_projecting_single_constant_int(bool a @"SELECT [s].[Name], COALESCE(( SELECT TOP(1) 42 FROM [Gears] AS [g] - LEFT JOIN [Officers] AS [o] ON ([g].[Nickname] = [o].[Nickname]) AND ([g].[SquadId] = [o].[SquadId]) - WHERE ([s].[Id] = [g].[SquadId]) AND ([g].[HasSoulPatch] = CAST(1 AS bit))), 0) AS [Gear] + LEFT JOIN [Officers] AS [o] ON [g].[Nickname] = [o].[Nickname] AND [g].[SquadId] = [o].[SquadId] + WHERE [s].[Id] = [g].[SquadId] AND [g].[HasSoulPatch] = CAST(1 AS bit)), 0) AS [Gear] FROM [Squads] AS [s]"); } @@ -5785,8 +5785,8 @@ public override async Task Select_subquery_projecting_single_constant_string(boo @"SELECT [s].[Name], ( SELECT TOP(1) N'Foo' FROM [Gears] AS [g] - LEFT JOIN [Officers] AS [o] ON ([g].[Nickname] = [o].[Nickname]) AND ([g].[SquadId] = [o].[SquadId]) - WHERE ([s].[Id] = [g].[SquadId]) AND ([g].[HasSoulPatch] = CAST(1 AS bit))) AS [Gear] + LEFT JOIN [Officers] AS [o] ON [g].[Nickname] = [o].[Nickname] AND [g].[SquadId] = [o].[SquadId] + WHERE [s].[Id] = [g].[SquadId] AND [g].[HasSoulPatch] = CAST(1 AS bit)) AS [Gear] FROM [Squads] AS [s]"); } @@ -5798,8 +5798,8 @@ public override async Task Select_subquery_projecting_single_constant_bool(bool @"SELECT [s].[Name], COALESCE(( SELECT TOP(1) CAST(1 AS bit) FROM [Gears] AS [g] - LEFT JOIN [Officers] AS [o] ON ([g].[Nickname] = [o].[Nickname]) AND ([g].[SquadId] = [o].[SquadId]) - WHERE ([s].[Id] = [g].[SquadId]) AND ([g].[HasSoulPatch] = CAST(1 AS bit))), CAST(0 AS bit)) AS [Gear] + LEFT JOIN [Officers] AS [o] ON [g].[Nickname] = [o].[Nickname] AND [g].[SquadId] = [o].[SquadId] + WHERE [s].[Id] = [g].[SquadId] AND [g].[HasSoulPatch] = CAST(1 AS bit)), CAST(0 AS bit)) AS [Gear] FROM [Squads] AS [s]"); } @@ -5851,7 +5851,7 @@ LEFT JOIN ( 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]) + LEFT JOIN [Officers] AS [o] ON [g].[Nickname] = [o].[Nickname] AND [g].[SquadId] = [o].[SquadId] ) AS [t] ON [s].[Id] = [t].[SquadId] ORDER BY [s].[Id], [t].[Nickname]"); } @@ -5912,14 +5912,14 @@ public override async Task Include_collection_OrderBy_aggregate(bool async) WHEN [o].[Nickname] IS NOT NULL THEN N'Officer' END AS [Discriminator], [t].[Nickname], [t].[SquadId], [t].[AssignedCityName], [t].[CityOfBirthName], [t].[FullName], [t].[HasSoulPatch], [t].[LeaderNickname], [t].[LeaderSquadId], [t].[Rank], [t].[Discriminator] FROM [Gears] AS [g] -LEFT JOIN [Officers] AS [o] ON ([g].[Nickname] = [o].[Nickname]) AND ([g].[SquadId] = [o].[SquadId]) +LEFT JOIN [Officers] AS [o] ON [g].[Nickname] = [o].[Nickname] AND [g].[SquadId] = [o].[SquadId] LEFT JOIN ( SELECT [g0].[Nickname], [g0].[SquadId], [g0].[AssignedCityName], [g0].[CityOfBirthName], [g0].[FullName], [g0].[HasSoulPatch], [g0].[LeaderNickname], [g0].[LeaderSquadId], [g0].[Rank], CASE 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 [t] ON ([g].[Nickname] = [t].[LeaderNickname]) AND ([g].[SquadId] = [t].[LeaderSquadId]) + LEFT JOIN [Officers] AS [o0] ON [g0].[Nickname] = [o0].[Nickname] AND [g0].[SquadId] = [o0].[SquadId] +) AS [t] ON [g].[Nickname] = [t].[LeaderNickname] AND [g].[SquadId] = [t].[LeaderSquadId] WHERE [o].[Nickname] IS NOT NULL ORDER BY ( SELECT COUNT(*) @@ -5936,14 +5936,14 @@ public override async Task Include_collection_with_complex_OrderBy2(bool async) WHEN [o].[Nickname] IS NOT NULL THEN N'Officer' END AS [Discriminator], [t].[Nickname], [t].[SquadId], [t].[AssignedCityName], [t].[CityOfBirthName], [t].[FullName], [t].[HasSoulPatch], [t].[LeaderNickname], [t].[LeaderSquadId], [t].[Rank], [t].[Discriminator] FROM [Gears] AS [g] -LEFT JOIN [Officers] AS [o] ON ([g].[Nickname] = [o].[Nickname]) AND ([g].[SquadId] = [o].[SquadId]) +LEFT JOIN [Officers] AS [o] ON [g].[Nickname] = [o].[Nickname] AND [g].[SquadId] = [o].[SquadId] LEFT JOIN ( SELECT [g0].[Nickname], [g0].[SquadId], [g0].[AssignedCityName], [g0].[CityOfBirthName], [g0].[FullName], [g0].[HasSoulPatch], [g0].[LeaderNickname], [g0].[LeaderSquadId], [g0].[Rank], CASE 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 [t] ON ([g].[Nickname] = [t].[LeaderNickname]) AND ([g].[SquadId] = [t].[LeaderSquadId]) + LEFT JOIN [Officers] AS [o0] ON [g0].[Nickname] = [o0].[Nickname] AND [g0].[SquadId] = [o0].[SquadId] +) AS [t] ON [g].[Nickname] = [t].[LeaderNickname] AND [g].[SquadId] = [t].[LeaderSquadId] WHERE [o].[Nickname] IS NOT NULL ORDER BY ( SELECT TOP(1) [w].[IsAutomatic] @@ -5961,14 +5961,14 @@ public override async Task Include_collection_with_complex_OrderBy3(bool async) WHEN [o].[Nickname] IS NOT NULL THEN N'Officer' END AS [Discriminator], [t].[Nickname], [t].[SquadId], [t].[AssignedCityName], [t].[CityOfBirthName], [t].[FullName], [t].[HasSoulPatch], [t].[LeaderNickname], [t].[LeaderSquadId], [t].[Rank], [t].[Discriminator] FROM [Gears] AS [g] -LEFT JOIN [Officers] AS [o] ON ([g].[Nickname] = [o].[Nickname]) AND ([g].[SquadId] = [o].[SquadId]) +LEFT JOIN [Officers] AS [o] ON [g].[Nickname] = [o].[Nickname] AND [g].[SquadId] = [o].[SquadId] LEFT JOIN ( SELECT [g0].[Nickname], [g0].[SquadId], [g0].[AssignedCityName], [g0].[CityOfBirthName], [g0].[FullName], [g0].[HasSoulPatch], [g0].[LeaderNickname], [g0].[LeaderSquadId], [g0].[Rank], CASE 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 [t] ON ([g].[Nickname] = [t].[LeaderNickname]) AND ([g].[SquadId] = [t].[LeaderSquadId]) + LEFT JOIN [Officers] AS [o0] ON [g0].[Nickname] = [o0].[Nickname] AND [g0].[SquadId] = [o0].[SquadId] +) AS [t] ON [g].[Nickname] = [t].[LeaderNickname] AND [g].[SquadId] = [t].[LeaderSquadId] WHERE [o].[Nickname] IS NOT NULL ORDER BY COALESCE(( SELECT TOP(1) [w].[IsAutomatic] @@ -5984,15 +5984,15 @@ public override async Task Correlated_collection_with_complex_OrderBy(bool async AssertSql( @"SELECT [g].[Nickname], [g].[SquadId], [t].[Nickname], [t].[SquadId], [t].[AssignedCityName], [t].[CityOfBirthName], [t].[FullName], [t].[HasSoulPatch], [t].[LeaderNickname], [t].[LeaderSquadId], [t].[Rank], [t].[Discriminator] FROM [Gears] AS [g] -LEFT JOIN [Officers] AS [o] ON ([g].[Nickname] = [o].[Nickname]) AND ([g].[SquadId] = [o].[SquadId]) +LEFT JOIN [Officers] AS [o] ON [g].[Nickname] = [o].[Nickname] AND [g].[SquadId] = [o].[SquadId] LEFT JOIN ( SELECT [g0].[Nickname], [g0].[SquadId], [g0].[AssignedCityName], [g0].[CityOfBirthName], [g0].[FullName], [g0].[HasSoulPatch], [g0].[LeaderNickname], [g0].[LeaderSquadId], [g0].[Rank], CASE 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]) + LEFT JOIN [Officers] AS [o0] ON [g0].[Nickname] = [o0].[Nickname] AND [g0].[SquadId] = [o0].[SquadId] WHERE [g0].[HasSoulPatch] = CAST(0 AS bit) -) AS [t] ON ([g].[Nickname] = [t].[LeaderNickname]) AND ([g].[SquadId] = [t].[LeaderSquadId]) +) AS [t] ON [g].[Nickname] = [t].[LeaderNickname] AND [g].[SquadId] = [t].[LeaderSquadId] WHERE [o].[Nickname] IS NOT NULL ORDER BY ( SELECT COUNT(*) @@ -6007,24 +6007,24 @@ public override async Task Correlated_collection_with_very_complex_order_by(bool AssertSql( @"SELECT [g].[Nickname], [g].[SquadId], [t].[Nickname], [t].[SquadId], [t].[AssignedCityName], [t].[CityOfBirthName], [t].[FullName], [t].[HasSoulPatch], [t].[LeaderNickname], [t].[LeaderSquadId], [t].[Rank], [t].[Discriminator] FROM [Gears] AS [g] -LEFT JOIN [Officers] AS [o] ON ([g].[Nickname] = [o].[Nickname]) AND ([g].[SquadId] = [o].[SquadId]) +LEFT JOIN [Officers] AS [o] ON [g].[Nickname] = [o].[Nickname] AND [g].[SquadId] = [o].[SquadId] LEFT JOIN ( SELECT [g1].[Nickname], [g1].[SquadId], [g1].[AssignedCityName], [g1].[CityOfBirthName], [g1].[FullName], [g1].[HasSoulPatch], [g1].[LeaderNickname], [g1].[LeaderSquadId], [g1].[Rank], CASE WHEN [o1].[Nickname] IS NOT NULL THEN N'Officer' END AS [Discriminator] FROM [Gears] AS [g1] - LEFT JOIN [Officers] AS [o1] ON ([g1].[Nickname] = [o1].[Nickname]) AND ([g1].[SquadId] = [o1].[SquadId]) + LEFT JOIN [Officers] AS [o1] ON [g1].[Nickname] = [o1].[Nickname] AND [g1].[SquadId] = [o1].[SquadId] WHERE [g1].[HasSoulPatch] = CAST(0 AS bit) -) AS [t] ON ([g].[Nickname] = [t].[LeaderNickname]) AND ([g].[SquadId] = [t].[LeaderSquadId]) +) AS [t] ON [g].[Nickname] = [t].[LeaderNickname] AND [g].[SquadId] = [t].[LeaderSquadId] WHERE [o].[Nickname] IS NOT NULL ORDER BY ( SELECT COUNT(*) FROM [Weapons] AS [w] - WHERE ([g].[FullName] = [w].[OwnerFullName]) AND ([w].[IsAutomatic] = COALESCE(( + WHERE [g].[FullName] = [w].[OwnerFullName] AND [w].[IsAutomatic] = COALESCE(( SELECT TOP(1) [g0].[HasSoulPatch] FROM [Gears] AS [g0] - LEFT JOIN [Officers] AS [o0] ON ([g0].[Nickname] = [o0].[Nickname]) AND ([g0].[SquadId] = [o0].[SquadId]) - WHERE [g0].[Nickname] = N'Marcus'), CAST(0 AS bit)))), [g].[Nickname], [g].[SquadId], [t].[Nickname]"); + LEFT JOIN [Officers] AS [o0] ON [g0].[Nickname] = [o0].[Nickname] AND [g0].[SquadId] = [o0].[SquadId] + WHERE [g0].[Nickname] = N'Marcus'), CAST(0 AS bit))), [g].[Nickname], [g].[SquadId], [t].[Nickname]"); } public override async Task Cast_to_derived_type_after_OfType_works(bool async) @@ -6036,7 +6036,7 @@ public override async Task Cast_to_derived_type_after_OfType_works(bool async) 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]) +LEFT JOIN [Officers] AS [o] ON [g].[Nickname] = [o].[Nickname] AND [g].[SquadId] = [o].[SquadId] WHERE [o].[Nickname] IS NOT NULL"); } @@ -6130,7 +6130,7 @@ public override async Task Select_subquery_boolean_empty(bool async) @"SELECT COALESCE(( SELECT TOP(1) [w].[IsAutomatic] FROM [Weapons] AS [w] - WHERE ([g].[FullName] = [w].[OwnerFullName]) AND ([w].[Name] = N'BFG') + WHERE [g].[FullName] = [w].[OwnerFullName] AND [w].[Name] = N'BFG' ORDER BY [w].[Id]), CAST(0 AS bit)) FROM [Gears] AS [g]"); } @@ -6143,7 +6143,7 @@ public override async Task Select_subquery_boolean_empty_with_pushdown(bool asyn @"SELECT ( SELECT TOP(1) [w].[IsAutomatic] FROM [Weapons] AS [w] - WHERE ([g].[FullName] = [w].[OwnerFullName]) AND ([w].[Name] = N'BFG') + WHERE [g].[FullName] = [w].[OwnerFullName] AND [w].[Name] = N'BFG' ORDER BY [w].[Id]) FROM [Gears] AS [g]"); } @@ -6158,7 +6158,7 @@ SELECT TOP(1) [t].[IsAutomatic] FROM ( SELECT DISTINCT [w].[Id], [w].[AmmunitionType], [w].[IsAutomatic], [w].[Name], [w].[OwnerFullName], [w].[SynergyWithId] FROM [Weapons] AS [w] - WHERE ([g].[FullName] = [w].[OwnerFullName]) AND ([w].[Name] LIKE N'%Lancer%') + WHERE [g].[FullName] = [w].[OwnerFullName] AND ([w].[Name] LIKE N'%Lancer%') ) AS [t]), CAST(0 AS bit)) FROM [Gears] AS [g] WHERE [g].[HasSoulPatch] = CAST(1 AS bit)"); @@ -6172,7 +6172,7 @@ public override async Task Select_subquery_distinct_singleordefault_boolean2(boo @"SELECT COALESCE(( SELECT DISTINCT TOP(1) [w].[IsAutomatic] FROM [Weapons] AS [w] - WHERE ([g].[FullName] = [w].[OwnerFullName]) AND ([w].[Name] LIKE N'%Lancer%')), CAST(0 AS bit)) + WHERE [g].[FullName] = [w].[OwnerFullName] AND ([w].[Name] LIKE N'%Lancer%')), CAST(0 AS bit)) FROM [Gears] AS [g] WHERE [g].[HasSoulPatch] = CAST(1 AS bit)"); } @@ -6187,7 +6187,7 @@ SELECT TOP(1) [t].[IsAutomatic] FROM ( SELECT DISTINCT [w].[Id], [w].[AmmunitionType], [w].[IsAutomatic], [w].[Name], [w].[OwnerFullName], [w].[SynergyWithId] FROM [Weapons] AS [w] - WHERE ([g].[FullName] = [w].[OwnerFullName]) AND ([w].[Name] LIKE N'%Lancer%') + WHERE [g].[FullName] = [w].[OwnerFullName] AND ([w].[Name] LIKE N'%Lancer%') ) AS [t]) FROM [Gears] AS [g] WHERE [g].[HasSoulPatch] = CAST(1 AS bit)"); @@ -6203,7 +6203,7 @@ SELECT TOP(1) [t].[IsAutomatic] FROM ( SELECT DISTINCT [w].[Id], [w].[AmmunitionType], [w].[IsAutomatic], [w].[Name], [w].[OwnerFullName], [w].[SynergyWithId] FROM [Weapons] AS [w] - WHERE ([g].[FullName] = [w].[OwnerFullName]) AND ([w].[Name] = N'BFG') + WHERE [g].[FullName] = [w].[OwnerFullName] AND [w].[Name] = N'BFG' ) AS [t]), CAST(0 AS bit)) FROM [Gears] AS [g] WHERE [g].[HasSoulPatch] = CAST(1 AS bit)"); @@ -6217,7 +6217,7 @@ public override async Task Select_subquery_distinct_singleordefault_boolean_empt @"SELECT COALESCE(( SELECT DISTINCT TOP(1) [w].[IsAutomatic] FROM [Weapons] AS [w] - WHERE ([g].[FullName] = [w].[OwnerFullName]) AND ([w].[Name] = N'BFG')), CAST(0 AS bit)) + WHERE [g].[FullName] = [w].[OwnerFullName] AND [w].[Name] = N'BFG'), CAST(0 AS bit)) FROM [Gears] AS [g] WHERE [g].[HasSoulPatch] = CAST(1 AS bit)"); } @@ -6232,7 +6232,7 @@ SELECT TOP(1) [t].[IsAutomatic] FROM ( SELECT DISTINCT [w].[Id], [w].[AmmunitionType], [w].[IsAutomatic], [w].[Name], [w].[OwnerFullName], [w].[SynergyWithId] FROM [Weapons] AS [w] - WHERE ([g].[FullName] = [w].[OwnerFullName]) AND ([w].[Name] = N'BFG') + WHERE [g].[FullName] = [w].[OwnerFullName] AND [w].[Name] = N'BFG' ) AS [t]) FROM [Gears] AS [g] WHERE [g].[HasSoulPatch] = CAST(1 AS bit)"); @@ -6335,7 +6335,7 @@ public override async Task Double_order_by_on_string_compare(bool async) @"SELECT [w].[Id], [w].[AmmunitionType], [w].[IsAutomatic], [w].[Name], [w].[OwnerFullName], [w].[SynergyWithId] FROM [Weapons] AS [w] ORDER BY CASE - WHEN ([w].[Name] = N'Marcus'' Lancer') AND [w].[Name] IS NOT NULL THEN CAST(1 AS bit) + WHEN [w].[Name] = N'Marcus'' Lancer' AND [w].[Name] IS NOT NULL THEN CAST(1 AS bit) ELSE CAST(0 AS bit) END, [w].[Id]"); } @@ -6359,7 +6359,7 @@ public override async Task String_compare_with_null_conditional_argument(bool as FROM [Weapons] AS [w] LEFT JOIN [Weapons] AS [w0] ON [w].[SynergyWithId] = [w0].[Id] ORDER BY CASE - WHEN ([w0].[Name] = N'Marcus'' Lancer') AND [w0].[Name] IS NOT NULL THEN CAST(1 AS bit) + WHEN [w0].[Name] = N'Marcus'' Lancer' AND [w0].[Name] IS NOT NULL THEN CAST(1 AS bit) ELSE CAST(0 AS bit) END"); } @@ -6373,7 +6373,7 @@ public override async Task String_compare_with_null_conditional_argument2(bool a FROM [Weapons] AS [w] LEFT JOIN [Weapons] AS [w0] ON [w].[SynergyWithId] = [w0].[Id] ORDER BY CASE - WHEN (N'Marcus'' Lancer' = [w0].[Name]) AND [w0].[Name] IS NOT NULL THEN CAST(1 AS bit) + WHEN N'Marcus'' Lancer' = [w0].[Name] AND [w0].[Name] IS NOT NULL THEN CAST(1 AS bit) ELSE CAST(0 AS bit) END"); } @@ -6496,7 +6496,7 @@ LEFT JOIN ( WHEN [o0].[Nickname] IS NOT NULL THEN N'Officer' END AS [Discriminator], [c].[Name], [c].[Location], [c].[Nation], ROW_NUMBER() OVER(PARTITION BY [g0].[Rank] ORDER BY [g0].[Nickname]) AS [row] FROM [Gears] AS [g0] - LEFT JOIN [Officers] AS [o0] ON ([g0].[Nickname] = [o0].[Nickname]) AND ([g0].[SquadId] = [o0].[SquadId]) + 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 [t1] WHERE [t1].[row] <= 1 @@ -6532,7 +6532,7 @@ LEFT JOIN ( WHEN [o0].[Nickname] IS NOT NULL THEN N'Officer' END AS [Discriminator], [c].[Name], [c].[Location], [c].[Nation], ROW_NUMBER() OVER(PARTITION BY [g0].[Rank] ORDER BY [g0].[Nickname], [g0].[SquadId], [c].[Name]) AS [row] FROM [Gears] AS [g0] - LEFT JOIN [Officers] AS [o0] ON ([g0].[Nickname] = [o0].[Nickname]) AND ([g0].[SquadId] = [o0].[SquadId]) + 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] WHERE [g0].[HasSoulPatch] = CAST(1 AS bit) ) AS [t1] @@ -6549,7 +6549,7 @@ public override async Task Include_collection_with_Cast_to_base(bool async) 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 [Officers] AS [o] ON [g].[Nickname] = [o].[Nickname] AND [g].[SquadId] = [o].[SquadId] LEFT JOIN [Weapons] AS [w] ON [g].[FullName] = [w].[OwnerFullName] WHERE [o].[Nickname] IS NOT NULL ORDER BY [g].[Nickname], [g].[SquadId]"); @@ -6564,8 +6564,8 @@ public override async Task Include_with_client_method_and_member_access_still_ap WHEN [o].[Nickname] IS NOT NULL THEN N'Officer' END AS [Discriminator], [t].[Id], [t].[GearNickName], [t].[GearSquadId], [t].[IssueDate], [t].[Note] 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 [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]"); } public override async Task Include_with_projection_of_unmapped_property_still_gets_applied(bool async) @@ -6577,7 +6577,7 @@ public override async Task Include_with_projection_of_unmapped_property_still_ge 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 [Officers] AS [o] ON [g].[Nickname] = [o].[Nickname] AND [g].[SquadId] = [o].[SquadId] LEFT JOIN [Weapons] AS [w] ON [g].[FullName] = [w].[OwnerFullName] ORDER BY [g].[Nickname], [g].[SquadId]"); } @@ -6594,7 +6594,7 @@ LEFT JOIN ( 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 [Officers] AS [o] ON [g].[Nickname] = [o].[Nickname] AND [g].[SquadId] = [o].[SquadId] LEFT JOIN [Weapons] AS [w] ON [g].[FullName] = [w].[OwnerFullName] ) AS [t] ON [s].[Id] = [t].[SquadId] WHERE [s].[Name] = N'Delta' @@ -6694,11 +6694,11 @@ public override async Task Filter_with_complex_predicate_containing_subquery(boo 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].[FullName] <> N'Dom') AND EXISTS ( +LEFT JOIN [Officers] AS [o] ON [g].[Nickname] = [o].[Nickname] AND [g].[SquadId] = [o].[SquadId] +WHERE [g].[FullName] <> N'Dom' AND EXISTS ( SELECT 1 FROM [Weapons] AS [w] - WHERE ([g].[FullName] = [w].[OwnerFullName]) AND ([w].[IsAutomatic] = CAST(1 AS bit)))"); + WHERE [g].[FullName] = [w].[OwnerFullName] AND [w].[IsAutomatic] = CAST(1 AS bit))"); } public override async Task Query_with_complex_let_containing_ordering_and_filter_projecting_firstOrDefault_element_of_let( @@ -6710,7 +6710,7 @@ public override async Task Query_with_complex_let_containing_ordering_and_filter @"SELECT [g].[Nickname], ( SELECT TOP(1) [w].[Name] FROM [Weapons] AS [w] - WHERE ([g].[FullName] = [w].[OwnerFullName]) AND ([w].[IsAutomatic] = CAST(1 AS bit)) + WHERE [g].[FullName] = [w].[OwnerFullName] AND [w].[IsAutomatic] = CAST(1 AS bit) ORDER BY [w].[AmmunitionType] DESC) AS [WeaponName] FROM [Gears] AS [g] WHERE [g].[Nickname] <> N'Dom'"); @@ -6737,9 +6737,9 @@ FROM [Tags] AS [t] LEFT JOIN ( SELECT [g].[Nickname], [g].[SquadId] FROM [Gears] AS [g] -) AS [t0] ON ([t].[GearNickName] = [t0].[Nickname]) AND ([t].[GearSquadId] = [t0].[SquadId]) +) 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) @@ -6779,10 +6779,10 @@ public override async Task OfTypeNav1(bool async) 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]) -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)"); +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)"); } public override async Task OfTypeNav2(bool async) @@ -6794,10 +6794,10 @@ public override async Task OfTypeNav2(bool async) 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]) -LEFT JOIN [Tags] AS [t] ON ([g].[Nickname] = [t].[GearNickName]) AND ([g].[SquadId] = [t].[GearSquadId]) +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) @@ -6809,11 +6809,11 @@ public override async Task OfTypeNav3(bool async) 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]) -LEFT JOIN [Tags] AS [t] ON ([g].[Nickname] = [t].[GearNickName]) AND ([g].[SquadId] = [t].[GearSquadId]) +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] 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)"); +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)"); } public override void Nav_rewrite_Distinct_with_convert() @@ -6846,7 +6846,7 @@ LEFT JOIN ( FROM [LocustLeaders] AS [l0] INNER JOIN [LocustCommanders] AS [l1] ON [l0].[Name] = [l1].[Name] ) AS [t] ON [l].[CommanderName] = [t].[Name] -WHERE ([c].[Name] <> N'Foo') OR [c].[Name] IS NULL"); +WHERE [c].[Name] <> N'Foo' OR [c].[Name] IS NULL"); } public override async Task Nav_rewrite_with_convert2(bool async) @@ -6865,7 +6865,7 @@ SELECT [l0].[Name] FROM [LocustLeaders] AS [l0] INNER JOIN [LocustCommanders] AS [l1] ON [l0].[Name] = [l1].[Name] ) AS [t] ON [l].[CommanderName] = [t].[Name] -WHERE (([c].[Name] <> N'Foo') OR [c].[Name] IS NULL) AND (([t].[Name] <> N'Bar') OR [t].[Name] IS NULL)"); +WHERE ([c].[Name] <> N'Foo' OR [c].[Name] IS NULL) AND ([t].[Name] <> N'Bar' OR [t].[Name] IS NULL)"); } public override async Task Nav_rewrite_with_convert3(bool async) @@ -6884,7 +6884,7 @@ SELECT [l0].[Name] FROM [LocustLeaders] AS [l0] INNER JOIN [LocustCommanders] AS [l1] ON [l0].[Name] = [l1].[Name] ) AS [t] ON [l].[CommanderName] = [t].[Name] -WHERE (([c].[Name] <> N'Foo') OR [c].[Name] IS NULL) AND (([t].[Name] <> N'Bar') OR [t].[Name] IS NULL)"); +WHERE ([c].[Name] <> N'Foo' OR [c].[Name] IS NULL) AND ([t].[Name] <> N'Bar' OR [t].[Name] IS NULL)"); } public override async Task Where_contains_on_navigation_with_composite_keys(bool async) @@ -6912,12 +6912,12 @@ public override async Task Include_with_complex_order_by(bool async) WHEN [o].[Nickname] IS NOT NULL THEN N'Officer' END AS [Discriminator], [w0].[Id], [w0].[AmmunitionType], [w0].[IsAutomatic], [w0].[Name], [w0].[OwnerFullName], [w0].[SynergyWithId] FROM [Gears] AS [g] -LEFT JOIN [Officers] AS [o] ON ([g].[Nickname] = [o].[Nickname]) AND ([g].[SquadId] = [o].[SquadId]) +LEFT JOIN [Officers] AS [o] ON [g].[Nickname] = [o].[Nickname] AND [g].[SquadId] = [o].[SquadId] LEFT JOIN [Weapons] AS [w0] ON [g].[FullName] = [w0].[OwnerFullName] ORDER BY ( SELECT TOP(1) [w].[Name] FROM [Weapons] AS [w] - WHERE ([g].[FullName] = [w].[OwnerFullName]) AND ([w].[Name] LIKE N'%Gnasher%')), [g].[Nickname], [g].[SquadId]"); + WHERE [g].[FullName] = [w].[OwnerFullName] AND ([w].[Name] LIKE N'%Gnasher%')), [g].[Nickname], [g].[SquadId]"); } public override async Task Anonymous_projection_take_followed_by_projecting_single_element_from_collection_navigation(bool async) @@ -6938,7 +6938,7 @@ FROM [Cities] AS [c] WHERE ( SELECT TOP(1) [g].[HasSoulPatch] FROM [Gears] AS [g] - LEFT JOIN [Officers] AS [o] ON ([g].[Nickname] = [o].[Nickname]) AND ([g].[SquadId] = [o].[SquadId]) + LEFT JOIN [Officers] AS [o] ON [g].[Nickname] = [o].[Nickname] AND [g].[SquadId] = [o].[SquadId] ORDER BY [g].[Nickname], [g].[SquadId]) = CAST(1 AS bit)"); } @@ -6952,7 +6952,7 @@ public override async Task DateTimeOffset_Contains_Less_than_Greater_than(bool a SELECT [m].[Id], [m].[CodeName], [m].[Duration], [m].[Rating], [m].[Timeline] FROM [Missions] AS [m] -WHERE ((@__start_0 <= CAST(CONVERT(date, [m].[Timeline]) AS datetimeoffset)) AND ([m].[Timeline] < @__end_1)) AND ([m].[Timeline] = '1902-01-02T10:00:00.1234567+01:30')"); +WHERE @__start_0 <= CAST(CONVERT(date, [m].[Timeline]) AS datetimeoffset) AND [m].[Timeline] < @__end_1 AND [m].[Timeline] = '1902-01-02T10:00:00.1234567+01:30'"); } public override async Task Navigation_inside_interpolated_string_expanded(bool async) @@ -6977,13 +6977,13 @@ public override async Task Left_join_projection_using_coalesce_tracking(bool asy 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]) +LEFT JOIN [Officers] AS [o] ON [g].[Nickname] = [o].[Nickname] AND [g].[SquadId] = [o].[SquadId] LEFT JOIN ( SELECT [g0].[Nickname], [g0].[SquadId], [g0].[AssignedCityName], [g0].[CityOfBirthName], [g0].[FullName], [g0].[HasSoulPatch], [g0].[LeaderNickname], [g0].[LeaderSquadId], [g0].[Rank], CASE 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]) + LEFT JOIN [Officers] AS [o0] ON [g0].[Nickname] = [o0].[Nickname] AND [g0].[SquadId] = [o0].[SquadId] ) AS [t] ON [g].[LeaderNickname] = [t].[Nickname]"); } @@ -6999,13 +6999,13 @@ ELSE CAST(0 AS bit) WHEN [o].[Nickname] IS NOT NULL THEN N'Officer' END AS [Discriminator], [t].[Nickname], [t].[SquadId], [t].[AssignedCityName], [t].[CityOfBirthName], [t].[FullName], [t].[HasSoulPatch], [t].[LeaderNickname], [t].[LeaderSquadId], [t].[Rank], [t].[Discriminator] FROM [Gears] AS [g] -LEFT JOIN [Officers] AS [o] ON ([g].[Nickname] = [o].[Nickname]) AND ([g].[SquadId] = [o].[SquadId]) +LEFT JOIN [Officers] AS [o] ON [g].[Nickname] = [o].[Nickname] AND [g].[SquadId] = [o].[SquadId] LEFT JOIN ( SELECT [g0].[Nickname], [g0].[SquadId], [g0].[AssignedCityName], [g0].[CityOfBirthName], [g0].[FullName], [g0].[HasSoulPatch], [g0].[LeaderNickname], [g0].[LeaderSquadId], [g0].[Rank], CASE 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]) + LEFT JOIN [Officers] AS [o0] ON [g0].[Nickname] = [o0].[Nickname] AND [g0].[SquadId] = [o0].[SquadId] ) AS [t] ON [g].[LeaderNickname] = [t].[Nickname]"); } @@ -7021,8 +7021,8 @@ LEFT JOIN ( 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]) + 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] LEFT JOIN ( SELECT [t2].[Nickname], [t2].[SquadId], [t2].[AssignedCityName], [t2].[CityOfBirthName], [t2].[FullName], [t2].[HasSoulPatch], [t2].[LeaderNickname], [t2].[LeaderSquadId], [t2].[Rank], [t2].[Discriminator] FROM ( @@ -7030,10 +7030,10 @@ LEFT JOIN ( WHEN [o0].[Nickname] IS NOT NULL THEN N'Officer' END AS [Discriminator], ROW_NUMBER() OVER(PARTITION BY [g0].[LeaderNickname], [g0].[LeaderSquadId] ORDER BY [g0].[Nickname], [g0].[SquadId]) AS [row] FROM [Gears] AS [g0] - LEFT JOIN [Officers] AS [o0] ON ([g0].[Nickname] = [o0].[Nickname]) AND ([g0].[SquadId] = [o0].[SquadId]) + 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]"); } @@ -7050,15 +7050,15 @@ LEFT JOIN ( 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]) + 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] LEFT JOIN ( SELECT [g0].[Nickname], [g0].[SquadId], [g0].[AssignedCityName], [g0].[CityOfBirthName], [g0].[FullName], [g0].[HasSoulPatch], [g0].[LeaderNickname], [g0].[LeaderSquadId], [g0].[Rank], CASE 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]) + 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] WHERE [t0].[Discriminator] = N'Officer' ORDER BY [t].[Id], [t0].[Nickname], [t0].[SquadId], [t1].[Nickname]"); } @@ -7075,8 +7075,8 @@ LEFT JOIN ( 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]) + 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] ORDER BY [t].[Id], [t0].[Nickname]"); } @@ -7108,7 +7108,7 @@ public override async Task Join_with_inner_being_a_subquery_projecting_single_pr 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]) +LEFT JOIN [Officers] AS [o] ON [g].[Nickname] = [o].[Nickname] AND [g].[SquadId] = [o].[SquadId] INNER JOIN ( SELECT [g0].[Nickname] FROM [Gears] AS [g0] @@ -7124,7 +7124,7 @@ public override async Task Join_with_inner_being_a_subquery_projecting_anonymous 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]) +LEFT JOIN [Officers] AS [o] ON [g].[Nickname] = [o].[Nickname] AND [g].[SquadId] = [o].[SquadId] INNER JOIN ( SELECT [g0].[Nickname] FROM [Gears] AS [g0] @@ -7228,14 +7228,14 @@ public override async Task OfType_in_subquery_works(bool async) AssertSql( @"SELECT [t].[Name], [t].[Location], [t].[Nation] FROM [Gears] AS [g] -INNER JOIN [Officers] AS [o] ON ([g].[Nickname] = [o].[Nickname]) AND ([g].[SquadId] = [o].[SquadId]) +INNER JOIN [Officers] AS [o] ON [g].[Nickname] = [o].[Nickname] AND [g].[SquadId] = [o].[SquadId] INNER JOIN ( SELECT [c].[Name], [c].[Location], [c].[Nation], [g0].[LeaderNickname], [g0].[LeaderSquadId] FROM [Gears] AS [g0] - LEFT JOIN [Officers] AS [o0] ON ([g0].[Nickname] = [o0].[Nickname]) AND ([g0].[SquadId] = [o0].[SquadId]) + LEFT JOIN [Officers] AS [o0] ON [g0].[Nickname] = [o0].[Nickname] AND [g0].[SquadId] = [o0].[SquadId] LEFT JOIN [Cities] AS [c] ON [g0].[AssignedCityName] = [c].[Name] WHERE [o0].[Nickname] IS NOT NULL -) AS [t] ON ([g].[Nickname] = [t].[LeaderNickname]) AND ([g].[SquadId] = [t].[LeaderSquadId])"); +) AS [t] ON [g].[Nickname] = [t].[LeaderNickname] AND [g].[SquadId] = [t].[LeaderSquadId]"); } public override async Task Nullable_bool_comparison_is_translated_to_server(bool async) @@ -7244,7 +7244,7 @@ public override async Task Nullable_bool_comparison_is_translated_to_server(bool AssertSql( @"SELECT CASE - WHEN ([l].[Eradicated] = CAST(1 AS bit)) AND ([l].[Eradicated] IS NOT NULL) THEN CAST(1 AS bit) + WHEN [l].[Eradicated] = CAST(1 AS bit) AND ([l].[Eradicated] IS NOT NULL) THEN CAST(1 AS bit) ELSE CAST(0 AS bit) END AS [IsEradicated] FROM [Factions] AS [f] @@ -7278,8 +7278,8 @@ LEFT JOIN ( 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]) + 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] LEFT JOIN [Squads] AS [s] ON [t0].[SquadId] = [s].[Id] ORDER BY [t].[Note]"); } @@ -7297,7 +7297,7 @@ FROM [Tags] AS [t] LEFT JOIN ( SELECT [g].[Nickname], [g].[SquadId], [g].[FullName] FROM [Gears] AS [g] -) AS [t0] ON ([t].[GearNickName] = [t0].[Nickname]) AND ([t].[GearSquadId] = [t0].[SquadId]) +) AS [t0] ON [t].[GearNickName] = [t0].[Nickname] AND [t].[GearSquadId] = [t0].[SquadId] LEFT JOIN ( SELECT [t2].[Nickname], [w].[Id], [t2].[SquadId], [w].[OwnerFullName] FROM [Weapons] AS [w] @@ -7319,8 +7319,8 @@ FROM [Cities] AS [c] 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'))"); + 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')"); } public override async Task Query_reusing_parameter_doesnt_declare_duplicate_parameter(bool async) @@ -7336,8 +7336,8 @@ public override async Task Query_reusing_parameter_doesnt_declare_duplicate_para 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].[Nickname] <> @__prm_Inner_Nickname_0) AND ([g].[Nickname] <> @__prm_Inner_Nickname_0) + LEFT JOIN [Officers] AS [o] ON [g].[Nickname] = [o].[Nickname] AND [g].[SquadId] = [o].[SquadId] + WHERE [g].[Nickname] <> @__prm_Inner_Nickname_0 AND [g].[Nickname] <> @__prm_Inner_Nickname_0 ) AS [t] ORDER BY [t].[FullName]"); } @@ -7355,23 +7355,23 @@ public override async Task Query_reusing_parameter_with_inner_query_doesnt_decla 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]) + LEFT JOIN [Officers] AS [o] ON [g].[Nickname] = [o].[Nickname] AND [g].[SquadId] = [o].[SquadId] INNER JOIN [Squads] AS [s] ON [g].[SquadId] = [s].[Id] WHERE EXISTS ( SELECT 1 FROM [Squads] AS [s0] - WHERE ([s0].[Id] = @__squadId_0) AND ([s0].[Id] = [s].[Id])) + WHERE [s0].[Id] = @__squadId_0 AND [s0].[Id] = [s].[Id]) UNION ALL SELECT [g0].[Nickname], [g0].[SquadId], [g0].[AssignedCityName], [g0].[CityOfBirthName], [g0].[FullName], [g0].[HasSoulPatch], [g0].[LeaderNickname], [g0].[LeaderSquadId], [g0].[Rank], CASE 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]) + LEFT JOIN [Officers] AS [o0] ON [g0].[Nickname] = [o0].[Nickname] AND [g0].[SquadId] = [o0].[SquadId] INNER JOIN [Squads] AS [s1] ON [g0].[SquadId] = [s1].[Id] WHERE EXISTS ( SELECT 1 FROM [Squads] AS [s2] - WHERE ([s2].[Id] = @__squadId_0) AND ([s2].[Id] = [s1].[Id])) + WHERE [s2].[Id] = @__squadId_0 AND [s2].[Id] = [s1].[Id]) ) AS [t] ORDER BY [t].[FullName]"); } @@ -7388,8 +7388,8 @@ FROM [Squads] AS [s] WHERE EXISTS ( SELECT 1 FROM [Gears] AS [g] - LEFT JOIN [Officers] AS [o] ON ([g].[Nickname] = [o].[Nickname]) AND ([g].[SquadId] = [o].[SquadId]) - WHERE (([s].[Id] = [g].[SquadId]) AND ([g].[SquadId] = @__gearId_0)) AND ([g].[SquadId] = @__gearId_0))"); + LEFT JOIN [Officers] AS [o] ON [g].[Nickname] = [o].[Nickname] AND [g].[SquadId] = [o].[SquadId] + WHERE [s].[Id] = [g].[SquadId] AND [g].[SquadId] = @__gearId_0 AND [g].[SquadId] = @__gearId_0)"); } public override async Task Query_reusing_parameter_doesnt_declare_duplicate_parameter_complex(bool async) @@ -7405,7 +7405,7 @@ public override async Task Query_reusing_parameter_doesnt_declare_duplicate_para 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]) + LEFT JOIN [Officers] AS [o] ON [g].[Nickname] = [o].[Nickname] AND [g].[SquadId] = [o].[SquadId] INNER JOIN [Squads] AS [s] ON [g].[SquadId] = [s].[Id] WHERE [s].[Id] = @__entity_equality_prm_Inner_Squad_0_Id ) AS [t] @@ -7426,7 +7426,7 @@ SELECT COUNT(*) FROM [Weapons] AS [w] WHERE [g].[FullName] = [w].[OwnerFullName]) AS [Count] FROM [Gears] AS [g] - LEFT JOIN [Officers] AS [o] ON ([g].[Nickname] = [o].[Nickname]) AND ([g].[SquadId] = [o].[SquadId]) + 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] UNION ALL SELECT [c0].[Name], ( @@ -7434,7 +7434,7 @@ SELECT COUNT(*) FROM [Weapons] AS [w0] WHERE [g0].[FullName] = [w0].[OwnerFullName]) AS [Count] FROM [Gears] AS [g0] - LEFT JOIN [Officers] AS [o0] ON ([g0].[Nickname] = [o0].[Nickname]) AND ([g0].[SquadId] = [o0].[SquadId]) + LEFT JOIN [Officers] AS [o0] ON [g0].[Nickname] = [o0].[Nickname] AND [g0].[SquadId] = [o0].[SquadId] INNER JOIN [Cities] AS [c0] ON [g0].[CityOfBirthName] = [c0].[Name] ) AS [t] GROUP BY [t].[Name], [t].[Count]"); @@ -7452,7 +7452,7 @@ SELECT COUNT(*) FROM [Weapons] AS [w] WHERE [g].[FullName] = [w].[OwnerFullName]) AS [Count] FROM [Gears] AS [g] - LEFT JOIN [Officers] AS [o] ON ([g].[Nickname] = [o].[Nickname]) AND ([g].[SquadId] = [o].[SquadId]) + 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] UNION ALL SELECT [c0].[Name], ( @@ -7460,7 +7460,7 @@ SELECT COUNT(*) FROM [Weapons] AS [w0] WHERE [g0].[FullName] = [w0].[OwnerFullName]) AS [Count] FROM [Gears] AS [g0] - LEFT JOIN [Officers] AS [o0] ON ([g0].[Nickname] = [o0].[Nickname]) AND ([g0].[SquadId] = [o0].[SquadId]) + LEFT JOIN [Officers] AS [o0] ON [g0].[Nickname] = [o0].[Nickname] AND [g0].[SquadId] = [o0].[SquadId] INNER JOIN [Cities] AS [c0] ON [g0].[CityOfBirthName] = [c0].[Name] ) AS [t] GROUP BY [t].[Name], [t].[Count]"); @@ -7504,7 +7504,7 @@ FROM [Tags] AS [t] 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]) +) AS [t0] ON [t].[GearNickName] = [t0].[Nickname] AND [t].[GearSquadId] = [t0].[SquadId] LEFT JOIN [Squads] AS [s] ON [t0].[SquadId] = [s].[Id] GROUP BY [t0].[HasSoulPatch], [s].[Name]"); } @@ -7571,7 +7571,7 @@ public override async Task Where_null_parameter_is_not_null(bool async) 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]) +LEFT JOIN [Officers] AS [o] ON [g].[Nickname] = [o].[Nickname] AND [g].[SquadId] = [o].[SquadId] WHERE @__p_0 = CAST(1 AS bit)"); } @@ -7584,7 +7584,7 @@ public override async Task OrderBy_StartsWith_with_null_parameter_as_argument(bo 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]) +LEFT JOIN [Officers] AS [o] ON [g].[Nickname] = [o].[Nickname] AND [g].[SquadId] = [o].[SquadId] ORDER BY [g].[Nickname]"); } @@ -7597,7 +7597,7 @@ public override async Task OrderBy_Contains_empty_list(bool async) 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])"); +LEFT JOIN [Officers] AS [o] ON [g].[Nickname] = [o].[Nickname] AND [g].[SquadId] = [o].[SquadId]"); } public override async Task Where_with_enum_flags_parameter(bool async) @@ -7611,14 +7611,14 @@ public override async Task Where_with_enum_flags_parameter(bool async) 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]) +LEFT JOIN [Officers] AS [o] ON [g].[Nickname] = [o].[Nickname] AND [g].[SquadId] = [o].[SquadId] WHERE ([g].[Rank] & @__rank_0) = @__rank_0", // @"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] FROM [Gears] AS [g] -LEFT JOIN [Officers] AS [o] ON ([g].[Nickname] = [o].[Nickname]) AND ([g].[SquadId] = [o].[SquadId])", +LEFT JOIN [Officers] AS [o] ON [g].[Nickname] = [o].[Nickname] AND [g].[SquadId] = [o].[SquadId]", // @"@__rank_0='2' (Nullable = true) @@ -7626,14 +7626,14 @@ LEFT JOIN [Officers] AS [o] ON ([g].[Nickname] = [o].[Nickname]) AND ([g].[Squad 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]) +LEFT JOIN [Officers] AS [o] ON [g].[Nickname] = [o].[Nickname] AND [g].[SquadId] = [o].[SquadId] WHERE ([g].[Rank] | @__rank_0) <> @__rank_0", // @"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] FROM [Gears] AS [g] -LEFT JOIN [Officers] AS [o] ON ([g].[Nickname] = [o].[Nickname]) AND ([g].[SquadId] = [o].[SquadId]) +LEFT JOIN [Officers] AS [o] ON [g].[Nickname] = [o].[Nickname] AND [g].[SquadId] = [o].[SquadId] WHERE 0 = 1"); } @@ -7648,15 +7648,15 @@ END AS [Discriminator] FROM [Factions] AS [f] LEFT JOIN [LocustHordes] AS [l] ON [f].[Id] = [l].[Id] LEFT JOIN [Cities] AS [c] ON [f].[CapitalName] = [c].[Name] -WHERE ([c].[Name] = ( +WHERE [c].[Name] = ( SELECT TOP(1) [c0].[Name] FROM [Gears] AS [g] - LEFT JOIN [Officers] AS [o] ON ([g].[Nickname] = [o].[Nickname]) AND ([g].[SquadId] = [o].[SquadId]) + 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]) + 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)"); } @@ -7672,7 +7672,7 @@ public override async Task Bitwise_operation_with_non_null_parameter_optimizes_n 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]) +LEFT JOIN [Officers] AS [o] ON [g].[Nickname] = [o].[Nickname] AND [g].[SquadId] = [o].[SquadId] WHERE ([g].[Rank] & @__ranks_0) <> 0", // @"@__ranks_0='134' @@ -7716,7 +7716,7 @@ FROM [Weapons] AS [w] SELECT [w].[Id], [w].[AmmunitionType], [w].[IsAutomatic], [w].[Name], [w].[OwnerFullName], [w].[SynergyWithId] FROM [Weapons] AS [w] -WHERE (([w].[AmmunitionType] & @__prm_0) <> 0) OR [w].[AmmunitionType] IS NULL", +WHERE ([w].[AmmunitionType] & @__prm_0) <> 0 OR [w].[AmmunitionType] IS NULL", // @"@__prm_0='1' (Nullable = true) @@ -7736,7 +7736,7 @@ public override async Task Logical_operation_with_non_null_parameter_optimizes_n 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]) +LEFT JOIN [Officers] AS [o] ON [g].[Nickname] = [o].[Nickname] AND [g].[SquadId] = [o].[SquadId] WHERE [g].[HasSoulPatch] <> @__prm_0", // @"@__prm_0='False' @@ -7745,7 +7745,7 @@ LEFT JOIN [Officers] AS [o] ON ([g].[Nickname] = [o].[Nickname]) AND ([g].[Squad 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]) +LEFT JOIN [Officers] AS [o] ON [g].[Nickname] = [o].[Nickname] AND [g].[SquadId] = [o].[SquadId] WHERE [g].[HasSoulPatch] <> @__prm_0"); } @@ -7756,7 +7756,7 @@ public override async Task Cast_OfType_works_correctly(bool async) AssertSql( @"SELECT [g].[FullName] FROM [Gears] AS [g] -LEFT JOIN [Officers] AS [o] ON ([g].[Nickname] = [o].[Nickname]) AND ([g].[SquadId] = [o].[SquadId]) +LEFT JOIN [Officers] AS [o] ON [g].[Nickname] = [o].[Nickname] AND [g].[SquadId] = [o].[SquadId] WHERE [o].[Nickname] IS NOT NULL"); } @@ -7776,10 +7776,10 @@ FROM [Factions] AS [f] LEFT JOIN [LocustHordes] AS [l1] ON [f].[Id] = [l1].[Id] WHERE [l1].[Id] IS NOT NULL ) AS [t] ON [l].[Name] = [t].[CommanderName] -WHERE (CASE +WHERE CASE WHEN [t].[Name] = N'Locust' THEN CAST(1 AS bit) ELSE NULL -END <> CAST(1 AS bit)) OR (CASE +END <> CAST(1 AS bit) OR (CASE WHEN [t].[Name] = N'Locust' THEN CAST(1 AS bit) ELSE NULL END IS NULL)"); @@ -7862,7 +7862,7 @@ public override async Task Conditional_expression_with_test_being_simplified_to_ 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]) +LEFT JOIN [Officers] AS [o] ON [g].[Nickname] = [o].[Nickname] AND [g].[SquadId] = [o].[SquadId] WHERE CASE WHEN [g].[HasSoulPatch] = @__prm_0 THEN CAST(1 AS bit) ELSE CAST(0 AS bit) @@ -7881,13 +7881,13 @@ public override async Task Conditional_expression_with_test_being_simplified_to_ 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]) +LEFT JOIN [Officers] AS [o] ON [g].[Nickname] = [o].[Nickname] AND [g].[SquadId] = [o].[SquadId] WHERE CASE WHEN [g].[HasSoulPatch] = @__prm_0 THEN CASE - WHEN (( + 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) @@ -8121,7 +8121,7 @@ WHERE EXISTS ( SELECT 1 FROM [LocustLeaders] AS [l1] LEFT JOIN [LocustCommanders] AS [l2] ON [l1].[Name] = [l2].[Name] - WHERE ([l1].[ThreatLevelNullableByte] = [l].[ThreatLevelNullableByte]) OR ([l1].[ThreatLevelNullableByte] IS NULL AND [l].[ThreatLevelNullableByte] IS NULL))"); + WHERE [l1].[ThreatLevelNullableByte] = [l].[ThreatLevelNullableByte] OR ([l1].[ThreatLevelNullableByte] IS NULL AND [l].[ThreatLevelNullableByte] IS NULL))"); } public override async Task Contains_on_collection_of_nullable_byte_subquery_null_constant(bool async) @@ -8188,7 +8188,7 @@ CROSS APPLY ( 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]) + LEFT JOIN [Officers] AS [o] ON [g].[Nickname] = [o].[Nickname] AND [g].[SquadId] = [o].[SquadId] WHERE EXISTS ( SELECT 1 FROM [LocustLeaders] AS [l1] @@ -8210,7 +8210,7 @@ CROSS APPLY ( 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]) + LEFT JOIN [Officers] AS [o] ON [g].[Nickname] = [o].[Nickname] AND [g].[SquadId] = [o].[SquadId] WHERE NOT (EXISTS ( SELECT 1 FROM [LocustLeaders] AS [l1] @@ -8231,12 +8231,12 @@ CROSS APPLY ( 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]) + LEFT JOIN [Officers] AS [o] ON [g].[Nickname] = [o].[Nickname] AND [g].[SquadId] = [o].[SquadId] 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]"); } @@ -8252,12 +8252,12 @@ CROSS APPLY ( 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]) + LEFT JOIN [Officers] AS [o] ON [g].[Nickname] = [o].[Nickname] AND [g].[SquadId] = [o].[SquadId] 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]"); } @@ -8284,7 +8284,7 @@ public override async Task Enum_flags_closure_typed_as_underlying_type_generates 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]) +LEFT JOIN [Officers] AS [o] ON [g].[Nickname] = [o].[Nickname] AND [g].[SquadId] = [o].[SquadId] WHERE (@__prm_0 & [g].[Rank]) = [g].[Rank]"); } @@ -8299,7 +8299,7 @@ public override async Task Enum_flags_closure_typed_as_different_type_generates_ 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]) +LEFT JOIN [Officers] AS [o] ON [g].[Nickname] = [o].[Nickname] AND [g].[SquadId] = [o].[SquadId] WHERE (@__prm_0 & CAST([g].[Rank] AS int)) = CAST([g].[Rank] AS int)"); } @@ -8323,7 +8323,7 @@ public override async Task Enum_array_contains(bool async) @"SELECT [w].[Id], [w].[AmmunitionType], [w].[IsAutomatic], [w].[Name], [w].[OwnerFullName], [w].[SynergyWithId] FROM [Weapons] AS [w] LEFT JOIN [Weapons] AS [w0] ON [w].[SynergyWithId] = [w0].[Id] -WHERE [w0].[Id] IS NOT NULL AND (([w0].[AmmunitionType] = 1) OR [w0].[AmmunitionType] IS NULL)"); +WHERE [w0].[Id] IS NOT NULL AND ([w0].[AmmunitionType] = 1 OR [w0].[AmmunitionType] IS NULL)"); } [ConditionalTheory] @@ -8384,8 +8384,8 @@ public override async Task SelectMany_predicate_with_non_equality_comparison_con 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 +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 ORDER BY [g].[Nickname], [w].[Id]"); } @@ -8398,8 +8398,8 @@ public override async Task SelectMany_predicate_with_non_equality_comparison_Def 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 [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 ORDER BY [g].[Nickname], [w].[Id]"); } @@ -8413,12 +8413,12 @@ public override async Task SelectMany_predicate_after_navigation_with_non_equali WHEN [o].[Nickname] IS NOT NULL THEN N'Officer' END AS [Discriminator], [t].[Id], [t].[AmmunitionType], [t].[IsAutomatic], [t].[Name], [t].[OwnerFullName], [t].[SynergyWithId] FROM [Gears] AS [g] -LEFT JOIN [Officers] AS [o] ON ([g].[Nickname] = [o].[Nickname]) AND ([g].[SquadId] = [o].[SquadId]) +LEFT JOIN [Officers] AS [o] ON [g].[Nickname] = [o].[Nickname] AND [g].[SquadId] = [o].[SquadId] LEFT JOIN ( SELECT [w0].[Id], [w0].[AmmunitionType], [w0].[IsAutomatic], [w0].[Name], [w0].[OwnerFullName], [w0].[SynergyWithId] FROM [Weapons] AS [w] LEFT JOIN [Weapons] AS [w0] ON [w].[SynergyWithId] = [w0].[Id] -) AS [t] ON ([g].[FullName] <> [t].[OwnerFullName]) OR [t].[OwnerFullName] IS NULL +) AS [t] ON [g].[FullName] <> [t].[OwnerFullName] OR [t].[OwnerFullName] IS NULL ORDER BY [g].[Nickname], [t].[Id]"); } @@ -8429,7 +8429,7 @@ public override async Task SelectMany_without_result_selector_and_non_equality_c AssertSql( @"SELECT [w].[Id], [w].[AmmunitionType], [w].[IsAutomatic], [w].[Name], [w].[OwnerFullName], [w].[SynergyWithId] FROM [Gears] AS [g] -LEFT JOIN [Weapons] AS [w] ON ([g].[FullName] <> [w].[OwnerFullName]) OR [w].[OwnerFullName] IS NULL"); +LEFT JOIN [Weapons] AS [w] ON [g].[FullName] <> [w].[OwnerFullName] OR [w].[OwnerFullName] IS NULL"); } public override async Task Filtered_collection_projection_with_order_comparison_predicate_converted_to_join(bool async) @@ -8439,7 +8439,7 @@ public override async Task Filtered_collection_projection_with_order_comparison_ AssertSql( @"SELECT [g].[Nickname], [g].[SquadId], [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]) AND ([g].[SquadId] < [w].[Id]) +LEFT JOIN [Weapons] AS [w] ON [g].[FullName] = [w].[OwnerFullName] AND [g].[SquadId] < [w].[Id] ORDER BY [g].[Nickname], [g].[SquadId]"); } @@ -8450,7 +8450,7 @@ public override async Task Filtered_collection_projection_with_order_comparison_ AssertSql( @"SELECT [g].[Nickname], [g].[SquadId], [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]) AND ([g].[SquadId] <= [w].[Id]) +LEFT JOIN [Weapons] AS [w] ON [g].[FullName] = [w].[OwnerFullName] AND [g].[SquadId] <= [w].[Id] ORDER BY [g].[Nickname], [g].[SquadId]"); } @@ -8461,7 +8461,7 @@ public override async Task Filtered_collection_projection_with_order_comparison_ AssertSql( @"SELECT [g].[Nickname], [g].[SquadId], [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]) AND ([g].[SquadId] >= [w].[Id]) +LEFT JOIN [Weapons] AS [w] ON [g].[FullName] = [w].[OwnerFullName] AND [g].[SquadId] >= [w].[Id] ORDER BY [g].[Nickname], [g].[SquadId]"); } @@ -8474,11 +8474,11 @@ public override async Task SelectMany_predicate_with_non_equality_comparison_wit WHEN [o].[Nickname] IS NOT NULL THEN N'Officer' END AS [Discriminator], [t].[Id], [t].[AmmunitionType], [t].[IsAutomatic], [t].[Name], [t].[OwnerFullName], [t].[SynergyWithId] FROM [Gears] AS [g] -LEFT JOIN [Officers] AS [o] ON ([g].[Nickname] = [o].[Nickname]) AND ([g].[SquadId] = [o].[SquadId]) +LEFT JOIN [Officers] AS [o] ON [g].[Nickname] = [o].[Nickname] AND [g].[SquadId] = [o].[SquadId] 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]"); @@ -8491,11 +8491,11 @@ public override async Task FirstOrDefault_over_int_compared_to_zero(bool async) AssertSql( @"SELECT [s].[Name] FROM [Squads] AS [s] -WHERE ([s].[Name] = N'Kilo') AND (COALESCE(( +WHERE [s].[Name] = N'Kilo' AND COALESCE(( SELECT TOP(1) [g].[SquadId] FROM [Gears] AS [g] - LEFT JOIN [Officers] AS [o] ON ([g].[Nickname] = [o].[Nickname]) AND ([g].[SquadId] = [o].[SquadId]) - WHERE ([s].[Id] = [g].[SquadId]) AND ([g].[HasSoulPatch] = CAST(1 AS bit))), 0) <> 0)"); + LEFT JOIN [Officers] AS [o] ON [g].[Nickname] = [o].[Nickname] AND [g].[SquadId] = [o].[SquadId] + WHERE [s].[Id] = [g].[SquadId] AND [g].[HasSoulPatch] = CAST(1 AS bit)), 0) <> 0"); } public override async Task Correlated_collection_with_inner_collection_references_element_two_levels_up(bool async) @@ -8505,11 +8505,11 @@ public override async Task Correlated_collection_with_inner_collection_reference AssertSql( @"SELECT [g].[FullName], [g].[Nickname], [g].[SquadId], [t].[ReportName], [t].[OfficerName], [t].[Nickname], [t].[SquadId] FROM [Gears] AS [g] -LEFT JOIN [Officers] AS [o] ON ([g].[Nickname] = [o].[Nickname]) AND ([g].[SquadId] = [o].[SquadId]) +LEFT JOIN [Officers] AS [o] ON [g].[Nickname] = [o].[Nickname] AND [g].[SquadId] = [o].[SquadId] OUTER APPLY ( SELECT [g0].[FullName] AS [ReportName], [g].[FullName] AS [OfficerName], [g0].[Nickname], [g0].[SquadId] FROM [Gears] AS [g0] - WHERE ([g].[Nickname] = [g0].[LeaderNickname]) AND ([g].[SquadId] = [g0].[LeaderSquadId]) + WHERE [g].[Nickname] = [g0].[LeaderNickname] AND [g].[SquadId] = [g0].[LeaderSquadId] ) AS [t] WHERE [o].[Nickname] IS NOT NULL ORDER BY [g].[Nickname], [g].[SquadId], [t].[Nickname]"); @@ -8525,14 +8525,14 @@ WHEN [l0].[Name] IS NOT NULL THEN N'LocustCommander' END AS [Discriminator] FROM [LocustLeaders] AS [l] LEFT JOIN [LocustCommanders] AS [l0] ON [l].[Name] = [l0].[Name] -WHERE [l0].[Name] IS NOT NULL AND (([l0].[HighCommandId] <> 0) OR [l0].[HighCommandId] IS NULL)", +WHERE [l0].[Name] IS NOT NULL AND ([l0].[HighCommandId] <> 0 OR [l0].[HighCommandId] IS NULL)", // @"SELECT [l].[Name], [l].[LocustHordeId], [l].[ThreatLevel], [l].[ThreatLevelByte], [l].[ThreatLevelNullableByte], [l0].[DefeatedByNickname], [l0].[DefeatedBySquadId], [l0].[HighCommandId], CASE WHEN [l0].[Name] IS NOT NULL THEN N'LocustCommander' END AS [Discriminator] FROM [LocustLeaders] AS [l] LEFT JOIN [LocustCommanders] AS [l0] ON [l].[Name] = [l0].[Name] -WHERE [l0].[Name] IS NOT NULL AND (([l0].[HighCommandId] <> 0) OR [l0].[HighCommandId] IS NULL)"); +WHERE [l0].[Name] IS NOT NULL AND ([l0].[HighCommandId] <> 0 OR [l0].[HighCommandId] IS NULL)"); } public override async Task Cast_to_derived_followed_by_include_and_FirstOrDefault(bool async) @@ -8550,8 +8550,8 @@ LEFT JOIN ( 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 [t] ON ([l0].[DefeatedByNickname] = [t].[Nickname]) AND ([l0].[DefeatedBySquadId] = [t].[SquadId]) + 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] WHERE [l].[Name] LIKE N'%Queen%'"); } @@ -8612,15 +8612,15 @@ public override async Task Composite_key_entity_equal(bool async) WHEN [o].[Nickname] IS NOT NULL THEN N'Officer' END AS [Discriminator], [t].[Nickname], [t].[SquadId], [t].[AssignedCityName], [t].[CityOfBirthName], [t].[FullName], [t].[HasSoulPatch], [t].[LeaderNickname], [t].[LeaderSquadId], [t].[Rank], [t].[Discriminator] FROM [Gears] AS [g] -LEFT JOIN [Officers] AS [o] ON ([g].[Nickname] = [o].[Nickname]) AND ([g].[SquadId] = [o].[SquadId]) +LEFT JOIN [Officers] AS [o] ON [g].[Nickname] = [o].[Nickname] AND [g].[SquadId] = [o].[SquadId] CROSS JOIN ( SELECT [g0].[Nickname], [g0].[SquadId], [g0].[AssignedCityName], [g0].[CityOfBirthName], [g0].[FullName], [g0].[HasSoulPatch], [g0].[LeaderNickname], [g0].[LeaderSquadId], [g0].[Rank], CASE 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]) + LEFT JOIN [Officers] AS [o0] ON [g0].[Nickname] = [o0].[Nickname] AND [g0].[SquadId] = [o0].[SquadId] ) AS [t] -WHERE ([g].[Nickname] = [t].[Nickname]) AND ([g].[SquadId] = [t].[SquadId])"); +WHERE [g].[Nickname] = [t].[Nickname] AND [g].[SquadId] = [t].[SquadId]"); } public override async Task Composite_key_entity_not_equal(bool async) @@ -8632,15 +8632,15 @@ public override async Task Composite_key_entity_not_equal(bool async) WHEN [o].[Nickname] IS NOT NULL THEN N'Officer' END AS [Discriminator], [t].[Nickname], [t].[SquadId], [t].[AssignedCityName], [t].[CityOfBirthName], [t].[FullName], [t].[HasSoulPatch], [t].[LeaderNickname], [t].[LeaderSquadId], [t].[Rank], [t].[Discriminator] FROM [Gears] AS [g] -LEFT JOIN [Officers] AS [o] ON ([g].[Nickname] = [o].[Nickname]) AND ([g].[SquadId] = [o].[SquadId]) +LEFT JOIN [Officers] AS [o] ON [g].[Nickname] = [o].[Nickname] AND [g].[SquadId] = [o].[SquadId] CROSS JOIN ( SELECT [g0].[Nickname], [g0].[SquadId], [g0].[AssignedCityName], [g0].[CityOfBirthName], [g0].[FullName], [g0].[HasSoulPatch], [g0].[LeaderNickname], [g0].[LeaderSquadId], [g0].[Rank], CASE 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]) + LEFT JOIN [Officers] AS [o0] ON [g0].[Nickname] = [o0].[Nickname] AND [g0].[SquadId] = [o0].[SquadId] ) AS [t] -WHERE ([g].[Nickname] <> [t].[Nickname]) OR ([g].[SquadId] <> [t].[SquadId])"); +WHERE [g].[Nickname] <> [t].[Nickname] OR [g].[SquadId] <> [t].[SquadId]"); } public override async Task Composite_key_entity_equal_null(bool async) @@ -8656,7 +8656,7 @@ FROM [LocustLeaders] AS [l] LEFT JOIN ( SELECT [g].[Nickname], [g].[SquadId] FROM [Gears] AS [g] -) AS [t] ON ([l0].[DefeatedByNickname] = [t].[Nickname]) AND ([l0].[DefeatedBySquadId] = [t].[SquadId]) +) 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)"); } @@ -8673,8 +8673,8 @@ FROM [LocustLeaders] AS [l] 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)"); +) 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"); } public override async Task Projecting_property_converted_to_nullable_with_comparison(bool async) @@ -8690,7 +8690,7 @@ FROM [Tags] AS [t] 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]) +) AS [t0] ON [t].[GearNickName] = [t0].[Nickname] AND [t].[GearSquadId] = [t0].[SquadId] WHERE CASE WHEN [t].[GearNickName] IS NOT NULL THEN [t0].[SquadId] ELSE NULL @@ -8710,7 +8710,7 @@ FROM [Tags] AS [t] 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]) +) AS [t0] ON [t].[GearNickName] = [t0].[Nickname] AND [t].[GearSquadId] = [t0].[SquadId] WHERE (CASE WHEN [t].[GearNickName] IS NOT NULL THEN [t0].[SquadId] ELSE NULL @@ -8730,7 +8730,7 @@ FROM [Tags] AS [t] LEFT JOIN ( SELECT [g].[Nickname], [g].[SquadId] FROM [Gears] AS [g] -) AS [t0] ON ([t].[GearNickName] = [t0].[Nickname]) AND ([t].[GearSquadId] = [t0].[SquadId]) +) AS [t0] ON [t].[GearNickName] = [t0].[Nickname] AND [t].[GearSquadId] = [t0].[SquadId] WHERE CASE WHEN [t].[GearNickName] IS NOT NULL THEN [t0].[Nickname] ELSE NULL @@ -8743,7 +8743,7 @@ public override async Task Projecting_property_converted_to_nullable_with_condit AssertSql( @"SELECT CASE - WHEN ([t].[Note] <> N'K.I.A.') OR [t].[Note] IS NULL THEN CASE + WHEN [t].[Note] <> N'K.I.A.' OR [t].[Note] IS NULL THEN CASE WHEN [t].[GearNickName] IS NOT NULL THEN [t0].[SquadId] ELSE NULL END @@ -8753,7 +8753,7 @@ FROM [Tags] AS [t] LEFT JOIN ( SELECT [g].[Nickname], [g].[SquadId] FROM [Gears] AS [g] -) AS [t0] ON ([t].[GearNickName] = [t0].[Nickname]) AND ([t].[GearSquadId] = [t0].[SquadId])"); +) AS [t0] ON [t].[GearNickName] = [t0].[Nickname] AND [t].[GearSquadId] = [t0].[SquadId]"); } public override async Task Projecting_property_converted_to_nullable_with_function_call(bool async) @@ -8769,7 +8769,7 @@ FROM [Tags] AS [t] LEFT JOIN ( SELECT [g].[Nickname], [g].[SquadId] FROM [Gears] AS [g] -) AS [t0] ON ([t].[GearNickName] = [t0].[Nickname]) AND ([t].[GearSquadId] = [t0].[SquadId])"); +) AS [t0] ON [t].[GearNickName] = [t0].[Nickname] AND [t].[GearSquadId] = [t0].[SquadId]"); } public override async Task Projecting_property_converted_to_nullable_with_function_call2(bool async) @@ -8785,7 +8785,7 @@ FROM [Tags] AS [t] LEFT JOIN ( SELECT [g].[Nickname], [g].[SquadId] FROM [Gears] AS [g] -) AS [t0] ON ([t].[GearNickName] = [t0].[Nickname]) AND ([t].[GearSquadId] = [t0].[SquadId]) +) AS [t0] ON [t].[GearNickName] = [t0].[Nickname] AND [t].[GearSquadId] = [t0].[SquadId] WHERE CASE WHEN [t].[GearNickName] IS NOT NULL THEN [t0].[Nickname] ELSE NULL @@ -8811,7 +8811,7 @@ FROM [Tags] AS [t] LEFT JOIN ( SELECT [g].[Nickname], [g].[SquadId] FROM [Gears] AS [g] -) AS [t0] ON ([t].[GearNickName] = [t0].[Nickname]) AND ([t].[GearSquadId] = [t0].[SquadId]) +) AS [t0] ON [t].[GearNickName] = [t0].[Nickname] AND [t].[GearSquadId] = [t0].[SquadId] WHERE CASE WHEN [t].[GearNickName] IS NOT NULL THEN [t0].[Nickname] ELSE NULL @@ -8832,7 +8832,7 @@ FROM [Tags] AS [t] LEFT JOIN ( SELECT [g].[Nickname], [g].[SquadId] FROM [Gears] AS [g] -) AS [t0] ON ([t].[GearNickName] = [t0].[Nickname]) AND ([t].[GearSquadId] = [t0].[SquadId]) +) AS [t0] ON [t].[GearNickName] = [t0].[Nickname] AND [t].[GearSquadId] = [t0].[SquadId] WHERE CASE WHEN [t].[GearNickName] IS NOT NULL THEN [t0].[Nickname] ELSE NULL @@ -8859,7 +8859,7 @@ FROM [Tags] AS [t] LEFT JOIN ( SELECT [g].[Nickname], [g].[SquadId] FROM [Gears] AS [g] -) AS [t0] ON ([t].[GearNickName] = [t0].[Nickname]) AND ([t].[GearSquadId] = [t0].[SquadId]) +) AS [t0] ON [t].[GearNickName] = [t0].[Nickname] AND [t].[GearSquadId] = [t0].[SquadId] WHERE CASE WHEN [t].[GearNickName] IS NOT NULL THEN [t0].[Nickname] ELSE NULL @@ -8877,14 +8877,14 @@ FROM [Tags] AS [t] 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]) +) AS [t0] ON [t].[GearNickName] = [t0].[Nickname] AND [t].[GearSquadId] = [t0].[SquadId] 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)) +END = CAST(0 AS bit) ORDER BY [t].[Note]"); } @@ -8895,8 +8895,8 @@ public override async Task Projecting_property_converted_to_nullable_into_member AssertSql( @"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 +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 ORDER BY [g].[Nickname]"); } @@ -8913,7 +8913,7 @@ FROM [Tags] AS [t] 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]) +) AS [t0] ON [t].[GearNickName] = [t0].[Nickname] AND [t].[GearSquadId] = [t0].[SquadId] WHERE CASE WHEN [t].[GearNickName] IS NOT NULL THEN [t0].[Nickname] ELSE NULL @@ -9095,8 +9095,8 @@ WHEN [s].[Id] IS NULL THEN CAST(1 AS bit) ELSE CAST(0 AS bit) END AS [IsNull] 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 [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].[CityOfBirthName] = [c].[Name] LEFT JOIN [Squads] AS [s] ON [g].[SquadId] = [s].[Id]"); } @@ -9125,8 +9125,8 @@ LEFT JOIN ( 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 [t] ON ([l0].[DefeatedByNickname] = [t].[Nickname]) AND ([l0].[DefeatedBySquadId] = [t].[SquadId]) + 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 ( SELECT [f].[Id], [f].[CapitalName], [f].[Name], [f].[ServerAddress], [l1].[CommanderName], [l1].[Eradicated] FROM [Factions] AS [f] @@ -9150,7 +9150,7 @@ public override async Task Join_entity_with_itself_grouped_by_key_followed_by_in WHEN [o].[Nickname] IS NOT NULL THEN N'Officer' END AS [Discriminator], [t].[HasSoulPatch] AS [HasSoulPatch0] FROM [Gears] AS [g] - LEFT JOIN [Officers] AS [o] ON ([g].[Nickname] = [o].[Nickname]) AND ([g].[SquadId] = [o].[SquadId]) + LEFT JOIN [Officers] AS [o] ON [g].[Nickname] = [o].[Nickname] AND [g].[SquadId] = [o].[SquadId] INNER JOIN ( SELECT MIN(CAST(LEN([g0].[Nickname]) AS int)) AS [c], [g0].[HasSoulPatch] FROM [Gears] AS [g0] @@ -9164,6 +9164,32 @@ OFFSET @__p_0 ROWS FETCH NEXT @__p_1 ROWS ONLY ORDER BY [t0].[Nickname], [t0].[SquadId], [t0].[HasSoulPatch0]"); } + public override async Task Where_bool_column_and_Contains(bool async) + { + await base.Where_bool_column_and_Contains(async); + + AssertSql( + @"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] +FROM [Gears] AS [g] +LEFT JOIN [Officers] AS [o] ON [g].[Nickname] = [o].[Nickname] AND [g].[SquadId] = [o].[SquadId] +WHERE [g].[HasSoulPatch] = CAST(1 AS bit) AND [g].[HasSoulPatch] IN (CAST(0 AS bit), CAST(1 AS bit))"); + } + + public override async Task Where_bool_column_or_Contains(bool async) + { + await base.Where_bool_column_or_Contains(async); + + AssertSql( + @"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] +FROM [Gears] AS [g] +LEFT JOIN [Officers] AS [o] ON [g].[Nickname] = [o].[Nickname] AND [g].[SquadId] = [o].[SquadId] +WHERE [g].[HasSoulPatch] = CAST(1 AS bit) AND [g].[HasSoulPatch] IN (CAST(0 AS bit), CAST(1 AS bit))"); + } + private void AssertSql(params string[] expected) => Fixture.TestSqlLoggerFactory.AssertBaseline(expected); } diff --git a/test/EFCore.SqlServer.FunctionalTests/Query/TPTInheritanceQuerySqlServerTest.cs b/test/EFCore.SqlServer.FunctionalTests/Query/TPTInheritanceQuerySqlServerTest.cs index d4ae1108a58..5001025f0e3 100644 --- a/test/EFCore.SqlServer.FunctionalTests/Query/TPTInheritanceQuerySqlServerTest.cs +++ b/test/EFCore.SqlServer.FunctionalTests/Query/TPTInheritanceQuerySqlServerTest.cs @@ -352,7 +352,7 @@ FROM [Animals] AS [a] LEFT JOIN [Birds] AS [b] ON [a].[Species] = [b].[Species] LEFT JOIN [Eagle] AS [e] ON [a].[Species] = [e].[Species] LEFT JOIN [Kiwi] AS [k] ON [a].[Species] = [k].[Species] -WHERE [k].[Species] IS NOT NULL AND ([a].[CountryId] = 1)"); +WHERE [k].[Species] IS NOT NULL AND [a].[CountryId] = 1"); } public override async Task Can_use_of_type_animal(bool async) @@ -418,7 +418,7 @@ FROM [Animals] AS [a] LEFT JOIN [Birds] AS [b] ON [a].[Species] = [b].[Species] LEFT JOIN [Eagle] AS [e] ON [a].[Species] = [e].[Species] LEFT JOIN [Kiwi] AS [k] ON [a].[Species] = [k].[Species] -WHERE ([a].[CountryId] = 1) AND ([k].[Species] IS NOT NULL OR [e].[Species] IS NOT NULL) +WHERE [a].[CountryId] = 1 AND ([k].[Species] IS NOT NULL OR [e].[Species] IS NOT NULL) ORDER BY [a].[Species]"); } @@ -460,7 +460,7 @@ END AS [Discriminator] FROM [Animals] AS [a] LEFT JOIN [Birds] AS [b] ON [a].[Species] = [b].[Species] LEFT JOIN [Kiwi] AS [k] ON [a].[Species] = [k].[Species] -WHERE [k].[Species] IS NOT NULL AND ([k].[FoundOn] = CAST(0 AS tinyint))"); +WHERE [k].[Species] IS NOT NULL AND [k].[FoundOn] = CAST(0 AS tinyint)"); } public override async Task Can_use_of_type_kiwi_where_south_on_derived_property(bool async) @@ -474,7 +474,7 @@ END AS [Discriminator] FROM [Animals] AS [a] LEFT JOIN [Birds] AS [b] ON [a].[Species] = [b].[Species] LEFT JOIN [Kiwi] AS [k] ON [a].[Species] = [k].[Species] -WHERE [k].[Species] IS NOT NULL AND ([k].[FoundOn] = CAST(1 AS tinyint))"); +WHERE [k].[Species] IS NOT NULL AND [k].[FoundOn] = CAST(1 AS tinyint)"); } public override async Task Can_use_of_type_rose(bool async) diff --git a/test/EFCore.SqlServer.FunctionalTests/Query/TPTManyToManyNoTrackingQuerySqlServerTest.cs b/test/EFCore.SqlServer.FunctionalTests/Query/TPTManyToManyNoTrackingQuerySqlServerTest.cs index 0c5f3047f80..1409c6008d5 100644 --- a/test/EFCore.SqlServer.FunctionalTests/Query/TPTManyToManyNoTrackingQuerySqlServerTest.cs +++ b/test/EFCore.SqlServer.FunctionalTests/Query/TPTManyToManyNoTrackingQuerySqlServerTest.cs @@ -30,7 +30,7 @@ WHERE NOT EXISTS ( SELECT 1 FROM [JoinOneToTwo] AS [j] INNER JOIN [EntityTwos] AS [e0] ON [j].[TwoId] = [e0].[Id] - WHERE ([e].[Id] = [j].[OneId]) AND NOT ([e0].[Name] LIKE N'%B%'))"); + WHERE [e].[Id] = [j].[OneId] AND NOT ([e0].[Name] LIKE N'%B%'))"); } public override async Task Skip_navigation_any_without_predicate(bool async) @@ -44,7 +44,7 @@ WHERE EXISTS ( SELECT 1 FROM [JoinOneToThreePayloadFull] AS [j] INNER JOIN [EntityThrees] AS [e0] ON [j].[ThreeId] = [e0].[Id] - WHERE ([e].[Id] = [j].[OneId]) AND ([e0].[Name] LIKE N'%B%'))"); + WHERE [e].[Id] = [j].[OneId] AND ([e0].[Name] LIKE N'%B%'))"); } public override async Task Skip_navigation_any_with_predicate(bool async) @@ -58,7 +58,7 @@ WHERE EXISTS ( SELECT 1 FROM [EntityOneEntityTwo] AS [e0] INNER JOIN [EntityTwos] AS [e1] ON [e0].[TwoSkipSharedId] = [e1].[Id] - WHERE ([e].[Id] = [e0].[OneSkipSharedId]) AND ([e1].[Name] LIKE N'%B%'))"); + WHERE [e].[Id] = [e0].[OneSkipSharedId] AND ([e1].[Name] LIKE N'%B%'))"); } public override async Task Skip_navigation_contains(bool async) @@ -72,7 +72,7 @@ WHERE EXISTS ( SELECT 1 FROM [JoinOneToThreePayloadFullShared] AS [j] INNER JOIN [EntityThrees] AS [e0] ON [j].[ThreeId] = [e0].[Id] - WHERE ([e].[Id] = [j].[OneId]) AND ([e0].[Id] = 1))"); + WHERE [e].[Id] = [j].[OneId] AND [e0].[Id] = 1)"); } public override async Task Skip_navigation_count_without_predicate(bool async) @@ -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) @@ -148,7 +148,7 @@ FROM [EntityTwos] AS [e] INNER JOIN ( SELECT [e1].[Key1], [e0].[TwoSkipSharedId] FROM [EntityCompositeKeyEntityTwo] AS [e0] - INNER JOIN [EntityCompositeKeys] AS [e1] ON (([e0].[CompositeKeySkipSharedKey1] = [e1].[Key1]) AND ([e0].[CompositeKeySkipSharedKey2] = [e1].[Key2])) AND ([e0].[CompositeKeySkipSharedKey3] = [e1].[Key3]) + INNER JOIN [EntityCompositeKeys] AS [e1] ON [e0].[CompositeKeySkipSharedKey1] = [e1].[Key1] AND [e0].[CompositeKeySkipSharedKey2] = [e1].[Key2] AND [e0].[CompositeKeySkipSharedKey3] = [e1].[Key3] ) AS [t] ON [e].[Id] = [t].[TwoSkipSharedId]"); } @@ -162,7 +162,7 @@ FROM [EntityThrees] AS [e] INNER JOIN ( SELECT [e0].[Key1], [j].[ThreeId] FROM [JoinThreeToCompositeKeyFull] AS [j] - INNER JOIN [EntityCompositeKeys] AS [e0] ON (([j].[CompositeId1] = [e0].[Key1]) AND ([j].[CompositeId2] = [e0].[Key2])) AND ([j].[CompositeId3] = [e0].[Key3]) + INNER JOIN [EntityCompositeKeys] AS [e0] ON [j].[CompositeId1] = [e0].[Key1] AND [j].[CompositeId2] = [e0].[Key2] AND [j].[CompositeId3] = [e0].[Key3] ) AS [t] ON [e].[Id] = [t].[ThreeId]"); } @@ -193,7 +193,7 @@ FROM [Roots] AS [r] INNER JOIN ( SELECT [e0].[Key1], [e].[RootSkipSharedId] FROM [EntityCompositeKeyEntityRoot] AS [e] - INNER JOIN [EntityCompositeKeys] AS [e0] ON (([e].[CompositeKeySkipSharedKey1] = [e0].[Key1]) AND ([e].[CompositeKeySkipSharedKey2] = [e0].[Key2])) AND ([e].[CompositeKeySkipSharedKey3] = [e0].[Key3]) + INNER JOIN [EntityCompositeKeys] AS [e0] ON [e].[CompositeKeySkipSharedKey1] = [e0].[Key1] AND [e].[CompositeKeySkipSharedKey2] = [e0].[Key2] AND [e].[CompositeKeySkipSharedKey3] = [e0].[Key3] ) AS [t] ON [r].[Id] = [t].[RootSkipSharedId]"); } @@ -205,7 +205,7 @@ public override async Task Skip_navigation_select_subquery_average(bool async) @"SELECT ( SELECT AVG(CAST([e].[Key1] AS float)) FROM [JoinCompositeKeyToLeaf] AS [j] - INNER JOIN [EntityCompositeKeys] AS [e] ON (([j].[CompositeId1] = [e].[Key1]) AND ([j].[CompositeId2] = [e].[Key2])) AND ([j].[CompositeId3] = [e].[Key3]) + INNER JOIN [EntityCompositeKeys] AS [e] ON [j].[CompositeId1] = [e].[Key1] AND [j].[CompositeId2] = [e].[Key2] AND [j].[CompositeId3] = [e].[Key3] WHERE [r].[Id] = [j].[LeafId]) FROM [Roots] AS [r] INNER JOIN [Branches] AS [b] ON [r].[Id] = [b].[Id] @@ -342,7 +342,7 @@ FROM [Roots] AS [r] INNER JOIN [Branches] AS [b] ON [r].[Id] = [b].[Id] INNER JOIN [Leaves] AS [l] ON [r].[Id] = [l].[Id] ) AS [t] ON [j].[LeafId] = [t].[Id] -) AS [t0] ON (([e].[Key1] = [t0].[CompositeId1]) AND ([e].[Key2] = [t0].[CompositeId2])) AND ([e].[Key3] = [t0].[CompositeId3]) +) AS [t0] ON [e].[Key1] = [t0].[CompositeId1] AND [e].[Key2] = [t0].[CompositeId2] AND [e].[Key3] = [t0].[CompositeId3] ORDER BY [e].[Key1], [e].[Key2], [e].[Key3], [t0].[LeafId], [t0].[CompositeId1], [t0].[CompositeId2], [t0].[CompositeId3]"); } @@ -366,7 +366,7 @@ FROM [Roots] AS [r] LEFT JOIN [Leaves] AS [l] ON [r].[Id] = [l].[Id] ) AS [t] ON [e0].[RootSkipSharedId] = [t].[Id] WHERE [t].[Discriminator] = N'EntityLeaf' -) AS [t0] ON (([e].[Key1] = [t0].[CompositeKeySkipSharedKey1]) AND ([e].[Key2] = [t0].[CompositeKeySkipSharedKey2])) AND ([e].[Key3] = [t0].[CompositeKeySkipSharedKey3]) +) AS [t0] ON [e].[Key1] = [t0].[CompositeKeySkipSharedKey1] AND [e].[Key2] = [t0].[CompositeKeySkipSharedKey2] AND [e].[Key3] = [t0].[CompositeKeySkipSharedKey3] ORDER BY [e].[Key1], [e].[Key2], [e].[Key3], [t0].[RootSkipSharedId], [t0].[CompositeKeySkipSharedKey1], [t0].[CompositeKeySkipSharedKey2], [t0].[CompositeKeySkipSharedKey3]"); } @@ -396,12 +396,12 @@ LEFT JOIN [EntityCompositeKeys] AS [e0] ON ( SELECT TOP(1) [e2].[Id] FROM [EntityCompositeKeyEntityTwo] AS [e1] INNER JOIN [EntityTwos] AS [e2] ON [e1].[TwoSkipSharedId] = [e2].[Id] - WHERE (([e].[Key1] = [e1].[CompositeKeySkipSharedKey1]) AND ([e].[Key2] = [e1].[CompositeKeySkipSharedKey2])) AND ([e].[Key3] = [e1].[CompositeKeySkipSharedKey3]) + WHERE [e].[Key1] = [e1].[CompositeKeySkipSharedKey1] AND [e].[Key2] = [e1].[CompositeKeySkipSharedKey2] AND [e].[Key3] = [e1].[CompositeKeySkipSharedKey3] ORDER BY [e2].[Id]) = ( SELECT TOP(1) [e3].[Id] FROM [JoinThreeToCompositeKeyFull] AS [j] INNER JOIN [EntityThrees] AS [e3] ON [j].[ThreeId] = [e3].[Id] - WHERE (([e0].[Key1] = [j].[CompositeId1]) AND ([e0].[Key2] = [j].[CompositeId2])) AND ([e0].[Key3] = [j].[CompositeId3]) + WHERE [e0].[Key1] = [j].[CompositeId1] AND [e0].[Key2] = [j].[CompositeId2] AND [e0].[Key3] = [j].[CompositeId3] ORDER BY [e3].[Id]) ORDER BY [e].[Key1], [e0].[Key1], [e].[Key2], [e0].[Key2]"); } @@ -484,7 +484,7 @@ INNER JOIN ( FROM [JoinOneToThreePayloadFullShared] AS [j] INNER JOIN [EntityThrees] AS [e0] ON [j].[ThreeId] = [e0].[Id] ) AS [t] - WHERE (2 < [t].[row]) AND ([t].[row] <= 5) + WHERE 2 < [t].[row] AND [t].[row] <= 5 ) AS [t0] ON [e].[Id] = [t0].[OneId]"); } @@ -567,7 +567,7 @@ FROM [EntityTwoEntityTwo] AS [e1] LEFT JOIN ( SELECT [e4].[Key1], [e4].[Key2], [e4].[Key3], [e4].[Name], [e3].[TwoSkipSharedId], [e3].[CompositeKeySkipSharedKey1], [e3].[CompositeKeySkipSharedKey2], [e3].[CompositeKeySkipSharedKey3] FROM [EntityCompositeKeyEntityTwo] AS [e3] - INNER JOIN [EntityCompositeKeys] AS [e4] ON (([e3].[CompositeKeySkipSharedKey1] = [e4].[Key1]) AND ([e3].[CompositeKeySkipSharedKey2] = [e4].[Key2])) AND ([e3].[CompositeKeySkipSharedKey3] = [e4].[Key3]) + INNER JOIN [EntityCompositeKeys] AS [e4] ON [e3].[CompositeKeySkipSharedKey1] = [e4].[Key1] AND [e3].[CompositeKeySkipSharedKey2] = [e4].[Key2] AND [e3].[CompositeKeySkipSharedKey3] = [e4].[Key3] ) AS [t1] ON [e].[Id] = [t1].[TwoSkipSharedId] ORDER BY [e].[Id], [t].[ThreeId], [t].[TwoId], [t].[Id], [t0].[SelfSkipSharedLeftId], [t0].[SelfSkipSharedRightId], [t0].[Id], [t1].[TwoSkipSharedId], [t1].[CompositeKeySkipSharedKey1], [t1].[CompositeKeySkipSharedKey2], [t1].[CompositeKeySkipSharedKey3], [t1].[Key1], [t1].[Key2]"); } @@ -584,7 +584,7 @@ LEFT JOIN ( FROM ( SELECT [e0].[Key1], [e0].[Key2], [e0].[Key3], [e0].[Name], [j].[ThreeId], ROW_NUMBER() OVER(PARTITION BY [j].[ThreeId] ORDER BY [e0].[Key1], [e0].[Key2]) AS [row] FROM [JoinThreeToCompositeKeyFull] AS [j] - INNER JOIN [EntityCompositeKeys] AS [e0] ON (([j].[CompositeId1] = [e0].[Key1]) AND ([j].[CompositeId2] = [e0].[Key2])) AND ([j].[CompositeId3] = [e0].[Key3]) + INNER JOIN [EntityCompositeKeys] AS [e0] ON [j].[CompositeId1] = [e0].[Key1] AND [j].[CompositeId2] = [e0].[Key2] AND [j].[CompositeId3] = [e0].[Key3] ) AS [t] WHERE [t].[row] <= 1 ) AS [t0] ON [e].[Id] = [t0].[ThreeId] @@ -610,7 +610,7 @@ FROM [Roots] AS [r] LEFT JOIN [Branches] AS [b] ON [r].[Id] = [b].[Id] LEFT JOIN [Leaves] AS [l] ON [r].[Id] = [l].[Id] ) AS [t] ON [e0].[RootSkipSharedId] = [t].[Id] -) AS [t0] ON (([e].[Key1] = [t0].[CompositeKeySkipSharedKey1]) AND ([e].[Key2] = [t0].[CompositeKeySkipSharedKey2])) AND ([e].[Key3] = [t0].[CompositeKeySkipSharedKey3]) +) AS [t0] ON [e].[Key1] = [t0].[CompositeKeySkipSharedKey1] AND [e].[Key2] = [t0].[CompositeKeySkipSharedKey2] AND [e].[Key3] = [t0].[CompositeKeySkipSharedKey3] ORDER BY [e].[Key1], [e].[Key2], [e].[Key3], [t0].[RootSkipSharedId], [t0].[CompositeKeySkipSharedKey1], [t0].[CompositeKeySkipSharedKey2], [t0].[CompositeKeySkipSharedKey3]"); } @@ -651,7 +651,7 @@ LEFT JOIN ( FROM [JoinOneToBranch] AS [j0] INNER JOIN [EntityOnes] AS [e0] ON [j0].[EntityOneId] = [e0].[Id] ) AS [t0] ON [t].[Id] = [t0].[EntityBranchId] -) AS [t1] ON (([e].[Key1] = [t1].[CompositeId1]) AND ([e].[Key2] = [t1].[CompositeId2])) AND ([e].[Key3] = [t1].[CompositeId3]) +) AS [t1] ON [e].[Key1] = [t1].[CompositeId1] AND [e].[Key2] = [t1].[CompositeId2] AND [e].[Key3] = [t1].[CompositeId3] ORDER BY [e].[Key1], [e].[Key2], [e].[Key3], [t1].[LeafId], [t1].[CompositeId1], [t1].[CompositeId2], [t1].[CompositeId3], [t1].[Id], [t1].[EntityBranchId], [t1].[EntityOneId]"); } @@ -757,7 +757,7 @@ FROM [EntityCompositeKeyEntityTwo] AS [e0] INNER JOIN [EntityTwos] AS [e1] ON [e0].[TwoSkipSharedId] = [e1].[Id] ) AS [t] WHERE [t].[row] <= 2 -) AS [t0] ON (([e].[Key1] = [t0].[CompositeKeySkipSharedKey1]) AND ([e].[Key2] = [t0].[CompositeKeySkipSharedKey2])) AND ([e].[Key3] = [t0].[CompositeKeySkipSharedKey3]) +) AS [t0] ON [e].[Key1] = [t0].[CompositeKeySkipSharedKey1] AND [e].[Key2] = [t0].[CompositeKeySkipSharedKey2] AND [e].[Key3] = [t0].[CompositeKeySkipSharedKey3] ORDER BY [e].[Key1], [e].[Key2], [e].[Key3], [t0].[CompositeKeySkipSharedKey1], [t0].[CompositeKeySkipSharedKey2], [t0].[CompositeKeySkipSharedKey3], [t0].[Id]"); } @@ -775,8 +775,8 @@ LEFT JOIN ( FROM [JoinThreeToCompositeKeyFull] AS [j] INNER JOIN [EntityThrees] AS [e0] ON [j].[ThreeId] = [e0].[Id] ) AS [t] - WHERE (1 < [t].[row]) AND ([t].[row] <= 3) -) AS [t0] ON (([e].[Key1] = [t0].[CompositeId1]) AND ([e].[Key2] = [t0].[CompositeId2])) AND ([e].[Key3] = [t0].[CompositeId3]) + WHERE 1 < [t].[row] AND [t].[row] <= 3 +) AS [t0] ON [e].[Key1] = [t0].[CompositeId1] AND [e].[Key2] = [t0].[CompositeId2] AND [e].[Key3] = [t0].[CompositeId3] ORDER BY [e].[Key1], [e].[Key2], [e].[Key3], [t0].[CompositeId1], [t0].[CompositeId2], [t0].[CompositeId3], [t0].[Id]"); } @@ -821,7 +821,7 @@ FROM [Roots] AS [r] LEFT JOIN ( SELECT [e0].[Key1], [e0].[Key2], [e0].[Key3], [e0].[Name], [e].[RootSkipSharedId], [e].[CompositeKeySkipSharedKey1], [e].[CompositeKeySkipSharedKey2], [e].[CompositeKeySkipSharedKey3], [t0].[Id], [t0].[CollectionInverseId], [t0].[Name] AS [Name0], [t0].[ReferenceInverseId], [t0].[Id0], [t0].[CompositeId1], [t0].[CompositeId2], [t0].[CompositeId3] FROM [EntityCompositeKeyEntityRoot] AS [e] - INNER JOIN [EntityCompositeKeys] AS [e0] ON (([e].[CompositeKeySkipSharedKey1] = [e0].[Key1]) AND ([e].[CompositeKeySkipSharedKey2] = [e0].[Key2])) AND ([e].[CompositeKeySkipSharedKey3] = [e0].[Key3]) + INNER JOIN [EntityCompositeKeys] AS [e0] ON [e].[CompositeKeySkipSharedKey1] = [e0].[Key1] AND [e].[CompositeKeySkipSharedKey2] = [e0].[Key2] AND [e].[CompositeKeySkipSharedKey3] = [e0].[Key3] LEFT JOIN ( SELECT [t].[Id], [t].[CollectionInverseId], [t].[Name], [t].[ReferenceInverseId], [t].[Id0], [t].[CompositeId1], [t].[CompositeId2], [t].[CompositeId3] FROM ( @@ -829,8 +829,8 @@ LEFT JOIN ( FROM [JoinThreeToCompositeKeyFull] AS [j] INNER JOIN [EntityThrees] AS [e1] ON [j].[ThreeId] = [e1].[Id] ) AS [t] - WHERE (1 < [t].[row]) AND ([t].[row] <= 3) - ) AS [t0] ON (([e0].[Key1] = [t0].[CompositeId1]) AND ([e0].[Key2] = [t0].[CompositeId2])) AND ([e0].[Key3] = [t0].[CompositeId3]) + WHERE 1 < [t].[row] AND [t].[row] <= 3 + ) AS [t0] ON [e0].[Key1] = [t0].[CompositeId1] AND [e0].[Key2] = [t0].[CompositeId2] AND [e0].[Key3] = [t0].[CompositeId3] ) AS [t1] ON [r].[Id] = [t1].[RootSkipSharedId] ORDER BY [r].[Id], [t1].[RootSkipSharedId], [t1].[CompositeKeySkipSharedKey1], [t1].[CompositeKeySkipSharedKey2], [t1].[CompositeKeySkipSharedKey3], [t1].[Key1], [t1].[Key2], [t1].[Key3], [t1].[CompositeId1], [t1].[CompositeId2], [t1].[CompositeId3], [t1].[Id]"); } @@ -847,12 +847,12 @@ FROM [Roots] AS [r] LEFT JOIN ( SELECT [e].[Key1], [e].[Key2], [e].[Key3], [e].[Name], [j].[LeafId], [j].[CompositeId1], [j].[CompositeId2], [j].[CompositeId3], [t].[Id], [t].[CollectionInverseId], [t].[ExtraId], [t].[Name] AS [Name0], [t].[ReferenceInverseId], [t].[TwoSkipSharedId], [t].[CompositeKeySkipSharedKey1], [t].[CompositeKeySkipSharedKey2], [t].[CompositeKeySkipSharedKey3] FROM [JoinCompositeKeyToLeaf] AS [j] - INNER JOIN [EntityCompositeKeys] AS [e] ON (([j].[CompositeId1] = [e].[Key1]) AND ([j].[CompositeId2] = [e].[Key2])) AND ([j].[CompositeId3] = [e].[Key3]) + INNER JOIN [EntityCompositeKeys] AS [e] ON [j].[CompositeId1] = [e].[Key1] AND [j].[CompositeId2] = [e].[Key2] AND [j].[CompositeId3] = [e].[Key3] LEFT JOIN ( SELECT [e1].[Id], [e1].[CollectionInverseId], [e1].[ExtraId], [e1].[Name], [e1].[ReferenceInverseId], [e0].[TwoSkipSharedId], [e0].[CompositeKeySkipSharedKey1], [e0].[CompositeKeySkipSharedKey2], [e0].[CompositeKeySkipSharedKey3] FROM [EntityCompositeKeyEntityTwo] AS [e0] INNER JOIN [EntityTwos] AS [e1] ON [e0].[TwoSkipSharedId] = [e1].[Id] - ) AS [t] ON (([e].[Key1] = [t].[CompositeKeySkipSharedKey1]) AND ([e].[Key2] = [t].[CompositeKeySkipSharedKey2])) AND ([e].[Key3] = [t].[CompositeKeySkipSharedKey3]) + ) AS [t] ON [e].[Key1] = [t].[CompositeKeySkipSharedKey1] AND [e].[Key2] = [t].[CompositeKeySkipSharedKey2] AND [e].[Key3] = [t].[CompositeKeySkipSharedKey3] WHERE [e].[Key1] < 5 ) AS [t0] ON [r].[Id] = [t0].[LeafId] ORDER BY [r].[Id], [t0].[LeafId], [t0].[CompositeId1], [t0].[CompositeId2], [t0].[CompositeId3], [t0].[Key1], [t0].[Key2], [t0].[Key3], [t0].[TwoSkipSharedId], [t0].[CompositeKeySkipSharedKey1], [t0].[CompositeKeySkipSharedKey2], [t0].[CompositeKeySkipSharedKey3]"); @@ -903,7 +903,7 @@ LEFT JOIN ( FROM [JoinTwoToThree] AS [j0] INNER JOIN [EntityThrees] AS [e1] ON [j0].[ThreeId] = [e1].[Id] ) AS [t] - WHERE (1 < [t].[row]) AND ([t].[row] <= 3) + WHERE 1 < [t].[row] AND [t].[row] <= 3 ) AS [t0] ON [e0].[Id] = [t0].[TwoId] WHERE [e0].[Id] < 10 ) AS [t1] ON [e].[Id] = [t1].[OneId] @@ -946,7 +946,7 @@ LEFT JOIN ( FROM [JoinOneToTwo] AS [j0] INNER JOIN [EntityTwos] AS [e1] ON [j0].[TwoId] = [e1].[Id] ) AS [t] - WHERE (1 < [t].[row]) AND ([t].[row] <= 3) + WHERE 1 < [t].[row] AND [t].[row] <= 3 ) AS [t0] ON [e0].[Id] = [t0].[OneId] LEFT JOIN ( SELECT [t2].[Id], [t2].[Name], [t2].[Number], [t2].[IsGreen], [t2].[Discriminator], [j1].[EntityBranchId], [j1].[EntityOneId] @@ -1045,7 +1045,7 @@ FROM [Roots] AS [r] LEFT JOIN [Branches] AS [b] ON [r].[Id] = [b].[Id] LEFT JOIN [Leaves] AS [l] ON [r].[Id] = [l].[Id] ) AS [t] ON [e0].[RootSkipSharedId] = [t].[Id] -) AS [t0] ON (([e].[Key1] = [t0].[CompositeKeySkipSharedKey1]) AND ([e].[Key2] = [t0].[CompositeKeySkipSharedKey2])) AND ([e].[Key3] = [t0].[CompositeKeySkipSharedKey3]) +) AS [t0] ON [e].[Key1] = [t0].[CompositeKeySkipSharedKey1] AND [e].[Key2] = [t0].[CompositeKeySkipSharedKey2] AND [e].[Key3] = [t0].[CompositeKeySkipSharedKey3] ORDER BY [e].[Key1], [e].[Key2], [e].[Key3]"); } @@ -1089,7 +1089,7 @@ FROM [Roots] AS [r] INNER JOIN [Branches] AS [b] ON [r].[Id] = [b].[Id] INNER JOIN [Leaves] AS [l] ON [r].[Id] = [l].[Id] ) AS [t] ON [j].[LeafId] = [t].[Id] -) AS [t0] ON (([e].[Key1] = [t0].[CompositeId1]) AND ([e].[Key2] = [t0].[CompositeId2])) AND ([e].[Key3] = [t0].[CompositeId3]) +) AS [t0] ON [e].[Key1] = [t0].[CompositeId1] AND [e].[Key2] = [t0].[CompositeId2] AND [e].[Key3] = [t0].[CompositeId3] ORDER BY [e].[Key1], [e].[Key2], [e].[Key3], [t0].[LeafId], [t0].[CompositeId1], [t0].[CompositeId2], [t0].[CompositeId3], [t0].[Id]", // @"SELECT [t1].[Id], [t1].[Name], [e].[Key1], [e].[Key2], [e].[Key3], [t0].[LeafId], [t0].[CompositeId1], [t0].[CompositeId2], [t0].[CompositeId3], [t0].[Id] @@ -1103,7 +1103,7 @@ FROM [Roots] AS [r] INNER JOIN [Branches] AS [b] ON [r].[Id] = [b].[Id] INNER JOIN [Leaves] AS [l] ON [r].[Id] = [l].[Id] ) AS [t] ON [j].[LeafId] = [t].[Id] -) AS [t0] ON (([e].[Key1] = [t0].[CompositeId1]) AND ([e].[Key2] = [t0].[CompositeId2])) AND ([e].[Key3] = [t0].[CompositeId3]) +) AS [t0] ON [e].[Key1] = [t0].[CompositeId1] AND [e].[Key2] = [t0].[CompositeId2] AND [e].[Key3] = [t0].[CompositeId3] INNER JOIN ( SELECT [e0].[Id], [e0].[Name], [j0].[EntityBranchId] FROM [JoinOneToBranch] AS [j0] @@ -1249,7 +1249,7 @@ FROM [EntityCompositeKeyEntityTwo] AS [e0] INNER JOIN [EntityTwos] AS [e1] ON [e0].[TwoSkipSharedId] = [e1].[Id] ) AS [t] WHERE [t].[row] <= 2 -) AS [t0] ON (([e].[Key1] = [t0].[CompositeKeySkipSharedKey1]) AND ([e].[Key2] = [t0].[CompositeKeySkipSharedKey2])) AND ([e].[Key3] = [t0].[CompositeKeySkipSharedKey3]) +) AS [t0] ON [e].[Key1] = [t0].[CompositeKeySkipSharedKey1] AND [e].[Key2] = [t0].[CompositeKeySkipSharedKey2] AND [e].[Key3] = [t0].[CompositeKeySkipSharedKey3] ORDER BY [e].[Key1], [e].[Key2], [e].[Key3], [t0].[CompositeKeySkipSharedKey1], [t0].[CompositeKeySkipSharedKey2], [t0].[CompositeKeySkipSharedKey3], [t0].[Id]"); } @@ -1271,8 +1271,8 @@ INNER JOIN ( FROM [JoinThreeToCompositeKeyFull] AS [j] INNER JOIN [EntityThrees] AS [e0] ON [j].[ThreeId] = [e0].[Id] ) AS [t] - WHERE (1 < [t].[row]) AND ([t].[row] <= 3) -) AS [t0] ON (([e].[Key1] = [t0].[CompositeId1]) AND ([e].[Key2] = [t0].[CompositeId2])) AND ([e].[Key3] = [t0].[CompositeId3]) + WHERE 1 < [t].[row] AND [t].[row] <= 3 +) AS [t0] ON [e].[Key1] = [t0].[CompositeId1] AND [e].[Key2] = [t0].[CompositeId2] AND [e].[Key3] = [t0].[CompositeId3] ORDER BY [e].[Key1], [e].[Key2], [e].[Key3], [t0].[CompositeId1], [t0].[CompositeId2], [t0].[CompositeId3], [t0].[Id]"); } @@ -1334,7 +1334,7 @@ FROM [Roots] AS [r] INNER JOIN ( SELECT [e0].[Key1], [e0].[Key2], [e0].[Key3], [e0].[Name], [e].[RootSkipSharedId], [e].[CompositeKeySkipSharedKey1], [e].[CompositeKeySkipSharedKey2], [e].[CompositeKeySkipSharedKey3] FROM [EntityCompositeKeyEntityRoot] AS [e] - INNER JOIN [EntityCompositeKeys] AS [e0] ON (([e].[CompositeKeySkipSharedKey1] = [e0].[Key1]) AND ([e].[CompositeKeySkipSharedKey2] = [e0].[Key2])) AND ([e].[CompositeKeySkipSharedKey3] = [e0].[Key3]) + INNER JOIN [EntityCompositeKeys] AS [e0] ON [e].[CompositeKeySkipSharedKey1] = [e0].[Key1] AND [e].[CompositeKeySkipSharedKey2] = [e0].[Key2] AND [e].[CompositeKeySkipSharedKey3] = [e0].[Key3] ) AS [t] ON [r].[Id] = [t].[RootSkipSharedId] ORDER BY [r].[Id], [t].[RootSkipSharedId], [t].[CompositeKeySkipSharedKey1], [t].[CompositeKeySkipSharedKey2], [t].[CompositeKeySkipSharedKey3], [t].[Key1], [t].[Key2], [t].[Key3]", // @@ -1343,7 +1343,7 @@ FROM [Roots] AS [r] INNER JOIN ( SELECT [e0].[Key1], [e0].[Key2], [e0].[Key3], [e].[RootSkipSharedId], [e].[CompositeKeySkipSharedKey1], [e].[CompositeKeySkipSharedKey2], [e].[CompositeKeySkipSharedKey3] FROM [EntityCompositeKeyEntityRoot] AS [e] - INNER JOIN [EntityCompositeKeys] AS [e0] ON (([e].[CompositeKeySkipSharedKey1] = [e0].[Key1]) AND ([e].[CompositeKeySkipSharedKey2] = [e0].[Key2])) AND ([e].[CompositeKeySkipSharedKey3] = [e0].[Key3]) + INNER JOIN [EntityCompositeKeys] AS [e0] ON [e].[CompositeKeySkipSharedKey1] = [e0].[Key1] AND [e].[CompositeKeySkipSharedKey2] = [e0].[Key2] AND [e].[CompositeKeySkipSharedKey3] = [e0].[Key3] ) AS [t] ON [r].[Id] = [t].[RootSkipSharedId] INNER JOIN ( SELECT [t1].[Id], [t1].[CollectionInverseId], [t1].[Name], [t1].[ReferenceInverseId], [t1].[CompositeId1], [t1].[CompositeId2], [t1].[CompositeId3] @@ -1352,8 +1352,8 @@ INNER JOIN ( FROM [JoinThreeToCompositeKeyFull] AS [j] INNER JOIN [EntityThrees] AS [e1] ON [j].[ThreeId] = [e1].[Id] ) AS [t1] - WHERE (1 < [t1].[row]) AND ([t1].[row] <= 3) -) AS [t0] ON (([t].[Key1] = [t0].[CompositeId1]) AND ([t].[Key2] = [t0].[CompositeId2])) AND ([t].[Key3] = [t0].[CompositeId3]) + WHERE 1 < [t1].[row] AND [t1].[row] <= 3 +) AS [t0] ON [t].[Key1] = [t0].[CompositeId1] AND [t].[Key2] = [t0].[CompositeId2] AND [t].[Key3] = [t0].[CompositeId3] ORDER BY [r].[Id], [t].[RootSkipSharedId], [t].[CompositeKeySkipSharedKey1], [t].[CompositeKeySkipSharedKey2], [t].[CompositeKeySkipSharedKey3], [t].[Key1], [t].[Key2], [t].[Key3], [t0].[CompositeId1], [t0].[CompositeId2], [t0].[CompositeId3], [t0].[Id]"); } @@ -1375,7 +1375,7 @@ FROM [Roots] AS [r] INNER JOIN ( SELECT [e].[Key1], [e].[Key2], [e].[Key3], [e].[Name], [j].[LeafId], [j].[CompositeId1], [j].[CompositeId2], [j].[CompositeId3] FROM [JoinCompositeKeyToLeaf] AS [j] - INNER JOIN [EntityCompositeKeys] AS [e] ON (([j].[CompositeId1] = [e].[Key1]) AND ([j].[CompositeId2] = [e].[Key2])) AND ([j].[CompositeId3] = [e].[Key3]) + INNER JOIN [EntityCompositeKeys] AS [e] ON [j].[CompositeId1] = [e].[Key1] AND [j].[CompositeId2] = [e].[Key2] AND [j].[CompositeId3] = [e].[Key3] WHERE [e].[Key1] < 5 ) AS [t] ON [r].[Id] = [t].[LeafId] ORDER BY [r].[Id], [t].[LeafId], [t].[CompositeId1], [t].[CompositeId2], [t].[CompositeId3], [t].[Key1], [t].[Key2], [t].[Key3]", @@ -1387,14 +1387,14 @@ FROM [Roots] AS [r] INNER JOIN ( SELECT [e].[Key1], [e].[Key2], [e].[Key3], [j].[LeafId], [j].[CompositeId1], [j].[CompositeId2], [j].[CompositeId3] FROM [JoinCompositeKeyToLeaf] AS [j] - INNER JOIN [EntityCompositeKeys] AS [e] ON (([j].[CompositeId1] = [e].[Key1]) AND ([j].[CompositeId2] = [e].[Key2])) AND ([j].[CompositeId3] = [e].[Key3]) + INNER JOIN [EntityCompositeKeys] AS [e] ON [j].[CompositeId1] = [e].[Key1] AND [j].[CompositeId2] = [e].[Key2] AND [j].[CompositeId3] = [e].[Key3] WHERE [e].[Key1] < 5 ) AS [t] ON [r].[Id] = [t].[LeafId] INNER JOIN ( SELECT [e1].[Id], [e1].[CollectionInverseId], [e1].[ExtraId], [e1].[Name], [e1].[ReferenceInverseId], [e0].[CompositeKeySkipSharedKey1], [e0].[CompositeKeySkipSharedKey2], [e0].[CompositeKeySkipSharedKey3] FROM [EntityCompositeKeyEntityTwo] AS [e0] INNER JOIN [EntityTwos] AS [e1] ON [e0].[TwoSkipSharedId] = [e1].[Id] -) AS [t0] ON (([t].[Key1] = [t0].[CompositeKeySkipSharedKey1]) AND ([t].[Key2] = [t0].[CompositeKeySkipSharedKey2])) AND ([t].[Key3] = [t0].[CompositeKeySkipSharedKey3]) +) AS [t0] ON [t].[Key1] = [t0].[CompositeKeySkipSharedKey1] AND [t].[Key2] = [t0].[CompositeKeySkipSharedKey2] AND [t].[Key3] = [t0].[CompositeKeySkipSharedKey3] ORDER BY [r].[Id], [t].[LeafId], [t].[CompositeId1], [t].[CompositeId2], [t].[CompositeId3], [t].[Key1], [t].[Key2], [t].[Key3]"); } @@ -1416,7 +1416,7 @@ INNER JOIN ( FROM [JoinOneToTwo] AS [j] INNER JOIN [EntityTwos] AS [e0] ON [j].[TwoId] = [e0].[Id] ) AS [t] - WHERE (1 < [t].[row]) AND ([t].[row] <= 3) + WHERE 1 < [t].[row] AND [t].[row] <= 3 ) AS [t0] ON [e].[Id] = [t0].[OneId] ORDER BY [e].[Id], [t0].[OneId], [t0].[Id], [t0].[TwoId]", // @@ -1429,7 +1429,7 @@ INNER JOIN ( FROM [JoinOneToTwo] AS [j] INNER JOIN [EntityTwos] AS [e0] ON [j].[TwoId] = [e0].[Id] ) AS [t] - WHERE (1 < [t].[row]) AND ([t].[row] <= 3) + WHERE 1 < [t].[row] AND [t].[row] <= 3 ) AS [t0] ON [e].[Id] = [t0].[OneId] INNER JOIN ( SELECT [e1].[Id], [e1].[CollectionInverseId], [e1].[Name], [e1].[ReferenceInverseId], [j0].[TwoId] @@ -1474,7 +1474,7 @@ INNER JOIN ( FROM [JoinTwoToThree] AS [j0] INNER JOIN [EntityThrees] AS [e1] ON [j0].[ThreeId] = [e1].[Id] ) AS [t1] - WHERE (1 < [t1].[row]) AND ([t1].[row] <= 3) + WHERE 1 < [t1].[row] AND [t1].[row] <= 3 ) AS [t0] ON [t].[Id] = [t0].[TwoId] ORDER BY [e].[Id], [t].[OneId], [t].[TwoId], [t].[Id], [t0].[TwoId], [t0].[Id]"); } @@ -1546,7 +1546,7 @@ INNER JOIN ( FROM [JoinOneToTwo] AS [j0] INNER JOIN [EntityTwos] AS [e1] ON [j0].[TwoId] = [e1].[Id] ) AS [t1] - WHERE (1 < [t1].[row]) AND ([t1].[row] <= 3) + WHERE 1 < [t1].[row] AND [t1].[row] <= 3 ) AS [t0] ON [t].[Id] = [t0].[OneId] ORDER BY [e].[Id], [t].[OneId], [t].[ThreeId], [t].[Id], [t0].[OneId], [t0].[Id]", // diff --git a/test/EFCore.SqlServer.FunctionalTests/Query/TPTManyToManyQuerySqlServerTest.cs b/test/EFCore.SqlServer.FunctionalTests/Query/TPTManyToManyQuerySqlServerTest.cs index a4d742a5e6e..14968b2e24f 100644 --- a/test/EFCore.SqlServer.FunctionalTests/Query/TPTManyToManyQuerySqlServerTest.cs +++ b/test/EFCore.SqlServer.FunctionalTests/Query/TPTManyToManyQuerySqlServerTest.cs @@ -29,7 +29,7 @@ WHERE NOT EXISTS ( SELECT 1 FROM [JoinOneToTwo] AS [j] INNER JOIN [EntityTwos] AS [e0] ON [j].[TwoId] = [e0].[Id] - WHERE ([e].[Id] = [j].[OneId]) AND NOT ([e0].[Name] LIKE N'%B%'))"); + WHERE [e].[Id] = [j].[OneId] AND NOT ([e0].[Name] LIKE N'%B%'))"); } public override async Task Skip_navigation_any_without_predicate(bool async) @@ -43,7 +43,7 @@ WHERE EXISTS ( SELECT 1 FROM [JoinOneToThreePayloadFull] AS [j] INNER JOIN [EntityThrees] AS [e0] ON [j].[ThreeId] = [e0].[Id] - WHERE ([e].[Id] = [j].[OneId]) AND ([e0].[Name] LIKE N'%B%'))"); + WHERE [e].[Id] = [j].[OneId] AND ([e0].[Name] LIKE N'%B%'))"); } public override async Task Skip_navigation_any_with_predicate(bool async) @@ -57,7 +57,7 @@ WHERE EXISTS ( SELECT 1 FROM [EntityOneEntityTwo] AS [e0] INNER JOIN [EntityTwos] AS [e1] ON [e0].[TwoSkipSharedId] = [e1].[Id] - WHERE ([e].[Id] = [e0].[OneSkipSharedId]) AND ([e1].[Name] LIKE N'%B%'))"); + WHERE [e].[Id] = [e0].[OneSkipSharedId] AND ([e1].[Name] LIKE N'%B%'))"); } public override async Task Skip_navigation_contains(bool async) @@ -71,7 +71,7 @@ WHERE EXISTS ( SELECT 1 FROM [JoinOneToThreePayloadFullShared] AS [j] INNER JOIN [EntityThrees] AS [e0] ON [j].[ThreeId] = [e0].[Id] - WHERE ([e].[Id] = [j].[OneId]) AND ([e0].[Id] = 1))"); + WHERE [e].[Id] = [j].[OneId] AND [e0].[Id] = 1)"); } public override async Task Skip_navigation_count_without_predicate(bool async) @@ -106,7 +106,7 @@ FROM [Roots] AS [r] INNER JOIN [Branches] AS [b] ON [r].[Id] = [b].[Id] LEFT JOIN [Leaves] AS [l] ON [r].[Id] = [l].[Id] ) AS [t] ON [j].[EntityBranchId] = [t].[Id] - WHERE ([e].[Id] = [j].[EntityOneId]) AND ([t].[Name] IS NOT NULL AND ([t].[Name] LIKE N'L%'))), [e].[Id]"); + WHERE [e].[Id] = [j].[EntityOneId] AND [t].[Name] IS NOT NULL AND ([t].[Name] LIKE N'L%')), [e].[Id]"); } public override async Task Skip_navigation_long_count_without_predicate(bool async) @@ -134,7 +134,7 @@ ORDER BY ( SELECT COUNT_BIG(*) FROM [EntityTwoEntityTwo] AS [e0] INNER JOIN [EntityTwos] AS [e1] ON [e0].[SelfSkipSharedLeftId] = [e1].[Id] - WHERE ([e].[Id] = [e0].[SelfSkipSharedRightId]) AND ([e1].[Name] IS NOT NULL AND ([e1].[Name] LIKE N'L%'))) DESC, [e].[Id]"); + WHERE [e].[Id] = [e0].[SelfSkipSharedRightId] AND [e1].[Name] IS NOT NULL AND ([e1].[Name] LIKE N'L%')) DESC, [e].[Id]"); } public override async Task Skip_navigation_select_many_average(bool async) @@ -147,7 +147,7 @@ FROM [EntityTwos] AS [e] INNER JOIN ( SELECT [e1].[Key1], [e0].[TwoSkipSharedId] FROM [EntityCompositeKeyEntityTwo] AS [e0] - INNER JOIN [EntityCompositeKeys] AS [e1] ON (([e0].[CompositeKeySkipSharedKey1] = [e1].[Key1]) AND ([e0].[CompositeKeySkipSharedKey2] = [e1].[Key2])) AND ([e0].[CompositeKeySkipSharedKey3] = [e1].[Key3]) + INNER JOIN [EntityCompositeKeys] AS [e1] ON [e0].[CompositeKeySkipSharedKey1] = [e1].[Key1] AND [e0].[CompositeKeySkipSharedKey2] = [e1].[Key2] AND [e0].[CompositeKeySkipSharedKey3] = [e1].[Key3] ) AS [t] ON [e].[Id] = [t].[TwoSkipSharedId]"); } @@ -161,7 +161,7 @@ FROM [EntityThrees] AS [e] INNER JOIN ( SELECT [e0].[Key1], [j].[ThreeId] FROM [JoinThreeToCompositeKeyFull] AS [j] - INNER JOIN [EntityCompositeKeys] AS [e0] ON (([j].[CompositeId1] = [e0].[Key1]) AND ([j].[CompositeId2] = [e0].[Key2])) AND ([j].[CompositeId3] = [e0].[Key3]) + INNER JOIN [EntityCompositeKeys] AS [e0] ON [j].[CompositeId1] = [e0].[Key1] AND [j].[CompositeId2] = [e0].[Key2] AND [j].[CompositeId3] = [e0].[Key3] ) AS [t] ON [e].[Id] = [t].[ThreeId]"); } @@ -192,7 +192,7 @@ FROM [Roots] AS [r] INNER JOIN ( SELECT [e0].[Key1], [e].[RootSkipSharedId] FROM [EntityCompositeKeyEntityRoot] AS [e] - INNER JOIN [EntityCompositeKeys] AS [e0] ON (([e].[CompositeKeySkipSharedKey1] = [e0].[Key1]) AND ([e].[CompositeKeySkipSharedKey2] = [e0].[Key2])) AND ([e].[CompositeKeySkipSharedKey3] = [e0].[Key3]) + INNER JOIN [EntityCompositeKeys] AS [e0] ON [e].[CompositeKeySkipSharedKey1] = [e0].[Key1] AND [e].[CompositeKeySkipSharedKey2] = [e0].[Key2] AND [e].[CompositeKeySkipSharedKey3] = [e0].[Key3] ) AS [t] ON [r].[Id] = [t].[RootSkipSharedId]"); } @@ -204,7 +204,7 @@ public override async Task Skip_navigation_select_subquery_average(bool async) @"SELECT ( SELECT AVG(CAST([e].[Key1] AS float)) FROM [JoinCompositeKeyToLeaf] AS [j] - INNER JOIN [EntityCompositeKeys] AS [e] ON (([j].[CompositeId1] = [e].[Key1]) AND ([j].[CompositeId2] = [e].[Key2])) AND ([j].[CompositeId3] = [e].[Key3]) + INNER JOIN [EntityCompositeKeys] AS [e] ON [j].[CompositeId1] = [e].[Key1] AND [j].[CompositeId2] = [e].[Key2] AND [j].[CompositeId3] = [e].[Key3] WHERE [r].[Id] = [j].[LeafId]) FROM [Roots] AS [r] INNER JOIN [Branches] AS [b] ON [r].[Id] = [b].[Id] @@ -341,7 +341,7 @@ FROM [Roots] AS [r] INNER JOIN [Branches] AS [b] ON [r].[Id] = [b].[Id] INNER JOIN [Leaves] AS [l] ON [r].[Id] = [l].[Id] ) AS [t] ON [j].[LeafId] = [t].[Id] -) AS [t0] ON (([e].[Key1] = [t0].[CompositeId1]) AND ([e].[Key2] = [t0].[CompositeId2])) AND ([e].[Key3] = [t0].[CompositeId3]) +) AS [t0] ON [e].[Key1] = [t0].[CompositeId1] AND [e].[Key2] = [t0].[CompositeId2] AND [e].[Key3] = [t0].[CompositeId3] ORDER BY [e].[Key1], [e].[Key2], [e].[Key3], [t0].[LeafId], [t0].[CompositeId1], [t0].[CompositeId2], [t0].[CompositeId3]"); } @@ -365,7 +365,7 @@ FROM [Roots] AS [r] LEFT JOIN [Leaves] AS [l] ON [r].[Id] = [l].[Id] ) AS [t] ON [e0].[RootSkipSharedId] = [t].[Id] WHERE [t].[Discriminator] = N'EntityLeaf' -) AS [t0] ON (([e].[Key1] = [t0].[CompositeKeySkipSharedKey1]) AND ([e].[Key2] = [t0].[CompositeKeySkipSharedKey2])) AND ([e].[Key3] = [t0].[CompositeKeySkipSharedKey3]) +) AS [t0] ON [e].[Key1] = [t0].[CompositeKeySkipSharedKey1] AND [e].[Key2] = [t0].[CompositeKeySkipSharedKey2] AND [e].[Key3] = [t0].[CompositeKeySkipSharedKey3] ORDER BY [e].[Key1], [e].[Key2], [e].[Key3], [t0].[RootSkipSharedId], [t0].[CompositeKeySkipSharedKey1], [t0].[CompositeKeySkipSharedKey2], [t0].[CompositeKeySkipSharedKey3]"); } @@ -395,12 +395,12 @@ LEFT JOIN [EntityCompositeKeys] AS [e0] ON ( SELECT TOP(1) [e2].[Id] FROM [EntityCompositeKeyEntityTwo] AS [e1] INNER JOIN [EntityTwos] AS [e2] ON [e1].[TwoSkipSharedId] = [e2].[Id] - WHERE (([e].[Key1] = [e1].[CompositeKeySkipSharedKey1]) AND ([e].[Key2] = [e1].[CompositeKeySkipSharedKey2])) AND ([e].[Key3] = [e1].[CompositeKeySkipSharedKey3]) + WHERE [e].[Key1] = [e1].[CompositeKeySkipSharedKey1] AND [e].[Key2] = [e1].[CompositeKeySkipSharedKey2] AND [e].[Key3] = [e1].[CompositeKeySkipSharedKey3] ORDER BY [e2].[Id]) = ( SELECT TOP(1) [e3].[Id] FROM [JoinThreeToCompositeKeyFull] AS [j] INNER JOIN [EntityThrees] AS [e3] ON [j].[ThreeId] = [e3].[Id] - WHERE (([e0].[Key1] = [j].[CompositeId1]) AND ([e0].[Key2] = [j].[CompositeId2])) AND ([e0].[Key3] = [j].[CompositeId3]) + WHERE [e0].[Key1] = [j].[CompositeId1] AND [e0].[Key2] = [j].[CompositeId2] AND [e0].[Key3] = [j].[CompositeId3] ORDER BY [e3].[Id]) ORDER BY [e].[Key1], [e0].[Key1], [e].[Key2], [e0].[Key2]"); } @@ -483,7 +483,7 @@ INNER JOIN ( FROM [JoinOneToThreePayloadFullShared] AS [j] INNER JOIN [EntityThrees] AS [e0] ON [j].[ThreeId] = [e0].[Id] ) AS [t] - WHERE (2 < [t].[row]) AND ([t].[row] <= 5) + WHERE 2 < [t].[row] AND [t].[row] <= 5 ) AS [t0] ON [e].[Id] = [t0].[OneId]"); } @@ -566,7 +566,7 @@ FROM [EntityTwoEntityTwo] AS [e1] LEFT JOIN ( SELECT [e4].[Key1], [e4].[Key2], [e4].[Key3], [e4].[Name], [e3].[TwoSkipSharedId], [e3].[CompositeKeySkipSharedKey1], [e3].[CompositeKeySkipSharedKey2], [e3].[CompositeKeySkipSharedKey3] FROM [EntityCompositeKeyEntityTwo] AS [e3] - INNER JOIN [EntityCompositeKeys] AS [e4] ON (([e3].[CompositeKeySkipSharedKey1] = [e4].[Key1]) AND ([e3].[CompositeKeySkipSharedKey2] = [e4].[Key2])) AND ([e3].[CompositeKeySkipSharedKey3] = [e4].[Key3]) + INNER JOIN [EntityCompositeKeys] AS [e4] ON [e3].[CompositeKeySkipSharedKey1] = [e4].[Key1] AND [e3].[CompositeKeySkipSharedKey2] = [e4].[Key2] AND [e3].[CompositeKeySkipSharedKey3] = [e4].[Key3] ) AS [t1] ON [e].[Id] = [t1].[TwoSkipSharedId] ORDER BY [e].[Id], [t].[ThreeId], [t].[TwoId], [t].[Id], [t0].[SelfSkipSharedLeftId], [t0].[SelfSkipSharedRightId], [t0].[Id], [t1].[TwoSkipSharedId], [t1].[CompositeKeySkipSharedKey1], [t1].[CompositeKeySkipSharedKey2], [t1].[CompositeKeySkipSharedKey3], [t1].[Key1], [t1].[Key2]"); } @@ -583,7 +583,7 @@ LEFT JOIN ( FROM ( SELECT [e0].[Key1], [e0].[Key2], [e0].[Key3], [e0].[Name], [j].[ThreeId], ROW_NUMBER() OVER(PARTITION BY [j].[ThreeId] ORDER BY [e0].[Key1], [e0].[Key2]) AS [row] FROM [JoinThreeToCompositeKeyFull] AS [j] - INNER JOIN [EntityCompositeKeys] AS [e0] ON (([j].[CompositeId1] = [e0].[Key1]) AND ([j].[CompositeId2] = [e0].[Key2])) AND ([j].[CompositeId3] = [e0].[Key3]) + INNER JOIN [EntityCompositeKeys] AS [e0] ON [j].[CompositeId1] = [e0].[Key1] AND [j].[CompositeId2] = [e0].[Key2] AND [j].[CompositeId3] = [e0].[Key3] ) AS [t] WHERE [t].[row] <= 1 ) AS [t0] ON [e].[Id] = [t0].[ThreeId] @@ -609,7 +609,7 @@ FROM [Roots] AS [r] LEFT JOIN [Branches] AS [b] ON [r].[Id] = [b].[Id] LEFT JOIN [Leaves] AS [l] ON [r].[Id] = [l].[Id] ) AS [t] ON [e0].[RootSkipSharedId] = [t].[Id] -) AS [t0] ON (([e].[Key1] = [t0].[CompositeKeySkipSharedKey1]) AND ([e].[Key2] = [t0].[CompositeKeySkipSharedKey2])) AND ([e].[Key3] = [t0].[CompositeKeySkipSharedKey3]) +) AS [t0] ON [e].[Key1] = [t0].[CompositeKeySkipSharedKey1] AND [e].[Key2] = [t0].[CompositeKeySkipSharedKey2] AND [e].[Key3] = [t0].[CompositeKeySkipSharedKey3] ORDER BY [e].[Key1], [e].[Key2], [e].[Key3], [t0].[RootSkipSharedId], [t0].[CompositeKeySkipSharedKey1], [t0].[CompositeKeySkipSharedKey2], [t0].[CompositeKeySkipSharedKey3]"); } @@ -650,7 +650,7 @@ LEFT JOIN ( FROM [JoinOneToBranch] AS [j0] INNER JOIN [EntityOnes] AS [e0] ON [j0].[EntityOneId] = [e0].[Id] ) AS [t0] ON [t].[Id] = [t0].[EntityBranchId] -) AS [t1] ON (([e].[Key1] = [t1].[CompositeId1]) AND ([e].[Key2] = [t1].[CompositeId2])) AND ([e].[Key3] = [t1].[CompositeId3]) +) AS [t1] ON [e].[Key1] = [t1].[CompositeId1] AND [e].[Key2] = [t1].[CompositeId2] AND [e].[Key3] = [t1].[CompositeId3] ORDER BY [e].[Key1], [e].[Key2], [e].[Key3], [t1].[LeafId], [t1].[CompositeId1], [t1].[CompositeId2], [t1].[CompositeId3], [t1].[Id], [t1].[EntityBranchId], [t1].[EntityOneId]"); } @@ -756,7 +756,7 @@ FROM [EntityCompositeKeyEntityTwo] AS [e0] INNER JOIN [EntityTwos] AS [e1] ON [e0].[TwoSkipSharedId] = [e1].[Id] ) AS [t] WHERE [t].[row] <= 2 -) AS [t0] ON (([e].[Key1] = [t0].[CompositeKeySkipSharedKey1]) AND ([e].[Key2] = [t0].[CompositeKeySkipSharedKey2])) AND ([e].[Key3] = [t0].[CompositeKeySkipSharedKey3]) +) AS [t0] ON [e].[Key1] = [t0].[CompositeKeySkipSharedKey1] AND [e].[Key2] = [t0].[CompositeKeySkipSharedKey2] AND [e].[Key3] = [t0].[CompositeKeySkipSharedKey3] ORDER BY [e].[Key1], [e].[Key2], [e].[Key3], [t0].[CompositeKeySkipSharedKey1], [t0].[CompositeKeySkipSharedKey2], [t0].[CompositeKeySkipSharedKey3], [t0].[Id]"); } @@ -774,8 +774,8 @@ LEFT JOIN ( FROM [JoinThreeToCompositeKeyFull] AS [j] INNER JOIN [EntityThrees] AS [e0] ON [j].[ThreeId] = [e0].[Id] ) AS [t] - WHERE (1 < [t].[row]) AND ([t].[row] <= 3) -) AS [t0] ON (([e].[Key1] = [t0].[CompositeId1]) AND ([e].[Key2] = [t0].[CompositeId2])) AND ([e].[Key3] = [t0].[CompositeId3]) + WHERE 1 < [t].[row] AND [t].[row] <= 3 +) AS [t0] ON [e].[Key1] = [t0].[CompositeId1] AND [e].[Key2] = [t0].[CompositeId2] AND [e].[Key3] = [t0].[CompositeId3] ORDER BY [e].[Key1], [e].[Key2], [e].[Key3], [t0].[CompositeId1], [t0].[CompositeId2], [t0].[CompositeId3], [t0].[Id0]"); } @@ -820,7 +820,7 @@ FROM [Roots] AS [r] LEFT JOIN ( SELECT [e].[RootSkipSharedId], [e].[CompositeKeySkipSharedKey1], [e].[CompositeKeySkipSharedKey2], [e].[CompositeKeySkipSharedKey3], [e0].[Key1], [e0].[Key2], [e0].[Key3], [e0].[Name], [t0].[Id], [t0].[CompositeId1], [t0].[CompositeId2], [t0].[CompositeId3], [t0].[ThreeId], [t0].[Id0], [t0].[CollectionInverseId], [t0].[Name] AS [Name0], [t0].[ReferenceInverseId] FROM [EntityCompositeKeyEntityRoot] AS [e] - INNER JOIN [EntityCompositeKeys] AS [e0] ON (([e].[CompositeKeySkipSharedKey1] = [e0].[Key1]) AND ([e].[CompositeKeySkipSharedKey2] = [e0].[Key2])) AND ([e].[CompositeKeySkipSharedKey3] = [e0].[Key3]) + INNER JOIN [EntityCompositeKeys] AS [e0] ON [e].[CompositeKeySkipSharedKey1] = [e0].[Key1] AND [e].[CompositeKeySkipSharedKey2] = [e0].[Key2] AND [e].[CompositeKeySkipSharedKey3] = [e0].[Key3] LEFT JOIN ( SELECT [t].[Id], [t].[CompositeId1], [t].[CompositeId2], [t].[CompositeId3], [t].[ThreeId], [t].[Id0], [t].[CollectionInverseId], [t].[Name], [t].[ReferenceInverseId] FROM ( @@ -828,8 +828,8 @@ LEFT JOIN ( FROM [JoinThreeToCompositeKeyFull] AS [j] INNER JOIN [EntityThrees] AS [e1] ON [j].[ThreeId] = [e1].[Id] ) AS [t] - WHERE (1 < [t].[row]) AND ([t].[row] <= 3) - ) AS [t0] ON (([e0].[Key1] = [t0].[CompositeId1]) AND ([e0].[Key2] = [t0].[CompositeId2])) AND ([e0].[Key3] = [t0].[CompositeId3]) + WHERE 1 < [t].[row] AND [t].[row] <= 3 + ) AS [t0] ON [e0].[Key1] = [t0].[CompositeId1] AND [e0].[Key2] = [t0].[CompositeId2] AND [e0].[Key3] = [t0].[CompositeId3] ) AS [t1] ON [r].[Id] = [t1].[RootSkipSharedId] ORDER BY [r].[Id], [t1].[RootSkipSharedId], [t1].[CompositeKeySkipSharedKey1], [t1].[CompositeKeySkipSharedKey2], [t1].[CompositeKeySkipSharedKey3], [t1].[Key1], [t1].[Key2], [t1].[Key3], [t1].[CompositeId1], [t1].[CompositeId2], [t1].[CompositeId3], [t1].[Id0]"); } @@ -846,12 +846,12 @@ FROM [Roots] AS [r] LEFT JOIN ( SELECT [j].[LeafId], [j].[CompositeId1], [j].[CompositeId2], [j].[CompositeId3], [e].[Key1], [e].[Key2], [e].[Key3], [e].[Name], [t].[TwoSkipSharedId], [t].[CompositeKeySkipSharedKey1], [t].[CompositeKeySkipSharedKey2], [t].[CompositeKeySkipSharedKey3], [t].[Id], [t].[CollectionInverseId], [t].[ExtraId], [t].[Name] AS [Name0], [t].[ReferenceInverseId] FROM [JoinCompositeKeyToLeaf] AS [j] - INNER JOIN [EntityCompositeKeys] AS [e] ON (([j].[CompositeId1] = [e].[Key1]) AND ([j].[CompositeId2] = [e].[Key2])) AND ([j].[CompositeId3] = [e].[Key3]) + INNER JOIN [EntityCompositeKeys] AS [e] ON [j].[CompositeId1] = [e].[Key1] AND [j].[CompositeId2] = [e].[Key2] AND [j].[CompositeId3] = [e].[Key3] LEFT JOIN ( SELECT [e0].[TwoSkipSharedId], [e0].[CompositeKeySkipSharedKey1], [e0].[CompositeKeySkipSharedKey2], [e0].[CompositeKeySkipSharedKey3], [e1].[Id], [e1].[CollectionInverseId], [e1].[ExtraId], [e1].[Name], [e1].[ReferenceInverseId] FROM [EntityCompositeKeyEntityTwo] AS [e0] INNER JOIN [EntityTwos] AS [e1] ON [e0].[TwoSkipSharedId] = [e1].[Id] - ) AS [t] ON (([e].[Key1] = [t].[CompositeKeySkipSharedKey1]) AND ([e].[Key2] = [t].[CompositeKeySkipSharedKey2])) AND ([e].[Key3] = [t].[CompositeKeySkipSharedKey3]) + ) AS [t] ON [e].[Key1] = [t].[CompositeKeySkipSharedKey1] AND [e].[Key2] = [t].[CompositeKeySkipSharedKey2] AND [e].[Key3] = [t].[CompositeKeySkipSharedKey3] WHERE [e].[Key1] < 5 ) AS [t0] ON [r].[Id] = [t0].[LeafId] ORDER BY [r].[Id], [t0].[LeafId], [t0].[CompositeId1], [t0].[CompositeId2], [t0].[CompositeId3], [t0].[Key1], [t0].[Key2], [t0].[Key3], [t0].[TwoSkipSharedId], [t0].[CompositeKeySkipSharedKey1], [t0].[CompositeKeySkipSharedKey2], [t0].[CompositeKeySkipSharedKey3]"); @@ -902,7 +902,7 @@ LEFT JOIN ( FROM [JoinTwoToThree] AS [j0] INNER JOIN [EntityThrees] AS [e1] ON [j0].[ThreeId] = [e1].[Id] ) AS [t] - WHERE (1 < [t].[row]) AND ([t].[row] <= 3) + WHERE 1 < [t].[row] AND [t].[row] <= 3 ) AS [t0] ON [e0].[Id] = [t0].[TwoId] WHERE [e0].[Id] < 10 ) AS [t1] ON [e].[Id] = [t1].[OneId] @@ -945,7 +945,7 @@ LEFT JOIN ( FROM [JoinOneToTwo] AS [j0] INNER JOIN [EntityTwos] AS [e1] ON [j0].[TwoId] = [e1].[Id] ) AS [t] - WHERE (1 < [t].[row]) AND ([t].[row] <= 3) + WHERE 1 < [t].[row] AND [t].[row] <= 3 ) AS [t0] ON [e0].[Id] = [t0].[OneId] LEFT JOIN ( SELECT [j1].[EntityBranchId], [j1].[EntityOneId], [t2].[Id], [t2].[Name], [t2].[Number], [t2].[IsGreen], [t2].[Discriminator] @@ -1044,7 +1044,7 @@ FROM [Roots] AS [r] LEFT JOIN [Branches] AS [b] ON [r].[Id] = [b].[Id] LEFT JOIN [Leaves] AS [l] ON [r].[Id] = [l].[Id] ) AS [t] ON [e0].[RootSkipSharedId] = [t].[Id] -) AS [t0] ON (([e].[Key1] = [t0].[CompositeKeySkipSharedKey1]) AND ([e].[Key2] = [t0].[CompositeKeySkipSharedKey2])) AND ([e].[Key3] = [t0].[CompositeKeySkipSharedKey3]) +) AS [t0] ON [e].[Key1] = [t0].[CompositeKeySkipSharedKey1] AND [e].[Key2] = [t0].[CompositeKeySkipSharedKey2] AND [e].[Key3] = [t0].[CompositeKeySkipSharedKey3] ORDER BY [e].[Key1], [e].[Key2], [e].[Key3]"); } @@ -1088,7 +1088,7 @@ FROM [Roots] AS [r] INNER JOIN [Branches] AS [b] ON [r].[Id] = [b].[Id] INNER JOIN [Leaves] AS [l] ON [r].[Id] = [l].[Id] ) AS [t] ON [j].[LeafId] = [t].[Id] -) AS [t0] ON (([e].[Key1] = [t0].[CompositeId1]) AND ([e].[Key2] = [t0].[CompositeId2])) AND ([e].[Key3] = [t0].[CompositeId3]) +) AS [t0] ON [e].[Key1] = [t0].[CompositeId1] AND [e].[Key2] = [t0].[CompositeId2] AND [e].[Key3] = [t0].[CompositeId3] ORDER BY [e].[Key1], [e].[Key2], [e].[Key3], [t0].[LeafId], [t0].[CompositeId1], [t0].[CompositeId2], [t0].[CompositeId3], [t0].[Id]", // @"SELECT [t1].[EntityBranchId], [t1].[EntityOneId], [t1].[Id], [t1].[Name], [e].[Key1], [e].[Key2], [e].[Key3], [t0].[LeafId], [t0].[CompositeId1], [t0].[CompositeId2], [t0].[CompositeId3], [t0].[Id] @@ -1102,7 +1102,7 @@ FROM [Roots] AS [r] INNER JOIN [Branches] AS [b] ON [r].[Id] = [b].[Id] INNER JOIN [Leaves] AS [l] ON [r].[Id] = [l].[Id] ) AS [t] ON [j].[LeafId] = [t].[Id] -) AS [t0] ON (([e].[Key1] = [t0].[CompositeId1]) AND ([e].[Key2] = [t0].[CompositeId2])) AND ([e].[Key3] = [t0].[CompositeId3]) +) AS [t0] ON [e].[Key1] = [t0].[CompositeId1] AND [e].[Key2] = [t0].[CompositeId2] AND [e].[Key3] = [t0].[CompositeId3] INNER JOIN ( SELECT [j0].[EntityBranchId], [j0].[EntityOneId], [e0].[Id], [e0].[Name] FROM [JoinOneToBranch] AS [j0] @@ -1248,7 +1248,7 @@ FROM [EntityCompositeKeyEntityTwo] AS [e0] INNER JOIN [EntityTwos] AS [e1] ON [e0].[TwoSkipSharedId] = [e1].[Id] ) AS [t] WHERE [t].[row] <= 2 -) AS [t0] ON (([e].[Key1] = [t0].[CompositeKeySkipSharedKey1]) AND ([e].[Key2] = [t0].[CompositeKeySkipSharedKey2])) AND ([e].[Key3] = [t0].[CompositeKeySkipSharedKey3]) +) AS [t0] ON [e].[Key1] = [t0].[CompositeKeySkipSharedKey1] AND [e].[Key2] = [t0].[CompositeKeySkipSharedKey2] AND [e].[Key3] = [t0].[CompositeKeySkipSharedKey3] ORDER BY [e].[Key1], [e].[Key2], [e].[Key3], [t0].[CompositeKeySkipSharedKey1], [t0].[CompositeKeySkipSharedKey2], [t0].[CompositeKeySkipSharedKey3], [t0].[Id]"); } @@ -1270,8 +1270,8 @@ INNER JOIN ( FROM [JoinThreeToCompositeKeyFull] AS [j] INNER JOIN [EntityThrees] AS [e0] ON [j].[ThreeId] = [e0].[Id] ) AS [t] - WHERE (1 < [t].[row]) AND ([t].[row] <= 3) -) AS [t0] ON (([e].[Key1] = [t0].[CompositeId1]) AND ([e].[Key2] = [t0].[CompositeId2])) AND ([e].[Key3] = [t0].[CompositeId3]) + WHERE 1 < [t].[row] AND [t].[row] <= 3 +) AS [t0] ON [e].[Key1] = [t0].[CompositeId1] AND [e].[Key2] = [t0].[CompositeId2] AND [e].[Key3] = [t0].[CompositeId3] ORDER BY [e].[Key1], [e].[Key2], [e].[Key3], [t0].[CompositeId1], [t0].[CompositeId2], [t0].[CompositeId3], [t0].[Id0]"); } @@ -1333,7 +1333,7 @@ FROM [Roots] AS [r] INNER JOIN ( SELECT [e].[RootSkipSharedId], [e].[CompositeKeySkipSharedKey1], [e].[CompositeKeySkipSharedKey2], [e].[CompositeKeySkipSharedKey3], [e0].[Key1], [e0].[Key2], [e0].[Key3], [e0].[Name] FROM [EntityCompositeKeyEntityRoot] AS [e] - INNER JOIN [EntityCompositeKeys] AS [e0] ON (([e].[CompositeKeySkipSharedKey1] = [e0].[Key1]) AND ([e].[CompositeKeySkipSharedKey2] = [e0].[Key2])) AND ([e].[CompositeKeySkipSharedKey3] = [e0].[Key3]) + INNER JOIN [EntityCompositeKeys] AS [e0] ON [e].[CompositeKeySkipSharedKey1] = [e0].[Key1] AND [e].[CompositeKeySkipSharedKey2] = [e0].[Key2] AND [e].[CompositeKeySkipSharedKey3] = [e0].[Key3] ) AS [t] ON [r].[Id] = [t].[RootSkipSharedId] ORDER BY [r].[Id], [t].[RootSkipSharedId], [t].[CompositeKeySkipSharedKey1], [t].[CompositeKeySkipSharedKey2], [t].[CompositeKeySkipSharedKey3], [t].[Key1], [t].[Key2], [t].[Key3]", // @@ -1342,7 +1342,7 @@ FROM [Roots] AS [r] INNER JOIN ( SELECT [e].[RootSkipSharedId], [e].[CompositeKeySkipSharedKey1], [e].[CompositeKeySkipSharedKey2], [e].[CompositeKeySkipSharedKey3], [e0].[Key1], [e0].[Key2], [e0].[Key3] FROM [EntityCompositeKeyEntityRoot] AS [e] - INNER JOIN [EntityCompositeKeys] AS [e0] ON (([e].[CompositeKeySkipSharedKey1] = [e0].[Key1]) AND ([e].[CompositeKeySkipSharedKey2] = [e0].[Key2])) AND ([e].[CompositeKeySkipSharedKey3] = [e0].[Key3]) + INNER JOIN [EntityCompositeKeys] AS [e0] ON [e].[CompositeKeySkipSharedKey1] = [e0].[Key1] AND [e].[CompositeKeySkipSharedKey2] = [e0].[Key2] AND [e].[CompositeKeySkipSharedKey3] = [e0].[Key3] ) AS [t] ON [r].[Id] = [t].[RootSkipSharedId] INNER JOIN ( SELECT [t1].[Id], [t1].[CompositeId1], [t1].[CompositeId2], [t1].[CompositeId3], [t1].[ThreeId], [t1].[Id0], [t1].[CollectionInverseId], [t1].[Name], [t1].[ReferenceInverseId] @@ -1351,8 +1351,8 @@ INNER JOIN ( FROM [JoinThreeToCompositeKeyFull] AS [j] INNER JOIN [EntityThrees] AS [e1] ON [j].[ThreeId] = [e1].[Id] ) AS [t1] - WHERE (1 < [t1].[row]) AND ([t1].[row] <= 3) -) AS [t0] ON (([t].[Key1] = [t0].[CompositeId1]) AND ([t].[Key2] = [t0].[CompositeId2])) AND ([t].[Key3] = [t0].[CompositeId3]) + WHERE 1 < [t1].[row] AND [t1].[row] <= 3 +) AS [t0] ON [t].[Key1] = [t0].[CompositeId1] AND [t].[Key2] = [t0].[CompositeId2] AND [t].[Key3] = [t0].[CompositeId3] ORDER BY [r].[Id], [t].[RootSkipSharedId], [t].[CompositeKeySkipSharedKey1], [t].[CompositeKeySkipSharedKey2], [t].[CompositeKeySkipSharedKey3], [t].[Key1], [t].[Key2], [t].[Key3], [t0].[CompositeId1], [t0].[CompositeId2], [t0].[CompositeId3], [t0].[Id0]"); } @@ -1374,7 +1374,7 @@ FROM [Roots] AS [r] INNER JOIN ( SELECT [j].[LeafId], [j].[CompositeId1], [j].[CompositeId2], [j].[CompositeId3], [e].[Key1], [e].[Key2], [e].[Key3], [e].[Name] FROM [JoinCompositeKeyToLeaf] AS [j] - INNER JOIN [EntityCompositeKeys] AS [e] ON (([j].[CompositeId1] = [e].[Key1]) AND ([j].[CompositeId2] = [e].[Key2])) AND ([j].[CompositeId3] = [e].[Key3]) + INNER JOIN [EntityCompositeKeys] AS [e] ON [j].[CompositeId1] = [e].[Key1] AND [j].[CompositeId2] = [e].[Key2] AND [j].[CompositeId3] = [e].[Key3] WHERE [e].[Key1] < 5 ) AS [t] ON [r].[Id] = [t].[LeafId] ORDER BY [r].[Id], [t].[LeafId], [t].[CompositeId1], [t].[CompositeId2], [t].[CompositeId3], [t].[Key1], [t].[Key2], [t].[Key3]", @@ -1386,14 +1386,14 @@ FROM [Roots] AS [r] INNER JOIN ( SELECT [j].[LeafId], [j].[CompositeId1], [j].[CompositeId2], [j].[CompositeId3], [e].[Key1], [e].[Key2], [e].[Key3] FROM [JoinCompositeKeyToLeaf] AS [j] - INNER JOIN [EntityCompositeKeys] AS [e] ON (([j].[CompositeId1] = [e].[Key1]) AND ([j].[CompositeId2] = [e].[Key2])) AND ([j].[CompositeId3] = [e].[Key3]) + INNER JOIN [EntityCompositeKeys] AS [e] ON [j].[CompositeId1] = [e].[Key1] AND [j].[CompositeId2] = [e].[Key2] AND [j].[CompositeId3] = [e].[Key3] WHERE [e].[Key1] < 5 ) AS [t] ON [r].[Id] = [t].[LeafId] INNER JOIN ( SELECT [e0].[TwoSkipSharedId], [e0].[CompositeKeySkipSharedKey1], [e0].[CompositeKeySkipSharedKey2], [e0].[CompositeKeySkipSharedKey3], [e1].[Id], [e1].[CollectionInverseId], [e1].[ExtraId], [e1].[Name], [e1].[ReferenceInverseId] FROM [EntityCompositeKeyEntityTwo] AS [e0] INNER JOIN [EntityTwos] AS [e1] ON [e0].[TwoSkipSharedId] = [e1].[Id] -) AS [t0] ON (([t].[Key1] = [t0].[CompositeKeySkipSharedKey1]) AND ([t].[Key2] = [t0].[CompositeKeySkipSharedKey2])) AND ([t].[Key3] = [t0].[CompositeKeySkipSharedKey3]) +) AS [t0] ON [t].[Key1] = [t0].[CompositeKeySkipSharedKey1] AND [t].[Key2] = [t0].[CompositeKeySkipSharedKey2] AND [t].[Key3] = [t0].[CompositeKeySkipSharedKey3] ORDER BY [r].[Id], [t].[LeafId], [t].[CompositeId1], [t].[CompositeId2], [t].[CompositeId3], [t].[Key1], [t].[Key2], [t].[Key3]"); } @@ -1415,7 +1415,7 @@ INNER JOIN ( FROM [JoinOneToTwo] AS [j] INNER JOIN [EntityTwos] AS [e0] ON [j].[TwoId] = [e0].[Id] ) AS [t] - WHERE (1 < [t].[row]) AND ([t].[row] <= 3) + WHERE 1 < [t].[row] AND [t].[row] <= 3 ) AS [t0] ON [e].[Id] = [t0].[OneId] ORDER BY [e].[Id], [t0].[OneId], [t0].[Id], [t0].[TwoId]", // @@ -1428,7 +1428,7 @@ INNER JOIN ( FROM [JoinOneToTwo] AS [j] INNER JOIN [EntityTwos] AS [e0] ON [j].[TwoId] = [e0].[Id] ) AS [t] - WHERE (1 < [t].[row]) AND ([t].[row] <= 3) + WHERE 1 < [t].[row] AND [t].[row] <= 3 ) AS [t0] ON [e].[Id] = [t0].[OneId] INNER JOIN ( SELECT [j0].[ThreeId], [j0].[TwoId], [e1].[Id], [e1].[CollectionInverseId], [e1].[Name], [e1].[ReferenceInverseId] @@ -1473,7 +1473,7 @@ INNER JOIN ( FROM [JoinTwoToThree] AS [j0] INNER JOIN [EntityThrees] AS [e1] ON [j0].[ThreeId] = [e1].[Id] ) AS [t1] - WHERE (1 < [t1].[row]) AND ([t1].[row] <= 3) + WHERE 1 < [t1].[row] AND [t1].[row] <= 3 ) AS [t0] ON [t].[Id] = [t0].[TwoId] ORDER BY [e].[Id], [t].[OneId], [t].[TwoId], [t].[Id], [t0].[TwoId], [t0].[Id]"); } @@ -1545,7 +1545,7 @@ INNER JOIN ( FROM [JoinOneToTwo] AS [j0] INNER JOIN [EntityTwos] AS [e1] ON [j0].[TwoId] = [e1].[Id] ) AS [t1] - WHERE (1 < [t1].[row]) AND ([t1].[row] <= 3) + WHERE 1 < [t1].[row] AND [t1].[row] <= 3 ) AS [t0] ON [t].[Id] = [t0].[OneId] ORDER BY [e].[Id], [t].[OneId], [t].[ThreeId], [t].[Id], [t0].[OneId], [t0].[Id]", // diff --git a/test/EFCore.SqlServer.FunctionalTests/Query/TPTRelationshipsQuerySqlServerTest.cs b/test/EFCore.SqlServer.FunctionalTests/Query/TPTRelationshipsQuerySqlServerTest.cs index abef61d0275..670c60475a3 100644 --- a/test/EFCore.SqlServer.FunctionalTests/Query/TPTRelationshipsQuerySqlServerTest.cs +++ b/test/EFCore.SqlServer.FunctionalTests/Query/TPTRelationshipsQuerySqlServerTest.cs @@ -92,7 +92,7 @@ FROM [BaseEntities] AS [b] LEFT JOIN [BaseEntities_OwnedCollectionOnBase] AS [b0] ON [b].[Id] = [b0].[BaseInheritanceRelationshipEntityId] LEFT JOIN [DerivedEntities_OwnedCollectionOnDerived] AS [d0] ON [b].[Id] = [d0].[DerivedInheritanceRelationshipEntityId] LEFT JOIN [CollectionsOnBase] AS [c] ON [b].[Id] = [c].[ParentId] -WHERE ([b].[Name] <> N'Bar') OR [b].[Name] IS NULL +WHERE [b].[Name] <> N'Bar' OR [b].[Name] IS NULL ORDER BY [b].[Id], [b0].[BaseInheritanceRelationshipEntityId], [b0].[Id], [d0].[DerivedInheritanceRelationshipEntityId], [d0].[Id]"); } @@ -112,7 +112,7 @@ FROM [BaseEntities] AS [b] ) AS [t] ON [c].[ParentId] = [t].[Id] LEFT JOIN [BaseEntities_OwnedCollectionOnBase] AS [b0] ON [t].[Id] = [b0].[BaseInheritanceRelationshipEntityId] LEFT JOIN [DerivedEntities_OwnedCollectionOnDerived] AS [d0] ON [t].[Id] = [d0].[DerivedInheritanceRelationshipEntityId] -WHERE ([c].[Name] <> N'Bar') OR [c].[Name] IS NULL +WHERE [c].[Name] <> N'Bar' OR [c].[Name] IS NULL ORDER BY [c].[Id], [t].[Id], [b0].[BaseInheritanceRelationshipEntityId], [b0].[Id], [d0].[DerivedInheritanceRelationshipEntityId]"); } @@ -257,7 +257,7 @@ END AS [Discriminator] FROM [BaseCollectionsOnBase] AS [b1] LEFT JOIN [DerivedCollectionsOnBase] AS [d1] ON [b1].[Id] = [d1].[Id] ) AS [t] ON [b].[Id] = [t].[BaseParentId] -WHERE ([b].[Name] <> N'Bar') OR [b].[Name] IS NULL +WHERE [b].[Name] <> N'Bar' OR [b].[Name] IS NULL ORDER BY [b].[Id], [b0].[BaseInheritanceRelationshipEntityId], [b0].[Id], [d0].[DerivedInheritanceRelationshipEntityId], [d0].[Id]"); } @@ -280,7 +280,7 @@ FROM [BaseEntities] AS [b0] ) AS [t] ON [b].[BaseParentId] = [t].[Id] LEFT JOIN [BaseEntities_OwnedCollectionOnBase] AS [b1] ON [t].[Id] = [b1].[BaseInheritanceRelationshipEntityId] LEFT JOIN [DerivedEntities_OwnedCollectionOnDerived] AS [d1] ON [t].[Id] = [d1].[DerivedInheritanceRelationshipEntityId] -WHERE ([b].[Name] <> N'Bar') OR [b].[Name] IS NULL +WHERE [b].[Name] <> N'Bar' OR [b].[Name] IS NULL ORDER BY [b].[Id], [t].[Id], [b1].[BaseInheritanceRelationshipEntityId], [b1].[Id], [d1].[DerivedInheritanceRelationshipEntityId]"); } @@ -377,7 +377,7 @@ FROM [BaseEntities] AS [b] LEFT JOIN [ReferencesOnBase] AS [r] ON [b].[Id] = [r].[ParentId] LEFT JOIN [BaseEntities_OwnedCollectionOnBase] AS [b0] ON [b].[Id] = [b0].[BaseInheritanceRelationshipEntityId] LEFT JOIN [DerivedEntities_OwnedCollectionOnDerived] AS [d0] ON [b].[Id] = [d0].[DerivedInheritanceRelationshipEntityId] -WHERE ([b].[Name] <> N'Bar') OR [b].[Name] IS NULL +WHERE [b].[Name] <> N'Bar' OR [b].[Name] IS NULL ORDER BY [b].[Id], [r].[Id], [b0].[BaseInheritanceRelationshipEntityId], [b0].[Id], [d0].[DerivedInheritanceRelationshipEntityId]"); } @@ -397,7 +397,7 @@ FROM [BaseEntities] AS [b] ) AS [t] ON [r].[ParentId] = [t].[Id] LEFT JOIN [BaseEntities_OwnedCollectionOnBase] AS [b0] ON [t].[Id] = [b0].[BaseInheritanceRelationshipEntityId] LEFT JOIN [DerivedEntities_OwnedCollectionOnDerived] AS [d0] ON [t].[Id] = [d0].[DerivedInheritanceRelationshipEntityId] -WHERE ([r].[Name] <> N'Bar') OR [r].[Name] IS NULL +WHERE [r].[Name] <> N'Bar' OR [r].[Name] IS NULL ORDER BY [r].[Id], [t].[Id], [b0].[BaseInheritanceRelationshipEntityId], [b0].[Id], [d0].[DerivedInheritanceRelationshipEntityId]"); } @@ -518,7 +518,7 @@ FROM [BaseReferencesOnBase] AS [b0] ) AS [t] ON [b].[Id] = [t].[BaseParentId] LEFT JOIN [BaseEntities_OwnedCollectionOnBase] AS [b1] ON [b].[Id] = [b1].[BaseInheritanceRelationshipEntityId] LEFT JOIN [DerivedEntities_OwnedCollectionOnDerived] AS [d1] ON [b].[Id] = [d1].[DerivedInheritanceRelationshipEntityId] -WHERE ([b].[Name] <> N'Bar') OR [b].[Name] IS NULL +WHERE [b].[Name] <> N'Bar' OR [b].[Name] IS NULL ORDER BY [b].[Id], [t].[Id], [b1].[BaseInheritanceRelationshipEntityId], [b1].[Id], [d1].[DerivedInheritanceRelationshipEntityId]"); } @@ -539,7 +539,7 @@ FROM [BaseReferencesOnDerived] AS [b0] ) AS [t] ON [b].[Id] = [t].[BaseParentId] LEFT JOIN [BaseEntities_OwnedCollectionOnBase] AS [b1] ON [b].[Id] = [b1].[BaseInheritanceRelationshipEntityId] LEFT JOIN [DerivedEntities_OwnedCollectionOnDerived] AS [d1] ON [b].[Id] = [d1].[DerivedInheritanceRelationshipEntityId] -WHERE ([b].[Name] <> N'Bar') OR [b].[Name] IS NULL +WHERE [b].[Name] <> N'Bar' OR [b].[Name] IS NULL ORDER BY [b].[Id], [t].[Id], [b1].[BaseInheritanceRelationshipEntityId], [b1].[Id], [d1].[DerivedInheritanceRelationshipEntityId]"); } @@ -558,7 +558,7 @@ FROM [BaseReferencesOnDerived] AS [b0] ) AS [t] ON [b].[Id] = [t].[DerivedInheritanceRelationshipEntityId] LEFT JOIN [BaseEntities_OwnedCollectionOnBase] AS [b1] ON [b].[Id] = [b1].[BaseInheritanceRelationshipEntityId] LEFT JOIN [DerivedEntities_OwnedCollectionOnDerived] AS [d1] ON [b].[Id] = [d1].[DerivedInheritanceRelationshipEntityId] -WHERE ([b].[Name] <> N'Bar') OR [b].[Name] IS NULL +WHERE [b].[Name] <> N'Bar' OR [b].[Name] IS NULL ORDER BY [b].[Id], [t].[Id], [b1].[BaseInheritanceRelationshipEntityId], [b1].[Id], [d1].[DerivedInheritanceRelationshipEntityId]"); } @@ -579,7 +579,7 @@ FROM [BaseEntities] AS [b0] ) AS [t] ON [b].[BaseParentId] = [t].[Id] LEFT JOIN [BaseEntities_OwnedCollectionOnBase] AS [b1] ON [t].[Id] = [b1].[BaseInheritanceRelationshipEntityId] LEFT JOIN [DerivedEntities_OwnedCollectionOnDerived] AS [d1] ON [t].[Id] = [d1].[DerivedInheritanceRelationshipEntityId] -WHERE ([b].[Name] <> N'Bar') OR [b].[Name] IS NULL +WHERE [b].[Name] <> N'Bar' OR [b].[Name] IS NULL ORDER BY [b].[Id], [t].[Id], [b1].[BaseInheritanceRelationshipEntityId], [b1].[Id], [d1].[DerivedInheritanceRelationshipEntityId]"); } @@ -624,7 +624,7 @@ FROM [BaseReferencesOnBase] AS [b0] ) AS [t] ON [b].[Id] = [t].[BaseParentId] LEFT JOIN [BaseEntities_OwnedCollectionOnBase] AS [b1] ON [b].[Id] = [b1].[BaseInheritanceRelationshipEntityId] LEFT JOIN [DerivedEntities_OwnedCollectionOnDerived] AS [d1] ON [b].[Id] = [d1].[DerivedInheritanceRelationshipEntityId] -WHERE ([b].[Name] <> N'Bar') OR [b].[Name] IS NULL +WHERE [b].[Name] <> N'Bar' OR [b].[Name] IS NULL ORDER BY [b].[Id], [t].[Id], [b1].[BaseInheritanceRelationshipEntityId], [b1].[Id], [d1].[DerivedInheritanceRelationshipEntityId]"); } @@ -647,7 +647,7 @@ FROM [BaseEntities] AS [b0] ) AS [t] ON [b].[BaseParentId] = [t].[Id] LEFT JOIN [BaseEntities_OwnedCollectionOnBase] AS [b1] ON [t].[Id] = [b1].[BaseInheritanceRelationshipEntityId] LEFT JOIN [DerivedEntities_OwnedCollectionOnDerived] AS [d1] ON [t].[Id] = [d1].[DerivedInheritanceRelationshipEntityId] -WHERE ([b].[Name] <> N'Bar') OR [b].[Name] IS NULL +WHERE [b].[Name] <> N'Bar' OR [b].[Name] IS NULL ORDER BY [b].[Id], [t].[Id], [b1].[BaseInheritanceRelationshipEntityId], [b1].[Id], [d1].[DerivedInheritanceRelationshipEntityId]"); } @@ -1116,19 +1116,19 @@ WHEN [d].[Id] IS NOT NULL THEN N'DerivedInheritanceRelationshipEntity' END AS [Discriminator], [b].[OwnedReferenceOnBase_Id], [b].[OwnedReferenceOnBase_Name], [d].[Id], [d].[OwnedReferenceOnDerived_Id], [d].[OwnedReferenceOnDerived_Name] FROM [BaseEntities] AS [b] LEFT JOIN [DerivedEntities] AS [d] ON [b].[Id] = [d].[Id] -WHERE ([b].[Name] <> N'Bar') OR [b].[Name] IS NULL +WHERE [b].[Name] <> N'Bar' OR [b].[Name] IS NULL ORDER BY [b].[Id]", // @"SELECT [b0].[BaseInheritanceRelationshipEntityId], [b0].[Id], [b0].[Name], [b].[Id] FROM [BaseEntities] AS [b] INNER JOIN [BaseEntities_OwnedCollectionOnBase] AS [b0] ON [b].[Id] = [b0].[BaseInheritanceRelationshipEntityId] -WHERE ([b].[Name] <> N'Bar') OR [b].[Name] IS NULL +WHERE [b].[Name] <> N'Bar' OR [b].[Name] IS NULL ORDER BY [b].[Id]", // @"SELECT [d0].[DerivedInheritanceRelationshipEntityId], [d0].[Id], [d0].[Name], [b].[Id] FROM [BaseEntities] AS [b] INNER JOIN [DerivedEntities_OwnedCollectionOnDerived] AS [d0] ON [b].[Id] = [d0].[DerivedInheritanceRelationshipEntityId] -WHERE ([b].[Name] <> N'Bar') OR [b].[Name] IS NULL +WHERE [b].[Name] <> N'Bar' OR [b].[Name] IS NULL ORDER BY [b].[Id]", // @"SELECT [t].[Id], [t].[BaseParentId], [t].[Name], [t].[DerivedProperty], [t].[Discriminator], [b].[Id] @@ -1140,7 +1140,7 @@ END AS [Discriminator] FROM [BaseCollectionsOnBase] AS [b0] LEFT JOIN [DerivedCollectionsOnBase] AS [d0] ON [b0].[Id] = [d0].[Id] ) AS [t] ON [b].[Id] = [t].[BaseParentId] -WHERE ([b].[Name] <> N'Bar') OR [b].[Name] IS NULL +WHERE [b].[Name] <> N'Bar' OR [b].[Name] IS NULL ORDER BY [b].[Id]"); } @@ -1161,7 +1161,7 @@ WHEN [d0].[Id] IS NOT NULL THEN N'DerivedInheritanceRelationshipEntity' FROM [BaseEntities] AS [b0] LEFT JOIN [DerivedEntities] AS [d0] ON [b0].[Id] = [d0].[Id] ) AS [t] ON [b].[BaseParentId] = [t].[Id] -WHERE ([b].[Name] <> N'Bar') OR [b].[Name] IS NULL +WHERE [b].[Name] <> N'Bar' OR [b].[Name] IS NULL ORDER BY [b].[Id], [t].[Id]", // @"SELECT [b1].[BaseInheritanceRelationshipEntityId], [b1].[Id], [b1].[Name], [b].[Id], [t].[Id] @@ -1171,7 +1171,7 @@ SELECT [b0].[Id] FROM [BaseEntities] AS [b0] ) AS [t] ON [b].[BaseParentId] = [t].[Id] INNER JOIN [BaseEntities_OwnedCollectionOnBase] AS [b1] ON [t].[Id] = [b1].[BaseInheritanceRelationshipEntityId] -WHERE ([b].[Name] <> N'Bar') OR [b].[Name] IS NULL +WHERE [b].[Name] <> N'Bar' OR [b].[Name] IS NULL ORDER BY [b].[Id], [t].[Id]", // @"SELECT [d1].[DerivedInheritanceRelationshipEntityId], [d1].[Id], [d1].[Name], [b].[Id], [t].[Id] @@ -1181,7 +1181,7 @@ SELECT [b0].[Id] FROM [BaseEntities] AS [b0] ) AS [t] ON [b].[BaseParentId] = [t].[Id] INNER JOIN [DerivedEntities_OwnedCollectionOnDerived] AS [d1] ON [t].[Id] = [d1].[DerivedInheritanceRelationshipEntityId] -WHERE ([b].[Name] <> N'Bar') OR [b].[Name] IS NULL +WHERE [b].[Name] <> N'Bar' OR [b].[Name] IS NULL ORDER BY [b].[Id], [t].[Id]"); } @@ -1258,25 +1258,25 @@ WHEN [d].[Id] IS NOT NULL THEN N'DerivedInheritanceRelationshipEntity' END AS [Discriminator], [b].[OwnedReferenceOnBase_Id], [b].[OwnedReferenceOnBase_Name], [d].[Id], [d].[OwnedReferenceOnDerived_Id], [d].[OwnedReferenceOnDerived_Name] FROM [BaseEntities] AS [b] LEFT JOIN [DerivedEntities] AS [d] ON [b].[Id] = [d].[Id] -WHERE ([b].[Name] <> N'Bar') OR [b].[Name] IS NULL +WHERE [b].[Name] <> N'Bar' OR [b].[Name] IS NULL ORDER BY [b].[Id]", // @"SELECT [b0].[BaseInheritanceRelationshipEntityId], [b0].[Id], [b0].[Name], [b].[Id] FROM [BaseEntities] AS [b] INNER JOIN [BaseEntities_OwnedCollectionOnBase] AS [b0] ON [b].[Id] = [b0].[BaseInheritanceRelationshipEntityId] -WHERE ([b].[Name] <> N'Bar') OR [b].[Name] IS NULL +WHERE [b].[Name] <> N'Bar' OR [b].[Name] IS NULL ORDER BY [b].[Id]", // @"SELECT [d0].[DerivedInheritanceRelationshipEntityId], [d0].[Id], [d0].[Name], [b].[Id] FROM [BaseEntities] AS [b] INNER JOIN [DerivedEntities_OwnedCollectionOnDerived] AS [d0] ON [b].[Id] = [d0].[DerivedInheritanceRelationshipEntityId] -WHERE ([b].[Name] <> N'Bar') OR [b].[Name] IS NULL +WHERE [b].[Name] <> N'Bar' OR [b].[Name] IS NULL ORDER BY [b].[Id]", // @"SELECT [c].[Id], [c].[Name], [c].[ParentId], [b].[Id] FROM [BaseEntities] AS [b] INNER JOIN [CollectionsOnBase] AS [c] ON [b].[Id] = [c].[ParentId] -WHERE ([b].[Name] <> N'Bar') OR [b].[Name] IS NULL +WHERE [b].[Name] <> N'Bar' OR [b].[Name] IS NULL ORDER BY [b].[Id]"); } @@ -1294,7 +1294,7 @@ WHEN [d].[Id] IS NOT NULL THEN N'DerivedInheritanceRelationshipEntity' FROM [BaseEntities] AS [b] LEFT JOIN [DerivedEntities] AS [d] ON [b].[Id] = [d].[Id] ) AS [t] ON [c].[ParentId] = [t].[Id] -WHERE ([c].[Name] <> N'Bar') OR [c].[Name] IS NULL +WHERE [c].[Name] <> N'Bar' OR [c].[Name] IS NULL ORDER BY [c].[Id], [t].[Id]", // @"SELECT [b0].[BaseInheritanceRelationshipEntityId], [b0].[Id], [b0].[Name], [c].[Id], [t].[Id] @@ -1304,7 +1304,7 @@ SELECT [b].[Id] FROM [BaseEntities] AS [b] ) AS [t] ON [c].[ParentId] = [t].[Id] INNER JOIN [BaseEntities_OwnedCollectionOnBase] AS [b0] ON [t].[Id] = [b0].[BaseInheritanceRelationshipEntityId] -WHERE ([c].[Name] <> N'Bar') OR [c].[Name] IS NULL +WHERE [c].[Name] <> N'Bar' OR [c].[Name] IS NULL ORDER BY [c].[Id], [t].[Id]", // @"SELECT [d0].[DerivedInheritanceRelationshipEntityId], [d0].[Id], [d0].[Name], [c].[Id], [t].[Id] @@ -1314,7 +1314,7 @@ SELECT [b].[Id] FROM [BaseEntities] AS [b] ) AS [t] ON [c].[ParentId] = [t].[Id] INNER JOIN [DerivedEntities_OwnedCollectionOnDerived] AS [d0] ON [t].[Id] = [d0].[DerivedInheritanceRelationshipEntityId] -WHERE ([c].[Name] <> N'Bar') OR [c].[Name] IS NULL +WHERE [c].[Name] <> N'Bar' OR [c].[Name] IS NULL ORDER BY [c].[Id], [t].[Id]"); } diff --git a/test/EFCore.SqlServer.FunctionalTests/Query/TemporalComplexNavigationsCollectionsQuerySqlServerTest.cs b/test/EFCore.SqlServer.FunctionalTests/Query/TemporalComplexNavigationsCollectionsQuerySqlServerTest.cs index b1b953c3ce5..bdfa3eb8d94 100644 --- a/test/EFCore.SqlServer.FunctionalTests/Query/TemporalComplexNavigationsCollectionsQuerySqlServerTest.cs +++ b/test/EFCore.SqlServer.FunctionalTests/Query/TemporalComplexNavigationsCollectionsQuerySqlServerTest.cs @@ -77,7 +77,7 @@ public override async Task SelectMany_with_predicate_and_DefaultIfEmpty_projecti OUTER APPLY ( SELECT [l0].[Id], [l0].[Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[Name], [l0].[OneToMany_Optional_Inverse2Id], [l0].[OneToMany_Optional_Self_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToMany_Required_Self_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id], [l0].[OneToOne_Optional_Self2Id], [l0].[PeriodEnd], [l0].[PeriodStart] FROM [LevelTwo] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l0] - WHERE ([l0].[Level1_Required_Id] = ([l].[Id] * 2)) OR (CAST(LEN([l0].[Name]) AS int) = [l0].[Id]) + WHERE [l0].[Level1_Required_Id] = ([l].[Id] * 2) OR CAST(LEN([l0].[Name]) AS int) = [l0].[Id] ) AS [t] LEFT JOIN [LevelTwo] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l1] ON [l].[Id] = [l1].[OneToMany_Optional_Inverse2Id] ORDER BY [l].[Id], [t].[Id]"); diff --git a/test/EFCore.SqlServer.FunctionalTests/Query/TemporalFiltersInheritanceQuerySqlServerTest.cs b/test/EFCore.SqlServer.FunctionalTests/Query/TemporalFiltersInheritanceQuerySqlServerTest.cs index be930edc567..05f017d7b06 100644 --- a/test/EFCore.SqlServer.FunctionalTests/Query/TemporalFiltersInheritanceQuerySqlServerTest.cs +++ b/test/EFCore.SqlServer.FunctionalTests/Query/TemporalFiltersInheritanceQuerySqlServerTest.cs @@ -54,7 +54,7 @@ public override async Task Can_use_is_kiwi(bool async) AssertSql( @"SELECT [a].[Species], [a].[CountryId], [a].[Discriminator], [a].[Name], [a].[PeriodEnd], [a].[PeriodStart], [a].[EagleId], [a].[IsFlightless], [a].[Group], [a].[FoundOn] FROM [Animals] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [a] -WHERE ([a].[CountryId] = 1) AND ([a].[Discriminator] = N'Kiwi')"); +WHERE [a].[CountryId] = 1 AND [a].[Discriminator] = N'Kiwi'"); } public override async Task Can_use_is_kiwi_with_other_predicate(bool async) @@ -64,7 +64,8 @@ public override async Task Can_use_is_kiwi_with_other_predicate(bool async) AssertSql( @"SELECT [a].[Species], [a].[CountryId], [a].[Discriminator], [a].[Name], [a].[PeriodEnd], [a].[PeriodStart], [a].[EagleId], [a].[IsFlightless], [a].[Group], [a].[FoundOn] FROM [Animals] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [a] -WHERE ([a].[CountryId] = 1) AND (([a].[Discriminator] = N'Kiwi') AND ([a].[CountryId] = 1))"); } +WHERE [a].[CountryId] = 1 AND [a].[Discriminator] = N'Kiwi' AND [a].[CountryId] = 1"); + } public override async Task Can_use_is_kiwi_in_projection(bool async) { @@ -97,7 +98,7 @@ public override async Task Can_use_of_type_bird_predicate(bool async) AssertSql( @"SELECT [a].[Species], [a].[CountryId], [a].[Discriminator], [a].[Name], [a].[PeriodEnd], [a].[PeriodStart], [a].[EagleId], [a].[IsFlightless], [a].[Group], [a].[FoundOn] FROM [Animals] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [a] -WHERE ([a].[CountryId] = 1) AND ([a].[CountryId] = 1) +WHERE [a].[CountryId] = 1 AND [a].[CountryId] = 1 ORDER BY [a].[Species]"); } @@ -129,7 +130,7 @@ public override async Task Can_use_of_type_kiwi(bool async) AssertSql( @"SELECT [a].[Species], [a].[CountryId], [a].[Discriminator], [a].[Name], [a].[PeriodEnd], [a].[PeriodStart], [a].[EagleId], [a].[IsFlightless], [a].[FoundOn] FROM [Animals] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [a] -WHERE ([a].[CountryId] = 1) AND ([a].[Discriminator] = N'Kiwi')"); +WHERE [a].[CountryId] = 1 AND [a].[Discriminator] = N'Kiwi'"); } public override async Task Can_use_derived_set(bool async) @@ -139,7 +140,7 @@ public override async Task Can_use_derived_set(bool async) AssertSql( @"SELECT [a].[Species], [a].[CountryId], [a].[Discriminator], [a].[Name], [a].[PeriodEnd], [a].[PeriodStart], [a].[EagleId], [a].[IsFlightless], [a].[Group] FROM [Animals] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [a] -WHERE ([a].[Discriminator] = N'Eagle') AND ([a].[CountryId] = 1)"); +WHERE [a].[Discriminator] = N'Eagle' AND [a].[CountryId] = 1"); } public override Task Can_use_IgnoreQueryFilters_and_GetDatabaseValues(bool async) diff --git a/test/EFCore.SqlServer.FunctionalTests/Query/TemporalGearsOfWarQuerySqlServerTest.cs b/test/EFCore.SqlServer.FunctionalTests/Query/TemporalGearsOfWarQuerySqlServerTest.cs index a1d8a117992..0af2f8f9c91 100644 --- a/test/EFCore.SqlServer.FunctionalTests/Query/TemporalGearsOfWarQuerySqlServerTest.cs +++ b/test/EFCore.SqlServer.FunctionalTests/Query/TemporalGearsOfWarQuerySqlServerTest.cs @@ -250,11 +250,11 @@ public override async Task Accessing_derived_property_using_hard_and_soft_cast(b AssertSql( @"SELECT [l].[Name], [l].[Discriminator], [l].[LocustHordeId], [l].[PeriodEnd], [l].[PeriodStart], [l].[ThreatLevel], [l].[ThreatLevelByte], [l].[ThreatLevelNullableByte], [l].[DefeatedByNickname], [l].[DefeatedBySquadId], [l].[HighCommandId] FROM [LocustLeaders] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l] -WHERE ([l].[Discriminator] = N'LocustCommander') AND (([l].[HighCommandId] <> 0) OR [l].[HighCommandId] IS NULL)", +WHERE [l].[Discriminator] = N'LocustCommander' AND ([l].[HighCommandId] <> 0 OR [l].[HighCommandId] IS NULL)", // @"SELECT [l].[Name], [l].[Discriminator], [l].[LocustHordeId], [l].[PeriodEnd], [l].[PeriodStart], [l].[ThreatLevel], [l].[ThreatLevelByte], [l].[ThreatLevelNullableByte], [l].[DefeatedByNickname], [l].[DefeatedBySquadId], [l].[HighCommandId] FROM [LocustLeaders] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l] -WHERE ([l].[Discriminator] = N'LocustCommander') AND (([l].[HighCommandId] <> 0) OR [l].[HighCommandId] IS NULL)"); +WHERE [l].[Discriminator] = N'LocustCommander' AND ([l].[HighCommandId] <> 0 OR [l].[HighCommandId] IS NULL)"); } public override async Task Accessing_property_of_optional_navigation_in_child_projection_works(bool async) @@ -267,7 +267,7 @@ 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] -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 [g] ON [t].[GearNickName] = [g].[Nickname] AND [t].[GearSquadId] = [g].[SquadId] LEFT JOIN ( SELECT [g0].[Nickname], [w].[Id], [g0].[SquadId], [w].[OwnerFullName] FROM [Weapons] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [w] @@ -300,8 +300,8 @@ public override async Task All_with_optional_navigation_is_translated_to_sql(boo 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) + 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) ELSE CAST(0 AS bit) END"); } @@ -324,8 +324,8 @@ public override async Task Any_with_optional_navigation_as_subquery_predicate_is WHERE 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 ([s].[Id] = [g].[SquadId]) AND ([t].[Note] = N'Dom''s Tag')))"); + 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 [s].[Id] = [g].[SquadId] AND [t].[Note] = N'Dom''s Tag'))"); } [ConditionalTheory] diff --git a/test/EFCore.SqlServer.FunctionalTests/Query/TemporalManyToManyQuerySqlServerTest.cs b/test/EFCore.SqlServer.FunctionalTests/Query/TemporalManyToManyQuerySqlServerTest.cs index 004d6cf3f52..f1ccbc14d1e 100644 --- a/test/EFCore.SqlServer.FunctionalTests/Query/TemporalManyToManyQuerySqlServerTest.cs +++ b/test/EFCore.SqlServer.FunctionalTests/Query/TemporalManyToManyQuerySqlServerTest.cs @@ -51,7 +51,7 @@ WHERE NOT EXISTS ( SELECT 1 FROM [JoinOneToTwo] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [j] INNER JOIN [EntityTwos] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [e0] ON [j].[TwoId] = [e0].[Id] - WHERE ([e].[Id] = [j].[OneId]) AND NOT ([e0].[Name] LIKE N'%B%'))"); + WHERE [e].[Id] = [j].[OneId] AND NOT ([e0].[Name] LIKE N'%B%'))"); } public override async Task Skip_navigation_any_without_predicate(bool async) @@ -65,7 +65,7 @@ WHERE EXISTS ( SELECT 1 FROM [JoinOneToThreePayloadFull] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [j] INNER JOIN [EntityThrees] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [e0] ON [j].[ThreeId] = [e0].[Id] - WHERE ([e].[Id] = [j].[OneId]) AND ([e0].[Name] LIKE N'%B%'))"); + WHERE [e].[Id] = [j].[OneId] AND ([e0].[Name] LIKE N'%B%'))"); } public override async Task Skip_navigation_any_with_predicate(bool async) @@ -79,7 +79,7 @@ WHERE EXISTS ( SELECT 1 FROM [EntityOneEntityTwo] 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].[TwoSkipSharedId] = [e1].[Id] - WHERE ([e].[Id] = [e0].[OneSkipSharedId]) AND ([e1].[Name] LIKE N'%B%'))"); + WHERE [e].[Id] = [e0].[OneSkipSharedId] AND ([e1].[Name] LIKE N'%B%'))"); } public override async Task Skip_navigation_contains(bool async) @@ -93,7 +93,7 @@ WHERE EXISTS ( SELECT 1 FROM [JoinOneToThreePayloadFullShared] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [j] INNER JOIN [EntityThrees] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [e0] ON [j].[ThreeId] = [e0].[Id] - WHERE ([e].[Id] = [j].[OneId]) AND ([e0].[Id] = 1))"); + WHERE [e].[Id] = [j].[OneId] AND [e0].[Id] = 1)"); } public override async Task Skip_navigation_count_without_predicate(bool async) @@ -125,7 +125,7 @@ INNER JOIN ( FROM [EntityRoots] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [e0] WHERE [e0].[Discriminator] IN (N'EntityBranch', N'EntityLeaf') ) AS [t] ON [j].[EntityBranchId] = [t].[Id] - WHERE ([e].[Id] = [j].[EntityOneId]) AND ([t].[Name] IS NOT NULL AND ([t].[Name] LIKE N'L%'))), [e].[Id]"); + WHERE [e].[Id] = [j].[EntityOneId] AND [t].[Name] IS NOT NULL AND ([t].[Name] LIKE N'L%')), [e].[Id]"); } public override async Task Skip_navigation_long_count_without_predicate(bool async) @@ -153,7 +153,7 @@ ORDER BY ( SELECT COUNT_BIG(*) FROM [EntityTwoEntityTwo] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [e0] INNER JOIN [EntityTwos] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [e1] ON [e0].[SelfSkipSharedLeftId] = [e1].[Id] - WHERE ([e].[Id] = [e0].[SelfSkipSharedRightId]) AND ([e1].[Name] IS NOT NULL AND ([e1].[Name] LIKE N'L%'))) DESC, [e].[Id]"); + WHERE [e].[Id] = [e0].[SelfSkipSharedRightId] AND [e1].[Name] IS NOT NULL AND ([e1].[Name] LIKE N'L%')) DESC, [e].[Id]"); } public override async Task Skip_navigation_select_many_average(bool async) @@ -166,7 +166,7 @@ public override async Task Skip_navigation_select_many_average(bool async) INNER JOIN ( SELECT [e1].[Key1], [e0].[TwoSkipSharedId] FROM [EntityCompositeKeyEntityTwo] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [e0] - INNER JOIN [EntityCompositeKeys] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [e1] ON (([e0].[CompositeKeySkipSharedKey1] = [e1].[Key1]) AND ([e0].[CompositeKeySkipSharedKey2] = [e1].[Key2])) AND ([e0].[CompositeKeySkipSharedKey3] = [e1].[Key3]) + INNER JOIN [EntityCompositeKeys] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [e1] ON [e0].[CompositeKeySkipSharedKey1] = [e1].[Key1] AND [e0].[CompositeKeySkipSharedKey2] = [e1].[Key2] AND [e0].[CompositeKeySkipSharedKey3] = [e1].[Key3] ) AS [t] ON [e].[Id] = [t].[TwoSkipSharedId]"); } @@ -180,7 +180,7 @@ public override async Task Skip_navigation_select_many_max(bool async) INNER JOIN ( SELECT [e0].[Key1], [j].[ThreeId] FROM [JoinThreeToCompositeKeyFull] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [j] - INNER JOIN [EntityCompositeKeys] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [e0] ON (([j].[CompositeId1] = [e0].[Key1]) AND ([j].[CompositeId2] = [e0].[Key2])) AND ([j].[CompositeId3] = [e0].[Key3]) + INNER JOIN [EntityCompositeKeys] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [e0] ON [j].[CompositeId1] = [e0].[Key1] AND [j].[CompositeId2] = [e0].[Key2] AND [j].[CompositeId3] = [e0].[Key3] ) AS [t] ON [e].[Id] = [t].[ThreeId]"); } @@ -208,7 +208,7 @@ public override async Task Skip_navigation_select_many_sum(bool async) INNER JOIN ( SELECT [e1].[Key1], [e0].[RootSkipSharedId] FROM [EntityCompositeKeyEntityRoot] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [e0] - INNER JOIN [EntityCompositeKeys] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [e1] ON (([e0].[CompositeKeySkipSharedKey1] = [e1].[Key1]) AND ([e0].[CompositeKeySkipSharedKey2] = [e1].[Key2])) AND ([e0].[CompositeKeySkipSharedKey3] = [e1].[Key3]) + INNER JOIN [EntityCompositeKeys] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [e1] ON [e0].[CompositeKeySkipSharedKey1] = [e1].[Key1] AND [e0].[CompositeKeySkipSharedKey2] = [e1].[Key2] AND [e0].[CompositeKeySkipSharedKey3] = [e1].[Key3] ) AS [t] ON [e].[Id] = [t].[RootSkipSharedId]"); } @@ -220,7 +220,7 @@ public override async Task Skip_navigation_select_subquery_average(bool async) @"SELECT ( SELECT AVG(CAST([e0].[Key1] AS float)) FROM [JoinCompositeKeyToLeaf] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [j] - INNER JOIN [EntityCompositeKeys] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [e0] ON (([j].[CompositeId1] = [e0].[Key1]) AND ([j].[CompositeId2] = [e0].[Key2])) AND ([j].[CompositeId3] = [e0].[Key3]) + INNER JOIN [EntityCompositeKeys] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [e0] ON [j].[CompositeId1] = [e0].[Key1] AND [j].[CompositeId2] = [e0].[Key2] AND [j].[CompositeId3] = [e0].[Key3] WHERE [e].[Id] = [j].[LeafId]) FROM [EntityRoots] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [e] WHERE [e].[Discriminator] = N'EntityLeaf'"); @@ -355,7 +355,7 @@ INNER JOIN ( FROM [EntityRoots] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [e0] WHERE [e0].[Discriminator] = N'EntityLeaf' ) AS [t] ON [j].[LeafId] = [t].[Id] -) AS [t0] ON (([e].[Key1] = [t0].[CompositeId1]) AND ([e].[Key2] = [t0].[CompositeId2])) AND ([e].[Key3] = [t0].[CompositeId3]) +) AS [t0] ON [e].[Key1] = [t0].[CompositeId1] AND [e].[Key2] = [t0].[CompositeId2] AND [e].[Key3] = [t0].[CompositeId3] ORDER BY [e].[Key1], [e].[Key2], [e].[Key3], [t0].[LeafId], [t0].[CompositeId1], [t0].[CompositeId2], [t0].[CompositeId3]"); } @@ -371,7 +371,7 @@ LEFT JOIN ( FROM [EntityCompositeKeyEntityRoot] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [e0] INNER JOIN [EntityRoots] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [e1] ON [e0].[RootSkipSharedId] = [e1].[Id] WHERE [e1].[Discriminator] = N'EntityLeaf' -) AS [t] ON (([e].[Key1] = [t].[CompositeKeySkipSharedKey1]) AND ([e].[Key2] = [t].[CompositeKeySkipSharedKey2])) AND ([e].[Key3] = [t].[CompositeKeySkipSharedKey3]) +) AS [t] ON [e].[Key1] = [t].[CompositeKeySkipSharedKey1] AND [e].[Key2] = [t].[CompositeKeySkipSharedKey2] AND [e].[Key3] = [t].[CompositeKeySkipSharedKey3] ORDER BY [e].[Key1], [e].[Key2], [e].[Key3], [t].[RootSkipSharedId], [t].[CompositeKeySkipSharedKey1], [t].[CompositeKeySkipSharedKey2], [t].[CompositeKeySkipSharedKey3]"); } @@ -401,12 +401,12 @@ public override async Task Left_join_with_skip_navigation(bool async) SELECT TOP(1) [e2].[Id] FROM [EntityCompositeKeyEntityTwo] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [e1] INNER JOIN [EntityTwos] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [e2] ON [e1].[TwoSkipSharedId] = [e2].[Id] - WHERE (([e].[Key1] = [e1].[CompositeKeySkipSharedKey1]) AND ([e].[Key2] = [e1].[CompositeKeySkipSharedKey2])) AND ([e].[Key3] = [e1].[CompositeKeySkipSharedKey3]) + WHERE [e].[Key1] = [e1].[CompositeKeySkipSharedKey1] AND [e].[Key2] = [e1].[CompositeKeySkipSharedKey2] AND [e].[Key3] = [e1].[CompositeKeySkipSharedKey3] ORDER BY [e2].[Id]) = ( SELECT TOP(1) [e3].[Id] FROM [JoinThreeToCompositeKeyFull] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [j] INNER JOIN [EntityThrees] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [e3] ON [j].[ThreeId] = [e3].[Id] - WHERE (([e0].[Key1] = [j].[CompositeId1]) AND ([e0].[Key2] = [j].[CompositeId2])) AND ([e0].[Key3] = [j].[CompositeId3]) + WHERE [e0].[Key1] = [j].[CompositeId1] AND [e0].[Key2] = [j].[CompositeId2] AND [e0].[Key3] = [j].[CompositeId3] ORDER BY [e3].[Id]) ORDER BY [e].[Key1], [e0].[Key1], [e].[Key2], [e0].[Key2]"); } @@ -489,7 +489,7 @@ INNER JOIN ( FROM [JoinOneToThreePayloadFullShared] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [j] INNER JOIN [EntityThrees] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [e0] ON [j].[ThreeId] = [e0].[Id] ) AS [t] - WHERE (2 < [t].[row]) AND ([t].[row] <= 5) + WHERE 2 < [t].[row] AND [t].[row] <= 5 ) AS [t0] ON [e].[Id] = [t0].[OneId]"); } @@ -561,7 +561,7 @@ LEFT JOIN ( LEFT JOIN ( SELECT [e4].[Key1], [e4].[Key2], [e4].[Key3], [e4].[Name], [e4].[PeriodEnd], [e4].[PeriodStart], [e3].[TwoSkipSharedId], [e3].[CompositeKeySkipSharedKey1], [e3].[CompositeKeySkipSharedKey2], [e3].[CompositeKeySkipSharedKey3] FROM [EntityCompositeKeyEntityTwo] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [e3] - INNER JOIN [EntityCompositeKeys] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [e4] ON (([e3].[CompositeKeySkipSharedKey1] = [e4].[Key1]) AND ([e3].[CompositeKeySkipSharedKey2] = [e4].[Key2])) AND ([e3].[CompositeKeySkipSharedKey3] = [e4].[Key3]) + INNER JOIN [EntityCompositeKeys] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [e4] ON [e3].[CompositeKeySkipSharedKey1] = [e4].[Key1] AND [e3].[CompositeKeySkipSharedKey2] = [e4].[Key2] AND [e3].[CompositeKeySkipSharedKey3] = [e4].[Key3] ) AS [t1] ON [e].[Id] = [t1].[TwoSkipSharedId] ORDER BY [e].[Id], [t].[ThreeId], [t].[TwoId], [t].[Id], [t0].[SelfSkipSharedLeftId], [t0].[SelfSkipSharedRightId], [t0].[Id], [t1].[TwoSkipSharedId], [t1].[CompositeKeySkipSharedKey1], [t1].[CompositeKeySkipSharedKey2], [t1].[CompositeKeySkipSharedKey3], [t1].[Key1], [t1].[Key2]"); } @@ -578,7 +578,7 @@ LEFT JOIN ( FROM ( SELECT [e0].[Key1], [e0].[Key2], [e0].[Key3], [e0].[Name], [e0].[PeriodEnd], [e0].[PeriodStart], [j].[ThreeId], ROW_NUMBER() OVER(PARTITION BY [j].[ThreeId] ORDER BY [e0].[Key1], [e0].[Key2]) AS [row] FROM [JoinThreeToCompositeKeyFull] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [j] - INNER JOIN [EntityCompositeKeys] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [e0] ON (([j].[CompositeId1] = [e0].[Key1]) AND ([j].[CompositeId2] = [e0].[Key2])) AND ([j].[CompositeId3] = [e0].[Key3]) + INNER JOIN [EntityCompositeKeys] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [e0] ON [j].[CompositeId1] = [e0].[Key1] AND [j].[CompositeId2] = [e0].[Key2] AND [j].[CompositeId3] = [e0].[Key3] ) AS [t] WHERE [t].[row] <= 1 ) AS [t0] ON [e].[Id] = [t0].[ThreeId] @@ -596,7 +596,7 @@ LEFT JOIN ( SELECT [e0].[RootSkipSharedId], [e0].[CompositeKeySkipSharedKey1], [e0].[CompositeKeySkipSharedKey2], [e0].[CompositeKeySkipSharedKey3], [e0].[PeriodEnd], [e0].[PeriodStart], [e1].[Id], [e1].[Discriminator], [e1].[Name], [e1].[PeriodEnd] AS [PeriodEnd0], [e1].[PeriodStart] AS [PeriodStart0], [e1].[Number], [e1].[IsGreen] FROM [EntityCompositeKeyEntityRoot] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [e0] INNER JOIN [EntityRoots] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [e1] ON [e0].[RootSkipSharedId] = [e1].[Id] -) AS [t] ON (([e].[Key1] = [t].[CompositeKeySkipSharedKey1]) AND ([e].[Key2] = [t].[CompositeKeySkipSharedKey2])) AND ([e].[Key3] = [t].[CompositeKeySkipSharedKey3]) +) AS [t] ON [e].[Key1] = [t].[CompositeKeySkipSharedKey1] AND [e].[Key2] = [t].[CompositeKeySkipSharedKey2] AND [e].[Key3] = [t].[CompositeKeySkipSharedKey3] ORDER BY [e].[Key1], [e].[Key2], [e].[Key3], [t].[RootSkipSharedId], [t].[CompositeKeySkipSharedKey1], [t].[CompositeKeySkipSharedKey2], [t].[CompositeKeySkipSharedKey3]"); } @@ -636,7 +636,7 @@ LEFT JOIN ( FROM [JoinOneToBranch] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [j0] INNER JOIN [EntityOnes] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [e1] ON [j0].[EntityOneId] = [e1].[Id] ) AS [t0] ON [t].[Id] = [t0].[EntityBranchId] -) AS [t1] ON (([e].[Key1] = [t1].[CompositeId1]) AND ([e].[Key2] = [t1].[CompositeId2])) AND ([e].[Key3] = [t1].[CompositeId3]) +) AS [t1] ON [e].[Key1] = [t1].[CompositeId1] AND [e].[Key2] = [t1].[CompositeId2] AND [e].[Key3] = [t1].[CompositeId3] ORDER BY [e].[Key1], [e].[Key2], [e].[Key3], [t1].[LeafId], [t1].[CompositeId1], [t1].[CompositeId2], [t1].[CompositeId3], [t1].[Id], [t1].[EntityBranchId], [t1].[EntityOneId]"); } @@ -762,7 +762,7 @@ LEFT JOIN ( INNER JOIN [EntityTwos] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [e1] ON [e0].[TwoSkipSharedId] = [e1].[Id] ) AS [t] WHERE [t].[row] <= 2 -) AS [t0] ON (([e].[Key1] = [t0].[CompositeKeySkipSharedKey1]) AND ([e].[Key2] = [t0].[CompositeKeySkipSharedKey2])) AND ([e].[Key3] = [t0].[CompositeKeySkipSharedKey3]) +) AS [t0] ON [e].[Key1] = [t0].[CompositeKeySkipSharedKey1] AND [e].[Key2] = [t0].[CompositeKeySkipSharedKey2] AND [e].[Key3] = [t0].[CompositeKeySkipSharedKey3] ORDER BY [e].[Key1], [e].[Key2], [e].[Key3], [t0].[CompositeKeySkipSharedKey1], [t0].[CompositeKeySkipSharedKey2], [t0].[CompositeKeySkipSharedKey3], [t0].[Id]"); } @@ -780,8 +780,8 @@ LEFT JOIN ( FROM [JoinThreeToCompositeKeyFull] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [j] INNER JOIN [EntityThrees] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [e0] ON [j].[ThreeId] = [e0].[Id] ) AS [t] - WHERE (1 < [t].[row]) AND ([t].[row] <= 3) -) AS [t0] ON (([e].[Key1] = [t0].[CompositeId1]) AND ([e].[Key2] = [t0].[CompositeId2])) AND ([e].[Key3] = [t0].[CompositeId3]) + WHERE 1 < [t].[row] AND [t].[row] <= 3 +) AS [t0] ON [e].[Key1] = [t0].[CompositeId1] AND [e].[Key2] = [t0].[CompositeId2] AND [e].[Key3] = [t0].[CompositeId3] ORDER BY [e].[Key1], [e].[Key2], [e].[Key3], [t0].[CompositeId1], [t0].[CompositeId2], [t0].[CompositeId3], [t0].[Id0]"); } @@ -816,7 +816,7 @@ public override async Task Filtered_then_include_skip_navigation_order_by_skip_t LEFT JOIN ( SELECT [e0].[RootSkipSharedId], [e0].[CompositeKeySkipSharedKey1], [e0].[CompositeKeySkipSharedKey2], [e0].[CompositeKeySkipSharedKey3], [e0].[PeriodEnd], [e0].[PeriodStart], [e1].[Key1], [e1].[Key2], [e1].[Key3], [e1].[Name], [e1].[PeriodEnd] AS [PeriodEnd0], [e1].[PeriodStart] AS [PeriodStart0], [t0].[Id], [t0].[CompositeId1], [t0].[CompositeId2], [t0].[CompositeId3], [t0].[PeriodEnd] AS [PeriodEnd1], [t0].[PeriodStart] AS [PeriodStart1], [t0].[ThreeId], [t0].[Id0], [t0].[CollectionInverseId], [t0].[Name] AS [Name0], [t0].[PeriodEnd0] AS [PeriodEnd00], [t0].[PeriodStart0] AS [PeriodStart00], [t0].[ReferenceInverseId] FROM [EntityCompositeKeyEntityRoot] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [e0] - INNER JOIN [EntityCompositeKeys] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [e1] ON (([e0].[CompositeKeySkipSharedKey1] = [e1].[Key1]) AND ([e0].[CompositeKeySkipSharedKey2] = [e1].[Key2])) AND ([e0].[CompositeKeySkipSharedKey3] = [e1].[Key3]) + INNER JOIN [EntityCompositeKeys] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [e1] ON [e0].[CompositeKeySkipSharedKey1] = [e1].[Key1] AND [e0].[CompositeKeySkipSharedKey2] = [e1].[Key2] AND [e0].[CompositeKeySkipSharedKey3] = [e1].[Key3] LEFT JOIN ( SELECT [t].[Id], [t].[CompositeId1], [t].[CompositeId2], [t].[CompositeId3], [t].[PeriodEnd], [t].[PeriodStart], [t].[ThreeId], [t].[Id0], [t].[CollectionInverseId], [t].[Name], [t].[PeriodEnd0], [t].[PeriodStart0], [t].[ReferenceInverseId] FROM ( @@ -824,8 +824,8 @@ LEFT JOIN ( FROM [JoinThreeToCompositeKeyFull] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [j] INNER JOIN [EntityThrees] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [e2] ON [j].[ThreeId] = [e2].[Id] ) AS [t] - WHERE (1 < [t].[row]) AND ([t].[row] <= 3) - ) AS [t0] ON (([e1].[Key1] = [t0].[CompositeId1]) AND ([e1].[Key2] = [t0].[CompositeId2])) AND ([e1].[Key3] = [t0].[CompositeId3]) + WHERE 1 < [t].[row] AND [t].[row] <= 3 + ) AS [t0] ON [e1].[Key1] = [t0].[CompositeId1] AND [e1].[Key2] = [t0].[CompositeId2] AND [e1].[Key3] = [t0].[CompositeId3] ) AS [t1] ON [e].[Id] = [t1].[RootSkipSharedId] ORDER BY [e].[Id], [t1].[RootSkipSharedId], [t1].[CompositeKeySkipSharedKey1], [t1].[CompositeKeySkipSharedKey2], [t1].[CompositeKeySkipSharedKey3], [t1].[Key1], [t1].[Key2], [t1].[Key3], [t1].[CompositeId1], [t1].[CompositeId2], [t1].[CompositeId3], [t1].[Id0]"); } @@ -840,12 +840,12 @@ public override async Task Filtered_include_skip_navigation_where_then_include_s LEFT JOIN ( SELECT [j].[LeafId], [j].[CompositeId1], [j].[CompositeId2], [j].[CompositeId3], [j].[PeriodEnd], [j].[PeriodStart], [e0].[Key1], [e0].[Key2], [e0].[Key3], [e0].[Name], [e0].[PeriodEnd] AS [PeriodEnd0], [e0].[PeriodStart] AS [PeriodStart0], [t].[TwoSkipSharedId], [t].[CompositeKeySkipSharedKey1], [t].[CompositeKeySkipSharedKey2], [t].[CompositeKeySkipSharedKey3], [t].[PeriodEnd] AS [PeriodEnd1], [t].[PeriodStart] AS [PeriodStart1], [t].[Id], [t].[CollectionInverseId], [t].[ExtraId], [t].[Name] AS [Name0], [t].[PeriodEnd0] AS [PeriodEnd00], [t].[PeriodStart0] AS [PeriodStart00], [t].[ReferenceInverseId] FROM [JoinCompositeKeyToLeaf] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [j] - INNER JOIN [EntityCompositeKeys] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [e0] ON (([j].[CompositeId1] = [e0].[Key1]) AND ([j].[CompositeId2] = [e0].[Key2])) AND ([j].[CompositeId3] = [e0].[Key3]) + INNER JOIN [EntityCompositeKeys] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [e0] ON [j].[CompositeId1] = [e0].[Key1] AND [j].[CompositeId2] = [e0].[Key2] AND [j].[CompositeId3] = [e0].[Key3] LEFT JOIN ( SELECT [e1].[TwoSkipSharedId], [e1].[CompositeKeySkipSharedKey1], [e1].[CompositeKeySkipSharedKey2], [e1].[CompositeKeySkipSharedKey3], [e1].[PeriodEnd], [e1].[PeriodStart], [e2].[Id], [e2].[CollectionInverseId], [e2].[ExtraId], [e2].[Name], [e2].[PeriodEnd] AS [PeriodEnd0], [e2].[PeriodStart] AS [PeriodStart0], [e2].[ReferenceInverseId] FROM [EntityCompositeKeyEntityTwo] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [e1] INNER JOIN [EntityTwos] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [e2] ON [e1].[TwoSkipSharedId] = [e2].[Id] - ) AS [t] ON (([e0].[Key1] = [t].[CompositeKeySkipSharedKey1]) AND ([e0].[Key2] = [t].[CompositeKeySkipSharedKey2])) AND ([e0].[Key3] = [t].[CompositeKeySkipSharedKey3]) + ) AS [t] ON [e0].[Key1] = [t].[CompositeKeySkipSharedKey1] AND [e0].[Key2] = [t].[CompositeKeySkipSharedKey2] AND [e0].[Key3] = [t].[CompositeKeySkipSharedKey3] WHERE [e0].[Key1] < 5 ) AS [t0] ON [e].[Id] = [t0].[LeafId] WHERE [e].[Discriminator] = N'EntityLeaf' @@ -897,7 +897,7 @@ LEFT JOIN ( FROM [JoinTwoToThree] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [j0] INNER JOIN [EntityThrees] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [e1] ON [j0].[ThreeId] = [e1].[Id] ) AS [t] - WHERE (1 < [t].[row]) AND ([t].[row] <= 3) + WHERE 1 < [t].[row] AND [t].[row] <= 3 ) AS [t0] ON [e0].[Id] = [t0].[TwoId] WHERE [e0].[Id] < 10 ) AS [t1] ON [e].[Id] = [t1].[OneId] @@ -940,7 +940,7 @@ LEFT JOIN ( FROM [JoinOneToTwo] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [j0] INNER JOIN [EntityTwos] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [e1] ON [j0].[TwoId] = [e1].[Id] ) AS [t] - WHERE (1 < [t].[row]) AND ([t].[row] <= 3) + WHERE 1 < [t].[row] AND [t].[row] <= 3 ) AS [t0] ON [e0].[Id] = [t0].[OneId] LEFT JOIN ( SELECT [j1].[EntityBranchId], [j1].[EntityOneId], [j1].[PeriodEnd], [j1].[PeriodStart], [t2].[Id], [t2].[Discriminator], [t2].[Name], [t2].[PeriodEnd] AS [PeriodEnd0], [t2].[PeriodStart] AS [PeriodStart0], [t2].[Number], [t2].[IsGreen] diff --git a/test/EFCore.SqlServer.FunctionalTests/Query/UdfDbFunctionSqlServerTests.cs b/test/EFCore.SqlServer.FunctionalTests/Query/UdfDbFunctionSqlServerTests.cs index 789cbbcefbe..e4342b58620 100644 --- a/test/EFCore.SqlServer.FunctionalTests/Query/UdfDbFunctionSqlServerTests.cs +++ b/test/EFCore.SqlServer.FunctionalTests/Query/UdfDbFunctionSqlServerTests.cs @@ -258,7 +258,7 @@ public override void Compare_functions_returning_int_that_take_nullable_param_wh AssertSql( @"SELECT [c].[Id], [c].[FirstName], [c].[LastName] FROM [Customers] AS [c] -WHERE (([dbo].[StringLength]([c].[FirstName]) <> [dbo].[StringLength]([c].[LastName])) OR ([c].[FirstName] IS NULL OR [c].[LastName] IS NULL)) AND ([c].[FirstName] IS NOT NULL OR [c].[LastName] IS NOT NULL) +WHERE ([dbo].[StringLength]([c].[FirstName]) <> [dbo].[StringLength]([c].[LastName]) OR [c].[FirstName] IS NULL OR [c].[LastName] IS NULL) AND ([c].[FirstName] IS NOT NULL OR [c].[LastName] IS NOT NULL) ORDER BY [c].[Id]"); } @@ -804,7 +804,7 @@ public override void Udf_with_argument_being_comparison_of_nullable_columns() @"SELECT [g].[Count], [g].[CustomerId], [g].[Year] FROM [Addresses] AS [a] CROSS APPLY [dbo].[GetCustomerOrderCountByYearOnlyFrom2000](1, CASE - WHEN (([a].[City] = [a].[State]) AND ([a].[City] IS NOT NULL AND [a].[State] IS NOT NULL)) OR ([a].[City] IS NULL AND [a].[State] IS NULL) THEN CAST(1 AS bit) + WHEN ([a].[City] = [a].[State] AND [a].[City] IS NOT NULL AND [a].[State] IS NOT NULL) OR ([a].[City] IS NULL AND [a].[State] IS NULL) THEN CAST(1 AS bit) ELSE CAST(0 AS bit) END) AS [g] ORDER BY [a].[Id], [g].[Year]"); diff --git a/test/EFCore.Sqlite.FunctionalTests/CustomConvertersSqliteTest.cs b/test/EFCore.Sqlite.FunctionalTests/CustomConvertersSqliteTest.cs index 4d3882f835f..7176c5a9fd1 100644 --- a/test/EFCore.Sqlite.FunctionalTests/CustomConvertersSqliteTest.cs +++ b/test/EFCore.Sqlite.FunctionalTests/CustomConvertersSqliteTest.cs @@ -31,7 +31,7 @@ public override void Value_conversion_is_appropriately_used_for_join_condition() SELECT ""b"".""Url"" FROM ""Blog"" AS ""b"" -INNER JOIN ""Post"" AS ""p"" ON ((""b"".""BlogId"" = ""p"".""BlogId"") AND (""b"".""IsVisible"" = 'Y')) AND (""b"".""BlogId"" = @__blogId_0) +INNER JOIN ""Post"" AS ""p"" ON ""b"".""BlogId"" = ""p"".""BlogId"" AND ""b"".""IsVisible"" = 'Y' AND ""b"".""BlogId"" = @__blogId_0 WHERE ""b"".""IsVisible"" = 'Y'"); } @@ -45,7 +45,7 @@ public override void Value_conversion_is_appropriately_used_for_left_join_condit SELECT ""b"".""Url"" FROM ""Blog"" AS ""b"" -LEFT JOIN ""Post"" AS ""p"" ON ((""b"".""BlogId"" = ""p"".""BlogId"") AND (""b"".""IsVisible"" = 'Y')) AND (""b"".""BlogId"" = @__blogId_0) +LEFT JOIN ""Post"" AS ""p"" ON ""b"".""BlogId"" = ""p"".""BlogId"" AND ""b"".""IsVisible"" = 'Y' AND ""b"".""BlogId"" = @__blogId_0 WHERE ""b"".""IsVisible"" = 'Y'"); } diff --git a/test/EFCore.Sqlite.FunctionalTests/Query/FromSqlQuerySqliteTest.cs b/test/EFCore.Sqlite.FunctionalTests/Query/FromSqlQuerySqliteTest.cs index 236ae1dda4f..72efd1f7ccf 100644 --- a/test/EFCore.Sqlite.FunctionalTests/Query/FromSqlQuerySqliteTest.cs +++ b/test/EFCore.Sqlite.FunctionalTests/Query/FromSqlQuerySqliteTest.cs @@ -27,7 +27,7 @@ public override async Task FromSqlRaw_queryable_composed(bool async) FROM ( SELECT * FROM ""Customers"" ) AS ""m"" -WHERE ('z' = '') OR (instr(""m"".""ContactName"", 'z') > 0)"; +WHERE 'z' = '' OR instr(""m"".""ContactName"", 'z') > 0"; Assert.Equal(expected, queryString, ignoreLineEndingDifferences: true); @@ -87,7 +87,7 @@ public override async Task FromSqlRaw_composed_with_common_table_expression(bool ) SELECT * FROM ""Customers2"" ) AS ""m"" -WHERE ('z' = '') OR (instr(""m"".""ContactName"", 'z') > 0)"); +WHERE 'z' = '' OR instr(""m"".""ContactName"", 'z') > 0"); } protected override DbParameter CreateDbParameter(string name, object value) diff --git a/test/EFCore.Sqlite.FunctionalTests/Query/NorthwindFunctionsQuerySqliteTest.cs b/test/EFCore.Sqlite.FunctionalTests/Query/NorthwindFunctionsQuerySqliteTest.cs index 54579cafef4..5a3ea5b2068 100644 --- a/test/EFCore.Sqlite.FunctionalTests/Query/NorthwindFunctionsQuerySqliteTest.cs +++ b/test/EFCore.Sqlite.FunctionalTests/Query/NorthwindFunctionsQuerySqliteTest.cs @@ -194,7 +194,7 @@ public override async Task String_StartsWith_Identity(bool async) AssertSql( @"SELECT ""c"".""CustomerID"", ""c"".""Address"", ""c"".""City"", ""c"".""CompanyName"", ""c"".""ContactName"", ""c"".""ContactTitle"", ""c"".""Country"", ""c"".""Fax"", ""c"".""Phone"", ""c"".""PostalCode"", ""c"".""Region"" FROM ""Customers"" AS ""c"" -WHERE (""c"".""ContactName"" = '') OR (""c"".""ContactName"" IS NOT NULL AND (((""c"".""ContactName"" LIKE ""c"".""ContactName"" || '%') AND (substr(""c"".""ContactName"", 1, length(""c"".""ContactName"")) = ""c"".""ContactName"")) OR (""c"".""ContactName"" = '')))"); +WHERE ""c"".""ContactName"" = '' OR (""c"".""ContactName"" IS NOT NULL AND (((""c"".""ContactName"" LIKE ""c"".""ContactName"" || '%') AND substr(""c"".""ContactName"", 1, length(""c"".""ContactName"")) = ""c"".""ContactName"") OR ""c"".""ContactName"" = ''))"); } public override async Task String_StartsWith_Column(bool async) @@ -204,7 +204,7 @@ public override async Task String_StartsWith_Column(bool async) AssertSql( @"SELECT ""c"".""CustomerID"", ""c"".""Address"", ""c"".""City"", ""c"".""CompanyName"", ""c"".""ContactName"", ""c"".""ContactTitle"", ""c"".""Country"", ""c"".""Fax"", ""c"".""Phone"", ""c"".""PostalCode"", ""c"".""Region"" FROM ""Customers"" AS ""c"" -WHERE (""c"".""ContactName"" = '') OR (""c"".""ContactName"" IS NOT NULL AND (((""c"".""ContactName"" LIKE ""c"".""ContactName"" || '%') AND (substr(""c"".""ContactName"", 1, length(""c"".""ContactName"")) = ""c"".""ContactName"")) OR (""c"".""ContactName"" = '')))"); +WHERE ""c"".""ContactName"" = '' OR (""c"".""ContactName"" IS NOT NULL AND (((""c"".""ContactName"" LIKE ""c"".""ContactName"" || '%') AND substr(""c"".""ContactName"", 1, length(""c"".""ContactName"")) = ""c"".""ContactName"") OR ""c"".""ContactName"" = ''))"); } public override async Task String_StartsWith_MethodCall(bool async) @@ -234,7 +234,7 @@ public override async Task String_EndsWith_Identity(bool async) AssertSql( @"SELECT ""c"".""CustomerID"", ""c"".""Address"", ""c"".""City"", ""c"".""CompanyName"", ""c"".""ContactName"", ""c"".""ContactTitle"", ""c"".""Country"", ""c"".""Fax"", ""c"".""Phone"", ""c"".""PostalCode"", ""c"".""Region"" FROM ""Customers"" AS ""c"" -WHERE (""c"".""ContactName"" = '') OR (""c"".""ContactName"" IS NOT NULL AND ((substr(""c"".""ContactName"", -length(""c"".""ContactName"")) = ""c"".""ContactName"") OR (""c"".""ContactName"" = '')))"); +WHERE ""c"".""ContactName"" = '' OR (""c"".""ContactName"" IS NOT NULL AND (substr(""c"".""ContactName"", -length(""c"".""ContactName"")) = ""c"".""ContactName"" OR ""c"".""ContactName"" = ''))"); } public override async Task String_EndsWith_Column(bool async) @@ -244,7 +244,7 @@ public override async Task String_EndsWith_Column(bool async) AssertSql( @"SELECT ""c"".""CustomerID"", ""c"".""Address"", ""c"".""City"", ""c"".""CompanyName"", ""c"".""ContactName"", ""c"".""ContactTitle"", ""c"".""Country"", ""c"".""Fax"", ""c"".""Phone"", ""c"".""PostalCode"", ""c"".""Region"" FROM ""Customers"" AS ""c"" -WHERE (""c"".""ContactName"" = '') OR (""c"".""ContactName"" IS NOT NULL AND ((substr(""c"".""ContactName"", -length(""c"".""ContactName"")) = ""c"".""ContactName"") OR (""c"".""ContactName"" = '')))"); +WHERE ""c"".""ContactName"" = '' OR (""c"".""ContactName"" IS NOT NULL AND (substr(""c"".""ContactName"", -length(""c"".""ContactName"")) = ""c"".""ContactName"" OR ""c"".""ContactName"" = ''))"); } public override async Task String_EndsWith_MethodCall(bool async) @@ -264,7 +264,7 @@ public override async Task String_Contains_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 ('M' = '') OR (instr(""c"".""ContactName"", 'M') > 0)"); +WHERE 'M' = '' OR instr(""c"".""ContactName"", 'M') > 0"); } public override async Task String_Contains_Identity(bool async) @@ -274,7 +274,7 @@ public override async Task String_Contains_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 (instr(""c"".""ContactName"", ""c"".""ContactName"") > 0)"); +WHERE ""c"".""ContactName"" = '' OR instr(""c"".""ContactName"", ""c"".""ContactName"") > 0"); } public override async Task String_Contains_Column(bool async) @@ -284,7 +284,7 @@ public override async Task String_Contains_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 (instr(""c"".""ContactName"", ""c"".""ContactName"") > 0)"); +WHERE ""c"".""ContactName"" = '' OR instr(""c"".""ContactName"", ""c"".""ContactName"") > 0"); } public override async Task String_FirstOrDefault_MethodCall(bool async) @@ -312,7 +312,7 @@ public override async Task String_Contains_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 ('M' = '') OR (instr(""c"".""ContactName"", 'M') > 0)"); +WHERE 'M' = '' OR instr(""c"".""ContactName"", 'M') > 0"); } public override async Task IsNullOrWhiteSpace_in_predicate(bool async) @@ -322,7 +322,7 @@ public override async Task IsNullOrWhiteSpace_in_predicate(bool async) AssertSql( @"SELECT ""c"".""CustomerID"", ""c"".""Address"", ""c"".""City"", ""c"".""CompanyName"", ""c"".""ContactName"", ""c"".""ContactTitle"", ""c"".""Country"", ""c"".""Fax"", ""c"".""Phone"", ""c"".""PostalCode"", ""c"".""Region"" FROM ""Customers"" AS ""c"" -WHERE ""c"".""Region"" IS NULL OR (trim(""c"".""Region"") = '')"); +WHERE ""c"".""Region"" IS NULL OR trim(""c"".""Region"") = ''"); } public override async Task Indexof_with_emptystring(bool async) @@ -446,7 +446,7 @@ public override async Task Where_math_abs2(bool async) AssertSql( @"SELECT ""o"".""OrderID"", ""o"".""ProductID"", ""o"".""Discount"", ""o"".""Quantity"", ""o"".""UnitPrice"" FROM ""Order Details"" AS ""o"" -WHERE (""o"".""UnitPrice"" < 7.0) AND (abs(""o"".""Quantity"") > 10)"); +WHERE ""o"".""UnitPrice"" < 7.0 AND abs(""o"".""Quantity"") > 10"); } public override async Task Where_math_abs_uncorrelated(bool async) @@ -456,7 +456,7 @@ public override async Task Where_math_abs_uncorrelated(bool async) AssertSql( @"SELECT ""o"".""OrderID"", ""o"".""ProductID"", ""o"".""Discount"", ""o"".""Quantity"", ""o"".""UnitPrice"" FROM ""Order Details"" AS ""o"" -WHERE (""o"".""UnitPrice"" < 7.0) AND (10 < ""o"".""ProductID"")"); +WHERE ""o"".""UnitPrice"" < 7.0 AND 10 < ""o"".""ProductID"""); } public override async Task Select_math_round_int(bool async) @@ -476,7 +476,7 @@ public override async Task Where_math_min(bool async) AssertSql( @"SELECT ""o"".""OrderID"", ""o"".""ProductID"", ""o"".""Discount"", ""o"".""Quantity"", ""o"".""UnitPrice"" FROM ""Order Details"" AS ""o"" -WHERE (""o"".""OrderID"" = 11077) AND (min(""o"".""OrderID"", ""o"".""ProductID"") = ""o"".""ProductID"")"); +WHERE ""o"".""OrderID"" = 11077 AND min(""o"".""OrderID"", ""o"".""ProductID"") = ""o"".""ProductID"""); } public override async Task Where_math_max(bool async) @@ -486,7 +486,7 @@ public override async Task Where_math_max(bool async) AssertSql( @"SELECT ""o"".""OrderID"", ""o"".""ProductID"", ""o"".""Discount"", ""o"".""Quantity"", ""o"".""UnitPrice"" FROM ""Order Details"" AS ""o"" -WHERE (""o"".""OrderID"" = 11077) AND (max(""o"".""OrderID"", ""o"".""ProductID"") = ""o"".""OrderID"")"); +WHERE ""o"".""OrderID"" = 11077 AND max(""o"".""OrderID"", ""o"".""ProductID"") = ""o"".""OrderID"""); } public override async Task Where_string_to_lower(bool async) @@ -624,7 +624,7 @@ public override async Task IsNullOrEmpty_in_predicate(bool async) AssertSql( @"SELECT ""c"".""CustomerID"", ""c"".""Address"", ""c"".""City"", ""c"".""CompanyName"", ""c"".""ContactName"", ""c"".""ContactTitle"", ""c"".""Country"", ""c"".""Fax"", ""c"".""Phone"", ""c"".""PostalCode"", ""c"".""Region"" FROM ""Customers"" AS ""c"" -WHERE ""c"".""Region"" IS NULL OR (""c"".""Region"" = '')"); +WHERE ""c"".""Region"" IS NULL OR ""c"".""Region"" = ''"); } public override async Task IsNullOrEmpty_in_projection(bool async) @@ -632,7 +632,7 @@ public override async Task IsNullOrEmpty_in_projection(bool async) await base.IsNullOrEmpty_in_projection(async); AssertSql( - @"SELECT ""c"".""CustomerID"" AS ""Id"", ""c"".""Region"" IS NULL OR (""c"".""Region"" = '') AS ""Value"" + @"SELECT ""c"".""CustomerID"" AS ""Id"", ""c"".""Region"" IS NULL OR ""c"".""Region"" = '' AS ""Value"" FROM ""Customers"" AS ""c"""); } @@ -643,7 +643,7 @@ public override async Task IsNullOrEmpty_negated_in_predicate(bool async) AssertSql( @"SELECT ""c"".""CustomerID"", ""c"".""Address"", ""c"".""City"", ""c"".""CompanyName"", ""c"".""ContactName"", ""c"".""ContactTitle"", ""c"".""Country"", ""c"".""Fax"", ""c"".""Phone"", ""c"".""PostalCode"", ""c"".""Region"" FROM ""Customers"" AS ""c"" -WHERE ""c"".""Region"" IS NOT NULL AND (""c"".""Region"" <> '')"); +WHERE ""c"".""Region"" IS NOT NULL AND ""c"".""Region"" <> ''"); } public override Task Datetime_subtraction_TotalDays(bool async) diff --git a/test/EFCore.Sqlite.FunctionalTests/Query/NorthwindMiscellaneousQuerySqliteTest.cs b/test/EFCore.Sqlite.FunctionalTests/Query/NorthwindMiscellaneousQuerySqliteTest.cs index 92908221a71..9d7de099c99 100644 --- a/test/EFCore.Sqlite.FunctionalTests/Query/NorthwindMiscellaneousQuerySqliteTest.cs +++ b/test/EFCore.Sqlite.FunctionalTests/Query/NorthwindMiscellaneousQuerySqliteTest.cs @@ -32,7 +32,7 @@ public override async Task Query_expression_with_to_string_and_contains(bool asy AssertSql( @"SELECT ""o"".""CustomerID"" FROM ""Orders"" AS ""o"" -WHERE ""o"".""OrderDate"" IS NOT NULL AND (('10' = '') OR (instr(CAST(""o"".""EmployeeID"" AS TEXT), '10') > 0))"); +WHERE ""o"".""OrderDate"" IS NOT NULL AND ('10' = '' OR instr(CAST(""o"".""EmployeeID"" AS TEXT), '10') > 0)"); } public override async Task Take_Skip(bool async) diff --git a/test/EFCore.Sqlite.FunctionalTests/Query/NorthwindQueryFiltersQuerySqliteTest.cs b/test/EFCore.Sqlite.FunctionalTests/Query/NorthwindQueryFiltersQuerySqliteTest.cs index d8e888e2435..e8ebb2c89cc 100644 --- a/test/EFCore.Sqlite.FunctionalTests/Query/NorthwindQueryFiltersQuerySqliteTest.cs +++ b/test/EFCore.Sqlite.FunctionalTests/Query/NorthwindQueryFiltersQuerySqliteTest.cs @@ -27,7 +27,7 @@ public override async Task Count_query(bool async) SELECT COUNT(*) FROM ""Customers"" AS ""c"" -WHERE (@__ef_filter__TenantPrefix_0 = '') OR (""c"".""CompanyName"" IS NOT NULL AND (((""c"".""CompanyName"" LIKE @__ef_filter__TenantPrefix_0 || '%') AND (substr(""c"".""CompanyName"", 1, length(@__ef_filter__TenantPrefix_0)) = @__ef_filter__TenantPrefix_0)) OR (@__ef_filter__TenantPrefix_0 = '')))"); +WHERE @__ef_filter__TenantPrefix_0 = '' OR (""c"".""CompanyName"" IS NOT NULL AND (((""c"".""CompanyName"" LIKE @__ef_filter__TenantPrefix_0 || '%') AND substr(""c"".""CompanyName"", 1, length(@__ef_filter__TenantPrefix_0)) = @__ef_filter__TenantPrefix_0) OR @__ef_filter__TenantPrefix_0 = ''))"); } private void AssertSql(params string[] expected) diff --git a/test/EFCore.Sqlite.FunctionalTests/Query/NorthwindWhereQuerySqliteTest.cs b/test/EFCore.Sqlite.FunctionalTests/Query/NorthwindWhereQuerySqliteTest.cs index 2c81c656f37..bd835db49d8 100644 --- a/test/EFCore.Sqlite.FunctionalTests/Query/NorthwindWhereQuerySqliteTest.cs +++ b/test/EFCore.Sqlite.FunctionalTests/Query/NorthwindWhereQuerySqliteTest.cs @@ -191,7 +191,7 @@ public override async Task Where_string_indexof(bool async) AssertSql( @"SELECT ""c"".""CustomerID"", ""c"".""Address"", ""c"".""City"", ""c"".""CompanyName"", ""c"".""ContactName"", ""c"".""ContactTitle"", ""c"".""Country"", ""c"".""Fax"", ""c"".""Phone"", ""c"".""PostalCode"", ""c"".""Region"" FROM ""Customers"" AS ""c"" -WHERE ((instr(""c"".""City"", 'Sea') - 1) <> -1) OR ""c"".""City"" IS NULL"); +WHERE (instr(""c"".""City"", 'Sea') - 1) <> -1 OR ""c"".""City"" IS NULL"); } public override async Task Where_string_replace(bool async)