diff --git a/src/EFCore.Relational/Query/QuerySqlGenerator.cs b/src/EFCore.Relational/Query/QuerySqlGenerator.cs index 7dd6cbf143d..b55f006cc04 100644 --- a/src/EFCore.Relational/Query/QuerySqlGenerator.cs +++ b/src/EFCore.Relational/Query/QuerySqlGenerator.cs @@ -1,6 +1,7 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. +using System.Runtime.CompilerServices; using Microsoft.EntityFrameworkCore.Query.SqlExpressions; using Microsoft.EntityFrameworkCore.Storage.Internal; @@ -954,62 +955,6 @@ protected override Expression VisitAtTimeZone(AtTimeZoneExpression atTimeZoneExp protected virtual string GetOperator(SqlBinaryExpression binaryExpression) => OperatorMap[binaryExpression.OperatorType]; - /// <summary> - /// Returns a bool value indicating if the inner SQL expression required to be put inside parenthesis - /// when generating SQL for outer SQL expression. - /// </summary> - /// <param name="outerExpression">The outer expression which provides context in which SQL is being generated.</param> - /// <param name="innerExpression">The inner expression which may need to be put inside parenthesis.</param> - /// <returns>A bool value indicating that parenthesis is required or not. </returns> - protected virtual bool RequiresParentheses(SqlExpression outerExpression, SqlExpression innerExpression) - { - switch (innerExpression) - { - case AtTimeZoneExpression or LikeExpression: - return true; - - case SqlUnaryExpression sqlUnaryExpression: - { - // Wrap IS (NOT) NULL operation - if (sqlUnaryExpression.OperatorType is ExpressionType.Equal or ExpressionType.NotEqual) - { - return true; - } - - if (sqlUnaryExpression.OperatorType == ExpressionType.Negate - && outerExpression is SqlUnaryExpression { OperatorType: ExpressionType.Negate }) - { - // double negative sign is interpreted as a comment in SQL, so we need to enclose it in brackets - return true; - } - - return false; - } - - case SqlBinaryExpression sqlBinaryExpression: - { - 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; - } - } - - return false; - } - /// <summary> /// Generates a TOP construct in the relational command /// </summary> @@ -1361,4 +1306,125 @@ void LiftPredicate(TableExpressionBase joinTable) protected override Expression VisitJsonScalar(JsonScalarExpression jsonScalarExpression) => throw new InvalidOperationException( RelationalStrings.JsonNodeMustBeHandledByProviderSpecificVisitor); + + /// <summary> + /// Returns a bool value indicating if the inner SQL expression required to be put inside parenthesis when generating SQL for outer + /// SQL expression. + /// </summary> + /// <param name="outerExpression">The outer expression which provides context in which SQL is being generated.</param> + /// <param name="innerExpression">The inner expression which may need to be put inside parenthesis.</param> + /// <returns>A bool value indicating that parenthesis is required or not. </returns> + protected virtual bool RequiresParentheses(SqlExpression outerExpression, SqlExpression innerExpression) + { + int outerPrecedence, innerPrecedence; + + // Convert is rendered as a function (CAST()) and not as an operator, so we never need to add parentheses around the inner + if (outerExpression is SqlUnaryExpression { OperatorType: ExpressionType.Convert }) + { + return false; + } + + switch (innerExpression) + { + case SqlUnaryExpression innerUnaryExpression: + { + // If the same unary operator is used in both outer and inner (e.g. NOT NOT), no parentheses are needed + if (outerExpression is SqlUnaryExpression outerUnary + && innerUnaryExpression.OperatorType == outerUnary.OperatorType) + { + // ... except for double negative (--), which is interpreted as a comment in SQL + return innerUnaryExpression.OperatorType == ExpressionType.Negate; + } + + // If the provider defined precedence for the two expression, use that + if (TryGetOperatorInfo(outerExpression, out outerPrecedence, out _) + && TryGetOperatorInfo(innerExpression, out innerPrecedence, out _)) + { + return outerPrecedence >= innerPrecedence; + } + + // Otherwise, wrap IS (NOT) NULL operation, except if it's in a logical operator + if (innerUnaryExpression.OperatorType is ExpressionType.Equal or ExpressionType.NotEqual + && outerExpression is not SqlBinaryExpression + { + OperatorType: ExpressionType.AndAlso or ExpressionType.OrElse or ExpressionType.Not + }) + { + return true; + } + + return false; + } + + case SqlBinaryExpression innerBinaryExpression: + { + // Precedence-wise AND is above OR but we still add parenthesis for ease of understanding + if (innerBinaryExpression.OperatorType is ExpressionType.AndAlso or ExpressionType.And + && outerExpression is SqlBinaryExpression { OperatorType: ExpressionType.OrElse or ExpressionType.Or }) + { + return true; + } + + // If the provider defined precedence for the two expression, use that + if (TryGetOperatorInfo(outerExpression, out outerPrecedence, out var isOuterAssociative) + && TryGetOperatorInfo(innerExpression, out innerPrecedence, out _)) + { + return outerPrecedence.CompareTo(innerPrecedence) switch + { + > 0 => true, + < 0 => false, + + // If both operators have the same precedence, add parentheses unless they're the same operator, and + // that operator is associative (e.g. a + b + c) + 0 => outerExpression is not SqlBinaryExpression outerBinary + || outerBinary.OperatorType != innerBinaryExpression.OperatorType + || !isOuterAssociative + // Arithmetic operators on floating points aren't associative, because of rounding errors. + || outerExpression.Type == typeof(float) + || outerExpression.Type == typeof(double) + || innerExpression.Type == typeof(float) + || innerExpression.Type == typeof(double) + }; + } + + // Otherwise always parenthesize for safety + return true; + } + + case CollateExpression or LikeExpression or AtTimeZoneExpression: + return !TryGetOperatorInfo(outerExpression, out outerPrecedence, out _) + || !TryGetOperatorInfo(innerExpression, out innerPrecedence, out _) + || outerPrecedence >= innerPrecedence; + + default: + return false; + } + } + + /// <summary> + /// Returns a numeric value representing the precedence of the given <paramref name="expression" />, as well as its associativity. + /// These control whether parentheses are generated around the expression. + /// </summary> + /// <param name="expression">The expression for which to get the precedence and associativity.</param> + /// <param name="precedence"> + /// If the method returned <see langword="true" />, contains the precedence of the provided <paramref name="expression" />. + /// Otherwise, contains default values. + /// </param> + /// <param name="isAssociative"> + /// If the method returned <see langword="true" />, contains the associativity of the provided <paramref name="expression" />. + /// Otherwise, contains default values. + /// </param> + /// <returns> + /// <see langword="true" /> if the expression operator info is known and was returned in <paramref name="precedence" /> and + /// <paramref name="isAssociative" />. Otherwise, <see langword="false" />. + /// </returns> + /// <remarks> + /// The default implementation always returns false, so that parentheses almost always get added. Providers can override this method + /// to remove parentheses where they aren't necessary. + /// </remarks> + protected virtual bool TryGetOperatorInfo(SqlExpression expression, out int precedence, out bool isAssociative) + { + (precedence, isAssociative) = (default, default); + return false; + } } diff --git a/src/EFCore.SqlServer/Query/Internal/SqlServerQuerySqlGenerator.cs b/src/EFCore.SqlServer/Query/Internal/SqlServerQuerySqlGenerator.cs index bfac93e291b..4fbab584d91 100644 --- a/src/EFCore.SqlServer/Query/Internal/SqlServerQuerySqlGenerator.cs +++ b/src/EFCore.SqlServer/Query/Internal/SqlServerQuerySqlGenerator.cs @@ -296,7 +296,12 @@ when tableExpression.FindAnnotation(SqlServerAnnotationNames.TemporalOperationTy return base.VisitExtension(extensionExpression); } - /// <inheritdoc /> + /// <summary> + /// This is an internal API that supports the Entity Framework Core infrastructure and not subject to + /// the same compatibility standards as public APIs. It may be changed or removed without notice in + /// any release. You should only use it directly in your code with extreme caution and knowing that + /// doing so can result in application failures when updating to a new Entity Framework Core release. + /// </summary> protected override Expression VisitJsonScalar(JsonScalarExpression jsonScalarExpression) { if (jsonScalarExpression.Path.Count == 1 @@ -344,6 +349,62 @@ protected override void CheckComposableSqlTrimmed(ReadOnlySpan<char> sql) } } + /// <summary> + /// This is an internal API that supports the Entity Framework Core infrastructure and not subject to + /// the same compatibility standards as public APIs. It may be changed or removed without notice in + /// any release. You should only use it directly in your code with extreme caution and knowing that + /// doing so can result in application failures when updating to a new Entity Framework Core release. + /// </summary> + protected override bool TryGetOperatorInfo(SqlExpression expression, out int precedence, out bool isAssociative) + { + // See https://docs.microsoft.com/sql/t-sql/language-elements/operator-precedence-transact-sql, although that list is very partial + (precedence, isAssociative) = expression switch + { + SqlBinaryExpression sqlBinaryExpression => sqlBinaryExpression.OperatorType switch + { + ExpressionType.Multiply => (900, true), + ExpressionType.Divide => (900, false), + ExpressionType.Modulo => (900, false), + ExpressionType.Add => (800, true), + ExpressionType.Subtract => (800, false), + ExpressionType.And => (700, true), + ExpressionType.Or => (700, true), + ExpressionType.LeftShift => (700, true), + ExpressionType.RightShift => (700, true), + ExpressionType.LessThan => (600, false), + ExpressionType.LessThanOrEqual => (600, false), + ExpressionType.GreaterThan => (600, false), + ExpressionType.GreaterThanOrEqual => (600, false), + ExpressionType.Equal => (500, false), + ExpressionType.NotEqual => (500, false), + ExpressionType.AndAlso => (200, true), + ExpressionType.OrElse => (100, true), + + _ => default, + }, + + SqlUnaryExpression sqlUnaryExpression => sqlUnaryExpression.OperatorType switch + { + ExpressionType.Convert => (1300, false), + ExpressionType.Not when sqlUnaryExpression.Type != typeof(bool) => (1200, false), + ExpressionType.Negate => (1100, false), + ExpressionType.Equal => (500, false), // IS NULL + ExpressionType.NotEqual => (500, false), // IS NOT NULL + ExpressionType.Not when sqlUnaryExpression.Type == typeof(bool) => (300, false), + + _ => default, + }, + + CollateExpression => (900, false), + LikeExpression => (350, false), + AtTimeZoneExpression => (1200, false), + + _ => default, + }; + + return precedence != default; + } + private void GenerateList<T>( IReadOnlyList<T> items, Action<T> generationAction, diff --git a/src/EFCore.Sqlite.Core/Query/Internal/SqliteQuerySqlGenerator.cs b/src/EFCore.Sqlite.Core/Query/Internal/SqliteQuerySqlGenerator.cs index 766076182cb..0c7a0ea735e 100644 --- a/src/EFCore.Sqlite.Core/Query/Internal/SqliteQuerySqlGenerator.cs +++ b/src/EFCore.Sqlite.Core/Query/Internal/SqliteQuerySqlGenerator.cs @@ -105,4 +105,58 @@ private Expression VisitRegexp(RegexpExpression regexpExpression) return regexpExpression; } + + /// <summary> + /// This is an internal API that supports the Entity Framework Core infrastructure and not subject to + /// the same compatibility standards as public APIs. It may be changed or removed without notice in + /// any release. You should only use it directly in your code with extreme caution and knowing that + /// doing so can result in application failures when updating to a new Entity Framework Core release. + /// </summary> + protected override bool TryGetOperatorInfo(SqlExpression expression, out int precedence, out bool isAssociative) + { + // See https://sqlite.org/lang_expr.html#operators_and_parse_affecting_attributes + (precedence, isAssociative) = expression switch + { + SqlBinaryExpression sqlBinaryExpression => sqlBinaryExpression.OperatorType switch + { + ExpressionType.Multiply => (900, true), + ExpressionType.Divide => (900, false), + ExpressionType.Modulo => (900, false), + ExpressionType.Add when sqlBinaryExpression.Type == typeof(string) => (1100, true), + ExpressionType.Add when sqlBinaryExpression.Type != typeof(string) => (800, true), + ExpressionType.Subtract => (800, false), + ExpressionType.And => (600, true), + ExpressionType.Or => (600, true), + ExpressionType.LessThan => (500, false), + ExpressionType.LessThanOrEqual => (500, false), + ExpressionType.GreaterThan => (500, false), + ExpressionType.GreaterThanOrEqual => (500, false), + ExpressionType.Equal => (500, false), + ExpressionType.NotEqual => (500, false), + ExpressionType.AndAlso => (200, true), + ExpressionType.OrElse => (100, true), + + _ => default, + }, + + SqlUnaryExpression sqlUnaryExpression => sqlUnaryExpression.OperatorType switch + { + ExpressionType.Convert => (1300, false), + ExpressionType.Not when sqlUnaryExpression.Type != typeof(bool) => (1200, false), + ExpressionType.Negate => (1200, false), + ExpressionType.Equal => (500, false), // IS NULL + ExpressionType.NotEqual => (500, false), // IS NOT NULL + ExpressionType.Not when sqlUnaryExpression.Type == typeof(bool) => (300, false), + + _ => default, + }, + + CollateExpression => (1100, false), + LikeExpression => (500, false), + + _ => default, + }; + + return precedence != default; + } } diff --git a/test/EFCore.Relational.Specification.Tests/Query/NorthwindOperatorsQueryTestBase.cs b/test/EFCore.Relational.Specification.Tests/Query/NorthwindOperatorsQueryTestBase.cs new file mode 100644 index 00000000000..0f9df2b82e7 --- /dev/null +++ b/test/EFCore.Relational.Specification.Tests/Query/NorthwindOperatorsQueryTestBase.cs @@ -0,0 +1,62 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +using Microsoft.EntityFrameworkCore.TestModels.Northwind; + +namespace Microsoft.EntityFrameworkCore.Query; + +public abstract class NorthwindOperatorsQueryTestBase<TFixture> : QueryTestBase<TFixture> + where TFixture : NorthwindQueryFixtureBase<NoopModelCustomizer>, new() +{ + protected NorthwindOperatorsQueryTestBase(TFixture fixture) + : base(fixture) + { + } + + protected static ExpressionType[] BinaryArithmeticOperators { get; } = + { + ExpressionType.Add, + ExpressionType.Subtract, + ExpressionType.Multiply, + ExpressionType.Divide, + // TODO Complete... + }; + + [ConditionalTheory] + [MemberData(nameof(Get_binary_arithmetic_data))] + public virtual async Task Binary_arithmetic_operators(ExpressionType outer, ExpressionType inner) + { + var parameter = Expression.Parameter(typeof(Order), "o"); + var predicate = + Expression.Lambda<Func<Order, int>>( + Expression.MakeBinary( + outer, + Expression.MakeBinary( + inner, + Expression.Property(parameter, nameof(Order.OrderID)), + Expression.Constant(8)), + Expression.Constant(9)), + parameter); + + await AssertQueryScalar( + async: true, + ss => ss.Set<Order>().Where(o => o.OrderID == 10248).Select(predicate)); + } + + public static IEnumerable<object[]> Get_binary_arithmetic_data() + => from op1 in BinaryArithmeticOperators from op2 in BinaryArithmeticOperators select new object[] { op1, op2 }; + + [ConditionalTheory] + [MemberData(nameof(IsAsyncData))] + public virtual Task Double_negate_on_column(bool async) + => AssertQuery( + async, + ss => ss.Set<Order>().Where(o => -(-o.OrderID) == o.OrderID), + entryCount: 830); + + // TODO: Test associativity (no parentheses on consecutive e.g. add operations) + // TODO: Test non-associativity of arithmetic operators on floating points aren't associative (because of rounding errors) + + // TODO: Move operator/precedence related here, e.g. NullSemanticsQueryTestBase.Bool_not_equal_nullable_int_HasValue, + // GearsOfWarTestBase.Negate_on_binary_expression... +} diff --git a/test/EFCore.Specification.Tests/Query/GearsOfWarQueryTestBase.cs b/test/EFCore.Specification.Tests/Query/GearsOfWarQueryTestBase.cs index adb2a61365c..ea8ee4feb94 100644 --- a/test/EFCore.Specification.Tests/Query/GearsOfWarQueryTestBase.cs +++ b/test/EFCore.Specification.Tests/Query/GearsOfWarQueryTestBase.cs @@ -48,13 +48,6 @@ public virtual Task Negate_on_column(bool async) async, ss => ss.Set<Squad>().Where(s => s.Id == -s.Id)); - [ConditionalTheory] - [MemberData(nameof(IsAsyncData))] - public virtual Task Double_negate_on_column(bool async) - => AssertQuery( - async, - ss => ss.Set<Squad>().Where(s => -(-s.Id) == s.Id)); - [ConditionalTheory] [MemberData(nameof(IsAsyncData))] public virtual Task Negate_on_like_expression(bool async) diff --git a/test/EFCore.SqlServer.FunctionalTests/BulkUpdates/NonSharedModelBulkUpdatesSqlServerTest.cs b/test/EFCore.SqlServer.FunctionalTests/BulkUpdates/NonSharedModelBulkUpdatesSqlServerTest.cs index e800288c5cf..7d7dc83be75 100644 --- a/test/EFCore.SqlServer.FunctionalTests/BulkUpdates/NonSharedModelBulkUpdatesSqlServerTest.cs +++ b/test/EFCore.SqlServer.FunctionalTests/BulkUpdates/NonSharedModelBulkUpdatesSqlServerTest.cs @@ -62,7 +62,7 @@ public override async Task Delete_predicate_based_on_optional_navigation(bool as DELETE FROM [p] FROM [Posts] AS [p] LEFT JOIN [Blogs] AS [b] ON [p].[BlogId] = [b].[Id] -WHERE ([b].[Title] IS NOT NULL) AND ([b].[Title] LIKE N'Arthur%') +WHERE [b].[Title] IS NOT NULL AND [b].[Title] LIKE N'Arthur%' """); } diff --git a/test/EFCore.SqlServer.FunctionalTests/BulkUpdates/NorthwindBulkUpdatesSqlServerTest.cs b/test/EFCore.SqlServer.FunctionalTests/BulkUpdates/NorthwindBulkUpdatesSqlServerTest.cs index f1013f9f577..fdfd67385c2 100644 --- a/test/EFCore.SqlServer.FunctionalTests/BulkUpdates/NorthwindBulkUpdatesSqlServerTest.cs +++ b/test/EFCore.SqlServer.FunctionalTests/BulkUpdates/NorthwindBulkUpdatesSqlServerTest.cs @@ -221,7 +221,7 @@ FROM [Order Details] AS [o] SELECT TOP(1) ( SELECT TOP(1) [o1].[OrderID] FROM [Orders] AS [o1] - WHERE [o0].[CustomerID] = [o1].[CustomerID] OR (([o0].[CustomerID] IS NULL) AND ([o1].[CustomerID] IS NULL))) + WHERE [o0].[CustomerID] = [o1].[CustomerID] OR ([o0].[CustomerID] IS NULL AND [o1].[CustomerID] IS NULL)) FROM [Orders] AS [o0] GROUP BY [o0].[CustomerID] HAVING COUNT(*) > 11) @@ -244,7 +244,7 @@ GROUP BY [o1].[CustomerID] HAVING COUNT(*) > 9 AND ( SELECT TOP(1) [o2].[OrderID] FROM [Orders] AS [o2] - WHERE [o1].[CustomerID] = [o2].[CustomerID] OR (([o1].[CustomerID] IS NULL) AND ([o2].[CustomerID] IS NULL))) = [o0].[OrderID]) + WHERE [o1].[CustomerID] = [o2].[CustomerID] OR ([o1].[CustomerID] IS NULL AND [o2].[CustomerID] IS NULL)) = [o0].[OrderID]) """); } @@ -360,7 +360,7 @@ DELETE FROM [o] FROM [Order Details] AS [o] INNER JOIN [Orders] AS [o0] ON [o].[OrderID] = [o0].[OrderID] LEFT JOIN [Customers] AS [c] ON [o0].[CustomerID] = [c].[CustomerID] -WHERE ([c].[CustomerID] IS NOT NULL) AND ([c].[CustomerID] LIKE N'F%') +WHERE [c].[CustomerID] IS NOT NULL AND [c].[CustomerID] LIKE N'F%' """); } @@ -506,7 +506,7 @@ DELETE FROM [o] FROM [Order Details] AS [o] INNER JOIN [Orders] AS [o0] ON [o].[OrderID] = [o0].[OrderID] LEFT JOIN [Customers] AS [c] ON [o0].[CustomerID] = [c].[CustomerID] -WHERE ([c].[City] IS NOT NULL) AND ([c].[City] LIKE N'Se%') +WHERE [c].[City] IS NOT NULL AND [c].[City] LIKE N'Se%' """); } @@ -927,7 +927,7 @@ FROM [Customers] AS [c] SELECT TOP(1) ( SELECT TOP(1) [o0].[CustomerID] FROM [Orders] AS [o0] - WHERE [o].[CustomerID] = [o0].[CustomerID] OR (([o].[CustomerID] IS NULL) AND ([o0].[CustomerID] IS NULL))) + WHERE [o].[CustomerID] = [o0].[CustomerID] OR ([o].[CustomerID] IS NULL AND [o0].[CustomerID] IS NULL)) FROM [Orders] AS [o] GROUP BY [o].[CustomerID] HAVING COUNT(*) > 11) @@ -958,7 +958,7 @@ HAVING COUNT(*) > 11 AND ( SELECT TOP(1) [c0].[CustomerID] FROM [Orders] AS [o0] LEFT JOIN [Customers] AS [c0] ON [o0].[CustomerID] = [c0].[CustomerID] - WHERE [o].[CustomerID] = [o0].[CustomerID] OR (([o].[CustomerID] IS NULL) AND ([o0].[CustomerID] IS NULL))) = [c].[CustomerID]) + WHERE [o].[CustomerID] = [o0].[CustomerID] OR ([o].[CustomerID] IS NULL AND [o0].[CustomerID] IS NULL)) = [c].[CustomerID]) """); } @@ -1322,7 +1322,7 @@ FROM [Customers] AS [c] CROSS JOIN ( SELECT [c0].[CustomerID], [c0].[Address], [c0].[City], [c0].[CompanyName], [c0].[ContactName], [c0].[ContactTitle], [c0].[Country], [c0].[Fax], [c0].[Phone], [c0].[PostalCode], [c0].[Region] FROM [Customers] AS [c0] - WHERE ([c0].[City] IS NOT NULL) AND ([c0].[City] LIKE N'S%') + WHERE [c0].[City] IS NOT NULL AND [c0].[City] LIKE N'S%' ) AS [t] LEFT JOIN ( SELECT [o].[OrderID], [o].[CustomerID], [o].[EmployeeID], [o].[OrderDate] @@ -1345,7 +1345,7 @@ FROM [Customers] AS [c] CROSS JOIN ( SELECT [c0].[CustomerID], [c0].[Address], [c0].[City], [c0].[CompanyName], [c0].[ContactName], [c0].[ContactTitle], [c0].[Country], [c0].[Fax], [c0].[Phone], [c0].[PostalCode], [c0].[Region] FROM [Customers] AS [c0] - WHERE ([c0].[City] IS NOT NULL) AND ([c0].[City] LIKE N'S%') + WHERE [c0].[City] IS NOT NULL AND [c0].[City] LIKE N'S%' ) AS [t] CROSS APPLY ( SELECT [o].[OrderID], [o].[CustomerID], [o].[EmployeeID], [o].[OrderDate] @@ -1368,7 +1368,7 @@ FROM [Customers] AS [c] CROSS JOIN ( SELECT [c0].[CustomerID], [c0].[Address], [c0].[City], [c0].[CompanyName], [c0].[ContactName], [c0].[ContactTitle], [c0].[Country], [c0].[Fax], [c0].[Phone], [c0].[PostalCode], [c0].[Region] FROM [Customers] AS [c0] - WHERE ([c0].[City] IS NOT NULL) AND ([c0].[City] LIKE N'S%') + WHERE [c0].[City] IS NOT NULL AND [c0].[City] LIKE N'S%' ) AS [t] OUTER APPLY ( SELECT [o].[OrderID], [o].[CustomerID], [o].[EmployeeID], [o].[OrderDate] diff --git a/test/EFCore.SqlServer.FunctionalTests/BulkUpdates/TPTFiltersInheritanceBulkUpdatesSqlServerTest.cs b/test/EFCore.SqlServer.FunctionalTests/BulkUpdates/TPTFiltersInheritanceBulkUpdatesSqlServerTest.cs index e967cde399c..37f7432301a 100644 --- a/test/EFCore.SqlServer.FunctionalTests/BulkUpdates/TPTFiltersInheritanceBulkUpdatesSqlServerTest.cs +++ b/test/EFCore.SqlServer.FunctionalTests/BulkUpdates/TPTFiltersInheritanceBulkUpdatesSqlServerTest.cs @@ -62,7 +62,7 @@ FROM [Animals] AS [a] LEFT JOIN [Birds] AS [b] ON [a].[Id] = [b].[Id] LEFT JOIN [Eagle] AS [e] ON [a].[Id] = [e].[Id] LEFT JOIN [Kiwi] AS [k] ON [a].[Id] = [k].[Id] - WHERE [a].[CountryId] = 1 AND [c].[Id] = [a].[CountryId] AND ([k].[Id] IS NOT NULL) AND [a].[CountryId] > 0) > 0 + WHERE [a].[CountryId] = 1 AND [c].[Id] = [a].[CountryId] AND [k].[Id] IS NOT NULL AND [a].[CountryId] > 0) > 0 """); } @@ -156,7 +156,7 @@ FROM [Animals] AS [a] LEFT JOIN [Birds] AS [b] ON [a].[Id] = [b].[Id] LEFT JOIN [Eagle] AS [e] ON [a].[Id] = [e].[Id] LEFT JOIN [Kiwi] AS [k] ON [a].[Id] = [k].[Id] - WHERE [a].[CountryId] = 1 AND [c].[Id] = [a].[CountryId] AND ([k].[Id] IS NOT NULL) AND [a].[CountryId] > 0) > 0 + WHERE [a].[CountryId] = 1 AND [c].[Id] = [a].[CountryId] AND [k].[Id] IS NOT NULL AND [a].[CountryId] > 0) > 0 """); } diff --git a/test/EFCore.SqlServer.FunctionalTests/BulkUpdates/TPTInheritanceBulkUpdatesSqlServerTest.cs b/test/EFCore.SqlServer.FunctionalTests/BulkUpdates/TPTInheritanceBulkUpdatesSqlServerTest.cs index 3edf38df652..8cc494db1a1 100644 --- a/test/EFCore.SqlServer.FunctionalTests/BulkUpdates/TPTInheritanceBulkUpdatesSqlServerTest.cs +++ b/test/EFCore.SqlServer.FunctionalTests/BulkUpdates/TPTInheritanceBulkUpdatesSqlServerTest.cs @@ -133,7 +133,7 @@ FROM [Animals] AS [a] LEFT JOIN [Birds] AS [b] ON [a].[Id] = [b].[Id] LEFT JOIN [Eagle] AS [e] ON [a].[Id] = [e].[Id] LEFT JOIN [Kiwi] AS [k] ON [a].[Id] = [k].[Id] - WHERE [c].[Id] = [a].[CountryId] AND ([k].[Id] IS NOT NULL) AND [a].[CountryId] > 0) > 0 + WHERE [c].[Id] = [a].[CountryId] AND [k].[Id] IS NOT NULL AND [a].[CountryId] > 0) > 0 """); } diff --git a/test/EFCore.SqlServer.FunctionalTests/Query/ComplexNavigationsCollectionsQuerySqlServerTest.cs b/test/EFCore.SqlServer.FunctionalTests/Query/ComplexNavigationsCollectionsQuerySqlServerTest.cs index 1ca2aa4195e..cffee89bb40 100644 --- a/test/EFCore.SqlServer.FunctionalTests/Query/ComplexNavigationsCollectionsQuerySqlServerTest.cs +++ b/test/EFCore.SqlServer.FunctionalTests/Query/ComplexNavigationsCollectionsQuerySqlServerTest.cs @@ -153,7 +153,7 @@ public override async Task Include_collection_with_conditional_order_by(bool asy FROM [LevelOne] AS [l] LEFT JOIN [LevelTwo] AS [l0] ON [l].[Id] = [l0].[OneToMany_Optional_Inverse2Id] ORDER BY CASE - WHEN ([l].[Name] IS NOT NULL) AND ([l].[Name] LIKE N'%03') THEN 1 + WHEN [l].[Name] IS NOT NULL AND [l].[Name] LIKE N'%03' THEN 1 ELSE 2 END, [l].[Id] """); @@ -192,7 +192,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] """); } @@ -281,7 +281,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] """); } @@ -529,7 +529,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] """); } @@ -600,7 +600,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] @@ -795,7 +795,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] @@ -1162,7 +1162,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] """); } @@ -1450,7 +1450,7 @@ LEFT JOIN ( FROM ( SELECT [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Name], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Optional_Self_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[OneToMany_Required_Self_Inverse3Id], [l1].[OneToOne_Optional_PK_Inverse3Id], [l1].[OneToOne_Optional_Self3Id], ROW_NUMBER() OVER(PARTITION BY [l1].[OneToMany_Optional_Inverse3Id] ORDER BY [l1].[Name]) AS [row] FROM [LevelThree] AS [l1] - WHERE [l1].[Name] <> N'Foo' OR ([l1].[Name] IS NULL) + WHERE [l1].[Name] <> N'Foo' OR [l1].[Name] IS NULL ) AS [t] WHERE 1 < [t].[row] AND [t].[row] <= 4 ) AS [t0] ON [l0].[Id] = [t0].[OneToMany_Optional_Inverse3Id] @@ -1472,7 +1472,7 @@ LEFT JOIN ( FROM ( SELECT [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Name], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Optional_Self_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[OneToMany_Required_Self_Inverse3Id], [l1].[OneToOne_Optional_PK_Inverse3Id], [l1].[OneToOne_Optional_Self3Id], ROW_NUMBER() OVER(PARTITION BY [l1].[OneToMany_Optional_Inverse3Id] ORDER BY [l1].[Name]) AS [row] FROM [LevelThree] AS [l1] - WHERE [l1].[Name] <> N'Foo' OR ([l1].[Name] IS NULL) + WHERE [l1].[Name] <> N'Foo' OR [l1].[Name] IS NULL ) AS [t] WHERE 1 < [t].[row] AND [t].[row] <= 4 ) AS [t0] ON [l0].[Id] = [t0].[OneToMany_Optional_Inverse3Id] @@ -1493,7 +1493,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] @@ -1502,7 +1502,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] @@ -1523,7 +1523,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 ( @@ -1531,7 +1531,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] @@ -1553,7 +1553,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] @@ -1574,7 +1574,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] @@ -1599,7 +1599,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] @@ -1622,7 +1622,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] @@ -1643,7 +1643,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] @@ -1664,7 +1664,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] @@ -1694,7 +1694,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] @@ -1721,7 +1721,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] @@ -1747,7 +1747,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] @@ -1846,7 +1846,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] @@ -1896,7 +1896,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] """); } @@ -2302,7 +2302,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 ( @@ -2310,7 +2310,7 @@ LEFT JOIN ( FROM ( SELECT [l1].[Id], [l1].[Date], [l1].[Name], [l1].[OneToMany_Optional_Self_Inverse1Id], [l1].[OneToMany_Required_Self_Inverse1Id], [l1].[OneToOne_Optional_Self1Id], ROW_NUMBER() OVER(PARTITION BY [l1].[Date] ORDER BY [l1].[Name]) AS [row] FROM [LevelOne] AS [l1] - WHERE [l1].[Name] = [l].[Name] OR (([l1].[Name] IS NULL) AND ([l].[Name] IS NULL)) + WHERE [l1].[Name] = [l].[Name] OR ([l1].[Name] IS NULL AND [l].[Name] IS NULL) ) AS [t1] WHERE 1 < [t1].[row] AND [t1].[row] <= 6 ) AS [t0] ON [t].[Date] = [t0].[Date] @@ -2418,7 +2418,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] @@ -2628,7 +2628,7 @@ FROM [LevelOne] AS [l] OUTER APPLY ( SELECT TOP(1) 1 AS [c], [l0].[Id] FROM [LevelTwo] AS [l0] - WHERE [l0].[Name] <> N'Foo' OR ([l0].[Name] IS NULL) + WHERE [l0].[Name] <> N'Foo' OR [l0].[Name] IS NULL ) AS [t] OUTER APPLY ( SELECT [l1].[Name], [l1].[Id] @@ -2682,7 +2682,7 @@ FROM [LevelOne] AS [l] OUTER APPLY ( SELECT [l1].[Id] AS [ChildId], [l0].[Name] AS [ParentName] FROM [LevelThree] AS [l1] - WHERE ([l0].[Id] IS NOT NULL) AND [l0].[Id] = [l1].[OneToMany_Optional_Inverse3Id] + WHERE [l0].[Id] IS NOT NULL AND [l0].[Id] = [l1].[OneToMany_Optional_Inverse3Id] ) AS [t] ORDER BY [l].[Id], [l0].[Id] """); @@ -2701,7 +2701,7 @@ FROM [LevelOne] AS [l] OUTER APPLY ( SELECT [l2].[Name] AS [Key], COUNT(*) AS [Count] FROM [LevelThree] AS [l2] - WHERE ([l0].[Id] IS NOT NULL) AND [l0].[Id] = [l2].[OneToMany_Optional_Inverse3Id] + WHERE [l0].[Id] IS NOT NULL AND [l0].[Id] = [l2].[OneToMany_Optional_Inverse3Id] GROUP BY [l2].[Name] ) AS [t] ORDER BY [l].[Id], [l0].[Id], [l1].[Id] @@ -2764,7 +2764,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] """); } @@ -2833,7 +2833,7 @@ LEFT JOIN ( FROM ( SELECT [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Name], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Optional_Self_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[OneToMany_Required_Self_Inverse3Id], [l1].[OneToOne_Optional_PK_Inverse3Id], [l1].[OneToOne_Optional_Self3Id], ROW_NUMBER() OVER(PARTITION BY [l1].[OneToMany_Optional_Inverse3Id] ORDER BY [l1].[Name]) AS [row] FROM [LevelThree] AS [l1] - WHERE [l1].[Name] <> N'Foo' OR ([l1].[Name] IS NULL) + WHERE [l1].[Name] <> N'Foo' OR [l1].[Name] IS NULL ) AS [t] WHERE 1 < [t].[row] AND [t].[row] <= 4 ) AS [t0] ON [l0].[Id] = [t0].[OneToMany_Optional_Inverse3Id] diff --git a/test/EFCore.SqlServer.FunctionalTests/Query/ComplexNavigationsCollectionsSharedTypeQuerySqlServerTest.cs b/test/EFCore.SqlServer.FunctionalTests/Query/ComplexNavigationsCollectionsSharedTypeQuerySqlServerTest.cs index b8a98df5351..dbcf023a517 100644 --- a/test/EFCore.SqlServer.FunctionalTests/Query/ComplexNavigationsCollectionsSharedTypeQuerySqlServerTest.cs +++ b/test/EFCore.SqlServer.FunctionalTests/Query/ComplexNavigationsCollectionsSharedTypeQuerySqlServerTest.cs @@ -33,11 +33,11 @@ FROM [Level1] AS [l0] LEFT JOIN ( SELECT [l1].[Id], [l1].[OneToOne_Required_PK_Date], [l1].[Level1_Required_Id], [l1].[Level2_Name], [l1].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l1] - WHERE ([l1].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l1].[Level1_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l1].[OneToOne_Required_PK_Date] IS NOT NULL AND [l1].[Level1_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] ON [l0].[Id] = CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] END - WHERE ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) AND ([t].[Level2_Name] <> N'Foo' OR ([t].[Level2_Name] IS NULL)) + WHERE [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL AND ([t].[Level2_Name] <> N'Foo' OR [t].[Level2_Name] IS NULL) ) AS [t0] OUTER APPLY ( SELECT [l2].[Name], [l2].[Id] @@ -45,8 +45,8 @@ FROM [Level1] AS [l2] WHERE EXISTS ( SELECT 1 FROM [Level1] AS [l3] - WHERE ([l3].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l3].[Level1_Required_Id] IS NOT NULL) AND ([l3].[OneToMany_Required_Inverse2Id] IS NOT NULL) AND [l2].[Id] = [l3].[OneToMany_Optional_Inverse2Id] AND [l3].[Id] = CASE - WHEN ([t0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t0].[Level1_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t0].[Id0] + WHERE [l3].[OneToOne_Required_PK_Date] IS NOT NULL AND [l3].[Level1_Required_Id] IS NOT NULL AND [l3].[OneToMany_Required_Inverse2Id] IS NOT NULL AND [l2].[Id] = [l3].[OneToMany_Optional_Inverse2Id] AND [l3].[Id] = CASE + WHEN [t0].[OneToOne_Required_PK_Date] IS NOT NULL AND [t0].[Level1_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t0].[Id0] END) ) AS [t1] ORDER BY [l].[Id], [t0].[Id], [t0].[Id0] @@ -64,14 +64,14 @@ FROM [Level1] AS [l] INNER JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[Level2_Name], [l0].[OneToMany_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id] FROM [Level1] AS [l0] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] ON [l].[Id] = [t].[OneToMany_Optional_Inverse2Id] LEFT JOIN ( SELECT [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Level3_Name], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[OneToOne_Optional_PK_Inverse3Id] FROM [Level1] AS [l1] - WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse3Id] IS NOT NULL) + WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL ) AS [t0] ON CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] END = [t0].[OneToMany_Optional_Inverse3Id] ORDER BY [l].[Id], [t].[Id] """); @@ -88,14 +88,14 @@ FROM [Level1] AS [l] INNER JOIN ( SELECT DISTINCT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[Level2_Name], [l0].[OneToMany_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id] FROM [Level1] AS [l0] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] ON [l].[Id] = [t].[OneToMany_Optional_Inverse2Id] LEFT JOIN ( SELECT [l1].[Id], [l1].[OneToOne_Required_PK_Date], [l1].[Level1_Optional_Id], [l1].[Level1_Required_Id], [l1].[Level2_Name], [l1].[OneToMany_Optional_Inverse2Id], [l1].[OneToMany_Required_Inverse2Id], [l1].[OneToOne_Optional_PK_Inverse2Id] FROM [Level1] AS [l1] - WHERE ([l1].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l1].[Level1_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l1].[OneToOne_Required_PK_Date] IS NOT NULL AND [l1].[Level1_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t0] ON [l].[Id] = [t0].[OneToMany_Optional_Inverse2Id] -WHERE ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) +WHERE [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL ORDER BY [l].[Id], [t].[Id] """); } @@ -116,16 +116,16 @@ ORDER BY [l].[Id] ) AS [t] OUTER APPLY ( SELECT CASE - WHEN ([t1].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t1].[Level1_Required_Id] IS NOT NULL) AND ([t1].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t1].[Id] + WHEN [t1].[OneToOne_Required_PK_Date] IS NOT NULL AND [t1].[Level1_Required_Id] IS NOT NULL AND [t1].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t1].[Id] END AS [Id], [t1].[Level2_Name] AS [Name], [t1].[OneToMany_Required_Inverse2Id] AS [Level1Id], [t1].[Level1_Required_Id] AS [Level2Id], [l0].[Id] AS [Id0], [l0].[Date], [l0].[Name] AS [Name0], [t1].[Id] AS [Id1], [t1].[c] FROM ( SELECT TOP(3) [l1].[Id], [l1].[OneToOne_Required_PK_Date], [l1].[Level1_Required_Id], [l1].[Level2_Name], [l1].[OneToMany_Required_Inverse2Id], CASE - WHEN ([l1].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l1].[Level1_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [l1].[Id] + WHEN [l1].[OneToOne_Required_PK_Date] IS NOT NULL AND [l1].[Level1_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [l1].[Id] END AS [c] FROM [Level1] AS [l1] - WHERE ([l1].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l1].[Level1_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse2Id] IS NOT NULL) AND [t].[Id] = [l1].[OneToMany_Required_Inverse2Id] + WHERE [l1].[OneToOne_Required_PK_Date] IS NOT NULL AND [l1].[Level1_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse2Id] IS NOT NULL AND [t].[Id] = [l1].[OneToMany_Required_Inverse2Id] ORDER BY CASE - WHEN ([l1].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l1].[Level1_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [l1].[Id] + WHEN [l1].[OneToOne_Required_PK_Date] IS NOT NULL AND [l1].[Level1_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [l1].[Id] END ) AS [t1] INNER JOIN [Level1] AS [l0] ON [t1].[Level1_Required_Id] = [l0].[Id] @@ -151,16 +151,16 @@ OFFSET @__p_0 ROWS FETCH NEXT @__p_0 ROWS ONLY ) AS [t] OUTER APPLY ( SELECT CASE - WHEN ([t1].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t1].[Level1_Required_Id] IS NOT NULL) AND ([t1].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t1].[Id] + WHEN [t1].[OneToOne_Required_PK_Date] IS NOT NULL AND [t1].[Level1_Required_Id] IS NOT NULL AND [t1].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t1].[Id] END AS [Id], [t1].[Level2_Name] AS [Name], [t1].[OneToMany_Required_Inverse2Id] AS [Level1Id], [t1].[Level1_Required_Id] AS [Level2Id], [l0].[Id] AS [Id0], [l0].[Date], [l0].[Name] AS [Name0], [t1].[Id] AS [Id1], [t1].[c] FROM ( SELECT [l1].[Id], [l1].[OneToOne_Required_PK_Date], [l1].[Level1_Required_Id], [l1].[Level2_Name], [l1].[OneToMany_Required_Inverse2Id], CASE - WHEN ([l1].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l1].[Level1_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [l1].[Id] + WHEN [l1].[OneToOne_Required_PK_Date] IS NOT NULL AND [l1].[Level1_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [l1].[Id] END AS [c] FROM [Level1] AS [l1] - WHERE ([l1].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l1].[Level1_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse2Id] IS NOT NULL) AND [t].[Id] = [l1].[OneToMany_Required_Inverse2Id] + WHERE [l1].[OneToOne_Required_PK_Date] IS NOT NULL AND [l1].[Level1_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse2Id] IS NOT NULL AND [t].[Id] = [l1].[OneToMany_Required_Inverse2Id] ORDER BY CASE - WHEN ([l1].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l1].[Level1_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [l1].[Id] + WHEN [l1].[OneToOne_Required_PK_Date] IS NOT NULL AND [l1].[Level1_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [l1].[Id] END OFFSET 1 ROWS FETCH NEXT 3 ROWS ONLY ) AS [t1] @@ -182,14 +182,14 @@ LEFT JOIN ( SELECT [t].[Id], [t].[OneToOne_Required_PK_Date], [t].[Level1_Optional_Id], [t].[Level1_Required_Id], [t].[Level2_Name], [t].[OneToMany_Optional_Inverse2Id], [t].[OneToMany_Required_Inverse2Id], [t].[OneToOne_Optional_PK_Inverse2Id] FROM ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[Level2_Name], [l0].[OneToMany_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id], ROW_NUMBER() OVER(PARTITION BY [l0].[OneToMany_Optional_Inverse2Id], CASE - WHEN ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [l0].[Id] + WHEN [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [l0].[Id] END ORDER BY [l0].[Id]) AS [row] FROM [Level1] AS [l0] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] WHERE [t].[row] <= 1 ) AS [t0] ON [l].[Id] = [t0].[OneToMany_Optional_Inverse2Id] AND [l].[Id] = CASE - WHEN ([t0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t0].[Level1_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t0].[Id] + WHEN [t0].[OneToOne_Required_PK_Date] IS NOT NULL AND [t0].[Level1_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t0].[Id] END """); } @@ -206,12 +206,12 @@ LEFT JOIN ( SELECT [t].[Id], [t].[OneToOne_Required_PK_Date], [t].[Level1_Optional_Id], [t].[Level1_Required_Id], [t].[Level2_Name], [t].[OneToMany_Optional_Inverse2Id], [t].[OneToMany_Required_Inverse2Id], [t].[OneToOne_Optional_PK_Inverse2Id], [t].[c] FROM ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[Level2_Name], [l0].[OneToMany_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id], ROW_NUMBER() OVER(PARTITION BY [l0].[OneToMany_Optional_Inverse2Id] ORDER BY CASE - WHEN ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [l0].[Id] + WHEN [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [l0].[Id] END DESC) AS [row], CASE - WHEN ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [l0].[Id] + WHEN [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [l0].[Id] END AS [c] FROM [Level1] AS [l0] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) AND ([l0].[Level2_Name] <> N'Foo' OR ([l0].[Level2_Name] IS NULL)) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL AND ([l0].[Level2_Name] <> N'Foo' OR [l0].[Level2_Name] IS NULL) ) AS [t] WHERE [t].[row] <= 2 ) AS [t0] ON [l].[Id] = [t0].[OneToMany_Optional_Inverse2Id] @@ -230,7 +230,7 @@ FROM [Level1] AS [l] LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[Level2_Name], [l0].[OneToMany_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id] FROM [Level1] AS [l0] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) AND [l0].[Id] > 5 + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL AND [l0].[Id] > 5 ) AS [t] ON [l].[Id] = [t].[OneToMany_Optional_Inverse2Id] ORDER BY [l].[Id] """); @@ -247,14 +247,14 @@ FROM [Level1] AS [l] LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[Level2_Name], [l0].[OneToMany_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id] FROM [Level1] AS [l0] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] ON [l].[Id] = [t].[Level1_Optional_Id] LEFT JOIN ( SELECT [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Level3_Name], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[OneToOne_Optional_PK_Inverse3Id] FROM [Level1] AS [l1] - WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse3Id] IS NOT NULL) + WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL ) AS [t0] ON CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] END = [t0].[OneToMany_Optional_Inverse3Id] ORDER BY [t].[Level2_Name], [l].[Id], [t].[Id] """); @@ -273,7 +273,7 @@ LEFT JOIN ( FROM ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[Level2_Name], [l0].[OneToMany_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id], ROW_NUMBER() OVER(PARTITION BY [l0].[OneToMany_Optional_Inverse2Id] ORDER BY [l0].[Level2_Name]) AS [row] FROM [Level1] AS [l0] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] WHERE 1 < [t].[row] ) AS [t0] ON [l].[Id] = [t0].[OneToMany_Optional_Inverse2Id] @@ -292,42 +292,42 @@ FROM [Level1] AS [l] LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[Level2_Name], [l0].[OneToMany_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id] FROM [Level1] AS [l0] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] ON [l].[Id] = [t].[Level1_Required_Id] LEFT JOIN ( SELECT [l1].[Id], [l1].[Level3_Name], [l1].[OneToOne_Optional_PK_Inverse3Id] FROM [Level1] AS [l1] - WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse3Id] IS NOT NULL) + WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL ) AS [t0] ON CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] END = [t0].[OneToOne_Optional_PK_Inverse3Id] LEFT JOIN ( SELECT [l2].[Id], [l2].[Level2_Optional_Id], [l2].[Level2_Required_Id], [l2].[Level3_Name], [l2].[OneToMany_Optional_Inverse3Id], [l2].[OneToMany_Required_Inverse3Id], [l2].[OneToOne_Optional_PK_Inverse3Id] FROM [Level1] AS [l2] - WHERE ([l2].[Level2_Required_Id] IS NOT NULL) AND ([l2].[OneToMany_Required_Inverse3Id] IS NOT NULL) + WHERE [l2].[Level2_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse3Id] IS NOT NULL ) AS [t1] ON CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] END = [t1].[Level2_Optional_Id] LEFT JOIN ( SELECT [l3].[Id], [l3].[OneToOne_Required_PK_Date], [l3].[Level1_Optional_Id], [l3].[Level1_Required_Id], [l3].[Level2_Name], [l3].[OneToMany_Optional_Inverse2Id], [l3].[OneToMany_Required_Inverse2Id], [l3].[OneToOne_Optional_PK_Inverse2Id] FROM [Level1] AS [l3] - WHERE ([l3].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l3].[Level1_Required_Id] IS NOT NULL) AND ([l3].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l3].[OneToOne_Required_PK_Date] IS NOT NULL AND [l3].[Level1_Required_Id] IS NOT NULL AND [l3].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t2] ON [l].[Id] = [t2].[Level1_Optional_Id] LEFT JOIN ( SELECT [l4].[Id], [l4].[Level2_Optional_Id], [l4].[Level2_Required_Id], [l4].[Level3_Name], [l4].[OneToMany_Optional_Inverse3Id], [l4].[OneToMany_Required_Inverse3Id], [l4].[OneToOne_Optional_PK_Inverse3Id] FROM [Level1] AS [l4] - WHERE ([l4].[Level2_Required_Id] IS NOT NULL) AND ([l4].[OneToMany_Required_Inverse3Id] IS NOT NULL) + WHERE [l4].[Level2_Required_Id] IS NOT NULL AND [l4].[OneToMany_Required_Inverse3Id] IS NOT NULL ) AS [t3] ON CASE - WHEN ([t2].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t2].[Level1_Required_Id] IS NOT NULL) AND ([t2].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t2].[Id] + WHEN [t2].[OneToOne_Required_PK_Date] IS NOT NULL AND [t2].[Level1_Required_Id] IS NOT NULL AND [t2].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t2].[Id] END = [t3].[Level2_Optional_Id] LEFT JOIN ( SELECT [l5].[Id], [l5].[Level2_Optional_Id], [l5].[Level2_Required_Id], [l5].[Level3_Name], [l5].[OneToMany_Optional_Inverse3Id], [l5].[OneToMany_Required_Inverse3Id], [l5].[OneToOne_Optional_PK_Inverse3Id] FROM [Level1] AS [l5] - WHERE ([l5].[Level2_Required_Id] IS NOT NULL) AND ([l5].[OneToMany_Required_Inverse3Id] IS NOT NULL) + WHERE [l5].[Level2_Required_Id] IS NOT NULL AND [l5].[OneToMany_Required_Inverse3Id] IS NOT NULL ) AS [t4] ON CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] END = [t4].[OneToMany_Optional_Inverse3Id] -WHERE [t0].[Level3_Name] <> N'Foo' OR ([t0].[Level3_Name] IS NULL) +WHERE [t0].[Level3_Name] <> N'Foo' OR [t0].[Level3_Name] IS NULL ORDER BY [l].[Id], [t].[Id], [t0].[Id], [t1].[Id], [t2].[Id], [t3].[Id] """); } @@ -351,15 +351,15 @@ OUTER APPLY ( FROM ( SELECT TOP(4) [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[Level2_Name], [l0].[OneToMany_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id] FROM [Level1] AS [l0] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) AND [t].[Id] = [l0].[OneToMany_Optional_Inverse2Id] + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL AND [t].[Id] = [l0].[OneToMany_Optional_Inverse2Id] ORDER BY [l0].[Level2_Name] DESC ) AS [t0] LEFT JOIN ( SELECT [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Level3_Name], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[OneToOne_Optional_PK_Inverse3Id] FROM [Level1] AS [l1] - WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse3Id] IS NOT NULL) + WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL ) AS [t2] ON CASE - WHEN ([t0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t0].[Level1_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t0].[Id] + WHEN [t0].[OneToOne_Required_PK_Date] IS NOT NULL AND [t0].[Level1_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t0].[Id] END = [t2].[Level2_Optional_Id] ) AS [t1] ORDER BY [t].[Id], [t1].[Level2_Name] DESC, [t1].[Id] @@ -379,7 +379,7 @@ OUTER APPLY ( FROM ( SELECT TOP(3) [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[Level2_Name], [l0].[OneToMany_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id] FROM [Level1] AS [l0] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) AND [l].[Id] = [l0].[OneToMany_Optional_Inverse2Id] AND ([l0].[Level2_Name] <> N'Foo' OR ([l0].[Level2_Name] IS NULL)) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL AND [l].[Id] = [l0].[OneToMany_Optional_Inverse2Id] AND ([l0].[Level2_Name] <> N'Foo' OR [l0].[Level2_Name] IS NULL) ORDER BY [l0].[Level2_Name] ) AS [t] LEFT JOIN ( @@ -387,11 +387,11 @@ LEFT JOIN ( FROM ( SELECT [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Level3_Name], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[OneToOne_Optional_PK_Inverse3Id], ROW_NUMBER() OVER(PARTITION BY [l1].[OneToMany_Required_Inverse3Id] ORDER BY [l1].[Level3_Name] DESC) AS [row] FROM [Level1] AS [l1] - WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse3Id] IS NOT NULL) AND ([l1].[Level3_Name] <> N'Bar' OR ([l1].[Level3_Name] IS NULL)) + WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL AND ([l1].[Level3_Name] <> N'Bar' OR [l1].[Level3_Name] IS NULL) ) AS [t1] WHERE 1 < [t1].[row] ) AS [t0] ON CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] END = [t0].[OneToMany_Required_Inverse3Id] ) AS [t2] ORDER BY [l].[Id], [t2].[Level2_Name], [t2].[Id], [t2].[OneToMany_Required_Inverse3Id], [t2].[Level3_Name] DESC @@ -409,7 +409,7 @@ FROM [Level1] AS [l] LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[Level2_Name], [l0].[OneToMany_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id] FROM [Level1] AS [l0] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) AND ([l0].[Level2_Name] <> N'Foo' OR ([l0].[Level2_Name] IS NULL)) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL AND ([l0].[Level2_Name] <> N'Foo' OR [l0].[Level2_Name] IS NULL) ) AS [t] ON [l].[Id] = [t].[OneToMany_Optional_Inverse2Id] WHERE [l].[Id] < 3 ORDER BY [l].[Id] @@ -429,7 +429,7 @@ LEFT JOIN ( FROM ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[Level2_Name], [l0].[OneToMany_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id], ROW_NUMBER() OVER(PARTITION BY [l0].[OneToMany_Optional_Inverse2Id] ORDER BY [l0].[Level2_Name]) AS [row] FROM [Level1] AS [l0] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] WHERE 1 < [t].[row] AND [t].[row] <= 4 ) AS [t0] ON [l].[Id] = [t0].[OneToMany_Optional_Inverse2Id] @@ -448,18 +448,18 @@ FROM [Level1] AS [l] LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[Level2_Name], [l0].[OneToMany_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id] FROM [Level1] AS [l0] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] ON [l].[Id] = [t].[Level1_Optional_Id] LEFT JOIN ( SELECT [t1].[Id], [t1].[Level2_Optional_Id], [t1].[Level2_Required_Id], [t1].[Level3_Name], [t1].[OneToMany_Optional_Inverse3Id], [t1].[OneToMany_Required_Inverse3Id], [t1].[OneToOne_Optional_PK_Inverse3Id] FROM ( SELECT [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Level3_Name], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[OneToOne_Optional_PK_Inverse3Id], ROW_NUMBER() OVER(PARTITION BY [l1].[OneToMany_Optional_Inverse3Id] ORDER BY [l1].[Level3_Name]) AS [row] FROM [Level1] AS [l1] - WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse3Id] IS NOT NULL) AND ([l1].[Level3_Name] <> N'Foo' OR ([l1].[Level3_Name] IS NULL)) + WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL AND ([l1].[Level3_Name] <> N'Foo' OR [l1].[Level3_Name] IS NULL) ) AS [t1] WHERE 1 < [t1].[row] AND [t1].[row] <= 4 ) AS [t0] ON CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] END = [t0].[OneToMany_Optional_Inverse3Id] ORDER BY [l].[Id], [t].[Id], [t0].[OneToMany_Optional_Inverse3Id], [t0].[Level3_Name] """); @@ -476,10 +476,10 @@ FROM [Level1] AS [l] LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[Level2_Name], [l0].[OneToMany_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id] FROM [Level1] AS [l0] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] ON [l].[Id] = [t].[OneToMany_Optional_Inverse2Id] ORDER BY CASE - WHEN ([l].[Name] IS NOT NULL) AND ([l].[Name] LIKE N'%03') THEN 1 + WHEN [l].[Name] IS NOT NULL AND [l].[Name] LIKE N'%03' THEN 1 ELSE 2 END, [l].[Id] """); @@ -496,7 +496,7 @@ FROM [Level1] AS [l] LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[Level2_Name], [l0].[OneToMany_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id] FROM [Level1] AS [l0] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] ON [l].[Id] = [t].[Level1_Optional_Id] LEFT JOIN ( SELECT [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Level3_Name], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[OneToOne_Optional_PK_Inverse3Id], [t1].[Id] AS [Id0], [t1].[Level3_Optional_Id], [t1].[Level3_Required_Id], [t1].[Level4_Name], [t1].[OneToMany_Optional_Inverse4Id], [t1].[OneToMany_Required_Inverse4Id], [t1].[OneToOne_Optional_PK_Inverse4Id] @@ -504,15 +504,15 @@ FROM [Level1] AS [l1] LEFT JOIN ( SELECT [l2].[Id], [l2].[Level3_Optional_Id], [l2].[Level3_Required_Id], [l2].[Level4_Name], [l2].[OneToMany_Optional_Inverse4Id], [l2].[OneToMany_Required_Inverse4Id], [l2].[OneToOne_Optional_PK_Inverse4Id] FROM [Level1] AS [l2] - WHERE ([l2].[Level3_Required_Id] IS NOT NULL) AND ([l2].[OneToMany_Required_Inverse4Id] IS NOT NULL) + WHERE [l2].[Level3_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse4Id] IS NOT NULL ) AS [t1] ON CASE - WHEN ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [l1].[Id] + WHEN [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [l1].[Id] END = [t1].[Level3_Required_Id] - WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse3Id] IS NOT NULL) + WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL ) AS [t0] ON CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] END = [t0].[OneToMany_Required_Inverse3Id] -WHERE [t].[Level2_Name] <> N'L2 09' OR ([t].[Level2_Name] IS NULL) +WHERE [t].[Level2_Name] <> N'L2 09' OR [t].[Level2_Name] IS NULL ORDER BY [l].[Id], [t].[Id], [t0].[Id] """); } @@ -536,26 +536,26 @@ OFFSET @__p_0 ROWS FETCH NEXT @__p_1 ROWS ONLY LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[Level2_Name], [l0].[OneToMany_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id] FROM [Level1] AS [l0] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t0] ON [t].[Id] = [t0].[Level1_Optional_Id] LEFT JOIN ( SELECT [l1].[Id], [l1].[OneToOne_Required_PK_Date], [l1].[Level1_Optional_Id], [l1].[Level1_Required_Id], [l1].[Level2_Name], [l1].[OneToMany_Optional_Inverse2Id], [l1].[OneToMany_Required_Inverse2Id], [l1].[OneToOne_Optional_PK_Inverse2Id] FROM [Level1] AS [l1] - WHERE ([l1].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l1].[Level1_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l1].[OneToOne_Required_PK_Date] IS NOT NULL AND [l1].[Level1_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t1] ON [t].[Id] = [t1].[Level1_Required_Id] LEFT JOIN ( SELECT [l2].[Id], [l2].[Level2_Optional_Id], [l2].[Level2_Required_Id], [l2].[Level3_Name], [l2].[OneToMany_Optional_Inverse3Id], [l2].[OneToMany_Required_Inverse3Id], [l2].[OneToOne_Optional_PK_Inverse3Id] FROM [Level1] AS [l2] - WHERE ([l2].[Level2_Required_Id] IS NOT NULL) AND ([l2].[OneToMany_Required_Inverse3Id] IS NOT NULL) + WHERE [l2].[Level2_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse3Id] IS NOT NULL ) AS [t2] ON CASE - WHEN ([t0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t0].[Level1_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t0].[Id] + WHEN [t0].[OneToOne_Required_PK_Date] IS NOT NULL AND [t0].[Level1_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t0].[Id] END = [t2].[OneToMany_Optional_Inverse3Id] LEFT JOIN ( SELECT [l3].[Id], [l3].[Level2_Optional_Id], [l3].[Level2_Required_Id], [l3].[Level3_Name], [l3].[OneToMany_Optional_Inverse3Id], [l3].[OneToMany_Required_Inverse3Id], [l3].[OneToOne_Optional_PK_Inverse3Id] FROM [Level1] AS [l3] - WHERE ([l3].[Level2_Required_Id] IS NOT NULL) AND ([l3].[OneToMany_Required_Inverse3Id] IS NOT NULL) + WHERE [l3].[Level2_Required_Id] IS NOT NULL AND [l3].[OneToMany_Required_Inverse3Id] IS NOT NULL ) AS [t3] ON CASE - WHEN ([t1].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t1].[Level1_Required_Id] IS NOT NULL) AND ([t1].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t1].[Id] + WHEN [t1].[OneToOne_Required_PK_Date] IS NOT NULL AND [t1].[Level1_Required_Id] IS NOT NULL AND [t1].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t1].[Id] END = [t3].[OneToMany_Required_Inverse3Id] ORDER BY [t].[Name], [t].[Id], [t0].[Id], [t1].[Id], [t2].[Id] """); @@ -571,32 +571,32 @@ public override async Task Select_subquery_single_nested_subquery2(bool async) FROM [Level1] AS [l] LEFT JOIN ( SELECT [l0].[Id], [t0].[Id] AS [Id0], [t1].[Id] AS [Id1], [t1].[Id0] AS [Id00], [t0].[c], CASE - WHEN ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [l0].[Id] + WHEN [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [l0].[Id] END AS [c0], [l0].[OneToMany_Optional_Inverse2Id] FROM [Level1] AS [l0] LEFT JOIN ( SELECT [t].[c], [t].[Id], [t].[Level2_Required_Id], [t].[OneToMany_Required_Inverse3Id], [t].[OneToMany_Optional_Inverse3Id] FROM ( SELECT 1 AS [c], [l1].[Id], [l1].[Level2_Required_Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[OneToMany_Optional_Inverse3Id], ROW_NUMBER() OVER(PARTITION BY [l1].[OneToMany_Optional_Inverse3Id] ORDER BY CASE - WHEN ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [l1].[Id] + WHEN [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [l1].[Id] END) AS [row] FROM [Level1] AS [l1] - WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse3Id] IS NOT NULL) + WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL ) AS [t] WHERE [t].[row] <= 1 ) AS [t0] ON CASE - WHEN ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [l0].[Id] + WHEN [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [l0].[Id] END = [t0].[OneToMany_Optional_Inverse3Id] LEFT JOIN ( SELECT CASE - WHEN ([l2].[Level3_Required_Id] IS NOT NULL) AND ([l2].[OneToMany_Required_Inverse4Id] IS NOT NULL) THEN [l2].[Id] + WHEN [l2].[Level3_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse4Id] IS NOT NULL THEN [l2].[Id] END AS [Id], [l2].[Id] AS [Id0], [l2].[OneToMany_Optional_Inverse4Id] FROM [Level1] AS [l2] - WHERE ([l2].[Level3_Required_Id] IS NOT NULL) AND ([l2].[OneToMany_Required_Inverse4Id] IS NOT NULL) + WHERE [l2].[Level3_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse4Id] IS NOT NULL ) AS [t1] ON CASE - WHEN ([t0].[Level2_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [t0].[Id] + WHEN [t0].[Level2_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [t0].[Id] END = [t1].[OneToMany_Optional_Inverse4Id] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t2] ON [l].[Id] = [t2].[OneToMany_Optional_Inverse2Id] ORDER BY [l].[Id], [t2].[c0], [t2].[Id], [t2].[Id0], [t2].[Id1] """); @@ -613,14 +613,14 @@ FROM [Level1] AS [l] INNER JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[Level2_Name], [l0].[OneToMany_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id] FROM [Level1] AS [l0] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] ON [l].[Id] = [t].[OneToMany_Optional_Inverse2Id] LEFT JOIN ( SELECT [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Level3_Name], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[OneToOne_Optional_PK_Inverse3Id] FROM [Level1] AS [l1] - WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse3Id] IS NOT NULL) + WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL ) AS [t0] ON CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] END = [t0].[OneToMany_Optional_Inverse3Id] ORDER BY [t].[Level2_Name], [l].[Id], [t].[Id] """); @@ -637,14 +637,14 @@ FROM [Level1] AS [l] LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[Level2_Name], [l0].[OneToMany_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id] FROM [Level1] AS [l0] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] ON [l].[Id] = [t].[Level1_Optional_Id] LEFT JOIN ( SELECT [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Level3_Name], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[OneToOne_Optional_PK_Inverse3Id] FROM [Level1] AS [l1] - WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse3Id] IS NOT NULL) + WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL ) AS [t0] ON CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] END = [t0].[OneToMany_Optional_Inverse3Id] LEFT JOIN ( SELECT [l2].[Id], [l2].[OneToOne_Required_PK_Date], [l2].[Level1_Optional_Id], [l2].[Level1_Required_Id], [l2].[Level2_Name], [l2].[OneToMany_Optional_Inverse2Id], [l2].[OneToMany_Required_Inverse2Id], [l2].[OneToOne_Optional_PK_Inverse2Id], [t2].[Id] AS [Id0], [t2].[Level2_Optional_Id], [t2].[Level2_Required_Id], [t2].[Level3_Name], [t2].[OneToMany_Optional_Inverse3Id], [t2].[OneToMany_Required_Inverse3Id], [t2].[OneToOne_Optional_PK_Inverse3Id] @@ -652,11 +652,11 @@ FROM [Level1] AS [l2] LEFT JOIN ( SELECT [l3].[Id], [l3].[Level2_Optional_Id], [l3].[Level2_Required_Id], [l3].[Level3_Name], [l3].[OneToMany_Optional_Inverse3Id], [l3].[OneToMany_Required_Inverse3Id], [l3].[OneToOne_Optional_PK_Inverse3Id] FROM [Level1] AS [l3] - WHERE ([l3].[Level2_Required_Id] IS NOT NULL) AND ([l3].[OneToMany_Required_Inverse3Id] IS NOT NULL) + WHERE [l3].[Level2_Required_Id] IS NOT NULL AND [l3].[OneToMany_Required_Inverse3Id] IS NOT NULL ) AS [t2] ON CASE - WHEN ([l2].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l2].[Level1_Required_Id] IS NOT NULL) AND ([l2].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [l2].[Id] + WHEN [l2].[OneToOne_Required_PK_Date] IS NOT NULL AND [l2].[Level1_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [l2].[Id] END = [t2].[Level2_Optional_Id] - WHERE ([l2].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l2].[Level1_Required_Id] IS NOT NULL) AND ([l2].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l2].[OneToOne_Required_PK_Date] IS NOT NULL AND [l2].[Level1_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t1] ON [l].[Id] = [t1].[OneToMany_Optional_Inverse2Id] ORDER BY [l].[Id], [t].[Id], [t0].[Id], [t1].[Id] """); @@ -676,11 +676,11 @@ FROM [Level1] AS [l0] LEFT JOIN ( SELECT [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Level3_Name], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[OneToOne_Optional_PK_Inverse3Id] FROM [Level1] AS [l1] - WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse3Id] IS NOT NULL) + WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL ) AS [t] ON CASE - WHEN ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [l0].[Id] + WHEN [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [l0].[Id] END = [t].[Level2_Optional_Id] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t0] ON [l].[Id] = [t0].[OneToMany_Optional_Inverse2Id] ORDER BY [l].[Id], [t0].[Id] """); @@ -697,14 +697,14 @@ FROM [Level1] AS [l] LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[Level2_Name], [l0].[OneToMany_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id] FROM [Level1] AS [l0] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] ON [l].[Id] = [t].[Level1_Optional_Id] LEFT JOIN ( SELECT [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Level3_Name], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[OneToOne_Optional_PK_Inverse3Id] FROM [Level1] AS [l1] - WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse3Id] IS NOT NULL) + WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL ) AS [t0] ON CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] END = [t0].[OneToMany_Optional_Inverse3Id] ORDER BY [l].[Id], [t].[Id] """); @@ -721,21 +721,21 @@ FROM [Level1] AS [l] LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l0] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] ON [l].[Id] = [t].[Level1_Optional_Id] LEFT JOIN ( SELECT [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Level3_Name], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[OneToOne_Optional_PK_Inverse3Id] FROM [Level1] AS [l1] - WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse3Id] IS NOT NULL) + WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL ) AS [t0] ON CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] END = [t0].[OneToOne_Optional_PK_Inverse3Id] LEFT JOIN ( SELECT [l2].[Id], [l2].[Level3_Optional_Id], [l2].[Level3_Required_Id], [l2].[Level4_Name], [l2].[OneToMany_Optional_Inverse4Id], [l2].[OneToMany_Required_Inverse4Id], [l2].[OneToOne_Optional_PK_Inverse4Id] FROM [Level1] AS [l2] - WHERE ([l2].[Level3_Required_Id] IS NOT NULL) AND ([l2].[OneToMany_Required_Inverse4Id] IS NOT NULL) + WHERE [l2].[Level3_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse4Id] IS NOT NULL ) AS [t1] ON CASE - WHEN ([t0].[Level2_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [t0].[Id] + WHEN [t0].[Level2_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [t0].[Id] END = [t1].[OneToMany_Optional_Inverse4Id] ORDER BY [l].[Id], [t].[Id], [t0].[Id] """); @@ -752,21 +752,21 @@ FROM [Level1] AS [l] INNER JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[Level2_Name], [l0].[OneToMany_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id] FROM [Level1] AS [l0] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] ON [l].[Id] = [t].[OneToMany_Optional_Inverse2Id] LEFT JOIN ( SELECT [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Level3_Name], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[OneToOne_Optional_PK_Inverse3Id] FROM [Level1] AS [l1] - WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse3Id] IS NOT NULL) + WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL ) AS [t0] ON CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] END = [t0].[OneToMany_Required_Inverse3Id] LEFT JOIN ( SELECT [l2].[Id], [l2].[Level2_Optional_Id], [l2].[Level2_Required_Id], [l2].[Level3_Name], [l2].[OneToMany_Optional_Inverse3Id], [l2].[OneToMany_Required_Inverse3Id], [l2].[OneToOne_Optional_PK_Inverse3Id] FROM [Level1] AS [l2] - WHERE ([l2].[Level2_Required_Id] IS NOT NULL) AND ([l2].[OneToMany_Required_Inverse3Id] IS NOT NULL) + WHERE [l2].[Level2_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse3Id] IS NOT NULL ) AS [t1] ON CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] END = [t1].[OneToMany_Optional_Inverse3Id] ORDER BY [l].[Id], [t].[Id], [t0].[Id] """); @@ -783,21 +783,21 @@ FROM [Level1] AS [l] INNER JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[Level2_Name], [l0].[OneToMany_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id] FROM [Level1] AS [l0] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] ON [l].[Id] = [t].[OneToMany_Optional_Inverse2Id] LEFT JOIN ( SELECT [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Level3_Name], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[OneToOne_Optional_PK_Inverse3Id] FROM [Level1] AS [l1] - WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse3Id] IS NOT NULL) + WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL ) AS [t0] ON CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] END = [t0].[Level2_Required_Id] LEFT JOIN ( SELECT [l2].[Id], [l2].[Level3_Optional_Id], [l2].[Level3_Required_Id], [l2].[Level4_Name], [l2].[OneToMany_Optional_Inverse4Id], [l2].[OneToMany_Required_Inverse4Id], [l2].[OneToOne_Optional_PK_Inverse4Id] FROM [Level1] AS [l2] - WHERE ([l2].[Level3_Required_Id] IS NOT NULL) AND ([l2].[OneToMany_Required_Inverse4Id] IS NOT NULL) + WHERE [l2].[Level3_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse4Id] IS NOT NULL ) AS [t1] ON CASE - WHEN ([t0].[Level2_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [t0].[Id] + WHEN [t0].[Level2_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [t0].[Id] END = [t1].[OneToMany_Optional_Inverse4Id] ORDER BY [l].[Id], [t].[Id], [t0].[Id] """); @@ -815,12 +815,12 @@ LEFT JOIN ( SELECT [t].[Id], [t].[OneToOne_Required_PK_Date], [t].[Level1_Optional_Id], [t].[Level1_Required_Id], [t].[Level2_Name], [t].[OneToMany_Optional_Inverse2Id], [t].[OneToMany_Required_Inverse2Id], [t].[OneToOne_Optional_PK_Inverse2Id], [t].[c] FROM ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[Level2_Name], [l0].[OneToMany_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id], ROW_NUMBER() OVER(PARTITION BY [l0].[OneToMany_Optional_Inverse2Id] ORDER BY CASE - WHEN ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [l0].[Id] + WHEN [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [l0].[Id] END) AS [row], CASE - WHEN ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [l0].[Id] + WHEN [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [l0].[Id] END AS [c] FROM [Level1] AS [l0] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) AND ([l0].[Level2_Name] <> N'Foo' OR ([l0].[Level2_Name] IS NULL)) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL AND ([l0].[Level2_Name] <> N'Foo' OR [l0].[Level2_Name] IS NULL) ) AS [t] WHERE [t].[row] <= 3 ) AS [t0] ON [l].[Id] = [t0].[OneToMany_Optional_Inverse2Id] @@ -847,22 +847,22 @@ FROM [Level1] AS [l1] INNER JOIN ( SELECT [l2].[Id], [l2].[OneToOne_Required_PK_Date], [l2].[Level1_Optional_Id], [l2].[Level1_Required_Id], [l2].[Level2_Name], [l2].[OneToMany_Optional_Inverse2Id], [l2].[OneToMany_Required_Inverse2Id], [l2].[OneToOne_Optional_PK_Inverse2Id] FROM [Level1] AS [l2] - WHERE ([l2].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l2].[Level1_Required_Id] IS NOT NULL) AND ([l2].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l2].[OneToOne_Required_PK_Date] IS NOT NULL AND [l2].[Level1_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] ON [l1].[OneToMany_Required_Inverse3Id] = CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] END LEFT JOIN ( SELECT [l3].[Id], [l3].[Level2_Optional_Id], [l3].[Level2_Required_Id], [l3].[Level3_Name], [l3].[OneToMany_Optional_Inverse3Id], [l3].[OneToMany_Required_Inverse3Id], [l3].[OneToOne_Optional_PK_Inverse3Id] FROM [Level1] AS [l3] - WHERE ([l3].[Level2_Required_Id] IS NOT NULL) AND ([l3].[OneToMany_Required_Inverse3Id] IS NOT NULL) + WHERE [l3].[Level2_Required_Id] IS NOT NULL AND [l3].[OneToMany_Required_Inverse3Id] IS NOT NULL ) AS [t0] ON CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] END = [t0].[OneToMany_Optional_Inverse3Id] - WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse3Id] IS NOT NULL) + WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL ) AS [t1] ON CASE - WHEN ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [l0].[Id] + WHEN [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [l0].[Id] END = [t1].[OneToMany_Optional_Inverse3Id] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t2] ON [l].[Id] = [t2].[OneToMany_Optional_Inverse2Id] ORDER BY [l].[Id], [t2].[Id], [t2].[Id0], [t2].[Id00] """); @@ -879,14 +879,14 @@ FROM [Level1] AS [l] INNER JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[Level2_Name], [l0].[OneToMany_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id] FROM [Level1] AS [l0] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] ON [l].[Id] = [t].[OneToMany_Required_Inverse2Id] LEFT JOIN ( SELECT [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Level3_Name], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[OneToOne_Optional_PK_Inverse3Id] FROM [Level1] AS [l1] - WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse3Id] IS NOT NULL) + WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL ) AS [t0] ON CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] END = [t0].[OneToMany_Optional_Inverse3Id] ORDER BY [l].[Id], [t].[Id] """); @@ -904,12 +904,12 @@ LEFT JOIN ( SELECT [t].[Id], [t].[OneToOne_Required_PK_Date], [t].[Level1_Optional_Id], [t].[Level1_Required_Id], [t].[Level2_Name], [t].[OneToMany_Optional_Inverse2Id], [t].[OneToMany_Required_Inverse2Id], [t].[OneToOne_Optional_PK_Inverse2Id], [t].[c] FROM ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[Level2_Name], [l0].[OneToMany_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id], ROW_NUMBER() OVER(PARTITION BY [l0].[OneToMany_Optional_Inverse2Id] ORDER BY CASE - WHEN ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [l0].[Id] + WHEN [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [l0].[Id] END) AS [row], CASE - WHEN ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [l0].[Id] + WHEN [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [l0].[Id] END AS [c] FROM [Level1] AS [l0] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) AND ( + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL AND ( SELECT COUNT(*) FROM [Level1] AS [l1] WHERE [l1].[Id] <> [l0].[Id]) > 1 @@ -955,14 +955,14 @@ FROM [Level1] AS [l] INNER JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[Level2_Name], [l0].[OneToMany_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id] FROM [Level1] AS [l0] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] ON [l].[Id] = [t].[OneToMany_Optional_Inverse2Id] LEFT JOIN ( SELECT [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Level3_Name], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[OneToOne_Optional_PK_Inverse3Id] FROM [Level1] AS [l1] - WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse3Id] IS NOT NULL) + WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL ) AS [t0] ON CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] END = [t0].[Level2_Required_Id] """); } @@ -979,27 +979,27 @@ OUTER APPLY ( SELECT [t].[Id], [t].[OneToOne_Required_PK_Date], [t].[Level1_Optional_Id], [t].[Level1_Required_Id], [t].[Level2_Name], [t].[OneToMany_Optional_Inverse2Id], [t].[OneToMany_Required_Inverse2Id], [t].[OneToOne_Optional_PK_Inverse2Id], [t0].[Id] AS [Id0], [t0].[Level2_Optional_Id], [t0].[Level2_Required_Id], [t0].[Level3_Name], [t0].[OneToMany_Optional_Inverse3Id], [t0].[OneToMany_Required_Inverse3Id], [t0].[OneToOne_Optional_PK_Inverse3Id], [t1].[Id] AS [Id1], [t1].[Level3_Optional_Id], [t1].[Level3_Required_Id], [t1].[Level4_Name], [t1].[OneToMany_Optional_Inverse4Id], [t1].[OneToMany_Required_Inverse4Id], [t1].[OneToOne_Optional_PK_Inverse4Id], [t].[c] FROM ( SELECT TOP(1) [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[Level2_Name], [l0].[OneToMany_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id], CASE - WHEN ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [l0].[Id] + WHEN [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [l0].[Id] END AS [c] FROM [Level1] AS [l0] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) AND [l].[Id] = [l0].[OneToMany_Optional_Inverse2Id] AND ([l0].[Level2_Name] <> N'Foo' OR ([l0].[Level2_Name] IS NULL)) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL AND [l].[Id] = [l0].[OneToMany_Optional_Inverse2Id] AND ([l0].[Level2_Name] <> N'Foo' OR [l0].[Level2_Name] IS NULL) ORDER BY CASE - WHEN ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [l0].[Id] + WHEN [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [l0].[Id] END ) AS [t] LEFT JOIN ( SELECT [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Level3_Name], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[OneToOne_Optional_PK_Inverse3Id] FROM [Level1] AS [l1] - WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse3Id] IS NOT NULL) + WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL ) AS [t0] ON CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] END = [t0].[OneToOne_Optional_PK_Inverse3Id] LEFT JOIN ( SELECT [l2].[Id], [l2].[Level3_Optional_Id], [l2].[Level3_Required_Id], [l2].[Level4_Name], [l2].[OneToMany_Optional_Inverse4Id], [l2].[OneToMany_Required_Inverse4Id], [l2].[OneToOne_Optional_PK_Inverse4Id] FROM [Level1] AS [l2] - WHERE ([l2].[Level3_Required_Id] IS NOT NULL) AND ([l2].[OneToMany_Required_Inverse4Id] IS NOT NULL) AND [l2].[Id] > 1 + WHERE [l2].[Level3_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse4Id] IS NOT NULL AND [l2].[Id] > 1 ) AS [t1] ON CASE - WHEN ([t0].[Level2_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [t0].[Id] + WHEN [t0].[Level2_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [t0].[Id] END = [t1].[OneToMany_Optional_Inverse4Id] ) AS [t2] ORDER BY [l].[Id], [t2].[c], [t2].[Id], [t2].[Id0] @@ -1029,7 +1029,7 @@ FROM [Level1] AS [l0] LEFT JOIN ( SELECT [l1].[Id], [l1].[OneToOne_Required_PK_Date], [l1].[Level1_Optional_Id], [l1].[Level1_Required_Id], [l1].[Level2_Name], [l1].[OneToMany_Optional_Inverse2Id], [l1].[OneToMany_Required_Inverse2Id], [l1].[OneToOne_Optional_PK_Inverse2Id] FROM [Level1] AS [l1] - WHERE ([l1].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l1].[Level1_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l1].[OneToOne_Required_PK_Date] IS NOT NULL AND [l1].[Level1_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t2] ON [t0].[Id] = [t2].[OneToMany_Optional_Inverse2Id] ORDER BY [t].[Name], [t0].[Id] """); @@ -1070,18 +1070,18 @@ FROM [Level1] AS [l] LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l0] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] ON [l].[Id] = [t].[Level1_Optional_Id] LEFT JOIN ( SELECT [t1].[Id], [t1].[Level2_Optional_Id], [t1].[Level2_Required_Id], [t1].[Level3_Name], [t1].[OneToMany_Optional_Inverse3Id], [t1].[OneToMany_Required_Inverse3Id], [t1].[OneToOne_Optional_PK_Inverse3Id] FROM ( SELECT [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Level3_Name], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[OneToOne_Optional_PK_Inverse3Id], ROW_NUMBER() OVER(PARTITION BY [l1].[OneToMany_Optional_Inverse3Id] ORDER BY [l1].[Id]) AS [row] FROM [Level1] AS [l1] - WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse3Id] IS NOT NULL) + WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL ) AS [t1] WHERE [t1].[row] <= 50 ) AS [t0] ON CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] END = [t0].[OneToMany_Optional_Inverse3Id] ORDER BY [l].[Id], [t].[Id] """); @@ -1094,27 +1094,27 @@ public override async Task Multiple_SelectMany_navigation_property_followed_by_s AssertSql( """ SELECT CASE - WHEN ([t0].[Level2_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [t0].[Id] + WHEN [t0].[Level2_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [t0].[Id] END, [l].[Id], [t].[Id], [t0].[Id], [t1].[Id], [t1].[Level3_Optional_Id], [t1].[Level3_Required_Id], [t1].[Level4_Name], [t1].[OneToMany_Optional_Inverse4Id], [t1].[OneToMany_Required_Inverse4Id], [t1].[OneToOne_Optional_PK_Inverse4Id] FROM [Level1] AS [l] INNER JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Required_Id], [l0].[OneToMany_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l0] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] ON [l].[Id] = [t].[OneToMany_Optional_Inverse2Id] INNER JOIN ( SELECT [l1].[Id], [l1].[Level2_Required_Id], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id] FROM [Level1] AS [l1] - WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse3Id] IS NOT NULL) + WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL ) AS [t0] ON CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] END = [t0].[OneToMany_Optional_Inverse3Id] LEFT JOIN ( SELECT [l2].[Id], [l2].[Level3_Optional_Id], [l2].[Level3_Required_Id], [l2].[Level4_Name], [l2].[OneToMany_Optional_Inverse4Id], [l2].[OneToMany_Required_Inverse4Id], [l2].[OneToOne_Optional_PK_Inverse4Id] FROM [Level1] AS [l2] - WHERE ([l2].[Level3_Required_Id] IS NOT NULL) AND ([l2].[OneToMany_Required_Inverse4Id] IS NOT NULL) + WHERE [l2].[Level3_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse4Id] IS NOT NULL ) AS [t1] ON CASE - WHEN ([t0].[Level2_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [t0].[Id] + WHEN [t0].[Level2_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [t0].[Id] END = [t1].[OneToMany_Optional_Inverse4Id] ORDER BY [l].[Id], [t].[Id], [t0].[Id] """); @@ -1144,7 +1144,7 @@ OFFSET 1 ROWS FETCH NEXT 5 ROWS ONLY LEFT JOIN ( SELECT [l1].[Id], [l1].[OneToOne_Required_PK_Date], [l1].[Level1_Optional_Id], [l1].[Level1_Required_Id], [l1].[Level2_Name], [l1].[OneToMany_Optional_Inverse2Id], [l1].[OneToMany_Required_Inverse2Id], [l1].[OneToOne_Optional_PK_Inverse2Id] FROM [Level1] AS [l1] - WHERE ([l1].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l1].[Level1_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l1].[OneToOne_Required_PK_Date] IS NOT NULL AND [l1].[Level1_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t2] ON [t0].[Id] = [t2].[Level1_Optional_Id] ) AS [t1] ORDER BY [t].[Date], [t1].[Name], [t1].[Id] @@ -1166,20 +1166,20 @@ FROM [Level1] AS [l0] LEFT JOIN ( SELECT [l1].[Id], [l1].[OneToOne_Required_PK_Date], [l1].[Level1_Optional_Id], [l1].[Level1_Required_Id], [l1].[Level2_Name], [l1].[OneToMany_Optional_Inverse2Id], [l1].[OneToMany_Required_Inverse2Id], [l1].[OneToOne_Optional_PK_Inverse2Id] FROM [Level1] AS [l1] - WHERE ([l1].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l1].[Level1_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l1].[OneToOne_Required_PK_Date] IS NOT NULL AND [l1].[Level1_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] ON [l0].[Id] = CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] END - WHERE ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) AND ([t].[Level1_Required_Id] = ([l].[Id] * 2) OR CAST(LEN([t].[Level2_Name]) AS int) = CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] - END OR (([t].[Level2_Name] IS NULL) AND (CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] - END IS NULL))) + WHERE [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL AND ([t].[Level1_Required_Id] = [l].[Id] * 2 OR CAST(LEN([t].[Level2_Name]) AS int) = CASE + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + END OR ([t].[Level2_Name] IS NULL AND CASE + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + END IS NULL)) ) AS [t0] LEFT JOIN ( SELECT [l2].[Id], [l2].[OneToOne_Required_PK_Date], [l2].[Level1_Optional_Id], [l2].[Level1_Required_Id], [l2].[Level2_Name], [l2].[OneToMany_Optional_Inverse2Id], [l2].[OneToMany_Required_Inverse2Id], [l2].[OneToOne_Optional_PK_Inverse2Id] FROM [Level1] AS [l2] - WHERE ([l2].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l2].[Level1_Required_Id] IS NOT NULL) AND ([l2].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l2].[OneToOne_Required_PK_Date] IS NOT NULL AND [l2].[Level1_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t1] ON [l].[Id] = [t1].[OneToMany_Optional_Inverse2Id] ORDER BY [l].[Id], [t0].[Id0], [t0].[Id] """); @@ -1203,14 +1203,14 @@ OUTER APPLY ( FROM ( SELECT TOP(40) [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[Level2_Name], [l0].[OneToMany_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id] FROM [Level1] AS [l0] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) AND [t].[Id] = [l0].[OneToMany_Optional_Inverse2Id] + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL AND [t].[Id] = [l0].[OneToMany_Optional_Inverse2Id] ) AS [t0] LEFT JOIN ( SELECT [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Level3_Name], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[OneToOne_Optional_PK_Inverse3Id] FROM [Level1] AS [l1] - WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse3Id] IS NOT NULL) + WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL ) AS [t2] ON CASE - WHEN ([t0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t0].[Level1_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t0].[Id] + WHEN [t0].[OneToOne_Required_PK_Date] IS NOT NULL AND [t0].[Level1_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t0].[Id] END = [t2].[Level2_Optional_Id] ) AS [t1] ORDER BY [t].[Id], [t1].[Id] @@ -1236,21 +1236,21 @@ OFFSET @__p_0 ROWS FETCH NEXT @__p_1 ROWS ONLY LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[Level2_Name], [l0].[OneToMany_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id] FROM [Level1] AS [l0] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t0] ON [t].[Id] = [t0].[Level1_Optional_Id] LEFT JOIN ( SELECT [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Level3_Name], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[OneToOne_Optional_PK_Inverse3Id] FROM [Level1] AS [l1] - WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse3Id] IS NOT NULL) + WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL ) AS [t1] ON CASE - WHEN ([t0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t0].[Level1_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t0].[Id] + WHEN [t0].[OneToOne_Required_PK_Date] IS NOT NULL AND [t0].[Level1_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t0].[Id] END = [t1].[Level2_Required_Id] LEFT JOIN ( SELECT [l2].[Id], [l2].[Level3_Optional_Id], [l2].[Level3_Required_Id], [l2].[Level4_Name], [l2].[OneToMany_Optional_Inverse4Id], [l2].[OneToMany_Required_Inverse4Id], [l2].[OneToOne_Optional_PK_Inverse4Id] FROM [Level1] AS [l2] - WHERE ([l2].[Level3_Required_Id] IS NOT NULL) AND ([l2].[OneToMany_Required_Inverse4Id] IS NOT NULL) + WHERE [l2].[Level3_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse4Id] IS NOT NULL ) AS [t2] ON CASE - WHEN ([t1].[Level2_Required_Id] IS NOT NULL) AND ([t1].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [t1].[Id] + WHEN [t1].[Level2_Required_Id] IS NOT NULL AND [t1].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [t1].[Id] END = [t2].[OneToMany_Optional_Inverse4Id] ORDER BY [t].[Name], [t].[Id], [t0].[Id], [t1].[Id] """); @@ -1263,20 +1263,20 @@ public override async Task SelectMany_navigation_property_followed_by_select_col AssertSql( """ SELECT CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] END, [l].[Id], [t].[Id], [t0].[Id], [t0].[Level2_Optional_Id], [t0].[Level2_Required_Id], [t0].[Level3_Name], [t0].[OneToMany_Optional_Inverse3Id], [t0].[OneToMany_Required_Inverse3Id], [t0].[OneToOne_Optional_PK_Inverse3Id] FROM [Level1] AS [l] INNER JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Required_Id], [l0].[OneToMany_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l0] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] ON [l].[Id] = [t].[OneToMany_Optional_Inverse2Id] LEFT JOIN ( SELECT [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Level3_Name], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[OneToOne_Optional_PK_Inverse3Id] FROM [Level1] AS [l1] - WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse3Id] IS NOT NULL) + WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL ) AS [t0] ON CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] END = [t0].[OneToMany_Optional_Inverse3Id] ORDER BY [l].[Id], [t].[Id] """); @@ -1307,7 +1307,7 @@ WHERE [l0].[Id] > 3 LEFT JOIN ( SELECT [l1].[Id], [l1].[OneToOne_Required_PK_Date], [l1].[Level1_Optional_Id], [l1].[Level1_Required_Id], [l1].[Level2_Name], [l1].[OneToMany_Optional_Inverse2Id], [l1].[OneToMany_Required_Inverse2Id], [l1].[OneToOne_Optional_PK_Inverse2Id] FROM [Level1] AS [l1] - WHERE ([l1].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l1].[Level1_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l1].[OneToOne_Required_PK_Date] IS NOT NULL AND [l1].[Level1_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t2] ON [t0].[Id] = [t2].[OneToMany_Optional_Inverse2Id] ORDER BY [t].[Name], [t0].[Id] """); @@ -1324,18 +1324,18 @@ FROM [Level1] AS [l] LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[Level2_Name], [l0].[OneToMany_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id] FROM [Level1] AS [l0] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] ON [l].[Id] = [t].[Level1_Optional_Id] LEFT JOIN ( SELECT [t1].[Id], [t1].[Level2_Optional_Id], [t1].[Level2_Required_Id], [t1].[Level3_Name], [t1].[OneToMany_Optional_Inverse3Id], [t1].[OneToMany_Required_Inverse3Id], [t1].[OneToOne_Optional_PK_Inverse3Id] FROM ( SELECT [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Level3_Name], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[OneToOne_Optional_PK_Inverse3Id], ROW_NUMBER() OVER(PARTITION BY [l1].[OneToMany_Optional_Inverse3Id] ORDER BY [l1].[Level3_Name]) AS [row] FROM [Level1] AS [l1] - WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse3Id] IS NOT NULL) AND ([l1].[Level3_Name] <> N'Foo' OR ([l1].[Level3_Name] IS NULL)) + WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL AND ([l1].[Level3_Name] <> N'Foo' OR [l1].[Level3_Name] IS NULL) ) AS [t1] WHERE 1 < [t1].[row] AND [t1].[row] <= 4 ) AS [t0] ON CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] END = [t0].[OneToMany_Optional_Inverse3Id] ORDER BY [l].[Id], [t].[Id], [t0].[OneToMany_Optional_Inverse3Id], [t0].[Level3_Name] """); @@ -1352,14 +1352,14 @@ FROM [Level1] AS [l] LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l0] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] ON [l].[Id] = [t].[Level1_Optional_Id] LEFT JOIN ( SELECT [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Level3_Name], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[OneToOne_Optional_PK_Inverse3Id] FROM [Level1] AS [l1] - WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse3Id] IS NOT NULL) + WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL ) AS [t0] ON CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] END = [t0].[OneToMany_Optional_Inverse3Id] ORDER BY [l].[Id], [t].[Id] """); @@ -1382,19 +1382,19 @@ LEFT JOIN ( SELECT [t1].[Id], [t1].[c], [t1].[Id0], [t1].[OneToMany_Required_Inverse2Id] FROM ( SELECT CASE - WHEN ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [l0].[Id] + WHEN [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [l0].[Id] END AS [Id], 1 AS [c], [l0].[Id] AS [Id0], [l0].[OneToMany_Required_Inverse2Id], ROW_NUMBER() OVER(PARTITION BY [l0].[OneToMany_Required_Inverse2Id] ORDER BY [l0].[Id]) AS [row] FROM [Level1] AS [l0] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t1] WHERE [t1].[row] <= 1 ) AS [t0] ON [t].[Id] = [t0].[OneToMany_Required_Inverse2Id] LEFT JOIN ( SELECT CASE - WHEN ([l1].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l1].[Level1_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [l1].[Id] + WHEN [l1].[OneToOne_Required_PK_Date] IS NOT NULL AND [l1].[Level1_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [l1].[Id] END AS [Id], [l1].[Id] AS [Id0], [l1].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l1] - WHERE ([l1].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l1].[Level1_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l1].[OneToOne_Required_PK_Date] IS NOT NULL AND [l1].[Level1_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t2] ON [t].[Id] = [t2].[OneToMany_Required_Inverse2Id] ORDER BY [t].[Id], [t0].[Id0] """); @@ -1414,11 +1414,11 @@ FROM [Level1] AS [l0] LEFT JOIN ( SELECT [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Level3_Name], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[OneToOne_Optional_PK_Inverse3Id] FROM [Level1] AS [l1] - WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse3Id] IS NOT NULL) + WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL ) AS [t] ON CASE - WHEN ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [l0].[Id] + WHEN [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [l0].[Id] END = [t].[OneToOne_Optional_PK_Inverse3Id] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t0] ON [l].[Id] = [t0].[OneToMany_Optional_Inverse2Id] LEFT JOIN ( SELECT [l2].[Id], [l2].[OneToOne_Required_PK_Date], [l2].[Level1_Optional_Id], [l2].[Level1_Required_Id], [l2].[Level2_Name], [l2].[OneToMany_Optional_Inverse2Id], [l2].[OneToMany_Required_Inverse2Id], [l2].[OneToOne_Optional_PK_Inverse2Id], [t2].[Id] AS [Id0], [t2].[Level2_Optional_Id], [t2].[Level2_Required_Id], [t2].[Level3_Name], [t2].[OneToMany_Optional_Inverse3Id], [t2].[OneToMany_Required_Inverse3Id], [t2].[OneToOne_Optional_PK_Inverse3Id] @@ -1426,11 +1426,11 @@ FROM [Level1] AS [l2] LEFT JOIN ( SELECT [l3].[Id], [l3].[Level2_Optional_Id], [l3].[Level2_Required_Id], [l3].[Level3_Name], [l3].[OneToMany_Optional_Inverse3Id], [l3].[OneToMany_Required_Inverse3Id], [l3].[OneToOne_Optional_PK_Inverse3Id] FROM [Level1] AS [l3] - WHERE ([l3].[Level2_Required_Id] IS NOT NULL) AND ([l3].[OneToMany_Required_Inverse3Id] IS NOT NULL) + WHERE [l3].[Level2_Required_Id] IS NOT NULL AND [l3].[OneToMany_Required_Inverse3Id] IS NOT NULL ) AS [t2] ON CASE - WHEN ([l2].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l2].[Level1_Required_Id] IS NOT NULL) AND ([l2].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [l2].[Id] + WHEN [l2].[OneToOne_Required_PK_Date] IS NOT NULL AND [l2].[Level1_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [l2].[Id] END = [t2].[OneToOne_Optional_PK_Inverse3Id] - WHERE ([l2].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l2].[Level1_Required_Id] IS NOT NULL) AND ([l2].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l2].[OneToOne_Required_PK_Date] IS NOT NULL AND [l2].[Level1_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t1] ON [l].[Id] = [t1].[OneToMany_Optional_Inverse2Id] ORDER BY [l].[Id], [t0].[Id], [t0].[Id0], [t1].[Id] """); @@ -1447,14 +1447,14 @@ FROM [Level1] AS [l] LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l0] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] ON [l].[Id] = [t].[Level1_Optional_Id] LEFT JOIN ( SELECT [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Level3_Name], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[OneToOne_Optional_PK_Inverse3Id] FROM [Level1] AS [l1] - WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse3Id] IS NOT NULL) + WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL ) AS [t0] ON CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] END = [t0].[OneToMany_Optional_Inverse3Id] ORDER BY [l].[Id], [t].[Id] """); @@ -1473,7 +1473,7 @@ LEFT JOIN ( FROM ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[Level2_Name], [l0].[OneToMany_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id], ROW_NUMBER() OVER(PARTITION BY [l0].[OneToMany_Optional_Inverse2Id] ORDER BY [l0].[Level2_Name]) AS [row] FROM [Level1] AS [l0] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) AND ([l0].[Level2_Name] <> N'Foo' OR ([l0].[Level2_Name] IS NULL)) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL AND ([l0].[Level2_Name] <> N'Foo' OR [l0].[Level2_Name] IS NULL) ) AS [t] WHERE [t].[row] <= 3 ) AS [t0] ON [l].[Id] = [t0].[OneToMany_Optional_Inverse2Id] @@ -1482,7 +1482,7 @@ LEFT JOIN ( FROM ( SELECT [l1].[Id], [l1].[OneToOne_Required_PK_Date], [l1].[Level1_Optional_Id], [l1].[Level1_Required_Id], [l1].[Level2_Name], [l1].[OneToMany_Optional_Inverse2Id], [l1].[OneToMany_Required_Inverse2Id], [l1].[OneToOne_Optional_PK_Inverse2Id], ROW_NUMBER() OVER(PARTITION BY [l1].[OneToMany_Required_Inverse2Id] ORDER BY [l1].[Level2_Name] DESC) AS [row] FROM [Level1] AS [l1] - WHERE ([l1].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l1].[Level1_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse2Id] IS NOT NULL) AND ([l1].[Level2_Name] <> N'Bar' OR ([l1].[Level2_Name] IS NULL)) + WHERE [l1].[OneToOne_Required_PK_Date] IS NOT NULL AND [l1].[Level1_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse2Id] IS NOT NULL AND ([l1].[Level2_Name] <> N'Bar' OR [l1].[Level2_Name] IS NULL) ) AS [t2] WHERE 1 < [t2].[row] ) AS [t1] ON [l].[Id] = [t1].[OneToMany_Required_Inverse2Id] @@ -1504,32 +1504,32 @@ FROM [Level1] AS [l0] LEFT JOIN ( SELECT [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Level3_Name], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[OneToOne_Optional_PK_Inverse3Id] FROM [Level1] AS [l1] - WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse3Id] IS NOT NULL) + WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL ) AS [t] ON CASE - WHEN ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [l0].[Id] + WHEN [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [l0].[Id] END = [t].[OneToOne_Optional_PK_Inverse3Id] LEFT JOIN ( SELECT [l2].[Id], [l2].[Level3_Optional_Id], [l2].[Level3_Required_Id], [l2].[Level4_Name], [l2].[OneToMany_Optional_Inverse4Id], [l2].[OneToMany_Required_Inverse4Id], [l2].[OneToOne_Optional_PK_Inverse4Id] FROM [Level1] AS [l2] - WHERE ([l2].[Level3_Required_Id] IS NOT NULL) AND ([l2].[OneToMany_Required_Inverse4Id] IS NOT NULL) + WHERE [l2].[Level3_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse4Id] IS NOT NULL ) AS [t0] ON CASE - WHEN ([t].[Level2_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [t].[Id] + WHEN [t].[Level2_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [t].[Id] END = [t0].[Level3_Optional_Id] LEFT JOIN ( SELECT [l3].[Id], [l3].[Level2_Optional_Id], [l3].[Level2_Required_Id], [l3].[Level3_Name], [l3].[OneToMany_Optional_Inverse3Id], [l3].[OneToMany_Required_Inverse3Id], [l3].[OneToOne_Optional_PK_Inverse3Id] FROM [Level1] AS [l3] - WHERE ([l3].[Level2_Required_Id] IS NOT NULL) AND ([l3].[OneToMany_Required_Inverse3Id] IS NOT NULL) + WHERE [l3].[Level2_Required_Id] IS NOT NULL AND [l3].[OneToMany_Required_Inverse3Id] IS NOT NULL ) AS [t1] ON CASE - WHEN ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [l0].[Id] + WHEN [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [l0].[Id] END = [t1].[Level2_Optional_Id] LEFT JOIN ( SELECT [l4].[Id], [l4].[Level3_Optional_Id], [l4].[Level3_Required_Id], [l4].[Level4_Name], [l4].[OneToMany_Optional_Inverse4Id], [l4].[OneToMany_Required_Inverse4Id], [l4].[OneToOne_Optional_PK_Inverse4Id] FROM [Level1] AS [l4] - WHERE ([l4].[Level3_Required_Id] IS NOT NULL) AND ([l4].[OneToMany_Required_Inverse4Id] IS NOT NULL) + WHERE [l4].[Level3_Required_Id] IS NOT NULL AND [l4].[OneToMany_Required_Inverse4Id] IS NOT NULL ) AS [t2] ON CASE - WHEN ([t1].[Level2_Required_Id] IS NOT NULL) AND ([t1].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [t1].[Id] + WHEN [t1].[Level2_Required_Id] IS NOT NULL AND [t1].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [t1].[Id] END = [t2].[OneToMany_Optional_Inverse4Id] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t3] ON [l].[Id] = [t3].[OneToMany_Optional_Inverse2Id] ORDER BY [l].[Id], [t3].[Id], [t3].[Id0], [t3].[Id1], [t3].[Id2] """); @@ -1554,12 +1554,12 @@ LEFT JOIN ( SELECT [t].[Id], [t].[OneToOne_Required_PK_Date], [t].[Level1_Optional_Id], [t].[Level1_Required_Id], [t].[Level2_Name], [t].[OneToMany_Optional_Inverse2Id], [t].[OneToMany_Required_Inverse2Id], [t].[OneToOne_Optional_PK_Inverse2Id], [t].[c] FROM ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[Level2_Name], [l0].[OneToMany_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id], ROW_NUMBER() OVER(PARTITION BY [l0].[OneToMany_Optional_Inverse2Id] ORDER BY CASE - WHEN ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [l0].[Id] + WHEN [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [l0].[Id] END) AS [row], CASE - WHEN ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [l0].[Id] + WHEN [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [l0].[Id] END AS [c] FROM [Level1] AS [l0] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) AND @__p_0 = CAST(1 AS bit) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL AND @__p_0 = CAST(1 AS bit) ) AS [t] WHERE [t].[row] <= 3 ) AS [t0] ON [l].[Id] = [t0].[OneToMany_Optional_Inverse2Id] @@ -1581,11 +1581,11 @@ FROM [Level1] AS [l0] LEFT JOIN ( SELECT [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Level3_Name], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[OneToOne_Optional_PK_Inverse3Id] FROM [Level1] AS [l1] - WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse3Id] IS NOT NULL) + WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL ) AS [t] ON CASE - WHEN ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [l0].[Id] + WHEN [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [l0].[Id] END = [t].[OneToOne_Optional_PK_Inverse3Id] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t0] ON [l].[Id] = [t0].[OneToMany_Optional_Inverse2Id] ORDER BY [l].[Id], [t0].[Id] """); @@ -1610,21 +1610,21 @@ OFFSET @__p_0 ROWS FETCH NEXT @__p_1 ROWS ONLY LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[Level2_Name], [l0].[OneToMany_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id] FROM [Level1] AS [l0] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t0] ON [t].[Id] = [t0].[Level1_Required_Id] LEFT JOIN ( SELECT [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Level3_Name], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[OneToOne_Optional_PK_Inverse3Id] FROM [Level1] AS [l1] - WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse3Id] IS NOT NULL) + WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL ) AS [t1] ON CASE - WHEN ([t0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t0].[Level1_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t0].[Id] + WHEN [t0].[OneToOne_Required_PK_Date] IS NOT NULL AND [t0].[Level1_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t0].[Id] END = [t1].[OneToMany_Optional_Inverse3Id] LEFT JOIN ( SELECT [l2].[Id], [l2].[Level2_Optional_Id], [l2].[Level2_Required_Id], [l2].[Level3_Name], [l2].[OneToMany_Optional_Inverse3Id], [l2].[OneToMany_Required_Inverse3Id], [l2].[OneToOne_Optional_PK_Inverse3Id] FROM [Level1] AS [l2] - WHERE ([l2].[Level2_Required_Id] IS NOT NULL) AND ([l2].[OneToMany_Required_Inverse3Id] IS NOT NULL) + WHERE [l2].[Level2_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse3Id] IS NOT NULL ) AS [t2] ON CASE - WHEN ([t0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t0].[Level1_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t0].[Id] + WHEN [t0].[OneToOne_Required_PK_Date] IS NOT NULL AND [t0].[Level1_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t0].[Id] END = [t2].[OneToMany_Required_Inverse3Id] ORDER BY [t].[Name], [t].[Id], [t0].[Id], [t1].[Id] """); @@ -1651,16 +1651,16 @@ OUTER APPLY ( FROM ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[Level2_Name], [l0].[OneToMany_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id] FROM [Level1] AS [l0] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) AND [t].[Id] = [l0].[OneToMany_Optional_Inverse2Id] + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL AND [t].[Id] = [l0].[OneToMany_Optional_Inverse2Id] ORDER BY [l0].[Level2_Name] DESC OFFSET 2 ROWS FETCH NEXT 4 ROWS ONLY ) AS [t0] LEFT JOIN ( SELECT [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Level3_Name], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[OneToOne_Optional_PK_Inverse3Id] FROM [Level1] AS [l1] - WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse3Id] IS NOT NULL) + WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL ) AS [t2] ON CASE - WHEN ([t0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t0].[Level1_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t0].[Id] + WHEN [t0].[OneToOne_Required_PK_Date] IS NOT NULL AND [t0].[Level1_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t0].[Id] END = [t2].[Level2_Optional_Id] ) AS [t1] ORDER BY [t].[Id] DESC, [t1].[Level2_Name] DESC, [t1].[Id] @@ -1691,7 +1691,7 @@ OFFSET 1 ROWS FETCH NEXT 5 ROWS ONLY LEFT JOIN ( SELECT [l1].[Id], [l1].[OneToOne_Required_PK_Date], [l1].[Level1_Optional_Id], [l1].[Level1_Required_Id], [l1].[Level2_Name], [l1].[OneToMany_Optional_Inverse2Id], [l1].[OneToMany_Required_Inverse2Id], [l1].[OneToOne_Optional_PK_Inverse2Id] FROM [Level1] AS [l1] - WHERE ([l1].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l1].[Level1_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l1].[OneToOne_Required_PK_Date] IS NOT NULL AND [l1].[Level1_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t2] ON [t0].[Id] = [t2].[OneToMany_Optional_Inverse2Id] ) AS [t1] ORDER BY [t].[Date], [t1].[Name], [t1].[Id] @@ -1708,18 +1708,18 @@ public override async Task Null_check_in_anonymous_type_projection_should_not_be FROM [Level1] AS [l] LEFT JOIN ( SELECT CASE - WHEN ([t].[Level2_Required_Id] IS NULL) OR ([t].[OneToMany_Required_Inverse3Id] IS NULL) THEN CAST(1 AS bit) + WHEN [t].[Level2_Required_Id] IS NULL OR [t].[OneToMany_Required_Inverse3Id] IS NULL THEN CAST(1 AS bit) ELSE CAST(0 AS bit) END AS [c], [t].[Level3_Name], [l0].[Id], [t].[Id] AS [Id0], [l0].[OneToMany_Optional_Inverse2Id] FROM [Level1] AS [l0] LEFT JOIN ( SELECT [l1].[Id], [l1].[Level2_Required_Id], [l1].[Level3_Name], [l1].[OneToMany_Required_Inverse3Id] FROM [Level1] AS [l1] - WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse3Id] IS NOT NULL) + WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL ) AS [t] ON CASE - WHEN ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [l0].[Id] + WHEN [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [l0].[Id] END = [t].[Level2_Required_Id] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t0] ON [l].[Id] = [t0].[OneToMany_Optional_Inverse2Id] ORDER BY [l].[Id], [t0].[Id] """); @@ -1738,7 +1738,7 @@ LEFT JOIN ( FROM ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[Level2_Name], [l0].[OneToMany_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id], ROW_NUMBER() OVER(PARTITION BY [l0].[OneToMany_Optional_Inverse2Id] ORDER BY [l0].[Id]) AS [row] FROM [Level1] AS [l0] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] WHERE [t].[row] <= 1 ) AS [t0] ON [l].[Id] = [t0].[OneToMany_Optional_Inverse2Id] @@ -1757,7 +1757,7 @@ FROM [Level1] AS [l] LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[Level2_Name], [l0].[OneToMany_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id] FROM [Level1] AS [l0] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] ON [l].[Id] = [t].[OneToMany_Optional_Inverse2Id] ORDER BY [l].[Id] """); @@ -1777,18 +1777,18 @@ FROM [Level1] AS [l0] LEFT JOIN ( SELECT [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Level3_Name], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[OneToOne_Optional_PK_Inverse3Id] FROM [Level1] AS [l1] - WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse3Id] IS NOT NULL) + WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL ) AS [t] ON CASE - WHEN ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [l0].[Id] + WHEN [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [l0].[Id] END = [t].[OneToOne_Optional_PK_Inverse3Id] LEFT JOIN ( SELECT [l2].[Id], [l2].[Level3_Optional_Id], [l2].[Level3_Required_Id], [l2].[Level4_Name], [l2].[OneToMany_Optional_Inverse4Id], [l2].[OneToMany_Required_Inverse4Id], [l2].[OneToOne_Optional_PK_Inverse4Id] FROM [Level1] AS [l2] - WHERE ([l2].[Level3_Required_Id] IS NOT NULL) AND ([l2].[OneToMany_Required_Inverse4Id] IS NOT NULL) + WHERE [l2].[Level3_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse4Id] IS NOT NULL ) AS [t0] ON CASE - WHEN ([t].[Level2_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [t].[Id] + WHEN [t].[Level2_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [t].[Id] END = [t0].[Level3_Optional_Id] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t1] ON [l].[Id] = [t1].[OneToMany_Optional_Inverse2Id] ORDER BY [l].[Id], [t1].[Id], [t1].[Id0] """); @@ -1808,11 +1808,11 @@ FROM [Level1] AS [l0] LEFT JOIN ( SELECT [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Level3_Name], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[OneToOne_Optional_PK_Inverse3Id] FROM [Level1] AS [l1] - WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse3Id] IS NOT NULL) + WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL ) AS [t] ON CASE - WHEN ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [l0].[Id] + WHEN [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [l0].[Id] END = [t].[OneToMany_Optional_Inverse3Id] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t0] ON [l].[Id] = [t0].[OneToMany_Optional_Inverse2Id] ORDER BY [l].[Id], [t0].[Level2_Name], [t0].[Id], [t0].[Level3_Name] DESC """); @@ -1833,36 +1833,36 @@ OUTER APPLY ( SELECT [t].[Id], [t].[Level2_Optional_Id], [t].[Level2_Required_Id], [t].[Level3_Name], [t].[OneToMany_Optional_Inverse3Id], [t].[OneToMany_Required_Inverse3Id], [t].[OneToOne_Optional_PK_Inverse3Id], [t0].[Id] AS [Id0], [t0].[Level3_Optional_Id], [t0].[Level3_Required_Id], [t0].[Level4_Name], [t0].[OneToMany_Optional_Inverse4Id], [t0].[OneToMany_Required_Inverse4Id], [t0].[OneToOne_Optional_PK_Inverse4Id], [t1].[Id] AS [Id1], [t1].[Level3_Optional_Id] AS [Level3_Optional_Id0], [t1].[Level3_Required_Id] AS [Level3_Required_Id0], [t1].[Level4_Name] AS [Level4_Name0], [t1].[OneToMany_Optional_Inverse4Id] AS [OneToMany_Optional_Inverse4Id0], [t1].[OneToMany_Required_Inverse4Id] AS [OneToMany_Required_Inverse4Id0], [t1].[OneToOne_Optional_PK_Inverse4Id] AS [OneToOne_Optional_PK_Inverse4Id0], [t].[c] FROM ( SELECT TOP(1) [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Level3_Name], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[OneToOne_Optional_PK_Inverse3Id], CASE - WHEN ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [l1].[Id] + WHEN [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [l1].[Id] END AS [c] FROM [Level1] AS [l1] - WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse3Id] IS NOT NULL) AND (CASE - WHEN ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [l0].[Id] - END IS NOT NULL) AND (CASE - WHEN ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [l0].[Id] - END = [l1].[OneToMany_Optional_Inverse3Id] OR ((CASE - WHEN ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [l0].[Id] - END IS NULL) AND ([l1].[OneToMany_Optional_Inverse3Id] IS NULL))) AND ([l1].[Level3_Name] <> N'Foo' OR ([l1].[Level3_Name] IS NULL)) + WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL AND CASE + WHEN [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [l0].[Id] + END IS NOT NULL AND (CASE + WHEN [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [l0].[Id] + END = [l1].[OneToMany_Optional_Inverse3Id] OR (CASE + WHEN [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [l0].[Id] + END IS NULL AND [l1].[OneToMany_Optional_Inverse3Id] IS NULL)) AND ([l1].[Level3_Name] <> N'Foo' OR [l1].[Level3_Name] IS NULL) ORDER BY CASE - WHEN ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [l1].[Id] + WHEN [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [l1].[Id] END ) AS [t] LEFT JOIN ( SELECT [l2].[Id], [l2].[Level3_Optional_Id], [l2].[Level3_Required_Id], [l2].[Level4_Name], [l2].[OneToMany_Optional_Inverse4Id], [l2].[OneToMany_Required_Inverse4Id], [l2].[OneToOne_Optional_PK_Inverse4Id] FROM [Level1] AS [l2] - WHERE ([l2].[Level3_Required_Id] IS NOT NULL) AND ([l2].[OneToMany_Required_Inverse4Id] IS NOT NULL) + WHERE [l2].[Level3_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse4Id] IS NOT NULL ) AS [t0] ON CASE - WHEN ([t].[Level2_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [t].[Id] + WHEN [t].[Level2_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [t].[Id] END = [t0].[OneToMany_Optional_Inverse4Id] LEFT JOIN ( SELECT [l3].[Id], [l3].[Level3_Optional_Id], [l3].[Level3_Required_Id], [l3].[Level4_Name], [l3].[OneToMany_Optional_Inverse4Id], [l3].[OneToMany_Required_Inverse4Id], [l3].[OneToOne_Optional_PK_Inverse4Id] FROM [Level1] AS [l3] - WHERE ([l3].[Level3_Required_Id] IS NOT NULL) AND ([l3].[OneToMany_Required_Inverse4Id] IS NOT NULL) + WHERE [l3].[Level3_Required_Id] IS NOT NULL AND [l3].[OneToMany_Required_Inverse4Id] IS NOT NULL ) AS [t1] ON CASE - WHEN ([t].[Level2_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [t].[Id] + WHEN [t].[Level2_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [t].[Id] END = [t1].[OneToMany_Required_Inverse4Id] ) AS [t2] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t3] ON [l].[Id] = [t3].[OneToMany_Optional_Inverse2Id] ORDER BY [l].[Id], [t3].[Id], [t3].[c], [t3].[Id0], [t3].[Id00] """); @@ -1879,7 +1879,7 @@ FROM [Level1] AS [l] LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[Level2_Name], [l0].[OneToMany_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id] FROM [Level1] AS [l0] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] ON [l].[Id] = [t].[OneToMany_Optional_Inverse2Id] ORDER BY [l].[Id] """); @@ -1896,17 +1896,17 @@ FROM [Level1] AS [l] LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[Level2_Name], [l0].[OneToMany_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id] FROM [Level1] AS [l0] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] ON [l].[Id] = [t].[Level1_Optional_Id] LEFT JOIN ( SELECT [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Level3_Name], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[OneToOne_Optional_PK_Inverse3Id] FROM [Level1] AS [l1] - WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse3Id] IS NOT NULL) + WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL ) AS [t0] ON CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] END = [t0].[OneToMany_Optional_Inverse3Id] ORDER BY CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] END, [l].[Id], [t].[Id] """); } @@ -1922,21 +1922,21 @@ FROM [Level1] AS [l] LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l0] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] ON [l].[Id] = [t].[Level1_Optional_Id] LEFT JOIN ( SELECT [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Level3_Name], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[OneToOne_Optional_PK_Inverse3Id] FROM [Level1] AS [l1] - WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse3Id] IS NOT NULL) + WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL ) AS [t0] ON CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] END = [t0].[OneToOne_Optional_PK_Inverse3Id] LEFT JOIN ( SELECT [l2].[Id], [l2].[Level3_Optional_Id], [l2].[Level3_Required_Id], [l2].[Level4_Name], [l2].[OneToMany_Optional_Inverse4Id], [l2].[OneToMany_Required_Inverse4Id], [l2].[OneToOne_Optional_PK_Inverse4Id] FROM [Level1] AS [l2] - WHERE ([l2].[Level3_Required_Id] IS NOT NULL) AND ([l2].[OneToMany_Required_Inverse4Id] IS NOT NULL) + WHERE [l2].[Level3_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse4Id] IS NOT NULL ) AS [t1] ON CASE - WHEN ([t0].[Level2_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [t0].[Id] + WHEN [t0].[Level2_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [t0].[Id] END = [t1].[OneToMany_Optional_Inverse4Id] ORDER BY [l].[Id], [t].[Id], [t0].[Id] """); @@ -1953,14 +1953,14 @@ FROM [Level1] AS [l] INNER JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[Level2_Name], [l0].[OneToMany_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id] FROM [Level1] AS [l0] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] ON [l].[Id] = [t].[OneToMany_Optional_Inverse2Id] LEFT JOIN ( SELECT [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Level3_Name], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[OneToOne_Optional_PK_Inverse3Id] FROM [Level1] AS [l1] - WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse3Id] IS NOT NULL) + WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL ) AS [t0] ON CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] END = [t0].[OneToMany_Optional_Inverse3Id] ORDER BY [t].[Level2_Name], [l].[Id], [t].[Id] """); @@ -1980,11 +1980,11 @@ FROM [Level1] AS [l0] LEFT JOIN ( SELECT [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Level3_Name], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[OneToOne_Optional_PK_Inverse3Id] FROM [Level1] AS [l1] - WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse3Id] IS NOT NULL) + WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL ) AS [t] ON CASE - WHEN ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [l0].[Id] + WHEN [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [l0].[Id] END = [t].[OneToOne_Optional_PK_Inverse3Id] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t0] ON [l].[Id] = [t0].[OneToMany_Optional_Inverse2Id] ORDER BY [l].[Id], [t0].[Id] """); @@ -2000,10 +2000,10 @@ public override async Task Select_nav_prop_collection_one_to_many_required(bool FROM [Level1] AS [l] LEFT JOIN ( SELECT CASE - WHEN ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [l0].[Id] + WHEN [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [l0].[Id] END AS [c], [l0].[Id], [l0].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l0] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] ON [l].[Id] = [t].[OneToMany_Required_Inverse2Id] ORDER BY [l].[Id] """); @@ -2020,7 +2020,7 @@ FROM [Level1] AS [l] LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[Level2_Name], [l0].[OneToMany_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id] FROM [Level1] AS [l0] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] ON [l].[Id] = [t].[OneToMany_Optional_Inverse2Id] ORDER BY [l].[Id] """); @@ -2037,14 +2037,14 @@ FROM [Level1] AS [l] LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[Level2_Name], [l0].[OneToMany_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id] FROM [Level1] AS [l0] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] ON [l].[Id] = [t].[Level1_Optional_Id] LEFT JOIN ( SELECT [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Level3_Name], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[OneToOne_Optional_PK_Inverse3Id] FROM [Level1] AS [l1] - WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse3Id] IS NOT NULL) + WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL ) AS [t0] ON CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] END = [t0].[OneToMany_Optional_Inverse3Id] LEFT JOIN ( SELECT [l2].[Id], [l2].[OneToOne_Required_PK_Date], [l2].[Level1_Optional_Id], [l2].[Level1_Required_Id], [l2].[Level2_Name], [l2].[OneToMany_Optional_Inverse2Id], [l2].[OneToMany_Required_Inverse2Id], [l2].[OneToOne_Optional_PK_Inverse2Id], [t2].[Id] AS [Id0], [t2].[Level2_Optional_Id], [t2].[Level2_Required_Id], [t2].[Level3_Name], [t2].[OneToMany_Optional_Inverse3Id], [t2].[OneToMany_Required_Inverse3Id], [t2].[OneToOne_Optional_PK_Inverse3Id] @@ -2052,11 +2052,11 @@ FROM [Level1] AS [l2] LEFT JOIN ( SELECT [l3].[Id], [l3].[Level2_Optional_Id], [l3].[Level2_Required_Id], [l3].[Level3_Name], [l3].[OneToMany_Optional_Inverse3Id], [l3].[OneToMany_Required_Inverse3Id], [l3].[OneToOne_Optional_PK_Inverse3Id] FROM [Level1] AS [l3] - WHERE ([l3].[Level2_Required_Id] IS NOT NULL) AND ([l3].[OneToMany_Required_Inverse3Id] IS NOT NULL) + WHERE [l3].[Level2_Required_Id] IS NOT NULL AND [l3].[OneToMany_Required_Inverse3Id] IS NOT NULL ) AS [t2] ON CASE - WHEN ([l2].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l2].[Level1_Required_Id] IS NOT NULL) AND ([l2].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [l2].[Id] + WHEN [l2].[OneToOne_Required_PK_Date] IS NOT NULL AND [l2].[Level1_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [l2].[Id] END = [t2].[Level2_Optional_Id] - WHERE ([l2].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l2].[Level1_Required_Id] IS NOT NULL) AND ([l2].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l2].[OneToOne_Required_PK_Date] IS NOT NULL AND [l2].[Level1_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t1] ON [l].[Id] = [t1].[OneToMany_Optional_Inverse2Id] ORDER BY [l].[Id], [t].[Id], [t0].[Id], [t1].[Id] """); @@ -2073,14 +2073,14 @@ FROM [Level1] AS [l] LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l0] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] ON [l].[Id] = [t].[Level1_Optional_Id] LEFT JOIN ( SELECT [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Level3_Name], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[OneToOne_Optional_PK_Inverse3Id] FROM [Level1] AS [l1] - WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse3Id] IS NOT NULL) + WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL ) AS [t0] ON CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] END = [t0].[OneToMany_Optional_Inverse3Id] ORDER BY [l].[Id], [t].[Id] """); @@ -2098,12 +2098,12 @@ LEFT JOIN ( SELECT [t].[Id], [t].[OneToOne_Required_PK_Date], [t].[Level1_Optional_Id], [t].[Level1_Required_Id], [t].[Level2_Name], [t].[OneToMany_Optional_Inverse2Id], [t].[OneToMany_Required_Inverse2Id], [t].[OneToOne_Optional_PK_Inverse2Id], [t].[c] FROM ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[Level2_Name], [l0].[OneToMany_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id], ROW_NUMBER() OVER(PARTITION BY [l0].[OneToMany_Optional_Inverse2Id] ORDER BY CASE - WHEN ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [l0].[Id] + WHEN [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [l0].[Id] END) AS [row], CASE - WHEN ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [l0].[Id] + WHEN [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [l0].[Id] END AS [c] FROM [Level1] AS [l0] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) AND ([l0].[Level2_Name] <> N'Foo' OR ([l0].[Level2_Name] IS NULL)) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL AND ([l0].[Level2_Name] <> N'Foo' OR [l0].[Level2_Name] IS NULL) ) AS [t] WHERE [t].[row] <= 3 ) AS [t0] ON [l].[Id] = [t0].[OneToMany_Optional_Inverse2Id] @@ -2131,14 +2131,14 @@ OUTER APPLY ( FROM ( SELECT TOP(40) [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[Level2_Name], [l0].[OneToMany_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id] FROM [Level1] AS [l0] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) AND [t].[Id] = [l0].[OneToMany_Optional_Inverse2Id] + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL AND [t].[Id] = [l0].[OneToMany_Optional_Inverse2Id] ) AS [t0] LEFT JOIN ( SELECT [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Level3_Name], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[OneToOne_Optional_PK_Inverse3Id] FROM [Level1] AS [l1] - WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse3Id] IS NOT NULL) + WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL ) AS [t2] ON CASE - WHEN ([t0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t0].[Level1_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t0].[Id] + WHEN [t0].[OneToOne_Required_PK_Date] IS NOT NULL AND [t0].[Level1_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t0].[Id] END = [t2].[Level2_Optional_Id] ) AS [t1] ORDER BY [t].[Id], [t1].[Id] @@ -2156,12 +2156,12 @@ FROM [Level1] AS [l] LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[Level2_Name], [l0].[OneToMany_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id] FROM [Level1] AS [l0] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] ON [l].[Id] = [t].[OneToMany_Optional_Inverse2Id] LEFT JOIN ( SELECT [l1].[Id], [l1].[OneToOne_Required_PK_Date], [l1].[Level1_Optional_Id], [l1].[Level1_Required_Id], [l1].[Level2_Name], [l1].[OneToMany_Optional_Inverse2Id], [l1].[OneToMany_Required_Inverse2Id], [l1].[OneToOne_Optional_PK_Inverse2Id] FROM [Level1] AS [l1] - WHERE ([l1].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l1].[Level1_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l1].[OneToOne_Required_PK_Date] IS NOT NULL AND [l1].[Level1_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t0] ON [l].[Id] = [t0].[OneToMany_Optional_Inverse2Id] ORDER BY [l].[Id], [t].[Id] """); @@ -2180,7 +2180,7 @@ LEFT JOIN ( FROM ( SELECT 1 AS [c], [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Required_Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToMany_Optional_Inverse2Id], ROW_NUMBER() OVER(PARTITION BY [l0].[OneToMany_Optional_Inverse2Id] ORDER BY [l0].[Id]) AS [row] FROM [Level1] AS [l0] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) AND ([l0].[Level2_Name] <> N'Foo' OR ([l0].[Level2_Name] IS NULL)) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL AND ([l0].[Level2_Name] <> N'Foo' OR [l0].[Level2_Name] IS NULL) ) AS [t] WHERE [t].[row] <= 1 ) AS [t0] ON [l].[Id] = [t0].[OneToMany_Optional_Inverse2Id] @@ -2190,8 +2190,8 @@ FROM [Level1] AS [l1] WHERE EXISTS ( SELECT 1 FROM [Level1] AS [l2] - WHERE ([l2].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l2].[Level1_Required_Id] IS NOT NULL) AND ([l2].[OneToMany_Required_Inverse2Id] IS NOT NULL) AND [l1].[Id] = [l2].[OneToMany_Optional_Inverse2Id] AND [l2].[Id] = CASE - WHEN ([t0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t0].[Level1_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t0].[Id] + WHERE [l2].[OneToOne_Required_PK_Date] IS NOT NULL AND [l2].[Level1_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse2Id] IS NOT NULL AND [l1].[Id] = [l2].[OneToMany_Optional_Inverse2Id] AND [l2].[Id] = CASE + WHEN [t0].[OneToOne_Required_PK_Date] IS NOT NULL AND [t0].[Level1_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t0].[Id] END) ) AS [t1] ORDER BY [l].[Id], [t0].[Id] @@ -2209,27 +2209,27 @@ FROM [Level1] AS [l] LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Required_Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id] FROM [Level1] AS [l0] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] ON [l].[Id] = [t].[OneToOne_Optional_PK_Inverse2Id] LEFT JOIN ( SELECT [l1].[Id], [l1].[OneToOne_Required_PK_Date], [l1].[Level1_Optional_Id], [l1].[Level1_Required_Id], [l1].[Level2_Name], [l1].[OneToMany_Optional_Inverse2Id], [l1].[OneToMany_Required_Inverse2Id], [l1].[OneToOne_Optional_PK_Inverse2Id] FROM [Level1] AS [l1] - WHERE ([l1].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l1].[Level1_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l1].[OneToOne_Required_PK_Date] IS NOT NULL AND [l1].[Level1_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t0] ON [l].[Id] = [t0].[Level1_Optional_Id] LEFT JOIN ( SELECT [t2].[Id], [t2].[Level2_Optional_Id], [t2].[Level2_Required_Id], [t2].[Level3_Name], [t2].[OneToMany_Optional_Inverse3Id], [t2].[OneToMany_Required_Inverse3Id], [t2].[OneToOne_Optional_PK_Inverse3Id], [t2].[c] FROM ( SELECT [l2].[Id], [l2].[Level2_Optional_Id], [l2].[Level2_Required_Id], [l2].[Level3_Name], [l2].[OneToMany_Optional_Inverse3Id], [l2].[OneToMany_Required_Inverse3Id], [l2].[OneToOne_Optional_PK_Inverse3Id], ROW_NUMBER() OVER(PARTITION BY [l2].[OneToMany_Optional_Inverse3Id] ORDER BY CASE - WHEN ([l2].[Level2_Required_Id] IS NOT NULL) AND ([l2].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [l2].[Id] + WHEN [l2].[Level2_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [l2].[Id] END) AS [row], CASE - WHEN ([l2].[Level2_Required_Id] IS NOT NULL) AND ([l2].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [l2].[Id] + WHEN [l2].[Level2_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [l2].[Id] END AS [c] FROM [Level1] AS [l2] - WHERE ([l2].[Level2_Required_Id] IS NOT NULL) AND ([l2].[OneToMany_Required_Inverse3Id] IS NOT NULL) + WHERE [l2].[Level2_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse3Id] IS NOT NULL ) AS [t2] WHERE [t2].[row] <= 3 ) AS [t1] ON CASE - WHEN ([t0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t0].[Level1_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t0].[Id] + WHEN [t0].[OneToOne_Required_PK_Date] IS NOT NULL AND [t0].[Level1_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t0].[Id] END = [t1].[OneToMany_Optional_Inverse3Id] LEFT JOIN ( SELECT [l3].[Id], [l3].[Level2_Optional_Id], [l3].[Level2_Required_Id], [l3].[Level3_Name], [l3].[OneToMany_Optional_Inverse3Id], [l3].[OneToMany_Required_Inverse3Id], [l3].[OneToOne_Optional_PK_Inverse3Id], [t4].[Id] AS [Id0], [t4].[Level3_Optional_Id], [t4].[Level3_Required_Id], [t4].[Level4_Name], [t4].[OneToMany_Optional_Inverse4Id], [t4].[OneToMany_Required_Inverse4Id], [t4].[OneToOne_Optional_PK_Inverse4Id] @@ -2237,18 +2237,18 @@ FROM [Level1] AS [l3] LEFT JOIN ( SELECT [l4].[Id], [l4].[Level3_Optional_Id], [l4].[Level3_Required_Id], [l4].[Level4_Name], [l4].[OneToMany_Optional_Inverse4Id], [l4].[OneToMany_Required_Inverse4Id], [l4].[OneToOne_Optional_PK_Inverse4Id] FROM [Level1] AS [l4] - WHERE ([l4].[Level3_Required_Id] IS NOT NULL) AND ([l4].[OneToMany_Required_Inverse4Id] IS NOT NULL) + WHERE [l4].[Level3_Required_Id] IS NOT NULL AND [l4].[OneToMany_Required_Inverse4Id] IS NOT NULL ) AS [t4] ON CASE - WHEN ([l3].[Level2_Required_Id] IS NOT NULL) AND ([l3].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [l3].[Id] + WHEN [l3].[Level2_Required_Id] IS NOT NULL AND [l3].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [l3].[Id] END = [t4].[Level3_Optional_Id] - WHERE ([l3].[Level2_Required_Id] IS NOT NULL) AND ([l3].[OneToMany_Required_Inverse3Id] IS NOT NULL) + WHERE [l3].[Level2_Required_Id] IS NOT NULL AND [l3].[OneToMany_Required_Inverse3Id] IS NOT NULL ) AS [t3] ON CASE - WHEN ([t0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t0].[Level1_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t0].[Id] + WHEN [t0].[OneToOne_Required_PK_Date] IS NOT NULL AND [t0].[Level1_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t0].[Id] END = [t3].[OneToMany_Required_Inverse3Id] WHERE CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] END < 3 OR CASE - WHEN ([t0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t0].[Level1_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t0].[Id] + WHEN [t0].[OneToOne_Required_PK_Date] IS NOT NULL AND [t0].[Level1_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t0].[Id] END > 8 ORDER BY [l].[Id], [t].[Id], [t0].[Id], [t1].[OneToMany_Optional_Inverse3Id], [t1].[c], [t1].[Id], [t3].[Id] """); @@ -2265,28 +2265,28 @@ FROM [Level1] AS [l] INNER JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Required_Id], [l0].[OneToMany_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l0] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] ON [l].[Id] = [t].[OneToMany_Optional_Inverse2Id] INNER JOIN ( SELECT [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Level3_Name], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[OneToOne_Optional_PK_Inverse3Id] FROM [Level1] AS [l1] - WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse3Id] IS NOT NULL) + WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL ) AS [t0] ON CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] END = [t0].[OneToMany_Optional_Inverse3Id] LEFT JOIN ( SELECT [l2].[Id], [l2].[Level3_Optional_Id], [l2].[Level3_Required_Id], [l2].[Level4_Name], [l2].[OneToMany_Optional_Inverse4Id], [l2].[OneToMany_Required_Inverse4Id], [l2].[OneToOne_Optional_PK_Inverse4Id] FROM [Level1] AS [l2] - WHERE ([l2].[Level3_Required_Id] IS NOT NULL) AND ([l2].[OneToMany_Required_Inverse4Id] IS NOT NULL) + WHERE [l2].[Level3_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse4Id] IS NOT NULL ) AS [t1] ON CASE - WHEN ([t0].[Level2_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [t0].[Id] + WHEN [t0].[Level2_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [t0].[Id] END = [t1].[Level3_Required_Id] LEFT JOIN ( SELECT [l3].[Id], [l3].[Level3_Optional_Id], [l3].[Level3_Required_Id], [l3].[Level4_Name], [l3].[OneToMany_Optional_Inverse4Id], [l3].[OneToMany_Required_Inverse4Id], [l3].[OneToOne_Optional_PK_Inverse4Id] FROM [Level1] AS [l3] - WHERE ([l3].[Level3_Required_Id] IS NOT NULL) AND ([l3].[OneToMany_Required_Inverse4Id] IS NOT NULL) + WHERE [l3].[Level3_Required_Id] IS NOT NULL AND [l3].[OneToMany_Required_Inverse4Id] IS NOT NULL ) AS [t2] ON CASE - WHEN ([t0].[Level2_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [t0].[Id] + WHEN [t0].[Level2_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [t0].[Id] END = [t2].[OneToMany_Optional_Inverse4Id] ORDER BY [l].[Id], [t].[Id], [t0].[Id], [t1].[Id] """); @@ -2307,7 +2307,7 @@ FROM [Level1] AS [l] LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[Level2_Name], [l0].[OneToMany_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id] FROM [Level1] AS [l0] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t0] ON [t].[Id] = [t0].[OneToMany_Optional_Inverse2Id] ORDER BY [t].[Id] """); @@ -2324,14 +2324,14 @@ FROM [Level1] AS [l] INNER JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[Level2_Name], [l0].[OneToMany_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id] FROM [Level1] AS [l0] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] ON [l].[Id] = [t].[OneToMany_Optional_Inverse2Id] LEFT JOIN ( SELECT [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Level3_Name], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[OneToOne_Optional_PK_Inverse3Id] FROM [Level1] AS [l1] - WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse3Id] IS NOT NULL) + WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL ) AS [t0] ON CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] END = [t0].[OneToMany_Optional_Inverse3Id] ORDER BY [l].[Id], [t].[Id] """); @@ -2349,21 +2349,21 @@ LEFT JOIN ( SELECT [t].[c], [t].[Id], [t].[OneToOne_Required_PK_Date], [t].[Level1_Required_Id], [t].[OneToMany_Required_Inverse2Id], [t].[OneToMany_Optional_Inverse2Id] FROM ( SELECT 1 AS [c], [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Required_Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToMany_Optional_Inverse2Id], ROW_NUMBER() OVER(PARTITION BY [l0].[OneToMany_Optional_Inverse2Id] ORDER BY CASE - WHEN ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [l0].[Id] + WHEN [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [l0].[Id] END) AS [row] FROM [Level1] AS [l0] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] WHERE [t].[row] <= 1 ) AS [t0] ON [l].[Id] = [t0].[OneToMany_Optional_Inverse2Id] LEFT JOIN ( SELECT CASE - WHEN ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [l1].[Id] + WHEN [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [l1].[Id] END AS [Id], [l1].[Id] AS [Id0], [l1].[OneToMany_Optional_Inverse3Id] FROM [Level1] AS [l1] - WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse3Id] IS NOT NULL) + WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL ) AS [t1] ON CASE - WHEN ([t0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t0].[Level1_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t0].[Id] + WHEN [t0].[OneToOne_Required_PK_Date] IS NOT NULL AND [t0].[Level1_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t0].[Id] END = [t1].[OneToMany_Optional_Inverse3Id] ORDER BY [l].[Id], [t0].[Id], [t1].[Id] """); @@ -2380,7 +2380,7 @@ FROM [Level1] AS [l] LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[Level2_Name], [l0].[OneToMany_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id] FROM [Level1] AS [l0] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] ON [l].[Id] = [t].[OneToMany_Optional_Inverse2Id] ORDER BY [l].[Id], [t].[Level2_Name] """); @@ -2398,27 +2398,27 @@ OUTER APPLY ( SELECT [t].[Id], [t].[OneToOne_Required_PK_Date], [t].[Level1_Optional_Id], [t].[Level1_Required_Id], [t].[Level2_Name], [t].[OneToMany_Optional_Inverse2Id], [t].[OneToMany_Required_Inverse2Id], [t].[OneToOne_Optional_PK_Inverse2Id], [t0].[Id] AS [Id0], [t1].[Id] AS [Id1], [t1].[Level2_Optional_Id], [t1].[Level2_Required_Id], [t1].[Level3_Name], [t1].[OneToMany_Optional_Inverse3Id], [t1].[OneToMany_Required_Inverse3Id], [t1].[OneToOne_Optional_PK_Inverse3Id], [t0].[Level2_Optional_Id] AS [Level2_Optional_Id0], [t0].[Level2_Required_Id] AS [Level2_Required_Id0], [t0].[Level3_Name] AS [Level3_Name0], [t0].[OneToMany_Optional_Inverse3Id] AS [OneToMany_Optional_Inverse3Id0], [t0].[OneToMany_Required_Inverse3Id] AS [OneToMany_Required_Inverse3Id0], [t0].[OneToOne_Optional_PK_Inverse3Id] AS [OneToOne_Optional_PK_Inverse3Id0], [t].[c] FROM ( SELECT TOP(2) [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[Level2_Name], [l0].[OneToMany_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id], CASE - WHEN ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [l0].[Id] + WHEN [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [l0].[Id] END AS [c] FROM [Level1] AS [l0] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) AND [l].[Id] = [l0].[OneToMany_Optional_Inverse2Id] AND ([l0].[Level2_Name] <> N'Foo' OR ([l0].[Level2_Name] IS NULL)) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL AND [l].[Id] = [l0].[OneToMany_Optional_Inverse2Id] AND ([l0].[Level2_Name] <> N'Foo' OR [l0].[Level2_Name] IS NULL) ORDER BY CASE - WHEN ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [l0].[Id] + WHEN [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [l0].[Id] END ) AS [t] LEFT JOIN ( SELECT [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Level3_Name], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[OneToOne_Optional_PK_Inverse3Id] FROM [Level1] AS [l1] - WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse3Id] IS NOT NULL) + WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL ) AS [t0] ON CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] END = [t0].[Level2_Required_Id] LEFT JOIN ( SELECT [l2].[Id], [l2].[Level2_Optional_Id], [l2].[Level2_Required_Id], [l2].[Level3_Name], [l2].[OneToMany_Optional_Inverse3Id], [l2].[OneToMany_Required_Inverse3Id], [l2].[OneToOne_Optional_PK_Inverse3Id] FROM [Level1] AS [l2] - WHERE ([l2].[Level2_Required_Id] IS NOT NULL) AND ([l2].[OneToMany_Required_Inverse3Id] IS NOT NULL) + WHERE [l2].[Level2_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse3Id] IS NOT NULL ) AS [t1] ON CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] END = [t1].[OneToMany_Optional_Inverse3Id] ) AS [t2] ORDER BY [l].[Id], [t2].[c], [t2].[Id], [t2].[Id0] @@ -2436,7 +2436,7 @@ public override async Task Include_collection_with_groupby_in_subquery_and_filte SELECT [l].[Name] FROM [Level1] AS [l] GROUP BY [l].[Name] - HAVING [l].[Name] <> N'Foo' OR ([l].[Name] IS NULL) + HAVING [l].[Name] <> N'Foo' OR [l].[Name] IS NULL ) AS [t] LEFT JOIN ( SELECT [t1].[Id], [t1].[Date], [t1].[Name] @@ -2449,7 +2449,7 @@ FROM [Level1] AS [l0] LEFT JOIN ( SELECT [l1].[Id], [l1].[OneToOne_Required_PK_Date], [l1].[Level1_Optional_Id], [l1].[Level1_Required_Id], [l1].[Level2_Name], [l1].[OneToMany_Optional_Inverse2Id], [l1].[OneToMany_Required_Inverse2Id], [l1].[OneToOne_Optional_PK_Inverse2Id] FROM [Level1] AS [l1] - WHERE ([l1].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l1].[Level1_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l1].[OneToOne_Required_PK_Date] IS NOT NULL AND [l1].[Level1_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t2] ON [t0].[Id] = [t2].[OneToMany_Optional_Inverse2Id] ORDER BY [t].[Name], [t0].[Id] """); @@ -2469,12 +2469,12 @@ LEFT JOIN ( SELECT [t].[Id], [t].[OneToOne_Required_PK_Date], [t].[Level1_Optional_Id], [t].[Level1_Required_Id], [t].[Level2_Name], [t].[OneToMany_Optional_Inverse2Id], [t].[OneToMany_Required_Inverse2Id], [t].[OneToOne_Optional_PK_Inverse2Id], [t].[c] FROM ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[Level2_Name], [l0].[OneToMany_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id], ROW_NUMBER() OVER(PARTITION BY [l0].[OneToMany_Optional_Inverse2Id] ORDER BY CASE - WHEN ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [l0].[Id] + WHEN [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [l0].[Id] END) AS [row], CASE - WHEN ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [l0].[Id] + WHEN [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [l0].[Id] END AS [c] FROM [Level1] AS [l0] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) AND ([l0].[Level2_Name] <> @__prm_0 OR ([l0].[Level2_Name] IS NULL)) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL AND ([l0].[Level2_Name] <> @__prm_0 OR [l0].[Level2_Name] IS NULL) ) AS [t] WHERE [t].[row] <= 3 ) AS [t0] ON [l].[Id] = [t0].[OneToMany_Optional_Inverse2Id] @@ -2496,11 +2496,11 @@ FROM [Level1] AS [l0] LEFT JOIN ( SELECT [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Level3_Name], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[OneToOne_Optional_PK_Inverse3Id] FROM [Level1] AS [l1] - WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse3Id] IS NOT NULL) + WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL ) AS [t] ON CASE - WHEN ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [l0].[Id] + WHEN [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [l0].[Id] END = [t].[OneToMany_Optional_Inverse3Id] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t0] ON [l].[Id] = [t0].[OneToMany_Optional_Inverse2Id] ORDER BY [l].[Id], [t0].[Id], [t0].[Level3_Name] """); @@ -2520,27 +2520,27 @@ OUTER APPLY ( SELECT [t].[Id], [t].[OneToOne_Required_PK_Date], [t].[Level1_Optional_Id], [t].[Level1_Required_Id], [t].[Level2_Name], [t].[OneToMany_Optional_Inverse2Id], [t].[OneToMany_Required_Inverse2Id], [t].[OneToOne_Optional_PK_Inverse2Id], [t0].[Id] AS [Id0], [t1].[Id] AS [Id1], [t1].[Level2_Optional_Id], [t1].[Level2_Required_Id], [t1].[Level3_Name], [t1].[OneToMany_Optional_Inverse3Id], [t1].[OneToMany_Required_Inverse3Id], [t1].[OneToOne_Optional_PK_Inverse3Id], [t0].[Level2_Optional_Id] AS [Level2_Optional_Id0], [t0].[Level2_Required_Id] AS [Level2_Required_Id0], [t0].[Level3_Name] AS [Level3_Name0], [t0].[OneToMany_Optional_Inverse3Id] AS [OneToMany_Optional_Inverse3Id0], [t0].[OneToMany_Required_Inverse3Id] AS [OneToMany_Required_Inverse3Id0], [t0].[OneToOne_Optional_PK_Inverse3Id] AS [OneToOne_Optional_PK_Inverse3Id0], [t].[c] FROM ( SELECT TOP(2) [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[Level2_Name], [l0].[OneToMany_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id], CASE - WHEN ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [l0].[Id] + WHEN [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [l0].[Id] END AS [c] FROM [Level1] AS [l0] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) AND [l].[Id] = [l0].[OneToMany_Optional_Inverse2Id] AND ([l0].[Level2_Name] <> N'Foo' OR ([l0].[Level2_Name] IS NULL)) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL AND [l].[Id] = [l0].[OneToMany_Optional_Inverse2Id] AND ([l0].[Level2_Name] <> N'Foo' OR [l0].[Level2_Name] IS NULL) ORDER BY CASE - WHEN ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [l0].[Id] + WHEN [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [l0].[Id] END ) AS [t] LEFT JOIN ( SELECT [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Level3_Name], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[OneToOne_Optional_PK_Inverse3Id] FROM [Level1] AS [l1] - WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse3Id] IS NOT NULL) + WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL ) AS [t0] ON CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] END = [t0].[Level2_Required_Id] LEFT JOIN ( SELECT [l2].[Id], [l2].[Level2_Optional_Id], [l2].[Level2_Required_Id], [l2].[Level3_Name], [l2].[OneToMany_Optional_Inverse3Id], [l2].[OneToMany_Required_Inverse3Id], [l2].[OneToOne_Optional_PK_Inverse3Id] FROM [Level1] AS [l2] - WHERE ([l2].[Level2_Required_Id] IS NOT NULL) AND ([l2].[OneToMany_Required_Inverse3Id] IS NOT NULL) + WHERE [l2].[Level2_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse3Id] IS NOT NULL ) AS [t1] ON CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] END = [t1].[OneToMany_Optional_Inverse3Id] ) AS [t2] ORDER BY [l].[Id], [t2].[c], [t2].[Id], [t2].[Id0] @@ -2560,7 +2560,7 @@ LEFT JOIN ( FROM ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[Level2_Name], [l0].[OneToMany_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id], ROW_NUMBER() OVER(PARTITION BY [l0].[OneToMany_Optional_Inverse2Id] ORDER BY [l0].[Id]) AS [row] FROM [Level1] AS [l0] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] WHERE 1 < [t].[row] ) AS [t0] ON [l].[Id] = [t0].[OneToMany_Optional_Inverse2Id] @@ -2606,32 +2606,32 @@ FROM [Level1] AS [l0] LEFT JOIN ( SELECT [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Level3_Name], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[OneToOne_Optional_PK_Inverse3Id] FROM [Level1] AS [l1] - WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse3Id] IS NOT NULL) + WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL ) AS [t] ON CASE - WHEN ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [l0].[Id] + WHEN [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [l0].[Id] END = [t].[OneToOne_Optional_PK_Inverse3Id] LEFT JOIN ( SELECT [l2].[Id], [l2].[Level3_Optional_Id], [l2].[Level3_Required_Id], [l2].[Level4_Name], [l2].[OneToMany_Optional_Inverse4Id], [l2].[OneToMany_Required_Inverse4Id], [l2].[OneToOne_Optional_PK_Inverse4Id] FROM [Level1] AS [l2] - WHERE ([l2].[Level3_Required_Id] IS NOT NULL) AND ([l2].[OneToMany_Required_Inverse4Id] IS NOT NULL) + WHERE [l2].[Level3_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse4Id] IS NOT NULL ) AS [t0] ON CASE - WHEN ([t].[Level2_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [t].[Id] + WHEN [t].[Level2_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [t].[Id] END = [t0].[Level3_Optional_Id] LEFT JOIN ( SELECT [l3].[Id], [l3].[Level2_Optional_Id], [l3].[Level2_Required_Id], [l3].[Level3_Name], [l3].[OneToMany_Optional_Inverse3Id], [l3].[OneToMany_Required_Inverse3Id], [l3].[OneToOne_Optional_PK_Inverse3Id] FROM [Level1] AS [l3] - WHERE ([l3].[Level2_Required_Id] IS NOT NULL) AND ([l3].[OneToMany_Required_Inverse3Id] IS NOT NULL) + WHERE [l3].[Level2_Required_Id] IS NOT NULL AND [l3].[OneToMany_Required_Inverse3Id] IS NOT NULL ) AS [t1] ON CASE - WHEN ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [l0].[Id] + WHEN [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [l0].[Id] END = [t1].[Level2_Optional_Id] LEFT JOIN ( SELECT [l4].[Id], [l4].[Level3_Optional_Id], [l4].[Level3_Required_Id], [l4].[Level4_Name], [l4].[OneToMany_Optional_Inverse4Id], [l4].[OneToMany_Required_Inverse4Id], [l4].[OneToOne_Optional_PK_Inverse4Id] FROM [Level1] AS [l4] - WHERE ([l4].[Level3_Required_Id] IS NOT NULL) AND ([l4].[OneToMany_Required_Inverse4Id] IS NOT NULL) + WHERE [l4].[Level3_Required_Id] IS NOT NULL AND [l4].[OneToMany_Required_Inverse4Id] IS NOT NULL ) AS [t2] ON CASE - WHEN ([t1].[Level2_Required_Id] IS NOT NULL) AND ([t1].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [t1].[Id] + WHEN [t1].[Level2_Required_Id] IS NOT NULL AND [t1].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [t1].[Id] END = [t2].[OneToMany_Optional_Inverse4Id] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t3] ON [l].[Id] = [t3].[OneToMany_Optional_Inverse2Id] ORDER BY [l].[Id], [t3].[Id], [t3].[Id0], [t3].[Id1], [t3].[Id2] """); @@ -2650,7 +2650,7 @@ LEFT JOIN ( FROM ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[Level2_Name], [l0].[OneToMany_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id], ROW_NUMBER() OVER(PARTITION BY [l0].[OneToMany_Optional_Inverse2Id] ORDER BY [l0].[Id]) AS [row] FROM [Level1] AS [l0] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] WHERE [t].[row] <= 50 ) AS [t0] ON [l].[Id] = [t0].[OneToMany_Optional_Inverse2Id] @@ -2669,7 +2669,7 @@ FROM [Level1] AS [l] LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[Level2_Name], [l0].[OneToMany_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id] FROM [Level1] AS [l0] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] ON [l].[Id] = [t].[Level1_Optional_Id] LEFT JOIN ( SELECT [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Level3_Name], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[OneToOne_Optional_PK_Inverse3Id], [t1].[Id] AS [Id0], [t1].[Level3_Optional_Id], [t1].[Level3_Required_Id], [t1].[Level4_Name], [t1].[OneToMany_Optional_Inverse4Id], [t1].[OneToMany_Required_Inverse4Id], [t1].[OneToOne_Optional_PK_Inverse4Id] @@ -2677,13 +2677,13 @@ FROM [Level1] AS [l1] LEFT JOIN ( SELECT [l2].[Id], [l2].[Level3_Optional_Id], [l2].[Level3_Required_Id], [l2].[Level4_Name], [l2].[OneToMany_Optional_Inverse4Id], [l2].[OneToMany_Required_Inverse4Id], [l2].[OneToOne_Optional_PK_Inverse4Id] FROM [Level1] AS [l2] - WHERE ([l2].[Level3_Required_Id] IS NOT NULL) AND ([l2].[OneToMany_Required_Inverse4Id] IS NOT NULL) + WHERE [l2].[Level3_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse4Id] IS NOT NULL ) AS [t1] ON CASE - WHEN ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [l1].[Id] + WHEN [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [l1].[Id] END = [t1].[Level3_Optional_Id] - WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse3Id] IS NOT NULL) + WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL ) AS [t0] ON CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] END = [t0].[OneToMany_Optional_Inverse3Id] ORDER BY [l].[Id], [t].[Id], [t0].[Id] """); @@ -2700,19 +2700,19 @@ FROM [Level1] AS [l] LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[Level2_Name], [l0].[OneToMany_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id] FROM [Level1] AS [l0] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] ON [l].[Id] = [t].[Level1_Required_Id] LEFT JOIN ( SELECT [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Level3_Name], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[OneToOne_Optional_PK_Inverse3Id] FROM [Level1] AS [l1] - WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse3Id] IS NOT NULL) + WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL ) AS [t0] ON CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] END = [t0].[Level2_Optional_Id] LEFT JOIN ( SELECT [l2].[Id], [l2].[OneToOne_Required_PK_Date], [l2].[Level1_Optional_Id], [l2].[Level1_Required_Id], [l2].[Level2_Name], [l2].[OneToMany_Optional_Inverse2Id], [l2].[OneToMany_Required_Inverse2Id], [l2].[OneToOne_Optional_PK_Inverse2Id] FROM [Level1] AS [l2] - WHERE ([l2].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l2].[Level1_Required_Id] IS NOT NULL) AND ([l2].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l2].[OneToOne_Required_PK_Date] IS NOT NULL AND [l2].[Level1_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t1] ON [l].[Id] = [t1].[OneToMany_Required_Inverse2Id] ORDER BY [l].[Id], [t].[Id], [t0].[Id] """); @@ -2729,14 +2729,14 @@ FROM [Level1] AS [l] LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[Level2_Name], [l0].[OneToMany_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id] FROM [Level1] AS [l0] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] ON [l].[Id] = [t].[Level1_Optional_Id] LEFT JOIN ( SELECT [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Level3_Name], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[OneToOne_Optional_PK_Inverse3Id] FROM [Level1] AS [l1] - WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse3Id] IS NOT NULL) + WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL ) AS [t0] ON CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] END = [t0].[OneToMany_Optional_Inverse3Id] ORDER BY [t].[Level2_Name], [l].[Id], [t].[Id] """); @@ -2753,12 +2753,12 @@ FROM [Level1] AS [l] LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Required_Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id] FROM [Level1] AS [l0] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] ON [l].[Id] = [t].[OneToOne_Optional_PK_Inverse2Id] LEFT JOIN ( SELECT [l1].[Id], [l1].[OneToOne_Required_PK_Date], [l1].[Level1_Optional_Id], [l1].[Level1_Required_Id], [l1].[Level2_Name], [l1].[OneToMany_Optional_Inverse2Id], [l1].[OneToMany_Required_Inverse2Id], [l1].[OneToOne_Optional_PK_Inverse2Id] FROM [Level1] AS [l1] - WHERE ([l1].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l1].[Level1_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l1].[OneToOne_Required_PK_Date] IS NOT NULL AND [l1].[Level1_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t0] ON [l].[Id] = [t0].[Level1_Optional_Id] LEFT JOIN ( SELECT [l2].[Id], [l2].[Level2_Optional_Id], [l2].[Level2_Required_Id], [l2].[Level3_Name], [l2].[OneToMany_Optional_Inverse3Id], [l2].[OneToMany_Required_Inverse3Id], [l2].[OneToOne_Optional_PK_Inverse3Id], [t2].[Id] AS [Id0], [t2].[Level3_Optional_Id], [t2].[Level3_Required_Id], [t2].[Level4_Name], [t2].[OneToMany_Optional_Inverse4Id], [t2].[OneToMany_Required_Inverse4Id], [t2].[OneToOne_Optional_PK_Inverse4Id] @@ -2766,18 +2766,18 @@ FROM [Level1] AS [l2] LEFT JOIN ( SELECT [l3].[Id], [l3].[Level3_Optional_Id], [l3].[Level3_Required_Id], [l3].[Level4_Name], [l3].[OneToMany_Optional_Inverse4Id], [l3].[OneToMany_Required_Inverse4Id], [l3].[OneToOne_Optional_PK_Inverse4Id] FROM [Level1] AS [l3] - WHERE ([l3].[Level3_Required_Id] IS NOT NULL) AND ([l3].[OneToMany_Required_Inverse4Id] IS NOT NULL) + WHERE [l3].[Level3_Required_Id] IS NOT NULL AND [l3].[OneToMany_Required_Inverse4Id] IS NOT NULL ) AS [t2] ON CASE - WHEN ([l2].[Level2_Required_Id] IS NOT NULL) AND ([l2].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [l2].[Id] + WHEN [l2].[Level2_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [l2].[Id] END = [t2].[Level3_Optional_Id] - WHERE ([l2].[Level2_Required_Id] IS NOT NULL) AND ([l2].[OneToMany_Required_Inverse3Id] IS NOT NULL) + WHERE [l2].[Level2_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse3Id] IS NOT NULL ) AS [t1] ON CASE - WHEN ([t0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t0].[Level1_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t0].[Id] + WHEN [t0].[OneToOne_Required_PK_Date] IS NOT NULL AND [t0].[Level1_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t0].[Id] END = [t1].[OneToMany_Optional_Inverse3Id] WHERE CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] END < 3 OR CASE - WHEN ([t0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t0].[Level1_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t0].[Id] + WHEN [t0].[OneToOne_Required_PK_Date] IS NOT NULL AND [t0].[Level1_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t0].[Id] END > 8 ORDER BY [l].[Id], [t].[Id], [t0].[Id], [t1].[Id] """); @@ -2797,18 +2797,18 @@ FROM [Level1] AS [l2] LEFT JOIN ( SELECT [l3].[Id], [l3].[Level2_Optional_Id], [l3].[Level2_Required_Id], [l3].[Level3_Name], [l3].[OneToMany_Optional_Inverse3Id], [l3].[OneToMany_Required_Inverse3Id], [l3].[OneToOne_Optional_PK_Inverse3Id] FROM [Level1] AS [l3] - WHERE ([l3].[Level2_Required_Id] IS NOT NULL) AND ([l3].[OneToMany_Required_Inverse3Id] IS NOT NULL) + WHERE [l3].[Level2_Required_Id] IS NOT NULL AND [l3].[OneToMany_Required_Inverse3Id] IS NOT NULL ) AS [t0] ON CASE - WHEN ([l2].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l2].[Level1_Required_Id] IS NOT NULL) AND ([l2].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [l2].[Id] + WHEN [l2].[OneToOne_Required_PK_Date] IS NOT NULL AND [l2].[Level1_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [l2].[Id] END = [t0].[OneToOne_Optional_PK_Inverse3Id] LEFT JOIN ( SELECT [l4].[Id], [l4].[Level3_Optional_Id], [l4].[Level3_Required_Id], [l4].[Level4_Name], [l4].[OneToMany_Optional_Inverse4Id], [l4].[OneToMany_Required_Inverse4Id], [l4].[OneToOne_Optional_PK_Inverse4Id] FROM [Level1] AS [l4] - WHERE ([l4].[Level3_Required_Id] IS NOT NULL) AND ([l4].[OneToMany_Required_Inverse4Id] IS NOT NULL) + WHERE [l4].[Level3_Required_Id] IS NOT NULL AND [l4].[OneToMany_Required_Inverse4Id] IS NOT NULL ) AS [t2] ON CASE - WHEN ([t0].[Level2_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [t0].[Id] + WHEN [t0].[Level2_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [t0].[Id] END = [t2].[Level3_Optional_Id] - WHERE ([l2].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l2].[Level1_Required_Id] IS NOT NULL) AND ([l2].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l2].[OneToOne_Required_PK_Date] IS NOT NULL AND [l2].[Level1_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t1] ON [l].[Id] = [t1].[OneToMany_Optional_Inverse2Id] WHERE ( SELECT COUNT(*) @@ -2816,11 +2816,11 @@ FROM [Level1] AS [l0] LEFT JOIN ( SELECT [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Level3_Name], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[OneToOne_Optional_PK_Inverse3Id] FROM [Level1] AS [l1] - WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse3Id] IS NOT NULL) + WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL ) AS [t] ON CASE - WHEN ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [l0].[Id] + WHEN [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [l0].[Id] END = [t].[OneToOne_Optional_PK_Inverse3Id] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) AND [l].[Id] = [l0].[OneToMany_Optional_Inverse2Id] AND ([t].[Level3_Name] <> N'Foo' OR ([t].[Level3_Name] IS NULL))) > 0 + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL AND [l].[Id] = [l0].[OneToMany_Optional_Inverse2Id] AND ([t].[Level3_Name] <> N'Foo' OR [t].[Level3_Name] IS NULL)) > 0 ORDER BY [l].[Id], [t1].[Id], [t1].[Id0] """); } @@ -2836,7 +2836,7 @@ FROM [Level1] AS [l] LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[Level2_Name], [l0].[OneToMany_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id] FROM [Level1] AS [l0] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] ON [l].[Id] = [t].[OneToMany_Optional_Inverse2Id] ORDER BY [l].[Id] """); @@ -2849,8 +2849,8 @@ public override async Task LeftJoin_with_Any_on_outer_source_and_projecting_coll AssertSql( """ SELECT CASE - WHEN ([t0].[OneToOne_Required_PK_Date] IS NULL) OR ([t0].[Level1_Required_Id] IS NULL) OR ([t0].[OneToMany_Required_Inverse2Id] IS NULL) THEN 0 - WHEN ([t0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t0].[Level1_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t0].[Id0] + WHEN [t0].[OneToOne_Required_PK_Date] IS NULL OR [t0].[Level1_Required_Id] IS NULL OR [t0].[OneToMany_Required_Inverse2Id] IS NULL THEN 0 + WHEN [t0].[OneToOne_Required_PK_Date] IS NOT NULL AND [t0].[Level1_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t0].[Id0] END, [l].[Id], [t0].[Id], [t0].[Id0], [t1].[Id], [t1].[Level2_Optional_Id], [t1].[Level2_Required_Id], [t1].[Level3_Name], [t1].[OneToMany_Optional_Inverse3Id], [t1].[OneToMany_Required_Inverse3Id], [t1].[OneToOne_Optional_PK_Inverse3Id] FROM [Level1] AS [l] LEFT JOIN ( @@ -2859,18 +2859,18 @@ FROM [Level1] AS [l0] LEFT JOIN ( SELECT [l1].[Id], [l1].[OneToOne_Required_PK_Date], [l1].[Level1_Required_Id], [l1].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l1] - WHERE ([l1].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l1].[Level1_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l1].[OneToOne_Required_PK_Date] IS NOT NULL AND [l1].[Level1_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] ON [l0].[Id] = CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] END - WHERE ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t0] ON [l].[Id] = [t0].[Level1_Required_Id] LEFT JOIN ( SELECT [l2].[Id], [l2].[Level2_Optional_Id], [l2].[Level2_Required_Id], [l2].[Level3_Name], [l2].[OneToMany_Optional_Inverse3Id], [l2].[OneToMany_Required_Inverse3Id], [l2].[OneToOne_Optional_PK_Inverse3Id] FROM [Level1] AS [l2] - WHERE ([l2].[Level2_Required_Id] IS NOT NULL) AND ([l2].[OneToMany_Required_Inverse3Id] IS NOT NULL) + WHERE [l2].[Level2_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse3Id] IS NOT NULL ) AS [t1] ON CASE - WHEN ([t0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t0].[Level1_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t0].[Id0] + WHEN [t0].[OneToOne_Required_PK_Date] IS NOT NULL AND [t0].[Level1_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t0].[Id0] END = [t1].[OneToMany_Required_Inverse3Id] WHERE [l].[Name] IN (N'L1 01', N'L1 02') ORDER BY [l].[Id], [t0].[Id], [t0].[Id0] @@ -2891,11 +2891,11 @@ FROM [Level1] AS [l0] LEFT JOIN ( SELECT [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Level3_Name], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[OneToOne_Optional_PK_Inverse3Id] FROM [Level1] AS [l1] - WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse3Id] IS NOT NULL) + WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL ) AS [t] ON CASE - WHEN ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [l0].[Id] + WHEN [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [l0].[Id] END = [t].[OneToMany_Optional_Inverse3Id] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t0] ON [l].[Id] = [t0].[OneToMany_Optional_Inverse2Id] ORDER BY [l].[Id], [t0].[Id] """); @@ -2935,18 +2935,18 @@ public override async Task Null_check_in_Dto_projection_should_not_be_removed(bo FROM [Level1] AS [l] LEFT JOIN ( SELECT CASE - WHEN ([t].[Level2_Required_Id] IS NULL) OR ([t].[OneToMany_Required_Inverse3Id] IS NULL) THEN CAST(1 AS bit) + WHEN [t].[Level2_Required_Id] IS NULL OR [t].[OneToMany_Required_Inverse3Id] IS NULL THEN CAST(1 AS bit) ELSE CAST(0 AS bit) END AS [c], [t].[Level3_Name], [l0].[Id], [t].[Id] AS [Id0], [l0].[OneToMany_Optional_Inverse2Id] FROM [Level1] AS [l0] LEFT JOIN ( SELECT [l1].[Id], [l1].[Level2_Required_Id], [l1].[Level3_Name], [l1].[OneToMany_Required_Inverse3Id] FROM [Level1] AS [l1] - WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse3Id] IS NOT NULL) + WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL ) AS [t] ON CASE - WHEN ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [l0].[Id] + WHEN [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [l0].[Id] END = [t].[Level2_Required_Id] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t0] ON [l].[Id] = [t0].[OneToMany_Optional_Inverse2Id] ORDER BY [l].[Id], [t0].[Id] """); @@ -2965,7 +2965,7 @@ LEFT JOIN ( FROM ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[Level2_Name], [l0].[OneToMany_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id], ROW_NUMBER() OVER(PARTITION BY [l0].[OneToMany_Optional_Inverse2Id] ORDER BY [l0].[Level2_Name]) AS [row] FROM [Level1] AS [l0] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] WHERE [t].[row] <= 3 ) AS [t0] ON [l].[Id] = [t0].[OneToMany_Optional_Inverse2Id] @@ -2986,7 +2986,7 @@ OUTER APPLY ( FROM ( SELECT [l0].[Date] FROM [Level1] AS [l0] - WHERE [l0].[Name] = [l].[Name] OR (([l0].[Name] IS NULL) AND ([l].[Name] IS NULL)) + WHERE [l0].[Name] = [l].[Name] OR ([l0].[Name] IS NULL AND [l].[Name] IS NULL) GROUP BY [l0].[Date] ) AS [t] LEFT JOIN ( @@ -2994,7 +2994,7 @@ LEFT JOIN ( FROM ( SELECT [l1].[Id], [l1].[Date], [l1].[Name], ROW_NUMBER() OVER(PARTITION BY [l1].[Date] ORDER BY [l1].[Name]) AS [row] FROM [Level1] AS [l1] - WHERE [l1].[Name] = [l].[Name] OR (([l1].[Name] IS NULL) AND ([l].[Name] IS NULL)) + WHERE [l1].[Name] = [l].[Name] OR ([l1].[Name] IS NULL AND [l].[Name] IS NULL) ) AS [t1] WHERE 1 < [t1].[row] AND [t1].[row] <= 6 ) AS [t0] ON [t].[Date] = [t0].[Date] @@ -3015,12 +3015,12 @@ LEFT JOIN ( SELECT [t].[Id], [t].[OneToOne_Required_PK_Date], [t].[Level1_Optional_Id], [t].[Level1_Required_Id], [t].[Level2_Name], [t].[OneToMany_Optional_Inverse2Id], [t].[OneToMany_Required_Inverse2Id], [t].[OneToOne_Optional_PK_Inverse2Id], [t].[c] FROM ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[Level2_Name], [l0].[OneToMany_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id], ROW_NUMBER() OVER(PARTITION BY [l0].[OneToMany_Optional_Inverse2Id] ORDER BY CASE - WHEN ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [l0].[Id] + WHEN [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [l0].[Id] END) AS [row], CASE - WHEN ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [l0].[Id] + WHEN [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [l0].[Id] END AS [c] FROM [Level1] AS [l0] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] WHERE [t].[row] <= 1 ) AS [t0] ON [l].[Id] = [t0].[OneToMany_Optional_Inverse2Id] @@ -3063,14 +3063,14 @@ FROM [Level1] AS [l] LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[Level2_Name], [l0].[OneToMany_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id] FROM [Level1] AS [l0] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] ON [l].[Id] = [t].[Level1_Optional_Id] LEFT JOIN ( SELECT [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Level3_Name], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[OneToOne_Optional_PK_Inverse3Id] FROM [Level1] AS [l1] - WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse3Id] IS NOT NULL) + WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL ) AS [t0] ON CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] END = [t0].[OneToMany_Optional_Inverse3Id] ORDER BY [l].[Name], [l].[Id], [t].[Id] """); @@ -3116,18 +3116,18 @@ FROM [Level1] AS [l0] LEFT JOIN ( SELECT [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Level3_Name], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[OneToOne_Optional_PK_Inverse3Id] FROM [Level1] AS [l1] - WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse3Id] IS NOT NULL) + WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL ) AS [t] ON CASE - WHEN ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [l0].[Id] + WHEN [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [l0].[Id] END = [t].[OneToOne_Optional_PK_Inverse3Id] LEFT JOIN ( SELECT [l2].[Id], [l2].[Level3_Optional_Id], [l2].[Level3_Required_Id], [l2].[Level4_Name], [l2].[OneToMany_Optional_Inverse4Id], [l2].[OneToMany_Required_Inverse4Id], [l2].[OneToOne_Optional_PK_Inverse4Id] FROM [Level1] AS [l2] - WHERE ([l2].[Level3_Required_Id] IS NOT NULL) AND ([l2].[OneToMany_Required_Inverse4Id] IS NOT NULL) + WHERE [l2].[Level3_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse4Id] IS NOT NULL ) AS [t0] ON CASE - WHEN ([t].[Level2_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [t].[Id] + WHEN [t].[Level2_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [t].[Id] END = [t0].[Level3_Optional_Id] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t1] ON [l].[Id] = [t1].[OneToMany_Optional_Inverse2Id] ORDER BY [l].[Id], [t1].[Id], [t1].[Id0] """); @@ -3148,36 +3148,36 @@ OUTER APPLY ( SELECT [t].[Id], [t].[Level2_Optional_Id], [t].[Level2_Required_Id], [t].[Level3_Name], [t].[OneToMany_Optional_Inverse3Id], [t].[OneToMany_Required_Inverse3Id], [t].[OneToOne_Optional_PK_Inverse3Id], [t0].[Id] AS [Id0], [t0].[Level3_Optional_Id], [t0].[Level3_Required_Id], [t0].[Level4_Name], [t0].[OneToMany_Optional_Inverse4Id], [t0].[OneToMany_Required_Inverse4Id], [t0].[OneToOne_Optional_PK_Inverse4Id], [t1].[Id] AS [Id1], [t1].[Level3_Optional_Id] AS [Level3_Optional_Id0], [t1].[Level3_Required_Id] AS [Level3_Required_Id0], [t1].[Level4_Name] AS [Level4_Name0], [t1].[OneToMany_Optional_Inverse4Id] AS [OneToMany_Optional_Inverse4Id0], [t1].[OneToMany_Required_Inverse4Id] AS [OneToMany_Required_Inverse4Id0], [t1].[OneToOne_Optional_PK_Inverse4Id] AS [OneToOne_Optional_PK_Inverse4Id0], [t].[c] FROM ( SELECT TOP(1) [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Level3_Name], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[OneToOne_Optional_PK_Inverse3Id], CASE - WHEN ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [l1].[Id] + WHEN [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [l1].[Id] END AS [c] FROM [Level1] AS [l1] - WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse3Id] IS NOT NULL) AND (CASE - WHEN ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [l0].[Id] - END IS NOT NULL) AND (CASE - WHEN ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [l0].[Id] - END = [l1].[OneToMany_Optional_Inverse3Id] OR ((CASE - WHEN ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [l0].[Id] - END IS NULL) AND ([l1].[OneToMany_Optional_Inverse3Id] IS NULL))) AND ([l1].[Level3_Name] <> N'Foo' OR ([l1].[Level3_Name] IS NULL)) + WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL AND CASE + WHEN [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [l0].[Id] + END IS NOT NULL AND (CASE + WHEN [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [l0].[Id] + END = [l1].[OneToMany_Optional_Inverse3Id] OR (CASE + WHEN [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [l0].[Id] + END IS NULL AND [l1].[OneToMany_Optional_Inverse3Id] IS NULL)) AND ([l1].[Level3_Name] <> N'Foo' OR [l1].[Level3_Name] IS NULL) ORDER BY CASE - WHEN ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [l1].[Id] + WHEN [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [l1].[Id] END ) AS [t] LEFT JOIN ( SELECT [l2].[Id], [l2].[Level3_Optional_Id], [l2].[Level3_Required_Id], [l2].[Level4_Name], [l2].[OneToMany_Optional_Inverse4Id], [l2].[OneToMany_Required_Inverse4Id], [l2].[OneToOne_Optional_PK_Inverse4Id] FROM [Level1] AS [l2] - WHERE ([l2].[Level3_Required_Id] IS NOT NULL) AND ([l2].[OneToMany_Required_Inverse4Id] IS NOT NULL) + WHERE [l2].[Level3_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse4Id] IS NOT NULL ) AS [t0] ON CASE - WHEN ([t].[Level2_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [t].[Id] + WHEN [t].[Level2_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [t].[Id] END = [t0].[OneToMany_Optional_Inverse4Id] LEFT JOIN ( SELECT [l3].[Id], [l3].[Level3_Optional_Id], [l3].[Level3_Required_Id], [l3].[Level4_Name], [l3].[OneToMany_Optional_Inverse4Id], [l3].[OneToMany_Required_Inverse4Id], [l3].[OneToOne_Optional_PK_Inverse4Id] FROM [Level1] AS [l3] - WHERE ([l3].[Level3_Required_Id] IS NOT NULL) AND ([l3].[OneToMany_Required_Inverse4Id] IS NOT NULL) + WHERE [l3].[Level3_Required_Id] IS NOT NULL AND [l3].[OneToMany_Required_Inverse4Id] IS NOT NULL ) AS [t1] ON CASE - WHEN ([t].[Level2_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [t].[Id] + WHEN [t].[Level2_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [t].[Id] END = [t1].[OneToMany_Required_Inverse4Id] ) AS [t2] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t3] ON [l].[Id] = [t3].[OneToMany_Optional_Inverse2Id] ORDER BY [l].[Id], [t3].[Id], [t3].[c], [t3].[Id0], [t3].[Id00] """); @@ -3197,18 +3197,18 @@ FROM [Level1] AS [l0] LEFT JOIN ( SELECT [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Level3_Name], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[OneToOne_Optional_PK_Inverse3Id] FROM [Level1] AS [l1] - WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse3Id] IS NOT NULL) + WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL ) AS [t] ON CASE - WHEN ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [l0].[Id] + WHEN [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [l0].[Id] END = [t].[OneToOne_Optional_PK_Inverse3Id] LEFT JOIN ( SELECT [l2].[Id], [l2].[Level3_Optional_Id], [l2].[Level3_Required_Id], [l2].[Level4_Name], [l2].[OneToMany_Optional_Inverse4Id], [l2].[OneToMany_Required_Inverse4Id], [l2].[OneToOne_Optional_PK_Inverse4Id] FROM [Level1] AS [l2] - WHERE ([l2].[Level3_Required_Id] IS NOT NULL) AND ([l2].[OneToMany_Required_Inverse4Id] IS NOT NULL) + WHERE [l2].[Level3_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse4Id] IS NOT NULL ) AS [t0] ON CASE - WHEN ([t].[Level2_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [t].[Id] + WHEN [t].[Level2_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [t].[Id] END = [t0].[Level3_Optional_Id] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t1] ON [l].[Id] = [t1].[OneToMany_Optional_Inverse2Id] ORDER BY [l].[Id], [t1].[Id1], [t1].[Id] """); @@ -3225,14 +3225,14 @@ FROM [Level1] AS [l] LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[Level2_Name], [l0].[OneToMany_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id] FROM [Level1] AS [l0] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] ON [l].[Id] = [t].[Level1_Optional_Id] LEFT JOIN ( SELECT [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Level3_Name], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[OneToOne_Optional_PK_Inverse3Id] FROM [Level1] AS [l1] - WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse3Id] IS NOT NULL) + WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL ) AS [t0] ON CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] END = [t0].[OneToMany_Optional_Inverse3Id] ORDER BY [l].[Id], [t].[Id] """); @@ -3249,14 +3249,14 @@ FROM [Level1] AS [l] LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[Level2_Name], [l0].[OneToMany_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id] FROM [Level1] AS [l0] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] ON [l].[Id] = [t].[Level1_Optional_Id] LEFT JOIN ( SELECT [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Level3_Name], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[OneToOne_Optional_PK_Inverse3Id] FROM [Level1] AS [l1] - WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse3Id] IS NOT NULL) + WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL ) AS [t0] ON CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] END = [t0].[OneToMany_Optional_Inverse3Id] ORDER BY [l].[Name], [l].[Id], [t].[Id] """); @@ -3464,20 +3464,20 @@ FROM [Level1] AS [l] LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[Level2_Name], [l0].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l0] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] ON [l].[Id] = [t].[Level1_Optional_Id] OUTER APPLY ( SELECT CASE - WHEN ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [l1].[Id] + WHEN [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [l1].[Id] END AS [ChildId], [t].[Level2_Name] AS [ParentName], [l1].[Id] FROM [Level1] AS [l1] - WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse3Id] IS NOT NULL) AND (CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] - END IS NOT NULL) AND (CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] - END = [l1].[OneToMany_Optional_Inverse3Id] OR ((CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] - END IS NULL) AND ([l1].[OneToMany_Optional_Inverse3Id] IS NULL))) + WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL AND CASE + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + END IS NOT NULL AND (CASE + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + END = [l1].[OneToMany_Optional_Inverse3Id] OR (CASE + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + END IS NULL AND [l1].[OneToMany_Optional_Inverse3Id] IS NULL)) ) AS [t0] ORDER BY [l].[Id], [t].[Id] """); @@ -3494,25 +3494,25 @@ FROM [Level1] AS [l] LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l0] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] ON [l].[Id] = [t].[Level1_Optional_Id] LEFT JOIN ( SELECT [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Level3_Name], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[OneToOne_Optional_PK_Inverse3Id] FROM [Level1] AS [l1] - WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse3Id] IS NOT NULL) + WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL ) AS [t0] ON CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] END = [t0].[Level2_Optional_Id] OUTER APPLY ( SELECT [l2].[Level3_Name] AS [Key], COUNT(*) AS [Count] FROM [Level1] AS [l2] - WHERE ([l2].[Level2_Required_Id] IS NOT NULL) AND ([l2].[OneToMany_Required_Inverse3Id] IS NOT NULL) AND (CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] - END IS NOT NULL) AND (CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] - END = [l2].[OneToMany_Optional_Inverse3Id] OR ((CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] - END IS NULL) AND ([l2].[OneToMany_Optional_Inverse3Id] IS NULL))) + WHERE [l2].[Level2_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse3Id] IS NOT NULL AND CASE + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + END IS NOT NULL AND (CASE + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + END = [l2].[OneToMany_Optional_Inverse3Id] OR (CASE + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + END IS NULL AND [l2].[OneToMany_Optional_Inverse3Id] IS NULL)) GROUP BY [l2].[Level3_Name] ) AS [t1] ORDER BY [l].[Id], [t].[Id], [t0].[Id] @@ -3537,14 +3537,14 @@ FROM [Level1] AS [l] LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[Level2_Name], [l0].[OneToMany_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id] FROM [Level1] AS [l0] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] ON [l].[Id] = [t].[Level1_Optional_Id] LEFT JOIN ( SELECT [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Level3_Name], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[OneToOne_Optional_PK_Inverse3Id] FROM [Level1] AS [l1] - WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse3Id] IS NOT NULL) + WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL ) AS [t0] ON CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] END = [t0].[OneToMany_Optional_Inverse3Id] LEFT JOIN ( SELECT [l2].[Id], [l2].[OneToOne_Required_PK_Date], [l2].[Level1_Optional_Id], [l2].[Level1_Required_Id], [l2].[Level2_Name], [l2].[OneToMany_Optional_Inverse2Id], [l2].[OneToMany_Required_Inverse2Id], [l2].[OneToOne_Optional_PK_Inverse2Id], [t2].[Id] AS [Id0], [t2].[Level2_Optional_Id], [t2].[Level2_Required_Id], [t2].[Level3_Name], [t2].[OneToMany_Optional_Inverse3Id], [t2].[OneToMany_Required_Inverse3Id], [t2].[OneToOne_Optional_PK_Inverse3Id] @@ -3552,11 +3552,11 @@ FROM [Level1] AS [l2] LEFT JOIN ( SELECT [l3].[Id], [l3].[Level2_Optional_Id], [l3].[Level2_Required_Id], [l3].[Level3_Name], [l3].[OneToMany_Optional_Inverse3Id], [l3].[OneToMany_Required_Inverse3Id], [l3].[OneToOne_Optional_PK_Inverse3Id] FROM [Level1] AS [l3] - WHERE ([l3].[Level2_Required_Id] IS NOT NULL) AND ([l3].[OneToMany_Required_Inverse3Id] IS NOT NULL) + WHERE [l3].[Level2_Required_Id] IS NOT NULL AND [l3].[OneToMany_Required_Inverse3Id] IS NOT NULL ) AS [t2] ON CASE - WHEN ([l2].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l2].[Level1_Required_Id] IS NOT NULL) AND ([l2].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [l2].[Id] + WHEN [l2].[OneToOne_Required_PK_Date] IS NOT NULL AND [l2].[Level1_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [l2].[Id] END = [t2].[Level2_Optional_Id] - WHERE ([l2].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l2].[Level1_Required_Id] IS NOT NULL) AND ([l2].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l2].[OneToOne_Required_PK_Date] IS NOT NULL AND [l2].[Level1_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t1] ON [l].[Id] = [t1].[OneToMany_Optional_Inverse2Id] ORDER BY [l].[Id], [t].[Id], [t0].[Id], [t1].[Id] """); @@ -3576,18 +3576,18 @@ FROM [Level1] AS [l2] LEFT JOIN ( SELECT [l3].[Id], [l3].[Level2_Optional_Id], [l3].[Level2_Required_Id], [l3].[Level3_Name], [l3].[OneToMany_Optional_Inverse3Id], [l3].[OneToMany_Required_Inverse3Id], [l3].[OneToOne_Optional_PK_Inverse3Id] FROM [Level1] AS [l3] - WHERE ([l3].[Level2_Required_Id] IS NOT NULL) AND ([l3].[OneToMany_Required_Inverse3Id] IS NOT NULL) + WHERE [l3].[Level2_Required_Id] IS NOT NULL AND [l3].[OneToMany_Required_Inverse3Id] IS NOT NULL ) AS [t0] ON CASE - WHEN ([l2].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l2].[Level1_Required_Id] IS NOT NULL) AND ([l2].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [l2].[Id] + WHEN [l2].[OneToOne_Required_PK_Date] IS NOT NULL AND [l2].[Level1_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [l2].[Id] END = [t0].[OneToOne_Optional_PK_Inverse3Id] LEFT JOIN ( SELECT [l4].[Id], [l4].[Level3_Optional_Id], [l4].[Level3_Required_Id], [l4].[Level4_Name], [l4].[OneToMany_Optional_Inverse4Id], [l4].[OneToMany_Required_Inverse4Id], [l4].[OneToOne_Optional_PK_Inverse4Id] FROM [Level1] AS [l4] - WHERE ([l4].[Level3_Required_Id] IS NOT NULL) AND ([l4].[OneToMany_Required_Inverse4Id] IS NOT NULL) + WHERE [l4].[Level3_Required_Id] IS NOT NULL AND [l4].[OneToMany_Required_Inverse4Id] IS NOT NULL ) AS [t2] ON CASE - WHEN ([t0].[Level2_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [t0].[Id] + WHEN [t0].[Level2_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [t0].[Id] END = [t2].[Level3_Optional_Id] - WHERE ([l2].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l2].[Level1_Required_Id] IS NOT NULL) AND ([l2].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l2].[OneToOne_Required_PK_Date] IS NOT NULL AND [l2].[Level1_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t1] ON [l].[Id] = [t1].[OneToMany_Optional_Inverse2Id] WHERE ( SELECT COUNT(*) @@ -3595,11 +3595,11 @@ FROM [Level1] AS [l0] LEFT JOIN ( SELECT [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Level3_Name], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[OneToOne_Optional_PK_Inverse3Id] FROM [Level1] AS [l1] - WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse3Id] IS NOT NULL) + WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL ) AS [t] ON CASE - WHEN ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [l0].[Id] + WHEN [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [l0].[Id] END = [t].[OneToOne_Optional_PK_Inverse3Id] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) AND [l].[Id] = [l0].[OneToMany_Optional_Inverse2Id] AND ([t].[Level3_Name] <> N'Foo' OR ([t].[Level3_Name] IS NULL))) > 0 + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL AND [l].[Id] = [l0].[OneToMany_Optional_Inverse2Id] AND ([t].[Level3_Name] <> N'Foo' OR [t].[Level3_Name] IS NULL)) > 0 ORDER BY [l].[Id], [t1].[Id], [t1].[Id0] """); } @@ -3615,7 +3615,7 @@ FROM [Level1] AS [l] LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[Level2_Name], [l0].[OneToMany_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id] FROM [Level1] AS [l0] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) AND [l0].[Id] > 5 + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL AND [l0].[Id] > 5 ) AS [t] ON [l].[Id] = [t].[OneToMany_Optional_Inverse2Id] ORDER BY [l].[Id] """); @@ -3632,7 +3632,7 @@ FROM [Level1] AS [l] LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[Level2_Name], [l0].[OneToMany_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id] FROM [Level1] AS [l0] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] ON [l].[Id] = [t].[OneToMany_Optional_Inverse2Id] ORDER BY [l].[Id], [t].[Level2_Name] """); @@ -3651,7 +3651,7 @@ LEFT JOIN ( FROM ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[Level2_Name], [l0].[OneToMany_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id], ROW_NUMBER() OVER(PARTITION BY [l0].[OneToMany_Optional_Inverse2Id] ORDER BY [l0].[Level2_Name]) AS [row] FROM [Level1] AS [l0] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] WHERE 1 < [t].[row] AND [t].[row] <= 4 ) AS [t0] ON [l].[Id] = [t0].[OneToMany_Optional_Inverse2Id] @@ -3670,18 +3670,18 @@ FROM [Level1] AS [l] LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[Level2_Name], [l0].[OneToMany_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id] FROM [Level1] AS [l0] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] ON [l].[Id] = [t].[Level1_Optional_Id] LEFT JOIN ( SELECT [t1].[Id], [t1].[Level2_Optional_Id], [t1].[Level2_Required_Id], [t1].[Level3_Name], [t1].[OneToMany_Optional_Inverse3Id], [t1].[OneToMany_Required_Inverse3Id], [t1].[OneToOne_Optional_PK_Inverse3Id] FROM ( SELECT [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Level3_Name], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[OneToOne_Optional_PK_Inverse3Id], ROW_NUMBER() OVER(PARTITION BY [l1].[OneToMany_Optional_Inverse3Id] ORDER BY [l1].[Level3_Name]) AS [row] FROM [Level1] AS [l1] - WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse3Id] IS NOT NULL) AND ([l1].[Level3_Name] <> N'Foo' OR ([l1].[Level3_Name] IS NULL)) + WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL AND ([l1].[Level3_Name] <> N'Foo' OR [l1].[Level3_Name] IS NULL) ) AS [t1] WHERE 1 < [t1].[row] AND [t1].[row] <= 4 ) AS [t0] ON CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] END = [t0].[OneToMany_Optional_Inverse3Id] ORDER BY [l].[Id], [t].[Id], [t0].[OneToMany_Optional_Inverse3Id], [t0].[Level3_Name] """); @@ -3698,7 +3698,7 @@ FROM [Level1] AS [l] LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[Level2_Name], [l0].[OneToMany_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id] FROM [Level1] AS [l0] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] ON [l].[Id] = [t].[OneToMany_Optional_Inverse2Id] ORDER BY [l].[Name], [l].[Id] """); @@ -3718,11 +3718,11 @@ FROM [Level1] AS [l0] LEFT JOIN ( SELECT [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Level3_Name], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[OneToOne_Optional_PK_Inverse3Id] FROM [Level1] AS [l1] - WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse3Id] IS NOT NULL) + WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL ) AS [t] ON CASE - WHEN ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [l0].[Id] + WHEN [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [l0].[Id] END = [t].[OneToMany_Optional_Inverse3Id] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t0] ON [l].[Id] = [t0].[OneToMany_Optional_Inverse2Id] ORDER BY [l].[Name], [l].[Id], [t0].[Id] """); @@ -3742,11 +3742,11 @@ FROM [Level1] AS [l0] LEFT JOIN ( SELECT [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Level3_Name], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[OneToOne_Optional_PK_Inverse3Id] FROM [Level1] AS [l1] - WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse3Id] IS NOT NULL) + WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL ) AS [t] ON CASE - WHEN ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [l0].[Id] + WHEN [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [l0].[Id] END = [t].[Level2_Optional_Id] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t0] ON [l].[Id] = [t0].[OneToMany_Optional_Inverse2Id] ORDER BY [l].[Name], [l].[Id], [t0].[Id] """); @@ -3763,12 +3763,12 @@ FROM [Level1] AS [l] LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[Level2_Name], [l0].[OneToMany_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id] FROM [Level1] AS [l0] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] ON [l].[Id] = [t].[OneToMany_Optional_Inverse2Id] LEFT JOIN ( SELECT [l1].[Id], [l1].[OneToOne_Required_PK_Date], [l1].[Level1_Optional_Id], [l1].[Level1_Required_Id], [l1].[Level2_Name], [l1].[OneToMany_Optional_Inverse2Id], [l1].[OneToMany_Required_Inverse2Id], [l1].[OneToOne_Optional_PK_Inverse2Id] FROM [Level1] AS [l1] - WHERE ([l1].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l1].[Level1_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l1].[OneToOne_Required_PK_Date] IS NOT NULL AND [l1].[Level1_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t0] ON [l].[Id] = [t0].[OneToMany_Required_Inverse2Id] ORDER BY [l].[Name], [l].[Id], [t].[Id] """); @@ -3785,12 +3785,12 @@ FROM [Level1] AS [l] LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[Level2_Name], [l0].[OneToMany_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id] FROM [Level1] AS [l0] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] ON [l].[Id] = [t].[Level1_Optional_Id] LEFT JOIN ( SELECT [l1].[Id], [l1].[OneToOne_Required_PK_Date], [l1].[Level1_Optional_Id], [l1].[Level1_Required_Id], [l1].[Level2_Name], [l1].[OneToMany_Optional_Inverse2Id], [l1].[OneToMany_Required_Inverse2Id], [l1].[OneToOne_Optional_PK_Inverse2Id] FROM [Level1] AS [l1] - WHERE ([l1].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l1].[Level1_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l1].[OneToOne_Required_PK_Date] IS NOT NULL AND [l1].[Level1_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t0] ON [l].[Id] = [t0].[OneToMany_Optional_Inverse2Id] ORDER BY [l].[Name], [l].[Id], [t].[Id] """); @@ -3807,7 +3807,7 @@ FROM [Level1] AS [l] LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[Level2_Name], [l0].[OneToMany_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id] FROM [Level1] AS [l0] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] ON [l].[Id] = [t].[Level1_Optional_Id] ORDER BY [l].[Name] """); @@ -3824,12 +3824,12 @@ FROM [Level1] AS [l] LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[Level2_Name], [l0].[OneToMany_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id] FROM [Level1] AS [l0] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] ON [l].[Id] = [t].[Level1_Optional_Id] LEFT JOIN ( SELECT [l1].[Id], [l1].[OneToOne_Required_PK_Date], [l1].[Level1_Optional_Id], [l1].[Level1_Required_Id], [l1].[Level2_Name], [l1].[OneToMany_Optional_Inverse2Id], [l1].[OneToMany_Required_Inverse2Id], [l1].[OneToOne_Optional_PK_Inverse2Id] FROM [Level1] AS [l1] - WHERE ([l1].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l1].[Level1_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l1].[OneToOne_Required_PK_Date] IS NOT NULL AND [l1].[Level1_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t0] ON [l].[Id] = [t0].[Level1_Required_Id] ORDER BY [l].[Name] """); diff --git a/test/EFCore.SqlServer.FunctionalTests/Query/ComplexNavigationsCollectionsSplitQuerySqlServerTest.cs b/test/EFCore.SqlServer.FunctionalTests/Query/ComplexNavigationsCollectionsSplitQuerySqlServerTest.cs index c6a3d7f220c..cb8a24cf73a 100644 --- a/test/EFCore.SqlServer.FunctionalTests/Query/ComplexNavigationsCollectionsSplitQuerySqlServerTest.cs +++ b/test/EFCore.SqlServer.FunctionalTests/Query/ComplexNavigationsCollectionsSplitQuerySqlServerTest.cs @@ -266,7 +266,7 @@ INNER JOIN ( FROM ( SELECT [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Name], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Optional_Self_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[OneToMany_Required_Self_Inverse3Id], [l1].[OneToOne_Optional_PK_Inverse3Id], [l1].[OneToOne_Optional_Self3Id], ROW_NUMBER() OVER(PARTITION BY [l1].[OneToMany_Optional_Inverse3Id] ORDER BY [l1].[Name]) AS [row] FROM [LevelThree] AS [l1] - WHERE [l1].[Name] <> N'Foo' OR ([l1].[Name] IS NULL) + WHERE [l1].[Name] <> N'Foo' OR [l1].[Name] IS NULL ) AS [t] WHERE 1 < [t].[row] AND [t].[row] <= 4 ) AS [t0] ON [l0].[Id] = [t0].[OneToMany_Optional_Inverse3Id] @@ -295,7 +295,7 @@ INNER JOIN ( FROM ( SELECT [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Name], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Optional_Self_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[OneToMany_Required_Self_Inverse3Id], [l1].[OneToOne_Optional_PK_Inverse3Id], [l1].[OneToOne_Optional_Self3Id], ROW_NUMBER() OVER(PARTITION BY [l1].[OneToMany_Optional_Inverse3Id] ORDER BY [l1].[Name]) AS [row] FROM [LevelThree] AS [l1] - WHERE [l1].[Name] <> N'Foo' OR ([l1].[Name] IS NULL) + WHERE [l1].[Name] <> N'Foo' OR [l1].[Name] IS NULL ) AS [t] WHERE 1 < [t].[row] AND [t].[row] <= 4 ) AS [t0] ON [l0].[Id] = [t0].[OneToMany_Optional_Inverse3Id] @@ -322,7 +322,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] @@ -337,7 +337,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] @@ -364,7 +364,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] @@ -379,7 +379,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] @@ -388,7 +388,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] @@ -415,7 +415,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] @@ -442,7 +442,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] @@ -458,7 +458,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] @@ -489,7 +489,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] @@ -505,7 +505,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] @@ -534,7 +534,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] @@ -561,7 +561,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] @@ -588,7 +588,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] @@ -604,7 +604,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] @@ -645,7 +645,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] @@ -661,7 +661,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] @@ -678,7 +678,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] @@ -714,7 +714,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] @@ -730,7 +730,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] @@ -747,7 +747,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] @@ -777,7 +777,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] @@ -941,7 +941,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] """, // @@ -974,7 +974,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] """); } @@ -1107,7 +1107,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] @@ -1476,7 +1476,7 @@ FROM [LevelOne] AS [l] OUTER APPLY ( SELECT TOP(1) 1 AS [c], [l0].[Id] FROM [LevelTwo] AS [l0] - WHERE [l0].[Name] <> N'Foo' OR ([l0].[Name] IS NULL) + WHERE [l0].[Name] <> N'Foo' OR [l0].[Name] IS NULL ) AS [t] ORDER BY [l].[Id], [t].[Id] """, @@ -1487,7 +1487,7 @@ FROM [LevelOne] AS [l] OUTER APPLY ( SELECT TOP(1) [l0].[Id] FROM [LevelTwo] AS [l0] - WHERE [l0].[Name] <> N'Foo' OR ([l0].[Name] IS NULL) + WHERE [l0].[Name] <> N'Foo' OR [l0].[Name] IS NULL ) AS [t] CROSS APPLY ( SELECT [l1].[Name] @@ -1514,7 +1514,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] @@ -1529,7 +1529,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] @@ -1574,7 +1574,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] """, // @@ -1607,7 +1607,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] """); } @@ -1900,7 +1900,7 @@ public override async Task Include_collection_with_conditional_order_by(bool asy SELECT [l].[Id], [l].[Date], [l].[Name], [l].[OneToMany_Optional_Self_Inverse1Id], [l].[OneToMany_Required_Self_Inverse1Id], [l].[OneToOne_Optional_Self1Id] FROM [LevelOne] AS [l] ORDER BY CASE - WHEN ([l].[Name] IS NOT NULL) AND ([l].[Name] LIKE N'%03') THEN 1 + WHEN [l].[Name] IS NOT NULL AND [l].[Name] LIKE N'%03' THEN 1 ELSE 2 END, [l].[Id] """, @@ -1910,7 +1910,7 @@ ELSE 2 FROM [LevelOne] AS [l] INNER JOIN [LevelTwo] AS [l0] ON [l].[Id] = [l0].[OneToMany_Optional_Inverse2Id] ORDER BY CASE - WHEN ([l].[Name] IS NOT NULL) AND ([l].[Name] LIKE N'%03') THEN 1 + WHEN [l].[Name] IS NOT NULL AND [l].[Name] LIKE N'%03' THEN 1 ELSE 2 END, [l].[Id] """); @@ -1958,7 +1958,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] """, // @@ -1971,7 +1971,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] """); } @@ -2137,7 +2137,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] """, // @@ -2150,7 +2150,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] """); } @@ -2709,7 +2709,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] @@ -2728,7 +2728,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] @@ -3136,7 +3136,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] """, // @@ -3153,7 +3153,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] """); } @@ -3701,7 +3701,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] @@ -3713,7 +3713,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 ( @@ -3723,7 +3723,7 @@ INNER JOIN ( FROM [LevelOne] AS [l1] ) AS [t1] WHERE 1 < [t1].[row] AND [t1].[row] <= 6 -) AS [t0] ON ([l].[Name] = [t0].[Name] OR (([l].[Name] IS NULL) AND ([t0].[Name] IS NULL))) AND [t].[Date] = [t0].[Date] +) AS [t0] ON ([l].[Name] = [t0].[Name] OR ([l].[Name] IS NULL AND [t0].[Name] IS NULL)) AND [t].[Date] = [t0].[Date] ORDER BY [l].[Id], [t].[Date], [t0].[Name], [t0].[Date] """); } @@ -3860,7 +3860,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] """, @@ -3871,7 +3871,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] @@ -3986,7 +3986,7 @@ FROM [LevelOne] AS [l] CROSS APPLY ( SELECT [l1].[Id] AS [ChildId], [l0].[Name] AS [ParentName] FROM [LevelThree] AS [l1] - WHERE ([l0].[Id] IS NOT NULL) AND [l0].[Id] = [l1].[OneToMany_Optional_Inverse3Id] + WHERE [l0].[Id] IS NOT NULL AND [l0].[Id] = [l1].[OneToMany_Optional_Inverse3Id] ) AS [t] ORDER BY [l].[Id], [l0].[Id] """); @@ -4013,7 +4013,7 @@ FROM [LevelOne] AS [l] CROSS APPLY ( SELECT [l2].[Name] AS [Key], COUNT(*) AS [Count] FROM [LevelThree] AS [l2] - WHERE ([l0].[Id] IS NOT NULL) AND [l0].[Id] = [l2].[OneToMany_Optional_Inverse3Id] + WHERE [l0].[Id] IS NOT NULL AND [l0].[Id] = [l2].[OneToMany_Optional_Inverse3Id] GROUP BY [l2].[Name] ) AS [t] ORDER BY [l].[Id], [l0].[Id], [l1].[Id] @@ -4098,7 +4098,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] """, // @@ -4115,7 +4115,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] """); } @@ -4209,7 +4209,7 @@ INNER JOIN ( FROM ( SELECT [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Name], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Optional_Self_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[OneToMany_Required_Self_Inverse3Id], [l1].[OneToOne_Optional_PK_Inverse3Id], [l1].[OneToOne_Optional_Self3Id], ROW_NUMBER() OVER(PARTITION BY [l1].[OneToMany_Optional_Inverse3Id] ORDER BY [l1].[Name]) AS [row] FROM [LevelThree] AS [l1] - WHERE [l1].[Name] <> N'Foo' OR ([l1].[Name] IS NULL) + WHERE [l1].[Name] <> N'Foo' OR [l1].[Name] IS NULL ) AS [t] WHERE 1 < [t].[row] AND [t].[row] <= 4 ) AS [t0] ON [l0].[Id] = [t0].[OneToMany_Optional_Inverse3Id] diff --git a/test/EFCore.SqlServer.FunctionalTests/Query/ComplexNavigationsQuerySqlServerTest.cs b/test/EFCore.SqlServer.FunctionalTests/Query/ComplexNavigationsQuerySqlServerTest.cs index 85e32974927..d55fd460371 100644 --- a/test/EFCore.SqlServer.FunctionalTests/Query/ComplexNavigationsQuerySqlServerTest.cs +++ b/test/EFCore.SqlServer.FunctionalTests/Query/ComplexNavigationsQuerySqlServerTest.cs @@ -270,7 +270,7 @@ public override async Task Navigation_inside_method_call_translated_to_join(bool SELECT [l].[Id], [l].[Date], [l].[Name], [l].[OneToMany_Optional_Self_Inverse1Id], [l].[OneToMany_Required_Self_Inverse1Id], [l].[OneToOne_Optional_Self1Id] FROM [LevelOne] AS [l] LEFT JOIN [LevelTwo] AS [l0] ON [l].[Id] = [l0].[Level1_Required_Id] -WHERE ([l0].[Name] IS NOT NULL) AND ([l0].[Name] LIKE N'L%') +WHERE [l0].[Name] IS NOT NULL AND [l0].[Name] LIKE N'L%' """); } @@ -283,7 +283,7 @@ public override async Task Navigation_inside_method_call_translated_to_join2(boo SELECT [l].[Id], [l].[Level2_Optional_Id], [l].[Level2_Required_Id], [l].[Name], [l].[OneToMany_Optional_Inverse3Id], [l].[OneToMany_Optional_Self_Inverse3Id], [l].[OneToMany_Required_Inverse3Id], [l].[OneToMany_Required_Self_Inverse3Id], [l].[OneToOne_Optional_PK_Inverse3Id], [l].[OneToOne_Optional_Self3Id] FROM [LevelThree] AS [l] INNER JOIN [LevelTwo] AS [l0] ON [l].[Level2_Required_Id] = [l0].[Id] -WHERE ([l0].[Name] IS NOT NULL) AND ([l0].[Name] LIKE N'L%') +WHERE [l0].[Name] IS NOT NULL AND [l0].[Name] LIKE N'L%' """); } @@ -296,7 +296,7 @@ public override async Task Optional_navigation_inside_method_call_translated_to_ SELECT [l].[Id], [l].[Date], [l].[Name], [l].[OneToMany_Optional_Self_Inverse1Id], [l].[OneToMany_Required_Self_Inverse1Id], [l].[OneToOne_Optional_Self1Id] FROM [LevelOne] AS [l] LEFT JOIN [LevelTwo] AS [l0] ON [l].[Id] = [l0].[Level1_Optional_Id] -WHERE ([l0].[Name] IS NOT NULL) AND ([l0].[Name] LIKE N'L%') +WHERE [l0].[Name] IS NOT NULL AND [l0].[Name] LIKE N'L%' """); } @@ -322,7 +322,7 @@ public override async Task Optional_navigation_inside_nested_method_call_transla SELECT [l].[Id], [l].[Date], [l].[Name], [l].[OneToMany_Optional_Self_Inverse1Id], [l].[OneToMany_Required_Self_Inverse1Id], [l].[OneToOne_Optional_Self1Id] FROM [LevelOne] AS [l] LEFT JOIN [LevelTwo] AS [l0] ON [l].[Id] = [l0].[Level1_Optional_Id] -WHERE ([l0].[Name] IS NOT NULL) AND (UPPER([l0].[Name]) LIKE N'L%') +WHERE [l0].[Name] IS NOT NULL AND UPPER([l0].[Name]) LIKE N'L%' """); } @@ -335,7 +335,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]) """); } @@ -684,7 +684,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 """); } @@ -698,7 +698,7 @@ SELECT [l].[Id] 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 """); } @@ -725,7 +725,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 """); } @@ -863,7 +863,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 """); } @@ -919,7 +919,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 """); } @@ -933,7 +933,7 @@ SELECT [l].[Id] 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 """); } @@ -948,7 +948,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' """); } @@ -963,7 +963,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' """); } @@ -978,7 +978,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) """); } @@ -993,7 +993,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) """); } @@ -1134,7 +1134,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 """); } @@ -1316,7 +1316,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 """); } @@ -1998,7 +1998,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) """); @@ -2016,7 +2016,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) """); } @@ -2079,7 +2079,7 @@ SELECT [l1].[Name] 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 """); } @@ -2465,7 +2465,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] """); } @@ -2481,7 +2481,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] """); } @@ -2497,7 +2497,7 @@ SELECT [t].[Id] 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] """); } @@ -2511,7 +2511,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 """); } @@ -2528,7 +2528,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] """); @@ -2595,7 +2595,7 @@ public override async Task Join_condition_optimizations_applied_correctly_when_a """ 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) """); } @@ -2607,7 +2607,7 @@ public override async Task Join_condition_optimizations_applied_correctly_when_a """ 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)) """); } @@ -2640,7 +2640,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 """); } @@ -2668,7 +2668,7 @@ SELECT [l].[Id] 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 """); } @@ -2725,7 +2725,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]) """); } @@ -2742,7 +2742,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]) """); } @@ -2792,11 +2792,11 @@ SELECT CASE SELECT TOP(1) [l1].[Name] FROM [LevelTwo] AS [l0] INNER JOIN [LevelOne] AS [l1] ON [l0].[Level1_Required_Id] = [l1].[Id] - ORDER BY [l0].[Id]) = N'L1 02' AND (( + ORDER BY [l0].[Id]) = N'L1 02' AND ( SELECT TOP(1) [l1].[Name] FROM [LevelTwo] AS [l0] INNER JOIN [LevelOne] AS [l1] ON [l0].[Level1_Required_Id] = [l1].[Id] - ORDER BY [l0].[Id]) IS NOT NULL) THEN CAST(1 AS bit) + ORDER BY [l0].[Id]) IS NOT NULL THEN CAST(1 AS bit) ELSE CAST(0 AS bit) END FROM [LevelTwo] AS [l] @@ -2866,7 +2866,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] """); @@ -2878,7 +2878,7 @@ public override async Task Select_optional_navigation_property_string_concat(boo AssertSql( """ -SELECT (COALESCE([l].[Name], N'') + N' ') + COALESCE(CASE +SELECT COALESCE([l].[Name], N'') + N' ' + COALESCE(CASE WHEN [t].[Id] IS NOT NULL THEN [t].[Name] ELSE N'NULL' END, N'') @@ -3079,7 +3079,7 @@ public override async Task Accessing_optional_property_inside_result_operator_su SELECT [l].[Id], [l].[Date], [l].[Name], [l].[OneToMany_Optional_Self_Inverse1Id], [l].[OneToMany_Required_Self_Inverse1Id], [l].[OneToOne_Optional_Self1Id] FROM [LevelOne] AS [l] LEFT JOIN [LevelTwo] AS [l0] ON [l].[Id] = [l0].[Level1_Optional_Id] -WHERE [l0].[Name] NOT IN (N'Name1', N'Name2') OR ([l0].[Name] IS NULL) +WHERE [l0].[Name] NOT IN (N'Name1', N'Name2') OR [l0].[Name] IS NULL """); } @@ -3180,7 +3180,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 """); } @@ -3193,7 +3193,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 """); } @@ -3324,7 +3324,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] """); @@ -3471,7 +3471,7 @@ SELECT CASE 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 """); @@ -3525,7 +3525,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] @@ -3537,7 +3537,7 @@ FROM [LevelThree] AS [l1] ORDER BY [l1].[Id]) FROM [LevelTwo] AS [l0] WHERE [l0].[Level1_Optional_Id] = [l].[Id] - ORDER BY [l0].[Id]) IS NULL) + ORDER BY [l0].[Id]) IS NULL ORDER BY [l].[Id] """); } @@ -3610,19 +3610,19 @@ public override async Task Member_pushdown_with_multiple_collections(bool async) SELECT ( SELECT TOP(1) [l0].[Name] FROM [LevelThree] AS [l0] - WHERE (( + WHERE ( SELECT TOP(1) [l1].[Id] FROM [LevelTwo] AS [l1] WHERE [l].[Id] = [l1].[OneToMany_Optional_Inverse2Id] - ORDER BY [l1].[Id]) IS NOT NULL) AND (( + ORDER BY [l1].[Id]) IS NOT NULL AND (( SELECT TOP(1) [l2].[Id] FROM [LevelTwo] AS [l2] WHERE [l].[Id] = [l2].[OneToMany_Optional_Inverse2Id] - ORDER BY [l2].[Id]) = [l0].[OneToMany_Optional_Inverse3Id] OR ((( + ORDER BY [l2].[Id]) = [l0].[OneToMany_Optional_Inverse3Id] OR (( SELECT TOP(1) [l2].[Id] FROM [LevelTwo] AS [l2] WHERE [l].[Id] = [l2].[OneToMany_Optional_Inverse2Id] - ORDER BY [l2].[Id]) IS NULL) AND ([l0].[OneToMany_Optional_Inverse3Id] IS NULL))) + ORDER BY [l2].[Id]) IS NULL AND [l0].[OneToMany_Optional_Inverse3Id] IS NULL)) ORDER BY [l0].[Id]) FROM [LevelOne] AS [l] """); @@ -3714,7 +3714,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] """); } @@ -3727,7 +3727,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' """); } @@ -3781,7 +3781,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)) """); } @@ -3803,7 +3803,7 @@ CROSS APPLY ( SELECT [l].[Name] AS [l1Name], [l1].[Name] AS [l2Name], [l3].[Name] AS [l3Name] FROM [LevelFour] AS [l2] LEFT JOIN [LevelThree] AS [l3] ON [l2].[OneToOne_Optional_PK_Inverse4Id] = [l3].[Id] - WHERE ([l1].[Id] IS NOT NULL) AND [l1].[Id] = [l2].[OneToMany_Optional_Inverse4Id] + WHERE [l1].[Id] IS NOT NULL AND [l1].[Id] = [l2].[OneToMany_Optional_Inverse4Id] ) AS [t] WHERE [l].[Id] = [l0].[OneToMany_Optional_Inverse2Id] ) AS [t0] @@ -3855,7 +3855,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] @@ -3874,7 +3874,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] @@ -3900,7 +3900,7 @@ FROM [LevelOne] AS [l2] LEFT JOIN [LevelTwo] AS [l3] ON [l2].[Id] = [l3].[Id] LEFT JOIN [LevelThree] AS [l4] ON [l3].[Id] = [l4].[Id] LEFT JOIN [LevelTwo] AS [l5] ON [l2].[Id] = [l5].[Id] - WHERE [l1].[Name] = [l4].[Name] OR (([l1].[Name] IS NULL) AND ([l4].[Name] IS NULL))) > 0 + WHERE [l1].[Name] = [l4].[Name] OR ([l1].[Name] IS NULL AND [l4].[Name] IS NULL)) > 0 """); } @@ -3929,7 +3929,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 """); } @@ -3982,10 +3982,10 @@ FROM [LevelOne] AS [l] WHERE CASE WHEN [l0].[Id] IS NULL THEN NULL ELSE [l1].[Name] -END <> N'L' OR (CASE +END <> N'L' OR CASE WHEN [l0].[Id] IS NULL THEN NULL ELSE [l1].[Name] -END IS NULL) +END IS NULL """); } @@ -4106,7 +4106,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 """); } @@ -4179,16 +4179,16 @@ public override async Task Multiple_collection_FirstOrDefault_followed_by_member SELECT [l].[Id], ( SELECT TOP(1) [l0].[Name] FROM [LevelThree] AS [l0] - WHERE (( + WHERE ( SELECT TOP(1) [l1].[Id] FROM [LevelTwo] AS [l1] - WHERE [l].[Id] = [l1].[OneToMany_Optional_Inverse2Id] AND [l1].[Name] = N'L2 02') IS NOT NULL) AND (( + WHERE [l].[Id] = [l1].[OneToMany_Optional_Inverse2Id] AND [l1].[Name] = N'L2 02') IS NOT NULL AND (( SELECT TOP(1) [l2].[Id] FROM [LevelTwo] AS [l2] - WHERE [l].[Id] = [l2].[OneToMany_Optional_Inverse2Id] AND [l2].[Name] = N'L2 02') = [l0].[OneToMany_Optional_Inverse3Id] OR ((( + WHERE [l].[Id] = [l2].[OneToMany_Optional_Inverse2Id] AND [l2].[Name] = N'L2 02') = [l0].[OneToMany_Optional_Inverse3Id] OR (( SELECT TOP(1) [l2].[Id] FROM [LevelTwo] AS [l2] - WHERE [l].[Id] = [l2].[OneToMany_Optional_Inverse2Id] AND [l2].[Name] = N'L2 02') IS NULL) AND ([l0].[OneToMany_Optional_Inverse3Id] IS NULL))) + WHERE [l].[Id] = [l2].[OneToMany_Optional_Inverse2Id] AND [l2].[Name] = N'L2 02') IS NULL AND [l0].[OneToMany_Optional_Inverse3Id] IS NULL)) ORDER BY [l0].[Id]) AS [Pushdown] FROM [LevelOne] AS [l] WHERE [l].[Id] < 2 @@ -4405,7 +4405,7 @@ FROM [LevelOne] AS [l2] LEFT JOIN [LevelTwo] AS [l3] ON [l2].[Id] = [l3].[Id] LEFT JOIN [LevelThree] AS [l4] ON [l3].[Id] = [l4].[Id] LEFT JOIN [LevelTwo] AS [l5] ON [l2].[Id] = [l5].[Id] - WHERE [l1].[Name] = [l4].[Name] OR (([l1].[Name] IS NULL) AND ([l4].[Name] IS NULL))) > 0 + WHERE [l1].[Name] = [l4].[Name] OR ([l1].[Name] IS NULL AND [l4].[Name] IS NULL)) > 0 """); } diff --git a/test/EFCore.SqlServer.FunctionalTests/Query/ComplexNavigationsSharedTypeQuerySqlServerTest.cs b/test/EFCore.SqlServer.FunctionalTests/Query/ComplexNavigationsSharedTypeQuerySqlServerTest.cs index ab52e848f35..1c2cbc0bf24 100644 --- a/test/EFCore.SqlServer.FunctionalTests/Query/ComplexNavigationsSharedTypeQuerySqlServerTest.cs +++ b/test/EFCore.SqlServer.FunctionalTests/Query/ComplexNavigationsSharedTypeQuerySqlServerTest.cs @@ -32,9 +32,9 @@ FROM [Level1] AS [l] LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[Level2_Name], [l0].[OneToMany_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id] FROM [Level1] AS [l0] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] ON [l].[Id] = CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] END """); } @@ -60,18 +60,18 @@ FROM [Level1] AS [l] LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[Level2_Name], [l0].[OneToMany_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id] FROM [Level1] AS [l0] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] ON [l].[Id] = CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] END LEFT JOIN ( SELECT [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Level3_Name], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[OneToOne_Optional_PK_Inverse3Id] FROM [Level1] AS [l1] - WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse3Id] IS NOT NULL) + WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL ) AS [t0] ON CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] END = CASE - WHEN ([t0].[Level2_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [t0].[Id] + WHEN [t0].[Level2_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [t0].[Id] END """); } @@ -87,18 +87,18 @@ FROM [Level1] AS [l] LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Required_Id], [l0].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l0] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] ON [l].[Id] = CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] END LEFT JOIN ( SELECT [l1].[Id], [l1].[Level2_Required_Id], [l1].[Level3_Name], [l1].[OneToMany_Required_Inverse3Id] FROM [Level1] AS [l1] - WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse3Id] IS NOT NULL) + WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL ) AS [t0] ON CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] END = CASE - WHEN ([t0].[Level2_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [t0].[Id] + WHEN [t0].[Level2_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [t0].[Id] END GROUP BY [t0].[Level3_Name] """); @@ -115,49 +115,49 @@ FROM [Level1] AS [l] LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Required_Id], [l0].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l0] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] ON [l].[Id] = CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] END LEFT JOIN ( SELECT [l1].[Id], [l1].[Level2_Required_Id], [l1].[Level3_Name], [l1].[OneToMany_Required_Inverse3Id] FROM [Level1] AS [l1] - WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse3Id] IS NOT NULL) + WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL ) AS [t0] ON CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] END = CASE - WHEN ([t0].[Level2_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [t0].[Id] + WHEN [t0].[Level2_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [t0].[Id] END GROUP BY [t0].[Level3_Name] HAVING ( SELECT MIN(COALESCE(CASE - WHEN ([t3].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t3].[Level1_Required_Id] IS NOT NULL) AND ([t3].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t3].[Id] + WHEN [t3].[OneToOne_Required_PK_Date] IS NOT NULL AND [t3].[Level1_Required_Id] IS NOT NULL AND [t3].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t3].[Id] END, 0)) FROM [Level1] AS [l2] LEFT JOIN ( SELECT [l3].[Id], [l3].[OneToOne_Required_PK_Date], [l3].[Level1_Optional_Id], [l3].[Level1_Required_Id], [l3].[Level2_Name], [l3].[OneToMany_Optional_Inverse2Id], [l3].[OneToMany_Required_Inverse2Id], [l3].[OneToOne_Optional_PK_Inverse2Id] FROM [Level1] AS [l3] - WHERE ([l3].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l3].[Level1_Required_Id] IS NOT NULL) AND ([l3].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l3].[OneToOne_Required_PK_Date] IS NOT NULL AND [l3].[Level1_Required_Id] IS NOT NULL AND [l3].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t1] ON [l2].[Id] = CASE - WHEN ([t1].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t1].[Level1_Required_Id] IS NOT NULL) AND ([t1].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t1].[Id] + WHEN [t1].[OneToOne_Required_PK_Date] IS NOT NULL AND [t1].[Level1_Required_Id] IS NOT NULL AND [t1].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t1].[Id] END LEFT JOIN ( SELECT [l4].[Id], [l4].[Level2_Optional_Id], [l4].[Level2_Required_Id], [l4].[Level3_Name], [l4].[OneToMany_Optional_Inverse3Id], [l4].[OneToMany_Required_Inverse3Id], [l4].[OneToOne_Optional_PK_Inverse3Id] FROM [Level1] AS [l4] - WHERE ([l4].[Level2_Required_Id] IS NOT NULL) AND ([l4].[OneToMany_Required_Inverse3Id] IS NOT NULL) + WHERE [l4].[Level2_Required_Id] IS NOT NULL AND [l4].[OneToMany_Required_Inverse3Id] IS NOT NULL ) AS [t2] ON CASE - WHEN ([t1].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t1].[Level1_Required_Id] IS NOT NULL) AND ([t1].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t1].[Id] + WHEN [t1].[OneToOne_Required_PK_Date] IS NOT NULL AND [t1].[Level1_Required_Id] IS NOT NULL AND [t1].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t1].[Id] END = CASE - WHEN ([t2].[Level2_Required_Id] IS NOT NULL) AND ([t2].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [t2].[Id] + WHEN [t2].[Level2_Required_Id] IS NOT NULL AND [t2].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [t2].[Id] END LEFT JOIN ( SELECT [l5].[Id], [l5].[OneToOne_Required_PK_Date], [l5].[Level1_Optional_Id], [l5].[Level1_Required_Id], [l5].[Level2_Name], [l5].[OneToMany_Optional_Inverse2Id], [l5].[OneToMany_Required_Inverse2Id], [l5].[OneToOne_Optional_PK_Inverse2Id] FROM [Level1] AS [l5] - WHERE ([l5].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l5].[Level1_Required_Id] IS NOT NULL) AND ([l5].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l5].[OneToOne_Required_PK_Date] IS NOT NULL AND [l5].[Level1_Required_Id] IS NOT NULL AND [l5].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t3] ON [l2].[Id] = CASE - WHEN ([t3].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t3].[Level1_Required_Id] IS NOT NULL) AND ([t3].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t3].[Id] + WHEN [t3].[OneToOne_Required_PK_Date] IS NOT NULL AND [t3].[Level1_Required_Id] IS NOT NULL AND [t3].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t3].[Id] END - WHERE [t0].[Level3_Name] = [t2].[Level3_Name] OR (([t0].[Level3_Name] IS NULL) AND ([t2].[Level3_Name] IS NULL))) > 0 + WHERE [t0].[Level3_Name] = [t2].[Level3_Name] OR ([t0].[Level3_Name] IS NULL AND [t2].[Level3_Name] IS NULL)) > 0 """); } @@ -172,27 +172,27 @@ FROM [Level1] AS [l] LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[Level2_Name], [l0].[OneToMany_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id] FROM [Level1] AS [l0] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] ON [l].[Id] = CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] END LEFT JOIN ( SELECT [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Level3_Name], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[OneToOne_Optional_PK_Inverse3Id] FROM [Level1] AS [l1] - WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse3Id] IS NOT NULL) + WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL ) AS [t0] ON CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] END = CASE - WHEN ([t0].[Level2_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [t0].[Id] + WHEN [t0].[Level2_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [t0].[Id] END LEFT JOIN ( SELECT [l2].[Id], [l2].[Level3_Optional_Id], [l2].[Level3_Required_Id], [l2].[Level4_Name], [l2].[OneToMany_Optional_Inverse4Id], [l2].[OneToMany_Required_Inverse4Id], [l2].[OneToOne_Optional_PK_Inverse4Id] FROM [Level1] AS [l2] - WHERE ([l2].[Level3_Required_Id] IS NOT NULL) AND ([l2].[OneToMany_Required_Inverse4Id] IS NOT NULL) + WHERE [l2].[Level3_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse4Id] IS NOT NULL ) AS [t1] ON CASE - WHEN ([t0].[Level2_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [t0].[Id] + WHEN [t0].[Level2_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [t0].[Id] END = CASE - WHEN ([t1].[Level3_Required_Id] IS NOT NULL) AND ([t1].[OneToMany_Required_Inverse4Id] IS NOT NULL) THEN [t1].[Id] + WHEN [t1].[Level3_Required_Id] IS NOT NULL AND [t1].[OneToMany_Required_Inverse4Id] IS NOT NULL THEN [t1].[Id] END """); } @@ -215,11 +215,11 @@ FROM [Level1] AS [l0] LEFT JOIN ( SELECT [l1].[Id], [l1].[OneToOne_Required_PK_Date], [l1].[Level1_Optional_Id], [l1].[Level1_Required_Id], [l1].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l1] - WHERE ([l1].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l1].[Level1_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l1].[OneToOne_Required_PK_Date] IS NOT NULL AND [l1].[Level1_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] ON [l0].[Id] = CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] END - WHERE ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t0] ON [l].[Id] = [t0].[Level1_Optional_Id] ORDER BY [l].[Id] ) AS [t1] @@ -229,13 +229,13 @@ FROM [Level1] AS [l2] LEFT JOIN ( SELECT [l3].[Id], [l3].[OneToOne_Required_PK_Date], [l3].[Level1_Optional_Id], [l3].[Level1_Required_Id], [l3].[Level2_Name], [l3].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l3] - WHERE ([l3].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l3].[Level1_Required_Id] IS NOT NULL) AND ([l3].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l3].[OneToOne_Required_PK_Date] IS NOT NULL AND [l3].[Level1_Required_Id] IS NOT NULL AND [l3].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t3] ON [l2].[Id] = CASE - WHEN ([t3].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t3].[Level1_Required_Id] IS NOT NULL) AND ([t3].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t3].[Id] + WHEN [t3].[OneToOne_Required_PK_Date] IS NOT NULL AND [t3].[Level1_Required_Id] IS NOT NULL AND [t3].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t3].[Id] END - WHERE ([t3].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t3].[Level1_Required_Id] IS NOT NULL) AND ([t3].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [t3].[OneToOne_Required_PK_Date] IS NOT NULL AND [t3].[Level1_Required_Id] IS NOT NULL AND [t3].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t2] ON CASE - WHEN ([t1].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t1].[Level1_Required_Id] IS NOT NULL) AND ([t1].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t1].[Id00] + WHEN [t1].[OneToOne_Required_PK_Date] IS NOT NULL AND [t1].[Level1_Required_Id] IS NOT NULL AND [t1].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t1].[Id00] END = [t2].[Level1_Optional_Id] ORDER BY [t1].[Id] """); @@ -257,13 +257,13 @@ FROM [Level1] AS [l0] LEFT JOIN ( SELECT [l1].[Id], [l1].[OneToOne_Required_PK_Date], [l1].[Level1_Optional_Id], [l1].[Level1_Required_Id], [l1].[Level2_Name], [l1].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l1] - WHERE ([l1].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l1].[Level1_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l1].[OneToOne_Required_PK_Date] IS NOT NULL AND [l1].[Level1_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] ON [l0].[Id] = CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] END - WHERE ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t0] ON [l].[Id] = [t0].[Level1_Optional_Id] - WHERE [t0].[Level2_Name] <> N'Foo' OR ([t0].[Level2_Name] IS NULL) + WHERE [t0].[Level2_Name] <> N'Foo' OR [t0].[Level2_Name] IS NULL ) AS [t1] """); } @@ -275,7 +275,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] @@ -285,11 +285,11 @@ FROM [Level1] AS [l0] LEFT JOIN ( SELECT [l1].[Id], [l1].[OneToOne_Required_PK_Date], [l1].[Level1_Optional_Id], [l1].[Level1_Required_Id], [l1].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l1] - WHERE ([l1].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l1].[Level1_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l1].[OneToOne_Required_PK_Date] IS NOT NULL AND [l1].[Level1_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] ON [l0].[Id] = CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] END - WHERE ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t0] ON [l].[Id] = [t0].[Level1_Optional_Id] """); } @@ -308,36 +308,36 @@ public override async Task Member_over_null_check_ternary_and_nested_anonymous_t AssertSql( """ SELECT [l].[Id], [l].[Name], CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NULL) OR ([t].[Level1_Required_Id] IS NULL) OR ([t].[OneToMany_Required_Inverse2Id] IS NULL) THEN CAST(1 AS bit) + WHEN [t].[OneToOne_Required_PK_Date] IS NULL OR [t].[Level1_Required_Id] IS NULL OR [t].[OneToMany_Required_Inverse2Id] IS NULL THEN CAST(1 AS bit) ELSE CAST(0 AS bit) END, CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] END, [t].[Level2_Name], CASE - WHEN ([t0].[Level2_Required_Id] IS NULL) OR ([t0].[OneToMany_Required_Inverse3Id] IS NULL) THEN CAST(1 AS bit) + WHEN [t0].[Level2_Required_Id] IS NULL OR [t0].[OneToMany_Required_Inverse3Id] IS NULL THEN CAST(1 AS bit) ELSE CAST(0 AS bit) END, CASE - WHEN ([t0].[Level2_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [t0].[Id] + WHEN [t0].[Level2_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [t0].[Id] END, [t0].[Level3_Name] FROM [Level1] AS [l] LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[Level2_Name], [l0].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l0] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] ON [l].[Id] = [t].[Level1_Optional_Id] LEFT JOIN ( SELECT [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Level3_Name], [l1].[OneToMany_Required_Inverse3Id] FROM [Level1] AS [l1] - WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse3Id] IS NOT NULL) + WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL ) AS [t0] ON CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] END = [t0].[Level2_Optional_Id] WHERE CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NULL) OR ([t].[Level1_Required_Id] IS NULL) OR ([t].[OneToMany_Required_Inverse2Id] IS NULL) THEN NULL + WHEN [t].[OneToOne_Required_PK_Date] IS NULL OR [t].[Level1_Required_Id] IS NULL OR [t].[OneToMany_Required_Inverse2Id] IS NULL THEN NULL ELSE [t0].[Level3_Name] -END <> N'L' OR (CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NULL) OR ([t].[Level1_Required_Id] IS NULL) OR ([t].[OneToMany_Required_Inverse2Id] IS NULL) THEN NULL +END <> N'L' OR CASE + WHEN [t].[OneToOne_Required_PK_Date] IS NULL OR [t].[Level1_Required_Id] IS NULL OR [t].[OneToMany_Required_Inverse2Id] IS NULL THEN NULL ELSE [t0].[Level3_Name] -END IS NULL) +END IS NULL """); } @@ -357,11 +357,11 @@ FROM [Level1] AS [l0] LEFT JOIN ( SELECT [l1].[Id], [l1].[Level2_Required_Id], [l1].[Level3_Name], [l1].[OneToMany_Required_Inverse3Id] FROM [Level1] AS [l1] - WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse3Id] IS NOT NULL) + WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL ) AS [t] ON CASE - WHEN ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [l0].[Id] + WHEN [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [l0].[Id] END = CASE - WHEN ([t].[Level2_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [t].[Id] + WHEN [t].[Level2_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [t].[Id] END CROSS APPLY ( SELECT [l].[Name] AS [l1Name], [t].[Level3_Name] AS [l2Name], [t1].[Level3_Name] AS [l3Name] @@ -369,19 +369,19 @@ FROM [Level1] AS [l2] LEFT JOIN ( SELECT [l3].[Id], [l3].[Level2_Required_Id], [l3].[Level3_Name], [l3].[OneToMany_Required_Inverse3Id] FROM [Level1] AS [l3] - WHERE ([l3].[Level2_Required_Id] IS NOT NULL) AND ([l3].[OneToMany_Required_Inverse3Id] IS NOT NULL) + WHERE [l3].[Level2_Required_Id] IS NOT NULL AND [l3].[OneToMany_Required_Inverse3Id] IS NOT NULL ) AS [t1] ON [l2].[OneToOne_Optional_PK_Inverse4Id] = CASE - WHEN ([t1].[Level2_Required_Id] IS NOT NULL) AND ([t1].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [t1].[Id] + WHEN [t1].[Level2_Required_Id] IS NOT NULL AND [t1].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [t1].[Id] END - WHERE ([l2].[Level3_Required_Id] IS NOT NULL) AND ([l2].[OneToMany_Required_Inverse4Id] IS NOT NULL) AND (CASE - WHEN ([t].[Level2_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [t].[Id] - END IS NOT NULL) AND (CASE - WHEN ([t].[Level2_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [t].[Id] - END = [l2].[OneToMany_Optional_Inverse4Id] OR ((CASE - WHEN ([t].[Level2_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [t].[Id] - END IS NULL) AND ([l2].[OneToMany_Optional_Inverse4Id] IS NULL))) + WHERE [l2].[Level3_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse4Id] IS NOT NULL AND CASE + WHEN [t].[Level2_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [t].[Id] + END IS NOT NULL AND (CASE + WHEN [t].[Level2_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [t].[Id] + END = [l2].[OneToMany_Optional_Inverse4Id] OR (CASE + WHEN [t].[Level2_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [t].[Id] + END IS NULL AND [l2].[OneToMany_Optional_Inverse4Id] IS NULL)) ) AS [t0] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) AND [l].[Id] = [l0].[OneToMany_Optional_Inverse2Id] + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL AND [l].[Id] = [l0].[OneToMany_Optional_Inverse2Id] ) AS [t2] """); } @@ -397,22 +397,22 @@ FROM [Level1] AS [l] LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Required_Id], [l0].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l0] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] ON [l].[Id] = [t].[Level1_Required_Id] LEFT JOIN ( SELECT [l1].[Level2_Required_Id], [l1].[Level3_Name] FROM [Level1] AS [l1] - WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse3Id] IS NOT NULL) + WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL ) AS [t0] ON CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] END = [t0].[Level2_Required_Id] ORDER BY ( SELECT COUNT(*) FROM [Level1] AS [l2] - WHERE ([l2].[Level2_Required_Id] IS NOT NULL) AND ([l2].[OneToMany_Required_Inverse3Id] IS NOT NULL) AND (CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] - END IS NOT NULL) AND CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] + WHERE [l2].[Level2_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse3Id] IS NOT NULL AND CASE + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + END IS NOT NULL AND CASE + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] END = [l2].[OneToMany_Required_Inverse3Id]), [t0].[Level3_Name] """); } @@ -428,51 +428,51 @@ FROM [Level1] AS [l] LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Required_Id], [l0].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l0] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] ON [l].[Id] = CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] END LEFT JOIN ( SELECT [l1].[Id], [l1].[Level2_Required_Id], [l1].[Level3_Name], [l1].[OneToMany_Required_Inverse3Id] FROM [Level1] AS [l1] - WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse3Id] IS NOT NULL) + WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL ) AS [t0] ON CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] END = CASE - WHEN ([t0].[Level2_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [t0].[Id] + WHEN [t0].[Level2_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [t0].[Id] END GROUP BY [t0].[Level3_Name] HAVING ( SELECT MIN(COALESCE(CASE - WHEN ([t3].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t3].[Level1_Required_Id] IS NOT NULL) AND ([t3].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t3].[Id] + WHEN [t3].[OneToOne_Required_PK_Date] IS NOT NULL AND [t3].[Level1_Required_Id] IS NOT NULL AND [t3].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t3].[Id] END, 0) + COALESCE(CASE - WHEN ([t3].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t3].[Level1_Required_Id] IS NOT NULL) AND ([t3].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t3].[Id] + WHEN [t3].[OneToOne_Required_PK_Date] IS NOT NULL AND [t3].[Level1_Required_Id] IS NOT NULL AND [t3].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t3].[Id] END, 0)) FROM [Level1] AS [l2] LEFT JOIN ( SELECT [l3].[Id], [l3].[OneToOne_Required_PK_Date], [l3].[Level1_Optional_Id], [l3].[Level1_Required_Id], [l3].[Level2_Name], [l3].[OneToMany_Optional_Inverse2Id], [l3].[OneToMany_Required_Inverse2Id], [l3].[OneToOne_Optional_PK_Inverse2Id] FROM [Level1] AS [l3] - WHERE ([l3].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l3].[Level1_Required_Id] IS NOT NULL) AND ([l3].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l3].[OneToOne_Required_PK_Date] IS NOT NULL AND [l3].[Level1_Required_Id] IS NOT NULL AND [l3].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t1] ON [l2].[Id] = CASE - WHEN ([t1].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t1].[Level1_Required_Id] IS NOT NULL) AND ([t1].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t1].[Id] + WHEN [t1].[OneToOne_Required_PK_Date] IS NOT NULL AND [t1].[Level1_Required_Id] IS NOT NULL AND [t1].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t1].[Id] END LEFT JOIN ( SELECT [l4].[Id], [l4].[Level2_Optional_Id], [l4].[Level2_Required_Id], [l4].[Level3_Name], [l4].[OneToMany_Optional_Inverse3Id], [l4].[OneToMany_Required_Inverse3Id], [l4].[OneToOne_Optional_PK_Inverse3Id] FROM [Level1] AS [l4] - WHERE ([l4].[Level2_Required_Id] IS NOT NULL) AND ([l4].[OneToMany_Required_Inverse3Id] IS NOT NULL) + WHERE [l4].[Level2_Required_Id] IS NOT NULL AND [l4].[OneToMany_Required_Inverse3Id] IS NOT NULL ) AS [t2] ON CASE - WHEN ([t1].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t1].[Level1_Required_Id] IS NOT NULL) AND ([t1].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t1].[Id] + WHEN [t1].[OneToOne_Required_PK_Date] IS NOT NULL AND [t1].[Level1_Required_Id] IS NOT NULL AND [t1].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t1].[Id] END = CASE - WHEN ([t2].[Level2_Required_Id] IS NOT NULL) AND ([t2].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [t2].[Id] + WHEN [t2].[Level2_Required_Id] IS NOT NULL AND [t2].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [t2].[Id] END LEFT JOIN ( SELECT [l5].[Id], [l5].[OneToOne_Required_PK_Date], [l5].[Level1_Optional_Id], [l5].[Level1_Required_Id], [l5].[Level2_Name], [l5].[OneToMany_Optional_Inverse2Id], [l5].[OneToMany_Required_Inverse2Id], [l5].[OneToOne_Optional_PK_Inverse2Id] FROM [Level1] AS [l5] - WHERE ([l5].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l5].[Level1_Required_Id] IS NOT NULL) AND ([l5].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l5].[OneToOne_Required_PK_Date] IS NOT NULL AND [l5].[Level1_Required_Id] IS NOT NULL AND [l5].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t3] ON [l2].[Id] = CASE - WHEN ([t3].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t3].[Level1_Required_Id] IS NOT NULL) AND ([t3].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t3].[Id] + WHEN [t3].[OneToOne_Required_PK_Date] IS NOT NULL AND [t3].[Level1_Required_Id] IS NOT NULL AND [t3].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t3].[Id] END - WHERE [t0].[Level3_Name] = [t2].[Level3_Name] OR (([t0].[Level3_Name] IS NULL) AND ([t2].[Level3_Name] IS NULL))) > 0 + WHERE [t0].[Level3_Name] = [t2].[Level3_Name] OR ([t0].[Level3_Name] IS NULL AND [t2].[Level3_Name] IS NULL)) > 0 """); } @@ -497,10 +497,10 @@ public override async Task Sum_with_filter_with_include_selector_cast_using_as(b FROM [Level1] AS [l] WHERE [l].[Id] > ( SELECT COALESCE(SUM(CASE - WHEN ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [l0].[Id] + WHEN [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [l0].[Id] END), 0) FROM [Level1] AS [l0] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) AND [l].[Id] = [l0].[OneToMany_Optional_Inverse2Id]) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL AND [l].[Id] = [l0].[OneToMany_Optional_Inverse2Id]) """); } @@ -518,23 +518,23 @@ FROM [Level1] AS [l0] LEFT JOIN ( SELECT [l1].[Id], [l1].[OneToOne_Required_PK_Date], [l1].[Level1_Optional_Id], [l1].[Level1_Required_Id], [l1].[Level2_Name], [l1].[OneToMany_Optional_Inverse2Id], [l1].[OneToMany_Required_Inverse2Id], [l1].[OneToOne_Optional_PK_Inverse2Id] FROM [Level1] AS [l1] - WHERE ([l1].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l1].[Level1_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l1].[OneToOne_Required_PK_Date] IS NOT NULL AND [l1].[Level1_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] ON [l0].[Id] = CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] END LEFT JOIN ( SELECT [l2].[Id], [l2].[Level2_Optional_Id], [l2].[Level2_Required_Id], [l2].[Level3_Name], [l2].[OneToMany_Optional_Inverse3Id], [l2].[OneToMany_Required_Inverse3Id], [l2].[OneToOne_Optional_PK_Inverse3Id] FROM [Level1] AS [l2] - WHERE ([l2].[Level2_Required_Id] IS NOT NULL) AND ([l2].[OneToMany_Required_Inverse3Id] IS NOT NULL) + WHERE [l2].[Level2_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse3Id] IS NOT NULL ) AS [t0] ON CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] END = CASE - WHEN ([t0].[Level2_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [t0].[Id] + WHEN [t0].[Level2_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [t0].[Id] END - WHERE ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) AND ([t0].[Level2_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse3Id] IS NOT NULL) + WHERE [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL AND [t0].[Level2_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse3Id] IS NOT NULL ) AS [t1] ORDER BY CASE - WHEN ([t1].[Level2_Required_Id] IS NOT NULL) AND ([t1].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [t1].[Id] + WHEN [t1].[Level2_Required_Id] IS NOT NULL AND [t1].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [t1].[Id] END) FROM [Level1] AS [l] WHERE [l].[Id] < 3 @@ -555,28 +555,28 @@ FROM [Level1] AS [l0] LEFT JOIN ( SELECT [l1].[Id], [l1].[OneToOne_Required_PK_Date], [l1].[Level1_Required_Id], [l1].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l1] - WHERE ([l1].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l1].[Level1_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l1].[OneToOne_Required_PK_Date] IS NOT NULL AND [l1].[Level1_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] ON [l0].[Id] = CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] END LEFT JOIN ( SELECT [l2].[Id], [l2].[Level2_Optional_Id], [l2].[Level2_Required_Id], [l2].[Level3_Name], [l2].[OneToMany_Optional_Inverse3Id], [l2].[OneToMany_Required_Inverse3Id], [l2].[OneToOne_Optional_PK_Inverse3Id] FROM [Level1] AS [l2] - WHERE ([l2].[Level2_Required_Id] IS NOT NULL) AND ([l2].[OneToMany_Required_Inverse3Id] IS NOT NULL) + WHERE [l2].[Level2_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse3Id] IS NOT NULL ) AS [t0] ON CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] END = CASE - WHEN ([t0].[Level2_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [t0].[Id] + WHEN [t0].[Level2_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [t0].[Id] END - WHERE ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) AND ([t0].[Level2_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse3Id] IS NOT NULL) AND EXISTS ( + WHERE [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL AND [t0].[Level2_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse3Id] IS NOT NULL AND EXISTS ( SELECT 1 FROM [Level1] AS [l3] - WHERE ([l3].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l3].[Level1_Required_Id] IS NOT NULL) AND ([l3].[OneToMany_Required_Inverse2Id] IS NOT NULL) AND [l].[Id] = [l3].[OneToMany_Required_Inverse2Id] AND [l3].[Id] = [t0].[Level2_Required_Id]) + WHERE [l3].[OneToOne_Required_PK_Date] IS NOT NULL AND [l3].[Level1_Required_Id] IS NOT NULL AND [l3].[OneToMany_Required_Inverse2Id] IS NOT NULL AND [l].[Id] = [l3].[OneToMany_Required_Inverse2Id] AND [l3].[Id] = [t0].[Level2_Required_Id]) ) AS [t1] LEFT JOIN ( SELECT [l4].[Id], [l4].[OneToOne_Required_PK_Date], [l4].[Level1_Optional_Id], [l4].[Level1_Required_Id], [l4].[Level2_Name], [l4].[OneToMany_Optional_Inverse2Id], [l4].[OneToMany_Required_Inverse2Id], [l4].[OneToOne_Optional_PK_Inverse2Id] FROM [Level1] AS [l4] - WHERE ([l4].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l4].[Level1_Required_Id] IS NOT NULL) AND ([l4].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l4].[OneToOne_Required_PK_Date] IS NOT NULL AND [l4].[Level1_Required_Id] IS NOT NULL AND [l4].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t2] ON [l].[Id] = [t2].[OneToMany_Required_Inverse2Id] ORDER BY [l].[Id], [t1].[Id0], [t1].[Id1], [t1].[Id] """); @@ -593,25 +593,25 @@ FROM [Level1] AS [l] LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l0] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] ON [l].[Id] = [t].[Level1_Optional_Id] LEFT JOIN ( SELECT [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[OneToMany_Required_Inverse3Id] FROM [Level1] AS [l1] - WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse3Id] IS NOT NULL) + WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL ) AS [t0] ON CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] END = [t0].[Level2_Optional_Id] LEFT JOIN ( SELECT [l2].[Level3_Optional_Id], [l2].[Level4_Name] FROM [Level1] AS [l2] - WHERE ([l2].[Level3_Required_Id] IS NOT NULL) AND ([l2].[OneToMany_Required_Inverse4Id] IS NOT NULL) + WHERE [l2].[Level3_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse4Id] IS NOT NULL ) AS [t1] ON CASE - WHEN ([t0].[Level2_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [t0].[Id] + WHEN [t0].[Level2_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [t0].[Id] END = [t1].[Level3_Optional_Id] WHERE CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NULL) OR ([t].[Level1_Required_Id] IS NULL) OR ([t].[OneToMany_Required_Inverse2Id] IS NULL) THEN NULL - WHEN ([t0].[Level2_Required_Id] IS NULL) OR ([t0].[OneToMany_Required_Inverse3Id] IS NULL) THEN NULL + WHEN [t].[OneToOne_Required_PK_Date] IS NULL OR [t].[Level1_Required_Id] IS NULL OR [t].[OneToMany_Required_Inverse2Id] IS NULL THEN NULL + WHEN [t0].[Level2_Required_Id] IS NULL OR [t0].[OneToMany_Required_Inverse3Id] IS NULL THEN NULL ELSE [t1].[Level4_Name] END = N'L4 01' """); @@ -628,9 +628,9 @@ FROM [Level1] AS [l] LEFT JOIN ( SELECT [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[Level2_Name], [l0].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l0] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] ON [l].[Id] = [t].[Level1_Optional_Id] -WHERE ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) AND [t].[Level2_Name] = N'L2 01' +WHERE [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL AND [t].[Level2_Name] = N'L2 01' """); } @@ -641,7 +641,7 @@ public override async Task Multiple_conditionals_in_projection(bool async) AssertSql( """ SELECT CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] END, [t0].[Level3_Name], CASE WHEN [l2].[Id] IS NULL THEN CAST(1 AS bit) ELSE CAST(0 AS bit) @@ -650,19 +650,19 @@ FROM [Level1] AS [l] LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l0] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] ON [l].[Id] = CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] END LEFT JOIN ( SELECT [l1].[Level2_Optional_Id], [l1].[Level3_Name] FROM [Level1] AS [l1] - WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse3Id] IS NOT NULL) + WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL ) AS [t0] ON CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] END = [t0].[Level2_Optional_Id] LEFT JOIN [Level1] AS [l2] ON [t].[Level1_Optional_Id] = [l2].[Id] -WHERE ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) +WHERE [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL """); } @@ -673,7 +673,7 @@ public override async Task Multiple_joins_groupby_predicate(bool async) AssertSql( """ SELECT [l].[Id], [l].[Name], CASE - WHEN ([t0].[OneToOne_Required_PK_Date] IS NULL) OR ([t0].[Level1_Required_Id] IS NULL) OR ([t0].[OneToMany_Required_Inverse2Id] IS NULL) THEN N'Foo' + WHEN [t0].[OneToOne_Required_PK_Date] IS NULL OR [t0].[Level1_Required_Id] IS NULL OR [t0].[OneToMany_Required_Inverse2Id] IS NULL THEN N'Foo' ELSE N'Bar' END AS [Foo] FROM [Level1] AS [l] @@ -683,11 +683,11 @@ FROM [Level1] AS [l0] LEFT JOIN ( SELECT [l1].[Id], [l1].[OneToOne_Required_PK_Date], [l1].[Level1_Optional_Id], [l1].[Level1_Required_Id], [l1].[Level2_Name], [l1].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l1] - WHERE ([l1].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l1].[Level1_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l1].[OneToOne_Required_PK_Date] IS NOT NULL AND [l1].[Level1_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] ON [l0].[Id] = CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] END - WHERE ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t0] ON [l].[Id] = [t0].[Level1_Optional_Id] LEFT JOIN ( SELECT [t3].[Level3_Name] AS [Key], COUNT(*) AS [Count] @@ -695,23 +695,23 @@ FROM [Level1] AS [l2] LEFT JOIN ( SELECT [l3].[Id], [l3].[OneToOne_Required_PK_Date], [l3].[Level1_Required_Id], [l3].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l3] - WHERE ([l3].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l3].[Level1_Required_Id] IS NOT NULL) AND ([l3].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l3].[OneToOne_Required_PK_Date] IS NOT NULL AND [l3].[Level1_Required_Id] IS NOT NULL AND [l3].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t2] ON [l2].[Id] = CASE - WHEN ([t2].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t2].[Level1_Required_Id] IS NOT NULL) AND ([t2].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t2].[Id] + WHEN [t2].[OneToOne_Required_PK_Date] IS NOT NULL AND [t2].[Level1_Required_Id] IS NOT NULL AND [t2].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t2].[Id] END LEFT JOIN ( SELECT [l4].[Id], [l4].[Level2_Required_Id], [l4].[Level3_Name], [l4].[OneToMany_Required_Inverse3Id] FROM [Level1] AS [l4] - WHERE ([l4].[Level2_Required_Id] IS NOT NULL) AND ([l4].[OneToMany_Required_Inverse3Id] IS NOT NULL) + WHERE [l4].[Level2_Required_Id] IS NOT NULL AND [l4].[OneToMany_Required_Inverse3Id] IS NOT NULL ) AS [t3] ON CASE - WHEN ([t2].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t2].[Level1_Required_Id] IS NOT NULL) AND ([t2].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t2].[Id] + WHEN [t2].[OneToOne_Required_PK_Date] IS NOT NULL AND [t2].[Level1_Required_Id] IS NOT NULL AND [t2].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t2].[Id] END = CASE - WHEN ([t3].[Level2_Required_Id] IS NOT NULL) AND ([t3].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [t3].[Id] + WHEN [t3].[Level2_Required_Id] IS NOT NULL AND [t3].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [t3].[Id] END - WHERE ([t2].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t2].[Level1_Required_Id] IS NOT NULL) AND ([t2].[OneToMany_Required_Inverse2Id] IS NOT NULL) AND ([t3].[Level2_Required_Id] IS NOT NULL) AND ([t3].[OneToMany_Required_Inverse3Id] IS NOT NULL) + WHERE [t2].[OneToOne_Required_PK_Date] IS NOT NULL AND [t2].[Level1_Required_Id] IS NOT NULL AND [t2].[OneToMany_Required_Inverse2Id] IS NOT NULL AND [t3].[Level2_Required_Id] IS NOT NULL AND [t3].[OneToMany_Required_Inverse3Id] IS NOT NULL GROUP BY [t3].[Level3_Name] ) AS [t1] ON [l].[Name] = [t1].[Key] -WHERE ([t0].[Level2_Name] IS NOT NULL) OR [t1].[Count] > 0 +WHERE [t0].[Level2_Name] IS NOT NULL OR [t1].[Count] > 0 """); } @@ -724,20 +724,20 @@ public override async Task Nested_object_constructed_from_group_key_properties(b SELECT [t1].[Id], [t1].[Name], [t1].[Date], [t1].[InnerId] AS [Id], [t1].[Level2_Name0] AS [Name], [t1].[OneToOne_Required_PK_Date] AS [Date], [t1].[Level1_Optional_Id], [t1].[Level1_Required_Id], COALESCE(SUM(CAST(LEN([t1].[Name]) AS int)), 0) AS [Aggregate] FROM ( SELECT [l].[Id], [l].[Date], [l].[Name], [t].[OneToOne_Required_PK_Date], [t].[Level1_Optional_Id], [t].[Level1_Required_Id], [t0].[Level2_Name] AS [Level2_Name0], CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] END AS [InnerId] FROM [Level1] AS [l] LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l0] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] ON [l].[Id] = [t].[Level1_Optional_Id] LEFT JOIN ( SELECT [l1].[Level1_Required_Id], [l1].[Level2_Name] FROM [Level1] AS [l1] - WHERE ([l1].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l1].[Level1_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l1].[OneToOne_Required_PK_Date] IS NOT NULL AND [l1].[Level1_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t0] ON [l].[Id] = [t0].[Level1_Required_Id] - WHERE ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t1] GROUP BY [t1].[Id], [t1].[Date], [t1].[Name], [t1].[InnerId], [t1].[OneToOne_Required_PK_Date], [t1].[Level1_Optional_Id], [t1].[Level1_Required_Id], [t1].[Level2_Name0] """); @@ -756,10 +756,10 @@ FROM [Level1] AS [l] LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[Level2_Name], [l0].[OneToMany_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id] FROM [Level1] AS [l0] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] ON [l].[Id] = [t].[Level1_Optional_Id] WHERE CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] END IS NULL) THEN CAST(1 AS bit) ELSE CAST(0 AS bit) END @@ -773,16 +773,16 @@ public override async Task Member_over_null_check_ternary_and_nested_dto_type(bo AssertSql( """ SELECT [l].[Id], [l].[Name], CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NULL) OR ([t].[Level1_Required_Id] IS NULL) OR ([t].[OneToMany_Required_Inverse2Id] IS NULL) THEN CAST(1 AS bit) + WHEN [t].[OneToOne_Required_PK_Date] IS NULL OR [t].[Level1_Required_Id] IS NULL OR [t].[OneToMany_Required_Inverse2Id] IS NULL THEN CAST(1 AS bit) ELSE CAST(0 AS bit) END, CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] END, [t].[Level2_Name] FROM [Level1] AS [l] LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[Level2_Name], [l0].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l0] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] ON [l].[Id] = [t].[Level1_Optional_Id] ORDER BY [t].[Level2_Name], [l].[Id] """); @@ -799,10 +799,10 @@ FROM [Level1] AS [l] LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l0] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] ON [l].[Id] = [t].[Level1_Optional_Id] WHERE [l].[Id] = CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] END """); } @@ -818,43 +818,43 @@ FROM [Level1] AS [l] INNER JOIN ( SELECT [t0].[Key], ( SELECT COALESCE(SUM(CASE - WHEN ([t3].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t3].[Level1_Required_Id] IS NOT NULL) AND ([t3].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t3].[Id] + WHEN [t3].[OneToOne_Required_PK_Date] IS NOT NULL AND [t3].[Level1_Required_Id] IS NOT NULL AND [t3].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t3].[Id] END), 0) FROM ( SELECT [l1].[Id], [l1].[Date], [l1].[Name], [t4].[Id] AS [Id0], [t4].[OneToOne_Required_PK_Date], [t4].[Level1_Optional_Id], [t4].[Level1_Required_Id], [t4].[Level2_Name], [t4].[OneToMany_Optional_Inverse2Id], [t4].[OneToMany_Required_Inverse2Id], [t4].[OneToOne_Optional_PK_Inverse2Id], CASE - WHEN ([t4].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t4].[Level1_Required_Id] IS NOT NULL) AND ([t4].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t4].[Id] + WHEN [t4].[OneToOne_Required_PK_Date] IS NOT NULL AND [t4].[Level1_Required_Id] IS NOT NULL AND [t4].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t4].[Id] END % 3 AS [Key] FROM [Level1] AS [l1] LEFT JOIN ( SELECT [l2].[Id], [l2].[OneToOne_Required_PK_Date], [l2].[Level1_Optional_Id], [l2].[Level1_Required_Id], [l2].[Level2_Name], [l2].[OneToMany_Optional_Inverse2Id], [l2].[OneToMany_Required_Inverse2Id], [l2].[OneToOne_Optional_PK_Inverse2Id] FROM [Level1] AS [l2] - WHERE ([l2].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l2].[Level1_Required_Id] IS NOT NULL) AND ([l2].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l2].[OneToOne_Required_PK_Date] IS NOT NULL AND [l2].[Level1_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t4] ON [l1].[Id] = CASE - WHEN ([t4].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t4].[Level1_Required_Id] IS NOT NULL) AND ([t4].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t4].[Id] + WHEN [t4].[OneToOne_Required_PK_Date] IS NOT NULL AND [t4].[Level1_Required_Id] IS NOT NULL AND [t4].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t4].[Id] END - WHERE ([t4].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t4].[Level1_Required_Id] IS NOT NULL) AND ([t4].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [t4].[OneToOne_Required_PK_Date] IS NOT NULL AND [t4].[Level1_Required_Id] IS NOT NULL AND [t4].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t2] LEFT JOIN ( SELECT [l3].[Id], [l3].[OneToOne_Required_PK_Date], [l3].[Level1_Optional_Id], [l3].[Level1_Required_Id], [l3].[Level2_Name], [l3].[OneToMany_Optional_Inverse2Id], [l3].[OneToMany_Required_Inverse2Id], [l3].[OneToOne_Optional_PK_Inverse2Id] FROM [Level1] AS [l3] - WHERE ([l3].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l3].[Level1_Required_Id] IS NOT NULL) AND ([l3].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l3].[OneToOne_Required_PK_Date] IS NOT NULL AND [l3].[Level1_Required_Id] IS NOT NULL AND [l3].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t3] ON [t2].[Id] = CASE - WHEN ([t3].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t3].[Level1_Required_Id] IS NOT NULL) AND ([t3].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t3].[Id] + WHEN [t3].[OneToOne_Required_PK_Date] IS NOT NULL AND [t3].[Level1_Required_Id] IS NOT NULL AND [t3].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t3].[Id] END - WHERE [t0].[Key] = [t2].[Key] OR (([t0].[Key] IS NULL) AND ([t2].[Key] IS NULL))) AS [Sum] + WHERE [t0].[Key] = [t2].[Key] OR ([t0].[Key] IS NULL AND [t2].[Key] IS NULL)) AS [Sum] FROM ( SELECT CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] END % 3 AS [Key] FROM [Level1] AS [l0] LEFT JOIN ( SELECT [l4].[Id], [l4].[OneToOne_Required_PK_Date], [l4].[Level1_Required_Id], [l4].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l4] - WHERE ([l4].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l4].[Level1_Required_Id] IS NOT NULL) AND ([l4].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l4].[OneToOne_Required_PK_Date] IS NOT NULL AND [l4].[Level1_Required_Id] IS NOT NULL AND [l4].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] ON [l0].[Id] = CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] END - WHERE ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t0] GROUP BY [t0].[Key] ) AS [t1] ON [l].[Id] = [t1].[Key] AND CAST(1 AS bit) = CASE @@ -877,29 +877,29 @@ FROM [Level1] AS [l2] LEFT JOIN ( SELECT [l3].[Id], [l3].[OneToOne_Required_PK_Date], [l3].[Level1_Optional_Id], [l3].[Level1_Required_Id], [l3].[Level2_Name], [l3].[OneToMany_Optional_Inverse2Id], [l3].[OneToMany_Required_Inverse2Id], [l3].[OneToOne_Optional_PK_Inverse2Id] FROM [Level1] AS [l3] - WHERE ([l3].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l3].[Level1_Required_Id] IS NOT NULL) AND ([l3].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l3].[OneToOne_Required_PK_Date] IS NOT NULL AND [l3].[Level1_Required_Id] IS NOT NULL AND [l3].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t1] ON [l2].[Id] = [t1].[Level1_Optional_Id] WHERE CASE - WHEN ([t1].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t1].[Level1_Required_Id] IS NOT NULL) AND ([t1].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t1].[Id] + WHEN [t1].[OneToOne_Required_PK_Date] IS NOT NULL AND [t1].[Level1_Required_Id] IS NOT NULL AND [t1].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t1].[Id] END = CASE - WHEN ([t0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t0].[Level1_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t0].[Id] - END OR ((CASE - WHEN ([t1].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t1].[Level1_Required_Id] IS NOT NULL) AND ([t1].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t1].[Id] - END IS NULL) AND (CASE - WHEN ([t0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t0].[Level1_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t0].[Id] - END IS NULL))) THEN CAST(1 AS bit) + WHEN [t0].[OneToOne_Required_PK_Date] IS NOT NULL AND [t0].[Level1_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t0].[Id] + END OR (CASE + WHEN [t1].[OneToOne_Required_PK_Date] IS NOT NULL AND [t1].[Level1_Required_Id] IS NOT NULL AND [t1].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t1].[Id] + END IS NULL AND CASE + WHEN [t0].[OneToOne_Required_PK_Date] IS NOT NULL AND [t0].[Level1_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t0].[Id] + END IS NULL)) THEN CAST(1 AS bit) ELSE CAST(0 AS bit) END AS [Contains] FROM [Level1] AS [l] LEFT JOIN ( SELECT [l0].[Level1_Optional_Id], [l0].[Level2_Name] FROM [Level1] AS [l0] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] ON [l].[Id] = [t].[Level1_Optional_Id] LEFT JOIN ( SELECT [l1].[Id], [l1].[OneToOne_Required_PK_Date], [l1].[Level1_Required_Id], [l1].[OneToMany_Required_Inverse2Id], [l1].[OneToOne_Optional_PK_Inverse2Id] FROM [Level1] AS [l1] - WHERE ([l1].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l1].[Level1_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l1].[OneToOne_Required_PK_Date] IS NOT NULL AND [l1].[Level1_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t0] ON [l].[Id] = [t0].[OneToOne_Optional_PK_Inverse2Id] """); } @@ -953,21 +953,21 @@ FROM [Level1] AS [l] LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[Level2_Name], [l0].[OneToMany_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id] FROM [Level1] AS [l0] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] ON [l].[Id] = [t].[Level1_Required_Id] LEFT JOIN ( SELECT [l1].[Id], [l1].[OneToOne_Required_PK_Date], [l1].[Level1_Optional_Id], [l1].[Level1_Required_Id], [l1].[Level2_Name], [l1].[OneToMany_Optional_Inverse2Id], [l1].[OneToMany_Required_Inverse2Id], [l1].[OneToOne_Optional_PK_Inverse2Id] FROM [Level1] AS [l1] - WHERE ([l1].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l1].[Level1_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l1].[OneToOne_Required_PK_Date] IS NOT NULL AND [l1].[Level1_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t0] ON [l].[Id] = [t0].[OneToMany_Required_Inverse2Id] LEFT JOIN ( SELECT [t2].[Id], [t2].[OneToOne_Required_PK_Date], [t2].[Level1_Optional_Id], [t2].[Level1_Required_Id], [t2].[Level2_Name], [t2].[OneToMany_Optional_Inverse2Id], [t2].[OneToMany_Required_Inverse2Id], [t2].[OneToOne_Optional_PK_Inverse2Id] FROM ( SELECT [l2].[Id], [l2].[OneToOne_Required_PK_Date], [l2].[Level1_Optional_Id], [l2].[Level1_Required_Id], [l2].[Level2_Name], [l2].[OneToMany_Optional_Inverse2Id], [l2].[OneToMany_Required_Inverse2Id], [l2].[OneToOne_Optional_PK_Inverse2Id], ROW_NUMBER() OVER(PARTITION BY [l2].[OneToMany_Required_Inverse2Id] ORDER BY CASE - WHEN ([l2].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l2].[Level1_Required_Id] IS NOT NULL) AND ([l2].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [l2].[Id] + WHEN [l2].[OneToOne_Required_PK_Date] IS NOT NULL AND [l2].[Level1_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [l2].[Id] END DESC) AS [row] FROM [Level1] AS [l2] - WHERE ([l2].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l2].[Level1_Required_Id] IS NOT NULL) AND ([l2].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l2].[OneToOne_Required_PK_Date] IS NOT NULL AND [l2].[Level1_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t2] WHERE [t2].[row] <= 1 ) AS [t1] ON [l].[Id] = [t1].[OneToMany_Required_Inverse2Id] @@ -989,11 +989,11 @@ FROM [Level1] AS [l0] LEFT JOIN ( SELECT [l1].[Id], [l1].[OneToOne_Required_PK_Date], [l1].[Level1_Optional_Id], [l1].[Level1_Required_Id], [l1].[Level2_Name], [l1].[OneToMany_Optional_Inverse2Id], [l1].[OneToMany_Required_Inverse2Id], [l1].[OneToOne_Optional_PK_Inverse2Id] FROM [Level1] AS [l1] - WHERE ([l1].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l1].[Level1_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l1].[OneToOne_Required_PK_Date] IS NOT NULL AND [l1].[Level1_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] ON [l0].[Id] = CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] END - WHERE ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t0] ON [l].[Id] = [t0].[Level1_Optional_Id] UNION ALL SELECT [l3].[Id] @@ -1001,12 +1001,12 @@ FROM [Level1] AS [l2] LEFT JOIN ( SELECT [l4].[Id], [l4].[OneToOne_Required_PK_Date], [l4].[Level1_Optional_Id], [l4].[Level1_Required_Id], [l4].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l4] - WHERE ([l4].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l4].[Level1_Required_Id] IS NOT NULL) AND ([l4].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l4].[OneToOne_Required_PK_Date] IS NOT NULL AND [l4].[Level1_Required_Id] IS NOT NULL AND [l4].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t2] ON [l2].[Id] = CASE - WHEN ([t2].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t2].[Level1_Required_Id] IS NOT NULL) AND ([t2].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t2].[Id] + WHEN [t2].[OneToOne_Required_PK_Date] IS NOT NULL AND [t2].[Level1_Required_Id] IS NOT NULL AND [t2].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t2].[Id] END LEFT JOIN [Level1] AS [l3] ON [t2].[Level1_Optional_Id] = [l3].[Id] -WHERE ([t2].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t2].[Level1_Required_Id] IS NOT NULL) AND ([t2].[OneToMany_Required_Inverse2Id] IS NOT NULL) AND ([l3].[Id] IS NULL) +WHERE [t2].[OneToOne_Required_PK_Date] IS NOT NULL AND [t2].[Level1_Required_Id] IS NOT NULL AND [t2].[OneToMany_Required_Inverse2Id] IS NOT NULL AND [l3].[Id] IS NULL """); } @@ -1026,26 +1026,26 @@ FROM [Level1] AS [l0] LEFT JOIN ( SELECT [l1].[Id], [l1].[OneToOne_Required_PK_Date], [l1].[Level1_Optional_Id], [l1].[Level1_Required_Id], [l1].[Level2_Name], [l1].[OneToMany_Optional_Inverse2Id], [l1].[OneToMany_Required_Inverse2Id], [l1].[OneToOne_Optional_PK_Inverse2Id] FROM [Level1] AS [l1] - WHERE ([l1].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l1].[Level1_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l1].[OneToOne_Required_PK_Date] IS NOT NULL AND [l1].[Level1_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] ON [l0].[Id] = CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] END LEFT JOIN ( SELECT [l2].[Id], [l2].[Level2_Optional_Id], [l2].[Level2_Required_Id], [l2].[Level3_Name], [l2].[OneToMany_Optional_Inverse3Id], [l2].[OneToMany_Required_Inverse3Id], [l2].[OneToOne_Optional_PK_Inverse3Id] FROM [Level1] AS [l2] - WHERE ([l2].[Level2_Required_Id] IS NOT NULL) AND ([l2].[OneToMany_Required_Inverse3Id] IS NOT NULL) + WHERE [l2].[Level2_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse3Id] IS NOT NULL ) AS [t0] ON CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] END = CASE - WHEN ([t0].[Level2_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [t0].[Id] + WHEN [t0].[Level2_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [t0].[Id] END - WHERE ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) AND ([t0].[Level2_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse3Id] IS NOT NULL) + WHERE [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL AND [t0].[Level2_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse3Id] IS NOT NULL ) AS [t1] ORDER BY (SELECT 1) OFFSET 1 ROWS ) AS [t2] ORDER BY CASE - WHEN ([t2].[Level2_Required_Id] IS NOT NULL) AND ([t2].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [t2].[Id] + WHEN [t2].[Level2_Required_Id] IS NOT NULL AND [t2].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [t2].[Id] END) FROM [Level1] AS [l] WHERE [l].[Id] < 3 @@ -1103,16 +1103,16 @@ FROM [Level1] AS [l1] LEFT JOIN ( SELECT [l2].[Id], [l2].[OneToOne_Required_PK_Date], [l2].[Level1_Optional_Id], [l2].[Level1_Required_Id], [l2].[Level2_Name], [l2].[OneToMany_Optional_Inverse2Id], [l2].[OneToMany_Required_Inverse2Id], [l2].[OneToOne_Optional_PK_Inverse2Id] FROM [Level1] AS [l2] - WHERE ([l2].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l2].[Level1_Required_Id] IS NOT NULL) AND ([l2].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l2].[OneToOne_Required_PK_Date] IS NOT NULL AND [l2].[Level1_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t0] ON [l1].[Id] = [t0].[Level1_Optional_Id] - WHERE [t0].[Level2_Name] = [t].[Level2_Name] OR (([t0].[Level2_Name] IS NULL) AND ([t].[Level2_Name] IS NULL))) THEN CAST(1 AS bit) + WHERE [t0].[Level2_Name] = [t].[Level2_Name] OR ([t0].[Level2_Name] IS NULL AND [t].[Level2_Name] IS NULL)) THEN CAST(1 AS bit) ELSE CAST(0 AS bit) END AS [Contains] FROM [Level1] AS [l] LEFT JOIN ( SELECT [l0].[Level1_Optional_Id], [l0].[Level2_Name] FROM [Level1] AS [l0] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] ON [l].[Id] = [t].[Level1_Optional_Id] """); } @@ -1126,7 +1126,7 @@ public override async Task Collection_FirstOrDefault_property_accesses_in_projec SELECT [l].[Id], ( SELECT TOP(1) [l0].[Level2_Name] FROM [Level1] AS [l0] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) AND [l].[Id] = [l0].[OneToMany_Optional_Inverse2Id] AND [l0].[Level2_Name] = N'L2 02') AS [Pushdown] + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL AND [l].[Id] = [l0].[OneToMany_Optional_Inverse2Id] AND [l0].[Level2_Name] = N'L2 02') AS [Pushdown] FROM [Level1] AS [l] WHERE [l].[Id] < 3 """); @@ -1146,11 +1146,11 @@ FROM [Level1] AS [l0] LEFT JOIN ( SELECT [l1].[Id], [l1].[OneToOne_Required_PK_Date], [l1].[Level1_Required_Id], [l1].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l1] - WHERE ([l1].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l1].[Level1_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l1].[OneToOne_Required_PK_Date] IS NOT NULL AND [l1].[Level1_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] ON [l0].[Id] = CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] END - WHERE ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t0] ON [l].[Id] = [t0].[Level1_Required_Id] INNER JOIN ( SELECT [t3].[Id] AS [Id1], [t3].[Level2_Required_Id], [t3].[OneToMany_Required_Inverse3Id] @@ -1158,22 +1158,22 @@ FROM [Level1] AS [l2] LEFT JOIN ( SELECT [l3].[Id], [l3].[OneToOne_Required_PK_Date], [l3].[Level1_Required_Id], [l3].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l3] - WHERE ([l3].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l3].[Level1_Required_Id] IS NOT NULL) AND ([l3].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l3].[OneToOne_Required_PK_Date] IS NOT NULL AND [l3].[Level1_Required_Id] IS NOT NULL AND [l3].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t2] ON [l2].[Id] = CASE - WHEN ([t2].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t2].[Level1_Required_Id] IS NOT NULL) AND ([t2].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t2].[Id] + WHEN [t2].[OneToOne_Required_PK_Date] IS NOT NULL AND [t2].[Level1_Required_Id] IS NOT NULL AND [t2].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t2].[Id] END LEFT JOIN ( SELECT [l4].[Id], [l4].[Level2_Required_Id], [l4].[OneToMany_Required_Inverse3Id] FROM [Level1] AS [l4] - WHERE ([l4].[Level2_Required_Id] IS NOT NULL) AND ([l4].[OneToMany_Required_Inverse3Id] IS NOT NULL) + WHERE [l4].[Level2_Required_Id] IS NOT NULL AND [l4].[OneToMany_Required_Inverse3Id] IS NOT NULL ) AS [t3] ON CASE - WHEN ([t2].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t2].[Level1_Required_Id] IS NOT NULL) AND ([t2].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t2].[Id] + WHEN [t2].[OneToOne_Required_PK_Date] IS NOT NULL AND [t2].[Level1_Required_Id] IS NOT NULL AND [t2].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t2].[Id] END = CASE - WHEN ([t3].[Level2_Required_Id] IS NOT NULL) AND ([t3].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [t3].[Id] + WHEN [t3].[Level2_Required_Id] IS NOT NULL AND [t3].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [t3].[Id] END - WHERE ([t2].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t2].[Level1_Required_Id] IS NOT NULL) AND ([t2].[OneToMany_Required_Inverse2Id] IS NOT NULL) AND ([t3].[Level2_Required_Id] IS NOT NULL) AND ([t3].[OneToMany_Required_Inverse3Id] IS NOT NULL) + WHERE [t2].[OneToOne_Required_PK_Date] IS NOT NULL AND [t2].[Level1_Required_Id] IS NOT NULL AND [t2].[OneToMany_Required_Inverse2Id] IS NOT NULL AND [t3].[Level2_Required_Id] IS NOT NULL AND [t3].[OneToMany_Required_Inverse3Id] IS NOT NULL ) AS [t1] ON CASE - WHEN ([t0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t0].[Level1_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t0].[Id0] + WHEN [t0].[OneToOne_Required_PK_Date] IS NOT NULL AND [t0].[Level1_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t0].[Id0] END = [t1].[Level2_Required_Id] INNER JOIN ( SELECT [t7].[Level3_Required_Id], [t7].[Level4_Name] @@ -1181,35 +1181,35 @@ FROM [Level1] AS [l5] LEFT JOIN ( SELECT [l6].[Id], [l6].[OneToOne_Required_PK_Date], [l6].[Level1_Required_Id], [l6].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l6] - WHERE ([l6].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l6].[Level1_Required_Id] IS NOT NULL) AND ([l6].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l6].[OneToOne_Required_PK_Date] IS NOT NULL AND [l6].[Level1_Required_Id] IS NOT NULL AND [l6].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t5] ON [l5].[Id] = CASE - WHEN ([t5].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t5].[Level1_Required_Id] IS NOT NULL) AND ([t5].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t5].[Id] + WHEN [t5].[OneToOne_Required_PK_Date] IS NOT NULL AND [t5].[Level1_Required_Id] IS NOT NULL AND [t5].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t5].[Id] END LEFT JOIN ( SELECT [l7].[Id], [l7].[Level2_Required_Id], [l7].[OneToMany_Required_Inverse3Id] FROM [Level1] AS [l7] - WHERE ([l7].[Level2_Required_Id] IS NOT NULL) AND ([l7].[OneToMany_Required_Inverse3Id] IS NOT NULL) + WHERE [l7].[Level2_Required_Id] IS NOT NULL AND [l7].[OneToMany_Required_Inverse3Id] IS NOT NULL ) AS [t6] ON CASE - WHEN ([t5].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t5].[Level1_Required_Id] IS NOT NULL) AND ([t5].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t5].[Id] + WHEN [t5].[OneToOne_Required_PK_Date] IS NOT NULL AND [t5].[Level1_Required_Id] IS NOT NULL AND [t5].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t5].[Id] END = CASE - WHEN ([t6].[Level2_Required_Id] IS NOT NULL) AND ([t6].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [t6].[Id] + WHEN [t6].[Level2_Required_Id] IS NOT NULL AND [t6].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [t6].[Id] END LEFT JOIN ( SELECT [l8].[Id], [l8].[Level3_Required_Id], [l8].[Level4_Name], [l8].[OneToMany_Required_Inverse4Id] FROM [Level1] AS [l8] - WHERE ([l8].[Level3_Required_Id] IS NOT NULL) AND ([l8].[OneToMany_Required_Inverse4Id] IS NOT NULL) + WHERE [l8].[Level3_Required_Id] IS NOT NULL AND [l8].[OneToMany_Required_Inverse4Id] IS NOT NULL ) AS [t7] ON CASE - WHEN ([t6].[Level2_Required_Id] IS NOT NULL) AND ([t6].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [t6].[Id] + WHEN [t6].[Level2_Required_Id] IS NOT NULL AND [t6].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [t6].[Id] END = CASE - WHEN ([t7].[Level3_Required_Id] IS NOT NULL) AND ([t7].[OneToMany_Required_Inverse4Id] IS NOT NULL) THEN [t7].[Id] + WHEN [t7].[Level3_Required_Id] IS NOT NULL AND [t7].[OneToMany_Required_Inverse4Id] IS NOT NULL THEN [t7].[Id] END - WHERE ([t5].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t5].[Level1_Required_Id] IS NOT NULL) AND ([t5].[OneToMany_Required_Inverse2Id] IS NOT NULL) AND ([t6].[Level2_Required_Id] IS NOT NULL) AND ([t6].[OneToMany_Required_Inverse3Id] IS NOT NULL) AND ([t7].[Level3_Required_Id] IS NOT NULL) AND ([t7].[OneToMany_Required_Inverse4Id] IS NOT NULL) + WHERE [t5].[OneToOne_Required_PK_Date] IS NOT NULL AND [t5].[Level1_Required_Id] IS NOT NULL AND [t5].[OneToMany_Required_Inverse2Id] IS NOT NULL AND [t6].[Level2_Required_Id] IS NOT NULL AND [t6].[OneToMany_Required_Inverse3Id] IS NOT NULL AND [t7].[Level3_Required_Id] IS NOT NULL AND [t7].[OneToMany_Required_Inverse4Id] IS NOT NULL ) AS [t4] ON CASE - WHEN ([t1].[Level2_Required_Id] IS NOT NULL) AND ([t1].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [t1].[Id1] + WHEN [t1].[Level2_Required_Id] IS NOT NULL AND [t1].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [t1].[Id1] END = [t4].[Level3_Required_Id] LEFT JOIN [Level1] AS [l9] ON CASE - WHEN ([t0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t0].[Level1_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t0].[Id0] -END >= [l9].[Id] AND ([t4].[Level4_Name] = [l9].[Name] OR (([t4].[Level4_Name] IS NULL) AND ([l9].[Name] IS NULL))) + WHEN [t0].[OneToOne_Required_PK_Date] IS NOT NULL AND [t0].[Level1_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t0].[Id0] +END >= [l9].[Id] AND ([t4].[Level4_Name] = [l9].[Name] OR ([t4].[Level4_Name] IS NULL AND [l9].[Name] IS NULL)) """); } @@ -1226,10 +1226,10 @@ FROM [Level1] AS [l] LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[Level2_Name], [l0].[OneToMany_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id] FROM [Level1] AS [l0] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] ON [l].[Id] = [t].[Level1_Optional_Id] WHERE CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] END IS NULL) THEN CAST(1 AS bit) ELSE CAST(0 AS bit) END @@ -1377,9 +1377,9 @@ FROM [Level1] AS [l] LEFT JOIN ( SELECT [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Required_Id], [l0].[OneToMany_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l0] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) AND [l0].[Id] > 5 + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL AND [l0].[Id] > 5 ) AS [t] ON [l].[Id] = [t].[OneToMany_Optional_Inverse2Id] -WHERE ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) +WHERE [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL """); } @@ -1394,16 +1394,16 @@ FROM [Level1] AS [l] LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Required_Id], [l0].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l0] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] ON [l].[Id] = [t].[Level1_Required_Id] LEFT JOIN ( SELECT [l1].[Level2_Required_Id], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id] FROM [Level1] AS [l1] - WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse3Id] IS NOT NULL) + WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL ) AS [t0] ON CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] END = [t0].[OneToMany_Optional_Inverse3Id] -WHERE ([t0].[Level2_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse3Id] IS NOT NULL) +WHERE [t0].[Level2_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse3Id] IS NOT NULL """); } @@ -1418,16 +1418,16 @@ FROM [Level1] AS [l] LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l0] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] ON [l].[Id] = [t].[Level1_Optional_Id] LEFT JOIN ( SELECT [l1].[Level2_Required_Id], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id] FROM [Level1] AS [l1] - WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse3Id] IS NOT NULL) AND [l1].[Id] > 5 + WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL AND [l1].[Id] > 5 ) AS [t0] ON CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] END = [t0].[OneToMany_Optional_Inverse3Id] -WHERE ([t0].[Level2_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse3Id] IS NOT NULL) +WHERE [t0].[Level2_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse3Id] IS NOT NULL """); } @@ -1447,12 +1447,12 @@ FROM [Level1] AS [l] LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Required_Id], [l0].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l0] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] ON [l].[Id] = CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] END - WHERE ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) AND CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] + WHERE [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL AND CASE + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] END < 5 ) AS [t0] ON 1 = 1 CROSS APPLY ( @@ -1475,9 +1475,9 @@ public override async Task Projecting_columns_with_same_name_from_different_enti SELECT [t4].[Id1] AS [Foo], [t4].[Id2] AS [Bar], [t4].[Id3] AS [Baz] FROM ( SELECT DISTINCT TOP(@__p_0) [l].[Id] AS [Id1], CASE - WHEN ([t0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t0].[Level1_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t0].[Id0] + WHEN [t0].[OneToOne_Required_PK_Date] IS NOT NULL AND [t0].[Level1_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t0].[Id0] END AS [Id2], CASE - WHEN ([t1].[Level2_Required_Id] IS NOT NULL) AND ([t1].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [t1].[Id1] + WHEN [t1].[Level2_Required_Id] IS NOT NULL AND [t1].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [t1].[Id1] END AS [Id3], [l].[Name] AS [Name1], [t0].[Level2_Name] AS [Name2] FROM [Level1] AS [l] INNER JOIN ( @@ -1486,11 +1486,11 @@ FROM [Level1] AS [l0] LEFT JOIN ( SELECT [l1].[Id], [l1].[OneToOne_Required_PK_Date], [l1].[Level1_Optional_Id], [l1].[Level1_Required_Id], [l1].[Level2_Name], [l1].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l1] - WHERE ([l1].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l1].[Level1_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l1].[OneToOne_Required_PK_Date] IS NOT NULL AND [l1].[Level1_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] ON [l0].[Id] = CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] END - WHERE ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t0] ON [l].[Id] = [t0].[Level1_Optional_Id] INNER JOIN ( SELECT [t3].[Id] AS [Id1], [t3].[Level2_Optional_Id], [t3].[Level2_Required_Id], [t3].[OneToMany_Required_Inverse3Id] @@ -1498,22 +1498,22 @@ FROM [Level1] AS [l2] LEFT JOIN ( SELECT [l3].[Id], [l3].[OneToOne_Required_PK_Date], [l3].[Level1_Required_Id], [l3].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l3] - WHERE ([l3].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l3].[Level1_Required_Id] IS NOT NULL) AND ([l3].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l3].[OneToOne_Required_PK_Date] IS NOT NULL AND [l3].[Level1_Required_Id] IS NOT NULL AND [l3].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t2] ON [l2].[Id] = CASE - WHEN ([t2].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t2].[Level1_Required_Id] IS NOT NULL) AND ([t2].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t2].[Id] + WHEN [t2].[OneToOne_Required_PK_Date] IS NOT NULL AND [t2].[Level1_Required_Id] IS NOT NULL AND [t2].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t2].[Id] END LEFT JOIN ( SELECT [l4].[Id], [l4].[Level2_Optional_Id], [l4].[Level2_Required_Id], [l4].[OneToMany_Required_Inverse3Id] FROM [Level1] AS [l4] - WHERE ([l4].[Level2_Required_Id] IS NOT NULL) AND ([l4].[OneToMany_Required_Inverse3Id] IS NOT NULL) + WHERE [l4].[Level2_Required_Id] IS NOT NULL AND [l4].[OneToMany_Required_Inverse3Id] IS NOT NULL ) AS [t3] ON CASE - WHEN ([t2].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t2].[Level1_Required_Id] IS NOT NULL) AND ([t2].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t2].[Id] + WHEN [t2].[OneToOne_Required_PK_Date] IS NOT NULL AND [t2].[Level1_Required_Id] IS NOT NULL AND [t2].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t2].[Id] END = CASE - WHEN ([t3].[Level2_Required_Id] IS NOT NULL) AND ([t3].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [t3].[Id] + WHEN [t3].[Level2_Required_Id] IS NOT NULL AND [t3].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [t3].[Id] END - WHERE ([t2].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t2].[Level1_Required_Id] IS NOT NULL) AND ([t2].[OneToMany_Required_Inverse2Id] IS NOT NULL) AND ([t3].[Level2_Required_Id] IS NOT NULL) AND ([t3].[OneToMany_Required_Inverse3Id] IS NOT NULL) + WHERE [t2].[OneToOne_Required_PK_Date] IS NOT NULL AND [t2].[Level1_Required_Id] IS NOT NULL AND [t2].[OneToMany_Required_Inverse2Id] IS NOT NULL AND [t3].[Level2_Required_Id] IS NOT NULL AND [t3].[OneToMany_Required_Inverse3Id] IS NOT NULL ) AS [t1] ON CASE - WHEN ([t0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t0].[Level1_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t0].[Id0] + WHEN [t0].[OneToOne_Required_PK_Date] IS NOT NULL AND [t0].[Level1_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t0].[Id0] END = [t1].[Level2_Optional_Id] ) AS [t4] """); @@ -1528,24 +1528,24 @@ public override async Task Multiple_collection_FirstOrDefault_followed_by_member SELECT [l].[Id], ( SELECT TOP(1) [l0].[Level3_Name] FROM [Level1] AS [l0] - WHERE ([l0].[Level2_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse3Id] IS NOT NULL) AND (( + WHERE [l0].[Level2_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse3Id] IS NOT NULL AND ( SELECT TOP(1) CASE - WHEN ([l1].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l1].[Level1_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [l1].[Id] + WHEN [l1].[OneToOne_Required_PK_Date] IS NOT NULL AND [l1].[Level1_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [l1].[Id] END FROM [Level1] AS [l1] - WHERE ([l1].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l1].[Level1_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse2Id] IS NOT NULL) AND [l].[Id] = [l1].[OneToMany_Optional_Inverse2Id] AND [l1].[Level2_Name] = N'L2 02') IS NOT NULL) AND (( + WHERE [l1].[OneToOne_Required_PK_Date] IS NOT NULL AND [l1].[Level1_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse2Id] IS NOT NULL AND [l].[Id] = [l1].[OneToMany_Optional_Inverse2Id] AND [l1].[Level2_Name] = N'L2 02') IS NOT NULL AND (( SELECT TOP(1) CASE - WHEN ([l2].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l2].[Level1_Required_Id] IS NOT NULL) AND ([l2].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [l2].[Id] + WHEN [l2].[OneToOne_Required_PK_Date] IS NOT NULL AND [l2].[Level1_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [l2].[Id] END FROM [Level1] AS [l2] - WHERE ([l2].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l2].[Level1_Required_Id] IS NOT NULL) AND ([l2].[OneToMany_Required_Inverse2Id] IS NOT NULL) AND [l].[Id] = [l2].[OneToMany_Optional_Inverse2Id] AND [l2].[Level2_Name] = N'L2 02') = [l0].[OneToMany_Optional_Inverse3Id] OR ((( + WHERE [l2].[OneToOne_Required_PK_Date] IS NOT NULL AND [l2].[Level1_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse2Id] IS NOT NULL AND [l].[Id] = [l2].[OneToMany_Optional_Inverse2Id] AND [l2].[Level2_Name] = N'L2 02') = [l0].[OneToMany_Optional_Inverse3Id] OR (( SELECT TOP(1) CASE - WHEN ([l2].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l2].[Level1_Required_Id] IS NOT NULL) AND ([l2].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [l2].[Id] + WHEN [l2].[OneToOne_Required_PK_Date] IS NOT NULL AND [l2].[Level1_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [l2].[Id] END FROM [Level1] AS [l2] - WHERE ([l2].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l2].[Level1_Required_Id] IS NOT NULL) AND ([l2].[OneToMany_Required_Inverse2Id] IS NOT NULL) AND [l].[Id] = [l2].[OneToMany_Optional_Inverse2Id] AND [l2].[Level2_Name] = N'L2 02') IS NULL) AND ([l0].[OneToMany_Optional_Inverse3Id] IS NULL))) + WHERE [l2].[OneToOne_Required_PK_Date] IS NOT NULL AND [l2].[Level1_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse2Id] IS NOT NULL AND [l].[Id] = [l2].[OneToMany_Optional_Inverse2Id] AND [l2].[Level2_Name] = N'L2 02') IS NULL AND [l0].[OneToMany_Optional_Inverse3Id] IS NULL)) ORDER BY CASE - WHEN ([l0].[Level2_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [l0].[Id] + WHEN [l0].[Level2_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [l0].[Id] END) AS [Pushdown] FROM [Level1] AS [l] WHERE [l].[Id] < 2 @@ -1565,16 +1565,16 @@ LEFT JOIN ( FROM ( SELECT 1 AS [c], [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Required_Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToMany_Optional_Inverse2Id], ROW_NUMBER() OVER(PARTITION BY [l0].[OneToMany_Optional_Inverse2Id] ORDER BY [l0].[Id]) AS [row] FROM [Level1] AS [l0] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) AND [l0].[Level2_Name] = N'L2 02' + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL AND [l0].[Level2_Name] = N'L2 02' ) AS [t] WHERE [t].[row] <= 1 ) AS [t0] ON [l].[Id] = [t0].[OneToMany_Optional_Inverse2Id] LEFT JOIN ( SELECT [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Level3_Name], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[OneToOne_Optional_PK_Inverse3Id] FROM [Level1] AS [l1] - WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse3Id] IS NOT NULL) + WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL ) AS [t1] ON CASE - WHEN ([t0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t0].[Level1_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t0].[Id] + WHEN [t0].[OneToOne_Required_PK_Date] IS NOT NULL AND [t0].[Level1_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t0].[Id] END = [t1].[OneToMany_Optional_Inverse3Id] WHERE [l].[Id] < 2 ORDER BY [l].[Id], [t0].[Id] @@ -1597,11 +1597,11 @@ FROM [Level1] AS [l0] LEFT JOIN ( SELECT [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Level3_Name], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[OneToOne_Optional_PK_Inverse3Id] FROM [Level1] AS [l1] - WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse3Id] IS NOT NULL) + WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL ) AS [t] ON CASE - WHEN ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [l0].[Id] + WHEN [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [l0].[Id] END = [t].[Level2_Optional_Id] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) AND [l0].[Level2_Name] = N'L2 02' + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL AND [l0].[Level2_Name] = N'L2 02' ) AS [t0] WHERE [t0].[row] <= 1 ) AS [t1] ON [l].[Id] = [t1].[OneToMany_Optional_Inverse2Id] @@ -1623,12 +1623,12 @@ FROM [Level1] AS [l0] LEFT JOIN ( SELECT [l1].[Id], [l1].[OneToOne_Required_PK_Date], [l1].[Level1_Optional_Id], [l1].[Level1_Required_Id], [l1].[Level2_Name], [l1].[OneToMany_Optional_Inverse2Id], [l1].[OneToMany_Required_Inverse2Id], [l1].[OneToOne_Optional_PK_Inverse2Id] FROM [Level1] AS [l1] - WHERE ([l1].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l1].[Level1_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l1].[OneToOne_Required_PK_Date] IS NOT NULL AND [l1].[Level1_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] ON [l0].[Id] = CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] END - WHERE ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) AND CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] + WHERE [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL AND CASE + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] END < 10 ) AS [t0] """); @@ -1645,18 +1645,18 @@ FROM [Level1] AS [l] LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Required_Id], [l0].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l0] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] ON [l].[Id] = CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] END LEFT JOIN ( SELECT [l1].[Id], [l1].[Level2_Required_Id], [l1].[OneToMany_Required_Inverse3Id] FROM [Level1] AS [l1] - WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse3Id] IS NOT NULL) + WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL ) AS [t0] ON CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] END = CASE - WHEN ([t0].[Level2_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [t0].[Id] + WHEN [t0].[Level2_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [t0].[Id] END LEFT JOIN ( SELECT [t2].[Id0] AS [Id00], [t2].[OneToOne_Required_PK_Date], [t2].[Level1_Optional_Id], [t2].[Level1_Required_Id], [t2].[Level2_Name], [t2].[OneToMany_Optional_Inverse2Id], [t2].[OneToMany_Required_Inverse2Id], [t2].[OneToOne_Optional_PK_Inverse2Id] @@ -1667,16 +1667,16 @@ FROM [Level1] AS [l3] LEFT JOIN ( SELECT [l4].[Id], [l4].[OneToOne_Required_PK_Date], [l4].[Level1_Optional_Id], [l4].[Level1_Required_Id], [l4].[Level2_Name], [l4].[OneToMany_Optional_Inverse2Id], [l4].[OneToMany_Required_Inverse2Id], [l4].[OneToOne_Optional_PK_Inverse2Id] FROM [Level1] AS [l4] - WHERE ([l4].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l4].[Level1_Required_Id] IS NOT NULL) AND ([l4].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l4].[OneToOne_Required_PK_Date] IS NOT NULL AND [l4].[Level1_Required_Id] IS NOT NULL AND [l4].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t3] ON [l3].[Id] = CASE - WHEN ([t3].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t3].[Level1_Required_Id] IS NOT NULL) AND ([t3].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t3].[Id] + WHEN [t3].[OneToOne_Required_PK_Date] IS NOT NULL AND [t3].[Level1_Required_Id] IS NOT NULL AND [t3].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t3].[Id] END - WHERE ([t3].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t3].[Level1_Required_Id] IS NOT NULL) AND ([t3].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [t3].[OneToOne_Required_PK_Date] IS NOT NULL AND [t3].[Level1_Required_Id] IS NOT NULL AND [t3].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t2] ON [l2].[Id] = [t2].[Level1_Optional_Id] ) AS [t1] ON [t0].[Level2_Required_Id] = CASE - WHEN ([t1].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t1].[Level1_Required_Id] IS NOT NULL) AND ([t1].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t1].[Id00] + WHEN [t1].[OneToOne_Required_PK_Date] IS NOT NULL AND [t1].[Level1_Required_Id] IS NOT NULL AND [t1].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t1].[Id00] END -WHERE ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) AND ([t0].[Level2_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse3Id] IS NOT NULL) +WHERE [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL AND [t0].[Level2_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse3Id] IS NOT NULL """); } @@ -1692,21 +1692,21 @@ FROM [Level1] AS [l] LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Required_Id], [l0].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l0] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] ON [l].[Id] = [t].[Level1_Required_Id] LEFT JOIN ( SELECT [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[OneToMany_Required_Inverse3Id] FROM [Level1] AS [l1] - WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse3Id] IS NOT NULL) + WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL ) AS [t0] ON CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] END = [t0].[Level2_Optional_Id] LEFT JOIN ( SELECT [l2].[Id], [l2].[Level3_Optional_Id], [l2].[Level3_Required_Id], [l2].[Level4_Name], [l2].[OneToMany_Optional_Inverse4Id], [l2].[OneToMany_Required_Inverse4Id], [l2].[OneToOne_Optional_PK_Inverse4Id] FROM [Level1] AS [l2] - WHERE ([l2].[Level3_Required_Id] IS NOT NULL) AND ([l2].[OneToMany_Required_Inverse4Id] IS NOT NULL) + WHERE [l2].[Level3_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse4Id] IS NOT NULL ) AS [t1] ON CASE - WHEN ([t0].[Level2_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [t0].[Id] + WHEN [t0].[Level2_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [t0].[Id] END = [t1].[OneToMany_Required_Inverse4Id] LEFT JOIN ( SELECT [t3].[Id] AS [Id0], [t3].[OneToOne_Required_PK_Date], [t3].[Level1_Optional_Id], [t3].[Level1_Required_Id], [t3].[Level2_Name], [t3].[OneToMany_Optional_Inverse2Id], [t3].[OneToMany_Required_Inverse2Id], [t3].[OneToOne_Optional_PK_Inverse2Id] @@ -1714,15 +1714,15 @@ FROM [Level1] AS [l3] LEFT JOIN ( SELECT [l4].[Id], [l4].[OneToOne_Required_PK_Date], [l4].[Level1_Optional_Id], [l4].[Level1_Required_Id], [l4].[Level2_Name], [l4].[OneToMany_Optional_Inverse2Id], [l4].[OneToMany_Required_Inverse2Id], [l4].[OneToOne_Optional_PK_Inverse2Id] FROM [Level1] AS [l4] - WHERE ([l4].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l4].[Level1_Required_Id] IS NOT NULL) AND ([l4].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l4].[OneToOne_Required_PK_Date] IS NOT NULL AND [l4].[Level1_Required_Id] IS NOT NULL AND [l4].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t3] ON [l3].[Id] = CASE - WHEN ([t3].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t3].[Level1_Required_Id] IS NOT NULL) AND ([t3].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t3].[Id] + WHEN [t3].[OneToOne_Required_PK_Date] IS NOT NULL AND [t3].[Level1_Required_Id] IS NOT NULL AND [t3].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t3].[Id] END - WHERE ([t3].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t3].[Level1_Required_Id] IS NOT NULL) AND ([t3].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [t3].[OneToOne_Required_PK_Date] IS NOT NULL AND [t3].[Level1_Required_Id] IS NOT NULL AND [t3].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t2] ON CASE - WHEN ([t1].[Level3_Required_Id] IS NOT NULL) AND ([t1].[OneToMany_Required_Inverse4Id] IS NOT NULL) THEN [t1].[Id] + WHEN [t1].[Level3_Required_Id] IS NOT NULL AND [t1].[OneToMany_Required_Inverse4Id] IS NOT NULL THEN [t1].[Id] END = CASE - WHEN ([t2].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t2].[Level1_Required_Id] IS NOT NULL) AND ([t2].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t2].[Id0] + WHEN [t2].[OneToOne_Required_PK_Date] IS NOT NULL AND [t2].[Level1_Required_Id] IS NOT NULL AND [t2].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t2].[Id0] END """); } @@ -1741,26 +1741,26 @@ FROM [Level1] AS [l0] LEFT JOIN ( SELECT [l1].[Id], [l1].[OneToOne_Required_PK_Date], [l1].[Level1_Optional_Id], [l1].[Level1_Required_Id], [l1].[Level2_Name], [l1].[OneToMany_Optional_Inverse2Id], [l1].[OneToMany_Required_Inverse2Id], [l1].[OneToOne_Optional_PK_Inverse2Id] FROM [Level1] AS [l1] - WHERE ([l1].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l1].[Level1_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l1].[OneToOne_Required_PK_Date] IS NOT NULL AND [l1].[Level1_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] ON [l0].[Id] = CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] END - WHERE ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t0] ON [l].[Id] = COALESCE(( SELECT TOP(1) CASE - WHEN ([t1].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t1].[Level1_Required_Id] IS NOT NULL) AND ([t1].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t1].[Id] + WHEN [t1].[OneToOne_Required_PK_Date] IS NOT NULL AND [t1].[Level1_Required_Id] IS NOT NULL AND [t1].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t1].[Id] END FROM [Level1] AS [l2] LEFT JOIN ( SELECT [l3].[Id], [l3].[OneToOne_Required_PK_Date], [l3].[Level1_Optional_Id], [l3].[Level1_Required_Id], [l3].[Level2_Name], [l3].[OneToMany_Optional_Inverse2Id], [l3].[OneToMany_Required_Inverse2Id], [l3].[OneToOne_Optional_PK_Inverse2Id] FROM [Level1] AS [l3] - WHERE ([l3].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l3].[Level1_Required_Id] IS NOT NULL) AND ([l3].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l3].[OneToOne_Required_PK_Date] IS NOT NULL AND [l3].[Level1_Required_Id] IS NOT NULL AND [l3].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t1] ON [l2].[Id] = CASE - WHEN ([t1].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t1].[Level1_Required_Id] IS NOT NULL) AND ([t1].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t1].[Id] + WHEN [t1].[OneToOne_Required_PK_Date] IS NOT NULL AND [t1].[Level1_Required_Id] IS NOT NULL AND [t1].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t1].[Id] END - WHERE ([t1].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t1].[Level1_Required_Id] IS NOT NULL) AND ([t1].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [t1].[OneToOne_Required_PK_Date] IS NOT NULL AND [t1].[Level1_Required_Id] IS NOT NULL AND [t1].[OneToMany_Required_Inverse2Id] IS NOT NULL ORDER BY CASE - WHEN ([t1].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t1].[Level1_Required_Id] IS NOT NULL) AND ([t1].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t1].[Id] + WHEN [t1].[OneToOne_Required_PK_Date] IS NOT NULL AND [t1].[Level1_Required_Id] IS NOT NULL AND [t1].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t1].[Id] END), 0) """); } @@ -1784,11 +1784,11 @@ FROM [Level1] AS [l0] LEFT JOIN ( SELECT [l1].[Id], [l1].[OneToOne_Required_PK_Date], [l1].[Level1_Optional_Id], [l1].[Level1_Required_Id], [l1].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l1] - WHERE ([l1].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l1].[Level1_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l1].[OneToOne_Required_PK_Date] IS NOT NULL AND [l1].[Level1_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] ON [l0].[Id] = CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] END - WHERE ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t0] ON [l].[Id] = [t0].[Level1_Optional_Id] ORDER BY [l].[Id] ) AS [t1] @@ -1808,18 +1808,18 @@ FROM [Level1] AS [l] LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Required_Id], [l0].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l0] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] ON [l].[Id] = CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] END LEFT JOIN ( SELECT [l1].[Id], [l1].[Level2_Required_Id], [l1].[OneToMany_Required_Inverse3Id] FROM [Level1] AS [l1] - WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse3Id] IS NOT NULL) + WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL ) AS [t0] ON CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] END = CASE - WHEN ([t0].[Level2_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [t0].[Id] + WHEN [t0].[Level2_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [t0].[Id] END LEFT JOIN ( SELECT [t2].[Id0] AS [Id00], [t2].[OneToOne_Required_PK_Date], [t2].[Level1_Required_Id], [t2].[Level2_Name], [t2].[OneToMany_Required_Inverse2Id] @@ -1830,16 +1830,16 @@ FROM [Level1] AS [l3] LEFT JOIN ( SELECT [l4].[Id], [l4].[OneToOne_Required_PK_Date], [l4].[Level1_Optional_Id], [l4].[Level1_Required_Id], [l4].[Level2_Name], [l4].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l4] - WHERE ([l4].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l4].[Level1_Required_Id] IS NOT NULL) AND ([l4].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l4].[OneToOne_Required_PK_Date] IS NOT NULL AND [l4].[Level1_Required_Id] IS NOT NULL AND [l4].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t3] ON [l3].[Id] = CASE - WHEN ([t3].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t3].[Level1_Required_Id] IS NOT NULL) AND ([t3].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t3].[Id] + WHEN [t3].[OneToOne_Required_PK_Date] IS NOT NULL AND [t3].[Level1_Required_Id] IS NOT NULL AND [t3].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t3].[Id] END - WHERE ([t3].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t3].[Level1_Required_Id] IS NOT NULL) AND ([t3].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [t3].[OneToOne_Required_PK_Date] IS NOT NULL AND [t3].[Level1_Required_Id] IS NOT NULL AND [t3].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t2] ON [l2].[Id] = [t2].[Level1_Optional_Id] ) AS [t1] ON [t0].[Level2_Required_Id] = CASE - WHEN ([t1].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t1].[Level1_Required_Id] IS NOT NULL) AND ([t1].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t1].[Id00] + WHEN [t1].[OneToOne_Required_PK_Date] IS NOT NULL AND [t1].[Level1_Required_Id] IS NOT NULL AND [t1].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t1].[Id00] END -WHERE ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) AND ([t0].[Level2_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse3Id] IS NOT NULL) +WHERE [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL AND [t0].[Level2_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse3Id] IS NOT NULL """); } @@ -1854,23 +1854,23 @@ FROM [Level1] AS [l] LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l0] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] ON [l].[Id] = [t].[Level1_Optional_Id] WHERE EXISTS ( SELECT 1 FROM ( SELECT DISTINCT [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Level3_Name], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[OneToOne_Optional_PK_Inverse3Id] FROM [Level1] AS [l1] - WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse3Id] IS NOT NULL) AND (CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] - END IS NOT NULL) AND (CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] - END = [l1].[OneToMany_Optional_Inverse3Id] OR ((CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] - END IS NULL) AND ([l1].[OneToMany_Optional_Inverse3Id] IS NULL))) + WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL AND CASE + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + END IS NOT NULL AND (CASE + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + END = [l1].[OneToMany_Optional_Inverse3Id] OR (CASE + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + END IS NULL AND [l1].[OneToMany_Optional_Inverse3Id] IS NULL)) ) AS [t0] WHERE CASE - WHEN ([t0].[Level2_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [t0].[Id] + WHEN [t0].[Level2_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [t0].[Id] END = 1) """); } @@ -1886,18 +1886,18 @@ FROM [Level1] AS [l] LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Required_Id], [l0].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l0] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] ON [l].[Id] = CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] END LEFT JOIN ( SELECT [l1].[Id], [l1].[Level2_Required_Id], [l1].[OneToMany_Required_Inverse3Id] FROM [Level1] AS [l1] - WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse3Id] IS NOT NULL) + WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL ) AS [t0] ON CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] END = CASE - WHEN ([t0].[Level2_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [t0].[Id] + WHEN [t0].[Level2_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [t0].[Id] END LEFT JOIN ( SELECT [t2].[Id0] AS [Id00], [t2].[OneToOne_Required_PK_Date], [t2].[Level1_Required_Id], [t2].[Level2_Name], [t2].[OneToMany_Required_Inverse2Id] @@ -1908,16 +1908,16 @@ FROM [Level1] AS [l3] LEFT JOIN ( SELECT [l4].[Id], [l4].[OneToOne_Required_PK_Date], [l4].[Level1_Optional_Id], [l4].[Level1_Required_Id], [l4].[Level2_Name], [l4].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l4] - WHERE ([l4].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l4].[Level1_Required_Id] IS NOT NULL) AND ([l4].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l4].[OneToOne_Required_PK_Date] IS NOT NULL AND [l4].[Level1_Required_Id] IS NOT NULL AND [l4].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t3] ON [l3].[Id] = CASE - WHEN ([t3].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t3].[Level1_Required_Id] IS NOT NULL) AND ([t3].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t3].[Id] + WHEN [t3].[OneToOne_Required_PK_Date] IS NOT NULL AND [t3].[Level1_Required_Id] IS NOT NULL AND [t3].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t3].[Id] END - WHERE ([t3].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t3].[Level1_Required_Id] IS NOT NULL) AND ([t3].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [t3].[OneToOne_Required_PK_Date] IS NOT NULL AND [t3].[Level1_Required_Id] IS NOT NULL AND [t3].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t2] ON [l2].[Id] = [t2].[Level1_Optional_Id] ) AS [t1] ON [t0].[Level2_Required_Id] = CASE - WHEN ([t1].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t1].[Level1_Required_Id] IS NOT NULL) AND ([t1].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t1].[Id00] + WHEN [t1].[OneToOne_Required_PK_Date] IS NOT NULL AND [t1].[Level1_Required_Id] IS NOT NULL AND [t1].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t1].[Id00] END -WHERE ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) AND ([t0].[Level2_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse3Id] IS NOT NULL) +WHERE [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL AND [t0].[Level2_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse3Id] IS NOT NULL """); } @@ -1932,16 +1932,16 @@ FROM [Level1] AS [l] INNER JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Required_Id], [l0].[OneToMany_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l0] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] ON [l].[Id] = [t].[OneToMany_Optional_Inverse2Id] LEFT JOIN ( SELECT [l1].[Level2_Required_Id], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id] FROM [Level1] AS [l1] - WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse3Id] IS NOT NULL) AND [l1].[Id] > 5 + WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL AND [l1].[Id] > 5 ) AS [t0] ON CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] END = [t0].[OneToMany_Optional_Inverse3Id] -WHERE ([t0].[Level2_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse3Id] IS NOT NULL) +WHERE [t0].[Level2_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse3Id] IS NOT NULL """); } @@ -1956,18 +1956,18 @@ FROM [Level1] AS [l] LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l0] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] ON [l].[Id] = [t].[Level1_Optional_Id] WHERE EXISTS ( SELECT DISTINCT 1 FROM [Level1] AS [l1] - WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse3Id] IS NOT NULL) AND (CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] - END IS NOT NULL) AND (CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] - END = [l1].[OneToMany_Optional_Inverse3Id] OR ((CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] - END IS NULL) AND ([l1].[OneToMany_Optional_Inverse3Id] IS NULL))) AND CAST(LEN([l1].[Level3_Name]) AS int) = 1) + WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL AND CASE + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + END IS NOT NULL AND (CASE + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + END = [l1].[OneToMany_Optional_Inverse3Id] OR (CASE + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + END IS NULL AND [l1].[OneToMany_Optional_Inverse3Id] IS NULL)) AND CAST(LEN([l1].[Level3_Name]) AS int) = 1) """); } @@ -1978,7 +1978,7 @@ public override async Task GroupJoin_with_complex_subquery_with_joins_does_not_g AssertSql( """ SELECT CASE - WHEN ([t0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t0].[Level1_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t0].[Id0] + WHEN [t0].[OneToOne_Required_PK_Date] IS NOT NULL AND [t0].[Level1_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t0].[Id0] END FROM [Level1] AS [l] LEFT JOIN ( @@ -1987,12 +1987,12 @@ FROM [Level1] AS [l0] LEFT JOIN ( SELECT [l2].[Id], [l2].[OneToOne_Required_PK_Date], [l2].[Level1_Optional_Id], [l2].[Level1_Required_Id], [l2].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l2] - WHERE ([l2].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l2].[Level1_Required_Id] IS NOT NULL) AND ([l2].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l2].[OneToOne_Required_PK_Date] IS NOT NULL AND [l2].[Level1_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] ON [l0].[Id] = CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] END INNER JOIN [Level1] AS [l1] ON [t].[Level1_Required_Id] = [l1].[Id] - WHERE ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t0] ON [l].[Id] = [t0].[Level1_Optional_Id] """); } @@ -2008,16 +2008,16 @@ FROM [Level1] AS [l] LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Required_Id], [l0].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l0] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] ON [l].[Id] = [t].[Level1_Required_Id] LEFT JOIN ( SELECT [l1].[Level2_Required_Id], [l1].[OneToMany_Required_Inverse3Id] FROM [Level1] AS [l1] - WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse3Id] IS NOT NULL) AND [l1].[Id] > 5 + WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL AND [l1].[Id] > 5 ) AS [t0] ON CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] END = [t0].[OneToMany_Required_Inverse3Id] -WHERE ([t0].[Level2_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse3Id] IS NOT NULL) +WHERE [t0].[Level2_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse3Id] IS NOT NULL """); } @@ -2033,26 +2033,26 @@ FROM [Level1] AS [l1] LEFT JOIN ( SELECT [l4].[Id], [l4].[OneToOne_Required_PK_Date], [l4].[Level1_Optional_Id], [l4].[Level1_Required_Id], [l4].[Level2_Name], [l4].[OneToMany_Optional_Inverse2Id], [l4].[OneToMany_Required_Inverse2Id], [l4].[OneToOne_Optional_PK_Inverse2Id] FROM [Level1] AS [l4] - WHERE ([l4].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l4].[Level1_Required_Id] IS NOT NULL) AND ([l4].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l4].[OneToOne_Required_PK_Date] IS NOT NULL AND [l4].[Level1_Required_Id] IS NOT NULL AND [l4].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t0] ON [l1].[Id] = CASE - WHEN ([t0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t0].[Level1_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t0].[Id] + WHEN [t0].[OneToOne_Required_PK_Date] IS NOT NULL AND [t0].[Level1_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t0].[Id] END INNER JOIN [Level1] AS [l2] ON [t0].[Level1_Required_Id] = [l2].[Id] LEFT JOIN [Level1] AS [l3] ON [t0].[Level1_Required_Id] = [l3].[Id] - WHERE ([t0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t0].[Level1_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [t0].[OneToOne_Required_PK_Date] IS NOT NULL AND [t0].[Level1_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse2Id] IS NOT NULL ORDER BY CASE - WHEN ([t0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t0].[Level1_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t0].[Id] + WHEN [t0].[OneToOne_Required_PK_Date] IS NOT NULL AND [t0].[Level1_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t0].[Id] END) FROM [Level1] AS [l] LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Required_Id], [l0].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l0] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] ON [l].[Id] = CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] END -WHERE ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) AND CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] +WHERE [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL AND CASE + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] END = 7 """); } @@ -2069,21 +2069,21 @@ FROM [Level1] AS [l] LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Required_Id], [l0].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l0] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] ON [l].[Id] = [t].[Level1_Required_Id] LEFT JOIN ( SELECT [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[OneToMany_Required_Inverse3Id] FROM [Level1] AS [l1] - WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse3Id] IS NOT NULL) + WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL ) AS [t0] ON CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] END = [t0].[Level2_Optional_Id] LEFT JOIN ( SELECT [l2].[Id], [l2].[Level3_Optional_Id], [l2].[Level3_Required_Id], [l2].[Level4_Name], [l2].[OneToMany_Optional_Inverse4Id], [l2].[OneToMany_Required_Inverse4Id], [l2].[OneToOne_Optional_PK_Inverse4Id] FROM [Level1] AS [l2] - WHERE ([l2].[Level3_Required_Id] IS NOT NULL) AND ([l2].[OneToMany_Required_Inverse4Id] IS NOT NULL) + WHERE [l2].[Level3_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse4Id] IS NOT NULL ) AS [t1] ON CASE - WHEN ([t0].[Level2_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [t0].[Id] + WHEN [t0].[Level2_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [t0].[Id] END = [t1].[OneToMany_Required_Inverse4Id] INNER JOIN ( SELECT [t3].[Id] AS [Id0], [t3].[OneToOne_Required_PK_Date], [t3].[Level1_Optional_Id], [t3].[Level1_Required_Id], [t3].[Level2_Name], [t3].[OneToMany_Optional_Inverse2Id], [t3].[OneToMany_Required_Inverse2Id], [t3].[OneToOne_Optional_PK_Inverse2Id] @@ -2091,15 +2091,15 @@ FROM [Level1] AS [l3] LEFT JOIN ( SELECT [l4].[Id], [l4].[OneToOne_Required_PK_Date], [l4].[Level1_Optional_Id], [l4].[Level1_Required_Id], [l4].[Level2_Name], [l4].[OneToMany_Optional_Inverse2Id], [l4].[OneToMany_Required_Inverse2Id], [l4].[OneToOne_Optional_PK_Inverse2Id] FROM [Level1] AS [l4] - WHERE ([l4].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l4].[Level1_Required_Id] IS NOT NULL) AND ([l4].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l4].[OneToOne_Required_PK_Date] IS NOT NULL AND [l4].[Level1_Required_Id] IS NOT NULL AND [l4].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t3] ON [l3].[Id] = CASE - WHEN ([t3].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t3].[Level1_Required_Id] IS NOT NULL) AND ([t3].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t3].[Id] + WHEN [t3].[OneToOne_Required_PK_Date] IS NOT NULL AND [t3].[Level1_Required_Id] IS NOT NULL AND [t3].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t3].[Id] END - WHERE ([t3].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t3].[Level1_Required_Id] IS NOT NULL) AND ([t3].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [t3].[OneToOne_Required_PK_Date] IS NOT NULL AND [t3].[Level1_Required_Id] IS NOT NULL AND [t3].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t2] ON CASE - WHEN ([t1].[Level3_Required_Id] IS NOT NULL) AND ([t1].[OneToMany_Required_Inverse4Id] IS NOT NULL) THEN [t1].[Id] + WHEN [t1].[Level3_Required_Id] IS NOT NULL AND [t1].[OneToMany_Required_Inverse4Id] IS NOT NULL THEN [t1].[Id] END = CASE - WHEN ([t2].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t2].[Level1_Required_Id] IS NOT NULL) AND ([t2].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t2].[Id0] + WHEN [t2].[OneToOne_Required_PK_Date] IS NOT NULL AND [t2].[Level1_Required_Id] IS NOT NULL AND [t2].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t2].[Id0] END """); } @@ -2115,26 +2115,26 @@ FROM [Level1] AS [l] LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[Level2_Name], [l0].[OneToMany_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id] FROM [Level1] AS [l0] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] ON [l].[Id] = CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] END -WHERE ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) AND CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] +WHERE [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL AND CASE + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] END = 7 AND ( SELECT TOP(1) [l2].[Name] FROM [Level1] AS [l1] LEFT JOIN ( SELECT [l3].[Id], [l3].[OneToOne_Required_PK_Date], [l3].[Level1_Optional_Id], [l3].[Level1_Required_Id], [l3].[Level2_Name], [l3].[OneToMany_Optional_Inverse2Id], [l3].[OneToMany_Required_Inverse2Id], [l3].[OneToOne_Optional_PK_Inverse2Id] FROM [Level1] AS [l3] - WHERE ([l3].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l3].[Level1_Required_Id] IS NOT NULL) AND ([l3].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l3].[OneToOne_Required_PK_Date] IS NOT NULL AND [l3].[Level1_Required_Id] IS NOT NULL AND [l3].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t0] ON [l1].[Id] = CASE - WHEN ([t0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t0].[Level1_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t0].[Id] + WHEN [t0].[OneToOne_Required_PK_Date] IS NOT NULL AND [t0].[Level1_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t0].[Id] END LEFT JOIN [Level1] AS [l2] ON [t0].[Level1_Required_Id] = [l2].[Id] - WHERE ([t0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t0].[Level1_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [t0].[OneToOne_Required_PK_Date] IS NOT NULL AND [t0].[Level1_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse2Id] IS NOT NULL ORDER BY CASE - WHEN ([t0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t0].[Level1_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t0].[Id] + WHEN [t0].[OneToOne_Required_PK_Date] IS NOT NULL AND [t0].[Level1_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t0].[Id] END) = N'L1 02' """); } @@ -2153,14 +2153,14 @@ FROM [Level1] AS [l0] LEFT JOIN ( SELECT [l1].[Id], [l1].[OneToOne_Required_PK_Date], [l1].[Level1_Optional_Id], [l1].[Level1_Required_Id], [l1].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l1] - WHERE ([l1].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l1].[Level1_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l1].[OneToOne_Required_PK_Date] IS NOT NULL AND [l1].[Level1_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] ON [l0].[Id] = CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] END - WHERE ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t0] ON [l].[Id] = [t0].[Level1_Optional_Id] LEFT JOIN [Level1] AS [l2] ON [t0].[Level1_Required_Id] = [l2].[Id] -WHERE [l2].[Name] <> N'L3 02' OR ([l2].[Name] IS NULL) +WHERE [l2].[Name] <> N'L3 02' OR [l2].[Name] IS NULL """); } @@ -2179,24 +2179,24 @@ FROM [Level1] AS [l] LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l0] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] ON [l].[Id] = [t].[Level1_Optional_Id] LEFT JOIN ( SELECT [l1].[Level2_Required_Id], [l1].[OneToMany_Optional_Inverse3Id] FROM [Level1] AS [l1] - WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse3Id] IS NOT NULL) + WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL ) AS [t0] ON CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] END = [t0].[OneToMany_Optional_Inverse3Id] LEFT JOIN ( SELECT [l2].[Id], [l2].[OneToOne_Required_PK_Date], [l2].[Level1_Required_Id], [l2].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l2] - WHERE ([l2].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l2].[Level1_Required_Id] IS NOT NULL) AND ([l2].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l2].[OneToOne_Required_PK_Date] IS NOT NULL AND [l2].[Level1_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t1] ON [t0].[Level2_Required_Id] = CASE - WHEN ([t1].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t1].[Level1_Required_Id] IS NOT NULL) AND ([t1].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t1].[Id] + WHEN [t1].[OneToOne_Required_PK_Date] IS NOT NULL AND [t1].[Level1_Required_Id] IS NOT NULL AND [t1].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t1].[Id] END LEFT JOIN [Level1] AS [l3] ON CASE - WHEN ([t1].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t1].[Level1_Required_Id] IS NOT NULL) AND ([t1].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t1].[Id] + WHEN [t1].[OneToOne_Required_PK_Date] IS NOT NULL AND [t1].[Level1_Required_Id] IS NOT NULL AND [t1].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t1].[Id] END = [l3].[Id] """); } @@ -2208,15 +2208,15 @@ public override async Task Optional_navigation_propagates_nullability_to_manuall AssertSql( """ SELECT CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] END AS [Id1], CASE - WHEN ([t0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t0].[Level1_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t0].[Id0] + WHEN [t0].[OneToOne_Required_PK_Date] IS NOT NULL AND [t0].[Level1_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t0].[Id0] END AS [Id2] FROM [Level1] AS [l] LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l0] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] ON [l].[Id] = [t].[Level1_Optional_Id] LEFT JOIN ( SELECT [t1].[Id] AS [Id0], [t1].[OneToOne_Required_PK_Date], [t1].[Level1_Required_Id], [t1].[OneToMany_Required_Inverse2Id] @@ -2224,13 +2224,13 @@ FROM [Level1] AS [l1] LEFT JOIN ( SELECT [l2].[Id], [l2].[OneToOne_Required_PK_Date], [l2].[Level1_Required_Id], [l2].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l2] - WHERE ([l2].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l2].[Level1_Required_Id] IS NOT NULL) AND ([l2].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l2].[OneToOne_Required_PK_Date] IS NOT NULL AND [l2].[Level1_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t1] ON [l1].[Id] = CASE - WHEN ([t1].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t1].[Level1_Required_Id] IS NOT NULL) AND ([t1].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t1].[Id] + WHEN [t1].[OneToOne_Required_PK_Date] IS NOT NULL AND [t1].[Level1_Required_Id] IS NOT NULL AND [t1].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t1].[Id] END - WHERE ([t1].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t1].[Level1_Required_Id] IS NOT NULL) AND ([t1].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [t1].[OneToOne_Required_PK_Date] IS NOT NULL AND [t1].[Level1_Required_Id] IS NOT NULL AND [t1].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t0] ON [t].[Level1_Required_Id] = CASE - WHEN ([t0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t0].[Level1_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t0].[Id0] + WHEN [t0].[OneToOne_Required_PK_Date] IS NOT NULL AND [t0].[Level1_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t0].[Id0] END """); } @@ -2248,7 +2248,7 @@ FROM [Level1] AS [l] LEFT JOIN ( SELECT [l0].[Level1_Optional_Id], [l0].[Level2_Name] FROM [Level1] AS [l0] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] ON [l].[Id] = [t].[Level1_Optional_Id] ORDER BY [t].[Level2_Name], [l].[Id] """); @@ -2269,60 +2269,60 @@ FROM [Level1] AS [l] LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Required_Id], [l0].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l0] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] ON [l].[Id] = CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] END LEFT JOIN ( SELECT [l1].[Id], [l1].[Level2_Required_Id], [l1].[OneToMany_Required_Inverse3Id] FROM [Level1] AS [l1] - WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse3Id] IS NOT NULL) + WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL ) AS [t0] ON CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] END = CASE - WHEN ([t0].[Level2_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [t0].[Id] + WHEN [t0].[Level2_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [t0].[Id] END LEFT JOIN ( SELECT [l2].[Id], [l2].[Level3_Required_Id], [l2].[OneToMany_Required_Inverse4Id] FROM [Level1] AS [l2] - WHERE ([l2].[Level3_Required_Id] IS NOT NULL) AND ([l2].[OneToMany_Required_Inverse4Id] IS NOT NULL) + WHERE [l2].[Level3_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse4Id] IS NOT NULL ) AS [t1] ON CASE - WHEN ([t0].[Level2_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [t0].[Id] + WHEN [t0].[Level2_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [t0].[Id] END = CASE - WHEN ([t1].[Level3_Required_Id] IS NOT NULL) AND ([t1].[OneToMany_Required_Inverse4Id] IS NOT NULL) THEN [t1].[Id] + WHEN [t1].[Level3_Required_Id] IS NOT NULL AND [t1].[OneToMany_Required_Inverse4Id] IS NOT NULL THEN [t1].[Id] END LEFT JOIN ( SELECT [l3].[Id], [l3].[Level2_Required_Id], [l3].[OneToMany_Required_Inverse3Id] FROM [Level1] AS [l3] - WHERE ([l3].[Level2_Required_Id] IS NOT NULL) AND ([l3].[OneToMany_Required_Inverse3Id] IS NOT NULL) + WHERE [l3].[Level2_Required_Id] IS NOT NULL AND [l3].[OneToMany_Required_Inverse3Id] IS NOT NULL ) AS [t2] ON [t1].[Level3_Required_Id] = CASE - WHEN ([t2].[Level2_Required_Id] IS NOT NULL) AND ([t2].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [t2].[Id] + WHEN [t2].[Level2_Required_Id] IS NOT NULL AND [t2].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [t2].[Id] END LEFT JOIN ( SELECT [l4].[Id], [l4].[OneToOne_Required_PK_Date], [l4].[Level1_Required_Id], [l4].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l4] - WHERE ([l4].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l4].[Level1_Required_Id] IS NOT NULL) AND ([l4].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l4].[OneToOne_Required_PK_Date] IS NOT NULL AND [l4].[Level1_Required_Id] IS NOT NULL AND [l4].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t3] ON [t2].[Level2_Required_Id] = CASE - WHEN ([t3].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t3].[Level1_Required_Id] IS NOT NULL) AND ([t3].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t3].[Id] + WHEN [t3].[OneToOne_Required_PK_Date] IS NOT NULL AND [t3].[Level1_Required_Id] IS NOT NULL AND [t3].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t3].[Id] END LEFT JOIN ( SELECT [l5].[Level2_Required_Id], [l5].[OneToMany_Required_Inverse3Id] FROM [Level1] AS [l5] - WHERE ([l5].[Level2_Required_Id] IS NOT NULL) AND ([l5].[OneToMany_Required_Inverse3Id] IS NOT NULL) + WHERE [l5].[Level2_Required_Id] IS NOT NULL AND [l5].[OneToMany_Required_Inverse3Id] IS NOT NULL ) AS [t4] ON CASE - WHEN ([t3].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t3].[Level1_Required_Id] IS NOT NULL) AND ([t3].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t3].[Id] + WHEN [t3].[OneToOne_Required_PK_Date] IS NOT NULL AND [t3].[Level1_Required_Id] IS NOT NULL AND [t3].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t3].[Id] END = [t4].[OneToMany_Required_Inverse3Id] LEFT JOIN ( SELECT [l6].[Id], [l6].[OneToOne_Required_PK_Date], [l6].[Level1_Required_Id], [l6].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l6] - WHERE ([l6].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l6].[Level1_Required_Id] IS NOT NULL) AND ([l6].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l6].[OneToOne_Required_PK_Date] IS NOT NULL AND [l6].[Level1_Required_Id] IS NOT NULL AND [l6].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t5] ON [t4].[Level2_Required_Id] = CASE - WHEN ([t5].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t5].[Level1_Required_Id] IS NOT NULL) AND ([t5].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t5].[Id] + WHEN [t5].[OneToOne_Required_PK_Date] IS NOT NULL AND [t5].[Level1_Required_Id] IS NOT NULL AND [t5].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t5].[Id] END LEFT JOIN [Level1] AS [l7] ON CASE - WHEN ([t5].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t5].[Level1_Required_Id] IS NOT NULL) AND ([t5].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t5].[Id] + WHEN [t5].[OneToOne_Required_PK_Date] IS NOT NULL AND [t5].[Level1_Required_Id] IS NOT NULL AND [t5].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t5].[Id] END = [l7].[Id] -WHERE ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) AND ([t0].[Level2_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse3Id] IS NOT NULL) AND ([t1].[Level3_Required_Id] IS NOT NULL) AND ([t1].[OneToMany_Required_Inverse4Id] IS NOT NULL) +WHERE [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL AND [t0].[Level2_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse3Id] IS NOT NULL AND [t1].[Level3_Required_Id] IS NOT NULL AND [t1].[OneToMany_Required_Inverse4Id] IS NOT NULL """); } @@ -2338,25 +2338,25 @@ FROM [Level1] AS [l1] LEFT JOIN ( SELECT [l3].[Id], [l3].[OneToOne_Required_PK_Date], [l3].[Level1_Optional_Id], [l3].[Level1_Required_Id], [l3].[Level2_Name], [l3].[OneToMany_Optional_Inverse2Id], [l3].[OneToMany_Required_Inverse2Id], [l3].[OneToOne_Optional_PK_Inverse2Id] FROM [Level1] AS [l3] - WHERE ([l3].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l3].[Level1_Required_Id] IS NOT NULL) AND ([l3].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l3].[OneToOne_Required_PK_Date] IS NOT NULL AND [l3].[Level1_Required_Id] IS NOT NULL AND [l3].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t0] ON [l1].[Id] = CASE - WHEN ([t0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t0].[Level1_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t0].[Id] + WHEN [t0].[OneToOne_Required_PK_Date] IS NOT NULL AND [t0].[Level1_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t0].[Id] END LEFT JOIN [Level1] AS [l2] ON [t0].[Level1_Required_Id] = [l2].[Id] - WHERE ([t0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t0].[Level1_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [t0].[OneToOne_Required_PK_Date] IS NOT NULL AND [t0].[Level1_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse2Id] IS NOT NULL ORDER BY CASE - WHEN ([t0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t0].[Level1_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t0].[Id] + WHEN [t0].[OneToOne_Required_PK_Date] IS NOT NULL AND [t0].[Level1_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t0].[Id] END) FROM [Level1] AS [l] LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Required_Id], [l0].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l0] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] ON [l].[Id] = CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] END -WHERE ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) AND CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] +WHERE [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL AND CASE + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] END = 7 """); } @@ -2368,7 +2368,7 @@ public override async Task GroupJoin_with_complex_subquery_with_joins_does_not_g AssertSql( """ SELECT CASE - WHEN ([t0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t0].[Level1_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t0].[Id0] + WHEN [t0].[OneToOne_Required_PK_Date] IS NOT NULL AND [t0].[Level1_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t0].[Id0] END FROM [Level1] AS [l] LEFT JOIN ( @@ -2377,12 +2377,12 @@ FROM [Level1] AS [l0] LEFT JOIN ( SELECT [l2].[Id], [l2].[OneToOne_Required_PK_Date], [l2].[Level1_Optional_Id], [l2].[Level1_Required_Id], [l2].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l2] - WHERE ([l2].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l2].[Level1_Required_Id] IS NOT NULL) AND ([l2].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l2].[OneToOne_Required_PK_Date] IS NOT NULL AND [l2].[Level1_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] ON [l0].[Id] = CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] END INNER JOIN [Level1] AS [l1] ON [t].[Level1_Required_Id] = [l1].[Id] - WHERE ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t0] ON [l].[Id] = [t0].[Level1_Optional_Id] """); } @@ -2394,7 +2394,7 @@ public override async Task GroupJoin_with_complex_subquery_with_joins_does_not_g AssertSql( """ SELECT CASE - WHEN ([t0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t0].[Level1_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t0].[Id0] + WHEN [t0].[OneToOne_Required_PK_Date] IS NOT NULL AND [t0].[Level1_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t0].[Id0] END FROM [Level1] AS [l] LEFT JOIN ( @@ -2403,12 +2403,12 @@ FROM [Level1] AS [l0] LEFT JOIN ( SELECT [l2].[Id], [l2].[OneToOne_Required_PK_Date], [l2].[Level1_Required_Id], [l2].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l2] - WHERE ([l2].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l2].[Level1_Required_Id] IS NOT NULL) AND ([l2].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l2].[OneToOne_Required_PK_Date] IS NOT NULL AND [l2].[Level1_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] ON [l0].[Id] = CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] END LEFT JOIN [Level1] AS [l1] ON [t].[Level1_Required_Id] = [l1].[Id] - WHERE ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t0] ON [l].[Id] = [t0].[Level1_Required_Id] """); } @@ -2431,11 +2431,11 @@ FROM [Level1] AS [l0] LEFT JOIN ( SELECT [l1].[Id], [l1].[OneToOne_Required_PK_Date], [l1].[Level1_Optional_Id], [l1].[Level1_Required_Id], [l1].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l1] - WHERE ([l1].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l1].[Level1_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l1].[OneToOne_Required_PK_Date] IS NOT NULL AND [l1].[Level1_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] ON [l0].[Id] = CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] END - WHERE ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t0] ON [l].[Id] = [t0].[Level1_Optional_Id] ORDER BY [l].[Id] ) AS [t1] @@ -2456,14 +2456,14 @@ LEFT JOIN ( SELECT [t].[OneToOne_Required_PK_Date], [t].[Level1_Required_Id], [t].[OneToMany_Required_Inverse2Id] FROM ( SELECT [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Required_Id], [l0].[OneToMany_Required_Inverse2Id], ROW_NUMBER() OVER(PARTITION BY [l0].[OneToMany_Required_Inverse2Id] ORDER BY CASE - WHEN ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [l0].[Id] + WHEN [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [l0].[Id] END) AS [row] FROM [Level1] AS [l0] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) AND [l0].[Id] > 5 + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL AND [l0].[Id] > 5 ) AS [t] WHERE [t].[row] <= 3 ) AS [t0] ON [l].[Id] = [t0].[OneToMany_Required_Inverse2Id] -WHERE ([t0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t0].[Level1_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse2Id] IS NOT NULL) +WHERE [t0].[OneToOne_Required_PK_Date] IS NOT NULL AND [t0].[Level1_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse2Id] IS NOT NULL """); } @@ -2481,12 +2481,12 @@ FROM [Level1] AS [l0] LEFT JOIN ( SELECT [l1].[Id], [l1].[OneToOne_Required_PK_Date], [l1].[Level1_Optional_Id], [l1].[Level1_Required_Id], [l1].[Level2_Name], [l1].[OneToMany_Optional_Inverse2Id], [l1].[OneToMany_Required_Inverse2Id], [l1].[OneToOne_Optional_PK_Inverse2Id] FROM [Level1] AS [l1] - WHERE ([l1].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l1].[Level1_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l1].[OneToOne_Required_PK_Date] IS NOT NULL AND [l1].[Level1_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] ON [l0].[Id] = CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] END - WHERE ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) AND CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] + WHERE [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL AND CASE + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] END > 2 ) AS [t0] ON [l].[Id] = [t0].[Level1_Optional_Id] """); @@ -2503,18 +2503,18 @@ FROM [Level1] AS [l] LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Required_Id], [l0].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l0] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] ON [l].[Id] = CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] END LEFT JOIN ( SELECT [l1].[Id], [l1].[Level2_Required_Id], [l1].[Level3_Name], [l1].[OneToMany_Required_Inverse3Id] FROM [Level1] AS [l1] - WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse3Id] IS NOT NULL) + WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL ) AS [t0] ON CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] END = CASE - WHEN ([t0].[Level2_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [t0].[Id] + WHEN [t0].[Level2_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [t0].[Id] END LEFT JOIN ( SELECT [t2].[Id] AS [Id0], [t2].[OneToOne_Required_PK_Date], [t2].[Level1_Required_Id], [t2].[Level2_Name], [t2].[OneToMany_Required_Inverse2Id] @@ -2522,12 +2522,12 @@ FROM [Level1] AS [l2] LEFT JOIN ( SELECT [l3].[Id], [l3].[OneToOne_Required_PK_Date], [l3].[Level1_Optional_Id], [l3].[Level1_Required_Id], [l3].[Level2_Name], [l3].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l3] - WHERE ([l3].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l3].[Level1_Required_Id] IS NOT NULL) AND ([l3].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l3].[OneToOne_Required_PK_Date] IS NOT NULL AND [l3].[Level1_Required_Id] IS NOT NULL AND [l3].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t2] ON [l2].[Id] = [t2].[Level1_Optional_Id] ) AS [t1] ON [t0].[Level2_Required_Id] = CASE - WHEN ([t1].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t1].[Level1_Required_Id] IS NOT NULL) AND ([t1].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t1].[Id0] + WHEN [t1].[OneToOne_Required_PK_Date] IS NOT NULL AND [t1].[Level1_Required_Id] IS NOT NULL AND [t1].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t1].[Id0] END -WHERE ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) AND ([t0].[Level2_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse3Id] IS NOT NULL) +WHERE [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL AND [t0].[Level2_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse3Id] IS NOT NULL """); } @@ -2549,11 +2549,11 @@ FROM [Level1] AS [l0] LEFT JOIN ( SELECT [l1].[Id], [l1].[OneToOne_Required_PK_Date], [l1].[Level1_Optional_Id], [l1].[Level1_Required_Id], [l1].[Level2_Name], [l1].[OneToMany_Optional_Inverse2Id], [l1].[OneToMany_Required_Inverse2Id], [l1].[OneToOne_Optional_PK_Inverse2Id] FROM [Level1] AS [l1] - WHERE ([l1].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l1].[Level1_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l1].[OneToOne_Required_PK_Date] IS NOT NULL AND [l1].[Level1_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] ON [l0].[Id] = CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] END - WHERE ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t0] ON [l].[Id] = [t0].[Level1_Optional_Id] ORDER BY [l].[Id] ) AS [t1] @@ -2563,11 +2563,11 @@ FROM [Level1] AS [l2] LEFT JOIN ( SELECT [l3].[Id], [l3].[OneToOne_Required_PK_Date], [l3].[Level1_Optional_Id], [l3].[Level1_Required_Id], [l3].[Level2_Name], [l3].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l3] - WHERE ([l3].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l3].[Level1_Required_Id] IS NOT NULL) AND ([l3].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l3].[OneToOne_Required_PK_Date] IS NOT NULL AND [l3].[Level1_Required_Id] IS NOT NULL AND [l3].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t3] ON [l2].[Id] = CASE - WHEN ([t3].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t3].[Level1_Required_Id] IS NOT NULL) AND ([t3].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t3].[Id] + WHEN [t3].[OneToOne_Required_PK_Date] IS NOT NULL AND [t3].[Level1_Required_Id] IS NOT NULL AND [t3].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t3].[Id] END - WHERE ([t3].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t3].[Level1_Required_Id] IS NOT NULL) AND ([t3].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [t3].[OneToOne_Required_PK_Date] IS NOT NULL AND [t3].[Level1_Required_Id] IS NOT NULL AND [t3].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t2] ON [t1].[Id] = [t2].[Level1_Optional_Id] ORDER BY [t1].[Id] """); @@ -2584,16 +2584,16 @@ FROM [Level1] AS [l] LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l0] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] ON [l].[Id] = [t].[Level1_Optional_Id] LEFT JOIN ( SELECT [l1].[Level2_Required_Id], [l1].[Level3_Name] FROM [Level1] AS [l1] - WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse3Id] IS NOT NULL) + WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL ) AS [t0] ON CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] END = [t0].[Level2_Required_Id] -WHERE [t0].[Level3_Name] <> N'L3 05' OR ([t0].[Level3_Name] IS NULL) +WHERE [t0].[Level3_Name] <> N'L3 05' OR [t0].[Level3_Name] IS NULL """); } @@ -2604,15 +2604,15 @@ public override async Task Join_navigation_non_key_join(bool async) AssertSql( """ SELECT CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] END AS [Id2], [t].[Level2_Name] AS [Name2], [t0].[Id] AS [Id1], [t0].[Name] AS [Name1] FROM [Level1] AS [l] LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Required_Id], [l0].[Level2_Name], [l0].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l0] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] ON [l].[Id] = CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] END INNER JOIN ( SELECT [l1].[Id], [l1].[Name], [t1].[Level2_Name] @@ -2620,10 +2620,10 @@ FROM [Level1] AS [l1] LEFT JOIN ( SELECT [l2].[Level1_Optional_Id], [l2].[Level2_Name] FROM [Level1] AS [l2] - WHERE ([l2].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l2].[Level1_Required_Id] IS NOT NULL) AND ([l2].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l2].[OneToOne_Required_PK_Date] IS NOT NULL AND [l2].[Level1_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t1] ON [l1].[Id] = [t1].[Level1_Optional_Id] ) AS [t0] ON [t].[Level2_Name] = [t0].[Level2_Name] -WHERE ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) +WHERE [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL """); } @@ -2638,12 +2638,12 @@ FROM [Level1] AS [l] LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l0] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] ON [l].[Id] = CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] END LEFT JOIN [Level1] AS [l1] ON [t].[Level1_Optional_Id] = [l1].[Id] -WHERE ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) +WHERE [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL """); } @@ -2658,54 +2658,54 @@ FROM [Level1] AS [l] LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[Level2_Name], [l0].[OneToMany_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id] FROM [Level1] AS [l0] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] ON [l].[Id] = [t].[Level1_Optional_Id] LEFT JOIN ( SELECT [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Level3_Name], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[OneToOne_Optional_PK_Inverse3Id] FROM [Level1] AS [l1] - WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse3Id] IS NOT NULL) + WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL ) AS [t0] ON CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] END = [t0].[Level2_Optional_Id] LEFT JOIN ( SELECT [l2].[Id], [l2].[Level2_Optional_Id], [l2].[Level2_Required_Id], [l2].[Level3_Name], [l2].[OneToMany_Optional_Inverse3Id], [l2].[OneToMany_Required_Inverse3Id], [l2].[OneToOne_Optional_PK_Inverse3Id] FROM [Level1] AS [l2] - WHERE ([l2].[Level2_Required_Id] IS NOT NULL) AND ([l2].[OneToMany_Required_Inverse3Id] IS NOT NULL) + WHERE [l2].[Level2_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse3Id] IS NOT NULL ) AS [t1] ON CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] END = [t1].[OneToOne_Optional_PK_Inverse3Id] LEFT JOIN ( SELECT [l3].[Id], [l3].[OneToOne_Required_PK_Date], [l3].[Level1_Optional_Id], [l3].[Level1_Required_Id], [l3].[Level2_Name], [l3].[OneToMany_Optional_Inverse2Id], [l3].[OneToMany_Required_Inverse2Id], [l3].[OneToOne_Optional_PK_Inverse2Id] FROM [Level1] AS [l3] - WHERE ([l3].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l3].[Level1_Required_Id] IS NOT NULL) AND ([l3].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l3].[OneToOne_Required_PK_Date] IS NOT NULL AND [l3].[Level1_Required_Id] IS NOT NULL AND [l3].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t2] ON [l].[Id] = [t2].[OneToOne_Optional_PK_Inverse2Id] LEFT JOIN ( SELECT [l4].[Id], [l4].[Level2_Optional_Id], [l4].[Level2_Required_Id], [l4].[Level3_Name], [l4].[OneToMany_Optional_Inverse3Id], [l4].[OneToMany_Required_Inverse3Id], [l4].[OneToOne_Optional_PK_Inverse3Id] FROM [Level1] AS [l4] - WHERE ([l4].[Level2_Required_Id] IS NOT NULL) AND ([l4].[OneToMany_Required_Inverse3Id] IS NOT NULL) + WHERE [l4].[Level2_Required_Id] IS NOT NULL AND [l4].[OneToMany_Required_Inverse3Id] IS NOT NULL ) AS [t3] ON CASE - WHEN ([t2].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t2].[Level1_Required_Id] IS NOT NULL) AND ([t2].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t2].[Id] + WHEN [t2].[OneToOne_Required_PK_Date] IS NOT NULL AND [t2].[Level1_Required_Id] IS NOT NULL AND [t2].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t2].[Id] END = [t3].[Level2_Optional_Id] LEFT JOIN ( SELECT [l5].[Id], [l5].[Level3_Optional_Id], [l5].[Level3_Required_Id], [l5].[Level4_Name], [l5].[OneToMany_Optional_Inverse4Id], [l5].[OneToMany_Required_Inverse4Id], [l5].[OneToOne_Optional_PK_Inverse4Id] FROM [Level1] AS [l5] - WHERE ([l5].[Level3_Required_Id] IS NOT NULL) AND ([l5].[OneToMany_Required_Inverse4Id] IS NOT NULL) + WHERE [l5].[Level3_Required_Id] IS NOT NULL AND [l5].[OneToMany_Required_Inverse4Id] IS NOT NULL ) AS [t4] ON CASE - WHEN ([t3].[Level2_Required_Id] IS NOT NULL) AND ([t3].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [t3].[Id] + WHEN [t3].[Level2_Required_Id] IS NOT NULL AND [t3].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [t3].[Id] END = [t4].[Level3_Optional_Id] LEFT JOIN ( SELECT [l6].[Id], [l6].[Level3_Optional_Id], [l6].[Level3_Required_Id], [l6].[Level4_Name], [l6].[OneToMany_Optional_Inverse4Id], [l6].[OneToMany_Required_Inverse4Id], [l6].[OneToOne_Optional_PK_Inverse4Id] FROM [Level1] AS [l6] - WHERE ([l6].[Level3_Required_Id] IS NOT NULL) AND ([l6].[OneToMany_Required_Inverse4Id] IS NOT NULL) + WHERE [l6].[Level3_Required_Id] IS NOT NULL AND [l6].[OneToMany_Required_Inverse4Id] IS NOT NULL ) AS [t5] ON CASE - WHEN ([t3].[Level2_Required_Id] IS NOT NULL) AND ([t3].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [t3].[Id] + WHEN [t3].[Level2_Required_Id] IS NOT NULL AND [t3].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [t3].[Id] END = [t5].[OneToOne_Optional_PK_Inverse4Id] LEFT JOIN ( SELECT [l7].[Id], [l7].[Level2_Optional_Id], [l7].[Level2_Required_Id], [l7].[Level3_Name], [l7].[OneToMany_Optional_Inverse3Id], [l7].[OneToMany_Required_Inverse3Id], [l7].[OneToOne_Optional_PK_Inverse3Id] FROM [Level1] AS [l7] - WHERE ([l7].[Level2_Required_Id] IS NOT NULL) AND ([l7].[OneToMany_Required_Inverse3Id] IS NOT NULL) + WHERE [l7].[Level2_Required_Id] IS NOT NULL AND [l7].[OneToMany_Required_Inverse3Id] IS NOT NULL ) AS [t6] ON CASE - WHEN ([t2].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t2].[Level1_Required_Id] IS NOT NULL) AND ([t2].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t2].[Id] + WHEN [t2].[OneToOne_Required_PK_Date] IS NOT NULL AND [t2].[Level1_Required_Id] IS NOT NULL AND [t2].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t2].[Id] END = [t6].[OneToOne_Optional_PK_Inverse3Id] """); } @@ -2723,15 +2723,15 @@ FROM [Level1] AS [l] LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[Level2_Name], [l0].[OneToMany_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id] FROM [Level1] AS [l0] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] ON [l].[Id] = [t].[Level1_Optional_Id] ) AS [t0] LEFT JOIN ( SELECT [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Level3_Name], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[OneToOne_Optional_PK_Inverse3Id] FROM [Level1] AS [l1] - WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse3Id] IS NOT NULL) + WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL ) AS [t1] ON CASE - WHEN ([t0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t0].[Level1_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t0].[Id] + WHEN [t0].[OneToOne_Required_PK_Date] IS NOT NULL AND [t0].[Level1_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t0].[Id] END = [t1].[Level2_Optional_Id] """); } @@ -2765,24 +2765,24 @@ public override async Task Join_navigation_nested(bool async) AssertSql( """ SELECT CASE - WHEN ([t0].[Level2_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [t0].[Id] + WHEN [t0].[Level2_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [t0].[Id] END AS [Id3], [t1].[Id] AS [Id1] FROM [Level1] AS [l] LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Required_Id], [l0].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l0] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] ON [l].[Id] = CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] END LEFT JOIN ( SELECT [l1].[Id], [l1].[Level2_Required_Id], [l1].[OneToMany_Required_Inverse3Id] FROM [Level1] AS [l1] - WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse3Id] IS NOT NULL) + WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL ) AS [t0] ON CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] END = CASE - WHEN ([t0].[Level2_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [t0].[Id] + WHEN [t0].[Level2_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [t0].[Id] END INNER JOIN ( SELECT [l2].[Id], [t3].[Id] AS [Id1], [t3].[Level2_Required_Id], [t3].[OneToMany_Required_Inverse3Id] @@ -2790,21 +2790,21 @@ FROM [Level1] AS [l2] LEFT JOIN ( SELECT [l3].[Id], [l3].[OneToOne_Required_PK_Date], [l3].[Level1_Required_Id], [l3].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l3] - WHERE ([l3].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l3].[Level1_Required_Id] IS NOT NULL) AND ([l3].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l3].[OneToOne_Required_PK_Date] IS NOT NULL AND [l3].[Level1_Required_Id] IS NOT NULL AND [l3].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t2] ON [l2].[Id] = [t2].[Level1_Required_Id] LEFT JOIN ( SELECT [l4].[Id], [l4].[Level2_Optional_Id], [l4].[Level2_Required_Id], [l4].[OneToMany_Required_Inverse3Id] FROM [Level1] AS [l4] - WHERE ([l4].[Level2_Required_Id] IS NOT NULL) AND ([l4].[OneToMany_Required_Inverse3Id] IS NOT NULL) + WHERE [l4].[Level2_Required_Id] IS NOT NULL AND [l4].[OneToMany_Required_Inverse3Id] IS NOT NULL ) AS [t3] ON CASE - WHEN ([t2].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t2].[Level1_Required_Id] IS NOT NULL) AND ([t2].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t2].[Id] + WHEN [t2].[OneToOne_Required_PK_Date] IS NOT NULL AND [t2].[Level1_Required_Id] IS NOT NULL AND [t2].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t2].[Id] END = [t3].[Level2_Optional_Id] ) AS [t1] ON CASE - WHEN ([t0].[Level2_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [t0].[Id] + WHEN [t0].[Level2_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [t0].[Id] END = CASE - WHEN ([t1].[Level2_Required_Id] IS NOT NULL) AND ([t1].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [t1].[Id1] + WHEN [t1].[Level2_Required_Id] IS NOT NULL AND [t1].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [t1].[Id1] END -WHERE ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) AND ([t0].[Level2_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse3Id] IS NOT NULL) +WHERE [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL AND [t0].[Level2_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse3Id] IS NOT NULL """); } @@ -2821,14 +2821,14 @@ FROM [Level1] AS [l] LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Required_Id], [l0].[Level2_Name], [l0].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l0] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] ON [l].[Id] = CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] END LEFT JOIN [Level1] AS [l1] ON [t].[Level1_Required_Id] = [l1].[Id] -WHERE ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) AND [l1].[Name] = N'L1 03' +WHERE [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL AND [l1].[Name] = N'L1 03' ORDER BY CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] END """); } @@ -2846,9 +2846,9 @@ FROM [Level1] AS [l] LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Required_Id], [l0].[Level2_Name], [l0].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l0] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] ON [l].[Id] = CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] END INNER JOIN [Level1] AS [l1] ON [t].[Level1_Required_Id] = [l1].[Id] INNER JOIN ( @@ -2857,22 +2857,22 @@ FROM [Level1] AS [l2] LEFT JOIN ( SELECT [l3].[Id], [l3].[OneToOne_Required_PK_Date], [l3].[Level1_Required_Id], [l3].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l3] - WHERE ([l3].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l3].[Level1_Required_Id] IS NOT NULL) AND ([l3].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l3].[OneToOne_Required_PK_Date] IS NOT NULL AND [l3].[Level1_Required_Id] IS NOT NULL AND [l3].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t0] ON [l2].[Id] = CASE - WHEN ([t0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t0].[Level1_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t0].[Id] + WHEN [t0].[OneToOne_Required_PK_Date] IS NOT NULL AND [t0].[Level1_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t0].[Id] END LEFT JOIN ( SELECT [l4].[Id], [l4].[Level2_Required_Id], [l4].[Level3_Name], [l4].[OneToMany_Required_Inverse3Id] FROM [Level1] AS [l4] - WHERE ([l4].[Level2_Required_Id] IS NOT NULL) AND ([l4].[OneToMany_Required_Inverse3Id] IS NOT NULL) + WHERE [l4].[Level2_Required_Id] IS NOT NULL AND [l4].[OneToMany_Required_Inverse3Id] IS NOT NULL ) AS [t2] ON CASE - WHEN ([t0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t0].[Level1_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t0].[Id] + WHEN [t0].[OneToOne_Required_PK_Date] IS NOT NULL AND [t0].[Level1_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t0].[Id] END = CASE - WHEN ([t2].[Level2_Required_Id] IS NOT NULL) AND ([t2].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [t2].[Id] + WHEN [t2].[Level2_Required_Id] IS NOT NULL AND [t2].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [t2].[Id] END - WHERE ([t0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t0].[Level1_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse2Id] IS NOT NULL) AND ([t2].[Level2_Required_Id] IS NOT NULL) AND ([t2].[OneToMany_Required_Inverse3Id] IS NOT NULL) + WHERE [t0].[OneToOne_Required_PK_Date] IS NOT NULL AND [t0].[Level1_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse2Id] IS NOT NULL AND [t2].[Level2_Required_Id] IS NOT NULL AND [t2].[OneToMany_Required_Inverse3Id] IS NOT NULL ) AS [t1] ON [l1].[Id] = [t1].[Level2_Required_Id] -WHERE ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) AND [l1].[Name] = N'L1 03' AND [t1].[Level3_Name] = N'L3 08' +WHERE [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL AND [l1].[Name] = N'L1 03' AND [t1].[Level3_Name] = N'L3 08' ORDER BY [l1].[Id] """); } @@ -2888,19 +2888,19 @@ FROM [Level1] AS [l] LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[Level2_Name], [l0].[OneToMany_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id] FROM [Level1] AS [l0] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] ON [l].[Id] = [t].[Level1_Optional_Id] LEFT JOIN ( SELECT [l1].[Id], [l1].[OneToOne_Required_PK_Date], [l1].[Level1_Optional_Id], [l1].[Level1_Required_Id], [l1].[Level2_Name], [l1].[OneToMany_Optional_Inverse2Id], [l1].[OneToMany_Required_Inverse2Id], [l1].[OneToOne_Optional_PK_Inverse2Id] FROM [Level1] AS [l1] - WHERE ([l1].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l1].[Level1_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l1].[OneToOne_Required_PK_Date] IS NOT NULL AND [l1].[Level1_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t0] ON [l].[Id] = [t0].[OneToOne_Optional_PK_Inverse2Id] LEFT JOIN ( SELECT [l2].[Id], [l2].[Level2_Optional_Id], [l2].[Level2_Required_Id], [l2].[Level3_Name], [l2].[OneToMany_Optional_Inverse3Id], [l2].[OneToMany_Required_Inverse3Id], [l2].[OneToOne_Optional_PK_Inverse3Id] FROM [Level1] AS [l2] - WHERE ([l2].[Level2_Required_Id] IS NOT NULL) AND ([l2].[OneToMany_Required_Inverse3Id] IS NOT NULL) + WHERE [l2].[Level2_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse3Id] IS NOT NULL ) AS [t1] ON CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] END = [t1].[Level2_Optional_Id] """); } @@ -2916,12 +2916,12 @@ FROM [Level1] AS [l] LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[Level2_Name], [l0].[OneToMany_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id] FROM [Level1] AS [l0] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] ON [l].[Id] = CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] END LEFT JOIN [Level1] AS [l1] ON [t].[Level1_Required_Id] = [l1].[Id] -WHERE ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) AND [l1].[Id] = 7 +WHERE [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL AND [l1].[Id] = 7 """); } @@ -2936,35 +2936,35 @@ public override async Task Order_by_key_of_projected_navigation_doesnt_get_optim SELECT [l3].[Name] FROM ( SELECT TOP(@__p_0) [t1].[Level1_Required_Id] AS [Level1_Required_Id0], CASE - WHEN ([t1].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t1].[Level1_Required_Id] IS NOT NULL) AND ([t1].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t1].[Id] + WHEN [t1].[OneToOne_Required_PK_Date] IS NOT NULL AND [t1].[Level1_Required_Id] IS NOT NULL AND [t1].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t1].[Id] END AS [c] FROM [Level1] AS [l] LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Required_Id], [l0].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l0] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] ON [l].[Id] = CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] END LEFT JOIN ( SELECT [l1].[Id], [l1].[Level2_Required_Id], [l1].[OneToMany_Required_Inverse3Id] FROM [Level1] AS [l1] - WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse3Id] IS NOT NULL) + WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL ) AS [t0] ON CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] END = CASE - WHEN ([t0].[Level2_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [t0].[Id] + WHEN [t0].[Level2_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [t0].[Id] END LEFT JOIN ( SELECT [l2].[Id], [l2].[OneToOne_Required_PK_Date], [l2].[Level1_Required_Id], [l2].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l2] - WHERE ([l2].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l2].[Level1_Required_Id] IS NOT NULL) AND ([l2].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l2].[OneToOne_Required_PK_Date] IS NOT NULL AND [l2].[Level1_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t1] ON [t0].[Level2_Required_Id] = CASE - WHEN ([t1].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t1].[Level1_Required_Id] IS NOT NULL) AND ([t1].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t1].[Id] + WHEN [t1].[OneToOne_Required_PK_Date] IS NOT NULL AND [t1].[Level1_Required_Id] IS NOT NULL AND [t1].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t1].[Id] END - WHERE ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) AND ([t0].[Level2_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse3Id] IS NOT NULL) + WHERE [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL AND [t0].[Level2_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse3Id] IS NOT NULL ORDER BY CASE - WHEN ([t1].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t1].[Level1_Required_Id] IS NOT NULL) AND ([t1].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t1].[Id] + WHEN [t1].[OneToOne_Required_PK_Date] IS NOT NULL AND [t1].[Level1_Required_Id] IS NOT NULL AND [t1].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t1].[Id] END ) AS [t2] LEFT JOIN [Level1] AS [l3] ON [t2].[Level1_Required_Id0] = [l3].[Id] @@ -2979,7 +2979,7 @@ public override async Task Where_complex_predicate_with_with_nav_prop_and_OrElse AssertSql( """ SELECT [l].[Id] AS [Id1], CASE - WHEN ([t0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t0].[Level1_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t0].[Id] + WHEN [t0].[OneToOne_Required_PK_Date] IS NOT NULL AND [t0].[Level1_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t0].[Id] END AS [Id2] FROM [Level1] AS [l] CROSS JOIN ( @@ -2988,19 +2988,19 @@ FROM [Level1] AS [l0] LEFT JOIN ( SELECT [l1].[Id], [l1].[OneToOne_Required_PK_Date], [l1].[Level1_Required_Id], [l1].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l1] - WHERE ([l1].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l1].[Level1_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l1].[OneToOne_Required_PK_Date] IS NOT NULL AND [l1].[Level1_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] ON [l0].[Id] = CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] END - WHERE ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t0] LEFT JOIN ( SELECT [l2].[Level1_Optional_Id], [l2].[Level2_Name] FROM [Level1] AS [l2] - WHERE ([l2].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l2].[Level1_Required_Id] IS NOT NULL) AND ([l2].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l2].[OneToOne_Required_PK_Date] IS NOT NULL AND [l2].[Level1_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t1] ON [l].[Id] = [t1].[Level1_Optional_Id] LEFT JOIN [Level1] AS [l3] ON [t0].[Level1_Required_Id] = [l3].[Id] -WHERE [t1].[Level2_Name] = N'L2 01' OR [l3].[Name] <> N'Bar' OR ([l3].[Name] IS NULL) +WHERE [t1].[Level2_Name] = N'L2 01' OR [l3].[Name] <> N'Bar' OR [l3].[Name] IS NULL """); } @@ -3015,7 +3015,7 @@ FROM [Level1] AS [l] LEFT JOIN ( SELECT [l0].[Level1_Optional_Id], [l0].[Level2_Name] FROM [Level1] AS [l0] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] ON [l].[Id] = [t].[Level1_Optional_Id] ORDER BY [t].[Level2_Name], [l].[Id] """); @@ -3038,12 +3038,12 @@ ORDER BY [l].[Id] LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[Level2_Name], [l0].[OneToMany_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id] FROM [Level1] AS [l0] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t0] ON [t].[Id] = [t0].[OneToOne_Optional_PK_Inverse2Id] LEFT JOIN ( SELECT [l1].[Id], [l1].[OneToOne_Required_PK_Date], [l1].[Level1_Optional_Id], [l1].[Level1_Required_Id], [l1].[Level2_Name], [l1].[OneToMany_Optional_Inverse2Id], [l1].[OneToMany_Required_Inverse2Id], [l1].[OneToOne_Optional_PK_Inverse2Id] FROM [Level1] AS [l1] - WHERE ([l1].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l1].[Level1_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l1].[OneToOne_Required_PK_Date] IS NOT NULL AND [l1].[Level1_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t1] ON [t].[Id] = [t1].[Level1_Optional_Id] ORDER BY [t].[Id] """); @@ -3073,12 +3073,12 @@ FROM [Level1] AS [l] LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[Level2_Name], [l0].[OneToMany_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id] FROM [Level1] AS [l0] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] ON [l].[Id] = [t].[Level1_Optional_Id] LEFT JOIN ( SELECT [l1].[Id], [l1].[OneToOne_Required_PK_Date], [l1].[Level1_Optional_Id], [l1].[Level1_Required_Id], [l1].[Level2_Name], [l1].[OneToMany_Optional_Inverse2Id], [l1].[OneToMany_Required_Inverse2Id], [l1].[OneToOne_Optional_PK_Inverse2Id] FROM [Level1] AS [l1] - WHERE ([l1].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l1].[Level1_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l1].[OneToOne_Required_PK_Date] IS NOT NULL AND [l1].[Level1_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t0] ON [l].[Id] = [t0].[OneToOne_Optional_PK_Inverse2Id] """); } @@ -3090,7 +3090,7 @@ public override async Task Join_navigation_key_access_optional(bool async) AssertSql( """ SELECT [l].[Id] AS [Id1], CASE - WHEN ([t0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t0].[Level1_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t0].[Id0] + WHEN [t0].[OneToOne_Required_PK_Date] IS NOT NULL AND [t0].[Level1_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t0].[Id0] END AS [Id2] FROM [Level1] AS [l] INNER JOIN ( @@ -3099,12 +3099,12 @@ FROM [Level1] AS [l0] LEFT JOIN ( SELECT [l2].[Id], [l2].[OneToOne_Required_PK_Date], [l2].[Level1_Optional_Id], [l2].[Level1_Required_Id], [l2].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l2] - WHERE ([l2].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l2].[Level1_Required_Id] IS NOT NULL) AND ([l2].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l2].[OneToOne_Required_PK_Date] IS NOT NULL AND [l2].[Level1_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] ON [l0].[Id] = CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] END LEFT JOIN [Level1] AS [l1] ON [t].[Level1_Optional_Id] = [l1].[Id] - WHERE ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t0] ON [l].[Id] = [t0].[Id1] """); } @@ -3120,9 +3120,9 @@ FROM [Level1] AS [l] LEFT JOIN ( SELECT [l0].[Level1_Optional_Id], [l0].[Level2_Name] FROM [Level1] AS [l0] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] ON [l].[Id] = [t].[Level1_Optional_Id] -WHERE ([t].[Level2_Name] IS NOT NULL) AND ([t].[Level2_Name] LIKE N'L%') +WHERE [t].[Level2_Name] IS NOT NULL AND [t].[Level2_Name] LIKE N'L%' """); } @@ -3133,34 +3133,34 @@ public override async Task Multi_level_navigation_with_same_navigation_compared_ AssertSql( """ SELECT CASE - WHEN ([t0].[Level2_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [t0].[Id] + WHEN [t0].[Level2_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [t0].[Id] END FROM [Level1] AS [l] LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Required_Id], [l0].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l0] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] ON [l].[Id] = CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] END LEFT JOIN ( SELECT [l1].[Id], [l1].[Level2_Required_Id], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id] FROM [Level1] AS [l1] - WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse3Id] IS NOT NULL) + WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL ) AS [t0] ON CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] END = CASE - WHEN ([t0].[Level2_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [t0].[Id] + WHEN [t0].[Level2_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [t0].[Id] END LEFT JOIN ( SELECT [l2].[Id], [l2].[OneToOne_Required_PK_Date], [l2].[Level1_Required_Id], [l2].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l2] - WHERE ([l2].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l2].[Level1_Required_Id] IS NOT NULL) AND ([l2].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l2].[OneToOne_Required_PK_Date] IS NOT NULL AND [l2].[Level1_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t1] ON [t0].[OneToMany_Optional_Inverse3Id] = CASE - WHEN ([t1].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t1].[Level1_Required_Id] IS NOT NULL) AND ([t1].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t1].[Id] + WHEN [t1].[OneToOne_Required_PK_Date] IS NOT NULL AND [t1].[Level1_Required_Id] IS NOT NULL AND [t1].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t1].[Id] END LEFT JOIN [Level1] AS [l3] ON [t1].[Level1_Required_Id] = [l3].[Id] -WHERE ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) AND ([t0].[Level2_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse3Id] IS NOT NULL) AND ([l3].[Name] <> N'L1 07' OR ([l3].[Name] IS NULL)) AND ([l3].[Id] IS NOT NULL) +WHERE [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL AND [t0].[Level2_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse3Id] IS NOT NULL AND ([l3].[Name] <> N'L1 07' OR [l3].[Name] IS NULL) AND [l3].[Id] IS NOT NULL """); } @@ -3171,34 +3171,34 @@ public override async Task Multi_level_navigation_compared_to_null(bool async) AssertSql( """ SELECT CASE - WHEN ([t0].[Level2_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [t0].[Id] + WHEN [t0].[Level2_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [t0].[Id] END FROM [Level1] AS [l] LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Required_Id], [l0].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l0] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] ON [l].[Id] = CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] END LEFT JOIN ( SELECT [l1].[Id], [l1].[Level2_Required_Id], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id] FROM [Level1] AS [l1] - WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse3Id] IS NOT NULL) + WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL ) AS [t0] ON CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] END = CASE - WHEN ([t0].[Level2_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [t0].[Id] + WHEN [t0].[Level2_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [t0].[Id] END LEFT JOIN ( SELECT [l2].[Id], [l2].[OneToOne_Required_PK_Date], [l2].[Level1_Required_Id], [l2].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l2] - WHERE ([l2].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l2].[Level1_Required_Id] IS NOT NULL) AND ([l2].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l2].[OneToOne_Required_PK_Date] IS NOT NULL AND [l2].[Level1_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t1] ON [t0].[OneToMany_Optional_Inverse3Id] = CASE - WHEN ([t1].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t1].[Level1_Required_Id] IS NOT NULL) AND ([t1].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t1].[Id] + WHEN [t1].[OneToOne_Required_PK_Date] IS NOT NULL AND [t1].[Level1_Required_Id] IS NOT NULL AND [t1].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t1].[Id] END LEFT JOIN [Level1] AS [l3] ON [t1].[Level1_Required_Id] = [l3].[Id] -WHERE ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) AND ([t0].[Level2_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse3Id] IS NOT NULL) AND ([l3].[Id] IS NOT NULL) +WHERE [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL AND [t0].[Level2_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse3Id] IS NOT NULL AND [l3].[Id] IS NOT NULL """); } @@ -3213,16 +3213,16 @@ FROM [Level1] AS [l] LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l0] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] ON [l].[Id] = [t].[Level1_Optional_Id] LEFT JOIN ( SELECT [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[OneToMany_Required_Inverse3Id] FROM [Level1] AS [l1] - WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse3Id] IS NOT NULL) + WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL ) AS [t0] ON CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] END = [t0].[Level2_Optional_Id] -WHERE ([t0].[Level2_Required_Id] IS NULL) OR ([t0].[OneToMany_Required_Inverse3Id] IS NULL) +WHERE [t0].[Level2_Required_Id] IS NULL OR [t0].[OneToMany_Required_Inverse3Id] IS NULL """); } @@ -3237,21 +3237,21 @@ FROM [Level1] AS [l] LEFT JOIN ( SELECT [l0].[Level1_Optional_Id], [l0].[Level2_Name] FROM [Level1] AS [l0] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] ON [l].[Id] = [t].[Level1_Optional_Id] LEFT JOIN ( SELECT [l1].[Id], [l1].[OneToOne_Required_PK_Date], [l1].[Level1_Required_Id], [l1].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l1] - WHERE ([l1].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l1].[Level1_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l1].[OneToOne_Required_PK_Date] IS NOT NULL AND [l1].[Level1_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t0] ON [l].[Id] = [t0].[Level1_Required_Id] LEFT JOIN ( SELECT [l2].[Level2_Optional_Id], [l2].[Level3_Name] FROM [Level1] AS [l2] - WHERE ([l2].[Level2_Required_Id] IS NOT NULL) AND ([l2].[OneToMany_Required_Inverse3Id] IS NOT NULL) + WHERE [l2].[Level2_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse3Id] IS NOT NULL ) AS [t1] ON CASE - WHEN ([t0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t0].[Level1_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t0].[Id] + WHEN [t0].[OneToOne_Required_PK_Date] IS NOT NULL AND [t0].[Level1_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t0].[Id] END = [t1].[Level2_Optional_Id] -WHERE [t].[Level2_Name] <> N'L2 05' OR ([t].[Level2_Name] IS NULL) OR [t1].[Level3_Name] = N'L3 05' +WHERE [t].[Level2_Name] <> N'L2 05' OR [t].[Level2_Name] IS NULL OR [t1].[Level3_Name] = N'L3 05' """); } @@ -3266,7 +3266,7 @@ FROM [Level1] AS [l] LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[Level2_Name], [l0].[OneToMany_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id] FROM [Level1] AS [l0] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] ON [l].[Id] = [t].[Level1_Optional_Id] """); } @@ -3278,15 +3278,15 @@ public override async Task Join_navigation_in_inner_selector(bool async) AssertSql( """ SELECT CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] END AS [Id2], [t0].[Id] AS [Id1] FROM [Level1] AS [l] LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Required_Id], [l0].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l0] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] ON [l].[Id] = CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] END INNER JOIN ( SELECT [l1].[Id], [t1].[Id] AS [Id0], [t1].[OneToOne_Required_PK_Date], [t1].[Level1_Required_Id], [t1].[OneToMany_Required_Inverse2Id] @@ -3294,14 +3294,14 @@ FROM [Level1] AS [l1] LEFT JOIN ( SELECT [l2].[Id], [l2].[OneToOne_Required_PK_Date], [l2].[Level1_Optional_Id], [l2].[Level1_Required_Id], [l2].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l2] - WHERE ([l2].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l2].[Level1_Required_Id] IS NOT NULL) AND ([l2].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l2].[OneToOne_Required_PK_Date] IS NOT NULL AND [l2].[Level1_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t1] ON [l1].[Id] = [t1].[Level1_Optional_Id] ) AS [t0] ON CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] END = CASE - WHEN ([t0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t0].[Level1_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t0].[Id0] + WHEN [t0].[OneToOne_Required_PK_Date] IS NOT NULL AND [t0].[Level1_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t0].[Id0] END -WHERE ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) +WHERE [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL """); } @@ -3316,7 +3316,7 @@ FROM [Level1] AS [l] LEFT JOIN ( SELECT [l0].[Level1_Optional_Id], [l0].[Level2_Name] FROM [Level1] AS [l0] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] ON [l].[Id] = [t].[Level1_Optional_Id] """); } @@ -3328,7 +3328,7 @@ public override async Task SelectMany_navigation_comparison3(bool async) AssertSql( """ SELECT [l].[Id] AS [Id1], CASE - WHEN ([t0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t0].[Level1_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t0].[Id] + WHEN [t0].[OneToOne_Required_PK_Date] IS NOT NULL AND [t0].[Level1_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t0].[Id] END AS [Id2] FROM [Level1] AS [l] CROSS JOIN ( @@ -3337,26 +3337,26 @@ FROM [Level1] AS [l0] LEFT JOIN ( SELECT [l1].[Id], [l1].[OneToOne_Required_PK_Date], [l1].[Level1_Required_Id], [l1].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l1] - WHERE ([l1].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l1].[Level1_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l1].[OneToOne_Required_PK_Date] IS NOT NULL AND [l1].[Level1_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] ON [l0].[Id] = CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] END - WHERE ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t0] LEFT JOIN ( SELECT [l2].[Id], [l2].[OneToOne_Required_PK_Date], [l2].[Level1_Optional_Id], [l2].[Level1_Required_Id], [l2].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l2] - WHERE ([l2].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l2].[Level1_Required_Id] IS NOT NULL) AND ([l2].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l2].[OneToOne_Required_PK_Date] IS NOT NULL AND [l2].[Level1_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t1] ON [l].[Id] = [t1].[Level1_Optional_Id] WHERE CASE - WHEN ([t1].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t1].[Level1_Required_Id] IS NOT NULL) AND ([t1].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t1].[Id] + WHEN [t1].[OneToOne_Required_PK_Date] IS NOT NULL AND [t1].[Level1_Required_Id] IS NOT NULL AND [t1].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t1].[Id] END = CASE - WHEN ([t0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t0].[Level1_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t0].[Id] -END OR ((CASE - WHEN ([t1].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t1].[Level1_Required_Id] IS NOT NULL) AND ([t1].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t1].[Id] -END IS NULL) AND (CASE - WHEN ([t0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t0].[Level1_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t0].[Id] -END IS NULL)) + WHEN [t0].[OneToOne_Required_PK_Date] IS NOT NULL AND [t0].[Level1_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t0].[Id] +END OR (CASE + WHEN [t1].[OneToOne_Required_PK_Date] IS NOT NULL AND [t1].[Level1_Required_Id] IS NOT NULL AND [t1].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t1].[Id] +END IS NULL AND CASE + WHEN [t0].[OneToOne_Required_PK_Date] IS NOT NULL AND [t0].[Level1_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t0].[Id] +END IS NULL) """); } @@ -3371,28 +3371,28 @@ FROM [Level1] AS [l] LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Required_Id], [l0].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l0] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] ON [l].[Id] = CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] END LEFT JOIN ( SELECT [l1].[Id], [l1].[Level2_Required_Id], [l1].[OneToMany_Required_Inverse3Id] FROM [Level1] AS [l1] - WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse3Id] IS NOT NULL) + WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL ) AS [t0] ON CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] END = CASE - WHEN ([t0].[Level2_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [t0].[Id] + WHEN [t0].[Level2_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [t0].[Id] END LEFT JOIN ( SELECT [l2].[Id], [l2].[OneToOne_Required_PK_Date], [l2].[Level1_Required_Id], [l2].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l2] - WHERE ([l2].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l2].[Level1_Required_Id] IS NOT NULL) AND ([l2].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l2].[OneToOne_Required_PK_Date] IS NOT NULL AND [l2].[Level1_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t1] ON [t0].[Level2_Required_Id] = CASE - WHEN ([t1].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t1].[Level1_Required_Id] IS NOT NULL) AND ([t1].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t1].[Id] + WHEN [t1].[OneToOne_Required_PK_Date] IS NOT NULL AND [t1].[Level1_Required_Id] IS NOT NULL AND [t1].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t1].[Id] END LEFT JOIN [Level1] AS [l3] ON [t1].[Level1_Required_Id] = [l3].[Id] -WHERE ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) AND ([t0].[Level2_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse3Id] IS NOT NULL) +WHERE [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL AND [t0].[Level2_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse3Id] IS NOT NULL """); } @@ -3407,14 +3407,14 @@ FROM [Level1] AS [l] LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[Level2_Name], [l0].[OneToMany_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id] FROM [Level1] AS [l0] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] ON [l].[Id] = [t].[Level1_Optional_Id] LEFT JOIN ( SELECT [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Level3_Name], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[OneToOne_Optional_PK_Inverse3Id] FROM [Level1] AS [l1] - WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse3Id] IS NOT NULL) + WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL ) AS [t0] ON CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] END = [t0].[Level2_Optional_Id] """); } @@ -3426,13 +3426,13 @@ public override async Task Join_navigation_in_outer_selector_translated_to_extra AssertSql( """ SELECT [l].[Id] AS [Id1], CASE - WHEN ([t0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t0].[Level1_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t0].[Id0] + WHEN [t0].[OneToOne_Required_PK_Date] IS NOT NULL AND [t0].[Level1_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t0].[Id0] END AS [Id2] FROM [Level1] AS [l] LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l0] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] ON [l].[Id] = [t].[Level1_Optional_Id] INNER JOIN ( SELECT [t1].[Id] AS [Id0], [t1].[OneToOne_Required_PK_Date], [t1].[Level1_Required_Id], [t1].[OneToMany_Required_Inverse2Id] @@ -3440,15 +3440,15 @@ FROM [Level1] AS [l1] LEFT JOIN ( SELECT [l2].[Id], [l2].[OneToOne_Required_PK_Date], [l2].[Level1_Required_Id], [l2].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l2] - WHERE ([l2].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l2].[Level1_Required_Id] IS NOT NULL) AND ([l2].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l2].[OneToOne_Required_PK_Date] IS NOT NULL AND [l2].[Level1_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t1] ON [l1].[Id] = CASE - WHEN ([t1].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t1].[Level1_Required_Id] IS NOT NULL) AND ([t1].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t1].[Id] + WHEN [t1].[OneToOne_Required_PK_Date] IS NOT NULL AND [t1].[Level1_Required_Id] IS NOT NULL AND [t1].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t1].[Id] END - WHERE ([t1].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t1].[Level1_Required_Id] IS NOT NULL) AND ([t1].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [t1].[OneToOne_Required_PK_Date] IS NOT NULL AND [t1].[Level1_Required_Id] IS NOT NULL AND [t1].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t0] ON CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] END = CASE - WHEN ([t0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t0].[Level1_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t0].[Id0] + WHEN [t0].[OneToOne_Required_PK_Date] IS NOT NULL AND [t0].[Level1_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t0].[Id0] END """); } @@ -3464,16 +3464,16 @@ FROM [Level1] AS [l] LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l0] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] ON [l].[Id] = [t].[Level1_Optional_Id] LEFT JOIN ( SELECT [l1].[Level2_Optional_Id], [l1].[Level3_Name] FROM [Level1] AS [l1] - WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse3Id] IS NOT NULL) + WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL ) AS [t0] ON CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] END = [t0].[Level2_Optional_Id] -WHERE [t0].[Level3_Name] <> N'L3 05' OR ([t0].[Level3_Name] IS NULL) +WHERE [t0].[Level3_Name] <> N'L3 05' OR [t0].[Level3_Name] IS NULL """); } @@ -3488,7 +3488,7 @@ FROM [Level1] AS [l] LEFT JOIN ( SELECT [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id] FROM [Level1] AS [l0] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] ON [l].[Id] = [t].[Level1_Optional_Id] """); } @@ -3504,10 +3504,10 @@ FROM [Level1] AS [l] LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Required_Id], [l0].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l0] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] ON [l].[Id] = [t].[Level1_Required_Id] WHERE CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] END = 7 """); } @@ -3530,13 +3530,13 @@ FROM [Level1] AS [l0] LEFT JOIN ( SELECT [l1].[Id], [l1].[OneToOne_Required_PK_Date], [l1].[Level1_Optional_Id], [l1].[Level1_Required_Id], [l1].[Level2_Name], [l1].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l1] - WHERE ([l1].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l1].[Level1_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l1].[OneToOne_Required_PK_Date] IS NOT NULL AND [l1].[Level1_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] ON [l0].[Id] = CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] END - WHERE ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t0] ON [l].[Id] = [t0].[Level1_Optional_Id] - WHERE [t0].[Level2_Name] <> N'Foo' OR ([t0].[Level2_Name] IS NULL) + WHERE [t0].[Level2_Name] <> N'Foo' OR [t0].[Level2_Name] IS NULL ) AS [t1] ORDER BY [t1].[Id] """); @@ -3553,14 +3553,14 @@ FROM [Level1] AS [l] INNER JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[Level2_Name], [l0].[OneToMany_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id] FROM [Level1] AS [l0] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] ON [l].[Id] = [t].[OneToMany_Optional_Inverse2Id] LEFT JOIN ( SELECT [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Level3_Name], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[OneToOne_Optional_PK_Inverse3Id] FROM [Level1] AS [l1] - WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse3Id] IS NOT NULL) + WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL ) AS [t0] ON CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] END = [t0].[Level2_Required_Id] """); } @@ -3576,14 +3576,14 @@ FROM [Level1] AS [l] LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Required_Id], [l0].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l0] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] ON [l].[Id] = [t].[Level1_Required_Id] INNER JOIN ( SELECT [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Level3_Name], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[OneToOne_Optional_PK_Inverse3Id] FROM [Level1] AS [l1] - WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse3Id] IS NOT NULL) + WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL ) AS [t0] ON CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] END = [t0].[OneToMany_Optional_Inverse3Id] """); } @@ -3599,10 +3599,10 @@ FROM [Level1] AS [l] LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Required_Id], [l0].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l0] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] ON [l].[Id] = [t].[Level1_Required_Id] WHERE CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] END > 7 """); } @@ -3618,7 +3618,7 @@ FROM [Level1] AS [l] LEFT JOIN ( SELECT [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id] FROM [Level1] AS [l0] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] ON [l].[Id] = [t].[Level1_Optional_Id] WHERE DATEADD(day, CAST(10.0E0 AS int), [t].[OneToOne_Required_PK_Date]) > '2000-02-01T00:00:00.0000000' """); @@ -3635,14 +3635,14 @@ FROM [Level1] AS [l] LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[Level2_Name], [l0].[OneToMany_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id] FROM [Level1] AS [l0] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] ON [l].[Id] = [t].[Level1_Optional_Id] LEFT JOIN ( SELECT [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Level3_Name], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[OneToOne_Optional_PK_Inverse3Id] FROM [Level1] AS [l1] - WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse3Id] IS NOT NULL) + WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL ) AS [t0] ON CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] END = [t0].[OneToOne_Optional_PK_Inverse3Id] """); } @@ -3661,13 +3661,13 @@ FROM [Level1] AS [l0] LEFT JOIN ( SELECT [l1].[Id], [l1].[OneToOne_Required_PK_Date], [l1].[Level1_Optional_Id], [l1].[Level1_Required_Id], [l1].[Level2_Name], [l1].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l1] - WHERE ([l1].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l1].[Level1_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l1].[OneToOne_Required_PK_Date] IS NOT NULL AND [l1].[Level1_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] ON [l0].[Id] = CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] END - WHERE ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t0] ON [l].[Id] = [t0].[Level1_Optional_Id] -WHERE [t0].[Level2_Name] <> N'Foo' OR ([t0].[Level2_Name] IS NULL) +WHERE [t0].[Level2_Name] <> N'Foo' OR [t0].[Level2_Name] IS NULL """); } @@ -3686,14 +3686,14 @@ FROM [Level1] AS [l] LEFT JOIN ( SELECT [l0].[Level1_Required_Id], [l0].[Level2_Name] FROM [Level1] AS [l0] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] ON [l].[Id] = [t].[Level1_Required_Id] ORDER BY [t].[Level2_Name] ) AS [t0] LEFT JOIN ( SELECT [l1].[Id], [l1].[OneToOne_Required_PK_Date], [l1].[Level1_Optional_Id], [l1].[Level1_Required_Id], [l1].[Level2_Name], [l1].[OneToMany_Optional_Inverse2Id], [l1].[OneToMany_Required_Inverse2Id], [l1].[OneToOne_Optional_PK_Inverse2Id] FROM [Level1] AS [l1] - WHERE ([l1].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l1].[Level1_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l1].[OneToOne_Required_PK_Date] IS NOT NULL AND [l1].[Level1_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t1] ON [t0].[Id] = [t1].[Level1_Optional_Id] ORDER BY [t0].[Level2_Name] """); @@ -3706,16 +3706,16 @@ public override async Task Optional_navigation_projected_into_DTO(bool async) AssertSql( """ SELECT [l].[Id], [l].[Name], CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN CAST(1 AS bit) + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN CAST(1 AS bit) ELSE CAST(0 AS bit) END, CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] END, [t].[Level2_Name] FROM [Level1] AS [l] LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[Level2_Name], [l0].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l0] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] ON [l].[Id] = [t].[Level1_Optional_Id] """); } @@ -3727,24 +3727,24 @@ public override async Task Join_navigation_nested2(bool async) AssertSql( """ SELECT CASE - WHEN ([t0].[Level2_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [t0].[Id] + WHEN [t0].[Level2_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [t0].[Id] END AS [Id3], [t1].[Id] AS [Id1] FROM [Level1] AS [l] LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Required_Id], [l0].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l0] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] ON [l].[Id] = CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] END LEFT JOIN ( SELECT [l1].[Id], [l1].[Level2_Required_Id], [l1].[OneToMany_Required_Inverse3Id] FROM [Level1] AS [l1] - WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse3Id] IS NOT NULL) + WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL ) AS [t0] ON CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] END = CASE - WHEN ([t0].[Level2_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [t0].[Id] + WHEN [t0].[Level2_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [t0].[Id] END INNER JOIN ( SELECT [l2].[Id], [t3].[Id] AS [Id1], [t3].[Level2_Required_Id], [t3].[OneToMany_Required_Inverse3Id] @@ -3752,21 +3752,21 @@ FROM [Level1] AS [l2] LEFT JOIN ( SELECT [l3].[Id], [l3].[OneToOne_Required_PK_Date], [l3].[Level1_Required_Id], [l3].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l3] - WHERE ([l3].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l3].[Level1_Required_Id] IS NOT NULL) AND ([l3].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l3].[OneToOne_Required_PK_Date] IS NOT NULL AND [l3].[Level1_Required_Id] IS NOT NULL AND [l3].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t2] ON [l2].[Id] = [t2].[Level1_Required_Id] LEFT JOIN ( SELECT [l4].[Id], [l4].[Level2_Optional_Id], [l4].[Level2_Required_Id], [l4].[OneToMany_Required_Inverse3Id] FROM [Level1] AS [l4] - WHERE ([l4].[Level2_Required_Id] IS NOT NULL) AND ([l4].[OneToMany_Required_Inverse3Id] IS NOT NULL) + WHERE [l4].[Level2_Required_Id] IS NOT NULL AND [l4].[OneToMany_Required_Inverse3Id] IS NOT NULL ) AS [t3] ON CASE - WHEN ([t2].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t2].[Level1_Required_Id] IS NOT NULL) AND ([t2].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t2].[Id] + WHEN [t2].[OneToOne_Required_PK_Date] IS NOT NULL AND [t2].[Level1_Required_Id] IS NOT NULL AND [t2].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t2].[Id] END = [t3].[Level2_Optional_Id] ) AS [t1] ON CASE - WHEN ([t0].[Level2_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [t0].[Id] + WHEN [t0].[Level2_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [t0].[Id] END = CASE - WHEN ([t1].[Level2_Required_Id] IS NOT NULL) AND ([t1].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [t1].[Id1] + WHEN [t1].[Level2_Required_Id] IS NOT NULL AND [t1].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [t1].[Id1] END -WHERE ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) AND ([t0].[Level2_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse3Id] IS NOT NULL) +WHERE [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL AND [t0].[Level2_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse3Id] IS NOT NULL """); } @@ -3781,10 +3781,10 @@ FROM [Level1] AS [l] LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Required_Id], [l0].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l0] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] ON [l].[Id] = [t].[Level1_Required_Id] WHERE CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] END = 7 """); } @@ -3796,18 +3796,18 @@ public override async Task Navigation_key_access_optional_comparison(bool async) AssertSql( """ SELECT CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] END FROM [Level1] AS [l] LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Required_Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id] FROM [Level1] AS [l0] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] ON [l].[Id] = CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] END LEFT JOIN [Level1] AS [l1] ON [t].[OneToOne_Optional_PK_Inverse2Id] = [l1].[Id] -WHERE ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) AND [l1].[Id] > 5 +WHERE [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL AND [l1].[Id] > 5 """); } @@ -3822,7 +3822,7 @@ FROM [Level1] AS [l] INNER JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[Level2_Name], [l0].[OneToMany_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id] FROM [Level1] AS [l0] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] ON [l].[Id] = [t].[OneToMany_Optional_Inverse2Id] """); } @@ -3834,15 +3834,15 @@ public override async Task Join_with_orderby_on_inner_sequence_navigation_non_ke AssertSql( """ SELECT CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] END AS [Id2], [t].[Level2_Name] AS [Name2], [t0].[Id] AS [Id1], [t0].[Name] AS [Name1] FROM [Level1] AS [l] LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Required_Id], [l0].[Level2_Name], [l0].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l0] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] ON [l].[Id] = CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] END INNER JOIN ( SELECT [l1].[Id], [l1].[Name], [t1].[Level2_Name] @@ -3850,10 +3850,10 @@ FROM [Level1] AS [l1] LEFT JOIN ( SELECT [l2].[Level1_Optional_Id], [l2].[Level2_Name] FROM [Level1] AS [l2] - WHERE ([l2].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l2].[Level1_Required_Id] IS NOT NULL) AND ([l2].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l2].[OneToOne_Required_PK_Date] IS NOT NULL AND [l2].[Level1_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t1] ON [l1].[Id] = [t1].[Level1_Optional_Id] ) AS [t0] ON [t].[Level2_Name] = [t0].[Level2_Name] -WHERE ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) +WHERE [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL """); } @@ -3864,7 +3864,7 @@ public override async Task Correlated_subquery_doesnt_project_unnecessary_column AssertSql( """ SELECT [l].[Name] AS [Name1], CASE - WHEN ([t0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t0].[Level1_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t0].[Id0] + WHEN [t0].[OneToOne_Required_PK_Date] IS NOT NULL AND [t0].[Level1_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t0].[Id0] END AS [Id2] FROM [Level1] AS [l] INNER JOIN ( @@ -3873,12 +3873,12 @@ FROM [Level1] AS [l0] LEFT JOIN ( SELECT [l2].[Id], [l2].[OneToOne_Required_PK_Date], [l2].[Level1_Optional_Id], [l2].[Level1_Required_Id], [l2].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l2] - WHERE ([l2].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l2].[Level1_Required_Id] IS NOT NULL) AND ([l2].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l2].[OneToOne_Required_PK_Date] IS NOT NULL AND [l2].[Level1_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] ON [l0].[Id] = CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] END LEFT JOIN [Level1] AS [l1] ON [t].[Level1_Optional_Id] = [l1].[Id] - WHERE ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t0] ON [l].[Id] = [t0].[Id1] WHERE EXISTS ( SELECT 1 @@ -3886,11 +3886,11 @@ FROM [Level1] AS [l3] LEFT JOIN ( SELECT [l4].[Id], [l4].[OneToOne_Required_PK_Date], [l4].[Level1_Optional_Id], [l4].[Level1_Required_Id], [l4].[Level2_Name], [l4].[OneToMany_Optional_Inverse2Id], [l4].[OneToMany_Required_Inverse2Id], [l4].[OneToOne_Optional_PK_Inverse2Id] FROM [Level1] AS [l4] - WHERE ([l4].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l4].[Level1_Required_Id] IS NOT NULL) AND ([l4].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l4].[OneToOne_Required_PK_Date] IS NOT NULL AND [l4].[Level1_Required_Id] IS NOT NULL AND [l4].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t1] ON [l3].[Id] = CASE - WHEN ([t1].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t1].[Level1_Required_Id] IS NOT NULL) AND ([t1].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t1].[Id] + WHEN [t1].[OneToOne_Required_PK_Date] IS NOT NULL AND [t1].[Level1_Required_Id] IS NOT NULL AND [t1].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t1].[Id] END - WHERE ([t1].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t1].[Level1_Required_Id] IS NOT NULL) AND ([t1].[OneToMany_Required_Inverse2Id] IS NOT NULL) AND [t1].[Level1_Required_Id] = [l].[Id]) + WHERE [t1].[OneToOne_Required_PK_Date] IS NOT NULL AND [t1].[Level1_Required_Id] IS NOT NULL AND [t1].[OneToMany_Required_Inverse2Id] IS NOT NULL AND [t1].[Level1_Required_Id] = [l].[Id]) """); } @@ -3905,7 +3905,7 @@ FROM [Level1] AS [l] INNER JOIN ( SELECT [l0].[Level2_Name], [l0].[OneToMany_Optional_Inverse2Id] FROM [Level1] AS [l0] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] ON [l].[Id] = [t].[OneToMany_Optional_Inverse2Id] """); } @@ -3921,30 +3921,30 @@ FROM [Level1] AS [l] LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Required_Id], [l0].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l0] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] ON [l].[Id] = CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] END LEFT JOIN ( SELECT [l1].[Id], [l1].[Level2_Required_Id], [l1].[OneToMany_Required_Inverse3Id] FROM [Level1] AS [l1] - WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse3Id] IS NOT NULL) + WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL ) AS [t0] ON CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] END = CASE - WHEN ([t0].[Level2_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [t0].[Id] + WHEN [t0].[Level2_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [t0].[Id] END LEFT JOIN ( SELECT [l2].[Id], [l2].[OneToOne_Required_PK_Date], [l2].[Level1_Required_Id], [l2].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l2] - WHERE ([l2].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l2].[Level1_Required_Id] IS NOT NULL) AND ([l2].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l2].[OneToOne_Required_PK_Date] IS NOT NULL AND [l2].[Level1_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t1] ON [t0].[Level2_Required_Id] = CASE - WHEN ([t1].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t1].[Level1_Required_Id] IS NOT NULL) AND ([t1].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t1].[Id] + WHEN [t1].[OneToOne_Required_PK_Date] IS NOT NULL AND [t1].[Level1_Required_Id] IS NOT NULL AND [t1].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t1].[Id] END LEFT JOIN [Level1] AS [l3] ON [t1].[Level1_Required_Id] = [l3].[Id] -WHERE ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) AND ([t0].[Level2_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse3Id] IS NOT NULL) +WHERE [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL AND [t0].[Level2_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse3Id] IS NOT NULL ORDER BY CASE - WHEN ([t1].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t1].[Level1_Required_Id] IS NOT NULL) AND ([t1].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t1].[Id] + WHEN [t1].[OneToOne_Required_PK_Date] IS NOT NULL AND [t1].[Level1_Required_Id] IS NOT NULL AND [t1].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t1].[Id] END """); } @@ -3960,13 +3960,13 @@ FROM [Level1] AS [l] LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Required_Id], [l0].[Level2_Name], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id] FROM [Level1] AS [l0] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] ON [l].[Id] = CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] END LEFT JOIN [Level1] AS [l1] ON [t].[OneToMany_Required_Inverse2Id] = [l1].[Id] LEFT JOIN [Level1] AS [l2] ON [t].[OneToOne_Optional_PK_Inverse2Id] = [l2].[Id] -WHERE ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) AND ([l1].[Id] = [l2].[Id] OR (([l1].[Id] IS NULL) AND ([l2].[Id] IS NULL))) +WHERE [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL AND ([l1].[Id] = [l2].[Id] OR ([l1].[Id] IS NULL AND [l2].[Id] IS NULL)) """); } @@ -3981,9 +3981,9 @@ FROM [Level1] AS [l] LEFT JOIN ( SELECT [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Required_Id], [l0].[OneToMany_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l0] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] ON [l].[Id] = [t].[OneToMany_Optional_Inverse2Id] -WHERE ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) +WHERE [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL """); } @@ -4007,11 +4007,11 @@ FROM [Level1] AS [l1] LEFT JOIN ( SELECT [l2].[Id], [l2].[OneToOne_Required_PK_Date], [l2].[Level1_Optional_Id], [l2].[Level1_Required_Id], [l2].[Level2_Name], [l2].[OneToMany_Optional_Inverse2Id], [l2].[OneToMany_Required_Inverse2Id], [l2].[OneToOne_Optional_PK_Inverse2Id] FROM [Level1] AS [l2] - WHERE ([l2].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l2].[Level1_Required_Id] IS NOT NULL) AND ([l2].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l2].[OneToOne_Required_PK_Date] IS NOT NULL AND [l2].[Level1_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] ON [l1].[Id] = CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] END - WHERE ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t0] ON [l0].[Id] = [t0].[Level1_Optional_Id] ) AS [t1]) > 4 """); @@ -4028,29 +4028,29 @@ FROM [Level1] AS [l] LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Required_Id], [l0].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l0] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] ON [l].[Id] = CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] END LEFT JOIN ( SELECT [l1].[Id], [l1].[Level2_Required_Id], [l1].[OneToMany_Required_Inverse3Id] FROM [Level1] AS [l1] - WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse3Id] IS NOT NULL) + WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL ) AS [t0] ON CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] END = CASE - WHEN ([t0].[Level2_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [t0].[Id] + WHEN [t0].[Level2_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [t0].[Id] END LEFT JOIN ( SELECT [l2].[Id], [l2].[OneToOne_Required_PK_Date], [l2].[Level1_Optional_Id], [l2].[Level1_Required_Id], [l2].[Level2_Name], [l2].[OneToMany_Optional_Inverse2Id], [l2].[OneToMany_Required_Inverse2Id], [l2].[OneToOne_Optional_PK_Inverse2Id] FROM [Level1] AS [l2] - WHERE ([l2].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l2].[Level1_Required_Id] IS NOT NULL) AND ([l2].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l2].[OneToOne_Required_PK_Date] IS NOT NULL AND [l2].[Level1_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t1] ON [t0].[Level2_Required_Id] = CASE - WHEN ([t1].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t1].[Level1_Required_Id] IS NOT NULL) AND ([t1].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t1].[Id] + WHEN [t1].[OneToOne_Required_PK_Date] IS NOT NULL AND [t1].[Level1_Required_Id] IS NOT NULL AND [t1].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t1].[Id] END -WHERE ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) AND ([t0].[Level2_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse3Id] IS NOT NULL) +WHERE [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL AND [t0].[Level2_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse3Id] IS NOT NULL ORDER BY CASE - WHEN ([t1].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t1].[Level1_Required_Id] IS NOT NULL) AND ([t1].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t1].[Id] + WHEN [t1].[OneToOne_Required_PK_Date] IS NOT NULL AND [t1].[Level1_Required_Id] IS NOT NULL AND [t1].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t1].[Id] END """); } @@ -4066,21 +4066,21 @@ FROM [Level1] AS [l] INNER JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[Level2_Name], [l0].[OneToMany_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id] FROM [Level1] AS [l0] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] ON [l].[Id] = [t].[OneToMany_Optional_Inverse2Id] LEFT JOIN ( SELECT [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Level3_Name], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[OneToOne_Optional_PK_Inverse3Id] FROM [Level1] AS [l1] - WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse3Id] IS NOT NULL) + WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL ) AS [t0] ON CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] END = [t0].[Level2_Required_Id] LEFT JOIN ( SELECT [l2].[Id], [l2].[Level3_Optional_Id], [l2].[Level3_Required_Id], [l2].[Level4_Name], [l2].[OneToMany_Optional_Inverse4Id], [l2].[OneToMany_Required_Inverse4Id], [l2].[OneToOne_Optional_PK_Inverse4Id] FROM [Level1] AS [l2] - WHERE ([l2].[Level3_Required_Id] IS NOT NULL) AND ([l2].[OneToMany_Required_Inverse4Id] IS NOT NULL) + WHERE [l2].[Level3_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse4Id] IS NOT NULL ) AS [t1] ON CASE - WHEN ([t0].[Level2_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [t0].[Id] + WHEN [t0].[Level2_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [t0].[Id] END = [t1].[Level3_Required_Id] """); } @@ -4096,9 +4096,9 @@ FROM [Level1] AS [l] LEFT JOIN ( SELECT [l0].[Level1_Optional_Id], [l0].[Level2_Name] FROM [Level1] AS [l0] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] ON [l].[Id] = [t].[Level1_Optional_Id] -WHERE [t].[Level2_Name] = N'' OR (([t].[Level2_Name] IS NOT NULL) AND LEFT([t].[Level2_Name], LEN([t].[Level2_Name])) = [t].[Level2_Name]) +WHERE [t].[Level2_Name] = N'' OR ([t].[Level2_Name] IS NOT NULL AND LEFT([t].[Level2_Name], LEN([t].[Level2_Name])) = [t].[Level2_Name]) """); } @@ -4115,7 +4115,7 @@ FROM [Level1] AS [l] INNER JOIN ( SELECT [l0].[Level2_Name] AS [Name], [l0].[OneToMany_Optional_Inverse2Id] FROM [Level1] AS [l0] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] ON [l].[Id] = [t].[OneToMany_Optional_Inverse2Id] ORDER BY [l].[Id] """); @@ -4135,16 +4135,16 @@ FROM [Level1] AS [l0] LEFT JOIN ( SELECT [l1].[Id], [l1].[OneToOne_Required_PK_Date], [l1].[Level1_Optional_Id], [l1].[Level1_Required_Id], [l1].[Level2_Name], [l1].[OneToMany_Optional_Inverse2Id], [l1].[OneToMany_Required_Inverse2Id], [l1].[OneToOne_Optional_PK_Inverse2Id] FROM [Level1] AS [l1] - WHERE ([l1].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l1].[Level1_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l1].[OneToOne_Required_PK_Date] IS NOT NULL AND [l1].[Level1_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] ON [l0].[Id] = CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] END - WHERE ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t0] ON [l].[Id] = [t0].[Level1_Required_Id] LEFT JOIN ( SELECT [l2].[Id], [l2].[OneToOne_Required_PK_Date], [l2].[Level1_Optional_Id], [l2].[Level1_Required_Id], [l2].[Level2_Name], [l2].[OneToMany_Optional_Inverse2Id], [l2].[OneToMany_Required_Inverse2Id], [l2].[OneToOne_Optional_PK_Inverse2Id] FROM [Level1] AS [l2] - WHERE ([l2].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l2].[Level1_Required_Id] IS NOT NULL) AND ([l2].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l2].[OneToOne_Required_PK_Date] IS NOT NULL AND [l2].[Level1_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t1] ON [l].[Id] = [t1].[Level1_Optional_Id] """); } @@ -4179,12 +4179,12 @@ FROM [Level1] AS [l] LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[Level2_Name], [l0].[OneToMany_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id] FROM [Level1] AS [l0] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] ON [l].[Id] = CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] END LEFT JOIN [Level1] AS [l1] ON [t].[Level1_Required_Id] = [l1].[Id] -WHERE ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) AND [l1].[Id] = 1 +WHERE [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL AND [l1].[Id] = 1 """); } @@ -4199,33 +4199,33 @@ FROM [Level1] AS [l] LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[Level2_Name], [l0].[OneToMany_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id] FROM [Level1] AS [l0] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] ON [l].[Id] = [t].[Level1_Optional_Id] LEFT JOIN ( SELECT [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Level3_Name], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[OneToOne_Optional_PK_Inverse3Id] FROM [Level1] AS [l1] - WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse3Id] IS NOT NULL) + WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL ) AS [t0] ON CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] END = [t0].[OneToOne_Optional_PK_Inverse3Id] LEFT JOIN ( SELECT [l2].[Id], [l2].[OneToOne_Required_PK_Date], [l2].[Level1_Optional_Id], [l2].[Level1_Required_Id], [l2].[Level2_Name], [l2].[OneToMany_Optional_Inverse2Id], [l2].[OneToMany_Required_Inverse2Id], [l2].[OneToOne_Optional_PK_Inverse2Id] FROM [Level1] AS [l2] - WHERE ([l2].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l2].[Level1_Required_Id] IS NOT NULL) AND ([l2].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l2].[OneToOne_Required_PK_Date] IS NOT NULL AND [l2].[Level1_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t1] ON [l].[Id] = [t1].[OneToOne_Optional_PK_Inverse2Id] LEFT JOIN ( SELECT [l3].[Id], [l3].[Level2_Optional_Id], [l3].[Level2_Required_Id], [l3].[Level3_Name], [l3].[OneToMany_Optional_Inverse3Id], [l3].[OneToMany_Required_Inverse3Id], [l3].[OneToOne_Optional_PK_Inverse3Id] FROM [Level1] AS [l3] - WHERE ([l3].[Level2_Required_Id] IS NOT NULL) AND ([l3].[OneToMany_Required_Inverse3Id] IS NOT NULL) + WHERE [l3].[Level2_Required_Id] IS NOT NULL AND [l3].[OneToMany_Required_Inverse3Id] IS NOT NULL ) AS [t2] ON CASE - WHEN ([t1].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t1].[Level1_Required_Id] IS NOT NULL) AND ([t1].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t1].[Id] + WHEN [t1].[OneToOne_Required_PK_Date] IS NOT NULL AND [t1].[Level1_Required_Id] IS NOT NULL AND [t1].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t1].[Id] END = [t2].[Level2_Optional_Id] LEFT JOIN ( SELECT [l4].[Id], [l4].[Level3_Optional_Id], [l4].[Level3_Required_Id], [l4].[Level4_Name], [l4].[OneToMany_Optional_Inverse4Id], [l4].[OneToMany_Required_Inverse4Id], [l4].[OneToOne_Optional_PK_Inverse4Id] FROM [Level1] AS [l4] - WHERE ([l4].[Level3_Required_Id] IS NOT NULL) AND ([l4].[OneToMany_Required_Inverse4Id] IS NOT NULL) + WHERE [l4].[Level3_Required_Id] IS NOT NULL AND [l4].[OneToMany_Required_Inverse4Id] IS NOT NULL ) AS [t3] ON CASE - WHEN ([t2].[Level2_Required_Id] IS NOT NULL) AND ([t2].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [t2].[Id] + WHEN [t2].[Level2_Required_Id] IS NOT NULL AND [t2].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [t2].[Id] END = [t3].[OneToOne_Optional_PK_Inverse4Id] """); } @@ -4241,15 +4241,15 @@ FROM [Level1] AS [l] LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[Level2_Name], [l0].[OneToMany_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id] FROM [Level1] AS [l0] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] ON [l].[Id] = CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] END LEFT JOIN [Level1] AS [l1] ON [t].[OneToMany_Required_Inverse2Id] = [l1].[Id] -WHERE ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) AND ( +WHERE [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL AND ( SELECT COUNT(*) FROM [Level1] AS [l2] - WHERE ([l2].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l2].[Level1_Required_Id] IS NOT NULL) AND ([l2].[OneToMany_Required_Inverse2Id] IS NOT NULL) AND ([l1].[Id] IS NOT NULL) AND [l1].[Id] = [l2].[OneToMany_Optional_Inverse2Id]) > 0 + WHERE [l2].[OneToOne_Required_PK_Date] IS NOT NULL AND [l2].[Level1_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse2Id] IS NOT NULL AND [l1].[Id] IS NOT NULL AND [l1].[Id] = [l2].[OneToMany_Optional_Inverse2Id]) > 0 """); } @@ -4264,28 +4264,28 @@ FROM [Level1] AS [l] LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Required_Id], [l0].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l0] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] ON [l].[Id] = CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] END LEFT JOIN ( SELECT [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Level3_Name], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[OneToOne_Optional_PK_Inverse3Id] FROM [Level1] AS [l1] - WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse3Id] IS NOT NULL) + WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL ) AS [t0] ON CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] END = CASE - WHEN ([t0].[Level2_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [t0].[Id] + WHEN [t0].[Level2_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [t0].[Id] END LEFT JOIN ( SELECT [l2].[Id], [l2].[OneToOne_Required_PK_Date], [l2].[Level1_Optional_Id], [l2].[Level1_Required_Id], [l2].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l2] - WHERE ([l2].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l2].[Level1_Required_Id] IS NOT NULL) AND ([l2].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l2].[OneToOne_Required_PK_Date] IS NOT NULL AND [l2].[Level1_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t1] ON [t0].[Level2_Optional_Id] = CASE - WHEN ([t1].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t1].[Level1_Required_Id] IS NOT NULL) AND ([t1].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t1].[Id] + WHEN [t1].[OneToOne_Required_PK_Date] IS NOT NULL AND [t1].[Level1_Required_Id] IS NOT NULL AND [t1].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t1].[Id] END LEFT JOIN [Level1] AS [l3] ON [t1].[Level1_Optional_Id] = [l3].[Id] -WHERE ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) AND ([t0].[Level2_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse3Id] IS NOT NULL) AND ([l3].[Id] IS NULL) +WHERE [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL AND [t0].[Level2_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse3Id] IS NOT NULL AND [l3].[Id] IS NULL """); } @@ -4300,13 +4300,13 @@ FROM [Level1] AS [l] INNER JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[Level2_Name], [l0].[OneToMany_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id] FROM [Level1] AS [l0] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] ON [l].[Id] = [t].[OneToMany_Optional_Inverse2Id] WHERE CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] -END <> 6 OR (CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] -END IS NULL) + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] +END <> 6 OR CASE + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] +END IS NULL """); } @@ -4324,30 +4324,30 @@ FROM [Level1] AS [l0] LEFT JOIN ( SELECT [l1].[Id], [l1].[OneToOne_Required_PK_Date], [l1].[Level1_Optional_Id], [l1].[Level1_Required_Id], [l1].[Level2_Name], [l1].[OneToMany_Optional_Inverse2Id], [l1].[OneToMany_Required_Inverse2Id], [l1].[OneToOne_Optional_PK_Inverse2Id] FROM [Level1] AS [l1] - WHERE ([l1].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l1].[Level1_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l1].[OneToOne_Required_PK_Date] IS NOT NULL AND [l1].[Level1_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] ON [l0].[Id] = CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] END - WHERE ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) AND EXISTS ( + WHERE [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL AND EXISTS ( SELECT 1 FROM [Level1] AS [l2] LEFT JOIN ( SELECT [l3].[Id], [l3].[OneToOne_Required_PK_Date], [l3].[Level1_Optional_Id], [l3].[Level1_Required_Id], [l3].[Level2_Name], [l3].[OneToMany_Optional_Inverse2Id], [l3].[OneToMany_Required_Inverse2Id], [l3].[OneToOne_Optional_PK_Inverse2Id] FROM [Level1] AS [l3] - WHERE ([l3].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l3].[Level1_Required_Id] IS NOT NULL) AND ([l3].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l3].[OneToOne_Required_PK_Date] IS NOT NULL AND [l3].[Level1_Required_Id] IS NOT NULL AND [l3].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t0] ON [l2].[Id] = CASE - WHEN ([t0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t0].[Level1_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t0].[Id] + WHEN [t0].[OneToOne_Required_PK_Date] IS NOT NULL AND [t0].[Level1_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t0].[Id] END LEFT JOIN ( SELECT [l4].[Id], [l4].[Level2_Optional_Id], [l4].[Level2_Required_Id], [l4].[Level3_Name], [l4].[OneToMany_Optional_Inverse3Id], [l4].[OneToMany_Required_Inverse3Id], [l4].[OneToOne_Optional_PK_Inverse3Id] FROM [Level1] AS [l4] - WHERE ([l4].[Level2_Required_Id] IS NOT NULL) AND ([l4].[OneToMany_Required_Inverse3Id] IS NOT NULL) + WHERE [l4].[Level2_Required_Id] IS NOT NULL AND [l4].[OneToMany_Required_Inverse3Id] IS NOT NULL ) AS [t1] ON CASE - WHEN ([t0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t0].[Level1_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t0].[Id] + WHEN [t0].[OneToOne_Required_PK_Date] IS NOT NULL AND [t0].[Level1_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t0].[Id] END = CASE - WHEN ([t1].[Level2_Required_Id] IS NOT NULL) AND ([t1].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [t1].[Id] + WHEN [t1].[Level2_Required_Id] IS NOT NULL AND [t1].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [t1].[Id] END - WHERE ([t0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t0].[Level1_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse2Id] IS NOT NULL) AND ([t1].[Level2_Required_Id] IS NOT NULL) AND ([t1].[OneToMany_Required_Inverse3Id] IS NOT NULL))) + WHERE [t0].[OneToOne_Required_PK_Date] IS NOT NULL AND [t0].[Level1_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse2Id] IS NOT NULL AND [t1].[Level2_Required_Id] IS NOT NULL AND [t1].[OneToMany_Required_Inverse3Id] IS NOT NULL)) """); } @@ -4365,11 +4365,11 @@ FROM [Level1] AS [l0] LEFT JOIN ( SELECT [l1].[Id], [l1].[OneToOne_Required_PK_Date], [l1].[Level1_Optional_Id], [l1].[Level1_Required_Id], [l1].[Level2_Name], [l1].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l1] - WHERE ([l1].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l1].[Level1_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l1].[OneToOne_Required_PK_Date] IS NOT NULL AND [l1].[Level1_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] ON [l0].[Id] = CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] END - WHERE ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t0] ON [l].[Id] = [t0].[Level1_Optional_Id] ORDER BY [t0].[Level2_Name], [l].[Id] """); @@ -4386,16 +4386,16 @@ FROM [Level1] AS [l] LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[Level2_Name], [l0].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l0] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] ON [l].[Id] = [t].[Level1_Optional_Id] LEFT JOIN ( SELECT [l1].[Level2_Required_Id], [l1].[Level3_Name] FROM [Level1] AS [l1] - WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse3Id] IS NOT NULL) + WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL ) AS [t0] ON CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] END = [t0].[Level2_Required_Id] -WHERE [t0].[Level3_Name] = N'L3 05' OR [t].[Level2_Name] <> N'L2 05' OR ([t].[Level2_Name] IS NULL) +WHERE [t0].[Level3_Name] = N'L3 05' OR [t].[Level2_Name] <> N'L2 05' OR [t].[Level2_Name] IS NULL """); } @@ -4410,9 +4410,9 @@ FROM [Level1] AS [l] LEFT JOIN ( SELECT [l0].[Level1_Optional_Id], [l0].[Level2_Name] FROM [Level1] AS [l0] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] ON [l].[Id] = [t].[Level1_Optional_Id] -WHERE ([t].[Level2_Name] IS NOT NULL) AND (UPPER([t].[Level2_Name]) LIKE N'L%') +WHERE [t].[Level2_Name] IS NOT NULL AND UPPER([t].[Level2_Name]) LIKE N'L%' """); } @@ -4427,14 +4427,14 @@ FROM [Level1] AS [l] INNER JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Required_Id], [l0].[OneToMany_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l0] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] ON [l].[Id] = [t].[OneToMany_Optional_Inverse2Id] INNER JOIN ( SELECT [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Level3_Name], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[OneToOne_Optional_PK_Inverse3Id] FROM [Level1] AS [l1] - WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse3Id] IS NOT NULL) + WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL ) AS [t0] ON CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] END = [t0].[OneToMany_Optional_Inverse3Id] """); } @@ -4450,9 +4450,9 @@ FROM [Level1] AS [l] LEFT JOIN ( SELECT [l0].[Level1_Required_Id], [l0].[Level2_Name] FROM [Level1] AS [l0] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] ON [l].[Id] = [t].[Level1_Required_Id] -WHERE ([t].[Level2_Name] IS NOT NULL) AND ([t].[Level2_Name] LIKE N'L%') +WHERE [t].[Level2_Name] IS NOT NULL AND [t].[Level2_Name] LIKE N'L%' """); } @@ -4467,14 +4467,14 @@ FROM [Level1] AS [l] LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[Level2_Name], [l0].[OneToMany_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id] FROM [Level1] AS [l0] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] ON [l].[Id] = [t].[Level1_Optional_Id] LEFT JOIN ( SELECT [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Level3_Name], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[OneToOne_Optional_PK_Inverse3Id] FROM [Level1] AS [l1] - WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse3Id] IS NOT NULL) + WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL ) AS [t0] ON CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] END = [t0].[OneToOne_Optional_PK_Inverse3Id] """); } @@ -4504,27 +4504,27 @@ FROM [Level1] AS [l] LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Required_Id], [l0].[Level2_Name], [l0].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l0] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] ON [l].[Id] = CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] END LEFT JOIN ( SELECT [l1].[Id], [l1].[Level2_Required_Id], [l1].[OneToMany_Required_Inverse3Id] FROM [Level1] AS [l1] - WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse3Id] IS NOT NULL) + WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL ) AS [t0] ON CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] END = [t0].[Level2_Required_Id] -WHERE ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) AND EXISTS ( +WHERE [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL AND EXISTS ( SELECT 1 FROM [Level1] AS [l2] - WHERE ([l2].[Level3_Required_Id] IS NOT NULL) AND ([l2].[OneToMany_Required_Inverse4Id] IS NOT NULL) AND (CASE - WHEN ([t0].[Level2_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [t0].[Id] - END IS NOT NULL) AND (CASE - WHEN ([t0].[Level2_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [t0].[Id] - END = [l2].[OneToMany_Optional_Inverse4Id] OR ((CASE - WHEN ([t0].[Level2_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [t0].[Id] - END IS NULL) AND ([l2].[OneToMany_Optional_Inverse4Id] IS NULL)))) + WHERE [l2].[Level3_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse4Id] IS NOT NULL AND CASE + WHEN [t0].[Level2_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [t0].[Id] + END IS NOT NULL AND (CASE + WHEN [t0].[Level2_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [t0].[Id] + END = [l2].[OneToMany_Optional_Inverse4Id] OR (CASE + WHEN [t0].[Level2_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [t0].[Id] + END IS NULL AND [l2].[OneToMany_Optional_Inverse4Id] IS NULL))) """); } @@ -4539,21 +4539,21 @@ FROM [Level1] AS [l] LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l0] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] ON [l].[Id] = [t].[Level1_Optional_Id] LEFT JOIN ( SELECT [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[OneToMany_Required_Inverse3Id] FROM [Level1] AS [l1] - WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse3Id] IS NOT NULL) + WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL ) AS [t0] ON CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] END = [t0].[Level2_Optional_Id] LEFT JOIN ( SELECT [l2].[Level3_Optional_Id], [l2].[Level4_Name] FROM [Level1] AS [l2] - WHERE ([l2].[Level3_Required_Id] IS NOT NULL) AND ([l2].[OneToMany_Required_Inverse4Id] IS NOT NULL) + WHERE [l2].[Level3_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse4Id] IS NOT NULL ) AS [t1] ON CASE - WHEN ([t0].[Level2_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [t0].[Id] + WHEN [t0].[Level2_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [t0].[Id] END = [t1].[Level3_Optional_Id] WHERE [t1].[Level4_Name] = N'L4 01' """); @@ -4570,15 +4570,15 @@ FROM [Level1] AS [l] INNER JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[Level2_Name], [l0].[OneToMany_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id] FROM [Level1] AS [l0] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] ON [l].[Id] = [t].[OneToMany_Required_Inverse2Id] WHERE EXISTS ( SELECT 1 FROM [Level1] AS [l1] - WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse3Id] IS NOT NULL) AND (CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] - END IS NOT NULL) AND CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] + WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL AND CASE + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + END IS NOT NULL AND CASE + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] END = [l1].[OneToMany_Required_Inverse3Id]) """); } @@ -4594,7 +4594,7 @@ FROM [Level1] AS [l] LEFT JOIN ( SELECT [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id] FROM [Level1] AS [l0] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] ON [l].[Id] = [t].[Level1_Optional_Id] """); } @@ -4606,41 +4606,41 @@ public override async Task Complex_navigations_with_predicate_projected_into_ano AssertSql( """ SELECT [l].[Name], CASE - WHEN ([t1].[Level2_Required_Id] IS NOT NULL) AND ([t1].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [t1].[Id] + WHEN [t1].[Level2_Required_Id] IS NOT NULL AND [t1].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [t1].[Id] END AS [Id] FROM [Level1] AS [l] LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Required_Id], [l0].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l0] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] ON [l].[Id] = [t].[Level1_Required_Id] LEFT JOIN ( SELECT [l1].[Id], [l1].[Level2_Required_Id], [l1].[OneToMany_Required_Inverse3Id] FROM [Level1] AS [l1] - WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse3Id] IS NOT NULL) + WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL ) AS [t0] ON CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] END = [t0].[Level2_Required_Id] LEFT JOIN ( SELECT [l2].[Id], [l2].[Level2_Optional_Id], [l2].[Level2_Required_Id], [l2].[OneToMany_Required_Inverse3Id] FROM [Level1] AS [l2] - WHERE ([l2].[Level2_Required_Id] IS NOT NULL) AND ([l2].[OneToMany_Required_Inverse3Id] IS NOT NULL) + WHERE [l2].[Level2_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse3Id] IS NOT NULL ) AS [t1] ON CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] END = [t1].[Level2_Optional_Id] WHERE (CASE - WHEN ([t0].[Level2_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [t0].[Id] + WHEN [t0].[Level2_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [t0].[Id] END = CASE - WHEN ([t1].[Level2_Required_Id] IS NOT NULL) AND ([t1].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [t1].[Id] -END OR ((CASE - WHEN ([t0].[Level2_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [t0].[Id] -END IS NULL) AND (CASE - WHEN ([t1].[Level2_Required_Id] IS NOT NULL) AND ([t1].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [t1].[Id] -END IS NULL))) AND (CASE - WHEN ([t1].[Level2_Required_Id] IS NOT NULL) AND ([t1].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [t1].[Id] -END <> 7 OR (CASE - WHEN ([t1].[Level2_Required_Id] IS NOT NULL) AND ([t1].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [t1].[Id] -END IS NULL)) + WHEN [t1].[Level2_Required_Id] IS NOT NULL AND [t1].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [t1].[Id] +END OR (CASE + WHEN [t0].[Level2_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [t0].[Id] +END IS NULL AND CASE + WHEN [t1].[Level2_Required_Id] IS NOT NULL AND [t1].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [t1].[Id] +END IS NULL)) AND (CASE + WHEN [t1].[Level2_Required_Id] IS NOT NULL AND [t1].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [t1].[Id] +END <> 7 OR CASE + WHEN [t1].[Level2_Required_Id] IS NOT NULL AND [t1].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [t1].[Id] +END IS NULL) """); } @@ -4658,11 +4658,11 @@ FROM [Level1] AS [l0] LEFT JOIN ( SELECT [l1].[Id], [l1].[OneToOne_Required_PK_Date], [l1].[Level1_Optional_Id], [l1].[Level1_Required_Id], [l1].[Level2_Name], [l1].[OneToMany_Optional_Inverse2Id], [l1].[OneToMany_Required_Inverse2Id], [l1].[OneToOne_Optional_PK_Inverse2Id] FROM [Level1] AS [l1] - WHERE ([l1].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l1].[Level1_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l1].[OneToOne_Required_PK_Date] IS NOT NULL AND [l1].[Level1_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] ON [l0].[Id] = CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] END - WHERE ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t0] ON [l].[Id] = [t0].[Level1_Optional_Id] """); } @@ -4678,12 +4678,12 @@ FROM [Level1] AS [l] LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Required_Id], [l0].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l0] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] ON [l].[Id] = [t].[Level1_Required_Id] WHERE CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] END = 1 OR CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] END = 2 """); } @@ -4695,20 +4695,20 @@ public override async Task Select_multiple_nav_prop_reference_required(bool asyn AssertSql( """ SELECT CASE - WHEN ([t0].[Level2_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [t0].[Id] + WHEN [t0].[Level2_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [t0].[Id] END FROM [Level1] AS [l] LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Required_Id], [l0].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l0] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] ON [l].[Id] = [t].[Level1_Required_Id] LEFT JOIN ( SELECT [l1].[Id], [l1].[Level2_Required_Id], [l1].[OneToMany_Required_Inverse3Id] FROM [Level1] AS [l1] - WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse3Id] IS NOT NULL) + WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL ) AS [t0] ON CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] END = [t0].[Level2_Required_Id] """); } @@ -4722,18 +4722,18 @@ public override async Task Project_collection_navigation_count(bool async) SELECT [l].[Id], ( SELECT COUNT(*) FROM [Level1] AS [l1] - WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse3Id] IS NOT NULL) AND (CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] - END IS NOT NULL) AND (CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] - END = [l1].[OneToMany_Optional_Inverse3Id] OR ((CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] - END IS NULL) AND ([l1].[OneToMany_Optional_Inverse3Id] IS NULL)))) AS [Count] + WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL AND CASE + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + END IS NOT NULL AND (CASE + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + END = [l1].[OneToMany_Optional_Inverse3Id] OR (CASE + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + END IS NULL AND [l1].[OneToMany_Optional_Inverse3Id] IS NULL))) AS [Count] FROM [Level1] AS [l] LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l0] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] ON [l].[Id] = [t].[Level1_Optional_Id] """); } @@ -4751,14 +4751,14 @@ FROM [Level1] AS [l] LEFT JOIN ( SELECT [l0].[Level1_Required_Id], [l0].[Level2_Name] FROM [Level1] AS [l0] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] ON [l].[Id] = [t].[Level1_Required_Id] - WHERE [t].[Level2_Name] <> N'Foo' OR ([t].[Level2_Name] IS NULL) + WHERE [t].[Level2_Name] <> N'Foo' OR [t].[Level2_Name] IS NULL ) AS [t0] LEFT JOIN ( SELECT [l1].[Id], [l1].[OneToOne_Required_PK_Date], [l1].[Level1_Optional_Id], [l1].[Level1_Required_Id], [l1].[Level2_Name], [l1].[OneToMany_Optional_Inverse2Id], [l1].[OneToMany_Required_Inverse2Id], [l1].[OneToOne_Optional_PK_Inverse2Id] FROM [Level1] AS [l1] - WHERE ([l1].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l1].[Level1_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l1].[OneToOne_Required_PK_Date] IS NOT NULL AND [l1].[Level1_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t1] ON [t0].[Id] = [t1].[Level1_Optional_Id] """); } @@ -4774,7 +4774,7 @@ FROM [Level1] AS [l] LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[Level2_Name], [l0].[OneToMany_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id] FROM [Level1] AS [l0] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] ON [l].[Id] = [t].[Level1_Optional_Id] """); } @@ -4790,9 +4790,9 @@ FROM [Level1] AS [l] LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[Level2_Name], [l0].[OneToMany_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id] FROM [Level1] AS [l0] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] ON [l].[Id] = [t].[Level1_Optional_Id] -WHERE [t].[Level2_Name] <> N'L2 05' OR ([t].[Level2_Name] IS NULL) +WHERE [t].[Level2_Name] <> N'L2 05' OR [t].[Level2_Name] IS NULL """); } @@ -4805,15 +4805,15 @@ public override async Task GroupJoin_on_right_side_being_a_subquery(bool async) @__p_0='2' SELECT CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] END AS [Id], [t0].[Name] FROM [Level1] AS [l] LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l0] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] ON [l].[Id] = CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] END LEFT JOIN ( SELECT TOP(@__p_0) [l1].[Id], [l1].[Name] @@ -4821,11 +4821,11 @@ FROM [Level1] AS [l1] LEFT JOIN ( SELECT [l2].[Level1_Optional_Id], [l2].[Level2_Name] FROM [Level1] AS [l2] - WHERE ([l2].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l2].[Level1_Required_Id] IS NOT NULL) AND ([l2].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l2].[OneToOne_Required_PK_Date] IS NOT NULL AND [l2].[Level1_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t1] ON [l1].[Id] = [t1].[Level1_Optional_Id] ORDER BY [t1].[Level2_Name] ) AS [t0] ON [t].[Level1_Optional_Id] = [t0].[Id] -WHERE ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) +WHERE [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL """); } @@ -4840,21 +4840,21 @@ FROM [Level1] AS [l] INNER JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Required_Id], [l0].[OneToMany_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l0] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] ON [l].[Id] = [t].[OneToMany_Optional_Inverse2Id] INNER JOIN ( SELECT [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Level3_Name], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[OneToOne_Optional_PK_Inverse3Id] FROM [Level1] AS [l1] - WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse3Id] IS NOT NULL) + WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL ) AS [t0] ON CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] END = [t0].[OneToMany_Optional_Inverse3Id] LEFT JOIN ( SELECT [l2].[Id], [l2].[Level3_Optional_Id], [l2].[Level3_Required_Id], [l2].[Level4_Name], [l2].[OneToMany_Optional_Inverse4Id], [l2].[OneToMany_Required_Inverse4Id], [l2].[OneToOne_Optional_PK_Inverse4Id] FROM [Level1] AS [l2] - WHERE ([l2].[Level3_Required_Id] IS NOT NULL) AND ([l2].[OneToMany_Required_Inverse4Id] IS NOT NULL) + WHERE [l2].[Level3_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse4Id] IS NOT NULL ) AS [t1] ON CASE - WHEN ([t0].[Level2_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [t0].[Id] + WHEN [t0].[Level2_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [t0].[Id] END = [t1].[Level3_Required_Id] """); } @@ -4870,36 +4870,36 @@ FROM [Level1] AS [l] LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Required_Id], [l0].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l0] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] ON [l].[Id] = CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] END LEFT JOIN ( SELECT [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Level3_Name], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[OneToOne_Optional_PK_Inverse3Id] FROM [Level1] AS [l1] - WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse3Id] IS NOT NULL) + WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL ) AS [t0] ON CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] END = CASE - WHEN ([t0].[Level2_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [t0].[Id] + WHEN [t0].[Level2_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [t0].[Id] END LEFT JOIN ( SELECT [l2].[Id], [l2].[OneToOne_Required_PK_Date], [l2].[Level1_Required_Id], [l2].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l2] - WHERE ([l2].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l2].[Level1_Required_Id] IS NOT NULL) AND ([l2].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l2].[OneToOne_Required_PK_Date] IS NOT NULL AND [l2].[Level1_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t1] ON [t0].[Level2_Required_Id] = CASE - WHEN ([t1].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t1].[Level1_Required_Id] IS NOT NULL) AND ([t1].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t1].[Id] + WHEN [t1].[OneToOne_Required_PK_Date] IS NOT NULL AND [t1].[Level1_Required_Id] IS NOT NULL AND [t1].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t1].[Id] END -WHERE ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) AND ([t0].[Level2_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse3Id] IS NOT NULL) AND ( +WHERE [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL AND [t0].[Level2_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse3Id] IS NOT NULL AND ( SELECT COUNT(*) FROM [Level1] AS [l3] - WHERE ([l3].[Level2_Required_Id] IS NOT NULL) AND ([l3].[OneToMany_Required_Inverse3Id] IS NOT NULL) AND (CASE - WHEN ([t1].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t1].[Level1_Required_Id] IS NOT NULL) AND ([t1].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t1].[Id] - END IS NOT NULL) AND (CASE - WHEN ([t1].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t1].[Level1_Required_Id] IS NOT NULL) AND ([t1].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t1].[Id] - END = [l3].[OneToMany_Optional_Inverse3Id] OR ((CASE - WHEN ([t1].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t1].[Level1_Required_Id] IS NOT NULL) AND ([t1].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t1].[Id] - END IS NULL) AND ([l3].[OneToMany_Optional_Inverse3Id] IS NULL)))) > 0 + WHERE [l3].[Level2_Required_Id] IS NOT NULL AND [l3].[OneToMany_Required_Inverse3Id] IS NOT NULL AND CASE + WHEN [t1].[OneToOne_Required_PK_Date] IS NOT NULL AND [t1].[Level1_Required_Id] IS NOT NULL AND [t1].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t1].[Id] + END IS NOT NULL AND (CASE + WHEN [t1].[OneToOne_Required_PK_Date] IS NOT NULL AND [t1].[Level1_Required_Id] IS NOT NULL AND [t1].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t1].[Id] + END = [l3].[OneToMany_Optional_Inverse3Id] OR (CASE + WHEN [t1].[OneToOne_Required_PK_Date] IS NOT NULL AND [t1].[Level1_Required_Id] IS NOT NULL AND [t1].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t1].[Id] + END IS NULL AND [l3].[OneToMany_Optional_Inverse3Id] IS NULL))) > 0 """); } @@ -4920,11 +4920,11 @@ FROM [Level1] AS [l1] LEFT JOIN ( SELECT [l2].[Id], [l2].[OneToOne_Required_PK_Date], [l2].[Level1_Optional_Id], [l2].[Level1_Required_Id], [l2].[Level2_Name], [l2].[OneToMany_Optional_Inverse2Id], [l2].[OneToMany_Required_Inverse2Id], [l2].[OneToOne_Optional_PK_Inverse2Id] FROM [Level1] AS [l2] - WHERE ([l2].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l2].[Level1_Required_Id] IS NOT NULL) AND ([l2].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l2].[OneToOne_Required_PK_Date] IS NOT NULL AND [l2].[Level1_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] ON [l1].[Id] = CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] END - WHERE ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t0] ON [l0].[Id] = [t0].[Level1_Optional_Id]) > 7 AND [l].[Id] < 3 """); } @@ -4940,32 +4940,32 @@ FROM [Level1] AS [l] LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Required_Id], [l0].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l0] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] ON [l].[Id] = CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] END LEFT JOIN ( SELECT [l1].[Id], [l1].[Level2_Required_Id], [l1].[OneToMany_Required_Inverse3Id] FROM [Level1] AS [l1] - WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse3Id] IS NOT NULL) + WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL ) AS [t0] ON CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] END = CASE - WHEN ([t0].[Level2_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [t0].[Id] + WHEN [t0].[Level2_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [t0].[Id] END INNER JOIN [Level1] AS [l2] ON CASE - WHEN ([t0].[Level2_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [t0].[Id] + WHEN [t0].[Level2_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [t0].[Id] END = ( SELECT TOP(1) CASE - WHEN ([t2].[Level2_Required_Id] IS NOT NULL) AND ([t2].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [t2].[Id1] + WHEN [t2].[Level2_Required_Id] IS NOT NULL AND [t2].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [t2].[Id1] END FROM [Level1] AS [l3] LEFT JOIN ( SELECT [l4].[Id], [l4].[OneToOne_Required_PK_Date], [l4].[Level1_Optional_Id], [l4].[Level1_Required_Id], [l4].[Level2_Name], [l4].[OneToMany_Optional_Inverse2Id], [l4].[OneToMany_Required_Inverse2Id], [l4].[OneToOne_Optional_PK_Inverse2Id] FROM [Level1] AS [l4] - WHERE ([l4].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l4].[Level1_Required_Id] IS NOT NULL) AND ([l4].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l4].[OneToOne_Required_PK_Date] IS NOT NULL AND [l4].[Level1_Required_Id] IS NOT NULL AND [l4].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t1] ON [l3].[Id] = CASE - WHEN ([t1].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t1].[Level1_Required_Id] IS NOT NULL) AND ([t1].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t1].[Id] + WHEN [t1].[OneToOne_Required_PK_Date] IS NOT NULL AND [t1].[Level1_Required_Id] IS NOT NULL AND [t1].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t1].[Id] END LEFT JOIN ( SELECT [l5].[Id], [l5].[Date], [l5].[Name], [t3].[Id] AS [Id0], [t3].[OneToOne_Required_PK_Date], [t3].[Level1_Optional_Id], [t3].[Level1_Required_Id], [t3].[Level2_Name], [t3].[OneToMany_Optional_Inverse2Id], [t3].[OneToMany_Required_Inverse2Id], [t3].[OneToOne_Optional_PK_Inverse2Id], [t4].[Id] AS [Id1], [t4].[Level2_Optional_Id], [t4].[Level2_Required_Id], [t4].[Level3_Name], [t4].[OneToMany_Optional_Inverse3Id], [t4].[OneToMany_Required_Inverse3Id], [t4].[OneToOne_Optional_PK_Inverse3Id] @@ -4973,28 +4973,28 @@ FROM [Level1] AS [l5] LEFT JOIN ( SELECT [l6].[Id], [l6].[OneToOne_Required_PK_Date], [l6].[Level1_Optional_Id], [l6].[Level1_Required_Id], [l6].[Level2_Name], [l6].[OneToMany_Optional_Inverse2Id], [l6].[OneToMany_Required_Inverse2Id], [l6].[OneToOne_Optional_PK_Inverse2Id] FROM [Level1] AS [l6] - WHERE ([l6].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l6].[Level1_Required_Id] IS NOT NULL) AND ([l6].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l6].[OneToOne_Required_PK_Date] IS NOT NULL AND [l6].[Level1_Required_Id] IS NOT NULL AND [l6].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t3] ON [l5].[Id] = CASE - WHEN ([t3].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t3].[Level1_Required_Id] IS NOT NULL) AND ([t3].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t3].[Id] + WHEN [t3].[OneToOne_Required_PK_Date] IS NOT NULL AND [t3].[Level1_Required_Id] IS NOT NULL AND [t3].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t3].[Id] END LEFT JOIN ( SELECT [l7].[Id], [l7].[Level2_Optional_Id], [l7].[Level2_Required_Id], [l7].[Level3_Name], [l7].[OneToMany_Optional_Inverse3Id], [l7].[OneToMany_Required_Inverse3Id], [l7].[OneToOne_Optional_PK_Inverse3Id] FROM [Level1] AS [l7] - WHERE ([l7].[Level2_Required_Id] IS NOT NULL) AND ([l7].[OneToMany_Required_Inverse3Id] IS NOT NULL) + WHERE [l7].[Level2_Required_Id] IS NOT NULL AND [l7].[OneToMany_Required_Inverse3Id] IS NOT NULL ) AS [t4] ON CASE - WHEN ([t3].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t3].[Level1_Required_Id] IS NOT NULL) AND ([t3].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t3].[Id] + WHEN [t3].[OneToOne_Required_PK_Date] IS NOT NULL AND [t3].[Level1_Required_Id] IS NOT NULL AND [t3].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t3].[Id] END = CASE - WHEN ([t4].[Level2_Required_Id] IS NOT NULL) AND ([t4].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [t4].[Id] + WHEN [t4].[Level2_Required_Id] IS NOT NULL AND [t4].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [t4].[Id] END - WHERE ([t3].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t3].[Level1_Required_Id] IS NOT NULL) AND ([t3].[OneToMany_Required_Inverse2Id] IS NOT NULL) AND ([t4].[Level2_Required_Id] IS NOT NULL) AND ([t4].[OneToMany_Required_Inverse3Id] IS NOT NULL) + WHERE [t3].[OneToOne_Required_PK_Date] IS NOT NULL AND [t3].[Level1_Required_Id] IS NOT NULL AND [t3].[OneToMany_Required_Inverse2Id] IS NOT NULL AND [t4].[Level2_Required_Id] IS NOT NULL AND [t4].[OneToMany_Required_Inverse3Id] IS NOT NULL ) AS [t2] ON CASE - WHEN ([t1].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t1].[Level1_Required_Id] IS NOT NULL) AND ([t1].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t1].[Id] + WHEN [t1].[OneToOne_Required_PK_Date] IS NOT NULL AND [t1].[Level1_Required_Id] IS NOT NULL AND [t1].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t1].[Id] END = [t2].[Level2_Optional_Id] - WHERE ([t1].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t1].[Level1_Required_Id] IS NOT NULL) AND ([t1].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [t1].[OneToOne_Required_PK_Date] IS NOT NULL AND [t1].[Level1_Required_Id] IS NOT NULL AND [t1].[OneToMany_Required_Inverse2Id] IS NOT NULL ORDER BY CASE - WHEN ([t2].[Level2_Required_Id] IS NOT NULL) AND ([t2].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [t2].[Id1] + WHEN [t2].[Level2_Required_Id] IS NOT NULL AND [t2].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [t2].[Id1] END) -WHERE ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) AND ([t0].[Level2_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse3Id] IS NOT NULL) +WHERE [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL AND [t0].[Level2_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse3Id] IS NOT NULL """); } @@ -5005,7 +5005,7 @@ public override async Task Join_navigation_deeply_nested_required(bool async) AssertSql( """ SELECT CASE - WHEN ([t4].[Level3_Required_Id] IS NOT NULL) AND ([t4].[OneToMany_Required_Inverse4Id] IS NOT NULL) THEN [t4].[Id2] + WHEN [t4].[Level3_Required_Id] IS NOT NULL AND [t4].[OneToMany_Required_Inverse4Id] IS NOT NULL THEN [t4].[Id2] END AS [Id4], [t4].[Level4_Name] AS [Name4], [l].[Id] AS [Id1], [l].[Name] AS [Name1] FROM [Level1] AS [l] INNER JOIN ( @@ -5014,46 +5014,46 @@ FROM [Level1] AS [l0] LEFT JOIN ( SELECT [l1].[Id], [l1].[OneToOne_Required_PK_Date], [l1].[Level1_Required_Id], [l1].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l1] - WHERE ([l1].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l1].[Level1_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l1].[OneToOne_Required_PK_Date] IS NOT NULL AND [l1].[Level1_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] ON [l0].[Id] = CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] END LEFT JOIN ( SELECT [l2].[Id], [l2].[Level2_Required_Id], [l2].[OneToMany_Required_Inverse3Id] FROM [Level1] AS [l2] - WHERE ([l2].[Level2_Required_Id] IS NOT NULL) AND ([l2].[OneToMany_Required_Inverse3Id] IS NOT NULL) + WHERE [l2].[Level2_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse3Id] IS NOT NULL ) AS [t0] ON CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] END = CASE - WHEN ([t0].[Level2_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [t0].[Id] + WHEN [t0].[Level2_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [t0].[Id] END LEFT JOIN ( SELECT [l3].[Id], [l3].[Level3_Required_Id], [l3].[Level4_Name], [l3].[OneToMany_Required_Inverse4Id] FROM [Level1] AS [l3] - WHERE ([l3].[Level3_Required_Id] IS NOT NULL) AND ([l3].[OneToMany_Required_Inverse4Id] IS NOT NULL) + WHERE [l3].[Level3_Required_Id] IS NOT NULL AND [l3].[OneToMany_Required_Inverse4Id] IS NOT NULL ) AS [t1] ON CASE - WHEN ([t0].[Level2_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [t0].[Id] + WHEN [t0].[Level2_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [t0].[Id] END = CASE - WHEN ([t1].[Level3_Required_Id] IS NOT NULL) AND ([t1].[OneToMany_Required_Inverse4Id] IS NOT NULL) THEN [t1].[Id] + WHEN [t1].[Level3_Required_Id] IS NOT NULL AND [t1].[OneToMany_Required_Inverse4Id] IS NOT NULL THEN [t1].[Id] END LEFT JOIN ( SELECT [l4].[Id], [l4].[Level2_Required_Id], [l4].[OneToMany_Required_Inverse3Id] FROM [Level1] AS [l4] - WHERE ([l4].[Level2_Required_Id] IS NOT NULL) AND ([l4].[OneToMany_Required_Inverse3Id] IS NOT NULL) + WHERE [l4].[Level2_Required_Id] IS NOT NULL AND [l4].[OneToMany_Required_Inverse3Id] IS NOT NULL ) AS [t2] ON [t1].[Level3_Required_Id] = CASE - WHEN ([t2].[Level2_Required_Id] IS NOT NULL) AND ([t2].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [t2].[Id] + WHEN [t2].[Level2_Required_Id] IS NOT NULL AND [t2].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [t2].[Id] END LEFT JOIN ( SELECT [l6].[Id], [l6].[OneToOne_Required_PK_Date], [l6].[Level1_Required_Id], [l6].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l6] - WHERE ([l6].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l6].[Level1_Required_Id] IS NOT NULL) AND ([l6].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l6].[OneToOne_Required_PK_Date] IS NOT NULL AND [l6].[Level1_Required_Id] IS NOT NULL AND [l6].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t3] ON [t2].[Level2_Required_Id] = CASE - WHEN ([t3].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t3].[Level1_Required_Id] IS NOT NULL) AND ([t3].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t3].[Id] + WHEN [t3].[OneToOne_Required_PK_Date] IS NOT NULL AND [t3].[Level1_Required_Id] IS NOT NULL AND [t3].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t3].[Id] END LEFT JOIN [Level1] AS [l5] ON CASE - WHEN ([t3].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t3].[Level1_Required_Id] IS NOT NULL) AND ([t3].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t3].[Id] + WHEN [t3].[OneToOne_Required_PK_Date] IS NOT NULL AND [t3].[Level1_Required_Id] IS NOT NULL AND [t3].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t3].[Id] END = [l5].[Id] - WHERE ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) AND ([t0].[Level2_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse3Id] IS NOT NULL) AND ([t1].[Level3_Required_Id] IS NOT NULL) AND ([t1].[OneToMany_Required_Inverse4Id] IS NOT NULL) + WHERE [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL AND [t0].[Level2_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse3Id] IS NOT NULL AND [t1].[Level3_Required_Id] IS NOT NULL AND [t1].[OneToMany_Required_Inverse4Id] IS NOT NULL ) AS [t4] ON [l].[Name] = [t4].[Name0] """); } @@ -5071,7 +5071,7 @@ FROM [Level1] AS [l] LEFT JOIN ( SELECT [l0].[Level1_Required_Id], [l0].[Level2_Name] FROM [Level1] AS [l0] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] ON [l].[Id] = [t].[Level1_Required_Id] WHERE [t].[Level2_Name] = N'L2 03' ORDER BY [l].[Id] @@ -5089,20 +5089,20 @@ FROM [Level1] AS [l] LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Required_Id], [l0].[Level2_Name], [l0].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l0] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] ON [l].[Id] = CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] END -WHERE ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) AND EXISTS ( +WHERE [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL AND EXISTS ( SELECT 1 FROM [Level1] AS [l1] - WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse3Id] IS NOT NULL) AND (CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] - END IS NOT NULL) AND (CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] - END = [l1].[OneToMany_Optional_Inverse3Id] OR ((CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] - END IS NULL) AND ([l1].[OneToMany_Optional_Inverse3Id] IS NULL)))) + WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL AND CASE + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + END IS NOT NULL AND (CASE + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + END = [l1].[OneToMany_Optional_Inverse3Id] OR (CASE + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + END IS NULL AND [l1].[OneToMany_Optional_Inverse3Id] IS NULL))) """); } @@ -5117,23 +5117,23 @@ FROM [Level1] AS [l] LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l0] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] ON [l].[Id] = [t].[Level1_Optional_Id] LEFT JOIN ( SELECT [l1].[Id], [l1].[Level2_Required_Id], [l1].[OneToMany_Required_Inverse3Id] FROM [Level1] AS [l1] - WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse3Id] IS NOT NULL) + WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL ) AS [t0] ON CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] END = [t0].[Level2_Required_Id] LEFT JOIN ( SELECT [l2].[Level3_Required_Id], [l2].[OneToMany_Required_Inverse4Id] FROM [Level1] AS [l2] - WHERE ([l2].[Level3_Required_Id] IS NOT NULL) AND ([l2].[OneToMany_Required_Inverse4Id] IS NOT NULL) + WHERE [l2].[Level3_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse4Id] IS NOT NULL ) AS [t1] ON CASE - WHEN ([t0].[Level2_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [t0].[Id] + WHEN [t0].[Level2_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [t0].[Id] END = [t1].[Level3_Required_Id] -WHERE ([t1].[Level3_Required_Id] IS NULL) OR ([t1].[OneToMany_Required_Inverse4Id] IS NULL) +WHERE [t1].[Level3_Required_Id] IS NULL OR [t1].[OneToMany_Required_Inverse4Id] IS NULL """); } @@ -5151,28 +5151,28 @@ FROM [Level1] AS [l] LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Required_Id], [l0].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l0] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] ON [l].[Id] = CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] END LEFT JOIN ( SELECT [l1].[Id], [l1].[Level2_Required_Id], [l1].[Level3_Name], [l1].[OneToMany_Required_Inverse3Id] FROM [Level1] AS [l1] - WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse3Id] IS NOT NULL) + WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL ) AS [t0] ON CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] END = CASE - WHEN ([t0].[Level2_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [t0].[Id] + WHEN [t0].[Level2_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [t0].[Id] END LEFT JOIN ( SELECT [l2].[Id], [l2].[OneToOne_Required_PK_Date], [l2].[Level1_Required_Id], [l2].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l2] - WHERE ([l2].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l2].[Level1_Required_Id] IS NOT NULL) AND ([l2].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l2].[OneToOne_Required_PK_Date] IS NOT NULL AND [l2].[Level1_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t1] ON [t0].[OneToMany_Required_Inverse3Id] = CASE - WHEN ([t1].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t1].[Level1_Required_Id] IS NOT NULL) AND ([t1].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t1].[Id] + WHEN [t1].[OneToOne_Required_PK_Date] IS NOT NULL AND [t1].[Level1_Required_Id] IS NOT NULL AND [t1].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t1].[Id] END LEFT JOIN [Level1] AS [l3] ON [t1].[Level1_Required_Id] = [l3].[Id] -WHERE ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) AND ([t0].[Level2_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse3Id] IS NOT NULL) AND [l3].[Name] = N'L1 03' +WHERE [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL AND [t0].[Level2_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse3Id] IS NOT NULL AND [l3].[Name] = N'L1 03' ORDER BY [t0].[Level2_Required_Id] OFFSET @__p_0 ROWS FETCH NEXT @__p_1 ROWS ONLY """); @@ -5192,9 +5192,9 @@ FROM [Level1] AS [l] LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Required_Id], [l0].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l0] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] ON [l].[Id] = CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] END INNER JOIN [Level1] AS [l1] ON [t].[Level1_Required_Id] = [l1].[Id] INNER JOIN ( @@ -5203,22 +5203,22 @@ FROM [Level1] AS [l2] LEFT JOIN ( SELECT [l3].[Id], [l3].[OneToOne_Required_PK_Date], [l3].[Level1_Required_Id], [l3].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l3] - WHERE ([l3].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l3].[Level1_Required_Id] IS NOT NULL) AND ([l3].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l3].[OneToOne_Required_PK_Date] IS NOT NULL AND [l3].[Level1_Required_Id] IS NOT NULL AND [l3].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t0] ON [l2].[Id] = CASE - WHEN ([t0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t0].[Level1_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t0].[Id] + WHEN [t0].[OneToOne_Required_PK_Date] IS NOT NULL AND [t0].[Level1_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t0].[Id] END LEFT JOIN ( SELECT [l4].[Id], [l4].[Level2_Required_Id], [l4].[Level3_Name], [l4].[OneToMany_Required_Inverse3Id] FROM [Level1] AS [l4] - WHERE ([l4].[Level2_Required_Id] IS NOT NULL) AND ([l4].[OneToMany_Required_Inverse3Id] IS NOT NULL) + WHERE [l4].[Level2_Required_Id] IS NOT NULL AND [l4].[OneToMany_Required_Inverse3Id] IS NOT NULL ) AS [t2] ON CASE - WHEN ([t0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t0].[Level1_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t0].[Id] + WHEN [t0].[OneToOne_Required_PK_Date] IS NOT NULL AND [t0].[Level1_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t0].[Id] END = CASE - WHEN ([t2].[Level2_Required_Id] IS NOT NULL) AND ([t2].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [t2].[Id] + WHEN [t2].[Level2_Required_Id] IS NOT NULL AND [t2].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [t2].[Id] END - WHERE ([t0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t0].[Level1_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse2Id] IS NOT NULL) AND ([t2].[Level2_Required_Id] IS NOT NULL) AND ([t2].[OneToMany_Required_Inverse3Id] IS NOT NULL) + WHERE [t0].[OneToOne_Required_PK_Date] IS NOT NULL AND [t0].[Level1_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse2Id] IS NOT NULL AND [t2].[Level2_Required_Id] IS NOT NULL AND [t2].[OneToMany_Required_Inverse3Id] IS NOT NULL ) AS [t1] ON [l1].[Id] = [t1].[Level2_Required_Id] -WHERE ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) AND [l1].[Name] = N'L1 03' AND [t1].[Level3_Name] = N'L3 08' +WHERE [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL AND [l1].[Name] = N'L1 03' AND [t1].[Level3_Name] = N'L3 08' ORDER BY [l1].[Id] """); } @@ -5234,14 +5234,14 @@ FROM [Level1] AS [l] LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[Level2_Name], [l0].[OneToMany_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id] FROM [Level1] AS [l0] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] ON [l].[Id] = [t].[Level1_Optional_Id] LEFT JOIN ( SELECT [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Level3_Name], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[OneToOne_Optional_PK_Inverse3Id] FROM [Level1] AS [l1] - WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse3Id] IS NOT NULL) + WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL ) AS [t0] ON CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] END = [t0].[OneToOne_Optional_PK_Inverse3Id] """); } @@ -5257,7 +5257,7 @@ FROM [Level1] AS [l] LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[Level2_Name], [l0].[OneToMany_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id] FROM [Level1] AS [l0] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] ON [l].[Id] = [t].[OneToOne_Optional_PK_Inverse2Id] """); } @@ -5276,23 +5276,23 @@ FROM [Level1] AS [l0] LEFT JOIN ( SELECT [l1].[Id], [l1].[OneToOne_Required_PK_Date], [l1].[Level1_Optional_Id], [l1].[Level1_Required_Id], [l1].[Level2_Name], [l1].[OneToMany_Optional_Inverse2Id], [l1].[OneToMany_Required_Inverse2Id], [l1].[OneToOne_Optional_PK_Inverse2Id] FROM [Level1] AS [l1] - WHERE ([l1].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l1].[Level1_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l1].[OneToOne_Required_PK_Date] IS NOT NULL AND [l1].[Level1_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] ON [l0].[Id] = CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] END LEFT JOIN ( SELECT [l2].[Id], [l2].[Level2_Optional_Id], [l2].[Level2_Required_Id], [l2].[Level3_Name], [l2].[OneToMany_Optional_Inverse3Id], [l2].[OneToMany_Required_Inverse3Id], [l2].[OneToOne_Optional_PK_Inverse3Id] FROM [Level1] AS [l2] - WHERE ([l2].[Level2_Required_Id] IS NOT NULL) AND ([l2].[OneToMany_Required_Inverse3Id] IS NOT NULL) + WHERE [l2].[Level2_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse3Id] IS NOT NULL ) AS [t0] ON CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] END = CASE - WHEN ([t0].[Level2_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [t0].[Id] + WHEN [t0].[Level2_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [t0].[Id] END - WHERE ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) AND ([t0].[Level2_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse3Id] IS NOT NULL) + WHERE [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL AND [t0].[Level2_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse3Id] IS NOT NULL ) AS [t1] ORDER BY CASE - WHEN ([t1].[Level2_Required_Id] IS NOT NULL) AND ([t1].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [t1].[Id] + WHEN [t1].[Level2_Required_Id] IS NOT NULL AND [t1].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [t1].[Id] END OFFSET 1 ROWS FETCH NEXT 1 ROWS ONLY) FROM [Level1] AS [l] @@ -5314,30 +5314,30 @@ FROM [Level1] AS [l0] LEFT JOIN ( SELECT [l1].[Id], [l1].[OneToOne_Required_PK_Date], [l1].[Level1_Optional_Id], [l1].[Level1_Required_Id], [l1].[Level2_Name], [l1].[OneToMany_Optional_Inverse2Id], [l1].[OneToMany_Required_Inverse2Id], [l1].[OneToOne_Optional_PK_Inverse2Id] FROM [Level1] AS [l1] - WHERE ([l1].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l1].[Level1_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l1].[OneToOne_Required_PK_Date] IS NOT NULL AND [l1].[Level1_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] ON [l0].[Id] = CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] END - WHERE ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) AND EXISTS ( + WHERE [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL AND EXISTS ( SELECT 1 FROM [Level1] AS [l2] LEFT JOIN ( SELECT [l3].[Id], [l3].[OneToOne_Required_PK_Date], [l3].[Level1_Optional_Id], [l3].[Level1_Required_Id], [l3].[Level2_Name], [l3].[OneToMany_Optional_Inverse2Id], [l3].[OneToMany_Required_Inverse2Id], [l3].[OneToOne_Optional_PK_Inverse2Id] FROM [Level1] AS [l3] - WHERE ([l3].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l3].[Level1_Required_Id] IS NOT NULL) AND ([l3].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l3].[OneToOne_Required_PK_Date] IS NOT NULL AND [l3].[Level1_Required_Id] IS NOT NULL AND [l3].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t0] ON [l2].[Id] = CASE - WHEN ([t0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t0].[Level1_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t0].[Id] + WHEN [t0].[OneToOne_Required_PK_Date] IS NOT NULL AND [t0].[Level1_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t0].[Id] END LEFT JOIN ( SELECT [l4].[Id], [l4].[Level2_Optional_Id], [l4].[Level2_Required_Id], [l4].[Level3_Name], [l4].[OneToMany_Optional_Inverse3Id], [l4].[OneToMany_Required_Inverse3Id], [l4].[OneToOne_Optional_PK_Inverse3Id] FROM [Level1] AS [l4] - WHERE ([l4].[Level2_Required_Id] IS NOT NULL) AND ([l4].[OneToMany_Required_Inverse3Id] IS NOT NULL) + WHERE [l4].[Level2_Required_Id] IS NOT NULL AND [l4].[OneToMany_Required_Inverse3Id] IS NOT NULL ) AS [t1] ON CASE - WHEN ([t0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t0].[Level1_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t0].[Id] + WHEN [t0].[OneToOne_Required_PK_Date] IS NOT NULL AND [t0].[Level1_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t0].[Id] END = CASE - WHEN ([t1].[Level2_Required_Id] IS NOT NULL) AND ([t1].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [t1].[Id] + WHEN [t1].[Level2_Required_Id] IS NOT NULL AND [t1].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [t1].[Id] END - WHERE ([t0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t0].[Level1_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse2Id] IS NOT NULL) AND ([t1].[Level2_Required_Id] IS NOT NULL) AND ([t1].[OneToMany_Required_Inverse3Id] IS NOT NULL))) + WHERE [t0].[OneToOne_Required_PK_Date] IS NOT NULL AND [t0].[Level1_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse2Id] IS NOT NULL AND [t1].[Level2_Required_Id] IS NOT NULL AND [t1].[OneToMany_Required_Inverse3Id] IS NOT NULL)) """); } @@ -5352,29 +5352,29 @@ FROM [Level1] AS [l] LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Required_Id], [l0].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l0] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] ON [l].[Id] = CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] END LEFT JOIN ( SELECT [l1].[Id], [l1].[Level2_Required_Id], [l1].[OneToMany_Required_Inverse3Id] FROM [Level1] AS [l1] - WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse3Id] IS NOT NULL) + WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL ) AS [t0] ON CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] END = CASE - WHEN ([t0].[Level2_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [t0].[Id] + WHEN [t0].[Level2_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [t0].[Id] END LEFT JOIN ( SELECT [l2].[Id], [l2].[OneToOne_Required_PK_Date], [l2].[Level1_Optional_Id], [l2].[Level1_Required_Id], [l2].[Level2_Name], [l2].[OneToMany_Optional_Inverse2Id], [l2].[OneToMany_Required_Inverse2Id], [l2].[OneToOne_Optional_PK_Inverse2Id] FROM [Level1] AS [l2] - WHERE ([l2].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l2].[Level1_Required_Id] IS NOT NULL) AND ([l2].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l2].[OneToOne_Required_PK_Date] IS NOT NULL AND [l2].[Level1_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t1] ON [t0].[Level2_Required_Id] = CASE - WHEN ([t1].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t1].[Level1_Required_Id] IS NOT NULL) AND ([t1].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t1].[Id] + WHEN [t1].[OneToOne_Required_PK_Date] IS NOT NULL AND [t1].[Level1_Required_Id] IS NOT NULL AND [t1].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t1].[Id] END -WHERE ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) AND ([t0].[Level2_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse3Id] IS NOT NULL) +WHERE [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL AND [t0].[Level2_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse3Id] IS NOT NULL ORDER BY CASE - WHEN ([t1].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t1].[Level1_Required_Id] IS NOT NULL) AND ([t1].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t1].[Id] + WHEN [t1].[OneToOne_Required_PK_Date] IS NOT NULL AND [t1].[Level1_Required_Id] IS NOT NULL AND [t1].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t1].[Id] END """); } @@ -5386,13 +5386,13 @@ public override async Task Select_nav_prop_reference_optional2(bool async) AssertSql( """ SELECT CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] END FROM [Level1] AS [l] LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l0] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] ON [l].[Id] = [t].[Level1_Optional_Id] """); } @@ -5408,9 +5408,9 @@ FROM [Level1] AS [l] LEFT JOIN ( SELECT [l0].[Level1_Optional_Id], [l0].[Level2_Name] FROM [Level1] AS [l0] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] ON [l].[Id] = [t].[Level1_Optional_Id] -WHERE [t].[Level2_Name] NOT IN (N'Name1', N'Name2') OR ([t].[Level2_Name] IS NULL) +WHERE [t].[Level2_Name] NOT IN (N'Name1', N'Name2') OR [t].[Level2_Name] IS NULL """); } @@ -5425,28 +5425,28 @@ FROM [Level1] AS [l] LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Required_Id], [l0].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l0] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] ON [l].[Id] = CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] END LEFT JOIN ( SELECT [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Level3_Name], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[OneToOne_Optional_PK_Inverse3Id] FROM [Level1] AS [l1] - WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse3Id] IS NOT NULL) + WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL ) AS [t0] ON CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] END = CASE - WHEN ([t0].[Level2_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [t0].[Id] + WHEN [t0].[Level2_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [t0].[Id] END LEFT JOIN ( SELECT [l2].[Id], [l2].[OneToOne_Required_PK_Date], [l2].[Level1_Optional_Id], [l2].[Level1_Required_Id], [l2].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l2] - WHERE ([l2].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l2].[Level1_Required_Id] IS NOT NULL) AND ([l2].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l2].[OneToOne_Required_PK_Date] IS NOT NULL AND [l2].[Level1_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t1] ON [t0].[Level2_Optional_Id] = CASE - WHEN ([t1].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t1].[Level1_Required_Id] IS NOT NULL) AND ([t1].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t1].[Id] + WHEN [t1].[OneToOne_Required_PK_Date] IS NOT NULL AND [t1].[Level1_Required_Id] IS NOT NULL AND [t1].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t1].[Id] END LEFT JOIN [Level1] AS [l3] ON [t1].[Level1_Optional_Id] = [l3].[Id] -WHERE ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) AND ([t0].[Level2_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse3Id] IS NOT NULL) AND ([l3].[Id] IS NOT NULL) +WHERE [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL AND [t0].[Level2_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse3Id] IS NOT NULL AND [l3].[Id] IS NOT NULL """); } @@ -5470,7 +5470,7 @@ FROM [Level1] AS [l0] LEFT JOIN ( SELECT [l1].[Id], [l1].[OneToOne_Required_PK_Date], [l1].[Level1_Optional_Id], [l1].[Level1_Required_Id], [l1].[Level2_Name], [l1].[OneToMany_Optional_Inverse2Id], [l1].[OneToMany_Required_Inverse2Id], [l1].[OneToOne_Optional_PK_Inverse2Id] FROM [Level1] AS [l1] - WHERE ([l1].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l1].[Level1_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l1].[OneToOne_Required_PK_Date] IS NOT NULL AND [l1].[Level1_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t2] ON [l0].[Id] = [t2].[Level1_Optional_Id] ) AS [t0] WHERE [t0].[row] <= 1 @@ -5478,9 +5478,9 @@ FROM [Level1] AS [l1] LEFT JOIN ( SELECT [l2].[Id], [l2].[Level2_Optional_Id], [l2].[Level2_Required_Id], [l2].[Level3_Name], [l2].[OneToMany_Optional_Inverse3Id], [l2].[OneToMany_Required_Inverse3Id], [l2].[OneToOne_Optional_PK_Inverse3Id] FROM [Level1] AS [l2] - WHERE ([l2].[Level2_Required_Id] IS NOT NULL) AND ([l2].[OneToMany_Required_Inverse3Id] IS NOT NULL) + WHERE [l2].[Level2_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse3Id] IS NOT NULL ) AS [t3] ON CASE - WHEN ([t1].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t1].[Level1_Required_Id] IS NOT NULL) AND ([t1].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t1].[Id0] + WHEN [t1].[OneToOne_Required_PK_Date] IS NOT NULL AND [t1].[Level1_Required_Id] IS NOT NULL AND [t1].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t1].[Id0] END = [t3].[OneToMany_Optional_Inverse3Id] ORDER BY [t].[Name], [t1].[Id], [t1].[Id0] """); @@ -5493,33 +5493,33 @@ public override async Task Join_navigation_deeply_nested_non_key_join(bool async AssertSql( """ SELECT CASE - WHEN ([t1].[Level3_Required_Id] IS NOT NULL) AND ([t1].[OneToMany_Required_Inverse4Id] IS NOT NULL) THEN [t1].[Id] + WHEN [t1].[Level3_Required_Id] IS NOT NULL AND [t1].[OneToMany_Required_Inverse4Id] IS NOT NULL THEN [t1].[Id] END AS [Id4], [t1].[Level4_Name] AS [Name4], [t2].[Id] AS [Id1], [t2].[Name] AS [Name1] FROM [Level1] AS [l] LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Required_Id], [l0].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l0] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] ON [l].[Id] = CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] END LEFT JOIN ( SELECT [l1].[Id], [l1].[Level2_Required_Id], [l1].[OneToMany_Required_Inverse3Id] FROM [Level1] AS [l1] - WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse3Id] IS NOT NULL) + WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL ) AS [t0] ON CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] END = CASE - WHEN ([t0].[Level2_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [t0].[Id] + WHEN [t0].[Level2_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [t0].[Id] END LEFT JOIN ( SELECT [l2].[Id], [l2].[Level3_Required_Id], [l2].[Level4_Name], [l2].[OneToMany_Required_Inverse4Id] FROM [Level1] AS [l2] - WHERE ([l2].[Level3_Required_Id] IS NOT NULL) AND ([l2].[OneToMany_Required_Inverse4Id] IS NOT NULL) + WHERE [l2].[Level3_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse4Id] IS NOT NULL ) AS [t1] ON CASE - WHEN ([t0].[Level2_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [t0].[Id] + WHEN [t0].[Level2_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [t0].[Id] END = CASE - WHEN ([t1].[Level3_Required_Id] IS NOT NULL) AND ([t1].[OneToMany_Required_Inverse4Id] IS NOT NULL) THEN [t1].[Id] + WHEN [t1].[Level3_Required_Id] IS NOT NULL AND [t1].[OneToMany_Required_Inverse4Id] IS NOT NULL THEN [t1].[Id] END INNER JOIN ( SELECT [l3].[Id], [l3].[Name], [t5].[Level4_Name] @@ -5527,26 +5527,26 @@ FROM [Level1] AS [l3] LEFT JOIN ( SELECT [l4].[Id], [l4].[OneToOne_Required_PK_Date], [l4].[Level1_Required_Id], [l4].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l4] - WHERE ([l4].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l4].[Level1_Required_Id] IS NOT NULL) AND ([l4].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l4].[OneToOne_Required_PK_Date] IS NOT NULL AND [l4].[Level1_Required_Id] IS NOT NULL AND [l4].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t3] ON [l3].[Id] = [t3].[Level1_Required_Id] LEFT JOIN ( SELECT [l5].[Id], [l5].[Level2_Optional_Id], [l5].[Level2_Required_Id], [l5].[OneToMany_Required_Inverse3Id] FROM [Level1] AS [l5] - WHERE ([l5].[Level2_Required_Id] IS NOT NULL) AND ([l5].[OneToMany_Required_Inverse3Id] IS NOT NULL) + WHERE [l5].[Level2_Required_Id] IS NOT NULL AND [l5].[OneToMany_Required_Inverse3Id] IS NOT NULL ) AS [t4] ON CASE - WHEN ([t3].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t3].[Level1_Required_Id] IS NOT NULL) AND ([t3].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t3].[Id] + WHEN [t3].[OneToOne_Required_PK_Date] IS NOT NULL AND [t3].[Level1_Required_Id] IS NOT NULL AND [t3].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t3].[Id] END = [t4].[Level2_Optional_Id] LEFT JOIN ( SELECT [l6].[Id], [l6].[Level3_Required_Id], [l6].[Level4_Name], [l6].[OneToMany_Required_Inverse4Id] FROM [Level1] AS [l6] - WHERE ([l6].[Level3_Required_Id] IS NOT NULL) AND ([l6].[OneToMany_Required_Inverse4Id] IS NOT NULL) + WHERE [l6].[Level3_Required_Id] IS NOT NULL AND [l6].[OneToMany_Required_Inverse4Id] IS NOT NULL ) AS [t5] ON CASE - WHEN ([t4].[Level2_Required_Id] IS NOT NULL) AND ([t4].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [t4].[Id] + WHEN [t4].[Level2_Required_Id] IS NOT NULL AND [t4].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [t4].[Id] END = CASE - WHEN ([t5].[Level3_Required_Id] IS NOT NULL) AND ([t5].[OneToMany_Required_Inverse4Id] IS NOT NULL) THEN [t5].[Id] + WHEN [t5].[Level3_Required_Id] IS NOT NULL AND [t5].[OneToMany_Required_Inverse4Id] IS NOT NULL THEN [t5].[Id] END ) AS [t2] ON [t1].[Level4_Name] = [t2].[Level4_Name] -WHERE ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) AND ([t0].[Level2_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse3Id] IS NOT NULL) AND ([t1].[Level3_Required_Id] IS NOT NULL) AND ([t1].[OneToMany_Required_Inverse4Id] IS NOT NULL) +WHERE [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL AND [t0].[Level2_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse3Id] IS NOT NULL AND [t1].[Level3_Required_Id] IS NOT NULL AND [t1].[OneToMany_Required_Inverse4Id] IS NOT NULL """); } @@ -5557,20 +5557,20 @@ public override async Task Join_navigation_in_outer_selector_translated_to_extra AssertSql( """ SELECT [l].[Id] AS [Id1], CASE - WHEN ([t1].[Level2_Required_Id] IS NOT NULL) AND ([t1].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [t1].[Id1] + WHEN [t1].[Level2_Required_Id] IS NOT NULL AND [t1].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [t1].[Id1] END AS [Id3] FROM [Level1] AS [l] LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Required_Id], [l0].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l0] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] ON [l].[Id] = [t].[Level1_Required_Id] LEFT JOIN ( SELECT [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[OneToMany_Required_Inverse3Id] FROM [Level1] AS [l1] - WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse3Id] IS NOT NULL) + WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL ) AS [t0] ON CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] END = [t0].[Level2_Optional_Id] INNER JOIN ( SELECT [t3].[Id] AS [Id1], [t3].[Level2_Required_Id], [t3].[OneToMany_Required_Inverse3Id] @@ -5578,24 +5578,24 @@ FROM [Level1] AS [l2] LEFT JOIN ( SELECT [l3].[Id], [l3].[OneToOne_Required_PK_Date], [l3].[Level1_Required_Id], [l3].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l3] - WHERE ([l3].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l3].[Level1_Required_Id] IS NOT NULL) AND ([l3].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l3].[OneToOne_Required_PK_Date] IS NOT NULL AND [l3].[Level1_Required_Id] IS NOT NULL AND [l3].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t2] ON [l2].[Id] = CASE - WHEN ([t2].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t2].[Level1_Required_Id] IS NOT NULL) AND ([t2].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t2].[Id] + WHEN [t2].[OneToOne_Required_PK_Date] IS NOT NULL AND [t2].[Level1_Required_Id] IS NOT NULL AND [t2].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t2].[Id] END LEFT JOIN ( SELECT [l4].[Id], [l4].[Level2_Required_Id], [l4].[OneToMany_Required_Inverse3Id] FROM [Level1] AS [l4] - WHERE ([l4].[Level2_Required_Id] IS NOT NULL) AND ([l4].[OneToMany_Required_Inverse3Id] IS NOT NULL) + WHERE [l4].[Level2_Required_Id] IS NOT NULL AND [l4].[OneToMany_Required_Inverse3Id] IS NOT NULL ) AS [t3] ON CASE - WHEN ([t2].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t2].[Level1_Required_Id] IS NOT NULL) AND ([t2].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t2].[Id] + WHEN [t2].[OneToOne_Required_PK_Date] IS NOT NULL AND [t2].[Level1_Required_Id] IS NOT NULL AND [t2].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t2].[Id] END = CASE - WHEN ([t3].[Level2_Required_Id] IS NOT NULL) AND ([t3].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [t3].[Id] + WHEN [t3].[Level2_Required_Id] IS NOT NULL AND [t3].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [t3].[Id] END - WHERE ([t2].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t2].[Level1_Required_Id] IS NOT NULL) AND ([t2].[OneToMany_Required_Inverse2Id] IS NOT NULL) AND ([t3].[Level2_Required_Id] IS NOT NULL) AND ([t3].[OneToMany_Required_Inverse3Id] IS NOT NULL) + WHERE [t2].[OneToOne_Required_PK_Date] IS NOT NULL AND [t2].[Level1_Required_Id] IS NOT NULL AND [t2].[OneToMany_Required_Inverse2Id] IS NOT NULL AND [t3].[Level2_Required_Id] IS NOT NULL AND [t3].[OneToMany_Required_Inverse3Id] IS NOT NULL ) AS [t1] ON CASE - WHEN ([t0].[Level2_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [t0].[Id] + WHEN [t0].[Level2_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [t0].[Id] END = CASE - WHEN ([t1].[Level2_Required_Id] IS NOT NULL) AND ([t1].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [t1].[Id1] + WHEN [t1].[Level2_Required_Id] IS NOT NULL AND [t1].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [t1].[Id1] END """); } @@ -5611,9 +5611,9 @@ FROM [Level1] AS [l] LEFT JOIN ( SELECT [l0].[Level1_Optional_Id], [l0].[Level2_Name] FROM [Level1] AS [l0] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] ON [l].[Id] = [t].[Level1_Optional_Id] -WHERE [t].[Level2_Name] = N'L2 05' OR [t].[Level2_Name] <> N'L2 42' OR ([t].[Level2_Name] IS NULL) +WHERE [t].[Level2_Name] = N'L2 05' OR [t].[Level2_Name] <> N'L2 42' OR [t].[Level2_Name] IS NULL """); } @@ -5631,11 +5631,11 @@ FROM [Level1] AS [l0] LEFT JOIN ( SELECT [l1].[Id], [l1].[OneToOne_Required_PK_Date], [l1].[Level1_Optional_Id], [l1].[Level1_Required_Id], [l1].[Level2_Name], [l1].[OneToMany_Optional_Inverse2Id], [l1].[OneToMany_Required_Inverse2Id], [l1].[OneToOne_Optional_PK_Inverse2Id] FROM [Level1] AS [l1] - WHERE ([l1].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l1].[Level1_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l1].[OneToOne_Required_PK_Date] IS NOT NULL AND [l1].[Level1_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] ON [l0].[Id] = CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] END - WHERE ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t0] ON [l].[Id] = [t0].[Level1_Optional_Id] """); } @@ -5651,34 +5651,34 @@ FROM [Level1] AS [l] LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Required_Id], [l0].[Level2_Name], [l0].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l0] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] ON [l].[Id] = CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] END LEFT JOIN ( SELECT [l1].[Id], [l1].[Level2_Required_Id], [l1].[OneToMany_Required_Inverse3Id] FROM [Level1] AS [l1] - WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse3Id] IS NOT NULL) + WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL ) AS [t0] ON CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] END = [t0].[Level2_Required_Id] LEFT JOIN ( SELECT [l2].[Id], [l2].[Level2_Optional_Id], [l2].[Level2_Required_Id], [l2].[Level3_Name], [l2].[OneToMany_Optional_Inverse3Id], [l2].[OneToMany_Required_Inverse3Id], [l2].[OneToOne_Optional_PK_Inverse3Id] FROM [Level1] AS [l2] - WHERE ([l2].[Level2_Required_Id] IS NOT NULL) AND ([l2].[OneToMany_Required_Inverse3Id] IS NOT NULL) + WHERE [l2].[Level2_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse3Id] IS NOT NULL ) AS [t1] ON CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] END = [t1].[OneToOne_Optional_PK_Inverse3Id] -WHERE ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) AND EXISTS ( +WHERE [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL AND EXISTS ( SELECT 1 FROM [Level1] AS [l3] - WHERE ([l3].[Level3_Required_Id] IS NOT NULL) AND ([l3].[OneToMany_Required_Inverse4Id] IS NOT NULL) AND (CASE - WHEN ([t0].[Level2_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [t0].[Id] - END IS NOT NULL) AND (CASE - WHEN ([t0].[Level2_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [t0].[Id] - END = [l3].[OneToMany_Optional_Inverse4Id] OR ((CASE - WHEN ([t0].[Level2_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [t0].[Id] - END IS NULL) AND ([l3].[OneToMany_Optional_Inverse4Id] IS NULL)))) + WHERE [l3].[Level3_Required_Id] IS NOT NULL AND [l3].[OneToMany_Required_Inverse4Id] IS NOT NULL AND CASE + WHEN [t0].[Level2_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [t0].[Id] + END IS NOT NULL AND (CASE + WHEN [t0].[Level2_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [t0].[Id] + END = [l3].[OneToMany_Optional_Inverse4Id] OR (CASE + WHEN [t0].[Level2_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [t0].[Id] + END IS NULL AND [l3].[OneToMany_Optional_Inverse4Id] IS NULL))) """); } @@ -5693,12 +5693,12 @@ FROM [Level1] AS [l] LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[Level2_Name], [l0].[OneToMany_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id] FROM [Level1] AS [l0] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] ON [l].[Id] = [t].[OneToMany_Optional_Inverse2Id] LEFT JOIN ( SELECT [l1].[Id], [l1].[OneToOne_Required_PK_Date], [l1].[Level1_Optional_Id], [l1].[Level1_Required_Id], [l1].[Level2_Name], [l1].[OneToMany_Optional_Inverse2Id], [l1].[OneToMany_Required_Inverse2Id], [l1].[OneToOne_Optional_PK_Inverse2Id] FROM [Level1] AS [l1] - WHERE ([l1].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l1].[Level1_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l1].[OneToOne_Required_PK_Date] IS NOT NULL AND [l1].[Level1_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t0] ON [l].[Id] = [t0].[OneToMany_Required_Inverse2Id] ORDER BY [l].[Id], [t].[Id] """); @@ -5715,12 +5715,12 @@ FROM [Level1] AS [l] LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[Level2_Name], [l0].[OneToMany_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id] FROM [Level1] AS [l0] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] ON [l].[Id] = CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] END LEFT JOIN [Level1] AS [l1] ON [t].[Level1_Required_Id] = [l1].[Id] -WHERE ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) AND [l1].[Id] > 7 +WHERE [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL AND [l1].[Id] > 7 """); } @@ -5730,15 +5730,15 @@ public override async Task Select_optional_navigation_property_string_concat(boo AssertSql( """ -SELECT (COALESCE([l].[Name], N'') + N' ') + COALESCE(CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Level2_Name] +SELECT COALESCE([l].[Name], N'') + N' ' + COALESCE(CASE + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Level2_Name] ELSE N'NULL' END, N'') FROM [Level1] AS [l] LEFT JOIN ( SELECT [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Required_Id], [l0].[Level2_Name], [l0].[OneToMany_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l0] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) AND [l0].[Id] > 5 + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL AND [l0].[Id] > 5 ) AS [t] ON [l].[Id] = [t].[OneToMany_Optional_Inverse2Id] """); } @@ -5750,35 +5750,35 @@ public override async Task Join_navigation_in_outer_selector_translated_to_extra AssertSql( """ SELECT CASE - WHEN ([t0].[Level2_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [t0].[Id] + WHEN [t0].[Level2_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [t0].[Id] END AS [Id3], [l4].[Id] AS [Id1] FROM [Level1] AS [l] LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Required_Id], [l0].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l0] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] ON [l].[Id] = CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] END LEFT JOIN ( SELECT [l1].[Id], [l1].[Level2_Required_Id], [l1].[OneToMany_Required_Inverse3Id] FROM [Level1] AS [l1] - WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse3Id] IS NOT NULL) + WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL ) AS [t0] ON CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] END = CASE - WHEN ([t0].[Level2_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [t0].[Id] + WHEN [t0].[Level2_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [t0].[Id] END LEFT JOIN ( SELECT [l2].[Id], [l2].[OneToOne_Required_PK_Date], [l2].[Level1_Optional_Id], [l2].[Level1_Required_Id], [l2].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l2] - WHERE ([l2].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l2].[Level1_Required_Id] IS NOT NULL) AND ([l2].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l2].[OneToOne_Required_PK_Date] IS NOT NULL AND [l2].[Level1_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t1] ON [t0].[Level2_Required_Id] = CASE - WHEN ([t1].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t1].[Level1_Required_Id] IS NOT NULL) AND ([t1].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t1].[Id] + WHEN [t1].[OneToOne_Required_PK_Date] IS NOT NULL AND [t1].[Level1_Required_Id] IS NOT NULL AND [t1].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t1].[Id] END LEFT JOIN [Level1] AS [l3] ON [t1].[Level1_Optional_Id] = [l3].[Id] INNER JOIN [Level1] AS [l4] ON [l3].[Id] = [l4].[Id] -WHERE ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) AND ([t0].[Level2_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse3Id] IS NOT NULL) +WHERE [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL AND [t0].[Level2_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse3Id] IS NOT NULL """); } @@ -5795,12 +5795,12 @@ FROM [Level1] AS [l] LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[Level2_Name], [l0].[OneToMany_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id] FROM [Level1] AS [l0] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] ON [l].[Id] = [t].[Level1_Optional_Id] LEFT JOIN ( SELECT [l1].[Id], [l1].[OneToOne_Required_PK_Date], [l1].[Level1_Optional_Id], [l1].[Level1_Required_Id], [l1].[Level2_Name], [l1].[OneToMany_Optional_Inverse2Id], [l1].[OneToMany_Required_Inverse2Id], [l1].[OneToOne_Optional_PK_Inverse2Id] FROM [Level1] AS [l1] - WHERE ([l1].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l1].[Level1_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l1].[OneToOne_Required_PK_Date] IS NOT NULL AND [l1].[Level1_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t0] ON [l].[Id] = [t0].[OneToOne_Optional_PK_Inverse2Id] ) AS [t1] """); @@ -5817,7 +5817,7 @@ FROM [Level1] AS [l] INNER JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[Level2_Name], [l0].[OneToMany_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id] FROM [Level1] AS [l0] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] ON [l].[Id] = [t].[OneToMany_Optional_Inverse2Id] WHERE [l].[Id] = 1 """); @@ -5837,20 +5837,20 @@ FROM [Level1] AS [l0] LEFT JOIN ( SELECT [l1].[Id], [l1].[OneToOne_Required_PK_Date], [l1].[Level1_Optional_Id], [l1].[Level1_Required_Id], [l1].[Level2_Name], [l1].[OneToMany_Optional_Inverse2Id], [l1].[OneToMany_Required_Inverse2Id], [l1].[OneToOne_Optional_PK_Inverse2Id] FROM [Level1] AS [l1] - WHERE ([l1].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l1].[Level1_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l1].[OneToOne_Required_PK_Date] IS NOT NULL AND [l1].[Level1_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] ON [l0].[Id] = CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] END LEFT JOIN ( SELECT [l2].[Id], [l2].[Level2_Optional_Id], [l2].[Level2_Required_Id], [l2].[Level3_Name], [l2].[OneToMany_Optional_Inverse3Id], [l2].[OneToMany_Required_Inverse3Id], [l2].[OneToOne_Optional_PK_Inverse3Id] FROM [Level1] AS [l2] - WHERE ([l2].[Level2_Required_Id] IS NOT NULL) AND ([l2].[OneToMany_Required_Inverse3Id] IS NOT NULL) + WHERE [l2].[Level2_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse3Id] IS NOT NULL ) AS [t0] ON CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] END = CASE - WHEN ([t0].[Level2_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [t0].[Id] + WHEN [t0].[Level2_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [t0].[Id] END - WHERE ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) AND ([t0].[Level2_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse3Id] IS NOT NULL) + WHERE [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL AND [t0].[Level2_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse3Id] IS NOT NULL ) AS [t1] ORDER BY (SELECT 1) OFFSET 1 ROWS FETCH NEXT 1 ROWS ONLY) AS [Subquery] @@ -5870,7 +5870,7 @@ FROM [Level1] AS [l] LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[Level2_Name], [l0].[OneToMany_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id] FROM [Level1] AS [l0] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] ON [l].[Id] = [t].[Level1_Optional_Id] """); } @@ -5886,9 +5886,9 @@ FROM [Level1] AS [l] LEFT JOIN ( SELECT [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l0] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] ON [l].[Id] = [t].[Level1_Optional_Id] -WHERE ([t].[OneToOne_Required_PK_Date] IS NULL) OR ([t].[Level1_Required_Id] IS NULL) OR ([t].[OneToMany_Required_Inverse2Id] IS NULL) +WHERE [t].[OneToOne_Required_PK_Date] IS NULL OR [t].[Level1_Required_Id] IS NULL OR [t].[OneToMany_Required_Inverse2Id] IS NULL """); } @@ -5906,11 +5906,11 @@ FROM [Level1] AS [l0] LEFT JOIN ( SELECT [l1].[Id], [l1].[OneToOne_Required_PK_Date], [l1].[Level1_Optional_Id], [l1].[Level1_Required_Id], [l1].[Level2_Name], [l1].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l1] - WHERE ([l1].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l1].[Level1_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l1].[OneToOne_Required_PK_Date] IS NOT NULL AND [l1].[Level1_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] ON [l0].[Id] = CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] END - WHERE ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t0] ON [l].[Id] = [t0].[Level1_Optional_Id] LEFT JOIN ( SELECT [t2].[Level1_Optional_Id], [t2].[Level2_Name] @@ -5918,13 +5918,13 @@ FROM [Level1] AS [l2] LEFT JOIN ( SELECT [l3].[Id], [l3].[OneToOne_Required_PK_Date], [l3].[Level1_Optional_Id], [l3].[Level1_Required_Id], [l3].[Level2_Name], [l3].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l3] - WHERE ([l3].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l3].[Level1_Required_Id] IS NOT NULL) AND ([l3].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l3].[OneToOne_Required_PK_Date] IS NOT NULL AND [l3].[Level1_Required_Id] IS NOT NULL AND [l3].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t2] ON [l2].[Id] = CASE - WHEN ([t2].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t2].[Level1_Required_Id] IS NOT NULL) AND ([t2].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t2].[Id] + WHEN [t2].[OneToOne_Required_PK_Date] IS NOT NULL AND [t2].[Level1_Required_Id] IS NOT NULL AND [t2].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t2].[Id] END - WHERE ([t2].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t2].[Level1_Required_Id] IS NOT NULL) AND ([t2].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [t2].[OneToOne_Required_PK_Date] IS NOT NULL AND [t2].[Level1_Required_Id] IS NOT NULL AND [t2].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t1] ON [l].[Id] = [t1].[Level1_Optional_Id] -WHERE [t0].[Level2_Name] = N'L2 05' OR [t1].[Level2_Name] <> N'L2 42' OR ([t1].[Level2_Name] IS NULL) +WHERE [t0].[Level2_Name] = N'L2 05' OR [t1].[Level2_Name] <> N'L2 42' OR [t1].[Level2_Name] IS NULL """); } @@ -5939,7 +5939,7 @@ FROM [Level1] AS [l] LEFT JOIN ( SELECT [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id] FROM [Level1] AS [l0] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] ON [l].[Id] = [t].[Level1_Optional_Id] """); } @@ -5955,7 +5955,7 @@ FROM [Level1] AS [l] LEFT JOIN ( SELECT [l0].[Level1_Optional_Id], [l0].[Level2_Name] FROM [Level1] AS [l0] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] ON [l].[Id] = [t].[Level1_Optional_Id] WHERE [t].[Level2_Name] = N'L2 01' """); @@ -5974,10 +5974,10 @@ FROM [Level1] AS [l] LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l0] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] ON [l].[Id] = [t].[Level1_Optional_Id] WHERE DATEADD(day, CAST(CAST(CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] END AS float) AS int), DATEADD(day, CAST(15.0E0 AS int), [t].[OneToOne_Required_PK_Date])) > '2002-02-01T00:00:00.0000000' """); } @@ -5993,12 +5993,12 @@ FROM [Level1] AS [l] LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[Level2_Name], [l0].[OneToMany_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id] FROM [Level1] AS [l0] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] ON [l].[Id] = CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] END LEFT JOIN [Level1] AS [l1] ON [t].[Level1_Required_Id] = [l1].[Id] -WHERE ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) AND [l1].[Id] = 7 +WHERE [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL AND [l1].[Id] = 7 """); } @@ -6022,7 +6022,7 @@ FROM [Level1] AS [l0] LEFT JOIN ( SELECT [l1].[Id], [l1].[OneToOne_Required_PK_Date], [l1].[Level1_Optional_Id], [l1].[Level1_Required_Id], [l1].[Level2_Name], [l1].[OneToMany_Optional_Inverse2Id], [l1].[OneToMany_Required_Inverse2Id], [l1].[OneToOne_Optional_PK_Inverse2Id] FROM [Level1] AS [l1] - WHERE ([l1].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l1].[Level1_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l1].[OneToOne_Required_PK_Date] IS NOT NULL AND [l1].[Level1_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t2] ON [l0].[Id] = [t2].[Level1_Optional_Id] ) AS [t0] WHERE [t0].[row] <= 1 @@ -6037,7 +6037,7 @@ public override async Task SelectMany_navigation_comparison2(bool async) AssertSql( """ SELECT [l].[Id] AS [Id1], CASE - WHEN ([t0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t0].[Level1_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t0].[Id] + WHEN [t0].[OneToOne_Required_PK_Date] IS NOT NULL AND [t0].[Level1_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t0].[Id] END AS [Id2] FROM [Level1] AS [l] CROSS JOIN ( @@ -6046,11 +6046,11 @@ FROM [Level1] AS [l0] LEFT JOIN ( SELECT [l1].[Id], [l1].[OneToOne_Required_PK_Date], [l1].[Level1_Optional_Id], [l1].[Level1_Required_Id], [l1].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l1] - WHERE ([l1].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l1].[Level1_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l1].[OneToOne_Required_PK_Date] IS NOT NULL AND [l1].[Level1_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] ON [l0].[Id] = CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] END - WHERE ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t0] LEFT JOIN [Level1] AS [l2] ON [t0].[Level1_Optional_Id] = [l2].[Id] WHERE [l].[Id] = [l2].[Id] @@ -6068,10 +6068,10 @@ FROM [Level1] AS [l] LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Required_Id], [l0].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l0] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] ON [l].[Id] = [t].[Level1_Required_Id] WHERE CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] END = 7 """); } @@ -6087,18 +6087,18 @@ FROM [Level1] AS [l] LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Required_Id], [l0].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l0] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] ON [l].[Id] = [t].[Level1_Required_Id] WHERE ( SELECT COUNT(*) FROM [Level1] AS [l1] - WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse3Id] IS NOT NULL) AND (CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] - END IS NOT NULL) AND (CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] - END = [l1].[OneToMany_Optional_Inverse3Id] OR ((CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] - END IS NULL) AND ([l1].[OneToMany_Optional_Inverse3Id] IS NULL)))) > 0 + WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL AND CASE + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + END IS NOT NULL AND (CASE + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + END = [l1].[OneToMany_Optional_Inverse3Id] OR (CASE + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] + END IS NULL AND [l1].[OneToMany_Optional_Inverse3Id] IS NULL))) > 0 """); } @@ -6109,20 +6109,20 @@ public override async Task Select_multiple_nav_prop_optional_required(bool async AssertSql( """ SELECT CASE - WHEN ([t0].[Level2_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [t0].[Id] + WHEN [t0].[Level2_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [t0].[Id] END FROM [Level1] AS [l] LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l0] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] ON [l].[Id] = [t].[Level1_Optional_Id] LEFT JOIN ( SELECT [l1].[Id], [l1].[Level2_Required_Id], [l1].[OneToMany_Required_Inverse3Id] FROM [Level1] AS [l1] - WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse3Id] IS NOT NULL) + WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL ) AS [t0] ON CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] END = [t0].[Level2_Required_Id] """); } @@ -6138,7 +6138,7 @@ FROM [Level1] AS [l] LEFT JOIN ( SELECT [l0].[Level1_Optional_Id], [l0].[Level2_Name] FROM [Level1] AS [l0] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] ON [l].[Id] = [t].[Level1_Optional_Id] WHERE [t].[Level2_Name] IN (N'L2 05', N'L2 07') """); @@ -6158,11 +6158,11 @@ FROM [Level1] AS [l0] LEFT JOIN ( SELECT [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Level3_Name], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[OneToOne_Optional_PK_Inverse3Id] FROM [Level1] AS [l1] - WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse3Id] IS NOT NULL) + WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL ) AS [t] ON CASE - WHEN ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [l0].[Id] + WHEN [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [l0].[Id] END = [t].[Level2_Optional_Id] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t0] ON [l].[Id] = [t0].[OneToMany_Optional_Inverse2Id] """); } @@ -6174,17 +6174,17 @@ public override async Task Join_navigations_in_inner_selector_translated_without AssertSql( """ SELECT CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] END AS [Id2], [t0].[Id] AS [Id1], CASE - WHEN ([t2].[Level2_Required_Id] IS NOT NULL) AND ([t2].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [t2].[Id1] + WHEN [t2].[Level2_Required_Id] IS NOT NULL AND [t2].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [t2].[Id1] END AS [Id3] FROM [Level1] AS [l] LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Required_Id], [l0].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l0] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] ON [l].[Id] = CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] END INNER JOIN ( SELECT [l1].[Id], [t1].[Id] AS [Id0], [t1].[OneToOne_Required_PK_Date], [t1].[Level1_Required_Id], [t1].[OneToMany_Required_Inverse2Id] @@ -6192,12 +6192,12 @@ FROM [Level1] AS [l1] LEFT JOIN ( SELECT [l2].[Id], [l2].[OneToOne_Required_PK_Date], [l2].[Level1_Optional_Id], [l2].[Level1_Required_Id], [l2].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l2] - WHERE ([l2].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l2].[Level1_Required_Id] IS NOT NULL) AND ([l2].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l2].[OneToOne_Required_PK_Date] IS NOT NULL AND [l2].[Level1_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t1] ON [l1].[Id] = [t1].[Level1_Optional_Id] ) AS [t0] ON CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] END = CASE - WHEN ([t0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t0].[Level1_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t0].[Id0] + WHEN [t0].[OneToOne_Required_PK_Date] IS NOT NULL AND [t0].[Level1_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t0].[Id0] END INNER JOIN ( SELECT [t4].[Id] AS [Id1], [t4].[Level2_Required_Id], [t4].[OneToMany_Required_Inverse3Id], [t5].[Id] AS [Id2], [t5].[OneToOne_Required_PK_Date] AS [OneToOne_Required_PK_Date0], [t5].[Level1_Required_Id] AS [Level1_Required_Id0], [t5].[OneToMany_Required_Inverse2Id] AS [OneToMany_Required_Inverse2Id0] @@ -6205,33 +6205,33 @@ FROM [Level1] AS [l3] LEFT JOIN ( SELECT [l4].[Id], [l4].[OneToOne_Required_PK_Date], [l4].[Level1_Required_Id], [l4].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l4] - WHERE ([l4].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l4].[Level1_Required_Id] IS NOT NULL) AND ([l4].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l4].[OneToOne_Required_PK_Date] IS NOT NULL AND [l4].[Level1_Required_Id] IS NOT NULL AND [l4].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t3] ON [l3].[Id] = CASE - WHEN ([t3].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t3].[Level1_Required_Id] IS NOT NULL) AND ([t3].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t3].[Id] + WHEN [t3].[OneToOne_Required_PK_Date] IS NOT NULL AND [t3].[Level1_Required_Id] IS NOT NULL AND [t3].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t3].[Id] END LEFT JOIN ( SELECT [l5].[Id], [l5].[Level2_Optional_Id], [l5].[Level2_Required_Id], [l5].[OneToMany_Required_Inverse3Id] FROM [Level1] AS [l5] - WHERE ([l5].[Level2_Required_Id] IS NOT NULL) AND ([l5].[OneToMany_Required_Inverse3Id] IS NOT NULL) + WHERE [l5].[Level2_Required_Id] IS NOT NULL AND [l5].[OneToMany_Required_Inverse3Id] IS NOT NULL ) AS [t4] ON CASE - WHEN ([t3].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t3].[Level1_Required_Id] IS NOT NULL) AND ([t3].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t3].[Id] + WHEN [t3].[OneToOne_Required_PK_Date] IS NOT NULL AND [t3].[Level1_Required_Id] IS NOT NULL AND [t3].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t3].[Id] END = CASE - WHEN ([t4].[Level2_Required_Id] IS NOT NULL) AND ([t4].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [t4].[Id] + WHEN [t4].[Level2_Required_Id] IS NOT NULL AND [t4].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [t4].[Id] END LEFT JOIN ( SELECT [l6].[Id], [l6].[OneToOne_Required_PK_Date], [l6].[Level1_Required_Id], [l6].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l6] - WHERE ([l6].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l6].[Level1_Required_Id] IS NOT NULL) AND ([l6].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l6].[OneToOne_Required_PK_Date] IS NOT NULL AND [l6].[Level1_Required_Id] IS NOT NULL AND [l6].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t5] ON [t4].[Level2_Optional_Id] = CASE - WHEN ([t5].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t5].[Level1_Required_Id] IS NOT NULL) AND ([t5].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t5].[Id] + WHEN [t5].[OneToOne_Required_PK_Date] IS NOT NULL AND [t5].[Level1_Required_Id] IS NOT NULL AND [t5].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t5].[Id] END - WHERE ([t3].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t3].[Level1_Required_Id] IS NOT NULL) AND ([t3].[OneToMany_Required_Inverse2Id] IS NOT NULL) AND ([t4].[Level2_Required_Id] IS NOT NULL) AND ([t4].[OneToMany_Required_Inverse3Id] IS NOT NULL) + WHERE [t3].[OneToOne_Required_PK_Date] IS NOT NULL AND [t3].[Level1_Required_Id] IS NOT NULL AND [t3].[OneToMany_Required_Inverse2Id] IS NOT NULL AND [t4].[Level2_Required_Id] IS NOT NULL AND [t4].[OneToMany_Required_Inverse3Id] IS NOT NULL ) AS [t2] ON CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] END = CASE - WHEN ([t2].[OneToOne_Required_PK_Date0] IS NOT NULL) AND ([t2].[Level1_Required_Id0] IS NOT NULL) AND ([t2].[OneToMany_Required_Inverse2Id0] IS NOT NULL) THEN [t2].[Id2] + WHEN [t2].[OneToOne_Required_PK_Date0] IS NOT NULL AND [t2].[Level1_Required_Id0] IS NOT NULL AND [t2].[OneToMany_Required_Inverse2Id0] IS NOT NULL THEN [t2].[Id2] END -WHERE ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) +WHERE [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL """); } @@ -6246,7 +6246,7 @@ FROM [Level1] AS [l] LEFT JOIN ( SELECT [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id] FROM [Level1] AS [l0] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] ON [l].[Id] = [t].[Level1_Optional_Id] WHERE DATEADD(month, CAST(2 AS int), DATEADD(day, CAST(15.0E0 AS int), DATEADD(day, CAST(10.0E0 AS int), [t].[OneToOne_Required_PK_Date]))) > '2002-02-01T00:00:00.0000000' """); @@ -6263,7 +6263,7 @@ FROM [Level1] AS [l] LEFT JOIN ( SELECT [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id] FROM [Level1] AS [l0] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] ON [l].[Id] = [t].[Level1_Optional_Id] """); } @@ -6285,11 +6285,11 @@ FROM [Level1] AS [l1] LEFT JOIN ( SELECT [l2].[Id], [l2].[OneToOne_Required_PK_Date], [l2].[Level1_Optional_Id], [l2].[Level1_Required_Id], [l2].[Level2_Name], [l2].[OneToMany_Optional_Inverse2Id], [l2].[OneToMany_Required_Inverse2Id], [l2].[OneToOne_Optional_PK_Inverse2Id] FROM [Level1] AS [l2] - WHERE ([l2].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l2].[Level1_Required_Id] IS NOT NULL) AND ([l2].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l2].[OneToOne_Required_PK_Date] IS NOT NULL AND [l2].[Level1_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] ON [l1].[Id] = CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] END - WHERE ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t0] ON [l0].[Id] = [t0].[Level1_Optional_Id] WHERE ( SELECT COUNT(*) @@ -6300,11 +6300,11 @@ FROM [Level1] AS [l4] LEFT JOIN ( SELECT [l5].[Id], [l5].[OneToOne_Required_PK_Date], [l5].[Level1_Optional_Id], [l5].[Level1_Required_Id], [l5].[Level2_Name], [l5].[OneToMany_Optional_Inverse2Id], [l5].[OneToMany_Required_Inverse2Id], [l5].[OneToOne_Optional_PK_Inverse2Id] FROM [Level1] AS [l5] - WHERE ([l5].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l5].[Level1_Required_Id] IS NOT NULL) AND ([l5].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l5].[OneToOne_Required_PK_Date] IS NOT NULL AND [l5].[Level1_Required_Id] IS NOT NULL AND [l5].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t2] ON [l4].[Id] = CASE - WHEN ([t2].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t2].[Level1_Required_Id] IS NOT NULL) AND ([t2].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t2].[Id] + WHEN [t2].[OneToOne_Required_PK_Date] IS NOT NULL AND [t2].[Level1_Required_Id] IS NOT NULL AND [t2].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t2].[Id] END - WHERE ([t2].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t2].[Level1_Required_Id] IS NOT NULL) AND ([t2].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [t2].[OneToOne_Required_PK_Date] IS NOT NULL AND [t2].[Level1_Required_Id] IS NOT NULL AND [t2].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t1] ON [l3].[Id] = [t1].[Level1_Optional_Id]) > 7) > 4 AND [l].[Id] < 2 """); } @@ -6320,29 +6320,29 @@ FROM [Level1] AS [l] LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Required_Id], [l0].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l0] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] ON [l].[Id] = CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] END LEFT JOIN ( SELECT [l1].[Id], [l1].[Level2_Required_Id], [l1].[Level3_Name], [l1].[OneToMany_Required_Inverse3Id] FROM [Level1] AS [l1] - WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse3Id] IS NOT NULL) + WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL ) AS [t0] ON CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] END = CASE - WHEN ([t0].[Level2_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [t0].[Id] + WHEN [t0].[Level2_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [t0].[Id] END LEFT JOIN ( SELECT [l2].[Id], [l2].[OneToOne_Required_PK_Date], [l2].[Level1_Optional_Id], [l2].[Level1_Required_Id], [l2].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l2] - WHERE ([l2].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l2].[Level1_Required_Id] IS NOT NULL) AND ([l2].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l2].[OneToOne_Required_PK_Date] IS NOT NULL AND [l2].[Level1_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t1] ON [t0].[Level2_Required_Id] = CASE - WHEN ([t1].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t1].[Level1_Required_Id] IS NOT NULL) AND ([t1].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t1].[Id] + WHEN [t1].[OneToOne_Required_PK_Date] IS NOT NULL AND [t1].[Level1_Required_Id] IS NOT NULL AND [t1].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t1].[Id] END LEFT JOIN [Level1] AS [l3] ON [t1].[Level1_Required_Id] = [l3].[Id] LEFT JOIN [Level1] AS [l4] ON [t1].[Level1_Optional_Id] = [l4].[Id] -WHERE ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) AND ([t0].[Level2_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse3Id] IS NOT NULL) AND ([l3].[Id] = [l4].[Id] OR (([l3].[Id] IS NULL) AND ([l4].[Id] IS NULL))) AND ([l4].[Id] <> 7 OR ([l4].[Id] IS NULL)) +WHERE [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL AND [t0].[Level2_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse3Id] IS NOT NULL AND ([l3].[Id] = [l4].[Id] OR ([l3].[Id] IS NULL AND [l4].[Id] IS NULL)) AND ([l4].[Id] <> 7 OR [l4].[Id] IS NULL) """); } @@ -6358,24 +6358,24 @@ FROM [Level1] AS [l1] LEFT JOIN ( SELECT [l3].[Id], [l3].[OneToOne_Required_PK_Date], [l3].[Level1_Optional_Id], [l3].[Level1_Required_Id], [l3].[Level2_Name], [l3].[OneToMany_Optional_Inverse2Id], [l3].[OneToMany_Required_Inverse2Id], [l3].[OneToOne_Optional_PK_Inverse2Id] FROM [Level1] AS [l3] - WHERE ([l3].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l3].[Level1_Required_Id] IS NOT NULL) AND ([l3].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l3].[OneToOne_Required_PK_Date] IS NOT NULL AND [l3].[Level1_Required_Id] IS NOT NULL AND [l3].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t0] ON [l1].[Id] = CASE - WHEN ([t0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t0].[Level1_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t0].[Id] + WHEN [t0].[OneToOne_Required_PK_Date] IS NOT NULL AND [t0].[Level1_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t0].[Id] END LEFT JOIN [Level1] AS [l2] ON [t0].[Level1_Required_Id] = [l2].[Id] - WHERE ([t0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t0].[Level1_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [t0].[OneToOne_Required_PK_Date] IS NOT NULL AND [t0].[Level1_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse2Id] IS NOT NULL ORDER BY CASE - WHEN ([t0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t0].[Level1_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t0].[Id] + WHEN [t0].[OneToOne_Required_PK_Date] IS NOT NULL AND [t0].[Level1_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t0].[Id] END) FROM [Level1] AS [l] LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Required_Id], [l0].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l0] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] ON [l].[Id] = CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] END -WHERE ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) +WHERE [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL """); } @@ -6404,7 +6404,7 @@ FROM [Level1] AS [l] LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[Level2_Name], [l0].[OneToMany_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id] FROM [Level1] AS [l0] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] ON [l].[Id] = [t].[Level1_Optional_Id] """); } @@ -6426,11 +6426,11 @@ FROM [Level1] AS [l1] LEFT JOIN ( SELECT [l2].[Id], [l2].[OneToOne_Required_PK_Date], [l2].[Level1_Optional_Id], [l2].[Level1_Required_Id], [l2].[Level2_Name], [l2].[OneToMany_Optional_Inverse2Id], [l2].[OneToMany_Required_Inverse2Id], [l2].[OneToOne_Optional_PK_Inverse2Id] FROM [Level1] AS [l2] - WHERE ([l2].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l2].[Level1_Required_Id] IS NOT NULL) AND ([l2].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l2].[OneToOne_Required_PK_Date] IS NOT NULL AND [l2].[Level1_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] ON [l1].[Id] = CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] END - WHERE ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t0] ON [l0].[Id] = [t0].[Level1_Optional_Id]) > 4 """); } @@ -6446,9 +6446,9 @@ FROM [Level1] AS [l] LEFT JOIN ( SELECT [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Required_Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id] FROM [Level1] AS [l0] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] ON [l].[Id] = [t].[OneToOne_Optional_PK_Inverse2Id] -WHERE ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) +WHERE [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL """); } @@ -6463,7 +6463,7 @@ FROM [Level1] AS [l] LEFT JOIN ( SELECT [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id] FROM [Level1] AS [l0] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] ON [l].[Id] = [t].[Level1_Optional_Id] """); } @@ -6479,13 +6479,13 @@ FROM [Level1] AS [l] LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[Level2_Name], [l0].[OneToMany_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id] FROM [Level1] AS [l0] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] ON [l].[Id] = CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] END -WHERE ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) +WHERE [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL ORDER BY CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] END """); } @@ -6501,27 +6501,27 @@ FROM [Level1] AS [l] LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Required_Id], [l0].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l0] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] ON [l].[Id] = CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] END LEFT JOIN ( SELECT [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Level3_Name], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[OneToOne_Optional_PK_Inverse3Id] FROM [Level1] AS [l1] - WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse3Id] IS NOT NULL) + WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL ) AS [t0] ON CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] END = CASE - WHEN ([t0].[Level2_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [t0].[Id] + WHEN [t0].[Level2_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [t0].[Id] END LEFT JOIN ( SELECT [l2].[Id], [l2].[OneToOne_Required_PK_Date], [l2].[Level1_Required_Id], [l2].[Level2_Name], [l2].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l2] - WHERE ([l2].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l2].[Level1_Required_Id] IS NOT NULL) AND ([l2].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l2].[OneToOne_Required_PK_Date] IS NOT NULL AND [l2].[Level1_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t1] ON [t0].[Level2_Required_Id] = CASE - WHEN ([t1].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t1].[Level1_Required_Id] IS NOT NULL) AND ([t1].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t1].[Id] + WHEN [t1].[OneToOne_Required_PK_Date] IS NOT NULL AND [t1].[Level1_Required_Id] IS NOT NULL AND [t1].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t1].[Id] END -WHERE ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) AND ([t0].[Level2_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse3Id] IS NOT NULL) AND ([t1].[Level2_Name] IS NOT NULL) AND ([t1].[Level2_Name] LIKE N'L%') +WHERE [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL AND [t0].[Level2_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse3Id] IS NOT NULL AND [t1].[Level2_Name] IS NOT NULL AND [t1].[Level2_Name] LIKE N'L%' """); } @@ -6539,11 +6539,11 @@ FROM [Level1] AS [l0] LEFT JOIN ( SELECT [l1].[Id], [l1].[OneToOne_Required_PK_Date], [l1].[Level1_Optional_Id], [l1].[Level1_Required_Id], [l1].[Level2_Name], [l1].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l1] - WHERE ([l1].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l1].[Level1_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l1].[OneToOne_Required_PK_Date] IS NOT NULL AND [l1].[Level1_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] ON [l0].[Id] = CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] END - WHERE ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t0] ON [l].[Id] = [t0].[Level1_Optional_Id] """); } @@ -6559,16 +6559,16 @@ FROM [Level1] AS [l] LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l0] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] ON [l].[Id] = [t].[Level1_Optional_Id] LEFT JOIN ( SELECT [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[OneToMany_Required_Inverse3Id] FROM [Level1] AS [l1] - WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse3Id] IS NOT NULL) + WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL ) AS [t0] ON CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] END = [t0].[Level2_Optional_Id] -WHERE ([t0].[Level2_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse3Id] IS NOT NULL) +WHERE [t0].[Level2_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse3Id] IS NOT NULL """); } @@ -6583,12 +6583,12 @@ FROM [Level1] AS [l] LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Required_Id], [l0].[Level2_Name], [l0].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l0] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] ON [l].[Id] = CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] END LEFT JOIN [Level1] AS [l1] ON [t].[OneToMany_Required_Inverse2Id] = [l1].[Id] -WHERE ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) AND ([l1].[Id] = [l1].[Id] OR ([l1].[Id] IS NULL)) +WHERE [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL AND ([l1].[Id] = [l1].[Id] OR [l1].[Id] IS NULL) """); } @@ -6605,9 +6605,9 @@ FROM [Level1] AS [l] LEFT JOIN ( SELECT [l0].[Level1_Optional_Id], [l0].[Level2_Name] FROM [Level1] AS [l0] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] ON [l].[Id] = [t].[Level1_Optional_Id] -WHERE [t].[Level2_Name] <> N'Foo' OR ([t].[Level2_Name] IS NULL) +WHERE [t].[Level2_Name] <> N'Foo' OR [t].[Level2_Name] IS NULL ORDER BY [l].[Id] """); } @@ -6626,11 +6626,11 @@ FROM [Level1] AS [l0] LEFT JOIN ( SELECT [l1].[Id], [l1].[OneToOne_Required_PK_Date], [l1].[Level1_Optional_Id], [l1].[Level1_Required_Id], [l1].[Level2_Name], [l1].[OneToMany_Optional_Inverse2Id], [l1].[OneToMany_Required_Inverse2Id], [l1].[OneToOne_Optional_PK_Inverse2Id] FROM [Level1] AS [l1] - WHERE ([l1].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l1].[Level1_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l1].[OneToOne_Required_PK_Date] IS NOT NULL AND [l1].[Level1_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] ON [l0].[Id] = CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] END - WHERE ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) AND [t].[Level1_Required_Id] = [l].[Id]) + WHERE [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL AND [t].[Level1_Required_Id] = [l].[Id]) """); } @@ -6647,40 +6647,40 @@ FROM [Level1] AS [l1] LEFT JOIN ( SELECT [l3].[Id], [l3].[OneToOne_Required_PK_Date], [l3].[Level1_Optional_Id], [l3].[Level1_Required_Id], [l3].[Level2_Name], [l3].[OneToMany_Optional_Inverse2Id], [l3].[OneToMany_Required_Inverse2Id], [l3].[OneToOne_Optional_PK_Inverse2Id] FROM [Level1] AS [l3] - WHERE ([l3].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l3].[Level1_Required_Id] IS NOT NULL) AND ([l3].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l3].[OneToOne_Required_PK_Date] IS NOT NULL AND [l3].[Level1_Required_Id] IS NOT NULL AND [l3].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t0] ON [l1].[Id] = CASE - WHEN ([t0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t0].[Level1_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t0].[Id] + WHEN [t0].[OneToOne_Required_PK_Date] IS NOT NULL AND [t0].[Level1_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t0].[Id] END LEFT JOIN [Level1] AS [l2] ON [t0].[Level1_Required_Id] = [l2].[Id] - WHERE ([t0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t0].[Level1_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [t0].[OneToOne_Required_PK_Date] IS NOT NULL AND [t0].[Level1_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse2Id] IS NOT NULL ORDER BY CASE - WHEN ([t0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t0].[Level1_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t0].[Id] - END) = N'L1 02' AND (( + WHEN [t0].[OneToOne_Required_PK_Date] IS NOT NULL AND [t0].[Level1_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t0].[Id] + END) = N'L1 02' AND ( SELECT TOP(1) [l2].[Name] FROM [Level1] AS [l1] LEFT JOIN ( SELECT [l3].[Id], [l3].[OneToOne_Required_PK_Date], [l3].[Level1_Optional_Id], [l3].[Level1_Required_Id], [l3].[Level2_Name], [l3].[OneToMany_Optional_Inverse2Id], [l3].[OneToMany_Required_Inverse2Id], [l3].[OneToOne_Optional_PK_Inverse2Id] FROM [Level1] AS [l3] - WHERE ([l3].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l3].[Level1_Required_Id] IS NOT NULL) AND ([l3].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l3].[OneToOne_Required_PK_Date] IS NOT NULL AND [l3].[Level1_Required_Id] IS NOT NULL AND [l3].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t0] ON [l1].[Id] = CASE - WHEN ([t0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t0].[Level1_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t0].[Id] + WHEN [t0].[OneToOne_Required_PK_Date] IS NOT NULL AND [t0].[Level1_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t0].[Id] END LEFT JOIN [Level1] AS [l2] ON [t0].[Level1_Required_Id] = [l2].[Id] - WHERE ([t0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t0].[Level1_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [t0].[OneToOne_Required_PK_Date] IS NOT NULL AND [t0].[Level1_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse2Id] IS NOT NULL ORDER BY CASE - WHEN ([t0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t0].[Level1_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t0].[Id] - END) IS NOT NULL) THEN CAST(1 AS bit) + WHEN [t0].[OneToOne_Required_PK_Date] IS NOT NULL AND [t0].[Level1_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t0].[Id] + END) IS NOT NULL THEN CAST(1 AS bit) ELSE CAST(0 AS bit) END FROM [Level1] AS [l] LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Required_Id], [l0].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l0] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] ON [l].[Id] = CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] END -WHERE ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) +WHERE [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL """); } @@ -6698,7 +6698,7 @@ FROM [Level1] AS [l] LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[Level2_Name], [l0].[OneToMany_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id] FROM [Level1] AS [l0] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t0] ON [t].[Id] = [t0].[Level1_Optional_Id] """); } @@ -6717,12 +6717,12 @@ FROM [Level1] AS [l] LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[Level2_Name], [l0].[OneToMany_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id] FROM [Level1] AS [l0] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t0] ON [t].[Id] = [t0].[Level1_Optional_Id] LEFT JOIN ( SELECT [l1].[Id], [l1].[OneToOne_Required_PK_Date], [l1].[Level1_Optional_Id], [l1].[Level1_Required_Id], [l1].[Level2_Name], [l1].[OneToMany_Optional_Inverse2Id], [l1].[OneToMany_Required_Inverse2Id], [l1].[OneToOne_Optional_PK_Inverse2Id] FROM [Level1] AS [l1] - WHERE ([l1].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l1].[Level1_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l1].[OneToOne_Required_PK_Date] IS NOT NULL AND [l1].[Level1_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t1] ON [t].[Id] = [t1].[Level1_Optional_Id] """); } @@ -6738,7 +6738,7 @@ FROM [Level1] AS [l] LEFT JOIN ( SELECT [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id] FROM [Level1] AS [l0] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] ON [l].[Id] = [t].[Level1_Optional_Id] """); } @@ -6757,29 +6757,29 @@ FROM [Level1] AS [l] LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Required_Id], [l0].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l0] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] ON [l].[Id] = CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] END LEFT JOIN ( SELECT [l1].[Id], [l1].[Level2_Required_Id], [l1].[OneToMany_Required_Inverse3Id] FROM [Level1] AS [l1] - WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse3Id] IS NOT NULL) + WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL ) AS [t0] ON CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] END = CASE - WHEN ([t0].[Level2_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [t0].[Id] + WHEN [t0].[Level2_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [t0].[Id] END LEFT JOIN ( SELECT [l2].[Id], [l2].[OneToOne_Required_PK_Date], [l2].[Level1_Required_Id], [l2].[Level2_Name], [l2].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l2] - WHERE ([l2].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l2].[Level1_Required_Id] IS NOT NULL) AND ([l2].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l2].[OneToOne_Required_PK_Date] IS NOT NULL AND [l2].[Level1_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t1] ON [t0].[Level2_Required_Id] = CASE - WHEN ([t1].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t1].[Level1_Required_Id] IS NOT NULL) AND ([t1].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t1].[Id] + WHEN [t1].[OneToOne_Required_PK_Date] IS NOT NULL AND [t1].[Level1_Required_Id] IS NOT NULL AND [t1].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t1].[Id] END -WHERE ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) AND ([t0].[Level2_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse3Id] IS NOT NULL) +WHERE [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL AND [t0].[Level2_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse3Id] IS NOT NULL ORDER BY CASE - WHEN ([t1].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t1].[Level1_Required_Id] IS NOT NULL) AND ([t1].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t1].[Id] + WHEN [t1].[OneToOne_Required_PK_Date] IS NOT NULL AND [t1].[Level1_Required_Id] IS NOT NULL AND [t1].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t1].[Id] END """); } @@ -6798,11 +6798,11 @@ FROM [Level1] AS [l0] LEFT JOIN ( SELECT [l1].[Id], [l1].[OneToOne_Required_PK_Date], [l1].[Level1_Optional_Id], [l1].[Level1_Required_Id], [l1].[Level2_Name], [l1].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l1] - WHERE ([l1].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l1].[Level1_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l1].[OneToOne_Required_PK_Date] IS NOT NULL AND [l1].[Level1_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] ON [l0].[Id] = CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] END - WHERE ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t0] ON [l].[Id] = [t0].[Level1_Optional_Id] LEFT JOIN ( SELECT [t2].[Level1_Optional_Id], [t2].[Level2_Name] @@ -6810,11 +6810,11 @@ FROM [Level1] AS [l2] LEFT JOIN ( SELECT [l3].[Id], [l3].[OneToOne_Required_PK_Date], [l3].[Level1_Optional_Id], [l3].[Level1_Required_Id], [l3].[Level2_Name], [l3].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l3] - WHERE ([l3].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l3].[Level1_Required_Id] IS NOT NULL) AND ([l3].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l3].[OneToOne_Required_PK_Date] IS NOT NULL AND [l3].[Level1_Required_Id] IS NOT NULL AND [l3].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t2] ON [l2].[Id] = CASE - WHEN ([t2].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t2].[Level1_Required_Id] IS NOT NULL) AND ([t2].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t2].[Id] + WHEN [t2].[OneToOne_Required_PK_Date] IS NOT NULL AND [t2].[Level1_Required_Id] IS NOT NULL AND [t2].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t2].[Id] END - WHERE ([t2].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t2].[Level1_Required_Id] IS NOT NULL) AND ([t2].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [t2].[OneToOne_Required_PK_Date] IS NOT NULL AND [t2].[Level1_Required_Id] IS NOT NULL AND [t2].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t1] ON [l].[Id] = [t1].[Level1_Optional_Id] WHERE [t0].[Level2_Name] = N'L2 05' OR [t1].[Level2_Name] = N'L2 07' """); @@ -6827,7 +6827,7 @@ public override async Task Join_navigation_key_access_required(bool async) AssertSql( """ SELECT [l].[Id] AS [Id1], CASE - WHEN ([t0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t0].[Level1_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t0].[Id0] + WHEN [t0].[OneToOne_Required_PK_Date] IS NOT NULL AND [t0].[Level1_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t0].[Id0] END AS [Id2] FROM [Level1] AS [l] INNER JOIN ( @@ -6836,12 +6836,12 @@ FROM [Level1] AS [l0] LEFT JOIN ( SELECT [l2].[Id], [l2].[OneToOne_Required_PK_Date], [l2].[Level1_Required_Id], [l2].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l2] - WHERE ([l2].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l2].[Level1_Required_Id] IS NOT NULL) AND ([l2].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l2].[OneToOne_Required_PK_Date] IS NOT NULL AND [l2].[Level1_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] ON [l0].[Id] = CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] END LEFT JOIN [Level1] AS [l1] ON [t].[Level1_Required_Id] = [l1].[Id] - WHERE ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t0] ON [l].[Id] = [t0].[Id1] """); } @@ -6856,7 +6856,7 @@ SELECT CASE WHEN NOT EXISTS ( SELECT 1 FROM [Level1] AS [l] - WHERE [l].[Name] = N'Foo' AND ([l].[Name] IS NOT NULL)) THEN CAST(1 AS bit) + WHERE [l].[Name] = N'Foo' AND [l].[Name] IS NOT NULL) THEN CAST(1 AS bit) ELSE CAST(0 AS bit) END """); @@ -6877,14 +6877,14 @@ FROM [Level1] AS [l] LEFT JOIN ( SELECT [l0].[Level1_Required_Id], [l0].[Level2_Name] FROM [Level1] AS [l0] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] ON [l].[Id] = [t].[Level1_Required_Id] ORDER BY [t].[Level2_Name] ) AS [t0] LEFT JOIN ( SELECT [l1].[Id], [l1].[OneToOne_Required_PK_Date], [l1].[Level1_Optional_Id], [l1].[Level1_Required_Id], [l1].[Level2_Name], [l1].[OneToMany_Optional_Inverse2Id], [l1].[OneToMany_Required_Inverse2Id], [l1].[OneToOne_Optional_PK_Inverse2Id] FROM [Level1] AS [l1] - WHERE ([l1].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l1].[Level1_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l1].[OneToOne_Required_PK_Date] IS NOT NULL AND [l1].[Level1_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t1] ON [t0].[Id] = [t1].[Level1_Optional_Id] ORDER BY [t0].[Level2_Name] """); @@ -6897,7 +6897,7 @@ public override async Task Select_nav_prop_reference_optional2_via_DefaultIfEmpt AssertSql( """ SELECT CASE - WHEN ([t0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t0].[Level1_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t0].[Id0] + WHEN [t0].[OneToOne_Required_PK_Date] IS NOT NULL AND [t0].[Level1_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t0].[Id0] END FROM [Level1] AS [l] LEFT JOIN ( @@ -6906,11 +6906,11 @@ FROM [Level1] AS [l0] LEFT JOIN ( SELECT [l1].[Id], [l1].[OneToOne_Required_PK_Date], [l1].[Level1_Optional_Id], [l1].[Level1_Required_Id], [l1].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l1] - WHERE ([l1].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l1].[Level1_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l1].[OneToOne_Required_PK_Date] IS NOT NULL AND [l1].[Level1_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] ON [l0].[Id] = CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] END - WHERE ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t0] ON [l].[Id] = [t0].[Level1_Optional_Id] """); } @@ -6926,29 +6926,29 @@ FROM [Level1] AS [l] LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Required_Id], [l0].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l0] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] ON [l].[Id] = CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] END LEFT JOIN ( SELECT [l1].[Id], [l1].[Level2_Required_Id], [l1].[OneToMany_Required_Inverse3Id] FROM [Level1] AS [l1] - WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse3Id] IS NOT NULL) + WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL ) AS [t0] ON CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] END = CASE - WHEN ([t0].[Level2_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [t0].[Id] + WHEN [t0].[Level2_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [t0].[Id] END LEFT JOIN ( SELECT [l2].[Id], [l2].[OneToOne_Required_PK_Date], [l2].[Level1_Optional_Id], [l2].[Level1_Required_Id], [l2].[Level2_Name], [l2].[OneToMany_Optional_Inverse2Id], [l2].[OneToMany_Required_Inverse2Id], [l2].[OneToOne_Optional_PK_Inverse2Id] FROM [Level1] AS [l2] - WHERE ([l2].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l2].[Level1_Required_Id] IS NOT NULL) AND ([l2].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l2].[OneToOne_Required_PK_Date] IS NOT NULL AND [l2].[Level1_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t1] ON [t0].[Level2_Required_Id] = CASE - WHEN ([t1].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t1].[Level1_Required_Id] IS NOT NULL) AND ([t1].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t1].[Id] + WHEN [t1].[OneToOne_Required_PK_Date] IS NOT NULL AND [t1].[Level1_Required_Id] IS NOT NULL AND [t1].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t1].[Id] END -WHERE ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) AND ([t0].[Level2_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse3Id] IS NOT NULL) +WHERE [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL AND [t0].[Level2_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse3Id] IS NOT NULL ORDER BY CASE - WHEN ([t1].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t1].[Level1_Required_Id] IS NOT NULL) AND ([t1].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t1].[Id] + WHEN [t1].[OneToOne_Required_PK_Date] IS NOT NULL AND [t1].[Level1_Required_Id] IS NOT NULL AND [t1].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t1].[Id] END """); } @@ -6960,41 +6960,41 @@ public override async Task Where_complex_predicate_with_with_nav_prop_and_OrElse AssertSql( """ SELECT CASE - WHEN ([t0].[Level2_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [t0].[Id] + WHEN [t0].[Level2_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [t0].[Id] END FROM [Level1] AS [l] LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Required_Id], [l0].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l0] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] ON [l].[Id] = CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] END LEFT JOIN ( SELECT [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[OneToMany_Required_Inverse3Id] FROM [Level1] AS [l1] - WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse3Id] IS NOT NULL) + WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL ) AS [t0] ON CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] END = CASE - WHEN ([t0].[Level2_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [t0].[Id] + WHEN [t0].[Level2_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [t0].[Id] END LEFT JOIN ( SELECT [l2].[Id], [l2].[OneToOne_Required_PK_Date], [l2].[Level1_Required_Id], [l2].[Level2_Name], [l2].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l2] - WHERE ([l2].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l2].[Level1_Required_Id] IS NOT NULL) AND ([l2].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l2].[OneToOne_Required_PK_Date] IS NOT NULL AND [l2].[Level1_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t1] ON [t0].[Level2_Optional_Id] = CASE - WHEN ([t1].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t1].[Level1_Required_Id] IS NOT NULL) AND ([t1].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t1].[Id] + WHEN [t1].[OneToOne_Required_PK_Date] IS NOT NULL AND [t1].[Level1_Required_Id] IS NOT NULL AND [t1].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t1].[Id] END LEFT JOIN ( SELECT [l3].[Id], [l3].[OneToOne_Required_PK_Date], [l3].[Level1_Optional_Id], [l3].[Level1_Required_Id], [l3].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l3] - WHERE ([l3].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l3].[Level1_Required_Id] IS NOT NULL) AND ([l3].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l3].[OneToOne_Required_PK_Date] IS NOT NULL AND [l3].[Level1_Required_Id] IS NOT NULL AND [l3].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t2] ON [t0].[Level2_Required_Id] = CASE - WHEN ([t2].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t2].[Level1_Required_Id] IS NOT NULL) AND ([t2].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t2].[Id] + WHEN [t2].[OneToOne_Required_PK_Date] IS NOT NULL AND [t2].[Level1_Required_Id] IS NOT NULL AND [t2].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t2].[Id] END LEFT JOIN [Level1] AS [l4] ON [t2].[Level1_Optional_Id] = [l4].[Id] -WHERE ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) AND ([t0].[Level2_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse3Id] IS NOT NULL) AND ([t1].[Level2_Name] <> N'L2 05' OR ([t1].[Level2_Name] IS NULL) OR [l4].[Name] = N'L1 05') +WHERE [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL AND [t0].[Level2_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse3Id] IS NOT NULL AND ([t1].[Level2_Name] <> N'L2 05' OR [t1].[Level2_Name] IS NULL OR [l4].[Name] = N'L1 05') """); } @@ -7023,49 +7023,49 @@ FROM [Level1] AS [l2] LEFT JOIN ( SELECT [l4].[Id], [l4].[OneToOne_Required_PK_Date], [l4].[Level1_Optional_Id], [l4].[Level1_Required_Id], [l4].[Level2_Name], [l4].[OneToMany_Optional_Inverse2Id], [l4].[OneToMany_Required_Inverse2Id], [l4].[OneToOne_Optional_PK_Inverse2Id] FROM [Level1] AS [l4] - WHERE ([l4].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l4].[Level1_Required_Id] IS NOT NULL) AND ([l4].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l4].[OneToOne_Required_PK_Date] IS NOT NULL AND [l4].[Level1_Required_Id] IS NOT NULL AND [l4].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t1] ON [l2].[Id] = CASE - WHEN ([t1].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t1].[Level1_Required_Id] IS NOT NULL) AND ([t1].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t1].[Id] + WHEN [t1].[OneToOne_Required_PK_Date] IS NOT NULL AND [t1].[Level1_Required_Id] IS NOT NULL AND [t1].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t1].[Id] END LEFT JOIN ( SELECT [l5].[Id], [l5].[Level2_Optional_Id], [l5].[Level2_Required_Id], [l5].[Level3_Name], [l5].[OneToMany_Optional_Inverse3Id], [l5].[OneToMany_Required_Inverse3Id], [l5].[OneToOne_Optional_PK_Inverse3Id] FROM [Level1] AS [l5] - WHERE ([l5].[Level2_Required_Id] IS NOT NULL) AND ([l5].[OneToMany_Required_Inverse3Id] IS NOT NULL) + WHERE [l5].[Level2_Required_Id] IS NOT NULL AND [l5].[OneToMany_Required_Inverse3Id] IS NOT NULL ) AS [t2] ON CASE - WHEN ([t1].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t1].[Level1_Required_Id] IS NOT NULL) AND ([t1].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t1].[Id] + WHEN [t1].[OneToOne_Required_PK_Date] IS NOT NULL AND [t1].[Level1_Required_Id] IS NOT NULL AND [t1].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t1].[Id] END = CASE - WHEN ([t2].[Level2_Required_Id] IS NOT NULL) AND ([t2].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [t2].[Id] + WHEN [t2].[Level2_Required_Id] IS NOT NULL AND [t2].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [t2].[Id] END LEFT JOIN ( SELECT [l6].[Id], [l6].[OneToOne_Required_PK_Date], [l6].[Level1_Optional_Id], [l6].[Level1_Required_Id], [l6].[Level2_Name], [l6].[OneToMany_Optional_Inverse2Id], [l6].[OneToMany_Required_Inverse2Id], [l6].[OneToOne_Optional_PK_Inverse2Id] FROM [Level1] AS [l6] - WHERE ([l6].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l6].[Level1_Required_Id] IS NOT NULL) AND ([l6].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l6].[OneToOne_Required_PK_Date] IS NOT NULL AND [l6].[Level1_Required_Id] IS NOT NULL AND [l6].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t3] ON [t2].[Level2_Required_Id] = CASE - WHEN ([t3].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t3].[Level1_Required_Id] IS NOT NULL) AND ([t3].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t3].[Id] + WHEN [t3].[OneToOne_Required_PK_Date] IS NOT NULL AND [t3].[Level1_Required_Id] IS NOT NULL AND [t3].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t3].[Id] END LEFT JOIN [Level1] AS [l3] ON [t3].[Level1_Required_Id] = [l3].[Id] - WHERE ([t1].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t1].[Level1_Required_Id] IS NOT NULL) AND ([t1].[OneToMany_Required_Inverse2Id] IS NOT NULL) AND ([t2].[Level2_Required_Id] IS NOT NULL) AND ([t2].[OneToMany_Required_Inverse3Id] IS NOT NULL) + WHERE [t1].[OneToOne_Required_PK_Date] IS NOT NULL AND [t1].[Level1_Required_Id] IS NOT NULL AND [t1].[OneToMany_Required_Inverse2Id] IS NOT NULL AND [t2].[Level2_Required_Id] IS NOT NULL AND [t2].[OneToMany_Required_Inverse3Id] IS NOT NULL ORDER BY CASE - WHEN ([t2].[Level2_Required_Id] IS NOT NULL) AND ([t2].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [t2].[Id] + WHEN [t2].[Level2_Required_Id] IS NOT NULL AND [t2].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [t2].[Id] END) FROM [Level1] AS [l] LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Required_Id], [l0].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l0] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] ON [l].[Id] = CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] END LEFT JOIN ( SELECT [l1].[Id], [l1].[Level2_Required_Id], [l1].[OneToMany_Required_Inverse3Id] FROM [Level1] AS [l1] - WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse3Id] IS NOT NULL) + WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL ) AS [t0] ON CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] END = CASE - WHEN ([t0].[Level2_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [t0].[Id] + WHEN [t0].[Level2_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [t0].[Id] END -WHERE ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) AND ([t0].[Level2_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse3Id] IS NOT NULL) +WHERE [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL AND [t0].[Level2_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse3Id] IS NOT NULL """); } @@ -7080,24 +7080,24 @@ public override async Task Optional_navigation_take_optional_navigation(bool asy SELECT [t1].[Level3_Name] FROM ( SELECT TOP(@__p_0) [t].[Id] AS [Id0], [t].[OneToOne_Required_PK_Date], [t].[Level1_Required_Id], [t].[OneToMany_Required_Inverse2Id], CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] END AS [c] FROM [Level1] AS [l] LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l0] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] ON [l].[Id] = [t].[Level1_Optional_Id] ORDER BY CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] END ) AS [t0] LEFT JOIN ( SELECT [l1].[Level2_Optional_Id], [l1].[Level3_Name] FROM [Level1] AS [l1] - WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse3Id] IS NOT NULL) + WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL ) AS [t1] ON CASE - WHEN ([t0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t0].[Level1_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t0].[Id0] + WHEN [t0].[OneToOne_Required_PK_Date] IS NOT NULL AND [t0].[Level1_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t0].[Id0] END = [t1].[Level2_Optional_Id] ORDER BY [t0].[c] """); @@ -7114,14 +7114,14 @@ FROM [Level1] AS [l] LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l0] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] ON [l].[Id] = [t].[Level1_Optional_Id] INNER JOIN ( SELECT [l1].[Level3_Name], [l1].[OneToMany_Optional_Inverse3Id] FROM [Level1] AS [l1] - WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse3Id] IS NOT NULL) + WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL ) AS [t0] ON CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] END = [t0].[OneToMany_Optional_Inverse3Id] """); } @@ -7141,14 +7141,14 @@ FROM [Level1] AS [l] LEFT JOIN ( SELECT [l0].[Level1_Required_Id], [l0].[Level2_Name] FROM [Level1] AS [l0] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] ON [l].[Id] = [t].[Level1_Required_Id] ORDER BY [t].[Level2_Name] ) AS [t0] LEFT JOIN ( SELECT [l1].[Id], [l1].[OneToOne_Required_PK_Date], [l1].[Level1_Optional_Id], [l1].[Level1_Required_Id], [l1].[Level2_Name], [l1].[OneToMany_Optional_Inverse2Id], [l1].[OneToMany_Required_Inverse2Id], [l1].[OneToOne_Optional_PK_Inverse2Id] FROM [Level1] AS [l1] - WHERE ([l1].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l1].[Level1_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l1].[OneToOne_Required_PK_Date] IS NOT NULL AND [l1].[Level1_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t1] ON [t0].[Id] = [t1].[Level1_Optional_Id] ORDER BY [t0].[Level2_Name] """); @@ -7161,18 +7161,18 @@ public override async Task Navigation_with_same_navigation_compared_to_null(bool AssertSql( """ SELECT CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] END FROM [Level1] AS [l] LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Required_Id], [l0].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l0] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] ON [l].[Id] = CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] END LEFT JOIN [Level1] AS [l1] ON [t].[OneToMany_Required_Inverse2Id] = [l1].[Id] -WHERE ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) AND ([l1].[Name] <> N'L1 07' OR ([l1].[Name] IS NULL)) AND ([l1].[Id] IS NOT NULL) +WHERE [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL AND ([l1].[Name] <> N'L1 07' OR [l1].[Name] IS NULL) AND [l1].[Id] IS NOT NULL """); } @@ -7192,13 +7192,13 @@ FROM [Level1] AS [l0] LEFT JOIN ( SELECT [l1].[Id], [l1].[OneToOne_Required_PK_Date], [l1].[Level1_Optional_Id], [l1].[Level1_Required_Id], [l1].[Level2_Name], [l1].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l1] - WHERE ([l1].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l1].[Level1_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l1].[OneToOne_Required_PK_Date] IS NOT NULL AND [l1].[Level1_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] ON [l0].[Id] = CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] END - WHERE ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t0] ON [l].[Id] = [t0].[Level1_Optional_Id] -WHERE [t0].[Level2_Name] <> N'Foo' OR ([t0].[Level2_Name] IS NULL) +WHERE [t0].[Level2_Name] <> N'Foo' OR [t0].[Level2_Name] IS NULL ORDER BY [l].[Id] """); } @@ -7210,20 +7210,20 @@ public override async Task Navigation_key_access_required_comparison(bool async) AssertSql( """ SELECT CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] END FROM [Level1] AS [l] LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Required_Id], [l0].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l0] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] ON [l].[Id] = CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] END LEFT JOIN [Level1] AS [l1] ON CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] END = [l1].[Id] -WHERE ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) AND [l1].[Id] > 5 +WHERE [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL AND [l1].[Id] > 5 """); } @@ -7259,11 +7259,11 @@ FROM [Level1] AS [l1] LEFT JOIN ( SELECT [l2].[Id], [l2].[OneToOne_Required_PK_Date], [l2].[Level1_Optional_Id], [l2].[Level1_Required_Id], [l2].[Level2_Name], [l2].[OneToMany_Optional_Inverse2Id], [l2].[OneToMany_Required_Inverse2Id], [l2].[OneToOne_Optional_PK_Inverse2Id] FROM [Level1] AS [l2] - WHERE ([l2].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l2].[Level1_Required_Id] IS NOT NULL) AND ([l2].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l2].[OneToOne_Required_PK_Date] IS NOT NULL AND [l2].[Level1_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] ON [l1].[Id] = CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] END - WHERE ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t0] ON [l0].[Id] = [t0].[Level1_Optional_Id] ) AS [t1]) > 7 AND [l].[Id] < 3 """); @@ -7284,14 +7284,14 @@ FROM [Level1] AS [l] LEFT JOIN ( SELECT [l0].[Level1_Required_Id], [l0].[Level2_Name] FROM [Level1] AS [l0] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] ON [l].[Id] = [t].[Level1_Required_Id] ORDER BY [t].[Level2_Name] ) AS [t0] LEFT JOIN ( SELECT [l1].[Id], [l1].[OneToOne_Required_PK_Date], [l1].[Level1_Optional_Id], [l1].[Level1_Required_Id], [l1].[Level2_Name], [l1].[OneToMany_Optional_Inverse2Id], [l1].[OneToMany_Required_Inverse2Id], [l1].[OneToOne_Optional_PK_Inverse2Id] FROM [Level1] AS [l1] - WHERE ([l1].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l1].[Level1_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l1].[OneToOne_Required_PK_Date] IS NOT NULL AND [l1].[Level1_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t1] ON [t0].[Id] = [t1].[Level1_Optional_Id] ORDER BY [t0].[Level2_Name] """); @@ -7308,12 +7308,12 @@ FROM [Level1] AS [l] LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[Level2_Name], [l0].[OneToMany_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id] FROM [Level1] AS [l0] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] ON [l].[Id] = CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] END LEFT JOIN [Level1] AS [l1] ON [t].[Level1_Required_Id] = [l1].[Id] -WHERE ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) AND [l1].[Id] IN (1, 2) +WHERE [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL AND [l1].[Id] IN (1, 2) """); } @@ -7328,10 +7328,10 @@ FROM [Level1] AS [l] LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l0] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] ON [l].[Id] = [t].[Level1_Optional_Id] WHERE CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] END = 0 """); } @@ -7345,33 +7345,33 @@ public override async Task Member_pushdown_with_multiple_collections(bool async) SELECT ( SELECT TOP(1) [l0].[Level3_Name] FROM [Level1] AS [l0] - WHERE ([l0].[Level2_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse3Id] IS NOT NULL) AND (( + WHERE [l0].[Level2_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse3Id] IS NOT NULL AND ( SELECT TOP(1) CASE - WHEN ([l1].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l1].[Level1_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [l1].[Id] + WHEN [l1].[OneToOne_Required_PK_Date] IS NOT NULL AND [l1].[Level1_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [l1].[Id] END FROM [Level1] AS [l1] - WHERE ([l1].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l1].[Level1_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse2Id] IS NOT NULL) AND [l].[Id] = [l1].[OneToMany_Optional_Inverse2Id] + WHERE [l1].[OneToOne_Required_PK_Date] IS NOT NULL AND [l1].[Level1_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse2Id] IS NOT NULL AND [l].[Id] = [l1].[OneToMany_Optional_Inverse2Id] ORDER BY CASE - WHEN ([l1].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l1].[Level1_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [l1].[Id] - END) IS NOT NULL) AND (( + WHEN [l1].[OneToOne_Required_PK_Date] IS NOT NULL AND [l1].[Level1_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [l1].[Id] + END) IS NOT NULL AND (( SELECT TOP(1) CASE - WHEN ([l2].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l2].[Level1_Required_Id] IS NOT NULL) AND ([l2].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [l2].[Id] + WHEN [l2].[OneToOne_Required_PK_Date] IS NOT NULL AND [l2].[Level1_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [l2].[Id] END FROM [Level1] AS [l2] - WHERE ([l2].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l2].[Level1_Required_Id] IS NOT NULL) AND ([l2].[OneToMany_Required_Inverse2Id] IS NOT NULL) AND [l].[Id] = [l2].[OneToMany_Optional_Inverse2Id] + WHERE [l2].[OneToOne_Required_PK_Date] IS NOT NULL AND [l2].[Level1_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse2Id] IS NOT NULL AND [l].[Id] = [l2].[OneToMany_Optional_Inverse2Id] ORDER BY CASE - WHEN ([l2].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l2].[Level1_Required_Id] IS NOT NULL) AND ([l2].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [l2].[Id] - END) = [l0].[OneToMany_Optional_Inverse3Id] OR ((( + WHEN [l2].[OneToOne_Required_PK_Date] IS NOT NULL AND [l2].[Level1_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [l2].[Id] + END) = [l0].[OneToMany_Optional_Inverse3Id] OR (( SELECT TOP(1) CASE - WHEN ([l2].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l2].[Level1_Required_Id] IS NOT NULL) AND ([l2].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [l2].[Id] + WHEN [l2].[OneToOne_Required_PK_Date] IS NOT NULL AND [l2].[Level1_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [l2].[Id] END FROM [Level1] AS [l2] - WHERE ([l2].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l2].[Level1_Required_Id] IS NOT NULL) AND ([l2].[OneToMany_Required_Inverse2Id] IS NOT NULL) AND [l].[Id] = [l2].[OneToMany_Optional_Inverse2Id] + WHERE [l2].[OneToOne_Required_PK_Date] IS NOT NULL AND [l2].[Level1_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse2Id] IS NOT NULL AND [l].[Id] = [l2].[OneToMany_Optional_Inverse2Id] ORDER BY CASE - WHEN ([l2].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l2].[Level1_Required_Id] IS NOT NULL) AND ([l2].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [l2].[Id] - END) IS NULL) AND ([l0].[OneToMany_Optional_Inverse3Id] IS NULL))) + WHEN [l2].[OneToOne_Required_PK_Date] IS NOT NULL AND [l2].[Level1_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [l2].[Id] + END) IS NULL AND [l0].[OneToMany_Optional_Inverse3Id] IS NULL)) ORDER BY CASE - WHEN ([l0].[Level2_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [l0].[Id] + WHEN [l0].[Level2_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [l0].[Id] END) FROM [Level1] AS [l] """); @@ -7391,11 +7391,11 @@ FROM [Level1] AS [l0] LEFT JOIN ( SELECT [l1].[Id], [l1].[OneToOne_Required_PK_Date], [l1].[Level1_Optional_Id], [l1].[Level1_Required_Id], [l1].[Level2_Name], [l1].[OneToMany_Optional_Inverse2Id], [l1].[OneToMany_Required_Inverse2Id], [l1].[OneToOne_Optional_PK_Inverse2Id] FROM [Level1] AS [l1] - WHERE ([l1].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l1].[Level1_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l1].[OneToOne_Required_PK_Date] IS NOT NULL AND [l1].[Level1_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] ON [l0].[Id] = CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] END - WHERE ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t0] ON [l].[Id] = [t0].[Level1_Optional_Id] CROSS JOIN ( SELECT [t2].[Level1_Required_Id] @@ -7403,11 +7403,11 @@ FROM [Level1] AS [l2] LEFT JOIN ( SELECT [l3].[Id], [l3].[OneToOne_Required_PK_Date], [l3].[Level1_Required_Id], [l3].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l3] - WHERE ([l3].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l3].[Level1_Required_Id] IS NOT NULL) AND ([l3].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l3].[OneToOne_Required_PK_Date] IS NOT NULL AND [l3].[Level1_Required_Id] IS NOT NULL AND [l3].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t2] ON [l2].[Id] = CASE - WHEN ([t2].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t2].[Level1_Required_Id] IS NOT NULL) AND ([t2].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t2].[Id] + WHEN [t2].[OneToOne_Required_PK_Date] IS NOT NULL AND [t2].[Level1_Required_Id] IS NOT NULL AND [t2].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t2].[Id] END - WHERE ([t2].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t2].[Level1_Required_Id] IS NOT NULL) AND ([t2].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [t2].[OneToOne_Required_PK_Date] IS NOT NULL AND [t2].[Level1_Required_Id] IS NOT NULL AND [t2].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t1] INNER JOIN [Level1] AS [l4] ON [t1].[Level1_Required_Id] = [l4].[Id] """); @@ -7444,20 +7444,20 @@ public override async Task Select_multiple_nav_prop_reference_optional(bool asyn AssertSql( """ SELECT CASE - WHEN ([t0].[Level2_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [t0].[Id] + WHEN [t0].[Level2_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [t0].[Id] END FROM [Level1] AS [l] LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l0] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] ON [l].[Id] = [t].[Level1_Optional_Id] LEFT JOIN ( SELECT [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[OneToMany_Required_Inverse3Id] FROM [Level1] AS [l1] - WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse3Id] IS NOT NULL) + WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL ) AS [t0] ON CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] END = [t0].[Level2_Optional_Id] """); } @@ -7473,14 +7473,14 @@ FROM [Level1] AS [l] LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l0] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] ON [l].[Id] = [t].[Level1_Optional_Id] LEFT JOIN ( SELECT [l1].[Level2_Optional_Id], [l1].[Level3_Name] FROM [Level1] AS [l1] - WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse3Id] IS NOT NULL) + WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL ) AS [t0] ON CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] END = [t0].[Level2_Optional_Id] WHERE [t0].[Level3_Name] IS NOT NULL """); @@ -7505,11 +7505,11 @@ FROM [Level1] AS [l1] LEFT JOIN ( SELECT [l2].[Id], [l2].[OneToOne_Required_PK_Date], [l2].[Level1_Optional_Id], [l2].[Level1_Required_Id], [l2].[Level2_Name], [l2].[OneToMany_Optional_Inverse2Id], [l2].[OneToMany_Required_Inverse2Id], [l2].[OneToOne_Optional_PK_Inverse2Id] FROM [Level1] AS [l2] - WHERE ([l2].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l2].[Level1_Required_Id] IS NOT NULL) AND ([l2].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l2].[OneToOne_Required_PK_Date] IS NOT NULL AND [l2].[Level1_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] ON [l1].[Id] = CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] END - WHERE ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t0] ON [l0].[Id] = [t0].[Level1_Optional_Id] WHERE ( SELECT COUNT(*) @@ -7520,11 +7520,11 @@ FROM [Level1] AS [l4] LEFT JOIN ( SELECT [l5].[Id], [l5].[OneToOne_Required_PK_Date], [l5].[Level1_Optional_Id], [l5].[Level1_Required_Id], [l5].[Level2_Name], [l5].[OneToMany_Optional_Inverse2Id], [l5].[OneToMany_Required_Inverse2Id], [l5].[OneToOne_Optional_PK_Inverse2Id] FROM [Level1] AS [l5] - WHERE ([l5].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l5].[Level1_Required_Id] IS NOT NULL) AND ([l5].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l5].[OneToOne_Required_PK_Date] IS NOT NULL AND [l5].[Level1_Required_Id] IS NOT NULL AND [l5].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t2] ON [l4].[Id] = CASE - WHEN ([t2].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t2].[Level1_Required_Id] IS NOT NULL) AND ([t2].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t2].[Id] + WHEN [t2].[OneToOne_Required_PK_Date] IS NOT NULL AND [t2].[Level1_Required_Id] IS NOT NULL AND [t2].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t2].[Id] END - WHERE ([t2].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t2].[Level1_Required_Id] IS NOT NULL) AND ([t2].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [t2].[OneToOne_Required_PK_Date] IS NOT NULL AND [t2].[Level1_Required_Id] IS NOT NULL AND [t2].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t1] ON [l3].[Id] = [t1].[Level1_Optional_Id]) > 7 ORDER BY [l0].[Id] ) AS [t3]) > 4 AND [l].[Id] < 2 @@ -7542,10 +7542,10 @@ FROM [Level1] AS [l] LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l0] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] ON [l].[Id] = [t].[Level1_Optional_Id] WHERE CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] END = 0 """); } @@ -7613,21 +7613,21 @@ SELECT [l].[Id] FROM [Level1] AS [l] OUTER APPLY ( SELECT TOP(10) [t].[Id], [t].[OneToOne_Required_PK_Date], [t].[Level1_Optional_Id], [t].[Level1_Required_Id], [t].[Level2_Name], [t].[OneToMany_Optional_Inverse2Id], [t].[OneToMany_Required_Inverse2Id], [t].[OneToOne_Optional_PK_Inverse2Id], [l0].[Id] AS [Id0], CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] END AS [c] FROM [Level1] AS [l0] LEFT JOIN ( SELECT [l1].[Id], [l1].[OneToOne_Required_PK_Date], [l1].[Level1_Optional_Id], [l1].[Level1_Required_Id], [l1].[Level2_Name], [l1].[OneToMany_Optional_Inverse2Id], [l1].[OneToMany_Required_Inverse2Id], [l1].[OneToOne_Optional_PK_Inverse2Id] FROM [Level1] AS [l1] - WHERE ([l1].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l1].[Level1_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l1].[OneToOne_Required_PK_Date] IS NOT NULL AND [l1].[Level1_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] ON [l0].[Id] = CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] END - WHERE ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) AND [l].[Id] = [t].[Level1_Optional_Id] AND CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] + WHERE [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL AND [l].[Id] = [t].[Level1_Optional_Id] AND CASE + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] END > 0 ORDER BY CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] END ) AS [t0] """); @@ -7643,21 +7643,21 @@ SELECT [l].[Id] FROM [Level1] AS [l] CROSS APPLY ( SELECT TOP(10) [t].[Id], [t].[OneToOne_Required_PK_Date], [t].[Level1_Optional_Id], [t].[Level1_Required_Id], [t].[Level2_Name], [t].[OneToMany_Optional_Inverse2Id], [t].[OneToMany_Required_Inverse2Id], [t].[OneToOne_Optional_PK_Inverse2Id], [l0].[Id] AS [Id0], CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] END AS [c] FROM [Level1] AS [l0] LEFT JOIN ( SELECT [l1].[Id], [l1].[OneToOne_Required_PK_Date], [l1].[Level1_Optional_Id], [l1].[Level1_Required_Id], [l1].[Level2_Name], [l1].[OneToMany_Optional_Inverse2Id], [l1].[OneToMany_Required_Inverse2Id], [l1].[OneToOne_Optional_PK_Inverse2Id] FROM [Level1] AS [l1] - WHERE ([l1].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l1].[Level1_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l1].[OneToOne_Required_PK_Date] IS NOT NULL AND [l1].[Level1_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] ON [l0].[Id] = CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] END - WHERE ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) AND [l].[Id] = [t].[Level1_Optional_Id] AND CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] + WHERE [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL AND [l].[Id] = [t].[Level1_Optional_Id] AND CASE + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] END > 0 ORDER BY CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] END ) AS [t0] """); @@ -7808,14 +7808,14 @@ FROM [Level1] AS [l] INNER JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[Level2_Name], [l0].[OneToMany_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id] FROM [Level1] AS [l0] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] ON [l].[Id] = [t].[OneToMany_Optional_Inverse2Id] LEFT JOIN ( SELECT [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Level3_Name], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[OneToOne_Optional_PK_Inverse3Id] FROM [Level1] AS [l1] - WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse3Id] IS NOT NULL) + WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL ) AS [t0] ON CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] END = [t0].[Level2_Required_Id] """); } @@ -7831,21 +7831,21 @@ FROM [Level1] AS [l] INNER JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Required_Id], [l0].[OneToMany_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id] FROM [Level1] AS [l0] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] ON [l].[Id] = [t].[OneToMany_Optional_Inverse2Id] INNER JOIN ( SELECT [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Level3_Name], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[OneToOne_Optional_PK_Inverse3Id] FROM [Level1] AS [l1] - WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse3Id] IS NOT NULL) + WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL ) AS [t0] ON CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] END = [t0].[OneToMany_Optional_Inverse3Id] LEFT JOIN ( SELECT [l2].[Id], [l2].[Level3_Optional_Id], [l2].[Level3_Required_Id], [l2].[Level4_Name], [l2].[OneToMany_Optional_Inverse4Id], [l2].[OneToMany_Required_Inverse4Id], [l2].[OneToOne_Optional_PK_Inverse4Id] FROM [Level1] AS [l2] - WHERE ([l2].[Level3_Required_Id] IS NOT NULL) AND ([l2].[OneToMany_Required_Inverse4Id] IS NOT NULL) + WHERE [l2].[Level3_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse4Id] IS NOT NULL ) AS [t1] ON CASE - WHEN ([t0].[Level2_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [t0].[Id] + WHEN [t0].[Level2_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [t0].[Id] END = [t1].[Level3_Required_Id] """); } diff --git a/test/EFCore.SqlServer.FunctionalTests/Query/Ef6GroupBySqlServerTest.cs b/test/EFCore.SqlServer.FunctionalTests/Query/Ef6GroupBySqlServerTest.cs index 6485842381d..5081804a200 100644 --- a/test/EFCore.SqlServer.FunctionalTests/Query/Ef6GroupBySqlServerTest.cs +++ b/test/EFCore.SqlServer.FunctionalTests/Query/Ef6GroupBySqlServerTest.cs @@ -610,7 +610,7 @@ FROM [Person] AS [p0] LEFT JOIN [Feet] AS [f0] ON [p0].[Id] = [f0].[Id] ) AS [t1] WHERE [t1].[row] <= 1 -) AS [t0] ON ([t].[Id] = [t0].[Id0] OR (([t].[Id] IS NULL) AND ([t0].[Id0] IS NULL))) AND ([t].[Size] = [t0].[Size] OR (([t].[Size] IS NULL) AND ([t0].[Size] IS NULL))) +) AS [t0] ON ([t].[Id] = [t0].[Id0] OR ([t].[Id] IS NULL AND [t0].[Id0] IS NULL)) AND ([t].[Size] = [t0].[Size] OR ([t].[Size] IS NULL AND [t0].[Size] IS NULL)) """); } @@ -699,7 +699,7 @@ LEFT JOIN ( SELECT [s0].[Id], [s0].[Style], [s0].[Age], [p0].[Id] AS [Id0] FROM [Person] AS [p0] INNER JOIN [Shoes] AS [s0] ON [p0].[Age] = [s0].[Age] -) AS [t0] ON [t].[Id] = [t0].[Id0] AND ([t].[Style] = [t0].[Style] OR (([t].[Style] IS NULL) AND ([t0].[Style] IS NULL))) AND [t].[Age] = [t0].[Age] +) AS [t0] ON [t].[Id] = [t0].[Id0] AND ([t].[Style] = [t0].[Style] OR ([t].[Style] IS NULL AND [t0].[Style] IS NULL)) AND [t].[Age] = [t0].[Age] ORDER BY [t].[Id], [t].[Style], [t].[Age], [t0].[Id0] """); } @@ -716,7 +716,7 @@ public override async Task Whats_new_2021_sample_13(bool async) FROM [Person] AS [p] GROUP BY [p].[FirstName], [p].[MiddleInitial] ) AS [t] -LEFT JOIN [Person] AS [p0] ON ([t].[FirstName] = [p0].[FirstName] OR (([t].[FirstName] IS NULL) AND ([p0].[FirstName] IS NULL))) AND ([t].[MiddleInitial] = [p0].[MiddleInitial] OR (([t].[MiddleInitial] IS NULL) AND ([p0].[MiddleInitial] IS NULL))) +LEFT JOIN [Person] AS [p0] ON ([t].[FirstName] = [p0].[FirstName] OR ([t].[FirstName] IS NULL AND [p0].[FirstName] IS NULL)) AND ([t].[MiddleInitial] = [p0].[MiddleInitial] OR ([t].[MiddleInitial] IS NULL AND [p0].[MiddleInitial] IS NULL)) ORDER BY [t].[FirstName], [t].[MiddleInitial], [p0].[Id] """); } @@ -753,7 +753,7 @@ ORDER BY [p].[FirstName] LEFT JOIN ( SELECT [t1].[FirstName], [t1].[FullName], [t1].[c] FROM ( - SELECT [p0].[FirstName], (((COALESCE([p0].[FirstName], N'') + N' ') + COALESCE([p0].[MiddleInitial], N'')) + N' ') + COALESCE([p0].[LastName], N'') AS [FullName], 1 AS [c], ROW_NUMBER() OVER(PARTITION BY [p0].[FirstName] ORDER BY [p0].[Id]) AS [row] + SELECT [p0].[FirstName], COALESCE([p0].[FirstName], N'') + N' ' + COALESCE([p0].[MiddleInitial], N'') + N' ' + COALESCE([p0].[LastName], N'') AS [FullName], 1 AS [c], ROW_NUMBER() OVER(PARTITION BY [p0].[FirstName] ORDER BY [p0].[Id]) AS [row] FROM [Person] AS [p0] ) AS [t1] WHERE [t1].[row] <= 1 @@ -801,11 +801,11 @@ FROM [Person] AS [p1] LEFT JOIN [Feet] AS [f0] ON [p1].[Id] = [f0].[Id] LEFT JOIN [Person] AS [p2] ON [f0].[Id] = [p2].[Id] LEFT JOIN [Feet] AS [f1] ON [p1].[Id] = [f1].[Id] - WHERE [f0].[Size] = @__size_0 AND ([p1].[MiddleInitial] IS NOT NULL) AND ([f0].[Id] <> 1 OR ([f0].[Id] IS NULL)) AND ([f].[Size] = [f0].[Size] OR (([f].[Size] IS NULL) AND ([f0].[Size] IS NULL))) AND ([p0].[LastName] = [p2].[LastName] OR (([p0].[LastName] IS NULL) AND ([p2].[LastName] IS NULL)))) AS [Min] + WHERE [f0].[Size] = @__size_0 AND [p1].[MiddleInitial] IS NOT NULL AND ([f0].[Id] <> 1 OR [f0].[Id] IS NULL) AND ([f].[Size] = [f0].[Size] OR ([f].[Size] IS NULL AND [f0].[Size] IS NULL)) AND ([p0].[LastName] = [p2].[LastName] OR ([p0].[LastName] IS NULL AND [p2].[LastName] IS NULL))) AS [Min] FROM [Person] AS [p] LEFT JOIN [Feet] AS [f] ON [p].[Id] = [f].[Id] LEFT JOIN [Person] AS [p0] ON [f].[Id] = [p0].[Id] -WHERE [f].[Size] = @__size_0 AND ([p].[MiddleInitial] IS NOT NULL) AND ([f].[Id] <> 1 OR ([f].[Id] IS NULL)) +WHERE [f].[Size] = @__size_0 AND [p].[MiddleInitial] IS NOT NULL AND ([f].[Id] <> 1 OR [f].[Id] IS NULL) GROUP BY [f].[Size], [p0].[LastName] """); } @@ -844,7 +844,7 @@ public override async Task Whats_new_2021_sample_9(bool async) SELECT COALESCE(SUM([f].[Size]), 0) FROM [Person] AS [p0] LEFT JOIN [Feet] AS [f] ON [p0].[Id] = [f].[Id] - WHERE [p].[FirstName] = [p0].[FirstName] OR (([p].[FirstName] IS NULL) AND ([p0].[FirstName] IS NULL))) AS [Total] + WHERE [p].[FirstName] = [p0].[FirstName] OR ([p].[FirstName] IS NULL AND [p0].[FirstName] IS NULL)) AS [Total] FROM [Person] AS [p] GROUP BY [p].[FirstName] """); @@ -872,7 +872,7 @@ public override async Task Whats_new_2021_sample_4(bool async) SELECT TOP(1) [s0].[Style] FROM [Person] AS [p0] INNER JOIN [Shoes] AS [s0] ON [p0].[Age] = [s0].[Age] - WHERE [s].[Style] = [s0].[Style] OR (([s].[Style] IS NULL) AND ([s0].[Style] IS NULL))) AS [Style], COUNT(*) AS [Count] + WHERE [s].[Style] = [s0].[Style] OR ([s].[Style] IS NULL AND [s0].[Style] IS NULL)) AS [Style], COUNT(*) AS [Count] FROM [Person] AS [p] INNER JOIN [Shoes] AS [s] ON [p].[Age] = [s].[Age] GROUP BY [s].[Style] diff --git a/test/EFCore.SqlServer.FunctionalTests/Query/EntitySplittingQuerySqlServerTest.cs b/test/EFCore.SqlServer.FunctionalTests/Query/EntitySplittingQuerySqlServerTest.cs index 6072dcb4832..a8c100f902e 100644 --- a/test/EFCore.SqlServer.FunctionalTests/Query/EntitySplittingQuerySqlServerTest.cs +++ b/test/EFCore.SqlServer.FunctionalTests/Query/EntitySplittingQuerySqlServerTest.cs @@ -209,9 +209,9 @@ public override async Task Normal_entity_owning_a_split_reference_with_main_frag AssertSql( """ SELECT [e].[Id], CASE - WHEN ([e].[OwnedReference_Id] IS NOT NULL) AND ([e].[OwnedReference_OwnedIntValue1] IS NOT NULL) AND ([e].[OwnedReference_OwnedIntValue2] IS NOT NULL) AND ([o0].[OwnedIntValue3] IS NOT NULL) AND ([o].[OwnedIntValue4] IS NOT NULL) THEN [o].[OwnedIntValue4] + WHEN [e].[OwnedReference_Id] IS NOT NULL AND [e].[OwnedReference_OwnedIntValue1] IS NOT NULL AND [e].[OwnedReference_OwnedIntValue2] IS NOT NULL AND [o0].[OwnedIntValue3] IS NOT NULL AND [o].[OwnedIntValue4] IS NOT NULL THEN [o].[OwnedIntValue4] END AS [OwnedIntValue4], CASE - WHEN ([e].[OwnedReference_Id] IS NOT NULL) AND ([e].[OwnedReference_OwnedIntValue1] IS NOT NULL) AND ([e].[OwnedReference_OwnedIntValue2] IS NOT NULL) AND ([o0].[OwnedIntValue3] IS NOT NULL) AND ([o].[OwnedIntValue4] IS NOT NULL) THEN [o].[OwnedStringValue4] + WHEN [e].[OwnedReference_Id] IS NOT NULL AND [e].[OwnedReference_OwnedIntValue1] IS NOT NULL AND [e].[OwnedReference_OwnedIntValue2] IS NOT NULL AND [o0].[OwnedIntValue3] IS NOT NULL AND [o].[OwnedIntValue4] IS NOT NULL THEN [o].[OwnedStringValue4] END AS [OwnedStringValue4] FROM [EntityOnes] AS [e] LEFT JOIN [OwnedReferenceExtras2] AS [o] ON [e].[Id] = [o].[EntityOneId] diff --git a/test/EFCore.SqlServer.FunctionalTests/Query/FunkyDataQuerySqlServerTest.cs b/test/EFCore.SqlServer.FunctionalTests/Query/FunkyDataQuerySqlServerTest.cs index dfb0b5c36cf..c554afea882 100644 --- a/test/EFCore.SqlServer.FunctionalTests/Query/FunkyDataQuerySqlServerTest.cs +++ b/test/EFCore.SqlServer.FunctionalTests/Query/FunkyDataQuerySqlServerTest.cs @@ -82,7 +82,7 @@ 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 """, // """ @@ -90,13 +90,13 @@ FROM [FunkyCustomers] AS [f] 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 """, // """ @@ -104,7 +104,7 @@ FROM [FunkyCustomers] AS [f] 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 """, // """ @@ -112,7 +112,7 @@ FROM [FunkyCustomers] AS [f] 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 """, // """ @@ -120,7 +120,7 @@ FROM [FunkyCustomers] AS [f] 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) """, // """ @@ -128,13 +128,13 @@ WHERE NOT ((@__prm6_0 LIKE N'') OR CHARINDEX(@__prm6_0, [f].[FirstName]) > 0) 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) """); } @@ -147,7 +147,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 """); } @@ -160,7 +160,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) """); } @@ -172,13 +172,13 @@ public override async Task String_starts_with_on_argument_with_wildcard_constant """ SELECT [f].[FirstName] FROM [FunkyCustomers] AS [f] -WHERE ([f].[FirstName] IS NOT NULL) AND ([f].[FirstName] LIKE N'\%B%' ESCAPE N'\') +WHERE [f].[FirstName] IS NOT NULL AND [f].[FirstName] LIKE N'\%B%' ESCAPE N'\' """, // """ SELECT [f].[FirstName] FROM [FunkyCustomers] AS [f] -WHERE ([f].[FirstName] IS NOT NULL) AND ([f].[FirstName] LIKE N'a\_%' ESCAPE N'\') +WHERE [f].[FirstName] IS NOT NULL AND [f].[FirstName] LIKE N'a\_%' ESCAPE N'\' """, // """ @@ -195,13 +195,13 @@ FROM [FunkyCustomers] AS [f] """ SELECT [f].[FirstName] FROM [FunkyCustomers] AS [f] -WHERE ([f].[FirstName] IS NOT NULL) AND ([f].[FirstName] LIKE N'\_Ba\_%' ESCAPE N'\') +WHERE [f].[FirstName] IS NOT NULL AND [f].[FirstName] LIKE N'\_Ba\_%' ESCAPE N'\' """, // """ SELECT [f].[FirstName] FROM [FunkyCustomers] AS [f] -WHERE ([f].[FirstName] IS NOT NULL) AND NOT ([f].[FirstName] LIKE N'\%B\%a\%r%' ESCAPE N'\') +WHERE [f].[FirstName] IS NOT NULL AND NOT ([f].[FirstName] LIKE N'\%B\%a\%r%' ESCAPE N'\') """, // """ @@ -227,7 +227,7 @@ 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) """, // """ @@ -235,7 +235,7 @@ FROM [FunkyCustomers] AS [f] 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) """, // """ @@ -249,7 +249,7 @@ 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) """, // """ @@ -257,7 +257,7 @@ FROM [FunkyCustomers] AS [f] 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) """, // """ @@ -265,7 +265,7 @@ FROM [FunkyCustomers] AS [f] 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 """, // """ @@ -273,7 +273,7 @@ FROM [FunkyCustomers] AS [f] 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 """, // """ @@ -291,19 +291,19 @@ public override async Task String_starts_with_on_argument_with_bracket(bool asyn """ SELECT [f].[Id], [f].[FirstName], [f].[LastName], [f].[NullableBool] FROM [FunkyCustomers] AS [f] -WHERE ([f].[FirstName] IS NOT NULL) AND ([f].[FirstName] LIKE N'\[%' ESCAPE N'\') +WHERE [f].[FirstName] IS NOT NULL AND [f].[FirstName] LIKE N'\[%' ESCAPE N'\' """, // """ SELECT [f].[Id], [f].[FirstName], [f].[LastName], [f].[NullableBool] FROM [FunkyCustomers] AS [f] -WHERE ([f].[FirstName] IS NOT NULL) AND ([f].[FirstName] LIKE N'B\[%' ESCAPE N'\') +WHERE [f].[FirstName] IS NOT NULL AND [f].[FirstName] LIKE N'B\[%' ESCAPE N'\' """, // """ SELECT [f].[Id], [f].[FirstName], [f].[LastName], [f].[NullableBool] FROM [FunkyCustomers] AS [f] -WHERE ([f].[FirstName] IS NOT NULL) AND ([f].[FirstName] LIKE N'B\[\[a^%' ESCAPE N'\') +WHERE [f].[FirstName] IS NOT NULL AND [f].[FirstName] LIKE N'B\[\[a^%' ESCAPE N'\' """, // """ @@ -311,7 +311,7 @@ FROM [FunkyCustomers] AS [f] 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) """, // """ @@ -319,7 +319,7 @@ FROM [FunkyCustomers] AS [f] 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) """, // """ @@ -327,13 +327,13 @@ FROM [FunkyCustomers] AS [f] 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]) """); } @@ -346,7 +346,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]) """); } @@ -359,7 +359,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] """); } @@ -371,13 +371,13 @@ public override async Task String_ends_with_on_argument_with_wildcard_constant(b """ SELECT [f].[FirstName] FROM [FunkyCustomers] AS [f] -WHERE ([f].[FirstName] IS NOT NULL) AND ([f].[FirstName] LIKE N'%\%B' ESCAPE N'\') +WHERE [f].[FirstName] IS NOT NULL AND [f].[FirstName] LIKE N'%\%B' ESCAPE N'\' """, // """ SELECT [f].[FirstName] FROM [FunkyCustomers] AS [f] -WHERE ([f].[FirstName] IS NOT NULL) AND ([f].[FirstName] LIKE N'%a\_' ESCAPE N'\') +WHERE [f].[FirstName] IS NOT NULL AND [f].[FirstName] LIKE N'%a\_' ESCAPE N'\' """, // """ @@ -394,13 +394,13 @@ FROM [FunkyCustomers] AS [f] """ SELECT [f].[FirstName] FROM [FunkyCustomers] AS [f] -WHERE ([f].[FirstName] IS NOT NULL) AND ([f].[FirstName] LIKE N'%\_Ba\_' ESCAPE N'\') +WHERE [f].[FirstName] IS NOT NULL AND [f].[FirstName] LIKE N'%\_Ba\_' ESCAPE N'\' """, // """ SELECT [f].[FirstName] FROM [FunkyCustomers] AS [f] -WHERE ([f].[FirstName] IS NOT NULL) AND NOT ([f].[FirstName] LIKE N'%\%B\%a\%r' ESCAPE N'\') +WHERE [f].[FirstName] IS NOT NULL AND NOT ([f].[FirstName] LIKE N'%\%B\%a\%r' ESCAPE N'\') """, // """ @@ -426,7 +426,7 @@ 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) """, // """ @@ -434,7 +434,7 @@ FROM [FunkyCustomers] AS [f] 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) """, // """ @@ -448,7 +448,7 @@ 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) """, // """ @@ -456,7 +456,7 @@ FROM [FunkyCustomers] AS [f] 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) """, // """ @@ -464,7 +464,7 @@ FROM [FunkyCustomers] AS [f] 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 """, // """ @@ -472,7 +472,7 @@ FROM [FunkyCustomers] AS [f] 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 """, // """ @@ -491,7 +491,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]) """); } @@ -504,7 +504,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] """); } @@ -518,7 +518,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) """); @@ -534,7 +534,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) """); @@ -550,7 +550,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] """); @@ -566,9 +566,9 @@ public override async Task String_ends_with_not_equals_nullable_column(bool asyn FROM [FunkyCustomers] AS [f] CROSS JOIN [FunkyCustomers] AS [f0] WHERE CASE - WHEN ([f0].[LastName] = N'' AND ([f0].[LastName] IS NOT NULL)) OR (([f].[FirstName] IS NOT NULL) AND ([f0].[LastName] IS NOT NULL) AND RIGHT([f].[FirstName], LEN([f0].[LastName])) = [f0].[LastName]) THEN CAST(1 AS bit) + WHEN ([f0].[LastName] = N'' AND [f0].[LastName] IS NOT NULL) OR ([f].[FirstName] IS NOT NULL AND [f0].[LastName] IS NOT NULL AND RIGHT([f].[FirstName], LEN([f0].[LastName])) = [f0].[LastName]) THEN CAST(1 AS bit) ELSE CAST(0 AS bit) -END <> [f].[NullableBool] OR ([f].[NullableBool] IS NULL) +END <> [f].[NullableBool] OR [f].[NullableBool] IS NULL """); } diff --git a/test/EFCore.SqlServer.FunctionalTests/Query/GearsOfWarQuerySqlServerTest.cs b/test/EFCore.SqlServer.FunctionalTests/Query/GearsOfWarQuerySqlServerTest.cs index b5d77fa52af..30df55d58fe 100644 --- a/test/EFCore.SqlServer.FunctionalTests/Query/GearsOfWarQuerySqlServerTest.cs +++ b/test/EFCore.SqlServer.FunctionalTests/Query/GearsOfWarQuerySqlServerTest.cs @@ -47,18 +47,6 @@ FROM [Squads] AS [s] """); } - public override async Task Double_negate_on_column(bool async) - { - await base.Double_negate_on_column(async); - - AssertSql( -""" -SELECT [s].[Id], [s].[Banner], [s].[Banner5], [s].[InternalNumber], [s].[Name] -FROM [Squads] AS [s] -WHERE -(-[s].[Id]) = [s].[Id] -"""); - } - public override async Task Negate_on_like_expression(bool async) { await base.Negate_on_like_expression(async); @@ -67,7 +55,7 @@ public override async Task Negate_on_like_expression(bool async) """ SELECT [s].[Id], [s].[Banner], [s].[Banner5], [s].[InternalNumber], [s].[Name] FROM [Squads] AS [s] -WHERE ([s].[Name] IS NOT NULL) AND NOT ([s].[Name] LIKE N'us%') +WHERE [s].[Name] IS NOT NULL AND NOT ([s].[Name] LIKE N'us%') """); } @@ -262,7 +250,7 @@ FROM [Tags] AS [t] SELECT [g].[Nickname], [g].[SquadId], [g].[AssignedCityName], [g].[CityOfBirthName], [g].[Discriminator], [g].[FullName], [g].[HasSoulPatch], [g].[LeaderNickname], [g].[LeaderSquadId], [g].[Rank], [t].[Id], [t].[GearNickName], [t].[GearSquadId], [t].[IssueDate], [t].[Note] FROM [Gears] AS [g] LEFT JOIN [Tags] AS [t] ON [g].[Nickname] = [t].[GearNickName] AND [g].[SquadId] = [t].[GearSquadId] -WHERE ([t].[Id] IS NOT NULL) AND [t].[Id] IN ('34c8d86e-a4ac-4be5-827f-584dda348a07', 'df36f493-463f-4123-83f9-6b135deeb7ba', 'a8ad98f9-e023-4e2a-9a70-c2728455bd34', '70534e05-782c-4052-8720-c2c54481ce5f', 'a7be028a-0cf2-448f-ab55-ce8bc5d8cf69', 'b39a6fba-9026-4d69-828e-fd7068673e57') +WHERE [t].[Id] IS NOT NULL AND [t].[Id] IN ('34c8d86e-a4ac-4be5-827f-584dda348a07', 'df36f493-463f-4123-83f9-6b135deeb7ba', 'a8ad98f9-e023-4e2a-9a70-c2728455bd34', '70534e05-782c-4052-8720-c2c54481ce5f', 'a7be028a-0cf2-448f-ab55-ce8bc5d8cf69', 'b39a6fba-9026-4d69-828e-fd7068673e57') """); } @@ -281,7 +269,7 @@ FROM [Tags] AS [t] FROM [Gears] AS [g] INNER JOIN [Cities] AS [c] ON [g].[CityOfBirthName] = [c].[Name] LEFT JOIN [Tags] AS [t] ON [g].[Nickname] = [t].[GearNickName] AND [g].[SquadId] = [t].[GearSquadId] -WHERE ([c].[Location] IS NOT NULL) AND [t].[Id] IN ('34c8d86e-a4ac-4be5-827f-584dda348a07', 'df36f493-463f-4123-83f9-6b135deeb7ba', 'a8ad98f9-e023-4e2a-9a70-c2728455bd34', '70534e05-782c-4052-8720-c2c54481ce5f', 'a7be028a-0cf2-448f-ab55-ce8bc5d8cf69', 'b39a6fba-9026-4d69-828e-fd7068673e57') +WHERE [c].[Location] IS NOT NULL AND [t].[Id] IN ('34c8d86e-a4ac-4be5-827f-584dda348a07', 'df36f493-463f-4123-83f9-6b135deeb7ba', 'a8ad98f9-e023-4e2a-9a70-c2728455bd34', '70534e05-782c-4052-8720-c2c54481ce5f', 'a7be028a-0cf2-448f-ab55-ce8bc5d8cf69', 'b39a6fba-9026-4d69-828e-fd7068673e57') """); } @@ -299,7 +287,7 @@ FROM [Tags] AS [t] SELECT [g].[Nickname], [g].[SquadId], [g].[AssignedCityName], [g].[CityOfBirthName], [g].[Discriminator], [g].[FullName], [g].[HasSoulPatch], [g].[LeaderNickname], [g].[LeaderSquadId], [g].[Rank] FROM [Gears] AS [g] LEFT JOIN [Tags] AS [t] ON [g].[Nickname] = [t].[GearNickName] AND [g].[SquadId] = [t].[GearSquadId] -WHERE ([t].[Id] IS NOT NULL) AND [t].[Id] IN ('34c8d86e-a4ac-4be5-827f-584dda348a07', 'df36f493-463f-4123-83f9-6b135deeb7ba', 'a8ad98f9-e023-4e2a-9a70-c2728455bd34', '70534e05-782c-4052-8720-c2c54481ce5f', 'a7be028a-0cf2-448f-ab55-ce8bc5d8cf69', 'b39a6fba-9026-4d69-828e-fd7068673e57') +WHERE [t].[Id] IS NOT NULL AND [t].[Id] IN ('34c8d86e-a4ac-4be5-827f-584dda348a07', 'df36f493-463f-4123-83f9-6b135deeb7ba', 'a8ad98f9-e023-4e2a-9a70-c2728455bd34', '70534e05-782c-4052-8720-c2c54481ce5f', 'a7be028a-0cf2-448f-ab55-ce8bc5d8cf69', 'b39a6fba-9026-4d69-828e-fd7068673e57') """); } @@ -396,7 +384,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] """); } @@ -479,13 +467,13 @@ public override async Task Where_bitwise_and_enum(bool async) """ 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] & 2) > 0 +WHERE [g].[Rank] & 2 > 0 """, // """ 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] & 2) = 2 +WHERE [g].[Rank] & 2 = 2 """); } @@ -497,19 +485,19 @@ public override async Task Where_bitwise_and_integral(bool async) """ 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] & 1) = 1 +WHERE [g].[Rank] & 1 = 1 """, // """ 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 (CAST([g].[Rank] AS bigint) & CAST(1 AS bigint)) = CAST(1 AS bigint) +WHERE CAST([g].[Rank] AS bigint) & CAST(1 AS bigint) = CAST(1 AS bigint) """, // """ 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 (CAST([g].[Rank] AS smallint) & CAST(1 AS smallint)) = CAST(1 AS smallint) +WHERE CAST([g].[Rank] AS smallint) & CAST(1 AS smallint) = CAST(1 AS smallint) """); } @@ -521,7 +509,7 @@ public override async Task Where_bitwise_and_nullable_enum_with_constant(bool as """ SELECT [w].[Id], [w].[AmmunitionType], [w].[IsAutomatic], [w].[Name], [w].[OwnerFullName], [w].[SynergyWithId] FROM [Weapons] AS [w] -WHERE ([w].[AmmunitionType] & 1) > 0 +WHERE [w].[AmmunitionType] & 1 > 0 """); } @@ -533,7 +521,7 @@ public override async Task Where_bitwise_and_nullable_enum_with_null_constant(bo """ SELECT [w].[Id], [w].[AmmunitionType], [w].[IsAutomatic], [w].[Name], [w].[OwnerFullName], [w].[SynergyWithId] FROM [Weapons] AS [w] -WHERE ([w].[AmmunitionType] & NULL) > 0 +WHERE [w].[AmmunitionType] & NULL > 0 """); } @@ -547,7 +535,7 @@ public override async Task Where_bitwise_and_nullable_enum_with_non_nullable_par SELECT [w].[Id], [w].[AmmunitionType], [w].[IsAutomatic], [w].[Name], [w].[OwnerFullName], [w].[SynergyWithId] FROM [Weapons] AS [w] -WHERE ([w].[AmmunitionType] & @__ammunitionType_0) > 0 +WHERE [w].[AmmunitionType] & @__ammunitionType_0 > 0 """); } @@ -561,13 +549,13 @@ public override async Task Where_bitwise_and_nullable_enum_with_nullable_paramet SELECT [w].[Id], [w].[AmmunitionType], [w].[IsAutomatic], [w].[Name], [w].[OwnerFullName], [w].[SynergyWithId] FROM [Weapons] AS [w] -WHERE ([w].[AmmunitionType] & @__ammunitionType_0) > 0 +WHERE [w].[AmmunitionType] & @__ammunitionType_0 > 0 """, // """ SELECT [w].[Id], [w].[AmmunitionType], [w].[IsAutomatic], [w].[Name], [w].[OwnerFullName], [w].[SynergyWithId] FROM [Weapons] AS [w] -WHERE ([w].[AmmunitionType] & NULL) > 0 +WHERE [w].[AmmunitionType] & NULL > 0 """); } @@ -579,7 +567,7 @@ public override async Task Where_bitwise_or_enum(bool async) """ 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] | 2) > 0 +WHERE [g].[Rank] | 2 > 0 """); } @@ -590,14 +578,14 @@ public override async Task Bitwise_projects_values_in_select(bool async) AssertSql( """ SELECT TOP(1) CASE - WHEN ([g].[Rank] & 2) = 2 THEN CAST(1 AS bit) + WHEN [g].[Rank] & 2 = 2 THEN CAST(1 AS bit) ELSE CAST(0 AS bit) END AS [BitwiseTrue], CASE - WHEN ([g].[Rank] & 2) = 4 THEN CAST(1 AS bit) + WHEN [g].[Rank] & 2 = 4 THEN CAST(1 AS bit) ELSE CAST(0 AS bit) END AS [BitwiseFalse], [g].[Rank] & 2 AS [BitwiseValue] FROM [Gears] AS [g] -WHERE ([g].[Rank] & 2) = 2 +WHERE [g].[Rank] & 2 = 2 """); } @@ -609,31 +597,31 @@ public override async Task Where_enum_has_flag(bool async) """ 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] & 2) = 2 +WHERE [g].[Rank] & 2 = 2 """, // """ 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] & 18) = 18 +WHERE [g].[Rank] & 18 = 18 """, // """ 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] & 1) = 1 +WHERE [g].[Rank] & 1 = 1 """, // """ 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] & 1) = 1 +WHERE [g].[Rank] & 1 = 1 """, // """ 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 & [g].[Rank]) = [g].[Rank] +WHERE 2 & [g].[Rank] = [g].[Rank] """); } @@ -645,10 +633,10 @@ public override async Task Where_enum_has_flag_subquery(bool async) """ 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] & COALESCE(( +WHERE [g].[Rank] & COALESCE(( SELECT TOP(1) [g0].[Rank] FROM [Gears] AS [g0] - ORDER BY [g0].[Nickname], [g0].[SquadId]), 0)) = COALESCE(( + ORDER BY [g0].[Nickname], [g0].[SquadId]), 0) = COALESCE(( SELECT TOP(1) [g0].[Rank] FROM [Gears] AS [g0] ORDER BY [g0].[Nickname], [g0].[SquadId]), 0) @@ -657,10 +645,10 @@ FROM [Gears] AS [g0] """ 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 & COALESCE(( +WHERE 2 & COALESCE(( SELECT TOP(1) [g0].[Rank] FROM [Gears] AS [g0] - ORDER BY [g0].[Nickname], [g0].[SquadId]), 0)) = COALESCE(( + ORDER BY [g0].[Nickname], [g0].[SquadId]), 0) = COALESCE(( SELECT TOP(1) [g0].[Rank] FROM [Gears] AS [g0] ORDER BY [g0].[Nickname], [g0].[SquadId]), 0) @@ -675,31 +663,31 @@ public override async Task Where_enum_has_flag_subquery_with_pushdown(bool async """ 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])) = ( + ORDER BY [g0].[Nickname], [g0].[SquadId]) = ( SELECT TOP(1) [g0].[Rank] FROM [Gears] AS [g0] - ORDER BY [g0].[Nickname], [g0].[SquadId]) OR (( + ORDER BY [g0].[Nickname], [g0].[SquadId]) OR ( SELECT TOP(1) [g0].[Rank] FROM [Gears] AS [g0] - ORDER BY [g0].[Nickname], [g0].[SquadId]) IS NULL) + ORDER BY [g0].[Nickname], [g0].[SquadId]) IS NULL """, // """ SELECT [g].[Nickname], [g].[SquadId], [g].[AssignedCityName], [g].[CityOfBirthName], [g].[Discriminator], [g].[FullName], [g].[HasSoulPatch], [g].[LeaderNickname], [g].[LeaderSquadId], [g].[Rank] FROM [Gears] AS [g] -WHERE (2 & ( +WHERE 2 & ( SELECT TOP(1) [g0].[Rank] FROM [Gears] AS [g0] - ORDER BY [g0].[Nickname], [g0].[SquadId])) = ( + ORDER BY [g0].[Nickname], [g0].[SquadId]) = ( SELECT TOP(1) [g0].[Rank] FROM [Gears] AS [g0] - ORDER BY [g0].[Nickname], [g0].[SquadId]) OR (( + ORDER BY [g0].[Nickname], [g0].[SquadId]) OR ( SELECT TOP(1) [g0].[Rank] FROM [Gears] AS [g0] - ORDER BY [g0].[Nickname], [g0].[SquadId]) IS NULL) + ORDER BY [g0].[Nickname], [g0].[SquadId]) IS NULL """); } @@ -711,16 +699,16 @@ public override async Task Where_enum_has_flag_subquery_client_eval(bool async) """ 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])) = ( + ORDER BY [g0].[Nickname], [g0].[SquadId]) = ( SELECT TOP(1) [g0].[Rank] FROM [Gears] AS [g0] - ORDER BY [g0].[Nickname], [g0].[SquadId]) OR (( + ORDER BY [g0].[Nickname], [g0].[SquadId]) OR ( SELECT TOP(1) [g0].[Rank] FROM [Gears] AS [g0] - ORDER BY [g0].[Nickname], [g0].[SquadId]) IS NULL) + ORDER BY [g0].[Nickname], [g0].[SquadId]) IS NULL """); } @@ -734,7 +722,7 @@ public override async Task Where_enum_has_flag_with_non_nullable_parameter(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] -WHERE ([g].[Rank] & @__parameter_0) = @__parameter_0 +WHERE [g].[Rank] & @__parameter_0 = @__parameter_0 """); } @@ -748,7 +736,7 @@ public override async Task Where_has_flag_with_nullable_parameter(bool async) 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] & @__parameter_0) = @__parameter_0 +WHERE [g].[Rank] & @__parameter_0 = @__parameter_0 """); } @@ -759,14 +747,14 @@ public override async Task Select_enum_has_flag(bool async) AssertSql( """ SELECT TOP(1) CASE - WHEN ([g].[Rank] & 2) = 2 THEN CAST(1 AS bit) + WHEN [g].[Rank] & 2 = 2 THEN CAST(1 AS bit) ELSE CAST(0 AS bit) END AS [hasFlagTrue], CASE - WHEN ([g].[Rank] & 4) = 4 THEN CAST(1 AS bit) + WHEN [g].[Rank] & 4 = 4 THEN CAST(1 AS bit) ELSE CAST(0 AS bit) END AS [hasFlagFalse] FROM [Gears] AS [g] -WHERE ([g].[Rank] & 2) = 2 +WHERE [g].[Rank] & 2 = 2 """); } @@ -824,7 +812,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] @@ -906,11 +894,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 """); } @@ -949,7 +937,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] @@ -981,7 +969,7 @@ public override async Task Null_propagation_optimization1(bool async) """ 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 """); } @@ -997,7 +985,7 @@ FROM [Gears] AS [g] WHERE CASE WHEN [g].[LeaderNickname] IS NULL THEN NULL ELSE CASE - WHEN ([g].[LeaderNickname] IS NOT NULL) AND ([g].[LeaderNickname] LIKE N'%us') THEN CAST(1 AS bit) + WHEN [g].[LeaderNickname] IS NOT NULL AND [g].[LeaderNickname] LIKE N'%us' THEN CAST(1 AS bit) ELSE CAST(0 AS bit) END END = CAST(1 AS bit) @@ -1035,10 +1023,10 @@ FROM [Gears] AS [g] WHERE CASE WHEN [g].[LeaderNickname] IS NULL THEN NULL ELSE CAST(LEN([g].[LeaderNickname]) AS int) -END = 5 AND (CASE +END = 5 AND CASE WHEN [g].[LeaderNickname] IS NULL THEN NULL ELSE CAST(LEN([g].[LeaderNickname]) AS int) -END IS NOT NULL) +END IS NOT NULL """); } @@ -1054,10 +1042,10 @@ FROM [Gears] AS [g] WHERE CASE WHEN [g].[LeaderNickname] IS NOT NULL THEN CAST(LEN([g].[LeaderNickname]) AS int) ELSE NULL -END = 5 AND (CASE +END = 5 AND CASE WHEN [g].[LeaderNickname] IS NOT NULL THEN CAST(LEN([g].[LeaderNickname]) AS int) ELSE NULL -END IS NOT NULL) +END IS NOT NULL """); } @@ -1073,10 +1061,10 @@ FROM [Gears] AS [g] WHERE CASE WHEN [g].[LeaderNickname] IS NOT NULL THEN CAST(LEN([g].[LeaderNickname]) AS int) ELSE NULL -END = 5 AND (CASE +END = 5 AND CASE WHEN [g].[LeaderNickname] IS NOT NULL THEN CAST(LEN([g].[LeaderNickname]) AS int) ELSE NULL -END IS NOT NULL) +END IS NOT NULL """); } @@ -1156,7 +1144,7 @@ public override async Task Select_null_propagation_negative3(bool async) AssertSql( """ SELECT [g0].[Nickname], CASE - WHEN ([g0].[Nickname] IS NOT NULL) AND ([g0].[SquadId] IS NOT NULL) THEN CASE + WHEN [g0].[Nickname] IS NOT NULL AND [g0].[SquadId] IS NOT NULL THEN CASE WHEN [g0].[LeaderNickname] IS NOT NULL THEN CAST(1 AS bit) ELSE CAST(0 AS bit) END @@ -1175,7 +1163,7 @@ public override async Task Select_null_propagation_negative4(bool async) AssertSql( """ SELECT CASE - WHEN ([g0].[Nickname] IS NOT NULL) AND ([g0].[SquadId] IS NOT NULL) THEN CAST(1 AS bit) + WHEN [g0].[Nickname] IS NOT NULL AND [g0].[SquadId] IS NOT NULL THEN CAST(1 AS bit) ELSE CAST(0 AS bit) END, [g0].[Nickname] FROM [Gears] AS [g] @@ -1191,7 +1179,7 @@ public override async Task Select_null_propagation_negative5(bool async) AssertSql( """ SELECT CASE - WHEN ([g0].[Nickname] IS NOT NULL) AND ([g0].[SquadId] IS NOT NULL) THEN CAST(1 AS bit) + WHEN [g0].[Nickname] IS NOT NULL AND [g0].[SquadId] IS NOT NULL THEN CAST(1 AS bit) ELSE CAST(0 AS bit) END, [g0].[Nickname] FROM [Gears] AS [g] @@ -1289,7 +1277,7 @@ ELSE NULL END FROM [Tags] AS [t] LEFT JOIN [Gears] AS [g] ON [t].[GearNickName] = [g].[Nickname] AND [t].[GearSquadId] = [g].[SquadId] -LEFT JOIN [Tags] AS [t0] ON ([g].[Nickname] = [t0].[GearNickName] OR (([g].[Nickname] IS NULL) AND ([t0].[GearNickName] IS NULL))) AND ([g].[SquadId] = [t0].[GearSquadId] OR (([g].[SquadId] IS NULL) AND ([t0].[GearSquadId] IS NULL))) +LEFT JOIN [Tags] AS [t0] ON ([g].[Nickname] = [t0].[GearNickName] OR ([g].[Nickname] IS NULL AND [t0].[GearNickName] IS NULL)) AND ([g].[SquadId] = [t0].[GearSquadId] OR ([g].[SquadId] IS NULL AND [t0].[GearSquadId] IS NULL)) LEFT JOIN [Gears] AS [g0] ON [t0].[GearNickName] = [g0].[Nickname] AND [t0].[GearSquadId] = [g0].[SquadId] LEFT JOIN [Cities] AS [c] ON [g0].[AssignedCityName] = [c].[Name] """); @@ -1417,7 +1405,7 @@ FROM [Tags] AS [t] CROSS JOIN [Tags] AS [t0] LEFT JOIN [Gears] AS [g] ON [t].[GearNickName] = [g].[Nickname] AND [t].[GearSquadId] = [g].[SquadId] LEFT JOIN [Gears] AS [g0] ON [t0].[GearNickName] = [g0].[Nickname] AND [t0].[GearSquadId] = [g0].[SquadId] -WHERE [g].[Nickname] = [g0].[Nickname] OR (([g].[Nickname] IS NULL) AND ([g0].[Nickname] IS NULL)) +WHERE [g].[Nickname] = [g0].[Nickname] OR ([g].[Nickname] IS NULL AND [g0].[Nickname] IS NULL) """); } @@ -1430,7 +1418,7 @@ public override async Task Select_Singleton_Navigation_With_Member_Access(bool a SELECT [g].[Nickname], [g].[SquadId], [g].[AssignedCityName], [g].[CityOfBirthName], [g].[Discriminator], [g].[FullName], [g].[HasSoulPatch], [g].[LeaderNickname], [g].[LeaderSquadId], [g].[Rank] FROM [Tags] AS [t] LEFT JOIN [Gears] AS [g] ON [t].[GearNickName] = [g].[Nickname] AND [t].[GearSquadId] = [g].[SquadId] -WHERE [g].[Nickname] = N'Marcus' AND ([g].[CityOfBirthName] <> N'Ephyra' OR ([g].[CityOfBirthName] IS NULL)) +WHERE [g].[Nickname] = N'Marcus' AND ([g].[CityOfBirthName] <> N'Ephyra' OR [g].[CityOfBirthName] IS NULL) """); } @@ -1458,7 +1446,7 @@ FROM [Tags] AS [t] CROSS JOIN [Tags] AS [t0] LEFT JOIN [Gears] AS [g] ON [t].[GearNickName] = [g].[Nickname] AND [t].[GearSquadId] = [g].[SquadId] LEFT JOIN [Gears] AS [g0] ON [t0].[GearNickName] = [g0].[Nickname] AND [t0].[GearSquadId] = [g0].[SquadId] -WHERE ([g].[Nickname] = [g0].[Nickname] OR (([g].[Nickname] IS NULL) AND ([g0].[Nickname] IS NULL))) AND ([g].[SquadId] = [g0].[SquadId] OR (([g].[SquadId] IS NULL) AND ([g0].[SquadId] IS NULL))) +WHERE ([g].[Nickname] = [g0].[Nickname] OR ([g].[Nickname] IS NULL AND [g0].[Nickname] IS NULL)) AND ([g].[SquadId] = [g0].[SquadId] OR ([g].[SquadId] IS NULL AND [g0].[SquadId] IS NULL)) """); } @@ -1471,7 +1459,7 @@ public override async Task Select_Where_Navigation_Null(bool async) SELECT [t].[Id], [t].[GearNickName], [t].[GearSquadId], [t].[IssueDate], [t].[Note] FROM [Tags] AS [t] LEFT JOIN [Gears] AS [g] ON [t].[GearNickName] = [g].[Nickname] AND [t].[GearSquadId] = [g].[SquadId] -WHERE ([g].[Nickname] IS NULL) OR ([g].[SquadId] IS NULL) +WHERE [g].[Nickname] IS NULL OR [g].[SquadId] IS NULL """); } @@ -1484,7 +1472,7 @@ public override async Task Select_Where_Navigation_Null_Reverse(bool async) SELECT [t].[Id], [t].[GearNickName], [t].[GearSquadId], [t].[IssueDate], [t].[Note] FROM [Tags] AS [t] LEFT JOIN [Gears] AS [g] ON [t].[GearNickName] = [g].[Nickname] AND [t].[GearSquadId] = [g].[SquadId] -WHERE ([g].[Nickname] IS NULL) OR ([g].[SquadId] IS NULL) +WHERE [g].[Nickname] IS NULL OR [g].[SquadId] IS NULL """); } @@ -1499,7 +1487,7 @@ FROM [Tags] AS [t] CROSS JOIN [Tags] AS [t0] LEFT JOIN [Gears] AS [g] ON [t].[GearNickName] = [g].[Nickname] AND [t].[GearSquadId] = [g].[SquadId] LEFT JOIN [Gears] AS [g0] ON [t0].[GearNickName] = [g0].[Nickname] AND [t0].[GearSquadId] = [g0].[SquadId] -WHERE [g].[Nickname] = [g0].[Nickname] OR (([g].[Nickname] IS NULL) AND ([g0].[Nickname] IS NULL)) +WHERE [g].[Nickname] = [g0].[Nickname] OR ([g].[Nickname] IS NULL AND [g0].[Nickname] IS NULL) """); } @@ -1619,7 +1607,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)) = CAST(1 AS bit) ORDER BY [g].[Nickname] """); @@ -1636,7 +1624,7 @@ FROM [Gears] AS [g] 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] """); } @@ -1654,7 +1642,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(1 AS bit) ORDER BY [g].[Nickname] """); @@ -1985,7 +1973,7 @@ public override async Task Singleton_Navigation_With_Member_Access(bool async) SELECT [g].[CityOfBirthName] AS [B] FROM [Tags] AS [t] LEFT JOIN [Gears] AS [g] ON [t].[GearNickName] = [g].[Nickname] AND [t].[GearSquadId] = [g].[SquadId] -WHERE [g].[Nickname] = N'Marcus' AND ([g].[CityOfBirthName] <> N'Ephyra' OR ([g].[CityOfBirthName] IS NULL)) +WHERE [g].[Nickname] = N'Marcus' AND ([g].[CityOfBirthName] <> N'Ephyra' OR [g].[CityOfBirthName] IS NULL) """); } @@ -2283,7 +2271,7 @@ public override async Task Include_on_GroupJoin_SelectMany_DefaultIfEmpty_with_c AssertSql( """ SELECT CASE - WHEN ([g0].[Nickname] IS NOT NULL) AND ([g0].[SquadId] IS NOT NULL) THEN CAST(1 AS bit) + WHEN [g0].[Nickname] IS NOT NULL AND [g0].[SquadId] IS NOT NULL THEN CAST(1 AS bit) ELSE CAST(0 AS bit) END, [g0].[Nickname], [g0].[SquadId], [g0].[AssignedCityName], [g0].[CityOfBirthName], [g0].[Discriminator], [g0].[FullName], [g0].[HasSoulPatch], [g0].[LeaderNickname], [g0].[LeaderSquadId], [g0].[Rank], [g].[Nickname], [g].[SquadId], [w].[Id], [w].[AmmunitionType], [w].[IsAutomatic], [w].[Name], [w].[OwnerFullName], [w].[SynergyWithId], [g].[AssignedCityName], [g].[CityOfBirthName], [g].[Discriminator], [g].[FullName], [g].[HasSoulPatch], [g].[LeaderNickname], [g].[LeaderSquadId], [g].[Rank], [w0].[Id], [w0].[AmmunitionType], [w0].[IsAutomatic], [w0].[Name], [w0].[OwnerFullName], [w0].[SynergyWithId] FROM [Gears] AS [g] @@ -2301,7 +2289,7 @@ public override async Task Include_on_GroupJoin_SelectMany_DefaultIfEmpty_with_c AssertSql( """ SELECT [g].[Nickname], [g].[SquadId], [g].[AssignedCityName], [g].[CityOfBirthName], [g].[Discriminator], [g].[FullName], [g].[HasSoulPatch], [g].[LeaderNickname], [g].[LeaderSquadId], [g].[Rank], [g0].[Nickname], [g0].[SquadId], [w].[Id], [w].[AmmunitionType], [w].[IsAutomatic], [w].[Name], [w].[OwnerFullName], [w].[SynergyWithId], [g0].[AssignedCityName], [g0].[CityOfBirthName], [g0].[Discriminator], [g0].[FullName], [g0].[HasSoulPatch], [g0].[LeaderNickname], [g0].[LeaderSquadId], [g0].[Rank], [w0].[Id], [w0].[AmmunitionType], [w0].[IsAutomatic], [w0].[Name], [w0].[OwnerFullName], [w0].[SynergyWithId], [w1].[Id], [w1].[AmmunitionType], [w1].[IsAutomatic], [w1].[Name], [w1].[OwnerFullName], [w1].[SynergyWithId], [w2].[Id], [w2].[AmmunitionType], [w2].[IsAutomatic], [w2].[Name], [w2].[OwnerFullName], [w2].[SynergyWithId], CASE - WHEN ([g0].[Nickname] IS NOT NULL) AND ([g0].[SquadId] IS NOT NULL) THEN CAST(1 AS bit) + WHEN [g0].[Nickname] IS NOT NULL AND [g0].[SquadId] IS NOT NULL THEN CAST(1 AS bit) ELSE CAST(0 AS bit) END, [w3].[Id], [w3].[AmmunitionType], [w3].[IsAutomatic], [w3].[Name], [w3].[OwnerFullName], [w3].[SynergyWithId], [w4].[Id], [w4].[AmmunitionType], [w4].[IsAutomatic], [w4].[Name], [w4].[OwnerFullName], [w4].[SynergyWithId] FROM [Gears] AS [g] @@ -2347,7 +2335,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] @@ -2363,7 +2351,7 @@ public override async Task Optional_navigation_type_compensation_works_with_pred SELECT [t].[Id], [t].[GearNickName], [t].[GearSquadId], [t].[IssueDate], [t].[Note] FROM [Tags] AS [t] LEFT JOIN [Gears] AS [g] ON [t].[GearNickName] = [g].[Nickname] AND [t].[GearSquadId] = [g].[SquadId] -WHERE ([t].[Note] <> N'K.I.A.' OR ([t].[Note] IS NULL)) AND [g].[HasSoulPatch] = CAST(1 AS bit) +WHERE ([t].[Note] <> N'K.I.A.' OR [t].[Note] IS NULL) AND [g].[HasSoulPatch] = CAST(1 AS bit) """); } @@ -2450,7 +2438,7 @@ public override async Task Optional_navigation_type_compensation_works_with_bina 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%') +WHERE [g].[HasSoulPatch] = CAST(1 AS bit) OR [t].[Note] LIKE N'%Cole%' """); } @@ -2461,7 +2449,7 @@ 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] @@ -2478,7 +2466,7 @@ public override async Task Optional_navigation_type_compensation_works_with_proj SELECT [g].[SquadId] FROM [Tags] AS [t] LEFT JOIN [Gears] AS [g] ON [t].[GearNickName] = [g].[Nickname] AND [t].[GearSquadId] = [g].[SquadId] -WHERE [t].[Note] <> N'K.I.A.' OR ([t].[Note] IS NULL) +WHERE [t].[Note] <> N'K.I.A.' OR [t].[Note] IS NULL """); } @@ -2491,7 +2479,7 @@ public override async Task Optional_navigation_type_compensation_works_with_proj SELECT [g].[SquadId] FROM [Tags] AS [t] LEFT JOIN [Gears] AS [g] ON [t].[GearNickName] = [g].[Nickname] AND [t].[GearSquadId] = [g].[SquadId] -WHERE [t].[Note] <> N'K.I.A.' OR ([t].[Note] IS NULL) +WHERE [t].[Note] <> N'K.I.A.' OR [t].[Note] IS NULL """); } @@ -2504,7 +2492,7 @@ public override async Task Optional_navigation_type_compensation_works_with_DTOs SELECT [g].[SquadId] AS [Id] FROM [Tags] AS [t] LEFT JOIN [Gears] AS [g] ON [t].[GearNickName] = [g].[Nickname] AND [t].[GearSquadId] = [g].[SquadId] -WHERE [t].[Note] <> N'K.I.A.' OR ([t].[Note] IS NULL) +WHERE [t].[Note] <> N'K.I.A.' OR [t].[Note] IS NULL """); } @@ -2517,7 +2505,7 @@ public override async Task Optional_navigation_type_compensation_works_with_list SELECT [g].[SquadId], [g].[SquadId] + 1 FROM [Tags] AS [t] LEFT JOIN [Gears] AS [g] ON [t].[GearNickName] = [g].[Nickname] AND [t].[GearSquadId] = [g].[SquadId] -WHERE [t].[Note] <> N'K.I.A.' OR ([t].[Note] IS NULL) +WHERE [t].[Note] <> N'K.I.A.' OR [t].[Note] IS NULL ORDER BY [t].[Note] """); } @@ -2531,7 +2519,7 @@ public override async Task Optional_navigation_type_compensation_works_with_arra SELECT [g].[SquadId] FROM [Tags] AS [t] LEFT JOIN [Gears] AS [g] ON [t].[GearNickName] = [g].[Nickname] AND [t].[GearSquadId] = [g].[SquadId] -WHERE [t].[Note] <> N'K.I.A.' OR ([t].[Note] IS NULL) +WHERE [t].[Note] <> N'K.I.A.' OR [t].[Note] IS NULL """); } @@ -2544,7 +2532,7 @@ public override async Task Optional_navigation_type_compensation_works_with_orde SELECT [t].[Id], [t].[GearNickName], [t].[GearSquadId], [t].[IssueDate], [t].[Note] FROM [Tags] AS [t] LEFT JOIN [Gears] AS [g] ON [t].[GearNickName] = [g].[Nickname] AND [t].[GearSquadId] = [g].[SquadId] -WHERE [t].[Note] <> N'K.I.A.' OR ([t].[Note] IS NULL) +WHERE [t].[Note] <> N'K.I.A.' OR [t].[Note] IS NULL ORDER BY [g].[SquadId] """); } @@ -2560,7 +2548,7 @@ WHEN NOT EXISTS ( SELECT 1 FROM [Tags] AS [t] LEFT JOIN [Gears] AS [g] ON [t].[GearNickName] = [g].[Nickname] AND [t].[GearSquadId] = [g].[SquadId] - WHERE ([t].[Note] <> N'K.I.A.' OR ([t].[Note] IS NULL)) AND [g].[HasSoulPatch] = CAST(0 AS bit)) THEN CAST(1 AS bit) + WHERE ([t].[Note] <> N'K.I.A.' OR [t].[Note] IS NULL) AND [g].[HasSoulPatch] = CAST(0 AS bit)) THEN CAST(1 AS bit) ELSE CAST(0 AS bit) END """); @@ -2575,7 +2563,7 @@ public override async Task Optional_navigation_type_compensation_works_with_nega SELECT [t].[Id], [t].[GearNickName], [t].[GearSquadId], [t].[IssueDate], [t].[Note] FROM [Tags] AS [t] LEFT JOIN [Gears] AS [g] ON [t].[GearNickName] = [g].[Nickname] AND [t].[GearSquadId] = [g].[SquadId] -WHERE ([t].[Note] <> N'K.I.A.' OR ([t].[Note] IS NULL)) AND [g].[HasSoulPatch] = CAST(0 AS bit) +WHERE ([t].[Note] <> N'K.I.A.' OR [t].[Note] IS NULL) AND [g].[HasSoulPatch] = CAST(0 AS bit) """); } @@ -2588,7 +2576,7 @@ public override async Task Optional_navigation_type_compensation_works_with_cont SELECT [t].[Id], [t].[GearNickName], [t].[GearSquadId], [t].[IssueDate], [t].[Note] FROM [Tags] AS [t] LEFT JOIN [Gears] AS [g] ON [t].[GearNickName] = [g].[Nickname] AND [t].[GearSquadId] = [g].[SquadId] -WHERE ([t].[Note] <> N'K.I.A.' OR ([t].[Note] IS NULL)) AND EXISTS ( +WHERE ([t].[Note] <> N'K.I.A.' OR [t].[Note] IS NULL) AND EXISTS ( SELECT 1 FROM [Gears] AS [g0] WHERE [g0].[SquadId] = [g].[SquadId]) @@ -2621,7 +2609,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] @@ -3124,7 +3112,7 @@ public override async Task Distinct_with_optional_navigation_is_translated_to_sq SELECT DISTINCT [g].[HasSoulPatch] FROM [Gears] AS [g] LEFT JOIN [Tags] AS [t] ON [g].[Nickname] = [t].[GearNickName] AND [g].[SquadId] = [t].[GearSquadId] -WHERE [t].[Note] <> N'Foo' OR ([t].[Note] IS NULL) +WHERE [t].[Note] <> N'Foo' OR [t].[Note] IS NULL """); } @@ -3137,7 +3125,7 @@ public override async Task Sum_with_optional_navigation_is_translated_to_sql(boo SELECT COALESCE(SUM([g].[SquadId]), 0) FROM [Gears] AS [g] LEFT JOIN [Tags] AS [t] ON [g].[Nickname] = [t].[GearNickName] AND [g].[SquadId] = [t].[GearSquadId] -WHERE [t].[Note] <> N'Foo' OR ([t].[Note] IS NULL) +WHERE [t].[Note] <> N'Foo' OR [t].[Note] IS NULL """); } @@ -3150,7 +3138,7 @@ public override async Task Count_with_optional_navigation_is_translated_to_sql(b SELECT COUNT(*) FROM [Gears] AS [g] LEFT JOIN [Tags] AS [t] ON [g].[Nickname] = [t].[GearNickName] AND [g].[SquadId] = [t].[GearSquadId] -WHERE [t].[Note] <> N'Foo' OR ([t].[Note] IS NULL) +WHERE [t].[Note] <> N'Foo' OR [t].[Note] IS NULL """); } @@ -3194,7 +3182,7 @@ WHEN NOT EXISTS ( SELECT 1 FROM [Gears] AS [g] LEFT JOIN [Tags] AS [t] ON [g].[Nickname] = [t].[GearNickName] AND [g].[SquadId] = [t].[GearSquadId] - WHERE [t].[Note] = N'Foo' AND ([t].[Note] IS NOT NULL)) THEN CAST(1 AS bit) + WHERE [t].[Note] = N'Foo' AND [t].[Note] IS NOT NULL) THEN CAST(1 AS bit) ELSE CAST(0 AS bit) END """); @@ -3329,7 +3317,7 @@ SELECT [g].[Nickname] 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] """); } @@ -3727,7 +3715,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) """); } @@ -3743,7 +3731,7 @@ FROM [Tags] AS [t] WHERE [g].[Discriminator] = N'Officer' AND ( SELECT COUNT(*) FROM [Gears] AS [g0] - WHERE ([g].[Nickname] IS NOT NULL) AND ([g].[SquadId] IS NOT NULL) AND [g].[Nickname] = [g0].[LeaderNickname] AND [g].[SquadId] = [g0].[LeaderSquadId] AND [g0].[Nickname] = N'Dom') > 0 + WHERE [g].[Nickname] IS NOT NULL AND [g].[SquadId] IS NOT NULL AND [g].[Nickname] = [g0].[LeaderNickname] AND [g].[SquadId] = [g0].[LeaderSquadId] AND [g0].[Nickname] = N'Dom') > 0 """); } @@ -3808,7 +3796,7 @@ FROM [LocustLeaders] AS [l] WHERE [l].[Discriminator] = N'LocustCommander' ) AS [t] ON [f].[CommanderName] = [t].[Name] LEFT JOIN [Gears] AS [g] ON [t].[DefeatedByNickname] = [g].[Nickname] AND [t].[DefeatedBySquadId] = [g].[SquadId] -LEFT JOIN [Gears] AS [g0] ON ([g].[Nickname] = [g0].[LeaderNickname] OR (([g].[Nickname] IS NULL) AND ([g0].[LeaderNickname] IS NULL))) AND [g].[SquadId] = [g0].[LeaderSquadId] +LEFT JOIN [Gears] AS [g0] ON ([g].[Nickname] = [g0].[LeaderNickname] OR ([g].[Nickname] IS NULL AND [g0].[LeaderNickname] IS NULL)) AND [g].[SquadId] = [g0].[LeaderSquadId] ORDER BY [f].[Id], [t].[Name], [g].[Nickname], [g].[SquadId], [g0].[Nickname] """); } @@ -3827,7 +3815,7 @@ FROM [LocustLeaders] AS [l] WHERE [l].[Discriminator] = N'LocustCommander' ) AS [t] ON [f].[CommanderName] = [t].[Name] LEFT JOIN [Gears] AS [g] ON [t].[DefeatedByNickname] = [g].[Nickname] AND [t].[DefeatedBySquadId] = [g].[SquadId] -LEFT JOIN [Gears] AS [g0] ON ([g].[Nickname] = [g0].[LeaderNickname] OR (([g].[Nickname] IS NULL) AND ([g0].[LeaderNickname] IS NULL))) AND [g].[SquadId] = [g0].[LeaderSquadId] +LEFT JOIN [Gears] AS [g0] ON ([g].[Nickname] = [g0].[LeaderNickname] OR ([g].[Nickname] IS NULL AND [g0].[LeaderNickname] IS NULL)) AND [g].[SquadId] = [g0].[LeaderSquadId] ORDER BY [f].[Id], [t].[Name], [g].[Nickname], [g].[SquadId], [g0].[Nickname] """); } @@ -3870,7 +3858,7 @@ LEFT JOIN ( SELECT [g0].[Nickname], [g0].[SquadId], [g0].[AssignedCityName], [g0].[CityOfBirthName], [g0].[Discriminator], [g0].[FullName], [g0].[HasSoulPatch], [g0].[LeaderNickname], [g0].[LeaderSquadId], [g0].[Rank], [c].[Name], [c].[Location], [c].[Nation] FROM [Gears] AS [g0] INNER JOIN [Cities] AS [c] ON [g0].[CityOfBirthName] = [c].[Name] -) AS [t] ON ([g].[Nickname] = [t].[LeaderNickname] OR (([g].[Nickname] IS NULL) AND ([t].[LeaderNickname] IS NULL))) AND [g].[SquadId] = [t].[LeaderSquadId] +) AS [t] ON ([g].[Nickname] = [t].[LeaderNickname] OR ([g].[Nickname] IS NULL AND [t].[LeaderNickname] IS NULL)) AND [g].[SquadId] = [t].[LeaderSquadId] ORDER BY [l].[Name], [g].[Nickname], [g].[SquadId], [t].[Nickname], [t].[SquadId] """); } @@ -3992,7 +3980,7 @@ FROM [LocustLeaders] AS [l] WHERE [l].[Discriminator] = N'LocustCommander' ) AS [t] ON [f].[CommanderName] = [t].[Name] LEFT JOIN [Gears] AS [g] ON [t].[DefeatedByNickname] = [g].[Nickname] AND [t].[DefeatedBySquadId] = [g].[SquadId] -LEFT JOIN [Gears] AS [g0] ON ([g].[Nickname] = [g0].[LeaderNickname] OR (([g].[Nickname] IS NULL) AND ([g0].[LeaderNickname] IS NULL))) AND [g].[SquadId] = [g0].[LeaderSquadId] +LEFT JOIN [Gears] AS [g0] ON ([g].[Nickname] = [g0].[LeaderNickname] OR ([g].[Nickname] IS NULL AND [g0].[LeaderNickname] IS NULL)) AND [g].[SquadId] = [g0].[LeaderSquadId] ORDER BY [f].[Id], [t].[Name], [g].[Nickname], [g].[SquadId], [g0].[Nickname] """); } @@ -4045,7 +4033,7 @@ FROM [LocustLeaders] AS [l] WHERE [l].[Discriminator] = N'LocustCommander' ) AS [t] ON [f].[CommanderName] = [t].[Name] LEFT JOIN [Gears] AS [g] ON [t].[DefeatedByNickname] = [g].[Nickname] AND [t].[DefeatedBySquadId] = [g].[SquadId] -LEFT JOIN [Gears] AS [g0] ON ([g].[Nickname] = [g0].[LeaderNickname] OR (([g].[Nickname] IS NULL) AND ([g0].[LeaderNickname] IS NULL))) AND [g].[SquadId] = [g0].[LeaderSquadId] +LEFT JOIN [Gears] AS [g0] ON ([g].[Nickname] = [g0].[LeaderNickname] OR ([g].[Nickname] IS NULL AND [g0].[LeaderNickname] IS NULL)) AND [g].[SquadId] = [g0].[LeaderSquadId] ORDER BY [f].[Id], [t].[Name], [g].[Nickname], [g].[SquadId], [g0].[Nickname] """); } @@ -4075,7 +4063,7 @@ public override async Task Projecting_nullable_bool_in_conditional_works(bool as AssertSql( """ SELECT CASE - WHEN ([g].[Nickname] IS NOT NULL) AND ([g].[SquadId] IS NOT NULL) THEN [g].[HasSoulPatch] + WHEN [g].[Nickname] IS NOT NULL AND [g].[SquadId] IS NOT NULL THEN [g].[HasSoulPatch] ELSE CAST(0 AS bit) END AS [Prop] FROM [Tags] AS [t] @@ -4191,7 +4179,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] @@ -4209,7 +4197,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] @@ -4227,7 +4215,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] @@ -4245,7 +4233,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 @@ -4281,7 +4269,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] @@ -4299,7 +4287,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] @@ -4317,7 +4305,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] @@ -4440,7 +4428,7 @@ FROM [Gears] AS [g0] LEFT JOIN ( SELECT [w].[Id], [w].[AmmunitionType], [w].[IsAutomatic], [w].[Name], [w].[OwnerFullName], [w].[SynergyWithId] FROM [Weapons] AS [w] - WHERE [w].[Name] <> N'Bar' OR ([w].[Name] IS NULL) + WHERE [w].[Name] <> N'Bar' OR [w].[Name] IS NULL ) AS [t] ON [g0].[FullName] = [t].[OwnerFullName] WHERE [g0].[FullName] <> N'Foo' ) AS [t0] ON [g].[Nickname] = [t0].[LeaderNickname] AND [g].[SquadId] = [t0].[LeaderSquadId] @@ -4591,7 +4579,7 @@ LEFT JOIN ( SELECT [w].[Id], [w].[AmmunitionType], [w].[IsAutomatic], [w].[Name], [w].[OwnerFullName], [w].[SynergyWithId], [g2].[Nickname], [g2].[SquadId], ( SELECT COUNT(*) FROM [Weapons] AS [w0] - WHERE ([g2].[FullName] IS NOT NULL) AND [g2].[FullName] = [w0].[OwnerFullName]) AS [c] + WHERE [g2].[FullName] IS NOT NULL AND [g2].[FullName] = [w0].[OwnerFullName]) AS [c] FROM [Weapons] AS [w] LEFT JOIN [Gears] AS [g2] ON [w].[OwnerFullName] = [g2].[FullName] ) AS [t0] ON [g1].[FullName] = [t0].[OwnerFullName] @@ -4623,7 +4611,7 @@ FROM [Weapons] AS [w] LEFT JOIN [Squads] AS [s] ON [g3].[SquadId] = [s].[Id] LEFT JOIN [Weapons] AS [w0] ON [g3].[FullName] = [w0].[OwnerFullName] LEFT JOIN [Gears] AS [g4] ON [s].[Id] = [g4].[SquadId] - WHERE [w].[Name] <> N'Bar' OR ([w].[Name] IS NULL) + WHERE [w].[Name] <> N'Bar' OR [w].[Name] IS NULL ) AS [t1] ON [g2].[FullName] = [t1].[OwnerFullName] WHERE [g2].[FullName] <> N'Foo' ) AS [t0] ON [g].[Nickname] = [t0].[LeaderNickname] AND [g].[SquadId] = [t0].[LeaderSquadId] @@ -4690,7 +4678,7 @@ FROM [Gears] AS [g0] OUTER APPLY ( SELECT [w].[Name], [g0].[Nickname], [w].[Id] FROM [Weapons] AS [w] - WHERE [g0].[FullName] = [w].[OwnerFullName] AND ([w].[Name] <> N'Bar' OR ([w].[Name] IS NULL)) + WHERE [g0].[FullName] = [w].[OwnerFullName] AND ([w].[Name] <> N'Bar' OR [w].[Name] IS NULL) ) AS [t] WHERE [g0].[FullName] <> N'Foo' ) AS [t0] ON [g].[Nickname] = [t0].[LeaderNickname] AND [g].[SquadId] = [t0].[LeaderSquadId] @@ -4713,7 +4701,7 @@ FROM [Gears] AS [g0] LEFT JOIN ( SELECT [w].[Name], [g].[Nickname], [w].[Id], [w].[OwnerFullName] FROM [Weapons] AS [w] - WHERE [w].[Name] <> N'Bar' OR ([w].[Name] IS NULL) + WHERE [w].[Name] <> N'Bar' OR [w].[Name] IS NULL ) AS [t] ON [g0].[FullName] = [t].[OwnerFullName] WHERE [g].[Nickname] = [g0].[LeaderNickname] AND [g].[SquadId] = [g0].[LeaderSquadId] AND [g0].[FullName] <> N'Foo' ) AS [t0] @@ -4734,7 +4722,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] @@ -4866,7 +4854,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] """); } @@ -5079,7 +5067,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 """); } @@ -5096,7 +5084,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 """); } @@ -5113,7 +5101,7 @@ public override async Task Include_on_derived_type_with_order_by_and_paging(bool SELECT TOP(@__p_0) [l].[Name], [l].[Discriminator], [l].[LocustHordeId], [l].[ThreatLevel], [l].[ThreatLevelByte], [l].[ThreatLevelNullableByte], [l].[DefeatedByNickname], [l].[DefeatedBySquadId], [l].[HighCommandId], [g].[Nickname], [g].[SquadId], [g].[AssignedCityName], [g].[CityOfBirthName], [g].[Discriminator] AS [Discriminator0], [g].[FullName], [g].[HasSoulPatch], [g].[LeaderNickname], [g].[LeaderSquadId], [g].[Rank], [t].[Id], [t].[Note] FROM [LocustLeaders] AS [l] LEFT JOIN [Gears] AS [g] ON [l].[DefeatedByNickname] = [g].[Nickname] AND [l].[DefeatedBySquadId] = [g].[SquadId] - LEFT JOIN [Tags] AS [t] ON ([g].[Nickname] = [t].[GearNickName] OR (([g].[Nickname] IS NULL) AND ([t].[GearNickName] IS NULL))) AND ([g].[SquadId] = [t].[GearSquadId] OR (([g].[SquadId] IS NULL) AND ([t].[GearSquadId] IS NULL))) + LEFT JOIN [Tags] AS [t] ON ([g].[Nickname] = [t].[GearNickName] OR ([g].[Nickname] IS NULL AND [t].[GearNickName] IS NULL)) AND ([g].[SquadId] = [t].[GearSquadId] OR ([g].[SquadId] IS NULL AND [t].[GearSquadId] IS NULL)) ORDER BY [t].[Note] ) AS [t0] LEFT JOIN [Weapons] AS [w] ON [t0].[FullName] = [w].[OwnerFullName] @@ -5885,7 +5873,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) @@ -5901,7 +5889,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) """); @@ -5918,7 +5906,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) @@ -6071,7 +6059,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] """); @@ -6099,7 +6087,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 """); @@ -6115,7 +6103,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 """); @@ -6153,7 +6141,7 @@ public override async Task String_concat_on_various_types(bool async) AssertSql( """ -SELECT (N'HasSoulPatch ' + CAST([g].[HasSoulPatch] AS nvarchar(max))) + N' HasSoulPatch' AS [HasSoulPatch], (N'Rank ' + CAST([g].[Rank] AS nvarchar(max))) + N' Rank' AS [Rank], (N'SquadId ' + CAST([g].[SquadId] AS nvarchar(max))) + N' SquadId' AS [SquadId], (N'Rating ' + COALESCE(CAST([m].[Rating] AS nvarchar(max)), N'')) + N' Rating' AS [Rating], (N'Timeline ' + CAST([m].[Timeline] AS nvarchar(max))) + N' Timeline' AS [Timeline] +SELECT N'HasSoulPatch ' + CAST([g].[HasSoulPatch] AS nvarchar(max)) + N' HasSoulPatch' AS [HasSoulPatch], N'Rank ' + CAST([g].[Rank] AS nvarchar(max)) + N' Rank' AS [Rank], N'SquadId ' + CAST([g].[SquadId] AS nvarchar(max)) + N' SquadId' AS [SquadId], N'Rating ' + COALESCE(CAST([m].[Rating] AS nvarchar(max)), N'') + N' Rating' AS [Rating], N'Timeline ' + CAST([m].[Timeline] AS nvarchar(max)) + N' Timeline' AS [Timeline] FROM [Gears] AS [g] CROSS JOIN [Missions] AS [m] ORDER BY [g].[Nickname], [m].[Id] @@ -6503,7 +6491,7 @@ public override async Task SELECT [t].[Id], [t].[GearNickName], [t].[GearSquadId], [t].[IssueDate], [t].[Note] FROM [Tags] AS [t] LEFT JOIN [Gears] AS [g] ON [t].[GearNickName] = [g].[Nickname] AND [t].[GearSquadId] = [g].[SquadId] -WHERE SUBSTRING([t].[Note], 0 + 1, [g].[SquadId]) = [t].[GearNickName] OR ((([t].[Note] IS NULL) OR ([g].[SquadId] IS NULL)) AND ([t].[GearNickName] IS NULL)) +WHERE SUBSTRING([t].[Note], 0 + 1, [g].[SquadId]) = [t].[GearNickName] OR (([t].[Note] IS NULL OR [g].[SquadId] IS NULL) AND [t].[GearNickName] IS NULL) """); } @@ -6519,7 +6507,7 @@ await base.Null_semantics_is_correctly_applied_for_function_comparisons_that_tak FROM [Tags] AS [t] LEFT JOIN [Gears] AS [g] ON [t].[GearNickName] = [g].[Nickname] AND [t].[GearSquadId] = [g].[SquadId] LEFT JOIN [Squads] AS [s] ON [g].[SquadId] = [s].[Id] -WHERE SUBSTRING([t].[Note], 0 + 1, CAST(LEN([s].[Name]) AS int)) = [t].[GearNickName] OR ((([t].[Note] IS NULL) OR ([s].[Name] IS NULL)) AND ([t].[GearNickName] IS NULL)) +WHERE SUBSTRING([t].[Note], 0 + 1, CAST(LEN([s].[Name]) AS int)) = [t].[GearNickName] OR (([t].[Note] IS NULL OR [s].[Name] IS NULL) AND [t].[GearNickName] IS NULL) """); } @@ -6567,7 +6555,7 @@ public override async Task OfTypeNav1(bool async) FROM [Gears] AS [g] LEFT JOIN [Tags] AS [t] ON [g].[Nickname] = [t].[GearNickName] AND [g].[SquadId] = [t].[GearSquadId] LEFT JOIN [Tags] AS [t0] ON [g].[Nickname] = [t0].[GearNickName] AND [g].[SquadId] = [t0].[GearSquadId] -WHERE ([t].[Note] <> N'Foo' OR ([t].[Note] IS NULL)) AND [g].[Discriminator] = N'Officer' AND ([t0].[Note] <> N'Bar' OR ([t0].[Note] IS NULL)) +WHERE ([t].[Note] <> N'Foo' OR [t].[Note] IS NULL) AND [g].[Discriminator] = N'Officer' AND ([t0].[Note] <> N'Bar' OR [t0].[Note] IS NULL) """); } @@ -6581,7 +6569,7 @@ public override async Task OfTypeNav2(bool async) FROM [Gears] AS [g] LEFT JOIN [Tags] AS [t] ON [g].[Nickname] = [t].[GearNickName] AND [g].[SquadId] = [t].[GearSquadId] LEFT JOIN [Cities] AS [c] ON [g].[AssignedCityName] = [c].[Name] -WHERE ([t].[Note] <> N'Foo' OR ([t].[Note] IS NULL)) AND [g].[Discriminator] = N'Officer' AND ([c].[Location] <> 'Bar' OR ([c].[Location] IS NULL)) +WHERE ([t].[Note] <> N'Foo' OR [t].[Note] IS NULL) AND [g].[Discriminator] = N'Officer' AND ([c].[Location] <> 'Bar' OR [c].[Location] IS NULL) """); } @@ -6596,7 +6584,7 @@ FROM [Gears] AS [g] LEFT JOIN [Tags] AS [t] ON [g].[Nickname] = [t].[GearNickName] AND [g].[SquadId] = [t].[GearSquadId] INNER JOIN [Weapons] AS [w] ON [g].[FullName] = [w].[OwnerFullName] LEFT JOIN [Tags] AS [t0] ON [g].[Nickname] = [t0].[GearNickName] AND [g].[SquadId] = [t0].[GearSquadId] -WHERE ([t].[Note] <> N'Foo' OR ([t].[Note] IS NULL)) AND [g].[Discriminator] = N'Officer' AND ([t0].[Note] <> N'Bar' OR ([t0].[Note] IS NULL)) +WHERE ([t].[Note] <> N'Foo' OR [t].[Note] IS NULL) AND [g].[Discriminator] = N'Officer' AND ([t0].[Note] <> N'Bar' OR [t0].[Note] IS NULL) """); } @@ -6628,7 +6616,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 """); } @@ -6646,7 +6634,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) """); } @@ -6664,7 +6652,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) """); } @@ -6698,7 +6686,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] """); } @@ -6793,7 +6781,7 @@ public override async Task Left_join_projection_using_conditional_tracking(bool AssertSql( """ SELECT CASE - WHEN ([g0].[Nickname] IS NULL) OR ([g0].[SquadId] IS NULL) THEN CAST(1 AS bit) + WHEN [g0].[Nickname] IS NULL OR [g0].[SquadId] IS NULL THEN CAST(1 AS bit) ELSE CAST(0 AS bit) END, [g].[Nickname], [g].[SquadId], [g].[AssignedCityName], [g].[CityOfBirthName], [g].[Discriminator], [g].[FullName], [g].[HasSoulPatch], [g].[LeaderNickname], [g].[LeaderSquadId], [g].[Rank], [g0].[Nickname], [g0].[SquadId], [g0].[AssignedCityName], [g0].[CityOfBirthName], [g0].[Discriminator], [g0].[FullName], [g0].[HasSoulPatch], [g0].[LeaderNickname], [g0].[LeaderSquadId], [g0].[Rank] FROM [Gears] AS [g] @@ -6817,7 +6805,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] """); @@ -6832,7 +6820,7 @@ public override async Task Project_collection_navigation_nested_composite_key(bo SELECT [t].[Id], [g].[Nickname], [g].[SquadId], [g0].[Nickname], [g0].[SquadId], [g0].[AssignedCityName], [g0].[CityOfBirthName], [g0].[Discriminator], [g0].[FullName], [g0].[HasSoulPatch], [g0].[LeaderNickname], [g0].[LeaderSquadId], [g0].[Rank] FROM [Tags] AS [t] LEFT JOIN [Gears] AS [g] ON [t].[GearNickName] = [g].[Nickname] AND [t].[GearSquadId] = [g].[SquadId] -LEFT JOIN [Gears] AS [g0] ON ([g].[Nickname] = [g0].[LeaderNickname] OR (([g].[Nickname] IS NULL) AND ([g0].[LeaderNickname] IS NULL))) AND [g].[SquadId] = [g0].[LeaderSquadId] +LEFT JOIN [Gears] AS [g0] ON ([g].[Nickname] = [g0].[LeaderNickname] OR ([g].[Nickname] IS NULL AND [g0].[LeaderNickname] IS NULL)) AND [g].[SquadId] = [g0].[LeaderSquadId] WHERE [g].[Discriminator] = N'Officer' ORDER BY [t].[Id], [g].[Nickname], [g].[SquadId], [g0].[Nickname] """); @@ -6846,7 +6834,7 @@ public override async Task Null_checks_in_correlated_predicate_are_correctly_tra """ SELECT [t].[Id], [g].[Nickname], [g].[SquadId], [g].[AssignedCityName], [g].[CityOfBirthName], [g].[Discriminator], [g].[FullName], [g].[HasSoulPatch], [g].[LeaderNickname], [g].[LeaderSquadId], [g].[Rank] FROM [Tags] AS [t] -LEFT JOIN [Gears] AS [g] ON [t].[GearNickName] = [g].[Nickname] AND [t].[GearSquadId] = [g].[SquadId] AND ([t].[Note] IS NOT NULL) +LEFT JOIN [Gears] AS [g] ON [t].[GearNickName] = [g].[Nickname] AND [t].[GearSquadId] = [g].[SquadId] AND [t].[Note] IS NOT NULL ORDER BY [t].[Id], [g].[Nickname] """); } @@ -7037,7 +7025,7 @@ public override async Task Navigation_based_on_complex_expression6(bool async) AssertSql( """ SELECT CASE - WHEN [t0].[Name] = N'Queen Myrrah' AND ([t0].[Name] IS NOT NULL) THEN CAST(1 AS bit) + WHEN [t0].[Name] = N'Queen Myrrah' AND [t0].[Name] IS NOT NULL THEN CAST(1 AS bit) ELSE CAST(0 AS bit) END, [t0].[Name], [t0].[Discriminator], [t0].[LocustHordeId], [t0].[ThreatLevel], [t0].[ThreatLevelByte], [t0].[ThreatLevelNullableByte], [t0].[DefeatedByNickname], [t0].[DefeatedBySquadId], [t0].[HighCommandId], [t].[Name], [t].[Discriminator], [t].[LocustHordeId], [t].[ThreatLevel], [t].[ThreatLevelByte], [t].[ThreatLevelNullableByte], [t].[DefeatedByNickname], [t].[DefeatedBySquadId], [t].[HighCommandId] FROM [Factions] AS [f] @@ -7104,7 +7092,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] @@ -7149,7 +7137,7 @@ public override async Task Accessing_property_of_optional_navigation_in_child_pr AssertSql( """ SELECT CASE - WHEN ([g].[Nickname] IS NOT NULL) AND ([g].[SquadId] IS NOT NULL) THEN CAST(1 AS bit) + WHEN [g].[Nickname] IS NOT NULL AND [g].[SquadId] IS NOT NULL THEN CAST(1 AS bit) ELSE CAST(0 AS bit) END, [t].[Id], [g].[Nickname], [g].[SquadId], [t0].[Nickname], [t0].[Id], [t0].[SquadId] FROM [Tags] AS [t] @@ -7474,7 +7462,7 @@ public override async Task Where_with_enum_flags_parameter(bool async) 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] & @__rank_0) = @__rank_0 +WHERE [g].[Rank] & @__rank_0 = @__rank_0 """, // """ @@ -7487,7 +7475,7 @@ FROM [Gears] AS [g] 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] | @__rank_0) <> @__rank_0 +WHERE [g].[Rank] | @__rank_0 <> @__rank_0 """, // """ @@ -7510,11 +7498,11 @@ FROM [Factions] AS [f] SELECT TOP(1) [c0].[Name] FROM [Gears] AS [g] INNER JOIN [Cities] AS [c0] ON [g].[CityOfBirthName] = [c0].[Name] - ORDER BY [g].[Nickname]) OR (([c].[Name] IS NULL) AND (( + ORDER BY [g].[Nickname]) OR ([c].[Name] IS NULL AND ( SELECT TOP(1) [c0].[Name] FROM [Gears] AS [g] INNER JOIN [Cities] AS [c0] ON [g].[CityOfBirthName] = [c0].[Name] - ORDER BY [g].[Nickname]) IS NULL)) + ORDER BY [g].[Nickname]) IS NULL) """); } @@ -7528,14 +7516,14 @@ public override async Task Bitwise_operation_with_non_null_parameter_optimizes_n 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] & @__ranks_0) <> 0 +WHERE [g].[Rank] & @__ranks_0 <> 0 """, // """ @__ranks_0='134' SELECT CASE - WHEN ([g].[Rank] | @__ranks_0) = @__ranks_0 THEN CAST(1 AS bit) + WHEN [g].[Rank] | @__ranks_0 = @__ranks_0 THEN CAST(1 AS bit) ELSE CAST(0 AS bit) END FROM [Gears] AS [g] @@ -7545,7 +7533,7 @@ FROM [Gears] AS [g] @__ranks_0='134' SELECT CASE - WHEN ([g].[Rank] | ([g].[Rank] | (@__ranks_0 | ([g].[Rank] | @__ranks_0)))) = @__ranks_0 THEN CAST(1 AS bit) + WHEN [g].[Rank] | [g].[Rank] | @__ranks_0 | [g].[Rank] | @__ranks_0 = @__ranks_0 THEN CAST(1 AS bit) ELSE CAST(0 AS bit) END FROM [Gears] AS [g] @@ -7585,7 +7573,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 """, // """ @@ -7593,7 +7581,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) = @__prm_0 +WHERE [w].[AmmunitionType] & @__prm_0 = @__prm_0 """); } @@ -7646,10 +7634,10 @@ FROM [LocustLeaders] AS [l] 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) +END IS NULL """); } @@ -7764,10 +7752,10 @@ WHERE CASE WHEN ( SELECT TOP(1) [w].[Name] FROM [Weapons] AS [w] - WHERE [w].[Id] = [g].[SquadId]) = @__prm2_1 AND (( + WHERE [w].[Id] = [g].[SquadId]) = @__prm2_1 AND ( SELECT TOP(1) [w].[Name] FROM [Weapons] AS [w] - WHERE [w].[Id] = [g].[SquadId]) IS NOT NULL) THEN CAST(1 AS bit) + WHERE [w].[Id] = [g].[SquadId]) IS NOT NULL THEN CAST(1 AS bit) ELSE CAST(0 AS bit) END ELSE CAST(0 AS bit) @@ -7902,7 +7890,7 @@ public override async Task Checked_context_with_addition_does_not_fail(bool isAs """ SELECT [l].[Name], [l].[Discriminator], [l].[LocustHordeId], [l].[ThreatLevel], [l].[ThreatLevelByte], [l].[ThreatLevelNullableByte], [l].[DefeatedByNickname], [l].[DefeatedBySquadId], [l].[HighCommandId] FROM [LocustLeaders] AS [l] -WHERE CAST([l].[ThreatLevel] AS bigint) >= (CAST(5 AS bigint) + CAST([l].[ThreatLevel] AS bigint)) +WHERE CAST([l].[ThreatLevel] AS bigint) >= CAST(5 AS bigint) + CAST([l].[ThreatLevel] AS bigint) """); } @@ -8024,7 +8012,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)) """); } @@ -8125,7 +8113,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] """); } @@ -8144,7 +8132,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] """); } @@ -8173,7 +8161,7 @@ public override async Task Enum_flags_closure_typed_as_underlying_type_generates 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 (@__prm_0 & [g].[Rank]) = [g].[Rank] +WHERE @__prm_0 & [g].[Rank] = [g].[Rank] """); } @@ -8187,7 +8175,7 @@ public override async Task Enum_flags_closure_typed_as_different_type_generates_ 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 (@__prm_0 & CAST([g].[Rank] AS int)) = CAST([g].[Rank] AS int) +WHERE @__prm_0 & CAST([g].[Rank] AS int) = CAST([g].[Rank] AS int) """); } @@ -8214,7 +8202,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) """); } @@ -8280,7 +8268,7 @@ public override async Task SelectMany_predicate_with_non_equality_comparison_con """ 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] """); } @@ -8293,7 +8281,7 @@ public override async Task SelectMany_predicate_with_non_equality_comparison_Def """ 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] """); } @@ -8311,7 +8299,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] """); } @@ -8324,7 +8312,7 @@ public override async Task SelectMany_without_result_selector_and_non_equality_c """ 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 """); } @@ -8378,7 +8366,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] @@ -8426,13 +8414,13 @@ public override async Task Accessing_derived_property_using_hard_and_soft_cast(b """ 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) """); } @@ -8599,7 +8587,7 @@ public override async Task Composite_key_entity_equal_null(bool async) SELECT [l].[Name], [l].[Discriminator], [l].[LocustHordeId], [l].[ThreatLevel], [l].[ThreatLevelByte], [l].[ThreatLevelNullableByte], [l].[DefeatedByNickname], [l].[DefeatedBySquadId], [l].[HighCommandId] FROM [LocustLeaders] AS [l] LEFT JOIN [Gears] AS [g] ON [l].[DefeatedByNickname] = [g].[Nickname] AND [l].[DefeatedBySquadId] = [g].[SquadId] -WHERE [l].[Discriminator] = N'LocustCommander' AND (([g].[Nickname] IS NULL) OR ([g].[SquadId] IS NULL)) +WHERE [l].[Discriminator] = N'LocustCommander' AND ([g].[Nickname] IS NULL OR [g].[SquadId] IS NULL) """); } @@ -8612,7 +8600,7 @@ public override async Task Composite_key_entity_not_equal_null(bool async) SELECT [l].[Name], [l].[Discriminator], [l].[LocustHordeId], [l].[ThreatLevel], [l].[ThreatLevelByte], [l].[ThreatLevelNullableByte], [l].[DefeatedByNickname], [l].[DefeatedBySquadId], [l].[HighCommandId] FROM [LocustLeaders] AS [l] LEFT JOIN [Gears] AS [g] ON [l].[DefeatedByNickname] = [g].[Nickname] AND [l].[DefeatedBySquadId] = [g].[SquadId] -WHERE [l].[Discriminator] = N'LocustCommander' AND ([g].[Nickname] IS NOT NULL) AND ([g].[SquadId] IS NOT NULL) +WHERE [l].[Discriminator] = N'LocustCommander' AND [g].[Nickname] IS NOT NULL AND [g].[SquadId] IS NOT NULL """); } @@ -8718,10 +8706,10 @@ 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] -WHERE (CASE +WHERE CASE WHEN [t].[GearNickName] IS NOT NULL THEN [g].[SquadId] ELSE NULL -END + 1) = 2 +END + 1 = 2 """); } @@ -8751,7 +8739,7 @@ public override async Task Projecting_property_converted_to_nullable_with_condit AssertSql( """ SELECT CASE - WHEN [t].[Note] <> N'K.I.A.' OR ([t].[Note] IS NULL) THEN CASE + WHEN [t].[Note] <> N'K.I.A.' OR [t].[Note] IS NULL THEN CASE WHEN [t].[GearNickName] IS NOT NULL THEN [g].[SquadId] ELSE NULL END @@ -8877,10 +8865,10 @@ public override async Task Projecting_property_converted_to_nullable_into_unary( SELECT [t].[Note] FROM [Tags] AS [t] LEFT JOIN [Gears] AS [g] ON [t].[GearNickName] = [g].[Nickname] AND [t].[GearSquadId] = [g].[SquadId] -WHERE (CASE +WHERE CASE WHEN [t].[GearNickName] IS NOT NULL THEN [g].[Nickname] ELSE NULL -END IS NOT NULL) AND CASE +END IS NOT NULL AND CASE WHEN [t].[GearNickName] IS NOT NULL THEN [g].[HasSoulPatch] ELSE NULL END = CAST(0 AS bit) @@ -8897,7 +8885,7 @@ public override async Task Projecting_property_converted_to_nullable_into_member SELECT [g].[Nickname] FROM [Gears] AS [g] LEFT JOIN [Tags] AS [t] ON [g].[Nickname] = [t].[GearNickName] AND [g].[SquadId] = [t].[GearSquadId] -WHERE DATEPART(month, [t].[IssueDate]) <> 5 OR ([t].[IssueDate] IS NULL) +WHERE DATEPART(month, [t].[IssueDate]) <> 5 OR [t].[IssueDate] IS NULL ORDER BY [g].[Nickname] """); } @@ -9335,7 +9323,7 @@ public override async Task Project_navigation_defined_on_derived_from_entity_wit AssertSql( """ SELECT [l].[Name], [l].[Discriminator], [l].[LocustHordeId], [l].[ThreatLevel], [l].[ThreatLevelByte], [l].[ThreatLevelNullableByte], [l].[DefeatedByNickname], [l].[DefeatedBySquadId], [l].[HighCommandId], [g].[Nickname], [g].[SquadId], [g].[AssignedCityName], [g].[CityOfBirthName], [g].[Discriminator], [g].[FullName], [g].[HasSoulPatch], [g].[LeaderNickname], [g].[LeaderSquadId], [g].[Rank], CASE - WHEN ([g].[Nickname] IS NULL) OR ([g].[SquadId] IS NULL) THEN CAST(1 AS bit) + WHEN [g].[Nickname] IS NULL OR [g].[SquadId] IS NULL THEN CAST(1 AS bit) ELSE CAST(0 AS bit) END AS [IsNull], [f].[Id], [f].[CapitalName], [f].[Discriminator], [f].[Name], [f].[ServerAddress], [f].[CommanderName], [f].[Eradicated], CASE WHEN [f].[Id] IS NULL THEN CAST(1 AS bit) @@ -9462,7 +9450,7 @@ public override async Task String_concat_nullable_expressions_are_coalesced(bool AssertSql( """ -SELECT (([g].[FullName] + N'') + COALESCE([g].[LeaderNickname], N'')) + N'' +SELECT [g].[FullName] + N'' + COALESCE([g].[LeaderNickname], N'') + N'' FROM [Gears] AS [g] """); } diff --git a/test/EFCore.SqlServer.FunctionalTests/Query/InheritanceRelationshipsQuerySqlServerTest.cs b/test/EFCore.SqlServer.FunctionalTests/Query/InheritanceRelationshipsQuerySqlServerTest.cs index 52d9bfc595d..f4b20c00f1b 100644 --- a/test/EFCore.SqlServer.FunctionalTests/Query/InheritanceRelationshipsQuerySqlServerTest.cs +++ b/test/EFCore.SqlServer.FunctionalTests/Query/InheritanceRelationshipsQuerySqlServerTest.cs @@ -99,7 +99,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] """); } @@ -115,7 +115,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] """); } @@ -161,7 +161,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] """); } @@ -177,7 +177,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] """); } @@ -223,7 +223,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] """); } @@ -239,7 +239,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] """); } @@ -285,7 +285,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] """); } @@ -301,7 +301,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] """); } @@ -388,7 +388,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] """); } @@ -404,7 +404,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] """); } @@ -424,7 +424,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] """); } @@ -444,7 +444,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] """); } @@ -859,7 +859,7 @@ public override async Task Include_collection_with_inheritance_with_filter_split """ 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] """, // @@ -867,7 +867,7 @@ 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] """, // @@ -875,7 +875,7 @@ 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] """, // @@ -883,7 +883,7 @@ 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] """); } @@ -897,7 +897,7 @@ 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] """, // @@ -906,7 +906,7 @@ FROM [BaseCollectionsOnBase] AS [b] 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] """, // @@ -915,7 +915,7 @@ FROM [BaseCollectionsOnBase] AS [b] 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] """); } @@ -990,7 +990,7 @@ public override async Task Include_collection_without_inheritance_with_filter_sp """ 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] """, // @@ -998,7 +998,7 @@ 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] """, // @@ -1006,7 +1006,7 @@ 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] """, // @@ -1014,7 +1014,7 @@ 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] """); } @@ -1028,7 +1028,7 @@ 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] """, // @@ -1037,7 +1037,7 @@ FROM [CollectionsOnBase] AS [c] 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] """, // @@ -1046,7 +1046,7 @@ FROM [CollectionsOnBase] AS [c] FROM [CollectionsOnBase] AS [c] LEFT JOIN [BaseEntities] AS [b] ON [c].[ParentId] = [b].[Id] INNER JOIN [BaseEntities_OwnedCollectionOnDerived] AS [b0] ON [b].[Id] = [b0].[DerivedInheritanceRelationshipEntityId] -WHERE [c].[Name] <> N'Bar' OR ([c].[Name] IS NULL) +WHERE [c].[Name] <> N'Bar' OR [c].[Name] IS NULL ORDER BY [c].[Id], [b].[Id] """); } diff --git a/test/EFCore.SqlServer.FunctionalTests/Query/JsonQuerySqlServerTest.cs b/test/EFCore.SqlServer.FunctionalTests/Query/JsonQuerySqlServerTest.cs index 2470fcd8b92..67150a5590c 100644 --- a/test/EFCore.SqlServer.FunctionalTests/Query/JsonQuerySqlServerTest.cs +++ b/test/EFCore.SqlServer.FunctionalTests/Query/JsonQuerySqlServerTest.cs @@ -12,7 +12,7 @@ public JsonQuerySqlServerTest(JsonQuerySqlServerFixture fixture, ITestOutputHelp : base(fixture) { Fixture.TestSqlLoggerFactory.Clear(); - //Fixture.TestSqlLoggerFactory.SetTestOutputHelper(testOutputHelper); + // Fixture.TestSqlLoggerFactory.SetTestOutputHelper(testOutputHelper); } public override async Task Basic_json_projection_owner_entity(bool async) @@ -608,7 +608,7 @@ public override async Task Json_scalar_required_null_semantics(bool async) """ SELECT [j].[Name] FROM [JsonEntitiesBasic] AS [j] -WHERE CAST(JSON_VALUE([j].[OwnedReferenceRoot],'$.Number') AS int) <> CAST(LEN(JSON_VALUE([j].[OwnedReferenceRoot],'$.Name')) AS int) OR (JSON_VALUE([j].[OwnedReferenceRoot],'$.Name') IS NULL) +WHERE CAST(JSON_VALUE([j].[OwnedReferenceRoot],'$.Number') AS int) <> CAST(LEN(JSON_VALUE([j].[OwnedReferenceRoot],'$.Name')) AS int) OR JSON_VALUE([j].[OwnedReferenceRoot],'$.Name') IS NULL """); } @@ -620,7 +620,7 @@ public override async Task Json_scalar_optional_null_semantics(bool async) """ SELECT [j].[Name] FROM [JsonEntitiesBasic] AS [j] -WHERE JSON_VALUE([j].[OwnedReferenceRoot],'$.Name') = JSON_VALUE([j].[OwnedReferenceRoot],'$.OwnedReferenceBranch.OwnedReferenceLeaf.SomethingSomething') OR ((JSON_VALUE([j].[OwnedReferenceRoot],'$.Name') IS NULL) AND (JSON_VALUE([j].[OwnedReferenceRoot],'$.OwnedReferenceBranch.OwnedReferenceLeaf.SomethingSomething') IS NULL)) +WHERE JSON_VALUE([j].[OwnedReferenceRoot],'$.Name') = JSON_VALUE([j].[OwnedReferenceRoot],'$.OwnedReferenceBranch.OwnedReferenceLeaf.SomethingSomething') OR (JSON_VALUE([j].[OwnedReferenceRoot],'$.Name') IS NULL AND JSON_VALUE([j].[OwnedReferenceRoot],'$.OwnedReferenceBranch.OwnedReferenceLeaf.SomethingSomething') IS NULL) """); } @@ -747,7 +747,7 @@ SELECT TOP(1) JSON_VALUE([t0].[c0],'$.OwnedReferenceBranch.Enum') SELECT [j0].[Id], [j0].[EntityBasicId], [j0].[Name], [j0].[OwnedCollectionRoot] AS [c], [j0].[OwnedReferenceRoot] AS [c0], JSON_VALUE([j0].[OwnedReferenceRoot],'$.Name') AS [Key] FROM [JsonEntitiesBasic] AS [j0] ) AS [t0] - WHERE [t].[Key] = [t0].[Key] OR (([t].[Key] IS NULL) AND ([t0].[Key] IS NULL))) + WHERE [t].[Key] = [t0].[Key] OR ([t].[Key] IS NULL AND [t0].[Key] IS NULL)) FROM ( SELECT JSON_VALUE([j].[OwnedReferenceRoot],'$.Name') AS [Key] FROM [JsonEntitiesBasic] AS [j] diff --git a/test/EFCore.SqlServer.FunctionalTests/Query/ManyToManyNoTrackingQuerySqlServerTest.cs b/test/EFCore.SqlServer.FunctionalTests/Query/ManyToManyNoTrackingQuerySqlServerTest.cs index f60d22eecce..3b3e3026fa0 100644 --- a/test/EFCore.SqlServer.FunctionalTests/Query/ManyToManyNoTrackingQuerySqlServerTest.cs +++ b/test/EFCore.SqlServer.FunctionalTests/Query/ManyToManyNoTrackingQuerySqlServerTest.cs @@ -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%') """); } @@ -60,7 +60,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%') """); } @@ -112,7 +112,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] """); } @@ -144,7 +144,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] """); } diff --git a/test/EFCore.SqlServer.FunctionalTests/Query/ManyToManyQuerySqlServerTest.cs b/test/EFCore.SqlServer.FunctionalTests/Query/ManyToManyQuerySqlServerTest.cs index 1eea7b708c2..09a38b7c6d5 100644 --- a/test/EFCore.SqlServer.FunctionalTests/Query/ManyToManyQuerySqlServerTest.cs +++ b/test/EFCore.SqlServer.FunctionalTests/Query/ManyToManyQuerySqlServerTest.cs @@ -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%') """); } @@ -59,7 +59,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%') """); } @@ -111,7 +111,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] """); } @@ -143,7 +143,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] """); } diff --git a/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindAggregateOperatorsQuerySqlServerTest.cs b/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindAggregateOperatorsQuerySqlServerTest.cs index b384b36f66e..4e011b10ae1 100644 --- a/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindAggregateOperatorsQuerySqlServerTest.cs +++ b/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindAggregateOperatorsQuerySqlServerTest.cs @@ -617,7 +617,7 @@ SELECT CASE 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 """); @@ -1248,7 +1248,7 @@ public override async Task OrderBy_Where_Count_with_predicate(bool async) """ 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) """); } @@ -1397,11 +1397,11 @@ FROM [Customers] AS [c] OUTER APPLY ( SELECT TOP(1) [o].[OrderID], [o].[ProductID], [o].[Discount], [o].[Quantity], [o].[UnitPrice] FROM [Order Details] AS [o] - WHERE (( + WHERE ( SELECT TOP(1) [o0].[OrderID] FROM [Orders] AS [o0] WHERE [c].[CustomerID] = [o0].[CustomerID] - ORDER BY [o0].[OrderID]) IS NOT NULL) AND ( + ORDER BY [o0].[OrderID]) IS NOT NULL AND ( SELECT TOP(1) [o1].[OrderID] FROM [Orders] AS [o1] WHERE [c].[CustomerID] = [o1].[CustomerID] @@ -1422,11 +1422,11 @@ public override async Task Multiple_collection_navigation_with_FirstOrDefault_ch SELECT ( SELECT TOP(1) [o].[ProductID] FROM [Order Details] AS [o] - WHERE (( + WHERE ( SELECT TOP(1) [o0].[OrderID] FROM [Orders] AS [o0] WHERE [c].[CustomerID] = [o0].[CustomerID] - ORDER BY [o0].[OrderID]) IS NOT NULL) AND ( + ORDER BY [o0].[OrderID]) IS NOT NULL AND ( SELECT TOP(1) [o1].[OrderID] FROM [Orders] AS [o1] WHERE [c].[CustomerID] = [o1].[CustomerID] @@ -1873,7 +1873,7 @@ public override async Task Average_with_non_matching_types_in_projection_doesnt_ """ SELECT AVG(CAST(CAST([o].[OrderID] AS bigint) AS float)) FROM [Orders] AS [o] -WHERE ([o].[CustomerID] IS NOT NULL) AND ([o].[CustomerID] LIKE N'A%') +WHERE [o].[CustomerID] IS NOT NULL AND [o].[CustomerID] LIKE N'A%' """); } @@ -1885,7 +1885,7 @@ public override async Task Max_with_non_matching_types_in_projection_introduces_ """ SELECT MAX(CAST([o].[OrderID] AS bigint)) FROM [Orders] AS [o] -WHERE ([o].[CustomerID] IS NOT NULL) AND ([o].[CustomerID] LIKE N'A%') +WHERE [o].[CustomerID] IS NOT NULL AND [o].[CustomerID] LIKE N'A%' """); } @@ -1897,7 +1897,7 @@ public override async Task Min_with_non_matching_types_in_projection_introduces_ """ SELECT MIN(CAST([o].[OrderID] AS bigint)) FROM [Orders] AS [o] -WHERE ([o].[CustomerID] IS NOT NULL) AND ([o].[CustomerID] LIKE N'A%') +WHERE [o].[CustomerID] IS NOT NULL AND [o].[CustomerID] LIKE N'A%' """); } @@ -2120,7 +2120,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) """); } @@ -2135,7 +2135,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)) """); } @@ -2151,13 +2151,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 """); @@ -2173,7 +2173,7 @@ SELECT 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 FROM [Orders] AS [o] @@ -2398,7 +2398,7 @@ public override async Task Collection_Last_member_access_in_projection_translate """ 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] @@ -2414,7 +2414,7 @@ public override async Task Collection_LastOrDefault_member_access_in_projection_ """ 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] diff --git a/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindAsNoTrackingQuerySqlServerTest.cs b/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindAsNoTrackingQuerySqlServerTest.cs index 22eed92a55b..f605747cb60 100644 --- a/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindAsNoTrackingQuerySqlServerTest.cs +++ b/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindAsNoTrackingQuerySqlServerTest.cs @@ -103,7 +103,7 @@ public override async Task Applied_after_navigation_expansion(bool async) SELECT [o].[OrderID], [o].[CustomerID], [o].[EmployeeID], [o].[OrderDate] FROM [Orders] AS [o] LEFT JOIN [Customers] AS [c] ON [o].[CustomerID] = [c].[CustomerID] -WHERE [c].[City] <> N'London' OR ([c].[City] IS NULL) +WHERE [c].[City] <> N'London' OR [c].[City] IS NULL """); } diff --git a/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindDbFunctionsQuerySqlServerTest.cs b/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindDbFunctionsQuerySqlServerTest.cs index 2a10a1de857..2da7bdb7021 100644 --- a/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindDbFunctionsQuerySqlServerTest.cs +++ b/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindDbFunctionsQuerySqlServerTest.cs @@ -1288,7 +1288,7 @@ await AssertCount( """ SELECT COUNT(*) FROM [Orders] AS [o] -WHERE ([o].[OrderID] % 10) = DATALENGTH([o].[OrderDate]) +WHERE [o].[OrderID] % 10 = DATALENGTH([o].[OrderDate]) """); } diff --git a/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindEFPropertyIncludeQuerySqlServerTest.cs b/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindEFPropertyIncludeQuerySqlServerTest.cs index 74a621e49e1..f8500ff7294 100644 --- a/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindEFPropertyIncludeQuerySqlServerTest.cs +++ b/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindEFPropertyIncludeQuerySqlServerTest.cs @@ -97,7 +97,7 @@ public override async Task Include_references_then_include_multi_level(bool asyn 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 +WHERE [o].[OrderID] % 23 = 13 """); } @@ -136,7 +136,7 @@ public override async Task Include_collection_alias_generation(bool async) SELECT [o].[OrderID], [o].[CustomerID], [o].[EmployeeID], [o].[OrderDate], [o0].[OrderID], [o0].[ProductID], [o0].[Discount], [o0].[Quantity], [o0].[UnitPrice] FROM [Orders] AS [o] LEFT JOIN [Order Details] AS [o0] ON [o].[OrderID] = [o0].[OrderID] -WHERE ([o].[CustomerID] IS NOT NULL) AND ([o].[CustomerID] LIKE N'F%') +WHERE [o].[CustomerID] IS NOT NULL AND [o].[CustomerID] LIKE N'F%' ORDER BY [o].[OrderID], [o0].[OrderID] """); } @@ -235,7 +235,7 @@ public override async Task Include_references_then_include_collection(bool async FROM [Orders] AS [o] LEFT JOIN [Customers] AS [c] ON [o].[CustomerID] = [c].[CustomerID] LEFT JOIN [Orders] AS [o0] ON [c].[CustomerID] = [o0].[CustomerID] -WHERE ([o].[CustomerID] IS NOT NULL) AND ([o].[CustomerID] LIKE N'F%') +WHERE [o].[CustomerID] IS NOT NULL AND [o].[CustomerID] LIKE N'F%' ORDER BY [o].[OrderID], [c].[CustomerID] """); } @@ -591,7 +591,7 @@ FROM [Order Details] AS [o] INNER JOIN [Products] AS [p] ON [o].[ProductID] = [p].[ProductID] 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 +WHERE [o].[OrderID] % 23 = 13 """); } @@ -783,7 +783,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 +WHERE [o].[OrderID] % 23 = 13 ORDER BY [o].[OrderID], [o].[ProductID], [p].[ProductID], [o0].[OrderID], [c].[CustomerID] """); } @@ -801,7 +801,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 +WHERE [p].[ProductID] % 17 = 5 ORDER BY [p].[ProductID], [t].[OrderID], [t].[ProductID] """); } @@ -983,7 +983,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] """); } @@ -1013,7 +1013,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] @@ -1054,7 +1054,7 @@ public override async Task Include_references_multi_level(bool async) FROM [Order Details] AS [o] INNER JOIN [Orders] AS [o0] ON [o].[OrderID] = [o0].[OrderID] LEFT JOIN [Customers] AS [c] ON [o0].[CustomerID] = [c].[CustomerID] -WHERE ([o].[OrderID] % 23) = 13 +WHERE [o].[OrderID] % 23 = 13 """); } @@ -1117,7 +1117,7 @@ public override async Task Include_reference_when_entity_in_projection(bool asyn SELECT [o].[OrderID], [o].[CustomerID], [o].[EmployeeID], [o].[OrderDate], [c].[CustomerID], [c].[Address], [c].[City], [c].[CompanyName], [c].[ContactName], [c].[ContactTitle], [c].[Country], [c].[Fax], [c].[Phone], [c].[PostalCode], [c].[Region] FROM [Orders] AS [o] LEFT JOIN [Customers] AS [c] ON [o].[CustomerID] = [c].[CustomerID] -WHERE ([o].[CustomerID] IS NOT NULL) AND ([o].[CustomerID] LIKE N'F%') +WHERE [o].[CustomerID] IS NOT NULL AND [o].[CustomerID] LIKE N'F%' """); } @@ -1143,7 +1143,7 @@ public override async Task Include_reference_alias_generation(bool async) SELECT [o].[OrderID], [o].[ProductID], [o].[Discount], [o].[Quantity], [o].[UnitPrice], [o0].[OrderID], [o0].[CustomerID], [o0].[EmployeeID], [o0].[OrderDate] FROM [Order Details] AS [o] INNER JOIN [Orders] AS [o0] ON [o].[OrderID] = [o0].[OrderID] -WHERE ([o].[OrderID] % 23) = 13 +WHERE [o].[OrderID] % 23 = 13 """); } @@ -1173,7 +1173,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].[ProductID] % 23) = 17 AND [o].[Quantity] < CAST(10 AS smallint) +WHERE [o].[ProductID] % 23 = 17 AND [o].[Quantity] < CAST(10 AS smallint) ORDER BY [o].[OrderID], [o].[ProductID], [o0].[OrderID], [c].[CustomerID] """); } @@ -1257,7 +1257,7 @@ FROM [Order Details] AS [o] LEFT JOIN [Customers] AS [c] ON [o0].[CustomerID] = [c].[CustomerID] INNER JOIN [Products] AS [p] ON [o].[ProductID] = [p].[ProductID] LEFT JOIN [Orders] AS [o1] ON [c].[CustomerID] = [o1].[CustomerID] -WHERE ([o].[OrderID] % 23) = 13 +WHERE [o].[OrderID] % 23 = 13 ORDER BY [o].[OrderID], [o].[ProductID], [o0].[OrderID], [c].[CustomerID], [p].[ProductID] """); } @@ -1494,7 +1494,7 @@ public override async Task Include_reference(bool async) SELECT [o].[OrderID], [o].[CustomerID], [o].[EmployeeID], [o].[OrderDate], [c].[CustomerID], [c].[Address], [c].[City], [c].[CompanyName], [c].[ContactName], [c].[ContactTitle], [c].[Country], [c].[Fax], [c].[Phone], [c].[PostalCode], [c].[Region] FROM [Orders] AS [o] LEFT JOIN [Customers] AS [c] ON [o].[CustomerID] = [c].[CustomerID] -WHERE ([o].[CustomerID] IS NOT NULL) AND ([o].[CustomerID] LIKE N'F%') +WHERE [o].[CustomerID] IS NOT NULL AND [o].[CustomerID] LIKE N'F%' """); } @@ -1510,7 +1510,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 +WHERE [o].[OrderID] % 23 = 13 ORDER BY [o].[OrderID], [o].[ProductID], [p].[ProductID], [o0].[OrderID], [c].[CustomerID] """); } @@ -1724,7 +1724,7 @@ public override async Task Include_collection_and_reference(bool async) FROM [Orders] AS [o] LEFT JOIN [Customers] AS [c] ON [o].[CustomerID] = [c].[CustomerID] LEFT JOIN [Order Details] AS [o0] ON [o].[OrderID] = [o0].[OrderID] -WHERE ([o].[CustomerID] IS NOT NULL) AND ([o].[CustomerID] LIKE N'F%') +WHERE [o].[CustomerID] IS NOT NULL AND [o].[CustomerID] LIKE N'F%' ORDER BY [o].[OrderID], [c].[CustomerID], [o0].[OrderID] """); } @@ -1740,7 +1740,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 [Products] AS [p] ON [o].[ProductID] = [p].[ProductID] -WHERE ([o].[OrderID] % 23) = 13 +WHERE [o].[OrderID] % 23 = 13 """); } @@ -1838,7 +1838,7 @@ FROM [Order Details] AS [o] INNER JOIN [Products] AS [p] ON [o].[ProductID] = [p].[ProductID] 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 +WHERE [o].[OrderID] % 23 = 13 """); } @@ -1852,7 +1852,7 @@ public override async Task Include_reference_and_collection(bool async) FROM [Orders] AS [o] LEFT JOIN [Customers] AS [c] ON [o].[CustomerID] = [c].[CustomerID] LEFT JOIN [Order Details] AS [o0] ON [o].[OrderID] = [o0].[OrderID] -WHERE ([o].[CustomerID] IS NOT NULL) AND ([o].[CustomerID] LIKE N'F%') +WHERE [o].[CustomerID] IS NOT NULL AND [o].[CustomerID] LIKE N'F%' ORDER BY [o].[OrderID], [c].[CustomerID], [o0].[OrderID] """); } @@ -1923,7 +1923,7 @@ public override async Task Include_reference_and_collection_order_by(bool async) FROM [Orders] AS [o] LEFT JOIN [Customers] AS [c] ON [o].[CustomerID] = [c].[CustomerID] LEFT JOIN [Orders] AS [o0] ON [c].[CustomerID] = [o0].[CustomerID] -WHERE ([o].[CustomerID] IS NOT NULL) AND ([o].[CustomerID] LIKE N'F%') +WHERE [o].[CustomerID] IS NOT NULL AND [o].[CustomerID] LIKE N'F%' ORDER BY [o].[OrderID], [c].[CustomerID] """); } @@ -1969,7 +1969,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 [Products] AS [p] ON [o].[ProductID] = [p].[ProductID] -WHERE ([o].[OrderID] % 23) = 13 +WHERE [o].[OrderID] % 23 = 13 """); } @@ -2023,7 +2023,7 @@ FROM [Order Details] AS [o] LEFT JOIN [Customers] AS [c] ON [o0].[CustomerID] = [c].[CustomerID] INNER JOIN [Products] AS [p] ON [o].[ProductID] = [p].[ProductID] LEFT JOIN [Orders] AS [o1] ON [c].[CustomerID] = [o1].[CustomerID] -WHERE ([o].[OrderID] % 23) = 13 +WHERE [o].[OrderID] % 23 = 13 ORDER BY [o].[OrderID], [o].[ProductID], [o0].[OrderID], [c].[CustomerID], [p].[ProductID] """); } @@ -2079,7 +2079,7 @@ public override async Task Include_multiple_references(bool async) FROM [Order Details] AS [o] INNER JOIN [Orders] AS [o0] ON [o].[OrderID] = [o0].[OrderID] INNER JOIN [Products] AS [p] ON [o].[ProductID] = [p].[ProductID] -WHERE ([o].[OrderID] % 23) = 13 +WHERE [o].[OrderID] % 23 = 13 """); } @@ -2096,7 +2096,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] """); } diff --git a/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindFunctionsQuerySqlServerTest.cs b/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindFunctionsQuerySqlServerTest.cs index 1c11acea2a1..d8aa23243aa 100644 --- a/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindFunctionsQuerySqlServerTest.cs +++ b/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindFunctionsQuerySqlServerTest.cs @@ -44,7 +44,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 """, // """ @@ -88,7 +88,7 @@ public override async Task String_StartsWith_Literal(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 ([c].[ContactName] IS NOT NULL) AND ([c].[ContactName] LIKE N'M%') +WHERE [c].[ContactName] IS NOT NULL AND [c].[ContactName] LIKE N'M%' """); } @@ -100,7 +100,7 @@ public override async Task String_StartsWith_Identity(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 [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]) """); } @@ -112,7 +112,7 @@ public override async Task String_StartsWith_Column(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 [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]) """); } @@ -124,7 +124,7 @@ public override async Task String_StartsWith_MethodCall(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 ([c].[ContactName] IS NOT NULL) AND ([c].[ContactName] LIKE N'M%') +WHERE [c].[ContactName] IS NOT NULL AND [c].[ContactName] LIKE N'M%' """); } @@ -136,7 +136,7 @@ public override async Task String_EndsWith_Literal(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 ([c].[ContactName] IS NOT NULL) AND ([c].[ContactName] LIKE N'%b') +WHERE [c].[ContactName] IS NOT NULL AND [c].[ContactName] LIKE N'%b' """); } @@ -148,7 +148,7 @@ public override async Task String_EndsWith_Identity(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 [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]) """); } @@ -160,7 +160,7 @@ public override async Task String_EndsWith_Column(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 [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]) """); } @@ -172,7 +172,7 @@ public override async Task String_EndsWith_MethodCall(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 ([c].[ContactName] IS NOT NULL) AND ([c].[ContactName] LIKE N'%m') +WHERE [c].[ContactName] IS NOT NULL AND [c].[ContactName] LIKE N'%m' """); } @@ -200,7 +200,7 @@ public override async Task String_Contains_Identity(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 ([c].[ContactName] LIKE N'') OR CHARINDEX([c].[ContactName], [c].[ContactName]) > 0 +WHERE [c].[ContactName] LIKE N'' OR CHARINDEX([c].[ContactName], [c].[ContactName]) > 0 """); } @@ -212,7 +212,7 @@ public override async Task String_Contains_Column(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 ([c].[ContactName] LIKE N'') OR CHARINDEX([c].[ContactName], [c].[ContactName]) > 0 +WHERE [c].[ContactName] LIKE N'' OR CHARINDEX([c].[ContactName], [c].[ContactName]) > 0 """); } @@ -238,7 +238,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 """); } @@ -531,7 +531,7 @@ public override async Task String_Compare_nested(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 [c].[CustomerID] = (N'M' + [c].[CustomerID]) +WHERE [c].[CustomerID] = N'M' + [c].[CustomerID] """, // """ @@ -549,7 +549,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] <= (N'M' + [c].[CustomerID]) +WHERE [c].[CustomerID] <= N'M' + [c].[CustomerID] """, // """ @@ -579,7 +579,7 @@ FROM [Customers] AS [c] """ SELECT [c].[CustomerID], [c].[Address], [c].[City], [c].[CompanyName], [c].[ContactName], [c].[ContactTitle], [c].[Country], [c].[Fax], [c].[Phone], [c].[PostalCode], [c].[Region] FROM [Customers] AS [c] -WHERE [c].[ContactTitle] = N'Owner' AND ([c].[Country] <> N'USA' OR ([c].[Country] IS NULL)) +WHERE [c].[ContactTitle] = N'Owner' AND ([c].[Country] <> N'USA' OR [c].[Country] IS NULL) """); } @@ -765,7 +765,7 @@ public override async Task String_Compare_to_nested(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 [c].[CustomerID] = (N'M' + [c].[CustomerID]) +WHERE [c].[CustomerID] = N'M' + [c].[CustomerID] """, // """ @@ -783,7 +783,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] <= (N'M' + [c].[CustomerID]) +WHERE [c].[CustomerID] <= N'M' + [c].[CustomerID] """, // """ @@ -813,7 +813,7 @@ FROM [Customers] AS [c] """ SELECT [c].[CustomerID], [c].[Address], [c].[City], [c].[CompanyName], [c].[ContactName], [c].[ContactTitle], [c].[Country], [c].[Fax], [c].[Phone], [c].[PostalCode], [c].[Region] FROM [Customers] AS [c] -WHERE [c].[ContactTitle] = N'Owner' AND ([c].[Country] <> N'USA' OR ([c].[Country] IS NULL)) +WHERE [c].[ContactTitle] = N'Owner' AND ([c].[Country] <> N'USA' OR [c].[Country] IS NULL) """); } @@ -835,7 +835,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 """, // """ @@ -2125,7 +2125,7 @@ FROM [Orders] AS [o] """ 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%') """); } @@ -2148,7 +2148,7 @@ public override async Task Indexof_with_one_constant_arg(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 (CHARINDEX(N'a', [c].[ContactName]) - 1) = 1 +WHERE CHARINDEX(N'a', [c].[ContactName]) - 1 = 1 """); } @@ -2177,7 +2177,7 @@ public override async Task Indexof_with_constant_starting_position(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 (CHARINDEX(N'a', [c].[ContactName], 3) - 1) = 4 +WHERE CHARINDEX(N'a', [c].[ContactName], 3) - 1 = 4 """); } @@ -2191,7 +2191,7 @@ public override async Task Indexof_with_parameter_starting_position(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 (CHARINDEX(N'a', [c].[ContactName], @__start_0 + 1) - 1) = 4 +WHERE CHARINDEX(N'a', [c].[ContactName], @__start_0 + 1) - 1 = 4 """); } @@ -2327,7 +2327,7 @@ public override async Task IsNullOrEmpty_in_predicate(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 ([c].[Region] IS NULL) OR ([c].[Region] LIKE N'') +WHERE [c].[Region] IS NULL OR [c].[Region] LIKE N'' """); } @@ -2338,7 +2338,7 @@ public override async Task IsNullOrEmpty_in_projection(bool async) AssertSql( """ SELECT [c].[CustomerID] AS [Id], CASE - WHEN ([c].[Region] IS NULL) OR ([c].[Region] LIKE N'') THEN CAST(1 AS bit) + WHEN [c].[Region] IS NULL OR [c].[Region] LIKE N'' THEN CAST(1 AS bit) ELSE CAST(0 AS bit) END AS [Value] FROM [Customers] AS [c] @@ -2353,7 +2353,7 @@ public override async Task IsNullOrEmpty_negated_in_predicate(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 ([c].[Region] IS NOT NULL) AND NOT ([c].[Region] LIKE N'') +WHERE [c].[Region] IS NOT NULL AND NOT ([c].[Region] LIKE N'') """); } @@ -2364,7 +2364,7 @@ public override async Task IsNullOrEmpty_negated_in_projection(bool async) AssertSql( """ SELECT [c].[CustomerID] AS [Id], CASE - WHEN ([c].[Region] IS NOT NULL) AND NOT ([c].[Region] LIKE N'') THEN CAST(1 AS bit) + WHEN [c].[Region] IS NOT NULL AND NOT ([c].[Region] LIKE N'') THEN CAST(1 AS bit) ELSE CAST(0 AS bit) END AS [Value] FROM [Customers] AS [c] @@ -2379,7 +2379,7 @@ public override async Task IsNullOrWhiteSpace_in_predicate(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 ([c].[Region] IS NULL) OR [c].[Region] = N'' +WHERE [c].[Region] IS NULL OR [c].[Region] = N'' """); } diff --git a/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindGroupByQuerySqlServerTest.cs b/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindGroupByQuerySqlServerTest.cs index 4a3e011f67d..526d9d311f2 100644 --- a/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindGroupByQuerySqlServerTest.cs +++ b/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindGroupByQuerySqlServerTest.cs @@ -274,7 +274,7 @@ public override async Task GroupBy_aggregate_projecting_conditional_expression(b SELECT [o].[OrderDate] AS [Key], CASE WHEN COUNT(*) = 0 THEN 1 ELSE COALESCE(SUM(CASE - WHEN ([o].[OrderID] % 2) = 0 THEN 1 + WHEN [o].[OrderID] % 2 = 0 THEN 1 ELSE 0 END), 0) / COUNT(*) END AS [SomeValue] @@ -1520,7 +1520,7 @@ public override async Task GroupBy_complex_key_aggregate_2(bool async) SELECT [t].[Key] AS [Month], COALESCE(SUM([t].[OrderID]), 0) AS [Total], ( SELECT COALESCE(SUM([o0].[OrderID]), 0) FROM [Orders] AS [o0] - WHERE DATEPART(month, [o0].[OrderDate]) = [t].[Key] OR (([o0].[OrderDate] IS NULL) AND ([t].[Key] IS NULL))) AS [Payment] + WHERE DATEPART(month, [o0].[OrderDate]) = [t].[Key] OR ([o0].[OrderDate] IS NULL AND [t].[Key] IS NULL)) AS [Payment] FROM ( SELECT [o].[OrderID], DATEPART(month, [o].[OrderDate]) AS [Key] FROM [Orders] AS [o] @@ -1592,7 +1592,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))) """); } @@ -2035,7 +2035,7 @@ SELECT COUNT(*) AS [c], [p0].[ProductID] FROM [Products] AS [p0] GROUP BY [p0].[ProductID] ) AS [t0] -WHERE ([o].[CustomerID] IS NOT NULL) AND ([o].[CustomerID] LIKE N'A%') +WHERE [o].[CustomerID] IS NOT NULL AND [o].[CustomerID] LIKE N'A%' ORDER BY [o].[OrderID], [t].[ProductID] """); } @@ -2051,7 +2051,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 """); @@ -2148,7 +2148,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] @@ -2162,7 +2162,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] @@ -2176,7 +2176,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] @@ -2190,7 +2190,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] @@ -2283,7 +2283,7 @@ public override async Task GroupBy_with_aggregate_through_navigation_property(bo SELECT MAX([c].[Region]) FROM [Orders] AS [o0] LEFT JOIN [Customers] AS [c] ON [o0].[CustomerID] = [c].[CustomerID] - WHERE [o].[EmployeeID] = [o0].[EmployeeID] OR (([o].[EmployeeID] IS NULL) AND ([o0].[EmployeeID] IS NULL))) AS [max] + WHERE [o].[EmployeeID] = [o0].[EmployeeID] OR ([o].[EmployeeID] IS NULL AND [o0].[EmployeeID] IS NULL)) AS [max] FROM [Orders] AS [o] GROUP BY [o].[EmployeeID] """); @@ -2298,7 +2298,7 @@ public override async Task GroupBy_with_aggregate_containing_complex_where(bool SELECT [o].[EmployeeID] AS [Key], ( SELECT MAX([o0].[OrderID]) FROM [Orders] AS [o0] - WHERE CAST([o0].[EmployeeID] AS bigint) = CAST((MAX([o].[OrderID]) * 6) AS bigint) OR (([o0].[EmployeeID] IS NULL) AND (MAX([o].[OrderID]) IS NULL))) AS [Max] + WHERE CAST([o0].[EmployeeID] AS bigint) = CAST((MAX([o].[OrderID]) * 6) AS bigint) OR ([o0].[EmployeeID] IS NULL AND MAX([o].[OrderID]) IS NULL)) AS [Max] FROM [Orders] AS [o] GROUP BY [o].[EmployeeID] """); @@ -2313,7 +2313,7 @@ public override async Task GroupBy_Shadow(bool async) SELECT ( SELECT TOP(1) [e0].[Title] FROM [Employees] AS [e0] - WHERE [e0].[Title] = N'Sales Representative' AND [e0].[EmployeeID] = 1 AND ([e].[Title] = [e0].[Title] OR (([e].[Title] IS NULL) AND ([e0].[Title] IS NULL)))) + WHERE [e0].[Title] = N'Sales Representative' AND [e0].[EmployeeID] = 1 AND ([e].[Title] = [e0].[Title] OR ([e].[Title] IS NULL AND [e0].[Title] IS NULL))) FROM [Employees] AS [e] WHERE [e].[Title] = N'Sales Representative' AND [e].[EmployeeID] = 1 GROUP BY [e].[Title] @@ -3025,7 +3025,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)) """); } @@ -3287,14 +3287,14 @@ public override async Task Where_select_function_groupby_followed_by_another_sel AssertSql( """ SELECT [o].[CustomerID] AS [Key], COALESCE(SUM(CASE - WHEN (2020 - DATEPART(year, [o].[OrderDate])) <= 30 THEN [o].[OrderID] + 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] -WHERE ([o].[CustomerID] IS NOT NULL) AND ([o].[CustomerID] LIKE N'A%') +WHERE [o].[CustomerID] IS NOT NULL AND [o].[CustomerID] LIKE N'A%' GROUP BY [o].[CustomerID] """); } @@ -3478,7 +3478,7 @@ public override async Task Select_uncorrelated_collection_with_groupby_when_oute SELECT DISTINCT [c].[City] FROM [Orders] AS [o] LEFT JOIN [Customers] AS [c] ON [o].[CustomerID] = [c].[CustomerID] - WHERE ([o].[CustomerID] IS NOT NULL) AND ([o].[CustomerID] LIKE N'A%') + WHERE [o].[CustomerID] IS NOT NULL AND [o].[CustomerID] LIKE N'A%' ) AS [t] OUTER APPLY ( SELECT [p].[ProductID] @@ -3523,7 +3523,7 @@ public override async Task Select_correlated_collection_after_GroupBy_aggregate_ SELECT [o].[CustomerID] FROM [Orders] AS [o] GROUP BY [o].[CustomerID] - HAVING ([o].[CustomerID] IS NOT NULL) AND ([o].[CustomerID] LIKE N'F%') + HAVING [o].[CustomerID] IS NOT NULL AND [o].[CustomerID] LIKE N'F%' ) AS [t] LEFT JOIN [Orders] AS [o0] ON [t].[CustomerID] = [o0].[CustomerID] ORDER BY [t].[CustomerID] @@ -3542,7 +3542,7 @@ public override async Task Complex_query_with_group_by_in_subquery5(bool async) """ SELECT [t].[c], [t].[ProductID], [t0].[CustomerID], [t0].[City] FROM ( - SELECT COALESCE(SUM([o].[ProductID] + ([o].[OrderID] * 1000)), 0) AS [c], [o].[ProductID], MIN([o].[OrderID] / 100) AS [c0] + SELECT COALESCE(SUM([o].[ProductID] + [o].[OrderID] * 1000), 0) AS [c], [o].[ProductID], MIN([o].[OrderID] / 100) AS [c0] 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] @@ -3576,7 +3576,7 @@ FROM [Orders] AS [o0] WHERE [c].[CustomerID] = [o0].[CustomerID] ) AS [t0] LEFT JOIN [Customers] AS [c0] ON [t0].[CustomerID] = [c0].[CustomerID] - WHERE ([t].[Key] = [t0].[Key] OR (([t].[Key] IS NULL) AND ([t0].[Key] IS NULL))) AND (COALESCE([c0].[City], N'') + COALESCE([t0].[CustomerID], N'') LIKE N'Lon%')) AS [Count], [t].[Key] + WHERE ([t].[Key] = [t0].[Key] OR ([t].[Key] IS NULL AND [t0].[Key] IS NULL)) AND COALESCE([c0].[City], N'') + COALESCE([t0].[CustomerID], N'') LIKE N'Lon%') AS [Count], [t].[Key] FROM ( SELECT [o].[OrderID], COALESCE([c2].[City], N'') + COALESCE([o].[CustomerID], N'') AS [Key] FROM [Orders] AS [o] diff --git a/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindIncludeNoTrackingQuerySqlServerTest.cs b/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindIncludeNoTrackingQuerySqlServerTest.cs index ec5fcce54a7..4970b5d56a8 100644 --- a/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindIncludeNoTrackingQuerySqlServerTest.cs +++ b/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindIncludeNoTrackingQuerySqlServerTest.cs @@ -140,7 +140,7 @@ public override async Task Include_reference_and_collection(bool async) FROM [Orders] AS [o] LEFT JOIN [Customers] AS [c] ON [o].[CustomerID] = [c].[CustomerID] LEFT JOIN [Order Details] AS [o0] ON [o].[OrderID] = [o0].[OrderID] -WHERE ([o].[CustomerID] IS NOT NULL) AND ([o].[CustomerID] LIKE N'F%') +WHERE [o].[CustomerID] IS NOT NULL AND [o].[CustomerID] LIKE N'F%' ORDER BY [o].[OrderID], [c].[CustomerID], [o0].[OrderID] """); } @@ -200,7 +200,7 @@ public override async Task Include_collection_alias_generation(bool async) SELECT [o].[OrderID], [o].[CustomerID], [o].[EmployeeID], [o].[OrderDate], [o0].[OrderID], [o0].[ProductID], [o0].[Discount], [o0].[Quantity], [o0].[UnitPrice] FROM [Orders] AS [o] LEFT JOIN [Order Details] AS [o0] ON [o].[OrderID] = [o0].[OrderID] -WHERE ([o].[CustomerID] IS NOT NULL) AND ([o].[CustomerID] LIKE N'F%') +WHERE [o].[CustomerID] IS NOT NULL AND [o].[CustomerID] LIKE N'F%' ORDER BY [o].[OrderID], [o0].[OrderID] """); } @@ -303,7 +303,7 @@ public override async Task Include_reference_when_entity_in_projection(bool asyn SELECT [o].[OrderID], [o].[CustomerID], [o].[EmployeeID], [o].[OrderDate], [c].[CustomerID], [c].[Address], [c].[City], [c].[CompanyName], [c].[ContactName], [c].[ContactTitle], [c].[Country], [c].[Fax], [c].[Phone], [c].[PostalCode], [c].[Region] FROM [Orders] AS [o] LEFT JOIN [Customers] AS [c] ON [o].[CustomerID] = [c].[CustomerID] -WHERE ([o].[CustomerID] IS NOT NULL) AND ([o].[CustomerID] LIKE N'F%') +WHERE [o].[CustomerID] IS NOT NULL AND [o].[CustomerID] LIKE N'F%' """); } @@ -435,7 +435,7 @@ public override async Task Include_multiple_references(bool async) FROM [Order Details] AS [o] INNER JOIN [Orders] AS [o0] ON [o].[OrderID] = [o0].[OrderID] INNER JOIN [Products] AS [p] ON [o].[ProductID] = [p].[ProductID] -WHERE ([o].[OrderID] % 23) = 13 +WHERE [o].[OrderID] % 23 = 13 """); } @@ -477,7 +477,7 @@ FROM [Order Details] AS [o] INNER JOIN [Products] AS [p] ON [o].[ProductID] = [p].[ProductID] 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 +WHERE [o].[OrderID] % 23 = 13 """); } @@ -494,7 +494,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] """); } @@ -510,7 +510,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 [Products] AS [p] ON [o].[ProductID] = [p].[ProductID] -WHERE ([o].[OrderID] % 23) = 13 +WHERE [o].[OrderID] % 23 = 13 """); } @@ -725,7 +725,7 @@ public override async Task Include_references_then_include_multi_level(bool asyn 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 +WHERE [o].[OrderID] % 23 = 13 """); } @@ -835,7 +835,7 @@ public override async Task Include_references_multi_level(bool async) FROM [Order Details] AS [o] INNER JOIN [Orders] AS [o0] ON [o].[OrderID] = [o0].[OrderID] LEFT JOIN [Customers] AS [c] ON [o0].[CustomerID] = [c].[CustomerID] -WHERE ([o].[OrderID] % 23) = 13 +WHERE [o].[OrderID] % 23 = 13 """); } @@ -1230,7 +1230,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] @@ -1329,7 +1329,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 +WHERE [p].[ProductID] % 17 = 5 ORDER BY [p].[ProductID], [t].[OrderID], [t].[ProductID] """); } @@ -1486,7 +1486,7 @@ public override async Task Include_collection_and_reference(bool async) FROM [Orders] AS [o] LEFT JOIN [Customers] AS [c] ON [o].[CustomerID] = [c].[CustomerID] LEFT JOIN [Order Details] AS [o0] ON [o].[OrderID] = [o0].[OrderID] -WHERE ([o].[CustomerID] IS NOT NULL) AND ([o].[CustomerID] LIKE N'F%') +WHERE [o].[CustomerID] IS NOT NULL AND [o].[CustomerID] LIKE N'F%' ORDER BY [o].[OrderID], [c].[CustomerID], [o0].[OrderID] """); } @@ -1553,7 +1553,7 @@ public override async Task Include_reference(bool async) SELECT [o].[OrderID], [o].[CustomerID], [o].[EmployeeID], [o].[OrderDate], [c].[CustomerID], [c].[Address], [c].[City], [c].[CompanyName], [c].[ContactName], [c].[ContactTitle], [c].[Country], [c].[Fax], [c].[Phone], [c].[PostalCode], [c].[Region] FROM [Orders] AS [o] LEFT JOIN [Customers] AS [c] ON [o].[CustomerID] = [c].[CustomerID] -WHERE ([o].[CustomerID] IS NOT NULL) AND ([o].[CustomerID] LIKE N'F%') +WHERE [o].[CustomerID] IS NOT NULL AND [o].[CustomerID] LIKE N'F%' """); } @@ -1745,7 +1745,7 @@ public override async Task Include_reference_alias_generation(bool async) SELECT [o].[OrderID], [o].[ProductID], [o].[Discount], [o].[Quantity], [o].[UnitPrice], [o0].[OrderID], [o0].[CustomerID], [o0].[EmployeeID], [o0].[OrderDate] FROM [Order Details] AS [o] INNER JOIN [Orders] AS [o0] ON [o].[OrderID] = [o0].[OrderID] -WHERE ([o].[OrderID] % 23) = 13 +WHERE [o].[OrderID] % 23 = 13 """); } @@ -1803,7 +1803,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 [Products] AS [p] ON [o].[ProductID] = [p].[ProductID] -WHERE ([o].[OrderID] % 23) = 13 +WHERE [o].[OrderID] % 23 = 13 """); } @@ -1861,7 +1861,7 @@ FROM [Order Details] AS [o] INNER JOIN [Products] AS [p] ON [o].[ProductID] = [p].[ProductID] 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 +WHERE [o].[OrderID] % 23 = 13 """); } diff --git a/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindIncludeQuerySqlServerTest.cs b/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindIncludeQuerySqlServerTest.cs index e94e0b5774e..2241669e8f8 100644 --- a/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindIncludeQuerySqlServerTest.cs +++ b/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindIncludeQuerySqlServerTest.cs @@ -38,7 +38,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] """); } @@ -52,7 +52,7 @@ public override async Task Include_reference(bool async) SELECT [o].[OrderID], [o].[CustomerID], [o].[EmployeeID], [o].[OrderDate], [c].[CustomerID], [c].[Address], [c].[City], [c].[CompanyName], [c].[ContactName], [c].[ContactTitle], [c].[Country], [c].[Fax], [c].[Phone], [c].[PostalCode], [c].[Region] FROM [Orders] AS [o] LEFT JOIN [Customers] AS [c] ON [o].[CustomerID] = [c].[CustomerID] -WHERE ([o].[CustomerID] IS NOT NULL) AND ([o].[CustomerID] LIKE N'F%') +WHERE [o].[CustomerID] IS NOT NULL AND [o].[CustomerID] LIKE N'F%' """); } @@ -171,7 +171,7 @@ public override async Task Include_reference_and_collection(bool async) FROM [Orders] AS [o] LEFT JOIN [Customers] AS [c] ON [o].[CustomerID] = [c].[CustomerID] LEFT JOIN [Order Details] AS [o0] ON [o].[OrderID] = [o0].[OrderID] -WHERE ([o].[CustomerID] IS NOT NULL) AND ([o].[CustomerID] LIKE N'F%') +WHERE [o].[CustomerID] IS NOT NULL AND [o].[CustomerID] LIKE N'F%' ORDER BY [o].[OrderID], [c].[CustomerID], [o0].[OrderID] """); } @@ -204,7 +204,7 @@ public override async Task Include_references_multi_level(bool async) FROM [Order Details] AS [o] INNER JOIN [Orders] AS [o0] ON [o].[OrderID] = [o0].[OrderID] LEFT JOIN [Customers] AS [c] ON [o0].[CustomerID] = [c].[CustomerID] -WHERE ([o].[OrderID] % 23) = 13 +WHERE [o].[OrderID] % 23 = 13 """); } @@ -219,7 +219,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 [Products] AS [p] ON [o].[ProductID] = [p].[ProductID] -WHERE ([o].[OrderID] % 23) = 13 +WHERE [o].[OrderID] % 23 = 13 """); } @@ -234,7 +234,7 @@ FROM [Order Details] AS [o] INNER JOIN [Products] AS [p] ON [o].[ProductID] = [p].[ProductID] 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 +WHERE [o].[OrderID] % 23 = 13 """); } @@ -249,7 +249,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] """); } @@ -302,7 +302,7 @@ public override async Task Include_collection_alias_generation(bool async) SELECT [o].[OrderID], [o].[CustomerID], [o].[EmployeeID], [o].[OrderDate], [o0].[OrderID], [o0].[ProductID], [o0].[Discount], [o0].[Quantity], [o0].[UnitPrice] FROM [Orders] AS [o] LEFT JOIN [Order Details] AS [o0] ON [o].[OrderID] = [o0].[OrderID] -WHERE ([o].[CustomerID] IS NOT NULL) AND ([o].[CustomerID] LIKE N'F%') +WHERE [o].[CustomerID] IS NOT NULL AND [o].[CustomerID] LIKE N'F%' ORDER BY [o].[OrderID], [o0].[OrderID] """); } @@ -760,7 +760,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] @@ -850,7 +850,7 @@ public override async Task Include_multiple_references(bool async) FROM [Order Details] AS [o] INNER JOIN [Orders] AS [o0] ON [o].[OrderID] = [o0].[OrderID] INNER JOIN [Products] AS [p] ON [o].[ProductID] = [p].[ProductID] -WHERE ([o].[OrderID] % 23) = 13 +WHERE [o].[OrderID] % 23 = 13 """); } @@ -863,7 +863,7 @@ public override async Task Include_reference_alias_generation(bool async) SELECT [o].[OrderID], [o].[ProductID], [o].[Discount], [o].[Quantity], [o].[UnitPrice], [o0].[OrderID], [o0].[CustomerID], [o0].[EmployeeID], [o0].[OrderDate] FROM [Order Details] AS [o] INNER JOIN [Orders] AS [o0] ON [o].[OrderID] = [o0].[OrderID] -WHERE ([o].[OrderID] % 23) = 13 +WHERE [o].[OrderID] % 23 = 13 """); } @@ -1814,7 +1814,7 @@ FROM [Order Details] AS [o] LEFT JOIN [Customers] AS [c] ON [o0].[CustomerID] = [c].[CustomerID] INNER JOIN [Products] AS [p] ON [o].[ProductID] = [p].[ProductID] LEFT JOIN [Orders] AS [o1] ON [c].[CustomerID] = [o1].[CustomerID] -WHERE ([o].[OrderID] % 23) = 13 +WHERE [o].[OrderID] % 23 = 13 ORDER BY [o].[OrderID], [o].[ProductID], [o0].[OrderID], [c].[CustomerID], [p].[ProductID] """); } @@ -1877,7 +1877,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 +WHERE [p].[ProductID] % 17 = 5 ORDER BY [p].[ProductID], [t].[OrderID], [t].[ProductID] """); } @@ -1892,7 +1892,7 @@ public override async Task Include_references_then_include_multi_level(bool asyn 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 +WHERE [o].[OrderID] % 23 = 13 """); } @@ -1922,7 +1922,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].[ProductID] % 23) = 17 AND [o].[Quantity] < CAST(10 AS smallint) +WHERE [o].[ProductID] % 23 = 17 AND [o].[Quantity] < CAST(10 AS smallint) ORDER BY [o].[OrderID], [o].[ProductID], [o0].[OrderID], [c].[CustomerID] """); } @@ -1952,7 +1952,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 [Products] AS [p] ON [o].[ProductID] = [p].[ProductID] -WHERE ([o].[OrderID] % 23) = 13 +WHERE [o].[OrderID] % 23 = 13 """); } @@ -1968,7 +1968,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 +WHERE [o].[OrderID] % 23 = 13 ORDER BY [o].[OrderID], [o].[ProductID], [p].[ProductID], [o0].[OrderID], [c].[CustomerID] """); } @@ -1983,7 +1983,7 @@ public override async Task Include_reference_and_collection_order_by(bool async) FROM [Orders] AS [o] LEFT JOIN [Customers] AS [c] ON [o].[CustomerID] = [c].[CustomerID] LEFT JOIN [Orders] AS [o0] ON [c].[CustomerID] = [o0].[CustomerID] -WHERE ([o].[CustomerID] IS NOT NULL) AND ([o].[CustomerID] LIKE N'F%') +WHERE [o].[CustomerID] IS NOT NULL AND [o].[CustomerID] LIKE N'F%' ORDER BY [o].[OrderID], [c].[CustomerID] """); } @@ -2036,7 +2036,7 @@ public override async Task Include_references_then_include_collection(bool async FROM [Orders] AS [o] LEFT JOIN [Customers] AS [c] ON [o].[CustomerID] = [c].[CustomerID] LEFT JOIN [Orders] AS [o0] ON [c].[CustomerID] = [o0].[CustomerID] -WHERE ([o].[CustomerID] IS NOT NULL) AND ([o].[CustomerID] LIKE N'F%') +WHERE [o].[CustomerID] IS NOT NULL AND [o].[CustomerID] LIKE N'F%' ORDER BY [o].[OrderID], [c].[CustomerID] """); } @@ -2051,7 +2051,7 @@ public override async Task Include_collection_and_reference(bool async) FROM [Orders] AS [o] LEFT JOIN [Customers] AS [c] ON [o].[CustomerID] = [c].[CustomerID] LEFT JOIN [Order Details] AS [o0] ON [o].[OrderID] = [o0].[OrderID] -WHERE ([o].[CustomerID] IS NOT NULL) AND ([o].[CustomerID] LIKE N'F%') +WHERE [o].[CustomerID] IS NOT NULL AND [o].[CustomerID] LIKE N'F%' ORDER BY [o].[OrderID], [c].[CustomerID], [o0].[OrderID] """); } @@ -2083,7 +2083,7 @@ FROM [Order Details] AS [o] LEFT JOIN [Customers] AS [c] ON [o0].[CustomerID] = [c].[CustomerID] INNER JOIN [Products] AS [p] ON [o].[ProductID] = [p].[ProductID] LEFT JOIN [Orders] AS [o1] ON [c].[CustomerID] = [o1].[CustomerID] -WHERE ([o].[OrderID] % 23) = 13 +WHERE [o].[OrderID] % 23 = 13 ORDER BY [o].[OrderID], [o].[ProductID], [o0].[OrderID], [c].[CustomerID], [p].[ProductID] """); } @@ -2147,7 +2147,7 @@ public override async Task Include_reference_when_entity_in_projection(bool asyn SELECT [o].[OrderID], [o].[CustomerID], [o].[EmployeeID], [o].[OrderDate], [c].[CustomerID], [c].[Address], [c].[City], [c].[CompanyName], [c].[ContactName], [c].[ContactTitle], [c].[Country], [c].[Fax], [c].[Phone], [c].[PostalCode], [c].[Region] FROM [Orders] AS [o] LEFT JOIN [Customers] AS [c] ON [o].[CustomerID] = [c].[CustomerID] -WHERE ([o].[CustomerID] IS NOT NULL) AND ([o].[CustomerID] LIKE N'F%') +WHERE [o].[CustomerID] IS NOT NULL AND [o].[CustomerID] LIKE N'F%' """); } @@ -2162,7 +2162,7 @@ FROM [Order Details] AS [o] INNER JOIN [Products] AS [p] ON [o].[ProductID] = [p].[ProductID] 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 +WHERE [o].[OrderID] % 23 = 13 """); } @@ -2178,7 +2178,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 +WHERE [o].[OrderID] % 23 = 13 ORDER BY [o].[OrderID], [o].[ProductID], [p].[ProductID], [o0].[OrderID], [c].[CustomerID] """); } diff --git a/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindJoinQuerySqlServerTest.cs b/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindJoinQuerySqlServerTest.cs index 8be046bcb4f..e333574f79e 100644 --- a/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindJoinQuerySqlServerTest.cs +++ b/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindJoinQuerySqlServerTest.cs @@ -232,7 +232,7 @@ public override async Task Join_same_collection_force_alias_uniquefication(bool SELECT [o].[OrderID], [o].[CustomerID], [o].[EmployeeID], [o].[OrderDate], [o0].[OrderID], [o0].[CustomerID], [o0].[EmployeeID], [o0].[OrderDate] FROM [Orders] AS [o] INNER JOIN [Orders] AS [o0] ON [o].[CustomerID] = [o0].[CustomerID] -WHERE ([o].[CustomerID] IS NOT NULL) AND ([o].[CustomerID] LIKE N'F%') +WHERE [o].[CustomerID] IS NOT NULL AND [o].[CustomerID] LIKE N'F%' """); } @@ -336,7 +336,7 @@ OUTER APPLY ( FROM [Orders] AS [o] WHERE [c].[CustomerID] = [o].[CustomerID] ) AS [t] -WHERE ([c].[CustomerID] LIKE N'F%') AND [c].[City] = N'Lisboa' +WHERE [c].[CustomerID] LIKE N'F%' AND [c].[City] = N'Lisboa' ORDER BY [c].[CustomerID] """); } @@ -402,7 +402,7 @@ FROM [Employees] AS [e] LEFT JOIN ( SELECT [o].[OrderID], [o].[CustomerID], [o].[EmployeeID], [o].[OrderDate] FROM [Orders] AS [o] - WHERE ([o].[CustomerID] IS NOT NULL) AND ([o].[CustomerID] LIKE N'F%') + WHERE [o].[CustomerID] IS NOT NULL AND [o].[CustomerID] LIKE N'F%' ) AS [t] ON [e].[EmployeeID] = [t].[EmployeeID] """); } @@ -462,7 +462,7 @@ public override async Task GroupJoin_DefaultIfEmpty_Where(bool async) SELECT [o].[OrderID], [o].[CustomerID], [o].[EmployeeID], [o].[OrderDate] FROM [Customers] AS [c] LEFT JOIN [Orders] AS [o] ON [c].[CustomerID] = [o].[CustomerID] -WHERE ([o].[OrderID] IS NOT NULL) AND [o].[CustomerID] = N'ALFKI' +WHERE [o].[OrderID] IS NOT NULL AND [o].[CustomerID] = N'ALFKI' """); } @@ -476,7 +476,7 @@ public override async Task Join_GroupJoin_DefaultIfEmpty_Where(bool async) FROM [Customers] AS [c] INNER JOIN [Orders] AS [o] ON [c].[CustomerID] = [o].[CustomerID] LEFT JOIN [Orders] AS [o0] ON [c].[CustomerID] = [o0].[CustomerID] -WHERE ([o0].[OrderID] IS NOT NULL) AND [o0].[CustomerID] = N'ALFKI' +WHERE [o0].[OrderID] IS NOT NULL AND [o0].[CustomerID] = N'ALFKI' """); } @@ -575,7 +575,7 @@ SELECT TOP(@__p_0) [o].[OrderID], [o].[CustomerID] FROM [Orders] AS [o] ORDER BY [o].[OrderID] ) AS [t] - WHERE ([t].[CustomerID] IS NOT NULL) AND ([t].[CustomerID] LIKE N'A%') + WHERE [t].[CustomerID] IS NOT NULL AND [t].[CustomerID] LIKE N'A%' ) AS [t0] ON [c].[CustomerID] = [t0].[CustomerID] """); } @@ -854,7 +854,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 b8d928af77d..c73f057bed4 100644 --- a/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindKeylessEntitiesQuerySqlServerTest.cs +++ b/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindKeylessEntitiesQuerySqlServerTest.cs @@ -129,7 +129,7 @@ SELECT [m].[CustomerID] 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]) """); } @@ -184,7 +184,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 08c3ba87bfe..03deaa0d4e1 100644 --- a/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindMiscellaneousQuerySqlServerTest.cs +++ b/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindMiscellaneousQuerySqlServerTest.cs @@ -672,7 +672,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 """); } @@ -687,7 +687,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 """); } @@ -702,7 +702,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 """); } @@ -717,7 +717,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 """); } @@ -877,16 +877,16 @@ SELECT TOP(1) [c0].[Country] FROM [Orders] AS [o1] INNER JOIN [Customers] AS [c0] ON [o1].[CustomerID] = [c0].[CustomerID] WHERE [o1].[OrderID] = [t0].[OrderID] - ORDER BY [o1].[OrderID], [c0].[CustomerID]) OR ((( + ORDER BY [o1].[OrderID], [c0].[CustomerID]) OR (( SELECT TOP(1) [c].[Country] FROM [Customers] AS [c] WHERE [c].[CustomerID] = [t].[CustomerID] - ORDER BY [c].[CustomerID]) IS NULL) AND (( + ORDER BY [c].[CustomerID]) IS NULL AND ( SELECT TOP(1) [c0].[Country] FROM [Orders] AS [o1] INNER JOIN [Customers] AS [c0] ON [o1].[CustomerID] = [c0].[CustomerID] WHERE [o1].[OrderID] = [t0].[OrderID] - ORDER BY [o1].[OrderID], [c0].[CustomerID]) IS NULL))) > 0 + ORDER BY [o1].[OrderID], [c0].[CustomerID]) IS NULL)) > 0 ORDER BY [t].[OrderID] """); } @@ -1141,7 +1141,7 @@ public override async Task Join_Customers_Orders_Projection_With_String_Concat_S @__p_0='10' @__p_1='5' -SELECT (COALESCE([c].[ContactName], N'') + N' ') + COALESCE([c].[ContactTitle], N'') AS [Contact], [o].[OrderID] +SELECT COALESCE([c].[ContactName], N'') + N' ' + COALESCE([c].[ContactTitle], N'') AS [Contact], [o].[OrderID] FROM [Customers] AS [c] INNER JOIN [Orders] AS [o] ON [c].[CustomerID] = [o].[CustomerID] ORDER BY [o].[OrderID] @@ -1488,7 +1488,7 @@ SELECT CASE WHEN EXISTS ( SELECT 1 FROM [Customers] AS [c] - WHERE ([c].[ContactName] IS NOT NULL) AND ([c].[ContactName] LIKE N'A%')) THEN CAST(1 AS bit) + WHERE [c].[ContactName] IS NOT NULL AND [c].[ContactName] LIKE N'A%') THEN CAST(1 AS bit) ELSE CAST(0 AS bit) END """); @@ -1505,7 +1505,7 @@ FROM [Customers] AS [c] WHERE NOT (EXISTS ( SELECT 1 FROM [Orders] AS [o] - WHERE ([o].[CustomerID] IS NOT NULL) AND ([o].[CustomerID] LIKE N'A%'))) + WHERE [o].[CustomerID] IS NOT NULL AND [o].[CustomerID] LIKE N'A%')) """); } @@ -1517,10 +1517,10 @@ public override async Task Any_nested_negated2(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 ([c].[City] <> N'London' OR ([c].[City] IS NULL)) AND NOT (EXISTS ( +WHERE ([c].[City] <> N'London' OR [c].[City] IS NULL) AND NOT (EXISTS ( SELECT 1 FROM [Orders] AS [o] - WHERE ([o].[CustomerID] IS NOT NULL) AND ([o].[CustomerID] LIKE N'A%'))) + WHERE [o].[CustomerID] IS NOT NULL AND [o].[CustomerID] LIKE N'A%')) """); } @@ -1535,7 +1535,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) """); } @@ -1550,7 +1550,7 @@ FROM [Customers] AS [c] WHERE EXISTS ( SELECT 1 FROM [Orders] AS [o] - WHERE ([o].[CustomerID] IS NOT NULL) AND ([o].[CustomerID] LIKE N'A%')) + WHERE [o].[CustomerID] IS NOT NULL AND [o].[CustomerID] LIKE N'A%') """); } @@ -1562,10 +1562,10 @@ public override async Task Any_nested2(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 ([c].[City] <> N'London' OR ([c].[City] IS NULL)) AND EXISTS ( +WHERE ([c].[City] <> N'London' OR [c].[City] IS NULL) AND EXISTS ( SELECT 1 FROM [Orders] AS [o] - WHERE ([o].[CustomerID] IS NOT NULL) AND ([o].[CustomerID] LIKE N'A%')) + WHERE [o].[CustomerID] IS NOT NULL AND [o].[CustomerID] LIKE N'A%') """); } @@ -1580,7 +1580,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) """); } @@ -1609,7 +1609,7 @@ SELECT CASE WHEN NOT EXISTS ( SELECT 1 FROM [Customers] AS [c] - WHERE ([c].[ContactName] IS NULL) OR NOT ([c].[ContactName] LIKE N'A%')) THEN CAST(1 AS bit) + WHERE [c].[ContactName] IS NULL OR NOT ([c].[ContactName] LIKE N'A%')) THEN CAST(1 AS bit) ELSE CAST(0 AS bit) END """); @@ -1625,7 +1625,7 @@ SELECT CASE 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 """); @@ -2028,7 +2028,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 """); } @@ -2496,7 +2496,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 @@ -2505,7 +2505,7 @@ SELECT 1 FROM [Customers] AS [c0] WHERE [c0].[CustomerID] = N'ALFKI') THEN CAST(1 AS bit) ELSE CAST(0 AS bit) - END) IS NULL)) + END) IS NULL) """); } @@ -2841,7 +2841,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 """); @@ -3045,7 +3045,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 """); } @@ -3101,7 +3101,7 @@ public override async Task String_concat_with_navigation1(bool async) AssertSql( """ -SELECT (COALESCE([o].[CustomerID], N'') + N' ') + COALESCE([c].[City], N'') +SELECT COALESCE([o].[CustomerID], N'') + N' ' + COALESCE([c].[City], N'') FROM [Orders] AS [o] LEFT JOIN [Customers] AS [c] ON [o].[CustomerID] = [c].[CustomerID] """); @@ -3113,7 +3113,7 @@ public override async Task String_concat_with_navigation2(bool async) AssertSql( """ -SELECT (COALESCE([c].[City], N'') + N' ') + COALESCE([c].[City], N'') +SELECT COALESCE([c].[City], N'') + N' ' + COALESCE([c].[City], N'') FROM [Orders] AS [o] LEFT JOIN [Customers] AS [c] ON [o].[CustomerID] = [c].[CustomerID] """); @@ -3143,13 +3143,13 @@ public override async Task Select_bitwise_or_multiple(bool async) AssertSql( """ -SELECT [c].[CustomerID], (CASE +SELECT [c].[CustomerID], 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) | CASE +END | CASE WHEN [c].[CustomerID] = N'ANTON' THEN CAST(1 AS bit) ELSE CAST(0 AS bit) END AS [Value] @@ -3205,13 +3205,13 @@ public override async Task Where_bitwise_or_with_logical_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] 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' """); } @@ -3223,13 +3223,13 @@ public override async Task Where_bitwise_and_with_logical_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] 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' """); } @@ -3241,13 +3241,13 @@ public override async Task Where_bitwise_or_with_logical_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] 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' """); } @@ -3259,13 +3259,13 @@ public override async Task Where_bitwise_and_with_logical_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] 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' """); } @@ -3291,7 +3291,7 @@ public override async Task Where_bitwise_binary_and(bool async) """ SELECT [o].[OrderID], [o].[CustomerID], [o].[EmployeeID], [o].[OrderDate] FROM [Orders] AS [o] -WHERE ([o].[OrderID] & 10248) = 10248 +WHERE [o].[OrderID] & 10248 = 10248 """); } @@ -3303,7 +3303,7 @@ public override async Task Where_bitwise_binary_or(bool async) """ SELECT [o].[OrderID], [o].[CustomerID], [o].[EmployeeID], [o].[OrderDate] FROM [Orders] AS [o] -WHERE ([o].[OrderID] | 10248) = 10248 +WHERE [o].[OrderID] | 10248 = 10248 """); } @@ -3314,13 +3314,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] @@ -3335,13 +3335,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] @@ -3374,7 +3374,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 """, // """ @@ -3395,7 +3395,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 """, // """ @@ -3416,7 +3416,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) """, // """ @@ -3481,7 +3481,7 @@ public override async Task Query_expression_with_to_string_and_contains(bool asy """ SELECT [o].[CustomerID] FROM [Orders] AS [o] -WHERE ([o].[OrderDate] IS NOT NULL) AND (CONVERT(varchar(10), [o].[EmployeeID]) LIKE N'%10%') +WHERE [o].[OrderDate] IS NOT NULL AND CONVERT(varchar(10), [o].[EmployeeID]) LIKE N'%10%' """); } @@ -3660,7 +3660,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 """); } @@ -3738,7 +3738,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] """); } @@ -3767,7 +3767,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] """); } @@ -4154,7 +4154,7 @@ public override async Task Anonymous_complex_distinct_where(bool async) """ SELECT DISTINCT [c].[CustomerID] + COALESCE([c].[City], N'') AS [A] FROM [Customers] AS [c] -WHERE ([c].[CustomerID] + COALESCE([c].[City], N'')) = N'ALFKIBerlin' +WHERE [c].[CustomerID] + COALESCE([c].[City], N'') = N'ALFKIBerlin' """); } @@ -4274,7 +4274,7 @@ public override async Task DTO_complex_distinct_where(bool async) """ SELECT DISTINCT [c].[CustomerID] + COALESCE([c].[City], N'') AS [Property] FROM [Customers] AS [c] -WHERE ([c].[CustomerID] + COALESCE([c].[City], N'')) = N'ALFKIBerlin' +WHERE [c].[CustomerID] + COALESCE([c].[City], N'') = N'ALFKIBerlin' """); } @@ -4792,7 +4792,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] """); } @@ -4834,7 +4834,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] """); } @@ -4850,7 +4850,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] """); } @@ -4903,7 +4903,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] """); } @@ -5129,7 +5129,7 @@ FROM [Orders] AS [o0] WHERE [c].[CustomerID] = [o0].[CustomerID] ORDER BY [o0].[OrderDate]) AS [OrderDate] FROM [Customers] AS [c] -WHERE ([c].[CustomerID] LIKE N'A%') AND EXISTS ( +WHERE [c].[CustomerID] LIKE N'A%' AND EXISTS ( SELECT 1 FROM [Orders] AS [o] WHERE [c].[CustomerID] = [o].[CustomerID]) @@ -5148,15 +5148,15 @@ 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] - ORDER BY [o].[OrderDate]) IS NULL)) + ORDER BY [o].[OrderDate]) IS NULL) """); } @@ -5574,7 +5574,7 @@ public override async Task Checked_context_with_arithmetic_does_not_fail(bool is """ 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] """); } @@ -5760,22 +5760,22 @@ SELECT CASE WHEN EXISTS ( SELECT 1 FROM [Orders] AS [o] - WHERE (( + WHERE ( SELECT TOP(1) [c0].[CustomerID] FROM [Orders] AS [o0] LEFT JOIN [Customers] AS [c0] ON [o0].[CustomerID] = [c0].[CustomerID] WHERE [c].[CustomerID] = [o0].[CustomerID] - ORDER BY [o0].[OrderDate]) IS NOT NULL) AND (( + ORDER BY [o0].[OrderDate]) IS NOT NULL AND (( SELECT TOP(1) [c1].[CustomerID] FROM [Orders] AS [o1] LEFT JOIN [Customers] AS [c1] ON [o1].[CustomerID] = [c1].[CustomerID] WHERE [c].[CustomerID] = [o1].[CustomerID] - ORDER BY [o1].[OrderDate]) = [o].[CustomerID] OR ((( + ORDER BY [o1].[OrderDate]) = [o].[CustomerID] OR (( SELECT TOP(1) [c1].[CustomerID] FROM [Orders] AS [o1] LEFT JOIN [Customers] AS [c1] ON [o1].[CustomerID] = [c1].[CustomerID] WHERE [c].[CustomerID] = [o1].[CustomerID] - ORDER BY [o1].[OrderDate]) IS NULL) AND ([o].[CustomerID] IS NULL))) AND [o].[OrderID] < 11000) THEN CAST(1 AS bit) + ORDER BY [o1].[OrderDate]) IS NULL AND [o].[CustomerID] IS NULL)) AND [o].[OrderID] < 11000) THEN CAST(1 AS bit) ELSE CAST(0 AS bit) END AS [Complex] FROM [Customers] AS [c] @@ -5925,12 +5925,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] """); } @@ -6711,7 +6711,7 @@ FROM [Orders] AS [o] WHERE EXISTS ( SELECT 1 FROM [Orders] AS [o0] - WHERE [o0].[OrderID] = @__firstOrder_OrderID_0 AND ([o0].[CustomerID] = [o].[CustomerID] OR (([o0].[CustomerID] IS NULL) AND ([o].[CustomerID] IS NULL)))) + WHERE [o0].[OrderID] = @__firstOrder_OrderID_0 AND ([o0].[CustomerID] = [o].[CustomerID] OR ([o0].[CustomerID] IS NULL AND [o].[CustomerID] IS NULL))) """); } @@ -6813,7 +6813,7 @@ public override async Task SelectMany_correlated_simple(bool async) SELECT [c].[CustomerID], [c].[Address], [c].[City], [c].[CompanyName], [c].[ContactName], [c].[ContactTitle], [c].[Country], [c].[Fax], [c].[Phone], [c].[PostalCode], [c].[Region], [e].[EmployeeID], [e].[City], [e].[Country], [e].[FirstName], [e].[ReportsTo], [e].[Title] FROM [Customers] AS [c] CROSS JOIN [Employees] AS [e] -WHERE [c].[City] = [e].[City] OR (([c].[City] IS NULL) AND ([e].[City] IS NULL)) +WHERE [c].[City] = [e].[City] OR ([c].[City] IS NULL AND [e].[City] IS NULL) ORDER BY [c].[CustomerID], [e].[EmployeeID] """); } diff --git a/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindNavigationsQuerySqlServerTest.cs b/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindNavigationsQuerySqlServerTest.cs index 9fe4da58d4e..9caea5b48a4 100644 --- a/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindNavigationsQuerySqlServerTest.cs +++ b/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindNavigationsQuerySqlServerTest.cs @@ -293,7 +293,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) """); } @@ -306,7 +306,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) """); } @@ -319,7 +319,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) """); } @@ -349,7 +349,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) """); } @@ -368,7 +368,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)) """); } @@ -383,7 +383,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)) """); } @@ -576,7 +576,7 @@ SELECT CASE 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] @@ -594,7 +594,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)) """); } @@ -700,7 +700,7 @@ SELECT COUNT_BIG(*) FROM [Order Details] AS [o3] WHERE [o].[OrderID] = [o3].[OrderID]) AS [collection2] FROM [Orders] AS [o] -WHERE ([o].[CustomerID] IS NOT NULL) AND ([o].[CustomerID] LIKE N'A%') +WHERE [o].[CustomerID] IS NOT NULL AND [o].[CustomerID] LIKE N'A%' """); } @@ -937,7 +937,7 @@ SELECT COUNT(*) FROM [Order Details] AS [o0] INNER JOIN [Orders] AS [o1] ON [o0].[OrderID] = [o1].[OrderID] LEFT JOIN [Customers] AS [c0] ON [o1].[CustomerID] = [c0].[CustomerID] - WHERE [c].[Country] = [c0].[Country] OR (([c].[Country] IS NULL) AND ([c0].[Country] IS NULL))) > 0 AND [o].[OrderID] IN (10643, 10692) + WHERE [c].[Country] = [c0].[Country] OR ([c].[Country] IS NULL AND [c0].[Country] IS NULL)) > 0 AND [o].[OrderID] IN (10643, 10692) """); } @@ -1046,7 +1046,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 """); } @@ -1081,7 +1081,7 @@ SELECT COUNT(*) FROM [Order Details] AS [o0] INNER JOIN [Orders] AS [o1] ON [o0].[OrderID] = [o1].[OrderID] LEFT JOIN [Customers] AS [c0] ON [o1].[CustomerID] = [c0].[CustomerID] - WHERE [c].[Country] = [c0].[Country] OR (([c].[Country] IS NULL) AND ([c0].[Country] IS NULL)) + WHERE [c].[Country] = [c0].[Country] OR ([c].[Country] IS NULL AND [c0].[Country] IS NULL) ) AS [t]) > 0 """); } @@ -1101,7 +1101,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)) """); } diff --git a/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindOperatorsSqlServerTest.cs b/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindOperatorsSqlServerTest.cs new file mode 100644 index 00000000000..a84b9dcd8c0 --- /dev/null +++ b/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindOperatorsSqlServerTest.cs @@ -0,0 +1,32 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +namespace Microsoft.EntityFrameworkCore.Query; + +public class NorthwindOperatorsSqlServerTest : NorthwindOperatorsQueryTestBase< + NorthwindQuerySqlServerFixture<NoopModelCustomizer>> +{ + public NorthwindOperatorsSqlServerTest( + NorthwindQuerySqlServerFixture<NoopModelCustomizer> fixture, + ITestOutputHelper testOutputHelper) + : base(fixture) + { + Fixture.TestSqlLoggerFactory.SetTestOutputHelper(testOutputHelper); + fixture.TestSqlLoggerFactory.Clear(); + } + + public override async Task Double_negate_on_column(bool async) + { + await base.Double_negate_on_column(async); + + AssertSql( +""" +SELECT [o].[OrderID], [o].[CustomerID], [o].[EmployeeID], [o].[OrderDate] +FROM [Orders] AS [o] +WHERE -(-[o].[OrderID]) = [o].[OrderID] +"""); + } + + private void AssertSql(params string[] expected) + => Fixture.TestSqlLoggerFactory.AssertBaseline(expected); +} diff --git a/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindQueryFiltersQuerySqlServerTest.cs b/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindQueryFiltersQuerySqlServerTest.cs index 27ba10a4e0f..02171dd82da 100644 --- a/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindQueryFiltersQuerySqlServerTest.cs +++ b/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindQueryFiltersQuerySqlServerTest.cs @@ -155,7 +155,7 @@ LEFT JOIN ( FROM [Customers] AS [c0] WHERE @__ef_filter__TenantPrefix_0 = N'' OR LEFT([c0].[CompanyName], LEN(@__ef_filter__TenantPrefix_0_1)) = @__ef_filter__TenantPrefix_0_1 ) AS [t] ON [o].[CustomerID] = [t].[CustomerID] - WHERE ([t].[CustomerID] IS NOT NULL) AND ([t].[CompanyName] IS NOT NULL) + WHERE [t].[CustomerID] IS NOT NULL AND [t].[CompanyName] IS NOT NULL ) AS [t0] ON [c].[CustomerID] = [t0].[CustomerID] WHERE @__ef_filter__TenantPrefix_0 = N'' OR LEFT([c].[CompanyName], LEN(@__ef_filter__TenantPrefix_0_1)) = @__ef_filter__TenantPrefix_0_1 ORDER BY [c].[CustomerID], [t0].[OrderID] @@ -191,7 +191,7 @@ LEFT JOIN ( FROM [Customers] AS [c] WHERE @__ef_filter__TenantPrefix_0 = N'' OR LEFT([c].[CompanyName], LEN(@__ef_filter__TenantPrefix_0_1)) = @__ef_filter__TenantPrefix_0_1 ) AS [t] ON [o].[CustomerID] = [t].[CustomerID] -WHERE ([t].[CustomerID] IS NOT NULL) AND ([t].[CompanyName] IS NOT NULL) +WHERE [t].[CustomerID] IS NOT NULL AND [t].[CompanyName] IS NOT NULL """); } @@ -215,7 +215,7 @@ LEFT JOIN ( FROM [Customers] AS [c] WHERE @__ef_filter__TenantPrefix_1 = N'' OR LEFT([c].[CompanyName], LEN(@__ef_filter__TenantPrefix_1_1)) = @__ef_filter__TenantPrefix_1_1 ) AS [t] ON [o0].[CustomerID] = [t].[CustomerID] - WHERE ([t].[CustomerID] IS NOT NULL) AND ([t].[CompanyName] IS NOT NULL) + WHERE [t].[CustomerID] IS NOT NULL AND [t].[CompanyName] IS NOT NULL ) AS [t0] ON [o].[OrderID] = [t0].[OrderID] WHERE [o].[Quantity] > @__ef_filter___quantity_0 """); @@ -241,7 +241,7 @@ LEFT JOIN ( FROM [Customers] AS [c0] WHERE @__ef_filter__TenantPrefix_0 = N'' OR LEFT([c0].[CompanyName], LEN(@__ef_filter__TenantPrefix_0_1)) = @__ef_filter__TenantPrefix_0_1 ) AS [t] ON [o].[CustomerID] = [t].[CustomerID] - WHERE ([t].[CustomerID] IS NOT NULL) AND ([t].[CompanyName] IS NOT NULL) + WHERE [t].[CustomerID] IS NOT NULL AND [t].[CompanyName] IS NOT NULL ) AS [t0] ON [c].[CustomerID] = [t0].[CustomerID] INNER JOIN ( SELECT [o0].[OrderID], [o0].[Discount] @@ -254,7 +254,7 @@ LEFT JOIN ( FROM [Customers] AS [c1] WHERE @__ef_filter__TenantPrefix_0 = N'' OR LEFT([c1].[CompanyName], LEN(@__ef_filter__TenantPrefix_0_1)) = @__ef_filter__TenantPrefix_0_1 ) AS [t3] ON [o1].[CustomerID] = [t3].[CustomerID] - WHERE ([t3].[CustomerID] IS NOT NULL) AND ([t3].[CompanyName] IS NOT NULL) + WHERE [t3].[CustomerID] IS NOT NULL AND [t3].[CompanyName] IS NOT NULL ) AS [t2] ON [o0].[OrderID] = [t2].[OrderID] WHERE [o0].[Quantity] > @__ef_filter___quantity_1 ) AS [t1] ON [t0].[OrderID] = [t1].[OrderID] @@ -309,7 +309,7 @@ LEFT JOIN ( FROM [Customers] AS [c] WHERE @__ef_filter__TenantPrefix_0 = N'' OR LEFT([c].[CompanyName], LEN(@__ef_filter__TenantPrefix_0_1)) = @__ef_filter__TenantPrefix_0_1 ) AS [t] ON [m].[CustomerID] = [t].[CustomerID] -WHERE ([t].[CustomerID] IS NOT NULL) AND ([t].[CompanyName] IS NOT NULL) +WHERE [t].[CustomerID] IS NOT NULL AND [t].[CompanyName] IS NOT NULL """); } @@ -355,7 +355,7 @@ LEFT JOIN ( FROM [Customers] AS [c] WHERE @__ef_filter__TenantPrefix_0 = N'' OR LEFT([c].[CompanyName], LEN(@__ef_filter__TenantPrefix_0_1)) = @__ef_filter__TenantPrefix_0_1 ) AS [t] ON [o].[CustomerID] = [t].[CustomerID] -WHERE ([t].[CustomerID] IS NOT NULL) AND ([t].[CompanyName] IS NOT NULL) +WHERE [t].[CustomerID] IS NOT NULL AND [t].[CompanyName] IS NOT NULL """); } @@ -382,7 +382,7 @@ LEFT JOIN ( FROM [Customers] AS [c] WHERE @__ef_filter__TenantPrefix_0 = N'' OR LEFT([c].[CompanyName], LEN(@__ef_filter__TenantPrefix_0_1)) = @__ef_filter__TenantPrefix_0_1 ) AS [t] ON [o].[CustomerID] = [t].[CustomerID] -WHERE ([t].[CustomerID] IS NOT NULL) AND ([t].[CompanyName] IS NOT NULL) +WHERE [t].[CustomerID] IS NOT NULL AND [t].[CompanyName] IS NOT NULL """); } diff --git a/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindSelectQuerySqlServerTest.cs b/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindSelectQuerySqlServerTest.cs index 8a026db2938..e493fc645e9 100644 --- a/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindSelectQuerySqlServerTest.cs +++ b/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindSelectQuerySqlServerTest.cs @@ -426,10 +426,10 @@ FROM [Order Details] AS [o0] WHERE [o].[OrderID] = [o0].[OrderID] AND ([o0].[OrderID] <> ( SELECT COUNT(*) FROM [Orders] AS [o1] - WHERE [c].[CustomerID] = [o1].[CustomerID]) OR (( + WHERE [c].[CustomerID] = [o1].[CustomerID]) OR ( SELECT COUNT(*) FROM [Orders] AS [o1] - WHERE [c].[CustomerID] = [o1].[CustomerID]) IS NULL)) + WHERE [c].[CustomerID] = [o1].[CustomerID]) IS NULL) ORDER BY [o0].[OrderID], [o0].[ProductID]), 0) FROM [Orders] AS [o] WHERE [c].[CustomerID] = [o].[CustomerID] AND [o].[OrderID] < 10500 @@ -573,7 +573,7 @@ public override async Task Select_non_matching_value_types_from_unary_expression AssertSql( """ -SELECT CAST(-[o].[OrderID] AS bigint) +SELECT CAST((-[o].[OrderID]) AS bigint) FROM [Orders] AS [o] WHERE [o].[CustomerID] = N'ALFKI' ORDER BY [o].[OrderID] @@ -1123,7 +1123,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] @@ -1245,7 +1245,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] """); } @@ -1261,7 +1261,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] """); @@ -1848,7 +1848,7 @@ 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 @@ -1863,7 +1863,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] @@ -1965,7 +1965,7 @@ public override async Task Projection_take_projection_doesnt_project_intermitten """ @__p_0='10' -SELECT TOP(@__p_0) ([c].[CustomerID] + N' ') + COALESCE([c].[City], N'') AS [Aggregate] +SELECT TOP(@__p_0) [c].[CustomerID] + N' ' + COALESCE([c].[City], N'') AS [Aggregate] FROM [Customers] AS [c] ORDER BY [c].[CustomerID] """); @@ -1979,7 +1979,7 @@ public override async Task Projection_skip_projection_doesnt_project_intermitten """ @__p_0='7' -SELECT ([c].[CustomerID] + N' ') + COALESCE([c].[City], N'') AS [Aggregate] +SELECT [c].[CustomerID] + N' ' + COALESCE([c].[City], N'') AS [Aggregate] FROM [Customers] AS [c] ORDER BY [c].[CustomerID] OFFSET @__p_0 ROWS @@ -1992,7 +1992,7 @@ public override async Task Projection_Distinct_projection_preserves_columns_used AssertSql( """ -SELECT (COALESCE([t].[FirstLetter], N'') + N' ') + [t].[Foo] AS [Aggregate] +SELECT COALESCE([t].[FirstLetter], N'') + N' ' + [t].[Foo] AS [Aggregate] FROM ( SELECT DISTINCT [c].[CustomerID], SUBSTRING([c].[CustomerID], 0 + 1, 1) AS [FirstLetter], N'Foo' AS [Foo] FROM [Customers] AS [c] @@ -2008,7 +2008,7 @@ public override async Task Projection_take_predicate_projection(bool async) """ @__p_0='10' -SELECT ([t].[CustomerID] + N' ') + COALESCE([t].[City], N'') AS [Aggregate] +SELECT [t].[CustomerID] + N' ' + COALESCE([t].[City], N'') AS [Aggregate] FROM ( SELECT TOP(@__p_0) [c].[CustomerID], [c].[City] FROM [Customers] AS [c] @@ -2087,7 +2087,7 @@ FROM [Orders] AS [o] OUTER APPLY ( SELECT [t].[CustomerID], [o0].[OrderID], [o0].[OrderDate] FROM [Orders] AS [o0] - WHERE ([t].[CustomerID] IS NOT NULL) AND [t].[CustomerID] = [o0].[CustomerID] AND [o0].[OrderID] IN (10248, 10249, 10250) + WHERE [t].[CustomerID] IS NOT NULL AND [t].[CustomerID] = [o0].[CustomerID] AND [o0].[OrderID] IN (10248, 10249, 10250) ) AS [t0] ORDER BY [t].[CustomerID], [t0].[OrderID] """); @@ -2127,7 +2127,7 @@ FROM [Orders] AS [o] OUTER APPLY ( SELECT [t].[OrderDate] AS [Outer1], [t].[CustomerID] AS [Outer2], [o0].[OrderID] AS [Inner], [o0].[OrderDate] FROM [Orders] AS [o0] - WHERE ([o0].[CustomerID] = [t].[CustomerID] OR (([o0].[CustomerID] IS NULL) AND ([t].[CustomerID] IS NULL))) AND [o0].[OrderID] IN (10248, 10249, 10250) + WHERE ([o0].[CustomerID] = [t].[CustomerID] OR ([o0].[CustomerID] IS NULL AND [t].[CustomerID] IS NULL)) AND [o0].[OrderID] IN (10248, 10249, 10250) ) AS [t0] ORDER BY [t].[OrderDate], [t].[CustomerID] """); @@ -2209,12 +2209,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] @@ -2287,7 +2287,7 @@ public override async Task Take_on_top_level_and_on_collection_projection_with_o FROM ( SELECT TOP(1) [o].[OrderID], [o].[OrderDate] FROM [Orders] AS [o] - WHERE ([o].[CustomerID] IS NOT NULL) AND ([o].[CustomerID] LIKE N'F%') + WHERE [o].[CustomerID] IS NOT NULL AND [o].[CustomerID] LIKE N'F%' ) AS [t] OUTER APPLY ( SELECT [t1].[OrderID], [p].[ProductID], [p].[Discontinued], [p].[ProductName], [p].[SupplierID], [p].[UnitPrice], [p].[UnitsInStock], [t1].[UnitPrice] AS [UnitPrice0], [t1].[ProductID] AS [ProductID0] @@ -2319,7 +2319,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 ( @@ -2391,7 +2391,7 @@ public override async Task VisitLambda_should_not_be_visited_trivially(bool asyn """ SELECT [o].[OrderID], [o].[CustomerID], [o].[EmployeeID], [o].[OrderDate] FROM [Orders] AS [o] -WHERE ([o].[CustomerID] IS NOT NULL) AND ([o].[CustomerID] LIKE N'A%') +WHERE [o].[CustomerID] IS NOT NULL AND [o].[CustomerID] LIKE N'A%' """); } @@ -2598,7 +2598,7 @@ FROM [Orders] AS [o] OUTER APPLY ( SELECT [t0].[CustomerID] AS [Outer], [o0].[OrderID] AS [Inner], [o0].[OrderDate] FROM [Orders] AS [o0] - WHERE ([o0].[CustomerID] = [t0].[CustomerID] OR (([o0].[CustomerID] IS NULL) AND ([t0].[CustomerID] IS NULL))) AND [o0].[OrderID] IN (10248, 10249, 10250) + WHERE ([o0].[CustomerID] = [t0].[CustomerID] OR ([o0].[CustomerID] IS NULL AND [t0].[CustomerID] IS NULL)) AND [o0].[OrderID] IN (10248, 10249, 10250) ) AS [t1] ORDER BY [t0].[CustomerID], [t0].[Complex] """); diff --git a/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindSplitIncludeNoTrackingQuerySqlServerTest.cs b/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindSplitIncludeNoTrackingQuerySqlServerTest.cs index 244a115679a..b60986f1227 100644 --- a/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindSplitIncludeNoTrackingQuerySqlServerTest.cs +++ b/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindSplitIncludeNoTrackingQuerySqlServerTest.cs @@ -275,7 +275,7 @@ public override async Task Include_references_multi_level(bool async) FROM [Order Details] AS [o] INNER JOIN [Orders] AS [o0] ON [o].[OrderID] = [o0].[OrderID] LEFT JOIN [Customers] AS [c] ON [o0].[CustomerID] = [c].[CustomerID] -WHERE ([o].[OrderID] % 23) = 13 +WHERE [o].[OrderID] % 23 = 13 """); } @@ -290,7 +290,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 [Products] AS [p] ON [o].[ProductID] = [p].[ProductID] -WHERE ([o].[OrderID] % 23) = 13 +WHERE [o].[OrderID] % 23 = 13 """); } @@ -450,7 +450,7 @@ FROM [Order Details] AS [o] INNER JOIN [Products] AS [p] ON [o].[ProductID] = [p].[ProductID] 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 +WHERE [o].[OrderID] % 23 = 13 """); } @@ -463,7 +463,7 @@ public override async Task Include_collection_and_reference(bool async) SELECT [o].[OrderID], [o].[CustomerID], [o].[EmployeeID], [o].[OrderDate], [c].[CustomerID], [c].[Address], [c].[City], [c].[CompanyName], [c].[ContactName], [c].[ContactTitle], [c].[Country], [c].[Fax], [c].[Phone], [c].[PostalCode], [c].[Region] FROM [Orders] AS [o] LEFT JOIN [Customers] AS [c] ON [o].[CustomerID] = [c].[CustomerID] -WHERE ([o].[CustomerID] IS NOT NULL) AND ([o].[CustomerID] LIKE N'F%') +WHERE [o].[CustomerID] IS NOT NULL AND [o].[CustomerID] LIKE N'F%' ORDER BY [o].[OrderID], [c].[CustomerID] """, // @@ -472,7 +472,7 @@ FROM [Orders] AS [o] FROM [Orders] AS [o] LEFT JOIN [Customers] AS [c] ON [o].[CustomerID] = [c].[CustomerID] INNER JOIN [Order Details] AS [o0] ON [o].[OrderID] = [o0].[OrderID] -WHERE ([o].[CustomerID] IS NOT NULL) AND ([o].[CustomerID] LIKE N'F%') +WHERE [o].[CustomerID] IS NOT NULL AND [o].[CustomerID] LIKE N'F%' ORDER BY [o].[OrderID], [c].[CustomerID] """); } @@ -813,7 +813,7 @@ public override async Task Include_references_then_include_multi_level(bool asyn 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 +WHERE [o].[OrderID] % 23 = 13 """); } @@ -879,7 +879,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 [Products] AS [p] ON [o].[ProductID] = [p].[ProductID] -WHERE ([o].[OrderID] % 23) = 13 +WHERE [o].[OrderID] % 23 = 13 """); } @@ -1053,7 +1053,7 @@ public override async Task Include_reference_alias_generation(bool async) SELECT [o].[OrderID], [o].[ProductID], [o].[Discount], [o].[Quantity], [o].[UnitPrice], [o0].[OrderID], [o0].[CustomerID], [o0].[EmployeeID], [o0].[OrderDate] FROM [Order Details] AS [o] INNER JOIN [Orders] AS [o0] ON [o].[OrderID] = [o0].[OrderID] -WHERE ([o].[OrderID] % 23) = 13 +WHERE [o].[OrderID] % 23 = 13 """); } @@ -1165,7 +1165,7 @@ public override async Task Include_collection_alias_generation(bool async) """ SELECT [o].[OrderID], [o].[CustomerID], [o].[EmployeeID], [o].[OrderDate] FROM [Orders] AS [o] -WHERE ([o].[CustomerID] IS NOT NULL) AND ([o].[CustomerID] LIKE N'F%') +WHERE [o].[CustomerID] IS NOT NULL AND [o].[CustomerID] LIKE N'F%' ORDER BY [o].[OrderID] """, // @@ -1173,7 +1173,7 @@ ORDER BY [o].[OrderID] SELECT [o0].[OrderID], [o0].[ProductID], [o0].[Discount], [o0].[Quantity], [o0].[UnitPrice], [o].[OrderID] FROM [Orders] AS [o] INNER JOIN [Order Details] AS [o0] ON [o].[OrderID] = [o0].[OrderID] -WHERE ([o].[CustomerID] IS NOT NULL) AND ([o].[CustomerID] LIKE N'F%') +WHERE [o].[CustomerID] IS NOT NULL AND [o].[CustomerID] LIKE N'F%' ORDER BY [o].[OrderID] """); } @@ -1267,7 +1267,7 @@ public override async Task Include_collection_then_reference(bool async) """ SELECT [p].[ProductID], [p].[Discontinued], [p].[ProductName], [p].[SupplierID], [p].[UnitPrice], [p].[UnitsInStock] FROM [Products] AS [p] -WHERE ([p].[ProductID] % 17) = 5 +WHERE [p].[ProductID] % 17 = 5 ORDER BY [p].[ProductID] """, // @@ -1279,7 +1279,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 +WHERE [p].[ProductID] % 17 = 5 ORDER BY [p].[ProductID] """); } @@ -1575,7 +1575,7 @@ public override async Task Include_list(bool async) """ 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] """, // @@ -1587,7 +1587,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] """); } @@ -1862,7 +1862,7 @@ public override async Task Include_reference(bool async) SELECT [o].[OrderID], [o].[CustomerID], [o].[EmployeeID], [o].[OrderDate], [c].[CustomerID], [c].[Address], [c].[City], [c].[CompanyName], [c].[ContactName], [c].[ContactTitle], [c].[Country], [c].[Fax], [c].[Phone], [c].[PostalCode], [c].[Region] FROM [Orders] AS [o] LEFT JOIN [Customers] AS [c] ON [o].[CustomerID] = [c].[CustomerID] -WHERE ([o].[CustomerID] IS NOT NULL) AND ([o].[CustomerID] LIKE N'F%') +WHERE [o].[CustomerID] IS NOT NULL AND [o].[CustomerID] LIKE N'F%' """); } @@ -1900,7 +1900,7 @@ public override async Task Include_multiple_references(bool async) FROM [Order Details] AS [o] INNER JOIN [Orders] AS [o0] ON [o].[OrderID] = [o0].[OrderID] INNER JOIN [Products] AS [p] ON [o].[ProductID] = [p].[ProductID] -WHERE ([o].[OrderID] % 23) = 13 +WHERE [o].[OrderID] % 23 = 13 """); } @@ -1949,7 +1949,7 @@ public override async Task Include_reference_when_entity_in_projection(bool asyn SELECT [o].[OrderID], [o].[CustomerID], [o].[EmployeeID], [o].[OrderDate], [c].[CustomerID], [c].[Address], [c].[City], [c].[CompanyName], [c].[ContactName], [c].[ContactTitle], [c].[Country], [c].[Fax], [c].[Phone], [c].[PostalCode], [c].[Region] FROM [Orders] AS [o] LEFT JOIN [Customers] AS [c] ON [o].[CustomerID] = [c].[CustomerID] -WHERE ([o].[CustomerID] IS NOT NULL) AND ([o].[CustomerID] LIKE N'F%') +WHERE [o].[CustomerID] IS NOT NULL AND [o].[CustomerID] LIKE N'F%' """); } @@ -2089,7 +2089,7 @@ FROM [Order Details] AS [o] INNER JOIN [Products] AS [p] ON [o].[ProductID] = [p].[ProductID] 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 +WHERE [o].[OrderID] % 23 = 13 """); } @@ -2400,7 +2400,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%' @@ -2413,7 +2413,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] @@ -2664,7 +2664,7 @@ public override async Task Include_reference_and_collection(bool async) SELECT [o].[OrderID], [o].[CustomerID], [o].[EmployeeID], [o].[OrderDate], [c].[CustomerID], [c].[Address], [c].[City], [c].[CompanyName], [c].[ContactName], [c].[ContactTitle], [c].[Country], [c].[Fax], [c].[Phone], [c].[PostalCode], [c].[Region] FROM [Orders] AS [o] LEFT JOIN [Customers] AS [c] ON [o].[CustomerID] = [c].[CustomerID] -WHERE ([o].[CustomerID] IS NOT NULL) AND ([o].[CustomerID] LIKE N'F%') +WHERE [o].[CustomerID] IS NOT NULL AND [o].[CustomerID] LIKE N'F%' ORDER BY [o].[OrderID], [c].[CustomerID] """, // @@ -2673,7 +2673,7 @@ FROM [Orders] AS [o] FROM [Orders] AS [o] LEFT JOIN [Customers] AS [c] ON [o].[CustomerID] = [c].[CustomerID] INNER JOIN [Order Details] AS [o0] ON [o].[OrderID] = [o0].[OrderID] -WHERE ([o].[CustomerID] IS NOT NULL) AND ([o].[CustomerID] LIKE N'F%') +WHERE [o].[CustomerID] IS NOT NULL AND [o].[CustomerID] LIKE N'F%' ORDER BY [o].[OrderID], [c].[CustomerID] """); } diff --git a/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindSplitIncludeQuerySqlServerTest.cs b/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindSplitIncludeQuerySqlServerTest.cs index 821b3def041..2468da5325e 100644 --- a/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindSplitIncludeQuerySqlServerTest.cs +++ b/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindSplitIncludeQuerySqlServerTest.cs @@ -31,7 +31,7 @@ public override async Task Include_list(bool async) """ 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] """, // @@ -43,7 +43,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] """); } @@ -57,7 +57,7 @@ public override async Task Include_reference(bool async) SELECT [o].[OrderID], [o].[CustomerID], [o].[EmployeeID], [o].[OrderDate], [c].[CustomerID], [c].[Address], [c].[City], [c].[CompanyName], [c].[ContactName], [c].[ContactTitle], [c].[Country], [c].[Fax], [c].[Phone], [c].[PostalCode], [c].[Region] FROM [Orders] AS [o] LEFT JOIN [Customers] AS [c] ON [o].[CustomerID] = [c].[CustomerID] -WHERE ([o].[CustomerID] IS NOT NULL) AND ([o].[CustomerID] LIKE N'F%') +WHERE [o].[CustomerID] IS NOT NULL AND [o].[CustomerID] LIKE N'F%' """); } @@ -165,7 +165,7 @@ public override async Task Include_reference_and_collection(bool async) SELECT [o].[OrderID], [o].[CustomerID], [o].[EmployeeID], [o].[OrderDate], [c].[CustomerID], [c].[Address], [c].[City], [c].[CompanyName], [c].[ContactName], [c].[ContactTitle], [c].[Country], [c].[Fax], [c].[Phone], [c].[PostalCode], [c].[Region] FROM [Orders] AS [o] LEFT JOIN [Customers] AS [c] ON [o].[CustomerID] = [c].[CustomerID] -WHERE ([o].[CustomerID] IS NOT NULL) AND ([o].[CustomerID] LIKE N'F%') +WHERE [o].[CustomerID] IS NOT NULL AND [o].[CustomerID] LIKE N'F%' ORDER BY [o].[OrderID], [c].[CustomerID] """, // @@ -174,7 +174,7 @@ FROM [Orders] AS [o] FROM [Orders] AS [o] LEFT JOIN [Customers] AS [c] ON [o].[CustomerID] = [c].[CustomerID] INNER JOIN [Order Details] AS [o0] ON [o].[OrderID] = [o0].[OrderID] -WHERE ([o].[CustomerID] IS NOT NULL) AND ([o].[CustomerID] LIKE N'F%') +WHERE [o].[CustomerID] IS NOT NULL AND [o].[CustomerID] LIKE N'F%' ORDER BY [o].[OrderID], [c].[CustomerID] """); } @@ -209,7 +209,7 @@ public override async Task Include_references_multi_level(bool async) FROM [Order Details] AS [o] INNER JOIN [Orders] AS [o0] ON [o].[OrderID] = [o0].[OrderID] LEFT JOIN [Customers] AS [c] ON [o0].[CustomerID] = [c].[CustomerID] -WHERE ([o].[OrderID] % 23) = 13 +WHERE [o].[OrderID] % 23 = 13 """); } @@ -224,7 +224,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 [Products] AS [p] ON [o].[ProductID] = [p].[ProductID] -WHERE ([o].[OrderID] % 23) = 13 +WHERE [o].[OrderID] % 23 = 13 """); } @@ -239,7 +239,7 @@ FROM [Order Details] AS [o] INNER JOIN [Products] AS [p] ON [o].[ProductID] = [p].[ProductID] 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 +WHERE [o].[OrderID] % 23 = 13 """); } @@ -253,7 +253,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] """, // @@ -263,7 +263,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] """); } @@ -330,7 +330,7 @@ public override async Task Include_collection_alias_generation(bool async) """ SELECT [o].[OrderID], [o].[CustomerID], [o].[EmployeeID], [o].[OrderDate] FROM [Orders] AS [o] -WHERE ([o].[CustomerID] IS NOT NULL) AND ([o].[CustomerID] LIKE N'F%') +WHERE [o].[CustomerID] IS NOT NULL AND [o].[CustomerID] LIKE N'F%' ORDER BY [o].[OrderID] """, // @@ -338,7 +338,7 @@ ORDER BY [o].[OrderID] SELECT [o0].[OrderID], [o0].[ProductID], [o0].[Discount], [o0].[Quantity], [o0].[UnitPrice], [o].[OrderID] FROM [Orders] AS [o] INNER JOIN [Order Details] AS [o0] ON [o].[OrderID] = [o0].[OrderID] -WHERE ([o].[CustomerID] IS NOT NULL) AND ([o].[CustomerID] LIKE N'F%') +WHERE [o].[CustomerID] IS NOT NULL AND [o].[CustomerID] LIKE N'F%' ORDER BY [o].[OrderID] """); } @@ -1069,7 +1069,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%' @@ -1082,7 +1082,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] @@ -1191,7 +1191,7 @@ public override async Task Include_multiple_references(bool async) FROM [Order Details] AS [o] INNER JOIN [Orders] AS [o0] ON [o].[OrderID] = [o0].[OrderID] INNER JOIN [Products] AS [p] ON [o].[ProductID] = [p].[ProductID] -WHERE ([o].[OrderID] % 23) = 13 +WHERE [o].[OrderID] % 23 = 13 """); } @@ -1204,7 +1204,7 @@ public override async Task Include_reference_alias_generation(bool async) SELECT [o].[OrderID], [o].[ProductID], [o].[Discount], [o].[Quantity], [o].[UnitPrice], [o0].[OrderID], [o0].[CustomerID], [o0].[EmployeeID], [o0].[OrderDate] FROM [Order Details] AS [o] INNER JOIN [Orders] AS [o0] ON [o].[OrderID] = [o0].[OrderID] -WHERE ([o].[OrderID] % 23) = 13 +WHERE [o].[OrderID] % 23 = 13 """); } @@ -2459,7 +2459,7 @@ FROM [Order Details] AS [o] INNER JOIN [Products] AS [p] ON [o].[ProductID] = [p].[ProductID] 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 +WHERE [o].[OrderID] % 23 = 13 ORDER BY [o].[OrderID], [o].[ProductID], [p].[ProductID], [o0].[OrderID], [c].[CustomerID] """, // @@ -2470,7 +2470,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 +WHERE [o].[OrderID] % 23 = 13 ORDER BY [o].[OrderID], [o].[ProductID], [p].[ProductID], [o0].[OrderID], [c].[CustomerID] """); } @@ -2528,7 +2528,7 @@ public override async Task Include_reference_when_entity_in_projection(bool asyn SELECT [o].[OrderID], [o].[CustomerID], [o].[EmployeeID], [o].[OrderDate], [c].[CustomerID], [c].[Address], [c].[City], [c].[CompanyName], [c].[ContactName], [c].[ContactTitle], [c].[Country], [c].[Fax], [c].[Phone], [c].[PostalCode], [c].[Region] FROM [Orders] AS [o] LEFT JOIN [Customers] AS [c] ON [o].[CustomerID] = [c].[CustomerID] -WHERE ([o].[CustomerID] IS NOT NULL) AND ([o].[CustomerID] LIKE N'F%') +WHERE [o].[CustomerID] IS NOT NULL AND [o].[CustomerID] LIKE N'F%' """); } @@ -2567,7 +2567,7 @@ public override async Task Include_collection_then_reference(bool async) """ SELECT [p].[ProductID], [p].[Discontinued], [p].[ProductName], [p].[SupplierID], [p].[UnitPrice], [p].[UnitsInStock] FROM [Products] AS [p] -WHERE ([p].[ProductID] % 17) = 5 +WHERE [p].[ProductID] % 17 = 5 ORDER BY [p].[ProductID] """, // @@ -2579,7 +2579,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 +WHERE [p].[ProductID] % 17 = 5 ORDER BY [p].[ProductID] """); } @@ -2595,7 +2595,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 [Products] AS [p] ON [o].[ProductID] = [p].[ProductID] -WHERE ([o].[OrderID] % 23) = 13 +WHERE [o].[OrderID] % 23 = 13 ORDER BY [o].[OrderID], [o].[ProductID], [o0].[OrderID], [c].[CustomerID], [p].[ProductID] """, // @@ -2606,7 +2606,7 @@ FROM [Order Details] AS [o] LEFT JOIN [Customers] AS [c] ON [o0].[CustomerID] = [c].[CustomerID] INNER JOIN [Products] AS [p] ON [o].[ProductID] = [p].[ProductID] INNER JOIN [Orders] AS [o1] ON [c].[CustomerID] = [o1].[CustomerID] -WHERE ([o].[OrderID] % 23) = 13 +WHERE [o].[OrderID] % 23 = 13 ORDER BY [o].[OrderID], [o].[ProductID], [o0].[OrderID], [c].[CustomerID], [p].[ProductID] """); } @@ -2699,7 +2699,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 [Products] AS [p] ON [o].[ProductID] = [p].[ProductID] -WHERE ([o].[OrderID] % 23) = 13 +WHERE [o].[OrderID] % 23 = 13 """); } @@ -2725,7 +2725,7 @@ public override async Task Include_reference_and_collection_order_by(bool async) SELECT [o].[OrderID], [o].[CustomerID], [o].[EmployeeID], [o].[OrderDate], [c].[CustomerID], [c].[Address], [c].[City], [c].[CompanyName], [c].[ContactName], [c].[ContactTitle], [c].[Country], [c].[Fax], [c].[Phone], [c].[PostalCode], [c].[Region] FROM [Orders] AS [o] LEFT JOIN [Customers] AS [c] ON [o].[CustomerID] = [c].[CustomerID] -WHERE ([o].[CustomerID] IS NOT NULL) AND ([o].[CustomerID] LIKE N'F%') +WHERE [o].[CustomerID] IS NOT NULL AND [o].[CustomerID] LIKE N'F%' ORDER BY [o].[OrderID], [c].[CustomerID] """, // @@ -2734,7 +2734,7 @@ FROM [Orders] AS [o] FROM [Orders] AS [o] LEFT JOIN [Customers] AS [c] ON [o].[CustomerID] = [c].[CustomerID] INNER JOIN [Orders] AS [o0] ON [c].[CustomerID] = [o0].[CustomerID] -WHERE ([o].[CustomerID] IS NOT NULL) AND ([o].[CustomerID] LIKE N'F%') +WHERE [o].[CustomerID] IS NOT NULL AND [o].[CustomerID] LIKE N'F%' ORDER BY [o].[OrderID], [c].[CustomerID] """); } @@ -2750,7 +2750,7 @@ FROM [Order Details] AS [o] INNER JOIN [Products] AS [p] ON [o].[ProductID] = [p].[ProductID] 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 +WHERE [o].[OrderID] % 23 = 13 ORDER BY [o].[OrderID], [o].[ProductID], [p].[ProductID], [o0].[OrderID], [c].[CustomerID] """, // @@ -2761,7 +2761,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 +WHERE [o].[OrderID] % 23 = 13 ORDER BY [o].[OrderID], [o].[ProductID], [p].[ProductID], [o0].[OrderID], [c].[CustomerID] """); } @@ -2776,7 +2776,7 @@ public override async Task Include_references_then_include_collection_multi_leve 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].[ProductID] % 23) = 17 AND [o].[Quantity] < CAST(10 AS smallint) +WHERE [o].[ProductID] % 23 = 17 AND [o].[Quantity] < CAST(10 AS smallint) ORDER BY [o].[OrderID], [o].[ProductID], [o0].[OrderID], [c].[CustomerID] """, // @@ -2786,7 +2786,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].[ProductID] % 23) = 17 AND [o].[Quantity] < CAST(10 AS smallint) +WHERE [o].[ProductID] % 23 = 17 AND [o].[Quantity] < CAST(10 AS smallint) ORDER BY [o].[OrderID], [o].[ProductID], [o0].[OrderID], [c].[CustomerID] """); } @@ -2800,7 +2800,7 @@ public override async Task Include_collection_and_reference(bool async) SELECT [o].[OrderID], [o].[CustomerID], [o].[EmployeeID], [o].[OrderDate], [c].[CustomerID], [c].[Address], [c].[City], [c].[CompanyName], [c].[ContactName], [c].[ContactTitle], [c].[Country], [c].[Fax], [c].[Phone], [c].[PostalCode], [c].[Region] FROM [Orders] AS [o] LEFT JOIN [Customers] AS [c] ON [o].[CustomerID] = [c].[CustomerID] -WHERE ([o].[CustomerID] IS NOT NULL) AND ([o].[CustomerID] LIKE N'F%') +WHERE [o].[CustomerID] IS NOT NULL AND [o].[CustomerID] LIKE N'F%' ORDER BY [o].[OrderID], [c].[CustomerID] """, // @@ -2809,7 +2809,7 @@ FROM [Orders] AS [o] FROM [Orders] AS [o] LEFT JOIN [Customers] AS [c] ON [o].[CustomerID] = [c].[CustomerID] INNER JOIN [Order Details] AS [o0] ON [o].[OrderID] = [o0].[OrderID] -WHERE ([o].[CustomerID] IS NOT NULL) AND ([o].[CustomerID] LIKE N'F%') +WHERE [o].[CustomerID] IS NOT NULL AND [o].[CustomerID] LIKE N'F%' ORDER BY [o].[OrderID], [c].[CustomerID] """); } @@ -2860,7 +2860,7 @@ public override async Task Include_references_then_include_multi_level(bool asyn 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 +WHERE [o].[OrderID] % 23 = 13 """); } @@ -2896,7 +2896,7 @@ public override async Task Include_references_then_include_collection(bool async SELECT [o].[OrderID], [o].[CustomerID], [o].[EmployeeID], [o].[OrderDate], [c].[CustomerID], [c].[Address], [c].[City], [c].[CompanyName], [c].[ContactName], [c].[ContactTitle], [c].[Country], [c].[Fax], [c].[Phone], [c].[PostalCode], [c].[Region] FROM [Orders] AS [o] LEFT JOIN [Customers] AS [c] ON [o].[CustomerID] = [c].[CustomerID] -WHERE ([o].[CustomerID] IS NOT NULL) AND ([o].[CustomerID] LIKE N'F%') +WHERE [o].[CustomerID] IS NOT NULL AND [o].[CustomerID] LIKE N'F%' ORDER BY [o].[OrderID], [c].[CustomerID] """, // @@ -2905,7 +2905,7 @@ FROM [Orders] AS [o] FROM [Orders] AS [o] LEFT JOIN [Customers] AS [c] ON [o].[CustomerID] = [c].[CustomerID] INNER JOIN [Orders] AS [o0] ON [c].[CustomerID] = [o0].[CustomerID] -WHERE ([o].[CustomerID] IS NOT NULL) AND ([o].[CustomerID] LIKE N'F%') +WHERE [o].[CustomerID] IS NOT NULL AND [o].[CustomerID] LIKE N'F%' ORDER BY [o].[OrderID], [c].[CustomerID] """); } @@ -2934,7 +2934,7 @@ FROM [Order Details] AS [o] INNER JOIN [Products] AS [p] ON [o].[ProductID] = [p].[ProductID] 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 +WHERE [o].[OrderID] % 23 = 13 """); } @@ -2949,7 +2949,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 [Products] AS [p] ON [o].[ProductID] = [p].[ProductID] -WHERE ([o].[OrderID] % 23) = 13 +WHERE [o].[OrderID] % 23 = 13 ORDER BY [o].[OrderID], [o].[ProductID], [o0].[OrderID], [c].[CustomerID], [p].[ProductID] """, // @@ -2960,7 +2960,7 @@ FROM [Order Details] AS [o] LEFT JOIN [Customers] AS [c] ON [o0].[CustomerID] = [c].[CustomerID] INNER JOIN [Products] AS [p] ON [o].[ProductID] = [p].[ProductID] INNER JOIN [Orders] AS [o1] ON [c].[CustomerID] = [o1].[CustomerID] -WHERE ([o].[OrderID] % 23) = 13 +WHERE [o].[OrderID] % 23 = 13 ORDER BY [o].[OrderID], [o].[ProductID], [o0].[OrderID], [c].[CustomerID], [p].[ProductID] """); } diff --git a/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindStringIncludeQuerySqlServerTest.cs b/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindStringIncludeQuerySqlServerTest.cs index 8c115ba5678..3d5f453af28 100644 --- a/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindStringIncludeQuerySqlServerTest.cs +++ b/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindStringIncludeQuerySqlServerTest.cs @@ -97,7 +97,7 @@ public override async Task Include_references_then_include_multi_level(bool asyn 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 +WHERE [o].[OrderID] % 23 = 13 """); } @@ -136,7 +136,7 @@ public override async Task Include_collection_alias_generation(bool async) SELECT [o].[OrderID], [o].[CustomerID], [o].[EmployeeID], [o].[OrderDate], [o0].[OrderID], [o0].[ProductID], [o0].[Discount], [o0].[Quantity], [o0].[UnitPrice] FROM [Orders] AS [o] LEFT JOIN [Order Details] AS [o0] ON [o].[OrderID] = [o0].[OrderID] -WHERE ([o].[CustomerID] IS NOT NULL) AND ([o].[CustomerID] LIKE N'F%') +WHERE [o].[CustomerID] IS NOT NULL AND [o].[CustomerID] LIKE N'F%' ORDER BY [o].[OrderID], [o0].[OrderID] """); } @@ -235,7 +235,7 @@ public override async Task Include_references_then_include_collection(bool async FROM [Orders] AS [o] LEFT JOIN [Customers] AS [c] ON [o].[CustomerID] = [c].[CustomerID] LEFT JOIN [Orders] AS [o0] ON [c].[CustomerID] = [o0].[CustomerID] -WHERE ([o].[CustomerID] IS NOT NULL) AND ([o].[CustomerID] LIKE N'F%') +WHERE [o].[CustomerID] IS NOT NULL AND [o].[CustomerID] LIKE N'F%' ORDER BY [o].[OrderID], [c].[CustomerID] """); } @@ -591,7 +591,7 @@ FROM [Order Details] AS [o] INNER JOIN [Products] AS [p] ON [o].[ProductID] = [p].[ProductID] 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 +WHERE [o].[OrderID] % 23 = 13 """); } @@ -783,7 +783,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 +WHERE [o].[OrderID] % 23 = 13 ORDER BY [o].[OrderID], [o].[ProductID], [p].[ProductID], [o0].[OrderID], [c].[CustomerID] """); } @@ -801,7 +801,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 +WHERE [p].[ProductID] % 17 = 5 ORDER BY [p].[ProductID], [t].[OrderID], [t].[ProductID] """); } @@ -983,7 +983,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] """); } @@ -1013,7 +1013,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] @@ -1054,7 +1054,7 @@ public override async Task Include_references_multi_level(bool async) FROM [Order Details] AS [o] INNER JOIN [Orders] AS [o0] ON [o].[OrderID] = [o0].[OrderID] LEFT JOIN [Customers] AS [c] ON [o0].[CustomerID] = [c].[CustomerID] -WHERE ([o].[OrderID] % 23) = 13 +WHERE [o].[OrderID] % 23 = 13 """); } @@ -1117,7 +1117,7 @@ public override async Task Include_reference_when_entity_in_projection(bool asyn SELECT [o].[OrderID], [o].[CustomerID], [o].[EmployeeID], [o].[OrderDate], [c].[CustomerID], [c].[Address], [c].[City], [c].[CompanyName], [c].[ContactName], [c].[ContactTitle], [c].[Country], [c].[Fax], [c].[Phone], [c].[PostalCode], [c].[Region] FROM [Orders] AS [o] LEFT JOIN [Customers] AS [c] ON [o].[CustomerID] = [c].[CustomerID] -WHERE ([o].[CustomerID] IS NOT NULL) AND ([o].[CustomerID] LIKE N'F%') +WHERE [o].[CustomerID] IS NOT NULL AND [o].[CustomerID] LIKE N'F%' """); } @@ -1143,7 +1143,7 @@ public override async Task Include_reference_alias_generation(bool async) SELECT [o].[OrderID], [o].[ProductID], [o].[Discount], [o].[Quantity], [o].[UnitPrice], [o0].[OrderID], [o0].[CustomerID], [o0].[EmployeeID], [o0].[OrderDate] FROM [Order Details] AS [o] INNER JOIN [Orders] AS [o0] ON [o].[OrderID] = [o0].[OrderID] -WHERE ([o].[OrderID] % 23) = 13 +WHERE [o].[OrderID] % 23 = 13 """); } @@ -1173,7 +1173,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].[ProductID] % 23) = 17 AND [o].[Quantity] < CAST(10 AS smallint) +WHERE [o].[ProductID] % 23 = 17 AND [o].[Quantity] < CAST(10 AS smallint) ORDER BY [o].[OrderID], [o].[ProductID], [o0].[OrderID], [c].[CustomerID] """); } @@ -1257,7 +1257,7 @@ FROM [Order Details] AS [o] LEFT JOIN [Customers] AS [c] ON [o0].[CustomerID] = [c].[CustomerID] INNER JOIN [Products] AS [p] ON [o].[ProductID] = [p].[ProductID] LEFT JOIN [Orders] AS [o1] ON [c].[CustomerID] = [o1].[CustomerID] -WHERE ([o].[OrderID] % 23) = 13 +WHERE [o].[OrderID] % 23 = 13 ORDER BY [o].[OrderID], [o].[ProductID], [o0].[OrderID], [c].[CustomerID], [p].[ProductID] """); } @@ -1494,7 +1494,7 @@ public override async Task Include_reference(bool async) SELECT [o].[OrderID], [o].[CustomerID], [o].[EmployeeID], [o].[OrderDate], [c].[CustomerID], [c].[Address], [c].[City], [c].[CompanyName], [c].[ContactName], [c].[ContactTitle], [c].[Country], [c].[Fax], [c].[Phone], [c].[PostalCode], [c].[Region] FROM [Orders] AS [o] LEFT JOIN [Customers] AS [c] ON [o].[CustomerID] = [c].[CustomerID] -WHERE ([o].[CustomerID] IS NOT NULL) AND ([o].[CustomerID] LIKE N'F%') +WHERE [o].[CustomerID] IS NOT NULL AND [o].[CustomerID] LIKE N'F%' """); } @@ -1510,7 +1510,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 +WHERE [o].[OrderID] % 23 = 13 ORDER BY [o].[OrderID], [o].[ProductID], [p].[ProductID], [o0].[OrderID], [c].[CustomerID] """); } @@ -1724,7 +1724,7 @@ public override async Task Include_collection_and_reference(bool async) FROM [Orders] AS [o] LEFT JOIN [Customers] AS [c] ON [o].[CustomerID] = [c].[CustomerID] LEFT JOIN [Order Details] AS [o0] ON [o].[OrderID] = [o0].[OrderID] -WHERE ([o].[CustomerID] IS NOT NULL) AND ([o].[CustomerID] LIKE N'F%') +WHERE [o].[CustomerID] IS NOT NULL AND [o].[CustomerID] LIKE N'F%' ORDER BY [o].[OrderID], [c].[CustomerID], [o0].[OrderID] """); } @@ -1740,7 +1740,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 [Products] AS [p] ON [o].[ProductID] = [p].[ProductID] -WHERE ([o].[OrderID] % 23) = 13 +WHERE [o].[OrderID] % 23 = 13 """); } @@ -1838,7 +1838,7 @@ FROM [Order Details] AS [o] INNER JOIN [Products] AS [p] ON [o].[ProductID] = [p].[ProductID] 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 +WHERE [o].[OrderID] % 23 = 13 """); } @@ -1852,7 +1852,7 @@ public override async Task Include_reference_and_collection(bool async) FROM [Orders] AS [o] LEFT JOIN [Customers] AS [c] ON [o].[CustomerID] = [c].[CustomerID] LEFT JOIN [Order Details] AS [o0] ON [o].[OrderID] = [o0].[OrderID] -WHERE ([o].[CustomerID] IS NOT NULL) AND ([o].[CustomerID] LIKE N'F%') +WHERE [o].[CustomerID] IS NOT NULL AND [o].[CustomerID] LIKE N'F%' ORDER BY [o].[OrderID], [c].[CustomerID], [o0].[OrderID] """); } @@ -1923,7 +1923,7 @@ public override async Task Include_reference_and_collection_order_by(bool async) FROM [Orders] AS [o] LEFT JOIN [Customers] AS [c] ON [o].[CustomerID] = [c].[CustomerID] LEFT JOIN [Orders] AS [o0] ON [c].[CustomerID] = [o0].[CustomerID] -WHERE ([o].[CustomerID] IS NOT NULL) AND ([o].[CustomerID] LIKE N'F%') +WHERE [o].[CustomerID] IS NOT NULL AND [o].[CustomerID] LIKE N'F%' ORDER BY [o].[OrderID], [c].[CustomerID] """); } @@ -1969,7 +1969,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 [Products] AS [p] ON [o].[ProductID] = [p].[ProductID] -WHERE ([o].[OrderID] % 23) = 13 +WHERE [o].[OrderID] % 23 = 13 """); } @@ -2023,7 +2023,7 @@ FROM [Order Details] AS [o] LEFT JOIN [Customers] AS [c] ON [o0].[CustomerID] = [c].[CustomerID] INNER JOIN [Products] AS [p] ON [o].[ProductID] = [p].[ProductID] LEFT JOIN [Orders] AS [o1] ON [c].[CustomerID] = [o1].[CustomerID] -WHERE ([o].[OrderID] % 23) = 13 +WHERE [o].[OrderID] % 23 = 13 ORDER BY [o].[OrderID], [o].[ProductID], [o0].[OrderID], [c].[CustomerID], [p].[ProductID] """); } @@ -2079,7 +2079,7 @@ public override async Task Include_multiple_references(bool async) FROM [Order Details] AS [o] INNER JOIN [Orders] AS [o0] ON [o].[OrderID] = [o0].[OrderID] INNER JOIN [Products] AS [p] ON [o].[ProductID] = [p].[ProductID] -WHERE ([o].[OrderID] % 23) = 13 +WHERE [o].[OrderID] % 23 = 13 """); } @@ -2096,7 +2096,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] """); } diff --git a/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindWhereQuerySqlServerTest.cs b/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindWhereQuerySqlServerTest.cs index e2aeed1450f..8d9fb99f2a0 100644 --- a/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindWhereQuerySqlServerTest.cs +++ b/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindWhereQuerySqlServerTest.cs @@ -498,13 +498,13 @@ public override async Task Where_bitwise_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] 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) +END = CAST(1 AS bit) """); } @@ -516,13 +516,13 @@ public override async Task Where_bitwise_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] 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) +END = CAST(1 AS bit) """); } @@ -569,10 +569,10 @@ FROM [Employees] AS [e] WHERE [e].[Title] = ( SELECT TOP(1) [e0].[Title] FROM [Employees] AS [e0] - ORDER BY [e0].[Title]) OR (([e].[Title] IS NULL) AND (( + ORDER BY [e0].[Title]) OR ([e].[Title] IS NULL AND ( SELECT TOP(1) [e0].[Title] FROM [Employees] AS [e0] - ORDER BY [e0].[Title]) IS NULL)) + ORDER BY [e0].[Title]) IS NULL) """); } @@ -801,7 +801,7 @@ public override async Task Where_string_indexof(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 (CHARINDEX(N'Sea', [c].[City]) - 1) <> -1 OR ([c].[City] IS NULL) +WHERE CHARINDEX(N'Sea', [c].[City]) - 1 <> -1 OR [c].[City] IS NULL """); } @@ -1119,7 +1119,7 @@ public override async Task Where_identity_comparison(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 [c].[City] = [c].[City] OR ([c].[City] IS NULL) +WHERE [c].[City] = [c].[City] OR [c].[City] IS NULL """); } @@ -1145,7 +1145,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) """); } @@ -1158,7 +1158,7 @@ public override async Task Where_not_in_optimization2(bool async) SELECT [c].[CustomerID], [c].[Address], [c].[City], [c].[CompanyName], [c].[ContactName], [c].[ContactTitle], [c].[Country], [c].[Fax], [c].[Phone], [c].[PostalCode], [c].[Region], [e].[EmployeeID], [e].[City], [e].[Country], [e].[FirstName], [e].[ReportsTo], [e].[Title] FROM [Customers] AS [c] CROSS JOIN [Employees] AS [e] -WHERE [c].[City] NOT IN (N'London', N'Berlin') OR ([c].[City] IS NULL) +WHERE [c].[City] NOT IN (N'London', N'Berlin') OR [c].[City] IS NULL """); } @@ -1171,7 +1171,7 @@ public override async Task Where_not_in_optimization3(bool async) SELECT [c].[CustomerID], [c].[Address], [c].[City], [c].[CompanyName], [c].[ContactName], [c].[ContactTitle], [c].[Country], [c].[Fax], [c].[Phone], [c].[PostalCode], [c].[Region], [e].[EmployeeID], [e].[City], [e].[Country], [e].[FirstName], [e].[ReportsTo], [e].[Title] FROM [Customers] AS [c] CROSS JOIN [Employees] AS [e] -WHERE [c].[City] NOT IN (N'London', N'Berlin', N'Seattle') OR ([c].[City] IS NULL) +WHERE [c].[City] NOT IN (N'London', N'Berlin', N'Seattle') OR [c].[City] IS NULL """); } @@ -1184,7 +1184,7 @@ public override async Task Where_not_in_optimization4(bool async) SELECT [c].[CustomerID], [c].[Address], [c].[City], [c].[CompanyName], [c].[ContactName], [c].[ContactTitle], [c].[Country], [c].[Fax], [c].[Phone], [c].[PostalCode], [c].[Region], [e].[EmployeeID], [e].[City], [e].[Country], [e].[FirstName], [e].[ReportsTo], [e].[Title] FROM [Customers] AS [c] CROSS JOIN [Employees] AS [e] -WHERE [c].[City] NOT IN (N'London', N'Berlin', N'Seattle', N'Lisboa') OR ([c].[City] IS NULL) +WHERE [c].[City] NOT IN (N'London', N'Berlin', N'Seattle', N'Lisboa') OR [c].[City] IS NULL """); } @@ -1554,7 +1554,7 @@ public override async Task Where_concat_string_int_comparison1(bool async) SELECT [c].[CustomerID] FROM [Customers] AS [c] -WHERE ([c].[CustomerID] + CAST(@__i_0 AS nchar(5))) = [c].[CompanyName] +WHERE [c].[CustomerID] + CAST(@__i_0 AS nchar(5)) = [c].[CompanyName] """); } @@ -1568,7 +1568,7 @@ public override async Task Where_concat_string_int_comparison2(bool async) SELECT [c].[CustomerID] FROM [Customers] AS [c] -WHERE (CAST(@__i_0 AS nchar(5)) + [c].[CustomerID]) = [c].[CompanyName] +WHERE CAST(@__i_0 AS nchar(5)) + [c].[CustomerID] = [c].[CompanyName] """); } @@ -1583,7 +1583,7 @@ public override async Task Where_concat_string_int_comparison3(bool async) SELECT [c].[CustomerID] FROM [Customers] AS [c] -WHERE (((CAST(@__p_0 AS nchar(5)) + [c].[CustomerID]) + CAST(@__j_1 AS nchar(5))) + CAST(42 AS nchar(5))) = [c].[CompanyName] +WHERE CAST(@__p_0 AS nchar(5)) + [c].[CustomerID] + CAST(@__j_1 AS nchar(5)) + CAST(42 AS nchar(5)) = [c].[CompanyName] """); } @@ -1595,7 +1595,7 @@ public override async Task Where_concat_string_int_comparison4(bool async) """ SELECT [o].[CustomerID] FROM [Orders] AS [o] -WHERE (CAST([o].[OrderID] AS nchar(5)) + COALESCE([o].[CustomerID], N'')) = [o].[CustomerID] +WHERE CAST([o].[OrderID] AS nchar(5)) + COALESCE([o].[CustomerID], N'') = [o].[CustomerID] """); } @@ -1609,7 +1609,7 @@ public override async Task Where_concat_string_string_comparison(bool async) SELECT [c].[CustomerID] FROM [Customers] AS [c] -WHERE (@__i_0 + [c].[CustomerID]) = [c].[CompanyName] +WHERE @__i_0 + [c].[CustomerID] = [c].[CompanyName] """); } @@ -1623,7 +1623,7 @@ public override async Task Where_string_concat_method_comparison(bool async) SELECT [c].[CustomerID] FROM [Customers] AS [c] -WHERE (@__i_0 + [c].[CustomerID]) = [c].[CompanyName] +WHERE @__i_0 + [c].[CustomerID] = [c].[CompanyName] """); } @@ -1638,7 +1638,7 @@ public override async Task Where_string_concat_method_comparison_2(bool async) SELECT [c].[CustomerID] FROM [Customers] AS [c] -WHERE (@__i_0 + (@__j_1 + [c].[CustomerID])) = [c].[CompanyName] +WHERE @__i_0 + @__j_1 + [c].[CustomerID] = [c].[CompanyName] """); } @@ -1654,7 +1654,7 @@ public override async Task Where_string_concat_method_comparison_3(bool async) SELECT [c].[CustomerID] FROM [Customers] AS [c] -WHERE (@__i_0 + (@__j_1 + (@__k_2 + [c].[CustomerID]))) = [c].[CompanyName] +WHERE @__i_0 + @__j_1 + @__k_2 + [c].[CustomerID] = [c].[CompanyName] """); } @@ -1800,7 +1800,7 @@ public override async Task Where_compare_null(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 ([c].[City] IS NULL) AND [c].[Country] = N'UK' +WHERE [c].[City] IS NULL AND [c].[Country] = N'UK' """); } @@ -2136,7 +2136,7 @@ public override async Task Using_same_parameter_twice_in_query_generates_one_sql SELECT [c].[CustomerID] FROM [Customers] AS [c] -WHERE ((CAST(@__i_0 AS nchar(5)) + [c].[CustomerID]) + CAST(@__i_0 AS nchar(5))) = [c].[CompanyName] +WHERE CAST(@__i_0 AS nchar(5)) + [c].[CustomerID] + CAST(@__i_0 AS nchar(5)) = [c].[CompanyName] """); } @@ -2479,7 +2479,7 @@ public override async Task Multiple_OrElse_on_same_column_with_null_constant_com """ SELECT [c].[CustomerID], [c].[Address], [c].[City], [c].[CompanyName], [c].[ContactName], [c].[ContactTitle], [c].[Country], [c].[Fax], [c].[Phone], [c].[PostalCode], [c].[Region] FROM [Customers] AS [c] -WHERE [c].[Region] IN (N'WA', N'OR', N'BC') OR ([c].[Region] IS NULL) +WHERE [c].[Region] IN (N'WA', N'OR', N'BC') OR [c].[Region] IS NULL """); } @@ -2570,7 +2570,7 @@ public override async Task Multiple_OrElse_on_same_column_with_null_parameter_co """ 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' """); } @@ -2621,7 +2621,7 @@ public override async Task Two_sets_of_comparison_combine_correctly2(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 [c].[Region] <> N'WA' AND ([c].[Region] IS NOT NULL) +WHERE [c].[Region] <> N'WA' AND [c].[Region] IS NOT NULL """); } @@ -2925,7 +2925,7 @@ public override async Task Where_Like_and_comparison(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 ([c].[CustomerID] LIKE N'F%') AND [c].[City] = N'Seattle' +WHERE [c].[CustomerID] LIKE N'F%' AND [c].[City] = N'Seattle' """); } @@ -2937,7 +2937,7 @@ public override async Task Where_Like_or_comparison(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 ([c].[CustomerID] LIKE N'F%') OR [c].[City] = N'Seattle' +WHERE [c].[CustomerID] LIKE N'F%' OR [c].[City] = N'Seattle' """); } diff --git a/test/EFCore.SqlServer.FunctionalTests/Query/NullSemanticsQuerySqlServerTest.cs b/test/EFCore.SqlServer.FunctionalTests/Query/NullSemanticsQuerySqlServerTest.cs index b567a48bc09..e302fe90f3d 100644 --- a/test/EFCore.SqlServer.FunctionalTests/Query/NullSemanticsQuerySqlServerTest.cs +++ b/test/EFCore.SqlServer.FunctionalTests/Query/NullSemanticsQuerySqlServerTest.cs @@ -41,7 +41,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) """); } @@ -59,19 +59,19 @@ WHERE [e].[BoolA] <> [e].[BoolB] """ 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) """); } @@ -89,19 +89,19 @@ WHERE [e].[BoolA] <> [e].[BoolB] """ 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) """); } @@ -119,19 +119,19 @@ 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) """); } @@ -149,19 +149,19 @@ WHERE [e].[BoolA] <> [e].[BoolB] """ 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) """); } @@ -179,19 +179,19 @@ 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) """); } @@ -209,19 +209,19 @@ 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) """); } @@ -239,19 +239,19 @@ WHERE [e].[BoolA] <> [e].[BoolB] """ 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) """); } @@ -269,19 +269,19 @@ WHERE [e].[BoolA] <> [e].[BoolB] """ 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) """); } @@ -299,19 +299,19 @@ 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) """); } @@ -329,19 +329,19 @@ 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) """); } @@ -359,19 +359,19 @@ WHERE [e].[BoolA] <> [e].[BoolB] """ 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) """); } @@ -389,19 +389,19 @@ 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) """); } @@ -419,19 +419,19 @@ WHERE [e].[BoolA] <> [e].[BoolB] """ 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) """); } @@ -449,19 +449,19 @@ WHERE [e].[BoolA] <> [e].[BoolB] """ 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) """); } @@ -479,19 +479,19 @@ 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) """); } @@ -521,7 +521,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) """); } @@ -551,7 +551,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) """); } @@ -569,19 +569,19 @@ WHERE [e].[BoolA] <> [e].[BoolB] """ 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) """); } @@ -599,19 +599,19 @@ WHERE [e].[BoolA] <> [e].[BoolB] """ 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) """); } @@ -636,10 +636,10 @@ 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 """, @@ -648,10 +648,10 @@ ELSE CAST(0 AS bit) 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 """); @@ -678,10 +678,10 @@ 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 """, @@ -690,10 +690,10 @@ ELSE CAST(0 AS bit) 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 """); @@ -720,10 +720,10 @@ 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 """, @@ -732,10 +732,10 @@ ELSE CAST(0 AS bit) 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 """); @@ -762,10 +762,10 @@ 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 """, @@ -774,10 +774,10 @@ ELSE CAST(0 AS bit) 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 """); @@ -804,10 +804,10 @@ 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 """, @@ -816,10 +816,10 @@ ELSE CAST(0 AS bit) 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 """); @@ -846,10 +846,10 @@ 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 """, @@ -858,10 +858,10 @@ ELSE CAST(0 AS bit) 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 """); @@ -913,7 +913,7 @@ public override async Task Contains_with_local_array_closure_with_null(bool asyn """ 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 """); } @@ -925,7 +925,7 @@ public override async Task Contains_with_local_array_closure_false_with_null(boo """ 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 """); } @@ -937,7 +937,7 @@ public override async Task Contains_with_local_nullable_array_closure_negated(bo """ 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 """); } @@ -949,7 +949,7 @@ public override async Task Contains_with_local_array_closure_with_multiple_nulls """ 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 """); } @@ -961,7 +961,7 @@ public override async Task Where_multiple_ors_with_null(bool async) """ SELECT [e].[Id] FROM [Entities1] AS [e] -WHERE [e].[NullableStringA] IN (N'Foo', N'Blah') OR ([e].[NullableStringA] IS NULL) +WHERE [e].[NullableStringA] IN (N'Foo', N'Blah') OR [e].[NullableStringA] IS NULL """); } @@ -973,7 +973,7 @@ public override async Task Where_multiple_ands_with_null(bool async) """ SELECT [e].[Id] FROM [Entities1] AS [e] -WHERE [e].[NullableStringA] NOT IN (N'Foo', N'Blah') AND ([e].[NullableStringA] IS NOT NULL) +WHERE [e].[NullableStringA] NOT IN (N'Foo', N'Blah') AND [e].[NullableStringA] IS NOT NULL """); } @@ -985,7 +985,7 @@ public override async Task Where_multiple_ors_with_nullable_parameter(bool async """ 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 """); } @@ -999,7 +999,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 """); } @@ -1013,7 +1013,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 """); } @@ -1061,7 +1061,7 @@ public override async Task Where_equal_with_coalesce(bool async) """ 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) """); } @@ -1073,7 +1073,7 @@ public override async Task Where_not_equal_with_coalesce(bool async) """ 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) """); } @@ -1097,7 +1097,7 @@ public override async Task Where_not_equal_with_coalesce_both_sides(bool async) """ 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) """); } @@ -1110,12 +1110,12 @@ public override async Task Where_equal_with_conditional(bool async) SELECT [e].[Id] FROM [Entities1] AS [e] WHERE CASE - WHEN [e].[NullableStringA] = [e].[NullableStringB] OR (([e].[NullableStringA] IS NULL) AND ([e].[NullableStringB] IS NULL)) THEN [e].[NullableStringA] + WHEN [e].[NullableStringA] = [e].[NullableStringB] OR ([e].[NullableStringA] IS NULL AND [e].[NullableStringB] IS NULL) THEN [e].[NullableStringA] ELSE [e].[NullableStringB] -END = [e].[NullableStringC] OR ((CASE - WHEN [e].[NullableStringA] = [e].[NullableStringB] OR (([e].[NullableStringA] IS NULL) AND ([e].[NullableStringB] IS NULL)) THEN [e].[NullableStringA] +END = [e].[NullableStringC] OR (CASE + WHEN [e].[NullableStringA] = [e].[NullableStringB] OR ([e].[NullableStringA] IS NULL AND [e].[NullableStringB] IS NULL) THEN [e].[NullableStringA] ELSE [e].[NullableStringB] -END IS NULL) AND ([e].[NullableStringC] IS NULL)) +END IS NULL AND [e].[NullableStringC] IS NULL) """); } @@ -1128,15 +1128,15 @@ public override async Task Where_not_equal_with_conditional(bool async) SELECT [e].[Id] FROM [Entities1] AS [e] WHERE ([e].[NullableStringC] <> CASE - WHEN [e].[NullableStringA] = [e].[NullableStringB] OR (([e].[NullableStringA] IS NULL) AND ([e].[NullableStringB] IS NULL)) THEN [e].[NullableStringA] + WHEN [e].[NullableStringA] = [e].[NullableStringB] OR ([e].[NullableStringA] IS NULL AND [e].[NullableStringB] IS NULL) THEN [e].[NullableStringA] ELSE [e].[NullableStringB] -END OR ([e].[NullableStringC] IS NULL) OR (CASE - WHEN [e].[NullableStringA] = [e].[NullableStringB] OR (([e].[NullableStringA] IS NULL) AND ([e].[NullableStringB] IS NULL)) THEN [e].[NullableStringA] +END OR [e].[NullableStringC] IS NULL OR CASE + WHEN [e].[NullableStringA] = [e].[NullableStringB] OR ([e].[NullableStringA] IS NULL AND [e].[NullableStringB] IS NULL) THEN [e].[NullableStringA] ELSE [e].[NullableStringB] -END IS NULL)) AND (([e].[NullableStringC] IS NOT NULL) OR (CASE - WHEN [e].[NullableStringA] = [e].[NullableStringB] OR (([e].[NullableStringA] IS NULL) AND ([e].[NullableStringB] IS NULL)) THEN [e].[NullableStringA] +END IS NULL) AND ([e].[NullableStringC] IS NOT NULL OR CASE + WHEN [e].[NullableStringA] = [e].[NullableStringB] OR ([e].[NullableStringA] IS NULL AND [e].[NullableStringB] IS NULL) THEN [e].[NullableStringA] ELSE [e].[NullableStringB] -END IS NOT NULL)) +END IS NOT NULL) """); } @@ -1149,9 +1149,9 @@ public override async Task Where_equal_with_conditional_non_nullable(bool async) SELECT [e].[Id] FROM [Entities1] AS [e] WHERE [e].[NullableStringC] <> CASE - WHEN [e].[NullableStringA] = [e].[NullableStringB] OR (([e].[NullableStringA] IS NULL) AND ([e].[NullableStringB] IS NULL)) THEN [e].[StringA] + WHEN [e].[NullableStringA] = [e].[NullableStringB] OR ([e].[NullableStringA] IS NULL AND [e].[NullableStringB] IS NULL) THEN [e].[StringA] ELSE [e].[StringB] -END OR ([e].[NullableStringC] IS NULL) +END OR [e].[NullableStringC] IS NULL """); } @@ -1163,7 +1163,7 @@ public override async Task Where_equal_with_and_and_contains(bool async) """ 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) """); } @@ -1174,7 +1174,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] @@ -1190,10 +1190,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 """); @@ -1326,7 +1326,7 @@ public override async Task Where_nullable_bool_with_null_check(bool async) """ 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) """); } @@ -1476,7 +1476,7 @@ public override void Switching_null_semantics_produces_different_cache_entry() """ 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) """, // """ @@ -1557,19 +1557,19 @@ public override async Task Null_semantics_applied_when_comparing_function_with_n """ SELECT [e].[Id] FROM [Entities1] AS [e] -WHERE (CAST(CHARINDEX(N'oo', [e].[NullableStringA]) AS int) - 1) = [e].[NullableIntA] OR (([e].[NullableStringA] IS NULL) AND ([e].[NullableIntA] IS NULL)) +WHERE CAST(CHARINDEX(N'oo', [e].[NullableStringA]) AS int) - 1 = [e].[NullableIntA] OR ([e].[NullableStringA] IS NULL AND [e].[NullableIntA] IS NULL) """, // """ SELECT [e].[Id] FROM [Entities1] AS [e] -WHERE (CAST(CHARINDEX(N'ar', [e].[NullableStringA]) AS int) - 1) = [e].[NullableIntA] OR (([e].[NullableStringA] IS NULL) AND ([e].[NullableIntA] IS NULL)) +WHERE CAST(CHARINDEX(N'ar', [e].[NullableStringA]) AS int) - 1 = [e].[NullableIntA] OR ([e].[NullableStringA] IS NULL AND [e].[NullableIntA] IS NULL) """, // """ SELECT [e].[Id] FROM [Entities1] AS [e] -WHERE ((CAST(CHARINDEX(N'oo', [e].[NullableStringA]) AS int) - 1) <> [e].[NullableIntB] OR ([e].[NullableStringA] IS NULL) OR ([e].[NullableIntB] IS NULL)) AND (([e].[NullableStringA] IS NOT NULL) OR ([e].[NullableIntB] IS NOT NULL)) +WHERE (CAST(CHARINDEX(N'oo', [e].[NullableStringA]) AS int) - 1 <> [e].[NullableIntB] OR [e].[NullableStringA] IS NULL OR [e].[NullableIntB] IS NULL) AND ([e].[NullableStringA] IS NOT NULL OR [e].[NullableIntB] IS NOT NULL) """); } @@ -1601,19 +1601,19 @@ public override async Task Null_semantics_applied_when_comparing_two_functions_w """ SELECT [e].[Id] FROM [Entities1] AS [e] -WHERE (CAST(CHARINDEX(N'oo', [e].[NullableStringA]) AS int) - 1) = (CAST(CHARINDEX(N'ar', [e].[NullableStringB]) AS int) - 1) OR (([e].[NullableStringA] IS NULL) AND ([e].[NullableStringB] IS NULL)) +WHERE CAST(CHARINDEX(N'oo', [e].[NullableStringA]) AS int) - 1 = CAST(CHARINDEX(N'ar', [e].[NullableStringB]) AS int) - 1 OR ([e].[NullableStringA] IS NULL AND [e].[NullableStringB] IS NULL) """, // """ SELECT [e].[Id] FROM [Entities1] AS [e] -WHERE ((CAST(CHARINDEX(N'oo', [e].[NullableStringA]) AS int) - 1) <> (CAST(CHARINDEX(N'ar', [e].[NullableStringB]) AS int) - 1) OR ([e].[NullableStringA] IS NULL) OR ([e].[NullableStringB] IS NULL)) AND (([e].[NullableStringA] IS NOT NULL) OR ([e].[NullableStringB] IS NOT NULL)) +WHERE (CAST(CHARINDEX(N'oo', [e].[NullableStringA]) AS int) - 1 <> CAST(CHARINDEX(N'ar', [e].[NullableStringB]) AS int) - 1 OR [e].[NullableStringA] IS NULL OR [e].[NullableStringB] IS NULL) AND ([e].[NullableStringA] IS NOT NULL OR [e].[NullableStringB] IS NOT NULL) """, // """ SELECT [e].[Id] FROM [Entities1] AS [e] -WHERE ((CAST(CHARINDEX(N'oo', [e].[NullableStringA]) AS int) - 1) <> (CAST(CHARINDEX(N'ar', [e].[NullableStringA]) AS int) - 1) OR ([e].[NullableStringA] IS NULL)) AND ([e].[NullableStringA] IS NOT NULL) +WHERE (CAST(CHARINDEX(N'oo', [e].[NullableStringA]) AS int) - 1 <> CAST(CHARINDEX(N'ar', [e].[NullableStringA]) AS int) - 1 OR [e].[NullableStringA] IS NULL) AND [e].[NullableStringA] IS NOT NULL """); } @@ -1625,13 +1625,13 @@ public override async Task Null_semantics_applied_when_comparing_two_functions_w """ 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) """); } @@ -1649,19 +1649,19 @@ 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) """); } @@ -1683,7 +1683,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] """, @@ -1694,13 +1694,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) @@ -1715,7 +1715,7 @@ public override async Task Null_semantics_function(bool async) """ 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) """); } @@ -1727,8 +1727,8 @@ public override async Task Null_semantics_join_with_composite_key(bool async) """ 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]) """); @@ -1748,19 +1748,19 @@ WHERE [e].[NullableIntA] IN (1, 2) """ SELECT [e].[Id] FROM [Entities1] AS [e] -WHERE [e].[NullableIntA] NOT IN (1, 2) OR ([e].[NullableIntA] IS NULL) +WHERE [e].[NullableIntA] NOT IN (1, 2) OR [e].[NullableIntA] IS NULL """, // """ SELECT [e].[Id] FROM [Entities1] AS [e] -WHERE [e].[NullableIntA] IN (1, 2) OR ([e].[NullableIntA] IS NULL) +WHERE [e].[NullableIntA] IN (1, 2) OR [e].[NullableIntA] IS NULL """, // """ SELECT [e].[Id] FROM [Entities1] AS [e] -WHERE [e].[NullableIntA] NOT IN (1, 2) AND ([e].[NullableIntA] IS NOT NULL) +WHERE [e].[NullableIntA] NOT IN (1, 2) AND [e].[NullableIntA] IS NOT NULL """, // """ @@ -1772,19 +1772,19 @@ WHERE [e].[NullableIntA] IN (1, 2) """ SELECT [e].[Id] FROM [Entities1] AS [e] -WHERE [e].[NullableIntA] NOT IN (1, 2) OR ([e].[NullableIntA] IS NULL) +WHERE [e].[NullableIntA] NOT IN (1, 2) OR [e].[NullableIntA] IS NULL """, // """ SELECT [e].[Id] FROM [Entities1] AS [e] -WHERE [e].[NullableIntA] IN (1, 2) OR ([e].[NullableIntA] IS NULL) +WHERE [e].[NullableIntA] IN (1, 2) OR [e].[NullableIntA] IS NULL """, // """ SELECT [e].[Id] FROM [Entities1] AS [e] -WHERE [e].[NullableIntA] NOT IN (1, 2) AND ([e].[NullableIntA] IS NOT NULL) +WHERE [e].[NullableIntA] NOT IN (1, 2) AND [e].[NullableIntA] IS NOT NULL """); } @@ -1900,31 +1900,31 @@ public override async Task Null_semantics_with_null_check_simple(bool async) """ 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] """); } @@ -1936,19 +1936,19 @@ public override async Task Null_semantics_with_null_check_complex(bool async) """ 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)) """); } @@ -1960,13 +1960,13 @@ public override async Task Null_semantics_with_null_check_complex2(bool async) """ 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 """); } @@ -1984,19 +1984,19 @@ WHERE [e].[NullableIntA] IS NOT NULL """ SELECT [e].[Id] FROM [Entities1] AS [e] -WHERE ([e].[NullableIntA] IS NULL) OR ([e].[NullableIntB] IS NULL) +WHERE [e].[NullableIntA] IS NULL OR [e].[NullableIntB] IS NULL """, // """ SELECT [e].[Id] FROM [Entities1] AS [e] -WHERE ([e].[NullableIntA] IS NULL) AND ([e].[NullableIntB] IS NULL) +WHERE [e].[NullableIntA] IS NULL AND [e].[NullableIntB] IS NULL """, // """ SELECT [e].[Id] FROM [Entities1] AS [e] -WHERE ([e].[NullableIntA] IS NOT NULL) OR ([e].[NullableIntB] IS NOT NULL) +WHERE [e].[NullableIntA] IS NOT NULL OR [e].[NullableIntB] IS NOT NULL """); } @@ -2066,7 +2066,7 @@ public override async Task Nullable_column_info_propagates_inside_binary_AndAlso """ 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] """); } @@ -2078,7 +2078,7 @@ public override async Task Nullable_column_info_doesnt_propagate_inside_binary_O """ 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) """); } @@ -2090,13 +2090,13 @@ public override async Task Nullable_column_info_propagates_inside_binary_OrElse_ """ 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] """); } @@ -2127,7 +2127,7 @@ SELECT CASE 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] @@ -2143,7 +2143,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) """); } @@ -2155,7 +2155,7 @@ public override async Task Nullable_column_info_propagation_complex(bool async) """ 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) """); } @@ -2190,7 +2190,7 @@ public override async Task Nullable_string_FirstOrDefault_compared_to_nullable_s """ 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) """); } @@ -2202,25 +2202,25 @@ public override async Task Null_semantics_applied_to_CompareTo_equality(bool asy """ 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) """); } @@ -2232,25 +2232,25 @@ public override async Task Nested_CompareTo_optimized(bool async) """ 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) """); } @@ -2274,7 +2274,7 @@ public override async Task Multiple_non_equality_comparisons_with_null_in_the_mi """ SELECT [e].[Id], [e].[BoolA], [e].[BoolB], [e].[BoolC], [e].[IntA], [e].[IntB], [e].[IntC], [e].[NullableBoolA], [e].[NullableBoolB], [e].[NullableBoolC], [e].[NullableIntA], [e].[NullableIntB], [e].[NullableIntC], [e].[NullableStringA], [e].[NullableStringB], [e].[NullableStringC], [e].[StringA], [e].[StringB], [e].[StringC] FROM [Entities1] AS [e] -WHERE [e].[NullableIntA] NOT IN (1, 2) AND ([e].[NullableIntA] IS NOT NULL) +WHERE [e].[NullableIntA] NOT IN (1, 2) AND [e].[NullableIntA] IS NOT NULL """); } @@ -2287,7 +2287,7 @@ public override async Task Multiple_non_equality_comparisons_including_null_comp """ 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 """); } @@ -2311,7 +2311,7 @@ public override async Task Multiple_equality_comparisons_including_null_comparis """ 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 """); } @@ -2347,7 +2347,7 @@ public override async Task Contains_with_comparison_dont_get_combined_for_relati """ SELECT [e].[Id], [e].[BoolA], [e].[BoolB], [e].[BoolC], [e].[IntA], [e].[IntB], [e].[IntC], [e].[NullableBoolA], [e].[NullableBoolB], [e].[NullableBoolC], [e].[NullableIntA], [e].[NullableIntB], [e].[NullableIntC], [e].[NullableStringA], [e].[NullableStringB], [e].[NullableStringC], [e].[StringA], [e].[StringB], [e].[StringC] FROM [Entities1] AS [e] -WHERE [e].[NullableIntA] IN (1, 2) OR ([e].[NullableIntA] IS NULL) +WHERE [e].[NullableIntA] IN (1, 2) OR [e].[NullableIntA] IS NULL """); } @@ -2359,7 +2359,7 @@ public override async Task Negated_contains_with_comparison_dont_get_combined_fo """ SELECT [e].[Id], [e].[BoolA], [e].[BoolB], [e].[BoolC], [e].[IntA], [e].[IntB], [e].[IntC], [e].[NullableBoolA], [e].[NullableBoolB], [e].[NullableBoolC], [e].[NullableIntA], [e].[NullableIntB], [e].[NullableIntC], [e].[NullableStringA], [e].[NullableStringB], [e].[NullableStringC], [e].[StringA], [e].[StringB], [e].[StringC] FROM [Entities1] AS [e] -WHERE ([e].[NullableIntA] IS NOT NULL) AND [e].[NullableIntA] NOT IN (1, 2) +WHERE [e].[NullableIntA] IS NOT NULL AND [e].[NullableIntA] NOT IN (1, 2) """); } @@ -2536,10 +2536,10 @@ FROM [Entities1] AS [e] """ SELECT [e].[Id], [e].[BoolA], [e].[BoolB], [e].[BoolC], [e].[IntA], [e].[IntB], [e].[IntC], [e].[NullableBoolA], [e].[NullableBoolB], [e].[NullableBoolC], [e].[NullableIntA], [e].[NullableIntB], [e].[NullableIntC], [e].[NullableStringA], [e].[NullableStringB], [e].[NullableStringC], [e].[StringA], [e].[StringB], [e].[StringC] FROM [Entities1] AS [e] -WHERE ([e].[BoolB] | CASE +WHERE [e].[BoolB] | CASE WHEN [e].[NullableBoolA] IS NOT NULL THEN CAST(1 AS bit) ELSE CAST(0 AS bit) -END) = CAST(1 AS bit) +END = CAST(1 AS bit) """); } @@ -2581,7 +2581,7 @@ public override async Task Is_null_on_column_followed_by_OrElse_optimizes_nullab """ SELECT [e].[Id], [e].[BoolA], [e].[BoolB], [e].[BoolC], [e].[IntA], [e].[IntB], [e].[IntC], [e].[NullableBoolA], [e].[NullableBoolB], [e].[NullableBoolC], [e].[NullableIntA], [e].[NullableIntB], [e].[NullableIntC], [e].[NullableStringA], [e].[NullableStringB], [e].[NullableStringC], [e].[StringA], [e].[StringB], [e].[StringC] FROM [Entities1] AS [e] -WHERE ([e].[NullableStringA] IS NOT NULL) AND [e].[NullableStringA] = N'Foo' +WHERE [e].[NullableStringA] IS NOT NULL AND [e].[NullableStringA] = N'Foo' """); } @@ -2593,7 +2593,7 @@ public override async Task Is_null_on_column_followed_by_OrElse_optimizes_nullab """ SELECT [e].[Id], [e].[BoolA], [e].[BoolB], [e].[BoolC], [e].[IntA], [e].[IntB], [e].[IntC], [e].[NullableBoolA], [e].[NullableBoolB], [e].[NullableBoolC], [e].[NullableIntA], [e].[NullableIntB], [e].[NullableIntC], [e].[NullableStringA], [e].[NullableStringB], [e].[NullableStringC], [e].[StringA], [e].[StringB], [e].[StringC] FROM [Entities1] AS [e] -WHERE ([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) """); } @@ -2605,7 +2605,7 @@ public override async Task Is_null_on_column_followed_by_OrElse_optimizes_nullab """ SELECT [e].[Id], [e].[BoolA], [e].[BoolB], [e].[BoolC], [e].[IntA], [e].[IntB], [e].[IntC], [e].[NullableBoolA], [e].[NullableBoolB], [e].[NullableBoolC], [e].[NullableIntA], [e].[NullableIntB], [e].[NullableIntC], [e].[NullableStringA], [e].[NullableStringB], [e].[NullableStringC], [e].[StringA], [e].[StringB], [e].[StringC] FROM [Entities1] AS [e] -WHERE ([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] """); } @@ -2617,7 +2617,7 @@ public override async Task Is_null_on_column_followed_by_OrElse_optimizes_nullab """ SELECT [e].[Id], [e].[BoolA], [e].[BoolB], [e].[BoolC], [e].[IntA], [e].[IntB], [e].[IntC], [e].[NullableBoolA], [e].[NullableBoolB], [e].[NullableBoolC], [e].[NullableIntA], [e].[NullableIntB], [e].[NullableIntC], [e].[NullableStringA], [e].[NullableStringB], [e].[NullableStringC], [e].[StringA], [e].[StringB], [e].[StringC] FROM [Entities1] AS [e] -WHERE (([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 """); } @@ -2632,11 +2632,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) @@ -2653,12 +2653,12 @@ public override async Task Is_null_on_column_followed_by_OrElse_optimizes_nullab SELECT [e].[Id], [e].[BoolA], [e].[BoolB], [e].[BoolC], [e].[IntA], [e].[IntB], [e].[IntC], [e].[NullableBoolA], [e].[NullableBoolB], [e].[NullableBoolC], [e].[NullableIntA], [e].[NullableIntB], [e].[NullableIntC], [e].[NullableStringA], [e].[NullableStringB], [e].[NullableStringC], [e].[StringA], [e].[StringB], [e].[StringC] FROM [Entities1] AS [e] WHERE CASE - WHEN ([e].[NullableStringA] IS NULL) OR ([e].[NullableStringB] IS NULL) THEN CASE - WHEN ([e].[NullableStringA] = [e].[NullableStringB] AND ([e].[NullableStringA] IS NOT NULL) AND ([e].[NullableStringB] IS NOT NULL)) OR (([e].[NullableStringA] IS NULL) AND ([e].[NullableStringB] IS NULL)) THEN CAST(1 AS bit) + WHEN [e].[NullableStringA] IS NULL OR [e].[NullableStringB] IS NULL THEN CASE + WHEN ([e].[NullableStringA] = [e].[NullableStringB] AND [e].[NullableStringA] IS NOT NULL AND [e].[NullableStringB] IS NOT NULL) OR ([e].[NullableStringA] IS NULL AND [e].[NullableStringB] IS NULL) THEN CAST(1 AS bit) ELSE CAST(0 AS bit) END ELSE CASE - WHEN ([e].[NullableStringA] <> [e].[NullableStringB] OR ([e].[NullableStringA] IS NULL) OR ([e].[NullableStringB] IS NULL)) AND (([e].[NullableStringA] IS NOT NULL) OR ([e].[NullableStringB] IS NOT NULL)) THEN CAST(1 AS bit) + WHEN ([e].[NullableStringA] <> [e].[NullableStringB] OR [e].[NullableStringA] IS NULL OR [e].[NullableStringB] IS NULL) AND ([e].[NullableStringA] IS NOT NULL OR [e].[NullableStringB] IS NOT NULL) THEN CAST(1 AS bit) ELSE CAST(0 AS bit) END END = CAST(1 AS bit) @@ -2674,12 +2674,12 @@ public override async Task Is_null_on_column_followed_by_OrElse_optimizes_nullab SELECT [e].[Id], [e].[BoolA], [e].[BoolB], [e].[BoolC], [e].[IntA], [e].[IntB], [e].[IntC], [e].[NullableBoolA], [e].[NullableBoolB], [e].[NullableBoolC], [e].[NullableIntA], [e].[NullableIntB], [e].[NullableIntC], [e].[NullableStringA], [e].[NullableStringB], [e].[NullableStringC], [e].[StringA], [e].[StringB], [e].[StringC] FROM [Entities1] AS [e] WHERE CASE - WHEN (([e].[NullableStringA] IS NULL) OR ([e].[NullableStringB] IS NULL)) AND ([e].[NullableBoolC] IS NULL) THEN CASE - WHEN ([e].[NullableStringA] = [e].[NullableStringB] AND ([e].[NullableStringA] IS NOT NULL) AND ([e].[NullableStringB] IS NOT NULL)) OR (([e].[NullableStringA] IS NULL) AND ([e].[NullableStringB] IS NULL)) THEN CAST(1 AS bit) + WHEN ([e].[NullableStringA] IS NULL OR [e].[NullableStringB] IS NULL) AND [e].[NullableBoolC] IS NULL THEN CASE + WHEN ([e].[NullableStringA] = [e].[NullableStringB] AND [e].[NullableStringA] IS NOT NULL AND [e].[NullableStringB] IS NOT NULL) OR ([e].[NullableStringA] IS NULL AND [e].[NullableStringB] IS NULL) THEN CAST(1 AS bit) ELSE CAST(0 AS bit) END ELSE CASE - WHEN ([e].[NullableStringA] <> [e].[NullableStringB] OR ([e].[NullableStringA] IS NULL) OR ([e].[NullableStringB] IS NULL)) AND (([e].[NullableStringA] IS NOT NULL) OR ([e].[NullableStringB] IS NOT NULL)) THEN CAST(1 AS bit) + WHEN ([e].[NullableStringA] <> [e].[NullableStringB] OR [e].[NullableStringA] IS NULL OR [e].[NullableStringB] IS NULL) AND ([e].[NullableStringA] IS NOT NULL OR [e].[NullableStringB] IS NOT NULL) THEN CAST(1 AS bit) ELSE CAST(0 AS bit) END END = CAST(1 AS bit) @@ -2695,13 +2695,13 @@ public override async Task Is_null_on_column_followed_by_OrElse_optimizes_nullab """ SELECT [e].[Id], [e].[BoolA], [e].[BoolB], [e].[BoolC], [e].[IntA], [e].[IntB], [e].[IntC], [e].[NullableBoolA], [e].[NullableBoolB], [e].[NullableBoolC], [e].[NullableIntA], [e].[NullableIntB], [e].[NullableIntC], [e].[NullableStringA], [e].[NullableStringB], [e].[NullableStringC], [e].[StringA], [e].[StringB], [e].[StringC] FROM [Entities1] AS [e] -WHERE ([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) @@ -2723,11 +2723,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) @@ -2741,7 +2741,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] @@ -2757,7 +2757,7 @@ public override async Task Nullability_is_computed_correctly_for_chained_coalesc """ 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 """); } @@ -2769,13 +2769,13 @@ public override async Task Nullability_check_is_computed_correctly_for_chained_c """ 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 """); } diff --git a/test/EFCore.SqlServer.FunctionalTests/Query/OwnedEntityQuerySqlServerTest.cs b/test/EFCore.SqlServer.FunctionalTests/Query/OwnedEntityQuerySqlServerTest.cs index d8209d74fd6..1d2db57a491 100644 --- a/test/EFCore.SqlServer.FunctionalTests/Query/OwnedEntityQuerySqlServerTest.cs +++ b/test/EFCore.SqlServer.FunctionalTests/Query/OwnedEntityQuerySqlServerTest.cs @@ -166,7 +166,7 @@ public override async Task Owned_entity_with_all_null_properties_entity_equality """ SELECT [r].[Id], [r].[Rot_ApartmentNo], [r].[Rot_ServiceType] FROM [RotRutCases] AS [r] -WHERE ([r].[Rot_ApartmentNo] IS NOT NULL) AND ([r].[Rot_ServiceType] IS NOT NULL) +WHERE [r].[Rot_ApartmentNo] IS NOT NULL AND [r].[Rot_ServiceType] IS NOT NULL """); } diff --git a/test/EFCore.SqlServer.FunctionalTests/Query/OwnedQuerySqlServerTest.cs b/test/EFCore.SqlServer.FunctionalTests/Query/OwnedQuerySqlServerTest.cs index cd3d6dd0af8..98c7187249c 100644 --- a/test/EFCore.SqlServer.FunctionalTests/Query/OwnedQuerySqlServerTest.cs +++ b/test/EFCore.SqlServer.FunctionalTests/Query/OwnedQuerySqlServerTest.cs @@ -272,7 +272,7 @@ LEFT JOIN ( FROM [Order] AS [o0] LEFT JOIN [OrderDetail] AS [o1] ON [o0].[ClientId] = [o1].[OrderClientId] AND [o0].[Id] = [o1].[OrderId] ) AS [t] ON [o].[Id] = [t].[ClientId] -WHERE [p].[Id] <> 42 OR ([p].[Id] IS NULL) +WHERE [p].[Id] <> 42 OR [p].[Id] IS NULL ORDER BY [o].[Id], [p].[Id], [t].[ClientId], [t].[Id], [t].[OrderClientId], [t].[OrderId] """); } @@ -307,7 +307,7 @@ FROM [Order] AS [o0] LEFT JOIN [OwnedPerson] AS [o1] ON [o0].[ClientId] = [o1].[Id] LEFT JOIN [Planet] AS [p0] ON [o1].[PersonAddress_Country_PlanetId] = [p0].[Id] LEFT JOIN [Star] AS [s] ON [p0].[StarId] = [s].[Id] - WHERE [o].[Id] = [o0].[ClientId] AND ([s].[Id] <> 42 OR ([s].[Id] IS NULL))) AS [Count], [p].[Id], [p].[Name], [p].[StarId] + WHERE [o].[Id] = [o0].[ClientId] AND ([s].[Id] <> 42 OR [s].[Id] IS NULL)) AS [Count], [p].[Id], [p].[Name], [p].[StarId] FROM [OwnedPerson] AS [o] LEFT JOIN [Planet] AS [p] ON [o].[PersonAddress_Country_PlanetId] = [p].[Id] ORDER BY [o].[Id] @@ -328,7 +328,7 @@ LEFT JOIN ( FROM [Order] AS [o0] LEFT JOIN [OrderDetail] AS [o1] ON [o0].[ClientId] = [o1].[OrderClientId] AND [o0].[Id] = [o1].[OrderId] ) AS [t] ON [o].[Id] = [t].[ClientId] -WHERE [p].[Id] <> 7 OR ([p].[Id] IS NULL) +WHERE [p].[Id] <> 7 OR [p].[Id] IS NULL ORDER BY [o].[Id], [p].[Id], [t].[ClientId], [t].[Id], [t].[OrderClientId], [t].[OrderId] """); } @@ -1321,7 +1321,7 @@ public override async Task Projecting_collection_correlated_with_keyless_entity_ SELECT [b].[Throned_Value], [f].[Id], [b].[Id], [p].[Id], [p].[Name], [p].[StarId] FROM [Fink] AS [f] LEFT JOIN [Barton] AS [b] ON [f].[BartonId] = [b].[Id] -LEFT JOIN [Planet] AS [p] ON [b].[Throned_Value] <> [p].[Id] OR ([b].[Throned_Value] IS NULL) +LEFT JOIN [Planet] AS [p] ON [b].[Throned_Value] <> [p].[Id] OR [b].[Throned_Value] IS NULL ORDER BY [f].[Id], [b].[Id] """); } diff --git a/test/EFCore.SqlServer.FunctionalTests/Query/QueryBugsTest.cs b/test/EFCore.SqlServer.FunctionalTests/Query/QueryBugsTest.cs index 0bfe0f25f83..f53338298cc 100644 --- a/test/EFCore.SqlServer.FunctionalTests/Query/QueryBugsTest.cs +++ b/test/EFCore.SqlServer.FunctionalTests/Query/QueryBugsTest.cs @@ -1822,7 +1822,7 @@ public virtual async Task Enum_has_flag_applies_explicit_cast_for_constant() """ SELECT [e].[Id], [e].[Permission], [e].[PermissionByte], [e].[PermissionShort] FROM [Entity] AS [e] -WHERE ([e].[Permission] & CAST(17179869184 AS bigint)) = CAST(17179869184 AS bigint) +WHERE [e].[Permission] & CAST(17179869184 AS bigint) = CAST(17179869184 AS bigint) """); } @@ -1857,7 +1857,7 @@ public virtual async Task Enum_has_flag_does_not_apply_explicit_cast_for_non_con """ SELECT [e].[Id], [e].[Permission], [e].[PermissionByte], [e].[PermissionShort] FROM [Entity] AS [e] -WHERE ([e].[Permission] & [e].[Permission]) = [e].[Permission] +WHERE [e].[Permission] & [e].[Permission] = [e].[Permission] """); } @@ -3093,7 +3093,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') """); } } @@ -4874,7 +4874,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) """); } @@ -5516,16 +5516,16 @@ OUTER APPLY ( SELECT [s].[ThingId], [t].[Id], [s].[Id] AS [Id0] FROM [Things] AS [t] LEFT JOIN [Subthings] AS [s] ON [t].[Id] = [s].[ThingId] - WHERE (( + WHERE ( SELECT TOP(1) [v].[Id] FROM [Values] AS [v] - WHERE [e].[Id] = [v].[Entity11023Id]) IS NOT NULL) AND (( + WHERE [e].[Id] = [v].[Entity11023Id]) IS NOT NULL AND (( SELECT TOP(1) [v0].[Id] FROM [Values] AS [v0] - WHERE [e].[Id] = [v0].[Entity11023Id]) = [t].[Value11023Id] OR ((( + WHERE [e].[Id] = [v0].[Entity11023Id]) = [t].[Value11023Id] OR (( SELECT TOP(1) [v0].[Id] FROM [Values] AS [v0] - WHERE [e].[Id] = [v0].[Entity11023Id]) IS NULL) AND ([t].[Value11023Id] IS NULL))) + WHERE [e].[Id] = [v0].[Entity11023Id]) IS NULL AND [t].[Value11023Id] IS NULL)) ) AS [t0] ORDER BY [e].[Id], [t0].[Id] """); @@ -5929,7 +5929,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] @@ -6438,7 +6438,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 """); } @@ -7530,7 +7530,7 @@ 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 """, // """ @@ -7538,7 +7538,7 @@ FROM [Entities] AS [e] 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 """); } } @@ -9659,12 +9659,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] """); @@ -9802,7 +9802,7 @@ SELECT TOP(2) ( SELECT COUNT(*) FROM [Cars] AS [c] INNER JOIN [Taxis] AS [t0] ON [c].[Id] = [t0].[CarId] - WHERE [u].[Id] = [c].[EUserId] AND ([t0].[ReportText] <> N'' OR ([t0].[ReportText] IS NULL))) AS [c], [u].[Id] + WHERE [u].[Id] = [c].[EUserId] AND ([t0].[ReportText] <> N'' OR [t0].[ReportText] IS NULL)) AS [c], [u].[Id] FROM [Users] AS [u] ) AS [t] OUTER APPLY ( diff --git a/test/EFCore.SqlServer.FunctionalTests/Query/SharedTypeQuerySqlServerTest.cs b/test/EFCore.SqlServer.FunctionalTests/Query/SharedTypeQuerySqlServerTest.cs index 7c89f886bab..11d1bf5ca75 100644 --- a/test/EFCore.SqlServer.FunctionalTests/Query/SharedTypeQuerySqlServerTest.cs +++ b/test/EFCore.SqlServer.FunctionalTests/Query/SharedTypeQuerySqlServerTest.cs @@ -19,7 +19,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)) """); } @@ -36,7 +36,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 630615fc0ce..9b24b8e6149 100644 --- a/test/EFCore.SqlServer.FunctionalTests/Query/SimpleQuerySqlServerTest.cs +++ b/test/EFCore.SqlServer.FunctionalTests/Query/SimpleQuerySqlServerTest.cs @@ -205,7 +205,7 @@ public override async Task GroupBy_aggregate_on_right_side_of_join(bool async) FROM [OrderItems] AS [o] INNER JOIN ( SELECT [o0].[OrderId] AS [Key], MAX(CASE - WHEN ([o0].[ShippingDate] IS NULL) AND ([o0].[CancellationDate] IS NULL) THEN [o0].[OrderId] + WHEN [o0].[ShippingDate] IS NULL AND [o0].[CancellationDate] IS NULL THEN [o0].[OrderId] ELSE [o0].[OrderId] - 10000000 END) AS [IsPending] FROM [OrderItems] AS [o0] @@ -254,17 +254,17 @@ public override async Task GroupBy_Aggregate_over_navigations_repeated(bool asyn SELECT MIN([o].[HourlyRate]) FROM [TimeSheets] AS [t0] LEFT JOIN [Order] AS [o] ON [t0].[OrderId] = [o].[Id] - WHERE ([t0].[OrderId] IS NOT NULL) AND [t].[OrderId] = [t0].[OrderId]) AS [HourlyRate], ( + WHERE [t0].[OrderId] IS NOT NULL AND [t].[OrderId] = [t0].[OrderId]) AS [HourlyRate], ( SELECT MIN([c].[Id]) FROM [TimeSheets] AS [t1] INNER JOIN [Project] AS [p] ON [t1].[ProjectId] = [p].[Id] INNER JOIN [Customers] AS [c] ON [p].[CustomerId] = [c].[Id] - WHERE ([t1].[OrderId] IS NOT NULL) AND [t].[OrderId] = [t1].[OrderId]) AS [CustomerId], ( + WHERE [t1].[OrderId] IS NOT NULL AND [t].[OrderId] = [t1].[OrderId]) AS [CustomerId], ( SELECT MIN([c0].[Name]) FROM [TimeSheets] AS [t2] INNER JOIN [Project] AS [p0] ON [t2].[ProjectId] = [p0].[Id] INNER JOIN [Customers] AS [c0] ON [p0].[CustomerId] = [c0].[Id] - WHERE ([t2].[OrderId] IS NOT NULL) AND [t].[OrderId] = [t2].[OrderId]) AS [CustomerName] + WHERE [t2].[OrderId] IS NOT NULL AND [t].[OrderId] = [t2].[OrderId]) AS [CustomerName] FROM [TimeSheets] AS [t] WHERE [t].[OrderId] IS NOT NULL GROUP BY [t].[OrderId] @@ -282,7 +282,7 @@ SELECT MIN([o0].[HourlyRate]) FROM [Order] AS [o0] WHERE [o0].[CustomerId] = [o].[CustomerId]) AS [CustomerMinHourlyRate], MIN([o].[HourlyRate]) AS [HourlyRate], COUNT(*) AS [Count] FROM [Order] AS [o] -WHERE [o].[Number] <> N'A1' OR ([o].[Number] IS NULL) +WHERE [o].[Number] <> N'A1' OR [o].[Number] IS NULL GROUP BY [o].[CustomerId], [o].[Number] """); } @@ -296,7 +296,7 @@ public override async Task Aggregate_over_subquery_in_group_by_projection_2(bool SELECT [t].[Value] AS [A], ( SELECT MAX([t0].[Id]) FROM [Table] AS [t0] - WHERE [t0].[Value] = (MAX([t].[Id]) * 6) OR (([t0].[Value] IS NULL) AND (MAX([t].[Id]) IS NULL))) AS [B] + WHERE [t0].[Value] = MAX([t].[Id]) * 6 OR ([t0].[Value] IS NULL AND MAX([t].[Id]) IS NULL)) AS [B] FROM [Table] AS [t] GROUP BY [t].[Value] """); @@ -405,17 +405,17 @@ public override async Task Subquery_first_member_compared_to_null(bool async) SELECT ( SELECT TOP(1) [c1].[SomeOtherNullableDateTime] FROM [Child26744] AS [c1] - WHERE [p].[Id] = [c1].[ParentId] AND ([c1].[SomeNullableDateTime] IS NULL) + WHERE [p].[Id] = [c1].[ParentId] AND [c1].[SomeNullableDateTime] IS NULL ORDER BY [c1].[SomeInteger]) FROM [Parents] AS [p] WHERE EXISTS ( SELECT 1 FROM [Child26744] AS [c] - WHERE [p].[Id] = [c].[ParentId] AND ([c].[SomeNullableDateTime] IS NULL)) AND (( + WHERE [p].[Id] = [c].[ParentId] AND [c].[SomeNullableDateTime] IS NULL) AND ( SELECT TOP(1) [c0].[SomeOtherNullableDateTime] FROM [Child26744] AS [c0] - WHERE [p].[Id] = [c0].[ParentId] AND ([c0].[SomeNullableDateTime] IS NULL) - ORDER BY [c0].[SomeInteger]) IS NOT NULL) + WHERE [p].[Id] = [c0].[ParentId] AND [c0].[SomeNullableDateTime] IS NULL + ORDER BY [c0].[SomeInteger]) IS NOT NULL """); } @@ -492,7 +492,7 @@ public override async Task Hierarchy_query_with_abstract_type_sibling(bool async """ SELECT [a].[Id], [a].[Discriminator], [a].[Species], [a].[Name], [a].[EdcuationLevel], [a].[FavoriteToy] FROM [Animals] AS [a] -WHERE [a].[Discriminator] IN (N'Cat', N'Dog') AND ([a].[Species] IS NOT NULL) AND ([a].[Species] LIKE N'F%') +WHERE [a].[Discriminator] IN (N'Cat', N'Dog') AND [a].[Species] IS NOT NULL AND [a].[Species] LIKE N'F%' """); } @@ -510,7 +510,7 @@ FROM [Animals] AS [a] LEFT JOIN [Pets] AS [p] ON [a].[Id] = [p].[Id] LEFT JOIN [Cats] AS [c] ON [a].[Id] = [c].[Id] LEFT JOIN [Dogs] AS [d] ON [a].[Id] = [d].[Id] -WHERE (([d].[Id] IS NOT NULL) OR ([c].[Id] IS NOT NULL)) AND ([a].[Species] IS NOT NULL) AND ([a].[Species] LIKE N'F%') +WHERE ([d].[Id] IS NOT NULL OR [c].[Id] IS NOT NULL) AND [a].[Species] IS NOT NULL AND [a].[Species] LIKE N'F%' """); } @@ -528,7 +528,7 @@ UNION ALL SELECT [d].[Id], [d].[Species], [d].[Name], NULL AS [EdcuationLevel], [d].[FavoriteToy], N'Dog' AS [Discriminator] FROM [Dogs] AS [d] ) AS [t] -WHERE ([t].[Species] IS NOT NULL) AND ([t].[Species] LIKE N'F%') +WHERE [t].[Species] IS NOT NULL AND [t].[Species] LIKE N'F%' """); } diff --git a/test/EFCore.SqlServer.FunctionalTests/Query/SpatialQuerySqlServerGeographyTest.cs b/test/EFCore.SqlServer.FunctionalTests/Query/SpatialQuerySqlServerGeographyTest.cs index 9675a979a83..c86dafd8e2d 100644 --- a/test/EFCore.SqlServer.FunctionalTests/Query/SpatialQuerySqlServerGeographyTest.cs +++ b/test/EFCore.SqlServer.FunctionalTests/Query/SpatialQuerySqlServerGeographyTest.cs @@ -457,7 +457,7 @@ public override async Task GetInteriorRingN(bool async) AssertSql( """ SELECT [p].[Id], CASE - WHEN ([p].[Polygon].NumRings() - 1) = 0 THEN NULL + WHEN [p].[Polygon].NumRings() - 1 = 0 THEN NULL ELSE [p].[Polygon].RingN(0 + 2) END AS [InteriorRing0] FROM [PolygonEntity] AS [p] diff --git a/test/EFCore.SqlServer.FunctionalTests/Query/TPCGearsOfWarQuerySqlServerTest.cs b/test/EFCore.SqlServer.FunctionalTests/Query/TPCGearsOfWarQuerySqlServerTest.cs index 648539cedde..ea6674b54e9 100644 --- a/test/EFCore.SqlServer.FunctionalTests/Query/TPCGearsOfWarQuerySqlServerTest.cs +++ b/test/EFCore.SqlServer.FunctionalTests/Query/TPCGearsOfWarQuerySqlServerTest.cs @@ -47,18 +47,6 @@ FROM [Squads] AS [s] """); } - public override async Task Double_negate_on_column(bool async) - { - await base.Double_negate_on_column(async); - - AssertSql( -""" -SELECT [s].[Id], [s].[Banner], [s].[Banner5], [s].[InternalNumber], [s].[Name] -FROM [Squads] AS [s] -WHERE -(-[s].[Id]) = [s].[Id] -"""); - } - public override async Task Negate_on_like_expression(bool async) { await base.Negate_on_like_expression(async); @@ -67,7 +55,7 @@ public override async Task Negate_on_like_expression(bool async) """ SELECT [s].[Id], [s].[Banner], [s].[Banner5], [s].[InternalNumber], [s].[Name] FROM [Squads] AS [s] -WHERE ([s].[Name] IS NOT NULL) AND NOT ([s].[Name] LIKE N'us%') +WHERE [s].[Name] IS NOT NULL AND NOT ([s].[Name] LIKE N'us%') """); } @@ -362,7 +350,7 @@ UNION ALL FROM [Officers] AS [o] ) AS [t] LEFT JOIN [Tags] AS [t0] ON [t].[Nickname] = [t0].[GearNickName] AND [t].[SquadId] = [t0].[GearSquadId] -WHERE ([t0].[Id] IS NOT NULL) AND [t0].[Id] IN ('34c8d86e-a4ac-4be5-827f-584dda348a07', 'df36f493-463f-4123-83f9-6b135deeb7ba', 'a8ad98f9-e023-4e2a-9a70-c2728455bd34', '70534e05-782c-4052-8720-c2c54481ce5f', 'a7be028a-0cf2-448f-ab55-ce8bc5d8cf69', 'b39a6fba-9026-4d69-828e-fd7068673e57') +WHERE [t0].[Id] IS NOT NULL AND [t0].[Id] IN ('34c8d86e-a4ac-4be5-827f-584dda348a07', 'df36f493-463f-4123-83f9-6b135deeb7ba', 'a8ad98f9-e023-4e2a-9a70-c2728455bd34', '70534e05-782c-4052-8720-c2c54481ce5f', 'a7be028a-0cf2-448f-ab55-ce8bc5d8cf69', 'b39a6fba-9026-4d69-828e-fd7068673e57') """); } @@ -387,7 +375,7 @@ FROM [Officers] AS [o] ) AS [t] INNER JOIN [Cities] AS [c] ON [t].[CityOfBirthName] = [c].[Name] LEFT JOIN [Tags] AS [t0] ON [t].[Nickname] = [t0].[GearNickName] AND [t].[SquadId] = [t0].[GearSquadId] -WHERE ([c].[Location] IS NOT NULL) AND [t0].[Id] IN ('34c8d86e-a4ac-4be5-827f-584dda348a07', 'df36f493-463f-4123-83f9-6b135deeb7ba', 'a8ad98f9-e023-4e2a-9a70-c2728455bd34', '70534e05-782c-4052-8720-c2c54481ce5f', 'a7be028a-0cf2-448f-ab55-ce8bc5d8cf69', 'b39a6fba-9026-4d69-828e-fd7068673e57') +WHERE [c].[Location] IS NOT NULL AND [t0].[Id] IN ('34c8d86e-a4ac-4be5-827f-584dda348a07', 'df36f493-463f-4123-83f9-6b135deeb7ba', 'a8ad98f9-e023-4e2a-9a70-c2728455bd34', '70534e05-782c-4052-8720-c2c54481ce5f', 'a7be028a-0cf2-448f-ab55-ce8bc5d8cf69', 'b39a6fba-9026-4d69-828e-fd7068673e57') """); } @@ -411,7 +399,7 @@ UNION ALL FROM [Officers] AS [o] ) AS [t] LEFT JOIN [Tags] AS [t0] ON [t].[Nickname] = [t0].[GearNickName] AND [t].[SquadId] = [t0].[GearSquadId] -WHERE ([t0].[Id] IS NOT NULL) AND [t0].[Id] IN ('34c8d86e-a4ac-4be5-827f-584dda348a07', 'df36f493-463f-4123-83f9-6b135deeb7ba', 'a8ad98f9-e023-4e2a-9a70-c2728455bd34', '70534e05-782c-4052-8720-c2c54481ce5f', 'a7be028a-0cf2-448f-ab55-ce8bc5d8cf69', 'b39a6fba-9026-4d69-828e-fd7068673e57') +WHERE [t0].[Id] IS NOT NULL AND [t0].[Id] IN ('34c8d86e-a4ac-4be5-827f-584dda348a07', 'df36f493-463f-4123-83f9-6b135deeb7ba', 'a8ad98f9-e023-4e2a-9a70-c2728455bd34', '70534e05-782c-4052-8720-c2c54481ce5f', 'a7be028a-0cf2-448f-ab55-ce8bc5d8cf69', 'b39a6fba-9026-4d69-828e-fd7068673e57') """); } @@ -537,7 +525,7 @@ UNION ALL FROM [Officers] AS [o] ) AS [t] ON [w].[OwnerFullName] = [t].[FullName] LEFT JOIN [Cities] AS [c] ON [t].[CityOfBirthName] = [c].[Name] -WHERE [t].[Nickname] <> N'Paduk' OR ([t].[Nickname] IS NULL) +WHERE [t].[Nickname] <> N'Paduk' OR [t].[Nickname] IS NULL ORDER BY [c].[Name], [w].[Id] """); } @@ -632,7 +620,7 @@ UNION ALL SELECT [o].[Nickname], [o].[SquadId], [o].[AssignedCityName], [o].[CityOfBirthName], [o].[FullName], [o].[HasSoulPatch], [o].[LeaderNickname], [o].[LeaderSquadId], [o].[Rank], N'Officer' AS [Discriminator] FROM [Officers] AS [o] ) AS [t] -WHERE ([t].[Rank] & 2) > 0 +WHERE [t].[Rank] & 2 > 0 """, // """ @@ -644,7 +632,7 @@ UNION ALL SELECT [o].[Nickname], [o].[SquadId], [o].[AssignedCityName], [o].[CityOfBirthName], [o].[FullName], [o].[HasSoulPatch], [o].[LeaderNickname], [o].[LeaderSquadId], [o].[Rank], N'Officer' AS [Discriminator] FROM [Officers] AS [o] ) AS [t] -WHERE ([t].[Rank] & 2) = 2 +WHERE [t].[Rank] & 2 = 2 """); } @@ -662,7 +650,7 @@ UNION ALL SELECT [o].[Nickname], [o].[SquadId], [o].[AssignedCityName], [o].[CityOfBirthName], [o].[FullName], [o].[HasSoulPatch], [o].[LeaderNickname], [o].[LeaderSquadId], [o].[Rank], N'Officer' AS [Discriminator] FROM [Officers] AS [o] ) AS [t] -WHERE ([t].[Rank] & 1) = 1 +WHERE [t].[Rank] & 1 = 1 """, // """ @@ -674,7 +662,7 @@ UNION ALL SELECT [o].[Nickname], [o].[SquadId], [o].[AssignedCityName], [o].[CityOfBirthName], [o].[FullName], [o].[HasSoulPatch], [o].[LeaderNickname], [o].[LeaderSquadId], [o].[Rank], N'Officer' AS [Discriminator] FROM [Officers] AS [o] ) AS [t] -WHERE (CAST([t].[Rank] AS bigint) & CAST(1 AS bigint)) = CAST(1 AS bigint) +WHERE CAST([t].[Rank] AS bigint) & CAST(1 AS bigint) = CAST(1 AS bigint) """, // """ @@ -686,7 +674,7 @@ UNION ALL SELECT [o].[Nickname], [o].[SquadId], [o].[AssignedCityName], [o].[CityOfBirthName], [o].[FullName], [o].[HasSoulPatch], [o].[LeaderNickname], [o].[LeaderSquadId], [o].[Rank], N'Officer' AS [Discriminator] FROM [Officers] AS [o] ) AS [t] -WHERE (CAST([t].[Rank] AS smallint) & CAST(1 AS smallint)) = CAST(1 AS smallint) +WHERE CAST([t].[Rank] AS smallint) & CAST(1 AS smallint) = CAST(1 AS smallint) """); } @@ -698,7 +686,7 @@ public override async Task Where_bitwise_and_nullable_enum_with_constant(bool as """ SELECT [w].[Id], [w].[AmmunitionType], [w].[IsAutomatic], [w].[Name], [w].[OwnerFullName], [w].[SynergyWithId] FROM [Weapons] AS [w] -WHERE ([w].[AmmunitionType] & 1) > 0 +WHERE [w].[AmmunitionType] & 1 > 0 """); } @@ -710,7 +698,7 @@ public override async Task Where_bitwise_and_nullable_enum_with_null_constant(bo """ SELECT [w].[Id], [w].[AmmunitionType], [w].[IsAutomatic], [w].[Name], [w].[OwnerFullName], [w].[SynergyWithId] FROM [Weapons] AS [w] -WHERE ([w].[AmmunitionType] & NULL) > 0 +WHERE [w].[AmmunitionType] & NULL > 0 """); } @@ -724,7 +712,7 @@ public override async Task Where_bitwise_and_nullable_enum_with_non_nullable_par SELECT [w].[Id], [w].[AmmunitionType], [w].[IsAutomatic], [w].[Name], [w].[OwnerFullName], [w].[SynergyWithId] FROM [Weapons] AS [w] -WHERE ([w].[AmmunitionType] & @__ammunitionType_0) > 0 +WHERE [w].[AmmunitionType] & @__ammunitionType_0 > 0 """); } @@ -738,13 +726,13 @@ public override async Task Where_bitwise_and_nullable_enum_with_nullable_paramet SELECT [w].[Id], [w].[AmmunitionType], [w].[IsAutomatic], [w].[Name], [w].[OwnerFullName], [w].[SynergyWithId] FROM [Weapons] AS [w] -WHERE ([w].[AmmunitionType] & @__ammunitionType_0) > 0 +WHERE [w].[AmmunitionType] & @__ammunitionType_0 > 0 """, // """ SELECT [w].[Id], [w].[AmmunitionType], [w].[IsAutomatic], [w].[Name], [w].[OwnerFullName], [w].[SynergyWithId] FROM [Weapons] AS [w] -WHERE ([w].[AmmunitionType] & NULL) > 0 +WHERE [w].[AmmunitionType] & NULL > 0 """); } @@ -762,7 +750,7 @@ UNION ALL SELECT [o].[Nickname], [o].[SquadId], [o].[AssignedCityName], [o].[CityOfBirthName], [o].[FullName], [o].[HasSoulPatch], [o].[LeaderNickname], [o].[LeaderSquadId], [o].[Rank], N'Officer' AS [Discriminator] FROM [Officers] AS [o] ) AS [t] -WHERE ([t].[Rank] | 2) > 0 +WHERE [t].[Rank] | 2 > 0 """); } @@ -773,10 +761,10 @@ public override async Task Bitwise_projects_values_in_select(bool async) AssertSql( """ SELECT TOP(1) CASE - WHEN ([t].[Rank] & 2) = 2 THEN CAST(1 AS bit) + WHEN [t].[Rank] & 2 = 2 THEN CAST(1 AS bit) ELSE CAST(0 AS bit) END AS [BitwiseTrue], CASE - WHEN ([t].[Rank] & 2) = 4 THEN CAST(1 AS bit) + WHEN [t].[Rank] & 2 = 4 THEN CAST(1 AS bit) ELSE CAST(0 AS bit) END AS [BitwiseFalse], [t].[Rank] & 2 AS [BitwiseValue] FROM ( @@ -786,7 +774,7 @@ UNION ALL SELECT [o].[Rank] FROM [Officers] AS [o] ) AS [t] -WHERE ([t].[Rank] & 2) = 2 +WHERE [t].[Rank] & 2 = 2 """); } @@ -804,7 +792,7 @@ UNION ALL SELECT [o].[Nickname], [o].[SquadId], [o].[AssignedCityName], [o].[CityOfBirthName], [o].[FullName], [o].[HasSoulPatch], [o].[LeaderNickname], [o].[LeaderSquadId], [o].[Rank], N'Officer' AS [Discriminator] FROM [Officers] AS [o] ) AS [t] -WHERE ([t].[Rank] & 2) = 2 +WHERE [t].[Rank] & 2 = 2 """, // """ @@ -816,7 +804,7 @@ UNION ALL SELECT [o].[Nickname], [o].[SquadId], [o].[AssignedCityName], [o].[CityOfBirthName], [o].[FullName], [o].[HasSoulPatch], [o].[LeaderNickname], [o].[LeaderSquadId], [o].[Rank], N'Officer' AS [Discriminator] FROM [Officers] AS [o] ) AS [t] -WHERE ([t].[Rank] & 18) = 18 +WHERE [t].[Rank] & 18 = 18 """, // """ @@ -828,7 +816,7 @@ UNION ALL SELECT [o].[Nickname], [o].[SquadId], [o].[AssignedCityName], [o].[CityOfBirthName], [o].[FullName], [o].[HasSoulPatch], [o].[LeaderNickname], [o].[LeaderSquadId], [o].[Rank], N'Officer' AS [Discriminator] FROM [Officers] AS [o] ) AS [t] -WHERE ([t].[Rank] & 1) = 1 +WHERE [t].[Rank] & 1 = 1 """, // """ @@ -840,7 +828,7 @@ UNION ALL SELECT [o].[Nickname], [o].[SquadId], [o].[AssignedCityName], [o].[CityOfBirthName], [o].[FullName], [o].[HasSoulPatch], [o].[LeaderNickname], [o].[LeaderSquadId], [o].[Rank], N'Officer' AS [Discriminator] FROM [Officers] AS [o] ) AS [t] -WHERE ([t].[Rank] & 1) = 1 +WHERE [t].[Rank] & 1 = 1 """, // """ @@ -852,7 +840,7 @@ UNION ALL SELECT [o].[Nickname], [o].[SquadId], [o].[AssignedCityName], [o].[CityOfBirthName], [o].[FullName], [o].[HasSoulPatch], [o].[LeaderNickname], [o].[LeaderSquadId], [o].[Rank], N'Officer' AS [Discriminator] FROM [Officers] AS [o] ) AS [t] -WHERE (2 & [t].[Rank]) = [t].[Rank] +WHERE 2 & [t].[Rank] = [t].[Rank] """); } @@ -870,7 +858,7 @@ UNION ALL SELECT [o].[Nickname], [o].[SquadId], [o].[AssignedCityName], [o].[CityOfBirthName], [o].[FullName], [o].[HasSoulPatch], [o].[LeaderNickname], [o].[LeaderSquadId], [o].[Rank], N'Officer' AS [Discriminator] FROM [Officers] AS [o] ) AS [t] -WHERE ([t].[Rank] & COALESCE(( +WHERE [t].[Rank] & COALESCE(( SELECT TOP(1) [t0].[Rank] FROM ( SELECT [g0].[Nickname], [g0].[SquadId], [g0].[AssignedCityName], [g0].[CityOfBirthName], [g0].[FullName], [g0].[HasSoulPatch], [g0].[LeaderNickname], [g0].[LeaderSquadId], [g0].[Rank], N'Gear' AS [Discriminator] @@ -879,7 +867,7 @@ UNION ALL SELECT [o0].[Nickname], [o0].[SquadId], [o0].[AssignedCityName], [o0].[CityOfBirthName], [o0].[FullName], [o0].[HasSoulPatch], [o0].[LeaderNickname], [o0].[LeaderSquadId], [o0].[Rank], N'Officer' AS [Discriminator] FROM [Officers] AS [o0] ) AS [t0] - ORDER BY [t0].[Nickname], [t0].[SquadId]), 0)) = COALESCE(( + ORDER BY [t0].[Nickname], [t0].[SquadId]), 0) = COALESCE(( SELECT TOP(1) [t0].[Rank] FROM ( SELECT [g0].[Nickname], [g0].[SquadId], [g0].[AssignedCityName], [g0].[CityOfBirthName], [g0].[FullName], [g0].[HasSoulPatch], [g0].[LeaderNickname], [g0].[LeaderSquadId], [g0].[Rank], N'Gear' AS [Discriminator] @@ -900,7 +888,7 @@ UNION ALL SELECT [o].[Nickname], [o].[SquadId], [o].[AssignedCityName], [o].[CityOfBirthName], [o].[FullName], [o].[HasSoulPatch], [o].[LeaderNickname], [o].[LeaderSquadId], [o].[Rank], N'Officer' AS [Discriminator] FROM [Officers] AS [o] ) AS [t] -WHERE (2 & COALESCE(( +WHERE 2 & COALESCE(( SELECT TOP(1) [t0].[Rank] FROM ( SELECT [g0].[Nickname], [g0].[SquadId], [g0].[AssignedCityName], [g0].[CityOfBirthName], [g0].[FullName], [g0].[HasSoulPatch], [g0].[LeaderNickname], [g0].[LeaderSquadId], [g0].[Rank], N'Gear' AS [Discriminator] @@ -909,7 +897,7 @@ UNION ALL SELECT [o0].[Nickname], [o0].[SquadId], [o0].[AssignedCityName], [o0].[CityOfBirthName], [o0].[FullName], [o0].[HasSoulPatch], [o0].[LeaderNickname], [o0].[LeaderSquadId], [o0].[Rank], N'Officer' AS [Discriminator] FROM [Officers] AS [o0] ) AS [t0] - ORDER BY [t0].[Nickname], [t0].[SquadId]), 0)) = COALESCE(( + ORDER BY [t0].[Nickname], [t0].[SquadId]), 0) = COALESCE(( SELECT TOP(1) [t0].[Rank] FROM ( SELECT [g0].[Nickname], [g0].[SquadId], [g0].[AssignedCityName], [g0].[CityOfBirthName], [g0].[FullName], [g0].[HasSoulPatch], [g0].[LeaderNickname], [g0].[LeaderSquadId], [g0].[Rank], N'Gear' AS [Discriminator] @@ -936,7 +924,7 @@ UNION ALL SELECT [o].[Nickname], [o].[SquadId], [o].[AssignedCityName], [o].[CityOfBirthName], [o].[FullName], [o].[HasSoulPatch], [o].[LeaderNickname], [o].[LeaderSquadId], [o].[Rank], N'Officer' AS [Discriminator] FROM [Officers] AS [o] ) AS [t] -WHERE ([t].[Rank] & ( +WHERE [t].[Rank] & ( SELECT TOP(1) [t0].[Rank] FROM ( SELECT [g0].[Nickname], [g0].[SquadId], [g0].[AssignedCityName], [g0].[CityOfBirthName], [g0].[FullName], [g0].[HasSoulPatch], [g0].[LeaderNickname], [g0].[LeaderSquadId], [g0].[Rank], N'Gear' AS [Discriminator] @@ -945,7 +933,7 @@ UNION ALL SELECT [o0].[Nickname], [o0].[SquadId], [o0].[AssignedCityName], [o0].[CityOfBirthName], [o0].[FullName], [o0].[HasSoulPatch], [o0].[LeaderNickname], [o0].[LeaderSquadId], [o0].[Rank], N'Officer' AS [Discriminator] FROM [Officers] AS [o0] ) AS [t0] - ORDER BY [t0].[Nickname], [t0].[SquadId])) = ( + ORDER BY [t0].[Nickname], [t0].[SquadId]) = ( SELECT TOP(1) [t0].[Rank] FROM ( SELECT [g0].[Nickname], [g0].[SquadId], [g0].[AssignedCityName], [g0].[CityOfBirthName], [g0].[FullName], [g0].[HasSoulPatch], [g0].[LeaderNickname], [g0].[LeaderSquadId], [g0].[Rank], N'Gear' AS [Discriminator] @@ -954,7 +942,7 @@ UNION ALL SELECT [o0].[Nickname], [o0].[SquadId], [o0].[AssignedCityName], [o0].[CityOfBirthName], [o0].[FullName], [o0].[HasSoulPatch], [o0].[LeaderNickname], [o0].[LeaderSquadId], [o0].[Rank], N'Officer' AS [Discriminator] FROM [Officers] AS [o0] ) AS [t0] - ORDER BY [t0].[Nickname], [t0].[SquadId]) OR (( + ORDER BY [t0].[Nickname], [t0].[SquadId]) OR ( SELECT TOP(1) [t0].[Rank] FROM ( SELECT [g0].[Nickname], [g0].[SquadId], [g0].[AssignedCityName], [g0].[CityOfBirthName], [g0].[FullName], [g0].[HasSoulPatch], [g0].[LeaderNickname], [g0].[LeaderSquadId], [g0].[Rank], N'Gear' AS [Discriminator] @@ -963,7 +951,7 @@ UNION ALL SELECT [o0].[Nickname], [o0].[SquadId], [o0].[AssignedCityName], [o0].[CityOfBirthName], [o0].[FullName], [o0].[HasSoulPatch], [o0].[LeaderNickname], [o0].[LeaderSquadId], [o0].[Rank], N'Officer' AS [Discriminator] FROM [Officers] AS [o0] ) AS [t0] - ORDER BY [t0].[Nickname], [t0].[SquadId]) IS NULL) + ORDER BY [t0].[Nickname], [t0].[SquadId]) IS NULL """, // """ @@ -975,7 +963,7 @@ UNION ALL SELECT [o].[Nickname], [o].[SquadId], [o].[AssignedCityName], [o].[CityOfBirthName], [o].[FullName], [o].[HasSoulPatch], [o].[LeaderNickname], [o].[LeaderSquadId], [o].[Rank], N'Officer' AS [Discriminator] FROM [Officers] AS [o] ) AS [t] -WHERE (2 & ( +WHERE 2 & ( SELECT TOP(1) [t0].[Rank] FROM ( SELECT [g0].[Nickname], [g0].[SquadId], [g0].[AssignedCityName], [g0].[CityOfBirthName], [g0].[FullName], [g0].[HasSoulPatch], [g0].[LeaderNickname], [g0].[LeaderSquadId], [g0].[Rank], N'Gear' AS [Discriminator] @@ -984,7 +972,7 @@ UNION ALL SELECT [o0].[Nickname], [o0].[SquadId], [o0].[AssignedCityName], [o0].[CityOfBirthName], [o0].[FullName], [o0].[HasSoulPatch], [o0].[LeaderNickname], [o0].[LeaderSquadId], [o0].[Rank], N'Officer' AS [Discriminator] FROM [Officers] AS [o0] ) AS [t0] - ORDER BY [t0].[Nickname], [t0].[SquadId])) = ( + ORDER BY [t0].[Nickname], [t0].[SquadId]) = ( SELECT TOP(1) [t0].[Rank] FROM ( SELECT [g0].[Nickname], [g0].[SquadId], [g0].[AssignedCityName], [g0].[CityOfBirthName], [g0].[FullName], [g0].[HasSoulPatch], [g0].[LeaderNickname], [g0].[LeaderSquadId], [g0].[Rank], N'Gear' AS [Discriminator] @@ -993,7 +981,7 @@ UNION ALL SELECT [o0].[Nickname], [o0].[SquadId], [o0].[AssignedCityName], [o0].[CityOfBirthName], [o0].[FullName], [o0].[HasSoulPatch], [o0].[LeaderNickname], [o0].[LeaderSquadId], [o0].[Rank], N'Officer' AS [Discriminator] FROM [Officers] AS [o0] ) AS [t0] - ORDER BY [t0].[Nickname], [t0].[SquadId]) OR (( + ORDER BY [t0].[Nickname], [t0].[SquadId]) OR ( SELECT TOP(1) [t0].[Rank] FROM ( SELECT [g0].[Nickname], [g0].[SquadId], [g0].[AssignedCityName], [g0].[CityOfBirthName], [g0].[FullName], [g0].[HasSoulPatch], [g0].[LeaderNickname], [g0].[LeaderSquadId], [g0].[Rank], N'Gear' AS [Discriminator] @@ -1002,7 +990,7 @@ UNION ALL SELECT [o0].[Nickname], [o0].[SquadId], [o0].[AssignedCityName], [o0].[CityOfBirthName], [o0].[FullName], [o0].[HasSoulPatch], [o0].[LeaderNickname], [o0].[LeaderSquadId], [o0].[Rank], N'Officer' AS [Discriminator] FROM [Officers] AS [o0] ) AS [t0] - ORDER BY [t0].[Nickname], [t0].[SquadId]) IS NULL) + ORDER BY [t0].[Nickname], [t0].[SquadId]) IS NULL """); } @@ -1020,7 +1008,7 @@ UNION ALL SELECT [o].[Nickname], [o].[SquadId], [o].[AssignedCityName], [o].[CityOfBirthName], [o].[FullName], [o].[HasSoulPatch], [o].[LeaderNickname], [o].[LeaderSquadId], [o].[Rank], N'Officer' AS [Discriminator] FROM [Officers] AS [o] ) AS [t] -WHERE ([t].[Rank] & ( +WHERE [t].[Rank] & ( SELECT TOP(1) [t0].[Rank] FROM ( SELECT [g0].[Nickname], [g0].[SquadId], [g0].[AssignedCityName], [g0].[CityOfBirthName], [g0].[FullName], [g0].[HasSoulPatch], [g0].[LeaderNickname], [g0].[LeaderSquadId], [g0].[Rank], N'Gear' AS [Discriminator] @@ -1029,7 +1017,7 @@ UNION ALL SELECT [o0].[Nickname], [o0].[SquadId], [o0].[AssignedCityName], [o0].[CityOfBirthName], [o0].[FullName], [o0].[HasSoulPatch], [o0].[LeaderNickname], [o0].[LeaderSquadId], [o0].[Rank], N'Officer' AS [Discriminator] FROM [Officers] AS [o0] ) AS [t0] - ORDER BY [t0].[Nickname], [t0].[SquadId])) = ( + ORDER BY [t0].[Nickname], [t0].[SquadId]) = ( SELECT TOP(1) [t0].[Rank] FROM ( SELECT [g0].[Nickname], [g0].[SquadId], [g0].[AssignedCityName], [g0].[CityOfBirthName], [g0].[FullName], [g0].[HasSoulPatch], [g0].[LeaderNickname], [g0].[LeaderSquadId], [g0].[Rank], N'Gear' AS [Discriminator] @@ -1038,7 +1026,7 @@ UNION ALL SELECT [o0].[Nickname], [o0].[SquadId], [o0].[AssignedCityName], [o0].[CityOfBirthName], [o0].[FullName], [o0].[HasSoulPatch], [o0].[LeaderNickname], [o0].[LeaderSquadId], [o0].[Rank], N'Officer' AS [Discriminator] FROM [Officers] AS [o0] ) AS [t0] - ORDER BY [t0].[Nickname], [t0].[SquadId]) OR (( + ORDER BY [t0].[Nickname], [t0].[SquadId]) OR ( SELECT TOP(1) [t0].[Rank] FROM ( SELECT [g0].[Nickname], [g0].[SquadId], [g0].[AssignedCityName], [g0].[CityOfBirthName], [g0].[FullName], [g0].[HasSoulPatch], [g0].[LeaderNickname], [g0].[LeaderSquadId], [g0].[Rank], N'Gear' AS [Discriminator] @@ -1047,7 +1035,7 @@ UNION ALL SELECT [o0].[Nickname], [o0].[SquadId], [o0].[AssignedCityName], [o0].[CityOfBirthName], [o0].[FullName], [o0].[HasSoulPatch], [o0].[LeaderNickname], [o0].[LeaderSquadId], [o0].[Rank], N'Officer' AS [Discriminator] FROM [Officers] AS [o0] ) AS [t0] - ORDER BY [t0].[Nickname], [t0].[SquadId]) IS NULL) + ORDER BY [t0].[Nickname], [t0].[SquadId]) IS NULL """); } @@ -1067,7 +1055,7 @@ UNION ALL SELECT [o].[Nickname], [o].[SquadId], [o].[AssignedCityName], [o].[CityOfBirthName], [o].[FullName], [o].[HasSoulPatch], [o].[LeaderNickname], [o].[LeaderSquadId], [o].[Rank], N'Officer' AS [Discriminator] FROM [Officers] AS [o] ) AS [t] -WHERE ([t].[Rank] & @__parameter_0) = @__parameter_0 +WHERE [t].[Rank] & @__parameter_0 = @__parameter_0 """); } @@ -1087,7 +1075,7 @@ UNION ALL SELECT [o].[Nickname], [o].[SquadId], [o].[AssignedCityName], [o].[CityOfBirthName], [o].[FullName], [o].[HasSoulPatch], [o].[LeaderNickname], [o].[LeaderSquadId], [o].[Rank], N'Officer' AS [Discriminator] FROM [Officers] AS [o] ) AS [t] -WHERE ([t].[Rank] & @__parameter_0) = @__parameter_0 +WHERE [t].[Rank] & @__parameter_0 = @__parameter_0 """); } @@ -1098,10 +1086,10 @@ public override async Task Select_enum_has_flag(bool async) AssertSql( """ SELECT TOP(1) CASE - WHEN ([t].[Rank] & 2) = 2 THEN CAST(1 AS bit) + WHEN [t].[Rank] & 2 = 2 THEN CAST(1 AS bit) ELSE CAST(0 AS bit) END AS [hasFlagTrue], CASE - WHEN ([t].[Rank] & 4) = 4 THEN CAST(1 AS bit) + WHEN [t].[Rank] & 4 = 4 THEN CAST(1 AS bit) ELSE CAST(0 AS bit) END AS [hasFlagFalse] FROM ( @@ -1111,7 +1099,7 @@ UNION ALL SELECT [o].[Rank] FROM [Officers] AS [o] ) AS [t] -WHERE ([t].[Rank] & 2) = 2 +WHERE [t].[Rank] & 2 = 2 """); } @@ -1181,7 +1169,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] @@ -1263,11 +1251,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 """); } @@ -1306,7 +1294,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] @@ -1344,7 +1332,7 @@ UNION ALL SELECT [o].[Nickname], [o].[SquadId], [o].[AssignedCityName], [o].[CityOfBirthName], [o].[FullName], [o].[HasSoulPatch], [o].[LeaderNickname], [o].[LeaderSquadId], [o].[Rank], N'Officer' AS [Discriminator] FROM [Officers] AS [o] ) AS [t] -WHERE [t].[LeaderNickname] = N'Marcus' AND ([t].[LeaderNickname] IS NOT NULL) +WHERE [t].[LeaderNickname] = N'Marcus' AND [t].[LeaderNickname] IS NOT NULL """); } @@ -1366,7 +1354,7 @@ FROM [Officers] AS [o] WHERE CASE WHEN [t].[LeaderNickname] IS NULL THEN NULL ELSE CASE - WHEN ([t].[LeaderNickname] IS NOT NULL) AND ([t].[LeaderNickname] LIKE N'%us') THEN CAST(1 AS bit) + WHEN [t].[LeaderNickname] IS NOT NULL AND [t].[LeaderNickname] LIKE N'%us' THEN CAST(1 AS bit) ELSE CAST(0 AS bit) END END = CAST(1 AS bit) @@ -1416,10 +1404,10 @@ FROM [Officers] AS [o] WHERE CASE WHEN [t].[LeaderNickname] IS NULL THEN NULL ELSE CAST(LEN([t].[LeaderNickname]) AS int) -END = 5 AND (CASE +END = 5 AND CASE WHEN [t].[LeaderNickname] IS NULL THEN NULL ELSE CAST(LEN([t].[LeaderNickname]) AS int) -END IS NOT NULL) +END IS NOT NULL """); } @@ -1441,10 +1429,10 @@ FROM [Officers] AS [o] WHERE CASE WHEN [t].[LeaderNickname] IS NOT NULL THEN CAST(LEN([t].[LeaderNickname]) AS int) ELSE NULL -END = 5 AND (CASE +END = 5 AND CASE WHEN [t].[LeaderNickname] IS NOT NULL THEN CAST(LEN([t].[LeaderNickname]) AS int) ELSE NULL -END IS NOT NULL) +END IS NOT NULL """); } @@ -1466,10 +1454,10 @@ FROM [Officers] AS [o] WHERE CASE WHEN [t].[LeaderNickname] IS NOT NULL THEN CAST(LEN([t].[LeaderNickname]) AS int) ELSE NULL -END = 5 AND (CASE +END = 5 AND CASE WHEN [t].[LeaderNickname] IS NOT NULL THEN CAST(LEN([t].[LeaderNickname]) AS int) ELSE NULL -END IS NOT NULL) +END IS NOT NULL """); } @@ -1585,7 +1573,7 @@ public override async Task Select_null_propagation_negative3(bool async) AssertSql( """ SELECT [t0].[Nickname], CASE - WHEN ([t0].[Nickname] IS NOT NULL) AND ([t0].[SquadId] IS NOT NULL) THEN CASE + WHEN [t0].[Nickname] IS NOT NULL AND [t0].[SquadId] IS NOT NULL THEN CASE WHEN [t0].[LeaderNickname] IS NOT NULL THEN CAST(1 AS bit) ELSE CAST(0 AS bit) END @@ -1616,7 +1604,7 @@ public override async Task Select_null_propagation_negative4(bool async) AssertSql( """ SELECT CASE - WHEN ([t0].[Nickname] IS NOT NULL) AND ([t0].[SquadId] IS NOT NULL) THEN CAST(1 AS bit) + WHEN [t0].[Nickname] IS NOT NULL AND [t0].[SquadId] IS NOT NULL THEN CAST(1 AS bit) ELSE CAST(0 AS bit) END, [t0].[Nickname] FROM ( @@ -1644,7 +1632,7 @@ public override async Task Select_null_propagation_negative5(bool async) AssertSql( """ SELECT CASE - WHEN ([t0].[Nickname] IS NOT NULL) AND ([t0].[SquadId] IS NOT NULL) THEN CAST(1 AS bit) + WHEN [t0].[Nickname] IS NOT NULL AND [t0].[SquadId] IS NOT NULL THEN CAST(1 AS bit) ELSE CAST(0 AS bit) END, [t0].[Nickname] FROM ( @@ -1790,7 +1778,7 @@ UNION ALL SELECT [o].[Nickname], [o].[SquadId] FROM [Officers] AS [o] ) AS [t0] ON [t].[GearNickName] = [t0].[Nickname] AND [t].[GearSquadId] = [t0].[SquadId] -LEFT JOIN [Tags] AS [t1] ON ([t0].[Nickname] = [t1].[GearNickName] OR (([t0].[Nickname] IS NULL) AND ([t1].[GearNickName] IS NULL))) AND ([t0].[SquadId] = [t1].[GearSquadId] OR (([t0].[SquadId] IS NULL) AND ([t1].[GearSquadId] IS NULL))) +LEFT JOIN [Tags] AS [t1] ON ([t0].[Nickname] = [t1].[GearNickName] OR ([t0].[Nickname] IS NULL AND [t1].[GearNickName] IS NULL)) AND ([t0].[SquadId] = [t1].[GearSquadId] OR ([t0].[SquadId] IS NULL AND [t1].[GearSquadId] IS NULL)) LEFT JOIN ( SELECT [g0].[Nickname], [g0].[SquadId], [g0].[AssignedCityName] FROM [Gears] AS [g0] @@ -1984,7 +1972,7 @@ UNION ALL SELECT [o0].[Nickname], [o0].[SquadId] FROM [Officers] AS [o0] ) AS [t2] ON [t0].[GearNickName] = [t2].[Nickname] AND [t0].[GearSquadId] = [t2].[SquadId] -WHERE [t1].[Nickname] = [t2].[Nickname] OR (([t1].[Nickname] IS NULL) AND ([t2].[Nickname] IS NULL)) +WHERE [t1].[Nickname] = [t2].[Nickname] OR ([t1].[Nickname] IS NULL AND [t2].[Nickname] IS NULL) """); } @@ -2003,7 +1991,7 @@ UNION ALL SELECT [o].[Nickname], [o].[SquadId], [o].[AssignedCityName], [o].[CityOfBirthName], [o].[FullName], [o].[HasSoulPatch], [o].[LeaderNickname], [o].[LeaderSquadId], [o].[Rank], N'Officer' AS [Discriminator] FROM [Officers] AS [o] ) AS [t0] ON [t].[GearNickName] = [t0].[Nickname] AND [t].[GearSquadId] = [t0].[SquadId] -WHERE [t0].[Nickname] = N'Marcus' AND ([t0].[CityOfBirthName] <> N'Ephyra' OR ([t0].[CityOfBirthName] IS NULL)) +WHERE [t0].[Nickname] = N'Marcus' AND ([t0].[CityOfBirthName] <> N'Ephyra' OR [t0].[CityOfBirthName] IS NULL) """); } @@ -2049,7 +2037,7 @@ UNION ALL SELECT [o0].[Nickname], [o0].[SquadId] FROM [Officers] AS [o0] ) AS [t2] ON [t0].[GearNickName] = [t2].[Nickname] AND [t0].[GearSquadId] = [t2].[SquadId] -WHERE ([t1].[Nickname] = [t2].[Nickname] OR (([t1].[Nickname] IS NULL) AND ([t2].[Nickname] IS NULL))) AND ([t1].[SquadId] = [t2].[SquadId] OR (([t1].[SquadId] IS NULL) AND ([t2].[SquadId] IS NULL))) +WHERE ([t1].[Nickname] = [t2].[Nickname] OR ([t1].[Nickname] IS NULL AND [t2].[Nickname] IS NULL)) AND ([t1].[SquadId] = [t2].[SquadId] OR ([t1].[SquadId] IS NULL AND [t2].[SquadId] IS NULL)) """); } @@ -2068,7 +2056,7 @@ UNION ALL SELECT [o].[Nickname], [o].[SquadId] FROM [Officers] AS [o] ) AS [t0] ON [t].[GearNickName] = [t0].[Nickname] AND [t].[GearSquadId] = [t0].[SquadId] -WHERE ([t0].[Nickname] IS NULL) OR ([t0].[SquadId] IS NULL) +WHERE [t0].[Nickname] IS NULL OR [t0].[SquadId] IS NULL """); } @@ -2087,7 +2075,7 @@ UNION ALL SELECT [o].[Nickname], [o].[SquadId] FROM [Officers] AS [o] ) AS [t0] ON [t].[GearNickName] = [t0].[Nickname] AND [t].[GearSquadId] = [t0].[SquadId] -WHERE ([t0].[Nickname] IS NULL) OR ([t0].[SquadId] IS NULL) +WHERE [t0].[Nickname] IS NULL OR [t0].[SquadId] IS NULL """); } @@ -2114,7 +2102,7 @@ UNION ALL SELECT [o0].[Nickname], [o0].[SquadId] FROM [Officers] AS [o0] ) AS [t2] ON [t0].[GearNickName] = [t2].[Nickname] AND [t0].[GearSquadId] = [t2].[SquadId] -WHERE [t1].[Nickname] = [t2].[Nickname] OR (([t1].[Nickname] IS NULL) AND ([t2].[Nickname] IS NULL)) +WHERE [t1].[Nickname] = [t2].[Nickname] OR ([t1].[Nickname] IS NULL AND [t2].[Nickname] IS NULL) """); } @@ -2270,7 +2258,7 @@ SELECT TOP(1) [t0].[IsAutomatic] FROM ( SELECT DISTINCT [w].[Id], [w].[AmmunitionType], [w].[IsAutomatic], [w].[Name], [w].[OwnerFullName], [w].[SynergyWithId] FROM [Weapons] AS [w] - WHERE [t].[FullName] = [w].[OwnerFullName] AND ([w].[Name] LIKE N'%Lancer%') + WHERE [t].[FullName] = [w].[OwnerFullName] AND [w].[Name] LIKE N'%Lancer%' ) AS [t0]), CAST(0 AS bit)) = CAST(1 AS bit) ORDER BY [t].[Nickname] """); @@ -2293,7 +2281,7 @@ FROM [Officers] AS [o] WHERE [t].[HasSoulPatch] = CAST(1 AS bit) AND COALESCE(( SELECT DISTINCT TOP(1) [w].[IsAutomatic] FROM [Weapons] AS [w] - WHERE [t].[FullName] = [w].[OwnerFullName] AND ([w].[Name] LIKE N'%Lancer%')), CAST(0 AS bit)) = CAST(1 AS bit) + WHERE [t].[FullName] = [w].[OwnerFullName] AND [w].[Name] LIKE N'%Lancer%'), CAST(0 AS bit)) = CAST(1 AS bit) ORDER BY [t].[Nickname] """); } @@ -2317,7 +2305,7 @@ SELECT TOP(1) [t0].[IsAutomatic] FROM ( SELECT DISTINCT [w].[Id], [w].[AmmunitionType], [w].[IsAutomatic], [w].[Name], [w].[OwnerFullName], [w].[SynergyWithId] FROM [Weapons] AS [w] - WHERE [t].[FullName] = [w].[OwnerFullName] AND ([w].[Name] LIKE N'%Lancer%') + WHERE [t].[FullName] = [w].[OwnerFullName] AND [w].[Name] LIKE N'%Lancer%' ) AS [t0]) = CAST(1 AS bit) ORDER BY [t].[Nickname] """); @@ -2764,7 +2752,7 @@ UNION ALL SELECT [o].[Nickname], [o].[SquadId], [o].[CityOfBirthName] FROM [Officers] AS [o] ) AS [t0] ON [t].[GearNickName] = [t0].[Nickname] AND [t].[GearSquadId] = [t0].[SquadId] -WHERE [t0].[Nickname] = N'Marcus' AND ([t0].[CityOfBirthName] <> N'Ephyra' OR ([t0].[CityOfBirthName] IS NULL)) +WHERE [t0].[Nickname] = N'Marcus' AND ([t0].[CityOfBirthName] <> N'Ephyra' OR [t0].[CityOfBirthName] IS NULL) """); } @@ -3170,7 +3158,7 @@ public override async Task Include_on_GroupJoin_SelectMany_DefaultIfEmpty_with_c AssertSql( """ SELECT CASE - WHEN ([t0].[Nickname] IS NOT NULL) AND ([t0].[SquadId] IS NOT NULL) THEN CAST(1 AS bit) + WHEN [t0].[Nickname] IS NOT NULL AND [t0].[SquadId] IS NOT NULL THEN CAST(1 AS bit) ELSE CAST(0 AS bit) END, [t0].[Nickname], [t0].[SquadId], [t0].[AssignedCityName], [t0].[CityOfBirthName], [t0].[FullName], [t0].[HasSoulPatch], [t0].[LeaderNickname], [t0].[LeaderSquadId], [t0].[Rank], [t0].[Discriminator], [t].[Nickname], [t].[SquadId], [w].[Id], [w].[AmmunitionType], [w].[IsAutomatic], [w].[Name], [w].[OwnerFullName], [w].[SynergyWithId], [t].[AssignedCityName], [t].[CityOfBirthName], [t].[FullName], [t].[HasSoulPatch], [t].[LeaderNickname], [t].[LeaderSquadId], [t].[Rank], [t].[Discriminator], [w0].[Id], [w0].[AmmunitionType], [w0].[IsAutomatic], [w0].[Name], [w0].[OwnerFullName], [w0].[SynergyWithId] FROM ( @@ -3200,7 +3188,7 @@ public override async Task Include_on_GroupJoin_SelectMany_DefaultIfEmpty_with_c AssertSql( """ SELECT [t].[Nickname], [t].[SquadId], [t].[AssignedCityName], [t].[CityOfBirthName], [t].[FullName], [t].[HasSoulPatch], [t].[LeaderNickname], [t].[LeaderSquadId], [t].[Rank], [t].[Discriminator], [t0].[Nickname], [t0].[SquadId], [w].[Id], [w].[AmmunitionType], [w].[IsAutomatic], [w].[Name], [w].[OwnerFullName], [w].[SynergyWithId], [t0].[AssignedCityName], [t0].[CityOfBirthName], [t0].[FullName], [t0].[HasSoulPatch], [t0].[LeaderNickname], [t0].[LeaderSquadId], [t0].[Rank], [t0].[Discriminator], [w0].[Id], [w0].[AmmunitionType], [w0].[IsAutomatic], [w0].[Name], [w0].[OwnerFullName], [w0].[SynergyWithId], [w1].[Id], [w1].[AmmunitionType], [w1].[IsAutomatic], [w1].[Name], [w1].[OwnerFullName], [w1].[SynergyWithId], [w2].[Id], [w2].[AmmunitionType], [w2].[IsAutomatic], [w2].[Name], [w2].[OwnerFullName], [w2].[SynergyWithId], CASE - WHEN ([t0].[Nickname] IS NOT NULL) AND ([t0].[SquadId] IS NOT NULL) THEN CAST(1 AS bit) + WHEN [t0].[Nickname] IS NOT NULL AND [t0].[SquadId] IS NOT NULL THEN CAST(1 AS bit) ELSE CAST(0 AS bit) END, [w3].[Id], [w3].[AmmunitionType], [w3].[IsAutomatic], [w3].[Name], [w3].[OwnerFullName], [w3].[SynergyWithId], [w4].[Id], [w4].[AmmunitionType], [w4].[IsAutomatic], [w4].[Name], [w4].[OwnerFullName], [w4].[SynergyWithId] FROM ( @@ -3258,7 +3246,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] @@ -3280,7 +3268,7 @@ UNION ALL SELECT [o].[Nickname], [o].[SquadId], [o].[HasSoulPatch] FROM [Officers] AS [o] ) AS [t0] ON [t].[GearNickName] = [t0].[Nickname] AND [t].[GearSquadId] = [t0].[SquadId] -WHERE ([t].[Note] <> N'K.I.A.' OR ([t].[Note] IS NULL)) AND [t0].[HasSoulPatch] = CAST(1 AS bit) +WHERE ([t].[Note] <> N'K.I.A.' OR [t].[Note] IS NULL) AND [t0].[HasSoulPatch] = CAST(1 AS bit) """); } @@ -3403,7 +3391,7 @@ UNION ALL SELECT [o].[Nickname], [o].[SquadId], [o].[HasSoulPatch] FROM [Officers] AS [o] ) AS [t0] ON [t].[GearNickName] = [t0].[Nickname] AND [t].[GearSquadId] = [t0].[SquadId] -WHERE [t0].[HasSoulPatch] = CAST(1 AS bit) OR ([t].[Note] LIKE N'%Cole%') +WHERE [t0].[HasSoulPatch] = CAST(1 AS bit) OR [t].[Note] LIKE N'%Cole%' """); } @@ -3414,7 +3402,7 @@ 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] @@ -3443,7 +3431,7 @@ UNION ALL SELECT [o].[Nickname], [o].[SquadId] FROM [Officers] AS [o] ) AS [t0] ON [t].[GearNickName] = [t0].[Nickname] AND [t].[GearSquadId] = [t0].[SquadId] -WHERE [t].[Note] <> N'K.I.A.' OR ([t].[Note] IS NULL) +WHERE [t].[Note] <> N'K.I.A.' OR [t].[Note] IS NULL """); } @@ -3462,7 +3450,7 @@ UNION ALL SELECT [o].[Nickname], [o].[SquadId] FROM [Officers] AS [o] ) AS [t0] ON [t].[GearNickName] = [t0].[Nickname] AND [t].[GearSquadId] = [t0].[SquadId] -WHERE [t].[Note] <> N'K.I.A.' OR ([t].[Note] IS NULL) +WHERE [t].[Note] <> N'K.I.A.' OR [t].[Note] IS NULL """); } @@ -3481,7 +3469,7 @@ UNION ALL SELECT [o].[Nickname], [o].[SquadId] FROM [Officers] AS [o] ) AS [t0] ON [t].[GearNickName] = [t0].[Nickname] AND [t].[GearSquadId] = [t0].[SquadId] -WHERE [t].[Note] <> N'K.I.A.' OR ([t].[Note] IS NULL) +WHERE [t].[Note] <> N'K.I.A.' OR [t].[Note] IS NULL """); } @@ -3500,7 +3488,7 @@ UNION ALL SELECT [o].[Nickname], [o].[SquadId] FROM [Officers] AS [o] ) AS [t0] ON [t].[GearNickName] = [t0].[Nickname] AND [t].[GearSquadId] = [t0].[SquadId] -WHERE [t].[Note] <> N'K.I.A.' OR ([t].[Note] IS NULL) +WHERE [t].[Note] <> N'K.I.A.' OR [t].[Note] IS NULL ORDER BY [t].[Note] """); } @@ -3520,7 +3508,7 @@ UNION ALL SELECT [o].[Nickname], [o].[SquadId] FROM [Officers] AS [o] ) AS [t0] ON [t].[GearNickName] = [t0].[Nickname] AND [t].[GearSquadId] = [t0].[SquadId] -WHERE [t].[Note] <> N'K.I.A.' OR ([t].[Note] IS NULL) +WHERE [t].[Note] <> N'K.I.A.' OR [t].[Note] IS NULL """); } @@ -3539,7 +3527,7 @@ UNION ALL SELECT [o].[Nickname], [o].[SquadId] FROM [Officers] AS [o] ) AS [t0] ON [t].[GearNickName] = [t0].[Nickname] AND [t].[GearSquadId] = [t0].[SquadId] -WHERE [t].[Note] <> N'K.I.A.' OR ([t].[Note] IS NULL) +WHERE [t].[Note] <> N'K.I.A.' OR [t].[Note] IS NULL ORDER BY [t0].[SquadId] """); } @@ -3561,7 +3549,7 @@ UNION ALL SELECT [o].[Nickname], [o].[SquadId], [o].[AssignedCityName], [o].[CityOfBirthName], [o].[FullName], [o].[HasSoulPatch], [o].[LeaderNickname], [o].[LeaderSquadId], [o].[Rank], N'Officer' AS [Discriminator] FROM [Officers] AS [o] ) AS [t0] ON [t].[GearNickName] = [t0].[Nickname] AND [t].[GearSquadId] = [t0].[SquadId] - WHERE ([t].[Note] <> N'K.I.A.' OR ([t].[Note] IS NULL)) AND [t0].[HasSoulPatch] = CAST(0 AS bit)) THEN CAST(1 AS bit) + WHERE ([t].[Note] <> N'K.I.A.' OR [t].[Note] IS NULL) AND [t0].[HasSoulPatch] = CAST(0 AS bit)) THEN CAST(1 AS bit) ELSE CAST(0 AS bit) END """); @@ -3582,7 +3570,7 @@ UNION ALL SELECT [o].[Nickname], [o].[SquadId], [o].[HasSoulPatch] FROM [Officers] AS [o] ) AS [t0] ON [t].[GearNickName] = [t0].[Nickname] AND [t].[GearSquadId] = [t0].[SquadId] -WHERE ([t].[Note] <> N'K.I.A.' OR ([t].[Note] IS NULL)) AND [t0].[HasSoulPatch] = CAST(0 AS bit) +WHERE ([t].[Note] <> N'K.I.A.' OR [t].[Note] IS NULL) AND [t0].[HasSoulPatch] = CAST(0 AS bit) """); } @@ -3601,7 +3589,7 @@ UNION ALL SELECT [o].[Nickname], [o].[SquadId] FROM [Officers] AS [o] ) AS [t0] ON [t].[GearNickName] = [t0].[Nickname] AND [t].[GearSquadId] = [t0].[SquadId] -WHERE ([t].[Note] <> N'K.I.A.' OR ([t].[Note] IS NULL)) AND EXISTS ( +WHERE ([t].[Note] <> N'K.I.A.' OR [t].[Note] IS NULL) AND EXISTS ( SELECT 1 FROM ( SELECT [g0].[Nickname], [g0].[SquadId], [g0].[AssignedCityName], [g0].[CityOfBirthName], [g0].[FullName], [g0].[HasSoulPatch], [g0].[LeaderNickname], [g0].[LeaderSquadId], [g0].[Rank], N'Gear' AS [Discriminator] @@ -3646,7 +3634,7 @@ FROM [Officers] AS [o] LEFT JOIN ( SELECT [w].[Id], [w].[AmmunitionType], [w].[IsAutomatic], [w].[Name], [w].[OwnerFullName], [w].[SynergyWithId] FROM [Weapons] AS [w] - WHERE [w].[Name] <> N'Lancer' OR ([w].[Name] IS NULL) + WHERE [w].[Name] <> N'Lancer' OR [w].[Name] IS NULL ) AS [t0] ON [t].[FullName] = [t0].[OwnerFullName] WHERE [c].[Name] IN (N'Ephyra', N'Hanover') ORDER BY [t].[Nickname], [t].[SquadId], [c].[Name] @@ -4060,7 +4048,7 @@ UNION ALL FROM [Officers] AS [o] ) AS [t] LEFT JOIN [Tags] AS [t0] ON [t].[Nickname] = [t0].[GearNickName] AND [t].[SquadId] = [t0].[GearSquadId] -WHERE [t0].[Note] <> N'Foo' OR ([t0].[Note] IS NULL) +WHERE [t0].[Note] <> N'Foo' OR [t0].[Note] IS NULL """); } @@ -4079,7 +4067,7 @@ UNION ALL FROM [Officers] AS [o] ) AS [t] LEFT JOIN [Tags] AS [t0] ON [t].[Nickname] = [t0].[GearNickName] AND [t].[SquadId] = [t0].[GearSquadId] -WHERE [t0].[Note] <> N'Foo' OR ([t0].[Note] IS NULL) +WHERE [t0].[Note] <> N'Foo' OR [t0].[Note] IS NULL """); } @@ -4098,7 +4086,7 @@ UNION ALL FROM [Officers] AS [o] ) AS [t] LEFT JOIN [Tags] AS [t0] ON [t].[Nickname] = [t0].[GearNickName] AND [t].[SquadId] = [t0].[GearSquadId] -WHERE [t0].[Note] <> N'Foo' OR ([t0].[Note] IS NULL) +WHERE [t0].[Note] <> N'Foo' OR [t0].[Note] IS NULL """); } @@ -4160,7 +4148,7 @@ UNION ALL FROM [Officers] AS [o] ) AS [t] LEFT JOIN [Tags] AS [t0] ON [t].[Nickname] = [t0].[GearNickName] AND [t].[SquadId] = [t0].[GearSquadId] - WHERE [t0].[Note] = N'Foo' AND ([t0].[Note] IS NOT NULL)) THEN CAST(1 AS bit) + WHERE [t0].[Note] = N'Foo' AND [t0].[Note] IS NOT NULL) THEN CAST(1 AS bit) ELSE CAST(0 AS bit) END """); @@ -4355,7 +4343,7 @@ FROM [Officers] AS [o] ) AS [t] INNER JOIN [Tags] AS [t0] ON [t].[Nickname] = [t0].[GearNickName] INNER JOIN [Tags] AS [t1] ON [t].[Nickname] = [t1].[GearNickName] -WHERE [t0].[GearNickName] <> N'Cole Train' OR ([t0].[GearNickName] IS NULL) +WHERE [t0].[GearNickName] <> N'Cole Train' OR [t0].[GearNickName] IS NULL ORDER BY [t].[Nickname], [t1].[Id] """); } @@ -4829,7 +4817,7 @@ UNION ALL FROM [Officers] AS [o] ) AS [t] LEFT JOIN [Cities] AS [c] ON [t].[AssignedCityName] = [c].[Name] -WHERE [t].[SquadId] < 2 AND ([c].[Name] = N'Ephyra' OR ([c].[Name] IS NULL)) +WHERE [t].[SquadId] < 2 AND ([c].[Name] = N'Ephyra' OR [c].[Name] IS NULL) """); } @@ -4857,7 +4845,7 @@ UNION ALL SELECT [o0].[Nickname], [o0].[SquadId], [o0].[AssignedCityName], [o0].[CityOfBirthName], [o0].[FullName], [o0].[HasSoulPatch], [o0].[LeaderNickname], [o0].[LeaderSquadId], [o0].[Rank], N'Officer' AS [Discriminator] FROM [Officers] AS [o0] ) AS [t1] - WHERE ([t0].[Nickname] IS NOT NULL) AND ([t0].[SquadId] IS NOT NULL) AND [t0].[Nickname] = [t1].[LeaderNickname] AND [t0].[SquadId] = [t1].[LeaderSquadId] AND [t1].[Nickname] = N'Dom') > 0 + WHERE [t0].[Nickname] IS NOT NULL AND [t0].[SquadId] IS NOT NULL AND [t0].[Nickname] = [t1].[LeaderNickname] AND [t0].[SquadId] = [t1].[LeaderSquadId] AND [t1].[Nickname] = N'Dom') > 0 """); } @@ -4932,7 +4920,7 @@ FROM [Gears] AS [g0] UNION ALL SELECT [o0].[Nickname], [o0].[SquadId], [o0].[AssignedCityName], [o0].[CityOfBirthName], [o0].[FullName], [o0].[HasSoulPatch], [o0].[LeaderNickname], [o0].[LeaderSquadId], [o0].[Rank], N'Officer' AS [Discriminator] FROM [Officers] AS [o0] -) AS [t0] ON ([t].[Nickname] = [t0].[LeaderNickname] OR (([t].[Nickname] IS NULL) AND ([t0].[LeaderNickname] IS NULL))) AND [t].[SquadId] = [t0].[LeaderSquadId] +) AS [t0] ON ([t].[Nickname] = [t0].[LeaderNickname] OR ([t].[Nickname] IS NULL AND [t0].[LeaderNickname] IS NULL)) AND [t].[SquadId] = [t0].[LeaderSquadId] ORDER BY [l].[Id], [l0].[Name], [t].[Nickname], [t].[SquadId], [t0].[Nickname] """); } @@ -4959,7 +4947,7 @@ FROM [Gears] AS [g0] UNION ALL SELECT [o0].[Nickname], [o0].[SquadId], [o0].[AssignedCityName], [o0].[CityOfBirthName], [o0].[FullName], [o0].[HasSoulPatch], [o0].[LeaderNickname], [o0].[LeaderSquadId], [o0].[Rank], N'Officer' AS [Discriminator] FROM [Officers] AS [o0] -) AS [t0] ON ([t].[Nickname] = [t0].[LeaderNickname] OR (([t].[Nickname] IS NULL) AND ([t0].[LeaderNickname] IS NULL))) AND [t].[SquadId] = [t0].[LeaderSquadId] +) AS [t0] ON ([t].[Nickname] = [t0].[LeaderNickname] OR ([t].[Nickname] IS NULL AND [t0].[LeaderNickname] IS NULL)) AND [t].[SquadId] = [t0].[LeaderSquadId] ORDER BY [l].[Id], [l0].[Name], [t].[Nickname], [t].[SquadId], [t0].[Nickname] """); } @@ -5044,7 +5032,7 @@ UNION ALL FROM [Officers] AS [o0] ) AS [t2] INNER JOIN [Cities] AS [c] ON [t2].[CityOfBirthName] = [c].[Name] -) AS [t1] ON ([t0].[Nickname] = [t1].[LeaderNickname] OR (([t0].[Nickname] IS NULL) AND ([t1].[LeaderNickname] IS NULL))) AND [t0].[SquadId] = [t1].[LeaderSquadId] +) AS [t1] ON ([t0].[Nickname] = [t1].[LeaderNickname] OR ([t0].[Nickname] IS NULL AND [t1].[LeaderNickname] IS NULL)) AND [t0].[SquadId] = [t1].[LeaderSquadId] ORDER BY [t].[Name], [t0].[Nickname], [t0].[SquadId], [t1].[Nickname], [t1].[SquadId] """); } @@ -5258,7 +5246,7 @@ FROM [Gears] AS [g0] UNION ALL SELECT [o0].[Nickname], [o0].[SquadId], [o0].[AssignedCityName], [o0].[CityOfBirthName], [o0].[FullName], [o0].[HasSoulPatch], [o0].[LeaderNickname], [o0].[LeaderSquadId], [o0].[Rank], N'Officer' AS [Discriminator] FROM [Officers] AS [o0] -) AS [t0] ON ([t].[Nickname] = [t0].[LeaderNickname] OR (([t].[Nickname] IS NULL) AND ([t0].[LeaderNickname] IS NULL))) AND [t].[SquadId] = [t0].[LeaderSquadId] +) AS [t0] ON ([t].[Nickname] = [t0].[LeaderNickname] OR ([t].[Nickname] IS NULL AND [t0].[LeaderNickname] IS NULL)) AND [t].[SquadId] = [t0].[LeaderSquadId] ORDER BY [l].[Id], [l0].[Name], [t].[Nickname], [t].[SquadId], [t0].[Nickname] """); } @@ -5349,7 +5337,7 @@ FROM [Gears] AS [g0] UNION ALL SELECT [o0].[Nickname], [o0].[SquadId], [o0].[AssignedCityName], [o0].[CityOfBirthName], [o0].[FullName], [o0].[HasSoulPatch], [o0].[LeaderNickname], [o0].[LeaderSquadId], [o0].[Rank], N'Officer' AS [Discriminator] FROM [Officers] AS [o0] -) AS [t0] ON ([t].[Nickname] = [t0].[LeaderNickname] OR (([t].[Nickname] IS NULL) AND ([t0].[LeaderNickname] IS NULL))) AND [t].[SquadId] = [t0].[LeaderSquadId] +) AS [t0] ON ([t].[Nickname] = [t0].[LeaderNickname] OR ([t].[Nickname] IS NULL AND [t0].[LeaderNickname] IS NULL)) AND [t].[SquadId] = [t0].[LeaderSquadId] ORDER BY [l].[Id], [l0].[Name], [t].[Nickname], [t].[SquadId], [t0].[Nickname] """); } @@ -5391,7 +5379,7 @@ public override async Task Projecting_nullable_bool_in_conditional_works(bool as AssertSql( """ SELECT CASE - WHEN ([t0].[Nickname] IS NOT NULL) AND ([t0].[SquadId] IS NOT NULL) THEN [t0].[HasSoulPatch] + WHEN [t0].[Nickname] IS NOT NULL AND [t0].[SquadId] IS NOT NULL THEN [t0].[HasSoulPatch] ELSE CAST(0 AS bit) END AS [Prop] FROM [Tags] AS [t] @@ -5502,7 +5490,7 @@ FROM [Officers] AS [o] LEFT JOIN ( SELECT [w].[Id], [w].[AmmunitionType], [w].[IsAutomatic], [w].[Name], [w].[OwnerFullName], [w].[SynergyWithId] FROM [Weapons] AS [w] - WHERE [w].[IsAutomatic] = CAST(1 AS bit) OR [w].[Name] <> N'foo' OR ([w].[Name] IS NULL) + WHERE [w].[IsAutomatic] = CAST(1 AS bit) OR [w].[Name] <> N'foo' OR [w].[Name] IS NULL ) AS [t0] ON [t].[FullName] = [t0].[OwnerFullName] WHERE [t].[Nickname] <> N'Marcus' ORDER BY [t].[Nickname], [t].[SquadId] @@ -5526,7 +5514,7 @@ FROM [Officers] AS [o] LEFT JOIN ( SELECT [w].[Id], [w].[AmmunitionType], [w].[IsAutomatic], [w].[Name], [w].[OwnerFullName], [w].[SynergyWithId] FROM [Weapons] AS [w] - WHERE [w].[IsAutomatic] = CAST(1 AS bit) OR [w].[Name] <> N'foo' OR ([w].[Name] IS NULL) + WHERE [w].[IsAutomatic] = CAST(1 AS bit) OR [w].[Name] <> N'foo' OR [w].[Name] IS NULL ) AS [t0] ON [t].[FullName] = [t0].[OwnerFullName] WHERE [t].[Nickname] <> N'Marcus' ORDER BY [t].[Nickname], [t].[SquadId] @@ -5550,7 +5538,7 @@ FROM [Officers] AS [o] LEFT JOIN ( SELECT [w].[Id], [w].[AmmunitionType], [w].[IsAutomatic], [w].[Name], [w].[OwnerFullName], [w].[SynergyWithId] FROM [Weapons] AS [w] - WHERE [w].[IsAutomatic] = CAST(1 AS bit) OR [w].[Name] <> N'foo' OR ([w].[Name] IS NULL) + WHERE [w].[IsAutomatic] = CAST(1 AS bit) OR [w].[Name] <> N'foo' OR [w].[Name] IS NULL ) AS [t0] ON [t].[FullName] = [t0].[OwnerFullName] WHERE [t].[Nickname] <> N'Marcus' ORDER BY [t].[Nickname], [t].[SquadId] @@ -5574,7 +5562,7 @@ FROM [Officers] AS [o] LEFT JOIN ( SELECT [w].[Id], [w].[AmmunitionType], [w].[IsAutomatic], [w].[Name], [w].[OwnerFullName], [w].[SynergyWithId] FROM [Weapons] AS [w] - WHERE [w].[IsAutomatic] = CAST(1 AS bit) OR [w].[Name] <> N'foo' OR ([w].[Name] IS NULL) + WHERE [w].[IsAutomatic] = CAST(1 AS bit) OR [w].[Name] <> N'foo' OR [w].[Name] IS NULL ) AS [t0] ON [t].[FullName] = [t0].[OwnerFullName] WHERE [t].[Nickname] <> N'Marcus' ORDER BY [t].[Nickname], [t].[SquadId], [t0].[Name] DESC @@ -5625,7 +5613,7 @@ FROM [Officers] AS [o] LEFT JOIN ( SELECT [w].[Name], [w].[Id], [w].[OwnerFullName] FROM [Weapons] AS [w] - WHERE [w].[IsAutomatic] = CAST(1 AS bit) OR [w].[Name] <> N'foo' OR ([w].[Name] IS NULL) + WHERE [w].[IsAutomatic] = CAST(1 AS bit) OR [w].[Name] <> N'foo' OR [w].[Name] IS NULL ) AS [t0] ON [t].[FullName] = [t0].[OwnerFullName] WHERE [t].[Nickname] <> N'Marcus' ORDER BY [t].[Nickname], [t].[SquadId] @@ -5649,7 +5637,7 @@ FROM [Officers] AS [o] LEFT JOIN ( SELECT N'BFG' AS [c], [w].[Id], [w].[OwnerFullName] FROM [Weapons] AS [w] - WHERE [w].[IsAutomatic] = CAST(1 AS bit) OR [w].[Name] <> N'foo' OR ([w].[Name] IS NULL) + WHERE [w].[IsAutomatic] = CAST(1 AS bit) OR [w].[Name] <> N'foo' OR [w].[Name] IS NULL ) AS [t0] ON [t].[FullName] = [t0].[OwnerFullName] WHERE [t].[Nickname] <> N'Marcus' ORDER BY [t].[Nickname], [t].[SquadId] @@ -5673,7 +5661,7 @@ FROM [Officers] AS [o] LEFT JOIN ( SELECT CAST(1 AS bit) AS [c], [w].[Id], [w].[OwnerFullName] FROM [Weapons] AS [w] - WHERE [w].[IsAutomatic] = CAST(1 AS bit) OR [w].[Name] <> N'foo' OR ([w].[Name] IS NULL) + WHERE [w].[IsAutomatic] = CAST(1 AS bit) OR [w].[Name] <> N'foo' OR [w].[Name] IS NULL ) AS [t0] ON [t].[FullName] = [t0].[OwnerFullName] WHERE [t].[Nickname] <> N'Marcus' ORDER BY [t].[Nickname], [t].[SquadId] @@ -5817,7 +5805,7 @@ FROM [Officers] AS [o0] LEFT JOIN ( SELECT [w].[Id], [w].[AmmunitionType], [w].[IsAutomatic], [w].[Name], [w].[OwnerFullName], [w].[SynergyWithId] FROM [Weapons] AS [w] - WHERE [w].[Name] <> N'Bar' OR ([w].[Name] IS NULL) + WHERE [w].[Name] <> N'Bar' OR [w].[Name] IS NULL ) AS [t2] ON [t0].[FullName] = [t2].[OwnerFullName] WHERE [t0].[FullName] <> N'Foo' ) AS [t1] ON [t].[Nickname] = [t1].[LeaderNickname] AND [t].[SquadId] = [t1].[LeaderSquadId] @@ -6047,7 +6035,7 @@ LEFT JOIN ( SELECT [w].[Id], [w].[AmmunitionType], [w].[IsAutomatic], [w].[Name], [w].[OwnerFullName], [w].[SynergyWithId], [t4].[Nickname], [t4].[SquadId], ( SELECT COUNT(*) FROM [Weapons] AS [w0] - WHERE ([t4].[FullName] IS NOT NULL) AND [t4].[FullName] = [w0].[OwnerFullName]) AS [c] + WHERE [t4].[FullName] IS NOT NULL AND [t4].[FullName] = [w0].[OwnerFullName]) AS [c] FROM [Weapons] AS [w] LEFT JOIN ( SELECT [g0].[Nickname], [g0].[SquadId], [g0].[FullName] @@ -6118,7 +6106,7 @@ UNION ALL SELECT [o3].[Nickname], [o3].[SquadId], [o3].[HasSoulPatch] FROM [Officers] AS [o3] ) AS [t7] ON [s].[Id] = [t7].[SquadId] - WHERE [w].[Name] <> N'Bar' OR ([w].[Name] IS NULL) + WHERE [w].[Name] <> N'Bar' OR [w].[Name] IS NULL ) AS [t5] ON [t4].[FullName] = [t5].[OwnerFullName] WHERE [t4].[FullName] <> N'Foo' ) AS [t3] ON [t].[Nickname] = [t3].[LeaderNickname] AND [t].[SquadId] = [t3].[LeaderSquadId] @@ -6222,7 +6210,7 @@ FROM [Officers] AS [o0] OUTER APPLY ( SELECT [w].[Name], [t0].[Nickname], [w].[Id] FROM [Weapons] AS [w] - WHERE [t0].[FullName] = [w].[OwnerFullName] AND ([w].[Name] <> N'Bar' OR ([w].[Name] IS NULL)) + WHERE [t0].[FullName] = [w].[OwnerFullName] AND ([w].[Name] <> N'Bar' OR [w].[Name] IS NULL) ) AS [t2] WHERE [t0].[FullName] <> N'Foo' ) AS [t1] ON [t].[Nickname] = [t1].[LeaderNickname] AND [t].[SquadId] = [t1].[LeaderSquadId] @@ -6253,7 +6241,7 @@ FROM [Officers] AS [o0] LEFT JOIN ( SELECT [w].[Name], [t].[Nickname], [w].[Id], [w].[OwnerFullName] FROM [Weapons] AS [w] - WHERE [w].[Name] <> N'Bar' OR ([w].[Name] IS NULL) + WHERE [w].[Name] <> N'Bar' OR [w].[Name] IS NULL ) AS [t2] ON [t0].[FullName] = [t2].[OwnerFullName] WHERE [t].[Nickname] = [t0].[LeaderNickname] AND [t].[SquadId] = [t0].[LeaderSquadId] AND [t0].[FullName] <> N'Foo' ) AS [t1] @@ -6279,7 +6267,7 @@ CROSS JOIN [Squads] AS [s] LEFT JOIN ( SELECT [w].[Id], [w].[AmmunitionType], [w].[IsAutomatic], [w].[Name], [w].[OwnerFullName], [w].[SynergyWithId] FROM [Weapons] AS [w] - WHERE [w].[IsAutomatic] = CAST(1 AS bit) OR [w].[Name] <> N'foo' OR ([w].[Name] IS NULL) + WHERE [w].[IsAutomatic] = CAST(1 AS bit) OR [w].[Name] <> N'foo' OR [w].[Name] IS NULL ) AS [t0] ON [t].[FullName] = [t0].[OwnerFullName] LEFT JOIN ( SELECT [t2].[Nickname], [t2].[SquadId], [t2].[AssignedCityName], [t2].[CityOfBirthName], [t2].[FullName], [t2].[HasSoulPatch], [t2].[LeaderNickname], [t2].[LeaderSquadId], [t2].[Rank], [t2].[Discriminator] @@ -6458,7 +6446,7 @@ FROM [Gears] AS [g] UNION ALL SELECT [o0].[Nickname], [o0].[SquadId], [o0].[FullName], [o0].[LeaderNickname], [o0].[LeaderSquadId] FROM [Officers] AS [o0] -) AS [t1] ON ([t0].[Nickname] = [t1].[LeaderNickname] OR (([t0].[Nickname] IS NULL) AND ([t1].[LeaderNickname] IS NULL))) AND [t0].[SquadId] = [t1].[LeaderSquadId] +) AS [t1] ON ([t0].[Nickname] = [t1].[LeaderNickname] OR ([t0].[Nickname] IS NULL AND [t1].[LeaderNickname] IS NULL)) AND [t0].[SquadId] = [t1].[LeaderSquadId] ORDER BY [t].[Id], [t0].[Nickname], [t0].[SquadId], [t1].[Nickname] """); } @@ -6801,7 +6789,7 @@ INNER JOIN ( FROM [LocustHordes] AS [l] WHERE [l].[Name] = N'Swarm' ) AS [t0] ON [t].[Name] = [t0].[CommanderName] -WHERE [t0].[Eradicated] <> CAST(1 AS bit) OR ([t0].[Eradicated] IS NULL) +WHERE [t0].[Eradicated] <> CAST(1 AS bit) OR [t0].[Eradicated] IS NULL """); } @@ -6824,7 +6812,7 @@ LEFT JOIN ( FROM [LocustHordes] AS [l] WHERE [l].[Name] = N'Swarm' ) AS [t0] ON [t].[Name] = [t0].[CommanderName] -WHERE [t0].[Eradicated] <> CAST(1 AS bit) OR ([t0].[Eradicated] IS NULL) +WHERE [t0].[Eradicated] <> CAST(1 AS bit) OR [t0].[Eradicated] IS NULL """); } @@ -6853,7 +6841,7 @@ UNION ALL SELECT [o].[Nickname], [o].[SquadId], [o].[AssignedCityName], [o].[CityOfBirthName], [o].[FullName], [o].[HasSoulPatch], [o].[LeaderNickname], [o].[LeaderSquadId], [o].[Rank], N'Officer' AS [Discriminator] FROM [Officers] AS [o] ) AS [t0] ON [t].[DefeatedByNickname] = [t0].[Nickname] AND [t].[DefeatedBySquadId] = [t0].[SquadId] - LEFT JOIN [Tags] AS [t1] ON ([t0].[Nickname] = [t1].[GearNickName] OR (([t0].[Nickname] IS NULL) AND ([t1].[GearNickName] IS NULL))) AND ([t0].[SquadId] = [t1].[GearSquadId] OR (([t0].[SquadId] IS NULL) AND ([t1].[GearSquadId] IS NULL))) + LEFT JOIN [Tags] AS [t1] ON ([t0].[Nickname] = [t1].[GearNickName] OR ([t0].[Nickname] IS NULL AND [t1].[GearNickName] IS NULL)) AND ([t0].[SquadId] = [t1].[GearSquadId] OR ([t0].[SquadId] IS NULL AND [t1].[GearSquadId] IS NULL)) ORDER BY [t1].[Note] ) AS [t2] LEFT JOIN [Weapons] AS [w] ON [t2].[FullName] = [w].[OwnerFullName] @@ -7917,7 +7905,7 @@ SELECT TOP(1) [t0].[IsAutomatic] FROM ( SELECT DISTINCT [w].[Id], [w].[AmmunitionType], [w].[IsAutomatic], [w].[Name], [w].[OwnerFullName], [w].[SynergyWithId] FROM [Weapons] AS [w] - WHERE [t].[FullName] = [w].[OwnerFullName] AND ([w].[Name] LIKE N'%Lancer%') + WHERE [t].[FullName] = [w].[OwnerFullName] AND [w].[Name] LIKE N'%Lancer%' ) AS [t0]), CAST(0 AS bit)) FROM ( SELECT [g].[FullName], [g].[HasSoulPatch] @@ -7939,7 +7927,7 @@ public override async Task Select_subquery_distinct_singleordefault_boolean2(boo SELECT COALESCE(( SELECT DISTINCT TOP(1) [w].[IsAutomatic] FROM [Weapons] AS [w] - WHERE [t].[FullName] = [w].[OwnerFullName] AND ([w].[Name] LIKE N'%Lancer%')), CAST(0 AS bit)) + WHERE [t].[FullName] = [w].[OwnerFullName] AND [w].[Name] LIKE N'%Lancer%'), CAST(0 AS bit)) FROM ( SELECT [g].[FullName], [g].[HasSoulPatch] FROM [Gears] AS [g] @@ -7962,7 +7950,7 @@ SELECT TOP(1) [t0].[IsAutomatic] FROM ( SELECT DISTINCT [w].[Id], [w].[AmmunitionType], [w].[IsAutomatic], [w].[Name], [w].[OwnerFullName], [w].[SynergyWithId] FROM [Weapons] AS [w] - WHERE [t].[FullName] = [w].[OwnerFullName] AND ([w].[Name] LIKE N'%Lancer%') + WHERE [t].[FullName] = [w].[OwnerFullName] AND [w].[Name] LIKE N'%Lancer%' ) AS [t0]) FROM ( SELECT [g].[FullName], [g].[HasSoulPatch] @@ -8157,7 +8145,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] """); @@ -8185,7 +8173,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 """); @@ -8201,7 +8189,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 """); @@ -8239,7 +8227,7 @@ public override async Task String_concat_on_various_types(bool async) AssertSql( """ -SELECT (N'HasSoulPatch ' + CAST([t].[HasSoulPatch] AS nvarchar(max))) + N' HasSoulPatch' AS [HasSoulPatch], (N'Rank ' + CAST([t].[Rank] AS nvarchar(max))) + N' Rank' AS [Rank], (N'SquadId ' + CAST([t].[SquadId] AS nvarchar(max))) + N' SquadId' AS [SquadId], (N'Rating ' + COALESCE(CAST([m].[Rating] AS nvarchar(max)), N'')) + N' Rating' AS [Rating], (N'Timeline ' + CAST([m].[Timeline] AS nvarchar(max))) + N' Timeline' AS [Timeline] +SELECT N'HasSoulPatch ' + CAST([t].[HasSoulPatch] AS nvarchar(max)) + N' HasSoulPatch' AS [HasSoulPatch], N'Rank ' + CAST([t].[Rank] AS nvarchar(max)) + N' Rank' AS [Rank], N'SquadId ' + CAST([t].[SquadId] AS nvarchar(max)) + N' SquadId' AS [SquadId], N'Rating ' + COALESCE(CAST([m].[Rating] AS nvarchar(max)), N'') + N' Rating' AS [Rating], N'Timeline ' + CAST([m].[Timeline] AS nvarchar(max)) + N' Timeline' AS [Timeline] FROM ( SELECT [g].[Nickname], [g].[SquadId], [g].[HasSoulPatch], [g].[Rank] FROM [Gears] AS [g] @@ -8705,7 +8693,7 @@ UNION ALL SELECT [o].[Nickname], [o].[SquadId] FROM [Officers] AS [o] ) AS [t0] ON [t].[GearNickName] = [t0].[Nickname] AND [t].[GearSquadId] = [t0].[SquadId] -WHERE SUBSTRING([t].[Note], 0 + 1, [t0].[SquadId]) = [t].[GearNickName] OR ((([t].[Note] IS NULL) OR ([t0].[SquadId] IS NULL)) AND ([t].[GearNickName] IS NULL)) +WHERE SUBSTRING([t].[Note], 0 + 1, [t0].[SquadId]) = [t].[GearNickName] OR (([t].[Note] IS NULL OR [t0].[SquadId] IS NULL) AND [t].[GearNickName] IS NULL) """); } @@ -8727,7 +8715,7 @@ UNION ALL FROM [Officers] AS [o] ) AS [t0] ON [t].[GearNickName] = [t0].[Nickname] AND [t].[GearSquadId] = [t0].[SquadId] LEFT JOIN [Squads] AS [s] ON [t0].[SquadId] = [s].[Id] -WHERE SUBSTRING([t].[Note], 0 + 1, CAST(LEN([s].[Name]) AS int)) = [t].[GearNickName] OR ((([t].[Note] IS NULL) OR ([s].[Name] IS NULL)) AND ([t].[GearNickName] IS NULL)) +WHERE SUBSTRING([t].[Note], 0 + 1, CAST(LEN([s].[Name]) AS int)) = [t].[GearNickName] OR (([t].[Note] IS NULL OR [s].[Name] IS NULL) AND [t].[GearNickName] IS NULL) """); } @@ -8763,7 +8751,7 @@ FROM [Officers] AS [o] ) AS [t] LEFT JOIN [Tags] AS [t0] ON [t].[Nickname] = [t0].[GearNickName] AND [t].[SquadId] = [t0].[GearSquadId] LEFT JOIN [Tags] AS [t1] ON [t].[Nickname] = [t1].[GearNickName] AND [t].[SquadId] = [t1].[GearSquadId] -WHERE ([t0].[Note] <> N'Foo' OR ([t0].[Note] IS NULL)) AND ([t1].[Note] <> N'Bar' OR ([t1].[Note] IS NULL)) +WHERE ([t0].[Note] <> N'Foo' OR [t0].[Note] IS NULL) AND ([t1].[Note] <> N'Bar' OR [t1].[Note] IS NULL) """); } @@ -8780,7 +8768,7 @@ FROM [Officers] AS [o] ) AS [t] LEFT JOIN [Tags] AS [t0] ON [t].[Nickname] = [t0].[GearNickName] AND [t].[SquadId] = [t0].[GearSquadId] LEFT JOIN [Cities] AS [c] ON [t].[AssignedCityName] = [c].[Name] -WHERE ([t0].[Note] <> N'Foo' OR ([t0].[Note] IS NULL)) AND ([c].[Location] <> 'Bar' OR ([c].[Location] IS NULL)) +WHERE ([t0].[Note] <> N'Foo' OR [t0].[Note] IS NULL) AND ([c].[Location] <> 'Bar' OR [c].[Location] IS NULL) """); } @@ -8798,7 +8786,7 @@ FROM [Officers] AS [o] LEFT JOIN [Tags] AS [t0] ON [t].[Nickname] = [t0].[GearNickName] AND [t].[SquadId] = [t0].[GearSquadId] INNER JOIN [Weapons] AS [w] ON [t].[FullName] = [w].[OwnerFullName] LEFT JOIN [Tags] AS [t1] ON [t].[Nickname] = [t1].[GearNickName] AND [t].[SquadId] = [t1].[GearSquadId] -WHERE ([t0].[Note] <> N'Foo' OR ([t0].[Note] IS NULL)) AND ([t1].[Note] <> N'Bar' OR ([t1].[Note] IS NULL)) +WHERE ([t0].[Note] <> N'Foo' OR [t0].[Note] IS NULL) AND ([t1].[Note] <> N'Bar' OR [t1].[Note] IS NULL) """); } @@ -8826,7 +8814,7 @@ public override async Task Nav_rewrite_with_convert1(bool async) FROM [LocustHordes] AS [l] LEFT JOIN [Cities] AS [c] ON [l].[CapitalName] = [c].[Name] LEFT JOIN [LocustCommanders] AS [l0] ON [l].[CommanderName] = [l0].[Name] -WHERE [c].[Name] <> N'Foo' OR ([c].[Name] IS NULL) +WHERE [c].[Name] <> N'Foo' OR [c].[Name] IS NULL """); } @@ -8840,7 +8828,7 @@ public override async Task Nav_rewrite_with_convert2(bool async) FROM [LocustHordes] AS [l] LEFT JOIN [Cities] AS [c] ON [l].[CapitalName] = [c].[Name] LEFT JOIN [LocustCommanders] AS [l0] ON [l].[CommanderName] = [l0].[Name] -WHERE ([c].[Name] <> N'Foo' OR ([c].[Name] IS NULL)) AND ([l0].[Name] <> N'Bar' OR ([l0].[Name] IS NULL)) +WHERE ([c].[Name] <> N'Foo' OR [c].[Name] IS NULL) AND ([l0].[Name] <> N'Bar' OR [l0].[Name] IS NULL) """); } @@ -8854,7 +8842,7 @@ public override async Task Nav_rewrite_with_convert3(bool async) FROM [LocustHordes] AS [l] LEFT JOIN [Cities] AS [c] ON [l].[CapitalName] = [c].[Name] LEFT JOIN [LocustCommanders] AS [l0] ON [l].[CommanderName] = [l0].[Name] -WHERE ([c].[Name] <> N'Foo' OR ([c].[Name] IS NULL)) AND ([l0].[Name] <> N'Bar' OR ([l0].[Name] IS NULL)) +WHERE ([c].[Name] <> N'Foo' OR [c].[Name] IS NULL) AND ([l0].[Name] <> N'Bar' OR [l0].[Name] IS NULL) """); } @@ -8906,7 +8894,7 @@ FROM [Officers] AS [o] ORDER BY ( SELECT TOP(1) [w].[Name] FROM [Weapons] AS [w] - WHERE [t].[FullName] = [w].[OwnerFullName] AND ([w].[Name] LIKE N'%Gnasher%')), [t].[Nickname], [t].[SquadId] + WHERE [t].[FullName] = [w].[OwnerFullName] AND [w].[Name] LIKE N'%Gnasher%'), [t].[Nickname], [t].[SquadId] """); } @@ -9025,7 +9013,7 @@ public override async Task Left_join_projection_using_conditional_tracking(bool AssertSql( """ SELECT CASE - WHEN ([t0].[Nickname] IS NULL) OR ([t0].[SquadId] IS NULL) THEN CAST(1 AS bit) + WHEN [t0].[Nickname] IS NULL OR [t0].[SquadId] IS NULL THEN CAST(1 AS bit) ELSE CAST(0 AS bit) END, [t].[Nickname], [t].[SquadId], [t].[AssignedCityName], [t].[CityOfBirthName], [t].[FullName], [t].[HasSoulPatch], [t].[LeaderNickname], [t].[LeaderSquadId], [t].[Rank], [t].[Discriminator], [t0].[Nickname], [t0].[SquadId], [t0].[AssignedCityName], [t0].[CityOfBirthName], [t0].[FullName], [t0].[HasSoulPatch], [t0].[LeaderNickname], [t0].[LeaderSquadId], [t0].[Rank], [t0].[Discriminator] FROM ( @@ -9073,7 +9061,7 @@ FROM [Officers] AS [o0] ) AS [t3] ) AS [t2] WHERE [t2].[row] <= 50 -) AS [t1] ON ([t0].[Nickname] = [t1].[LeaderNickname] OR (([t0].[Nickname] IS NULL) AND ([t1].[LeaderNickname] IS NULL))) AND [t0].[SquadId] = [t1].[LeaderSquadId] +) AS [t1] ON ([t0].[Nickname] = [t1].[LeaderNickname] OR ([t0].[Nickname] IS NULL AND [t1].[LeaderNickname] IS NULL)) AND [t0].[SquadId] = [t1].[LeaderSquadId] WHERE [t0].[Discriminator] = N'Officer' ORDER BY [t].[Id], [t0].[Nickname], [t0].[SquadId], [t1].[Nickname] """); @@ -9100,7 +9088,7 @@ FROM [Gears] AS [g0] UNION ALL SELECT [o0].[Nickname], [o0].[SquadId], [o0].[AssignedCityName], [o0].[CityOfBirthName], [o0].[FullName], [o0].[HasSoulPatch], [o0].[LeaderNickname], [o0].[LeaderSquadId], [o0].[Rank], N'Officer' AS [Discriminator] FROM [Officers] AS [o0] -) AS [t1] ON ([t0].[Nickname] = [t1].[LeaderNickname] OR (([t0].[Nickname] IS NULL) AND ([t1].[LeaderNickname] IS NULL))) AND [t0].[SquadId] = [t1].[LeaderSquadId] +) AS [t1] ON ([t0].[Nickname] = [t1].[LeaderNickname] OR ([t0].[Nickname] IS NULL AND [t1].[LeaderNickname] IS NULL)) AND [t0].[SquadId] = [t1].[LeaderSquadId] WHERE [t0].[Discriminator] = N'Officer' ORDER BY [t].[Id], [t0].[Nickname], [t0].[SquadId], [t1].[Nickname] """); @@ -9120,7 +9108,7 @@ FROM [Gears] AS [g] UNION ALL SELECT [o].[Nickname], [o].[SquadId], [o].[AssignedCityName], [o].[CityOfBirthName], [o].[FullName], [o].[HasSoulPatch], [o].[LeaderNickname], [o].[LeaderSquadId], [o].[Rank], N'Officer' AS [Discriminator] FROM [Officers] AS [o] -) AS [t0] ON [t].[GearNickName] = [t0].[Nickname] AND [t].[GearSquadId] = [t0].[SquadId] AND ([t].[Note] IS NOT NULL) +) AS [t0] ON [t].[GearNickName] = [t0].[Nickname] AND [t].[GearSquadId] = [t0].[SquadId] AND [t].[Note] IS NOT NULL ORDER BY [t].[Id], [t0].[Nickname] """); } @@ -9277,7 +9265,7 @@ public override async Task Navigation_based_on_complex_expression6(bool async) AssertSql( """ SELECT CASE - WHEN [l0].[Name] = N'Queen Myrrah' AND ([l0].[Name] IS NOT NULL) THEN CAST(1 AS bit) + WHEN [l0].[Name] = N'Queen Myrrah' AND [l0].[Name] IS NOT NULL THEN CAST(1 AS bit) ELSE CAST(0 AS bit) END, [l0].[Name], [l0].[LocustHordeId], [l0].[ThreatLevel], [l0].[ThreatLevelByte], [l0].[ThreatLevelNullableByte], [l0].[DefeatedByNickname], [l0].[DefeatedBySquadId], [l0].[HighCommandId], [t].[Name], [t].[LocustHordeId], [t].[ThreatLevel], [t].[ThreatLevelByte], [t].[ThreatLevelNullableByte], [t].[DefeatedByNickname], [t].[DefeatedBySquadId], [t].[HighCommandId], [t].[Discriminator] FROM [LocustHordes] AS [l] @@ -9343,7 +9331,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 [LocustHordes] AS [l] @@ -9400,7 +9388,7 @@ public override async Task Accessing_property_of_optional_navigation_in_child_pr AssertSql( """ SELECT CASE - WHEN ([t0].[Nickname] IS NOT NULL) AND ([t0].[SquadId] IS NOT NULL) THEN CAST(1 AS bit) + WHEN [t0].[Nickname] IS NOT NULL AND [t0].[SquadId] IS NOT NULL THEN CAST(1 AS bit) ELSE CAST(0 AS bit) END, [t].[Id], [t0].[Nickname], [t0].[SquadId], [t1].[Nickname], [t1].[Id], [t1].[SquadId] FROM [Tags] AS [t] @@ -9866,7 +9854,7 @@ UNION ALL SELECT [o].[Nickname], [o].[SquadId], [o].[AssignedCityName], [o].[CityOfBirthName], [o].[FullName], [o].[HasSoulPatch], [o].[LeaderNickname], [o].[LeaderSquadId], [o].[Rank], N'Officer' AS [Discriminator] FROM [Officers] AS [o] ) AS [t] -WHERE ([t].[Rank] & @__rank_0) = @__rank_0 +WHERE [t].[Rank] & @__rank_0 = @__rank_0 """, // """ @@ -9891,7 +9879,7 @@ UNION ALL SELECT [o].[Nickname], [o].[SquadId], [o].[AssignedCityName], [o].[CityOfBirthName], [o].[FullName], [o].[HasSoulPatch], [o].[LeaderNickname], [o].[LeaderSquadId], [o].[Rank], N'Officer' AS [Discriminator] FROM [Officers] AS [o] ) AS [t] -WHERE ([t].[Rank] | @__rank_0) <> @__rank_0 +WHERE [t].[Rank] | @__rank_0 <> @__rank_0 """, // """ @@ -9926,7 +9914,7 @@ UNION ALL FROM [Officers] AS [o] ) AS [t] INNER JOIN [Cities] AS [c0] ON [t].[CityOfBirthName] = [c0].[Name] - ORDER BY [t].[Nickname]) OR (([c].[Name] IS NULL) AND (( + ORDER BY [t].[Nickname]) OR ([c].[Name] IS NULL AND ( SELECT TOP(1) [c0].[Name] FROM ( SELECT [g].[Nickname], [g].[SquadId], [g].[AssignedCityName], [g].[CityOfBirthName], [g].[FullName], [g].[HasSoulPatch], [g].[LeaderNickname], [g].[LeaderSquadId], [g].[Rank], N'Gear' AS [Discriminator] @@ -9936,7 +9924,7 @@ UNION ALL FROM [Officers] AS [o] ) AS [t] INNER JOIN [Cities] AS [c0] ON [t].[CityOfBirthName] = [c0].[Name] - ORDER BY [t].[Nickname]) IS NULL)) + ORDER BY [t].[Nickname]) IS NULL) """); } @@ -9956,14 +9944,14 @@ UNION ALL SELECT [o].[Nickname], [o].[SquadId], [o].[AssignedCityName], [o].[CityOfBirthName], [o].[FullName], [o].[HasSoulPatch], [o].[LeaderNickname], [o].[LeaderSquadId], [o].[Rank], N'Officer' AS [Discriminator] FROM [Officers] AS [o] ) AS [t] -WHERE ([t].[Rank] & @__ranks_0) <> 0 +WHERE [t].[Rank] & @__ranks_0 <> 0 """, // """ @__ranks_0='134' SELECT CASE - WHEN ([t].[Rank] | @__ranks_0) = @__ranks_0 THEN CAST(1 AS bit) + WHEN [t].[Rank] | @__ranks_0 = @__ranks_0 THEN CAST(1 AS bit) ELSE CAST(0 AS bit) END FROM ( @@ -9979,7 +9967,7 @@ FROM [Officers] AS [o] @__ranks_0='134' SELECT CASE - WHEN ([t].[Rank] | ([t].[Rank] | (@__ranks_0 | ([t].[Rank] | @__ranks_0)))) = @__ranks_0 THEN CAST(1 AS bit) + WHEN [t].[Rank] | [t].[Rank] | @__ranks_0 | [t].[Rank] | @__ranks_0 = @__ranks_0 THEN CAST(1 AS bit) ELSE CAST(0 AS bit) END FROM ( @@ -10025,7 +10013,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 """, // """ @@ -10033,7 +10021,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) = @__prm_0 +WHERE [w].[AmmunitionType] & @__prm_0 = @__prm_0 """); } @@ -10103,10 +10091,10 @@ FROM [LocustCommanders] AS [l1] WHERE CASE WHEN [l].[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 [l].[Name] = N'Locust' THEN CAST(1 AS bit) ELSE NULL -END IS NULL) +END IS NULL """); } @@ -10233,10 +10221,10 @@ WHERE CASE WHEN ( SELECT TOP(1) [w].[Name] FROM [Weapons] AS [w] - WHERE [w].[Id] = [t].[SquadId]) = @__prm2_1 AND (( + WHERE [w].[Id] = [t].[SquadId]) = @__prm2_1 AND ( SELECT TOP(1) [w].[Name] FROM [Weapons] AS [w] - WHERE [w].[Id] = [t].[SquadId]) IS NOT NULL) THEN CAST(1 AS bit) + WHERE [w].[Id] = [t].[SquadId]) IS NOT NULL THEN CAST(1 AS bit) ELSE CAST(0 AS bit) END ELSE CAST(0 AS bit) @@ -10401,7 +10389,7 @@ UNION ALL SELECT [l0].[Name], [l0].[LocustHordeId], [l0].[ThreatLevel], [l0].[ThreatLevelByte], [l0].[ThreatLevelNullableByte], [l0].[DefeatedByNickname], [l0].[DefeatedBySquadId], [l0].[HighCommandId], N'LocustCommander' AS [Discriminator] FROM [LocustCommanders] AS [l0] ) AS [t] -WHERE CAST([t].[ThreatLevel] AS bigint) >= (CAST(5 AS bigint) + CAST([t].[ThreatLevel] AS bigint)) +WHERE CAST([t].[ThreatLevel] AS bigint) >= CAST(5 AS bigint) + CAST([t].[ThreatLevel] AS bigint) """); } @@ -10547,7 +10535,7 @@ UNION ALL SELECT [l2].[Name], [l2].[LocustHordeId], [l2].[ThreatLevel], [l2].[ThreatLevelByte], [l2].[ThreatLevelNullableByte], [l2].[DefeatedByNickname], [l2].[DefeatedBySquadId], [l2].[HighCommandId], N'LocustCommander' AS [Discriminator] FROM [LocustCommanders] AS [l2] ) AS [t0] - WHERE [t0].[ThreatLevelNullableByte] = [t].[ThreatLevelNullableByte] OR (([t0].[ThreatLevelNullableByte] IS NULL) AND ([t].[ThreatLevelNullableByte] IS NULL))) + WHERE [t0].[ThreatLevelNullableByte] = [t].[ThreatLevelNullableByte] OR ([t0].[ThreatLevelNullableByte] IS NULL AND [t].[ThreatLevelNullableByte] IS NULL)) """); } @@ -10732,7 +10720,7 @@ UNION ALL SELECT [l2].[Name], [l2].[LocustHordeId], [l2].[ThreatLevel], [l2].[ThreatLevelByte], [l2].[ThreatLevelNullableByte], [l2].[DefeatedByNickname], [l2].[DefeatedBySquadId], [l2].[HighCommandId], N'LocustCommander' AS [Discriminator] FROM [LocustCommanders] AS [l2] ) AS [t2] - WHERE [t2].[ThreatLevelNullableByte] = [t].[ThreatLevelNullableByte] OR (([t2].[ThreatLevelNullableByte] IS NULL) AND ([t].[ThreatLevelNullableByte] IS NULL))) + WHERE [t2].[ThreatLevelNullableByte] = [t].[ThreatLevelNullableByte] OR ([t2].[ThreatLevelNullableByte] IS NULL AND [t].[ThreatLevelNullableByte] IS NULL)) ) AS [t1] """); } @@ -10769,7 +10757,7 @@ UNION ALL SELECT [l2].[Name], [l2].[LocustHordeId], [l2].[ThreatLevel], [l2].[ThreatLevelByte], [l2].[ThreatLevelNullableByte], [l2].[DefeatedByNickname], [l2].[DefeatedBySquadId], [l2].[HighCommandId], N'LocustCommander' AS [Discriminator] FROM [LocustCommanders] AS [l2] ) AS [t2] - WHERE [t2].[ThreatLevelNullableByte] = [t].[ThreatLevelNullableByte] OR (([t2].[ThreatLevelNullableByte] IS NULL) AND ([t].[ThreatLevelNullableByte] IS NULL)))) + WHERE [t2].[ThreatLevelNullableByte] = [t].[ThreatLevelNullableByte] OR ([t2].[ThreatLevelNullableByte] IS NULL AND [t].[ThreatLevelNullableByte] IS NULL))) ) AS [t1] """); } @@ -10804,7 +10792,7 @@ UNION ALL SELECT [o].[Nickname], [o].[SquadId], [o].[AssignedCityName], [o].[CityOfBirthName], [o].[FullName], [o].[HasSoulPatch], [o].[LeaderNickname], [o].[LeaderSquadId], [o].[Rank], N'Officer' AS [Discriminator] FROM [Officers] AS [o] ) AS [t] -WHERE (@__prm_0 & [t].[Rank]) = [t].[Rank] +WHERE @__prm_0 & [t].[Rank] = [t].[Rank] """); } @@ -10824,7 +10812,7 @@ UNION ALL SELECT [o].[Nickname], [o].[SquadId], [o].[AssignedCityName], [o].[CityOfBirthName], [o].[FullName], [o].[HasSoulPatch], [o].[LeaderNickname], [o].[LeaderSquadId], [o].[Rank], N'Officer' AS [Discriminator] FROM [Officers] AS [o] ) AS [t] -WHERE (@__prm_0 & CAST([t].[Rank] AS int)) = CAST([t].[Rank] AS int) +WHERE @__prm_0 & CAST([t].[Rank] AS int) = CAST([t].[Rank] AS int) """); } @@ -10857,7 +10845,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) """); } @@ -10935,7 +10923,7 @@ UNION ALL SELECT [o].[Nickname], [o].[SquadId], [o].[AssignedCityName], [o].[CityOfBirthName], [o].[FullName], [o].[HasSoulPatch], [o].[LeaderNickname], [o].[LeaderSquadId], [o].[Rank], N'Officer' AS [Discriminator] FROM [Officers] AS [o] ) AS [t] -INNER JOIN [Weapons] AS [w] ON [t].[FullName] <> [w].[OwnerFullName] OR ([w].[OwnerFullName] IS NULL) +INNER JOIN [Weapons] AS [w] ON [t].[FullName] <> [w].[OwnerFullName] OR [w].[OwnerFullName] IS NULL ORDER BY [t].[Nickname], [w].[Id] """); } @@ -10954,7 +10942,7 @@ UNION ALL SELECT [o].[Nickname], [o].[SquadId], [o].[AssignedCityName], [o].[CityOfBirthName], [o].[FullName], [o].[HasSoulPatch], [o].[LeaderNickname], [o].[LeaderSquadId], [o].[Rank], N'Officer' AS [Discriminator] FROM [Officers] AS [o] ) AS [t] -LEFT JOIN [Weapons] AS [w] ON [t].[FullName] <> [w].[OwnerFullName] OR ([w].[OwnerFullName] IS NULL) +LEFT JOIN [Weapons] AS [w] ON [t].[FullName] <> [w].[OwnerFullName] OR [w].[OwnerFullName] IS NULL ORDER BY [t].[Nickname], [w].[Id] """); } @@ -10978,7 +10966,7 @@ LEFT JOIN ( SELECT [w0].[Id], [w0].[AmmunitionType], [w0].[IsAutomatic], [w0].[Name], [w0].[OwnerFullName], [w0].[SynergyWithId] FROM [Weapons] AS [w] LEFT JOIN [Weapons] AS [w0] ON [w].[SynergyWithId] = [w0].[Id] -) AS [t0] ON [t].[FullName] <> [t0].[OwnerFullName] OR ([t0].[OwnerFullName] IS NULL) +) AS [t0] ON [t].[FullName] <> [t0].[OwnerFullName] OR [t0].[OwnerFullName] IS NULL ORDER BY [t].[Nickname], [t0].[Id] """); } @@ -10997,7 +10985,7 @@ UNION ALL SELECT [o].[FullName] FROM [Officers] AS [o] ) AS [t] -LEFT JOIN [Weapons] AS [w] ON [t].[FullName] <> [w].[OwnerFullName] OR ([w].[OwnerFullName] IS NULL) +LEFT JOIN [Weapons] AS [w] ON [t].[FullName] <> [w].[OwnerFullName] OR [w].[OwnerFullName] IS NULL """); } @@ -11075,7 +11063,7 @@ FROM [Officers] AS [o] CROSS APPLY ( SELECT TOP(3) [w].[Id], [w].[AmmunitionType], [w].[IsAutomatic], [w].[Name], [w].[OwnerFullName], [w].[SynergyWithId] FROM [Weapons] AS [w] - WHERE [w].[OwnerFullName] <> [t].[FullName] OR ([w].[OwnerFullName] IS NULL) + WHERE [w].[OwnerFullName] <> [t].[FullName] OR [w].[OwnerFullName] IS NULL ORDER BY [w].[Id] ) AS [t0] ORDER BY [t].[Nickname], [t0].[Id] @@ -11143,7 +11131,7 @@ UNION ALL SELECT [l0].[Name], [l0].[LocustHordeId], [l0].[ThreatLevel], [l0].[ThreatLevelByte], [l0].[ThreatLevelNullableByte], [l0].[DefeatedByNickname], [l0].[DefeatedBySquadId], [l0].[HighCommandId], N'LocustCommander' AS [Discriminator] FROM [LocustCommanders] AS [l0] ) AS [t] -WHERE [t].[Discriminator] = N'LocustCommander' AND ([t].[HighCommandId] <> 0 OR ([t].[HighCommandId] IS NULL)) +WHERE [t].[Discriminator] = N'LocustCommander' AND ([t].[HighCommandId] <> 0 OR [t].[HighCommandId] IS NULL) """, // """ @@ -11155,7 +11143,7 @@ UNION ALL SELECT [l0].[Name], [l0].[LocustHordeId], [l0].[ThreatLevel], [l0].[ThreatLevelByte], [l0].[ThreatLevelNullableByte], [l0].[DefeatedByNickname], [l0].[DefeatedBySquadId], [l0].[HighCommandId], N'LocustCommander' AS [Discriminator] FROM [LocustCommanders] AS [l0] ) AS [t] -WHERE [t].[Discriminator] = N'LocustCommander' AND ([t].[HighCommandId] <> 0 OR ([t].[HighCommandId] IS NULL)) +WHERE [t].[Discriminator] = N'LocustCommander' AND ([t].[HighCommandId] <> 0 OR [t].[HighCommandId] IS NULL) """); } @@ -11317,7 +11305,7 @@ UNION ALL SELECT [o].[Nickname], [o].[SquadId] FROM [Officers] AS [o] ) AS [t0] ON [t].[DefeatedByNickname] = [t0].[Nickname] AND [t].[DefeatedBySquadId] = [t0].[SquadId] -WHERE ([t0].[Nickname] IS NULL) OR ([t0].[SquadId] IS NULL) +WHERE [t0].[Nickname] IS NULL OR [t0].[SquadId] IS NULL """); } @@ -11339,7 +11327,7 @@ UNION ALL SELECT [o].[Nickname], [o].[SquadId] FROM [Officers] AS [o] ) AS [t0] ON [t].[DefeatedByNickname] = [t0].[Nickname] AND [t].[DefeatedBySquadId] = [t0].[SquadId] -WHERE ([t0].[Nickname] IS NOT NULL) AND ([t0].[SquadId] IS NOT NULL) +WHERE [t0].[Nickname] IS NOT NULL AND [t0].[SquadId] IS NOT NULL """); } @@ -11386,10 +11374,10 @@ UNION ALL SELECT [o].[Nickname], [o].[SquadId], [o].[HasSoulPatch] FROM [Officers] AS [o] ) AS [t0] ON [t].[GearNickName] = [t0].[Nickname] AND [t].[GearSquadId] = [t0].[SquadId] -WHERE (CASE +WHERE CASE WHEN [t].[GearNickName] IS NOT NULL THEN [t0].[SquadId] ELSE NULL -END + 1) = 2 +END + 1 = 2 """); } @@ -11425,7 +11413,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 @@ -11593,10 +11581,10 @@ UNION ALL SELECT [o].[Nickname], [o].[SquadId], [o].[HasSoulPatch] FROM [Officers] AS [o] ) AS [t0] ON [t].[GearNickName] = [t0].[Nickname] AND [t].[GearSquadId] = [t0].[SquadId] -WHERE (CASE +WHERE CASE WHEN [t].[GearNickName] IS NOT NULL THEN [t0].[Nickname] ELSE NULL -END IS NOT NULL) AND CASE +END IS NOT NULL AND CASE WHEN [t].[GearNickName] IS NOT NULL THEN [t0].[HasSoulPatch] ELSE NULL END = CAST(0 AS bit) @@ -11619,7 +11607,7 @@ UNION ALL FROM [Officers] AS [o] ) AS [t] LEFT JOIN [Tags] AS [t0] ON [t].[Nickname] = [t0].[GearNickName] AND [t].[SquadId] = [t0].[GearSquadId] -WHERE DATEPART(month, [t0].[IssueDate]) <> 5 OR ([t0].[IssueDate] IS NULL) +WHERE DATEPART(month, [t0].[IssueDate]) <> 5 OR [t0].[IssueDate] IS NULL ORDER BY [t].[Nickname] """); } @@ -11825,7 +11813,7 @@ public override async Task Project_navigation_defined_on_derived_from_entity_wit AssertSql( """ SELECT [t].[Name], [t].[LocustHordeId], [t].[ThreatLevel], [t].[ThreatLevelByte], [t].[ThreatLevelNullableByte], [t].[DefeatedByNickname], [t].[DefeatedBySquadId], [t].[HighCommandId], [t].[Discriminator], [t0].[Nickname], [t0].[SquadId], [t0].[AssignedCityName], [t0].[CityOfBirthName], [t0].[FullName], [t0].[HasSoulPatch], [t0].[LeaderNickname], [t0].[LeaderSquadId], [t0].[Rank], [t0].[Discriminator], CASE - WHEN ([t0].[Nickname] IS NULL) OR ([t0].[SquadId] IS NULL) THEN CAST(1 AS bit) + WHEN [t0].[Nickname] IS NULL OR [t0].[SquadId] IS NULL THEN CAST(1 AS bit) ELSE CAST(0 AS bit) END AS [IsNull], [l].[Id], [l].[CapitalName], [l].[Name], [l].[ServerAddress], [l].[CommanderName], [l].[Eradicated], CASE WHEN [l].[Id] IS NULL THEN CAST(1 AS bit) @@ -12539,7 +12527,7 @@ public override async Task String_concat_nullable_expressions_are_coalesced(bool AssertSql( """ -SELECT (([t].[FullName] + N'') + COALESCE([t].[LeaderNickname], N'')) + N'' +SELECT [t].[FullName] + N'' + COALESCE([t].[LeaderNickname], N'') + N'' FROM ( SELECT [g].[FullName], [g].[LeaderNickname] FROM [Gears] AS [g] diff --git a/test/EFCore.SqlServer.FunctionalTests/Query/TPCManyToManyNoTrackingQuerySqlServerTest.cs b/test/EFCore.SqlServer.FunctionalTests/Query/TPCManyToManyNoTrackingQuerySqlServerTest.cs index 34af34d3af6..6173122c1d1 100644 --- a/test/EFCore.SqlServer.FunctionalTests/Query/TPCManyToManyNoTrackingQuerySqlServerTest.cs +++ b/test/EFCore.SqlServer.FunctionalTests/Query/TPCManyToManyNoTrackingQuerySqlServerTest.cs @@ -47,7 +47,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%') """); } @@ -63,7 +63,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%') """); } @@ -117,7 +117,7 @@ UNION ALL SELECT [l].[Id], [l].[Name], [l].[Number], [l].[IsGreen], N'EntityLeaf' AS [Discriminator] FROM [Leaves] AS [l] ) AS [t] ON [j].[EntityBranchId] = [t].[Id] - WHERE [e].[Id] = [j].[EntityOneId] AND ([t].[Name] IS NOT NULL) AND ([t].[Name] LIKE N'L%')), [e].[Id] + WHERE [e].[Id] = [j].[EntityOneId] AND [t].[Name] IS NOT NULL AND [t].[Name] LIKE N'L%'), [e].[Id] """); } @@ -149,7 +149,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] """); } @@ -2151,7 +2151,7 @@ WHERE EXISTS ( SELECT 1 FROM [UnidirectionalEntityOneUnidirectionalEntityTwo] AS [u0] INNER JOIN [UnidirectionalEntityTwos] AS [u1] ON [u0].[TwoSkipSharedId] = [u1].[Id] - WHERE [u].[Id] = [u0].[UnidirectionalEntityOneId] AND ([u1].[Name] LIKE N'%B%')) + WHERE [u].[Id] = [u0].[UnidirectionalEntityOneId] AND [u1].[Name] LIKE N'%B%') """); } @@ -2205,7 +2205,7 @@ UNION ALL SELECT [u2].[Id], [u2].[Name], [u2].[Number], [u2].[IsGreen], N'UnidirectionalEntityLeaf' AS [Discriminator] FROM [UnidirectionalLeaves] AS [u2] ) AS [t] ON [u0].[UnidirectionalEntityBranchId] = [t].[Id] - WHERE [u].[Id] = [u0].[UnidirectionalEntityOneId] AND ([t].[Name] IS NOT NULL) AND ([t].[Name] LIKE N'L%')), [u].[Id] + WHERE [u].[Id] = [u0].[UnidirectionalEntityOneId] AND [t].[Name] IS NOT NULL AND [t].[Name] LIKE N'L%'), [u].[Id] """); } diff --git a/test/EFCore.SqlServer.FunctionalTests/Query/TPCManyToManyQuerySqlServerTest.cs b/test/EFCore.SqlServer.FunctionalTests/Query/TPCManyToManyQuerySqlServerTest.cs index 89104f9f9a5..f3dc0fbb67c 100644 --- a/test/EFCore.SqlServer.FunctionalTests/Query/TPCManyToManyQuerySqlServerTest.cs +++ b/test/EFCore.SqlServer.FunctionalTests/Query/TPCManyToManyQuerySqlServerTest.cs @@ -47,7 +47,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%') """); } @@ -63,7 +63,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%') """); } @@ -117,7 +117,7 @@ UNION ALL SELECT [l].[Id], [l].[Name], [l].[Number], [l].[IsGreen], N'EntityLeaf' AS [Discriminator] FROM [Leaves] AS [l] ) AS [t] ON [j].[EntityBranchId] = [t].[Id] - WHERE [e].[Id] = [j].[EntityOneId] AND ([t].[Name] IS NOT NULL) AND ([t].[Name] LIKE N'L%')), [e].[Id] + WHERE [e].[Id] = [j].[EntityOneId] AND [t].[Name] IS NOT NULL AND [t].[Name] LIKE N'L%'), [e].[Id] """); } @@ -149,7 +149,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] """); } @@ -2152,7 +2152,7 @@ WHERE EXISTS ( SELECT 1 FROM [UnidirectionalEntityOneUnidirectionalEntityTwo] AS [u0] INNER JOIN [UnidirectionalEntityTwos] AS [u1] ON [u0].[TwoSkipSharedId] = [u1].[Id] - WHERE [u].[Id] = [u0].[UnidirectionalEntityOneId] AND ([u1].[Name] LIKE N'%B%')) + WHERE [u].[Id] = [u0].[UnidirectionalEntityOneId] AND [u1].[Name] LIKE N'%B%') """); } @@ -2206,7 +2206,7 @@ UNION ALL SELECT [u2].[Id], [u2].[Name], [u2].[Number], [u2].[IsGreen], N'UnidirectionalEntityLeaf' AS [Discriminator] FROM [UnidirectionalLeaves] AS [u2] ) AS [t] ON [u0].[UnidirectionalEntityBranchId] = [t].[Id] - WHERE [u].[Id] = [u0].[UnidirectionalEntityOneId] AND ([t].[Name] IS NOT NULL) AND ([t].[Name] LIKE N'L%')), [u].[Id] + WHERE [u].[Id] = [u0].[UnidirectionalEntityOneId] AND [t].[Name] IS NOT NULL AND [t].[Name] LIKE N'L%'), [u].[Id] """); } diff --git a/test/EFCore.SqlServer.FunctionalTests/Query/TPCRelationshipsQuerySqlServerTest.cs b/test/EFCore.SqlServer.FunctionalTests/Query/TPCRelationshipsQuerySqlServerTest.cs index 328589b9d75..8e9d4df58ac 100644 --- a/test/EFCore.SqlServer.FunctionalTests/Query/TPCRelationshipsQuerySqlServerTest.cs +++ b/test/EFCore.SqlServer.FunctionalTests/Query/TPCRelationshipsQuerySqlServerTest.cs @@ -117,7 +117,7 @@ FROM [DerivedEntities] AS [d1] LEFT JOIN [OwnedCollections] AS [o0] ON [t].[Id] = [o0].[BaseInheritanceRelationshipEntityId] LEFT JOIN [DerivedEntities_OwnedCollectionOnDerived] AS [d0] ON [t].[Id] = [d0].[DerivedInheritanceRelationshipEntityId] LEFT JOIN [CollectionsOnBase] AS [c] ON [t].[Id] = [c].[ParentId] -WHERE [t].[Name] <> N'Bar' OR ([t].[Name] IS NULL) +WHERE [t].[Name] <> N'Bar' OR [t].[Name] IS NULL ORDER BY [t].[Id], [o].[BaseInheritanceRelationshipEntityId], [d].[Id], [o0].[BaseInheritanceRelationshipEntityId], [o0].[Id], [d0].[DerivedInheritanceRelationshipEntityId], [d0].[Id] """); } @@ -141,7 +141,7 @@ FROM [DerivedEntities] AS [d1] LEFT JOIN [DerivedEntities] AS [d] ON [t].[Id] = [d].[Id] LEFT JOIN [OwnedCollections] AS [o0] ON [t].[Id] = [o0].[BaseInheritanceRelationshipEntityId] LEFT JOIN [DerivedEntities_OwnedCollectionOnDerived] AS [d0] ON [t].[Id] = [d0].[DerivedInheritanceRelationshipEntityId] -WHERE [c].[Name] <> N'Bar' OR ([c].[Name] IS NULL) +WHERE [c].[Name] <> N'Bar' OR [c].[Name] IS NULL ORDER BY [c].[Id], [t].[Id], [o].[BaseInheritanceRelationshipEntityId], [d].[Id], [o0].[BaseInheritanceRelationshipEntityId], [o0].[Id], [d0].[DerivedInheritanceRelationshipEntityId] """); } @@ -311,7 +311,7 @@ UNION ALL SELECT [d2].[Id], [d2].[BaseParentId], [d2].[Name], [d2].[DerivedProperty], N'DerivedCollectionOnBase' AS [Discriminator] FROM [DerivedCollectionsOnBase] AS [d2] ) AS [t0] ON [t].[Id] = [t0].[BaseParentId] -WHERE [t].[Name] <> N'Bar' OR ([t].[Name] IS NULL) +WHERE [t].[Name] <> N'Bar' OR [t].[Name] IS NULL ORDER BY [t].[Id], [o].[BaseInheritanceRelationshipEntityId], [d].[Id], [o0].[BaseInheritanceRelationshipEntityId], [o0].[Id], [d0].[DerivedInheritanceRelationshipEntityId], [d0].[Id] """); } @@ -341,7 +341,7 @@ FROM [DerivedEntities] AS [d2] LEFT JOIN [DerivedEntities] AS [d] ON [t0].[Id] = [d].[Id] LEFT JOIN [OwnedCollections] AS [o0] ON [t0].[Id] = [o0].[BaseInheritanceRelationshipEntityId] LEFT JOIN [DerivedEntities_OwnedCollectionOnDerived] AS [d0] ON [t0].[Id] = [d0].[DerivedInheritanceRelationshipEntityId] -WHERE [t].[Name] <> N'Bar' OR ([t].[Name] IS NULL) +WHERE [t].[Name] <> N'Bar' OR [t].[Name] IS NULL ORDER BY [t].[Id], [t0].[Id], [o].[BaseInheritanceRelationshipEntityId], [d].[Id], [o0].[BaseInheritanceRelationshipEntityId], [o0].[Id], [d0].[DerivedInheritanceRelationshipEntityId] """); } @@ -459,7 +459,7 @@ FROM [DerivedEntities] AS [d1] LEFT JOIN [DerivedEntities] AS [d] ON [t].[Id] = [d].[Id] LEFT JOIN [OwnedCollections] AS [o0] ON [t].[Id] = [o0].[BaseInheritanceRelationshipEntityId] LEFT JOIN [DerivedEntities_OwnedCollectionOnDerived] AS [d0] ON [t].[Id] = [d0].[DerivedInheritanceRelationshipEntityId] -WHERE [t].[Name] <> N'Bar' OR ([t].[Name] IS NULL) +WHERE [t].[Name] <> N'Bar' OR [t].[Name] IS NULL ORDER BY [t].[Id], [r].[Id], [o].[BaseInheritanceRelationshipEntityId], [d].[Id], [o0].[BaseInheritanceRelationshipEntityId], [o0].[Id], [d0].[DerivedInheritanceRelationshipEntityId] """); } @@ -483,7 +483,7 @@ FROM [DerivedEntities] AS [d1] LEFT JOIN [DerivedEntities] AS [d] ON [t].[Id] = [d].[Id] LEFT JOIN [OwnedCollections] AS [o0] ON [t].[Id] = [o0].[BaseInheritanceRelationshipEntityId] LEFT JOIN [DerivedEntities_OwnedCollectionOnDerived] AS [d0] ON [t].[Id] = [d0].[DerivedInheritanceRelationshipEntityId] -WHERE [r].[Name] <> N'Bar' OR ([r].[Name] IS NULL) +WHERE [r].[Name] <> N'Bar' OR [r].[Name] IS NULL ORDER BY [r].[Id], [t].[Id], [o].[BaseInheritanceRelationshipEntityId], [d].[Id], [o0].[BaseInheritanceRelationshipEntityId], [o0].[Id], [d0].[DerivedInheritanceRelationshipEntityId] """); } @@ -617,7 +617,7 @@ FROM [DerivedReferencesOnBase] AS [d1] LEFT JOIN [OwnedReferences] AS [o] ON [d].[Id] = [o].[BaseInheritanceRelationshipEntityId] LEFT JOIN [OwnedCollections] AS [o0] ON [d].[Id] = [o0].[BaseInheritanceRelationshipEntityId] LEFT JOIN [DerivedEntities_OwnedCollectionOnDerived] AS [d0] ON [d].[Id] = [d0].[DerivedInheritanceRelationshipEntityId] -WHERE [d].[Name] <> N'Bar' OR ([d].[Name] IS NULL) +WHERE [d].[Name] <> N'Bar' OR [d].[Name] IS NULL ORDER BY [d].[Id], [t].[Id], [o].[BaseInheritanceRelationshipEntityId], [o0].[BaseInheritanceRelationshipEntityId], [o0].[Id], [d0].[DerivedInheritanceRelationshipEntityId] """); } @@ -640,7 +640,7 @@ FROM [DerivedReferencesOnDerived] AS [d1] LEFT JOIN [OwnedReferences] AS [o] ON [d].[Id] = [o].[BaseInheritanceRelationshipEntityId] LEFT JOIN [OwnedCollections] AS [o0] ON [d].[Id] = [o0].[BaseInheritanceRelationshipEntityId] LEFT JOIN [DerivedEntities_OwnedCollectionOnDerived] AS [d0] ON [d].[Id] = [d0].[DerivedInheritanceRelationshipEntityId] -WHERE [d].[Name] <> N'Bar' OR ([d].[Name] IS NULL) +WHERE [d].[Name] <> N'Bar' OR [d].[Name] IS NULL ORDER BY [d].[Id], [t].[Id], [o].[BaseInheritanceRelationshipEntityId], [o0].[BaseInheritanceRelationshipEntityId], [o0].[Id], [d0].[DerivedInheritanceRelationshipEntityId] """); } @@ -657,7 +657,7 @@ FROM [DerivedEntities] AS [d] LEFT JOIN [OwnedReferences] AS [o] ON [d].[Id] = [o].[BaseInheritanceRelationshipEntityId] LEFT JOIN [OwnedCollections] AS [o0] ON [d].[Id] = [o0].[BaseInheritanceRelationshipEntityId] LEFT JOIN [DerivedEntities_OwnedCollectionOnDerived] AS [d1] ON [d].[Id] = [d1].[DerivedInheritanceRelationshipEntityId] -WHERE [d].[Name] <> N'Bar' OR ([d].[Name] IS NULL) +WHERE [d].[Name] <> N'Bar' OR [d].[Name] IS NULL ORDER BY [d].[Id], [d0].[Id], [o].[BaseInheritanceRelationshipEntityId], [o0].[BaseInheritanceRelationshipEntityId], [o0].[Id], [d1].[DerivedInheritanceRelationshipEntityId] """); } @@ -680,7 +680,7 @@ FROM [DerivedReferencesOnDerived] AS [d1] LEFT JOIN [OwnedReferences] AS [o] ON [d].[Id] = [o].[BaseInheritanceRelationshipEntityId] LEFT JOIN [OwnedCollections] AS [o0] ON [d].[Id] = [o0].[BaseInheritanceRelationshipEntityId] LEFT JOIN [DerivedEntities_OwnedCollectionOnDerived] AS [d0] ON [d].[Id] = [d0].[DerivedInheritanceRelationshipEntityId] -WHERE [t].[Name] <> N'Bar' OR ([t].[Name] IS NULL) +WHERE [t].[Name] <> N'Bar' OR [t].[Name] IS NULL ORDER BY [t].[Id], [d].[Id], [o].[BaseInheritanceRelationshipEntityId], [o0].[BaseInheritanceRelationshipEntityId], [o0].[Id], [d0].[DerivedInheritanceRelationshipEntityId] """); } @@ -739,7 +739,7 @@ FROM [DerivedReferencesOnBase] AS [d2] LEFT JOIN [DerivedEntities] AS [d] ON [t].[Id] = [d].[Id] LEFT JOIN [OwnedCollections] AS [o0] ON [t].[Id] = [o0].[BaseInheritanceRelationshipEntityId] LEFT JOIN [DerivedEntities_OwnedCollectionOnDerived] AS [d0] ON [t].[Id] = [d0].[DerivedInheritanceRelationshipEntityId] -WHERE [t].[Name] <> N'Bar' OR ([t].[Name] IS NULL) +WHERE [t].[Name] <> N'Bar' OR [t].[Name] IS NULL ORDER BY [t].[Id], [t0].[Id], [o].[BaseInheritanceRelationshipEntityId], [d].[Id], [o0].[BaseInheritanceRelationshipEntityId], [o0].[Id], [d0].[DerivedInheritanceRelationshipEntityId] """); } @@ -769,7 +769,7 @@ FROM [DerivedEntities] AS [d2] LEFT JOIN [DerivedEntities] AS [d] ON [t0].[Id] = [d].[Id] LEFT JOIN [OwnedCollections] AS [o0] ON [t0].[Id] = [o0].[BaseInheritanceRelationshipEntityId] LEFT JOIN [DerivedEntities_OwnedCollectionOnDerived] AS [d0] ON [t0].[Id] = [d0].[DerivedInheritanceRelationshipEntityId] -WHERE [t].[Name] <> N'Bar' OR ([t].[Name] IS NULL) +WHERE [t].[Name] <> N'Bar' OR [t].[Name] IS NULL ORDER BY [t].[Id], [t0].[Id], [o].[BaseInheritanceRelationshipEntityId], [d].[Id], [o0].[BaseInheritanceRelationshipEntityId], [o0].[Id], [d0].[DerivedInheritanceRelationshipEntityId] """); } @@ -1402,7 +1402,7 @@ FROM [DerivedEntities] AS [d0] ) AS [t] LEFT JOIN [OwnedReferences] AS [o] ON [t].[Id] = [o].[BaseInheritanceRelationshipEntityId] LEFT JOIN [DerivedEntities] AS [d] ON [t].[Id] = [d].[Id] -WHERE [t].[Name] <> N'Bar' OR ([t].[Name] IS NULL) +WHERE [t].[Name] <> N'Bar' OR [t].[Name] IS NULL ORDER BY [t].[Id], [o].[BaseInheritanceRelationshipEntityId], [d].[Id] """, // @@ -1418,7 +1418,7 @@ FROM [DerivedEntities] AS [d0] LEFT JOIN [OwnedReferences] AS [o] ON [t].[Id] = [o].[BaseInheritanceRelationshipEntityId] LEFT JOIN [DerivedEntities] AS [d] ON [t].[Id] = [d].[Id] INNER JOIN [OwnedCollections] AS [o0] ON [t].[Id] = [o0].[BaseInheritanceRelationshipEntityId] -WHERE [t].[Name] <> N'Bar' OR ([t].[Name] IS NULL) +WHERE [t].[Name] <> N'Bar' OR [t].[Name] IS NULL ORDER BY [t].[Id], [o].[BaseInheritanceRelationshipEntityId], [d].[Id] """, // @@ -1434,7 +1434,7 @@ FROM [DerivedEntities] AS [d1] LEFT JOIN [OwnedReferences] AS [o] ON [t].[Id] = [o].[BaseInheritanceRelationshipEntityId] LEFT JOIN [DerivedEntities] AS [d] ON [t].[Id] = [d].[Id] INNER JOIN [DerivedEntities_OwnedCollectionOnDerived] AS [d0] ON [t].[Id] = [d0].[DerivedInheritanceRelationshipEntityId] -WHERE [t].[Name] <> N'Bar' OR ([t].[Name] IS NULL) +WHERE [t].[Name] <> N'Bar' OR [t].[Name] IS NULL ORDER BY [t].[Id], [o].[BaseInheritanceRelationshipEntityId], [d].[Id] """, // @@ -1456,7 +1456,7 @@ UNION ALL SELECT [d1].[Id], [d1].[BaseParentId], [d1].[Name], [d1].[DerivedProperty], N'DerivedCollectionOnBase' AS [Discriminator] FROM [DerivedCollectionsOnBase] AS [d1] ) AS [t0] ON [t].[Id] = [t0].[BaseParentId] -WHERE [t].[Name] <> N'Bar' OR ([t].[Name] IS NULL) +WHERE [t].[Name] <> N'Bar' OR [t].[Name] IS NULL ORDER BY [t].[Id], [o].[BaseInheritanceRelationshipEntityId], [d].[Id] """); } @@ -1484,7 +1484,7 @@ FROM [DerivedEntities] AS [d1] ) AS [t0] ON [t].[BaseParentId] = [t0].[Id] LEFT JOIN [OwnedReferences] AS [o] ON [t0].[Id] = [o].[BaseInheritanceRelationshipEntityId] LEFT JOIN [DerivedEntities] AS [d] ON [t0].[Id] = [d].[Id] -WHERE [t].[Name] <> N'Bar' OR ([t].[Name] IS NULL) +WHERE [t].[Name] <> N'Bar' OR [t].[Name] IS NULL ORDER BY [t].[Id], [t0].[Id], [o].[BaseInheritanceRelationshipEntityId], [d].[Id] """, // @@ -1507,7 +1507,7 @@ FROM [DerivedEntities] AS [d1] LEFT JOIN [OwnedReferences] AS [o] ON [t0].[Id] = [o].[BaseInheritanceRelationshipEntityId] LEFT JOIN [DerivedEntities] AS [d] ON [t0].[Id] = [d].[Id] INNER JOIN [OwnedCollections] AS [o0] ON [t0].[Id] = [o0].[BaseInheritanceRelationshipEntityId] -WHERE [t].[Name] <> N'Bar' OR ([t].[Name] IS NULL) +WHERE [t].[Name] <> N'Bar' OR [t].[Name] IS NULL ORDER BY [t].[Id], [t0].[Id], [o].[BaseInheritanceRelationshipEntityId], [d].[Id] """, // @@ -1530,7 +1530,7 @@ FROM [DerivedEntities] AS [d2] LEFT JOIN [OwnedReferences] AS [o] ON [t0].[Id] = [o].[BaseInheritanceRelationshipEntityId] LEFT JOIN [DerivedEntities] AS [d] ON [t0].[Id] = [d].[Id] INNER JOIN [DerivedEntities_OwnedCollectionOnDerived] AS [d0] ON [t0].[Id] = [d0].[DerivedInheritanceRelationshipEntityId] -WHERE [t].[Name] <> N'Bar' OR ([t].[Name] IS NULL) +WHERE [t].[Name] <> N'Bar' OR [t].[Name] IS NULL ORDER BY [t].[Id], [t0].[Id], [o].[BaseInheritanceRelationshipEntityId], [d].[Id] """); } @@ -1669,7 +1669,7 @@ FROM [DerivedEntities] AS [d0] ) AS [t] LEFT JOIN [OwnedReferences] AS [o] ON [t].[Id] = [o].[BaseInheritanceRelationshipEntityId] LEFT JOIN [DerivedEntities] AS [d] ON [t].[Id] = [d].[Id] -WHERE [t].[Name] <> N'Bar' OR ([t].[Name] IS NULL) +WHERE [t].[Name] <> N'Bar' OR [t].[Name] IS NULL ORDER BY [t].[Id], [o].[BaseInheritanceRelationshipEntityId], [d].[Id] """, // @@ -1685,7 +1685,7 @@ FROM [DerivedEntities] AS [d0] LEFT JOIN [OwnedReferences] AS [o] ON [t].[Id] = [o].[BaseInheritanceRelationshipEntityId] LEFT JOIN [DerivedEntities] AS [d] ON [t].[Id] = [d].[Id] INNER JOIN [OwnedCollections] AS [o0] ON [t].[Id] = [o0].[BaseInheritanceRelationshipEntityId] -WHERE [t].[Name] <> N'Bar' OR ([t].[Name] IS NULL) +WHERE [t].[Name] <> N'Bar' OR [t].[Name] IS NULL ORDER BY [t].[Id], [o].[BaseInheritanceRelationshipEntityId], [d].[Id] """, // @@ -1701,7 +1701,7 @@ FROM [DerivedEntities] AS [d1] LEFT JOIN [OwnedReferences] AS [o] ON [t].[Id] = [o].[BaseInheritanceRelationshipEntityId] LEFT JOIN [DerivedEntities] AS [d] ON [t].[Id] = [d].[Id] INNER JOIN [DerivedEntities_OwnedCollectionOnDerived] AS [d0] ON [t].[Id] = [d0].[DerivedInheritanceRelationshipEntityId] -WHERE [t].[Name] <> N'Bar' OR ([t].[Name] IS NULL) +WHERE [t].[Name] <> N'Bar' OR [t].[Name] IS NULL ORDER BY [t].[Id], [o].[BaseInheritanceRelationshipEntityId], [d].[Id] """, // @@ -1717,7 +1717,7 @@ FROM [DerivedEntities] AS [d0] LEFT JOIN [OwnedReferences] AS [o] ON [t].[Id] = [o].[BaseInheritanceRelationshipEntityId] LEFT JOIN [DerivedEntities] AS [d] ON [t].[Id] = [d].[Id] INNER JOIN [CollectionsOnBase] AS [c] ON [t].[Id] = [c].[ParentId] -WHERE [t].[Name] <> N'Bar' OR ([t].[Name] IS NULL) +WHERE [t].[Name] <> N'Bar' OR [t].[Name] IS NULL ORDER BY [t].[Id], [o].[BaseInheritanceRelationshipEntityId], [d].[Id] """); } @@ -1739,7 +1739,7 @@ FROM [DerivedEntities] AS [d0] ) AS [t] ON [c].[ParentId] = [t].[Id] LEFT JOIN [OwnedReferences] AS [o] ON [t].[Id] = [o].[BaseInheritanceRelationshipEntityId] LEFT JOIN [DerivedEntities] AS [d] ON [t].[Id] = [d].[Id] -WHERE [c].[Name] <> N'Bar' OR ([c].[Name] IS NULL) +WHERE [c].[Name] <> N'Bar' OR [c].[Name] IS NULL ORDER BY [c].[Id], [t].[Id], [o].[BaseInheritanceRelationshipEntityId], [d].[Id] """, // @@ -1756,7 +1756,7 @@ FROM [DerivedEntities] AS [d0] LEFT JOIN [OwnedReferences] AS [o] ON [t].[Id] = [o].[BaseInheritanceRelationshipEntityId] LEFT JOIN [DerivedEntities] AS [d] ON [t].[Id] = [d].[Id] INNER JOIN [OwnedCollections] AS [o0] ON [t].[Id] = [o0].[BaseInheritanceRelationshipEntityId] -WHERE [c].[Name] <> N'Bar' OR ([c].[Name] IS NULL) +WHERE [c].[Name] <> N'Bar' OR [c].[Name] IS NULL ORDER BY [c].[Id], [t].[Id], [o].[BaseInheritanceRelationshipEntityId], [d].[Id] """, // @@ -1773,7 +1773,7 @@ FROM [DerivedEntities] AS [d1] LEFT JOIN [OwnedReferences] AS [o] ON [t].[Id] = [o].[BaseInheritanceRelationshipEntityId] LEFT JOIN [DerivedEntities] AS [d] ON [t].[Id] = [d].[Id] INNER JOIN [DerivedEntities_OwnedCollectionOnDerived] AS [d0] ON [t].[Id] = [d0].[DerivedInheritanceRelationshipEntityId] -WHERE [c].[Name] <> N'Bar' OR ([c].[Name] IS NULL) +WHERE [c].[Name] <> N'Bar' OR [c].[Name] IS NULL ORDER BY [c].[Id], [t].[Id], [o].[BaseInheritanceRelationshipEntityId], [d].[Id] """); } diff --git a/test/EFCore.SqlServer.FunctionalTests/Query/TPTFiltersInheritanceQuerySqlServerTest.cs b/test/EFCore.SqlServer.FunctionalTests/Query/TPTFiltersInheritanceQuerySqlServerTest.cs index b5dd8dff78b..4af39f70b41 100644 --- a/test/EFCore.SqlServer.FunctionalTests/Query/TPTFiltersInheritanceQuerySqlServerTest.cs +++ b/test/EFCore.SqlServer.FunctionalTests/Query/TPTFiltersInheritanceQuerySqlServerTest.cs @@ -51,7 +51,7 @@ FROM [Animals] AS [a] LEFT JOIN [Birds] AS [b] ON [a].[Id] = [b].[Id] LEFT JOIN [Eagle] AS [e] ON [a].[Id] = [e].[Id] LEFT JOIN [Kiwi] AS [k] ON [a].[Id] = [k].[Id] -WHERE [a].[CountryId] = 1 AND ([k].[Id] IS NOT NULL) +WHERE [a].[CountryId] = 1 AND [k].[Id] IS NOT NULL """); } @@ -69,7 +69,7 @@ FROM [Animals] AS [a] LEFT JOIN [Birds] AS [b] ON [a].[Id] = [b].[Id] LEFT JOIN [Eagle] AS [e] ON [a].[Id] = [e].[Id] LEFT JOIN [Kiwi] AS [k] ON [a].[Id] = [k].[Id] -WHERE [a].[CountryId] = 1 AND ([k].[Id] IS NOT NULL) AND [a].[CountryId] = 1 +WHERE [a].[CountryId] = 1 AND [k].[Id] IS NOT NULL AND [a].[CountryId] = 1 """); } @@ -103,7 +103,7 @@ FROM [Animals] AS [a] LEFT JOIN [Birds] AS [b] ON [a].[Id] = [b].[Id] LEFT JOIN [Eagle] AS [e] ON [a].[Id] = [e].[Id] LEFT JOIN [Kiwi] AS [k] ON [a].[Id] = [k].[Id] -WHERE [a].[CountryId] = 1 AND (([k].[Id] IS NOT NULL) OR ([e].[Id] IS NOT NULL)) +WHERE [a].[CountryId] = 1 AND ([k].[Id] IS NOT NULL OR [e].[Id] IS NOT NULL) ORDER BY [a].[Species] """); } @@ -122,7 +122,7 @@ FROM [Animals] AS [a] LEFT JOIN [Birds] AS [b] ON [a].[Id] = [b].[Id] LEFT JOIN [Eagle] AS [e] ON [a].[Id] = [e].[Id] LEFT JOIN [Kiwi] AS [k] ON [a].[Id] = [k].[Id] -WHERE [a].[CountryId] = 1 AND [a].[CountryId] = 1 AND (([k].[Id] IS NOT NULL) OR ([e].[Id] IS NOT NULL)) +WHERE [a].[CountryId] = 1 AND [a].[CountryId] = 1 AND ([k].[Id] IS NOT NULL OR [e].[Id] IS NOT NULL) ORDER BY [a].[Species] """); } @@ -137,7 +137,7 @@ SELECT [a].[Name] FROM [Animals] AS [a] LEFT JOIN [Eagle] AS [e] ON [a].[Id] = [e].[Id] LEFT JOIN [Kiwi] AS [k] ON [a].[Id] = [k].[Id] -WHERE [a].[CountryId] = 1 AND (([k].[Id] IS NOT NULL) OR ([e].[Id] IS NOT NULL)) +WHERE [a].[CountryId] = 1 AND ([k].[Id] IS NOT NULL OR [e].[Id] IS NOT NULL) """); } @@ -155,7 +155,7 @@ FROM [Animals] AS [a] LEFT JOIN [Birds] AS [b] ON [a].[Id] = [b].[Id] LEFT JOIN [Eagle] AS [e] ON [a].[Id] = [e].[Id] LEFT JOIN [Kiwi] AS [k] ON [a].[Id] = [k].[Id] -WHERE [a].[CountryId] = 1 AND (([k].[Id] IS NOT NULL) OR ([e].[Id] IS NOT NULL)) +WHERE [a].[CountryId] = 1 AND ([k].[Id] IS NOT NULL OR [e].[Id] IS NOT NULL) ORDER BY [a].[Species] """); } @@ -172,7 +172,7 @@ END AS [Discriminator] FROM [Animals] AS [a] LEFT JOIN [Birds] AS [b] ON [a].[Id] = [b].[Id] LEFT JOIN [Kiwi] AS [k] ON [a].[Id] = [k].[Id] -WHERE [a].[CountryId] = 1 AND ([k].[Id] IS NOT NULL) +WHERE [a].[CountryId] = 1 AND [k].[Id] IS NOT NULL """); } diff --git a/test/EFCore.SqlServer.FunctionalTests/Query/TPTGearsOfWarQuerySqlServerTest.cs b/test/EFCore.SqlServer.FunctionalTests/Query/TPTGearsOfWarQuerySqlServerTest.cs index 94fc8da2bf6..867ecfd897b 100644 --- a/test/EFCore.SqlServer.FunctionalTests/Query/TPTGearsOfWarQuerySqlServerTest.cs +++ b/test/EFCore.SqlServer.FunctionalTests/Query/TPTGearsOfWarQuerySqlServerTest.cs @@ -47,18 +47,6 @@ FROM [Squads] AS [s] """); } - public override async Task Double_negate_on_column(bool async) - { - await base.Double_negate_on_column(async); - - AssertSql( -""" -SELECT [s].[Id], [s].[Banner], [s].[Banner5], [s].[InternalNumber], [s].[Name] -FROM [Squads] AS [s] -WHERE -(-[s].[Id]) = [s].[Id] -"""); - } - public override async Task Negate_on_like_expression(bool async) { await base.Negate_on_like_expression(async); @@ -67,7 +55,7 @@ public override async Task Negate_on_like_expression(bool async) """ SELECT [s].[Id], [s].[Banner], [s].[Banner5], [s].[InternalNumber], [s].[Name] FROM [Squads] AS [s] -WHERE ([s].[Name] IS NOT NULL) AND NOT ([s].[Name] LIKE N'us%') +WHERE [s].[Name] IS NOT NULL AND NOT ([s].[Name] LIKE N'us%') """); } @@ -343,7 +331,7 @@ WHEN [o].[Nickname] IS NOT NULL THEN N'Officer' FROM [Gears] AS [g] LEFT JOIN [Officers] AS [o] ON [g].[Nickname] = [o].[Nickname] AND [g].[SquadId] = [o].[SquadId] LEFT JOIN [Tags] AS [t] ON [g].[Nickname] = [t].[GearNickName] AND [g].[SquadId] = [t].[GearSquadId] -WHERE ([t].[Id] IS NOT NULL) AND [t].[Id] IN ('34c8d86e-a4ac-4be5-827f-584dda348a07', 'df36f493-463f-4123-83f9-6b135deeb7ba', 'a8ad98f9-e023-4e2a-9a70-c2728455bd34', '70534e05-782c-4052-8720-c2c54481ce5f', 'a7be028a-0cf2-448f-ab55-ce8bc5d8cf69', 'b39a6fba-9026-4d69-828e-fd7068673e57') +WHERE [t].[Id] IS NOT NULL AND [t].[Id] IN ('34c8d86e-a4ac-4be5-827f-584dda348a07', 'df36f493-463f-4123-83f9-6b135deeb7ba', 'a8ad98f9-e023-4e2a-9a70-c2728455bd34', '70534e05-782c-4052-8720-c2c54481ce5f', 'a7be028a-0cf2-448f-ab55-ce8bc5d8cf69', 'b39a6fba-9026-4d69-828e-fd7068673e57') """); } @@ -365,7 +353,7 @@ FROM [Gears] AS [g] LEFT JOIN [Officers] AS [o] ON [g].[Nickname] = [o].[Nickname] AND [g].[SquadId] = [o].[SquadId] INNER JOIN [Cities] AS [c] ON [g].[CityOfBirthName] = [c].[Name] LEFT JOIN [Tags] AS [t] ON [g].[Nickname] = [t].[GearNickName] AND [g].[SquadId] = [t].[GearSquadId] -WHERE ([c].[Location] IS NOT NULL) AND [t].[Id] IN ('34c8d86e-a4ac-4be5-827f-584dda348a07', 'df36f493-463f-4123-83f9-6b135deeb7ba', 'a8ad98f9-e023-4e2a-9a70-c2728455bd34', '70534e05-782c-4052-8720-c2c54481ce5f', 'a7be028a-0cf2-448f-ab55-ce8bc5d8cf69', 'b39a6fba-9026-4d69-828e-fd7068673e57') +WHERE [c].[Location] IS NOT NULL AND [t].[Id] IN ('34c8d86e-a4ac-4be5-827f-584dda348a07', 'df36f493-463f-4123-83f9-6b135deeb7ba', 'a8ad98f9-e023-4e2a-9a70-c2728455bd34', '70534e05-782c-4052-8720-c2c54481ce5f', 'a7be028a-0cf2-448f-ab55-ce8bc5d8cf69', 'b39a6fba-9026-4d69-828e-fd7068673e57') """); } @@ -386,7 +374,7 @@ END AS [Discriminator] FROM [Gears] AS [g] LEFT JOIN [Officers] AS [o] ON [g].[Nickname] = [o].[Nickname] AND [g].[SquadId] = [o].[SquadId] LEFT JOIN [Tags] AS [t] ON [g].[Nickname] = [t].[GearNickName] AND [g].[SquadId] = [t].[GearSquadId] -WHERE ([t].[Id] IS NOT NULL) AND [t].[Id] IN ('34c8d86e-a4ac-4be5-827f-584dda348a07', 'df36f493-463f-4123-83f9-6b135deeb7ba', 'a8ad98f9-e023-4e2a-9a70-c2728455bd34', '70534e05-782c-4052-8720-c2c54481ce5f', 'a7be028a-0cf2-448f-ab55-ce8bc5d8cf69', 'b39a6fba-9026-4d69-828e-fd7068673e57') +WHERE [t].[Id] IS NOT NULL AND [t].[Id] IN ('34c8d86e-a4ac-4be5-827f-584dda348a07', 'df36f493-463f-4123-83f9-6b135deeb7ba', 'a8ad98f9-e023-4e2a-9a70-c2728455bd34', '70534e05-782c-4052-8720-c2c54481ce5f', 'a7be028a-0cf2-448f-ab55-ce8bc5d8cf69', 'b39a6fba-9026-4d69-828e-fd7068673e57') """); } @@ -522,7 +510,7 @@ FROM [Gears] AS [g] LEFT JOIN [Officers] AS [o] ON [g].[Nickname] = [o].[Nickname] AND [g].[SquadId] = [o].[SquadId] ) AS [t] ON [w].[OwnerFullName] = [t].[FullName] LEFT JOIN [Cities] AS [c] ON [t].[CityOfBirthName] = [c].[Name] -WHERE [t].[Nickname] <> N'Paduk' OR ([t].[Nickname] IS NULL) +WHERE [t].[Nickname] <> N'Paduk' OR [t].[Nickname] IS NULL ORDER BY [c].[Name], [w].[Id] """); } @@ -611,7 +599,7 @@ WHEN [o].[Nickname] IS NOT NULL THEN N'Officer' END AS [Discriminator] FROM [Gears] AS [g] LEFT JOIN [Officers] AS [o] ON [g].[Nickname] = [o].[Nickname] AND [g].[SquadId] = [o].[SquadId] -WHERE ([g].[Rank] & 2) > 0 +WHERE [g].[Rank] & 2 > 0 """, // """ @@ -620,7 +608,7 @@ WHEN [o].[Nickname] IS NOT NULL THEN N'Officer' END AS [Discriminator] FROM [Gears] AS [g] LEFT JOIN [Officers] AS [o] ON [g].[Nickname] = [o].[Nickname] AND [g].[SquadId] = [o].[SquadId] -WHERE ([g].[Rank] & 2) = 2 +WHERE [g].[Rank] & 2 = 2 """); } @@ -635,7 +623,7 @@ WHEN [o].[Nickname] IS NOT NULL THEN N'Officer' END AS [Discriminator] FROM [Gears] AS [g] LEFT JOIN [Officers] AS [o] ON [g].[Nickname] = [o].[Nickname] AND [g].[SquadId] = [o].[SquadId] -WHERE ([g].[Rank] & 1) = 1 +WHERE [g].[Rank] & 1 = 1 """, // """ @@ -644,7 +632,7 @@ WHEN [o].[Nickname] IS NOT NULL THEN N'Officer' END AS [Discriminator] FROM [Gears] AS [g] LEFT JOIN [Officers] AS [o] ON [g].[Nickname] = [o].[Nickname] AND [g].[SquadId] = [o].[SquadId] -WHERE (CAST([g].[Rank] AS bigint) & CAST(1 AS bigint)) = CAST(1 AS bigint) +WHERE CAST([g].[Rank] AS bigint) & CAST(1 AS bigint) = CAST(1 AS bigint) """, // """ @@ -653,7 +641,7 @@ WHEN [o].[Nickname] IS NOT NULL THEN N'Officer' END AS [Discriminator] FROM [Gears] AS [g] LEFT JOIN [Officers] AS [o] ON [g].[Nickname] = [o].[Nickname] AND [g].[SquadId] = [o].[SquadId] -WHERE (CAST([g].[Rank] AS smallint) & CAST(1 AS smallint)) = CAST(1 AS smallint) +WHERE CAST([g].[Rank] AS smallint) & CAST(1 AS smallint) = CAST(1 AS smallint) """); } @@ -665,7 +653,7 @@ public override async Task Where_bitwise_and_nullable_enum_with_constant(bool as """ SELECT [w].[Id], [w].[AmmunitionType], [w].[IsAutomatic], [w].[Name], [w].[OwnerFullName], [w].[SynergyWithId] FROM [Weapons] AS [w] -WHERE ([w].[AmmunitionType] & 1) > 0 +WHERE [w].[AmmunitionType] & 1 > 0 """); } @@ -677,7 +665,7 @@ public override async Task Where_bitwise_and_nullable_enum_with_null_constant(bo """ SELECT [w].[Id], [w].[AmmunitionType], [w].[IsAutomatic], [w].[Name], [w].[OwnerFullName], [w].[SynergyWithId] FROM [Weapons] AS [w] -WHERE ([w].[AmmunitionType] & NULL) > 0 +WHERE [w].[AmmunitionType] & NULL > 0 """); } @@ -691,7 +679,7 @@ public override async Task Where_bitwise_and_nullable_enum_with_non_nullable_par SELECT [w].[Id], [w].[AmmunitionType], [w].[IsAutomatic], [w].[Name], [w].[OwnerFullName], [w].[SynergyWithId] FROM [Weapons] AS [w] -WHERE ([w].[AmmunitionType] & @__ammunitionType_0) > 0 +WHERE [w].[AmmunitionType] & @__ammunitionType_0 > 0 """); } @@ -705,13 +693,13 @@ public override async Task Where_bitwise_and_nullable_enum_with_nullable_paramet SELECT [w].[Id], [w].[AmmunitionType], [w].[IsAutomatic], [w].[Name], [w].[OwnerFullName], [w].[SynergyWithId] FROM [Weapons] AS [w] -WHERE ([w].[AmmunitionType] & @__ammunitionType_0) > 0 +WHERE [w].[AmmunitionType] & @__ammunitionType_0 > 0 """, // """ SELECT [w].[Id], [w].[AmmunitionType], [w].[IsAutomatic], [w].[Name], [w].[OwnerFullName], [w].[SynergyWithId] FROM [Weapons] AS [w] -WHERE ([w].[AmmunitionType] & NULL) > 0 +WHERE [w].[AmmunitionType] & NULL > 0 """); } @@ -726,7 +714,7 @@ WHEN [o].[Nickname] IS NOT NULL THEN N'Officer' END AS [Discriminator] FROM [Gears] AS [g] LEFT JOIN [Officers] AS [o] ON [g].[Nickname] = [o].[Nickname] AND [g].[SquadId] = [o].[SquadId] -WHERE ([g].[Rank] | 2) > 0 +WHERE [g].[Rank] | 2 > 0 """); } @@ -737,14 +725,14 @@ public override async Task Bitwise_projects_values_in_select(bool async) AssertSql( """ SELECT TOP(1) CASE - WHEN ([g].[Rank] & 2) = 2 THEN CAST(1 AS bit) + WHEN [g].[Rank] & 2 = 2 THEN CAST(1 AS bit) ELSE CAST(0 AS bit) END AS [BitwiseTrue], CASE - WHEN ([g].[Rank] & 2) = 4 THEN CAST(1 AS bit) + WHEN [g].[Rank] & 2 = 4 THEN CAST(1 AS bit) ELSE CAST(0 AS bit) END AS [BitwiseFalse], [g].[Rank] & 2 AS [BitwiseValue] FROM [Gears] AS [g] -WHERE ([g].[Rank] & 2) = 2 +WHERE [g].[Rank] & 2 = 2 """); } @@ -759,7 +747,7 @@ WHEN [o].[Nickname] IS NOT NULL THEN N'Officer' END AS [Discriminator] FROM [Gears] AS [g] LEFT JOIN [Officers] AS [o] ON [g].[Nickname] = [o].[Nickname] AND [g].[SquadId] = [o].[SquadId] -WHERE ([g].[Rank] & 2) = 2 +WHERE [g].[Rank] & 2 = 2 """, // """ @@ -768,7 +756,7 @@ WHEN [o].[Nickname] IS NOT NULL THEN N'Officer' END AS [Discriminator] FROM [Gears] AS [g] LEFT JOIN [Officers] AS [o] ON [g].[Nickname] = [o].[Nickname] AND [g].[SquadId] = [o].[SquadId] -WHERE ([g].[Rank] & 18) = 18 +WHERE [g].[Rank] & 18 = 18 """, // """ @@ -777,7 +765,7 @@ WHEN [o].[Nickname] IS NOT NULL THEN N'Officer' END AS [Discriminator] FROM [Gears] AS [g] LEFT JOIN [Officers] AS [o] ON [g].[Nickname] = [o].[Nickname] AND [g].[SquadId] = [o].[SquadId] -WHERE ([g].[Rank] & 1) = 1 +WHERE [g].[Rank] & 1 = 1 """, // """ @@ -786,7 +774,7 @@ WHEN [o].[Nickname] IS NOT NULL THEN N'Officer' END AS [Discriminator] FROM [Gears] AS [g] LEFT JOIN [Officers] AS [o] ON [g].[Nickname] = [o].[Nickname] AND [g].[SquadId] = [o].[SquadId] -WHERE ([g].[Rank] & 1) = 1 +WHERE [g].[Rank] & 1 = 1 """, // """ @@ -795,7 +783,7 @@ WHEN [o].[Nickname] IS NOT NULL THEN N'Officer' END AS [Discriminator] FROM [Gears] AS [g] LEFT JOIN [Officers] AS [o] ON [g].[Nickname] = [o].[Nickname] AND [g].[SquadId] = [o].[SquadId] -WHERE (2 & [g].[Rank]) = [g].[Rank] +WHERE 2 & [g].[Rank] = [g].[Rank] """); } @@ -810,11 +798,11 @@ 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] & COALESCE(( +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] - ORDER BY [g0].[Nickname], [g0].[SquadId]), 0)) = COALESCE(( + 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] @@ -827,11 +815,11 @@ 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 & COALESCE(( +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] - ORDER BY [g0].[Nickname], [g0].[SquadId]), 0)) = COALESCE(( + 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] @@ -850,23 +838,23 @@ 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] & ( +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] - ORDER BY [g0].[Nickname], [g0].[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 ((( + ORDER BY [g0].[Nickname], [g0].[SquadId]) OR (( SELECT TOP(1) [g0].[Rank] FROM [Gears] AS [g0] LEFT JOIN [Officers] AS [o0] ON [g0].[Nickname] = [o0].[Nickname] AND [g0].[SquadId] = [o0].[SquadId] - ORDER BY [g0].[Nickname], [g0].[SquadId]) IS NULL) AND (( + ORDER BY [g0].[Nickname], [g0].[SquadId]) IS NULL AND ( SELECT TOP(1) [g0].[Rank] FROM [Gears] AS [g0] LEFT JOIN [Officers] AS [o0] ON [g0].[Nickname] = [o0].[Nickname] AND [g0].[SquadId] = [o0].[SquadId] - ORDER BY [g0].[Nickname], [g0].[SquadId]) IS NULL)) + ORDER BY [g0].[Nickname], [g0].[SquadId]) IS NULL) """, // """ @@ -875,23 +863,23 @@ 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 & ( +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] - ORDER BY [g0].[Nickname], [g0].[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 ((( + ORDER BY [g0].[Nickname], [g0].[SquadId]) OR (( SELECT TOP(1) [g0].[Rank] FROM [Gears] AS [g0] LEFT JOIN [Officers] AS [o0] ON [g0].[Nickname] = [o0].[Nickname] AND [g0].[SquadId] = [o0].[SquadId] - ORDER BY [g0].[Nickname], [g0].[SquadId]) IS NULL) AND (( + ORDER BY [g0].[Nickname], [g0].[SquadId]) IS NULL AND ( SELECT TOP(1) [g0].[Rank] FROM [Gears] AS [g0] LEFT JOIN [Officers] AS [o0] ON [g0].[Nickname] = [o0].[Nickname] AND [g0].[SquadId] = [o0].[SquadId] - ORDER BY [g0].[Nickname], [g0].[SquadId]) IS NULL)) + ORDER BY [g0].[Nickname], [g0].[SquadId]) IS NULL) """); } @@ -906,23 +894,23 @@ 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] & ( +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] - ORDER BY [g0].[Nickname], [g0].[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 ((( + ORDER BY [g0].[Nickname], [g0].[SquadId]) OR (( SELECT TOP(1) [g0].[Rank] FROM [Gears] AS [g0] LEFT JOIN [Officers] AS [o0] ON [g0].[Nickname] = [o0].[Nickname] AND [g0].[SquadId] = [o0].[SquadId] - ORDER BY [g0].[Nickname], [g0].[SquadId]) IS NULL) AND (( + ORDER BY [g0].[Nickname], [g0].[SquadId]) IS NULL AND ( SELECT TOP(1) [g0].[Rank] FROM [Gears] AS [g0] LEFT JOIN [Officers] AS [o0] ON [g0].[Nickname] = [o0].[Nickname] AND [g0].[SquadId] = [o0].[SquadId] - ORDER BY [g0].[Nickname], [g0].[SquadId]) IS NULL)) + ORDER BY [g0].[Nickname], [g0].[SquadId]) IS NULL) """); } @@ -939,7 +927,7 @@ WHEN [o].[Nickname] IS NOT NULL THEN N'Officer' END AS [Discriminator] FROM [Gears] AS [g] LEFT JOIN [Officers] AS [o] ON [g].[Nickname] = [o].[Nickname] AND [g].[SquadId] = [o].[SquadId] -WHERE ([g].[Rank] & @__parameter_0) = @__parameter_0 +WHERE [g].[Rank] & @__parameter_0 = @__parameter_0 """); } @@ -956,7 +944,7 @@ WHEN [o].[Nickname] IS NOT NULL THEN N'Officer' END AS [Discriminator] FROM [Gears] AS [g] LEFT JOIN [Officers] AS [o] ON [g].[Nickname] = [o].[Nickname] AND [g].[SquadId] = [o].[SquadId] -WHERE ([g].[Rank] & @__parameter_0) = @__parameter_0 +WHERE [g].[Rank] & @__parameter_0 = @__parameter_0 """); } @@ -967,14 +955,14 @@ public override async Task Select_enum_has_flag(bool async) AssertSql( """ SELECT TOP(1) CASE - WHEN ([g].[Rank] & 2) = 2 THEN CAST(1 AS bit) + WHEN [g].[Rank] & 2 = 2 THEN CAST(1 AS bit) ELSE CAST(0 AS bit) END AS [hasFlagTrue], CASE - WHEN ([g].[Rank] & 4) = 4 THEN CAST(1 AS bit) + WHEN [g].[Rank] & 4 = 4 THEN CAST(1 AS bit) ELSE CAST(0 AS bit) END AS [hasFlagFalse] FROM [Gears] AS [g] -WHERE ([g].[Rank] & 2) = 2 +WHERE [g].[Rank] & 2 = 2 """); } @@ -1038,7 +1026,7 @@ public override async Task Select_comparison_with_null(bool async) @__ammunitionType_0='1' (Nullable = true) SELECT [w].[Id], CASE - WHEN [w].[AmmunitionType] = @__ammunitionType_0 AND ([w].[AmmunitionType] IS NOT NULL) THEN CAST(1 AS bit) + WHEN [w].[AmmunitionType] = @__ammunitionType_0 AND [w].[AmmunitionType] IS NOT NULL THEN CAST(1 AS bit) ELSE CAST(0 AS bit) END AS [Cartridge] FROM [Weapons] AS [w] @@ -1120,11 +1108,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 """); } @@ -1163,7 +1151,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] @@ -1198,7 +1186,7 @@ WHEN [o].[Nickname] IS NOT NULL THEN N'Officer' END AS [Discriminator] FROM [Gears] AS [g] LEFT JOIN [Officers] AS [o] ON [g].[Nickname] = [o].[Nickname] AND [g].[SquadId] = [o].[SquadId] -WHERE [g].[LeaderNickname] = N'Marcus' AND ([g].[LeaderNickname] IS NOT NULL) +WHERE [g].[LeaderNickname] = N'Marcus' AND [g].[LeaderNickname] IS NOT NULL """); } @@ -1217,7 +1205,7 @@ FROM [Gears] AS [g] WHERE CASE WHEN [g].[LeaderNickname] IS NULL THEN NULL ELSE CASE - WHEN ([g].[LeaderNickname] IS NOT NULL) AND ([g].[LeaderNickname] LIKE N'%us') THEN CAST(1 AS bit) + WHEN [g].[LeaderNickname] IS NOT NULL AND [g].[LeaderNickname] LIKE N'%us' THEN CAST(1 AS bit) ELSE CAST(0 AS bit) END END = CAST(1 AS bit) @@ -1261,10 +1249,10 @@ FROM [Gears] AS [g] WHERE CASE WHEN [g].[LeaderNickname] IS NULL THEN NULL ELSE CAST(LEN([g].[LeaderNickname]) AS int) -END = 5 AND (CASE +END = 5 AND CASE WHEN [g].[LeaderNickname] IS NULL THEN NULL ELSE CAST(LEN([g].[LeaderNickname]) AS int) -END IS NOT NULL) +END IS NOT NULL """); } @@ -1283,10 +1271,10 @@ FROM [Gears] AS [g] WHERE CASE WHEN [g].[LeaderNickname] IS NOT NULL THEN CAST(LEN([g].[LeaderNickname]) AS int) ELSE NULL -END = 5 AND (CASE +END = 5 AND CASE WHEN [g].[LeaderNickname] IS NOT NULL THEN CAST(LEN([g].[LeaderNickname]) AS int) ELSE NULL -END IS NOT NULL) +END IS NOT NULL """); } @@ -1305,10 +1293,10 @@ FROM [Gears] AS [g] WHERE CASE WHEN [g].[LeaderNickname] IS NOT NULL THEN CAST(LEN([g].[LeaderNickname]) AS int) ELSE NULL -END = 5 AND (CASE +END = 5 AND CASE WHEN [g].[LeaderNickname] IS NOT NULL THEN CAST(LEN([g].[LeaderNickname]) AS int) ELSE NULL -END IS NOT NULL) +END IS NOT NULL """); } @@ -1391,7 +1379,7 @@ public override async Task Select_null_propagation_negative3(bool async) AssertSql( """ SELECT [t].[Nickname], CASE - WHEN ([t].[Nickname] IS NOT NULL) AND ([t].[SquadId] IS NOT NULL) THEN CASE + WHEN [t].[Nickname] IS NOT NULL AND [t].[SquadId] IS NOT NULL THEN CASE WHEN [t].[LeaderNickname] IS NOT NULL THEN CAST(1 AS bit) ELSE CAST(0 AS bit) END @@ -1413,7 +1401,7 @@ public override async Task Select_null_propagation_negative4(bool async) AssertSql( """ SELECT CASE - WHEN ([t].[Nickname] IS NOT NULL) AND ([t].[SquadId] IS NOT NULL) THEN CAST(1 AS bit) + WHEN [t].[Nickname] IS NOT NULL AND [t].[SquadId] IS NOT NULL THEN CAST(1 AS bit) ELSE CAST(0 AS bit) END, [t].[Nickname] FROM [Gears] AS [g] @@ -1432,7 +1420,7 @@ public override async Task Select_null_propagation_negative5(bool async) AssertSql( """ SELECT CASE - WHEN ([t].[Nickname] IS NOT NULL) AND ([t].[SquadId] IS NOT NULL) THEN CAST(1 AS bit) + WHEN [t].[Nickname] IS NOT NULL AND [t].[SquadId] IS NOT NULL THEN CAST(1 AS bit) ELSE CAST(0 AS bit) END, [t].[Nickname] FROM [Gears] AS [g] @@ -1542,7 +1530,7 @@ LEFT JOIN ( SELECT [g].[Nickname], [g].[SquadId] FROM [Gears] AS [g] ) AS [t0] ON [t].[GearNickName] = [t0].[Nickname] AND [t].[GearSquadId] = [t0].[SquadId] -LEFT JOIN [Tags] AS [t1] ON ([t0].[Nickname] = [t1].[GearNickName] OR (([t0].[Nickname] IS NULL) AND ([t1].[GearNickName] IS NULL))) AND ([t0].[SquadId] = [t1].[GearSquadId] OR (([t0].[SquadId] IS NULL) AND ([t1].[GearSquadId] IS NULL))) +LEFT JOIN [Tags] AS [t1] ON ([t0].[Nickname] = [t1].[GearNickName] OR ([t0].[Nickname] IS NULL AND [t1].[GearNickName] IS NULL)) AND ([t0].[SquadId] = [t1].[GearSquadId] OR ([t0].[SquadId] IS NULL AND [t1].[GearSquadId] IS NULL)) LEFT JOIN ( SELECT [g0].[Nickname], [g0].[SquadId], [g0].[AssignedCityName] FROM [Gears] AS [g0] @@ -1679,7 +1667,7 @@ LEFT JOIN ( SELECT [g0].[Nickname], [g0].[SquadId] FROM [Gears] AS [g0] ) AS [t2] ON [t0].[GearNickName] = [t2].[Nickname] AND [t0].[GearSquadId] = [t2].[SquadId] -WHERE [t1].[Nickname] = [t2].[Nickname] OR (([t1].[Nickname] IS NULL) AND ([t2].[Nickname] IS NULL)) +WHERE [t1].[Nickname] = [t2].[Nickname] OR ([t1].[Nickname] IS NULL AND [t2].[Nickname] IS NULL) """); } @@ -1698,7 +1686,7 @@ END AS [Discriminator] FROM [Gears] AS [g] LEFT JOIN [Officers] AS [o] ON [g].[Nickname] = [o].[Nickname] AND [g].[SquadId] = [o].[SquadId] ) AS [t0] ON [t].[GearNickName] = [t0].[Nickname] AND [t].[GearSquadId] = [t0].[SquadId] -WHERE [t0].[Nickname] = N'Marcus' AND ([t0].[CityOfBirthName] <> N'Ephyra' OR ([t0].[CityOfBirthName] IS NULL)) +WHERE [t0].[Nickname] = N'Marcus' AND ([t0].[CityOfBirthName] <> N'Ephyra' OR [t0].[CityOfBirthName] IS NULL) """); } @@ -1735,7 +1723,7 @@ LEFT JOIN ( SELECT [g0].[Nickname], [g0].[SquadId] FROM [Gears] AS [g0] ) AS [t2] ON [t0].[GearNickName] = [t2].[Nickname] AND [t0].[GearSquadId] = [t2].[SquadId] -WHERE ([t1].[Nickname] = [t2].[Nickname] OR (([t1].[Nickname] IS NULL) AND ([t2].[Nickname] IS NULL))) AND ([t1].[SquadId] = [t2].[SquadId] OR (([t1].[SquadId] IS NULL) AND ([t2].[SquadId] IS NULL))) +WHERE ([t1].[Nickname] = [t2].[Nickname] OR ([t1].[Nickname] IS NULL AND [t2].[Nickname] IS NULL)) AND ([t1].[SquadId] = [t2].[SquadId] OR ([t1].[SquadId] IS NULL AND [t2].[SquadId] IS NULL)) """); } @@ -1751,7 +1739,7 @@ LEFT JOIN ( SELECT [g].[Nickname], [g].[SquadId] FROM [Gears] AS [g] ) AS [t0] ON [t].[GearNickName] = [t0].[Nickname] AND [t].[GearSquadId] = [t0].[SquadId] -WHERE ([t0].[Nickname] IS NULL) OR ([t0].[SquadId] IS NULL) +WHERE [t0].[Nickname] IS NULL OR [t0].[SquadId] IS NULL """); } @@ -1767,7 +1755,7 @@ LEFT JOIN ( SELECT [g].[Nickname], [g].[SquadId] FROM [Gears] AS [g] ) AS [t0] ON [t].[GearNickName] = [t0].[Nickname] AND [t].[GearSquadId] = [t0].[SquadId] -WHERE ([t0].[Nickname] IS NULL) OR ([t0].[SquadId] IS NULL) +WHERE [t0].[Nickname] IS NULL OR [t0].[SquadId] IS NULL """); } @@ -1788,7 +1776,7 @@ LEFT JOIN ( SELECT [g0].[Nickname], [g0].[SquadId] FROM [Gears] AS [g0] ) AS [t2] ON [t0].[GearNickName] = [t2].[Nickname] AND [t0].[GearSquadId] = [t2].[SquadId] -WHERE [t1].[Nickname] = [t2].[Nickname] OR (([t1].[Nickname] IS NULL) AND ([t2].[Nickname] IS NULL)) +WHERE [t1].[Nickname] = [t2].[Nickname] OR ([t1].[Nickname] IS NULL AND [t2].[Nickname] IS NULL) """); } @@ -1926,7 +1914,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)) = CAST(1 AS bit) ORDER BY [g].[Nickname] """); @@ -1946,7 +1934,7 @@ FROM [Gears] AS [g] 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] """); } @@ -1967,7 +1955,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(1 AS bit) ORDER BY [g].[Nickname] """); @@ -2344,7 +2332,7 @@ LEFT JOIN ( SELECT [g].[Nickname], [g].[SquadId], [g].[CityOfBirthName] FROM [Gears] AS [g] ) AS [t0] ON [t].[GearNickName] = [t0].[Nickname] AND [t].[GearSquadId] = [t0].[SquadId] -WHERE [t0].[Nickname] = N'Marcus' AND ([t0].[CityOfBirthName] <> N'Ephyra' OR ([t0].[CityOfBirthName] IS NULL)) +WHERE [t0].[Nickname] = N'Marcus' AND ([t0].[CityOfBirthName] <> N'Ephyra' OR [t0].[CityOfBirthName] IS NULL) """); } @@ -2709,7 +2697,7 @@ public override async Task Include_on_GroupJoin_SelectMany_DefaultIfEmpty_with_c AssertSql( """ SELECT CASE - WHEN ([t].[Nickname] IS NOT NULL) AND ([t].[SquadId] IS NOT NULL) THEN CAST(1 AS bit) + WHEN [t].[Nickname] IS NOT NULL AND [t].[SquadId] IS NOT NULL THEN CAST(1 AS bit) ELSE CAST(0 AS bit) END, [t].[Nickname], [t].[SquadId], [t].[AssignedCityName], [t].[CityOfBirthName], [t].[FullName], [t].[HasSoulPatch], [t].[LeaderNickname], [t].[LeaderSquadId], [t].[Rank], [t].[Discriminator], [g].[Nickname], [g].[SquadId], [w].[Id], [w].[AmmunitionType], [w].[IsAutomatic], [w].[Name], [w].[OwnerFullName], [w].[SynergyWithId], [g].[AssignedCityName], [g].[CityOfBirthName], [g].[FullName], [g].[HasSoulPatch], [g].[LeaderNickname], [g].[LeaderSquadId], [g].[Rank], CASE WHEN [o].[Nickname] IS NOT NULL THEN N'Officer' @@ -2738,7 +2726,7 @@ public override async Task Include_on_GroupJoin_SelectMany_DefaultIfEmpty_with_c SELECT [g].[Nickname], [g].[SquadId], [g].[AssignedCityName], [g].[CityOfBirthName], [g].[FullName], [g].[HasSoulPatch], [g].[LeaderNickname], [g].[LeaderSquadId], [g].[Rank], CASE WHEN [o].[Nickname] IS NOT NULL THEN N'Officer' END AS [Discriminator], [t].[Nickname], [t].[SquadId], [w].[Id], [w].[AmmunitionType], [w].[IsAutomatic], [w].[Name], [w].[OwnerFullName], [w].[SynergyWithId], [t].[AssignedCityName], [t].[CityOfBirthName], [t].[FullName], [t].[HasSoulPatch], [t].[LeaderNickname], [t].[LeaderSquadId], [t].[Rank], [t].[Discriminator], [w0].[Id], [w0].[AmmunitionType], [w0].[IsAutomatic], [w0].[Name], [w0].[OwnerFullName], [w0].[SynergyWithId], [w1].[Id], [w1].[AmmunitionType], [w1].[IsAutomatic], [w1].[Name], [w1].[OwnerFullName], [w1].[SynergyWithId], [w2].[Id], [w2].[AmmunitionType], [w2].[IsAutomatic], [w2].[Name], [w2].[OwnerFullName], [w2].[SynergyWithId], CASE - WHEN ([t].[Nickname] IS NOT NULL) AND ([t].[SquadId] IS NOT NULL) THEN CAST(1 AS bit) + WHEN [t].[Nickname] IS NOT NULL AND [t].[SquadId] IS NOT NULL THEN CAST(1 AS bit) ELSE CAST(0 AS bit) END, [w3].[Id], [w3].[AmmunitionType], [w3].[IsAutomatic], [w3].[Name], [w3].[OwnerFullName], [w3].[SynergyWithId], [w4].[Id], [w4].[AmmunitionType], [w4].[IsAutomatic], [w4].[Name], [w4].[OwnerFullName], [w4].[SynergyWithId] FROM [Gears] AS [g] @@ -2791,7 +2779,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] @@ -2810,7 +2798,7 @@ LEFT JOIN ( SELECT [g].[Nickname], [g].[SquadId], [g].[HasSoulPatch] FROM [Gears] AS [g] ) AS [t0] ON [t].[GearNickName] = [t0].[Nickname] AND [t].[GearSquadId] = [t0].[SquadId] -WHERE ([t].[Note] <> N'K.I.A.' OR ([t].[Note] IS NULL)) AND [t0].[HasSoulPatch] = CAST(1 AS bit) +WHERE ([t].[Note] <> N'K.I.A.' OR [t].[Note] IS NULL) AND [t0].[HasSoulPatch] = CAST(1 AS bit) """); } @@ -2915,7 +2903,7 @@ LEFT JOIN ( SELECT [g].[Nickname], [g].[SquadId], [g].[HasSoulPatch] FROM [Gears] AS [g] ) AS [t0] ON [t].[GearNickName] = [t0].[Nickname] AND [t].[GearSquadId] = [t0].[SquadId] -WHERE [t0].[HasSoulPatch] = CAST(1 AS bit) OR ([t].[Note] LIKE N'%Cole%') +WHERE [t0].[HasSoulPatch] = CAST(1 AS bit) OR [t].[Note] LIKE N'%Cole%' """); } @@ -2926,7 +2914,7 @@ 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] @@ -2949,7 +2937,7 @@ LEFT JOIN ( SELECT [g].[Nickname], [g].[SquadId] FROM [Gears] AS [g] ) AS [t0] ON [t].[GearNickName] = [t0].[Nickname] AND [t].[GearSquadId] = [t0].[SquadId] -WHERE [t].[Note] <> N'K.I.A.' OR ([t].[Note] IS NULL) +WHERE [t].[Note] <> N'K.I.A.' OR [t].[Note] IS NULL """); } @@ -2965,7 +2953,7 @@ LEFT JOIN ( SELECT [g].[Nickname], [g].[SquadId] FROM [Gears] AS [g] ) AS [t0] ON [t].[GearNickName] = [t0].[Nickname] AND [t].[GearSquadId] = [t0].[SquadId] -WHERE [t].[Note] <> N'K.I.A.' OR ([t].[Note] IS NULL) +WHERE [t].[Note] <> N'K.I.A.' OR [t].[Note] IS NULL """); } @@ -2981,7 +2969,7 @@ LEFT JOIN ( SELECT [g].[Nickname], [g].[SquadId] FROM [Gears] AS [g] ) AS [t0] ON [t].[GearNickName] = [t0].[Nickname] AND [t].[GearSquadId] = [t0].[SquadId] -WHERE [t].[Note] <> N'K.I.A.' OR ([t].[Note] IS NULL) +WHERE [t].[Note] <> N'K.I.A.' OR [t].[Note] IS NULL """); } @@ -2997,7 +2985,7 @@ LEFT JOIN ( SELECT [g].[Nickname], [g].[SquadId] FROM [Gears] AS [g] ) AS [t0] ON [t].[GearNickName] = [t0].[Nickname] AND [t].[GearSquadId] = [t0].[SquadId] -WHERE [t].[Note] <> N'K.I.A.' OR ([t].[Note] IS NULL) +WHERE [t].[Note] <> N'K.I.A.' OR [t].[Note] IS NULL ORDER BY [t].[Note] """); } @@ -3014,7 +3002,7 @@ LEFT JOIN ( SELECT [g].[Nickname], [g].[SquadId] FROM [Gears] AS [g] ) AS [t0] ON [t].[GearNickName] = [t0].[Nickname] AND [t].[GearSquadId] = [t0].[SquadId] -WHERE [t].[Note] <> N'K.I.A.' OR ([t].[Note] IS NULL) +WHERE [t].[Note] <> N'K.I.A.' OR [t].[Note] IS NULL """); } @@ -3030,7 +3018,7 @@ LEFT JOIN ( SELECT [g].[Nickname], [g].[SquadId] FROM [Gears] AS [g] ) AS [t0] ON [t].[GearNickName] = [t0].[Nickname] AND [t].[GearSquadId] = [t0].[SquadId] -WHERE [t].[Note] <> N'K.I.A.' OR ([t].[Note] IS NULL) +WHERE [t].[Note] <> N'K.I.A.' OR [t].[Note] IS NULL ORDER BY [t0].[SquadId] """); } @@ -3052,7 +3040,7 @@ END AS [Discriminator] FROM [Gears] AS [g] LEFT JOIN [Officers] AS [o] ON [g].[Nickname] = [o].[Nickname] AND [g].[SquadId] = [o].[SquadId] ) AS [t0] ON [t].[GearNickName] = [t0].[Nickname] AND [t].[GearSquadId] = [t0].[SquadId] - WHERE ([t].[Note] <> N'K.I.A.' OR ([t].[Note] IS NULL)) AND [t0].[HasSoulPatch] = CAST(0 AS bit)) THEN CAST(1 AS bit) + WHERE ([t].[Note] <> N'K.I.A.' OR [t].[Note] IS NULL) AND [t0].[HasSoulPatch] = CAST(0 AS bit)) THEN CAST(1 AS bit) ELSE CAST(0 AS bit) END """); @@ -3070,7 +3058,7 @@ LEFT JOIN ( SELECT [g].[Nickname], [g].[SquadId], [g].[HasSoulPatch] FROM [Gears] AS [g] ) AS [t0] ON [t].[GearNickName] = [t0].[Nickname] AND [t].[GearSquadId] = [t0].[SquadId] -WHERE ([t].[Note] <> N'K.I.A.' OR ([t].[Note] IS NULL)) AND [t0].[HasSoulPatch] = CAST(0 AS bit) +WHERE ([t].[Note] <> N'K.I.A.' OR [t].[Note] IS NULL) AND [t0].[HasSoulPatch] = CAST(0 AS bit) """); } @@ -3086,7 +3074,7 @@ LEFT JOIN ( SELECT [g].[Nickname], [g].[SquadId] FROM [Gears] AS [g] ) AS [t0] ON [t].[GearNickName] = [t0].[Nickname] AND [t].[GearSquadId] = [t0].[SquadId] -WHERE ([t].[Note] <> N'K.I.A.' OR ([t].[Note] IS NULL)) AND EXISTS ( +WHERE ([t].[Note] <> N'K.I.A.' OR [t].[Note] IS NULL) AND EXISTS ( SELECT 1 FROM [Gears] AS [g0] LEFT JOIN [Officers] AS [o0] ON [g0].[Nickname] = [o0].[Nickname] AND [g0].[SquadId] = [o0].[SquadId] @@ -3120,7 +3108,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] @@ -3503,7 +3491,7 @@ public override async Task Distinct_with_optional_navigation_is_translated_to_sq SELECT DISTINCT [g].[HasSoulPatch] FROM [Gears] AS [g] LEFT JOIN [Tags] AS [t] ON [g].[Nickname] = [t].[GearNickName] AND [g].[SquadId] = [t].[GearSquadId] -WHERE [t].[Note] <> N'Foo' OR ([t].[Note] IS NULL) +WHERE [t].[Note] <> N'Foo' OR [t].[Note] IS NULL """); } @@ -3516,7 +3504,7 @@ public override async Task Sum_with_optional_navigation_is_translated_to_sql(boo SELECT COALESCE(SUM([g].[SquadId]), 0) FROM [Gears] AS [g] LEFT JOIN [Tags] AS [t] ON [g].[Nickname] = [t].[GearNickName] AND [g].[SquadId] = [t].[GearSquadId] -WHERE [t].[Note] <> N'Foo' OR ([t].[Note] IS NULL) +WHERE [t].[Note] <> N'Foo' OR [t].[Note] IS NULL """); } @@ -3529,7 +3517,7 @@ public override async Task Count_with_optional_navigation_is_translated_to_sql(b SELECT COUNT(*) FROM [Gears] AS [g] LEFT JOIN [Tags] AS [t] ON [g].[Nickname] = [t].[GearNickName] AND [g].[SquadId] = [t].[GearSquadId] -WHERE [t].[Note] <> N'Foo' OR ([t].[Note] IS NULL) +WHERE [t].[Note] <> N'Foo' OR [t].[Note] IS NULL """); } @@ -3581,7 +3569,7 @@ SELECT 1 FROM [Gears] AS [g] LEFT JOIN [Officers] AS [o] ON [g].[Nickname] = [o].[Nickname] AND [g].[SquadId] = [o].[SquadId] LEFT JOIN [Tags] AS [t] ON [g].[Nickname] = [t].[GearNickName] AND [g].[SquadId] = [t].[GearSquadId] - WHERE [t].[Note] = N'Foo' AND ([t].[Note] IS NOT NULL)) THEN CAST(1 AS bit) + WHERE [t].[Note] = N'Foo' AND [t].[Note] IS NOT NULL) THEN CAST(1 AS bit) ELSE CAST(0 AS bit) END """); @@ -3722,7 +3710,7 @@ SELECT [g].[Nickname] 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] """); } @@ -4145,7 +4133,7 @@ LEFT JOIN ( SELECT [g0].[Nickname], [g0].[SquadId] FROM [Gears] AS [g0] ) AS [t1] ON [t0].[DefeatedByNickname] = [t1].[Nickname] AND [t0].[DefeatedBySquadId] = [t1].[SquadId] -WHERE ([l].[Id] IS NOT NULL) AND [t].[HasSoulPatch] = CAST(1 AS bit) AND [t1].[Nickname] = [t].[Nickname] AND [t1].[SquadId] = [t].[SquadId] +WHERE [l].[Id] IS NOT NULL AND [t].[HasSoulPatch] = CAST(1 AS bit) AND [t1].[Nickname] = [t].[Nickname] AND [t1].[SquadId] = [t].[SquadId] """); } @@ -4180,7 +4168,7 @@ END AS [Discriminator] FROM [Gears] AS [g] LEFT JOIN [Officers] AS [o] ON [g].[Nickname] = [o].[Nickname] AND [g].[SquadId] = [o].[SquadId] LEFT JOIN [Cities] AS [c] ON [g].[AssignedCityName] = [c].[Name] -WHERE [g].[SquadId] < 2 AND ([c].[Name] = N'Ephyra' OR ([c].[Name] IS NULL)) +WHERE [g].[SquadId] < 2 AND ([c].[Name] = N'Ephyra' OR [c].[Name] IS NULL) """); } @@ -4203,7 +4191,7 @@ FROM [Gears] AS [g] SELECT COUNT(*) FROM [Gears] AS [g0] LEFT JOIN [Officers] AS [o0] ON [g0].[Nickname] = [o0].[Nickname] AND [g0].[SquadId] = [o0].[SquadId] - WHERE ([t0].[Nickname] IS NOT NULL) AND ([t0].[SquadId] IS NOT NULL) AND [t0].[Nickname] = [g0].[LeaderNickname] AND [t0].[SquadId] = [g0].[LeaderSquadId] AND [g0].[Nickname] = N'Dom') > 0 + WHERE [t0].[Nickname] IS NOT NULL AND [t0].[SquadId] IS NOT NULL AND [t0].[Nickname] = [g0].[LeaderNickname] AND [t0].[SquadId] = [g0].[LeaderSquadId] AND [g0].[Nickname] = N'Dom') > 0 """); } @@ -4294,7 +4282,7 @@ WHEN [o0].[Nickname] IS NOT NULL THEN N'Officer' END AS [Discriminator] FROM [Gears] AS [g0] LEFT JOIN [Officers] AS [o0] ON [g0].[Nickname] = [o0].[Nickname] AND [g0].[SquadId] = [o0].[SquadId] -) AS [t1] ON ([t0].[Nickname] = [t1].[LeaderNickname] OR (([t0].[Nickname] IS NULL) AND ([t1].[LeaderNickname] IS NULL))) AND [t0].[SquadId] = [t1].[LeaderSquadId] +) AS [t1] ON ([t0].[Nickname] = [t1].[LeaderNickname] OR ([t0].[Nickname] IS NULL AND [t1].[LeaderNickname] IS NULL)) AND [t0].[SquadId] = [t1].[LeaderSquadId] WHERE [l].[Id] IS NOT NULL ORDER BY [f].[Id], [t].[Name], [t0].[Nickname], [t0].[SquadId], [t1].[Nickname] """); @@ -4324,7 +4312,7 @@ WHEN [o0].[Nickname] IS NOT NULL THEN N'Officer' END AS [Discriminator] FROM [Gears] AS [g0] LEFT JOIN [Officers] AS [o0] ON [g0].[Nickname] = [o0].[Nickname] AND [g0].[SquadId] = [o0].[SquadId] -) AS [t1] ON ([t0].[Nickname] = [t1].[LeaderNickname] OR (([t0].[Nickname] IS NULL) AND ([t1].[LeaderNickname] IS NULL))) AND [t0].[SquadId] = [t1].[LeaderSquadId] +) AS [t1] ON ([t0].[Nickname] = [t1].[LeaderNickname] OR ([t0].[Nickname] IS NULL AND [t1].[LeaderNickname] IS NULL)) AND [t0].[SquadId] = [t1].[LeaderSquadId] WHERE [l].[Id] IS NOT NULL ORDER BY [f].[Id], [t].[Name], [t0].[Nickname], [t0].[SquadId], [t1].[Nickname] """); @@ -4398,7 +4386,7 @@ WHEN [o0].[Nickname] IS NOT NULL THEN N'Officer' FROM [Gears] AS [g0] LEFT JOIN [Officers] AS [o0] ON [g0].[Nickname] = [o0].[Nickname] AND [g0].[SquadId] = [o0].[SquadId] INNER JOIN [Cities] AS [c] ON [g0].[CityOfBirthName] = [c].[Name] -) AS [t0] ON ([t].[Nickname] = [t0].[LeaderNickname] OR (([t].[Nickname] IS NULL) AND ([t0].[LeaderNickname] IS NULL))) AND [t].[SquadId] = [t0].[LeaderSquadId] +) AS [t0] ON ([t].[Nickname] = [t0].[LeaderNickname] OR ([t].[Nickname] IS NULL AND [t0].[LeaderNickname] IS NULL)) AND [t].[SquadId] = [t0].[LeaderSquadId] ORDER BY [l].[Name], [t].[Nickname], [t].[SquadId], [t0].[Nickname], [t0].[SquadId] """); } @@ -4598,7 +4586,7 @@ WHEN [o0].[Nickname] IS NOT NULL THEN N'Officer' END AS [Discriminator] FROM [Gears] AS [g0] LEFT JOIN [Officers] AS [o0] ON [g0].[Nickname] = [o0].[Nickname] AND [g0].[SquadId] = [o0].[SquadId] -) AS [t1] ON ([t0].[Nickname] = [t1].[LeaderNickname] OR (([t0].[Nickname] IS NULL) AND ([t1].[LeaderNickname] IS NULL))) AND [t0].[SquadId] = [t1].[LeaderSquadId] +) AS [t1] ON ([t0].[Nickname] = [t1].[LeaderNickname] OR ([t0].[Nickname] IS NULL AND [t1].[LeaderNickname] IS NULL)) AND [t0].[SquadId] = [t1].[LeaderSquadId] ORDER BY [f].[Id], [t].[Name], [t0].[Nickname], [t0].[SquadId], [t1].[Nickname] """); } @@ -4690,7 +4678,7 @@ WHEN [o0].[Nickname] IS NOT NULL THEN N'Officer' END AS [Discriminator] FROM [Gears] AS [g0] LEFT JOIN [Officers] AS [o0] ON [g0].[Nickname] = [o0].[Nickname] AND [g0].[SquadId] = [o0].[SquadId] -) AS [t1] ON ([t0].[Nickname] = [t1].[LeaderNickname] OR (([t0].[Nickname] IS NULL) AND ([t1].[LeaderNickname] IS NULL))) AND [t0].[SquadId] = [t1].[LeaderSquadId] +) AS [t1] ON ([t0].[Nickname] = [t1].[LeaderNickname] OR ([t0].[Nickname] IS NULL AND [t1].[LeaderNickname] IS NULL)) AND [t0].[SquadId] = [t1].[LeaderSquadId] ORDER BY [f].[Id], [t].[Name], [t0].[Nickname], [t0].[SquadId], [t1].[Nickname] """); } @@ -4726,7 +4714,7 @@ public override async Task Projecting_nullable_bool_in_conditional_works(bool as AssertSql( """ SELECT CASE - WHEN ([t0].[Nickname] IS NOT NULL) AND ([t0].[SquadId] IS NOT NULL) THEN [t0].[HasSoulPatch] + WHEN [t0].[Nickname] IS NOT NULL AND [t0].[SquadId] IS NOT NULL THEN [t0].[HasSoulPatch] ELSE CAST(0 AS bit) END AS [Prop] FROM [Tags] AS [t] @@ -4804,7 +4792,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] @@ -4822,7 +4810,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] @@ -4840,7 +4828,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] @@ -4858,7 +4846,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 @@ -4879,7 +4867,7 @@ LEFT JOIN ( FROM [Gears] AS [g0] WHERE [g0].[HasSoulPatch] = CAST(0 AS bit) ) AS [t] ON [g].[Nickname] = [t].[LeaderNickname] AND [g].[SquadId] = [t].[LeaderSquadId] -WHERE ([o].[Nickname] IS NOT NULL) AND [g].[Nickname] <> N'Foo' +WHERE [o].[Nickname] IS NOT NULL AND [g].[Nickname] <> N'Foo' ORDER BY [g].[Nickname], [g].[SquadId], [t].[Nickname] """); } @@ -4895,7 +4883,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] @@ -4913,7 +4901,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] @@ -4931,7 +4919,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] @@ -5058,7 +5046,7 @@ FROM [Gears] AS [g0] LEFT JOIN ( SELECT [w].[Id], [w].[AmmunitionType], [w].[IsAutomatic], [w].[Name], [w].[OwnerFullName], [w].[SynergyWithId] FROM [Weapons] AS [w] - WHERE [w].[Name] <> N'Bar' OR ([w].[Name] IS NULL) + WHERE [w].[Name] <> N'Bar' OR [w].[Name] IS NULL ) AS [t] ON [g0].[FullName] = [t].[OwnerFullName] WHERE [g0].[FullName] <> N'Foo' ) AS [t0] ON [g].[Nickname] = [t0].[LeaderNickname] AND [g].[SquadId] = [t0].[LeaderSquadId] @@ -5144,7 +5132,7 @@ 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] -WHERE ([o].[Nickname] IS NOT NULL) AND EXISTS ( +WHERE [o].[Nickname] IS NOT NULL AND EXISTS ( SELECT 1 FROM [Gears] AS [g0] LEFT JOIN [Officers] AS [o0] ON [g0].[Nickname] = [o0].[Nickname] AND [g0].[SquadId] = [o0].[SquadId] @@ -5175,7 +5163,7 @@ LEFT JOIN ( FROM [Gears] AS [g2] ) AS [t2] ON [w].[OwnerFullName] = [t2].[FullName] ) AS [t1] ON [t0].[FullName] = [t1].[OwnerFullName] -WHERE ([o].[Nickname] IS NOT NULL) AND EXISTS ( +WHERE [o].[Nickname] IS NOT NULL AND EXISTS ( SELECT 1 FROM [Gears] AS [g0] LEFT JOIN [Officers] AS [o0] ON [g0].[Nickname] = [o0].[Nickname] AND [g0].[SquadId] = [o0].[SquadId] @@ -5207,7 +5195,7 @@ LEFT JOIN ( FROM [Gears] AS [g2] ) AS [t2] ON [w].[OwnerFullName] = [t2].[FullName] ) AS [t1] ON [t0].[FullName] = [t1].[OwnerFullName] -WHERE ([o].[Nickname] IS NOT NULL) AND EXISTS ( +WHERE [o].[Nickname] IS NOT NULL AND EXISTS ( SELECT 1 FROM [Gears] AS [g0] LEFT JOIN [Officers] AS [o0] ON [g0].[Nickname] = [o0].[Nickname] AND [g0].[SquadId] = [o0].[SquadId] @@ -5235,14 +5223,14 @@ LEFT JOIN ( SELECT [w].[Id], [w].[AmmunitionType], [w].[IsAutomatic], [w].[Name], [w].[OwnerFullName], [w].[SynergyWithId], [t2].[Nickname], [t2].[SquadId], ( SELECT COUNT(*) FROM [Weapons] AS [w0] - WHERE ([t2].[FullName] IS NOT NULL) AND [t2].[FullName] = [w0].[OwnerFullName]) AS [c] + WHERE [t2].[FullName] IS NOT NULL AND [t2].[FullName] = [w0].[OwnerFullName]) AS [c] FROM [Weapons] AS [w] LEFT JOIN ( SELECT [g2].[Nickname], [g2].[SquadId], [g2].[FullName] FROM [Gears] AS [g2] ) AS [t2] ON [w].[OwnerFullName] = [t2].[FullName] ) AS [t1] ON [t0].[FullName] = [t1].[OwnerFullName] -WHERE ([o].[Nickname] IS NOT NULL) AND EXISTS ( +WHERE [o].[Nickname] IS NOT NULL AND EXISTS ( SELECT 1 FROM [Gears] AS [g0] LEFT JOIN [Officers] AS [o0] ON [g0].[Nickname] = [o0].[Nickname] AND [g0].[SquadId] = [o0].[SquadId] @@ -5281,7 +5269,7 @@ LEFT JOIN ( SELECT [g4].[Nickname], [g4].[HasSoulPatch], [g4].[SquadId] FROM [Gears] AS [g4] ) AS [t4] ON [s].[Id] = [t4].[SquadId] - WHERE [w].[Name] <> N'Bar' OR ([w].[Name] IS NULL) + WHERE [w].[Name] <> N'Bar' OR [w].[Name] IS NULL ) AS [t1] ON [g2].[FullName] = [t1].[OwnerFullName] WHERE [g2].[FullName] <> N'Foo' ) AS [t2] ON [g].[Nickname] = [t2].[LeaderNickname] AND [g].[SquadId] = [t2].[LeaderSquadId] @@ -5293,7 +5281,7 @@ LEFT JOIN ( FROM [Gears] AS [g5] ) AS [t6] ON [w1].[OwnerFullName] = [t6].[FullName] ) AS [t5] ON [t0].[FullName] = [t5].[OwnerFullName] -WHERE ([o].[Nickname] IS NOT NULL) AND EXISTS ( +WHERE [o].[Nickname] IS NOT NULL AND EXISTS ( SELECT 1 FROM [Gears] AS [g0] LEFT JOIN [Officers] AS [o0] ON [g0].[Nickname] = [o0].[Nickname] AND [g0].[SquadId] = [o0].[SquadId] @@ -5355,7 +5343,7 @@ FROM [Gears] AS [g0] OUTER APPLY ( SELECT [w].[Name], [g0].[Nickname], [w].[Id] FROM [Weapons] AS [w] - WHERE [g0].[FullName] = [w].[OwnerFullName] AND ([w].[Name] <> N'Bar' OR ([w].[Name] IS NULL)) + WHERE [g0].[FullName] = [w].[OwnerFullName] AND ([w].[Name] <> N'Bar' OR [w].[Name] IS NULL) ) AS [t] WHERE [g0].[FullName] <> N'Foo' ) AS [t0] ON [g].[Nickname] = [t0].[LeaderNickname] AND [g].[SquadId] = [t0].[LeaderSquadId] @@ -5379,7 +5367,7 @@ FROM [Gears] AS [g0] LEFT JOIN ( SELECT [w].[Name], [g].[Nickname], [w].[Id], [w].[OwnerFullName] FROM [Weapons] AS [w] - WHERE [w].[Name] <> N'Bar' OR ([w].[Name] IS NULL) + WHERE [w].[Name] <> N'Bar' OR [w].[Name] IS NULL ) AS [t] ON [g0].[FullName] = [t].[OwnerFullName] WHERE [g].[Nickname] = [g0].[LeaderNickname] AND [g].[SquadId] = [g0].[LeaderSquadId] AND [g0].[FullName] <> N'Foo' ) AS [t0] @@ -5400,7 +5388,7 @@ CROSS JOIN [Squads] AS [s] LEFT JOIN ( SELECT [w].[Id], [w].[AmmunitionType], [w].[IsAutomatic], [w].[Name], [w].[OwnerFullName], [w].[SynergyWithId] FROM [Weapons] AS [w] - WHERE [w].[IsAutomatic] = CAST(1 AS bit) OR [w].[Name] <> N'foo' OR ([w].[Name] IS NULL) + WHERE [w].[IsAutomatic] = CAST(1 AS bit) OR [w].[Name] <> N'foo' OR [w].[Name] IS NULL ) AS [t] ON [g].[FullName] = [t].[OwnerFullName] LEFT JOIN ( SELECT [g0].[Nickname], [g0].[SquadId], [g0].[AssignedCityName], [g0].[CityOfBirthName], [g0].[FullName], [g0].[HasSoulPatch], [g0].[LeaderNickname], [g0].[LeaderSquadId], [g0].[Rank], CASE @@ -5555,7 +5543,7 @@ WHERE [o].[Nickname] IS NOT NULL LEFT JOIN ( SELECT [g0].[FullName], [g0].[Nickname], [g0].[SquadId], [g0].[LeaderNickname], [g0].[LeaderSquadId] FROM [Gears] AS [g0] -) AS [t1] ON ([t0].[Nickname] = [t1].[LeaderNickname] OR (([t0].[Nickname] IS NULL) AND ([t1].[LeaderNickname] IS NULL))) AND [t0].[SquadId] = [t1].[LeaderSquadId] +) AS [t1] ON ([t0].[Nickname] = [t1].[LeaderNickname] OR ([t0].[Nickname] IS NULL AND [t1].[LeaderNickname] IS NULL)) AND [t0].[SquadId] = [t1].[LeaderSquadId] ORDER BY [t].[Id], [t0].[Nickname], [t0].[SquadId], [t1].[Nickname] """); } @@ -5801,9 +5789,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 """); } @@ -5821,9 +5809,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 """); } @@ -5849,7 +5837,7 @@ END AS [Discriminator] FROM [Gears] AS [g] LEFT JOIN [Officers] AS [o] ON [g].[Nickname] = [o].[Nickname] AND [g].[SquadId] = [o].[SquadId] ) AS [t] ON [l0].[DefeatedByNickname] = [t].[Nickname] AND [l0].[DefeatedBySquadId] = [t].[SquadId] - LEFT JOIN [Tags] AS [t0] ON ([t].[Nickname] = [t0].[GearNickName] OR (([t].[Nickname] IS NULL) AND ([t0].[GearNickName] IS NULL))) AND ([t].[SquadId] = [t0].[GearSquadId] OR (([t].[SquadId] IS NULL) AND ([t0].[GearSquadId] IS NULL))) + LEFT JOIN [Tags] AS [t0] ON ([t].[Nickname] = [t0].[GearNickName] OR ([t].[Nickname] IS NULL AND [t0].[GearNickName] IS NULL)) AND ([t].[SquadId] = [t0].[GearSquadId] OR ([t].[SquadId] IS NULL AND [t0].[GearSquadId] IS NULL)) ORDER BY [t0].[Note] ) AS [t1] LEFT JOIN [Weapons] AS [w] ON [t1].[FullName] = [w].[OwnerFullName] @@ -6711,7 +6699,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) @@ -6727,7 +6715,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) """); @@ -6744,7 +6732,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) @@ -6903,7 +6891,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] """); @@ -6931,7 +6919,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 """); @@ -6947,7 +6935,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 """); @@ -6985,7 +6973,7 @@ public override async Task String_concat_on_various_types(bool async) AssertSql( """ -SELECT (N'HasSoulPatch ' + CAST([g].[HasSoulPatch] AS nvarchar(max))) + N' HasSoulPatch' AS [HasSoulPatch], (N'Rank ' + CAST([g].[Rank] AS nvarchar(max))) + N' Rank' AS [Rank], (N'SquadId ' + CAST([g].[SquadId] AS nvarchar(max))) + N' SquadId' AS [SquadId], (N'Rating ' + COALESCE(CAST([m].[Rating] AS nvarchar(max)), N'')) + N' Rating' AS [Rating], (N'Timeline ' + CAST([m].[Timeline] AS nvarchar(max))) + N' Timeline' AS [Timeline] +SELECT N'HasSoulPatch ' + CAST([g].[HasSoulPatch] AS nvarchar(max)) + N' HasSoulPatch' AS [HasSoulPatch], N'Rank ' + CAST([g].[Rank] AS nvarchar(max)) + N' Rank' AS [Rank], N'SquadId ' + CAST([g].[SquadId] AS nvarchar(max)) + N' SquadId' AS [SquadId], N'Rating ' + COALESCE(CAST([m].[Rating] AS nvarchar(max)), N'') + N' Rating' AS [Rating], N'Timeline ' + CAST([m].[Timeline] AS nvarchar(max)) + N' Timeline' AS [Timeline] FROM [Gears] AS [g] CROSS JOIN [Missions] AS [m] ORDER BY [g].[Nickname], [m].[Id] @@ -7359,7 +7347,7 @@ LEFT JOIN ( SELECT [g].[Nickname], [g].[SquadId] FROM [Gears] AS [g] ) AS [t0] ON [t].[GearNickName] = [t0].[Nickname] AND [t].[GearSquadId] = [t0].[SquadId] -WHERE SUBSTRING([t].[Note], 0 + 1, [t0].[SquadId]) = [t].[GearNickName] OR ((([t].[Note] IS NULL) OR ([t0].[SquadId] IS NULL)) AND ([t].[GearNickName] IS NULL)) +WHERE SUBSTRING([t].[Note], 0 + 1, [t0].[SquadId]) = [t].[GearNickName] OR (([t].[Note] IS NULL OR [t0].[SquadId] IS NULL) AND [t].[GearNickName] IS NULL) """); } @@ -7378,7 +7366,7 @@ LEFT JOIN ( FROM [Gears] AS [g] ) AS [t0] ON [t].[GearNickName] = [t0].[Nickname] AND [t].[GearSquadId] = [t0].[SquadId] LEFT JOIN [Squads] AS [s] ON [t0].[SquadId] = [s].[Id] -WHERE SUBSTRING([t].[Note], 0 + 1, CAST(LEN([s].[Name]) AS int)) = [t].[GearNickName] OR ((([t].[Note] IS NULL) OR ([s].[Name] IS NULL)) AND ([t].[GearNickName] IS NULL)) +WHERE SUBSTRING([t].[Note], 0 + 1, CAST(LEN([s].[Name]) AS int)) = [t].[GearNickName] OR (([t].[Note] IS NULL OR [s].[Name] IS NULL) AND [t].[GearNickName] IS NULL) """); } @@ -7429,7 +7417,7 @@ FROM [Gears] AS [g] LEFT JOIN [Officers] AS [o] ON [g].[Nickname] = [o].[Nickname] AND [g].[SquadId] = [o].[SquadId] LEFT JOIN [Tags] AS [t] ON [g].[Nickname] = [t].[GearNickName] AND [g].[SquadId] = [t].[GearSquadId] LEFT JOIN [Tags] AS [t0] ON [g].[Nickname] = [t0].[GearNickName] AND [g].[SquadId] = [t0].[GearSquadId] -WHERE ([t].[Note] <> N'Foo' OR ([t].[Note] IS NULL)) AND ([o].[Nickname] IS NOT NULL) AND ([t0].[Note] <> N'Bar' OR ([t0].[Note] IS NULL)) +WHERE ([t].[Note] <> N'Foo' OR [t].[Note] IS NULL) AND [o].[Nickname] IS NOT NULL AND ([t0].[Note] <> N'Bar' OR [t0].[Note] IS NULL) """); } @@ -7446,7 +7434,7 @@ FROM [Gears] AS [g] LEFT JOIN [Officers] AS [o] ON [g].[Nickname] = [o].[Nickname] AND [g].[SquadId] = [o].[SquadId] LEFT JOIN [Tags] AS [t] ON [g].[Nickname] = [t].[GearNickName] AND [g].[SquadId] = [t].[GearSquadId] LEFT JOIN [Cities] AS [c] ON [g].[AssignedCityName] = [c].[Name] -WHERE ([t].[Note] <> N'Foo' OR ([t].[Note] IS NULL)) AND ([o].[Nickname] IS NOT NULL) AND ([c].[Location] <> 'Bar' OR ([c].[Location] IS NULL)) +WHERE ([t].[Note] <> N'Foo' OR [t].[Note] IS NULL) AND [o].[Nickname] IS NOT NULL AND ([c].[Location] <> 'Bar' OR [c].[Location] IS NULL) """); } @@ -7464,7 +7452,7 @@ FROM [Gears] AS [g] LEFT JOIN [Tags] AS [t] ON [g].[Nickname] = [t].[GearNickName] AND [g].[SquadId] = [t].[GearSquadId] INNER JOIN [Weapons] AS [w] ON [g].[FullName] = [w].[OwnerFullName] LEFT JOIN [Tags] AS [t0] ON [g].[Nickname] = [t0].[GearNickName] AND [g].[SquadId] = [t0].[GearSquadId] -WHERE ([t].[Note] <> N'Foo' OR ([t].[Note] IS NULL)) AND ([o].[Nickname] IS NOT NULL) AND ([t0].[Note] <> N'Bar' OR ([t0].[Note] IS NULL)) +WHERE ([t].[Note] <> N'Foo' OR [t].[Note] IS NULL) AND [o].[Nickname] IS NOT NULL AND ([t0].[Note] <> N'Bar' OR [t0].[Note] IS NULL) """); } @@ -7497,7 +7485,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 """); } @@ -7518,7 +7506,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) """); } @@ -7539,7 +7527,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) """); } @@ -7580,7 +7568,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] """); } @@ -7685,7 +7673,7 @@ public override async Task Left_join_projection_using_conditional_tracking(bool AssertSql( """ SELECT CASE - WHEN ([t].[Nickname] IS NULL) OR ([t].[SquadId] IS NULL) THEN CAST(1 AS bit) + WHEN [t].[Nickname] IS NULL OR [t].[SquadId] IS NULL THEN CAST(1 AS bit) ELSE CAST(0 AS bit) END, [g].[Nickname], [g].[SquadId], [g].[AssignedCityName], [g].[CityOfBirthName], [g].[FullName], [g].[HasSoulPatch], [g].[LeaderNickname], [g].[LeaderSquadId], [g].[Rank], CASE WHEN [o].[Nickname] IS NOT NULL THEN N'Officer' @@ -7727,7 +7715,7 @@ FROM [Gears] AS [g0] LEFT JOIN [Officers] AS [o0] ON [g0].[Nickname] = [o0].[Nickname] AND [g0].[SquadId] = [o0].[SquadId] ) AS [t2] WHERE [t2].[row] <= 50 -) AS [t1] ON ([t0].[Nickname] = [t1].[LeaderNickname] OR (([t0].[Nickname] IS NULL) AND ([t1].[LeaderNickname] IS NULL))) AND [t0].[SquadId] = [t1].[LeaderSquadId] +) AS [t1] ON ([t0].[Nickname] = [t1].[LeaderNickname] OR ([t0].[Nickname] IS NULL AND [t1].[LeaderNickname] IS NULL)) AND [t0].[SquadId] = [t1].[LeaderSquadId] WHERE [t0].[Discriminator] = N'Officer' ORDER BY [t].[Id], [t0].[Nickname], [t0].[SquadId], [t1].[Nickname] """); @@ -7754,7 +7742,7 @@ WHEN [o0].[Nickname] IS NOT NULL THEN N'Officer' END AS [Discriminator] FROM [Gears] AS [g0] LEFT JOIN [Officers] AS [o0] ON [g0].[Nickname] = [o0].[Nickname] AND [g0].[SquadId] = [o0].[SquadId] -) AS [t1] ON ([t0].[Nickname] = [t1].[LeaderNickname] OR (([t0].[Nickname] IS NULL) AND ([t1].[LeaderNickname] IS NULL))) AND [t0].[SquadId] = [t1].[LeaderSquadId] +) AS [t1] ON ([t0].[Nickname] = [t1].[LeaderNickname] OR ([t0].[Nickname] IS NULL AND [t1].[LeaderNickname] IS NULL)) AND [t0].[SquadId] = [t1].[LeaderSquadId] WHERE [t0].[Discriminator] = N'Officer' ORDER BY [t].[Id], [t0].[Nickname], [t0].[SquadId], [t1].[Nickname] """); @@ -7774,7 +7762,7 @@ WHEN [o].[Nickname] IS NOT NULL THEN N'Officer' END AS [Discriminator] FROM [Gears] AS [g] LEFT JOIN [Officers] AS [o] ON [g].[Nickname] = [o].[Nickname] AND [g].[SquadId] = [o].[SquadId] -) AS [t0] ON [t].[GearNickName] = [t0].[Nickname] AND [t].[GearSquadId] = [t0].[SquadId] AND ([t].[Note] IS NOT NULL) +) AS [t0] ON [t].[GearNickName] = [t0].[Nickname] AND [t].[GearSquadId] = [t0].[SquadId] AND [t].[Note] IS NOT NULL ORDER BY [t].[Id], [t0].[Nickname] """); } @@ -7884,7 +7872,7 @@ SELECT [l0].[Name] FROM [LocustLeaders] AS [l0] INNER JOIN [LocustCommanders] AS [l1] ON [l0].[Name] = [l1].[Name] ) AS [t] ON [l].[CommanderName] = [t].[Name] -WHERE ([l].[Id] IS NOT NULL) AND ([t].[Name] IS NOT NULL) +WHERE [l].[Id] IS NOT NULL AND [t].[Name] IS NOT NULL """); } @@ -7967,7 +7955,7 @@ public override async Task Navigation_based_on_complex_expression6(bool async) AssertSql( """ SELECT CASE - WHEN [t0].[Name] = N'Queen Myrrah' AND ([t0].[Name] IS NOT NULL) THEN CAST(1 AS bit) + WHEN [t0].[Name] = N'Queen Myrrah' AND [t0].[Name] IS NOT NULL THEN CAST(1 AS bit) ELSE CAST(0 AS bit) END, [t0].[Name], [t0].[LocustHordeId], [t0].[ThreatLevel], [t0].[ThreatLevelByte], [t0].[ThreatLevelNullableByte], [t0].[DefeatedByNickname], [t0].[DefeatedBySquadId], [t0].[HighCommandId], [t].[Name], [t].[LocustHordeId], [t].[ThreatLevel], [t].[ThreatLevelByte], [t].[ThreatLevelNullableByte], [t].[DefeatedByNickname], [t].[DefeatedBySquadId], [t].[HighCommandId], [t].[Discriminator] FROM [Factions] AS [f] @@ -8043,7 +8031,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] @@ -8095,7 +8083,7 @@ public override async Task Accessing_property_of_optional_navigation_in_child_pr AssertSql( """ SELECT CASE - WHEN ([t0].[Nickname] IS NOT NULL) AND ([t0].[SquadId] IS NOT NULL) THEN CAST(1 AS bit) + WHEN [t0].[Nickname] IS NOT NULL AND [t0].[SquadId] IS NOT NULL THEN CAST(1 AS bit) ELSE CAST(0 AS bit) END, [t].[Id], [t0].[Nickname], [t0].[SquadId], [t1].[Nickname], [t1].[Id], [t1].[SquadId] FROM [Tags] AS [t] @@ -8127,7 +8115,7 @@ WHERE EXISTS ( SELECT 1 FROM [Gears] AS [g] LEFT JOIN [Officers] AS [o] ON [g].[Nickname] = [o].[Nickname] AND [g].[SquadId] = [o].[SquadId] - WHERE [c].[Name] = [g].[CityOfBirthName] AND ([o].[Nickname] IS NOT NULL) AND [g].[Nickname] = N'Marcus') + WHERE [c].[Name] = [g].[CityOfBirthName] AND [o].[Nickname] IS NOT NULL AND [g].[Nickname] = N'Marcus') """); } @@ -8455,7 +8443,7 @@ WHEN [o].[Nickname] IS NOT NULL THEN N'Officer' END AS [Discriminator] FROM [Gears] AS [g] LEFT JOIN [Officers] AS [o] ON [g].[Nickname] = [o].[Nickname] AND [g].[SquadId] = [o].[SquadId] -WHERE ([g].[Rank] & @__rank_0) = @__rank_0 +WHERE [g].[Rank] & @__rank_0 = @__rank_0 """, // """ @@ -8474,7 +8462,7 @@ WHEN [o].[Nickname] IS NOT NULL THEN N'Officer' END AS [Discriminator] FROM [Gears] AS [g] LEFT JOIN [Officers] AS [o] ON [g].[Nickname] = [o].[Nickname] AND [g].[SquadId] = [o].[SquadId] -WHERE ([g].[Rank] | @__rank_0) <> @__rank_0 +WHERE [g].[Rank] | @__rank_0 <> @__rank_0 """, // """ @@ -8504,12 +8492,12 @@ SELECT TOP(1) [c0].[Name] FROM [Gears] AS [g] LEFT JOIN [Officers] AS [o] ON [g].[Nickname] = [o].[Nickname] AND [g].[SquadId] = [o].[SquadId] INNER JOIN [Cities] AS [c0] ON [g].[CityOfBirthName] = [c0].[Name] - ORDER BY [g].[Nickname]) OR (([c].[Name] IS NULL) AND (( + ORDER BY [g].[Nickname]) OR ([c].[Name] IS NULL AND ( SELECT TOP(1) [c0].[Name] FROM [Gears] AS [g] LEFT JOIN [Officers] AS [o] ON [g].[Nickname] = [o].[Nickname] AND [g].[SquadId] = [o].[SquadId] INNER JOIN [Cities] AS [c0] ON [g].[CityOfBirthName] = [c0].[Name] - ORDER BY [g].[Nickname]) IS NULL)) + ORDER BY [g].[Nickname]) IS NULL) """); } @@ -8526,14 +8514,14 @@ 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] & @__ranks_0) <> 0 +WHERE [g].[Rank] & @__ranks_0 <> 0 """, // """ @__ranks_0='134' SELECT CASE - WHEN ([g].[Rank] | @__ranks_0) = @__ranks_0 THEN CAST(1 AS bit) + WHEN [g].[Rank] | @__ranks_0 = @__ranks_0 THEN CAST(1 AS bit) ELSE CAST(0 AS bit) END FROM [Gears] AS [g] @@ -8543,7 +8531,7 @@ FROM [Gears] AS [g] @__ranks_0='134' SELECT CASE - WHEN ([g].[Rank] | ([g].[Rank] | (@__ranks_0 | ([g].[Rank] | @__ranks_0)))) = @__ranks_0 THEN CAST(1 AS bit) + WHEN [g].[Rank] | [g].[Rank] | @__ranks_0 | [g].[Rank] | @__ranks_0 = @__ranks_0 THEN CAST(1 AS bit) ELSE CAST(0 AS bit) END FROM [Gears] AS [g] @@ -8583,7 +8571,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 """, // """ @@ -8591,7 +8579,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) = @__prm_0 +WHERE [w].[AmmunitionType] & @__prm_0 = @__prm_0 """); } @@ -8656,10 +8644,10 @@ WHERE [l1].[Id] IS NOT NULL 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) +END IS NULL """); } @@ -8780,10 +8768,10 @@ WHERE CASE WHEN ( SELECT TOP(1) [w].[Name] FROM [Weapons] AS [w] - WHERE [w].[Id] = [g].[SquadId]) = @__prm2_1 AND (( + WHERE [w].[Id] = [g].[SquadId]) = @__prm2_1 AND ( SELECT TOP(1) [w].[Name] FROM [Weapons] AS [w] - WHERE [w].[Id] = [g].[SquadId]) IS NOT NULL) THEN CAST(1 AS bit) + WHERE [w].[Id] = [g].[SquadId]) IS NOT NULL THEN CAST(1 AS bit) ELSE CAST(0 AS bit) END ELSE CAST(0 AS bit) @@ -8924,7 +8912,7 @@ 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 CAST([l].[ThreatLevel] AS bigint) >= (CAST(5 AS bigint) + CAST([l].[ThreatLevel] AS bigint)) +WHERE CAST([l].[ThreatLevel] AS bigint) >= CAST(5 AS bigint) + CAST([l].[ThreatLevel] AS bigint) """); } @@ -9054,7 +9042,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)) """); } @@ -9181,7 +9169,7 @@ WHERE EXISTS ( SELECT 1 FROM [LocustLeaders] AS [l1] LEFT JOIN [LocustCommanders] AS [l2] ON [l1].[Name] = [l2].[Name] - WHERE [l1].[ThreatLevelNullableByte] = [l].[ThreatLevelNullableByte] OR (([l1].[ThreatLevelNullableByte] IS NULL) AND ([l].[ThreatLevelNullableByte] IS NULL))) + WHERE [l1].[ThreatLevelNullableByte] = [l].[ThreatLevelNullableByte] OR ([l1].[ThreatLevelNullableByte] IS NULL AND [l].[ThreatLevelNullableByte] IS NULL)) ) AS [t] """); } @@ -9204,7 +9192,7 @@ WHERE NOT (EXISTS ( SELECT 1 FROM [LocustLeaders] AS [l1] LEFT JOIN [LocustCommanders] AS [l2] ON [l1].[Name] = [l2].[Name] - WHERE [l1].[ThreatLevelNullableByte] = [l].[ThreatLevelNullableByte] OR (([l1].[ThreatLevelNullableByte] IS NULL) AND ([l].[ThreatLevelNullableByte] IS NULL)))) + WHERE [l1].[ThreatLevelNullableByte] = [l].[ThreatLevelNullableByte] OR ([l1].[ThreatLevelNullableByte] IS NULL AND [l].[ThreatLevelNullableByte] IS NULL))) ) AS [t] """); } @@ -9236,7 +9224,7 @@ WHEN [o].[Nickname] IS NOT NULL THEN N'Officer' END AS [Discriminator] FROM [Gears] AS [g] LEFT JOIN [Officers] AS [o] ON [g].[Nickname] = [o].[Nickname] AND [g].[SquadId] = [o].[SquadId] -WHERE (@__prm_0 & [g].[Rank]) = [g].[Rank] +WHERE @__prm_0 & [g].[Rank] = [g].[Rank] """); } @@ -9253,7 +9241,7 @@ WHEN [o].[Nickname] IS NOT NULL THEN N'Officer' END AS [Discriminator] FROM [Gears] AS [g] LEFT JOIN [Officers] AS [o] ON [g].[Nickname] = [o].[Nickname] AND [g].[SquadId] = [o].[SquadId] -WHERE (@__prm_0 & CAST([g].[Rank] AS int)) = CAST([g].[Rank] AS int) +WHERE @__prm_0 & CAST([g].[Rank] AS int) = CAST([g].[Rank] AS int) """); } @@ -9280,7 +9268,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) """); } @@ -9352,7 +9340,7 @@ WHEN [o].[Nickname] IS NOT NULL THEN N'Officer' END AS [Discriminator], [w].[Id], [w].[AmmunitionType], [w].[IsAutomatic], [w].[Name], [w].[OwnerFullName], [w].[SynergyWithId] FROM [Gears] AS [g] LEFT JOIN [Officers] AS [o] ON [g].[Nickname] = [o].[Nickname] AND [g].[SquadId] = [o].[SquadId] -INNER JOIN [Weapons] AS [w] ON [g].[FullName] <> [w].[OwnerFullName] OR ([w].[OwnerFullName] IS NULL) +INNER JOIN [Weapons] AS [w] ON [g].[FullName] <> [w].[OwnerFullName] OR [w].[OwnerFullName] IS NULL ORDER BY [g].[Nickname], [w].[Id] """); } @@ -9368,7 +9356,7 @@ WHEN [o].[Nickname] IS NOT NULL THEN N'Officer' END AS [Discriminator], [w].[Id], [w].[AmmunitionType], [w].[IsAutomatic], [w].[Name], [w].[OwnerFullName], [w].[SynergyWithId] FROM [Gears] AS [g] LEFT JOIN [Officers] AS [o] ON [g].[Nickname] = [o].[Nickname] AND [g].[SquadId] = [o].[SquadId] -LEFT JOIN [Weapons] AS [w] ON [g].[FullName] <> [w].[OwnerFullName] OR ([w].[OwnerFullName] IS NULL) +LEFT JOIN [Weapons] AS [w] ON [g].[FullName] <> [w].[OwnerFullName] OR [w].[OwnerFullName] IS NULL ORDER BY [g].[Nickname], [w].[Id] """); } @@ -9389,7 +9377,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] """); } @@ -9402,7 +9390,7 @@ public override async Task SelectMany_without_result_selector_and_non_equality_c """ 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 """); } @@ -9459,7 +9447,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] @@ -9512,7 +9500,7 @@ 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) """, // """ @@ -9521,7 +9509,7 @@ 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) """); } @@ -9662,7 +9650,7 @@ LEFT JOIN ( SELECT [g].[Nickname], [g].[SquadId] FROM [Gears] AS [g] ) AS [t] ON [l0].[DefeatedByNickname] = [t].[Nickname] AND [l0].[DefeatedBySquadId] = [t].[SquadId] -WHERE ([l0].[Name] IS NOT NULL) AND (([t].[Nickname] IS NULL) OR ([t].[SquadId] IS NULL)) +WHERE [l0].[Name] IS NOT NULL AND ([t].[Nickname] IS NULL OR [t].[SquadId] IS NULL) """); } @@ -9681,7 +9669,7 @@ LEFT JOIN ( SELECT [g].[Nickname], [g].[SquadId] FROM [Gears] AS [g] ) AS [t] ON [l0].[DefeatedByNickname] = [t].[Nickname] AND [l0].[DefeatedBySquadId] = [t].[SquadId] -WHERE ([l0].[Name] IS NOT NULL) AND ([t].[Nickname] IS NOT NULL) AND ([t].[SquadId] IS NOT NULL) +WHERE [l0].[Name] IS NOT NULL AND [t].[Nickname] IS NOT NULL AND [t].[SquadId] IS NOT NULL """); } @@ -9722,10 +9710,10 @@ LEFT JOIN ( SELECT [g].[Nickname], [g].[SquadId], [g].[HasSoulPatch] FROM [Gears] AS [g] ) AS [t0] ON [t].[GearNickName] = [t0].[Nickname] AND [t].[GearSquadId] = [t0].[SquadId] -WHERE (CASE +WHERE CASE WHEN [t].[GearNickName] IS NOT NULL THEN [t0].[SquadId] ELSE NULL -END + 1) = 2 +END + 1 = 2 """); } @@ -9758,7 +9746,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 @@ -9905,10 +9893,10 @@ LEFT JOIN ( SELECT [g].[Nickname], [g].[SquadId], [g].[HasSoulPatch] FROM [Gears] AS [g] ) AS [t0] ON [t].[GearNickName] = [t0].[Nickname] AND [t].[GearSquadId] = [t0].[SquadId] -WHERE (CASE +WHERE CASE WHEN [t].[GearNickName] IS NOT NULL THEN [t0].[Nickname] ELSE NULL -END IS NOT NULL) AND CASE +END IS NOT NULL AND CASE WHEN [t].[GearNickName] IS NOT NULL THEN [t0].[HasSoulPatch] ELSE NULL END = CAST(0 AS bit) @@ -9925,7 +9913,7 @@ public override async Task Projecting_property_converted_to_nullable_into_member SELECT [g].[Nickname] FROM [Gears] AS [g] LEFT JOIN [Tags] AS [t] ON [g].[Nickname] = [t].[GearNickName] AND [g].[SquadId] = [t].[GearSquadId] -WHERE DATEPART(month, [t].[IssueDate]) <> 5 OR ([t].[IssueDate] IS NULL) +WHERE DATEPART(month, [t].[IssueDate]) <> 5 OR [t].[IssueDate] IS NULL ORDER BY [g].[Nickname] """); } @@ -10127,7 +10115,7 @@ public override async Task Project_navigation_defined_on_derived_from_entity_wit SELECT [l].[Name], [l].[LocustHordeId], [l].[ThreatLevel], [l].[ThreatLevelByte], [l].[ThreatLevelNullableByte], [l0].[DefeatedByNickname], [l0].[DefeatedBySquadId], [l0].[HighCommandId], CASE WHEN [l0].[Name] IS NOT NULL THEN N'LocustCommander' END AS [Discriminator], [t].[Nickname], [t].[SquadId], [t].[AssignedCityName], [t].[CityOfBirthName], [t].[FullName], [t].[HasSoulPatch], [t].[LeaderNickname], [t].[LeaderSquadId], [t].[Rank], [t].[Discriminator], CASE - WHEN ([t].[Nickname] IS NULL) OR ([t].[SquadId] IS NULL) THEN CAST(1 AS bit) + WHEN [t].[Nickname] IS NULL OR [t].[SquadId] IS NULL THEN CAST(1 AS bit) ELSE CAST(0 AS bit) END AS [IsNull], [t0].[Id], [t0].[CapitalName], [t0].[Name], [t0].[ServerAddress], [t0].[CommanderName], [t0].[Eradicated], CASE WHEN [t0].[Id] IS NULL THEN CAST(1 AS bit) @@ -10782,7 +10770,7 @@ public override async Task String_concat_nullable_expressions_are_coalesced(bool AssertSql( """ -SELECT (([g].[FullName] + N'') + COALESCE([g].[LeaderNickname], N'')) + N'' +SELECT [g].[FullName] + N'' + COALESCE([g].[LeaderNickname], N'') + N'' FROM [Gears] AS [g] """); } diff --git a/test/EFCore.SqlServer.FunctionalTests/Query/TPTInheritanceQuerySqlServerTest.cs b/test/EFCore.SqlServer.FunctionalTests/Query/TPTInheritanceQuerySqlServerTest.cs index 492b4f5f3f7..111a361639b 100644 --- a/test/EFCore.SqlServer.FunctionalTests/Query/TPTInheritanceQuerySqlServerTest.cs +++ b/test/EFCore.SqlServer.FunctionalTests/Query/TPTInheritanceQuerySqlServerTest.cs @@ -314,7 +314,7 @@ FROM [Animals] AS [a] LEFT JOIN [Birds] AS [b] ON [a].[Id] = [b].[Id] LEFT JOIN [Eagle] AS [e] ON [a].[Id] = [e].[Id] LEFT JOIN [Kiwi] AS [k] ON [a].[Id] = [k].[Id] -WHERE ([k].[Id] IS NOT NULL) AND [a].[CountryId] = 1 +WHERE [k].[Id] IS NOT NULL AND [a].[CountryId] = 1 """); } @@ -350,7 +350,7 @@ FROM [Animals] AS [a] LEFT JOIN [Birds] AS [b] ON [a].[Id] = [b].[Id] LEFT JOIN [Eagle] AS [e] ON [a].[Id] = [e].[Id] LEFT JOIN [Kiwi] AS [k] ON [a].[Id] = [k].[Id] -WHERE ([k].[Id] IS NOT NULL) OR ([e].[Id] IS NOT NULL) +WHERE [k].[Id] IS NOT NULL OR [e].[Id] IS NOT NULL ORDER BY [a].[Species] """); } @@ -369,7 +369,7 @@ FROM [Animals] AS [a] LEFT JOIN [Birds] AS [b] ON [a].[Id] = [b].[Id] LEFT JOIN [Eagle] AS [e] ON [a].[Id] = [e].[Id] LEFT JOIN [Kiwi] AS [k] ON [a].[Id] = [k].[Id] -WHERE ([k].[Id] IS NOT NULL) OR ([e].[Id] IS NOT NULL) +WHERE [k].[Id] IS NOT NULL OR [e].[Id] IS NOT NULL ORDER BY [a].[Species] """); } @@ -388,7 +388,7 @@ FROM [Animals] AS [a] LEFT JOIN [Birds] AS [b] ON [a].[Id] = [b].[Id] LEFT JOIN [Eagle] AS [e] ON [a].[Id] = [e].[Id] LEFT JOIN [Kiwi] AS [k] ON [a].[Id] = [k].[Id] -WHERE [a].[CountryId] = 1 AND (([k].[Id] IS NOT NULL) OR ([e].[Id] IS NOT NULL)) +WHERE [a].[CountryId] = 1 AND ([k].[Id] IS NOT NULL OR [e].[Id] IS NOT NULL) ORDER BY [a].[Species] """); } @@ -404,7 +404,7 @@ FROM [Animals] AS [a] LEFT JOIN [Birds] AS [b] ON [a].[Id] = [b].[Id] LEFT JOIN [Eagle] AS [e] ON [a].[Id] = [e].[Id] LEFT JOIN [Kiwi] AS [k] ON [a].[Id] = [k].[Id] -WHERE ([k].[Id] IS NOT NULL) OR ([e].[Id] IS NOT NULL) +WHERE [k].[Id] IS NOT NULL OR [e].[Id] IS NOT NULL """); } @@ -436,7 +436,7 @@ END AS [Discriminator] FROM [Animals] AS [a] LEFT JOIN [Birds] AS [b] ON [a].[Id] = [b].[Id] LEFT JOIN [Kiwi] AS [k] ON [a].[Id] = [k].[Id] -WHERE ([k].[Id] IS NOT NULL) AND [k].[FoundOn] = CAST(0 AS tinyint) +WHERE [k].[Id] IS NOT NULL AND [k].[FoundOn] = CAST(0 AS tinyint) """); } @@ -452,7 +452,7 @@ END AS [Discriminator] FROM [Animals] AS [a] LEFT JOIN [Birds] AS [b] ON [a].[Id] = [b].[Id] LEFT JOIN [Kiwi] AS [k] ON [a].[Id] = [k].[Id] -WHERE ([k].[Id] IS NOT NULL) AND [k].[FoundOn] = CAST(1 AS tinyint) +WHERE [k].[Id] IS NOT NULL AND [k].[FoundOn] = CAST(1 AS tinyint) """); } @@ -698,7 +698,7 @@ FROM [Animals] AS [a] LEFT JOIN [Birds] AS [b] ON [a].[Id] = [b].[Id] LEFT JOIN [Eagle] AS [e] ON [a].[Id] = [e].[Id] LEFT JOIN [Kiwi] AS [k] ON [a].[Id] = [k].[Id] -WHERE ([k].[Id] IS NOT NULL) AND ([e].[Id] IS NOT NULL) +WHERE [k].[Id] IS NOT NULL AND [e].[Id] IS NOT NULL """); } @@ -715,7 +715,7 @@ FROM [Animals] AS [a] LEFT JOIN [Birds] AS [b] ON [a].[Id] = [b].[Id] LEFT JOIN [Eagle] AS [e] ON [a].[Id] = [e].[Id] LEFT JOIN [Kiwi] AS [k] ON [a].[Id] = [k].[Id] -WHERE ([k].[Id] IS NOT NULL) AND ([e].[Id] IS NOT NULL) +WHERE [k].[Id] IS NOT NULL AND [e].[Id] IS NOT NULL """); } diff --git a/test/EFCore.SqlServer.FunctionalTests/Query/TPTManyToManyNoTrackingQuerySqlServerTest.cs b/test/EFCore.SqlServer.FunctionalTests/Query/TPTManyToManyNoTrackingQuerySqlServerTest.cs index dec1d4c0fdb..2a949c57378 100644 --- a/test/EFCore.SqlServer.FunctionalTests/Query/TPTManyToManyNoTrackingQuerySqlServerTest.cs +++ b/test/EFCore.SqlServer.FunctionalTests/Query/TPTManyToManyNoTrackingQuerySqlServerTest.cs @@ -48,7 +48,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%') """); } @@ -64,7 +64,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%') """); } @@ -119,7 +119,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] """); } @@ -151,7 +151,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] """); } @@ -1957,7 +1957,7 @@ FROM [Roots] AS [r] LEFT JOIN [Branch2s] AS [b0] ON [r].[Id] = [b0].[Id] LEFT JOIN [Leaves] AS [l] ON [r].[Id] = [l].[Id] LEFT JOIN [Leaf2s] AS [l0] ON [r].[Id] = [l0].[Id] -WHERE ([l0].[Id] IS NULL) AND ([l].[Id] IS NULL) AND ([b].[Id] IS NULL) +WHERE [l0].[Id] IS NULL AND [l].[Id] IS NULL AND [b].[Id] IS NULL """); } @@ -1977,7 +1977,7 @@ FROM [Roots] AS [r] LEFT JOIN [Branch2s] AS [b0] ON [r].[Id] = [b0].[Id] LEFT JOIN [Leaves] AS [l] ON [r].[Id] = [l].[Id] LEFT JOIN [Leaf2s] AS [l0] ON [r].[Id] = [l0].[Id] -WHERE ([l].[Id] IS NULL) AND ([b].[Id] IS NOT NULL) +WHERE [l].[Id] IS NULL AND [b].[Id] IS NOT NULL """); } @@ -2103,7 +2103,7 @@ WHERE EXISTS ( SELECT 1 FROM [UnidirectionalEntityOneUnidirectionalEntityTwo] AS [u0] INNER JOIN [UnidirectionalEntityTwos] AS [u1] ON [u0].[TwoSkipSharedId] = [u1].[Id] - WHERE [u].[Id] = [u0].[UnidirectionalEntityOneId] AND ([u1].[Name] LIKE N'%B%')) + WHERE [u].[Id] = [u0].[UnidirectionalEntityOneId] AND [u1].[Name] LIKE N'%B%') """); } @@ -2158,7 +2158,7 @@ FROM [UnidirectionalRoots] AS [u1] INNER JOIN [UnidirectionalBranches] AS [u2] ON [u1].[Id] = [u2].[Id] LEFT JOIN [UnidirectionalLeaves] AS [u3] ON [u1].[Id] = [u3].[Id] ) AS [t] ON [u0].[UnidirectionalEntityBranchId] = [t].[Id] - WHERE [u].[Id] = [u0].[UnidirectionalEntityOneId] AND ([t].[Name] IS NOT NULL) AND ([t].[Name] LIKE N'L%')), [u].[Id] + WHERE [u].[Id] = [u0].[UnidirectionalEntityOneId] AND [t].[Name] IS NOT NULL AND [t].[Name] LIKE N'L%'), [u].[Id] """); } @@ -2690,7 +2690,7 @@ END AS [Discriminator] FROM [UnidirectionalRoots] AS [u] LEFT JOIN [UnidirectionalBranches] AS [u0] ON [u].[Id] = [u0].[Id] LEFT JOIN [UnidirectionalLeaves] AS [u1] ON [u].[Id] = [u1].[Id] -WHERE ([u1].[Id] IS NULL) AND ([u0].[Id] IS NULL) +WHERE [u1].[Id] IS NULL AND [u0].[Id] IS NULL """); } @@ -2707,7 +2707,7 @@ END AS [Discriminator] FROM [UnidirectionalRoots] AS [u] LEFT JOIN [UnidirectionalBranches] AS [u0] ON [u].[Id] = [u0].[Id] LEFT JOIN [UnidirectionalLeaves] AS [u1] ON [u].[Id] = [u1].[Id] -WHERE ([u1].[Id] IS NULL) AND ([u0].[Id] IS NOT NULL) +WHERE [u1].[Id] IS NULL AND [u0].[Id] IS NOT NULL """); } diff --git a/test/EFCore.SqlServer.FunctionalTests/Query/TPTManyToManyQuerySqlServerTest.cs b/test/EFCore.SqlServer.FunctionalTests/Query/TPTManyToManyQuerySqlServerTest.cs index 7fa25a71da1..6090d1e01af 100644 --- a/test/EFCore.SqlServer.FunctionalTests/Query/TPTManyToManyQuerySqlServerTest.cs +++ b/test/EFCore.SqlServer.FunctionalTests/Query/TPTManyToManyQuerySqlServerTest.cs @@ -47,7 +47,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%') """); } @@ -63,7 +63,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%') """); } @@ -118,7 +118,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] """); } @@ -150,7 +150,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] """); } @@ -1964,7 +1964,7 @@ FROM [Roots] AS [r] LEFT JOIN [Branch2s] AS [b0] ON [r].[Id] = [b0].[Id] LEFT JOIN [Leaves] AS [l] ON [r].[Id] = [l].[Id] LEFT JOIN [Leaf2s] AS [l0] ON [r].[Id] = [l0].[Id] -WHERE ([l0].[Id] IS NULL) AND ([l].[Id] IS NULL) AND ([b].[Id] IS NULL) +WHERE [l0].[Id] IS NULL AND [l].[Id] IS NULL AND [b].[Id] IS NULL """); } @@ -1984,7 +1984,7 @@ FROM [Roots] AS [r] LEFT JOIN [Branch2s] AS [b0] ON [r].[Id] = [b0].[Id] LEFT JOIN [Leaves] AS [l] ON [r].[Id] = [l].[Id] LEFT JOIN [Leaf2s] AS [l0] ON [r].[Id] = [l0].[Id] -WHERE ([l].[Id] IS NULL) AND ([b].[Id] IS NOT NULL) +WHERE [l].[Id] IS NULL AND [b].[Id] IS NOT NULL """); } @@ -2103,7 +2103,7 @@ WHERE EXISTS ( SELECT 1 FROM [UnidirectionalEntityOneUnidirectionalEntityTwo] AS [u0] INNER JOIN [UnidirectionalEntityTwos] AS [u1] ON [u0].[TwoSkipSharedId] = [u1].[Id] - WHERE [u].[Id] = [u0].[UnidirectionalEntityOneId] AND ([u1].[Name] LIKE N'%B%')) + WHERE [u].[Id] = [u0].[UnidirectionalEntityOneId] AND [u1].[Name] LIKE N'%B%') """); } @@ -2158,7 +2158,7 @@ FROM [UnidirectionalRoots] AS [u1] INNER JOIN [UnidirectionalBranches] AS [u2] ON [u1].[Id] = [u2].[Id] LEFT JOIN [UnidirectionalLeaves] AS [u3] ON [u1].[Id] = [u3].[Id] ) AS [t] ON [u0].[UnidirectionalEntityBranchId] = [t].[Id] - WHERE [u].[Id] = [u0].[UnidirectionalEntityOneId] AND ([t].[Name] IS NOT NULL) AND ([t].[Name] LIKE N'L%')), [u].[Id] + WHERE [u].[Id] = [u0].[UnidirectionalEntityOneId] AND [t].[Name] IS NOT NULL AND [t].[Name] LIKE N'L%'), [u].[Id] """); } @@ -2713,7 +2713,7 @@ END AS [Discriminator] FROM [UnidirectionalRoots] AS [u] LEFT JOIN [UnidirectionalBranches] AS [u0] ON [u].[Id] = [u0].[Id] LEFT JOIN [UnidirectionalLeaves] AS [u1] ON [u].[Id] = [u1].[Id] -WHERE ([u1].[Id] IS NULL) AND ([u0].[Id] IS NULL) +WHERE [u1].[Id] IS NULL AND [u0].[Id] IS NULL """); } @@ -2730,7 +2730,7 @@ END AS [Discriminator] FROM [UnidirectionalRoots] AS [u] LEFT JOIN [UnidirectionalBranches] AS [u0] ON [u].[Id] = [u0].[Id] LEFT JOIN [UnidirectionalLeaves] AS [u1] ON [u].[Id] = [u1].[Id] -WHERE ([u1].[Id] IS NULL) AND ([u0].[Id] IS NOT NULL) +WHERE [u1].[Id] IS NULL AND [u0].[Id] IS NOT NULL """); } diff --git a/test/EFCore.SqlServer.FunctionalTests/Query/TPTRelationshipsQuerySqlServerTest.cs b/test/EFCore.SqlServer.FunctionalTests/Query/TPTRelationshipsQuerySqlServerTest.cs index 92765cfb4a2..d5686582360 100644 --- a/test/EFCore.SqlServer.FunctionalTests/Query/TPTRelationshipsQuerySqlServerTest.cs +++ b/test/EFCore.SqlServer.FunctionalTests/Query/TPTRelationshipsQuerySqlServerTest.cs @@ -99,7 +99,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] """); } @@ -121,7 +121,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] """); } @@ -280,7 +280,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] """); } @@ -305,7 +305,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] """); } @@ -414,7 +414,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] """); } @@ -436,7 +436,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] """); } @@ -569,7 +569,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] """); } @@ -592,7 +592,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] """); } @@ -613,7 +613,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] """); } @@ -636,7 +636,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] """); } @@ -685,7 +685,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] """); } @@ -710,7 +710,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] """); } @@ -1225,7 +1225,7 @@ 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] """, // @@ -1233,7 +1233,7 @@ 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] """, // @@ -1241,7 +1241,7 @@ 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] """, // @@ -1255,7 +1255,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] """); } @@ -1278,7 +1278,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] """, // @@ -1290,7 +1290,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] """, // @@ -1302,7 +1302,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] """); } @@ -1395,7 +1395,7 @@ 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] """, // @@ -1403,7 +1403,7 @@ 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] """, // @@ -1411,7 +1411,7 @@ 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] """, // @@ -1419,7 +1419,7 @@ 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] """); } @@ -1439,7 +1439,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] """, // @@ -1451,7 +1451,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] """, // @@ -1463,7 +1463,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 0850234d7f5..dc070726aef 100644 --- a/test/EFCore.SqlServer.FunctionalTests/Query/TemporalComplexNavigationsCollectionsQuerySqlServerTest.cs +++ b/test/EFCore.SqlServer.FunctionalTests/Query/TemporalComplexNavigationsCollectionsQuerySqlServerTest.cs @@ -75,7 +75,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] @@ -95,7 +95,7 @@ LEFT JOIN ( FROM ( SELECT [l0].[Id], [l0].[Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[Name], [l0].[OneToMany_Optional_Inverse2Id], [l0].[OneToMany_Optional_Self_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToMany_Required_Self_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id], [l0].[OneToOne_Optional_Self2Id], [l0].[PeriodEnd], [l0].[PeriodStart], ROW_NUMBER() OVER(PARTITION BY [l0].[OneToMany_Optional_Inverse2Id] ORDER BY [l0].[Id]) AS [row] FROM [LevelTwo] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l0] - WHERE [l0].[Name] <> N'Foo' OR ([l0].[Name] IS NULL) + WHERE [l0].[Name] <> N'Foo' OR [l0].[Name] IS NULL ) AS [t] WHERE [t].[row] <= 3 ) AS [t0] ON [l].[Id] = [t0].[OneToMany_Optional_Inverse2Id] @@ -134,7 +134,7 @@ LEFT JOIN ( SELECT COUNT(*) FROM [LevelTwo] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l0] LEFT JOIN [LevelThree] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l1] ON [l0].[Id] = [l1].[OneToOne_Optional_PK_Inverse3Id] - WHERE [l].[Id] = [l0].[OneToMany_Optional_Inverse2Id] AND ([l1].[Name] <> N'Foo' OR ([l1].[Name] IS NULL))) > 0 + WHERE [l].[Id] = [l0].[OneToMany_Optional_Inverse2Id] AND ([l1].[Name] <> N'Foo' OR [l1].[Name] IS NULL)) > 0 ORDER BY [l].[Id], [t].[Id], [t].[Id0] """); } @@ -153,7 +153,7 @@ LEFT JOIN ( FROM ( SELECT [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Name], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Optional_Self_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[OneToMany_Required_Self_Inverse3Id], [l1].[OneToOne_Optional_PK_Inverse3Id], [l1].[OneToOne_Optional_Self3Id], [l1].[PeriodEnd], [l1].[PeriodStart], ROW_NUMBER() OVER(PARTITION BY [l1].[OneToMany_Optional_Inverse3Id] ORDER BY [l1].[Name]) AS [row] FROM [LevelThree] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l1] - WHERE [l1].[Name] <> N'Foo' OR ([l1].[Name] IS NULL) + WHERE [l1].[Name] <> N'Foo' OR [l1].[Name] IS NULL ) AS [t] WHERE 1 < [t].[row] AND [t].[row] <= 4 ) AS [t0] ON [l0].[Id] = [t0].[OneToMany_Optional_Inverse3Id] @@ -262,7 +262,7 @@ LEFT JOIN ( FROM ( SELECT [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Name], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Optional_Self_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[OneToMany_Required_Self_Inverse3Id], [l1].[OneToOne_Optional_PK_Inverse3Id], [l1].[OneToOne_Optional_Self3Id], [l1].[PeriodEnd], [l1].[PeriodStart], ROW_NUMBER() OVER(PARTITION BY [l1].[OneToMany_Optional_Inverse3Id] ORDER BY [l1].[Name]) AS [row] FROM [LevelThree] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l1] - WHERE [l1].[Name] <> N'Foo' OR ([l1].[Name] IS NULL) + WHERE [l1].[Name] <> N'Foo' OR [l1].[Name] IS NULL ) AS [t] WHERE 1 < [t].[row] AND [t].[row] <= 4 ) AS [t0] ON [l0].[Id] = [t0].[OneToMany_Optional_Inverse3Id] @@ -283,7 +283,7 @@ LEFT JOIN ( FROM ( SELECT 1 AS [c], [l0].[Id], [l0].[OneToMany_Optional_Inverse2Id], ROW_NUMBER() OVER(PARTITION BY [l0].[OneToMany_Optional_Inverse2Id] ORDER BY [l0].[Id]) AS [row] FROM [LevelTwo] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l0] - WHERE [l0].[Name] <> N'Foo' OR ([l0].[Name] IS NULL) + WHERE [l0].[Name] <> N'Foo' OR [l0].[Name] IS NULL ) AS [t] WHERE [t].[row] <= 1 ) AS [t0] ON [l].[Id] = [t0].[OneToMany_Optional_Inverse2Id] @@ -353,7 +353,7 @@ OUTER APPLY ( FROM ( SELECT TOP(2) [l2].[Id], [l2].[Date], [l2].[Level1_Optional_Id], [l2].[Level1_Required_Id], [l2].[Name], [l2].[OneToMany_Optional_Inverse2Id], [l2].[OneToMany_Optional_Self_Inverse2Id], [l2].[OneToMany_Required_Inverse2Id], [l2].[OneToMany_Required_Self_Inverse2Id], [l2].[OneToOne_Optional_PK_Inverse2Id], [l2].[OneToOne_Optional_Self2Id], [l2].[PeriodEnd], [l2].[PeriodStart] FROM [LevelTwo] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l2] - WHERE [l].[Id] = [l2].[OneToMany_Optional_Inverse2Id] AND ([l2].[Name] <> N'Foo' OR ([l2].[Name] IS NULL)) + WHERE [l].[Id] = [l2].[OneToMany_Optional_Inverse2Id] AND ([l2].[Name] <> N'Foo' OR [l2].[Name] IS NULL) ORDER BY [l2].[Id] ) AS [t] LEFT JOIN [LevelThree] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l0] ON [t].[Id] = [l0].[Level2_Required_Id] @@ -373,7 +373,7 @@ public override async Task Include_collection_with_conditional_order_by(bool asy FROM [LevelOne] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l] LEFT JOIN [LevelTwo] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l0] ON [l].[Id] = [l0].[OneToMany_Optional_Inverse2Id] ORDER BY CASE - WHEN ([l].[Name] IS NOT NULL) AND ([l].[Name] LIKE N'%03') THEN 1 + WHEN [l].[Name] IS NOT NULL AND [l].[Name] LIKE N'%03' THEN 1 ELSE 2 END, [l].[Id] """); @@ -436,7 +436,7 @@ public override async Task Include_collection_with_groupby_in_subquery_and_filte SELECT [l].[Name] FROM [LevelOne] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l] GROUP BY [l].[Name] - HAVING [l].[Name] <> N'Foo' OR ([l].[Name] IS NULL) + HAVING [l].[Name] <> N'Foo' OR [l].[Name] IS NULL ) AS [t] LEFT JOIN ( SELECT [t1].[Id], [t1].[Date], [t1].[Name], [t1].[OneToMany_Optional_Self_Inverse1Id], [t1].[OneToMany_Required_Self_Inverse1Id], [t1].[OneToOne_Optional_Self1Id], [t1].[PeriodEnd], [t1].[PeriodStart] @@ -720,7 +720,7 @@ public override async Task Multiple_include_with_multiple_optional_navigations(b LEFT JOIN [LevelTwo] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l3] ON [l].[Id] = [l3].[Level1_Optional_Id] LEFT JOIN [LevelThree] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l4] ON [l3].[Id] = [l4].[Level2_Optional_Id] LEFT JOIN [LevelThree] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l5] ON [l0].[Id] = [l5].[OneToMany_Optional_Inverse3Id] -WHERE [l1].[Name] <> N'Foo' OR ([l1].[Name] IS NULL) +WHERE [l1].[Name] <> N'Foo' OR [l1].[Name] IS NULL ORDER BY [l].[Id], [l0].[Id], [l1].[Id], [l2].[Id], [l3].[Id], [l4].[Id] """); } @@ -863,7 +863,7 @@ LEFT JOIN ( FROM ( SELECT [l0].[Id], [l0].[Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[Name], [l0].[OneToMany_Optional_Inverse2Id], [l0].[OneToMany_Optional_Self_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToMany_Required_Self_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id], [l0].[OneToOne_Optional_Self2Id], [l0].[PeriodEnd], [l0].[PeriodStart], ROW_NUMBER() OVER(PARTITION BY [l0].[OneToMany_Optional_Inverse2Id] ORDER BY [l0].[Id]) AS [row] FROM [LevelTwo] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l0] - WHERE [l0].[Name] <> @__prm_0 OR ([l0].[Name] IS NULL) + WHERE [l0].[Name] <> @__prm_0 OR [l0].[Name] IS NULL ) AS [t] WHERE [t].[row] <= 3 ) AS [t0] ON [l].[Id] = [t0].[OneToMany_Optional_Inverse2Id] @@ -948,7 +948,7 @@ LEFT JOIN ( FROM [LevelTwo] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l15] WHERE [l15].[Id] <> 42 ) AS [t1] ON [t].[Id2] = [t1].[OneToMany_Optional_Self_Inverse2Id] -WHERE [l11].[Name] <> N'Foo' OR ([l11].[Name] IS NULL) +WHERE [l11].[Name] <> N'Foo' OR [l11].[Name] IS NULL ORDER BY [l12].[Id], [l].[Id], [l0].[Id], [l1].[Id], [l2].[Id], [t].[Id], [t].[Id0], [t].[Id1], [t].[Id2], [t0].[Id], [t0].[Id0], [t0].[Id1], [t0].[Id2], [l11].[Id], [l13].[Id], [l14].[Id] """); } @@ -967,7 +967,7 @@ LEFT JOIN ( FROM [LevelThree] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l1] LEFT JOIN [LevelFour] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l2] ON [l1].[Id] = [l2].[Level3_Required_Id] ) AS [t] ON [l0].[Id] = [t].[OneToMany_Required_Inverse3Id] -WHERE [l0].[Name] <> N'L2 09' OR ([l0].[Name] IS NULL) +WHERE [l0].[Name] <> N'L2 09' OR [l0].[Name] IS NULL ORDER BY [l].[Id], [l0].[Id], [t].[Id] """); } @@ -983,7 +983,7 @@ public override async Task Project_collection_navigation_composed(bool async) LEFT JOIN ( SELECT [l0].[Id], [l0].[Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[Name], [l0].[OneToMany_Optional_Inverse2Id], [l0].[OneToMany_Optional_Self_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToMany_Required_Self_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id], [l0].[OneToOne_Optional_Self2Id], [l0].[PeriodEnd], [l0].[PeriodStart] FROM [LevelTwo] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l0] - WHERE [l0].[Name] <> N'Foo' OR ([l0].[Name] IS NULL) + WHERE [l0].[Name] <> N'Foo' OR [l0].[Name] IS NULL ) AS [t] ON [l].[Id] = [t].[OneToMany_Optional_Inverse2Id] WHERE [l].[Id] < 3 ORDER BY [l].[Id] @@ -1166,7 +1166,7 @@ OUTER APPLY ( FROM ( SELECT TOP(3) [l0].[Id], [l0].[Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[Name], [l0].[OneToMany_Optional_Inverse2Id], [l0].[OneToMany_Optional_Self_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToMany_Required_Self_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id], [l0].[OneToOne_Optional_Self2Id], [l0].[PeriodEnd], [l0].[PeriodStart] FROM [LevelTwo] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l0] - WHERE [l].[Id] = [l0].[OneToMany_Optional_Inverse2Id] AND ([l0].[Name] <> N'Foo' OR ([l0].[Name] IS NULL)) + WHERE [l].[Id] = [l0].[OneToMany_Optional_Inverse2Id] AND ([l0].[Name] <> N'Foo' OR [l0].[Name] IS NULL) ORDER BY [l0].[Name] ) AS [t] LEFT JOIN ( @@ -1174,7 +1174,7 @@ LEFT JOIN ( FROM ( SELECT [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Name], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Optional_Self_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[OneToMany_Required_Self_Inverse3Id], [l1].[OneToOne_Optional_PK_Inverse3Id], [l1].[OneToOne_Optional_Self3Id], [l1].[PeriodEnd], [l1].[PeriodStart], ROW_NUMBER() OVER(PARTITION BY [l1].[OneToMany_Required_Inverse3Id] ORDER BY [l1].[Name] DESC) AS [row] FROM [LevelThree] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l1] - WHERE [l1].[Name] <> N'Bar' OR ([l1].[Name] IS NULL) + WHERE [l1].[Name] <> N'Bar' OR [l1].[Name] IS NULL ) AS [t1] WHERE 1 < [t1].[row] ) AS [t0] ON [t].[Id] = [t0].[OneToMany_Required_Inverse3Id] @@ -1214,7 +1214,7 @@ public override async Task Complex_query_with_let_collection_projection_FirstOrD OUTER APPLY ( SELECT TOP(1) 1 AS [c], [l0].[Id] FROM [LevelTwo] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l0] - WHERE [l0].[Name] <> N'Foo' OR ([l0].[Name] IS NULL) + WHERE [l0].[Name] <> N'Foo' OR [l0].[Name] IS NULL ) AS [t] OUTER APPLY ( SELECT [l1].[Name], [l1].[Id] @@ -1436,7 +1436,7 @@ OUTER APPLY ( FROM ( SELECT TOP(1) [l1].[Id], [l1].[Date], [l1].[Level1_Optional_Id], [l1].[Level1_Required_Id], [l1].[Name], [l1].[OneToMany_Optional_Inverse2Id], [l1].[OneToMany_Optional_Self_Inverse2Id], [l1].[OneToMany_Required_Inverse2Id], [l1].[OneToMany_Required_Self_Inverse2Id], [l1].[OneToOne_Optional_PK_Inverse2Id], [l1].[OneToOne_Optional_Self2Id], [l1].[PeriodEnd], [l1].[PeriodStart] FROM [LevelTwo] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l1] - WHERE [l].[Id] = [l1].[OneToMany_Optional_Inverse2Id] AND ([l1].[Name] <> N'Foo' OR ([l1].[Name] IS NULL)) + WHERE [l].[Id] = [l1].[OneToMany_Optional_Inverse2Id] AND ([l1].[Name] <> N'Foo' OR [l1].[Name] IS NULL) ORDER BY [l1].[Id] ) AS [t] LEFT JOIN [LevelThree] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l0] ON [t].[Id] = [l0].[OneToOne_Optional_PK_Inverse3Id] @@ -1500,7 +1500,7 @@ OUTER APPLY ( FROM ( SELECT TOP(1) [l3].[Id], [l3].[Level2_Optional_Id], [l3].[Level2_Required_Id], [l3].[Name], [l3].[OneToMany_Optional_Inverse3Id], [l3].[OneToMany_Optional_Self_Inverse3Id], [l3].[OneToMany_Required_Inverse3Id], [l3].[OneToMany_Required_Self_Inverse3Id], [l3].[OneToOne_Optional_PK_Inverse3Id], [l3].[OneToOne_Optional_Self3Id], [l3].[PeriodEnd], [l3].[PeriodStart] FROM [LevelThree] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l3] - WHERE [l0].[Id] = [l3].[OneToMany_Optional_Inverse3Id] AND ([l3].[Name] <> N'Foo' OR ([l3].[Name] IS NULL)) + WHERE [l0].[Id] = [l3].[OneToMany_Optional_Inverse3Id] AND ([l3].[Name] <> N'Foo' OR [l3].[Name] IS NULL) ORDER BY [l3].[Id] ) AS [t] LEFT JOIN [LevelFour] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l1] ON [t].[Id] = [l1].[OneToMany_Optional_Inverse4Id] @@ -1846,7 +1846,7 @@ LEFT JOIN ( FROM ( SELECT [l0].[Id], [l0].[Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[Name], [l0].[OneToMany_Optional_Inverse2Id], [l0].[OneToMany_Optional_Self_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToMany_Required_Self_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id], [l0].[OneToOne_Optional_Self2Id], [l0].[PeriodEnd], [l0].[PeriodStart], ROW_NUMBER() OVER(PARTITION BY [l0].[OneToMany_Optional_Inverse2Id] ORDER BY [l0].[Id]) AS [row] FROM [LevelTwo] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l0] - WHERE [l0].[Name] <> N'Foo' OR ([l0].[Name] IS NULL) + WHERE [l0].[Name] <> N'Foo' OR [l0].[Name] IS NULL ) AS [t] WHERE [t].[row] <= 3 ) AS [t0] ON [l].[Id] = [t0].[OneToMany_Optional_Inverse2Id] @@ -1890,7 +1890,7 @@ LEFT JOIN ( FROM [LevelTwo] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l15] WHERE [l15].[Id] <> 42 ) AS [t1] ON [t].[Id2] = [t1].[OneToMany_Optional_Self_Inverse2Id] -WHERE [l11].[Name] <> N'Foo' OR ([l11].[Name] IS NULL) +WHERE [l11].[Name] <> N'Foo' OR [l11].[Name] IS NULL ORDER BY [l12].[Id], [l].[Id], [l0].[Id], [l1].[Id], [l2].[Id], [t].[Id], [t].[Id0], [t].[Id1], [t].[Id2], [t0].[Id], [t0].[Id0], [t0].[Id1], [t0].[Id2], [l11].[Id], [l13].[Id], [l14].[Id] """); } @@ -2032,7 +2032,7 @@ LEFT JOIN ( FROM ( SELECT [l0].[Id], [l0].[Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[Name], [l0].[OneToMany_Optional_Inverse2Id], [l0].[OneToMany_Optional_Self_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToMany_Required_Self_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id], [l0].[OneToOne_Optional_Self2Id], [l0].[PeriodEnd], [l0].[PeriodStart], ROW_NUMBER() OVER(PARTITION BY [l0].[OneToMany_Optional_Inverse2Id] ORDER BY [l0].[Id] DESC) AS [row] FROM [LevelTwo] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l0] - WHERE [l0].[Name] <> N'Foo' OR ([l0].[Name] IS NULL) + WHERE [l0].[Name] <> N'Foo' OR [l0].[Name] IS NULL ) AS [t] WHERE [t].[row] <= 2 ) AS [t0] ON [l].[Id] = [t0].[OneToMany_Optional_Inverse2Id] @@ -2224,7 +2224,7 @@ LEFT JOIN ( FROM ( SELECT [l0].[Id], [l0].[Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[Name], [l0].[OneToMany_Optional_Inverse2Id], [l0].[OneToMany_Optional_Self_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToMany_Required_Self_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id], [l0].[OneToOne_Optional_Self2Id], [l0].[PeriodEnd], [l0].[PeriodStart], ROW_NUMBER() OVER(PARTITION BY [l0].[OneToMany_Optional_Inverse2Id] ORDER BY [l0].[Name]) AS [row] FROM [LevelTwo] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l0] - WHERE [l0].[Name] <> N'Foo' OR ([l0].[Name] IS NULL) + WHERE [l0].[Name] <> N'Foo' OR [l0].[Name] IS NULL ) AS [t] WHERE [t].[row] <= 3 ) AS [t0] ON [l].[Id] = [t0].[OneToMany_Optional_Inverse2Id] @@ -2233,7 +2233,7 @@ LEFT JOIN ( FROM ( SELECT [l1].[Id], [l1].[Date], [l1].[Level1_Optional_Id], [l1].[Level1_Required_Id], [l1].[Name], [l1].[OneToMany_Optional_Inverse2Id], [l1].[OneToMany_Optional_Self_Inverse2Id], [l1].[OneToMany_Required_Inverse2Id], [l1].[OneToMany_Required_Self_Inverse2Id], [l1].[OneToOne_Optional_PK_Inverse2Id], [l1].[OneToOne_Optional_Self2Id], [l1].[PeriodEnd], [l1].[PeriodStart], ROW_NUMBER() OVER(PARTITION BY [l1].[OneToMany_Required_Inverse2Id] ORDER BY [l1].[Name] DESC) AS [row] FROM [LevelTwo] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l1] - WHERE [l1].[Name] <> N'Bar' OR ([l1].[Name] IS NULL) + WHERE [l1].[Name] <> N'Bar' OR [l1].[Name] IS NULL ) AS [t2] WHERE 1 < [t2].[row] ) AS [t1] ON [l].[Id] = [t1].[OneToMany_Required_Inverse2Id] @@ -2278,7 +2278,7 @@ OUTER APPLY ( FROM ( SELECT [l0].[Date] FROM [LevelOne] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l0] - WHERE [l0].[Name] = [l].[Name] OR (([l0].[Name] IS NULL) AND ([l].[Name] IS NULL)) + WHERE [l0].[Name] = [l].[Name] OR ([l0].[Name] IS NULL AND [l].[Name] IS NULL) GROUP BY [l0].[Date] ) AS [t] LEFT JOIN ( @@ -2286,7 +2286,7 @@ LEFT JOIN ( FROM ( SELECT [l1].[Id], [l1].[Date], [l1].[Name], [l1].[OneToMany_Optional_Self_Inverse1Id], [l1].[OneToMany_Required_Self_Inverse1Id], [l1].[OneToOne_Optional_Self1Id], [l1].[PeriodEnd], [l1].[PeriodStart], ROW_NUMBER() OVER(PARTITION BY [l1].[Date] ORDER BY [l1].[Name]) AS [row] FROM [LevelOne] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l1] - WHERE [l1].[Name] = [l].[Name] OR (([l1].[Name] IS NULL) AND ([l].[Name] IS NULL)) + WHERE [l1].[Name] = [l].[Name] OR ([l1].[Name] IS NULL AND [l].[Name] IS NULL) ) AS [t1] WHERE 1 < [t1].[row] AND [t1].[row] <= 6 ) AS [t0] ON [t].[Date] = [t0].[Date] @@ -2497,7 +2497,7 @@ OUTER APPLY ( FROM ( SELECT TOP(2) [l2].[Id], [l2].[Date], [l2].[Level1_Optional_Id], [l2].[Level1_Required_Id], [l2].[Name], [l2].[OneToMany_Optional_Inverse2Id], [l2].[OneToMany_Optional_Self_Inverse2Id], [l2].[OneToMany_Required_Inverse2Id], [l2].[OneToMany_Required_Self_Inverse2Id], [l2].[OneToOne_Optional_PK_Inverse2Id], [l2].[OneToOne_Optional_Self2Id], [l2].[PeriodEnd], [l2].[PeriodStart] FROM [LevelTwo] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l2] - WHERE [l].[Id] = [l2].[OneToMany_Optional_Inverse2Id] AND ([l2].[Name] <> N'Foo' OR ([l2].[Name] IS NULL)) + WHERE [l].[Id] = [l2].[OneToMany_Optional_Inverse2Id] AND ([l2].[Name] <> N'Foo' OR [l2].[Name] IS NULL) ORDER BY [l2].[Id] ) AS [t] LEFT JOIN [LevelThree] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l0] ON [t].[Id] = [l0].[Level2_Required_Id] @@ -2616,7 +2616,7 @@ OUTER APPLY ( FROM ( SELECT TOP(1) [l3].[Id], [l3].[Level2_Optional_Id], [l3].[Level2_Required_Id], [l3].[Name], [l3].[OneToMany_Optional_Inverse3Id], [l3].[OneToMany_Optional_Self_Inverse3Id], [l3].[OneToMany_Required_Inverse3Id], [l3].[OneToMany_Required_Self_Inverse3Id], [l3].[OneToOne_Optional_PK_Inverse3Id], [l3].[OneToOne_Optional_Self3Id], [l3].[PeriodEnd], [l3].[PeriodStart] FROM [LevelThree] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l3] - WHERE [l0].[Id] = [l3].[OneToMany_Optional_Inverse3Id] AND ([l3].[Name] <> N'Foo' OR ([l3].[Name] IS NULL)) + WHERE [l0].[Id] = [l3].[OneToMany_Optional_Inverse3Id] AND ([l3].[Name] <> N'Foo' OR [l3].[Name] IS NULL) ORDER BY [l3].[Id] ) AS [t] LEFT JOIN [LevelFour] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l1] ON [t].[Id] = [l1].[OneToMany_Optional_Inverse4Id] @@ -2702,7 +2702,7 @@ public override async Task Projecting_collection_after_optional_reference_correl OUTER APPLY ( SELECT [l1].[Id] AS [ChildId], [l0].[Name] AS [ParentName] FROM [LevelThree] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l1] - WHERE ([l0].[Id] IS NOT NULL) AND [l0].[Id] = [l1].[OneToMany_Optional_Inverse3Id] + WHERE [l0].[Id] IS NOT NULL AND [l0].[Id] = [l1].[OneToMany_Optional_Inverse3Id] ) AS [t] ORDER BY [l].[Id], [l0].[Id] """); @@ -2721,7 +2721,7 @@ public override async Task Projecting_collection_with_group_by_after_optional_re OUTER APPLY ( SELECT [l2].[Name] AS [Key], COUNT(*) AS [Count] FROM [LevelThree] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l2] - WHERE ([l0].[Id] IS NOT NULL) AND [l0].[Id] = [l2].[OneToMany_Optional_Inverse3Id] + WHERE [l0].[Id] IS NOT NULL AND [l0].[Id] = [l2].[OneToMany_Optional_Inverse3Id] GROUP BY [l2].[Name] ) AS [t] ORDER BY [l].[Id], [l0].[Id], [l1].[Id] @@ -2784,7 +2784,7 @@ LEFT JOIN ( SELECT COUNT(*) FROM [LevelTwo] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l0] LEFT JOIN [LevelThree] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l1] ON [l0].[Id] = [l1].[OneToOne_Optional_PK_Inverse3Id] - WHERE [l].[Id] = [l0].[OneToMany_Optional_Inverse2Id] AND ([l1].[Name] <> N'Foo' OR ([l1].[Name] IS NULL))) > 0 + WHERE [l].[Id] = [l0].[OneToMany_Optional_Inverse2Id] AND ([l1].[Name] <> N'Foo' OR [l1].[Name] IS NULL)) > 0 ORDER BY [l].[Id], [t].[Id], [t].[Id0] """); } @@ -2853,7 +2853,7 @@ LEFT JOIN ( FROM ( SELECT [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Name], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Optional_Self_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[OneToMany_Required_Self_Inverse3Id], [l1].[OneToOne_Optional_PK_Inverse3Id], [l1].[OneToOne_Optional_Self3Id], [l1].[PeriodEnd], [l1].[PeriodStart], ROW_NUMBER() OVER(PARTITION BY [l1].[OneToMany_Optional_Inverse3Id] ORDER BY [l1].[Name]) AS [row] FROM [LevelThree] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l1] - WHERE [l1].[Name] <> N'Foo' OR ([l1].[Name] IS NULL) + WHERE [l1].[Name] <> N'Foo' OR [l1].[Name] IS NULL ) AS [t] WHERE 1 < [t].[row] AND [t].[row] <= 4 ) AS [t0] ON [l0].[Id] = [t0].[OneToMany_Optional_Inverse3Id] diff --git a/test/EFCore.SqlServer.FunctionalTests/Query/TemporalComplexNavigationsCollectionsSharedTypeQuerySqlServerTest.cs b/test/EFCore.SqlServer.FunctionalTests/Query/TemporalComplexNavigationsCollectionsSharedTypeQuerySqlServerTest.cs index e1a93618956..7136b356635 100644 --- a/test/EFCore.SqlServer.FunctionalTests/Query/TemporalComplexNavigationsCollectionsSharedTypeQuerySqlServerTest.cs +++ b/test/EFCore.SqlServer.FunctionalTests/Query/TemporalComplexNavigationsCollectionsSharedTypeQuerySqlServerTest.cs @@ -54,21 +54,21 @@ OFFSET @__p_0 ROWS FETCH NEXT @__p_1 ROWS ONLY LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[Level2_Name], [l0].[OneToMany_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id], [l0].[PeriodEnd], [l0].[PeriodStart] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l0] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t0] ON [t].[Id] = [t0].[Level1_Required_Id] LEFT JOIN ( SELECT [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Level3_Name], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[OneToOne_Optional_PK_Inverse3Id], [l1].[PeriodEnd], [l1].[PeriodStart] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l1] - WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse3Id] IS NOT NULL) + WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL ) AS [t1] ON CASE - WHEN ([t0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t0].[Level1_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse2Id] IS NOT NULL) AND ([t0].[PeriodEnd] IS NOT NULL) AND ([t0].[PeriodStart] IS NOT NULL) THEN [t0].[Id] + WHEN [t0].[OneToOne_Required_PK_Date] IS NOT NULL AND [t0].[Level1_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse2Id] IS NOT NULL AND [t0].[PeriodEnd] IS NOT NULL AND [t0].[PeriodStart] IS NOT NULL THEN [t0].[Id] END = [t1].[OneToMany_Optional_Inverse3Id] LEFT JOIN ( SELECT [l2].[Id], [l2].[Level2_Optional_Id], [l2].[Level2_Required_Id], [l2].[Level3_Name], [l2].[OneToMany_Optional_Inverse3Id], [l2].[OneToMany_Required_Inverse3Id], [l2].[OneToOne_Optional_PK_Inverse3Id], [l2].[PeriodEnd], [l2].[PeriodStart] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l2] - WHERE ([l2].[Level2_Required_Id] IS NOT NULL) AND ([l2].[OneToMany_Required_Inverse3Id] IS NOT NULL) + WHERE [l2].[Level2_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse3Id] IS NOT NULL ) AS [t2] ON CASE - WHEN ([t0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t0].[Level1_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse2Id] IS NOT NULL) AND ([t0].[PeriodEnd] IS NOT NULL) AND ([t0].[PeriodStart] IS NOT NULL) THEN [t0].[Id] + WHEN [t0].[OneToOne_Required_PK_Date] IS NOT NULL AND [t0].[Level1_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse2Id] IS NOT NULL AND [t0].[PeriodEnd] IS NOT NULL AND [t0].[PeriodStart] IS NOT NULL THEN [t0].[Id] END = [t2].[OneToMany_Required_Inverse3Id] ORDER BY [t].[Name], [t].[Id], [t0].[Id], [t1].[Id] """); @@ -93,26 +93,26 @@ OFFSET @__p_0 ROWS FETCH NEXT @__p_1 ROWS ONLY LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[Level2_Name], [l0].[OneToMany_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id], [l0].[PeriodEnd], [l0].[PeriodStart] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l0] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t0] ON [t].[Id] = [t0].[Level1_Optional_Id] LEFT JOIN ( SELECT [l1].[Id], [l1].[OneToOne_Required_PK_Date], [l1].[Level1_Optional_Id], [l1].[Level1_Required_Id], [l1].[Level2_Name], [l1].[OneToMany_Optional_Inverse2Id], [l1].[OneToMany_Required_Inverse2Id], [l1].[OneToOne_Optional_PK_Inverse2Id], [l1].[PeriodEnd], [l1].[PeriodStart] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l1] - WHERE ([l1].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l1].[Level1_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l1].[OneToOne_Required_PK_Date] IS NOT NULL AND [l1].[Level1_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t1] ON [t].[Id] = [t1].[Level1_Required_Id] LEFT JOIN ( SELECT [l2].[Id], [l2].[Level2_Optional_Id], [l2].[Level2_Required_Id], [l2].[Level3_Name], [l2].[OneToMany_Optional_Inverse3Id], [l2].[OneToMany_Required_Inverse3Id], [l2].[OneToOne_Optional_PK_Inverse3Id], [l2].[PeriodEnd], [l2].[PeriodStart] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l2] - WHERE ([l2].[Level2_Required_Id] IS NOT NULL) AND ([l2].[OneToMany_Required_Inverse3Id] IS NOT NULL) + WHERE [l2].[Level2_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse3Id] IS NOT NULL ) AS [t2] ON CASE - WHEN ([t0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t0].[Level1_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse2Id] IS NOT NULL) AND ([t0].[PeriodEnd] IS NOT NULL) AND ([t0].[PeriodStart] IS NOT NULL) THEN [t0].[Id] + WHEN [t0].[OneToOne_Required_PK_Date] IS NOT NULL AND [t0].[Level1_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse2Id] IS NOT NULL AND [t0].[PeriodEnd] IS NOT NULL AND [t0].[PeriodStart] IS NOT NULL THEN [t0].[Id] END = [t2].[OneToMany_Optional_Inverse3Id] LEFT JOIN ( SELECT [l3].[Id], [l3].[Level2_Optional_Id], [l3].[Level2_Required_Id], [l3].[Level3_Name], [l3].[OneToMany_Optional_Inverse3Id], [l3].[OneToMany_Required_Inverse3Id], [l3].[OneToOne_Optional_PK_Inverse3Id], [l3].[PeriodEnd], [l3].[PeriodStart] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l3] - WHERE ([l3].[Level2_Required_Id] IS NOT NULL) AND ([l3].[OneToMany_Required_Inverse3Id] IS NOT NULL) + WHERE [l3].[Level2_Required_Id] IS NOT NULL AND [l3].[OneToMany_Required_Inverse3Id] IS NOT NULL ) AS [t3] ON CASE - WHEN ([t1].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t1].[Level1_Required_Id] IS NOT NULL) AND ([t1].[OneToMany_Required_Inverse2Id] IS NOT NULL) AND ([t1].[PeriodEnd] IS NOT NULL) AND ([t1].[PeriodStart] 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 AND [t1].[PeriodEnd] IS NOT NULL AND [t1].[PeriodStart] IS NOT NULL THEN [t1].[Id] END = [t3].[OneToMany_Required_Inverse3Id] ORDER BY [t].[Name], [t].[Id], [t0].[Id], [t1].[Id], [t2].[Id] """); @@ -137,21 +137,21 @@ OFFSET @__p_0 ROWS FETCH NEXT @__p_1 ROWS ONLY LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[Level2_Name], [l0].[OneToMany_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id], [l0].[PeriodEnd], [l0].[PeriodStart] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l0] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t0] ON [t].[Id] = [t0].[Level1_Optional_Id] LEFT JOIN ( SELECT [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Level3_Name], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[OneToOne_Optional_PK_Inverse3Id], [l1].[PeriodEnd], [l1].[PeriodStart] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l1] - WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse3Id] IS NOT NULL) + WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL ) AS [t1] ON CASE - WHEN ([t0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t0].[Level1_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse2Id] IS NOT NULL) AND ([t0].[PeriodEnd] IS NOT NULL) AND ([t0].[PeriodStart] IS NOT NULL) THEN [t0].[Id] + WHEN [t0].[OneToOne_Required_PK_Date] IS NOT NULL AND [t0].[Level1_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse2Id] IS NOT NULL AND [t0].[PeriodEnd] IS NOT NULL AND [t0].[PeriodStart] IS NOT NULL THEN [t0].[Id] END = [t1].[Level2_Required_Id] LEFT JOIN ( SELECT [l2].[Id], [l2].[Level3_Optional_Id], [l2].[Level3_Required_Id], [l2].[Level4_Name], [l2].[OneToMany_Optional_Inverse4Id], [l2].[OneToMany_Required_Inverse4Id], [l2].[OneToOne_Optional_PK_Inverse4Id], [l2].[PeriodEnd], [l2].[PeriodStart] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l2] - WHERE ([l2].[Level3_Required_Id] IS NOT NULL) AND ([l2].[OneToMany_Required_Inverse4Id] IS NOT NULL) + WHERE [l2].[Level3_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse4Id] IS NOT NULL ) AS [t2] ON CASE - WHEN ([t1].[Level2_Required_Id] IS NOT NULL) AND ([t1].[OneToMany_Required_Inverse3Id] IS NOT NULL) AND ([t1].[PeriodEnd] IS NOT NULL) AND ([t1].[PeriodStart] IS NOT NULL) THEN [t1].[Id] + WHEN [t1].[Level2_Required_Id] IS NOT NULL AND [t1].[OneToMany_Required_Inverse3Id] IS NOT NULL AND [t1].[PeriodEnd] IS NOT NULL AND [t1].[PeriodStart] IS NOT NULL THEN [t1].[Id] END = [t2].[OneToMany_Optional_Inverse4Id] ORDER BY [t].[Name], [t].[Id], [t0].[Id], [t1].[Id] """); @@ -170,7 +170,7 @@ LEFT JOIN ( FROM ( SELECT 1 AS [c], [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Required_Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[PeriodEnd], [l0].[PeriodStart], [l0].[OneToMany_Optional_Inverse2Id], ROW_NUMBER() OVER(PARTITION BY [l0].[OneToMany_Optional_Inverse2Id] ORDER BY [l0].[Id]) AS [row] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l0] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) AND ([l0].[Level2_Name] <> N'Foo' OR ([l0].[Level2_Name] IS NULL)) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL AND ([l0].[Level2_Name] <> N'Foo' OR [l0].[Level2_Name] IS NULL) ) AS [t] WHERE [t].[row] <= 1 ) AS [t0] ON [l].[Id] = [t0].[OneToMany_Optional_Inverse2Id] @@ -180,8 +180,8 @@ OUTER APPLY ( WHERE EXISTS ( SELECT 1 FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l2] - WHERE ([l2].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l2].[Level1_Required_Id] IS NOT NULL) AND ([l2].[OneToMany_Required_Inverse2Id] IS NOT NULL) AND [l1].[Id] = [l2].[OneToMany_Optional_Inverse2Id] AND [l2].[Id] = CASE - WHEN ([t0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t0].[Level1_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t0].[Id] + WHERE [l2].[OneToOne_Required_PK_Date] IS NOT NULL AND [l2].[Level1_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse2Id] IS NOT NULL AND [l1].[Id] = [l2].[OneToMany_Optional_Inverse2Id] AND [l2].[Id] = CASE + WHEN [t0].[OneToOne_Required_PK_Date] IS NOT NULL AND [t0].[Level1_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t0].[Id] END) ) AS [t1] ORDER BY [l].[Id], [t0].[Id] @@ -233,7 +233,7 @@ OUTER APPLY ( FROM ( SELECT TOP(3) [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[Level2_Name], [l0].[OneToMany_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id], [l0].[PeriodEnd], [l0].[PeriodStart] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l0] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) AND [l].[Id] = [l0].[OneToMany_Optional_Inverse2Id] AND ([l0].[Level2_Name] <> N'Foo' OR ([l0].[Level2_Name] IS NULL)) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL AND [l].[Id] = [l0].[OneToMany_Optional_Inverse2Id] AND ([l0].[Level2_Name] <> N'Foo' OR [l0].[Level2_Name] IS NULL) ORDER BY [l0].[Level2_Name] ) AS [t] LEFT JOIN ( @@ -241,11 +241,11 @@ LEFT JOIN ( FROM ( SELECT [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Level3_Name], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[OneToOne_Optional_PK_Inverse3Id], [l1].[PeriodEnd], [l1].[PeriodStart], ROW_NUMBER() OVER(PARTITION BY [l1].[OneToMany_Required_Inverse3Id] ORDER BY [l1].[Level3_Name] DESC) AS [row] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l1] - WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse3Id] IS NOT NULL) AND ([l1].[Level3_Name] <> N'Bar' OR ([l1].[Level3_Name] IS NULL)) + WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL AND ([l1].[Level3_Name] <> N'Bar' OR [l1].[Level3_Name] IS NULL) ) AS [t1] WHERE 1 < [t1].[row] ) AS [t0] ON CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] END = [t0].[OneToMany_Required_Inverse3Id] ) AS [t2] ORDER BY [l].[Id], [t2].[Level2_Name], [t2].[Id], [t2].[OneToMany_Required_Inverse3Id], [t2].[Level3_Name] DESC @@ -265,7 +265,7 @@ LEFT JOIN ( FROM ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[Level2_Name], [l0].[OneToMany_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id], [l0].[PeriodEnd], [l0].[PeriodStart], ROW_NUMBER() OVER(PARTITION BY [l0].[OneToMany_Optional_Inverse2Id] ORDER BY [l0].[Level2_Name]) AS [row] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l0] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) AND ([l0].[Level2_Name] <> N'Foo' OR ([l0].[Level2_Name] IS NULL)) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL AND ([l0].[Level2_Name] <> N'Foo' OR [l0].[Level2_Name] IS NULL) ) AS [t] WHERE [t].[row] <= 3 ) AS [t0] ON [l].[Id] = [t0].[OneToMany_Optional_Inverse2Id] @@ -274,7 +274,7 @@ LEFT JOIN ( FROM ( SELECT [l1].[Id], [l1].[OneToOne_Required_PK_Date], [l1].[Level1_Optional_Id], [l1].[Level1_Required_Id], [l1].[Level2_Name], [l1].[OneToMany_Optional_Inverse2Id], [l1].[OneToMany_Required_Inverse2Id], [l1].[OneToOne_Optional_PK_Inverse2Id], [l1].[PeriodEnd], [l1].[PeriodStart], ROW_NUMBER() OVER(PARTITION BY [l1].[OneToMany_Required_Inverse2Id] ORDER BY [l1].[Level2_Name] DESC) AS [row] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l1] - WHERE ([l1].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l1].[Level1_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse2Id] IS NOT NULL) AND ([l1].[Level2_Name] <> N'Bar' OR ([l1].[Level2_Name] IS NULL)) + WHERE [l1].[OneToOne_Required_PK_Date] IS NOT NULL AND [l1].[Level1_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse2Id] IS NOT NULL AND ([l1].[Level2_Name] <> N'Bar' OR [l1].[Level2_Name] IS NULL) ) AS [t2] WHERE 1 < [t2].[row] ) AS [t1] ON [l].[Id] = [t1].[OneToMany_Required_Inverse2Id] @@ -293,18 +293,18 @@ public override async Task Filtered_include_after_reference_navigation(bool asyn LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[Level2_Name], [l0].[OneToMany_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id], [l0].[PeriodEnd], [l0].[PeriodStart] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l0] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] ON [l].[Id] = [t].[Level1_Optional_Id] LEFT JOIN ( SELECT [t1].[Id], [t1].[Level2_Optional_Id], [t1].[Level2_Required_Id], [t1].[Level3_Name], [t1].[OneToMany_Optional_Inverse3Id], [t1].[OneToMany_Required_Inverse3Id], [t1].[OneToOne_Optional_PK_Inverse3Id], [t1].[PeriodEnd], [t1].[PeriodStart] FROM ( SELECT [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Level3_Name], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[OneToOne_Optional_PK_Inverse3Id], [l1].[PeriodEnd], [l1].[PeriodStart], ROW_NUMBER() OVER(PARTITION BY [l1].[OneToMany_Optional_Inverse3Id] ORDER BY [l1].[Level3_Name]) AS [row] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l1] - WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse3Id] IS NOT NULL) AND ([l1].[Level3_Name] <> N'Foo' OR ([l1].[Level3_Name] IS NULL)) + WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL AND ([l1].[Level3_Name] <> N'Foo' OR [l1].[Level3_Name] IS NULL) ) AS [t1] WHERE 1 < [t1].[row] AND [t1].[row] <= 4 ) AS [t0] ON CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) AND ([t].[PeriodEnd] IS NOT NULL) AND ([t].[PeriodStart] IS NOT NULL) THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL AND [t].[PeriodEnd] IS NOT NULL AND [t].[PeriodStart] IS NOT NULL THEN [t].[Id] END = [t0].[OneToMany_Optional_Inverse3Id] ORDER BY [l].[Id], [t].[Id], [t0].[OneToMany_Optional_Inverse3Id], [t0].[Level3_Name] """); @@ -322,27 +322,27 @@ OUTER APPLY ( SELECT [t].[Id], [t].[OneToOne_Required_PK_Date], [t].[Level1_Optional_Id], [t].[Level1_Required_Id], [t].[Level2_Name], [t].[OneToMany_Optional_Inverse2Id], [t].[OneToMany_Required_Inverse2Id], [t].[OneToOne_Optional_PK_Inverse2Id], [t].[PeriodEnd], [t].[PeriodStart], [t0].[Id] AS [Id0], [t0].[Level2_Optional_Id], [t0].[Level2_Required_Id], [t0].[Level3_Name], [t0].[OneToMany_Optional_Inverse3Id], [t0].[OneToMany_Required_Inverse3Id], [t0].[OneToOne_Optional_PK_Inverse3Id], [t0].[PeriodEnd] AS [PeriodEnd0], [t0].[PeriodStart] AS [PeriodStart0], [t1].[Id] AS [Id1], [t1].[Level3_Optional_Id], [t1].[Level3_Required_Id], [t1].[Level4_Name], [t1].[OneToMany_Optional_Inverse4Id], [t1].[OneToMany_Required_Inverse4Id], [t1].[OneToOne_Optional_PK_Inverse4Id], [t1].[PeriodEnd] AS [PeriodEnd1], [t1].[PeriodStart] AS [PeriodStart1], [t].[c] FROM ( SELECT TOP(1) [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[Level2_Name], [l0].[OneToMany_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id], [l0].[PeriodEnd], [l0].[PeriodStart], CASE - WHEN ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [l0].[Id] + WHEN [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [l0].[Id] END AS [c] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l0] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) AND [l].[Id] = [l0].[OneToMany_Optional_Inverse2Id] AND ([l0].[Level2_Name] <> N'Foo' OR ([l0].[Level2_Name] IS NULL)) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL AND [l].[Id] = [l0].[OneToMany_Optional_Inverse2Id] AND ([l0].[Level2_Name] <> N'Foo' OR [l0].[Level2_Name] IS NULL) ORDER BY CASE - WHEN ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [l0].[Id] + WHEN [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [l0].[Id] END ) AS [t] LEFT JOIN ( SELECT [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Level3_Name], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[OneToOne_Optional_PK_Inverse3Id], [l1].[PeriodEnd], [l1].[PeriodStart] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l1] - WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse3Id] IS NOT NULL) + WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL ) AS [t0] ON CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] END = [t0].[OneToOne_Optional_PK_Inverse3Id] LEFT JOIN ( SELECT [l2].[Id], [l2].[Level3_Optional_Id], [l2].[Level3_Required_Id], [l2].[Level4_Name], [l2].[OneToMany_Optional_Inverse4Id], [l2].[OneToMany_Required_Inverse4Id], [l2].[OneToOne_Optional_PK_Inverse4Id], [l2].[PeriodEnd], [l2].[PeriodStart] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l2] - WHERE ([l2].[Level3_Required_Id] IS NOT NULL) AND ([l2].[OneToMany_Required_Inverse4Id] IS NOT NULL) AND [l2].[Id] > 1 + WHERE [l2].[Level3_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse4Id] IS NOT NULL AND [l2].[Id] > 1 ) AS [t1] ON CASE - WHEN ([t0].[Level2_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse3Id] IS NOT NULL) AND ([t0].[PeriodEnd] IS NOT NULL) AND ([t0].[PeriodStart] IS NOT NULL) THEN [t0].[Id] + WHEN [t0].[Level2_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse3Id] IS NOT NULL AND [t0].[PeriodEnd] IS NOT NULL AND [t0].[PeriodStart] IS NOT NULL THEN [t0].[Id] END = [t1].[OneToMany_Optional_Inverse4Id] ) AS [t2] ORDER BY [l].[Id], [t2].[c], [t2].[Id], [t2].[Id0] @@ -361,12 +361,12 @@ LEFT JOIN ( SELECT [t].[Id], [t].[OneToOne_Required_PK_Date], [t].[Level1_Optional_Id], [t].[Level1_Required_Id], [t].[Level2_Name], [t].[OneToMany_Optional_Inverse2Id], [t].[OneToMany_Required_Inverse2Id], [t].[OneToOne_Optional_PK_Inverse2Id], [t].[PeriodEnd], [t].[PeriodStart], [t].[c] FROM ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[Level2_Name], [l0].[OneToMany_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id], [l0].[PeriodEnd], [l0].[PeriodStart], ROW_NUMBER() OVER(PARTITION BY [l0].[OneToMany_Optional_Inverse2Id] ORDER BY CASE - WHEN ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [l0].[Id] + WHEN [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [l0].[Id] END) AS [row], CASE - WHEN ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [l0].[Id] + WHEN [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [l0].[Id] END AS [c] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l0] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) AND ([l0].[Level2_Name] <> N'Foo' OR ([l0].[Level2_Name] IS NULL)) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL AND ([l0].[Level2_Name] <> N'Foo' OR [l0].[Level2_Name] IS NULL) ) AS [t] WHERE [t].[row] <= 3 ) AS [t0] ON [l].[Id] = [t0].[OneToMany_Optional_Inverse2Id] @@ -386,12 +386,12 @@ LEFT JOIN ( SELECT [t].[Id], [t].[OneToOne_Required_PK_Date], [t].[Level1_Optional_Id], [t].[Level1_Required_Id], [t].[Level2_Name], [t].[OneToMany_Optional_Inverse2Id], [t].[OneToMany_Required_Inverse2Id], [t].[OneToOne_Optional_PK_Inverse2Id], [t].[PeriodEnd], [t].[PeriodStart], [t].[c] FROM ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[Level2_Name], [l0].[OneToMany_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id], [l0].[PeriodEnd], [l0].[PeriodStart], ROW_NUMBER() OVER(PARTITION BY [l0].[OneToMany_Optional_Inverse2Id] ORDER BY CASE - WHEN ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [l0].[Id] + WHEN [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [l0].[Id] END) AS [row], CASE - WHEN ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [l0].[Id] + WHEN [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [l0].[Id] END AS [c] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l0] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) AND ([l0].[Level2_Name] <> N'Foo' OR ([l0].[Level2_Name] IS NULL)) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL AND ([l0].[Level2_Name] <> N'Foo' OR [l0].[Level2_Name] IS NULL) ) AS [t] WHERE [t].[row] <= 3 ) AS [t0] ON [l].[Id] = [t0].[OneToMany_Optional_Inverse2Id] @@ -412,7 +412,7 @@ LEFT JOIN ( FROM ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[Level2_Name], [l0].[OneToMany_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id], [l0].[PeriodEnd], [l0].[PeriodStart], ROW_NUMBER() OVER(PARTITION BY [l0].[OneToMany_Optional_Inverse2Id] ORDER BY [l0].[Level2_Name]) AS [row] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l0] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] WHERE 1 < [t].[row] ) AS [t0] ON [l].[Id] = [t0].[OneToMany_Optional_Inverse2Id] @@ -433,7 +433,7 @@ LEFT JOIN ( FROM ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[Level2_Name], [l0].[OneToMany_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id], [l0].[PeriodEnd], [l0].[PeriodStart], ROW_NUMBER() OVER(PARTITION BY [l0].[OneToMany_Optional_Inverse2Id] ORDER BY [l0].[Level2_Name]) AS [row] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l0] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] WHERE 1 < [t].[row] AND [t].[row] <= 4 ) AS [t0] ON [l].[Id] = [t0].[OneToMany_Optional_Inverse2Id] @@ -454,7 +454,7 @@ LEFT JOIN ( FROM ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[Level2_Name], [l0].[OneToMany_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id], [l0].[PeriodEnd], [l0].[PeriodStart], ROW_NUMBER() OVER(PARTITION BY [l0].[OneToMany_Optional_Inverse2Id] ORDER BY [l0].[Level2_Name]) AS [row] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l0] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] WHERE [t].[row] <= 3 ) AS [t0] ON [l].[Id] = [t0].[OneToMany_Optional_Inverse2Id] @@ -473,7 +473,7 @@ public override async Task Filtered_include_basic_Where(bool async) LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[Level2_Name], [l0].[OneToMany_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id], [l0].[PeriodEnd], [l0].[PeriodStart] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l0] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) AND [l0].[Id] > 5 + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL AND [l0].[Id] > 5 ) AS [t] ON [l].[Id] = [t].[OneToMany_Optional_Inverse2Id] ORDER BY [l].[Id] """); @@ -494,36 +494,36 @@ OUTER APPLY ( SELECT [t].[Id], [t].[Level2_Optional_Id], [t].[Level2_Required_Id], [t].[Level3_Name], [t].[OneToMany_Optional_Inverse3Id], [t].[OneToMany_Required_Inverse3Id], [t].[OneToOne_Optional_PK_Inverse3Id], [t].[PeriodEnd], [t].[PeriodStart], [t0].[Id] AS [Id0], [t0].[Level3_Optional_Id], [t0].[Level3_Required_Id], [t0].[Level4_Name], [t0].[OneToMany_Optional_Inverse4Id], [t0].[OneToMany_Required_Inverse4Id], [t0].[OneToOne_Optional_PK_Inverse4Id], [t0].[PeriodEnd] AS [PeriodEnd0], [t0].[PeriodStart] AS [PeriodStart0], [t1].[Id] AS [Id1], [t1].[Level3_Optional_Id] AS [Level3_Optional_Id0], [t1].[Level3_Required_Id] AS [Level3_Required_Id0], [t1].[Level4_Name] AS [Level4_Name0], [t1].[OneToMany_Optional_Inverse4Id] AS [OneToMany_Optional_Inverse4Id0], [t1].[OneToMany_Required_Inverse4Id] AS [OneToMany_Required_Inverse4Id0], [t1].[OneToOne_Optional_PK_Inverse4Id] AS [OneToOne_Optional_PK_Inverse4Id0], [t1].[PeriodEnd] AS [PeriodEnd1], [t1].[PeriodStart] AS [PeriodStart1], [t].[c] FROM ( SELECT TOP(1) [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Level3_Name], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[OneToOne_Optional_PK_Inverse3Id], [l1].[PeriodEnd], [l1].[PeriodStart], CASE - WHEN ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [l1].[Id] + WHEN [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [l1].[Id] END AS [c] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l1] - WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse3Id] IS NOT NULL) AND (CASE - WHEN ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [l0].[Id] - END IS NOT NULL) AND (CASE - WHEN ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [l0].[Id] - END = [l1].[OneToMany_Optional_Inverse3Id] OR ((CASE - WHEN ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [l0].[Id] - END IS NULL) AND ([l1].[OneToMany_Optional_Inverse3Id] IS NULL))) AND ([l1].[Level3_Name] <> N'Foo' OR ([l1].[Level3_Name] IS NULL)) + WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL AND CASE + WHEN [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [l0].[Id] + END IS NOT NULL AND (CASE + WHEN [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [l0].[Id] + END = [l1].[OneToMany_Optional_Inverse3Id] OR (CASE + WHEN [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [l0].[Id] + END IS NULL AND [l1].[OneToMany_Optional_Inverse3Id] IS NULL)) AND ([l1].[Level3_Name] <> N'Foo' OR [l1].[Level3_Name] IS NULL) ORDER BY CASE - WHEN ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [l1].[Id] + WHEN [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [l1].[Id] END ) AS [t] LEFT JOIN ( SELECT [l2].[Id], [l2].[Level3_Optional_Id], [l2].[Level3_Required_Id], [l2].[Level4_Name], [l2].[OneToMany_Optional_Inverse4Id], [l2].[OneToMany_Required_Inverse4Id], [l2].[OneToOne_Optional_PK_Inverse4Id], [l2].[PeriodEnd], [l2].[PeriodStart] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l2] - WHERE ([l2].[Level3_Required_Id] IS NOT NULL) AND ([l2].[OneToMany_Required_Inverse4Id] IS NOT NULL) + WHERE [l2].[Level3_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse4Id] IS NOT NULL ) AS [t0] ON CASE - WHEN ([t].[Level2_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [t].[Id] + WHEN [t].[Level2_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [t].[Id] END = [t0].[OneToMany_Optional_Inverse4Id] LEFT JOIN ( SELECT [l3].[Id], [l3].[Level3_Optional_Id], [l3].[Level3_Required_Id], [l3].[Level4_Name], [l3].[OneToMany_Optional_Inverse4Id], [l3].[OneToMany_Required_Inverse4Id], [l3].[OneToOne_Optional_PK_Inverse4Id], [l3].[PeriodEnd], [l3].[PeriodStart] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l3] - WHERE ([l3].[Level3_Required_Id] IS NOT NULL) AND ([l3].[OneToMany_Required_Inverse4Id] IS NOT NULL) + WHERE [l3].[Level3_Required_Id] IS NOT NULL AND [l3].[OneToMany_Required_Inverse4Id] IS NOT NULL ) AS [t1] ON CASE - WHEN ([t].[Level2_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [t].[Id] + WHEN [t].[Level2_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [t].[Id] END = [t1].[OneToMany_Required_Inverse4Id] ) AS [t2] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t3] ON [l].[Id] = [t3].[OneToMany_Optional_Inverse2Id] ORDER BY [l].[Id], [t3].[Id], [t3].[c], [t3].[Id0], [t3].[Id00] """); @@ -544,36 +544,36 @@ OUTER APPLY ( SELECT [t].[Id], [t].[Level2_Optional_Id], [t].[Level2_Required_Id], [t].[Level3_Name], [t].[OneToMany_Optional_Inverse3Id], [t].[OneToMany_Required_Inverse3Id], [t].[OneToOne_Optional_PK_Inverse3Id], [t].[PeriodEnd], [t].[PeriodStart], [t0].[Id] AS [Id0], [t0].[Level3_Optional_Id], [t0].[Level3_Required_Id], [t0].[Level4_Name], [t0].[OneToMany_Optional_Inverse4Id], [t0].[OneToMany_Required_Inverse4Id], [t0].[OneToOne_Optional_PK_Inverse4Id], [t0].[PeriodEnd] AS [PeriodEnd0], [t0].[PeriodStart] AS [PeriodStart0], [t1].[Id] AS [Id1], [t1].[Level3_Optional_Id] AS [Level3_Optional_Id0], [t1].[Level3_Required_Id] AS [Level3_Required_Id0], [t1].[Level4_Name] AS [Level4_Name0], [t1].[OneToMany_Optional_Inverse4Id] AS [OneToMany_Optional_Inverse4Id0], [t1].[OneToMany_Required_Inverse4Id] AS [OneToMany_Required_Inverse4Id0], [t1].[OneToOne_Optional_PK_Inverse4Id] AS [OneToOne_Optional_PK_Inverse4Id0], [t1].[PeriodEnd] AS [PeriodEnd1], [t1].[PeriodStart] AS [PeriodStart1], [t].[c] FROM ( SELECT TOP(1) [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Level3_Name], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[OneToOne_Optional_PK_Inverse3Id], [l1].[PeriodEnd], [l1].[PeriodStart], CASE - WHEN ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [l1].[Id] + WHEN [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [l1].[Id] END AS [c] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l1] - WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse3Id] IS NOT NULL) AND (CASE - WHEN ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [l0].[Id] - END IS NOT NULL) AND (CASE - WHEN ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [l0].[Id] - END = [l1].[OneToMany_Optional_Inverse3Id] OR ((CASE - WHEN ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [l0].[Id] - END IS NULL) AND ([l1].[OneToMany_Optional_Inverse3Id] IS NULL))) AND ([l1].[Level3_Name] <> N'Foo' OR ([l1].[Level3_Name] IS NULL)) + WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL AND CASE + WHEN [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [l0].[Id] + END IS NOT NULL AND (CASE + WHEN [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [l0].[Id] + END = [l1].[OneToMany_Optional_Inverse3Id] OR (CASE + WHEN [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [l0].[Id] + END IS NULL AND [l1].[OneToMany_Optional_Inverse3Id] IS NULL)) AND ([l1].[Level3_Name] <> N'Foo' OR [l1].[Level3_Name] IS NULL) ORDER BY CASE - WHEN ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [l1].[Id] + WHEN [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [l1].[Id] END ) AS [t] LEFT JOIN ( SELECT [l2].[Id], [l2].[Level3_Optional_Id], [l2].[Level3_Required_Id], [l2].[Level4_Name], [l2].[OneToMany_Optional_Inverse4Id], [l2].[OneToMany_Required_Inverse4Id], [l2].[OneToOne_Optional_PK_Inverse4Id], [l2].[PeriodEnd], [l2].[PeriodStart] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l2] - WHERE ([l2].[Level3_Required_Id] IS NOT NULL) AND ([l2].[OneToMany_Required_Inverse4Id] IS NOT NULL) + WHERE [l2].[Level3_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse4Id] IS NOT NULL ) AS [t0] ON CASE - WHEN ([t].[Level2_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [t].[Id] + WHEN [t].[Level2_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [t].[Id] END = [t0].[OneToMany_Optional_Inverse4Id] LEFT JOIN ( SELECT [l3].[Id], [l3].[Level3_Optional_Id], [l3].[Level3_Required_Id], [l3].[Level4_Name], [l3].[OneToMany_Optional_Inverse4Id], [l3].[OneToMany_Required_Inverse4Id], [l3].[OneToOne_Optional_PK_Inverse4Id], [l3].[PeriodEnd], [l3].[PeriodStart] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l3] - WHERE ([l3].[Level3_Required_Id] IS NOT NULL) AND ([l3].[OneToMany_Required_Inverse4Id] IS NOT NULL) + WHERE [l3].[Level3_Required_Id] IS NOT NULL AND [l3].[OneToMany_Required_Inverse4Id] IS NOT NULL ) AS [t1] ON CASE - WHEN ([t].[Level2_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [t].[Id] + WHEN [t].[Level2_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [t].[Id] END = [t1].[OneToMany_Required_Inverse4Id] ) AS [t2] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t3] ON [l].[Id] = [t3].[OneToMany_Optional_Inverse2Id] ORDER BY [l].[Id], [t3].[Id], [t3].[c], [t3].[Id0], [t3].[Id00] """); @@ -598,12 +598,12 @@ LEFT JOIN ( SELECT [t].[Id], [t].[OneToOne_Required_PK_Date], [t].[Level1_Optional_Id], [t].[Level1_Required_Id], [t].[Level2_Name], [t].[OneToMany_Optional_Inverse2Id], [t].[OneToMany_Required_Inverse2Id], [t].[OneToOne_Optional_PK_Inverse2Id], [t].[PeriodEnd], [t].[PeriodStart], [t].[c] FROM ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[Level2_Name], [l0].[OneToMany_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id], [l0].[PeriodEnd], [l0].[PeriodStart], ROW_NUMBER() OVER(PARTITION BY [l0].[OneToMany_Optional_Inverse2Id] ORDER BY CASE - WHEN ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [l0].[Id] + WHEN [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [l0].[Id] END) AS [row], CASE - WHEN ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [l0].[Id] + WHEN [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [l0].[Id] END AS [c] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l0] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) AND @__p_0 = CAST(1 AS bit) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL AND @__p_0 = CAST(1 AS bit) ) AS [t] WHERE [t].[row] <= 3 ) AS [t0] ON [l].[Id] = [t0].[OneToMany_Optional_Inverse2Id] @@ -623,12 +623,12 @@ LEFT JOIN ( SELECT [t].[Id], [t].[OneToOne_Required_PK_Date], [t].[Level1_Optional_Id], [t].[Level1_Required_Id], [t].[Level2_Name], [t].[OneToMany_Optional_Inverse2Id], [t].[OneToMany_Required_Inverse2Id], [t].[OneToOne_Optional_PK_Inverse2Id], [t].[PeriodEnd], [t].[PeriodStart], [t].[c] FROM ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[Level2_Name], [l0].[OneToMany_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id], [l0].[PeriodEnd], [l0].[PeriodStart], ROW_NUMBER() OVER(PARTITION BY [l0].[OneToMany_Optional_Inverse2Id] ORDER BY CASE - WHEN ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [l0].[Id] + WHEN [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [l0].[Id] END) AS [row], CASE - WHEN ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [l0].[Id] + WHEN [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [l0].[Id] END AS [c] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l0] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) AND ( + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL AND ( SELECT COUNT(*) FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l1] WHERE [l1].[Id] <> [l0].[Id]) > 1 @@ -665,27 +665,27 @@ OUTER APPLY ( SELECT [t].[Id], [t].[OneToOne_Required_PK_Date], [t].[Level1_Optional_Id], [t].[Level1_Required_Id], [t].[Level2_Name], [t].[OneToMany_Optional_Inverse2Id], [t].[OneToMany_Required_Inverse2Id], [t].[OneToOne_Optional_PK_Inverse2Id], [t].[PeriodEnd], [t].[PeriodStart], [t0].[Id] AS [Id0], [t1].[Id] AS [Id1], [t1].[Level2_Optional_Id], [t1].[Level2_Required_Id], [t1].[Level3_Name], [t1].[OneToMany_Optional_Inverse3Id], [t1].[OneToMany_Required_Inverse3Id], [t1].[OneToOne_Optional_PK_Inverse3Id], [t1].[PeriodEnd] AS [PeriodEnd0], [t1].[PeriodStart] AS [PeriodStart0], [t0].[Level2_Optional_Id] AS [Level2_Optional_Id0], [t0].[Level2_Required_Id] AS [Level2_Required_Id0], [t0].[Level3_Name] AS [Level3_Name0], [t0].[OneToMany_Optional_Inverse3Id] AS [OneToMany_Optional_Inverse3Id0], [t0].[OneToMany_Required_Inverse3Id] AS [OneToMany_Required_Inverse3Id0], [t0].[OneToOne_Optional_PK_Inverse3Id] AS [OneToOne_Optional_PK_Inverse3Id0], [t0].[PeriodEnd] AS [PeriodEnd1], [t0].[PeriodStart] AS [PeriodStart1], [t].[c] FROM ( SELECT TOP(2) [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[Level2_Name], [l0].[OneToMany_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id], [l0].[PeriodEnd], [l0].[PeriodStart], CASE - WHEN ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [l0].[Id] + WHEN [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [l0].[Id] END AS [c] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l0] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) AND [l].[Id] = [l0].[OneToMany_Optional_Inverse2Id] AND ([l0].[Level2_Name] <> N'Foo' OR ([l0].[Level2_Name] IS NULL)) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL AND [l].[Id] = [l0].[OneToMany_Optional_Inverse2Id] AND ([l0].[Level2_Name] <> N'Foo' OR [l0].[Level2_Name] IS NULL) ORDER BY CASE - WHEN ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [l0].[Id] + WHEN [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [l0].[Id] END ) AS [t] LEFT JOIN ( SELECT [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Level3_Name], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[OneToOne_Optional_PK_Inverse3Id], [l1].[PeriodEnd], [l1].[PeriodStart] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l1] - WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse3Id] IS NOT NULL) + WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL ) AS [t0] ON CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] END = [t0].[Level2_Required_Id] LEFT JOIN ( SELECT [l2].[Id], [l2].[Level2_Optional_Id], [l2].[Level2_Required_Id], [l2].[Level3_Name], [l2].[OneToMany_Optional_Inverse3Id], [l2].[OneToMany_Required_Inverse3Id], [l2].[OneToOne_Optional_PK_Inverse3Id], [l2].[PeriodEnd], [l2].[PeriodStart] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l2] - WHERE ([l2].[Level2_Required_Id] IS NOT NULL) AND ([l2].[OneToMany_Required_Inverse3Id] IS NOT NULL) + WHERE [l2].[Level2_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse3Id] IS NOT NULL ) AS [t1] ON CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] END = [t1].[OneToMany_Optional_Inverse3Id] ) AS [t2] ORDER BY [l].[Id], [t2].[c], [t2].[Id], [t2].[Id0] @@ -703,18 +703,18 @@ public override async Task Filtered_include_on_ThenInclude(bool async) LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[Level2_Name], [l0].[OneToMany_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id], [l0].[PeriodEnd], [l0].[PeriodStart] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l0] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] ON [l].[Id] = [t].[Level1_Optional_Id] LEFT JOIN ( SELECT [t1].[Id], [t1].[Level2_Optional_Id], [t1].[Level2_Required_Id], [t1].[Level3_Name], [t1].[OneToMany_Optional_Inverse3Id], [t1].[OneToMany_Required_Inverse3Id], [t1].[OneToOne_Optional_PK_Inverse3Id], [t1].[PeriodEnd], [t1].[PeriodStart] FROM ( SELECT [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Level3_Name], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[OneToOne_Optional_PK_Inverse3Id], [l1].[PeriodEnd], [l1].[PeriodStart], ROW_NUMBER() OVER(PARTITION BY [l1].[OneToMany_Optional_Inverse3Id] ORDER BY [l1].[Level3_Name]) AS [row] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l1] - WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse3Id] IS NOT NULL) AND ([l1].[Level3_Name] <> N'Foo' OR ([l1].[Level3_Name] IS NULL)) + WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL AND ([l1].[Level3_Name] <> N'Foo' OR [l1].[Level3_Name] IS NULL) ) AS [t1] WHERE 1 < [t1].[row] AND [t1].[row] <= 4 ) AS [t0] ON CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) AND ([t].[PeriodEnd] IS NOT NULL) AND ([t].[PeriodStart] IS NOT NULL) THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL AND [t].[PeriodEnd] IS NOT NULL AND [t].[PeriodStart] IS NOT NULL THEN [t].[Id] END = [t0].[OneToMany_Optional_Inverse3Id] ORDER BY [l].[Id], [t].[Id], [t0].[OneToMany_Optional_Inverse3Id], [t0].[Level3_Name] """); @@ -733,7 +733,7 @@ LEFT JOIN ( FROM ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[Level2_Name], [l0].[OneToMany_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id], [l0].[PeriodEnd], [l0].[PeriodStart], ROW_NUMBER() OVER(PARTITION BY [l0].[OneToMany_Optional_Inverse2Id] ORDER BY [l0].[Id]) AS [row] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l0] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] WHERE 1 < [t].[row] ) AS [t0] ON [l].[Id] = [t0].[OneToMany_Optional_Inverse2Id] @@ -754,7 +754,7 @@ LEFT JOIN ( FROM ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[Level2_Name], [l0].[OneToMany_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id], [l0].[PeriodEnd], [l0].[PeriodStart], ROW_NUMBER() OVER(PARTITION BY [l0].[OneToMany_Optional_Inverse2Id] ORDER BY [l0].[Id]) AS [row] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l0] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] WHERE [t].[row] <= 1 ) AS [t0] ON [l].[Id] = [t0].[OneToMany_Optional_Inverse2Id] @@ -781,15 +781,15 @@ OUTER APPLY ( FROM ( SELECT TOP(4) [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[Level2_Name], [l0].[OneToMany_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id], [l0].[PeriodEnd], [l0].[PeriodStart] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l0] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) AND [t].[Id] = [l0].[OneToMany_Optional_Inverse2Id] + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL AND [t].[Id] = [l0].[OneToMany_Optional_Inverse2Id] ORDER BY [l0].[Level2_Name] DESC ) AS [t0] LEFT JOIN ( SELECT [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Level3_Name], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[OneToOne_Optional_PK_Inverse3Id], [l1].[PeriodEnd], [l1].[PeriodStart] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l1] - WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse3Id] IS NOT NULL) + WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL ) AS [t2] ON CASE - WHEN ([t0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t0].[Level1_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t0].[Id] + WHEN [t0].[OneToOne_Required_PK_Date] IS NOT NULL AND [t0].[Level1_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t0].[Id] END = [t2].[Level2_Optional_Id] ) AS [t1] ORDER BY [t].[Id], [t1].[Level2_Name] DESC, [t1].[Id] @@ -810,11 +810,11 @@ LEFT JOIN ( LEFT JOIN ( SELECT [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Level3_Name], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[OneToOne_Optional_PK_Inverse3Id], [l1].[PeriodEnd], [l1].[PeriodStart] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l1] - WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse3Id] IS NOT NULL) + WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL ) AS [t] ON CASE - WHEN ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [l0].[Id] + WHEN [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [l0].[Id] END = [t].[OneToMany_Optional_Inverse3Id] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t0] ON [l].[Id] = [t0].[OneToMany_Optional_Inverse2Id] ORDER BY [l].[Id], [t0].[Level2_Name], [t0].[Id], [t0].[Level3_Name] DESC """); @@ -834,12 +834,12 @@ LEFT JOIN ( SELECT [t].[Id], [t].[OneToOne_Required_PK_Date], [t].[Level1_Optional_Id], [t].[Level1_Required_Id], [t].[Level2_Name], [t].[OneToMany_Optional_Inverse2Id], [t].[OneToMany_Required_Inverse2Id], [t].[OneToOne_Optional_PK_Inverse2Id], [t].[PeriodEnd], [t].[PeriodStart], [t].[c] FROM ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[Level2_Name], [l0].[OneToMany_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id], [l0].[PeriodEnd], [l0].[PeriodStart], ROW_NUMBER() OVER(PARTITION BY [l0].[OneToMany_Optional_Inverse2Id] ORDER BY CASE - WHEN ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [l0].[Id] + WHEN [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [l0].[Id] END) AS [row], CASE - WHEN ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [l0].[Id] + WHEN [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [l0].[Id] END AS [c] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l0] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) AND ([l0].[Level2_Name] <> @__prm_0 OR ([l0].[Level2_Name] IS NULL)) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL AND ([l0].[Level2_Name] <> @__prm_0 OR [l0].[Level2_Name] IS NULL) ) AS [t] WHERE [t].[row] <= 3 ) AS [t0] ON [l].[Id] = [t0].[OneToMany_Optional_Inverse2Id] @@ -865,14 +865,14 @@ OUTER APPLY ( FROM ( SELECT TOP(40) [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[Level2_Name], [l0].[OneToMany_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id], [l0].[PeriodEnd], [l0].[PeriodStart] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l0] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) AND [t].[Id] = [l0].[OneToMany_Optional_Inverse2Id] + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL AND [t].[Id] = [l0].[OneToMany_Optional_Inverse2Id] ) AS [t0] LEFT JOIN ( SELECT [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Level3_Name], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[OneToOne_Optional_PK_Inverse3Id], [l1].[PeriodEnd], [l1].[PeriodStart] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l1] - WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse3Id] IS NOT NULL) + WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL ) AS [t2] ON CASE - WHEN ([t0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t0].[Level1_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t0].[Id] + WHEN [t0].[OneToOne_Required_PK_Date] IS NOT NULL AND [t0].[Level1_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t0].[Id] END = [t2].[Level2_Optional_Id] ) AS [t1] ORDER BY [t].[Id], [t1].[Id] @@ -899,14 +899,14 @@ OUTER APPLY ( FROM ( SELECT TOP(40) [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[Level2_Name], [l0].[OneToMany_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id], [l0].[PeriodEnd], [l0].[PeriodStart] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l0] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) AND [t].[Id] = [l0].[OneToMany_Optional_Inverse2Id] + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL AND [t].[Id] = [l0].[OneToMany_Optional_Inverse2Id] ) AS [t0] LEFT JOIN ( SELECT [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Level3_Name], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[OneToOne_Optional_PK_Inverse3Id], [l1].[PeriodEnd], [l1].[PeriodStart] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l1] - WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse3Id] IS NOT NULL) + WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL ) AS [t2] ON CASE - WHEN ([t0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t0].[Level1_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t0].[Id] + WHEN [t0].[OneToOne_Required_PK_Date] IS NOT NULL AND [t0].[Level1_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t0].[Id] END = [t2].[Level2_Optional_Id] ) AS [t1] ORDER BY [t].[Id], [t1].[Id] @@ -927,11 +927,11 @@ LEFT JOIN ( LEFT JOIN ( SELECT [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Level3_Name], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[OneToOne_Optional_PK_Inverse3Id], [l1].[PeriodEnd], [l1].[PeriodStart] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l1] - WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse3Id] IS NOT NULL) + WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL ) AS [t] ON CASE - WHEN ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [l0].[Id] + WHEN [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [l0].[Id] END = [t].[OneToMany_Optional_Inverse3Id] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t0] ON [l].[Id] = [t0].[OneToMany_Optional_Inverse2Id] ORDER BY [l].[Id], [t0].[Id], [t0].[Level3_Name] """); @@ -949,14 +949,14 @@ LEFT JOIN ( SELECT [t].[Id], [t].[OneToOne_Required_PK_Date], [t].[Level1_Optional_Id], [t].[Level1_Required_Id], [t].[Level2_Name], [t].[OneToMany_Optional_Inverse2Id], [t].[OneToMany_Required_Inverse2Id], [t].[OneToOne_Optional_PK_Inverse2Id], [t].[PeriodEnd], [t].[PeriodStart] FROM ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[Level2_Name], [l0].[OneToMany_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id], [l0].[PeriodEnd], [l0].[PeriodStart], ROW_NUMBER() OVER(PARTITION BY [l0].[OneToMany_Optional_Inverse2Id], CASE - WHEN ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [l0].[Id] + WHEN [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [l0].[Id] END ORDER BY [l0].[Id]) AS [row] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l0] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] WHERE [t].[row] <= 1 ) AS [t0] ON [l].[Id] = [t0].[OneToMany_Optional_Inverse2Id] AND [l].[Id] = CASE - WHEN ([t0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t0].[Level1_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t0].[Id] + WHEN [t0].[OneToOne_Required_PK_Date] IS NOT NULL AND [t0].[Level1_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t0].[Id] END """); } @@ -972,7 +972,7 @@ public override async Task Filtered_include_OrderBy(bool async) LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[Level2_Name], [l0].[OneToMany_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id], [l0].[PeriodEnd], [l0].[PeriodStart] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l0] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] ON [l].[Id] = [t].[OneToMany_Optional_Inverse2Id] ORDER BY [l].[Id], [t].[Level2_Name] """); @@ -990,12 +990,12 @@ LEFT JOIN ( SELECT [t].[Id], [t].[OneToOne_Required_PK_Date], [t].[Level1_Optional_Id], [t].[Level1_Required_Id], [t].[Level2_Name], [t].[OneToMany_Optional_Inverse2Id], [t].[OneToMany_Required_Inverse2Id], [t].[OneToOne_Optional_PK_Inverse2Id], [t].[PeriodEnd], [t].[PeriodStart], [t].[c] FROM ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[Level2_Name], [l0].[OneToMany_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id], [l0].[PeriodEnd], [l0].[PeriodStart], ROW_NUMBER() OVER(PARTITION BY [l0].[OneToMany_Optional_Inverse2Id] ORDER BY CASE - WHEN ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [l0].[Id] + WHEN [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [l0].[Id] END DESC) AS [row], CASE - WHEN ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [l0].[Id] + WHEN [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [l0].[Id] END AS [c] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l0] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) AND ([l0].[Level2_Name] <> N'Foo' OR ([l0].[Level2_Name] IS NULL)) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL AND ([l0].[Level2_Name] <> N'Foo' OR [l0].[Level2_Name] IS NULL) ) AS [t] WHERE [t].[row] <= 2 ) AS [t0] ON [l].[Id] = [t0].[OneToMany_Optional_Inverse2Id] @@ -1015,27 +1015,27 @@ OUTER APPLY ( SELECT [t].[Id], [t].[OneToOne_Required_PK_Date], [t].[Level1_Optional_Id], [t].[Level1_Required_Id], [t].[Level2_Name], [t].[OneToMany_Optional_Inverse2Id], [t].[OneToMany_Required_Inverse2Id], [t].[OneToOne_Optional_PK_Inverse2Id], [t].[PeriodEnd], [t].[PeriodStart], [t0].[Id] AS [Id0], [t1].[Id] AS [Id1], [t1].[Level2_Optional_Id], [t1].[Level2_Required_Id], [t1].[Level3_Name], [t1].[OneToMany_Optional_Inverse3Id], [t1].[OneToMany_Required_Inverse3Id], [t1].[OneToOne_Optional_PK_Inverse3Id], [t1].[PeriodEnd] AS [PeriodEnd0], [t1].[PeriodStart] AS [PeriodStart0], [t0].[Level2_Optional_Id] AS [Level2_Optional_Id0], [t0].[Level2_Required_Id] AS [Level2_Required_Id0], [t0].[Level3_Name] AS [Level3_Name0], [t0].[OneToMany_Optional_Inverse3Id] AS [OneToMany_Optional_Inverse3Id0], [t0].[OneToMany_Required_Inverse3Id] AS [OneToMany_Required_Inverse3Id0], [t0].[OneToOne_Optional_PK_Inverse3Id] AS [OneToOne_Optional_PK_Inverse3Id0], [t0].[PeriodEnd] AS [PeriodEnd1], [t0].[PeriodStart] AS [PeriodStart1], [t].[c] FROM ( SELECT TOP(2) [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[Level2_Name], [l0].[OneToMany_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id], [l0].[PeriodEnd], [l0].[PeriodStart], CASE - WHEN ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [l0].[Id] + WHEN [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [l0].[Id] END AS [c] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l0] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) AND [l].[Id] = [l0].[OneToMany_Optional_Inverse2Id] AND ([l0].[Level2_Name] <> N'Foo' OR ([l0].[Level2_Name] IS NULL)) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL AND [l].[Id] = [l0].[OneToMany_Optional_Inverse2Id] AND ([l0].[Level2_Name] <> N'Foo' OR [l0].[Level2_Name] IS NULL) ORDER BY CASE - WHEN ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [l0].[Id] + WHEN [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [l0].[Id] END ) AS [t] LEFT JOIN ( SELECT [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Level3_Name], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[OneToOne_Optional_PK_Inverse3Id], [l1].[PeriodEnd], [l1].[PeriodStart] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l1] - WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse3Id] IS NOT NULL) + WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL ) AS [t0] ON CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] END = [t0].[Level2_Required_Id] LEFT JOIN ( SELECT [l2].[Id], [l2].[Level2_Optional_Id], [l2].[Level2_Required_Id], [l2].[Level3_Name], [l2].[OneToMany_Optional_Inverse3Id], [l2].[OneToMany_Required_Inverse3Id], [l2].[OneToOne_Optional_PK_Inverse3Id], [l2].[PeriodEnd], [l2].[PeriodStart] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l2] - WHERE ([l2].[Level2_Required_Id] IS NOT NULL) AND ([l2].[OneToMany_Required_Inverse3Id] IS NOT NULL) + WHERE [l2].[Level2_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse3Id] IS NOT NULL ) AS [t1] ON CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] END = [t1].[OneToMany_Optional_Inverse3Id] ) AS [t2] ORDER BY [l].[Id], [t2].[c], [t2].[Id], [t2].[Id0] @@ -1063,16 +1063,16 @@ OUTER APPLY ( FROM ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[Level2_Name], [l0].[OneToMany_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id], [l0].[PeriodEnd], [l0].[PeriodStart] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l0] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) AND [t].[Id] = [l0].[OneToMany_Optional_Inverse2Id] + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL AND [t].[Id] = [l0].[OneToMany_Optional_Inverse2Id] ORDER BY [l0].[Level2_Name] DESC OFFSET 2 ROWS FETCH NEXT 4 ROWS ONLY ) AS [t0] LEFT JOIN ( SELECT [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Level3_Name], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[OneToOne_Optional_PK_Inverse3Id], [l1].[PeriodEnd], [l1].[PeriodStart] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l1] - WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse3Id] IS NOT NULL) + WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL ) AS [t2] ON CASE - WHEN ([t0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t0].[Level1_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t0].[Id] + WHEN [t0].[OneToOne_Required_PK_Date] IS NOT NULL AND [t0].[Level1_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t0].[Id] END = [t2].[Level2_Optional_Id] ) AS [t1] ORDER BY [t].[Id] DESC, [t1].[Level2_Name] DESC, [t1].[Id] @@ -1090,14 +1090,14 @@ public override async Task Include_after_SelectMany(bool async) INNER JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[Level2_Name], [l0].[OneToMany_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id], [l0].[PeriodEnd], [l0].[PeriodStart] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l0] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] ON [l].[Id] = [t].[OneToMany_Required_Inverse2Id] LEFT JOIN ( SELECT [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Level3_Name], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[OneToOne_Optional_PK_Inverse3Id], [l1].[PeriodEnd], [l1].[PeriodStart] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l1] - WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse3Id] IS NOT NULL) + WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL ) AS [t0] ON CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] END = [t0].[OneToMany_Optional_Inverse3Id] ORDER BY [l].[Id], [t].[Id] """); @@ -1117,11 +1117,11 @@ LEFT JOIN ( LEFT JOIN ( SELECT [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Level3_Name], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[OneToOne_Optional_PK_Inverse3Id], [l1].[PeriodEnd], [l1].[PeriodStart] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l1] - WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse3Id] IS NOT NULL) + WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL ) AS [t] ON CASE - WHEN ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [l0].[Id] + WHEN [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [l0].[Id] END = [t].[OneToOne_Optional_PK_Inverse3Id] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t0] ON [l].[Id] = [t0].[OneToMany_Optional_Inverse2Id] ORDER BY [l].[Id], [t0].[Id] """); @@ -1138,7 +1138,7 @@ public override async Task Include_collection(bool async) LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[Level2_Name], [l0].[OneToMany_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id], [l0].[PeriodEnd], [l0].[PeriodStart] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l0] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] ON [l].[Id] = [t].[OneToMany_Optional_Inverse2Id] ORDER BY [l].[Id] """); @@ -1158,18 +1158,18 @@ LEFT JOIN ( LEFT JOIN ( SELECT [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Level3_Name], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[OneToOne_Optional_PK_Inverse3Id], [l1].[PeriodEnd], [l1].[PeriodStart] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l1] - WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse3Id] IS NOT NULL) + WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL ) AS [t] ON CASE - WHEN ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [l0].[Id] + WHEN [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [l0].[Id] END = [t].[OneToOne_Optional_PK_Inverse3Id] LEFT JOIN ( SELECT [l2].[Id], [l2].[Level3_Optional_Id], [l2].[Level3_Required_Id], [l2].[Level4_Name], [l2].[OneToMany_Optional_Inverse4Id], [l2].[OneToMany_Required_Inverse4Id], [l2].[OneToOne_Optional_PK_Inverse4Id], [l2].[PeriodEnd], [l2].[PeriodStart] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l2] - WHERE ([l2].[Level3_Required_Id] IS NOT NULL) AND ([l2].[OneToMany_Required_Inverse4Id] IS NOT NULL) + WHERE [l2].[Level3_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse4Id] IS NOT NULL ) AS [t0] ON CASE - WHEN ([t].[Level2_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse3Id] IS NOT NULL) AND ([t].[PeriodEnd] IS NOT NULL) AND ([t].[PeriodStart] IS NOT NULL) THEN [t].[Id] + WHEN [t].[Level2_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse3Id] IS NOT NULL AND [t].[PeriodEnd] IS NOT NULL AND [t].[PeriodStart] IS NOT NULL THEN [t].[Id] END = [t0].[Level3_Optional_Id] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t1] ON [l].[Id] = [t1].[OneToMany_Optional_Inverse2Id] ORDER BY [l].[Id], [t1].[Id], [t1].[Id0] """); @@ -1189,32 +1189,32 @@ LEFT JOIN ( LEFT JOIN ( SELECT [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Level3_Name], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[OneToOne_Optional_PK_Inverse3Id], [l1].[PeriodEnd], [l1].[PeriodStart] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l1] - WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse3Id] IS NOT NULL) + WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL ) AS [t] ON CASE - WHEN ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [l0].[Id] + WHEN [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [l0].[Id] END = [t].[OneToOne_Optional_PK_Inverse3Id] LEFT JOIN ( SELECT [l2].[Id], [l2].[Level3_Optional_Id], [l2].[Level3_Required_Id], [l2].[Level4_Name], [l2].[OneToMany_Optional_Inverse4Id], [l2].[OneToMany_Required_Inverse4Id], [l2].[OneToOne_Optional_PK_Inverse4Id], [l2].[PeriodEnd], [l2].[PeriodStart] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l2] - WHERE ([l2].[Level3_Required_Id] IS NOT NULL) AND ([l2].[OneToMany_Required_Inverse4Id] IS NOT NULL) + WHERE [l2].[Level3_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse4Id] IS NOT NULL ) AS [t0] ON CASE - WHEN ([t].[Level2_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse3Id] IS NOT NULL) AND ([t].[PeriodEnd] IS NOT NULL) AND ([t].[PeriodStart] IS NOT NULL) THEN [t].[Id] + WHEN [t].[Level2_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse3Id] IS NOT NULL AND [t].[PeriodEnd] IS NOT NULL AND [t].[PeriodStart] IS NOT NULL THEN [t].[Id] END = [t0].[Level3_Optional_Id] LEFT JOIN ( SELECT [l3].[Id], [l3].[Level2_Optional_Id], [l3].[Level2_Required_Id], [l3].[Level3_Name], [l3].[OneToMany_Optional_Inverse3Id], [l3].[OneToMany_Required_Inverse3Id], [l3].[OneToOne_Optional_PK_Inverse3Id], [l3].[PeriodEnd], [l3].[PeriodStart] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l3] - WHERE ([l3].[Level2_Required_Id] IS NOT NULL) AND ([l3].[OneToMany_Required_Inverse3Id] IS NOT NULL) + WHERE [l3].[Level2_Required_Id] IS NOT NULL AND [l3].[OneToMany_Required_Inverse3Id] IS NOT NULL ) AS [t1] ON CASE - WHEN ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [l0].[Id] + WHEN [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [l0].[Id] END = [t1].[Level2_Optional_Id] LEFT JOIN ( SELECT [l4].[Id], [l4].[Level3_Optional_Id], [l4].[Level3_Required_Id], [l4].[Level4_Name], [l4].[OneToMany_Optional_Inverse4Id], [l4].[OneToMany_Required_Inverse4Id], [l4].[OneToOne_Optional_PK_Inverse4Id], [l4].[PeriodEnd], [l4].[PeriodStart] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l4] - WHERE ([l4].[Level3_Required_Id] IS NOT NULL) AND ([l4].[OneToMany_Required_Inverse4Id] IS NOT NULL) + WHERE [l4].[Level3_Required_Id] IS NOT NULL AND [l4].[OneToMany_Required_Inverse4Id] IS NOT NULL ) AS [t2] ON CASE - WHEN ([t1].[Level2_Required_Id] IS NOT NULL) AND ([t1].[OneToMany_Required_Inverse3Id] IS NOT NULL) AND ([t1].[PeriodEnd] IS NOT NULL) AND ([t1].[PeriodStart] IS NOT NULL) THEN [t1].[Id] + WHEN [t1].[Level2_Required_Id] IS NOT NULL AND [t1].[OneToMany_Required_Inverse3Id] IS NOT NULL AND [t1].[PeriodEnd] IS NOT NULL AND [t1].[PeriodStart] IS NOT NULL THEN [t1].[Id] END = [t2].[OneToMany_Optional_Inverse4Id] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t3] ON [l].[Id] = [t3].[OneToMany_Optional_Inverse2Id] ORDER BY [l].[Id], [t3].[Id], [t3].[Id0], [t3].[Id1], [t3].[Id2] """); @@ -1234,11 +1234,11 @@ LEFT JOIN ( LEFT JOIN ( SELECT [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Level3_Name], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[OneToOne_Optional_PK_Inverse3Id], [l1].[PeriodEnd], [l1].[PeriodStart] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l1] - WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse3Id] IS NOT NULL) + WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL ) AS [t] ON CASE - WHEN ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [l0].[Id] + WHEN [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [l0].[Id] END = [t].[OneToOne_Optional_PK_Inverse3Id] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t0] ON [l].[Id] = [t0].[OneToMany_Optional_Inverse2Id] ORDER BY [l].[Id], [t0].[Id] """); @@ -1255,7 +1255,7 @@ public override async Task Include_collection_followed_by_projecting_the_include LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[Level2_Name], [l0].[OneToMany_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id], [l0].[PeriodEnd], [l0].[PeriodStart] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l0] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] ON [l].[Id] = [t].[OneToMany_Optional_Inverse2Id] ORDER BY [l].[Id] """); @@ -1275,32 +1275,32 @@ LEFT JOIN ( LEFT JOIN ( SELECT [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Level3_Name], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[OneToOne_Optional_PK_Inverse3Id], [l1].[PeriodEnd], [l1].[PeriodStart] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l1] - WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse3Id] IS NOT NULL) + WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL ) AS [t] ON CASE - WHEN ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [l0].[Id] + WHEN [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [l0].[Id] END = [t].[OneToOne_Optional_PK_Inverse3Id] LEFT JOIN ( SELECT [l2].[Id], [l2].[Level3_Optional_Id], [l2].[Level3_Required_Id], [l2].[Level4_Name], [l2].[OneToMany_Optional_Inverse4Id], [l2].[OneToMany_Required_Inverse4Id], [l2].[OneToOne_Optional_PK_Inverse4Id], [l2].[PeriodEnd], [l2].[PeriodStart] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l2] - WHERE ([l2].[Level3_Required_Id] IS NOT NULL) AND ([l2].[OneToMany_Required_Inverse4Id] IS NOT NULL) + WHERE [l2].[Level3_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse4Id] IS NOT NULL ) AS [t0] ON CASE - WHEN ([t].[Level2_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse3Id] IS NOT NULL) AND ([t].[PeriodEnd] IS NOT NULL) AND ([t].[PeriodStart] IS NOT NULL) THEN [t].[Id] + WHEN [t].[Level2_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse3Id] IS NOT NULL AND [t].[PeriodEnd] IS NOT NULL AND [t].[PeriodStart] IS NOT NULL THEN [t].[Id] END = [t0].[Level3_Optional_Id] LEFT JOIN ( SELECT [l3].[Id], [l3].[Level2_Optional_Id], [l3].[Level2_Required_Id], [l3].[Level3_Name], [l3].[OneToMany_Optional_Inverse3Id], [l3].[OneToMany_Required_Inverse3Id], [l3].[OneToOne_Optional_PK_Inverse3Id], [l3].[PeriodEnd], [l3].[PeriodStart] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l3] - WHERE ([l3].[Level2_Required_Id] IS NOT NULL) AND ([l3].[OneToMany_Required_Inverse3Id] IS NOT NULL) + WHERE [l3].[Level2_Required_Id] IS NOT NULL AND [l3].[OneToMany_Required_Inverse3Id] IS NOT NULL ) AS [t1] ON CASE - WHEN ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [l0].[Id] + WHEN [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [l0].[Id] END = [t1].[Level2_Optional_Id] LEFT JOIN ( SELECT [l4].[Id], [l4].[Level3_Optional_Id], [l4].[Level3_Required_Id], [l4].[Level4_Name], [l4].[OneToMany_Optional_Inverse4Id], [l4].[OneToMany_Required_Inverse4Id], [l4].[OneToOne_Optional_PK_Inverse4Id], [l4].[PeriodEnd], [l4].[PeriodStart] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l4] - WHERE ([l4].[Level3_Required_Id] IS NOT NULL) AND ([l4].[OneToMany_Required_Inverse4Id] IS NOT NULL) + WHERE [l4].[Level3_Required_Id] IS NOT NULL AND [l4].[OneToMany_Required_Inverse4Id] IS NOT NULL ) AS [t2] ON CASE - WHEN ([t1].[Level2_Required_Id] IS NOT NULL) AND ([t1].[OneToMany_Required_Inverse3Id] IS NOT NULL) AND ([t1].[PeriodEnd] IS NOT NULL) AND ([t1].[PeriodStart] IS NOT NULL) THEN [t1].[Id] + WHEN [t1].[Level2_Required_Id] IS NOT NULL AND [t1].[OneToMany_Required_Inverse3Id] IS NOT NULL AND [t1].[PeriodEnd] IS NOT NULL AND [t1].[PeriodStart] IS NOT NULL THEN [t1].[Id] END = [t2].[OneToMany_Optional_Inverse4Id] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t3] ON [l].[Id] = [t3].[OneToMany_Optional_Inverse2Id] ORDER BY [l].[Id], [t3].[Id], [t3].[Id0], [t3].[Id1], [t3].[Id2] """); @@ -1320,18 +1320,18 @@ LEFT JOIN ( LEFT JOIN ( SELECT [l3].[Id], [l3].[Level2_Optional_Id], [l3].[Level2_Required_Id], [l3].[Level3_Name], [l3].[OneToMany_Optional_Inverse3Id], [l3].[OneToMany_Required_Inverse3Id], [l3].[OneToOne_Optional_PK_Inverse3Id], [l3].[PeriodEnd], [l3].[PeriodStart] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l3] - WHERE ([l3].[Level2_Required_Id] IS NOT NULL) AND ([l3].[OneToMany_Required_Inverse3Id] IS NOT NULL) + WHERE [l3].[Level2_Required_Id] IS NOT NULL AND [l3].[OneToMany_Required_Inverse3Id] IS NOT NULL ) AS [t0] ON CASE - WHEN ([l2].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l2].[Level1_Required_Id] IS NOT NULL) AND ([l2].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [l2].[Id] + WHEN [l2].[OneToOne_Required_PK_Date] IS NOT NULL AND [l2].[Level1_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [l2].[Id] END = [t0].[OneToOne_Optional_PK_Inverse3Id] LEFT JOIN ( SELECT [l4].[Id], [l4].[Level3_Optional_Id], [l4].[Level3_Required_Id], [l4].[Level4_Name], [l4].[OneToMany_Optional_Inverse4Id], [l4].[OneToMany_Required_Inverse4Id], [l4].[OneToOne_Optional_PK_Inverse4Id], [l4].[PeriodEnd], [l4].[PeriodStart] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l4] - WHERE ([l4].[Level3_Required_Id] IS NOT NULL) AND ([l4].[OneToMany_Required_Inverse4Id] IS NOT NULL) + WHERE [l4].[Level3_Required_Id] IS NOT NULL AND [l4].[OneToMany_Required_Inverse4Id] IS NOT NULL ) AS [t2] ON CASE - WHEN ([t0].[Level2_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse3Id] IS NOT NULL) AND ([t0].[PeriodEnd] IS NOT NULL) AND ([t0].[PeriodStart] IS NOT NULL) THEN [t0].[Id] + WHEN [t0].[Level2_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse3Id] IS NOT NULL AND [t0].[PeriodEnd] IS NOT NULL AND [t0].[PeriodStart] IS NOT NULL THEN [t0].[Id] END = [t2].[Level3_Optional_Id] - WHERE ([l2].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l2].[Level1_Required_Id] IS NOT NULL) AND ([l2].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l2].[OneToOne_Required_PK_Date] IS NOT NULL AND [l2].[Level1_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t1] ON [l].[Id] = [t1].[OneToMany_Optional_Inverse2Id] WHERE ( SELECT COUNT(*) @@ -1339,11 +1339,11 @@ SELECT COUNT(*) LEFT JOIN ( SELECT [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Level3_Name], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[OneToOne_Optional_PK_Inverse3Id], [l1].[PeriodEnd], [l1].[PeriodStart] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l1] - WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse3Id] IS NOT NULL) + WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL ) AS [t] ON CASE - WHEN ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [l0].[Id] + WHEN [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [l0].[Id] END = [t].[OneToOne_Optional_PK_Inverse3Id] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) AND [l].[Id] = [l0].[OneToMany_Optional_Inverse2Id] AND ([t].[Level3_Name] <> N'Foo' OR ([t].[Level3_Name] IS NULL))) > 0 + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL AND [l].[Id] = [l0].[OneToMany_Optional_Inverse2Id] AND ([t].[Level3_Name] <> N'Foo' OR [t].[Level3_Name] IS NULL)) > 0 ORDER BY [l].[Id], [t1].[Id], [t1].[Id0] """); } @@ -1362,11 +1362,11 @@ LEFT JOIN ( LEFT JOIN ( SELECT [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Level3_Name], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[OneToOne_Optional_PK_Inverse3Id], [l1].[PeriodEnd], [l1].[PeriodStart] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l1] - WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse3Id] IS NOT NULL) + WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL ) AS [t] ON CASE - WHEN ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [l0].[Id] + WHEN [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [l0].[Id] END = [t].[OneToOne_Optional_PK_Inverse3Id] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t0] ON [l].[Id] = [t0].[OneToMany_Optional_Inverse2Id] LEFT JOIN ( SELECT [l2].[Id], [l2].[OneToOne_Required_PK_Date], [l2].[Level1_Optional_Id], [l2].[Level1_Required_Id], [l2].[Level2_Name], [l2].[OneToMany_Optional_Inverse2Id], [l2].[OneToMany_Required_Inverse2Id], [l2].[OneToOne_Optional_PK_Inverse2Id], [l2].[PeriodEnd], [l2].[PeriodStart], [t2].[Id] AS [Id0], [t2].[Level2_Optional_Id], [t2].[Level2_Required_Id], [t2].[Level3_Name], [t2].[OneToMany_Optional_Inverse3Id], [t2].[OneToMany_Required_Inverse3Id], [t2].[OneToOne_Optional_PK_Inverse3Id], [t2].[PeriodEnd] AS [PeriodEnd0], [t2].[PeriodStart] AS [PeriodStart0] @@ -1374,11 +1374,11 @@ LEFT JOIN ( LEFT JOIN ( SELECT [l3].[Id], [l3].[Level2_Optional_Id], [l3].[Level2_Required_Id], [l3].[Level3_Name], [l3].[OneToMany_Optional_Inverse3Id], [l3].[OneToMany_Required_Inverse3Id], [l3].[OneToOne_Optional_PK_Inverse3Id], [l3].[PeriodEnd], [l3].[PeriodStart] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l3] - WHERE ([l3].[Level2_Required_Id] IS NOT NULL) AND ([l3].[OneToMany_Required_Inverse3Id] IS NOT NULL) + WHERE [l3].[Level2_Required_Id] IS NOT NULL AND [l3].[OneToMany_Required_Inverse3Id] IS NOT NULL ) AS [t2] ON CASE - WHEN ([l2].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l2].[Level1_Required_Id] IS NOT NULL) AND ([l2].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [l2].[Id] + WHEN [l2].[OneToOne_Required_PK_Date] IS NOT NULL AND [l2].[Level1_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [l2].[Id] END = [t2].[OneToOne_Optional_PK_Inverse3Id] - WHERE ([l2].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l2].[Level1_Required_Id] IS NOT NULL) AND ([l2].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l2].[OneToOne_Required_PK_Date] IS NOT NULL AND [l2].[Level1_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t1] ON [l].[Id] = [t1].[OneToMany_Optional_Inverse2Id] ORDER BY [l].[Id], [t0].[Id], [t0].[Id0], [t1].[Id] """); @@ -1398,18 +1398,18 @@ LEFT JOIN ( LEFT JOIN ( SELECT [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Level3_Name], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[OneToOne_Optional_PK_Inverse3Id], [l1].[PeriodEnd], [l1].[PeriodStart] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l1] - WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse3Id] IS NOT NULL) + WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL ) AS [t] ON CASE - WHEN ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [l0].[Id] + WHEN [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [l0].[Id] END = [t].[OneToOne_Optional_PK_Inverse3Id] LEFT JOIN ( SELECT [l2].[Id], [l2].[Level3_Optional_Id], [l2].[Level3_Required_Id], [l2].[Level4_Name], [l2].[OneToMany_Optional_Inverse4Id], [l2].[OneToMany_Required_Inverse4Id], [l2].[OneToOne_Optional_PK_Inverse4Id], [l2].[PeriodEnd], [l2].[PeriodStart] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l2] - WHERE ([l2].[Level3_Required_Id] IS NOT NULL) AND ([l2].[OneToMany_Required_Inverse4Id] IS NOT NULL) + WHERE [l2].[Level3_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse4Id] IS NOT NULL ) AS [t0] ON CASE - WHEN ([t].[Level2_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse3Id] IS NOT NULL) AND ([t].[PeriodEnd] IS NOT NULL) AND ([t].[PeriodStart] IS NOT NULL) THEN [t].[Id] + WHEN [t].[Level2_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse3Id] IS NOT NULL AND [t].[PeriodEnd] IS NOT NULL AND [t].[PeriodStart] IS NOT NULL THEN [t].[Id] END = [t0].[Level3_Optional_Id] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t1] ON [l].[Id] = [t1].[OneToMany_Optional_Inverse2Id] ORDER BY [l].[Id], [t1].[Id], [t1].[Id0] """); @@ -1429,11 +1429,11 @@ LEFT JOIN ( LEFT JOIN ( SELECT [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Level3_Name], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[OneToOne_Optional_PK_Inverse3Id], [l1].[PeriodEnd], [l1].[PeriodStart] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l1] - WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse3Id] IS NOT NULL) + WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL ) AS [t] ON CASE - WHEN ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [l0].[Id] + WHEN [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [l0].[Id] END = [t].[Level2_Optional_Id] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t0] ON [l].[Id] = [t0].[OneToMany_Optional_Inverse2Id] ORDER BY [l].[Id], [t0].[Id] """); @@ -1450,10 +1450,10 @@ public override async Task Include_collection_with_conditional_order_by(bool asy LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[Level2_Name], [l0].[OneToMany_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id], [l0].[PeriodEnd], [l0].[PeriodStart] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l0] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] ON [l].[Id] = [t].[OneToMany_Optional_Inverse2Id] ORDER BY CASE - WHEN ([l].[Name] IS NOT NULL) AND ([l].[Name] LIKE N'%03') THEN 1 + WHEN [l].[Name] IS NOT NULL AND [l].[Name] LIKE N'%03' THEN 1 ELSE 2 END, [l].[Id] """); @@ -1482,7 +1482,7 @@ LEFT JOIN ( LEFT JOIN ( SELECT [l1].[Id], [l1].[OneToOne_Required_PK_Date], [l1].[Level1_Optional_Id], [l1].[Level1_Required_Id], [l1].[Level2_Name], [l1].[OneToMany_Optional_Inverse2Id], [l1].[OneToMany_Required_Inverse2Id], [l1].[OneToOne_Optional_PK_Inverse2Id], [l1].[PeriodEnd], [l1].[PeriodStart] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l1] - WHERE ([l1].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l1].[Level1_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l1].[OneToOne_Required_PK_Date] IS NOT NULL AND [l1].[Level1_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t2] ON [t0].[Id] = [t2].[OneToMany_Optional_Inverse2Id] ORDER BY [t].[Name], [t0].[Id] """); @@ -1499,7 +1499,7 @@ public override async Task Include_collection_with_groupby_in_subquery_and_filte SELECT [l].[Name] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l] GROUP BY [l].[Name] - HAVING [l].[Name] <> N'Foo' OR ([l].[Name] IS NULL) + HAVING [l].[Name] <> N'Foo' OR [l].[Name] IS NULL ) AS [t] LEFT JOIN ( SELECT [t1].[Id], [t1].[Date], [t1].[Name], [t1].[PeriodEnd], [t1].[PeriodStart] @@ -1512,7 +1512,7 @@ LEFT JOIN ( LEFT JOIN ( SELECT [l1].[Id], [l1].[OneToOne_Required_PK_Date], [l1].[Level1_Optional_Id], [l1].[Level1_Required_Id], [l1].[Level2_Name], [l1].[OneToMany_Optional_Inverse2Id], [l1].[OneToMany_Required_Inverse2Id], [l1].[OneToOne_Optional_PK_Inverse2Id], [l1].[PeriodEnd], [l1].[PeriodStart] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l1] - WHERE ([l1].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l1].[Level1_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l1].[OneToOne_Required_PK_Date] IS NOT NULL AND [l1].[Level1_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t2] ON [t0].[Id] = [t2].[OneToMany_Optional_Inverse2Id] ORDER BY [t].[Name], [t0].[Id] """); @@ -1543,7 +1543,7 @@ WHERE [l0].[Id] > 3 LEFT JOIN ( SELECT [l1].[Id], [l1].[OneToOne_Required_PK_Date], [l1].[Level1_Optional_Id], [l1].[Level1_Required_Id], [l1].[Level2_Name], [l1].[OneToMany_Optional_Inverse2Id], [l1].[OneToMany_Required_Inverse2Id], [l1].[OneToOne_Optional_PK_Inverse2Id], [l1].[PeriodEnd], [l1].[PeriodStart] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l1] - WHERE ([l1].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l1].[Level1_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l1].[OneToOne_Required_PK_Date] IS NOT NULL AND [l1].[Level1_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t2] ON [t0].[Id] = [t2].[OneToMany_Optional_Inverse2Id] ORDER BY [t].[Name], [t0].[Id] """); @@ -1560,7 +1560,7 @@ public override async Task Include_nested_with_optional_navigation(bool async) LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[Level2_Name], [l0].[OneToMany_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id], [l0].[PeriodEnd], [l0].[PeriodStart] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l0] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] ON [l].[Id] = [t].[Level1_Optional_Id] LEFT JOIN ( SELECT [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Level3_Name], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[OneToOne_Optional_PK_Inverse3Id], [l1].[PeriodEnd], [l1].[PeriodStart], [t1].[Id] AS [Id0], [t1].[Level3_Optional_Id], [t1].[Level3_Required_Id], [t1].[Level4_Name], [t1].[OneToMany_Optional_Inverse4Id], [t1].[OneToMany_Required_Inverse4Id], [t1].[OneToOne_Optional_PK_Inverse4Id], [t1].[PeriodEnd] AS [PeriodEnd0], [t1].[PeriodStart] AS [PeriodStart0] @@ -1568,15 +1568,15 @@ LEFT JOIN ( LEFT JOIN ( SELECT [l2].[Id], [l2].[Level3_Optional_Id], [l2].[Level3_Required_Id], [l2].[Level4_Name], [l2].[OneToMany_Optional_Inverse4Id], [l2].[OneToMany_Required_Inverse4Id], [l2].[OneToOne_Optional_PK_Inverse4Id], [l2].[PeriodEnd], [l2].[PeriodStart] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l2] - WHERE ([l2].[Level3_Required_Id] IS NOT NULL) AND ([l2].[OneToMany_Required_Inverse4Id] IS NOT NULL) + WHERE [l2].[Level3_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse4Id] IS NOT NULL ) AS [t1] ON CASE - WHEN ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [l1].[Id] + WHEN [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [l1].[Id] END = [t1].[Level3_Required_Id] - WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse3Id] IS NOT NULL) + WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL ) AS [t0] ON CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) AND ([t].[PeriodEnd] IS NOT NULL) AND ([t].[PeriodStart] IS NOT NULL) THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL AND [t].[PeriodEnd] IS NOT NULL AND [t].[PeriodStart] IS NOT NULL THEN [t].[Id] END = [t0].[OneToMany_Required_Inverse3Id] -WHERE [t].[Level2_Name] <> N'L2 09' OR ([t].[Level2_Name] IS NULL) +WHERE [t].[Level2_Name] <> N'L2 09' OR [t].[Level2_Name] IS NULL ORDER BY [l].[Id], [t].[Id], [t0].[Id] """); } @@ -1592,12 +1592,12 @@ public override async Task Include_partially_added_before_Where_and_then_build_u LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Required_Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id], [l0].[PeriodEnd], [l0].[PeriodStart] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l0] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] ON [l].[Id] = [t].[OneToOne_Optional_PK_Inverse2Id] LEFT JOIN ( SELECT [l1].[Id], [l1].[OneToOne_Required_PK_Date], [l1].[Level1_Optional_Id], [l1].[Level1_Required_Id], [l1].[Level2_Name], [l1].[OneToMany_Optional_Inverse2Id], [l1].[OneToMany_Required_Inverse2Id], [l1].[OneToOne_Optional_PK_Inverse2Id], [l1].[PeriodEnd], [l1].[PeriodStart] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l1] - WHERE ([l1].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l1].[Level1_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l1].[OneToOne_Required_PK_Date] IS NOT NULL AND [l1].[Level1_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t0] ON [l].[Id] = [t0].[Level1_Optional_Id] LEFT JOIN ( SELECT [l2].[Id], [l2].[Level2_Optional_Id], [l2].[Level2_Required_Id], [l2].[Level3_Name], [l2].[OneToMany_Optional_Inverse3Id], [l2].[OneToMany_Required_Inverse3Id], [l2].[OneToOne_Optional_PK_Inverse3Id], [l2].[PeriodEnd], [l2].[PeriodStart], [t2].[Id] AS [Id0], [t2].[Level3_Optional_Id], [t2].[Level3_Required_Id], [t2].[Level4_Name], [t2].[OneToMany_Optional_Inverse4Id], [t2].[OneToMany_Required_Inverse4Id], [t2].[OneToOne_Optional_PK_Inverse4Id], [t2].[PeriodEnd] AS [PeriodEnd0], [t2].[PeriodStart] AS [PeriodStart0] @@ -1605,18 +1605,18 @@ LEFT JOIN ( LEFT JOIN ( SELECT [l3].[Id], [l3].[Level3_Optional_Id], [l3].[Level3_Required_Id], [l3].[Level4_Name], [l3].[OneToMany_Optional_Inverse4Id], [l3].[OneToMany_Required_Inverse4Id], [l3].[OneToOne_Optional_PK_Inverse4Id], [l3].[PeriodEnd], [l3].[PeriodStart] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l3] - WHERE ([l3].[Level3_Required_Id] IS NOT NULL) AND ([l3].[OneToMany_Required_Inverse4Id] IS NOT NULL) + WHERE [l3].[Level3_Required_Id] IS NOT NULL AND [l3].[OneToMany_Required_Inverse4Id] IS NOT NULL ) AS [t2] ON CASE - WHEN ([l2].[Level2_Required_Id] IS NOT NULL) AND ([l2].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [l2].[Id] + WHEN [l2].[Level2_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [l2].[Id] END = [t2].[Level3_Optional_Id] - WHERE ([l2].[Level2_Required_Id] IS NOT NULL) AND ([l2].[OneToMany_Required_Inverse3Id] IS NOT NULL) + WHERE [l2].[Level2_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse3Id] IS NOT NULL ) AS [t1] ON CASE - WHEN ([t0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t0].[Level1_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse2Id] IS NOT NULL) AND ([t0].[PeriodEnd] IS NOT NULL) AND ([t0].[PeriodStart] IS NOT NULL) THEN [t0].[Id] + WHEN [t0].[OneToOne_Required_PK_Date] IS NOT NULL AND [t0].[Level1_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse2Id] IS NOT NULL AND [t0].[PeriodEnd] IS NOT NULL AND [t0].[PeriodStart] IS NOT NULL THEN [t0].[Id] END = [t1].[OneToMany_Optional_Inverse3Id] WHERE CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) AND ([t].[PeriodEnd] IS NOT NULL) AND ([t].[PeriodStart] IS NOT NULL) THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL AND [t].[PeriodEnd] IS NOT NULL AND [t].[PeriodStart] IS NOT NULL THEN [t].[Id] END < 3 OR CASE - WHEN ([t0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t0].[Level1_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse2Id] IS NOT NULL) AND ([t0].[PeriodEnd] IS NOT NULL) AND ([t0].[PeriodStart] IS NOT NULL) THEN [t0].[Id] + WHEN [t0].[OneToOne_Required_PK_Date] IS NOT NULL AND [t0].[Level1_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse2Id] IS NOT NULL AND [t0].[PeriodEnd] IS NOT NULL AND [t0].[PeriodStart] IS NOT NULL THEN [t0].[Id] END > 8 ORDER BY [l].[Id], [t].[Id], [t0].[Id], [t1].[Id] """); @@ -1633,27 +1633,27 @@ public override async Task Include_partially_added_before_Where_and_then_build_u LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Required_Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id], [l0].[PeriodEnd], [l0].[PeriodStart] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l0] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] ON [l].[Id] = [t].[OneToOne_Optional_PK_Inverse2Id] LEFT JOIN ( SELECT [l1].[Id], [l1].[OneToOne_Required_PK_Date], [l1].[Level1_Optional_Id], [l1].[Level1_Required_Id], [l1].[Level2_Name], [l1].[OneToMany_Optional_Inverse2Id], [l1].[OneToMany_Required_Inverse2Id], [l1].[OneToOne_Optional_PK_Inverse2Id], [l1].[PeriodEnd], [l1].[PeriodStart] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l1] - WHERE ([l1].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l1].[Level1_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l1].[OneToOne_Required_PK_Date] IS NOT NULL AND [l1].[Level1_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t0] ON [l].[Id] = [t0].[Level1_Optional_Id] LEFT JOIN ( SELECT [t2].[Id], [t2].[Level2_Optional_Id], [t2].[Level2_Required_Id], [t2].[Level3_Name], [t2].[OneToMany_Optional_Inverse3Id], [t2].[OneToMany_Required_Inverse3Id], [t2].[OneToOne_Optional_PK_Inverse3Id], [t2].[PeriodEnd], [t2].[PeriodStart], [t2].[c] FROM ( SELECT [l2].[Id], [l2].[Level2_Optional_Id], [l2].[Level2_Required_Id], [l2].[Level3_Name], [l2].[OneToMany_Optional_Inverse3Id], [l2].[OneToMany_Required_Inverse3Id], [l2].[OneToOne_Optional_PK_Inverse3Id], [l2].[PeriodEnd], [l2].[PeriodStart], ROW_NUMBER() OVER(PARTITION BY [l2].[OneToMany_Optional_Inverse3Id] ORDER BY CASE - WHEN ([l2].[Level2_Required_Id] IS NOT NULL) AND ([l2].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [l2].[Id] + WHEN [l2].[Level2_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [l2].[Id] END) AS [row], CASE - WHEN ([l2].[Level2_Required_Id] IS NOT NULL) AND ([l2].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [l2].[Id] + WHEN [l2].[Level2_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [l2].[Id] END AS [c] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l2] - WHERE ([l2].[Level2_Required_Id] IS NOT NULL) AND ([l2].[OneToMany_Required_Inverse3Id] IS NOT NULL) + WHERE [l2].[Level2_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse3Id] IS NOT NULL ) AS [t2] WHERE [t2].[row] <= 3 ) AS [t1] ON CASE - WHEN ([t0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t0].[Level1_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse2Id] IS NOT NULL) AND ([t0].[PeriodEnd] IS NOT NULL) AND ([t0].[PeriodStart] IS NOT NULL) THEN [t0].[Id] + WHEN [t0].[OneToOne_Required_PK_Date] IS NOT NULL AND [t0].[Level1_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse2Id] IS NOT NULL AND [t0].[PeriodEnd] IS NOT NULL AND [t0].[PeriodStart] IS NOT NULL THEN [t0].[Id] END = [t1].[OneToMany_Optional_Inverse3Id] LEFT JOIN ( SELECT [l3].[Id], [l3].[Level2_Optional_Id], [l3].[Level2_Required_Id], [l3].[Level3_Name], [l3].[OneToMany_Optional_Inverse3Id], [l3].[OneToMany_Required_Inverse3Id], [l3].[OneToOne_Optional_PK_Inverse3Id], [l3].[PeriodEnd], [l3].[PeriodStart], [t4].[Id] AS [Id0], [t4].[Level3_Optional_Id], [t4].[Level3_Required_Id], [t4].[Level4_Name], [t4].[OneToMany_Optional_Inverse4Id], [t4].[OneToMany_Required_Inverse4Id], [t4].[OneToOne_Optional_PK_Inverse4Id], [t4].[PeriodEnd] AS [PeriodEnd0], [t4].[PeriodStart] AS [PeriodStart0] @@ -1661,18 +1661,18 @@ LEFT JOIN ( LEFT JOIN ( SELECT [l4].[Id], [l4].[Level3_Optional_Id], [l4].[Level3_Required_Id], [l4].[Level4_Name], [l4].[OneToMany_Optional_Inverse4Id], [l4].[OneToMany_Required_Inverse4Id], [l4].[OneToOne_Optional_PK_Inverse4Id], [l4].[PeriodEnd], [l4].[PeriodStart] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l4] - WHERE ([l4].[Level3_Required_Id] IS NOT NULL) AND ([l4].[OneToMany_Required_Inverse4Id] IS NOT NULL) + WHERE [l4].[Level3_Required_Id] IS NOT NULL AND [l4].[OneToMany_Required_Inverse4Id] IS NOT NULL ) AS [t4] ON CASE - WHEN ([l3].[Level2_Required_Id] IS NOT NULL) AND ([l3].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [l3].[Id] + WHEN [l3].[Level2_Required_Id] IS NOT NULL AND [l3].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [l3].[Id] END = [t4].[Level3_Optional_Id] - WHERE ([l3].[Level2_Required_Id] IS NOT NULL) AND ([l3].[OneToMany_Required_Inverse3Id] IS NOT NULL) + WHERE [l3].[Level2_Required_Id] IS NOT NULL AND [l3].[OneToMany_Required_Inverse3Id] IS NOT NULL ) AS [t3] ON CASE - WHEN ([t0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t0].[Level1_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse2Id] IS NOT NULL) AND ([t0].[PeriodEnd] IS NOT NULL) AND ([t0].[PeriodStart] IS NOT NULL) THEN [t0].[Id] + WHEN [t0].[OneToOne_Required_PK_Date] IS NOT NULL AND [t0].[Level1_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse2Id] IS NOT NULL AND [t0].[PeriodEnd] IS NOT NULL AND [t0].[PeriodStart] IS NOT NULL THEN [t0].[Id] END = [t3].[OneToMany_Required_Inverse3Id] WHERE CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) AND ([t].[PeriodEnd] IS NOT NULL) AND ([t].[PeriodStart] IS NOT NULL) THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL AND [t].[PeriodEnd] IS NOT NULL AND [t].[PeriodStart] IS NOT NULL THEN [t].[Id] END < 3 OR CASE - WHEN ([t0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t0].[Level1_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse2Id] IS NOT NULL) AND ([t0].[PeriodEnd] IS NOT NULL) AND ([t0].[PeriodStart] IS NOT NULL) THEN [t0].[Id] + WHEN [t0].[OneToOne_Required_PK_Date] IS NOT NULL AND [t0].[Level1_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse2Id] IS NOT NULL AND [t0].[PeriodEnd] IS NOT NULL AND [t0].[PeriodStart] IS NOT NULL THEN [t0].[Id] END > 8 ORDER BY [l].[Id], [t].[Id], [t0].[Id], [t1].[OneToMany_Optional_Inverse3Id], [t1].[c], [t1].[Id], [t3].[Id] """); @@ -1689,14 +1689,14 @@ public override async Task Include_reference_and_collection_order_by(bool async) LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[Level2_Name], [l0].[OneToMany_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id], [l0].[PeriodEnd], [l0].[PeriodStart] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l0] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] ON [l].[Id] = [t].[Level1_Optional_Id] LEFT JOIN ( SELECT [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Level3_Name], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[OneToOne_Optional_PK_Inverse3Id], [l1].[PeriodEnd], [l1].[PeriodStart] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l1] - WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse3Id] IS NOT NULL) + WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL ) AS [t0] ON CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) AND ([t].[PeriodEnd] IS NOT NULL) AND ([t].[PeriodStart] IS NOT NULL) THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL AND [t].[PeriodEnd] IS NOT NULL AND [t].[PeriodStart] IS NOT NULL THEN [t].[Id] END = [t0].[OneToMany_Optional_Inverse3Id] ORDER BY [l].[Name], [l].[Id], [t].[Id] """); @@ -1713,17 +1713,17 @@ public override async Task Include_reference_collection_order_by_reference_navig LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[Level2_Name], [l0].[OneToMany_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id], [l0].[PeriodEnd], [l0].[PeriodStart] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l0] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] ON [l].[Id] = [t].[Level1_Optional_Id] LEFT JOIN ( SELECT [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Level3_Name], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[OneToOne_Optional_PK_Inverse3Id], [l1].[PeriodEnd], [l1].[PeriodStart] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l1] - WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse3Id] IS NOT NULL) + WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL ) AS [t0] ON CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) AND ([t].[PeriodEnd] IS NOT NULL) AND ([t].[PeriodStart] IS NOT NULL) THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL AND [t].[PeriodEnd] IS NOT NULL AND [t].[PeriodStart] IS NOT NULL THEN [t].[Id] END = [t0].[OneToMany_Optional_Inverse3Id] ORDER BY CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) AND ([t].[PeriodEnd] IS NOT NULL) AND ([t].[PeriodStart] IS NOT NULL) THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL AND [t].[PeriodEnd] IS NOT NULL AND [t].[PeriodStart] IS NOT NULL THEN [t].[Id] END, [l].[Id], [t].[Id] """); } @@ -1739,14 +1739,14 @@ public override async Task Include_reference_followed_by_include_collection(bool LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[Level2_Name], [l0].[OneToMany_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id], [l0].[PeriodEnd], [l0].[PeriodStart] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l0] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] ON [l].[Id] = [t].[Level1_Optional_Id] LEFT JOIN ( SELECT [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Level3_Name], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[OneToOne_Optional_PK_Inverse3Id], [l1].[PeriodEnd], [l1].[PeriodStart] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l1] - WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse3Id] IS NOT NULL) + WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL ) AS [t0] ON CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) AND ([t].[PeriodEnd] IS NOT NULL) AND ([t].[PeriodStart] IS NOT NULL) THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL AND [t].[PeriodEnd] IS NOT NULL AND [t].[PeriodStart] IS NOT NULL THEN [t].[Id] END = [t0].[OneToMany_Optional_Inverse3Id] ORDER BY [l].[Id], [t].[Id] """); @@ -1763,14 +1763,14 @@ public override async Task Include_reference_ThenInclude_collection_order_by(boo LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[Level2_Name], [l0].[OneToMany_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id], [l0].[PeriodEnd], [l0].[PeriodStart] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l0] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] ON [l].[Id] = [t].[Level1_Optional_Id] LEFT JOIN ( SELECT [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Level3_Name], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[OneToOne_Optional_PK_Inverse3Id], [l1].[PeriodEnd], [l1].[PeriodStart] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l1] - WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse3Id] IS NOT NULL) + WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL ) AS [t0] ON CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) AND ([t].[PeriodEnd] IS NOT NULL) AND ([t].[PeriodStart] IS NOT NULL) THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL AND [t].[PeriodEnd] IS NOT NULL AND [t].[PeriodStart] IS NOT NULL THEN [t].[Id] END = [t0].[OneToMany_Optional_Inverse3Id] ORDER BY [l].[Name], [l].[Id], [t].[Id] """); @@ -1790,18 +1790,18 @@ LEFT JOIN ( LEFT JOIN ( SELECT [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Level3_Name], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[OneToOne_Optional_PK_Inverse3Id], [l1].[PeriodEnd], [l1].[PeriodStart] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l1] - WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse3Id] IS NOT NULL) + WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL ) AS [t] ON CASE - WHEN ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [l0].[Id] + WHEN [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [l0].[Id] END = [t].[OneToOne_Optional_PK_Inverse3Id] LEFT JOIN ( SELECT [l2].[Id], [l2].[Level3_Optional_Id], [l2].[Level3_Required_Id], [l2].[Level4_Name], [l2].[OneToMany_Optional_Inverse4Id], [l2].[OneToMany_Required_Inverse4Id], [l2].[OneToOne_Optional_PK_Inverse4Id], [l2].[PeriodEnd], [l2].[PeriodStart] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l2] - WHERE ([l2].[Level3_Required_Id] IS NOT NULL) AND ([l2].[OneToMany_Required_Inverse4Id] IS NOT NULL) + WHERE [l2].[Level3_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse4Id] IS NOT NULL ) AS [t0] ON CASE - WHEN ([t].[Level2_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse3Id] IS NOT NULL) AND ([t].[PeriodEnd] IS NOT NULL) AND ([t].[PeriodStart] IS NOT NULL) THEN [t].[Id] + WHEN [t].[Level2_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse3Id] IS NOT NULL AND [t].[PeriodEnd] IS NOT NULL AND [t].[PeriodStart] IS NOT NULL THEN [t].[Id] END = [t0].[Level3_Optional_Id] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t1] ON [l].[Id] = [t1].[OneToMany_Optional_Inverse2Id] ORDER BY [l].[Id], [t1].[Id1], [t1].[Id] """); @@ -1818,19 +1818,19 @@ public override async Task Including_reference_navigation_and_projecting_collect LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[Level2_Name], [l0].[OneToMany_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id], [l0].[PeriodEnd], [l0].[PeriodStart] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l0] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] ON [l].[Id] = [t].[Level1_Required_Id] LEFT JOIN ( SELECT [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Level3_Name], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[OneToOne_Optional_PK_Inverse3Id], [l1].[PeriodEnd], [l1].[PeriodStart] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l1] - WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse3Id] IS NOT NULL) + WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL ) AS [t0] ON CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) AND ([t].[PeriodEnd] IS NOT NULL) AND ([t].[PeriodStart] IS NOT NULL) THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL AND [t].[PeriodEnd] IS NOT NULL AND [t].[PeriodStart] IS NOT NULL THEN [t].[Id] END = [t0].[Level2_Optional_Id] LEFT JOIN ( SELECT [l2].[Id], [l2].[OneToOne_Required_PK_Date], [l2].[Level1_Optional_Id], [l2].[Level1_Required_Id], [l2].[Level2_Name], [l2].[OneToMany_Optional_Inverse2Id], [l2].[OneToMany_Required_Inverse2Id], [l2].[OneToOne_Optional_PK_Inverse2Id], [l2].[PeriodEnd], [l2].[PeriodStart] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l2] - WHERE ([l2].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l2].[Level1_Required_Id] IS NOT NULL) AND ([l2].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l2].[OneToOne_Required_PK_Date] IS NOT NULL AND [l2].[Level1_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t1] ON [l].[Id] = [t1].[OneToMany_Required_Inverse2Id] ORDER BY [l].[Id], [t].[Id], [t0].[Id] """); @@ -1843,12 +1843,12 @@ public override async Task LeftJoin_with_Any_on_outer_source_and_projecting_coll AssertSql( """ SELECT CASE - WHEN ([t0].[OneToOne_Required_PK_Date] IS NULL) OR ([t0].[Level1_Required_Id] IS NULL) OR ([t0].[OneToMany_Required_Inverse2Id] IS NULL) OR (CASE - WHEN ([t0].[PeriodEnd0] IS NOT NULL) AND ([t0].[PeriodStart0] IS NOT NULL) THEN [t0].[PeriodEnd0] - END IS NULL) OR (CASE - WHEN ([t0].[PeriodEnd0] IS NOT NULL) AND ([t0].[PeriodStart0] IS NOT NULL) THEN [t0].[PeriodStart0] - END IS NULL) THEN 0 - WHEN ([t0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t0].[Level1_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse2Id] IS NOT NULL) AND ([t0].[PeriodEnd0] IS NOT NULL) AND ([t0].[PeriodStart0] IS NOT NULL) THEN [t0].[Id0] + WHEN [t0].[OneToOne_Required_PK_Date] IS NULL OR [t0].[Level1_Required_Id] IS NULL OR [t0].[OneToMany_Required_Inverse2Id] IS NULL OR CASE + WHEN [t0].[PeriodEnd0] IS NOT NULL AND [t0].[PeriodStart0] IS NOT NULL THEN [t0].[PeriodEnd0] + END IS NULL OR CASE + WHEN [t0].[PeriodEnd0] IS NOT NULL AND [t0].[PeriodStart0] IS NOT NULL THEN [t0].[PeriodStart0] + END IS NULL THEN 0 + WHEN [t0].[OneToOne_Required_PK_Date] IS NOT NULL AND [t0].[Level1_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse2Id] IS NOT NULL AND [t0].[PeriodEnd0] IS NOT NULL AND [t0].[PeriodStart0] IS NOT NULL THEN [t0].[Id0] END, [l].[Id], [t0].[Id], [t0].[Id0], [t1].[Id], [t1].[Level2_Optional_Id], [t1].[Level2_Required_Id], [t1].[Level3_Name], [t1].[OneToMany_Optional_Inverse3Id], [t1].[OneToMany_Required_Inverse3Id], [t1].[OneToOne_Optional_PK_Inverse3Id], [t1].[PeriodEnd], [t1].[PeriodStart] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l] LEFT JOIN ( @@ -1857,22 +1857,22 @@ LEFT JOIN ( LEFT JOIN ( SELECT [l1].[Id], [l1].[OneToOne_Required_PK_Date], [l1].[Level1_Required_Id], [l1].[OneToMany_Required_Inverse2Id], [l1].[PeriodEnd], [l1].[PeriodStart] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l1] - WHERE ([l1].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l1].[Level1_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l1].[OneToOne_Required_PK_Date] IS NOT NULL AND [l1].[Level1_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] ON [l0].[Id] = CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] END - WHERE ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) AND (CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) AND ([t].[PeriodEnd] IS NOT NULL) AND ([t].[PeriodStart] IS NOT NULL) THEN [t].[PeriodEnd] - END IS NOT NULL) AND (CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) AND ([t].[PeriodEnd] IS NOT NULL) AND ([t].[PeriodStart] IS NOT NULL) THEN [t].[PeriodStart] - END IS NOT NULL) + WHERE [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL AND CASE + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL AND [t].[PeriodEnd] IS NOT NULL AND [t].[PeriodStart] IS NOT NULL THEN [t].[PeriodEnd] + END IS NOT NULL AND CASE + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL AND [t].[PeriodEnd] IS NOT NULL AND [t].[PeriodStart] IS NOT NULL THEN [t].[PeriodStart] + END IS NOT NULL ) AS [t0] ON [l].[Id] = [t0].[Level1_Required_Id] LEFT JOIN ( SELECT [l2].[Id], [l2].[Level2_Optional_Id], [l2].[Level2_Required_Id], [l2].[Level3_Name], [l2].[OneToMany_Optional_Inverse3Id], [l2].[OneToMany_Required_Inverse3Id], [l2].[OneToOne_Optional_PK_Inverse3Id], [l2].[PeriodEnd], [l2].[PeriodStart] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l2] - WHERE ([l2].[Level2_Required_Id] IS NOT NULL) AND ([l2].[OneToMany_Required_Inverse3Id] IS NOT NULL) + WHERE [l2].[Level2_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse3Id] IS NOT NULL ) AS [t1] ON CASE - WHEN ([t0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t0].[Level1_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse2Id] IS NOT NULL) AND ([t0].[PeriodEnd0] IS NOT NULL) AND ([t0].[PeriodStart0] IS NOT NULL) THEN [t0].[Id0] + WHEN [t0].[OneToOne_Required_PK_Date] IS NOT NULL AND [t0].[Level1_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse2Id] IS NOT NULL AND [t0].[PeriodEnd0] IS NOT NULL AND [t0].[PeriodStart0] IS NOT NULL THEN [t0].[Id0] END = [t1].[OneToMany_Required_Inverse3Id] WHERE [l].[Name] IN (N'L1 01', N'L1 02') ORDER BY [l].[Id], [t0].[Id], [t0].[Id0] @@ -1896,19 +1896,19 @@ LEFT JOIN ( SELECT [t1].[Id], [t1].[c], [t1].[Id0], [t1].[OneToMany_Required_Inverse2Id] FROM ( SELECT CASE - WHEN ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [l0].[Id] + WHEN [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [l0].[Id] END AS [Id], 1 AS [c], [l0].[Id] AS [Id0], [l0].[OneToMany_Required_Inverse2Id], ROW_NUMBER() OVER(PARTITION BY [l0].[OneToMany_Required_Inverse2Id] ORDER BY [l0].[Id]) AS [row] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l0] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t1] WHERE [t1].[row] <= 1 ) AS [t0] ON [t].[Id] = [t0].[OneToMany_Required_Inverse2Id] LEFT JOIN ( SELECT CASE - WHEN ([l1].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l1].[Level1_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [l1].[Id] + WHEN [l1].[OneToOne_Required_PK_Date] IS NOT NULL AND [l1].[Level1_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [l1].[Id] END AS [Id], [l1].[Id] AS [Id0], [l1].[OneToMany_Required_Inverse2Id] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l1] - WHERE ([l1].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l1].[Level1_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l1].[OneToOne_Required_PK_Date] IS NOT NULL AND [l1].[Level1_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t2] ON [t].[Id] = [t2].[OneToMany_Required_Inverse2Id] ORDER BY [t].[Id], [t0].[Id0] """); @@ -1925,14 +1925,14 @@ public override async Task Multiple_complex_includes(bool async) LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[Level2_Name], [l0].[OneToMany_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id], [l0].[PeriodEnd], [l0].[PeriodStart] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l0] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] ON [l].[Id] = [t].[Level1_Optional_Id] LEFT JOIN ( SELECT [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Level3_Name], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[OneToOne_Optional_PK_Inverse3Id], [l1].[PeriodEnd], [l1].[PeriodStart] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l1] - WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse3Id] IS NOT NULL) + WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL ) AS [t0] ON CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) AND ([t].[PeriodEnd] IS NOT NULL) AND ([t].[PeriodStart] IS NOT NULL) THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL AND [t].[PeriodEnd] IS NOT NULL AND [t].[PeriodStart] IS NOT NULL THEN [t].[Id] END = [t0].[OneToMany_Optional_Inverse3Id] LEFT JOIN ( SELECT [l2].[Id], [l2].[OneToOne_Required_PK_Date], [l2].[Level1_Optional_Id], [l2].[Level1_Required_Id], [l2].[Level2_Name], [l2].[OneToMany_Optional_Inverse2Id], [l2].[OneToMany_Required_Inverse2Id], [l2].[OneToOne_Optional_PK_Inverse2Id], [l2].[PeriodEnd], [l2].[PeriodStart], [t2].[Id] AS [Id0], [t2].[Level2_Optional_Id], [t2].[Level2_Required_Id], [t2].[Level3_Name], [t2].[OneToMany_Optional_Inverse3Id], [t2].[OneToMany_Required_Inverse3Id], [t2].[OneToOne_Optional_PK_Inverse3Id], [t2].[PeriodEnd] AS [PeriodEnd0], [t2].[PeriodStart] AS [PeriodStart0] @@ -1940,11 +1940,11 @@ LEFT JOIN ( LEFT JOIN ( SELECT [l3].[Id], [l3].[Level2_Optional_Id], [l3].[Level2_Required_Id], [l3].[Level3_Name], [l3].[OneToMany_Optional_Inverse3Id], [l3].[OneToMany_Required_Inverse3Id], [l3].[OneToOne_Optional_PK_Inverse3Id], [l3].[PeriodEnd], [l3].[PeriodStart] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l3] - WHERE ([l3].[Level2_Required_Id] IS NOT NULL) AND ([l3].[OneToMany_Required_Inverse3Id] IS NOT NULL) + WHERE [l3].[Level2_Required_Id] IS NOT NULL AND [l3].[OneToMany_Required_Inverse3Id] IS NOT NULL ) AS [t2] ON CASE - WHEN ([l2].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l2].[Level1_Required_Id] IS NOT NULL) AND ([l2].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [l2].[Id] + WHEN [l2].[OneToOne_Required_PK_Date] IS NOT NULL AND [l2].[Level1_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [l2].[Id] END = [t2].[Level2_Optional_Id] - WHERE ([l2].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l2].[Level1_Required_Id] IS NOT NULL) AND ([l2].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l2].[OneToOne_Required_PK_Date] IS NOT NULL AND [l2].[Level1_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t1] ON [l].[Id] = [t1].[OneToMany_Optional_Inverse2Id] ORDER BY [l].[Id], [t].[Id], [t0].[Id], [t1].[Id] """); @@ -1961,14 +1961,14 @@ public override async Task Multiple_complex_include_select(bool async) LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[Level2_Name], [l0].[OneToMany_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id], [l0].[PeriodEnd], [l0].[PeriodStart] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l0] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] ON [l].[Id] = [t].[Level1_Optional_Id] LEFT JOIN ( SELECT [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Level3_Name], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[OneToOne_Optional_PK_Inverse3Id], [l1].[PeriodEnd], [l1].[PeriodStart] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l1] - WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse3Id] IS NOT NULL) + WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL ) AS [t0] ON CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) AND ([t].[PeriodEnd] IS NOT NULL) AND ([t].[PeriodStart] IS NOT NULL) THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL AND [t].[PeriodEnd] IS NOT NULL AND [t].[PeriodStart] IS NOT NULL THEN [t].[Id] END = [t0].[OneToMany_Optional_Inverse3Id] LEFT JOIN ( SELECT [l2].[Id], [l2].[OneToOne_Required_PK_Date], [l2].[Level1_Optional_Id], [l2].[Level1_Required_Id], [l2].[Level2_Name], [l2].[OneToMany_Optional_Inverse2Id], [l2].[OneToMany_Required_Inverse2Id], [l2].[OneToOne_Optional_PK_Inverse2Id], [l2].[PeriodEnd], [l2].[PeriodStart], [t2].[Id] AS [Id0], [t2].[Level2_Optional_Id], [t2].[Level2_Required_Id], [t2].[Level3_Name], [t2].[OneToMany_Optional_Inverse3Id], [t2].[OneToMany_Required_Inverse3Id], [t2].[OneToOne_Optional_PK_Inverse3Id], [t2].[PeriodEnd] AS [PeriodEnd0], [t2].[PeriodStart] AS [PeriodStart0] @@ -1976,11 +1976,11 @@ LEFT JOIN ( LEFT JOIN ( SELECT [l3].[Id], [l3].[Level2_Optional_Id], [l3].[Level2_Required_Id], [l3].[Level3_Name], [l3].[OneToMany_Optional_Inverse3Id], [l3].[OneToMany_Required_Inverse3Id], [l3].[OneToOne_Optional_PK_Inverse3Id], [l3].[PeriodEnd], [l3].[PeriodStart] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l3] - WHERE ([l3].[Level2_Required_Id] IS NOT NULL) AND ([l3].[OneToMany_Required_Inverse3Id] IS NOT NULL) + WHERE [l3].[Level2_Required_Id] IS NOT NULL AND [l3].[OneToMany_Required_Inverse3Id] IS NOT NULL ) AS [t2] ON CASE - WHEN ([l2].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l2].[Level1_Required_Id] IS NOT NULL) AND ([l2].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [l2].[Id] + WHEN [l2].[OneToOne_Required_PK_Date] IS NOT NULL AND [l2].[Level1_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [l2].[Id] END = [t2].[Level2_Optional_Id] - WHERE ([l2].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l2].[Level1_Required_Id] IS NOT NULL) AND ([l2].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l2].[OneToOne_Required_PK_Date] IS NOT NULL AND [l2].[Level1_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t1] ON [l].[Id] = [t1].[OneToMany_Optional_Inverse2Id] ORDER BY [l].[Id], [t].[Id], [t0].[Id], [t1].[Id] """); @@ -1997,42 +1997,42 @@ public override async Task Multiple_include_with_multiple_optional_navigations(b LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[Level2_Name], [l0].[OneToMany_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id], [l0].[PeriodEnd], [l0].[PeriodStart] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l0] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] ON [l].[Id] = [t].[Level1_Required_Id] LEFT JOIN ( SELECT [l1].[Id], [l1].[Level3_Name], [l1].[OneToOne_Optional_PK_Inverse3Id] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l1] - WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse3Id] IS NOT NULL) + WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL ) AS [t0] ON CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) AND ([t].[PeriodEnd] IS NOT NULL) AND ([t].[PeriodStart] IS NOT NULL) THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL AND [t].[PeriodEnd] IS NOT NULL AND [t].[PeriodStart] IS NOT NULL THEN [t].[Id] END = [t0].[OneToOne_Optional_PK_Inverse3Id] LEFT JOIN ( SELECT [l2].[Id], [l2].[Level2_Optional_Id], [l2].[Level2_Required_Id], [l2].[Level3_Name], [l2].[OneToMany_Optional_Inverse3Id], [l2].[OneToMany_Required_Inverse3Id], [l2].[OneToOne_Optional_PK_Inverse3Id], [l2].[PeriodEnd], [l2].[PeriodStart] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l2] - WHERE ([l2].[Level2_Required_Id] IS NOT NULL) AND ([l2].[OneToMany_Required_Inverse3Id] IS NOT NULL) + WHERE [l2].[Level2_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse3Id] IS NOT NULL ) AS [t1] ON CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) AND ([t].[PeriodEnd] IS NOT NULL) AND ([t].[PeriodStart] IS NOT NULL) THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL AND [t].[PeriodEnd] IS NOT NULL AND [t].[PeriodStart] IS NOT NULL THEN [t].[Id] END = [t1].[Level2_Optional_Id] LEFT JOIN ( SELECT [l3].[Id], [l3].[OneToOne_Required_PK_Date], [l3].[Level1_Optional_Id], [l3].[Level1_Required_Id], [l3].[Level2_Name], [l3].[OneToMany_Optional_Inverse2Id], [l3].[OneToMany_Required_Inverse2Id], [l3].[OneToOne_Optional_PK_Inverse2Id], [l3].[PeriodEnd], [l3].[PeriodStart] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l3] - WHERE ([l3].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l3].[Level1_Required_Id] IS NOT NULL) AND ([l3].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l3].[OneToOne_Required_PK_Date] IS NOT NULL AND [l3].[Level1_Required_Id] IS NOT NULL AND [l3].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t2] ON [l].[Id] = [t2].[Level1_Optional_Id] LEFT JOIN ( SELECT [l4].[Id], [l4].[Level2_Optional_Id], [l4].[Level2_Required_Id], [l4].[Level3_Name], [l4].[OneToMany_Optional_Inverse3Id], [l4].[OneToMany_Required_Inverse3Id], [l4].[OneToOne_Optional_PK_Inverse3Id], [l4].[PeriodEnd], [l4].[PeriodStart] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l4] - WHERE ([l4].[Level2_Required_Id] IS NOT NULL) AND ([l4].[OneToMany_Required_Inverse3Id] IS NOT NULL) + WHERE [l4].[Level2_Required_Id] IS NOT NULL AND [l4].[OneToMany_Required_Inverse3Id] IS NOT NULL ) AS [t3] ON CASE - WHEN ([t2].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t2].[Level1_Required_Id] IS NOT NULL) AND ([t2].[OneToMany_Required_Inverse2Id] IS NOT NULL) AND ([t2].[PeriodEnd] IS NOT NULL) AND ([t2].[PeriodStart] 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 AND [t2].[PeriodEnd] IS NOT NULL AND [t2].[PeriodStart] IS NOT NULL THEN [t2].[Id] END = [t3].[Level2_Optional_Id] LEFT JOIN ( SELECT [l5].[Id], [l5].[Level2_Optional_Id], [l5].[Level2_Required_Id], [l5].[Level3_Name], [l5].[OneToMany_Optional_Inverse3Id], [l5].[OneToMany_Required_Inverse3Id], [l5].[OneToOne_Optional_PK_Inverse3Id], [l5].[PeriodEnd], [l5].[PeriodStart] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l5] - WHERE ([l5].[Level2_Required_Id] IS NOT NULL) AND ([l5].[OneToMany_Required_Inverse3Id] IS NOT NULL) + WHERE [l5].[Level2_Required_Id] IS NOT NULL AND [l5].[OneToMany_Required_Inverse3Id] IS NOT NULL ) AS [t4] ON CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) AND ([t].[PeriodEnd] IS NOT NULL) AND ([t].[PeriodStart] IS NOT NULL) THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL AND [t].[PeriodEnd] IS NOT NULL AND [t].[PeriodStart] IS NOT NULL THEN [t].[Id] END = [t4].[OneToMany_Optional_Inverse3Id] -WHERE [t0].[Level3_Name] <> N'Foo' OR ([t0].[Level3_Name] IS NULL) +WHERE [t0].[Level3_Name] <> N'Foo' OR [t0].[Level3_Name] IS NULL ORDER BY [l].[Id], [t].[Id], [t0].[Id], [t1].[Id], [t2].[Id], [t3].[Id] """); } @@ -2048,21 +2048,21 @@ public override async Task Multiple_optional_navigation_with_Include(bool async) LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[PeriodEnd], [l0].[PeriodStart] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l0] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] ON [l].[Id] = [t].[Level1_Optional_Id] LEFT JOIN ( SELECT [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Level3_Name], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[OneToOne_Optional_PK_Inverse3Id], [l1].[PeriodEnd], [l1].[PeriodStart] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l1] - WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse3Id] IS NOT NULL) + WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL ) AS [t0] ON CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) AND ([t].[PeriodEnd] IS NOT NULL) AND ([t].[PeriodStart] IS NOT NULL) THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL AND [t].[PeriodEnd] IS NOT NULL AND [t].[PeriodStart] IS NOT NULL THEN [t].[Id] END = [t0].[OneToOne_Optional_PK_Inverse3Id] LEFT JOIN ( SELECT [l2].[Id], [l2].[Level3_Optional_Id], [l2].[Level3_Required_Id], [l2].[Level4_Name], [l2].[OneToMany_Optional_Inverse4Id], [l2].[OneToMany_Required_Inverse4Id], [l2].[OneToOne_Optional_PK_Inverse4Id], [l2].[PeriodEnd], [l2].[PeriodStart] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l2] - WHERE ([l2].[Level3_Required_Id] IS NOT NULL) AND ([l2].[OneToMany_Required_Inverse4Id] IS NOT NULL) + WHERE [l2].[Level3_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse4Id] IS NOT NULL ) AS [t1] ON CASE - WHEN ([t0].[Level2_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse3Id] IS NOT NULL) AND ([t0].[PeriodEnd] IS NOT NULL) AND ([t0].[PeriodStart] IS NOT NULL) THEN [t0].[Id] + WHEN [t0].[Level2_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse3Id] IS NOT NULL AND [t0].[PeriodEnd] IS NOT NULL AND [t0].[PeriodStart] IS NOT NULL THEN [t0].[Id] END = [t1].[OneToMany_Optional_Inverse4Id] ORDER BY [l].[Id], [t].[Id], [t0].[Id] """); @@ -2079,21 +2079,21 @@ public override async Task Multiple_optional_navigation_with_string_based_Includ LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[PeriodEnd], [l0].[PeriodStart] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l0] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] ON [l].[Id] = [t].[Level1_Optional_Id] LEFT JOIN ( SELECT [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Level3_Name], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[OneToOne_Optional_PK_Inverse3Id], [l1].[PeriodEnd], [l1].[PeriodStart] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l1] - WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse3Id] IS NOT NULL) + WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL ) AS [t0] ON CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) AND ([t].[PeriodEnd] IS NOT NULL) AND ([t].[PeriodStart] IS NOT NULL) THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL AND [t].[PeriodEnd] IS NOT NULL AND [t].[PeriodStart] IS NOT NULL THEN [t].[Id] END = [t0].[OneToOne_Optional_PK_Inverse3Id] LEFT JOIN ( SELECT [l2].[Id], [l2].[Level3_Optional_Id], [l2].[Level3_Required_Id], [l2].[Level4_Name], [l2].[OneToMany_Optional_Inverse4Id], [l2].[OneToMany_Required_Inverse4Id], [l2].[OneToOne_Optional_PK_Inverse4Id], [l2].[PeriodEnd], [l2].[PeriodStart] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l2] - WHERE ([l2].[Level3_Required_Id] IS NOT NULL) AND ([l2].[OneToMany_Required_Inverse4Id] IS NOT NULL) + WHERE [l2].[Level3_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse4Id] IS NOT NULL ) AS [t1] ON CASE - WHEN ([t0].[Level2_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse3Id] IS NOT NULL) AND ([t0].[PeriodEnd] IS NOT NULL) AND ([t0].[PeriodStart] IS NOT NULL) THEN [t0].[Id] + WHEN [t0].[Level2_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse3Id] IS NOT NULL AND [t0].[PeriodEnd] IS NOT NULL AND [t0].[PeriodStart] IS NOT NULL THEN [t0].[Id] END = [t1].[OneToMany_Optional_Inverse4Id] ORDER BY [l].[Id], [t].[Id], [t0].[Id] """); @@ -2106,27 +2106,27 @@ public override async Task Multiple_SelectMany_navigation_property_followed_by_s AssertSql( """ SELECT CASE - WHEN ([t0].[Level2_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [t0].[Id] + WHEN [t0].[Level2_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [t0].[Id] END, [l].[Id], [t].[Id], [t0].[Id], [t1].[Id], [t1].[Level3_Optional_Id], [t1].[Level3_Required_Id], [t1].[Level4_Name], [t1].[OneToMany_Optional_Inverse4Id], [t1].[OneToMany_Required_Inverse4Id], [t1].[OneToOne_Optional_PK_Inverse4Id], [t1].[PeriodEnd], [t1].[PeriodStart] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l] INNER JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Required_Id], [l0].[OneToMany_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[PeriodEnd], [l0].[PeriodStart] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l0] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] ON [l].[Id] = [t].[OneToMany_Optional_Inverse2Id] INNER JOIN ( SELECT [l1].[Id], [l1].[Level2_Required_Id], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[PeriodEnd], [l1].[PeriodStart] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l1] - WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse3Id] IS NOT NULL) + WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL ) AS [t0] ON CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] END = [t0].[OneToMany_Optional_Inverse3Id] LEFT JOIN ( SELECT [l2].[Id], [l2].[Level3_Optional_Id], [l2].[Level3_Required_Id], [l2].[Level4_Name], [l2].[OneToMany_Optional_Inverse4Id], [l2].[OneToMany_Required_Inverse4Id], [l2].[OneToOne_Optional_PK_Inverse4Id], [l2].[PeriodEnd], [l2].[PeriodStart] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l2] - WHERE ([l2].[Level3_Required_Id] IS NOT NULL) AND ([l2].[OneToMany_Required_Inverse4Id] IS NOT NULL) + WHERE [l2].[Level3_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse4Id] IS NOT NULL ) AS [t1] ON CASE - WHEN ([t0].[Level2_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [t0].[Id] + WHEN [t0].[Level2_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [t0].[Id] END = [t1].[OneToMany_Optional_Inverse4Id] ORDER BY [l].[Id], [t].[Id], [t0].[Id] """); @@ -2143,28 +2143,28 @@ public override async Task Multiple_SelectMany_with_Include(bool async) INNER JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Required_Id], [l0].[OneToMany_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[PeriodEnd], [l0].[PeriodStart] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l0] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] ON [l].[Id] = [t].[OneToMany_Optional_Inverse2Id] INNER JOIN ( SELECT [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Level3_Name], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[OneToOne_Optional_PK_Inverse3Id], [l1].[PeriodEnd], [l1].[PeriodStart] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l1] - WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse3Id] IS NOT NULL) + WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL ) AS [t0] ON CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] END = [t0].[OneToMany_Optional_Inverse3Id] LEFT JOIN ( SELECT [l2].[Id], [l2].[Level3_Optional_Id], [l2].[Level3_Required_Id], [l2].[Level4_Name], [l2].[OneToMany_Optional_Inverse4Id], [l2].[OneToMany_Required_Inverse4Id], [l2].[OneToOne_Optional_PK_Inverse4Id], [l2].[PeriodEnd], [l2].[PeriodStart] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l2] - WHERE ([l2].[Level3_Required_Id] IS NOT NULL) AND ([l2].[OneToMany_Required_Inverse4Id] IS NOT NULL) + WHERE [l2].[Level3_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse4Id] IS NOT NULL ) AS [t1] ON CASE - WHEN ([t0].[Level2_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [t0].[Id] + WHEN [t0].[Level2_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [t0].[Id] END = [t1].[Level3_Required_Id] LEFT JOIN ( SELECT [l3].[Id], [l3].[Level3_Optional_Id], [l3].[Level3_Required_Id], [l3].[Level4_Name], [l3].[OneToMany_Optional_Inverse4Id], [l3].[OneToMany_Required_Inverse4Id], [l3].[OneToOne_Optional_PK_Inverse4Id], [l3].[PeriodEnd], [l3].[PeriodStart] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l3] - WHERE ([l3].[Level3_Required_Id] IS NOT NULL) AND ([l3].[OneToMany_Required_Inverse4Id] IS NOT NULL) + WHERE [l3].[Level3_Required_Id] IS NOT NULL AND [l3].[OneToMany_Required_Inverse4Id] IS NOT NULL ) AS [t2] ON CASE - WHEN ([t0].[Level2_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [t0].[Id] + WHEN [t0].[Level2_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [t0].[Id] END = [t2].[OneToMany_Optional_Inverse4Id] ORDER BY [l].[Id], [t].[Id], [t0].[Id], [t1].[Id] """); @@ -2188,22 +2188,22 @@ LEFT JOIN ( INNER JOIN ( SELECT [l2].[Id], [l2].[OneToOne_Required_PK_Date], [l2].[Level1_Optional_Id], [l2].[Level1_Required_Id], [l2].[Level2_Name], [l2].[OneToMany_Optional_Inverse2Id], [l2].[OneToMany_Required_Inverse2Id], [l2].[OneToOne_Optional_PK_Inverse2Id], [l2].[PeriodEnd], [l2].[PeriodStart] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l2] - WHERE ([l2].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l2].[Level1_Required_Id] IS NOT NULL) AND ([l2].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l2].[OneToOne_Required_PK_Date] IS NOT NULL AND [l2].[Level1_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] ON [l1].[OneToMany_Required_Inverse3Id] = CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] END LEFT JOIN ( SELECT [l3].[Id], [l3].[Level2_Optional_Id], [l3].[Level2_Required_Id], [l3].[Level3_Name], [l3].[OneToMany_Optional_Inverse3Id], [l3].[OneToMany_Required_Inverse3Id], [l3].[OneToOne_Optional_PK_Inverse3Id], [l3].[PeriodEnd], [l3].[PeriodStart] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l3] - WHERE ([l3].[Level2_Required_Id] IS NOT NULL) AND ([l3].[OneToMany_Required_Inverse3Id] IS NOT NULL) + WHERE [l3].[Level2_Required_Id] IS NOT NULL AND [l3].[OneToMany_Required_Inverse3Id] IS NOT NULL ) AS [t0] ON CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] END = [t0].[OneToMany_Optional_Inverse3Id] - WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse3Id] IS NOT NULL) + WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL ) AS [t1] ON CASE - WHEN ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [l0].[Id] + WHEN [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [l0].[Id] END = [t1].[OneToMany_Optional_Inverse3Id] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t2] ON [l].[Id] = [t2].[OneToMany_Optional_Inverse2Id] ORDER BY [l].[Id], [t2].[Id], [t2].[Id0], [t2].[Id00] """); @@ -2223,11 +2223,11 @@ LEFT JOIN ( LEFT JOIN ( SELECT [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Level3_Name], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[OneToOne_Optional_PK_Inverse3Id], [l1].[PeriodEnd], [l1].[PeriodStart] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l1] - WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse3Id] IS NOT NULL) + WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL ) AS [t] ON CASE - WHEN ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [l0].[Id] + WHEN [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [l0].[Id] END = [t].[OneToMany_Optional_Inverse3Id] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t0] ON [l].[Id] = [t0].[OneToMany_Optional_Inverse2Id] ORDER BY [l].[Id], [t0].[Id] """); @@ -2243,22 +2243,22 @@ public override async Task Null_check_in_anonymous_type_projection_should_not_be FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l] LEFT JOIN ( SELECT CASE - WHEN ([t].[Level2_Required_Id] IS NULL) OR ([t].[OneToMany_Required_Inverse3Id] IS NULL) OR (CASE - WHEN ([t].[PeriodEnd] IS NOT NULL) AND ([t].[PeriodStart] IS NOT NULL) THEN [t].[PeriodEnd] - END IS NULL) OR (CASE - WHEN ([t].[PeriodEnd] IS NOT NULL) AND ([t].[PeriodStart] IS NOT NULL) THEN [t].[PeriodStart] - END IS NULL) THEN CAST(1 AS bit) + WHEN [t].[Level2_Required_Id] IS NULL OR [t].[OneToMany_Required_Inverse3Id] IS NULL OR CASE + WHEN [t].[PeriodEnd] IS NOT NULL AND [t].[PeriodStart] IS NOT NULL THEN [t].[PeriodEnd] + END IS NULL OR CASE + WHEN [t].[PeriodEnd] IS NOT NULL AND [t].[PeriodStart] IS NOT NULL THEN [t].[PeriodStart] + END IS NULL THEN CAST(1 AS bit) ELSE CAST(0 AS bit) END AS [c], [t].[Level3_Name], [l0].[Id], [t].[Id] AS [Id0], [l0].[OneToMany_Optional_Inverse2Id] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l0] LEFT JOIN ( SELECT [l1].[Id], [l1].[Level2_Required_Id], [l1].[Level3_Name], [l1].[OneToMany_Required_Inverse3Id], [l1].[PeriodEnd], [l1].[PeriodStart] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l1] - WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse3Id] IS NOT NULL) + WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL ) AS [t] ON CASE - WHEN ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [l0].[Id] + WHEN [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [l0].[Id] END = [t].[Level2_Required_Id] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t0] ON [l].[Id] = [t0].[OneToMany_Optional_Inverse2Id] ORDER BY [l].[Id], [t0].[Id] """); @@ -2274,22 +2274,22 @@ public override async Task Null_check_in_Dto_projection_should_not_be_removed(bo FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l] LEFT JOIN ( SELECT CASE - WHEN ([t].[Level2_Required_Id] IS NULL) OR ([t].[OneToMany_Required_Inverse3Id] IS NULL) OR (CASE - WHEN ([t].[PeriodEnd] IS NOT NULL) AND ([t].[PeriodStart] IS NOT NULL) THEN [t].[PeriodEnd] - END IS NULL) OR (CASE - WHEN ([t].[PeriodEnd] IS NOT NULL) AND ([t].[PeriodStart] IS NOT NULL) THEN [t].[PeriodStart] - END IS NULL) THEN CAST(1 AS bit) + WHEN [t].[Level2_Required_Id] IS NULL OR [t].[OneToMany_Required_Inverse3Id] IS NULL OR CASE + WHEN [t].[PeriodEnd] IS NOT NULL AND [t].[PeriodStart] IS NOT NULL THEN [t].[PeriodEnd] + END IS NULL OR CASE + WHEN [t].[PeriodEnd] IS NOT NULL AND [t].[PeriodStart] IS NOT NULL THEN [t].[PeriodStart] + END IS NULL THEN CAST(1 AS bit) ELSE CAST(0 AS bit) END AS [c], [t].[Level3_Name], [l0].[Id], [t].[Id] AS [Id0], [l0].[OneToMany_Optional_Inverse2Id] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l0] LEFT JOIN ( SELECT [l1].[Id], [l1].[Level2_Required_Id], [l1].[Level3_Name], [l1].[OneToMany_Required_Inverse3Id], [l1].[PeriodEnd], [l1].[PeriodStart] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l1] - WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse3Id] IS NOT NULL) + WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL ) AS [t] ON CASE - WHEN ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [l0].[Id] + WHEN [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [l0].[Id] END = [t].[Level2_Required_Id] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t0] ON [l].[Id] = [t0].[OneToMany_Optional_Inverse2Id] ORDER BY [l].[Id], [t0].[Id] """); @@ -2306,14 +2306,14 @@ public override async Task Optional_navigation_with_Include_and_order(bool async LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[Level2_Name], [l0].[OneToMany_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id], [l0].[PeriodEnd], [l0].[PeriodStart] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l0] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] ON [l].[Id] = [t].[Level1_Optional_Id] LEFT JOIN ( SELECT [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Level3_Name], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[OneToOne_Optional_PK_Inverse3Id], [l1].[PeriodEnd], [l1].[PeriodStart] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l1] - WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse3Id] IS NOT NULL) + WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL ) AS [t0] ON CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) AND ([t].[PeriodEnd] IS NOT NULL) AND ([t].[PeriodStart] IS NOT NULL) THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL AND [t].[PeriodEnd] IS NOT NULL AND [t].[PeriodStart] IS NOT NULL THEN [t].[Id] END = [t0].[OneToMany_Optional_Inverse3Id] ORDER BY [t].[Level2_Name], [l].[Id], [t].[Id] """); @@ -2330,7 +2330,7 @@ public override async Task Optional_navigation_with_Include_ThenInclude(bool asy LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[Level2_Name], [l0].[OneToMany_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id], [l0].[PeriodEnd], [l0].[PeriodStart] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l0] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] ON [l].[Id] = [t].[Level1_Optional_Id] LEFT JOIN ( SELECT [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Level3_Name], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[OneToOne_Optional_PK_Inverse3Id], [l1].[PeriodEnd], [l1].[PeriodStart], [t1].[Id] AS [Id0], [t1].[Level3_Optional_Id], [t1].[Level3_Required_Id], [t1].[Level4_Name], [t1].[OneToMany_Optional_Inverse4Id], [t1].[OneToMany_Required_Inverse4Id], [t1].[OneToOne_Optional_PK_Inverse4Id], [t1].[PeriodEnd] AS [PeriodEnd0], [t1].[PeriodStart] AS [PeriodStart0] @@ -2338,13 +2338,13 @@ LEFT JOIN ( LEFT JOIN ( SELECT [l2].[Id], [l2].[Level3_Optional_Id], [l2].[Level3_Required_Id], [l2].[Level4_Name], [l2].[OneToMany_Optional_Inverse4Id], [l2].[OneToMany_Required_Inverse4Id], [l2].[OneToOne_Optional_PK_Inverse4Id], [l2].[PeriodEnd], [l2].[PeriodStart] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l2] - WHERE ([l2].[Level3_Required_Id] IS NOT NULL) AND ([l2].[OneToMany_Required_Inverse4Id] IS NOT NULL) + WHERE [l2].[Level3_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse4Id] IS NOT NULL ) AS [t1] ON CASE - WHEN ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [l1].[Id] + WHEN [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [l1].[Id] END = [t1].[Level3_Optional_Id] - WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse3Id] IS NOT NULL) + WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL ) AS [t0] ON CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) AND ([t].[PeriodEnd] IS NOT NULL) AND ([t].[PeriodStart] IS NOT NULL) THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL AND [t].[PeriodEnd] IS NOT NULL AND [t].[PeriodStart] IS NOT NULL THEN [t].[Id] END = [t0].[OneToMany_Optional_Inverse3Id] ORDER BY [l].[Id], [t].[Id], [t0].[Id] """); @@ -2361,14 +2361,14 @@ public override async Task Optional_navigation_with_order_by_and_Include(bool as LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[Level2_Name], [l0].[OneToMany_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id], [l0].[PeriodEnd], [l0].[PeriodStart] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l0] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] ON [l].[Id] = [t].[Level1_Optional_Id] LEFT JOIN ( SELECT [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Level3_Name], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[OneToOne_Optional_PK_Inverse3Id], [l1].[PeriodEnd], [l1].[PeriodStart] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l1] - WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse3Id] IS NOT NULL) + WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL ) AS [t0] ON CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) AND ([t].[PeriodEnd] IS NOT NULL) AND ([t].[PeriodStart] IS NOT NULL) THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL AND [t].[PeriodEnd] IS NOT NULL AND [t].[PeriodStart] IS NOT NULL THEN [t].[Id] END = [t0].[OneToMany_Optional_Inverse3Id] ORDER BY [t].[Level2_Name], [l].[Id], [t].[Id] """); @@ -2385,14 +2385,14 @@ public override async Task Orderby_SelectMany_with_Include1(bool async) INNER JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[Level2_Name], [l0].[OneToMany_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id], [l0].[PeriodEnd], [l0].[PeriodStart] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l0] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] ON [l].[Id] = [t].[OneToMany_Optional_Inverse2Id] LEFT JOIN ( SELECT [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Level3_Name], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[OneToOne_Optional_PK_Inverse3Id], [l1].[PeriodEnd], [l1].[PeriodStart] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l1] - WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse3Id] IS NOT NULL) + WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL ) AS [t0] ON CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] END = [t0].[OneToMany_Optional_Inverse3Id] ORDER BY [l].[Id], [t].[Id] """); @@ -2413,7 +2413,7 @@ SELECT TOP(1) [l].[Id] LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[Level2_Name], [l0].[OneToMany_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id], [l0].[PeriodEnd], [l0].[PeriodStart] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l0] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t0] ON [t].[Id] = [t0].[OneToMany_Optional_Inverse2Id] ORDER BY [t].[Id] """); @@ -2430,12 +2430,12 @@ public override async Task Project_collection_and_include(bool async) LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[Level2_Name], [l0].[OneToMany_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id], [l0].[PeriodEnd], [l0].[PeriodStart] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l0] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] ON [l].[Id] = [t].[OneToMany_Optional_Inverse2Id] LEFT JOIN ( SELECT [l1].[Id], [l1].[OneToOne_Required_PK_Date], [l1].[Level1_Optional_Id], [l1].[Level1_Required_Id], [l1].[Level2_Name], [l1].[OneToMany_Optional_Inverse2Id], [l1].[OneToMany_Required_Inverse2Id], [l1].[OneToOne_Optional_PK_Inverse2Id], [l1].[PeriodEnd], [l1].[PeriodStart] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l1] - WHERE ([l1].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l1].[Level1_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l1].[OneToOne_Required_PK_Date] IS NOT NULL AND [l1].[Level1_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t0] ON [l].[Id] = [t0].[OneToMany_Optional_Inverse2Id] ORDER BY [l].[Id], [t].[Id] """); @@ -2452,7 +2452,7 @@ public override async Task Project_collection_and_root_entity(bool async) LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[Level2_Name], [l0].[OneToMany_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id], [l0].[PeriodEnd], [l0].[PeriodStart] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l0] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] ON [l].[Id] = [t].[OneToMany_Optional_Inverse2Id] ORDER BY [l].[Id] """); @@ -2469,7 +2469,7 @@ public override async Task Project_collection_navigation(bool async) LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[Level2_Name], [l0].[OneToMany_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id], [l0].[PeriodEnd], [l0].[PeriodStart] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l0] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] ON [l].[Id] = [t].[OneToMany_Optional_Inverse2Id] ORDER BY [l].[Id] """); @@ -2486,7 +2486,7 @@ public override async Task Project_collection_navigation_composed(bool async) LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[Level2_Name], [l0].[OneToMany_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id], [l0].[PeriodEnd], [l0].[PeriodStart] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l0] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) AND ([l0].[Level2_Name] <> N'Foo' OR ([l0].[Level2_Name] IS NULL)) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL AND ([l0].[Level2_Name] <> N'Foo' OR [l0].[Level2_Name] IS NULL) ) AS [t] ON [l].[Id] = [t].[OneToMany_Optional_Inverse2Id] WHERE [l].[Id] < 3 ORDER BY [l].[Id] @@ -2504,14 +2504,14 @@ public override async Task Project_collection_navigation_nested(bool async) LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[PeriodEnd], [l0].[PeriodStart] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l0] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] ON [l].[Id] = [t].[Level1_Optional_Id] LEFT JOIN ( SELECT [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Level3_Name], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[OneToOne_Optional_PK_Inverse3Id], [l1].[PeriodEnd], [l1].[PeriodStart] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l1] - WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse3Id] IS NOT NULL) + WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL ) AS [t0] ON CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) AND ([t].[PeriodEnd] IS NOT NULL) AND ([t].[PeriodStart] IS NOT NULL) THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL AND [t].[PeriodEnd] IS NOT NULL AND [t].[PeriodStart] IS NOT NULL THEN [t].[Id] END = [t0].[OneToMany_Optional_Inverse3Id] ORDER BY [l].[Id], [t].[Id] """); @@ -2528,14 +2528,14 @@ public override async Task Project_collection_navigation_nested_anonymous(bool a LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[PeriodEnd], [l0].[PeriodStart] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l0] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] ON [l].[Id] = [t].[Level1_Optional_Id] LEFT JOIN ( SELECT [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Level3_Name], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[OneToOne_Optional_PK_Inverse3Id], [l1].[PeriodEnd], [l1].[PeriodStart] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l1] - WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse3Id] IS NOT NULL) + WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL ) AS [t0] ON CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) AND ([t].[PeriodEnd] IS NOT NULL) AND ([t].[PeriodStart] IS NOT NULL) THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL AND [t].[PeriodEnd] IS NOT NULL AND [t].[PeriodStart] IS NOT NULL THEN [t].[Id] END = [t0].[OneToMany_Optional_Inverse3Id] ORDER BY [l].[Id], [t].[Id] """); @@ -2552,18 +2552,18 @@ public override async Task Project_collection_navigation_nested_with_take(bool a LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[PeriodEnd], [l0].[PeriodStart] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l0] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] ON [l].[Id] = [t].[Level1_Optional_Id] LEFT JOIN ( SELECT [t1].[Id], [t1].[Level2_Optional_Id], [t1].[Level2_Required_Id], [t1].[Level3_Name], [t1].[OneToMany_Optional_Inverse3Id], [t1].[OneToMany_Required_Inverse3Id], [t1].[OneToOne_Optional_PK_Inverse3Id], [t1].[PeriodEnd], [t1].[PeriodStart] FROM ( SELECT [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Level3_Name], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[OneToOne_Optional_PK_Inverse3Id], [l1].[PeriodEnd], [l1].[PeriodStart], ROW_NUMBER() OVER(PARTITION BY [l1].[OneToMany_Optional_Inverse3Id] ORDER BY [l1].[Id]) AS [row] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l1] - WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse3Id] IS NOT NULL) + WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL ) AS [t1] WHERE [t1].[row] <= 50 ) AS [t0] ON CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) AND ([t].[PeriodEnd] IS NOT NULL) AND ([t].[PeriodStart] IS NOT NULL) THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL AND [t].[PeriodEnd] IS NOT NULL AND [t].[PeriodStart] IS NOT NULL THEN [t].[Id] END = [t0].[OneToMany_Optional_Inverse3Id] ORDER BY [l].[Id], [t].[Id] """); @@ -2580,14 +2580,14 @@ public override async Task Project_collection_navigation_using_ef_property(bool LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[PeriodEnd], [l0].[PeriodStart] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l0] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] ON [l].[Id] = [t].[Level1_Optional_Id] LEFT JOIN ( SELECT [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Level3_Name], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[OneToOne_Optional_PK_Inverse3Id], [l1].[PeriodEnd], [l1].[PeriodStart] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l1] - WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse3Id] IS NOT NULL) + WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL ) AS [t0] ON CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) AND ([t].[PeriodEnd] IS NOT NULL) AND ([t].[PeriodStart] IS NOT NULL) THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL AND [t].[PeriodEnd] IS NOT NULL AND [t].[PeriodStart] IS NOT NULL THEN [t].[Id] END = [t0].[OneToMany_Optional_Inverse3Id] ORDER BY [l].[Id], [t].[Id] """); @@ -2604,14 +2604,14 @@ public override async Task Project_navigation_and_collection(bool async) LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[Level2_Name], [l0].[OneToMany_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id], [l0].[PeriodEnd], [l0].[PeriodStart] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l0] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] ON [l].[Id] = [t].[Level1_Optional_Id] LEFT JOIN ( SELECT [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Level3_Name], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[OneToOne_Optional_PK_Inverse3Id], [l1].[PeriodEnd], [l1].[PeriodStart] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l1] - WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse3Id] IS NOT NULL) + WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL ) AS [t0] ON CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) AND ([t].[PeriodEnd] IS NOT NULL) AND ([t].[PeriodStart] IS NOT NULL) THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL AND [t].[PeriodEnd] IS NOT NULL AND [t].[PeriodStart] IS NOT NULL THEN [t].[Id] END = [t0].[OneToMany_Optional_Inverse3Id] ORDER BY [l].[Id], [t].[Id] """); @@ -2624,20 +2624,20 @@ public override async Task SelectMany_navigation_property_followed_by_select_col AssertSql( """ SELECT CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] END, [l].[Id], [t].[Id], [t0].[Id], [t0].[Level2_Optional_Id], [t0].[Level2_Required_Id], [t0].[Level3_Name], [t0].[OneToMany_Optional_Inverse3Id], [t0].[OneToMany_Required_Inverse3Id], [t0].[OneToOne_Optional_PK_Inverse3Id], [t0].[PeriodEnd], [t0].[PeriodStart] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l] INNER JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Required_Id], [l0].[OneToMany_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[PeriodEnd], [l0].[PeriodStart] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l0] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] ON [l].[Id] = [t].[OneToMany_Optional_Inverse2Id] LEFT JOIN ( SELECT [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Level3_Name], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[OneToOne_Optional_PK_Inverse3Id], [l1].[PeriodEnd], [l1].[PeriodStart] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l1] - WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse3Id] IS NOT NULL) + WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL ) AS [t0] ON CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] END = [t0].[OneToMany_Optional_Inverse3Id] ORDER BY [l].[Id], [t].[Id] """); @@ -2654,21 +2654,21 @@ public override async Task SelectMany_navigation_property_with_include_and_follo INNER JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[Level2_Name], [l0].[OneToMany_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id], [l0].[PeriodEnd], [l0].[PeriodStart] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l0] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] ON [l].[Id] = [t].[OneToMany_Optional_Inverse2Id] LEFT JOIN ( SELECT [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Level3_Name], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[OneToOne_Optional_PK_Inverse3Id], [l1].[PeriodEnd], [l1].[PeriodStart] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l1] - WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse3Id] IS NOT NULL) + WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL ) AS [t0] ON CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] END = [t0].[OneToMany_Required_Inverse3Id] LEFT JOIN ( SELECT [l2].[Id], [l2].[Level2_Optional_Id], [l2].[Level2_Required_Id], [l2].[Level3_Name], [l2].[OneToMany_Optional_Inverse3Id], [l2].[OneToMany_Required_Inverse3Id], [l2].[OneToOne_Optional_PK_Inverse3Id], [l2].[PeriodEnd], [l2].[PeriodStart] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l2] - WHERE ([l2].[Level2_Required_Id] IS NOT NULL) AND ([l2].[OneToMany_Required_Inverse3Id] IS NOT NULL) + WHERE [l2].[Level2_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse3Id] IS NOT NULL ) AS [t1] ON CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] END = [t1].[OneToMany_Optional_Inverse3Id] ORDER BY [l].[Id], [t].[Id], [t0].[Id] """); @@ -2685,14 +2685,14 @@ public override async Task SelectMany_with_Include1(bool async) INNER JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[Level2_Name], [l0].[OneToMany_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id], [l0].[PeriodEnd], [l0].[PeriodStart] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l0] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] ON [l].[Id] = [t].[OneToMany_Optional_Inverse2Id] LEFT JOIN ( SELECT [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Level3_Name], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[OneToOne_Optional_PK_Inverse3Id], [l1].[PeriodEnd], [l1].[PeriodStart] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l1] - WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse3Id] IS NOT NULL) + WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL ) AS [t0] ON CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] END = [t0].[OneToMany_Optional_Inverse3Id] ORDER BY [l].[Id], [t].[Id] """); @@ -2709,14 +2709,14 @@ public override async Task SelectMany_with_Include2(bool async) INNER JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[Level2_Name], [l0].[OneToMany_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id], [l0].[PeriodEnd], [l0].[PeriodStart] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l0] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] ON [l].[Id] = [t].[OneToMany_Optional_Inverse2Id] LEFT JOIN ( SELECT [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Level3_Name], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[OneToOne_Optional_PK_Inverse3Id], [l1].[PeriodEnd], [l1].[PeriodStart] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l1] - WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse3Id] IS NOT NULL) + WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL ) AS [t0] ON CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] END = [t0].[Level2_Required_Id] """); } @@ -2732,14 +2732,14 @@ public override async Task SelectMany_with_Include_and_order_by(bool async) INNER JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[Level2_Name], [l0].[OneToMany_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id], [l0].[PeriodEnd], [l0].[PeriodStart] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l0] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] ON [l].[Id] = [t].[OneToMany_Optional_Inverse2Id] LEFT JOIN ( SELECT [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Level3_Name], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[OneToOne_Optional_PK_Inverse3Id], [l1].[PeriodEnd], [l1].[PeriodStart] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l1] - WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse3Id] IS NOT NULL) + WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL ) AS [t0] ON CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] END = [t0].[OneToMany_Optional_Inverse3Id] ORDER BY [t].[Level2_Name], [l].[Id], [t].[Id] """); @@ -2756,21 +2756,21 @@ public override async Task SelectMany_with_Include_ThenInclude(bool async) INNER JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[Level2_Name], [l0].[OneToMany_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id], [l0].[PeriodEnd], [l0].[PeriodStart] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l0] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] ON [l].[Id] = [t].[OneToMany_Optional_Inverse2Id] LEFT JOIN ( SELECT [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Level3_Name], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[OneToOne_Optional_PK_Inverse3Id], [l1].[PeriodEnd], [l1].[PeriodStart] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l1] - WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse3Id] IS NOT NULL) + WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL ) AS [t0] ON CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] END = [t0].[Level2_Required_Id] LEFT JOIN ( SELECT [l2].[Id], [l2].[Level3_Optional_Id], [l2].[Level3_Required_Id], [l2].[Level4_Name], [l2].[OneToMany_Optional_Inverse4Id], [l2].[OneToMany_Required_Inverse4Id], [l2].[OneToOne_Optional_PK_Inverse4Id], [l2].[PeriodEnd], [l2].[PeriodStart] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l2] - WHERE ([l2].[Level3_Required_Id] IS NOT NULL) AND ([l2].[OneToMany_Required_Inverse4Id] IS NOT NULL) + WHERE [l2].[Level3_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse4Id] IS NOT NULL ) AS [t1] ON CASE - WHEN ([t0].[Level2_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse3Id] IS NOT NULL) AND ([t0].[PeriodEnd] IS NOT NULL) AND ([t0].[PeriodStart] IS NOT NULL) THEN [t0].[Id] + WHEN [t0].[Level2_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse3Id] IS NOT NULL AND [t0].[PeriodEnd] IS NOT NULL AND [t0].[PeriodStart] IS NOT NULL THEN [t0].[Id] END = [t1].[OneToMany_Optional_Inverse4Id] ORDER BY [l].[Id], [t].[Id], [t0].[Id] """); @@ -2787,18 +2787,18 @@ public override async Task SelectMany_with_navigation_and_Distinct(bool async) INNER JOIN ( SELECT DISTINCT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[Level2_Name], [l0].[OneToMany_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id], [l0].[PeriodEnd], [l0].[PeriodStart] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l0] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] ON [l].[Id] = [t].[OneToMany_Optional_Inverse2Id] LEFT JOIN ( SELECT [l1].[Id], [l1].[OneToOne_Required_PK_Date], [l1].[Level1_Optional_Id], [l1].[Level1_Required_Id], [l1].[Level2_Name], [l1].[OneToMany_Optional_Inverse2Id], [l1].[OneToMany_Required_Inverse2Id], [l1].[OneToOne_Optional_PK_Inverse2Id], [l1].[PeriodEnd], [l1].[PeriodStart] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l1] - WHERE ([l1].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l1].[Level1_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l1].[OneToOne_Required_PK_Date] IS NOT NULL AND [l1].[Level1_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t0] ON [l].[Id] = [t0].[OneToMany_Optional_Inverse2Id] -WHERE ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) AND (CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[PeriodEnd] -END IS NOT NULL) AND (CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[PeriodStart] -END IS NOT NULL) +WHERE [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL AND CASE + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[PeriodEnd] +END IS NOT NULL AND CASE + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[PeriodStart] +END IS NOT NULL ORDER BY [l].[Id], [t].[Id] """); } @@ -2814,14 +2814,14 @@ public override async Task SelectMany_with_order_by_and_Include(bool async) INNER JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[Level2_Name], [l0].[OneToMany_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id], [l0].[PeriodEnd], [l0].[PeriodStart] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l0] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] ON [l].[Id] = [t].[OneToMany_Optional_Inverse2Id] LEFT JOIN ( SELECT [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Level3_Name], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[OneToOne_Optional_PK_Inverse3Id], [l1].[PeriodEnd], [l1].[PeriodStart] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l1] - WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse3Id] IS NOT NULL) + WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL ) AS [t0] ON CASE - WHEN ([t].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t].[Level1_Required_Id] IS NOT NULL) AND ([t].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t].[Id] + WHEN [t].[OneToOne_Required_PK_Date] IS NOT NULL AND [t].[Level1_Required_Id] IS NOT NULL AND [t].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t].[Id] END = [t0].[OneToMany_Optional_Inverse3Id] ORDER BY [t].[Level2_Name], [l].[Id], [t].[Id] """); @@ -2837,10 +2837,10 @@ public override async Task Select_nav_prop_collection_one_to_many_required(bool FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l] LEFT JOIN ( SELECT CASE - WHEN ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [l0].[Id] + WHEN [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [l0].[Id] END AS [c], [l0].[Id], [l0].[OneToMany_Required_Inverse2Id] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l0] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] ON [l].[Id] = [t].[OneToMany_Required_Inverse2Id] ORDER BY [l].[Id] """); @@ -2858,21 +2858,21 @@ LEFT JOIN ( SELECT [t].[c], [t].[Id], [t].[OneToOne_Required_PK_Date], [t].[Level1_Required_Id], [t].[OneToMany_Required_Inverse2Id], [t].[PeriodEnd], [t].[PeriodStart], [t].[OneToMany_Optional_Inverse2Id] FROM ( SELECT 1 AS [c], [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Required_Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[PeriodEnd], [l0].[PeriodStart], [l0].[OneToMany_Optional_Inverse2Id], ROW_NUMBER() OVER(PARTITION BY [l0].[OneToMany_Optional_Inverse2Id] ORDER BY CASE - WHEN ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [l0].[Id] + WHEN [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [l0].[Id] END) AS [row] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l0] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] WHERE [t].[row] <= 1 ) AS [t0] ON [l].[Id] = [t0].[OneToMany_Optional_Inverse2Id] LEFT JOIN ( SELECT CASE - WHEN ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [l1].[Id] + WHEN [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [l1].[Id] END AS [Id], [l1].[Id] AS [Id0], [l1].[OneToMany_Optional_Inverse3Id] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l1] - WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse3Id] IS NOT NULL) + WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL ) AS [t1] ON CASE - WHEN ([t0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t0].[Level1_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t0].[Id] + WHEN [t0].[OneToOne_Required_PK_Date] IS NOT NULL AND [t0].[Level1_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t0].[Id] END = [t1].[OneToMany_Optional_Inverse3Id] ORDER BY [l].[Id], [t0].[Id], [t1].[Id] """); @@ -2888,32 +2888,32 @@ public override async Task Select_subquery_single_nested_subquery2(bool async) FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l] LEFT JOIN ( SELECT [l0].[Id], [t0].[Id] AS [Id0], [t1].[Id] AS [Id1], [t1].[Id0] AS [Id00], [t0].[c], CASE - WHEN ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [l0].[Id] + WHEN [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [l0].[Id] END AS [c0], [l0].[OneToMany_Optional_Inverse2Id] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l0] LEFT JOIN ( SELECT [t].[c], [t].[Id], [t].[Level2_Required_Id], [t].[OneToMany_Required_Inverse3Id], [t].[PeriodEnd], [t].[PeriodStart], [t].[OneToMany_Optional_Inverse3Id] FROM ( SELECT 1 AS [c], [l1].[Id], [l1].[Level2_Required_Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[PeriodEnd], [l1].[PeriodStart], [l1].[OneToMany_Optional_Inverse3Id], ROW_NUMBER() OVER(PARTITION BY [l1].[OneToMany_Optional_Inverse3Id] ORDER BY CASE - WHEN ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [l1].[Id] + WHEN [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [l1].[Id] END) AS [row] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l1] - WHERE ([l1].[Level2_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse3Id] IS NOT NULL) + WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse3Id] IS NOT NULL ) AS [t] WHERE [t].[row] <= 1 ) AS [t0] ON CASE - WHEN ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [l0].[Id] + WHEN [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [l0].[Id] END = [t0].[OneToMany_Optional_Inverse3Id] LEFT JOIN ( SELECT CASE - WHEN ([l2].[Level3_Required_Id] IS NOT NULL) AND ([l2].[OneToMany_Required_Inverse4Id] IS NOT NULL) THEN [l2].[Id] + WHEN [l2].[Level3_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse4Id] IS NOT NULL THEN [l2].[Id] END AS [Id], [l2].[Id] AS [Id0], [l2].[OneToMany_Optional_Inverse4Id] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l2] - WHERE ([l2].[Level3_Required_Id] IS NOT NULL) AND ([l2].[OneToMany_Required_Inverse4Id] IS NOT NULL) + WHERE [l2].[Level3_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse4Id] IS NOT NULL ) AS [t1] ON CASE - WHEN ([t0].[Level2_Required_Id] IS NOT NULL) AND ([t0].[OneToMany_Required_Inverse3Id] IS NOT NULL) THEN [t0].[Id] + WHEN [t0].[Level2_Required_Id] IS NOT NULL AND [t0].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [t0].[Id] END = [t1].[OneToMany_Optional_Inverse4Id] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t2] ON [l].[Id] = [t2].[OneToMany_Optional_Inverse2Id] ORDER BY [l].[Id], [t2].[c0], [t2].[Id], [t2].[Id0], [t2].[Id1] """); @@ -3006,7 +3006,7 @@ OUTER APPLY ( FROM ( SELECT [l0].[Date] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l0] - WHERE [l0].[Name] = [l].[Name] OR (([l0].[Name] IS NULL) AND ([l].[Name] IS NULL)) + WHERE [l0].[Name] = [l].[Name] OR ([l0].[Name] IS NULL AND [l].[Name] IS NULL) GROUP BY [l0].[Date] ) AS [t] LEFT JOIN ( @@ -3014,7 +3014,7 @@ LEFT JOIN ( FROM ( SELECT [l1].[Id], [l1].[Date], [l1].[Name], [l1].[PeriodEnd], [l1].[PeriodStart], ROW_NUMBER() OVER(PARTITION BY [l1].[Date] ORDER BY [l1].[Name]) AS [row] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l1] - WHERE [l1].[Name] = [l].[Name] OR (([l1].[Name] IS NULL) AND ([l].[Name] IS NULL)) + WHERE [l1].[Name] = [l].[Name] OR ([l1].[Name] IS NULL AND [l].[Name] IS NULL) ) AS [t1] WHERE 1 < [t1].[row] AND [t1].[row] <= 6 ) AS [t0] ON [t].[Date] = [t0].[Date] @@ -3071,7 +3071,7 @@ OFFSET 1 ROWS FETCH NEXT 5 ROWS ONLY LEFT JOIN ( SELECT [l1].[Id], [l1].[OneToOne_Required_PK_Date], [l1].[Level1_Optional_Id], [l1].[Level1_Required_Id], [l1].[Level2_Name], [l1].[OneToMany_Optional_Inverse2Id], [l1].[OneToMany_Required_Inverse2Id], [l1].[OneToOne_Optional_PK_Inverse2Id], [l1].[PeriodEnd], [l1].[PeriodStart] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l1] - WHERE ([l1].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l1].[Level1_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l1].[OneToOne_Required_PK_Date] IS NOT NULL AND [l1].[Level1_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t2] ON [t0].[Id] = [t2].[OneToMany_Optional_Inverse2Id] ) AS [t1] ORDER BY [t].[Date], [t1].[Name], [t1].[Id] @@ -3102,7 +3102,7 @@ OFFSET 1 ROWS FETCH NEXT 5 ROWS ONLY LEFT JOIN ( SELECT [l1].[Id], [l1].[OneToOne_Required_PK_Date], [l1].[Level1_Optional_Id], [l1].[Level1_Required_Id], [l1].[Level2_Name], [l1].[OneToMany_Optional_Inverse2Id], [l1].[OneToMany_Required_Inverse2Id], [l1].[OneToOne_Optional_PK_Inverse2Id], [l1].[PeriodEnd], [l1].[PeriodStart] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l1] - WHERE ([l1].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l1].[Level1_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l1].[OneToOne_Required_PK_Date] IS NOT NULL AND [l1].[Level1_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t2] ON [t0].[Id] = [t2].[Level1_Optional_Id] ) AS [t1] ORDER BY [t].[Date], [t1].[Name], [t1].[Id] @@ -3126,16 +3126,16 @@ OFFSET @__p_0 ROWS FETCH NEXT @__p_0 ROWS ONLY ) AS [t] OUTER APPLY ( SELECT CASE - WHEN ([t1].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t1].[Level1_Required_Id] IS NOT NULL) AND ([t1].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t1].[Id] + WHEN [t1].[OneToOne_Required_PK_Date] IS NOT NULL AND [t1].[Level1_Required_Id] IS NOT NULL AND [t1].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t1].[Id] END AS [Id], [t1].[Level2_Name] AS [Name], [t1].[OneToMany_Required_Inverse2Id] AS [Level1Id], [t1].[Level1_Required_Id] AS [Level2Id], [l0].[Id] AS [Id0], [l0].[Date], [l0].[Name] AS [Name0], [l0].[PeriodEnd], [l0].[PeriodStart], [t1].[Id] AS [Id1], [t1].[c] FROM ( SELECT [l1].[Id], [l1].[OneToOne_Required_PK_Date], [l1].[Level1_Required_Id], [l1].[Level2_Name], [l1].[OneToMany_Required_Inverse2Id], [l1].[PeriodEnd], [l1].[PeriodStart], CASE - WHEN ([l1].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l1].[Level1_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [l1].[Id] + WHEN [l1].[OneToOne_Required_PK_Date] IS NOT NULL AND [l1].[Level1_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [l1].[Id] END AS [c] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l1] - WHERE ([l1].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l1].[Level1_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse2Id] IS NOT NULL) AND [t].[Id] = [l1].[OneToMany_Required_Inverse2Id] + WHERE [l1].[OneToOne_Required_PK_Date] IS NOT NULL AND [l1].[Level1_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse2Id] IS NOT NULL AND [t].[Id] = [l1].[OneToMany_Required_Inverse2Id] ORDER BY CASE - WHEN ([l1].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l1].[Level1_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [l1].[Id] + WHEN [l1].[OneToOne_Required_PK_Date] IS NOT NULL AND [l1].[Level1_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [l1].[Id] END OFFSET 1 ROWS FETCH NEXT 3 ROWS ONLY ) AS [t1] @@ -3182,7 +3182,7 @@ LEFT JOIN ( FROM ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[Level2_Name], [l0].[OneToMany_Optional_Inverse2Id], [l0].[OneToMany_Required_Inverse2Id], [l0].[OneToOne_Optional_PK_Inverse2Id], [l0].[PeriodEnd], [l0].[PeriodStart], ROW_NUMBER() OVER(PARTITION BY [l0].[OneToMany_Optional_Inverse2Id] ORDER BY [l0].[Id]) AS [row] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l0] - WHERE ([l0].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l0].[Level1_Required_Id] IS NOT NULL) AND ([l0].[OneToMany_Required_Inverse2Id] IS NOT NULL) + WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [t] WHERE [t].[row] <= 50 ) AS [t0] ON [l].[Id] = [t0].[OneToMany_Optional_Inverse2Id] @@ -3230,16 +3230,16 @@ ORDER BY [l].[Id] ) AS [t] OUTER APPLY ( SELECT CASE - WHEN ([t1].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([t1].[Level1_Required_Id] IS NOT NULL) AND ([t1].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [t1].[Id] + WHEN [t1].[OneToOne_Required_PK_Date] IS NOT NULL AND [t1].[Level1_Required_Id] IS NOT NULL AND [t1].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [t1].[Id] END AS [Id], [t1].[Level2_Name] AS [Name], [t1].[OneToMany_Required_Inverse2Id] AS [Level1Id], [t1].[Level1_Required_Id] AS [Level2Id], [l0].[Id] AS [Id0], [l0].[Date], [l0].[Name] AS [Name0], [l0].[PeriodEnd], [l0].[PeriodStart], [t1].[Id] AS [Id1], [t1].[c] FROM ( SELECT TOP(3) [l1].[Id], [l1].[OneToOne_Required_PK_Date], [l1].[Level1_Required_Id], [l1].[Level2_Name], [l1].[OneToMany_Required_Inverse2Id], [l1].[PeriodEnd], [l1].[PeriodStart], CASE - WHEN ([l1].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l1].[Level1_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [l1].[Id] + WHEN [l1].[OneToOne_Required_PK_Date] IS NOT NULL AND [l1].[Level1_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [l1].[Id] END AS [c] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l1] - WHERE ([l1].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l1].[Level1_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse2Id] IS NOT NULL) AND [t].[Id] = [l1].[OneToMany_Required_Inverse2Id] + WHERE [l1].[OneToOne_Required_PK_Date] IS NOT NULL AND [l1].[Level1_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse2Id] IS NOT NULL AND [t].[Id] = [l1].[OneToMany_Required_Inverse2Id] ORDER BY CASE - WHEN ([l1].[OneToOne_Required_PK_Date] IS NOT NULL) AND ([l1].[Level1_Required_Id] IS NOT NULL) AND ([l1].[OneToMany_Required_Inverse2Id] IS NOT NULL) THEN [l1].[Id] + WHEN [l1].[OneToOne_Required_PK_Date] IS NOT NULL AND [l1].[Level1_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [l1].[Id] END ) AS [t1] INNER JOIN [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l0] ON [t1].[Level1_Required_Id] = [l0].[Id] diff --git a/test/EFCore.SqlServer.FunctionalTests/Query/TemporalGearsOfWarQuerySqlServerTest.cs b/test/EFCore.SqlServer.FunctionalTests/Query/TemporalGearsOfWarQuerySqlServerTest.cs index e26fc12d9d5..c7b8761c36b 100644 --- a/test/EFCore.SqlServer.FunctionalTests/Query/TemporalGearsOfWarQuerySqlServerTest.cs +++ b/test/EFCore.SqlServer.FunctionalTests/Query/TemporalGearsOfWarQuerySqlServerTest.cs @@ -377,13 +377,13 @@ public override async Task Accessing_derived_property_using_hard_and_soft_cast(b """ 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) """); } @@ -394,7 +394,7 @@ public override async Task Accessing_property_of_optional_navigation_in_child_pr AssertSql( """ SELECT CASE - WHEN ([g].[Nickname] IS NOT NULL) AND ([g].[SquadId] IS NOT NULL) THEN CAST(1 AS bit) + WHEN [g].[Nickname] IS NOT NULL AND [g].[SquadId] IS NOT NULL THEN CAST(1 AS bit) ELSE CAST(0 AS bit) END, [t].[Id], [g].[Nickname], [g].[SquadId], [t0].[Nickname], [t0].[Id], [t0].[SquadId] FROM [Tags] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [t] @@ -436,7 +436,7 @@ WHEN NOT EXISTS ( SELECT 1 FROM [Gears] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [g] LEFT JOIN [Tags] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [t] ON [g].[Nickname] = [t].[GearNickName] AND [g].[SquadId] = [t].[GearSquadId] - WHERE [t].[Note] = N'Foo' AND ([t].[Note] IS NOT NULL)) THEN CAST(1 AS bit) + WHERE [t].[Note] = N'Foo' AND [t].[Note] IS NOT NULL) THEN CAST(1 AS bit) ELSE CAST(0 AS bit) END """); @@ -572,7 +572,7 @@ public override async Task Select_null_propagation_negative3(bool async) AssertSql( """ SELECT [g0].[Nickname], CASE - WHEN ([g0].[Nickname] IS NOT NULL) AND ([g0].[SquadId] IS NOT NULL) THEN CASE + WHEN [g0].[Nickname] IS NOT NULL AND [g0].[SquadId] IS NOT NULL THEN CASE WHEN [g0].[LeaderNickname] IS NOT NULL THEN CAST(1 AS bit) ELSE CAST(0 AS bit) END @@ -659,7 +659,7 @@ public override async Task OfTypeNav1(bool async) FROM [Gears] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [g] LEFT JOIN [Tags] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [t] ON [g].[Nickname] = [t].[GearNickName] AND [g].[SquadId] = [t].[GearSquadId] LEFT JOIN [Tags] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [t0] ON [g].[Nickname] = [t0].[GearNickName] AND [g].[SquadId] = [t0].[GearSquadId] -WHERE ([t].[Note] <> N'Foo' OR ([t].[Note] IS NULL)) AND [g].[Discriminator] = N'Officer' AND ([t0].[Note] <> N'Bar' OR ([t0].[Note] IS NULL)) +WHERE ([t].[Note] <> N'Foo' OR [t].[Note] IS NULL) AND [g].[Discriminator] = N'Officer' AND ([t0].[Note] <> N'Bar' OR [t0].[Note] IS NULL) """); } @@ -702,7 +702,7 @@ public override async Task Include_on_GroupJoin_SelectMany_DefaultIfEmpty_with_c AssertSql( """ SELECT CASE - WHEN ([g0].[Nickname] IS NOT NULL) AND ([g0].[SquadId] IS NOT NULL) THEN CAST(1 AS bit) + WHEN [g0].[Nickname] IS NOT NULL AND [g0].[SquadId] IS NOT NULL THEN CAST(1 AS bit) ELSE CAST(0 AS bit) END, [g0].[Nickname], [g0].[SquadId], [g0].[AssignedCityName], [g0].[CityOfBirthName], [g0].[Discriminator], [g0].[FullName], [g0].[HasSoulPatch], [g0].[LeaderNickname], [g0].[LeaderSquadId], [g0].[PeriodEnd], [g0].[PeriodStart], [g0].[Rank], [g].[Nickname], [g].[SquadId], [w].[Id], [w].[AmmunitionType], [w].[IsAutomatic], [w].[Name], [w].[OwnerFullName], [w].[PeriodEnd], [w].[PeriodStart], [w].[SynergyWithId], [g].[AssignedCityName], [g].[CityOfBirthName], [g].[Discriminator], [g].[FullName], [g].[HasSoulPatch], [g].[LeaderNickname], [g].[LeaderSquadId], [g].[PeriodEnd], [g].[PeriodStart], [g].[Rank], [w0].[Id], [w0].[AmmunitionType], [w0].[IsAutomatic], [w0].[Name], [w0].[OwnerFullName], [w0].[PeriodEnd], [w0].[PeriodStart], [w0].[SynergyWithId] FROM [Gears] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [g] @@ -906,7 +906,7 @@ public override async Task Where_bitwise_and_nullable_enum_with_constant(bool as """ SELECT [w].[Id], [w].[AmmunitionType], [w].[IsAutomatic], [w].[Name], [w].[OwnerFullName], [w].[PeriodEnd], [w].[PeriodStart], [w].[SynergyWithId] FROM [Weapons] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [w] -WHERE ([w].[AmmunitionType] & 1) > 0 +WHERE [w].[AmmunitionType] & 1 > 0 """); } @@ -1009,7 +1009,7 @@ public override async Task Null_propagation_optimization1(bool async) """ SELECT [g].[Nickname], [g].[SquadId], [g].[AssignedCityName], [g].[CityOfBirthName], [g].[Discriminator], [g].[FullName], [g].[HasSoulPatch], [g].[LeaderNickname], [g].[LeaderSquadId], [g].[PeriodEnd], [g].[PeriodStart], [g].[Rank] FROM [Gears] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [g] -WHERE [g].[LeaderNickname] = N'Marcus' AND ([g].[LeaderNickname] IS NOT NULL) +WHERE [g].[LeaderNickname] = N'Marcus' AND [g].[LeaderNickname] IS NOT NULL """); } @@ -1043,7 +1043,7 @@ public override async Task Projecting_property_converted_to_nullable_with_condit AssertSql( """ SELECT CASE - WHEN [t].[Note] <> N'K.I.A.' OR ([t].[Note] IS NULL) THEN CASE + WHEN [t].[Note] <> N'K.I.A.' OR [t].[Note] IS NULL THEN CASE WHEN [t].[GearNickName] IS NOT NULL THEN [g].[SquadId] ELSE NULL END @@ -1123,7 +1123,7 @@ WHEN NOT EXISTS ( SELECT 1 FROM [Tags] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [t] LEFT JOIN [Gears] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [g] ON [t].[GearNickName] = [g].[Nickname] AND [t].[GearSquadId] = [g].[SquadId] - WHERE ([t].[Note] <> N'K.I.A.' OR ([t].[Note] IS NULL)) AND [g].[HasSoulPatch] = CAST(0 AS bit)) THEN CAST(1 AS bit) + WHERE ([t].[Note] <> N'K.I.A.' OR [t].[Note] IS NULL) AND [g].[HasSoulPatch] = CAST(0 AS bit)) THEN CAST(1 AS bit) ELSE CAST(0 AS bit) END """); @@ -1187,7 +1187,7 @@ LEFT JOIN ( LEFT JOIN ( SELECT [w].[Id], [w].[AmmunitionType], [w].[IsAutomatic], [w].[Name], [w].[OwnerFullName], [w].[PeriodEnd], [w].[PeriodStart], [w].[SynergyWithId] FROM [Weapons] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [w] - WHERE [w].[Name] <> N'Bar' OR ([w].[Name] IS NULL) + WHERE [w].[Name] <> N'Bar' OR [w].[Name] IS NULL ) AS [t] ON [g0].[FullName] = [t].[OwnerFullName] WHERE [g0].[FullName] <> N'Foo' ) AS [t0] ON [g].[Nickname] = [t0].[LeaderNickname] AND [g].[SquadId] = [t0].[LeaderSquadId] @@ -1295,10 +1295,10 @@ WHERE CASE WHEN ( SELECT TOP(1) [w].[Name] FROM [Weapons] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [w] - WHERE [w].[Id] = [g].[SquadId]) = @__prm2_1 AND (( + WHERE [w].[Id] = [g].[SquadId]) = @__prm2_1 AND ( SELECT TOP(1) [w].[Name] FROM [Weapons] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [w] - WHERE [w].[Id] = [g].[SquadId]) IS NOT NULL) THEN CAST(1 AS bit) + WHERE [w].[Id] = [g].[SquadId]) IS NOT NULL THEN CAST(1 AS bit) ELSE CAST(0 AS bit) END ELSE CAST(0 AS bit) @@ -1320,7 +1320,7 @@ SELECT [l].[Name] FROM [LocustLeaders] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l] WHERE [l].[Discriminator] = N'LocustCommander' ) AS [t] ON [f].[CommanderName] = [t].[Name] -WHERE ([c].[Name] <> N'Foo' OR ([c].[Name] IS NULL)) AND ([t].[Name] <> N'Bar' OR ([t].[Name] IS NULL)) +WHERE ([c].[Name] <> N'Foo' OR [c].[Name] IS NULL) AND ([t].[Name] <> N'Bar' OR [t].[Name] IS NULL) """); } @@ -1385,7 +1385,7 @@ public override async Task Negate_on_like_expression(bool async) """ SELECT [s].[Id], [s].[Banner], [s].[Banner5], [s].[InternalNumber], [s].[Name], [s].[PeriodEnd], [s].[PeriodStart] FROM [Squads] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [s] -WHERE ([s].[Name] IS NOT NULL) AND NOT ([s].[Name] LIKE N'us%') +WHERE [s].[Name] IS NOT NULL AND NOT ([s].[Name] LIKE N'us%') """); } @@ -1398,7 +1398,7 @@ public override async Task Select_subquery_distinct_singleordefault_boolean2(boo SELECT COALESCE(( SELECT DISTINCT TOP(1) [w].[IsAutomatic] FROM [Weapons] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' 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] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [g] WHERE [g].[HasSoulPatch] = CAST(1 AS bit) """); @@ -1424,7 +1424,7 @@ public override async Task Project_navigation_defined_on_derived_from_entity_wit AssertSql( """ SELECT [l].[Name], [l].[Discriminator], [l].[LocustHordeId], [l].[PeriodEnd], [l].[PeriodStart], [l].[ThreatLevel], [l].[ThreatLevelByte], [l].[ThreatLevelNullableByte], [l].[DefeatedByNickname], [l].[DefeatedBySquadId], [l].[HighCommandId], [g].[Nickname], [g].[SquadId], [g].[AssignedCityName], [g].[CityOfBirthName], [g].[Discriminator], [g].[FullName], [g].[HasSoulPatch], [g].[LeaderNickname], [g].[LeaderSquadId], [g].[PeriodEnd], [g].[PeriodStart], [g].[Rank], CASE - WHEN ([g].[Nickname] IS NULL) OR ([g].[SquadId] IS NULL) THEN CAST(1 AS bit) + WHEN [g].[Nickname] IS NULL OR [g].[SquadId] IS NULL THEN CAST(1 AS bit) ELSE CAST(0 AS bit) END AS [IsNull], [f].[Id], [f].[CapitalName], [f].[Discriminator], [f].[Name], [f].[PeriodEnd], [f].[PeriodStart], [f].[ServerAddress], [f].[CommanderName], [f].[Eradicated], CASE WHEN [f].[Id] IS NULL THEN CAST(1 AS bit) @@ -1451,10 +1451,10 @@ public override async Task Null_propagation_optimization6(bool async) WHERE CASE WHEN [g].[LeaderNickname] IS NOT NULL THEN CAST(LEN([g].[LeaderNickname]) AS int) ELSE NULL -END = 5 AND (CASE +END = 5 AND CASE WHEN [g].[LeaderNickname] IS NOT NULL THEN CAST(LEN([g].[LeaderNickname]) AS int) ELSE NULL -END IS NOT NULL) +END IS NOT NULL """); } @@ -1529,7 +1529,7 @@ OUTER APPLY ( LEFT JOIN ( SELECT [w].[Name], [g].[Nickname], [w].[Id], [w].[OwnerFullName] FROM [Weapons] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [w] - WHERE [w].[Name] <> N'Bar' OR ([w].[Name] IS NULL) + WHERE [w].[Name] <> N'Bar' OR [w].[Name] IS NULL ) AS [t] ON [g0].[FullName] = [t].[OwnerFullName] WHERE [g].[Nickname] = [g0].[LeaderNickname] AND [g].[SquadId] = [g0].[LeaderSquadId] AND [g0].[FullName] <> N'Foo' ) AS [t0] @@ -1659,7 +1659,7 @@ public override async Task Optional_navigation_type_compensation_works_with_nega SELECT [t].[Id], [t].[GearNickName], [t].[GearSquadId], [t].[IssueDate], [t].[Note], [t].[PeriodEnd], [t].[PeriodStart] FROM [Tags] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [t] LEFT JOIN [Gears] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [g] ON [t].[GearNickName] = [g].[Nickname] AND [t].[GearSquadId] = [g].[SquadId] -WHERE ([t].[Note] <> N'K.I.A.' OR ([t].[Note] IS NULL)) AND [g].[HasSoulPatch] = CAST(0 AS bit) +WHERE ([t].[Note] <> N'K.I.A.' OR [t].[Note] IS NULL) AND [g].[HasSoulPatch] = CAST(0 AS bit) """); } @@ -1687,7 +1687,7 @@ public override async Task Contains_on_nullable_array_produces_correct_sql(bool SELECT [g].[Nickname], [g].[SquadId], [g].[AssignedCityName], [g].[CityOfBirthName], [g].[Discriminator], [g].[FullName], [g].[HasSoulPatch], [g].[LeaderNickname], [g].[LeaderSquadId], [g].[PeriodEnd], [g].[PeriodStart], [g].[Rank] FROM [Gears] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [g] LEFT JOIN [Cities] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [c] ON [g].[AssignedCityName] = [c].[Name] -WHERE [g].[SquadId] < 2 AND ([c].[Name] = N'Ephyra' OR ([c].[Name] IS NULL)) +WHERE [g].[SquadId] < 2 AND ([c].[Name] = N'Ephyra' OR [c].[Name] IS NULL) """); } @@ -1733,7 +1733,7 @@ public override async Task Navigation_based_on_complex_expression6(bool async) AssertSql( """ SELECT CASE - WHEN [t0].[Name] = N'Queen Myrrah' AND ([t0].[Name] IS NOT NULL) THEN CAST(1 AS bit) + WHEN [t0].[Name] = N'Queen Myrrah' AND [t0].[Name] IS NOT NULL THEN CAST(1 AS bit) ELSE CAST(0 AS bit) END, [t0].[Name], [t0].[Discriminator], [t0].[LocustHordeId], [t0].[PeriodEnd], [t0].[PeriodStart], [t0].[ThreatLevel], [t0].[ThreatLevelByte], [t0].[ThreatLevelNullableByte], [t0].[DefeatedByNickname], [t0].[DefeatedBySquadId], [t0].[HighCommandId], [t].[Name], [t].[Discriminator], [t].[LocustHordeId], [t].[PeriodEnd], [t].[PeriodStart], [t].[ThreatLevel], [t].[ThreatLevelByte], [t].[ThreatLevelNullableByte], [t].[DefeatedByNickname], [t].[DefeatedBySquadId], [t].[HighCommandId] FROM [Factions] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [f] @@ -1891,7 +1891,7 @@ CROSS APPLY ( WHERE EXISTS ( SELECT 1 FROM [LocustLeaders] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l0] - WHERE [l0].[ThreatLevelNullableByte] = [l].[ThreatLevelNullableByte] OR (([l0].[ThreatLevelNullableByte] IS NULL) AND ([l].[ThreatLevelNullableByte] IS NULL))) + WHERE [l0].[ThreatLevelNullableByte] = [l].[ThreatLevelNullableByte] OR ([l0].[ThreatLevelNullableByte] IS NULL AND [l].[ThreatLevelNullableByte] IS NULL)) ) AS [t] """); } @@ -1923,7 +1923,7 @@ public override async Task Correlated_collections_basic_projection_explicit_to_l LEFT JOIN ( SELECT [w].[Id], [w].[AmmunitionType], [w].[IsAutomatic], [w].[Name], [w].[OwnerFullName], [w].[PeriodEnd], [w].[PeriodStart], [w].[SynergyWithId] FROM [Weapons] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [w] - WHERE [w].[IsAutomatic] = CAST(1 AS bit) OR [w].[Name] <> N'foo' OR ([w].[Name] IS NULL) + WHERE [w].[IsAutomatic] = CAST(1 AS bit) OR [w].[Name] <> N'foo' OR [w].[Name] IS NULL ) AS [t] ON [g].[FullName] = [t].[OwnerFullName] WHERE [g].[Nickname] <> N'Marcus' ORDER BY [g].[Nickname], [g].[SquadId] @@ -1937,11 +1937,11 @@ public override async Task Select_ternary_operation_with_has_value_not_null(bool AssertSql( """ SELECT [w].[Id], CASE - WHEN ([w].[AmmunitionType] IS NOT NULL) AND [w].[AmmunitionType] = 1 THEN N'Yes' + WHEN [w].[AmmunitionType] IS NOT NULL AND [w].[AmmunitionType] = 1 THEN N'Yes' ELSE N'No' END AS [IsCartridge] FROM [Weapons] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [w] -WHERE ([w].[AmmunitionType] IS NOT NULL) AND [w].[AmmunitionType] = 1 +WHERE [w].[AmmunitionType] IS NOT NULL AND [w].[AmmunitionType] = 1 """); } @@ -1970,7 +1970,7 @@ public override async Task String_compare_with_null_conditional_argument2(bool a FROM [Weapons] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [w] LEFT JOIN [Weapons] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [w0] ON [w].[SynergyWithId] = [w0].[Id] ORDER BY CASE - WHEN N'Marcus'' Lancer' = [w0].[Name] AND ([w0].[Name] IS NOT NULL) THEN CAST(1 AS bit) + WHEN N'Marcus'' Lancer' = [w0].[Name] AND [w0].[Name] IS NOT NULL THEN CAST(1 AS bit) ELSE CAST(0 AS bit) END """); @@ -2104,7 +2104,7 @@ public override async Task Optional_navigation_type_compensation_works_with_bina SELECT [t].[Id], [t].[GearNickName], [t].[GearSquadId], [t].[IssueDate], [t].[Note], [t].[PeriodEnd], [t].[PeriodStart] FROM [Tags] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [t] LEFT JOIN [Gears] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [g] ON [t].[GearNickName] = [g].[Nickname] AND [t].[GearSquadId] = [g].[SquadId] -WHERE [g].[HasSoulPatch] = CAST(1 AS bit) OR ([t].[Note] LIKE N'%Cole%') +WHERE [g].[HasSoulPatch] = CAST(1 AS bit) OR [t].[Note] LIKE N'%Cole%' """); } @@ -2119,7 +2119,7 @@ public override async Task SelectMany_predicate_with_non_equality_comparison_wit CROSS APPLY ( SELECT TOP(3) [w].[Id], [w].[AmmunitionType], [w].[IsAutomatic], [w].[Name], [w].[OwnerFullName], [w].[PeriodEnd], [w].[PeriodStart], [w].[SynergyWithId] FROM [Weapons] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [w] - WHERE [w].[OwnerFullName] <> [g].[FullName] OR ([w].[OwnerFullName] IS NULL) + WHERE [w].[OwnerFullName] <> [g].[FullName] OR [w].[OwnerFullName] IS NULL ORDER BY [w].[Id] ) AS [t] ORDER BY [g].[Nickname], [t].[Id] @@ -2138,7 +2138,7 @@ public override async Task Include_with_complex_order_by(bool async) ORDER BY ( SELECT TOP(1) [w].[Name] FROM [Weapons] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' 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] """); } @@ -2165,7 +2165,7 @@ public override async Task Optional_navigation_type_compensation_works_with_proj SELECT [g].[SquadId] FROM [Tags] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [t] LEFT JOIN [Gears] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [g] ON [t].[GearNickName] = [g].[Nickname] AND [t].[GearSquadId] = [g].[SquadId] -WHERE [t].[Note] <> N'K.I.A.' OR ([t].[Note] IS NULL) +WHERE [t].[Note] <> N'K.I.A.' OR [t].[Note] IS NULL """); } @@ -2182,7 +2182,7 @@ LEFT JOIN ( SELECT [w0].[Id], [w0].[AmmunitionType], [w0].[IsAutomatic], [w0].[Name], [w0].[OwnerFullName], [w0].[PeriodEnd], [w0].[PeriodStart], [w0].[SynergyWithId] FROM [Weapons] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [w] LEFT JOIN [Weapons] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [w0] ON [w].[SynergyWithId] = [w0].[Id] -) AS [t] ON [g].[FullName] <> [t].[OwnerFullName] OR ([t].[OwnerFullName] IS NULL) +) AS [t] ON [g].[FullName] <> [t].[OwnerFullName] OR [t].[OwnerFullName] IS NULL ORDER BY [g].[Nickname], [t].[Id] """); } @@ -2196,7 +2196,7 @@ public override async Task Project_collection_navigation_nested_composite_key(bo SELECT [t].[Id], [g].[Nickname], [g].[SquadId], [g0].[Nickname], [g0].[SquadId], [g0].[AssignedCityName], [g0].[CityOfBirthName], [g0].[Discriminator], [g0].[FullName], [g0].[HasSoulPatch], [g0].[LeaderNickname], [g0].[LeaderSquadId], [g0].[PeriodEnd], [g0].[PeriodStart], [g0].[Rank] FROM [Tags] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [t] LEFT JOIN [Gears] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [g] ON [t].[GearNickName] = [g].[Nickname] AND [t].[GearSquadId] = [g].[SquadId] -LEFT JOIN [Gears] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [g0] ON ([g].[Nickname] = [g0].[LeaderNickname] OR (([g].[Nickname] IS NULL) AND ([g0].[LeaderNickname] IS NULL))) AND [g].[SquadId] = [g0].[LeaderSquadId] +LEFT JOIN [Gears] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [g0] ON ([g].[Nickname] = [g0].[LeaderNickname] OR ([g].[Nickname] IS NULL AND [g0].[LeaderNickname] IS NULL)) AND [g].[SquadId] = [g0].[LeaderSquadId] WHERE [g].[Discriminator] = N'Officer' ORDER BY [t].[Id], [g].[Nickname], [g].[SquadId], [g0].[Nickname] """); @@ -2320,7 +2320,7 @@ public override async Task Select_Where_Navigation_Scalar_Equals_Navigation_Scal CROSS JOIN [Tags] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [t0] LEFT JOIN [Gears] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [g] ON [t].[GearNickName] = [g].[Nickname] AND [t].[GearSquadId] = [g].[SquadId] LEFT JOIN [Gears] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [g0] ON [t0].[GearNickName] = [g0].[Nickname] AND [t0].[GearSquadId] = [g0].[SquadId] -WHERE [g].[Nickname] = [g0].[Nickname] OR (([g].[Nickname] IS NULL) AND ([g0].[Nickname] IS NULL)) +WHERE [g].[Nickname] = [g0].[Nickname] OR ([g].[Nickname] IS NULL AND [g0].[Nickname] IS NULL) """); } @@ -2331,7 +2331,7 @@ public override async Task Left_join_projection_using_conditional_tracking(bool AssertSql( """ SELECT CASE - WHEN ([g0].[Nickname] IS NULL) OR ([g0].[SquadId] IS NULL) THEN CAST(1 AS bit) + WHEN [g0].[Nickname] IS NULL OR [g0].[SquadId] IS NULL THEN CAST(1 AS bit) ELSE CAST(0 AS bit) END, [g].[Nickname], [g].[SquadId], [g].[AssignedCityName], [g].[CityOfBirthName], [g].[Discriminator], [g].[FullName], [g].[HasSoulPatch], [g].[LeaderNickname], [g].[LeaderSquadId], [g].[PeriodEnd], [g].[PeriodStart], [g].[Rank], [g0].[Nickname], [g0].[SquadId], [g0].[AssignedCityName], [g0].[CityOfBirthName], [g0].[Discriminator], [g0].[FullName], [g0].[HasSoulPatch], [g0].[LeaderNickname], [g0].[LeaderSquadId], [g0].[PeriodEnd], [g0].[PeriodStart], [g0].[Rank] FROM [Gears] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [g] @@ -2390,7 +2390,7 @@ public override async Task Correlated_collections_basic_projecting_single_proper LEFT JOIN ( SELECT [w].[Name], [w].[Id], [w].[OwnerFullName] FROM [Weapons] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [w] - WHERE [w].[IsAutomatic] = CAST(1 AS bit) OR [w].[Name] <> N'foo' OR ([w].[Name] IS NULL) + WHERE [w].[IsAutomatic] = CAST(1 AS bit) OR [w].[Name] <> N'foo' OR [w].[Name] IS NULL ) AS [t] ON [g].[FullName] = [t].[OwnerFullName] WHERE [g].[Nickname] <> N'Marcus' ORDER BY [g].[Nickname], [g].[SquadId] @@ -2429,10 +2429,10 @@ ELSE NULL 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) +END IS NULL """); } @@ -2472,7 +2472,7 @@ public override async Task Where_with_enum_flags_parameter(bool async) SELECT [g].[Nickname], [g].[SquadId], [g].[AssignedCityName], [g].[CityOfBirthName], [g].[Discriminator], [g].[FullName], [g].[HasSoulPatch], [g].[LeaderNickname], [g].[LeaderSquadId], [g].[PeriodEnd], [g].[PeriodStart], [g].[Rank] FROM [Gears] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [g] -WHERE ([g].[Rank] & @__rank_0) = @__rank_0 +WHERE [g].[Rank] & @__rank_0 = @__rank_0 """, // """ @@ -2485,7 +2485,7 @@ public override async Task Where_with_enum_flags_parameter(bool async) SELECT [g].[Nickname], [g].[SquadId], [g].[AssignedCityName], [g].[CityOfBirthName], [g].[Discriminator], [g].[FullName], [g].[HasSoulPatch], [g].[LeaderNickname], [g].[LeaderSquadId], [g].[PeriodEnd], [g].[PeriodStart], [g].[Rank] FROM [Gears] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [g] -WHERE ([g].[Rank] | @__rank_0) <> @__rank_0 +WHERE [g].[Rank] | @__rank_0 <> @__rank_0 """, // """ @@ -2538,10 +2538,10 @@ ELSE CAST(0 AS bit) END, [g].[Nickname], [g].[SquadId], [g].[HasSoulPatch] FROM [Tags] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [t] LEFT JOIN [Gears] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [g] ON [t].[GearNickName] = [g].[Nickname] AND [t].[GearSquadId] = [g].[SquadId] -WHERE (CASE +WHERE CASE WHEN [t].[GearNickName] IS NOT NULL THEN [g].[SquadId] ELSE NULL -END + 1) = 2 +END + 1 = 2 """); } @@ -2673,7 +2673,7 @@ public override async Task Distinct_with_optional_navigation_is_translated_to_sq SELECT DISTINCT [g].[HasSoulPatch] FROM [Gears] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [g] LEFT JOIN [Tags] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [t] ON [g].[Nickname] = [t].[GearNickName] AND [g].[SquadId] = [t].[GearSquadId] -WHERE [t].[Note] <> N'Foo' OR ([t].[Note] IS NULL) +WHERE [t].[Note] <> N'Foo' OR [t].[Note] IS NULL """); } @@ -2696,7 +2696,7 @@ public override async Task Include_on_GroupJoin_SelectMany_DefaultIfEmpty_with_c AssertSql( """ SELECT [g].[Nickname], [g].[SquadId], [g].[AssignedCityName], [g].[CityOfBirthName], [g].[Discriminator], [g].[FullName], [g].[HasSoulPatch], [g].[LeaderNickname], [g].[LeaderSquadId], [g].[PeriodEnd], [g].[PeriodStart], [g].[Rank], [g0].[Nickname], [g0].[SquadId], [w].[Id], [w].[AmmunitionType], [w].[IsAutomatic], [w].[Name], [w].[OwnerFullName], [w].[PeriodEnd], [w].[PeriodStart], [w].[SynergyWithId], [g0].[AssignedCityName], [g0].[CityOfBirthName], [g0].[Discriminator], [g0].[FullName], [g0].[HasSoulPatch], [g0].[LeaderNickname], [g0].[LeaderSquadId], [g0].[PeriodEnd], [g0].[PeriodStart], [g0].[Rank], [w0].[Id], [w0].[AmmunitionType], [w0].[IsAutomatic], [w0].[Name], [w0].[OwnerFullName], [w0].[PeriodEnd], [w0].[PeriodStart], [w0].[SynergyWithId], [w1].[Id], [w1].[AmmunitionType], [w1].[IsAutomatic], [w1].[Name], [w1].[OwnerFullName], [w1].[PeriodEnd], [w1].[PeriodStart], [w1].[SynergyWithId], [w2].[Id], [w2].[AmmunitionType], [w2].[IsAutomatic], [w2].[Name], [w2].[OwnerFullName], [w2].[PeriodEnd], [w2].[PeriodStart], [w2].[SynergyWithId], CASE - WHEN ([g0].[Nickname] IS NOT NULL) AND ([g0].[SquadId] IS NOT NULL) THEN CAST(1 AS bit) + WHEN [g0].[Nickname] IS NOT NULL AND [g0].[SquadId] IS NOT NULL THEN CAST(1 AS bit) ELSE CAST(0 AS bit) END, [w3].[Id], [w3].[AmmunitionType], [w3].[IsAutomatic], [w3].[Name], [w3].[OwnerFullName], [w3].[PeriodEnd], [w3].[PeriodStart], [w3].[SynergyWithId], [w4].[Id], [w4].[AmmunitionType], [w4].[IsAutomatic], [w4].[Name], [w4].[OwnerFullName], [w4].[PeriodEnd], [w4].[PeriodStart], [w4].[SynergyWithId] FROM [Gears] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [g] @@ -2757,7 +2757,7 @@ public override async Task Where_enum_has_flag_with_non_nullable_parameter(bool SELECT [g].[Nickname], [g].[SquadId], [g].[AssignedCityName], [g].[CityOfBirthName], [g].[Discriminator], [g].[FullName], [g].[HasSoulPatch], [g].[LeaderNickname], [g].[LeaderSquadId], [g].[PeriodEnd], [g].[PeriodStart], [g].[Rank] FROM [Gears] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [g] -WHERE ([g].[Rank] & @__parameter_0) = @__parameter_0 +WHERE [g].[Rank] & @__parameter_0 = @__parameter_0 """); } @@ -2844,7 +2844,7 @@ public override async Task Select_Singleton_Navigation_With_Member_Access(bool a SELECT [g].[Nickname], [g].[SquadId], [g].[AssignedCityName], [g].[CityOfBirthName], [g].[Discriminator], [g].[FullName], [g].[HasSoulPatch], [g].[LeaderNickname], [g].[LeaderSquadId], [g].[PeriodEnd], [g].[PeriodStart], [g].[Rank] FROM [Tags] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [t] LEFT JOIN [Gears] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [g] ON [t].[GearNickName] = [g].[Nickname] AND [t].[GearSquadId] = [g].[SquadId] -WHERE [g].[Nickname] = N'Marcus' AND ([g].[CityOfBirthName] <> N'Ephyra' OR ([g].[CityOfBirthName] IS NULL)) +WHERE [g].[Nickname] = N'Marcus' AND ([g].[CityOfBirthName] <> N'Ephyra' OR [g].[CityOfBirthName] IS NULL) """); } @@ -3005,7 +3005,7 @@ public override async Task Correlated_collections_basic_projecting_constant(bool LEFT JOIN ( SELECT N'BFG' AS [c], [w].[Id], [w].[OwnerFullName] FROM [Weapons] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [w] - WHERE [w].[IsAutomatic] = CAST(1 AS bit) OR [w].[Name] <> N'foo' OR ([w].[Name] IS NULL) + WHERE [w].[IsAutomatic] = CAST(1 AS bit) OR [w].[Name] <> N'foo' OR [w].[Name] IS NULL ) AS [t] ON [g].[FullName] = [t].[OwnerFullName] WHERE [g].[Nickname] <> N'Marcus' ORDER BY [g].[Nickname], [g].[SquadId] @@ -3116,7 +3116,7 @@ WHERE [w].[AmmunitionType] IS NULL SELECT [w].[Id], [w].[AmmunitionType], [w].[IsAutomatic], [w].[Name], [w].[OwnerFullName], [w].[PeriodEnd], [w].[PeriodStart], [w].[SynergyWithId] FROM [Weapons] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [w] -WHERE ([w].[AmmunitionType] & @__prm_0) <> 0 OR ([w].[AmmunitionType] IS NULL) +WHERE [w].[AmmunitionType] & @__prm_0 <> 0 OR [w].[AmmunitionType] IS NULL """, // """ @@ -3124,7 +3124,7 @@ WHERE [w].[AmmunitionType] IS NULL SELECT [w].[Id], [w].[AmmunitionType], [w].[IsAutomatic], [w].[Name], [w].[OwnerFullName], [w].[PeriodEnd], [w].[PeriodStart], [w].[SynergyWithId] FROM [Weapons] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [w] -WHERE ([w].[AmmunitionType] & @__prm_0) = @__prm_0 +WHERE [w].[AmmunitionType] & @__prm_0 = @__prm_0 """); } @@ -3234,7 +3234,7 @@ public override async Task Select_multiple_conditions(bool async) AssertSql( """ SELECT [w].[Id], CASE - WHEN [w].[IsAutomatic] = CAST(0 AS bit) AND [w].[SynergyWithId] = 1 AND ([w].[SynergyWithId] IS NOT NULL) THEN CAST(1 AS bit) + WHEN [w].[IsAutomatic] = CAST(0 AS bit) AND [w].[SynergyWithId] = 1 AND [w].[SynergyWithId] IS NOT NULL THEN CAST(1 AS bit) ELSE CAST(0 AS bit) END AS [IsCartridge] FROM [Weapons] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [w] @@ -3306,7 +3306,7 @@ LEFT JOIN ( LEFT JOIN [Squads] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [s] ON [g3].[SquadId] = [s].[Id] LEFT JOIN [Weapons] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [w0] ON [g3].[FullName] = [w0].[OwnerFullName] LEFT JOIN [Gears] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [g4] ON [s].[Id] = [g4].[SquadId] - WHERE [w].[Name] <> N'Bar' OR ([w].[Name] IS NULL) + WHERE [w].[Name] <> N'Bar' OR [w].[Name] IS NULL ) AS [t1] ON [g2].[FullName] = [t1].[OwnerFullName] WHERE [g2].[FullName] <> N'Foo' ) AS [t0] ON [g].[Nickname] = [t0].[LeaderNickname] AND [g].[SquadId] = [t0].[LeaderSquadId] @@ -3370,7 +3370,7 @@ public override async Task Select_comparison_with_null(bool async) @__ammunitionType_0='1' (Nullable = true) SELECT [w].[Id], CASE - WHEN [w].[AmmunitionType] = @__ammunitionType_0 AND ([w].[AmmunitionType] IS NOT NULL) THEN CAST(1 AS bit) + WHEN [w].[AmmunitionType] = @__ammunitionType_0 AND [w].[AmmunitionType] IS NOT NULL THEN CAST(1 AS bit) ELSE CAST(0 AS bit) END AS [Cartridge] FROM [Weapons] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [w] @@ -3410,7 +3410,7 @@ public override async Task OfTypeNav2(bool async) FROM [Gears] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [g] LEFT JOIN [Tags] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [t] ON [g].[Nickname] = [t].[GearNickName] AND [g].[SquadId] = [t].[GearSquadId] LEFT JOIN [Cities] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [c] ON [g].[AssignedCityName] = [c].[Name] -WHERE ([t].[Note] <> N'Foo' OR ([t].[Note] IS NULL)) AND [g].[Discriminator] = N'Officer' AND ([c].[Location] <> 'Bar' OR ([c].[Location] IS NULL)) +WHERE ([t].[Note] <> N'Foo' OR [t].[Note] IS NULL) AND [g].[Discriminator] = N'Officer' AND ([c].[Location] <> 'Bar' OR [c].[Location] IS NULL) """); } @@ -3452,7 +3452,7 @@ public override async Task Optional_navigation_type_compensation_works_with_list SELECT [g].[SquadId], [g].[SquadId] + 1 FROM [Tags] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [t] LEFT JOIN [Gears] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [g] ON [t].[GearNickName] = [g].[Nickname] AND [t].[GearSquadId] = [g].[SquadId] -WHERE [t].[Note] <> N'K.I.A.' OR ([t].[Note] IS NULL) +WHERE [t].[Note] <> N'K.I.A.' OR [t].[Note] IS NULL ORDER BY [t].[Note] """); } @@ -3507,7 +3507,7 @@ public override async Task Correlated_collections_on_select_many(bool async) LEFT JOIN ( SELECT [w].[Id], [w].[AmmunitionType], [w].[IsAutomatic], [w].[Name], [w].[OwnerFullName], [w].[PeriodEnd], [w].[PeriodStart], [w].[SynergyWithId] FROM [Weapons] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [w] - WHERE [w].[IsAutomatic] = CAST(1 AS bit) OR [w].[Name] <> N'foo' OR ([w].[Name] IS NULL) + WHERE [w].[IsAutomatic] = CAST(1 AS bit) OR [w].[Name] <> N'foo' OR [w].[Name] IS NULL ) AS [t] ON [g].[FullName] = [t].[OwnerFullName] LEFT JOIN ( SELECT [g0].[Nickname], [g0].[SquadId], [g0].[AssignedCityName], [g0].[CityOfBirthName], [g0].[Discriminator], [g0].[FullName], [g0].[HasSoulPatch], [g0].[LeaderNickname], [g0].[LeaderSquadId], [g0].[PeriodEnd], [g0].[PeriodStart], [g0].[Rank] @@ -3529,14 +3529,14 @@ public override async Task Bitwise_operation_with_non_null_parameter_optimizes_n SELECT [g].[Nickname], [g].[SquadId], [g].[AssignedCityName], [g].[CityOfBirthName], [g].[Discriminator], [g].[FullName], [g].[HasSoulPatch], [g].[LeaderNickname], [g].[LeaderSquadId], [g].[PeriodEnd], [g].[PeriodStart], [g].[Rank] FROM [Gears] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [g] -WHERE ([g].[Rank] & @__ranks_0) <> 0 +WHERE [g].[Rank] & @__ranks_0 <> 0 """, // """ @__ranks_0='134' SELECT CASE - WHEN ([g].[Rank] | @__ranks_0) = @__ranks_0 THEN CAST(1 AS bit) + WHEN [g].[Rank] | @__ranks_0 = @__ranks_0 THEN CAST(1 AS bit) ELSE CAST(0 AS bit) END FROM [Gears] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [g] @@ -3546,7 +3546,7 @@ ELSE CAST(0 AS bit) @__ranks_0='134' SELECT CASE - WHEN ([g].[Rank] | ([g].[Rank] | (@__ranks_0 | ([g].[Rank] | @__ranks_0)))) = @__ranks_0 THEN CAST(1 AS bit) + WHEN [g].[Rank] | [g].[Rank] | @__ranks_0 | [g].[Rank] | @__ranks_0 = @__ranks_0 THEN CAST(1 AS bit) ELSE CAST(0 AS bit) END FROM [Gears] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [g] @@ -3694,7 +3694,7 @@ LEFT JOIN ( FROM [Gears] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [g0] ) AS [t1] WHERE [t1].[row] <= 50 -) AS [t0] ON ([g].[Nickname] = [t0].[LeaderNickname] OR (([g].[Nickname] IS NULL) AND ([t0].[LeaderNickname] IS NULL))) AND [g].[SquadId] = [t0].[LeaderSquadId] +) AS [t0] ON ([g].[Nickname] = [t0].[LeaderNickname] OR ([g].[Nickname] IS NULL AND [t0].[LeaderNickname] IS NULL)) AND [g].[SquadId] = [t0].[LeaderSquadId] WHERE [g].[Discriminator] = N'Officer' ORDER BY [t].[Id], [g].[Nickname], [g].[SquadId], [t0].[Nickname] """); @@ -3814,7 +3814,7 @@ public override async Task Optional_navigation_type_compensation_works_with_orde SELECT [t].[Id], [t].[GearNickName], [t].[GearSquadId], [t].[IssueDate], [t].[Note], [t].[PeriodEnd], [t].[PeriodStart] FROM [Tags] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [t] LEFT JOIN [Gears] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [g] ON [t].[GearNickName] = [g].[Nickname] AND [t].[GearSquadId] = [g].[SquadId] -WHERE [t].[Note] <> N'K.I.A.' OR ([t].[Note] IS NULL) +WHERE [t].[Note] <> N'K.I.A.' OR [t].[Note] IS NULL ORDER BY [g].[SquadId] """); } @@ -3842,7 +3842,7 @@ public override async Task Correlated_collections_basic_projecting_constant_bool LEFT JOIN ( SELECT CAST(1 AS bit) AS [c], [w].[Id], [w].[OwnerFullName] FROM [Weapons] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [w] - WHERE [w].[IsAutomatic] = CAST(1 AS bit) OR [w].[Name] <> N'foo' OR ([w].[Name] IS NULL) + WHERE [w].[IsAutomatic] = CAST(1 AS bit) OR [w].[Name] <> N'foo' OR [w].[Name] IS NULL ) AS [t] ON [g].[FullName] = [t].[OwnerFullName] WHERE [g].[Nickname] <> N'Marcus' ORDER BY [g].[Nickname], [g].[SquadId] @@ -3888,10 +3888,10 @@ public override async Task Null_propagation_optimization5(bool async) WHERE CASE WHEN [g].[LeaderNickname] IS NOT NULL THEN CAST(LEN([g].[LeaderNickname]) AS int) ELSE NULL -END = 5 AND (CASE +END = 5 AND CASE WHEN [g].[LeaderNickname] IS NOT NULL THEN CAST(LEN([g].[LeaderNickname]) AS int) ELSE NULL -END IS NOT NULL) +END IS NOT NULL """); } @@ -3935,7 +3935,7 @@ public override async Task FROM [Tags] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [t] LEFT JOIN [Gears] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [g] ON [t].[GearNickName] = [g].[Nickname] AND [t].[GearSquadId] = [g].[SquadId] LEFT JOIN [Squads] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [s] ON [g].[SquadId] = [s].[Id] -WHERE SUBSTRING([t].[Note], 0 + 1, CAST(LEN([s].[Name]) AS int)) = [t].[GearNickName] OR ((([t].[Note] IS NULL) OR ([s].[Name] IS NULL)) AND ([t].[GearNickName] IS NULL)) +WHERE SUBSTRING([t].[Note], 0 + 1, CAST(LEN([s].[Name]) AS int)) = [t].[GearNickName] OR (([t].[Note] IS NULL OR [s].[Name] IS NULL) AND [t].[GearNickName] IS NULL) """); } @@ -3999,7 +3999,7 @@ SELECT [l].[Name] FROM [LocustLeaders] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l] WHERE [l].[Discriminator] = N'LocustCommander' ) AS [t] ON [f].[CommanderName] = [t].[Name] -WHERE ([c].[Name] <> N'Foo' OR ([c].[Name] IS NULL)) AND ([t].[Name] <> N'Bar' OR ([t].[Name] IS NULL)) +WHERE ([c].[Name] <> N'Foo' OR [c].[Name] IS NULL) AND ([t].[Name] <> N'Bar' OR [t].[Name] IS NULL) """); } @@ -4052,7 +4052,7 @@ public override async Task Contains_on_collection_of_nullable_byte_subquery(bool WHERE EXISTS ( SELECT 1 FROM [LocustLeaders] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l0] - WHERE [l0].[ThreatLevelNullableByte] = [l].[ThreatLevelNullableByte] OR (([l0].[ThreatLevelNullableByte] IS NULL) AND ([l].[ThreatLevelNullableByte] IS NULL))) + WHERE [l0].[ThreatLevelNullableByte] = [l].[ThreatLevelNullableByte] OR ([l0].[ThreatLevelNullableByte] IS NULL AND [l].[ThreatLevelNullableByte] IS NULL)) """); } @@ -4093,7 +4093,7 @@ public override async Task String_compare_with_null_conditional_argument(bool as FROM [Weapons] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [w] LEFT JOIN [Weapons] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [w0] ON [w].[SynergyWithId] = [w0].[Id] ORDER BY CASE - WHEN [w0].[Name] = N'Marcus'' Lancer' AND ([w0].[Name] IS NOT NULL) THEN CAST(1 AS bit) + WHEN [w0].[Name] = N'Marcus'' Lancer' AND [w0].[Name] IS NOT NULL THEN CAST(1 AS bit) ELSE CAST(0 AS bit) END """); @@ -4110,7 +4110,7 @@ public override async Task Correlated_collections_basic_projection_explicit_to_a LEFT JOIN ( SELECT [w].[Id], [w].[AmmunitionType], [w].[IsAutomatic], [w].[Name], [w].[OwnerFullName], [w].[PeriodEnd], [w].[PeriodStart], [w].[SynergyWithId] FROM [Weapons] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [w] - WHERE [w].[IsAutomatic] = CAST(1 AS bit) OR [w].[Name] <> N'foo' OR ([w].[Name] IS NULL) + WHERE [w].[IsAutomatic] = CAST(1 AS bit) OR [w].[Name] <> N'foo' OR [w].[Name] IS NULL ) AS [t] ON [g].[FullName] = [t].[OwnerFullName] WHERE [g].[Nickname] <> N'Marcus' ORDER BY [g].[Nickname], [g].[SquadId] @@ -4186,7 +4186,7 @@ public override async Task Double_order_by_on_string_compare(bool async) SELECT [w].[Id], [w].[AmmunitionType], [w].[IsAutomatic], [w].[Name], [w].[OwnerFullName], [w].[PeriodEnd], [w].[PeriodStart], [w].[SynergyWithId] FROM [Weapons] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [w] ORDER BY CASE - WHEN [w].[Name] = N'Marcus'' Lancer' AND ([w].[Name] IS NOT NULL) THEN CAST(1 AS bit) + WHEN [w].[Name] = N'Marcus'' Lancer' AND [w].[Name] IS NOT NULL THEN CAST(1 AS bit) ELSE CAST(0 AS bit) END, [w].[Id] """); @@ -4271,7 +4271,7 @@ public override async Task Include_with_nested_navigation_in_order_by(bool async FROM [Weapons] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [w] LEFT JOIN [Gears] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [g] ON [w].[OwnerFullName] = [g].[FullName] LEFT JOIN [Cities] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [c] ON [g].[CityOfBirthName] = [c].[Name] -WHERE [g].[Nickname] <> N'Paduk' OR ([g].[Nickname] IS NULL) +WHERE [g].[Nickname] <> N'Paduk' OR [g].[Nickname] IS NULL ORDER BY [c].[Name], [w].[Id] """); } @@ -4309,7 +4309,7 @@ LEFT JOIN ( SELECT [w].[Id], [w].[AmmunitionType], [w].[IsAutomatic], [w].[Name], [w].[OwnerFullName], [w].[PeriodEnd], [w].[PeriodStart], [w].[SynergyWithId], [g2].[Nickname], [g2].[SquadId], ( SELECT COUNT(*) FROM [Weapons] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [w0] - WHERE ([g2].[FullName] IS NOT NULL) AND [g2].[FullName] = [w0].[OwnerFullName]) AS [c] + WHERE [g2].[FullName] IS NOT NULL AND [g2].[FullName] = [w0].[OwnerFullName]) AS [c] FROM [Weapons] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [w] LEFT JOIN [Gears] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [g2] ON [w].[OwnerFullName] = [g2].[FullName] ) AS [t0] ON [g1].[FullName] = [t0].[OwnerFullName] @@ -4334,7 +4334,7 @@ LEFT JOIN ( SELECT [g0].[Nickname], [g0].[SquadId], [g0].[AssignedCityName], [g0].[CityOfBirthName], [g0].[Discriminator], [g0].[FullName], [g0].[HasSoulPatch], [g0].[LeaderNickname], [g0].[LeaderSquadId], [g0].[PeriodEnd], [g0].[PeriodStart], [g0].[Rank], [c].[Name], [c].[Location], [c].[Nation], [c].[PeriodEnd] AS [PeriodEnd0], [c].[PeriodStart] AS [PeriodStart0] FROM [Gears] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [g0] INNER JOIN [Cities] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [c] ON [g0].[CityOfBirthName] = [c].[Name] -) AS [t] ON ([g].[Nickname] = [t].[LeaderNickname] OR (([g].[Nickname] IS NULL) AND ([t].[LeaderNickname] IS NULL))) AND [g].[SquadId] = [t].[LeaderSquadId] +) AS [t] ON ([g].[Nickname] = [t].[LeaderNickname] OR ([g].[Nickname] IS NULL AND [t].[LeaderNickname] IS NULL)) AND [g].[SquadId] = [t].[LeaderSquadId] ORDER BY [l].[Name], [g].[Nickname], [g].[SquadId], [t].[Nickname], [t].[SquadId] """); } @@ -4404,7 +4404,7 @@ INNER JOIN ( FROM [Factions] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' 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 """); } @@ -4422,7 +4422,7 @@ CROSS APPLY ( WHERE NOT (EXISTS ( SELECT 1 FROM [LocustLeaders] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l0] - WHERE [l0].[ThreatLevelNullableByte] = [l].[ThreatLevelNullableByte] OR (([l0].[ThreatLevelNullableByte] IS NULL) AND ([l].[ThreatLevelNullableByte] IS NULL)))) + WHERE [l0].[ThreatLevelNullableByte] = [l].[ThreatLevelNullableByte] OR ([l0].[ThreatLevelNullableByte] IS NULL AND [l].[ThreatLevelNullableByte] IS NULL))) ) AS [t] """); } @@ -4438,7 +4438,7 @@ public override async Task Select_Where_Navigation_Equals_Navigation(bool async) CROSS JOIN [Tags] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [t0] LEFT JOIN [Gears] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [g] ON [t].[GearNickName] = [g].[Nickname] AND [t].[GearSquadId] = [g].[SquadId] LEFT JOIN [Gears] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [g0] ON [t0].[GearNickName] = [g0].[Nickname] AND [t0].[GearSquadId] = [g0].[SquadId] -WHERE ([g].[Nickname] = [g0].[Nickname] OR (([g].[Nickname] IS NULL) AND ([g0].[Nickname] IS NULL))) AND ([g].[SquadId] = [g0].[SquadId] OR (([g].[SquadId] IS NULL) AND ([g0].[SquadId] IS NULL))) +WHERE ([g].[Nickname] = [g0].[Nickname] OR ([g].[Nickname] IS NULL AND [g0].[Nickname] IS NULL)) AND ([g].[SquadId] = [g0].[SquadId] OR ([g].[SquadId] IS NULL AND [g0].[SquadId] IS NULL)) """); } @@ -4595,7 +4595,7 @@ public override async Task Optional_navigation_type_compensation_works_with_pred SELECT [t].[Id], [t].[GearNickName], [t].[GearSquadId], [t].[IssueDate], [t].[Note], [t].[PeriodEnd], [t].[PeriodStart] FROM [Tags] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [t] LEFT JOIN [Gears] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [g] ON [t].[GearNickName] = [g].[Nickname] AND [t].[GearSquadId] = [g].[SquadId] -WHERE ([t].[Note] <> N'K.I.A.' OR ([t].[Note] IS NULL)) AND [g].[HasSoulPatch] = CAST(1 AS bit) +WHERE ([t].[Note] <> N'K.I.A.' OR [t].[Note] IS NULL) AND [g].[HasSoulPatch] = CAST(1 AS bit) """); } @@ -4606,7 +4606,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] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [f] @@ -4623,7 +4623,7 @@ public override async Task Where_bitwise_and_nullable_enum_with_non_nullable_par SELECT [w].[Id], [w].[AmmunitionType], [w].[IsAutomatic], [w].[Name], [w].[OwnerFullName], [w].[PeriodEnd], [w].[PeriodStart], [w].[SynergyWithId] FROM [Weapons] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [w] -WHERE ([w].[AmmunitionType] & @__ammunitionType_0) > 0 +WHERE [w].[AmmunitionType] & @__ammunitionType_0 > 0 """); } @@ -4635,31 +4635,31 @@ public override async Task Where_enum_has_flag(bool async) """ SELECT [g].[Nickname], [g].[SquadId], [g].[AssignedCityName], [g].[CityOfBirthName], [g].[Discriminator], [g].[FullName], [g].[HasSoulPatch], [g].[LeaderNickname], [g].[LeaderSquadId], [g].[PeriodEnd], [g].[PeriodStart], [g].[Rank] FROM [Gears] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [g] -WHERE ([g].[Rank] & 2) = 2 +WHERE [g].[Rank] & 2 = 2 """, // """ SELECT [g].[Nickname], [g].[SquadId], [g].[AssignedCityName], [g].[CityOfBirthName], [g].[Discriminator], [g].[FullName], [g].[HasSoulPatch], [g].[LeaderNickname], [g].[LeaderSquadId], [g].[PeriodEnd], [g].[PeriodStart], [g].[Rank] FROM [Gears] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [g] -WHERE ([g].[Rank] & 18) = 18 +WHERE [g].[Rank] & 18 = 18 """, // """ SELECT [g].[Nickname], [g].[SquadId], [g].[AssignedCityName], [g].[CityOfBirthName], [g].[Discriminator], [g].[FullName], [g].[HasSoulPatch], [g].[LeaderNickname], [g].[LeaderSquadId], [g].[PeriodEnd], [g].[PeriodStart], [g].[Rank] FROM [Gears] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [g] -WHERE ([g].[Rank] & 1) = 1 +WHERE [g].[Rank] & 1 = 1 """, // """ SELECT [g].[Nickname], [g].[SquadId], [g].[AssignedCityName], [g].[CityOfBirthName], [g].[Discriminator], [g].[FullName], [g].[HasSoulPatch], [g].[LeaderNickname], [g].[LeaderSquadId], [g].[PeriodEnd], [g].[PeriodStart], [g].[Rank] FROM [Gears] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [g] -WHERE ([g].[Rank] & 1) = 1 +WHERE [g].[Rank] & 1 = 1 """, // """ SELECT [g].[Nickname], [g].[SquadId], [g].[AssignedCityName], [g].[CityOfBirthName], [g].[Discriminator], [g].[FullName], [g].[HasSoulPatch], [g].[LeaderNickname], [g].[LeaderSquadId], [g].[PeriodEnd], [g].[PeriodStart], [g].[Rank] FROM [Gears] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [g] -WHERE (2 & [g].[Rank]) = [g].[Rank] +WHERE 2 & [g].[Rank] = [g].[Rank] """); } @@ -4745,10 +4745,10 @@ public override async Task Where_enum_has_flag_subquery(bool async) """ SELECT [g].[Nickname], [g].[SquadId], [g].[AssignedCityName], [g].[CityOfBirthName], [g].[Discriminator], [g].[FullName], [g].[HasSoulPatch], [g].[LeaderNickname], [g].[LeaderSquadId], [g].[PeriodEnd], [g].[PeriodStart], [g].[Rank] FROM [Gears] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [g] -WHERE ([g].[Rank] & COALESCE(( +WHERE [g].[Rank] & COALESCE(( SELECT TOP(1) [g0].[Rank] FROM [Gears] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [g0] - ORDER BY [g0].[Nickname], [g0].[SquadId]), 0)) = COALESCE(( + ORDER BY [g0].[Nickname], [g0].[SquadId]), 0) = COALESCE(( SELECT TOP(1) [g0].[Rank] FROM [Gears] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [g0] ORDER BY [g0].[Nickname], [g0].[SquadId]), 0) @@ -4757,10 +4757,10 @@ SELECT TOP(1) [g0].[Rank] """ SELECT [g].[Nickname], [g].[SquadId], [g].[AssignedCityName], [g].[CityOfBirthName], [g].[Discriminator], [g].[FullName], [g].[HasSoulPatch], [g].[LeaderNickname], [g].[LeaderSquadId], [g].[PeriodEnd], [g].[PeriodStart], [g].[Rank] FROM [Gears] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [g] -WHERE (2 & COALESCE(( +WHERE 2 & COALESCE(( SELECT TOP(1) [g0].[Rank] FROM [Gears] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [g0] - ORDER BY [g0].[Nickname], [g0].[SquadId]), 0)) = COALESCE(( + ORDER BY [g0].[Nickname], [g0].[SquadId]), 0) = COALESCE(( SELECT TOP(1) [g0].[Rank] FROM [Gears] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [g0] ORDER BY [g0].[Nickname], [g0].[SquadId]), 0) @@ -4820,10 +4820,10 @@ public override async Task Null_propagation_optimization4(bool async) WHERE CASE WHEN [g].[LeaderNickname] IS NULL THEN NULL ELSE CAST(LEN([g].[LeaderNickname]) AS int) -END = 5 AND (CASE +END = 5 AND CASE WHEN [g].[LeaderNickname] IS NULL THEN NULL ELSE CAST(LEN([g].[LeaderNickname]) AS int) -END IS NOT NULL) +END IS NOT NULL """); } @@ -4856,7 +4856,7 @@ public override async Task Optional_navigation_with_collection_composite_key(boo WHERE [g].[Discriminator] = N'Officer' AND ( SELECT COUNT(*) FROM [Gears] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [g0] - WHERE ([g].[Nickname] IS NOT NULL) AND ([g].[SquadId] IS NOT NULL) AND [g].[Nickname] = [g0].[LeaderNickname] AND [g].[SquadId] = [g0].[LeaderSquadId] AND [g0].[Nickname] = N'Dom') > 0 + WHERE [g].[Nickname] IS NOT NULL AND [g].[SquadId] IS NOT NULL AND [g].[Nickname] = [g0].[LeaderNickname] AND [g].[SquadId] = [g0].[LeaderSquadId] AND [g0].[Nickname] = N'Dom') > 0 """); } @@ -4917,7 +4917,7 @@ public override async Task Select_Where_Navigation_Scalar_Equals_Navigation_Scal CROSS JOIN [Tags] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [t0] LEFT JOIN [Gears] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [g] ON [t].[GearNickName] = [g].[Nickname] AND [t].[GearSquadId] = [g].[SquadId] LEFT JOIN [Gears] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [g0] ON [t0].[GearNickName] = [g0].[Nickname] AND [t0].[GearSquadId] = [g0].[SquadId] -WHERE [g].[Nickname] = [g0].[Nickname] OR (([g].[Nickname] IS NULL) AND ([g0].[Nickname] IS NULL)) +WHERE [g].[Nickname] = [g0].[Nickname] OR ([g].[Nickname] IS NULL AND [g0].[Nickname] IS NULL) """); } @@ -4929,31 +4929,31 @@ public override async Task Where_enum_has_flag_subquery_with_pushdown(bool async """ SELECT [g].[Nickname], [g].[SquadId], [g].[AssignedCityName], [g].[CityOfBirthName], [g].[Discriminator], [g].[FullName], [g].[HasSoulPatch], [g].[LeaderNickname], [g].[LeaderSquadId], [g].[PeriodEnd], [g].[PeriodStart], [g].[Rank] FROM [Gears] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [g] -WHERE ([g].[Rank] & ( +WHERE [g].[Rank] & ( SELECT TOP(1) [g0].[Rank] FROM [Gears] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [g0] - ORDER BY [g0].[Nickname], [g0].[SquadId])) = ( + ORDER BY [g0].[Nickname], [g0].[SquadId]) = ( SELECT TOP(1) [g0].[Rank] FROM [Gears] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [g0] - ORDER BY [g0].[Nickname], [g0].[SquadId]) OR (( + ORDER BY [g0].[Nickname], [g0].[SquadId]) OR ( SELECT TOP(1) [g0].[Rank] FROM [Gears] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [g0] - ORDER BY [g0].[Nickname], [g0].[SquadId]) IS NULL) + ORDER BY [g0].[Nickname], [g0].[SquadId]) IS NULL """, // """ SELECT [g].[Nickname], [g].[SquadId], [g].[AssignedCityName], [g].[CityOfBirthName], [g].[Discriminator], [g].[FullName], [g].[HasSoulPatch], [g].[LeaderNickname], [g].[LeaderSquadId], [g].[PeriodEnd], [g].[PeriodStart], [g].[Rank] FROM [Gears] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [g] -WHERE (2 & ( +WHERE 2 & ( SELECT TOP(1) [g0].[Rank] FROM [Gears] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [g0] - ORDER BY [g0].[Nickname], [g0].[SquadId])) = ( + ORDER BY [g0].[Nickname], [g0].[SquadId]) = ( SELECT TOP(1) [g0].[Rank] FROM [Gears] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [g0] - ORDER BY [g0].[Nickname], [g0].[SquadId]) OR (( + ORDER BY [g0].[Nickname], [g0].[SquadId]) OR ( SELECT TOP(1) [g0].[Rank] FROM [Gears] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [g0] - ORDER BY [g0].[Nickname], [g0].[SquadId]) IS NULL) + ORDER BY [g0].[Nickname], [g0].[SquadId]) IS NULL """); } @@ -5120,7 +5120,7 @@ public override async Task Select_Where_Navigation_Null(bool async) SELECT [t].[Id], [t].[GearNickName], [t].[GearSquadId], [t].[IssueDate], [t].[Note], [t].[PeriodEnd], [t].[PeriodStart] FROM [Tags] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [t] LEFT JOIN [Gears] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [g] ON [t].[GearNickName] = [g].[Nickname] AND [t].[GearSquadId] = [g].[SquadId] -WHERE ([g].[Nickname] IS NULL) OR ([g].[SquadId] IS NULL) +WHERE [g].[Nickname] IS NULL OR [g].[SquadId] IS NULL """); } @@ -5249,7 +5249,7 @@ SELECT TOP(1) [t].[IsAutomatic] FROM ( SELECT DISTINCT [w].[Id], [w].[AmmunitionType], [w].[IsAutomatic], [w].[Name], [w].[OwnerFullName], [w].[PeriodEnd], [w].[PeriodStart], [w].[SynergyWithId] FROM [Weapons] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [w] - WHERE [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] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [g] WHERE [g].[HasSoulPatch] = CAST(1 AS bit) @@ -5362,7 +5362,7 @@ LEFT JOIN ( WHERE [l].[Discriminator] = N'LocustCommander' ) AS [t] ON [f].[CommanderName] = [t].[Name] LEFT JOIN [Gears] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [g] ON [t].[DefeatedByNickname] = [g].[Nickname] AND [t].[DefeatedBySquadId] = [g].[SquadId] -LEFT JOIN [Gears] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [g0] ON ([g].[Nickname] = [g0].[LeaderNickname] OR (([g].[Nickname] IS NULL) AND ([g0].[LeaderNickname] IS NULL))) AND [g].[SquadId] = [g0].[LeaderSquadId] +LEFT JOIN [Gears] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [g0] ON ([g].[Nickname] = [g0].[LeaderNickname] OR ([g].[Nickname] IS NULL AND [g0].[LeaderNickname] IS NULL)) AND [g].[SquadId] = [g0].[LeaderSquadId] ORDER BY [f].[Id], [t].[Name], [g].[Nickname], [g].[SquadId], [g0].[Nickname] """); } @@ -5399,7 +5399,7 @@ public override async Task SelectMany_without_result_selector_and_non_equality_c """ SELECT [w].[Id], [w].[AmmunitionType], [w].[IsAutomatic], [w].[Name], [w].[OwnerFullName], [w].[PeriodEnd], [w].[PeriodStart], [w].[SynergyWithId] FROM [Gears] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [g] -LEFT JOIN [Weapons] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [w] ON [g].[FullName] <> [w].[OwnerFullName] OR ([w].[OwnerFullName] IS NULL) +LEFT JOIN [Weapons] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [w] ON [g].[FullName] <> [w].[OwnerFullName] OR [w].[OwnerFullName] IS NULL """); } @@ -5450,11 +5450,11 @@ public override async Task FirstOrDefault_navigation_access_entity_equality_in_w SELECT TOP(1) [c0].[Name] FROM [Gears] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [g] INNER JOIN [Cities] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [c0] ON [g].[CityOfBirthName] = [c0].[Name] - ORDER BY [g].[Nickname]) OR (([c].[Name] IS NULL) AND (( + ORDER BY [g].[Nickname]) OR ([c].[Name] IS NULL AND ( SELECT TOP(1) [c0].[Name] FROM [Gears] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [g] INNER JOIN [Cities] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [c0] ON [g].[CityOfBirthName] = [c0].[Name] - ORDER BY [g].[Nickname]) IS NULL)) + ORDER BY [g].[Nickname]) IS NULL) """); } @@ -5466,7 +5466,7 @@ public override async Task SelectMany_predicate_with_non_equality_comparison_Def """ SELECT [g].[Nickname], [g].[SquadId], [g].[AssignedCityName], [g].[CityOfBirthName], [g].[Discriminator], [g].[FullName], [g].[HasSoulPatch], [g].[LeaderNickname], [g].[LeaderSquadId], [g].[PeriodEnd], [g].[PeriodStart], [g].[Rank], [w].[Id], [w].[AmmunitionType], [w].[IsAutomatic], [w].[Name], [w].[OwnerFullName], [w].[PeriodEnd], [w].[PeriodStart], [w].[SynergyWithId] FROM [Gears] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [g] -LEFT JOIN [Weapons] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [w] ON [g].[FullName] <> [w].[OwnerFullName] OR ([w].[OwnerFullName] IS NULL) +LEFT JOIN [Weapons] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [w] ON [g].[FullName] <> [w].[OwnerFullName] OR [w].[OwnerFullName] IS NULL ORDER BY [g].[Nickname], [w].[Id] """); } @@ -5482,7 +5482,7 @@ public override async Task Correlated_collections_basic_projection(bool async) LEFT JOIN ( SELECT [w].[Id], [w].[AmmunitionType], [w].[IsAutomatic], [w].[Name], [w].[OwnerFullName], [w].[PeriodEnd], [w].[PeriodStart], [w].[SynergyWithId] FROM [Weapons] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [w] - WHERE [w].[IsAutomatic] = CAST(1 AS bit) OR [w].[Name] <> N'foo' OR ([w].[Name] IS NULL) + WHERE [w].[IsAutomatic] = CAST(1 AS bit) OR [w].[Name] <> N'foo' OR [w].[Name] IS NULL ) AS [t] ON [g].[FullName] = [t].[OwnerFullName] WHERE [g].[Nickname] <> N'Marcus' ORDER BY [g].[Nickname], [g].[SquadId] @@ -5497,7 +5497,7 @@ public override async Task Where_bitwise_and_nullable_enum_with_null_constant(bo """ SELECT [w].[Id], [w].[AmmunitionType], [w].[IsAutomatic], [w].[Name], [w].[OwnerFullName], [w].[PeriodEnd], [w].[PeriodStart], [w].[SynergyWithId] FROM [Weapons] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [w] -WHERE ([w].[AmmunitionType] & NULL) > 0 +WHERE [w].[AmmunitionType] & NULL > 0 """); } @@ -5538,7 +5538,7 @@ public override async Task Enum_array_contains(bool async) SELECT [w].[Id], [w].[AmmunitionType], [w].[IsAutomatic], [w].[Name], [w].[OwnerFullName], [w].[PeriodEnd], [w].[PeriodStart], [w].[SynergyWithId] FROM [Weapons] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [w] LEFT JOIN [Weapons] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [w0] ON [w].[SynergyWithId] = [w0].[Id] -WHERE ([w0].[Id] IS NOT NULL) AND ([w0].[AmmunitionType] = 1 OR ([w0].[AmmunitionType] IS NULL)) +WHERE [w0].[Id] IS NOT NULL AND ([w0].[AmmunitionType] = 1 OR [w0].[AmmunitionType] IS NULL) """); } @@ -5551,7 +5551,7 @@ public override async Task Sum_with_optional_navigation_is_translated_to_sql(boo SELECT COALESCE(SUM([g].[SquadId]), 0) FROM [Gears] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [g] LEFT JOIN [Tags] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [t] ON [g].[Nickname] = [t].[GearNickName] AND [g].[SquadId] = [t].[GearSquadId] -WHERE [t].[Note] <> N'Foo' OR ([t].[Note] IS NULL) +WHERE [t].[Note] <> N'Foo' OR [t].[Note] IS NULL """); } @@ -5626,7 +5626,7 @@ LEFT JOIN ( WHERE [l].[Discriminator] = N'LocustCommander' ) AS [t] ON [f].[CommanderName] = [t].[Name] LEFT JOIN [Gears] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [g] ON [t].[DefeatedByNickname] = [g].[Nickname] AND [t].[DefeatedBySquadId] = [g].[SquadId] -LEFT JOIN [Gears] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [g0] ON ([g].[Nickname] = [g0].[LeaderNickname] OR (([g].[Nickname] IS NULL) AND ([g0].[LeaderNickname] IS NULL))) AND [g].[SquadId] = [g0].[LeaderSquadId] +LEFT JOIN [Gears] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [g0] ON ([g].[Nickname] = [g0].[LeaderNickname] OR ([g].[Nickname] IS NULL AND [g0].[LeaderNickname] IS NULL)) AND [g].[SquadId] = [g0].[LeaderSquadId] ORDER BY [f].[Id], [t].[Name], [g].[Nickname], [g].[SquadId], [g0].[Nickname] """); } @@ -5643,7 +5643,7 @@ ELSE NULL END FROM [Tags] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [t] LEFT JOIN [Gears] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [g] ON [t].[GearNickName] = [g].[Nickname] AND [t].[GearSquadId] = [g].[SquadId] -LEFT JOIN [Tags] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [t0] ON ([g].[Nickname] = [t0].[GearNickName] OR (([g].[Nickname] IS NULL) AND ([t0].[GearNickName] IS NULL))) AND ([g].[SquadId] = [t0].[GearSquadId] OR (([g].[SquadId] IS NULL) AND ([t0].[GearSquadId] IS NULL))) +LEFT JOIN [Tags] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [t0] ON ([g].[Nickname] = [t0].[GearNickName] OR ([g].[Nickname] IS NULL AND [t0].[GearNickName] IS NULL)) AND ([g].[SquadId] = [t0].[GearSquadId] OR ([g].[SquadId] IS NULL AND [t0].[GearSquadId] IS NULL)) LEFT JOIN [Gears] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [g0] ON [t0].[GearNickName] = [g0].[Nickname] AND [t0].[GearSquadId] = [g0].[SquadId] LEFT JOIN [Cities] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [c] ON [g0].[AssignedCityName] = [c].[Name] """); @@ -5702,7 +5702,7 @@ public override async Task Projecting_property_converted_to_nullable_into_member SELECT [g].[Nickname] FROM [Gears] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [g] LEFT JOIN [Tags] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [t] ON [g].[Nickname] = [t].[GearNickName] AND [g].[SquadId] = [t].[GearSquadId] -WHERE DATEPART(month, [t].[IssueDate]) <> 5 OR ([t].[IssueDate] IS NULL) +WHERE DATEPART(month, [t].[IssueDate]) <> 5 OR [t].[IssueDate] IS NULL ORDER BY [g].[Nickname] """); } @@ -5791,7 +5791,7 @@ public override async Task Count_with_optional_navigation_is_translated_to_sql(b SELECT COUNT(*) FROM [Gears] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [g] LEFT JOIN [Tags] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [t] ON [g].[Nickname] = [t].[GearNickName] AND [g].[SquadId] = [t].[GearSquadId] -WHERE [t].[Note] <> N'Foo' OR ([t].[Note] IS NULL) +WHERE [t].[Note] <> N'Foo' OR [t].[Note] IS NULL """); } @@ -5839,7 +5839,7 @@ public override async Task Composite_key_entity_not_equal_null(bool async) SELECT [l].[Name], [l].[Discriminator], [l].[LocustHordeId], [l].[PeriodEnd], [l].[PeriodStart], [l].[ThreatLevel], [l].[ThreatLevelByte], [l].[ThreatLevelNullableByte], [l].[DefeatedByNickname], [l].[DefeatedBySquadId], [l].[HighCommandId] FROM [LocustLeaders] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l] LEFT JOIN [Gears] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [g] ON [l].[DefeatedByNickname] = [g].[Nickname] AND [l].[DefeatedBySquadId] = [g].[SquadId] -WHERE [l].[Discriminator] = N'LocustCommander' AND ([g].[Nickname] IS NOT NULL) AND ([g].[SquadId] IS NOT NULL) +WHERE [l].[Discriminator] = N'LocustCommander' AND [g].[Nickname] IS NOT NULL AND [g].[SquadId] IS NOT NULL """); } @@ -5886,7 +5886,7 @@ SELECT TOP(1) [t].[IsAutomatic] FROM ( SELECT DISTINCT [w].[Id], [w].[AmmunitionType], [w].[IsAutomatic], [w].[Name], [w].[OwnerFullName], [w].[PeriodEnd], [w].[PeriodStart], [w].[SynergyWithId] FROM [Weapons] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [w] - WHERE [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)) = CAST(1 AS bit) ORDER BY [g].[Nickname] """); @@ -5924,7 +5924,7 @@ public override async Task Enum_flags_closure_typed_as_different_type_generates_ SELECT [g].[Nickname], [g].[SquadId], [g].[AssignedCityName], [g].[CityOfBirthName], [g].[Discriminator], [g].[FullName], [g].[HasSoulPatch], [g].[LeaderNickname], [g].[LeaderSquadId], [g].[PeriodEnd], [g].[PeriodStart], [g].[Rank] FROM [Gears] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [g] -WHERE (@__prm_0 & CAST([g].[Rank] AS int)) = CAST([g].[Rank] AS int) +WHERE @__prm_0 & CAST([g].[Rank] AS int) = CAST([g].[Rank] AS int) """); } @@ -6002,7 +6002,7 @@ public override async Task OfTypeNav3(bool async) LEFT JOIN [Tags] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [t] ON [g].[Nickname] = [t].[GearNickName] AND [g].[SquadId] = [t].[GearSquadId] INNER JOIN [Weapons] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [w] ON [g].[FullName] = [w].[OwnerFullName] LEFT JOIN [Tags] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [t0] ON [g].[Nickname] = [t0].[GearNickName] AND [g].[SquadId] = [t0].[GearSquadId] -WHERE ([t].[Note] <> N'Foo' OR ([t].[Note] IS NULL)) AND [g].[Discriminator] = N'Officer' AND ([t0].[Note] <> N'Bar' OR ([t0].[Note] IS NULL)) +WHERE ([t].[Note] <> N'Foo' OR [t].[Note] IS NULL) AND [g].[Discriminator] = N'Officer' AND ([t0].[Note] <> N'Bar' OR [t0].[Note] IS NULL) """); } @@ -6187,7 +6187,7 @@ public override async Task Optional_navigation_type_compensation_works_with_arra SELECT [g].[SquadId] FROM [Tags] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [t] LEFT JOIN [Gears] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [g] ON [t].[GearNickName] = [g].[Nickname] AND [t].[GearSquadId] = [g].[SquadId] -WHERE [t].[Note] <> N'K.I.A.' OR ([t].[Note] IS NULL) +WHERE [t].[Note] <> N'K.I.A.' OR [t].[Note] IS NULL """); } @@ -6202,7 +6202,7 @@ SELECT TOP(1) [t].[IsAutomatic] FROM ( SELECT DISTINCT [w].[Id], [w].[AmmunitionType], [w].[IsAutomatic], [w].[Name], [w].[OwnerFullName], [w].[PeriodEnd], [w].[PeriodStart], [w].[SynergyWithId] FROM [Weapons] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [w] - WHERE [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] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [g] WHERE [g].[HasSoulPatch] = CAST(1 AS bit) @@ -6278,7 +6278,7 @@ LEFT JOIN ( FROM [Factions] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' 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 """); } @@ -6443,7 +6443,7 @@ public override async Task Where_subquery_distinct_singleordefault_boolean2(bool WHERE [g].[HasSoulPatch] = CAST(1 AS bit) AND COALESCE(( SELECT DISTINCT TOP(1) [w].[IsAutomatic] FROM [Weapons] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' 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] """); } @@ -6558,7 +6558,7 @@ public override async Task Composite_key_entity_equal_null(bool async) SELECT [l].[Name], [l].[Discriminator], [l].[LocustHordeId], [l].[PeriodEnd], [l].[PeriodStart], [l].[ThreatLevel], [l].[ThreatLevelByte], [l].[ThreatLevelNullableByte], [l].[DefeatedByNickname], [l].[DefeatedBySquadId], [l].[HighCommandId] FROM [LocustLeaders] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l] LEFT JOIN [Gears] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [g] ON [l].[DefeatedByNickname] = [g].[Nickname] AND [l].[DefeatedBySquadId] = [g].[SquadId] -WHERE [l].[Discriminator] = N'LocustCommander' AND (([g].[Nickname] IS NULL) OR ([g].[SquadId] IS NULL)) +WHERE [l].[Discriminator] = N'LocustCommander' AND ([g].[Nickname] IS NULL OR [g].[SquadId] IS NULL) """); } @@ -6571,7 +6571,7 @@ public override async Task Optional_navigation_type_compensation_works_with_cont SELECT [t].[Id], [t].[GearNickName], [t].[GearSquadId], [t].[IssueDate], [t].[Note], [t].[PeriodEnd], [t].[PeriodStart] FROM [Tags] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [t] LEFT JOIN [Gears] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [g] ON [t].[GearNickName] = [g].[Nickname] AND [t].[GearSquadId] = [g].[SquadId] -WHERE ([t].[Note] <> N'K.I.A.' OR ([t].[Note] IS NULL)) AND EXISTS ( +WHERE ([t].[Note] <> N'K.I.A.' OR [t].[Note] IS NULL) AND EXISTS ( SELECT 1 FROM [Gears] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [g0] WHERE [g0].[SquadId] = [g].[SquadId]) @@ -6587,7 +6587,7 @@ public override async Task Optional_navigation_type_compensation_works_with_DTOs SELECT [g].[SquadId] AS [Id] FROM [Tags] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [t] LEFT JOIN [Gears] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [g] ON [t].[GearNickName] = [g].[Nickname] AND [t].[GearSquadId] = [g].[SquadId] -WHERE [t].[Note] <> N'K.I.A.' OR ([t].[Note] IS NULL) +WHERE [t].[Note] <> N'K.I.A.' OR [t].[Note] IS NULL """); } @@ -6616,7 +6616,7 @@ public override async Task Include_on_derived_type_with_order_by_and_paging(bool SELECT TOP(@__p_0) [l].[Name], [l].[Discriminator], [l].[LocustHordeId], [l].[PeriodEnd], [l].[PeriodStart], [l].[ThreatLevel], [l].[ThreatLevelByte], [l].[ThreatLevelNullableByte], [l].[DefeatedByNickname], [l].[DefeatedBySquadId], [l].[HighCommandId], [g].[Nickname], [g].[SquadId], [g].[AssignedCityName], [g].[CityOfBirthName], [g].[Discriminator] AS [Discriminator0], [g].[FullName], [g].[HasSoulPatch], [g].[LeaderNickname], [g].[LeaderSquadId], [g].[PeriodEnd] AS [PeriodEnd0], [g].[PeriodStart] AS [PeriodStart0], [g].[Rank], [t].[Id], [t].[Note] FROM [LocustLeaders] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l] LEFT JOIN [Gears] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [g] ON [l].[DefeatedByNickname] = [g].[Nickname] AND [l].[DefeatedBySquadId] = [g].[SquadId] - LEFT JOIN [Tags] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [t] ON ([g].[Nickname] = [t].[GearNickName] OR (([g].[Nickname] IS NULL) AND ([t].[GearNickName] IS NULL))) AND ([g].[SquadId] = [t].[GearSquadId] OR (([g].[SquadId] IS NULL) AND ([t].[GearSquadId] IS NULL))) + LEFT JOIN [Tags] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [t] ON ([g].[Nickname] = [t].[GearNickName] OR ([g].[Nickname] IS NULL AND [t].[GearNickName] IS NULL)) AND ([g].[SquadId] = [t].[GearSquadId] OR ([g].[SquadId] IS NULL AND [t].[GearSquadId] IS NULL)) ORDER BY [t].[Note] ) AS [t0] LEFT JOIN [Weapons] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [w] ON [t0].[FullName] = [w].[OwnerFullName] @@ -6811,14 +6811,14 @@ public override async Task Bitwise_projects_values_in_select(bool async) AssertSql( """ SELECT TOP(1) CASE - WHEN ([g].[Rank] & 2) = 2 THEN CAST(1 AS bit) + WHEN [g].[Rank] & 2 = 2 THEN CAST(1 AS bit) ELSE CAST(0 AS bit) END AS [BitwiseTrue], CASE - WHEN ([g].[Rank] & 2) = 4 THEN CAST(1 AS bit) + WHEN [g].[Rank] & 2 = 4 THEN CAST(1 AS bit) ELSE CAST(0 AS bit) END AS [BitwiseFalse], [g].[Rank] & 2 AS [BitwiseValue] FROM [Gears] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [g] -WHERE ([g].[Rank] & 2) = 2 +WHERE [g].[Rank] & 2 = 2 """); } @@ -7068,7 +7068,7 @@ SELECT [g].[Nickname] FROM [Gears] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [g] INNER JOIN [Tags] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [t] ON [g].[Nickname] = [t].[GearNickName] INNER JOIN [Tags] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [t0] ON [g].[Nickname] = [t0].[GearNickName] -WHERE [t].[GearNickName] <> N'Cole Train' OR ([t].[GearNickName] IS NULL) +WHERE [t].[GearNickName] <> N'Cole Train' OR [t].[GearNickName] IS NULL ORDER BY [g].[Nickname], [t0].[Id] """); } @@ -7135,7 +7135,7 @@ public override async Task SelectMany_predicate_with_non_equality_comparison_con """ SELECT [g].[Nickname], [g].[SquadId], [g].[AssignedCityName], [g].[CityOfBirthName], [g].[Discriminator], [g].[FullName], [g].[HasSoulPatch], [g].[LeaderNickname], [g].[LeaderSquadId], [g].[PeriodEnd], [g].[PeriodStart], [g].[Rank], [w].[Id], [w].[AmmunitionType], [w].[IsAutomatic], [w].[Name], [w].[OwnerFullName], [w].[PeriodEnd], [w].[PeriodStart], [w].[SynergyWithId] FROM [Gears] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [g] -INNER JOIN [Weapons] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [w] ON [g].[FullName] <> [w].[OwnerFullName] OR ([w].[OwnerFullName] IS NULL) +INNER JOIN [Weapons] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [w] ON [g].[FullName] <> [w].[OwnerFullName] OR [w].[OwnerFullName] IS NULL ORDER BY [g].[Nickname], [w].[Id] """); } @@ -7154,7 +7154,7 @@ LEFT JOIN ( FROM [LocustLeaders] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l] WHERE [l].[Discriminator] = N'LocustCommander' ) AS [t] ON [f].[CommanderName] = [t].[Name] -WHERE [c].[Name] <> N'Foo' OR ([c].[Name] IS NULL) +WHERE [c].[Name] <> N'Foo' OR [c].[Name] IS NULL """); } @@ -7184,7 +7184,7 @@ public override async Task Optional_navigation_type_compensation_works_with_proj SELECT [g].[SquadId] FROM [Tags] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [t] LEFT JOIN [Gears] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [g] ON [t].[GearNickName] = [g].[Nickname] AND [t].[GearSquadId] = [g].[SquadId] -WHERE [t].[Note] <> N'K.I.A.' OR ([t].[Note] IS NULL) +WHERE [t].[Note] <> N'K.I.A.' OR [t].[Note] IS NULL """); } @@ -7228,18 +7228,6 @@ GROUP BY [c].[Name] """); } - public override async Task Double_negate_on_column(bool async) - { - await base.Double_negate_on_column(async); - - AssertSql( -""" -SELECT [s].[Id], [s].[Banner], [s].[Banner5], [s].[InternalNumber], [s].[Name], [s].[PeriodEnd], [s].[PeriodStart] -FROM [Squads] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [s] -WHERE -(-[s].[Id]) = [s].[Id] -"""); - } - public override async Task Outer_parameter_in_group_join_with_DefaultIfEmpty(bool async) { await base.Outer_parameter_in_group_join_with_DefaultIfEmpty(async); @@ -7272,7 +7260,7 @@ LEFT JOIN ( WHERE [l].[Discriminator] = N'LocustCommander' ) AS [t] ON [f].[CommanderName] = [t].[Name] LEFT JOIN [Gears] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [g] ON [t].[DefeatedByNickname] = [g].[Nickname] AND [t].[DefeatedBySquadId] = [g].[SquadId] -LEFT JOIN [Gears] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [g0] ON ([g].[Nickname] = [g0].[LeaderNickname] OR (([g].[Nickname] IS NULL) AND ([g0].[LeaderNickname] IS NULL))) AND [g].[SquadId] = [g0].[LeaderSquadId] +LEFT JOIN [Gears] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [g0] ON ([g].[Nickname] = [g0].[LeaderNickname] OR ([g].[Nickname] IS NULL AND [g0].[LeaderNickname] IS NULL)) AND [g].[SquadId] = [g0].[LeaderSquadId] ORDER BY [f].[Id], [t].[Name], [g].[Nickname], [g].[SquadId], [g0].[Nickname] """); } @@ -7503,7 +7491,7 @@ public override async Task Checked_context_with_addition_does_not_fail(bool asyn """ 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 CAST([l].[ThreatLevel] AS bigint) >= (CAST(5 AS bigint) + CAST([l].[ThreatLevel] AS bigint)) +WHERE CAST([l].[ThreatLevel] AS bigint) >= CAST(5 AS bigint) + CAST([l].[ThreatLevel] AS bigint) """); } @@ -7544,7 +7532,7 @@ LEFT JOIN ( WHERE [l].[Discriminator] = N'LocustCommander' ) AS [t] ON [f].[CommanderName] = [t].[Name] LEFT JOIN [Gears] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [g] ON [t].[DefeatedByNickname] = [g].[Nickname] AND [t].[DefeatedBySquadId] = [g].[SquadId] -LEFT JOIN [Gears] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [g0] ON ([g].[Nickname] = [g0].[LeaderNickname] OR (([g].[Nickname] IS NULL) AND ([g0].[LeaderNickname] IS NULL))) AND [g].[SquadId] = [g0].[LeaderSquadId] +LEFT JOIN [Gears] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [g0] ON ([g].[Nickname] = [g0].[LeaderNickname] OR ([g].[Nickname] IS NULL AND [g0].[LeaderNickname] IS NULL)) AND [g].[SquadId] = [g0].[LeaderSquadId] ORDER BY [f].[Id], [t].[Name], [g].[Nickname], [g].[SquadId], [g0].[Nickname] """); } @@ -7563,7 +7551,7 @@ LEFT JOIN ( OUTER APPLY ( SELECT [w].[Name], [g0].[Nickname], [w].[Id] FROM [Weapons] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [w] - WHERE [g0].[FullName] = [w].[OwnerFullName] AND ([w].[Name] <> N'Bar' OR ([w].[Name] IS NULL)) + WHERE [g0].[FullName] = [w].[OwnerFullName] AND ([w].[Name] <> N'Bar' OR [w].[Name] IS NULL) ) AS [t] WHERE [g0].[FullName] <> N'Foo' ) AS [t0] ON [g].[Nickname] = [t0].[LeaderNickname] AND [g].[SquadId] = [t0].[LeaderSquadId] @@ -7614,7 +7602,7 @@ public override async Task Null_propagation_optimization2(bool async) WHERE CASE WHEN [g].[LeaderNickname] IS NULL THEN NULL ELSE CASE - WHEN ([g].[LeaderNickname] IS NOT NULL) AND ([g].[LeaderNickname] LIKE N'%us') THEN CAST(1 AS bit) + WHEN [g].[LeaderNickname] IS NOT NULL AND [g].[LeaderNickname] LIKE N'%us' THEN CAST(1 AS bit) ELSE CAST(0 AS bit) END END = CAST(1 AS bit) @@ -7766,16 +7754,16 @@ public override async Task Where_enum_has_flag_subquery_client_eval(bool async) """ SELECT [g].[Nickname], [g].[SquadId], [g].[AssignedCityName], [g].[CityOfBirthName], [g].[Discriminator], [g].[FullName], [g].[HasSoulPatch], [g].[LeaderNickname], [g].[LeaderSquadId], [g].[PeriodEnd], [g].[PeriodStart], [g].[Rank] FROM [Gears] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [g] -WHERE ([g].[Rank] & ( +WHERE [g].[Rank] & ( SELECT TOP(1) [g0].[Rank] FROM [Gears] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [g0] - ORDER BY [g0].[Nickname], [g0].[SquadId])) = ( + ORDER BY [g0].[Nickname], [g0].[SquadId]) = ( SELECT TOP(1) [g0].[Rank] FROM [Gears] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [g0] - ORDER BY [g0].[Nickname], [g0].[SquadId]) OR (( + ORDER BY [g0].[Nickname], [g0].[SquadId]) OR ( SELECT TOP(1) [g0].[Rank] FROM [Gears] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [g0] - ORDER BY [g0].[Nickname], [g0].[SquadId]) IS NULL) + ORDER BY [g0].[Nickname], [g0].[SquadId]) IS NULL """); } @@ -7972,7 +7960,7 @@ public override async Task Singleton_Navigation_With_Member_Access(bool async) SELECT [g].[CityOfBirthName] AS [B] FROM [Tags] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [t] LEFT JOIN [Gears] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [g] ON [t].[GearNickName] = [g].[Nickname] AND [t].[GearSquadId] = [g].[SquadId] -WHERE [g].[Nickname] = N'Marcus' AND ([g].[CityOfBirthName] <> N'Ephyra' OR ([g].[CityOfBirthName] IS NULL)) +WHERE [g].[Nickname] = N'Marcus' AND ([g].[CityOfBirthName] <> N'Ephyra' OR [g].[CityOfBirthName] IS NULL) """); } @@ -8007,7 +7995,7 @@ public override async Task Projecting_nullable_bool_in_conditional_works(bool as AssertSql( """ SELECT CASE - WHEN ([g].[Nickname] IS NOT NULL) AND ([g].[SquadId] IS NOT NULL) THEN [g].[HasSoulPatch] + WHEN [g].[Nickname] IS NOT NULL AND [g].[SquadId] IS NOT NULL THEN [g].[HasSoulPatch] ELSE CAST(0 AS bit) END AS [Prop] FROM [Tags] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [t] @@ -8052,13 +8040,13 @@ public override async Task Where_bitwise_and_enum(bool async) """ SELECT [g].[Nickname], [g].[SquadId], [g].[AssignedCityName], [g].[CityOfBirthName], [g].[Discriminator], [g].[FullName], [g].[HasSoulPatch], [g].[LeaderNickname], [g].[LeaderSquadId], [g].[PeriodEnd], [g].[PeriodStart], [g].[Rank] FROM [Gears] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [g] -WHERE ([g].[Rank] & 2) > 0 +WHERE [g].[Rank] & 2 > 0 """, // """ SELECT [g].[Nickname], [g].[SquadId], [g].[AssignedCityName], [g].[CityOfBirthName], [g].[Discriminator], [g].[FullName], [g].[HasSoulPatch], [g].[LeaderNickname], [g].[LeaderSquadId], [g].[PeriodEnd], [g].[PeriodStart], [g].[Rank] FROM [Gears] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [g] -WHERE ([g].[Rank] & 2) = 2 +WHERE [g].[Rank] & 2 = 2 """); } @@ -8247,7 +8235,7 @@ public override async Task Select_Where_Navigation_Null_Reverse(bool async) SELECT [t].[Id], [t].[GearNickName], [t].[GearSquadId], [t].[IssueDate], [t].[Note], [t].[PeriodEnd], [t].[PeriodStart] FROM [Tags] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [t] LEFT JOIN [Gears] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [g] ON [t].[GearNickName] = [g].[Nickname] AND [t].[GearSquadId] = [g].[SquadId] -WHERE ([g].[Nickname] IS NULL) OR ([g].[SquadId] IS NULL) +WHERE [g].[Nickname] IS NULL OR [g].[SquadId] IS NULL """); } @@ -8294,7 +8282,7 @@ SELECT TOP(1) [t].[IsAutomatic] FROM ( SELECT DISTINCT [w].[Id], [w].[AmmunitionType], [w].[IsAutomatic], [w].[Name], [w].[OwnerFullName], [w].[PeriodEnd], [w].[PeriodStart], [w].[SynergyWithId] FROM [Weapons] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [w] - WHERE [g].[FullName] = [w].[OwnerFullName] AND ([w].[Name] LIKE N'%Lancer%') + WHERE [g].[FullName] = [w].[OwnerFullName] AND [w].[Name] LIKE N'%Lancer%' ) AS [t]) = CAST(1 AS bit) ORDER BY [g].[Nickname] """); @@ -8322,7 +8310,7 @@ public override async Task String_concat_on_various_types(bool async) AssertSql( """ -SELECT (N'HasSoulPatch ' + CAST([g].[HasSoulPatch] AS nvarchar(max))) + N' HasSoulPatch' AS [HasSoulPatch], (N'Rank ' + CAST([g].[Rank] AS nvarchar(max))) + N' Rank' AS [Rank], (N'SquadId ' + CAST([g].[SquadId] AS nvarchar(max))) + N' SquadId' AS [SquadId], (N'Rating ' + COALESCE(CAST([m].[Rating] AS nvarchar(max)), N'')) + N' Rating' AS [Rating], (N'Timeline ' + CAST([m].[Timeline] AS nvarchar(max))) + N' Timeline' AS [Timeline] +SELECT N'HasSoulPatch ' + CAST([g].[HasSoulPatch] AS nvarchar(max)) + N' HasSoulPatch' AS [HasSoulPatch], N'Rank ' + CAST([g].[Rank] AS nvarchar(max)) + N' Rank' AS [Rank], N'SquadId ' + CAST([g].[SquadId] AS nvarchar(max)) + N' SquadId' AS [SquadId], N'Rating ' + COALESCE(CAST([m].[Rating] AS nvarchar(max)), N'') + N' Rating' AS [Rating], N'Timeline ' + CAST([m].[Timeline] AS nvarchar(max)) + N' Timeline' AS [Timeline] FROM [Gears] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [g] CROSS JOIN [Missions] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [m] ORDER BY [g].[Nickname], [m].[Id] @@ -8356,19 +8344,19 @@ public override async Task Where_bitwise_and_integral(bool async) """ SELECT [g].[Nickname], [g].[SquadId], [g].[AssignedCityName], [g].[CityOfBirthName], [g].[Discriminator], [g].[FullName], [g].[HasSoulPatch], [g].[LeaderNickname], [g].[LeaderSquadId], [g].[PeriodEnd], [g].[PeriodStart], [g].[Rank] FROM [Gears] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [g] -WHERE ([g].[Rank] & 1) = 1 +WHERE [g].[Rank] & 1 = 1 """, // """ SELECT [g].[Nickname], [g].[SquadId], [g].[AssignedCityName], [g].[CityOfBirthName], [g].[Discriminator], [g].[FullName], [g].[HasSoulPatch], [g].[LeaderNickname], [g].[LeaderSquadId], [g].[PeriodEnd], [g].[PeriodStart], [g].[Rank] FROM [Gears] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [g] -WHERE (CAST([g].[Rank] AS bigint) & CAST(1 AS bigint)) = CAST(1 AS bigint) +WHERE CAST([g].[Rank] AS bigint) & CAST(1 AS bigint) = CAST(1 AS bigint) """, // """ SELECT [g].[Nickname], [g].[SquadId], [g].[AssignedCityName], [g].[CityOfBirthName], [g].[Discriminator], [g].[FullName], [g].[HasSoulPatch], [g].[LeaderNickname], [g].[LeaderSquadId], [g].[PeriodEnd], [g].[PeriodStart], [g].[Rank] FROM [Gears] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [g] -WHERE (CAST([g].[Rank] AS smallint) & CAST(1 AS smallint)) = CAST(1 AS smallint) +WHERE CAST([g].[Rank] AS smallint) & CAST(1 AS smallint) = CAST(1 AS smallint) """); } @@ -8379,7 +8367,7 @@ public override async Task Coalesce_operator_in_projection_with_other_conditions AssertSql( """ SELECT CASE - WHEN [w].[AmmunitionType] = 1 AND ([w].[AmmunitionType] IS NOT NULL) AND COALESCE([w].[IsAutomatic], CAST(0 AS bit)) = CAST(1 AS bit) THEN CAST(1 AS bit) + WHEN [w].[AmmunitionType] = 1 AND [w].[AmmunitionType] IS NOT NULL AND COALESCE([w].[IsAutomatic], CAST(0 AS bit)) = CAST(1 AS bit) THEN CAST(1 AS bit) ELSE CAST(0 AS bit) END FROM [Weapons] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [w] @@ -8408,7 +8396,7 @@ public override async Task Select_null_propagation_negative4(bool async) AssertSql( """ SELECT CASE - WHEN ([g0].[Nickname] IS NOT NULL) AND ([g0].[SquadId] IS NOT NULL) THEN CAST(1 AS bit) + WHEN [g0].[Nickname] IS NOT NULL AND [g0].[SquadId] IS NOT NULL THEN CAST(1 AS bit) ELSE CAST(0 AS bit) END, [g0].[Nickname] FROM [Gears] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [g] @@ -8579,7 +8567,7 @@ public override async Task Null_checks_in_correlated_predicate_are_correctly_tra """ SELECT [t].[Id], [g].[Nickname], [g].[SquadId], [g].[AssignedCityName], [g].[CityOfBirthName], [g].[Discriminator], [g].[FullName], [g].[HasSoulPatch], [g].[LeaderNickname], [g].[LeaderSquadId], [g].[PeriodEnd], [g].[PeriodStart], [g].[Rank] FROM [Tags] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [t] -LEFT JOIN [Gears] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [g] ON [t].[GearNickName] = [g].[Nickname] AND [t].[GearSquadId] = [g].[SquadId] AND ([t].[Note] IS NOT NULL) +LEFT JOIN [Gears] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [g] ON [t].[GearNickName] = [g].[Nickname] AND [t].[GearSquadId] = [g].[SquadId] AND [t].[Note] IS NOT NULL ORDER BY [t].[Id], [g].[Nickname] """); } @@ -8620,7 +8608,7 @@ public override async Task Where_has_flag_with_nullable_parameter(bool async) SELECT [g].[Nickname], [g].[SquadId], [g].[AssignedCityName], [g].[CityOfBirthName], [g].[Discriminator], [g].[FullName], [g].[HasSoulPatch], [g].[LeaderNickname], [g].[LeaderSquadId], [g].[PeriodEnd], [g].[PeriodStart], [g].[Rank] FROM [Gears] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [g] -WHERE ([g].[Rank] & @__parameter_0) = @__parameter_0 +WHERE [g].[Rank] & @__parameter_0 = @__parameter_0 """); } @@ -8707,7 +8695,7 @@ public override async Task Select_correlated_filtered_collection(bool async) LEFT JOIN ( SELECT [w].[Id], [w].[AmmunitionType], [w].[IsAutomatic], [w].[Name], [w].[OwnerFullName], [w].[PeriodEnd], [w].[PeriodStart], [w].[SynergyWithId] FROM [Weapons] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [w] - WHERE [w].[Name] <> N'Lancer' OR ([w].[Name] IS NULL) + WHERE [w].[Name] <> N'Lancer' OR [w].[Name] IS NULL ) AS [t] ON [g].[FullName] = [t].[OwnerFullName] WHERE [c].[Name] IN (N'Ephyra', N'Hanover') ORDER BY [g].[Nickname], [g].[SquadId], [c].[Name] @@ -8720,7 +8708,7 @@ public override async Task String_concat_nullable_expressions_are_coalesced(bool AssertSql( """ -SELECT (([g].[FullName] + N'') + COALESCE([g].[LeaderNickname], N'')) + N'' +SELECT [g].[FullName] + N'' + COALESCE([g].[LeaderNickname], N'') + N'' FROM [Gears] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [g] """); } @@ -8797,7 +8785,7 @@ public override async Task Null_semantics_is_correctly_applied_for_function_comp SELECT [t].[Id], [t].[GearNickName], [t].[GearSquadId], [t].[IssueDate], [t].[Note], [t].[PeriodEnd], [t].[PeriodStart] FROM [Tags] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [t] LEFT JOIN [Gears] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [g] ON [t].[GearNickName] = [g].[Nickname] AND [t].[GearSquadId] = [g].[SquadId] -WHERE SUBSTRING([t].[Note], 0 + 1, [g].[SquadId]) = [t].[GearNickName] OR ((([t].[Note] IS NULL) OR ([g].[SquadId] IS NULL)) AND ([t].[GearNickName] IS NULL)) +WHERE SUBSTRING([t].[Note], 0 + 1, [g].[SquadId]) = [t].[GearNickName] OR (([t].[Note] IS NULL OR [g].[SquadId] IS NULL) AND [t].[GearNickName] IS NULL) """); } @@ -8856,7 +8844,7 @@ public override async Task Select_null_propagation_negative5(bool async) AssertSql( """ SELECT CASE - WHEN ([g0].[Nickname] IS NOT NULL) AND ([g0].[SquadId] IS NOT NULL) THEN CAST(1 AS bit) + WHEN [g0].[Nickname] IS NOT NULL AND [g0].[SquadId] IS NOT NULL THEN CAST(1 AS bit) ELSE CAST(0 AS bit) END, [g0].[Nickname] FROM [Gears] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [g] @@ -8875,7 +8863,7 @@ public override async Task Enum_flags_closure_typed_as_underlying_type_generates SELECT [g].[Nickname], [g].[SquadId], [g].[AssignedCityName], [g].[CityOfBirthName], [g].[Discriminator], [g].[FullName], [g].[HasSoulPatch], [g].[LeaderNickname], [g].[LeaderSquadId], [g].[PeriodEnd], [g].[PeriodStart], [g].[Rank] FROM [Gears] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [g] -WHERE (@__prm_0 & [g].[Rank]) = [g].[Rank] +WHERE @__prm_0 & [g].[Rank] = [g].[Rank] """); } @@ -8898,7 +8886,7 @@ 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] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [t] @@ -9042,7 +9030,7 @@ public override async Task Correlated_collections_basic_projection_ordered(bool LEFT JOIN ( SELECT [w].[Id], [w].[AmmunitionType], [w].[IsAutomatic], [w].[Name], [w].[OwnerFullName], [w].[PeriodEnd], [w].[PeriodStart], [w].[SynergyWithId] FROM [Weapons] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [w] - WHERE [w].[IsAutomatic] = CAST(1 AS bit) OR [w].[Name] <> N'foo' OR ([w].[Name] IS NULL) + WHERE [w].[IsAutomatic] = CAST(1 AS bit) OR [w].[Name] <> N'foo' OR [w].[Name] IS NULL ) AS [t] ON [g].[FullName] = [t].[OwnerFullName] WHERE [g].[Nickname] <> N'Marcus' ORDER BY [g].[Nickname], [g].[SquadId], [t].[Name] DESC @@ -9074,14 +9062,14 @@ public override async Task Select_enum_has_flag(bool async) AssertSql( """ SELECT TOP(1) CASE - WHEN ([g].[Rank] & 2) = 2 THEN CAST(1 AS bit) + WHEN [g].[Rank] & 2 = 2 THEN CAST(1 AS bit) ELSE CAST(0 AS bit) END AS [hasFlagTrue], CASE - WHEN ([g].[Rank] & 4) = 4 THEN CAST(1 AS bit) + WHEN [g].[Rank] & 4 = 4 THEN CAST(1 AS bit) ELSE CAST(0 AS bit) END AS [hasFlagFalse] FROM [Gears] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [g] -WHERE ([g].[Rank] & 2) = 2 +WHERE [g].[Rank] & 2 = 2 """); } @@ -9107,10 +9095,10 @@ public override async Task Projecting_property_converted_to_nullable_into_unary( SELECT [t].[Note] FROM [Tags] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [t] LEFT JOIN [Gears] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [g] ON [t].[GearNickName] = [g].[Nickname] AND [t].[GearSquadId] = [g].[SquadId] -WHERE (CASE +WHERE CASE WHEN [t].[GearNickName] IS NOT NULL THEN [g].[Nickname] ELSE NULL -END IS NOT NULL) AND CASE +END IS NOT NULL AND CASE WHEN [t].[GearNickName] IS NOT NULL THEN [g].[HasSoulPatch] ELSE NULL END = CAST(0 AS bit) @@ -9131,7 +9119,7 @@ LEFT JOIN ( FROM [Gears] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [g] WHERE [g].[Discriminator] = N'Officer' ) AS [t0] ON [t].[GearNickName] = [t0].[Nickname] -LEFT JOIN [Gears] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [g0] ON ([t0].[Nickname] = [g0].[LeaderNickname] OR (([t0].[Nickname] IS NULL) AND ([g0].[LeaderNickname] IS NULL))) AND [t0].[SquadId] = [g0].[LeaderSquadId] +LEFT JOIN [Gears] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [g0] ON ([t0].[Nickname] = [g0].[LeaderNickname] OR ([t0].[Nickname] IS NULL AND [g0].[LeaderNickname] IS NULL)) AND [t0].[SquadId] = [g0].[LeaderSquadId] ORDER BY [t].[Id], [t0].[Nickname], [t0].[SquadId], [g0].[Nickname] """); } @@ -9144,7 +9132,7 @@ public override async Task Where_bitwise_or_enum(bool async) """ SELECT [g].[Nickname], [g].[SquadId], [g].[AssignedCityName], [g].[CityOfBirthName], [g].[Discriminator], [g].[FullName], [g].[HasSoulPatch], [g].[LeaderNickname], [g].[LeaderSquadId], [g].[PeriodEnd], [g].[PeriodStart], [g].[Rank] FROM [Gears] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [g] -WHERE ([g].[Rank] | 2) > 0 +WHERE [g].[Rank] | 2 > 0 """); } @@ -9257,13 +9245,13 @@ public override async Task Where_bitwise_and_nullable_enum_with_nullable_paramet SELECT [w].[Id], [w].[AmmunitionType], [w].[IsAutomatic], [w].[Name], [w].[OwnerFullName], [w].[PeriodEnd], [w].[PeriodStart], [w].[SynergyWithId] FROM [Weapons] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [w] -WHERE ([w].[AmmunitionType] & @__ammunitionType_0) > 0 +WHERE [w].[AmmunitionType] & @__ammunitionType_0 > 0 """, // """ SELECT [w].[Id], [w].[AmmunitionType], [w].[IsAutomatic], [w].[Name], [w].[OwnerFullName], [w].[PeriodEnd], [w].[PeriodStart], [w].[SynergyWithId] FROM [Weapons] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [w] -WHERE ([w].[AmmunitionType] & NULL) > 0 +WHERE [w].[AmmunitionType] & NULL > 0 """); } diff --git a/test/EFCore.SqlServer.FunctionalTests/Query/TemporalManyToManyQuerySqlServerTest.cs b/test/EFCore.SqlServer.FunctionalTests/Query/TemporalManyToManyQuerySqlServerTest.cs index 4a6acd18c37..fc448965ee6 100644 --- a/test/EFCore.SqlServer.FunctionalTests/Query/TemporalManyToManyQuerySqlServerTest.cs +++ b/test/EFCore.SqlServer.FunctionalTests/Query/TemporalManyToManyQuerySqlServerTest.cs @@ -76,7 +76,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%') """); } @@ -92,7 +92,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%') """); } @@ -144,7 +144,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] """); } @@ -176,7 +176,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] """); } diff --git a/test/EFCore.SqlServer.FunctionalTests/Query/TemporalOwnedQuerySqlServerTest.cs b/test/EFCore.SqlServer.FunctionalTests/Query/TemporalOwnedQuerySqlServerTest.cs index 2b5b3ffb323..12f594daa75 100644 --- a/test/EFCore.SqlServer.FunctionalTests/Query/TemporalOwnedQuerySqlServerTest.cs +++ b/test/EFCore.SqlServer.FunctionalTests/Query/TemporalOwnedQuerySqlServerTest.cs @@ -294,7 +294,7 @@ LEFT JOIN ( FROM [Order] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [o0] LEFT JOIN [OrderDetail] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [o1] ON [o0].[ClientId] = [o1].[OrderClientId] AND [o0].[Id] = [o1].[OrderId] ) AS [t] ON [o].[Id] = [t].[ClientId] -WHERE [p].[Id] <> 42 OR ([p].[Id] IS NULL) +WHERE [p].[Id] <> 42 OR [p].[Id] IS NULL ORDER BY [o].[Id], [p].[Id], [t].[ClientId], [t].[Id], [t].[OrderClientId], [t].[OrderId] """); } @@ -329,7 +329,7 @@ SELECT COUNT(*) LEFT JOIN [OwnedPerson] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [o1] ON [o0].[ClientId] = [o1].[Id] LEFT JOIN [Planet] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [p0] ON [o1].[PersonAddress_Country_PlanetId] = [p0].[Id] LEFT JOIN [Star] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [s] ON [p0].[StarId] = [s].[Id] - WHERE [o].[Id] = [o0].[ClientId] AND ([s].[Id] <> 42 OR ([s].[Id] IS NULL))) AS [Count], [p].[Id], [p].[Name], [p].[PeriodEnd], [p].[PeriodStart], [p].[StarId] + WHERE [o].[Id] = [o0].[ClientId] AND ([s].[Id] <> 42 OR [s].[Id] IS NULL)) AS [Count], [p].[Id], [p].[Name], [p].[PeriodEnd], [p].[PeriodStart], [p].[StarId] FROM [OwnedPerson] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [o] LEFT JOIN [Planet] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [p] ON [o].[PersonAddress_Country_PlanetId] = [p].[Id] ORDER BY [o].[Id] @@ -350,7 +350,7 @@ LEFT JOIN ( FROM [Order] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [o0] LEFT JOIN [OrderDetail] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [o1] ON [o0].[ClientId] = [o1].[OrderClientId] AND [o0].[Id] = [o1].[OrderId] ) AS [t] ON [o].[Id] = [t].[ClientId] -WHERE [p].[Id] <> 7 OR ([p].[Id] IS NULL) +WHERE [p].[Id] <> 7 OR [p].[Id] IS NULL ORDER BY [o].[Id], [p].[Id], [t].[ClientId], [t].[Id], [t].[OrderClientId], [t].[OrderId] """); } @@ -1313,7 +1313,7 @@ public override async Task Projecting_collection_correlated_with_keyless_entity_ SELECT [b].[Throned_Value], [f].[Id], [b].[Id], [p].[Id], [p].[Name], [p].[PeriodEnd], [p].[PeriodStart], [p].[StarId] FROM [Fink] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [f] LEFT JOIN [Barton] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [b] ON [f].[BartonId] = [b].[Id] -LEFT JOIN [Planet] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [p] ON [b].[Throned_Value] <> [p].[Id] OR ([b].[Throned_Value] IS NULL) +LEFT JOIN [Planet] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [p] ON [b].[Throned_Value] <> [p].[Id] OR [b].[Throned_Value] IS NULL ORDER BY [f].[Id], [b].[Id] """); } diff --git a/test/EFCore.SqlServer.FunctionalTests/Query/TemporalTableSqlServerTest.cs b/test/EFCore.SqlServer.FunctionalTests/Query/TemporalTableSqlServerTest.cs index 27f7b769e18..7c54ad71ed5 100644 --- a/test/EFCore.SqlServer.FunctionalTests/Query/TemporalTableSqlServerTest.cs +++ b/test/EFCore.SqlServer.FunctionalTests/Query/TemporalTableSqlServerTest.cs @@ -471,7 +471,7 @@ public virtual async Task Temporal_can_query_shared_derived_hierarchy(bool async """ SELECT [v].[Name], [v].[Capacity], [v].[FuelTank_Discriminator], [v].[End], [v].[FuelType], [v].[Start], [v].[GrainGeometry] FROM [Vehicles] FOR SYSTEM_TIME AS OF '2000-01-01T00:00:00.0000000' AS [v] -WHERE ([v].[Capacity] IS NOT NULL) AND ([v].[FuelTank_Discriminator] IS NOT NULL) +WHERE [v].[Capacity] IS NOT NULL AND [v].[FuelTank_Discriminator] IS NOT NULL """); } diff --git a/test/EFCore.SqlServer.FunctionalTests/Query/UdfDbFunctionSqlServerTests.cs b/test/EFCore.SqlServer.FunctionalTests/Query/UdfDbFunctionSqlServerTests.cs index 7ca3199af4f..f06505b1baf 100644 --- a/test/EFCore.SqlServer.FunctionalTests/Query/UdfDbFunctionSqlServerTests.cs +++ b/test/EFCore.SqlServer.FunctionalTests/Query/UdfDbFunctionSqlServerTests.cs @@ -298,7 +298,7 @@ public override void Compare_functions_returning_int_that_take_nullable_param_wh """ 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] """); } @@ -336,7 +336,7 @@ public override void Scalar_Function_with_nested_InExpression_translation() SELECT [c].[Id], [c].[FirstName], [c].[LastName] FROM [Customers] AS [c] WHERE CASE - WHEN SUBSTRING([c].[FirstName], 0 + 1, 1) IN (N'A', N'B', N'C') AND (SUBSTRING([c].[FirstName], 0 + 1, 1) IS NOT NULL) THEN CAST(1 AS bit) + WHEN SUBSTRING([c].[FirstName], 0 + 1, 1) IN (N'A', N'B', N'C') AND SUBSTRING([c].[FirstName], 0 + 1, 1) IS NOT NULL THEN CAST(1 AS bit) ELSE CAST(0 AS bit) END IN (CAST(1 AS bit), CAST(0 AS bit)) """); @@ -936,7 +936,7 @@ public override void Udf_with_argument_being_comparison_of_nullable_columns() SELECT [g].[Count], [g].[CustomerId], [g].[Year] FROM [Addresses] AS [a] CROSS APPLY [dbo].[GetCustomerOrderCountByYearOnlyFrom2000](1, CASE - WHEN ([a].[City] = [a].[State] AND ([a].[City] IS NOT NULL) AND ([a].[State] IS NOT NULL)) OR (([a].[City] IS NULL) AND ([a].[State] IS NULL)) THEN CAST(1 AS bit) + WHEN ([a].[City] = [a].[State] AND [a].[City] IS NOT NULL AND [a].[State] IS NOT NULL) OR ([a].[City] IS NULL AND [a].[State] IS NULL) THEN CAST(1 AS bit) ELSE CAST(0 AS bit) END) AS [g] ORDER BY [a].[Id], [g].[Year] diff --git a/test/EFCore.SqlServer.FunctionalTests/TPTTableSplittingSqlServerTest.cs b/test/EFCore.SqlServer.FunctionalTests/TPTTableSplittingSqlServerTest.cs index d7c4a73f97f..abea81ef11a 100644 --- a/test/EFCore.SqlServer.FunctionalTests/TPTTableSplittingSqlServerTest.cs +++ b/test/EFCore.SqlServer.FunctionalTests/TPTTableSplittingSqlServerTest.cs @@ -139,7 +139,7 @@ public override async Task Can_query_shared_derived_nonhierarchy_all_required() """ SELECT [c].[VehicleName], [c].[Capacity], [c].[FuelType] FROM [CombustionEngines] AS [c] -WHERE ([c].[Capacity] IS NOT NULL) AND ([c].[FuelType] IS NOT NULL) +WHERE [c].[Capacity] IS NOT NULL AND [c].[FuelType] IS NOT NULL """); } diff --git a/test/EFCore.SqlServer.FunctionalTests/TableSplittingSqlServerTest.cs b/test/EFCore.SqlServer.FunctionalTests/TableSplittingSqlServerTest.cs index 8da48de77cb..2131d3b3893 100644 --- a/test/EFCore.SqlServer.FunctionalTests/TableSplittingSqlServerTest.cs +++ b/test/EFCore.SqlServer.FunctionalTests/TableSplittingSqlServerTest.cs @@ -35,12 +35,12 @@ WHEN [t].[Active] IS NOT NULL THEN [t].[Name] LEFT JOIN ( SELECT [v2].[Name], [v2].[Computed], [v2].[Description], [v2].[Engine_Discriminator] FROM [Vehicles] AS [v2] - WHERE ([v2].[Computed] IS NOT NULL) AND ([v2].[Engine_Discriminator] IS NOT NULL) + WHERE [v2].[Computed] IS NOT NULL AND [v2].[Engine_Discriminator] IS NOT NULL ) AS [t0] ON [v].[Name] = [t0].[Name] LEFT JOIN ( SELECT [v3].[Name], [v3].[Capacity], [v3].[FuelTank_Discriminator], [v3].[FuelType], [v3].[GrainGeometry] FROM [Vehicles] AS [v3] - WHERE ([v3].[Capacity] IS NOT NULL) AND ([v3].[FuelTank_Discriminator] IS NOT NULL) + WHERE [v3].[Capacity] IS NOT NULL AND [v3].[FuelTank_Discriminator] IS NOT NULL ) AS [t1] ON [t0].[Name] = [t1].[Name] ORDER BY [v].[Name] """); @@ -87,7 +87,7 @@ public override async Task Can_query_shared_derived_hierarchy() """ SELECT [v].[Name], [v].[Capacity], [v].[FuelTank_Discriminator], [v].[FuelType], [v].[GrainGeometry] FROM [Vehicles] AS [v] -WHERE ([v].[Capacity] IS NOT NULL) AND ([v].[FuelTank_Discriminator] IS NOT NULL) +WHERE [v].[Capacity] IS NOT NULL AND [v].[FuelTank_Discriminator] IS NOT NULL """); } @@ -111,7 +111,7 @@ public override async Task Can_query_shared_derived_nonhierarchy_all_required() """ SELECT [v].[Name], [v].[Capacity], [v].[FuelType] FROM [Vehicles] AS [v] -WHERE ([v].[Capacity] IS NOT NULL) AND ([v].[FuelType] IS NOT NULL) +WHERE [v].[Capacity] IS NOT NULL AND [v].[FuelType] IS NOT NULL """); } diff --git a/test/EFCore.Sqlite.FunctionalTests/Query/GearsOfWarQuerySqliteTest.cs b/test/EFCore.Sqlite.FunctionalTests/Query/GearsOfWarQuerySqliteTest.cs index 4dbe4b83639..80408cd72e0 100644 --- a/test/EFCore.Sqlite.FunctionalTests/Query/GearsOfWarQuerySqliteTest.cs +++ b/test/EFCore.Sqlite.FunctionalTests/Query/GearsOfWarQuerySqliteTest.cs @@ -3585,18 +3585,6 @@ UNION ALL """); } - public override async Task Double_negate_on_column(bool async) - { - await base.Double_negate_on_column(async); - - AssertSql( -""" -SELECT "s"."Id", "s"."Banner", "s"."Banner5", "s"."InternalNumber", "s"."Name" -FROM "Squads" AS "s" -WHERE -(-"s"."Id") = "s"."Id" -"""); - } - public override async Task Join_on_entity_qsre_keys_inner_key_is_nested_navigation(bool async) { await base.Join_on_entity_qsre_keys_inner_key_is_nested_navigation(async);