diff --git a/src/EFCore.Relational/Query/RelationalQueryableMethodTranslatingExpressionVisitor.cs b/src/EFCore.Relational/Query/RelationalQueryableMethodTranslatingExpressionVisitor.cs index b591b6bbef7..242f66eec20 100644 --- a/src/EFCore.Relational/Query/RelationalQueryableMethodTranslatingExpressionVisitor.cs +++ b/src/EFCore.Relational/Query/RelationalQueryableMethodTranslatingExpressionVisitor.cs @@ -874,8 +874,11 @@ protected override ShapedQueryExpression TranslateIntersect(ShapedQueryExpressio var joinPredicate = CreateJoinPredicate(outer, outerKeySelector, inner, innerKeySelector); if (joinPredicate != null) { + var isToOneJoin = IsToOneJoin(inner, innerKeySelector); + var isPrunable = isToOneJoin && IsRequiredStructuralTypeJoin(outer, inner, outerKeySelector, innerKeySelector); var outerSelectExpression = (SelectExpression)outer.QueryExpression; - var outerShaperExpression = outerSelectExpression.AddInnerJoin(inner, joinPredicate, outer.ShaperExpression); + var outerShaperExpression = outerSelectExpression.AddInnerJoin( + inner, joinPredicate, outer.ShaperExpression, isToOneJoin, isPrunable); outer = outer.UpdateShaperExpression(outerShaperExpression); return TranslateTwoParameterSelector(outer, resultSelector); @@ -895,8 +898,10 @@ protected override ShapedQueryExpression TranslateIntersect(ShapedQueryExpressio var joinPredicate = CreateJoinPredicate(outer, outerKeySelector, inner, innerKeySelector); if (joinPredicate != null) { + var isToOneJoin = IsToOneJoin(inner, innerKeySelector); var outerSelectExpression = (SelectExpression)outer.QueryExpression; - var outerShaperExpression = outerSelectExpression.AddLeftJoin(inner, joinPredicate, outer.ShaperExpression); + var outerShaperExpression = outerSelectExpression.AddLeftJoin( + inner, joinPredicate, outer.ShaperExpression, isToOneJoin, isPrunableJoin: isToOneJoin); outer = outer.UpdateShaperExpression(outerShaperExpression); return TranslateTwoParameterSelector(outer, resultSelector); @@ -2401,4 +2406,158 @@ private ShapedQueryExpression CreateShapedQueryExpressionForValuesExpression( [Obsolete( "Extend RelationalTypeMappingPostprocessor instead, and invoke it from RelationalQueryTranslationPostprocessor.ProcessTypeMappings().")] protected class RelationalInferredTypeMappingApplier; + + /// + /// Determines whether a join is guaranteed to produce at least one matching inner row for every outer row. + /// This is detected by checking whether a required foreign key exists between the outer and inner entity types + /// whose properties match the join key selectors. + /// + private static bool IsRequiredStructuralTypeJoin( + ShapedQueryExpression outer, + ShapedQueryExpression inner, + LambdaExpression outerKeySelector, + LambdaExpression innerKeySelector) + { + if (outer.ShaperExpression is not StructuralTypeShaperExpression { StructuralType: IEntityType outerEntityType } + || inner.ShaperExpression is not StructuralTypeShaperExpression { StructuralType: IEntityType innerEntityType }) + { + return false; + } + + var outerKeyProperties = ExtractKeyProperties(outerEntityType, outerKeySelector); + var innerKeyProperties = ExtractKeyProperties(innerEntityType, innerKeySelector); + + if (outerKeyProperties is null || innerKeyProperties is null) + { + return false; + } + + // Case 1: Outer is dependent, inner is principal — FK.IsRequired guarantees every dependent has a principal. + // Case 2: Outer is principal, inner is dependent — FK.IsRequiredDependent guarantees every principal has a dependent. + return HasMatchingRequiredForeignKey( + outerEntityType, innerEntityType, outerKeyProperties, innerKeyProperties, checkIsRequired: true) + || HasMatchingRequiredForeignKey( + innerEntityType, outerEntityType, innerKeyProperties, outerKeyProperties, checkIsRequired: false); + + // Checks whether the dependent entity type has a required FK to the principal whose properties match the key selectors. + // When checkIsRequired is true, checks FK.IsRequired (every dependent has a principal); + // when false, checks FK.IsRequiredDependent (every principal has a dependent). + // The key selector properties may appear in a different order than the FK properties, so we match positionally: + // for each (fkProperty[i], principalKeyProperty[i]) pair, both must appear at the same index in the respective key selectors. + static bool HasMatchingRequiredForeignKey( + IEntityType dependentEntityType, + IEntityType principalEntityType, + IReadOnlyList dependentKeyProperties, + IReadOnlyList principalKeyProperties, + bool checkIsRequired) + { + foreach (var fk in dependentEntityType.GetForeignKeys()) + { + if (fk.PrincipalEntityType == principalEntityType + && (checkIsRequired ? fk.IsRequired : fk.IsRequiredDependent) + && fk.Properties.Count == dependentKeyProperties.Count) + { + for (var i = 0; i < fk.Properties.Count; i++) + { + var dependentIndex = dependentKeyProperties.IndexOf(fk.Properties[i]); + if (dependentIndex == -1 + || dependentIndex >= principalKeyProperties.Count + || principalKeyProperties[dependentIndex] != fk.PrincipalKey.Properties[i]) + { + goto NextForeignKey; + } + } + + return true; + + NextForeignKey:; + } + } + + return false; + } + } + + /// + /// Determines whether a join is guaranteed to match at most one inner row per outer row (a "to-one" join). + /// This is detected by checking whether the inner key selector's properties form a primary/alternate key + /// or are covered by a unique index on the inner entity type. + /// + private static bool IsToOneJoin(ShapedQueryExpression inner, LambdaExpression innerKeySelector) + { + if (inner.ShaperExpression is not StructuralTypeShaperExpression { StructuralType: IEntityType entityType }) + { + return false; + } + + var keyProperties = ExtractKeyProperties(entityType, innerKeySelector); + if (keyProperties is null) + { + return false; + } + + // Check if the inner key properties form a primary or alternate key. + if (entityType.FindKey(keyProperties) is not null) + { + return true; + } + + // Check if the inner key properties are covered by a unique index (e.g. unique FK in a 1:1 relationship). + foreach (var index in entityType.GetIndexes()) + { + if (index.IsUnique && index.Properties.SequenceEqual(keyProperties)) + { + return true; + } + } + + return false; + } + + /// + /// Extracts the instances referenced by the inner key selector lambda. + /// Returns if properties cannot be determined. + /// + private static IReadOnlyList? ExtractKeyProperties( + IEntityType entityType, + LambdaExpression innerKeySelector) + { + switch (innerKeySelector.Body.UnwrapTypeConversion(out _)) + { + // Composite key: new[] { Convert(EF.Property(...)), ... } + case NewArrayExpression { NodeType: ExpressionType.NewArrayInit } newArray: + { + var properties = new IReadOnlyProperty[newArray.Expressions.Count]; + for (var i = 0; i < newArray.Expressions.Count; i++) + { + var property = ExtractSingleKeyProperty(entityType, newArray.Expressions[i].UnwrapTypeConversion(out _)); + if (property is null) + { + return null; + } + + properties[i] = property; + } + + return properties; + } + + // Single key + case var e when ExtractSingleKeyProperty(entityType, e) is IProperty singleProperty: + return [singleProperty]; + + default: + return null; + } + + static IReadOnlyProperty? ExtractSingleKeyProperty(IEntityType entityType, Expression expression) + { + expression = expression.UnwrapTypeConversion(out _); + + return Infrastructure.ExpressionExtensions.IsMemberAccess(expression, entityType.Model, out _, out var memberIdentity) + && memberIdentity.Name is not null + ? entityType.FindProperty(memberIdentity.Name) + : null; + } + } } diff --git a/src/EFCore.Relational/Query/SqlExpressions/SelectExpression.cs b/src/EFCore.Relational/Query/SqlExpressions/SelectExpression.cs index 2efcd67ecf8..bc326516e97 100644 --- a/src/EFCore.Relational/Query/SqlExpressions/SelectExpression.cs +++ b/src/EFCore.Relational/Query/SqlExpressions/SelectExpression.cs @@ -896,7 +896,11 @@ static void UpdateLimit(SelectExpression selectExpression) innerShaperExpression); } - AddJoin(JoinType.OuterApply, ref innerSelectExpression, out _); + // Single-result (to-one) joins never increase result cardinality, so the outer entity's + // identifiers are already sufficient to uniquely identify rows. We don't need to add the + // inner's identifiers to our own; doing so would cause unnecessary reference table JOINs, + // ORDER BY columns, and projections in split collection queries (#29182). + AddJoin(JoinType.OuterApply, ref innerSelectExpression, out _, isToOneJoin: true, isPrunableJoin: true); var offset = _clientProjections.Count; var count = innerSelectExpression._clientProjections.Count; @@ -2899,9 +2903,11 @@ private Expression AddJoin( SelectExpression innerSelect, Expression outerShaper, Expression innerShaper, - SqlExpression? joinPredicate = null) + SqlExpression? joinPredicate = null, + bool isToOneJoin = false, + bool isPrunableJoin = false) { - AddJoin(joinType, ref innerSelect, out _, joinPredicate); + AddJoin(joinType, ref innerSelect, out _, joinPredicate, isToOneJoin, isPrunableJoin); var transparentIdentifierType = TransparentIdentifierFactory.Create(outerShaper.Type, innerShaper.Type); var outerMemberInfo = transparentIdentifierType.GetTypeInfo().GetDeclaredField("Outer")!; @@ -3018,7 +3024,9 @@ private void AddJoin( JoinType joinType, ref SelectExpression innerSelect, out bool innerPushdownOccurred, - SqlExpression? joinPredicate = null) + SqlExpression? joinPredicate = null, + bool isToOneJoin = false, + bool isPrunableJoin = false) { innerPushdownOccurred = false; // Try to convert Apply to normal join @@ -3099,7 +3107,9 @@ private void AddJoin( joinType == JoinType.CrossApply ? JoinType.InnerJoin : JoinType.LeftJoin, ref innerSelect, out innerPushdownOccurred, - joinPredicate); + joinPredicate, + isToOneJoin, + isPrunableJoin); return; } @@ -3153,8 +3163,19 @@ private void AddJoin( innerPushdownOccurred = true; } - if (_identifier.Count > 0 && innerSelect._identifier.Count > 0) + // If this is a to-one join, then we know that it doesn't increase cardinality — the outer identifiers are already sufficient. + // Skipping the inner's identifiers avoids unnecessary ORDER BY columns and projections (#29182). + if (_identifier.Count == 0 || innerSelect._identifier.Count == 0) { + // Either the outer and inner sides aren't uniquely identifiable; mark everything as non-uniquely-identifiable. + _identifier.Clear(); + innerSelect._identifier.Clear(); + } + else if (!isToOneJoin || joinType is JoinType.RightJoin) + { + // This is cardinality-increasing join - add identifiers from the inner. + // Note that we do the same for right joins, since these make the outer identifiers nullable; that could mean that + // multiple inner rows get the same NULL identifier. switch (joinType) { case JoinType.LeftJoin or JoinType.OuterApply: @@ -3162,9 +3183,13 @@ private void AddJoin( break; case JoinType.RightJoin: - var nullableOuterIdentifier = _identifier.Select(e => (e.Column.MakeNullable(), e.Comparer)).ToList(); - _identifier.Clear(); - _identifier.AddRange(nullableOuterIdentifier); + // Make the outer identifiers nullable, then add the inner identifiers + for (var i = 0; i < _identifier.Count; i++) + { + var identifier = _identifier[i]; + _identifier[i] = (identifier.Column.MakeNullable(), identifier.Comparer); + } + _identifier.AddRange(innerSelect._identifier); break; @@ -3173,19 +3198,12 @@ private void AddJoin( break; } } - else - { - // if the subquery that is joined to can't be uniquely identified - // then the entire join should also not be marked as non-identifiable - _identifier.Clear(); - innerSelect._identifier.Clear(); - } var innerTable = innerSelect.Tables.Single(); var joinTable = joinType switch { - JoinType.InnerJoin => new InnerJoinExpression(innerTable, joinPredicate!), - JoinType.LeftJoin => new LeftJoinExpression(innerTable, joinPredicate!), + JoinType.InnerJoin => new InnerJoinExpression(innerTable, joinPredicate!, isPrunableJoin), + JoinType.LeftJoin => new LeftJoinExpression(innerTable, joinPredicate!, isPrunableJoin), JoinType.RightJoin => new RightJoinExpression(innerTable, joinPredicate!), JoinType.CrossJoin => new CrossJoinExpression(innerTable), JoinType.CrossApply => new CrossApplyExpression(innerTable), @@ -3548,14 +3566,24 @@ public void AddOuterApply(SelectExpression innerSelectExpression) /// A to join with. /// A predicate to use for the join. /// An expression for outer shaper. + /// + /// Whether each outer row is guaranteed to match at most one inner row. When , inner identifiers + /// are not added (#29182). + /// + /// + /// Whether the join can be pruned if none of its columns are referenced. For INNER JOINs this requires both + /// a to-one guarantee and a required foreign key guaranteeing matching rows exist (#29182). + /// /// An expression which shapes the result of this join. public Expression AddInnerJoin( ShapedQueryExpression innerSource, SqlExpression joinPredicate, - Expression outerShaper) + Expression outerShaper, + bool isToOneJoin = false, + bool isPrunableJoin = false) => AddJoin( JoinType.InnerJoin, (SelectExpression)innerSource.QueryExpression, outerShaper, innerSource.ShaperExpression, - joinPredicate); + joinPredicate, isToOneJoin, isPrunableJoin); /// /// Adds the query expression of the given to table sources using LEFT JOIN and combine shapers. @@ -3563,13 +3591,23 @@ public Expression AddInnerJoin( /// A to join with. /// A predicate to use for the join. /// An expression for outer shaper. + /// + /// Whether each outer row is guaranteed to match at most one inner row. When , inner identifiers + /// are not added. + /// + /// + /// Whether the join can be pruned if none of its columns are referenced (#29182). + /// /// An expression which shapes the result of this join. public Expression AddLeftJoin( ShapedQueryExpression innerSource, SqlExpression joinPredicate, - Expression outerShaper) + Expression outerShaper, + bool isToOneJoin = false, + bool isPrunableJoin = false) => AddJoin( - JoinType.LeftJoin, (SelectExpression)innerSource.QueryExpression, outerShaper, innerSource.ShaperExpression, joinPredicate); + JoinType.LeftJoin, (SelectExpression)innerSource.QueryExpression, outerShaper, innerSource.ShaperExpression, + joinPredicate, isToOneJoin, isPrunableJoin); /// /// Adds the query expression of the given to table sources using RIGHT JOIN and combine shapers. diff --git a/test/EFCore.SqlServer.FunctionalTests/BulkUpdates/NonSharedModelBulkUpdatesSqlServerTest.cs b/test/EFCore.SqlServer.FunctionalTests/BulkUpdates/NonSharedModelBulkUpdatesSqlServerTest.cs index e76944c94ec..643f4c3b69f 100644 --- a/test/EFCore.SqlServer.FunctionalTests/BulkUpdates/NonSharedModelBulkUpdatesSqlServerTest.cs +++ b/test/EFCore.SqlServer.FunctionalTests/BulkUpdates/NonSharedModelBulkUpdatesSqlServerTest.cs @@ -165,7 +165,6 @@ public override async Task Delete_entity_with_auto_include(bool async) """ DELETE FROM [c] FROM [Context30572_Principal] AS [c] -LEFT JOIN [Context30572_Dependent] AS [c0] ON [c].[DependentId] = [c0].[Id] """); } diff --git a/test/EFCore.SqlServer.FunctionalTests/BulkUpdates/NorthwindBulkUpdatesSqlServerTest.cs b/test/EFCore.SqlServer.FunctionalTests/BulkUpdates/NorthwindBulkUpdatesSqlServerTest.cs index 892a5f04bc8..dceebdc2e9d 100644 --- a/test/EFCore.SqlServer.FunctionalTests/BulkUpdates/NorthwindBulkUpdatesSqlServerTest.cs +++ b/test/EFCore.SqlServer.FunctionalTests/BulkUpdates/NorthwindBulkUpdatesSqlServerTest.cs @@ -532,18 +532,8 @@ public override async Task Delete_with_LeftJoin(bool async) AssertSql( """ -@p='0' -@p1='100' - DELETE FROM [o] FROM [Order Details] AS [o] -LEFT JOIN ( - SELECT [o0].[OrderID] - FROM [Orders] AS [o0] - WHERE [o0].[OrderID] < 10300 - ORDER BY [o0].[OrderID] - OFFSET @p ROWS FETCH NEXT @p1 ROWS ONLY -) AS [o1] ON [o].[OrderID] = [o1].[OrderID] WHERE [o].[OrderID] < 10276 """); } @@ -554,18 +544,8 @@ public override async Task Delete_with_LeftJoin_via_flattened_GroupJoin(bool asy AssertSql( """ -@p='0' -@p1='100' - DELETE FROM [o] FROM [Order Details] AS [o] -LEFT JOIN ( - SELECT [o0].[OrderID] - FROM [Orders] AS [o0] - WHERE [o0].[OrderID] < 10300 - ORDER BY [o0].[OrderID] - OFFSET @p ROWS FETCH NEXT @p1 ROWS ONLY -) AS [o1] ON [o].[OrderID] = [o1].[OrderID] WHERE [o].[OrderID] < 10276 """); } diff --git a/test/EFCore.SqlServer.FunctionalTests/ManyToManyFieldsLoadSqlServerTest.cs b/test/EFCore.SqlServer.FunctionalTests/ManyToManyFieldsLoadSqlServerTest.cs index 554b85a74d8..12200a91e99 100644 --- a/test/EFCore.SqlServer.FunctionalTests/ManyToManyFieldsLoadSqlServerTest.cs +++ b/test/EFCore.SqlServer.FunctionalTests/ManyToManyFieldsLoadSqlServerTest.cs @@ -33,7 +33,7 @@ FROM [JoinOneToTwo] AS [j0] WHERE [e1].[Id] = @p ) AS [s0] ON [s].[Id] = [s0].[TwoId] WHERE [e].[Id] = @p -ORDER BY [e].[Id], [s].[OneId], [s].[TwoId], [s].[Id], [s0].[OneId], [s0].[TwoId] +ORDER BY [e].[Id], [s].[OneId], [s].[TwoId], [s0].[OneId] """); } @@ -59,7 +59,7 @@ FROM [EntityOneEntityTwo] AS [e2] WHERE [e3].[Id] = @p ) AS [s0] ON [s].[Id] = [s0].[TwoSkipSharedId] WHERE [e].[Id] = @p -ORDER BY [e].[Id], [s].[OneSkipSharedId], [s].[TwoSkipSharedId], [s].[Id], [s0].[OneSkipSharedId], [s0].[TwoSkipSharedId] +ORDER BY [e].[Id], [s].[OneSkipSharedId], [s].[TwoSkipSharedId], [s0].[OneSkipSharedId] """); } @@ -90,7 +90,7 @@ FROM [EntityOneEntityTwo] AS [e4] WHERE [e3].[Id] = @p ) AS [s1] ON [s].[Id] = [s1].[TwoSkipSharedId] WHERE [e].[Id] = @p -ORDER BY [e].[Id], [s].[OneSkipSharedId], [s].[TwoSkipSharedId], [s].[Id], [s1].[OneSkipSharedId], [s1].[TwoSkipSharedId], [s1].[Id], [s1].[OneSkipSharedId0], [s1].[TwoSkipSharedId0] +ORDER BY [e].[Id], [s].[OneSkipSharedId], [s].[TwoSkipSharedId], [s1].[OneSkipSharedId], [s1].[TwoSkipSharedId], [s1].[OneSkipSharedId0] """); } @@ -121,7 +121,7 @@ FROM [JoinTwoToThree] AS [j] INNER JOIN [EntityThrees] AS [e4] ON [j].[ThreeId] = [e4].[Id] ) AS [s1] ON [s].[Id] = [s1].[TwoId] WHERE [e].[Id] = @p -ORDER BY [e].[Id], [s].[OneSkipSharedId], [s].[TwoSkipSharedId], [s].[Id], [s0].[OneSkipSharedId], [s0].[TwoSkipSharedId], [s0].[Id], [s1].[ThreeId], [s1].[TwoId] +ORDER BY [e].[Id], [s].[OneSkipSharedId], [s].[TwoSkipSharedId], [s0].[OneSkipSharedId], [s0].[TwoSkipSharedId], [s1].[ThreeId] """); } @@ -153,7 +153,7 @@ FROM [JoinTwoToThree] AS [j] WHERE [e4].[Id] IN (13, 11) ) AS [s1] ON [s].[Id] = [s1].[TwoId] WHERE [e].[Id] = @p -ORDER BY [e].[Id], [s].[OneSkipSharedId], [s].[TwoSkipSharedId], [s].[Id], [s0].[OneSkipSharedId], [s0].[TwoSkipSharedId], [s0].[Id], [s1].[ThreeId], [s1].[TwoId] +ORDER BY [e].[Id], [s].[OneSkipSharedId], [s].[TwoSkipSharedId], [s0].[OneSkipSharedId], [s0].[TwoSkipSharedId], [s1].[ThreeId] """); } @@ -168,11 +168,9 @@ public override async Task Load_collection_using_Query_with_filtered_Include_and SELECT [s].[Id], [s].[Name], ( SELECT COUNT(*) FROM [EntityOneEntityTwo] AS [e2] - INNER JOIN [EntityOnes] AS [e3] ON [e2].[OneSkipSharedId] = [e3].[Id] WHERE [s].[Id] = [e2].[TwoSkipSharedId]) AS [Count1], ( SELECT COUNT(*) FROM [JoinTwoToThree] AS [j] - INNER JOIN [EntityThrees] AS [e4] ON [j].[ThreeId] = [e4].[Id] WHERE [s].[Id] = [j].[TwoId]) AS [Count3] FROM [EntityOnes] AS [e] INNER JOIN ( @@ -193,7 +191,7 @@ public override async Task Load_collection_using_Query_with_join(bool async) """ @p='3' -SELECT [s].[Id], [s].[CollectionInverseId], [s].[Name], [s].[ReferenceInverseId], [e].[Id], [s].[OneSkipSharedId], [s].[TwoSkipSharedId], [s1].[Id], [s1].[OneSkipSharedId], [s1].[TwoSkipSharedId], [s1].[Id0], [s2].[OneSkipSharedId], [s2].[TwoSkipSharedId], [s2].[Id], [s2].[Name], [s1].[CollectionInverseId], [s1].[Name0], [s1].[ReferenceInverseId] +SELECT [s].[Id], [s].[CollectionInverseId], [s].[Name], [s].[ReferenceInverseId], [e].[Id], [s].[OneSkipSharedId], [s].[TwoSkipSharedId], [s1].[Id], [s1].[OneSkipSharedId], [s1].[TwoSkipSharedId], [s2].[OneSkipSharedId], [s2].[TwoSkipSharedId], [s2].[Id], [s2].[Name], [s1].[Id0], [s1].[CollectionInverseId], [s1].[Name0], [s1].[ReferenceInverseId] FROM [EntityOnes] AS [e] INNER JOIN ( SELECT [e1].[Id], [e1].[CollectionInverseId], [e1].[Name], [e1].[ReferenceInverseId], [e0].[OneSkipSharedId], [e0].[TwoSkipSharedId] @@ -216,7 +214,7 @@ FROM [EntityOneEntityTwo] AS [e5] WHERE [e6].[Id] = @p ) AS [s2] ON [s].[Id] = [s2].[TwoSkipSharedId] WHERE [e].[Id] = @p -ORDER BY [e].[Id], [s].[OneSkipSharedId], [s].[TwoSkipSharedId], [s].[Id], [s1].[Id], [s1].[OneSkipSharedId], [s1].[TwoSkipSharedId], [s1].[Id0], [s2].[OneSkipSharedId], [s2].[TwoSkipSharedId] +ORDER BY [e].[Id], [s].[OneSkipSharedId], [s].[TwoSkipSharedId], [s1].[Id], [s1].[OneSkipSharedId], [s1].[TwoSkipSharedId], [s2].[OneSkipSharedId] """); } diff --git a/test/EFCore.SqlServer.FunctionalTests/ManyToManyLoadSqlServerTest.cs b/test/EFCore.SqlServer.FunctionalTests/ManyToManyLoadSqlServerTest.cs index b124d84d20a..e006f60eb02 100644 --- a/test/EFCore.SqlServer.FunctionalTests/ManyToManyLoadSqlServerTest.cs +++ b/test/EFCore.SqlServer.FunctionalTests/ManyToManyLoadSqlServerTest.cs @@ -33,7 +33,7 @@ FROM [JoinOneToTwo] AS [j0] WHERE [e1].[Id] = @p ) AS [s0] ON [s].[Id] = [s0].[TwoId] WHERE [e].[Id] = @p -ORDER BY [e].[Id], [s].[OneId], [s].[TwoId], [s].[Id], [s0].[OneId], [s0].[TwoId] +ORDER BY [e].[Id], [s].[OneId], [s].[TwoId], [s0].[OneId] """ : """ @p='3' @@ -52,7 +52,7 @@ FROM [JoinOneToTwo] AS [j0] WHERE [e1].[Id] = @p ) AS [s0] ON [s].[Id] = [s0].[TwoId] WHERE [e].[Id] = @p -ORDER BY [e].[Id], [s].[OneId], [s].[TwoId], [s].[Id], [s0].[OneId], [s0].[TwoId] +ORDER BY [e].[Id], [s].[OneId], [s].[TwoId], [s0].[OneId] """); } @@ -78,7 +78,7 @@ FROM [EntityOneEntityTwo] AS [e2] WHERE [e3].[Id] = @p ) AS [s0] ON [s].[Id] = [s0].[TwoSkipSharedId] WHERE [e].[Id] = @p -ORDER BY [e].[Id], [s].[OneSkipSharedId], [s].[TwoSkipSharedId], [s].[Id], [s0].[OneSkipSharedId], [s0].[TwoSkipSharedId] +ORDER BY [e].[Id], [s].[OneSkipSharedId], [s].[TwoSkipSharedId], [s0].[OneSkipSharedId] """); } @@ -109,7 +109,7 @@ FROM [EntityOneEntityTwo] AS [e4] WHERE [e3].[Id] = @p ) AS [s1] ON [s].[Id] = [s1].[TwoSkipSharedId] WHERE [e].[Id] = @p -ORDER BY [e].[Id], [s].[OneSkipSharedId], [s].[TwoSkipSharedId], [s].[Id], [s1].[OneSkipSharedId], [s1].[TwoSkipSharedId], [s1].[Id], [s1].[OneSkipSharedId0], [s1].[TwoSkipSharedId0] +ORDER BY [e].[Id], [s].[OneSkipSharedId], [s].[TwoSkipSharedId], [s1].[OneSkipSharedId], [s1].[TwoSkipSharedId], [s1].[OneSkipSharedId0] """); } @@ -140,7 +140,7 @@ FROM [JoinTwoToThree] AS [j] INNER JOIN [EntityThrees] AS [e4] ON [j].[ThreeId] = [e4].[Id] ) AS [s1] ON [s].[Id] = [s1].[TwoId] WHERE [e].[Id] = @p -ORDER BY [e].[Id], [s].[OneSkipSharedId], [s].[TwoSkipSharedId], [s].[Id], [s0].[OneSkipSharedId], [s0].[TwoSkipSharedId], [s0].[Id], [s1].[ThreeId], [s1].[TwoId] +ORDER BY [e].[Id], [s].[OneSkipSharedId], [s].[TwoSkipSharedId], [s0].[OneSkipSharedId], [s0].[TwoSkipSharedId], [s1].[ThreeId] """); } @@ -172,7 +172,7 @@ FROM [JoinTwoToThree] AS [j] WHERE [e4].[Id] IN (13, 11) ) AS [s1] ON [s].[Id] = [s1].[TwoId] WHERE [e].[Id] = @p -ORDER BY [e].[Id], [s].[OneSkipSharedId], [s].[TwoSkipSharedId], [s].[Id], [s0].[OneSkipSharedId], [s0].[TwoSkipSharedId], [s0].[Id], [s1].[ThreeId], [s1].[TwoId] +ORDER BY [e].[Id], [s].[OneSkipSharedId], [s].[TwoSkipSharedId], [s0].[OneSkipSharedId], [s0].[TwoSkipSharedId], [s1].[ThreeId] """); } @@ -187,11 +187,9 @@ public override async Task Load_collection_using_Query_with_filtered_Include_and SELECT [s].[Id], [s].[Name], ( SELECT COUNT(*) FROM [EntityOneEntityTwo] AS [e2] - INNER JOIN [EntityOnes] AS [e3] ON [e2].[OneSkipSharedId] = [e3].[Id] WHERE [s].[Id] = [e2].[TwoSkipSharedId]) AS [Count1], ( SELECT COUNT(*) FROM [JoinTwoToThree] AS [j] - INNER JOIN [EntityThrees] AS [e4] ON [j].[ThreeId] = [e4].[Id] WHERE [s].[Id] = [j].[TwoId]) AS [Count3] FROM [EntityOnes] AS [e] INNER JOIN ( @@ -212,7 +210,7 @@ public override async Task Load_collection_using_Query_with_join(bool async) """ @p='3' -SELECT [s].[Id], [s].[CollectionInverseId], [s].[ExtraId], [s].[Name], [s].[ReferenceInverseId], [e].[Id], [s].[OneSkipSharedId], [s].[TwoSkipSharedId], [s1].[Id], [s1].[OneSkipSharedId], [s1].[TwoSkipSharedId], [s1].[Id0], [s2].[OneSkipSharedId], [s2].[TwoSkipSharedId], [s2].[Id], [s2].[Name], [s1].[CollectionInverseId], [s1].[ExtraId], [s1].[Name0], [s1].[ReferenceInverseId] +SELECT [s].[Id], [s].[CollectionInverseId], [s].[ExtraId], [s].[Name], [s].[ReferenceInverseId], [e].[Id], [s].[OneSkipSharedId], [s].[TwoSkipSharedId], [s1].[Id], [s1].[OneSkipSharedId], [s1].[TwoSkipSharedId], [s2].[OneSkipSharedId], [s2].[TwoSkipSharedId], [s2].[Id], [s2].[Name], [s1].[Id0], [s1].[CollectionInverseId], [s1].[ExtraId], [s1].[Name0], [s1].[ReferenceInverseId] FROM [EntityOnes] AS [e] INNER JOIN ( SELECT [e1].[Id], [e1].[CollectionInverseId], [e1].[ExtraId], [e1].[Name], [e1].[ReferenceInverseId], [e0].[OneSkipSharedId], [e0].[TwoSkipSharedId] @@ -235,7 +233,7 @@ FROM [EntityOneEntityTwo] AS [e5] WHERE [e6].[Id] = @p ) AS [s2] ON [s].[Id] = [s2].[TwoSkipSharedId] WHERE [e].[Id] = @p -ORDER BY [e].[Id], [s].[OneSkipSharedId], [s].[TwoSkipSharedId], [s].[Id], [s1].[Id], [s1].[OneSkipSharedId], [s1].[TwoSkipSharedId], [s1].[Id0], [s2].[OneSkipSharedId], [s2].[TwoSkipSharedId] +ORDER BY [e].[Id], [s].[OneSkipSharedId], [s].[TwoSkipSharedId], [s1].[Id], [s1].[OneSkipSharedId], [s1].[TwoSkipSharedId], [s2].[OneSkipSharedId] """); } diff --git a/test/EFCore.SqlServer.FunctionalTests/Query/AdHocManyToManyQuerySqlServerTest.cs b/test/EFCore.SqlServer.FunctionalTests/Query/AdHocManyToManyQuerySqlServerTest.cs index 521ab49a063..475cc2ef13c 100644 --- a/test/EFCore.SqlServer.FunctionalTests/Query/AdHocManyToManyQuerySqlServerTest.cs +++ b/test/EFCore.SqlServer.FunctionalTests/Query/AdHocManyToManyQuerySqlServerTest.cs @@ -67,7 +67,7 @@ FROM [ManyMN_DB] AS [m2] WHERE [m3].[Id] = @p ) AS [s0] ON [s].[Id] = [s0].[ManyN_Id] WHERE [m].[Id] = @p -ORDER BY [m].[Id], [s].[Id0], [s].[Id], [s0].[Id] +ORDER BY [m].[Id], [s].[Id0] """, // """ @@ -95,7 +95,7 @@ FROM [ManyMN_DB] AS [m2] WHERE [m3].[Id] = @p ) AS [s0] ON [s].[Id] = [s0].[ManyM_Id] WHERE [m].[Id] = @p -ORDER BY [m].[Id], [s].[Id0], [s].[Id], [s0].[Id] +ORDER BY [m].[Id], [s].[Id0] """); } } diff --git a/test/EFCore.SqlServer.FunctionalTests/Query/AdHocNavigationsQuerySqlServerTest.cs b/test/EFCore.SqlServer.FunctionalTests/Query/AdHocNavigationsQuerySqlServerTest.cs index 05f3482a874..e23161d0540 100644 --- a/test/EFCore.SqlServer.FunctionalTests/Query/AdHocNavigationsQuerySqlServerTest.cs +++ b/test/EFCore.SqlServer.FunctionalTests/Query/AdHocNavigationsQuerySqlServerTest.cs @@ -210,7 +210,7 @@ FROM [People] AS [p0] WHERE [p0].[Discriminator] = N'PersonKid9038' ) AS [s] ON [p].[Id] = [s].[TeacherId] WHERE [p].[Discriminator] = N'PersonTeacher9038' -ORDER BY [p].[Id], [s].[Id], [s].[Id0] +ORDER BY [p].[Id], [s].[Id] """, // """ @@ -224,7 +224,7 @@ FROM [People] AS [p1] WHERE [p1].[Discriminator] = N'PersonKid9038' ) AS [p2] ON [p].[Id] = [p2].[TeacherId] WHERE [p].[Discriminator] = N'PersonTeacher9038' -ORDER BY [p].[Id], [f].[Id], [p0].[Id] +ORDER BY [p].[Id], [p0].[Id] """); } @@ -318,11 +318,11 @@ public override async Task Let_multiple_references_with_reference_to_outer() SELECT ( SELECT TOP(1) [c].[Id] FROM [CompetitionSeasons] AS [c] - WHERE [c].[StartDate] <= [a].[DateTime] AND [a].[DateTime] < [c].[EndDate]), [a].[Id], [a0].[Id], [s].[Id], [s].[ActivityTypeId], [s].[CompetitionSeasonId], [s].[Points], [s].[Id0] + WHERE [c].[StartDate] <= [a].[DateTime] AND [a].[DateTime] < [c].[EndDate]), [a].[Id], [s].[Id], [s].[ActivityTypeId], [s].[CompetitionSeasonId], [s].[Points] FROM [Activities] AS [a] INNER JOIN [ActivityType] AS [a0] ON [a].[ActivityTypeId] = [a0].[Id] OUTER APPLY ( - SELECT [a1].[Id], [a1].[ActivityTypeId], [a1].[CompetitionSeasonId], [a1].[Points], [c0].[Id] AS [Id0] + SELECT [a1].[Id], [a1].[ActivityTypeId], [a1].[CompetitionSeasonId], [a1].[Points] FROM [ActivityTypePoints] AS [a1] INNER JOIN [CompetitionSeasons] AS [c0] ON [a1].[CompetitionSeasonId] = [c0].[Id] WHERE [a0].[Id] = [a1].[ActivityTypeId] AND [c0].[Id] = ( @@ -330,7 +330,7 @@ SELECT TOP(1) [c1].[Id] FROM [CompetitionSeasons] AS [c1] WHERE [c1].[StartDate] <= [a].[DateTime] AND [a].[DateTime] < [c1].[EndDate]) ) AS [s] -ORDER BY [a].[Id], [a0].[Id], [s].[Id] +ORDER BY [a].[Id] """, // """ @@ -512,7 +512,7 @@ ORDER BY [p].[Id] FROM [DependentOneToMany] AS [d] INNER JOIN [PrincipalOneToMany] AS [p] ON [d].[PrincipalId] = [p].[Id] LEFT JOIN [DependentOneToMany] AS [d0] ON [p].[Id] = [d0].[PrincipalId] -ORDER BY [d].[Id], [p].[Id] +ORDER BY [d].[Id] """, // """ @@ -569,7 +569,7 @@ LEFT JOIN ( FROM [ManyDependent] AS [m0] LEFT JOIN [SingleDependent] AS [s] ON [m0].[Id] = [s].[ManyDependentId] ) AS [s0] ON [p].[Id] = [s0].[PrincipalId] -ORDER BY [m].[Id], [p].[Id], [s0].[Id] +ORDER BY [m].[Id] """); } @@ -588,7 +588,7 @@ public override async Task Projection_with_multiple_includes_and_subquery_with_s """ @id='1' -SELECT [s].[Id], [s].[Name], [s].[Surname], [s].[Birthday], [s].[Hometown], [s].[Bio], [s].[AvatarUrl], [s].[Id0], [s].[Id1], [p0].[Id], [p0].[ImageUrl], [p0].[Height], [p0].[Width], [u].[Id], [u].[Name], [u].[PosterUrl], [u].[Rating] +SELECT [s].[Id], [s].[Name], [s].[Surname], [s].[Birthday], [s].[Hometown], [s].[Bio], [s].[AvatarUrl], [p0].[Id], [p0].[ImageUrl], [p0].[Height], [p0].[Width], [u].[Id], [u].[Name], [u].[PosterUrl], [u].[Rating] FROM ( SELECT TOP(1) [p].[Id], [p].[Name], [p].[Surname], [p].[Birthday], [p].[Hometown], [p].[Bio], [p].[AvatarUrl], [a].[Id] AS [Id0], [d].[Id] AS [Id1] FROM [Persons] AS [p] @@ -608,7 +608,7 @@ FROM [MovieDirectorEntity] AS [m1] INNER JOIN [MovieEntity] AS [m2] ON [m1].[MovieId] = [m2].[Id] WHERE [s].[Id1] IS NOT NULL AND [s].[Id1] = [m1].[DirectorId] ) AS [u] -ORDER BY [s].[Id], [s].[Id0], [s].[Id1], [p0].[Id] +ORDER BY [s].[Id], [p0].[Id] """); } diff --git a/test/EFCore.SqlServer.FunctionalTests/Query/Associations/Navigations/NavigationsCollectionSqlServerTest.cs b/test/EFCore.SqlServer.FunctionalTests/Query/Associations/Navigations/NavigationsCollectionSqlServerTest.cs index 4d672656a85..89fc2fd761c 100644 --- a/test/EFCore.SqlServer.FunctionalTests/Query/Associations/Navigations/NavigationsCollectionSqlServerTest.cs +++ b/test/EFCore.SqlServer.FunctionalTests/Query/Associations/Navigations/NavigationsCollectionSqlServerTest.cs @@ -12,7 +12,7 @@ public override async Task Count() AssertSql( """ -SELECT [r].[Id], [r].[Name], [r].[OptionalAssociateId], [r].[RequiredAssociateId], [a0].[Id], [n].[Id], [n0].[Id], [a1].[Id], [n1].[Id], [n2].[Id], [s].[Id], [s].[CollectionRootId], [s].[Int], [s].[Ints], [s].[Name], [s].[OptionalNestedAssociateId], [s].[RequiredNestedAssociateId], [s].[String], [s].[Id0], [s].[Id1], [s].[Id2], [s].[CollectionAssociateId], [s].[Int0], [s].[Ints0], [s].[Name0], [s].[String0], [s].[CollectionAssociateId0], [s].[Int1], [s].[Ints1], [s].[Name1], [s].[String1], [s].[CollectionAssociateId1], [s].[Int2], [s].[Ints2], [s].[Name2], [s].[String2], [a0].[CollectionRootId], [a0].[Int], [a0].[Ints], [a0].[Name], [a0].[OptionalNestedAssociateId], [a0].[RequiredNestedAssociateId], [a0].[String], [n6].[Id], [n6].[CollectionAssociateId], [n6].[Int], [n6].[Ints], [n6].[Name], [n6].[String], [n].[CollectionAssociateId], [n].[Int], [n].[Ints], [n].[Name], [n].[String], [n0].[CollectionAssociateId], [n0].[Int], [n0].[Ints], [n0].[Name], [n0].[String], [a1].[CollectionRootId], [a1].[Int], [a1].[Ints], [a1].[Name], [a1].[OptionalNestedAssociateId], [a1].[RequiredNestedAssociateId], [a1].[String], [n7].[Id], [n7].[CollectionAssociateId], [n7].[Int], [n7].[Ints], [n7].[Name], [n7].[String], [n1].[CollectionAssociateId], [n1].[Int], [n1].[Ints], [n1].[Name], [n1].[String], [n2].[CollectionAssociateId], [n2].[Int], [n2].[Ints], [n2].[Name], [n2].[String] +SELECT [r].[Id], [r].[Name], [r].[OptionalAssociateId], [r].[RequiredAssociateId], [s].[Id], [s].[CollectionRootId], [s].[Int], [s].[Ints], [s].[Name], [s].[OptionalNestedAssociateId], [s].[RequiredNestedAssociateId], [s].[String], [s].[Id0], [s].[CollectionAssociateId], [s].[Int0], [s].[Ints0], [s].[Name0], [s].[String0], [s].[Id1], [s].[CollectionAssociateId0], [s].[Int1], [s].[Ints1], [s].[Name1], [s].[String1], [s].[Id2], [s].[CollectionAssociateId1], [s].[Int2], [s].[Ints2], [s].[Name2], [s].[String2], [a0].[Id], [a0].[CollectionRootId], [a0].[Int], [a0].[Ints], [a0].[Name], [a0].[OptionalNestedAssociateId], [a0].[RequiredNestedAssociateId], [a0].[String], [n6].[Id], [n6].[CollectionAssociateId], [n6].[Int], [n6].[Ints], [n6].[Name], [n6].[String], [n].[Id], [n].[CollectionAssociateId], [n].[Int], [n].[Ints], [n].[Name], [n].[String], [n0].[Id], [n0].[CollectionAssociateId], [n0].[Int], [n0].[Ints], [n0].[Name], [n0].[String], [a1].[Id], [a1].[CollectionRootId], [a1].[Int], [a1].[Ints], [a1].[Name], [a1].[OptionalNestedAssociateId], [a1].[RequiredNestedAssociateId], [a1].[String], [n7].[Id], [n7].[CollectionAssociateId], [n7].[Int], [n7].[Ints], [n7].[Name], [n7].[String], [n1].[Id], [n1].[CollectionAssociateId], [n1].[Int], [n1].[Ints], [n1].[Name], [n1].[String], [n2].[Id], [n2].[CollectionAssociateId], [n2].[Int], [n2].[Ints], [n2].[Name], [n2].[String] FROM [RootEntity] AS [r] LEFT JOIN [AssociateType] AS [a0] ON [r].[OptionalAssociateId] = [a0].[Id] LEFT JOIN [NestedAssociateType] AS [n] ON [a0].[OptionalNestedAssociateId] = [n].[Id] @@ -21,7 +21,7 @@ FROM [RootEntity] AS [r] LEFT JOIN [NestedAssociateType] AS [n1] ON [a1].[OptionalNestedAssociateId] = [n1].[Id] INNER JOIN [NestedAssociateType] AS [n2] ON [a1].[RequiredNestedAssociateId] = [n2].[Id] LEFT JOIN ( - SELECT [a2].[Id], [a2].[CollectionRootId], [a2].[Int], [a2].[Ints], [a2].[Name], [a2].[OptionalNestedAssociateId], [a2].[RequiredNestedAssociateId], [a2].[String], [n3].[Id] AS [Id0], [n4].[Id] AS [Id1], [n5].[Id] AS [Id2], [n5].[CollectionAssociateId], [n5].[Int] AS [Int0], [n5].[Ints] AS [Ints0], [n5].[Name] AS [Name0], [n5].[String] AS [String0], [n3].[CollectionAssociateId] AS [CollectionAssociateId0], [n3].[Int] AS [Int1], [n3].[Ints] AS [Ints1], [n3].[Name] AS [Name1], [n3].[String] AS [String1], [n4].[CollectionAssociateId] AS [CollectionAssociateId1], [n4].[Int] AS [Int2], [n4].[Ints] AS [Ints2], [n4].[Name] AS [Name2], [n4].[String] AS [String2] + SELECT [a2].[Id], [a2].[CollectionRootId], [a2].[Int], [a2].[Ints], [a2].[Name], [a2].[OptionalNestedAssociateId], [a2].[RequiredNestedAssociateId], [a2].[String], [n5].[Id] AS [Id0], [n5].[CollectionAssociateId], [n5].[Int] AS [Int0], [n5].[Ints] AS [Ints0], [n5].[Name] AS [Name0], [n5].[String] AS [String0], [n3].[Id] AS [Id1], [n3].[CollectionAssociateId] AS [CollectionAssociateId0], [n3].[Int] AS [Int1], [n3].[Ints] AS [Ints1], [n3].[Name] AS [Name1], [n3].[String] AS [String1], [n4].[Id] AS [Id2], [n4].[CollectionAssociateId] AS [CollectionAssociateId1], [n4].[Int] AS [Int2], [n4].[Ints] AS [Ints2], [n4].[Name] AS [Name2], [n4].[String] AS [String2] FROM [AssociateType] AS [a2] LEFT JOIN [NestedAssociateType] AS [n3] ON [a2].[OptionalNestedAssociateId] = [n3].[Id] INNER JOIN [NestedAssociateType] AS [n4] ON [a2].[RequiredNestedAssociateId] = [n4].[Id] @@ -33,7 +33,7 @@ FROM [AssociateType] AS [a2] SELECT COUNT(*) FROM [AssociateType] AS [a] WHERE [r].[Id] = [a].[CollectionRootId]) = 2 -ORDER BY [r].[Id], [a0].[Id], [n].[Id], [n0].[Id], [a1].[Id], [n1].[Id], [n2].[Id], [s].[Id], [s].[Id0], [s].[Id1], [s].[Id2], [n6].[Id] +ORDER BY [r].[Id], [s].[Id], [s].[Id0], [n6].[Id] """); } @@ -43,7 +43,7 @@ public override async Task Where() AssertSql( """ -SELECT [r].[Id], [r].[Name], [r].[OptionalAssociateId], [r].[RequiredAssociateId], [a0].[Id], [n].[Id], [n0].[Id], [a1].[Id], [n1].[Id], [n2].[Id], [s].[Id], [s].[CollectionRootId], [s].[Int], [s].[Ints], [s].[Name], [s].[OptionalNestedAssociateId], [s].[RequiredNestedAssociateId], [s].[String], [s].[Id0], [s].[Id1], [s].[Id2], [s].[CollectionAssociateId], [s].[Int0], [s].[Ints0], [s].[Name0], [s].[String0], [s].[CollectionAssociateId0], [s].[Int1], [s].[Ints1], [s].[Name1], [s].[String1], [s].[CollectionAssociateId1], [s].[Int2], [s].[Ints2], [s].[Name2], [s].[String2], [a0].[CollectionRootId], [a0].[Int], [a0].[Ints], [a0].[Name], [a0].[OptionalNestedAssociateId], [a0].[RequiredNestedAssociateId], [a0].[String], [n6].[Id], [n6].[CollectionAssociateId], [n6].[Int], [n6].[Ints], [n6].[Name], [n6].[String], [n].[CollectionAssociateId], [n].[Int], [n].[Ints], [n].[Name], [n].[String], [n0].[CollectionAssociateId], [n0].[Int], [n0].[Ints], [n0].[Name], [n0].[String], [a1].[CollectionRootId], [a1].[Int], [a1].[Ints], [a1].[Name], [a1].[OptionalNestedAssociateId], [a1].[RequiredNestedAssociateId], [a1].[String], [n7].[Id], [n7].[CollectionAssociateId], [n7].[Int], [n7].[Ints], [n7].[Name], [n7].[String], [n1].[CollectionAssociateId], [n1].[Int], [n1].[Ints], [n1].[Name], [n1].[String], [n2].[CollectionAssociateId], [n2].[Int], [n2].[Ints], [n2].[Name], [n2].[String] +SELECT [r].[Id], [r].[Name], [r].[OptionalAssociateId], [r].[RequiredAssociateId], [s].[Id], [s].[CollectionRootId], [s].[Int], [s].[Ints], [s].[Name], [s].[OptionalNestedAssociateId], [s].[RequiredNestedAssociateId], [s].[String], [s].[Id0], [s].[CollectionAssociateId], [s].[Int0], [s].[Ints0], [s].[Name0], [s].[String0], [s].[Id1], [s].[CollectionAssociateId0], [s].[Int1], [s].[Ints1], [s].[Name1], [s].[String1], [s].[Id2], [s].[CollectionAssociateId1], [s].[Int2], [s].[Ints2], [s].[Name2], [s].[String2], [a0].[Id], [a0].[CollectionRootId], [a0].[Int], [a0].[Ints], [a0].[Name], [a0].[OptionalNestedAssociateId], [a0].[RequiredNestedAssociateId], [a0].[String], [n6].[Id], [n6].[CollectionAssociateId], [n6].[Int], [n6].[Ints], [n6].[Name], [n6].[String], [n].[Id], [n].[CollectionAssociateId], [n].[Int], [n].[Ints], [n].[Name], [n].[String], [n0].[Id], [n0].[CollectionAssociateId], [n0].[Int], [n0].[Ints], [n0].[Name], [n0].[String], [a1].[Id], [a1].[CollectionRootId], [a1].[Int], [a1].[Ints], [a1].[Name], [a1].[OptionalNestedAssociateId], [a1].[RequiredNestedAssociateId], [a1].[String], [n7].[Id], [n7].[CollectionAssociateId], [n7].[Int], [n7].[Ints], [n7].[Name], [n7].[String], [n1].[Id], [n1].[CollectionAssociateId], [n1].[Int], [n1].[Ints], [n1].[Name], [n1].[String], [n2].[Id], [n2].[CollectionAssociateId], [n2].[Int], [n2].[Ints], [n2].[Name], [n2].[String] FROM [RootEntity] AS [r] LEFT JOIN [AssociateType] AS [a0] ON [r].[OptionalAssociateId] = [a0].[Id] LEFT JOIN [NestedAssociateType] AS [n] ON [a0].[OptionalNestedAssociateId] = [n].[Id] @@ -52,7 +52,7 @@ FROM [RootEntity] AS [r] LEFT JOIN [NestedAssociateType] AS [n1] ON [a1].[OptionalNestedAssociateId] = [n1].[Id] INNER JOIN [NestedAssociateType] AS [n2] ON [a1].[RequiredNestedAssociateId] = [n2].[Id] LEFT JOIN ( - SELECT [a2].[Id], [a2].[CollectionRootId], [a2].[Int], [a2].[Ints], [a2].[Name], [a2].[OptionalNestedAssociateId], [a2].[RequiredNestedAssociateId], [a2].[String], [n3].[Id] AS [Id0], [n4].[Id] AS [Id1], [n5].[Id] AS [Id2], [n5].[CollectionAssociateId], [n5].[Int] AS [Int0], [n5].[Ints] AS [Ints0], [n5].[Name] AS [Name0], [n5].[String] AS [String0], [n3].[CollectionAssociateId] AS [CollectionAssociateId0], [n3].[Int] AS [Int1], [n3].[Ints] AS [Ints1], [n3].[Name] AS [Name1], [n3].[String] AS [String1], [n4].[CollectionAssociateId] AS [CollectionAssociateId1], [n4].[Int] AS [Int2], [n4].[Ints] AS [Ints2], [n4].[Name] AS [Name2], [n4].[String] AS [String2] + SELECT [a2].[Id], [a2].[CollectionRootId], [a2].[Int], [a2].[Ints], [a2].[Name], [a2].[OptionalNestedAssociateId], [a2].[RequiredNestedAssociateId], [a2].[String], [n5].[Id] AS [Id0], [n5].[CollectionAssociateId], [n5].[Int] AS [Int0], [n5].[Ints] AS [Ints0], [n5].[Name] AS [Name0], [n5].[String] AS [String0], [n3].[Id] AS [Id1], [n3].[CollectionAssociateId] AS [CollectionAssociateId0], [n3].[Int] AS [Int1], [n3].[Ints] AS [Ints1], [n3].[Name] AS [Name1], [n3].[String] AS [String1], [n4].[Id] AS [Id2], [n4].[CollectionAssociateId] AS [CollectionAssociateId1], [n4].[Int] AS [Int2], [n4].[Ints] AS [Ints2], [n4].[Name] AS [Name2], [n4].[String] AS [String2] FROM [AssociateType] AS [a2] LEFT JOIN [NestedAssociateType] AS [n3] ON [a2].[OptionalNestedAssociateId] = [n3].[Id] INNER JOIN [NestedAssociateType] AS [n4] ON [a2].[RequiredNestedAssociateId] = [n4].[Id] @@ -64,7 +64,7 @@ FROM [AssociateType] AS [a2] SELECT COUNT(*) FROM [AssociateType] AS [a] WHERE [r].[Id] = [a].[CollectionRootId] AND [a].[Int] <> 8) = 2 -ORDER BY [r].[Id], [a0].[Id], [n].[Id], [n0].[Id], [a1].[Id], [n1].[Id], [n2].[Id], [s].[Id], [s].[Id0], [s].[Id1], [s].[Id2], [n6].[Id] +ORDER BY [r].[Id], [s].[Id], [s].[Id0], [n6].[Id] """); } @@ -74,7 +74,7 @@ public override async Task OrderBy_ElementAt() AssertSql( """ -SELECT [r].[Id], [r].[Name], [r].[OptionalAssociateId], [r].[RequiredAssociateId], [a0].[Id], [n].[Id], [n0].[Id], [a1].[Id], [n1].[Id], [n2].[Id], [s].[Id], [s].[CollectionRootId], [s].[Int], [s].[Ints], [s].[Name], [s].[OptionalNestedAssociateId], [s].[RequiredNestedAssociateId], [s].[String], [s].[Id0], [s].[Id1], [s].[Id2], [s].[CollectionAssociateId], [s].[Int0], [s].[Ints0], [s].[Name0], [s].[String0], [s].[CollectionAssociateId0], [s].[Int1], [s].[Ints1], [s].[Name1], [s].[String1], [s].[CollectionAssociateId1], [s].[Int2], [s].[Ints2], [s].[Name2], [s].[String2], [a0].[CollectionRootId], [a0].[Int], [a0].[Ints], [a0].[Name], [a0].[OptionalNestedAssociateId], [a0].[RequiredNestedAssociateId], [a0].[String], [n6].[Id], [n6].[CollectionAssociateId], [n6].[Int], [n6].[Ints], [n6].[Name], [n6].[String], [n].[CollectionAssociateId], [n].[Int], [n].[Ints], [n].[Name], [n].[String], [n0].[CollectionAssociateId], [n0].[Int], [n0].[Ints], [n0].[Name], [n0].[String], [a1].[CollectionRootId], [a1].[Int], [a1].[Ints], [a1].[Name], [a1].[OptionalNestedAssociateId], [a1].[RequiredNestedAssociateId], [a1].[String], [n7].[Id], [n7].[CollectionAssociateId], [n7].[Int], [n7].[Ints], [n7].[Name], [n7].[String], [n1].[CollectionAssociateId], [n1].[Int], [n1].[Ints], [n1].[Name], [n1].[String], [n2].[CollectionAssociateId], [n2].[Int], [n2].[Ints], [n2].[Name], [n2].[String] +SELECT [r].[Id], [r].[Name], [r].[OptionalAssociateId], [r].[RequiredAssociateId], [s].[Id], [s].[CollectionRootId], [s].[Int], [s].[Ints], [s].[Name], [s].[OptionalNestedAssociateId], [s].[RequiredNestedAssociateId], [s].[String], [s].[Id0], [s].[CollectionAssociateId], [s].[Int0], [s].[Ints0], [s].[Name0], [s].[String0], [s].[Id1], [s].[CollectionAssociateId0], [s].[Int1], [s].[Ints1], [s].[Name1], [s].[String1], [s].[Id2], [s].[CollectionAssociateId1], [s].[Int2], [s].[Ints2], [s].[Name2], [s].[String2], [a0].[Id], [a0].[CollectionRootId], [a0].[Int], [a0].[Ints], [a0].[Name], [a0].[OptionalNestedAssociateId], [a0].[RequiredNestedAssociateId], [a0].[String], [n6].[Id], [n6].[CollectionAssociateId], [n6].[Int], [n6].[Ints], [n6].[Name], [n6].[String], [n].[Id], [n].[CollectionAssociateId], [n].[Int], [n].[Ints], [n].[Name], [n].[String], [n0].[Id], [n0].[CollectionAssociateId], [n0].[Int], [n0].[Ints], [n0].[Name], [n0].[String], [a1].[Id], [a1].[CollectionRootId], [a1].[Int], [a1].[Ints], [a1].[Name], [a1].[OptionalNestedAssociateId], [a1].[RequiredNestedAssociateId], [a1].[String], [n7].[Id], [n7].[CollectionAssociateId], [n7].[Int], [n7].[Ints], [n7].[Name], [n7].[String], [n1].[Id], [n1].[CollectionAssociateId], [n1].[Int], [n1].[Ints], [n1].[Name], [n1].[String], [n2].[Id], [n2].[CollectionAssociateId], [n2].[Int], [n2].[Ints], [n2].[Name], [n2].[String] FROM [RootEntity] AS [r] LEFT JOIN [AssociateType] AS [a0] ON [r].[OptionalAssociateId] = [a0].[Id] LEFT JOIN [NestedAssociateType] AS [n] ON [a0].[OptionalNestedAssociateId] = [n].[Id] @@ -83,7 +83,7 @@ FROM [RootEntity] AS [r] LEFT JOIN [NestedAssociateType] AS [n1] ON [a1].[OptionalNestedAssociateId] = [n1].[Id] INNER JOIN [NestedAssociateType] AS [n2] ON [a1].[RequiredNestedAssociateId] = [n2].[Id] LEFT JOIN ( - SELECT [a2].[Id], [a2].[CollectionRootId], [a2].[Int], [a2].[Ints], [a2].[Name], [a2].[OptionalNestedAssociateId], [a2].[RequiredNestedAssociateId], [a2].[String], [n3].[Id] AS [Id0], [n4].[Id] AS [Id1], [n5].[Id] AS [Id2], [n5].[CollectionAssociateId], [n5].[Int] AS [Int0], [n5].[Ints] AS [Ints0], [n5].[Name] AS [Name0], [n5].[String] AS [String0], [n3].[CollectionAssociateId] AS [CollectionAssociateId0], [n3].[Int] AS [Int1], [n3].[Ints] AS [Ints1], [n3].[Name] AS [Name1], [n3].[String] AS [String1], [n4].[CollectionAssociateId] AS [CollectionAssociateId1], [n4].[Int] AS [Int2], [n4].[Ints] AS [Ints2], [n4].[Name] AS [Name2], [n4].[String] AS [String2] + SELECT [a2].[Id], [a2].[CollectionRootId], [a2].[Int], [a2].[Ints], [a2].[Name], [a2].[OptionalNestedAssociateId], [a2].[RequiredNestedAssociateId], [a2].[String], [n5].[Id] AS [Id0], [n5].[CollectionAssociateId], [n5].[Int] AS [Int0], [n5].[Ints] AS [Ints0], [n5].[Name] AS [Name0], [n5].[String] AS [String0], [n3].[Id] AS [Id1], [n3].[CollectionAssociateId] AS [CollectionAssociateId0], [n3].[Int] AS [Int1], [n3].[Ints] AS [Ints1], [n3].[Name] AS [Name1], [n3].[String] AS [String1], [n4].[Id] AS [Id2], [n4].[CollectionAssociateId] AS [CollectionAssociateId1], [n4].[Int] AS [Int2], [n4].[Ints] AS [Ints2], [n4].[Name] AS [Name2], [n4].[String] AS [String2] FROM [AssociateType] AS [a2] LEFT JOIN [NestedAssociateType] AS [n3] ON [a2].[OptionalNestedAssociateId] = [n3].[Id] INNER JOIN [NestedAssociateType] AS [n4] ON [a2].[RequiredNestedAssociateId] = [n4].[Id] @@ -97,7 +97,7 @@ FROM [AssociateType] AS [a] WHERE [r].[Id] = [a].[CollectionRootId] ORDER BY [a].[Id] OFFSET 0 ROWS FETCH NEXT 1 ROWS ONLY) = 8 -ORDER BY [r].[Id], [a0].[Id], [n].[Id], [n0].[Id], [a1].[Id], [n1].[Id], [n2].[Id], [s].[Id], [s].[Id0], [s].[Id1], [s].[Id2], [n6].[Id] +ORDER BY [r].[Id], [s].[Id], [s].[Id0], [n6].[Id] """); } @@ -109,7 +109,7 @@ public override async Task Distinct() AssertSql( """ -SELECT [r].[Id], [r].[Name], [r].[OptionalAssociateId], [r].[RequiredAssociateId], [a1].[Id], [n].[Id], [n0].[Id], [a2].[Id], [n1].[Id], [n2].[Id], [s].[Id], [s].[CollectionRootId], [s].[Int], [s].[Ints], [s].[Name], [s].[OptionalNestedAssociateId], [s].[RequiredNestedAssociateId], [s].[String], [s].[Id0], [s].[Id1], [s].[Id2], [s].[CollectionAssociateId], [s].[Int0], [s].[Ints0], [s].[Name0], [s].[String0], [s].[CollectionAssociateId0], [s].[Int1], [s].[Ints1], [s].[Name1], [s].[String1], [s].[CollectionAssociateId1], [s].[Int2], [s].[Ints2], [s].[Name2], [s].[String2], [a1].[CollectionRootId], [a1].[Int], [a1].[Ints], [a1].[Name], [a1].[OptionalNestedAssociateId], [a1].[RequiredNestedAssociateId], [a1].[String], [n6].[Id], [n6].[CollectionAssociateId], [n6].[Int], [n6].[Ints], [n6].[Name], [n6].[String], [n].[CollectionAssociateId], [n].[Int], [n].[Ints], [n].[Name], [n].[String], [n0].[CollectionAssociateId], [n0].[Int], [n0].[Ints], [n0].[Name], [n0].[String], [a2].[CollectionRootId], [a2].[Int], [a2].[Ints], [a2].[Name], [a2].[OptionalNestedAssociateId], [a2].[RequiredNestedAssociateId], [a2].[String], [n7].[Id], [n7].[CollectionAssociateId], [n7].[Int], [n7].[Ints], [n7].[Name], [n7].[String], [n1].[CollectionAssociateId], [n1].[Int], [n1].[Ints], [n1].[Name], [n1].[String], [n2].[CollectionAssociateId], [n2].[Int], [n2].[Ints], [n2].[Name], [n2].[String] +SELECT [r].[Id], [r].[Name], [r].[OptionalAssociateId], [r].[RequiredAssociateId], [s].[Id], [s].[CollectionRootId], [s].[Int], [s].[Ints], [s].[Name], [s].[OptionalNestedAssociateId], [s].[RequiredNestedAssociateId], [s].[String], [s].[Id0], [s].[CollectionAssociateId], [s].[Int0], [s].[Ints0], [s].[Name0], [s].[String0], [s].[Id1], [s].[CollectionAssociateId0], [s].[Int1], [s].[Ints1], [s].[Name1], [s].[String1], [s].[Id2], [s].[CollectionAssociateId1], [s].[Int2], [s].[Ints2], [s].[Name2], [s].[String2], [a1].[Id], [a1].[CollectionRootId], [a1].[Int], [a1].[Ints], [a1].[Name], [a1].[OptionalNestedAssociateId], [a1].[RequiredNestedAssociateId], [a1].[String], [n6].[Id], [n6].[CollectionAssociateId], [n6].[Int], [n6].[Ints], [n6].[Name], [n6].[String], [n].[Id], [n].[CollectionAssociateId], [n].[Int], [n].[Ints], [n].[Name], [n].[String], [n0].[Id], [n0].[CollectionAssociateId], [n0].[Int], [n0].[Ints], [n0].[Name], [n0].[String], [a2].[Id], [a2].[CollectionRootId], [a2].[Int], [a2].[Ints], [a2].[Name], [a2].[OptionalNestedAssociateId], [a2].[RequiredNestedAssociateId], [a2].[String], [n7].[Id], [n7].[CollectionAssociateId], [n7].[Int], [n7].[Ints], [n7].[Name], [n7].[String], [n1].[Id], [n1].[CollectionAssociateId], [n1].[Int], [n1].[Ints], [n1].[Name], [n1].[String], [n2].[Id], [n2].[CollectionAssociateId], [n2].[Int], [n2].[Ints], [n2].[Name], [n2].[String] FROM [RootEntity] AS [r] LEFT JOIN [AssociateType] AS [a1] ON [r].[OptionalAssociateId] = [a1].[Id] LEFT JOIN [NestedAssociateType] AS [n] ON [a1].[OptionalNestedAssociateId] = [n].[Id] @@ -118,7 +118,7 @@ FROM [RootEntity] AS [r] LEFT JOIN [NestedAssociateType] AS [n1] ON [a2].[OptionalNestedAssociateId] = [n1].[Id] INNER JOIN [NestedAssociateType] AS [n2] ON [a2].[RequiredNestedAssociateId] = [n2].[Id] LEFT JOIN ( - SELECT [a3].[Id], [a3].[CollectionRootId], [a3].[Int], [a3].[Ints], [a3].[Name], [a3].[OptionalNestedAssociateId], [a3].[RequiredNestedAssociateId], [a3].[String], [n3].[Id] AS [Id0], [n4].[Id] AS [Id1], [n5].[Id] AS [Id2], [n5].[CollectionAssociateId], [n5].[Int] AS [Int0], [n5].[Ints] AS [Ints0], [n5].[Name] AS [Name0], [n5].[String] AS [String0], [n3].[CollectionAssociateId] AS [CollectionAssociateId0], [n3].[Int] AS [Int1], [n3].[Ints] AS [Ints1], [n3].[Name] AS [Name1], [n3].[String] AS [String1], [n4].[CollectionAssociateId] AS [CollectionAssociateId1], [n4].[Int] AS [Int2], [n4].[Ints] AS [Ints2], [n4].[Name] AS [Name2], [n4].[String] AS [String2] + SELECT [a3].[Id], [a3].[CollectionRootId], [a3].[Int], [a3].[Ints], [a3].[Name], [a3].[OptionalNestedAssociateId], [a3].[RequiredNestedAssociateId], [a3].[String], [n5].[Id] AS [Id0], [n5].[CollectionAssociateId], [n5].[Int] AS [Int0], [n5].[Ints] AS [Ints0], [n5].[Name] AS [Name0], [n5].[String] AS [String0], [n3].[Id] AS [Id1], [n3].[CollectionAssociateId] AS [CollectionAssociateId0], [n3].[Int] AS [Int1], [n3].[Ints] AS [Ints1], [n3].[Name] AS [Name1], [n3].[String] AS [String1], [n4].[Id] AS [Id2], [n4].[CollectionAssociateId] AS [CollectionAssociateId1], [n4].[Int] AS [Int2], [n4].[Ints] AS [Ints2], [n4].[Name] AS [Name2], [n4].[String] AS [String2] FROM [AssociateType] AS [a3] LEFT JOIN [NestedAssociateType] AS [n3] ON [a3].[OptionalNestedAssociateId] = [n3].[Id] INNER JOIN [NestedAssociateType] AS [n4] ON [a3].[RequiredNestedAssociateId] = [n4].[Id] @@ -133,7 +133,7 @@ SELECT COUNT(*) FROM [AssociateType] AS [a] WHERE [r].[Id] = [a].[CollectionRootId] ) AS [a0]) = 2 -ORDER BY [r].[Id], [a1].[Id], [n].[Id], [n0].[Id], [a2].[Id], [n1].[Id], [n2].[Id], [s].[Id], [s].[Id0], [s].[Id1], [s].[Id2], [n6].[Id] +ORDER BY [r].[Id], [s].[Id], [s].[Id0], [n6].[Id] """); } @@ -143,10 +143,10 @@ public override async Task Distinct_projected(QueryTrackingBehavior queryTrackin AssertSql( """ -SELECT [r].[Id], [s].[Id], [s].[CollectionRootId], [s].[Int], [s].[Ints], [s].[Name], [s].[OptionalNestedAssociateId], [s].[RequiredNestedAssociateId], [s].[String], [s].[Id0], [s].[Id1], [s].[Id2], [s].[CollectionAssociateId], [s].[Int0], [s].[Ints0], [s].[Name0], [s].[String0], [s].[CollectionAssociateId0], [s].[Int1], [s].[Ints1], [s].[Name1], [s].[String1], [s].[CollectionAssociateId1], [s].[Int2], [s].[Ints2], [s].[Name2], [s].[String2] +SELECT [r].[Id], [s].[Id], [s].[CollectionRootId], [s].[Int], [s].[Ints], [s].[Name], [s].[OptionalNestedAssociateId], [s].[RequiredNestedAssociateId], [s].[String], [s].[Id0], [s].[CollectionAssociateId], [s].[Int0], [s].[Ints0], [s].[Name0], [s].[String0], [s].[Id1], [s].[CollectionAssociateId0], [s].[Int1], [s].[Ints1], [s].[Name1], [s].[String1], [s].[Id2], [s].[CollectionAssociateId1], [s].[Int2], [s].[Ints2], [s].[Name2], [s].[String2] FROM [RootEntity] AS [r] OUTER APPLY ( - SELECT [a0].[Id], [a0].[CollectionRootId], [a0].[Int], [a0].[Ints], [a0].[Name], [a0].[OptionalNestedAssociateId], [a0].[RequiredNestedAssociateId], [a0].[String], [n].[Id] AS [Id0], [n0].[Id] AS [Id1], [n1].[Id] AS [Id2], [n1].[CollectionAssociateId], [n1].[Int] AS [Int0], [n1].[Ints] AS [Ints0], [n1].[Name] AS [Name0], [n1].[String] AS [String0], [n].[CollectionAssociateId] AS [CollectionAssociateId0], [n].[Int] AS [Int1], [n].[Ints] AS [Ints1], [n].[Name] AS [Name1], [n].[String] AS [String1], [n0].[CollectionAssociateId] AS [CollectionAssociateId1], [n0].[Int] AS [Int2], [n0].[Ints] AS [Ints2], [n0].[Name] AS [Name2], [n0].[String] AS [String2] + SELECT [a0].[Id], [a0].[CollectionRootId], [a0].[Int], [a0].[Ints], [a0].[Name], [a0].[OptionalNestedAssociateId], [a0].[RequiredNestedAssociateId], [a0].[String], [n1].[Id] AS [Id0], [n1].[CollectionAssociateId], [n1].[Int] AS [Int0], [n1].[Ints] AS [Ints0], [n1].[Name] AS [Name0], [n1].[String] AS [String0], [n].[Id] AS [Id1], [n].[CollectionAssociateId] AS [CollectionAssociateId0], [n].[Int] AS [Int1], [n].[Ints] AS [Ints1], [n].[Name] AS [Name1], [n].[String] AS [String1], [n0].[Id] AS [Id2], [n0].[CollectionAssociateId] AS [CollectionAssociateId1], [n0].[Int] AS [Int2], [n0].[Ints] AS [Ints2], [n0].[Name] AS [Name2], [n0].[String] AS [String2] FROM ( SELECT DISTINCT [a].[Id], [a].[CollectionRootId], [a].[Int], [a].[Ints], [a].[Name], [a].[OptionalNestedAssociateId], [a].[RequiredNestedAssociateId], [a].[String] FROM [AssociateType] AS [a] @@ -156,7 +156,7 @@ FROM [AssociateType] AS [a] INNER JOIN [NestedAssociateType] AS [n0] ON [a0].[RequiredNestedAssociateId] = [n0].[Id] LEFT JOIN [NestedAssociateType] AS [n1] ON [a0].[Id] = [n1].[CollectionAssociateId] ) AS [s] -ORDER BY [r].[Id], [s].[Id], [s].[Id0], [s].[Id1] +ORDER BY [r].[Id], [s].[Id] """); } @@ -224,7 +224,7 @@ public override async Task GroupBy() AssertSql( """ -SELECT [r].[Id], [r].[Name], [r].[OptionalAssociateId], [r].[RequiredAssociateId], [a0].[Id], [n].[Id], [n0].[Id], [a1].[Id], [n1].[Id], [n2].[Id], [s].[Id], [s].[CollectionRootId], [s].[Int], [s].[Ints], [s].[Name], [s].[OptionalNestedAssociateId], [s].[RequiredNestedAssociateId], [s].[String], [s].[Id0], [s].[Id1], [s].[Id2], [s].[CollectionAssociateId], [s].[Int0], [s].[Ints0], [s].[Name0], [s].[String0], [s].[CollectionAssociateId0], [s].[Int1], [s].[Ints1], [s].[Name1], [s].[String1], [s].[CollectionAssociateId1], [s].[Int2], [s].[Ints2], [s].[Name2], [s].[String2], [a0].[CollectionRootId], [a0].[Int], [a0].[Ints], [a0].[Name], [a0].[OptionalNestedAssociateId], [a0].[RequiredNestedAssociateId], [a0].[String], [n6].[Id], [n6].[CollectionAssociateId], [n6].[Int], [n6].[Ints], [n6].[Name], [n6].[String], [n].[CollectionAssociateId], [n].[Int], [n].[Ints], [n].[Name], [n].[String], [n0].[CollectionAssociateId], [n0].[Int], [n0].[Ints], [n0].[Name], [n0].[String], [a1].[CollectionRootId], [a1].[Int], [a1].[Ints], [a1].[Name], [a1].[OptionalNestedAssociateId], [a1].[RequiredNestedAssociateId], [a1].[String], [n7].[Id], [n7].[CollectionAssociateId], [n7].[Int], [n7].[Ints], [n7].[Name], [n7].[String], [n1].[CollectionAssociateId], [n1].[Int], [n1].[Ints], [n1].[Name], [n1].[String], [n2].[CollectionAssociateId], [n2].[Int], [n2].[Ints], [n2].[Name], [n2].[String] +SELECT [r].[Id], [r].[Name], [r].[OptionalAssociateId], [r].[RequiredAssociateId], [s].[Id], [s].[CollectionRootId], [s].[Int], [s].[Ints], [s].[Name], [s].[OptionalNestedAssociateId], [s].[RequiredNestedAssociateId], [s].[String], [s].[Id0], [s].[CollectionAssociateId], [s].[Int0], [s].[Ints0], [s].[Name0], [s].[String0], [s].[Id1], [s].[CollectionAssociateId0], [s].[Int1], [s].[Ints1], [s].[Name1], [s].[String1], [s].[Id2], [s].[CollectionAssociateId1], [s].[Int2], [s].[Ints2], [s].[Name2], [s].[String2], [a0].[Id], [a0].[CollectionRootId], [a0].[Int], [a0].[Ints], [a0].[Name], [a0].[OptionalNestedAssociateId], [a0].[RequiredNestedAssociateId], [a0].[String], [n6].[Id], [n6].[CollectionAssociateId], [n6].[Int], [n6].[Ints], [n6].[Name], [n6].[String], [n].[Id], [n].[CollectionAssociateId], [n].[Int], [n].[Ints], [n].[Name], [n].[String], [n0].[Id], [n0].[CollectionAssociateId], [n0].[Int], [n0].[Ints], [n0].[Name], [n0].[String], [a1].[Id], [a1].[CollectionRootId], [a1].[Int], [a1].[Ints], [a1].[Name], [a1].[OptionalNestedAssociateId], [a1].[RequiredNestedAssociateId], [a1].[String], [n7].[Id], [n7].[CollectionAssociateId], [n7].[Int], [n7].[Ints], [n7].[Name], [n7].[String], [n1].[Id], [n1].[CollectionAssociateId], [n1].[Int], [n1].[Ints], [n1].[Name], [n1].[String], [n2].[Id], [n2].[CollectionAssociateId], [n2].[Int], [n2].[Ints], [n2].[Name], [n2].[String] FROM [RootEntity] AS [r] LEFT JOIN [AssociateType] AS [a0] ON [r].[OptionalAssociateId] = [a0].[Id] LEFT JOIN [NestedAssociateType] AS [n] ON [a0].[OptionalNestedAssociateId] = [n].[Id] @@ -233,7 +233,7 @@ FROM [RootEntity] AS [r] LEFT JOIN [NestedAssociateType] AS [n1] ON [a1].[OptionalNestedAssociateId] = [n1].[Id] INNER JOIN [NestedAssociateType] AS [n2] ON [a1].[RequiredNestedAssociateId] = [n2].[Id] LEFT JOIN ( - SELECT [a2].[Id], [a2].[CollectionRootId], [a2].[Int], [a2].[Ints], [a2].[Name], [a2].[OptionalNestedAssociateId], [a2].[RequiredNestedAssociateId], [a2].[String], [n3].[Id] AS [Id0], [n4].[Id] AS [Id1], [n5].[Id] AS [Id2], [n5].[CollectionAssociateId], [n5].[Int] AS [Int0], [n5].[Ints] AS [Ints0], [n5].[Name] AS [Name0], [n5].[String] AS [String0], [n3].[CollectionAssociateId] AS [CollectionAssociateId0], [n3].[Int] AS [Int1], [n3].[Ints] AS [Ints1], [n3].[Name] AS [Name1], [n3].[String] AS [String1], [n4].[CollectionAssociateId] AS [CollectionAssociateId1], [n4].[Int] AS [Int2], [n4].[Ints] AS [Ints2], [n4].[Name] AS [Name2], [n4].[String] AS [String2] + SELECT [a2].[Id], [a2].[CollectionRootId], [a2].[Int], [a2].[Ints], [a2].[Name], [a2].[OptionalNestedAssociateId], [a2].[RequiredNestedAssociateId], [a2].[String], [n5].[Id] AS [Id0], [n5].[CollectionAssociateId], [n5].[Int] AS [Int0], [n5].[Ints] AS [Ints0], [n5].[Name] AS [Name0], [n5].[String] AS [String0], [n3].[Id] AS [Id1], [n3].[CollectionAssociateId] AS [CollectionAssociateId0], [n3].[Int] AS [Int1], [n3].[Ints] AS [Ints1], [n3].[Name] AS [Name1], [n3].[String] AS [String1], [n4].[Id] AS [Id2], [n4].[CollectionAssociateId] AS [CollectionAssociateId1], [n4].[Int] AS [Int2], [n4].[Ints] AS [Ints2], [n4].[Name] AS [Name2], [n4].[String] AS [String2] FROM [AssociateType] AS [a2] LEFT JOIN [NestedAssociateType] AS [n3] ON [a2].[OptionalNestedAssociateId] = [n3].[Id] INNER JOIN [NestedAssociateType] AS [n4] ON [a2].[RequiredNestedAssociateId] = [n4].[Id] @@ -247,7 +247,7 @@ FROM [AssociateType] AS [a] WHERE [r].[Id] = [a].[CollectionRootId] GROUP BY [a].[String] ) -ORDER BY [r].[Id], [a0].[Id], [n].[Id], [n0].[Id], [a1].[Id], [n1].[Id], [n2].[Id], [s].[Id], [s].[Id0], [s].[Id1], [s].[Id2], [n6].[Id] +ORDER BY [r].[Id], [s].[Id], [s].[Id0], [n6].[Id] """); } diff --git a/test/EFCore.SqlServer.FunctionalTests/Query/Associations/Navigations/NavigationsIncludeSqlServerTest.cs b/test/EFCore.SqlServer.FunctionalTests/Query/Associations/Navigations/NavigationsIncludeSqlServerTest.cs index 4242bedaacc..6c165d5bafb 100644 --- a/test/EFCore.SqlServer.FunctionalTests/Query/Associations/Navigations/NavigationsIncludeSqlServerTest.cs +++ b/test/EFCore.SqlServer.FunctionalTests/Query/Associations/Navigations/NavigationsIncludeSqlServerTest.cs @@ -12,7 +12,7 @@ public override async Task Include_required(bool async) AssertSql( """ -SELECT [r].[Id], [r].[Name], [r].[OptionalAssociateId], [r].[RequiredAssociateId], [a].[Id], [n].[Id], [n0].[Id], [a0].[Id], [n1].[Id], [n2].[Id], [s].[Id], [s].[CollectionRootId], [s].[Int], [s].[Ints], [s].[Name], [s].[OptionalNestedAssociateId], [s].[RequiredNestedAssociateId], [s].[String], [s].[Id0], [s].[Id1], [s].[Id2], [s].[CollectionAssociateId], [s].[Int0], [s].[Ints0], [s].[Name0], [s].[String0], [s].[CollectionAssociateId0], [s].[Int1], [s].[Ints1], [s].[Name1], [s].[String1], [s].[CollectionAssociateId1], [s].[Int2], [s].[Ints2], [s].[Name2], [s].[String2], [a].[CollectionRootId], [a].[Int], [a].[Ints], [a].[Name], [a].[OptionalNestedAssociateId], [a].[RequiredNestedAssociateId], [a].[String], [n6].[Id], [n6].[CollectionAssociateId], [n6].[Int], [n6].[Ints], [n6].[Name], [n6].[String], [n].[CollectionAssociateId], [n].[Int], [n].[Ints], [n].[Name], [n].[String], [n0].[CollectionAssociateId], [n0].[Int], [n0].[Ints], [n0].[Name], [n0].[String], [a0].[CollectionRootId], [a0].[Int], [a0].[Ints], [a0].[Name], [a0].[OptionalNestedAssociateId], [a0].[RequiredNestedAssociateId], [a0].[String], [n7].[Id], [n7].[CollectionAssociateId], [n7].[Int], [n7].[Ints], [n7].[Name], [n7].[String], [n1].[CollectionAssociateId], [n1].[Int], [n1].[Ints], [n1].[Name], [n1].[String], [n2].[CollectionAssociateId], [n2].[Int], [n2].[Ints], [n2].[Name], [n2].[String] +SELECT [r].[Id], [r].[Name], [r].[OptionalAssociateId], [r].[RequiredAssociateId], [s].[Id], [s].[CollectionRootId], [s].[Int], [s].[Ints], [s].[Name], [s].[OptionalNestedAssociateId], [s].[RequiredNestedAssociateId], [s].[String], [s].[Id0], [s].[CollectionAssociateId], [s].[Int0], [s].[Ints0], [s].[Name0], [s].[String0], [s].[Id1], [s].[CollectionAssociateId0], [s].[Int1], [s].[Ints1], [s].[Name1], [s].[String1], [s].[Id2], [s].[CollectionAssociateId1], [s].[Int2], [s].[Ints2], [s].[Name2], [s].[String2], [a].[Id], [a].[CollectionRootId], [a].[Int], [a].[Ints], [a].[Name], [a].[OptionalNestedAssociateId], [a].[RequiredNestedAssociateId], [a].[String], [n6].[Id], [n6].[CollectionAssociateId], [n6].[Int], [n6].[Ints], [n6].[Name], [n6].[String], [n].[Id], [n].[CollectionAssociateId], [n].[Int], [n].[Ints], [n].[Name], [n].[String], [n0].[Id], [n0].[CollectionAssociateId], [n0].[Int], [n0].[Ints], [n0].[Name], [n0].[String], [a0].[Id], [a0].[CollectionRootId], [a0].[Int], [a0].[Ints], [a0].[Name], [a0].[OptionalNestedAssociateId], [a0].[RequiredNestedAssociateId], [a0].[String], [n7].[Id], [n7].[CollectionAssociateId], [n7].[Int], [n7].[Ints], [n7].[Name], [n7].[String], [n1].[Id], [n1].[CollectionAssociateId], [n1].[Int], [n1].[Ints], [n1].[Name], [n1].[String], [n2].[Id], [n2].[CollectionAssociateId], [n2].[Int], [n2].[Ints], [n2].[Name], [n2].[String] FROM [RootEntity] AS [r] LEFT JOIN [AssociateType] AS [a] ON [r].[OptionalAssociateId] = [a].[Id] LEFT JOIN [NestedAssociateType] AS [n] ON [a].[OptionalNestedAssociateId] = [n].[Id] @@ -21,7 +21,7 @@ FROM [RootEntity] AS [r] LEFT JOIN [NestedAssociateType] AS [n1] ON [a0].[OptionalNestedAssociateId] = [n1].[Id] INNER JOIN [NestedAssociateType] AS [n2] ON [a0].[RequiredNestedAssociateId] = [n2].[Id] LEFT JOIN ( - SELECT [a1].[Id], [a1].[CollectionRootId], [a1].[Int], [a1].[Ints], [a1].[Name], [a1].[OptionalNestedAssociateId], [a1].[RequiredNestedAssociateId], [a1].[String], [n3].[Id] AS [Id0], [n4].[Id] AS [Id1], [n5].[Id] AS [Id2], [n5].[CollectionAssociateId], [n5].[Int] AS [Int0], [n5].[Ints] AS [Ints0], [n5].[Name] AS [Name0], [n5].[String] AS [String0], [n3].[CollectionAssociateId] AS [CollectionAssociateId0], [n3].[Int] AS [Int1], [n3].[Ints] AS [Ints1], [n3].[Name] AS [Name1], [n3].[String] AS [String1], [n4].[CollectionAssociateId] AS [CollectionAssociateId1], [n4].[Int] AS [Int2], [n4].[Ints] AS [Ints2], [n4].[Name] AS [Name2], [n4].[String] AS [String2] + SELECT [a1].[Id], [a1].[CollectionRootId], [a1].[Int], [a1].[Ints], [a1].[Name], [a1].[OptionalNestedAssociateId], [a1].[RequiredNestedAssociateId], [a1].[String], [n5].[Id] AS [Id0], [n5].[CollectionAssociateId], [n5].[Int] AS [Int0], [n5].[Ints] AS [Ints0], [n5].[Name] AS [Name0], [n5].[String] AS [String0], [n3].[Id] AS [Id1], [n3].[CollectionAssociateId] AS [CollectionAssociateId0], [n3].[Int] AS [Int1], [n3].[Ints] AS [Ints1], [n3].[Name] AS [Name1], [n3].[String] AS [String1], [n4].[Id] AS [Id2], [n4].[CollectionAssociateId] AS [CollectionAssociateId1], [n4].[Int] AS [Int2], [n4].[Ints] AS [Ints2], [n4].[Name] AS [Name2], [n4].[String] AS [String2] FROM [AssociateType] AS [a1] LEFT JOIN [NestedAssociateType] AS [n3] ON [a1].[OptionalNestedAssociateId] = [n3].[Id] INNER JOIN [NestedAssociateType] AS [n4] ON [a1].[RequiredNestedAssociateId] = [n4].[Id] @@ -29,7 +29,7 @@ FROM [AssociateType] AS [a1] ) AS [s] ON [r].[Id] = [s].[CollectionRootId] LEFT JOIN [NestedAssociateType] AS [n6] ON [a].[Id] = [n6].[CollectionAssociateId] LEFT JOIN [NestedAssociateType] AS [n7] ON [a0].[Id] = [n7].[CollectionAssociateId] -ORDER BY [r].[Id], [a].[Id], [n].[Id], [n0].[Id], [a0].[Id], [n1].[Id], [n2].[Id], [s].[Id], [s].[Id0], [s].[Id1], [s].[Id2], [n6].[Id] +ORDER BY [r].[Id], [s].[Id], [s].[Id0], [n6].[Id] """); } @@ -39,7 +39,7 @@ public override async Task Include_optional(bool async) AssertSql( """ -SELECT [r].[Id], [r].[Name], [r].[OptionalAssociateId], [r].[RequiredAssociateId], [a].[Id], [n].[Id], [n0].[Id], [a0].[Id], [n1].[Id], [n2].[Id], [s].[Id], [s].[CollectionRootId], [s].[Int], [s].[Ints], [s].[Name], [s].[OptionalNestedAssociateId], [s].[RequiredNestedAssociateId], [s].[String], [s].[Id0], [s].[Id1], [s].[Id2], [s].[CollectionAssociateId], [s].[Int0], [s].[Ints0], [s].[Name0], [s].[String0], [s].[CollectionAssociateId0], [s].[Int1], [s].[Ints1], [s].[Name1], [s].[String1], [s].[CollectionAssociateId1], [s].[Int2], [s].[Ints2], [s].[Name2], [s].[String2], [a].[CollectionRootId], [a].[Int], [a].[Ints], [a].[Name], [a].[OptionalNestedAssociateId], [a].[RequiredNestedAssociateId], [a].[String], [n6].[Id], [n6].[CollectionAssociateId], [n6].[Int], [n6].[Ints], [n6].[Name], [n6].[String], [n].[CollectionAssociateId], [n].[Int], [n].[Ints], [n].[Name], [n].[String], [n0].[CollectionAssociateId], [n0].[Int], [n0].[Ints], [n0].[Name], [n0].[String], [a0].[CollectionRootId], [a0].[Int], [a0].[Ints], [a0].[Name], [a0].[OptionalNestedAssociateId], [a0].[RequiredNestedAssociateId], [a0].[String], [n7].[Id], [n7].[CollectionAssociateId], [n7].[Int], [n7].[Ints], [n7].[Name], [n7].[String], [n1].[CollectionAssociateId], [n1].[Int], [n1].[Ints], [n1].[Name], [n1].[String], [n2].[CollectionAssociateId], [n2].[Int], [n2].[Ints], [n2].[Name], [n2].[String] +SELECT [r].[Id], [r].[Name], [r].[OptionalAssociateId], [r].[RequiredAssociateId], [s].[Id], [s].[CollectionRootId], [s].[Int], [s].[Ints], [s].[Name], [s].[OptionalNestedAssociateId], [s].[RequiredNestedAssociateId], [s].[String], [s].[Id0], [s].[CollectionAssociateId], [s].[Int0], [s].[Ints0], [s].[Name0], [s].[String0], [s].[Id1], [s].[CollectionAssociateId0], [s].[Int1], [s].[Ints1], [s].[Name1], [s].[String1], [s].[Id2], [s].[CollectionAssociateId1], [s].[Int2], [s].[Ints2], [s].[Name2], [s].[String2], [a].[Id], [a].[CollectionRootId], [a].[Int], [a].[Ints], [a].[Name], [a].[OptionalNestedAssociateId], [a].[RequiredNestedAssociateId], [a].[String], [n6].[Id], [n6].[CollectionAssociateId], [n6].[Int], [n6].[Ints], [n6].[Name], [n6].[String], [n].[Id], [n].[CollectionAssociateId], [n].[Int], [n].[Ints], [n].[Name], [n].[String], [n0].[Id], [n0].[CollectionAssociateId], [n0].[Int], [n0].[Ints], [n0].[Name], [n0].[String], [a0].[Id], [a0].[CollectionRootId], [a0].[Int], [a0].[Ints], [a0].[Name], [a0].[OptionalNestedAssociateId], [a0].[RequiredNestedAssociateId], [a0].[String], [n7].[Id], [n7].[CollectionAssociateId], [n7].[Int], [n7].[Ints], [n7].[Name], [n7].[String], [n1].[Id], [n1].[CollectionAssociateId], [n1].[Int], [n1].[Ints], [n1].[Name], [n1].[String], [n2].[Id], [n2].[CollectionAssociateId], [n2].[Int], [n2].[Ints], [n2].[Name], [n2].[String] FROM [RootEntity] AS [r] LEFT JOIN [AssociateType] AS [a] ON [r].[OptionalAssociateId] = [a].[Id] LEFT JOIN [NestedAssociateType] AS [n] ON [a].[OptionalNestedAssociateId] = [n].[Id] @@ -48,7 +48,7 @@ FROM [RootEntity] AS [r] LEFT JOIN [NestedAssociateType] AS [n1] ON [a0].[OptionalNestedAssociateId] = [n1].[Id] INNER JOIN [NestedAssociateType] AS [n2] ON [a0].[RequiredNestedAssociateId] = [n2].[Id] LEFT JOIN ( - SELECT [a1].[Id], [a1].[CollectionRootId], [a1].[Int], [a1].[Ints], [a1].[Name], [a1].[OptionalNestedAssociateId], [a1].[RequiredNestedAssociateId], [a1].[String], [n3].[Id] AS [Id0], [n4].[Id] AS [Id1], [n5].[Id] AS [Id2], [n5].[CollectionAssociateId], [n5].[Int] AS [Int0], [n5].[Ints] AS [Ints0], [n5].[Name] AS [Name0], [n5].[String] AS [String0], [n3].[CollectionAssociateId] AS [CollectionAssociateId0], [n3].[Int] AS [Int1], [n3].[Ints] AS [Ints1], [n3].[Name] AS [Name1], [n3].[String] AS [String1], [n4].[CollectionAssociateId] AS [CollectionAssociateId1], [n4].[Int] AS [Int2], [n4].[Ints] AS [Ints2], [n4].[Name] AS [Name2], [n4].[String] AS [String2] + SELECT [a1].[Id], [a1].[CollectionRootId], [a1].[Int], [a1].[Ints], [a1].[Name], [a1].[OptionalNestedAssociateId], [a1].[RequiredNestedAssociateId], [a1].[String], [n5].[Id] AS [Id0], [n5].[CollectionAssociateId], [n5].[Int] AS [Int0], [n5].[Ints] AS [Ints0], [n5].[Name] AS [Name0], [n5].[String] AS [String0], [n3].[Id] AS [Id1], [n3].[CollectionAssociateId] AS [CollectionAssociateId0], [n3].[Int] AS [Int1], [n3].[Ints] AS [Ints1], [n3].[Name] AS [Name1], [n3].[String] AS [String1], [n4].[Id] AS [Id2], [n4].[CollectionAssociateId] AS [CollectionAssociateId1], [n4].[Int] AS [Int2], [n4].[Ints] AS [Ints2], [n4].[Name] AS [Name2], [n4].[String] AS [String2] FROM [AssociateType] AS [a1] LEFT JOIN [NestedAssociateType] AS [n3] ON [a1].[OptionalNestedAssociateId] = [n3].[Id] INNER JOIN [NestedAssociateType] AS [n4] ON [a1].[RequiredNestedAssociateId] = [n4].[Id] @@ -56,7 +56,7 @@ FROM [AssociateType] AS [a1] ) AS [s] ON [r].[Id] = [s].[CollectionRootId] LEFT JOIN [NestedAssociateType] AS [n6] ON [a].[Id] = [n6].[CollectionAssociateId] LEFT JOIN [NestedAssociateType] AS [n7] ON [a0].[Id] = [n7].[CollectionAssociateId] -ORDER BY [r].[Id], [a].[Id], [n].[Id], [n0].[Id], [a0].[Id], [n1].[Id], [n2].[Id], [s].[Id], [s].[Id0], [s].[Id1], [s].[Id2], [n6].[Id] +ORDER BY [r].[Id], [s].[Id], [s].[Id0], [n6].[Id] """); } @@ -66,7 +66,7 @@ public override async Task Include_collection(bool async) AssertSql( """ -SELECT [r].[Id], [r].[Name], [r].[OptionalAssociateId], [r].[RequiredAssociateId], [a].[Id], [n].[Id], [n0].[Id], [a0].[Id], [n1].[Id], [n2].[Id], [s].[Id], [s].[CollectionRootId], [s].[Int], [s].[Ints], [s].[Name], [s].[OptionalNestedAssociateId], [s].[RequiredNestedAssociateId], [s].[String], [s].[Id0], [s].[Id1], [s].[Id2], [s].[CollectionAssociateId], [s].[Int0], [s].[Ints0], [s].[Name0], [s].[String0], [s].[CollectionAssociateId0], [s].[Int1], [s].[Ints1], [s].[Name1], [s].[String1], [s].[CollectionAssociateId1], [s].[Int2], [s].[Ints2], [s].[Name2], [s].[String2], [a].[CollectionRootId], [a].[Int], [a].[Ints], [a].[Name], [a].[OptionalNestedAssociateId], [a].[RequiredNestedAssociateId], [a].[String], [n6].[Id], [n6].[CollectionAssociateId], [n6].[Int], [n6].[Ints], [n6].[Name], [n6].[String], [n].[CollectionAssociateId], [n].[Int], [n].[Ints], [n].[Name], [n].[String], [n0].[CollectionAssociateId], [n0].[Int], [n0].[Ints], [n0].[Name], [n0].[String], [a0].[CollectionRootId], [a0].[Int], [a0].[Ints], [a0].[Name], [a0].[OptionalNestedAssociateId], [a0].[RequiredNestedAssociateId], [a0].[String], [n7].[Id], [n7].[CollectionAssociateId], [n7].[Int], [n7].[Ints], [n7].[Name], [n7].[String], [n1].[CollectionAssociateId], [n1].[Int], [n1].[Ints], [n1].[Name], [n1].[String], [n2].[CollectionAssociateId], [n2].[Int], [n2].[Ints], [n2].[Name], [n2].[String] +SELECT [r].[Id], [r].[Name], [r].[OptionalAssociateId], [r].[RequiredAssociateId], [s].[Id], [s].[CollectionRootId], [s].[Int], [s].[Ints], [s].[Name], [s].[OptionalNestedAssociateId], [s].[RequiredNestedAssociateId], [s].[String], [s].[Id0], [s].[CollectionAssociateId], [s].[Int0], [s].[Ints0], [s].[Name0], [s].[String0], [s].[Id1], [s].[CollectionAssociateId0], [s].[Int1], [s].[Ints1], [s].[Name1], [s].[String1], [s].[Id2], [s].[CollectionAssociateId1], [s].[Int2], [s].[Ints2], [s].[Name2], [s].[String2], [a].[Id], [a].[CollectionRootId], [a].[Int], [a].[Ints], [a].[Name], [a].[OptionalNestedAssociateId], [a].[RequiredNestedAssociateId], [a].[String], [n6].[Id], [n6].[CollectionAssociateId], [n6].[Int], [n6].[Ints], [n6].[Name], [n6].[String], [n].[Id], [n].[CollectionAssociateId], [n].[Int], [n].[Ints], [n].[Name], [n].[String], [n0].[Id], [n0].[CollectionAssociateId], [n0].[Int], [n0].[Ints], [n0].[Name], [n0].[String], [a0].[Id], [a0].[CollectionRootId], [a0].[Int], [a0].[Ints], [a0].[Name], [a0].[OptionalNestedAssociateId], [a0].[RequiredNestedAssociateId], [a0].[String], [n7].[Id], [n7].[CollectionAssociateId], [n7].[Int], [n7].[Ints], [n7].[Name], [n7].[String], [n1].[Id], [n1].[CollectionAssociateId], [n1].[Int], [n1].[Ints], [n1].[Name], [n1].[String], [n2].[Id], [n2].[CollectionAssociateId], [n2].[Int], [n2].[Ints], [n2].[Name], [n2].[String] FROM [RootEntity] AS [r] LEFT JOIN [AssociateType] AS [a] ON [r].[OptionalAssociateId] = [a].[Id] LEFT JOIN [NestedAssociateType] AS [n] ON [a].[OptionalNestedAssociateId] = [n].[Id] @@ -75,7 +75,7 @@ FROM [RootEntity] AS [r] LEFT JOIN [NestedAssociateType] AS [n1] ON [a0].[OptionalNestedAssociateId] = [n1].[Id] INNER JOIN [NestedAssociateType] AS [n2] ON [a0].[RequiredNestedAssociateId] = [n2].[Id] LEFT JOIN ( - SELECT [a1].[Id], [a1].[CollectionRootId], [a1].[Int], [a1].[Ints], [a1].[Name], [a1].[OptionalNestedAssociateId], [a1].[RequiredNestedAssociateId], [a1].[String], [n3].[Id] AS [Id0], [n4].[Id] AS [Id1], [n5].[Id] AS [Id2], [n5].[CollectionAssociateId], [n5].[Int] AS [Int0], [n5].[Ints] AS [Ints0], [n5].[Name] AS [Name0], [n5].[String] AS [String0], [n3].[CollectionAssociateId] AS [CollectionAssociateId0], [n3].[Int] AS [Int1], [n3].[Ints] AS [Ints1], [n3].[Name] AS [Name1], [n3].[String] AS [String1], [n4].[CollectionAssociateId] AS [CollectionAssociateId1], [n4].[Int] AS [Int2], [n4].[Ints] AS [Ints2], [n4].[Name] AS [Name2], [n4].[String] AS [String2] + SELECT [a1].[Id], [a1].[CollectionRootId], [a1].[Int], [a1].[Ints], [a1].[Name], [a1].[OptionalNestedAssociateId], [a1].[RequiredNestedAssociateId], [a1].[String], [n5].[Id] AS [Id0], [n5].[CollectionAssociateId], [n5].[Int] AS [Int0], [n5].[Ints] AS [Ints0], [n5].[Name] AS [Name0], [n5].[String] AS [String0], [n3].[Id] AS [Id1], [n3].[CollectionAssociateId] AS [CollectionAssociateId0], [n3].[Int] AS [Int1], [n3].[Ints] AS [Ints1], [n3].[Name] AS [Name1], [n3].[String] AS [String1], [n4].[Id] AS [Id2], [n4].[CollectionAssociateId] AS [CollectionAssociateId1], [n4].[Int] AS [Int2], [n4].[Ints] AS [Ints2], [n4].[Name] AS [Name2], [n4].[String] AS [String2] FROM [AssociateType] AS [a1] LEFT JOIN [NestedAssociateType] AS [n3] ON [a1].[OptionalNestedAssociateId] = [n3].[Id] INNER JOIN [NestedAssociateType] AS [n4] ON [a1].[RequiredNestedAssociateId] = [n4].[Id] @@ -83,7 +83,7 @@ FROM [AssociateType] AS [a1] ) AS [s] ON [r].[Id] = [s].[CollectionRootId] LEFT JOIN [NestedAssociateType] AS [n6] ON [a].[Id] = [n6].[CollectionAssociateId] LEFT JOIN [NestedAssociateType] AS [n7] ON [a0].[Id] = [n7].[CollectionAssociateId] -ORDER BY [r].[Id], [a].[Id], [n].[Id], [n0].[Id], [a0].[Id], [n1].[Id], [n2].[Id], [s].[Id], [s].[Id0], [s].[Id1], [s].[Id2], [n6].[Id] +ORDER BY [r].[Id], [s].[Id], [s].[Id0], [n6].[Id] """); } @@ -93,7 +93,7 @@ public override async Task Include_required_optional_and_collection(bool async) AssertSql( """ -SELECT [r].[Id], [r].[Name], [r].[OptionalAssociateId], [r].[RequiredAssociateId], [a].[Id], [n].[Id], [n0].[Id], [a0].[Id], [n1].[Id], [n2].[Id], [s].[Id], [s].[CollectionRootId], [s].[Int], [s].[Ints], [s].[Name], [s].[OptionalNestedAssociateId], [s].[RequiredNestedAssociateId], [s].[String], [s].[Id0], [s].[Id1], [s].[Id2], [s].[CollectionAssociateId], [s].[Int0], [s].[Ints0], [s].[Name0], [s].[String0], [s].[CollectionAssociateId0], [s].[Int1], [s].[Ints1], [s].[Name1], [s].[String1], [s].[CollectionAssociateId1], [s].[Int2], [s].[Ints2], [s].[Name2], [s].[String2], [a].[CollectionRootId], [a].[Int], [a].[Ints], [a].[Name], [a].[OptionalNestedAssociateId], [a].[RequiredNestedAssociateId], [a].[String], [n6].[Id], [n6].[CollectionAssociateId], [n6].[Int], [n6].[Ints], [n6].[Name], [n6].[String], [n].[CollectionAssociateId], [n].[Int], [n].[Ints], [n].[Name], [n].[String], [n0].[CollectionAssociateId], [n0].[Int], [n0].[Ints], [n0].[Name], [n0].[String], [a0].[CollectionRootId], [a0].[Int], [a0].[Ints], [a0].[Name], [a0].[OptionalNestedAssociateId], [a0].[RequiredNestedAssociateId], [a0].[String], [n7].[Id], [n7].[CollectionAssociateId], [n7].[Int], [n7].[Ints], [n7].[Name], [n7].[String], [n1].[CollectionAssociateId], [n1].[Int], [n1].[Ints], [n1].[Name], [n1].[String], [n2].[CollectionAssociateId], [n2].[Int], [n2].[Ints], [n2].[Name], [n2].[String] +SELECT [r].[Id], [r].[Name], [r].[OptionalAssociateId], [r].[RequiredAssociateId], [s].[Id], [s].[CollectionRootId], [s].[Int], [s].[Ints], [s].[Name], [s].[OptionalNestedAssociateId], [s].[RequiredNestedAssociateId], [s].[String], [s].[Id0], [s].[CollectionAssociateId], [s].[Int0], [s].[Ints0], [s].[Name0], [s].[String0], [s].[Id1], [s].[CollectionAssociateId0], [s].[Int1], [s].[Ints1], [s].[Name1], [s].[String1], [s].[Id2], [s].[CollectionAssociateId1], [s].[Int2], [s].[Ints2], [s].[Name2], [s].[String2], [a].[Id], [a].[CollectionRootId], [a].[Int], [a].[Ints], [a].[Name], [a].[OptionalNestedAssociateId], [a].[RequiredNestedAssociateId], [a].[String], [n6].[Id], [n6].[CollectionAssociateId], [n6].[Int], [n6].[Ints], [n6].[Name], [n6].[String], [n].[Id], [n].[CollectionAssociateId], [n].[Int], [n].[Ints], [n].[Name], [n].[String], [n0].[Id], [n0].[CollectionAssociateId], [n0].[Int], [n0].[Ints], [n0].[Name], [n0].[String], [a0].[Id], [a0].[CollectionRootId], [a0].[Int], [a0].[Ints], [a0].[Name], [a0].[OptionalNestedAssociateId], [a0].[RequiredNestedAssociateId], [a0].[String], [n7].[Id], [n7].[CollectionAssociateId], [n7].[Int], [n7].[Ints], [n7].[Name], [n7].[String], [n1].[Id], [n1].[CollectionAssociateId], [n1].[Int], [n1].[Ints], [n1].[Name], [n1].[String], [n2].[Id], [n2].[CollectionAssociateId], [n2].[Int], [n2].[Ints], [n2].[Name], [n2].[String] FROM [RootEntity] AS [r] LEFT JOIN [AssociateType] AS [a] ON [r].[OptionalAssociateId] = [a].[Id] LEFT JOIN [NestedAssociateType] AS [n] ON [a].[OptionalNestedAssociateId] = [n].[Id] @@ -102,7 +102,7 @@ FROM [RootEntity] AS [r] LEFT JOIN [NestedAssociateType] AS [n1] ON [a0].[OptionalNestedAssociateId] = [n1].[Id] INNER JOIN [NestedAssociateType] AS [n2] ON [a0].[RequiredNestedAssociateId] = [n2].[Id] LEFT JOIN ( - SELECT [a1].[Id], [a1].[CollectionRootId], [a1].[Int], [a1].[Ints], [a1].[Name], [a1].[OptionalNestedAssociateId], [a1].[RequiredNestedAssociateId], [a1].[String], [n3].[Id] AS [Id0], [n4].[Id] AS [Id1], [n5].[Id] AS [Id2], [n5].[CollectionAssociateId], [n5].[Int] AS [Int0], [n5].[Ints] AS [Ints0], [n5].[Name] AS [Name0], [n5].[String] AS [String0], [n3].[CollectionAssociateId] AS [CollectionAssociateId0], [n3].[Int] AS [Int1], [n3].[Ints] AS [Ints1], [n3].[Name] AS [Name1], [n3].[String] AS [String1], [n4].[CollectionAssociateId] AS [CollectionAssociateId1], [n4].[Int] AS [Int2], [n4].[Ints] AS [Ints2], [n4].[Name] AS [Name2], [n4].[String] AS [String2] + SELECT [a1].[Id], [a1].[CollectionRootId], [a1].[Int], [a1].[Ints], [a1].[Name], [a1].[OptionalNestedAssociateId], [a1].[RequiredNestedAssociateId], [a1].[String], [n5].[Id] AS [Id0], [n5].[CollectionAssociateId], [n5].[Int] AS [Int0], [n5].[Ints] AS [Ints0], [n5].[Name] AS [Name0], [n5].[String] AS [String0], [n3].[Id] AS [Id1], [n3].[CollectionAssociateId] AS [CollectionAssociateId0], [n3].[Int] AS [Int1], [n3].[Ints] AS [Ints1], [n3].[Name] AS [Name1], [n3].[String] AS [String1], [n4].[Id] AS [Id2], [n4].[CollectionAssociateId] AS [CollectionAssociateId1], [n4].[Int] AS [Int2], [n4].[Ints] AS [Ints2], [n4].[Name] AS [Name2], [n4].[String] AS [String2] FROM [AssociateType] AS [a1] LEFT JOIN [NestedAssociateType] AS [n3] ON [a1].[OptionalNestedAssociateId] = [n3].[Id] INNER JOIN [NestedAssociateType] AS [n4] ON [a1].[RequiredNestedAssociateId] = [n4].[Id] @@ -110,7 +110,7 @@ FROM [AssociateType] AS [a1] ) AS [s] ON [r].[Id] = [s].[CollectionRootId] LEFT JOIN [NestedAssociateType] AS [n6] ON [a].[Id] = [n6].[CollectionAssociateId] LEFT JOIN [NestedAssociateType] AS [n7] ON [a0].[Id] = [n7].[CollectionAssociateId] -ORDER BY [r].[Id], [a].[Id], [n].[Id], [n0].[Id], [a0].[Id], [n1].[Id], [n2].[Id], [s].[Id], [s].[Id0], [s].[Id1], [s].[Id2], [n6].[Id] +ORDER BY [r].[Id], [s].[Id], [s].[Id0], [n6].[Id] """); } @@ -120,7 +120,7 @@ public override async Task Include_nested(bool async) AssertSql( """ -SELECT [r].[Id], [r].[Name], [r].[OptionalAssociateId], [r].[RequiredAssociateId], [a].[Id], [n].[Id], [n0].[Id], [a0].[Id], [n1].[Id], [n2].[Id], [s].[Id], [s].[CollectionRootId], [s].[Int], [s].[Ints], [s].[Name], [s].[OptionalNestedAssociateId], [s].[RequiredNestedAssociateId], [s].[String], [s].[Id0], [s].[Id1], [s].[Id2], [s].[CollectionAssociateId], [s].[Int0], [s].[Ints0], [s].[Name0], [s].[String0], [s].[CollectionAssociateId0], [s].[Int1], [s].[Ints1], [s].[Name1], [s].[String1], [s].[CollectionAssociateId1], [s].[Int2], [s].[Ints2], [s].[Name2], [s].[String2], [a].[CollectionRootId], [a].[Int], [a].[Ints], [a].[Name], [a].[OptionalNestedAssociateId], [a].[RequiredNestedAssociateId], [a].[String], [n6].[Id], [n6].[CollectionAssociateId], [n6].[Int], [n6].[Ints], [n6].[Name], [n6].[String], [n].[CollectionAssociateId], [n].[Int], [n].[Ints], [n].[Name], [n].[String], [n0].[CollectionAssociateId], [n0].[Int], [n0].[Ints], [n0].[Name], [n0].[String], [a0].[CollectionRootId], [a0].[Int], [a0].[Ints], [a0].[Name], [a0].[OptionalNestedAssociateId], [a0].[RequiredNestedAssociateId], [a0].[String], [n7].[Id], [n7].[CollectionAssociateId], [n7].[Int], [n7].[Ints], [n7].[Name], [n7].[String], [n1].[CollectionAssociateId], [n1].[Int], [n1].[Ints], [n1].[Name], [n1].[String], [n2].[CollectionAssociateId], [n2].[Int], [n2].[Ints], [n2].[Name], [n2].[String] +SELECT [r].[Id], [r].[Name], [r].[OptionalAssociateId], [r].[RequiredAssociateId], [s].[Id], [s].[CollectionRootId], [s].[Int], [s].[Ints], [s].[Name], [s].[OptionalNestedAssociateId], [s].[RequiredNestedAssociateId], [s].[String], [s].[Id0], [s].[CollectionAssociateId], [s].[Int0], [s].[Ints0], [s].[Name0], [s].[String0], [s].[Id1], [s].[CollectionAssociateId0], [s].[Int1], [s].[Ints1], [s].[Name1], [s].[String1], [s].[Id2], [s].[CollectionAssociateId1], [s].[Int2], [s].[Ints2], [s].[Name2], [s].[String2], [a].[Id], [a].[CollectionRootId], [a].[Int], [a].[Ints], [a].[Name], [a].[OptionalNestedAssociateId], [a].[RequiredNestedAssociateId], [a].[String], [n6].[Id], [n6].[CollectionAssociateId], [n6].[Int], [n6].[Ints], [n6].[Name], [n6].[String], [n].[Id], [n].[CollectionAssociateId], [n].[Int], [n].[Ints], [n].[Name], [n].[String], [n0].[Id], [n0].[CollectionAssociateId], [n0].[Int], [n0].[Ints], [n0].[Name], [n0].[String], [a0].[Id], [a0].[CollectionRootId], [a0].[Int], [a0].[Ints], [a0].[Name], [a0].[OptionalNestedAssociateId], [a0].[RequiredNestedAssociateId], [a0].[String], [n7].[Id], [n7].[CollectionAssociateId], [n7].[Int], [n7].[Ints], [n7].[Name], [n7].[String], [n1].[Id], [n1].[CollectionAssociateId], [n1].[Int], [n1].[Ints], [n1].[Name], [n1].[String], [n2].[Id], [n2].[CollectionAssociateId], [n2].[Int], [n2].[Ints], [n2].[Name], [n2].[String] FROM [RootEntity] AS [r] LEFT JOIN [AssociateType] AS [a] ON [r].[OptionalAssociateId] = [a].[Id] LEFT JOIN [NestedAssociateType] AS [n] ON [a].[OptionalNestedAssociateId] = [n].[Id] @@ -129,7 +129,7 @@ FROM [RootEntity] AS [r] LEFT JOIN [NestedAssociateType] AS [n1] ON [a0].[OptionalNestedAssociateId] = [n1].[Id] INNER JOIN [NestedAssociateType] AS [n2] ON [a0].[RequiredNestedAssociateId] = [n2].[Id] LEFT JOIN ( - SELECT [a1].[Id], [a1].[CollectionRootId], [a1].[Int], [a1].[Ints], [a1].[Name], [a1].[OptionalNestedAssociateId], [a1].[RequiredNestedAssociateId], [a1].[String], [n3].[Id] AS [Id0], [n4].[Id] AS [Id1], [n5].[Id] AS [Id2], [n5].[CollectionAssociateId], [n5].[Int] AS [Int0], [n5].[Ints] AS [Ints0], [n5].[Name] AS [Name0], [n5].[String] AS [String0], [n3].[CollectionAssociateId] AS [CollectionAssociateId0], [n3].[Int] AS [Int1], [n3].[Ints] AS [Ints1], [n3].[Name] AS [Name1], [n3].[String] AS [String1], [n4].[CollectionAssociateId] AS [CollectionAssociateId1], [n4].[Int] AS [Int2], [n4].[Ints] AS [Ints2], [n4].[Name] AS [Name2], [n4].[String] AS [String2] + SELECT [a1].[Id], [a1].[CollectionRootId], [a1].[Int], [a1].[Ints], [a1].[Name], [a1].[OptionalNestedAssociateId], [a1].[RequiredNestedAssociateId], [a1].[String], [n5].[Id] AS [Id0], [n5].[CollectionAssociateId], [n5].[Int] AS [Int0], [n5].[Ints] AS [Ints0], [n5].[Name] AS [Name0], [n5].[String] AS [String0], [n3].[Id] AS [Id1], [n3].[CollectionAssociateId] AS [CollectionAssociateId0], [n3].[Int] AS [Int1], [n3].[Ints] AS [Ints1], [n3].[Name] AS [Name1], [n3].[String] AS [String1], [n4].[Id] AS [Id2], [n4].[CollectionAssociateId] AS [CollectionAssociateId1], [n4].[Int] AS [Int2], [n4].[Ints] AS [Ints2], [n4].[Name] AS [Name2], [n4].[String] AS [String2] FROM [AssociateType] AS [a1] LEFT JOIN [NestedAssociateType] AS [n3] ON [a1].[OptionalNestedAssociateId] = [n3].[Id] INNER JOIN [NestedAssociateType] AS [n4] ON [a1].[RequiredNestedAssociateId] = [n4].[Id] @@ -137,7 +137,7 @@ FROM [AssociateType] AS [a1] ) AS [s] ON [r].[Id] = [s].[CollectionRootId] LEFT JOIN [NestedAssociateType] AS [n6] ON [a].[Id] = [n6].[CollectionAssociateId] LEFT JOIN [NestedAssociateType] AS [n7] ON [a0].[Id] = [n7].[CollectionAssociateId] -ORDER BY [r].[Id], [a].[Id], [n].[Id], [n0].[Id], [a0].[Id], [n1].[Id], [n2].[Id], [s].[Id], [s].[Id0], [s].[Id1], [s].[Id2], [n6].[Id] +ORDER BY [r].[Id], [s].[Id], [s].[Id0], [n6].[Id] """); } @@ -147,7 +147,7 @@ public override async Task Include_nested_optional(bool async) AssertSql( """ -SELECT [r].[Id], [r].[Name], [r].[OptionalAssociateId], [r].[RequiredAssociateId], [a].[Id], [n].[Id], [n0].[Id], [a0].[Id], [n1].[Id], [n2].[Id], [s].[Id], [s].[CollectionRootId], [s].[Int], [s].[Ints], [s].[Name], [s].[OptionalNestedAssociateId], [s].[RequiredNestedAssociateId], [s].[String], [s].[Id0], [s].[Id1], [s].[Id2], [s].[CollectionAssociateId], [s].[Int0], [s].[Ints0], [s].[Name0], [s].[String0], [s].[CollectionAssociateId0], [s].[Int1], [s].[Ints1], [s].[Name1], [s].[String1], [s].[CollectionAssociateId1], [s].[Int2], [s].[Ints2], [s].[Name2], [s].[String2], [a].[CollectionRootId], [a].[Int], [a].[Ints], [a].[Name], [a].[OptionalNestedAssociateId], [a].[RequiredNestedAssociateId], [a].[String], [n6].[Id], [n6].[CollectionAssociateId], [n6].[Int], [n6].[Ints], [n6].[Name], [n6].[String], [n].[CollectionAssociateId], [n].[Int], [n].[Ints], [n].[Name], [n].[String], [n0].[CollectionAssociateId], [n0].[Int], [n0].[Ints], [n0].[Name], [n0].[String], [a0].[CollectionRootId], [a0].[Int], [a0].[Ints], [a0].[Name], [a0].[OptionalNestedAssociateId], [a0].[RequiredNestedAssociateId], [a0].[String], [n7].[Id], [n7].[CollectionAssociateId], [n7].[Int], [n7].[Ints], [n7].[Name], [n7].[String], [n1].[CollectionAssociateId], [n1].[Int], [n1].[Ints], [n1].[Name], [n1].[String], [n2].[CollectionAssociateId], [n2].[Int], [n2].[Ints], [n2].[Name], [n2].[String] +SELECT [r].[Id], [r].[Name], [r].[OptionalAssociateId], [r].[RequiredAssociateId], [s].[Id], [s].[CollectionRootId], [s].[Int], [s].[Ints], [s].[Name], [s].[OptionalNestedAssociateId], [s].[RequiredNestedAssociateId], [s].[String], [s].[Id0], [s].[CollectionAssociateId], [s].[Int0], [s].[Ints0], [s].[Name0], [s].[String0], [s].[Id1], [s].[CollectionAssociateId0], [s].[Int1], [s].[Ints1], [s].[Name1], [s].[String1], [s].[Id2], [s].[CollectionAssociateId1], [s].[Int2], [s].[Ints2], [s].[Name2], [s].[String2], [a].[Id], [a].[CollectionRootId], [a].[Int], [a].[Ints], [a].[Name], [a].[OptionalNestedAssociateId], [a].[RequiredNestedAssociateId], [a].[String], [n6].[Id], [n6].[CollectionAssociateId], [n6].[Int], [n6].[Ints], [n6].[Name], [n6].[String], [n].[Id], [n].[CollectionAssociateId], [n].[Int], [n].[Ints], [n].[Name], [n].[String], [n0].[Id], [n0].[CollectionAssociateId], [n0].[Int], [n0].[Ints], [n0].[Name], [n0].[String], [a0].[Id], [a0].[CollectionRootId], [a0].[Int], [a0].[Ints], [a0].[Name], [a0].[OptionalNestedAssociateId], [a0].[RequiredNestedAssociateId], [a0].[String], [n7].[Id], [n7].[CollectionAssociateId], [n7].[Int], [n7].[Ints], [n7].[Name], [n7].[String], [n1].[Id], [n1].[CollectionAssociateId], [n1].[Int], [n1].[Ints], [n1].[Name], [n1].[String], [n2].[Id], [n2].[CollectionAssociateId], [n2].[Int], [n2].[Ints], [n2].[Name], [n2].[String] FROM [RootEntity] AS [r] LEFT JOIN [AssociateType] AS [a] ON [r].[OptionalAssociateId] = [a].[Id] LEFT JOIN [NestedAssociateType] AS [n] ON [a].[OptionalNestedAssociateId] = [n].[Id] @@ -156,7 +156,7 @@ FROM [RootEntity] AS [r] LEFT JOIN [NestedAssociateType] AS [n1] ON [a0].[OptionalNestedAssociateId] = [n1].[Id] INNER JOIN [NestedAssociateType] AS [n2] ON [a0].[RequiredNestedAssociateId] = [n2].[Id] LEFT JOIN ( - SELECT [a1].[Id], [a1].[CollectionRootId], [a1].[Int], [a1].[Ints], [a1].[Name], [a1].[OptionalNestedAssociateId], [a1].[RequiredNestedAssociateId], [a1].[String], [n3].[Id] AS [Id0], [n4].[Id] AS [Id1], [n5].[Id] AS [Id2], [n5].[CollectionAssociateId], [n5].[Int] AS [Int0], [n5].[Ints] AS [Ints0], [n5].[Name] AS [Name0], [n5].[String] AS [String0], [n3].[CollectionAssociateId] AS [CollectionAssociateId0], [n3].[Int] AS [Int1], [n3].[Ints] AS [Ints1], [n3].[Name] AS [Name1], [n3].[String] AS [String1], [n4].[CollectionAssociateId] AS [CollectionAssociateId1], [n4].[Int] AS [Int2], [n4].[Ints] AS [Ints2], [n4].[Name] AS [Name2], [n4].[String] AS [String2] + SELECT [a1].[Id], [a1].[CollectionRootId], [a1].[Int], [a1].[Ints], [a1].[Name], [a1].[OptionalNestedAssociateId], [a1].[RequiredNestedAssociateId], [a1].[String], [n5].[Id] AS [Id0], [n5].[CollectionAssociateId], [n5].[Int] AS [Int0], [n5].[Ints] AS [Ints0], [n5].[Name] AS [Name0], [n5].[String] AS [String0], [n3].[Id] AS [Id1], [n3].[CollectionAssociateId] AS [CollectionAssociateId0], [n3].[Int] AS [Int1], [n3].[Ints] AS [Ints1], [n3].[Name] AS [Name1], [n3].[String] AS [String1], [n4].[Id] AS [Id2], [n4].[CollectionAssociateId] AS [CollectionAssociateId1], [n4].[Int] AS [Int2], [n4].[Ints] AS [Ints2], [n4].[Name] AS [Name2], [n4].[String] AS [String2] FROM [AssociateType] AS [a1] LEFT JOIN [NestedAssociateType] AS [n3] ON [a1].[OptionalNestedAssociateId] = [n3].[Id] INNER JOIN [NestedAssociateType] AS [n4] ON [a1].[RequiredNestedAssociateId] = [n4].[Id] @@ -164,7 +164,7 @@ FROM [AssociateType] AS [a1] ) AS [s] ON [r].[Id] = [s].[CollectionRootId] LEFT JOIN [NestedAssociateType] AS [n6] ON [a].[Id] = [n6].[CollectionAssociateId] LEFT JOIN [NestedAssociateType] AS [n7] ON [a0].[Id] = [n7].[CollectionAssociateId] -ORDER BY [r].[Id], [a].[Id], [n].[Id], [n0].[Id], [a0].[Id], [n1].[Id], [n2].[Id], [s].[Id], [s].[Id0], [s].[Id1], [s].[Id2], [n6].[Id] +ORDER BY [r].[Id], [s].[Id], [s].[Id0], [n6].[Id] """); } @@ -174,7 +174,7 @@ public override async Task Include_nested_collection(bool async) AssertSql( """ -SELECT [r].[Id], [r].[Name], [r].[OptionalAssociateId], [r].[RequiredAssociateId], [a].[Id], [n].[Id], [n0].[Id], [a0].[Id], [n1].[Id], [n2].[Id], [s].[Id], [s].[CollectionRootId], [s].[Int], [s].[Ints], [s].[Name], [s].[OptionalNestedAssociateId], [s].[RequiredNestedAssociateId], [s].[String], [s].[Id0], [s].[Id1], [s].[Id2], [s].[CollectionAssociateId], [s].[Int0], [s].[Ints0], [s].[Name0], [s].[String0], [s].[CollectionAssociateId0], [s].[Int1], [s].[Ints1], [s].[Name1], [s].[String1], [s].[CollectionAssociateId1], [s].[Int2], [s].[Ints2], [s].[Name2], [s].[String2], [a].[CollectionRootId], [a].[Int], [a].[Ints], [a].[Name], [a].[OptionalNestedAssociateId], [a].[RequiredNestedAssociateId], [a].[String], [n6].[Id], [n6].[CollectionAssociateId], [n6].[Int], [n6].[Ints], [n6].[Name], [n6].[String], [n].[CollectionAssociateId], [n].[Int], [n].[Ints], [n].[Name], [n].[String], [n0].[CollectionAssociateId], [n0].[Int], [n0].[Ints], [n0].[Name], [n0].[String], [a0].[CollectionRootId], [a0].[Int], [a0].[Ints], [a0].[Name], [a0].[OptionalNestedAssociateId], [a0].[RequiredNestedAssociateId], [a0].[String], [n7].[Id], [n7].[CollectionAssociateId], [n7].[Int], [n7].[Ints], [n7].[Name], [n7].[String], [n1].[CollectionAssociateId], [n1].[Int], [n1].[Ints], [n1].[Name], [n1].[String], [n2].[CollectionAssociateId], [n2].[Int], [n2].[Ints], [n2].[Name], [n2].[String] +SELECT [r].[Id], [r].[Name], [r].[OptionalAssociateId], [r].[RequiredAssociateId], [s].[Id], [s].[CollectionRootId], [s].[Int], [s].[Ints], [s].[Name], [s].[OptionalNestedAssociateId], [s].[RequiredNestedAssociateId], [s].[String], [s].[Id0], [s].[CollectionAssociateId], [s].[Int0], [s].[Ints0], [s].[Name0], [s].[String0], [s].[Id1], [s].[CollectionAssociateId0], [s].[Int1], [s].[Ints1], [s].[Name1], [s].[String1], [s].[Id2], [s].[CollectionAssociateId1], [s].[Int2], [s].[Ints2], [s].[Name2], [s].[String2], [a].[Id], [a].[CollectionRootId], [a].[Int], [a].[Ints], [a].[Name], [a].[OptionalNestedAssociateId], [a].[RequiredNestedAssociateId], [a].[String], [n6].[Id], [n6].[CollectionAssociateId], [n6].[Int], [n6].[Ints], [n6].[Name], [n6].[String], [n].[Id], [n].[CollectionAssociateId], [n].[Int], [n].[Ints], [n].[Name], [n].[String], [n0].[Id], [n0].[CollectionAssociateId], [n0].[Int], [n0].[Ints], [n0].[Name], [n0].[String], [a0].[Id], [a0].[CollectionRootId], [a0].[Int], [a0].[Ints], [a0].[Name], [a0].[OptionalNestedAssociateId], [a0].[RequiredNestedAssociateId], [a0].[String], [n7].[Id], [n7].[CollectionAssociateId], [n7].[Int], [n7].[Ints], [n7].[Name], [n7].[String], [n1].[Id], [n1].[CollectionAssociateId], [n1].[Int], [n1].[Ints], [n1].[Name], [n1].[String], [n2].[Id], [n2].[CollectionAssociateId], [n2].[Int], [n2].[Ints], [n2].[Name], [n2].[String] FROM [RootEntity] AS [r] LEFT JOIN [AssociateType] AS [a] ON [r].[OptionalAssociateId] = [a].[Id] LEFT JOIN [NestedAssociateType] AS [n] ON [a].[OptionalNestedAssociateId] = [n].[Id] @@ -183,7 +183,7 @@ FROM [RootEntity] AS [r] LEFT JOIN [NestedAssociateType] AS [n1] ON [a0].[OptionalNestedAssociateId] = [n1].[Id] INNER JOIN [NestedAssociateType] AS [n2] ON [a0].[RequiredNestedAssociateId] = [n2].[Id] LEFT JOIN ( - SELECT [a1].[Id], [a1].[CollectionRootId], [a1].[Int], [a1].[Ints], [a1].[Name], [a1].[OptionalNestedAssociateId], [a1].[RequiredNestedAssociateId], [a1].[String], [n3].[Id] AS [Id0], [n4].[Id] AS [Id1], [n5].[Id] AS [Id2], [n5].[CollectionAssociateId], [n5].[Int] AS [Int0], [n5].[Ints] AS [Ints0], [n5].[Name] AS [Name0], [n5].[String] AS [String0], [n3].[CollectionAssociateId] AS [CollectionAssociateId0], [n3].[Int] AS [Int1], [n3].[Ints] AS [Ints1], [n3].[Name] AS [Name1], [n3].[String] AS [String1], [n4].[CollectionAssociateId] AS [CollectionAssociateId1], [n4].[Int] AS [Int2], [n4].[Ints] AS [Ints2], [n4].[Name] AS [Name2], [n4].[String] AS [String2] + SELECT [a1].[Id], [a1].[CollectionRootId], [a1].[Int], [a1].[Ints], [a1].[Name], [a1].[OptionalNestedAssociateId], [a1].[RequiredNestedAssociateId], [a1].[String], [n5].[Id] AS [Id0], [n5].[CollectionAssociateId], [n5].[Int] AS [Int0], [n5].[Ints] AS [Ints0], [n5].[Name] AS [Name0], [n5].[String] AS [String0], [n3].[Id] AS [Id1], [n3].[CollectionAssociateId] AS [CollectionAssociateId0], [n3].[Int] AS [Int1], [n3].[Ints] AS [Ints1], [n3].[Name] AS [Name1], [n3].[String] AS [String1], [n4].[Id] AS [Id2], [n4].[CollectionAssociateId] AS [CollectionAssociateId1], [n4].[Int] AS [Int2], [n4].[Ints] AS [Ints2], [n4].[Name] AS [Name2], [n4].[String] AS [String2] FROM [AssociateType] AS [a1] LEFT JOIN [NestedAssociateType] AS [n3] ON [a1].[OptionalNestedAssociateId] = [n3].[Id] INNER JOIN [NestedAssociateType] AS [n4] ON [a1].[RequiredNestedAssociateId] = [n4].[Id] @@ -191,7 +191,7 @@ FROM [AssociateType] AS [a1] ) AS [s] ON [r].[Id] = [s].[CollectionRootId] LEFT JOIN [NestedAssociateType] AS [n6] ON [a].[Id] = [n6].[CollectionAssociateId] LEFT JOIN [NestedAssociateType] AS [n7] ON [a0].[Id] = [n7].[CollectionAssociateId] -ORDER BY [r].[Id], [a].[Id], [n].[Id], [n0].[Id], [a0].[Id], [n1].[Id], [n2].[Id], [s].[Id], [s].[Id0], [s].[Id1], [s].[Id2], [n6].[Id] +ORDER BY [r].[Id], [s].[Id], [s].[Id0], [n6].[Id] """); } @@ -201,7 +201,7 @@ public override async Task Include_nested_collection_on_optional(bool async) AssertSql( """ -SELECT [r].[Id], [r].[Name], [r].[OptionalAssociateId], [r].[RequiredAssociateId], [a].[Id], [n].[Id], [n0].[Id], [a0].[Id], [n1].[Id], [n2].[Id], [s].[Id], [s].[CollectionRootId], [s].[Int], [s].[Ints], [s].[Name], [s].[OptionalNestedAssociateId], [s].[RequiredNestedAssociateId], [s].[String], [s].[Id0], [s].[Id1], [s].[Id2], [s].[CollectionAssociateId], [s].[Int0], [s].[Ints0], [s].[Name0], [s].[String0], [s].[CollectionAssociateId0], [s].[Int1], [s].[Ints1], [s].[Name1], [s].[String1], [s].[CollectionAssociateId1], [s].[Int2], [s].[Ints2], [s].[Name2], [s].[String2], [a].[CollectionRootId], [a].[Int], [a].[Ints], [a].[Name], [a].[OptionalNestedAssociateId], [a].[RequiredNestedAssociateId], [a].[String], [n6].[Id], [n6].[CollectionAssociateId], [n6].[Int], [n6].[Ints], [n6].[Name], [n6].[String], [n].[CollectionAssociateId], [n].[Int], [n].[Ints], [n].[Name], [n].[String], [n0].[CollectionAssociateId], [n0].[Int], [n0].[Ints], [n0].[Name], [n0].[String], [a0].[CollectionRootId], [a0].[Int], [a0].[Ints], [a0].[Name], [a0].[OptionalNestedAssociateId], [a0].[RequiredNestedAssociateId], [a0].[String], [n7].[Id], [n7].[CollectionAssociateId], [n7].[Int], [n7].[Ints], [n7].[Name], [n7].[String], [n1].[CollectionAssociateId], [n1].[Int], [n1].[Ints], [n1].[Name], [n1].[String], [n2].[CollectionAssociateId], [n2].[Int], [n2].[Ints], [n2].[Name], [n2].[String] +SELECT [r].[Id], [r].[Name], [r].[OptionalAssociateId], [r].[RequiredAssociateId], [s].[Id], [s].[CollectionRootId], [s].[Int], [s].[Ints], [s].[Name], [s].[OptionalNestedAssociateId], [s].[RequiredNestedAssociateId], [s].[String], [s].[Id0], [s].[CollectionAssociateId], [s].[Int0], [s].[Ints0], [s].[Name0], [s].[String0], [s].[Id1], [s].[CollectionAssociateId0], [s].[Int1], [s].[Ints1], [s].[Name1], [s].[String1], [s].[Id2], [s].[CollectionAssociateId1], [s].[Int2], [s].[Ints2], [s].[Name2], [s].[String2], [a].[Id], [a].[CollectionRootId], [a].[Int], [a].[Ints], [a].[Name], [a].[OptionalNestedAssociateId], [a].[RequiredNestedAssociateId], [a].[String], [n6].[Id], [n6].[CollectionAssociateId], [n6].[Int], [n6].[Ints], [n6].[Name], [n6].[String], [n].[Id], [n].[CollectionAssociateId], [n].[Int], [n].[Ints], [n].[Name], [n].[String], [n0].[Id], [n0].[CollectionAssociateId], [n0].[Int], [n0].[Ints], [n0].[Name], [n0].[String], [a0].[Id], [a0].[CollectionRootId], [a0].[Int], [a0].[Ints], [a0].[Name], [a0].[OptionalNestedAssociateId], [a0].[RequiredNestedAssociateId], [a0].[String], [n7].[Id], [n7].[CollectionAssociateId], [n7].[Int], [n7].[Ints], [n7].[Name], [n7].[String], [n1].[Id], [n1].[CollectionAssociateId], [n1].[Int], [n1].[Ints], [n1].[Name], [n1].[String], [n2].[Id], [n2].[CollectionAssociateId], [n2].[Int], [n2].[Ints], [n2].[Name], [n2].[String] FROM [RootEntity] AS [r] LEFT JOIN [AssociateType] AS [a] ON [r].[OptionalAssociateId] = [a].[Id] LEFT JOIN [NestedAssociateType] AS [n] ON [a].[OptionalNestedAssociateId] = [n].[Id] @@ -210,7 +210,7 @@ FROM [RootEntity] AS [r] LEFT JOIN [NestedAssociateType] AS [n1] ON [a0].[OptionalNestedAssociateId] = [n1].[Id] INNER JOIN [NestedAssociateType] AS [n2] ON [a0].[RequiredNestedAssociateId] = [n2].[Id] LEFT JOIN ( - SELECT [a1].[Id], [a1].[CollectionRootId], [a1].[Int], [a1].[Ints], [a1].[Name], [a1].[OptionalNestedAssociateId], [a1].[RequiredNestedAssociateId], [a1].[String], [n3].[Id] AS [Id0], [n4].[Id] AS [Id1], [n5].[Id] AS [Id2], [n5].[CollectionAssociateId], [n5].[Int] AS [Int0], [n5].[Ints] AS [Ints0], [n5].[Name] AS [Name0], [n5].[String] AS [String0], [n3].[CollectionAssociateId] AS [CollectionAssociateId0], [n3].[Int] AS [Int1], [n3].[Ints] AS [Ints1], [n3].[Name] AS [Name1], [n3].[String] AS [String1], [n4].[CollectionAssociateId] AS [CollectionAssociateId1], [n4].[Int] AS [Int2], [n4].[Ints] AS [Ints2], [n4].[Name] AS [Name2], [n4].[String] AS [String2] + SELECT [a1].[Id], [a1].[CollectionRootId], [a1].[Int], [a1].[Ints], [a1].[Name], [a1].[OptionalNestedAssociateId], [a1].[RequiredNestedAssociateId], [a1].[String], [n5].[Id] AS [Id0], [n5].[CollectionAssociateId], [n5].[Int] AS [Int0], [n5].[Ints] AS [Ints0], [n5].[Name] AS [Name0], [n5].[String] AS [String0], [n3].[Id] AS [Id1], [n3].[CollectionAssociateId] AS [CollectionAssociateId0], [n3].[Int] AS [Int1], [n3].[Ints] AS [Ints1], [n3].[Name] AS [Name1], [n3].[String] AS [String1], [n4].[Id] AS [Id2], [n4].[CollectionAssociateId] AS [CollectionAssociateId1], [n4].[Int] AS [Int2], [n4].[Ints] AS [Ints2], [n4].[Name] AS [Name2], [n4].[String] AS [String2] FROM [AssociateType] AS [a1] LEFT JOIN [NestedAssociateType] AS [n3] ON [a1].[OptionalNestedAssociateId] = [n3].[Id] INNER JOIN [NestedAssociateType] AS [n4] ON [a1].[RequiredNestedAssociateId] = [n4].[Id] @@ -218,7 +218,7 @@ FROM [AssociateType] AS [a1] ) AS [s] ON [r].[Id] = [s].[CollectionRootId] LEFT JOIN [NestedAssociateType] AS [n6] ON [a].[Id] = [n6].[CollectionAssociateId] LEFT JOIN [NestedAssociateType] AS [n7] ON [a0].[Id] = [n7].[CollectionAssociateId] -ORDER BY [r].[Id], [a].[Id], [n].[Id], [n0].[Id], [a0].[Id], [n1].[Id], [n2].[Id], [s].[Id], [s].[Id0], [s].[Id1], [s].[Id2], [n6].[Id] +ORDER BY [r].[Id], [s].[Id], [s].[Id0], [n6].[Id] """); } @@ -228,7 +228,7 @@ public override async Task Include_nested_collection_on_collection(bool async) AssertSql( """ -SELECT [r].[Id], [r].[Name], [r].[OptionalAssociateId], [r].[RequiredAssociateId], [a].[Id], [n].[Id], [n0].[Id], [a0].[Id], [n1].[Id], [n2].[Id], [s].[Id], [s].[CollectionRootId], [s].[Int], [s].[Ints], [s].[Name], [s].[OptionalNestedAssociateId], [s].[RequiredNestedAssociateId], [s].[String], [s].[Id0], [s].[Id1], [s].[Id2], [s].[CollectionAssociateId], [s].[Int0], [s].[Ints0], [s].[Name0], [s].[String0], [s].[CollectionAssociateId0], [s].[Int1], [s].[Ints1], [s].[Name1], [s].[String1], [s].[CollectionAssociateId1], [s].[Int2], [s].[Ints2], [s].[Name2], [s].[String2], [a].[CollectionRootId], [a].[Int], [a].[Ints], [a].[Name], [a].[OptionalNestedAssociateId], [a].[RequiredNestedAssociateId], [a].[String], [n6].[Id], [n6].[CollectionAssociateId], [n6].[Int], [n6].[Ints], [n6].[Name], [n6].[String], [n].[CollectionAssociateId], [n].[Int], [n].[Ints], [n].[Name], [n].[String], [n0].[CollectionAssociateId], [n0].[Int], [n0].[Ints], [n0].[Name], [n0].[String], [a0].[CollectionRootId], [a0].[Int], [a0].[Ints], [a0].[Name], [a0].[OptionalNestedAssociateId], [a0].[RequiredNestedAssociateId], [a0].[String], [n7].[Id], [n7].[CollectionAssociateId], [n7].[Int], [n7].[Ints], [n7].[Name], [n7].[String], [n1].[CollectionAssociateId], [n1].[Int], [n1].[Ints], [n1].[Name], [n1].[String], [n2].[CollectionAssociateId], [n2].[Int], [n2].[Ints], [n2].[Name], [n2].[String] +SELECT [r].[Id], [r].[Name], [r].[OptionalAssociateId], [r].[RequiredAssociateId], [s].[Id], [s].[CollectionRootId], [s].[Int], [s].[Ints], [s].[Name], [s].[OptionalNestedAssociateId], [s].[RequiredNestedAssociateId], [s].[String], [s].[Id0], [s].[CollectionAssociateId], [s].[Int0], [s].[Ints0], [s].[Name0], [s].[String0], [s].[Id1], [s].[CollectionAssociateId0], [s].[Int1], [s].[Ints1], [s].[Name1], [s].[String1], [s].[Id2], [s].[CollectionAssociateId1], [s].[Int2], [s].[Ints2], [s].[Name2], [s].[String2], [a].[Id], [a].[CollectionRootId], [a].[Int], [a].[Ints], [a].[Name], [a].[OptionalNestedAssociateId], [a].[RequiredNestedAssociateId], [a].[String], [n6].[Id], [n6].[CollectionAssociateId], [n6].[Int], [n6].[Ints], [n6].[Name], [n6].[String], [n].[Id], [n].[CollectionAssociateId], [n].[Int], [n].[Ints], [n].[Name], [n].[String], [n0].[Id], [n0].[CollectionAssociateId], [n0].[Int], [n0].[Ints], [n0].[Name], [n0].[String], [a0].[Id], [a0].[CollectionRootId], [a0].[Int], [a0].[Ints], [a0].[Name], [a0].[OptionalNestedAssociateId], [a0].[RequiredNestedAssociateId], [a0].[String], [n7].[Id], [n7].[CollectionAssociateId], [n7].[Int], [n7].[Ints], [n7].[Name], [n7].[String], [n1].[Id], [n1].[CollectionAssociateId], [n1].[Int], [n1].[Ints], [n1].[Name], [n1].[String], [n2].[Id], [n2].[CollectionAssociateId], [n2].[Int], [n2].[Ints], [n2].[Name], [n2].[String] FROM [RootEntity] AS [r] LEFT JOIN [AssociateType] AS [a] ON [r].[OptionalAssociateId] = [a].[Id] LEFT JOIN [NestedAssociateType] AS [n] ON [a].[OptionalNestedAssociateId] = [n].[Id] @@ -237,7 +237,7 @@ FROM [RootEntity] AS [r] LEFT JOIN [NestedAssociateType] AS [n1] ON [a0].[OptionalNestedAssociateId] = [n1].[Id] INNER JOIN [NestedAssociateType] AS [n2] ON [a0].[RequiredNestedAssociateId] = [n2].[Id] LEFT JOIN ( - SELECT [a1].[Id], [a1].[CollectionRootId], [a1].[Int], [a1].[Ints], [a1].[Name], [a1].[OptionalNestedAssociateId], [a1].[RequiredNestedAssociateId], [a1].[String], [n3].[Id] AS [Id0], [n4].[Id] AS [Id1], [n5].[Id] AS [Id2], [n5].[CollectionAssociateId], [n5].[Int] AS [Int0], [n5].[Ints] AS [Ints0], [n5].[Name] AS [Name0], [n5].[String] AS [String0], [n3].[CollectionAssociateId] AS [CollectionAssociateId0], [n3].[Int] AS [Int1], [n3].[Ints] AS [Ints1], [n3].[Name] AS [Name1], [n3].[String] AS [String1], [n4].[CollectionAssociateId] AS [CollectionAssociateId1], [n4].[Int] AS [Int2], [n4].[Ints] AS [Ints2], [n4].[Name] AS [Name2], [n4].[String] AS [String2] + SELECT [a1].[Id], [a1].[CollectionRootId], [a1].[Int], [a1].[Ints], [a1].[Name], [a1].[OptionalNestedAssociateId], [a1].[RequiredNestedAssociateId], [a1].[String], [n5].[Id] AS [Id0], [n5].[CollectionAssociateId], [n5].[Int] AS [Int0], [n5].[Ints] AS [Ints0], [n5].[Name] AS [Name0], [n5].[String] AS [String0], [n3].[Id] AS [Id1], [n3].[CollectionAssociateId] AS [CollectionAssociateId0], [n3].[Int] AS [Int1], [n3].[Ints] AS [Ints1], [n3].[Name] AS [Name1], [n3].[String] AS [String1], [n4].[Id] AS [Id2], [n4].[CollectionAssociateId] AS [CollectionAssociateId1], [n4].[Int] AS [Int2], [n4].[Ints] AS [Ints2], [n4].[Name] AS [Name2], [n4].[String] AS [String2] FROM [AssociateType] AS [a1] LEFT JOIN [NestedAssociateType] AS [n3] ON [a1].[OptionalNestedAssociateId] = [n3].[Id] INNER JOIN [NestedAssociateType] AS [n4] ON [a1].[RequiredNestedAssociateId] = [n4].[Id] @@ -245,7 +245,7 @@ FROM [AssociateType] AS [a1] ) AS [s] ON [r].[Id] = [s].[CollectionRootId] LEFT JOIN [NestedAssociateType] AS [n6] ON [a].[Id] = [n6].[CollectionAssociateId] LEFT JOIN [NestedAssociateType] AS [n7] ON [a0].[Id] = [n7].[CollectionAssociateId] -ORDER BY [r].[Id], [a].[Id], [n].[Id], [n0].[Id], [a0].[Id], [n1].[Id], [n2].[Id], [s].[Id], [s].[Id0], [s].[Id1], [s].[Id2], [n6].[Id] +ORDER BY [r].[Id], [s].[Id], [s].[Id0], [n6].[Id] """); } diff --git a/test/EFCore.SqlServer.FunctionalTests/Query/Associations/Navigations/NavigationsMiscellaneousSqlServerTest.cs b/test/EFCore.SqlServer.FunctionalTests/Query/Associations/Navigations/NavigationsMiscellaneousSqlServerTest.cs index 1b50f02e3e9..0c18bc6543a 100644 --- a/test/EFCore.SqlServer.FunctionalTests/Query/Associations/Navigations/NavigationsMiscellaneousSqlServerTest.cs +++ b/test/EFCore.SqlServer.FunctionalTests/Query/Associations/Navigations/NavigationsMiscellaneousSqlServerTest.cs @@ -16,7 +16,7 @@ public override async Task Where_on_associate_scalar_property() AssertSql( """ -SELECT [r].[Id], [r].[Name], [r].[OptionalAssociateId], [r].[RequiredAssociateId], [a].[Id], [a0].[Id], [n].[Id], [n0].[Id], [n1].[Id], [n2].[Id], [s].[Id], [s].[CollectionRootId], [s].[Int], [s].[Ints], [s].[Name], [s].[OptionalNestedAssociateId], [s].[RequiredNestedAssociateId], [s].[String], [s].[Id0], [s].[Id1], [s].[Id2], [s].[CollectionAssociateId], [s].[Int0], [s].[Ints0], [s].[Name0], [s].[String0], [s].[CollectionAssociateId0], [s].[Int1], [s].[Ints1], [s].[Name1], [s].[String1], [s].[CollectionAssociateId1], [s].[Int2], [s].[Ints2], [s].[Name2], [s].[String2], [a0].[CollectionRootId], [a0].[Int], [a0].[Ints], [a0].[Name], [a0].[OptionalNestedAssociateId], [a0].[RequiredNestedAssociateId], [a0].[String], [n6].[Id], [n6].[CollectionAssociateId], [n6].[Int], [n6].[Ints], [n6].[Name], [n6].[String], [n].[CollectionAssociateId], [n].[Int], [n].[Ints], [n].[Name], [n].[String], [n0].[CollectionAssociateId], [n0].[Int], [n0].[Ints], [n0].[Name], [n0].[String], [a].[CollectionRootId], [a].[Int], [a].[Ints], [a].[Name], [a].[OptionalNestedAssociateId], [a].[RequiredNestedAssociateId], [a].[String], [n7].[Id], [n7].[CollectionAssociateId], [n7].[Int], [n7].[Ints], [n7].[Name], [n7].[String], [n1].[CollectionAssociateId], [n1].[Int], [n1].[Ints], [n1].[Name], [n1].[String], [n2].[CollectionAssociateId], [n2].[Int], [n2].[Ints], [n2].[Name], [n2].[String] +SELECT [r].[Id], [r].[Name], [r].[OptionalAssociateId], [r].[RequiredAssociateId], [s].[Id], [s].[CollectionRootId], [s].[Int], [s].[Ints], [s].[Name], [s].[OptionalNestedAssociateId], [s].[RequiredNestedAssociateId], [s].[String], [s].[Id0], [s].[CollectionAssociateId], [s].[Int0], [s].[Ints0], [s].[Name0], [s].[String0], [s].[Id1], [s].[CollectionAssociateId0], [s].[Int1], [s].[Ints1], [s].[Name1], [s].[String1], [s].[Id2], [s].[CollectionAssociateId1], [s].[Int2], [s].[Ints2], [s].[Name2], [s].[String2], [a0].[Id], [a0].[CollectionRootId], [a0].[Int], [a0].[Ints], [a0].[Name], [a0].[OptionalNestedAssociateId], [a0].[RequiredNestedAssociateId], [a0].[String], [n6].[Id], [n6].[CollectionAssociateId], [n6].[Int], [n6].[Ints], [n6].[Name], [n6].[String], [n].[Id], [n].[CollectionAssociateId], [n].[Int], [n].[Ints], [n].[Name], [n].[String], [n0].[Id], [n0].[CollectionAssociateId], [n0].[Int], [n0].[Ints], [n0].[Name], [n0].[String], [a].[Id], [a].[CollectionRootId], [a].[Int], [a].[Ints], [a].[Name], [a].[OptionalNestedAssociateId], [a].[RequiredNestedAssociateId], [a].[String], [n7].[Id], [n7].[CollectionAssociateId], [n7].[Int], [n7].[Ints], [n7].[Name], [n7].[String], [n1].[Id], [n1].[CollectionAssociateId], [n1].[Int], [n1].[Ints], [n1].[Name], [n1].[String], [n2].[Id], [n2].[CollectionAssociateId], [n2].[Int], [n2].[Ints], [n2].[Name], [n2].[String] FROM [RootEntity] AS [r] INNER JOIN [AssociateType] AS [a] ON [r].[RequiredAssociateId] = [a].[Id] LEFT JOIN [AssociateType] AS [a0] ON [r].[OptionalAssociateId] = [a0].[Id] @@ -25,7 +25,7 @@ FROM [RootEntity] AS [r] LEFT JOIN [NestedAssociateType] AS [n1] ON [a].[OptionalNestedAssociateId] = [n1].[Id] INNER JOIN [NestedAssociateType] AS [n2] ON [a].[RequiredNestedAssociateId] = [n2].[Id] LEFT JOIN ( - SELECT [a1].[Id], [a1].[CollectionRootId], [a1].[Int], [a1].[Ints], [a1].[Name], [a1].[OptionalNestedAssociateId], [a1].[RequiredNestedAssociateId], [a1].[String], [n3].[Id] AS [Id0], [n4].[Id] AS [Id1], [n5].[Id] AS [Id2], [n5].[CollectionAssociateId], [n5].[Int] AS [Int0], [n5].[Ints] AS [Ints0], [n5].[Name] AS [Name0], [n5].[String] AS [String0], [n3].[CollectionAssociateId] AS [CollectionAssociateId0], [n3].[Int] AS [Int1], [n3].[Ints] AS [Ints1], [n3].[Name] AS [Name1], [n3].[String] AS [String1], [n4].[CollectionAssociateId] AS [CollectionAssociateId1], [n4].[Int] AS [Int2], [n4].[Ints] AS [Ints2], [n4].[Name] AS [Name2], [n4].[String] AS [String2] + SELECT [a1].[Id], [a1].[CollectionRootId], [a1].[Int], [a1].[Ints], [a1].[Name], [a1].[OptionalNestedAssociateId], [a1].[RequiredNestedAssociateId], [a1].[String], [n5].[Id] AS [Id0], [n5].[CollectionAssociateId], [n5].[Int] AS [Int0], [n5].[Ints] AS [Ints0], [n5].[Name] AS [Name0], [n5].[String] AS [String0], [n3].[Id] AS [Id1], [n3].[CollectionAssociateId] AS [CollectionAssociateId0], [n3].[Int] AS [Int1], [n3].[Ints] AS [Ints1], [n3].[Name] AS [Name1], [n3].[String] AS [String1], [n4].[Id] AS [Id2], [n4].[CollectionAssociateId] AS [CollectionAssociateId1], [n4].[Int] AS [Int2], [n4].[Ints] AS [Ints2], [n4].[Name] AS [Name2], [n4].[String] AS [String2] FROM [AssociateType] AS [a1] LEFT JOIN [NestedAssociateType] AS [n3] ON [a1].[OptionalNestedAssociateId] = [n3].[Id] INNER JOIN [NestedAssociateType] AS [n4] ON [a1].[RequiredNestedAssociateId] = [n4].[Id] @@ -34,7 +34,7 @@ FROM [AssociateType] AS [a1] LEFT JOIN [NestedAssociateType] AS [n6] ON [a0].[Id] = [n6].[CollectionAssociateId] LEFT JOIN [NestedAssociateType] AS [n7] ON [a].[Id] = [n7].[CollectionAssociateId] WHERE [a].[Int] = 8 -ORDER BY [r].[Id], [a].[Id], [a0].[Id], [n].[Id], [n0].[Id], [n1].[Id], [n2].[Id], [s].[Id], [s].[Id0], [s].[Id1], [s].[Id2], [n6].[Id] +ORDER BY [r].[Id], [s].[Id], [s].[Id0], [n6].[Id] """); } @@ -44,7 +44,7 @@ public override async Task Where_on_optional_associate_scalar_property() AssertSql( """ -SELECT [r].[Id], [r].[Name], [r].[OptionalAssociateId], [r].[RequiredAssociateId], [a].[Id], [n].[Id], [n0].[Id], [a0].[Id], [n1].[Id], [n2].[Id], [s].[Id], [s].[CollectionRootId], [s].[Int], [s].[Ints], [s].[Name], [s].[OptionalNestedAssociateId], [s].[RequiredNestedAssociateId], [s].[String], [s].[Id0], [s].[Id1], [s].[Id2], [s].[CollectionAssociateId], [s].[Int0], [s].[Ints0], [s].[Name0], [s].[String0], [s].[CollectionAssociateId0], [s].[Int1], [s].[Ints1], [s].[Name1], [s].[String1], [s].[CollectionAssociateId1], [s].[Int2], [s].[Ints2], [s].[Name2], [s].[String2], [a].[CollectionRootId], [a].[Int], [a].[Ints], [a].[Name], [a].[OptionalNestedAssociateId], [a].[RequiredNestedAssociateId], [a].[String], [n6].[Id], [n6].[CollectionAssociateId], [n6].[Int], [n6].[Ints], [n6].[Name], [n6].[String], [n].[CollectionAssociateId], [n].[Int], [n].[Ints], [n].[Name], [n].[String], [n0].[CollectionAssociateId], [n0].[Int], [n0].[Ints], [n0].[Name], [n0].[String], [a0].[CollectionRootId], [a0].[Int], [a0].[Ints], [a0].[Name], [a0].[OptionalNestedAssociateId], [a0].[RequiredNestedAssociateId], [a0].[String], [n7].[Id], [n7].[CollectionAssociateId], [n7].[Int], [n7].[Ints], [n7].[Name], [n7].[String], [n1].[CollectionAssociateId], [n1].[Int], [n1].[Ints], [n1].[Name], [n1].[String], [n2].[CollectionAssociateId], [n2].[Int], [n2].[Ints], [n2].[Name], [n2].[String] +SELECT [r].[Id], [r].[Name], [r].[OptionalAssociateId], [r].[RequiredAssociateId], [s].[Id], [s].[CollectionRootId], [s].[Int], [s].[Ints], [s].[Name], [s].[OptionalNestedAssociateId], [s].[RequiredNestedAssociateId], [s].[String], [s].[Id0], [s].[CollectionAssociateId], [s].[Int0], [s].[Ints0], [s].[Name0], [s].[String0], [s].[Id1], [s].[CollectionAssociateId0], [s].[Int1], [s].[Ints1], [s].[Name1], [s].[String1], [s].[Id2], [s].[CollectionAssociateId1], [s].[Int2], [s].[Ints2], [s].[Name2], [s].[String2], [a].[Id], [a].[CollectionRootId], [a].[Int], [a].[Ints], [a].[Name], [a].[OptionalNestedAssociateId], [a].[RequiredNestedAssociateId], [a].[String], [n6].[Id], [n6].[CollectionAssociateId], [n6].[Int], [n6].[Ints], [n6].[Name], [n6].[String], [n].[Id], [n].[CollectionAssociateId], [n].[Int], [n].[Ints], [n].[Name], [n].[String], [n0].[Id], [n0].[CollectionAssociateId], [n0].[Int], [n0].[Ints], [n0].[Name], [n0].[String], [a0].[Id], [a0].[CollectionRootId], [a0].[Int], [a0].[Ints], [a0].[Name], [a0].[OptionalNestedAssociateId], [a0].[RequiredNestedAssociateId], [a0].[String], [n7].[Id], [n7].[CollectionAssociateId], [n7].[Int], [n7].[Ints], [n7].[Name], [n7].[String], [n1].[Id], [n1].[CollectionAssociateId], [n1].[Int], [n1].[Ints], [n1].[Name], [n1].[String], [n2].[Id], [n2].[CollectionAssociateId], [n2].[Int], [n2].[Ints], [n2].[Name], [n2].[String] FROM [RootEntity] AS [r] LEFT JOIN [AssociateType] AS [a] ON [r].[OptionalAssociateId] = [a].[Id] LEFT JOIN [NestedAssociateType] AS [n] ON [a].[OptionalNestedAssociateId] = [n].[Id] @@ -53,7 +53,7 @@ FROM [RootEntity] AS [r] LEFT JOIN [NestedAssociateType] AS [n1] ON [a0].[OptionalNestedAssociateId] = [n1].[Id] INNER JOIN [NestedAssociateType] AS [n2] ON [a0].[RequiredNestedAssociateId] = [n2].[Id] LEFT JOIN ( - SELECT [a1].[Id], [a1].[CollectionRootId], [a1].[Int], [a1].[Ints], [a1].[Name], [a1].[OptionalNestedAssociateId], [a1].[RequiredNestedAssociateId], [a1].[String], [n3].[Id] AS [Id0], [n4].[Id] AS [Id1], [n5].[Id] AS [Id2], [n5].[CollectionAssociateId], [n5].[Int] AS [Int0], [n5].[Ints] AS [Ints0], [n5].[Name] AS [Name0], [n5].[String] AS [String0], [n3].[CollectionAssociateId] AS [CollectionAssociateId0], [n3].[Int] AS [Int1], [n3].[Ints] AS [Ints1], [n3].[Name] AS [Name1], [n3].[String] AS [String1], [n4].[CollectionAssociateId] AS [CollectionAssociateId1], [n4].[Int] AS [Int2], [n4].[Ints] AS [Ints2], [n4].[Name] AS [Name2], [n4].[String] AS [String2] + SELECT [a1].[Id], [a1].[CollectionRootId], [a1].[Int], [a1].[Ints], [a1].[Name], [a1].[OptionalNestedAssociateId], [a1].[RequiredNestedAssociateId], [a1].[String], [n5].[Id] AS [Id0], [n5].[CollectionAssociateId], [n5].[Int] AS [Int0], [n5].[Ints] AS [Ints0], [n5].[Name] AS [Name0], [n5].[String] AS [String0], [n3].[Id] AS [Id1], [n3].[CollectionAssociateId] AS [CollectionAssociateId0], [n3].[Int] AS [Int1], [n3].[Ints] AS [Ints1], [n3].[Name] AS [Name1], [n3].[String] AS [String1], [n4].[Id] AS [Id2], [n4].[CollectionAssociateId] AS [CollectionAssociateId1], [n4].[Int] AS [Int2], [n4].[Ints] AS [Ints2], [n4].[Name] AS [Name2], [n4].[String] AS [String2] FROM [AssociateType] AS [a1] LEFT JOIN [NestedAssociateType] AS [n3] ON [a1].[OptionalNestedAssociateId] = [n3].[Id] INNER JOIN [NestedAssociateType] AS [n4] ON [a1].[RequiredNestedAssociateId] = [n4].[Id] @@ -62,7 +62,7 @@ FROM [AssociateType] AS [a1] LEFT JOIN [NestedAssociateType] AS [n6] ON [a].[Id] = [n6].[CollectionAssociateId] LEFT JOIN [NestedAssociateType] AS [n7] ON [a0].[Id] = [n7].[CollectionAssociateId] WHERE [a].[Int] = 8 -ORDER BY [r].[Id], [a].[Id], [n].[Id], [n0].[Id], [a0].[Id], [n1].[Id], [n2].[Id], [s].[Id], [s].[Id0], [s].[Id1], [s].[Id2], [n6].[Id] +ORDER BY [r].[Id], [s].[Id], [s].[Id0], [n6].[Id] """); } @@ -72,7 +72,7 @@ public override async Task Where_on_nested_associate_scalar_property() AssertSql( """ -SELECT [r].[Id], [r].[Name], [r].[OptionalAssociateId], [r].[RequiredAssociateId], [a].[Id], [n].[Id], [a0].[Id], [n0].[Id], [n1].[Id], [n2].[Id], [s].[Id], [s].[CollectionRootId], [s].[Int], [s].[Ints], [s].[Name], [s].[OptionalNestedAssociateId], [s].[RequiredNestedAssociateId], [s].[String], [s].[Id0], [s].[Id1], [s].[Id2], [s].[CollectionAssociateId], [s].[Int0], [s].[Ints0], [s].[Name0], [s].[String0], [s].[CollectionAssociateId0], [s].[Int1], [s].[Ints1], [s].[Name1], [s].[String1], [s].[CollectionAssociateId1], [s].[Int2], [s].[Ints2], [s].[Name2], [s].[String2], [a0].[CollectionRootId], [a0].[Int], [a0].[Ints], [a0].[Name], [a0].[OptionalNestedAssociateId], [a0].[RequiredNestedAssociateId], [a0].[String], [n6].[Id], [n6].[CollectionAssociateId], [n6].[Int], [n6].[Ints], [n6].[Name], [n6].[String], [n0].[CollectionAssociateId], [n0].[Int], [n0].[Ints], [n0].[Name], [n0].[String], [n1].[CollectionAssociateId], [n1].[Int], [n1].[Ints], [n1].[Name], [n1].[String], [a].[CollectionRootId], [a].[Int], [a].[Ints], [a].[Name], [a].[OptionalNestedAssociateId], [a].[RequiredNestedAssociateId], [a].[String], [n7].[Id], [n7].[CollectionAssociateId], [n7].[Int], [n7].[Ints], [n7].[Name], [n7].[String], [n2].[CollectionAssociateId], [n2].[Int], [n2].[Ints], [n2].[Name], [n2].[String], [n].[CollectionAssociateId], [n].[Int], [n].[Ints], [n].[Name], [n].[String] +SELECT [r].[Id], [r].[Name], [r].[OptionalAssociateId], [r].[RequiredAssociateId], [s].[Id], [s].[CollectionRootId], [s].[Int], [s].[Ints], [s].[Name], [s].[OptionalNestedAssociateId], [s].[RequiredNestedAssociateId], [s].[String], [s].[Id0], [s].[CollectionAssociateId], [s].[Int0], [s].[Ints0], [s].[Name0], [s].[String0], [s].[Id1], [s].[CollectionAssociateId0], [s].[Int1], [s].[Ints1], [s].[Name1], [s].[String1], [s].[Id2], [s].[CollectionAssociateId1], [s].[Int2], [s].[Ints2], [s].[Name2], [s].[String2], [a0].[Id], [a0].[CollectionRootId], [a0].[Int], [a0].[Ints], [a0].[Name], [a0].[OptionalNestedAssociateId], [a0].[RequiredNestedAssociateId], [a0].[String], [n6].[Id], [n6].[CollectionAssociateId], [n6].[Int], [n6].[Ints], [n6].[Name], [n6].[String], [n0].[Id], [n0].[CollectionAssociateId], [n0].[Int], [n0].[Ints], [n0].[Name], [n0].[String], [n1].[Id], [n1].[CollectionAssociateId], [n1].[Int], [n1].[Ints], [n1].[Name], [n1].[String], [a].[Id], [a].[CollectionRootId], [a].[Int], [a].[Ints], [a].[Name], [a].[OptionalNestedAssociateId], [a].[RequiredNestedAssociateId], [a].[String], [n7].[Id], [n7].[CollectionAssociateId], [n7].[Int], [n7].[Ints], [n7].[Name], [n7].[String], [n2].[Id], [n2].[CollectionAssociateId], [n2].[Int], [n2].[Ints], [n2].[Name], [n2].[String], [n].[Id], [n].[CollectionAssociateId], [n].[Int], [n].[Ints], [n].[Name], [n].[String] FROM [RootEntity] AS [r] INNER JOIN [AssociateType] AS [a] ON [r].[RequiredAssociateId] = [a].[Id] INNER JOIN [NestedAssociateType] AS [n] ON [a].[RequiredNestedAssociateId] = [n].[Id] @@ -81,7 +81,7 @@ FROM [RootEntity] AS [r] LEFT JOIN [NestedAssociateType] AS [n1] ON [a0].[RequiredNestedAssociateId] = [n1].[Id] LEFT JOIN [NestedAssociateType] AS [n2] ON [a].[OptionalNestedAssociateId] = [n2].[Id] LEFT JOIN ( - SELECT [a1].[Id], [a1].[CollectionRootId], [a1].[Int], [a1].[Ints], [a1].[Name], [a1].[OptionalNestedAssociateId], [a1].[RequiredNestedAssociateId], [a1].[String], [n3].[Id] AS [Id0], [n4].[Id] AS [Id1], [n5].[Id] AS [Id2], [n5].[CollectionAssociateId], [n5].[Int] AS [Int0], [n5].[Ints] AS [Ints0], [n5].[Name] AS [Name0], [n5].[String] AS [String0], [n3].[CollectionAssociateId] AS [CollectionAssociateId0], [n3].[Int] AS [Int1], [n3].[Ints] AS [Ints1], [n3].[Name] AS [Name1], [n3].[String] AS [String1], [n4].[CollectionAssociateId] AS [CollectionAssociateId1], [n4].[Int] AS [Int2], [n4].[Ints] AS [Ints2], [n4].[Name] AS [Name2], [n4].[String] AS [String2] + SELECT [a1].[Id], [a1].[CollectionRootId], [a1].[Int], [a1].[Ints], [a1].[Name], [a1].[OptionalNestedAssociateId], [a1].[RequiredNestedAssociateId], [a1].[String], [n5].[Id] AS [Id0], [n5].[CollectionAssociateId], [n5].[Int] AS [Int0], [n5].[Ints] AS [Ints0], [n5].[Name] AS [Name0], [n5].[String] AS [String0], [n3].[Id] AS [Id1], [n3].[CollectionAssociateId] AS [CollectionAssociateId0], [n3].[Int] AS [Int1], [n3].[Ints] AS [Ints1], [n3].[Name] AS [Name1], [n3].[String] AS [String1], [n4].[Id] AS [Id2], [n4].[CollectionAssociateId] AS [CollectionAssociateId1], [n4].[Int] AS [Int2], [n4].[Ints] AS [Ints2], [n4].[Name] AS [Name2], [n4].[String] AS [String2] FROM [AssociateType] AS [a1] LEFT JOIN [NestedAssociateType] AS [n3] ON [a1].[OptionalNestedAssociateId] = [n3].[Id] INNER JOIN [NestedAssociateType] AS [n4] ON [a1].[RequiredNestedAssociateId] = [n4].[Id] @@ -90,7 +90,7 @@ FROM [AssociateType] AS [a1] LEFT JOIN [NestedAssociateType] AS [n6] ON [a0].[Id] = [n6].[CollectionAssociateId] LEFT JOIN [NestedAssociateType] AS [n7] ON [a].[Id] = [n7].[CollectionAssociateId] WHERE [n].[Int] = 8 -ORDER BY [r].[Id], [a].[Id], [n].[Id], [a0].[Id], [n0].[Id], [n1].[Id], [n2].[Id], [s].[Id], [s].[Id0], [s].[Id1], [s].[Id2], [n6].[Id] +ORDER BY [r].[Id], [s].[Id], [s].[Id0], [n6].[Id] """); } @@ -102,7 +102,7 @@ public override async Task FromSql_on_root() AssertSql( """ -SELECT [m].[Id], [m].[Name], [m].[OptionalAssociateId], [m].[RequiredAssociateId], [a].[Id], [n].[Id], [n0].[Id], [a0].[Id], [n1].[Id], [n2].[Id], [s].[Id], [s].[CollectionRootId], [s].[Int], [s].[Ints], [s].[Name], [s].[OptionalNestedAssociateId], [s].[RequiredNestedAssociateId], [s].[String], [s].[Id0], [s].[Id1], [s].[Id2], [s].[CollectionAssociateId], [s].[Int0], [s].[Ints0], [s].[Name0], [s].[String0], [s].[CollectionAssociateId0], [s].[Int1], [s].[Ints1], [s].[Name1], [s].[String1], [s].[CollectionAssociateId1], [s].[Int2], [s].[Ints2], [s].[Name2], [s].[String2], [a].[CollectionRootId], [a].[Int], [a].[Ints], [a].[Name], [a].[OptionalNestedAssociateId], [a].[RequiredNestedAssociateId], [a].[String], [n6].[Id], [n6].[CollectionAssociateId], [n6].[Int], [n6].[Ints], [n6].[Name], [n6].[String], [n].[CollectionAssociateId], [n].[Int], [n].[Ints], [n].[Name], [n].[String], [n0].[CollectionAssociateId], [n0].[Int], [n0].[Ints], [n0].[Name], [n0].[String], [a0].[CollectionRootId], [a0].[Int], [a0].[Ints], [a0].[Name], [a0].[OptionalNestedAssociateId], [a0].[RequiredNestedAssociateId], [a0].[String], [n7].[Id], [n7].[CollectionAssociateId], [n7].[Int], [n7].[Ints], [n7].[Name], [n7].[String], [n1].[CollectionAssociateId], [n1].[Int], [n1].[Ints], [n1].[Name], [n1].[String], [n2].[CollectionAssociateId], [n2].[Int], [n2].[Ints], [n2].[Name], [n2].[String] +SELECT [m].[Id], [m].[Name], [m].[OptionalAssociateId], [m].[RequiredAssociateId], [s].[Id], [s].[CollectionRootId], [s].[Int], [s].[Ints], [s].[Name], [s].[OptionalNestedAssociateId], [s].[RequiredNestedAssociateId], [s].[String], [s].[Id0], [s].[CollectionAssociateId], [s].[Int0], [s].[Ints0], [s].[Name0], [s].[String0], [s].[Id1], [s].[CollectionAssociateId0], [s].[Int1], [s].[Ints1], [s].[Name1], [s].[String1], [s].[Id2], [s].[CollectionAssociateId1], [s].[Int2], [s].[Ints2], [s].[Name2], [s].[String2], [a].[Id], [a].[CollectionRootId], [a].[Int], [a].[Ints], [a].[Name], [a].[OptionalNestedAssociateId], [a].[RequiredNestedAssociateId], [a].[String], [n6].[Id], [n6].[CollectionAssociateId], [n6].[Int], [n6].[Ints], [n6].[Name], [n6].[String], [n].[Id], [n].[CollectionAssociateId], [n].[Int], [n].[Ints], [n].[Name], [n].[String], [n0].[Id], [n0].[CollectionAssociateId], [n0].[Int], [n0].[Ints], [n0].[Name], [n0].[String], [a0].[Id], [a0].[CollectionRootId], [a0].[Int], [a0].[Ints], [a0].[Name], [a0].[OptionalNestedAssociateId], [a0].[RequiredNestedAssociateId], [a0].[String], [n7].[Id], [n7].[CollectionAssociateId], [n7].[Int], [n7].[Ints], [n7].[Name], [n7].[String], [n1].[Id], [n1].[CollectionAssociateId], [n1].[Int], [n1].[Ints], [n1].[Name], [n1].[String], [n2].[Id], [n2].[CollectionAssociateId], [n2].[Int], [n2].[Ints], [n2].[Name], [n2].[String] FROM ( SELECT * FROM [RootEntity] ) AS [m] @@ -113,7 +113,7 @@ public override async Task FromSql_on_root() LEFT JOIN [NestedAssociateType] AS [n1] ON [a0].[OptionalNestedAssociateId] = [n1].[Id] INNER JOIN [NestedAssociateType] AS [n2] ON [a0].[RequiredNestedAssociateId] = [n2].[Id] LEFT JOIN ( - SELECT [a1].[Id], [a1].[CollectionRootId], [a1].[Int], [a1].[Ints], [a1].[Name], [a1].[OptionalNestedAssociateId], [a1].[RequiredNestedAssociateId], [a1].[String], [n3].[Id] AS [Id0], [n4].[Id] AS [Id1], [n5].[Id] AS [Id2], [n5].[CollectionAssociateId], [n5].[Int] AS [Int0], [n5].[Ints] AS [Ints0], [n5].[Name] AS [Name0], [n5].[String] AS [String0], [n3].[CollectionAssociateId] AS [CollectionAssociateId0], [n3].[Int] AS [Int1], [n3].[Ints] AS [Ints1], [n3].[Name] AS [Name1], [n3].[String] AS [String1], [n4].[CollectionAssociateId] AS [CollectionAssociateId1], [n4].[Int] AS [Int2], [n4].[Ints] AS [Ints2], [n4].[Name] AS [Name2], [n4].[String] AS [String2] + SELECT [a1].[Id], [a1].[CollectionRootId], [a1].[Int], [a1].[Ints], [a1].[Name], [a1].[OptionalNestedAssociateId], [a1].[RequiredNestedAssociateId], [a1].[String], [n5].[Id] AS [Id0], [n5].[CollectionAssociateId], [n5].[Int] AS [Int0], [n5].[Ints] AS [Ints0], [n5].[Name] AS [Name0], [n5].[String] AS [String0], [n3].[Id] AS [Id1], [n3].[CollectionAssociateId] AS [CollectionAssociateId0], [n3].[Int] AS [Int1], [n3].[Ints] AS [Ints1], [n3].[Name] AS [Name1], [n3].[String] AS [String1], [n4].[Id] AS [Id2], [n4].[CollectionAssociateId] AS [CollectionAssociateId1], [n4].[Int] AS [Int2], [n4].[Ints] AS [Ints2], [n4].[Name] AS [Name2], [n4].[String] AS [String2] FROM [AssociateType] AS [a1] LEFT JOIN [NestedAssociateType] AS [n3] ON [a1].[OptionalNestedAssociateId] = [n3].[Id] INNER JOIN [NestedAssociateType] AS [n4] ON [a1].[RequiredNestedAssociateId] = [n4].[Id] @@ -121,7 +121,7 @@ FROM [AssociateType] AS [a1] ) AS [s] ON [m].[Id] = [s].[CollectionRootId] LEFT JOIN [NestedAssociateType] AS [n6] ON [a].[Id] = [n6].[CollectionAssociateId] LEFT JOIN [NestedAssociateType] AS [n7] ON [a0].[Id] = [n7].[CollectionAssociateId] -ORDER BY [m].[Id], [a].[Id], [n].[Id], [n0].[Id], [a0].[Id], [n1].[Id], [n2].[Id], [s].[Id], [s].[Id0], [s].[Id1], [s].[Id2], [n6].[Id] +ORDER BY [m].[Id], [s].[Id], [s].[Id0], [n6].[Id] """); } diff --git a/test/EFCore.SqlServer.FunctionalTests/Query/Associations/Navigations/NavigationsPrimitiveCollectionSqlServerTest.cs b/test/EFCore.SqlServer.FunctionalTests/Query/Associations/Navigations/NavigationsPrimitiveCollectionSqlServerTest.cs index acbd2f5ed51..3e7c1840294 100644 --- a/test/EFCore.SqlServer.FunctionalTests/Query/Associations/Navigations/NavigationsPrimitiveCollectionSqlServerTest.cs +++ b/test/EFCore.SqlServer.FunctionalTests/Query/Associations/Navigations/NavigationsPrimitiveCollectionSqlServerTest.cs @@ -12,7 +12,7 @@ public override async Task Count() AssertSql( """ -SELECT [r].[Id], [r].[Name], [r].[OptionalAssociateId], [r].[RequiredAssociateId], [a].[Id], [a0].[Id], [n].[Id], [n0].[Id], [n1].[Id], [n2].[Id], [s].[Id], [s].[CollectionRootId], [s].[Int], [s].[Ints], [s].[Name], [s].[OptionalNestedAssociateId], [s].[RequiredNestedAssociateId], [s].[String], [s].[Id0], [s].[Id1], [s].[Id2], [s].[CollectionAssociateId], [s].[Int0], [s].[Ints0], [s].[Name0], [s].[String0], [s].[CollectionAssociateId0], [s].[Int1], [s].[Ints1], [s].[Name1], [s].[String1], [s].[CollectionAssociateId1], [s].[Int2], [s].[Ints2], [s].[Name2], [s].[String2], [a0].[CollectionRootId], [a0].[Int], [a0].[Ints], [a0].[Name], [a0].[OptionalNestedAssociateId], [a0].[RequiredNestedAssociateId], [a0].[String], [n6].[Id], [n6].[CollectionAssociateId], [n6].[Int], [n6].[Ints], [n6].[Name], [n6].[String], [n].[CollectionAssociateId], [n].[Int], [n].[Ints], [n].[Name], [n].[String], [n0].[CollectionAssociateId], [n0].[Int], [n0].[Ints], [n0].[Name], [n0].[String], [a].[CollectionRootId], [a].[Int], [a].[Ints], [a].[Name], [a].[OptionalNestedAssociateId], [a].[RequiredNestedAssociateId], [a].[String], [n7].[Id], [n7].[CollectionAssociateId], [n7].[Int], [n7].[Ints], [n7].[Name], [n7].[String], [n1].[CollectionAssociateId], [n1].[Int], [n1].[Ints], [n1].[Name], [n1].[String], [n2].[CollectionAssociateId], [n2].[Int], [n2].[Ints], [n2].[Name], [n2].[String] +SELECT [r].[Id], [r].[Name], [r].[OptionalAssociateId], [r].[RequiredAssociateId], [s].[Id], [s].[CollectionRootId], [s].[Int], [s].[Ints], [s].[Name], [s].[OptionalNestedAssociateId], [s].[RequiredNestedAssociateId], [s].[String], [s].[Id0], [s].[CollectionAssociateId], [s].[Int0], [s].[Ints0], [s].[Name0], [s].[String0], [s].[Id1], [s].[CollectionAssociateId0], [s].[Int1], [s].[Ints1], [s].[Name1], [s].[String1], [s].[Id2], [s].[CollectionAssociateId1], [s].[Int2], [s].[Ints2], [s].[Name2], [s].[String2], [a0].[Id], [a0].[CollectionRootId], [a0].[Int], [a0].[Ints], [a0].[Name], [a0].[OptionalNestedAssociateId], [a0].[RequiredNestedAssociateId], [a0].[String], [n6].[Id], [n6].[CollectionAssociateId], [n6].[Int], [n6].[Ints], [n6].[Name], [n6].[String], [n].[Id], [n].[CollectionAssociateId], [n].[Int], [n].[Ints], [n].[Name], [n].[String], [n0].[Id], [n0].[CollectionAssociateId], [n0].[Int], [n0].[Ints], [n0].[Name], [n0].[String], [a].[Id], [a].[CollectionRootId], [a].[Int], [a].[Ints], [a].[Name], [a].[OptionalNestedAssociateId], [a].[RequiredNestedAssociateId], [a].[String], [n7].[Id], [n7].[CollectionAssociateId], [n7].[Int], [n7].[Ints], [n7].[Name], [n7].[String], [n1].[Id], [n1].[CollectionAssociateId], [n1].[Int], [n1].[Ints], [n1].[Name], [n1].[String], [n2].[Id], [n2].[CollectionAssociateId], [n2].[Int], [n2].[Ints], [n2].[Name], [n2].[String] FROM [RootEntity] AS [r] INNER JOIN [AssociateType] AS [a] ON [r].[RequiredAssociateId] = [a].[Id] LEFT JOIN [AssociateType] AS [a0] ON [r].[OptionalAssociateId] = [a0].[Id] @@ -21,7 +21,7 @@ FROM [RootEntity] AS [r] LEFT JOIN [NestedAssociateType] AS [n1] ON [a].[OptionalNestedAssociateId] = [n1].[Id] INNER JOIN [NestedAssociateType] AS [n2] ON [a].[RequiredNestedAssociateId] = [n2].[Id] LEFT JOIN ( - SELECT [a1].[Id], [a1].[CollectionRootId], [a1].[Int], [a1].[Ints], [a1].[Name], [a1].[OptionalNestedAssociateId], [a1].[RequiredNestedAssociateId], [a1].[String], [n3].[Id] AS [Id0], [n4].[Id] AS [Id1], [n5].[Id] AS [Id2], [n5].[CollectionAssociateId], [n5].[Int] AS [Int0], [n5].[Ints] AS [Ints0], [n5].[Name] AS [Name0], [n5].[String] AS [String0], [n3].[CollectionAssociateId] AS [CollectionAssociateId0], [n3].[Int] AS [Int1], [n3].[Ints] AS [Ints1], [n3].[Name] AS [Name1], [n3].[String] AS [String1], [n4].[CollectionAssociateId] AS [CollectionAssociateId1], [n4].[Int] AS [Int2], [n4].[Ints] AS [Ints2], [n4].[Name] AS [Name2], [n4].[String] AS [String2] + SELECT [a1].[Id], [a1].[CollectionRootId], [a1].[Int], [a1].[Ints], [a1].[Name], [a1].[OptionalNestedAssociateId], [a1].[RequiredNestedAssociateId], [a1].[String], [n5].[Id] AS [Id0], [n5].[CollectionAssociateId], [n5].[Int] AS [Int0], [n5].[Ints] AS [Ints0], [n5].[Name] AS [Name0], [n5].[String] AS [String0], [n3].[Id] AS [Id1], [n3].[CollectionAssociateId] AS [CollectionAssociateId0], [n3].[Int] AS [Int1], [n3].[Ints] AS [Ints1], [n3].[Name] AS [Name1], [n3].[String] AS [String1], [n4].[Id] AS [Id2], [n4].[CollectionAssociateId] AS [CollectionAssociateId1], [n4].[Int] AS [Int2], [n4].[Ints] AS [Ints2], [n4].[Name] AS [Name2], [n4].[String] AS [String2] FROM [AssociateType] AS [a1] LEFT JOIN [NestedAssociateType] AS [n3] ON [a1].[OptionalNestedAssociateId] = [n3].[Id] INNER JOIN [NestedAssociateType] AS [n4] ON [a1].[RequiredNestedAssociateId] = [n4].[Id] @@ -32,7 +32,7 @@ FROM [AssociateType] AS [a1] WHERE ( SELECT COUNT(*) FROM OPENJSON([a].[Ints]) AS [i]) = 3 -ORDER BY [r].[Id], [a].[Id], [a0].[Id], [n].[Id], [n0].[Id], [n1].[Id], [n2].[Id], [s].[Id], [s].[Id0], [s].[Id1], [s].[Id2], [n6].[Id] +ORDER BY [r].[Id], [s].[Id], [s].[Id0], [n6].[Id] """); } @@ -42,7 +42,7 @@ public override async Task Index() AssertSql( """ -SELECT [r].[Id], [r].[Name], [r].[OptionalAssociateId], [r].[RequiredAssociateId], [a].[Id], [a0].[Id], [n].[Id], [n0].[Id], [n1].[Id], [n2].[Id], [s].[Id], [s].[CollectionRootId], [s].[Int], [s].[Ints], [s].[Name], [s].[OptionalNestedAssociateId], [s].[RequiredNestedAssociateId], [s].[String], [s].[Id0], [s].[Id1], [s].[Id2], [s].[CollectionAssociateId], [s].[Int0], [s].[Ints0], [s].[Name0], [s].[String0], [s].[CollectionAssociateId0], [s].[Int1], [s].[Ints1], [s].[Name1], [s].[String1], [s].[CollectionAssociateId1], [s].[Int2], [s].[Ints2], [s].[Name2], [s].[String2], [a0].[CollectionRootId], [a0].[Int], [a0].[Ints], [a0].[Name], [a0].[OptionalNestedAssociateId], [a0].[RequiredNestedAssociateId], [a0].[String], [n6].[Id], [n6].[CollectionAssociateId], [n6].[Int], [n6].[Ints], [n6].[Name], [n6].[String], [n].[CollectionAssociateId], [n].[Int], [n].[Ints], [n].[Name], [n].[String], [n0].[CollectionAssociateId], [n0].[Int], [n0].[Ints], [n0].[Name], [n0].[String], [a].[CollectionRootId], [a].[Int], [a].[Ints], [a].[Name], [a].[OptionalNestedAssociateId], [a].[RequiredNestedAssociateId], [a].[String], [n7].[Id], [n7].[CollectionAssociateId], [n7].[Int], [n7].[Ints], [n7].[Name], [n7].[String], [n1].[CollectionAssociateId], [n1].[Int], [n1].[Ints], [n1].[Name], [n1].[String], [n2].[CollectionAssociateId], [n2].[Int], [n2].[Ints], [n2].[Name], [n2].[String] +SELECT [r].[Id], [r].[Name], [r].[OptionalAssociateId], [r].[RequiredAssociateId], [s].[Id], [s].[CollectionRootId], [s].[Int], [s].[Ints], [s].[Name], [s].[OptionalNestedAssociateId], [s].[RequiredNestedAssociateId], [s].[String], [s].[Id0], [s].[CollectionAssociateId], [s].[Int0], [s].[Ints0], [s].[Name0], [s].[String0], [s].[Id1], [s].[CollectionAssociateId0], [s].[Int1], [s].[Ints1], [s].[Name1], [s].[String1], [s].[Id2], [s].[CollectionAssociateId1], [s].[Int2], [s].[Ints2], [s].[Name2], [s].[String2], [a0].[Id], [a0].[CollectionRootId], [a0].[Int], [a0].[Ints], [a0].[Name], [a0].[OptionalNestedAssociateId], [a0].[RequiredNestedAssociateId], [a0].[String], [n6].[Id], [n6].[CollectionAssociateId], [n6].[Int], [n6].[Ints], [n6].[Name], [n6].[String], [n].[Id], [n].[CollectionAssociateId], [n].[Int], [n].[Ints], [n].[Name], [n].[String], [n0].[Id], [n0].[CollectionAssociateId], [n0].[Int], [n0].[Ints], [n0].[Name], [n0].[String], [a].[Id], [a].[CollectionRootId], [a].[Int], [a].[Ints], [a].[Name], [a].[OptionalNestedAssociateId], [a].[RequiredNestedAssociateId], [a].[String], [n7].[Id], [n7].[CollectionAssociateId], [n7].[Int], [n7].[Ints], [n7].[Name], [n7].[String], [n1].[Id], [n1].[CollectionAssociateId], [n1].[Int], [n1].[Ints], [n1].[Name], [n1].[String], [n2].[Id], [n2].[CollectionAssociateId], [n2].[Int], [n2].[Ints], [n2].[Name], [n2].[String] FROM [RootEntity] AS [r] INNER JOIN [AssociateType] AS [a] ON [r].[RequiredAssociateId] = [a].[Id] LEFT JOIN [AssociateType] AS [a0] ON [r].[OptionalAssociateId] = [a0].[Id] @@ -51,7 +51,7 @@ FROM [RootEntity] AS [r] LEFT JOIN [NestedAssociateType] AS [n1] ON [a].[OptionalNestedAssociateId] = [n1].[Id] INNER JOIN [NestedAssociateType] AS [n2] ON [a].[RequiredNestedAssociateId] = [n2].[Id] LEFT JOIN ( - SELECT [a1].[Id], [a1].[CollectionRootId], [a1].[Int], [a1].[Ints], [a1].[Name], [a1].[OptionalNestedAssociateId], [a1].[RequiredNestedAssociateId], [a1].[String], [n3].[Id] AS [Id0], [n4].[Id] AS [Id1], [n5].[Id] AS [Id2], [n5].[CollectionAssociateId], [n5].[Int] AS [Int0], [n5].[Ints] AS [Ints0], [n5].[Name] AS [Name0], [n5].[String] AS [String0], [n3].[CollectionAssociateId] AS [CollectionAssociateId0], [n3].[Int] AS [Int1], [n3].[Ints] AS [Ints1], [n3].[Name] AS [Name1], [n3].[String] AS [String1], [n4].[CollectionAssociateId] AS [CollectionAssociateId1], [n4].[Int] AS [Int2], [n4].[Ints] AS [Ints2], [n4].[Name] AS [Name2], [n4].[String] AS [String2] + SELECT [a1].[Id], [a1].[CollectionRootId], [a1].[Int], [a1].[Ints], [a1].[Name], [a1].[OptionalNestedAssociateId], [a1].[RequiredNestedAssociateId], [a1].[String], [n5].[Id] AS [Id0], [n5].[CollectionAssociateId], [n5].[Int] AS [Int0], [n5].[Ints] AS [Ints0], [n5].[Name] AS [Name0], [n5].[String] AS [String0], [n3].[Id] AS [Id1], [n3].[CollectionAssociateId] AS [CollectionAssociateId0], [n3].[Int] AS [Int1], [n3].[Ints] AS [Ints1], [n3].[Name] AS [Name1], [n3].[String] AS [String1], [n4].[Id] AS [Id2], [n4].[CollectionAssociateId] AS [CollectionAssociateId1], [n4].[Int] AS [Int2], [n4].[Ints] AS [Ints2], [n4].[Name] AS [Name2], [n4].[String] AS [String2] FROM [AssociateType] AS [a1] LEFT JOIN [NestedAssociateType] AS [n3] ON [a1].[OptionalNestedAssociateId] = [n3].[Id] INNER JOIN [NestedAssociateType] AS [n4] ON [a1].[RequiredNestedAssociateId] = [n4].[Id] @@ -60,7 +60,7 @@ FROM [AssociateType] AS [a1] LEFT JOIN [NestedAssociateType] AS [n6] ON [a0].[Id] = [n6].[CollectionAssociateId] LEFT JOIN [NestedAssociateType] AS [n7] ON [a].[Id] = [n7].[CollectionAssociateId] WHERE CAST(JSON_VALUE([a].[Ints], '$[0]') AS int) = 1 -ORDER BY [r].[Id], [a].[Id], [a0].[Id], [n].[Id], [n0].[Id], [n1].[Id], [n2].[Id], [s].[Id], [s].[Id0], [s].[Id1], [s].[Id2], [n6].[Id] +ORDER BY [r].[Id], [s].[Id], [s].[Id0], [n6].[Id] """); } @@ -70,7 +70,7 @@ public override async Task Contains() AssertSql( """ -SELECT [r].[Id], [r].[Name], [r].[OptionalAssociateId], [r].[RequiredAssociateId], [a].[Id], [a0].[Id], [n].[Id], [n0].[Id], [n1].[Id], [n2].[Id], [s].[Id], [s].[CollectionRootId], [s].[Int], [s].[Ints], [s].[Name], [s].[OptionalNestedAssociateId], [s].[RequiredNestedAssociateId], [s].[String], [s].[Id0], [s].[Id1], [s].[Id2], [s].[CollectionAssociateId], [s].[Int0], [s].[Ints0], [s].[Name0], [s].[String0], [s].[CollectionAssociateId0], [s].[Int1], [s].[Ints1], [s].[Name1], [s].[String1], [s].[CollectionAssociateId1], [s].[Int2], [s].[Ints2], [s].[Name2], [s].[String2], [a0].[CollectionRootId], [a0].[Int], [a0].[Ints], [a0].[Name], [a0].[OptionalNestedAssociateId], [a0].[RequiredNestedAssociateId], [a0].[String], [n6].[Id], [n6].[CollectionAssociateId], [n6].[Int], [n6].[Ints], [n6].[Name], [n6].[String], [n].[CollectionAssociateId], [n].[Int], [n].[Ints], [n].[Name], [n].[String], [n0].[CollectionAssociateId], [n0].[Int], [n0].[Ints], [n0].[Name], [n0].[String], [a].[CollectionRootId], [a].[Int], [a].[Ints], [a].[Name], [a].[OptionalNestedAssociateId], [a].[RequiredNestedAssociateId], [a].[String], [n7].[Id], [n7].[CollectionAssociateId], [n7].[Int], [n7].[Ints], [n7].[Name], [n7].[String], [n1].[CollectionAssociateId], [n1].[Int], [n1].[Ints], [n1].[Name], [n1].[String], [n2].[CollectionAssociateId], [n2].[Int], [n2].[Ints], [n2].[Name], [n2].[String] +SELECT [r].[Id], [r].[Name], [r].[OptionalAssociateId], [r].[RequiredAssociateId], [s].[Id], [s].[CollectionRootId], [s].[Int], [s].[Ints], [s].[Name], [s].[OptionalNestedAssociateId], [s].[RequiredNestedAssociateId], [s].[String], [s].[Id0], [s].[CollectionAssociateId], [s].[Int0], [s].[Ints0], [s].[Name0], [s].[String0], [s].[Id1], [s].[CollectionAssociateId0], [s].[Int1], [s].[Ints1], [s].[Name1], [s].[String1], [s].[Id2], [s].[CollectionAssociateId1], [s].[Int2], [s].[Ints2], [s].[Name2], [s].[String2], [a0].[Id], [a0].[CollectionRootId], [a0].[Int], [a0].[Ints], [a0].[Name], [a0].[OptionalNestedAssociateId], [a0].[RequiredNestedAssociateId], [a0].[String], [n6].[Id], [n6].[CollectionAssociateId], [n6].[Int], [n6].[Ints], [n6].[Name], [n6].[String], [n].[Id], [n].[CollectionAssociateId], [n].[Int], [n].[Ints], [n].[Name], [n].[String], [n0].[Id], [n0].[CollectionAssociateId], [n0].[Int], [n0].[Ints], [n0].[Name], [n0].[String], [a].[Id], [a].[CollectionRootId], [a].[Int], [a].[Ints], [a].[Name], [a].[OptionalNestedAssociateId], [a].[RequiredNestedAssociateId], [a].[String], [n7].[Id], [n7].[CollectionAssociateId], [n7].[Int], [n7].[Ints], [n7].[Name], [n7].[String], [n1].[Id], [n1].[CollectionAssociateId], [n1].[Int], [n1].[Ints], [n1].[Name], [n1].[String], [n2].[Id], [n2].[CollectionAssociateId], [n2].[Int], [n2].[Ints], [n2].[Name], [n2].[String] FROM [RootEntity] AS [r] INNER JOIN [AssociateType] AS [a] ON [r].[RequiredAssociateId] = [a].[Id] LEFT JOIN [AssociateType] AS [a0] ON [r].[OptionalAssociateId] = [a0].[Id] @@ -79,7 +79,7 @@ FROM [RootEntity] AS [r] LEFT JOIN [NestedAssociateType] AS [n1] ON [a].[OptionalNestedAssociateId] = [n1].[Id] INNER JOIN [NestedAssociateType] AS [n2] ON [a].[RequiredNestedAssociateId] = [n2].[Id] LEFT JOIN ( - SELECT [a1].[Id], [a1].[CollectionRootId], [a1].[Int], [a1].[Ints], [a1].[Name], [a1].[OptionalNestedAssociateId], [a1].[RequiredNestedAssociateId], [a1].[String], [n3].[Id] AS [Id0], [n4].[Id] AS [Id1], [n5].[Id] AS [Id2], [n5].[CollectionAssociateId], [n5].[Int] AS [Int0], [n5].[Ints] AS [Ints0], [n5].[Name] AS [Name0], [n5].[String] AS [String0], [n3].[CollectionAssociateId] AS [CollectionAssociateId0], [n3].[Int] AS [Int1], [n3].[Ints] AS [Ints1], [n3].[Name] AS [Name1], [n3].[String] AS [String1], [n4].[CollectionAssociateId] AS [CollectionAssociateId1], [n4].[Int] AS [Int2], [n4].[Ints] AS [Ints2], [n4].[Name] AS [Name2], [n4].[String] AS [String2] + SELECT [a1].[Id], [a1].[CollectionRootId], [a1].[Int], [a1].[Ints], [a1].[Name], [a1].[OptionalNestedAssociateId], [a1].[RequiredNestedAssociateId], [a1].[String], [n5].[Id] AS [Id0], [n5].[CollectionAssociateId], [n5].[Int] AS [Int0], [n5].[Ints] AS [Ints0], [n5].[Name] AS [Name0], [n5].[String] AS [String0], [n3].[Id] AS [Id1], [n3].[CollectionAssociateId] AS [CollectionAssociateId0], [n3].[Int] AS [Int1], [n3].[Ints] AS [Ints1], [n3].[Name] AS [Name1], [n3].[String] AS [String1], [n4].[Id] AS [Id2], [n4].[CollectionAssociateId] AS [CollectionAssociateId1], [n4].[Int] AS [Int2], [n4].[Ints] AS [Ints2], [n4].[Name] AS [Name2], [n4].[String] AS [String2] FROM [AssociateType] AS [a1] LEFT JOIN [NestedAssociateType] AS [n3] ON [a1].[OptionalNestedAssociateId] = [n3].[Id] INNER JOIN [NestedAssociateType] AS [n4] ON [a1].[RequiredNestedAssociateId] = [n4].[Id] @@ -91,7 +91,7 @@ WHERE 3 IN ( SELECT [i].[value] FROM OPENJSON([a].[Ints]) WITH ([value] int '$') AS [i] ) -ORDER BY [r].[Id], [a].[Id], [a0].[Id], [n].[Id], [n0].[Id], [n1].[Id], [n2].[Id], [s].[Id], [s].[Id0], [s].[Id1], [s].[Id2], [n6].[Id] +ORDER BY [r].[Id], [s].[Id], [s].[Id0], [n6].[Id] """); } @@ -101,7 +101,7 @@ public override async Task Any_predicate() AssertSql( """ -SELECT [r].[Id], [r].[Name], [r].[OptionalAssociateId], [r].[RequiredAssociateId], [a].[Id], [a0].[Id], [n].[Id], [n0].[Id], [n1].[Id], [n2].[Id], [s].[Id], [s].[CollectionRootId], [s].[Int], [s].[Ints], [s].[Name], [s].[OptionalNestedAssociateId], [s].[RequiredNestedAssociateId], [s].[String], [s].[Id0], [s].[Id1], [s].[Id2], [s].[CollectionAssociateId], [s].[Int0], [s].[Ints0], [s].[Name0], [s].[String0], [s].[CollectionAssociateId0], [s].[Int1], [s].[Ints1], [s].[Name1], [s].[String1], [s].[CollectionAssociateId1], [s].[Int2], [s].[Ints2], [s].[Name2], [s].[String2], [a0].[CollectionRootId], [a0].[Int], [a0].[Ints], [a0].[Name], [a0].[OptionalNestedAssociateId], [a0].[RequiredNestedAssociateId], [a0].[String], [n6].[Id], [n6].[CollectionAssociateId], [n6].[Int], [n6].[Ints], [n6].[Name], [n6].[String], [n].[CollectionAssociateId], [n].[Int], [n].[Ints], [n].[Name], [n].[String], [n0].[CollectionAssociateId], [n0].[Int], [n0].[Ints], [n0].[Name], [n0].[String], [a].[CollectionRootId], [a].[Int], [a].[Ints], [a].[Name], [a].[OptionalNestedAssociateId], [a].[RequiredNestedAssociateId], [a].[String], [n7].[Id], [n7].[CollectionAssociateId], [n7].[Int], [n7].[Ints], [n7].[Name], [n7].[String], [n1].[CollectionAssociateId], [n1].[Int], [n1].[Ints], [n1].[Name], [n1].[String], [n2].[CollectionAssociateId], [n2].[Int], [n2].[Ints], [n2].[Name], [n2].[String] +SELECT [r].[Id], [r].[Name], [r].[OptionalAssociateId], [r].[RequiredAssociateId], [s].[Id], [s].[CollectionRootId], [s].[Int], [s].[Ints], [s].[Name], [s].[OptionalNestedAssociateId], [s].[RequiredNestedAssociateId], [s].[String], [s].[Id0], [s].[CollectionAssociateId], [s].[Int0], [s].[Ints0], [s].[Name0], [s].[String0], [s].[Id1], [s].[CollectionAssociateId0], [s].[Int1], [s].[Ints1], [s].[Name1], [s].[String1], [s].[Id2], [s].[CollectionAssociateId1], [s].[Int2], [s].[Ints2], [s].[Name2], [s].[String2], [a0].[Id], [a0].[CollectionRootId], [a0].[Int], [a0].[Ints], [a0].[Name], [a0].[OptionalNestedAssociateId], [a0].[RequiredNestedAssociateId], [a0].[String], [n6].[Id], [n6].[CollectionAssociateId], [n6].[Int], [n6].[Ints], [n6].[Name], [n6].[String], [n].[Id], [n].[CollectionAssociateId], [n].[Int], [n].[Ints], [n].[Name], [n].[String], [n0].[Id], [n0].[CollectionAssociateId], [n0].[Int], [n0].[Ints], [n0].[Name], [n0].[String], [a].[Id], [a].[CollectionRootId], [a].[Int], [a].[Ints], [a].[Name], [a].[OptionalNestedAssociateId], [a].[RequiredNestedAssociateId], [a].[String], [n7].[Id], [n7].[CollectionAssociateId], [n7].[Int], [n7].[Ints], [n7].[Name], [n7].[String], [n1].[Id], [n1].[CollectionAssociateId], [n1].[Int], [n1].[Ints], [n1].[Name], [n1].[String], [n2].[Id], [n2].[CollectionAssociateId], [n2].[Int], [n2].[Ints], [n2].[Name], [n2].[String] FROM [RootEntity] AS [r] INNER JOIN [AssociateType] AS [a] ON [r].[RequiredAssociateId] = [a].[Id] LEFT JOIN [AssociateType] AS [a0] ON [r].[OptionalAssociateId] = [a0].[Id] @@ -110,7 +110,7 @@ FROM [RootEntity] AS [r] LEFT JOIN [NestedAssociateType] AS [n1] ON [a].[OptionalNestedAssociateId] = [n1].[Id] INNER JOIN [NestedAssociateType] AS [n2] ON [a].[RequiredNestedAssociateId] = [n2].[Id] LEFT JOIN ( - SELECT [a1].[Id], [a1].[CollectionRootId], [a1].[Int], [a1].[Ints], [a1].[Name], [a1].[OptionalNestedAssociateId], [a1].[RequiredNestedAssociateId], [a1].[String], [n3].[Id] AS [Id0], [n4].[Id] AS [Id1], [n5].[Id] AS [Id2], [n5].[CollectionAssociateId], [n5].[Int] AS [Int0], [n5].[Ints] AS [Ints0], [n5].[Name] AS [Name0], [n5].[String] AS [String0], [n3].[CollectionAssociateId] AS [CollectionAssociateId0], [n3].[Int] AS [Int1], [n3].[Ints] AS [Ints1], [n3].[Name] AS [Name1], [n3].[String] AS [String1], [n4].[CollectionAssociateId] AS [CollectionAssociateId1], [n4].[Int] AS [Int2], [n4].[Ints] AS [Ints2], [n4].[Name] AS [Name2], [n4].[String] AS [String2] + SELECT [a1].[Id], [a1].[CollectionRootId], [a1].[Int], [a1].[Ints], [a1].[Name], [a1].[OptionalNestedAssociateId], [a1].[RequiredNestedAssociateId], [a1].[String], [n5].[Id] AS [Id0], [n5].[CollectionAssociateId], [n5].[Int] AS [Int0], [n5].[Ints] AS [Ints0], [n5].[Name] AS [Name0], [n5].[String] AS [String0], [n3].[Id] AS [Id1], [n3].[CollectionAssociateId] AS [CollectionAssociateId0], [n3].[Int] AS [Int1], [n3].[Ints] AS [Ints1], [n3].[Name] AS [Name1], [n3].[String] AS [String1], [n4].[Id] AS [Id2], [n4].[CollectionAssociateId] AS [CollectionAssociateId1], [n4].[Int] AS [Int2], [n4].[Ints] AS [Ints2], [n4].[Name] AS [Name2], [n4].[String] AS [String2] FROM [AssociateType] AS [a1] LEFT JOIN [NestedAssociateType] AS [n3] ON [a1].[OptionalNestedAssociateId] = [n3].[Id] INNER JOIN [NestedAssociateType] AS [n4] ON [a1].[RequiredNestedAssociateId] = [n4].[Id] @@ -122,7 +122,7 @@ WHERE 2 IN ( SELECT [i].[value] FROM OPENJSON([a].[Ints]) WITH ([value] int '$') AS [i] ) -ORDER BY [r].[Id], [a].[Id], [a0].[Id], [n].[Id], [n0].[Id], [n1].[Id], [n2].[Id], [s].[Id], [s].[Id0], [s].[Id1], [s].[Id2], [n6].[Id] +ORDER BY [r].[Id], [s].[Id], [s].[Id0], [n6].[Id] """); } @@ -132,7 +132,7 @@ public override async Task Nested_Count() AssertSql( """ -SELECT [r].[Id], [r].[Name], [r].[OptionalAssociateId], [r].[RequiredAssociateId], [a].[Id], [n].[Id], [a0].[Id], [n0].[Id], [n1].[Id], [n2].[Id], [s].[Id], [s].[CollectionRootId], [s].[Int], [s].[Ints], [s].[Name], [s].[OptionalNestedAssociateId], [s].[RequiredNestedAssociateId], [s].[String], [s].[Id0], [s].[Id1], [s].[Id2], [s].[CollectionAssociateId], [s].[Int0], [s].[Ints0], [s].[Name0], [s].[String0], [s].[CollectionAssociateId0], [s].[Int1], [s].[Ints1], [s].[Name1], [s].[String1], [s].[CollectionAssociateId1], [s].[Int2], [s].[Ints2], [s].[Name2], [s].[String2], [a0].[CollectionRootId], [a0].[Int], [a0].[Ints], [a0].[Name], [a0].[OptionalNestedAssociateId], [a0].[RequiredNestedAssociateId], [a0].[String], [n6].[Id], [n6].[CollectionAssociateId], [n6].[Int], [n6].[Ints], [n6].[Name], [n6].[String], [n0].[CollectionAssociateId], [n0].[Int], [n0].[Ints], [n0].[Name], [n0].[String], [n1].[CollectionAssociateId], [n1].[Int], [n1].[Ints], [n1].[Name], [n1].[String], [a].[CollectionRootId], [a].[Int], [a].[Ints], [a].[Name], [a].[OptionalNestedAssociateId], [a].[RequiredNestedAssociateId], [a].[String], [n7].[Id], [n7].[CollectionAssociateId], [n7].[Int], [n7].[Ints], [n7].[Name], [n7].[String], [n2].[CollectionAssociateId], [n2].[Int], [n2].[Ints], [n2].[Name], [n2].[String], [n].[CollectionAssociateId], [n].[Int], [n].[Ints], [n].[Name], [n].[String] +SELECT [r].[Id], [r].[Name], [r].[OptionalAssociateId], [r].[RequiredAssociateId], [s].[Id], [s].[CollectionRootId], [s].[Int], [s].[Ints], [s].[Name], [s].[OptionalNestedAssociateId], [s].[RequiredNestedAssociateId], [s].[String], [s].[Id0], [s].[CollectionAssociateId], [s].[Int0], [s].[Ints0], [s].[Name0], [s].[String0], [s].[Id1], [s].[CollectionAssociateId0], [s].[Int1], [s].[Ints1], [s].[Name1], [s].[String1], [s].[Id2], [s].[CollectionAssociateId1], [s].[Int2], [s].[Ints2], [s].[Name2], [s].[String2], [a0].[Id], [a0].[CollectionRootId], [a0].[Int], [a0].[Ints], [a0].[Name], [a0].[OptionalNestedAssociateId], [a0].[RequiredNestedAssociateId], [a0].[String], [n6].[Id], [n6].[CollectionAssociateId], [n6].[Int], [n6].[Ints], [n6].[Name], [n6].[String], [n0].[Id], [n0].[CollectionAssociateId], [n0].[Int], [n0].[Ints], [n0].[Name], [n0].[String], [n1].[Id], [n1].[CollectionAssociateId], [n1].[Int], [n1].[Ints], [n1].[Name], [n1].[String], [a].[Id], [a].[CollectionRootId], [a].[Int], [a].[Ints], [a].[Name], [a].[OptionalNestedAssociateId], [a].[RequiredNestedAssociateId], [a].[String], [n7].[Id], [n7].[CollectionAssociateId], [n7].[Int], [n7].[Ints], [n7].[Name], [n7].[String], [n2].[Id], [n2].[CollectionAssociateId], [n2].[Int], [n2].[Ints], [n2].[Name], [n2].[String], [n].[Id], [n].[CollectionAssociateId], [n].[Int], [n].[Ints], [n].[Name], [n].[String] FROM [RootEntity] AS [r] INNER JOIN [AssociateType] AS [a] ON [r].[RequiredAssociateId] = [a].[Id] INNER JOIN [NestedAssociateType] AS [n] ON [a].[RequiredNestedAssociateId] = [n].[Id] @@ -141,7 +141,7 @@ FROM [RootEntity] AS [r] LEFT JOIN [NestedAssociateType] AS [n1] ON [a0].[RequiredNestedAssociateId] = [n1].[Id] LEFT JOIN [NestedAssociateType] AS [n2] ON [a].[OptionalNestedAssociateId] = [n2].[Id] LEFT JOIN ( - SELECT [a1].[Id], [a1].[CollectionRootId], [a1].[Int], [a1].[Ints], [a1].[Name], [a1].[OptionalNestedAssociateId], [a1].[RequiredNestedAssociateId], [a1].[String], [n3].[Id] AS [Id0], [n4].[Id] AS [Id1], [n5].[Id] AS [Id2], [n5].[CollectionAssociateId], [n5].[Int] AS [Int0], [n5].[Ints] AS [Ints0], [n5].[Name] AS [Name0], [n5].[String] AS [String0], [n3].[CollectionAssociateId] AS [CollectionAssociateId0], [n3].[Int] AS [Int1], [n3].[Ints] AS [Ints1], [n3].[Name] AS [Name1], [n3].[String] AS [String1], [n4].[CollectionAssociateId] AS [CollectionAssociateId1], [n4].[Int] AS [Int2], [n4].[Ints] AS [Ints2], [n4].[Name] AS [Name2], [n4].[String] AS [String2] + SELECT [a1].[Id], [a1].[CollectionRootId], [a1].[Int], [a1].[Ints], [a1].[Name], [a1].[OptionalNestedAssociateId], [a1].[RequiredNestedAssociateId], [a1].[String], [n5].[Id] AS [Id0], [n5].[CollectionAssociateId], [n5].[Int] AS [Int0], [n5].[Ints] AS [Ints0], [n5].[Name] AS [Name0], [n5].[String] AS [String0], [n3].[Id] AS [Id1], [n3].[CollectionAssociateId] AS [CollectionAssociateId0], [n3].[Int] AS [Int1], [n3].[Ints] AS [Ints1], [n3].[Name] AS [Name1], [n3].[String] AS [String1], [n4].[Id] AS [Id2], [n4].[CollectionAssociateId] AS [CollectionAssociateId1], [n4].[Int] AS [Int2], [n4].[Ints] AS [Ints2], [n4].[Name] AS [Name2], [n4].[String] AS [String2] FROM [AssociateType] AS [a1] LEFT JOIN [NestedAssociateType] AS [n3] ON [a1].[OptionalNestedAssociateId] = [n3].[Id] INNER JOIN [NestedAssociateType] AS [n4] ON [a1].[RequiredNestedAssociateId] = [n4].[Id] @@ -152,7 +152,7 @@ FROM [AssociateType] AS [a1] WHERE ( SELECT COUNT(*) FROM OPENJSON([n].[Ints]) AS [i]) = 3 -ORDER BY [r].[Id], [a].[Id], [n].[Id], [a0].[Id], [n0].[Id], [n1].[Id], [n2].[Id], [s].[Id], [s].[Id0], [s].[Id1], [s].[Id2], [n6].[Id] +ORDER BY [r].[Id], [s].[Id], [s].[Id0], [n6].[Id] """); } diff --git a/test/EFCore.SqlServer.FunctionalTests/Query/Associations/Navigations/NavigationsProjectionSqlServerTest.cs b/test/EFCore.SqlServer.FunctionalTests/Query/Associations/Navigations/NavigationsProjectionSqlServerTest.cs index 2403bae3bdc..232b2041564 100644 --- a/test/EFCore.SqlServer.FunctionalTests/Query/Associations/Navigations/NavigationsProjectionSqlServerTest.cs +++ b/test/EFCore.SqlServer.FunctionalTests/Query/Associations/Navigations/NavigationsProjectionSqlServerTest.cs @@ -12,7 +12,7 @@ public override async Task Select_root(QueryTrackingBehavior queryTrackingBehavi AssertSql( """ -SELECT [r].[Id], [r].[Name], [r].[OptionalAssociateId], [r].[RequiredAssociateId], [a].[Id], [n].[Id], [n0].[Id], [a0].[Id], [n1].[Id], [n2].[Id], [s].[Id], [s].[CollectionRootId], [s].[Int], [s].[Ints], [s].[Name], [s].[OptionalNestedAssociateId], [s].[RequiredNestedAssociateId], [s].[String], [s].[Id0], [s].[Id1], [s].[Id2], [s].[CollectionAssociateId], [s].[Int0], [s].[Ints0], [s].[Name0], [s].[String0], [s].[CollectionAssociateId0], [s].[Int1], [s].[Ints1], [s].[Name1], [s].[String1], [s].[CollectionAssociateId1], [s].[Int2], [s].[Ints2], [s].[Name2], [s].[String2], [a].[CollectionRootId], [a].[Int], [a].[Ints], [a].[Name], [a].[OptionalNestedAssociateId], [a].[RequiredNestedAssociateId], [a].[String], [n6].[Id], [n6].[CollectionAssociateId], [n6].[Int], [n6].[Ints], [n6].[Name], [n6].[String], [n].[CollectionAssociateId], [n].[Int], [n].[Ints], [n].[Name], [n].[String], [n0].[CollectionAssociateId], [n0].[Int], [n0].[Ints], [n0].[Name], [n0].[String], [a0].[CollectionRootId], [a0].[Int], [a0].[Ints], [a0].[Name], [a0].[OptionalNestedAssociateId], [a0].[RequiredNestedAssociateId], [a0].[String], [n7].[Id], [n7].[CollectionAssociateId], [n7].[Int], [n7].[Ints], [n7].[Name], [n7].[String], [n1].[CollectionAssociateId], [n1].[Int], [n1].[Ints], [n1].[Name], [n1].[String], [n2].[CollectionAssociateId], [n2].[Int], [n2].[Ints], [n2].[Name], [n2].[String] +SELECT [r].[Id], [r].[Name], [r].[OptionalAssociateId], [r].[RequiredAssociateId], [s].[Id], [s].[CollectionRootId], [s].[Int], [s].[Ints], [s].[Name], [s].[OptionalNestedAssociateId], [s].[RequiredNestedAssociateId], [s].[String], [s].[Id0], [s].[CollectionAssociateId], [s].[Int0], [s].[Ints0], [s].[Name0], [s].[String0], [s].[Id1], [s].[CollectionAssociateId0], [s].[Int1], [s].[Ints1], [s].[Name1], [s].[String1], [s].[Id2], [s].[CollectionAssociateId1], [s].[Int2], [s].[Ints2], [s].[Name2], [s].[String2], [a].[Id], [a].[CollectionRootId], [a].[Int], [a].[Ints], [a].[Name], [a].[OptionalNestedAssociateId], [a].[RequiredNestedAssociateId], [a].[String], [n6].[Id], [n6].[CollectionAssociateId], [n6].[Int], [n6].[Ints], [n6].[Name], [n6].[String], [n].[Id], [n].[CollectionAssociateId], [n].[Int], [n].[Ints], [n].[Name], [n].[String], [n0].[Id], [n0].[CollectionAssociateId], [n0].[Int], [n0].[Ints], [n0].[Name], [n0].[String], [a0].[Id], [a0].[CollectionRootId], [a0].[Int], [a0].[Ints], [a0].[Name], [a0].[OptionalNestedAssociateId], [a0].[RequiredNestedAssociateId], [a0].[String], [n7].[Id], [n7].[CollectionAssociateId], [n7].[Int], [n7].[Ints], [n7].[Name], [n7].[String], [n1].[Id], [n1].[CollectionAssociateId], [n1].[Int], [n1].[Ints], [n1].[Name], [n1].[String], [n2].[Id], [n2].[CollectionAssociateId], [n2].[Int], [n2].[Ints], [n2].[Name], [n2].[String] FROM [RootEntity] AS [r] LEFT JOIN [AssociateType] AS [a] ON [r].[OptionalAssociateId] = [a].[Id] LEFT JOIN [NestedAssociateType] AS [n] ON [a].[OptionalNestedAssociateId] = [n].[Id] @@ -21,7 +21,7 @@ FROM [RootEntity] AS [r] LEFT JOIN [NestedAssociateType] AS [n1] ON [a0].[OptionalNestedAssociateId] = [n1].[Id] INNER JOIN [NestedAssociateType] AS [n2] ON [a0].[RequiredNestedAssociateId] = [n2].[Id] LEFT JOIN ( - SELECT [a1].[Id], [a1].[CollectionRootId], [a1].[Int], [a1].[Ints], [a1].[Name], [a1].[OptionalNestedAssociateId], [a1].[RequiredNestedAssociateId], [a1].[String], [n3].[Id] AS [Id0], [n4].[Id] AS [Id1], [n5].[Id] AS [Id2], [n5].[CollectionAssociateId], [n5].[Int] AS [Int0], [n5].[Ints] AS [Ints0], [n5].[Name] AS [Name0], [n5].[String] AS [String0], [n3].[CollectionAssociateId] AS [CollectionAssociateId0], [n3].[Int] AS [Int1], [n3].[Ints] AS [Ints1], [n3].[Name] AS [Name1], [n3].[String] AS [String1], [n4].[CollectionAssociateId] AS [CollectionAssociateId1], [n4].[Int] AS [Int2], [n4].[Ints] AS [Ints2], [n4].[Name] AS [Name2], [n4].[String] AS [String2] + SELECT [a1].[Id], [a1].[CollectionRootId], [a1].[Int], [a1].[Ints], [a1].[Name], [a1].[OptionalNestedAssociateId], [a1].[RequiredNestedAssociateId], [a1].[String], [n5].[Id] AS [Id0], [n5].[CollectionAssociateId], [n5].[Int] AS [Int0], [n5].[Ints] AS [Ints0], [n5].[Name] AS [Name0], [n5].[String] AS [String0], [n3].[Id] AS [Id1], [n3].[CollectionAssociateId] AS [CollectionAssociateId0], [n3].[Int] AS [Int1], [n3].[Ints] AS [Ints1], [n3].[Name] AS [Name1], [n3].[String] AS [String1], [n4].[Id] AS [Id2], [n4].[CollectionAssociateId] AS [CollectionAssociateId1], [n4].[Int] AS [Int2], [n4].[Ints] AS [Ints2], [n4].[Name] AS [Name2], [n4].[String] AS [String2] FROM [AssociateType] AS [a1] LEFT JOIN [NestedAssociateType] AS [n3] ON [a1].[OptionalNestedAssociateId] = [n3].[Id] INNER JOIN [NestedAssociateType] AS [n4] ON [a1].[RequiredNestedAssociateId] = [n4].[Id] @@ -29,7 +29,7 @@ FROM [AssociateType] AS [a1] ) AS [s] ON [r].[Id] = [s].[CollectionRootId] LEFT JOIN [NestedAssociateType] AS [n6] ON [a].[Id] = [n6].[CollectionAssociateId] LEFT JOIN [NestedAssociateType] AS [n7] ON [a0].[Id] = [n7].[CollectionAssociateId] -ORDER BY [r].[Id], [a].[Id], [n].[Id], [n0].[Id], [a0].[Id], [n1].[Id], [n2].[Id], [s].[Id], [s].[Id0], [s].[Id1], [s].[Id2], [n6].[Id] +ORDER BY [r].[Id], [s].[Id], [s].[Id0], [n6].[Id] """); } @@ -93,13 +93,13 @@ public override async Task Select_associate(QueryTrackingBehavior queryTrackingB AssertSql( """ -SELECT [a].[Id], [a].[CollectionRootId], [a].[Int], [a].[Ints], [a].[Name], [a].[OptionalNestedAssociateId], [a].[RequiredNestedAssociateId], [a].[String], [r].[Id], [n].[Id], [n0].[Id], [n1].[Id], [n1].[CollectionAssociateId], [n1].[Int], [n1].[Ints], [n1].[Name], [n1].[String], [n].[CollectionAssociateId], [n].[Int], [n].[Ints], [n].[Name], [n].[String], [n0].[CollectionAssociateId], [n0].[Int], [n0].[Ints], [n0].[Name], [n0].[String] +SELECT [a].[Id], [a].[CollectionRootId], [a].[Int], [a].[Ints], [a].[Name], [a].[OptionalNestedAssociateId], [a].[RequiredNestedAssociateId], [a].[String], [r].[Id], [n1].[Id], [n1].[CollectionAssociateId], [n1].[Int], [n1].[Ints], [n1].[Name], [n1].[String], [n].[Id], [n].[CollectionAssociateId], [n].[Int], [n].[Ints], [n].[Name], [n].[String], [n0].[Id], [n0].[CollectionAssociateId], [n0].[Int], [n0].[Ints], [n0].[Name], [n0].[String] FROM [RootEntity] AS [r] INNER JOIN [AssociateType] AS [a] ON [r].[RequiredAssociateId] = [a].[Id] LEFT JOIN [NestedAssociateType] AS [n] ON [a].[OptionalNestedAssociateId] = [n].[Id] INNER JOIN [NestedAssociateType] AS [n0] ON [a].[RequiredNestedAssociateId] = [n0].[Id] LEFT JOIN [NestedAssociateType] AS [n1] ON [a].[Id] = [n1].[CollectionAssociateId] -ORDER BY [r].[Id], [a].[Id], [n].[Id], [n0].[Id] +ORDER BY [r].[Id] """); } @@ -109,13 +109,13 @@ public override async Task Select_optional_associate(QueryTrackingBehavior query AssertSql( """ -SELECT [a].[Id], [a].[CollectionRootId], [a].[Int], [a].[Ints], [a].[Name], [a].[OptionalNestedAssociateId], [a].[RequiredNestedAssociateId], [a].[String], [r].[Id], [n].[Id], [n0].[Id], [n1].[Id], [n1].[CollectionAssociateId], [n1].[Int], [n1].[Ints], [n1].[Name], [n1].[String], [n].[CollectionAssociateId], [n].[Int], [n].[Ints], [n].[Name], [n].[String], [n0].[CollectionAssociateId], [n0].[Int], [n0].[Ints], [n0].[Name], [n0].[String] +SELECT [a].[Id], [a].[CollectionRootId], [a].[Int], [a].[Ints], [a].[Name], [a].[OptionalNestedAssociateId], [a].[RequiredNestedAssociateId], [a].[String], [r].[Id], [n1].[Id], [n1].[CollectionAssociateId], [n1].[Int], [n1].[Ints], [n1].[Name], [n1].[String], [n].[Id], [n].[CollectionAssociateId], [n].[Int], [n].[Ints], [n].[Name], [n].[String], [n0].[Id], [n0].[CollectionAssociateId], [n0].[Int], [n0].[Ints], [n0].[Name], [n0].[String] FROM [RootEntity] AS [r] LEFT JOIN [AssociateType] AS [a] ON [r].[OptionalAssociateId] = [a].[Id] LEFT JOIN [NestedAssociateType] AS [n] ON [a].[OptionalNestedAssociateId] = [n].[Id] LEFT JOIN [NestedAssociateType] AS [n0] ON [a].[RequiredNestedAssociateId] = [n0].[Id] LEFT JOIN [NestedAssociateType] AS [n1] ON [a].[Id] = [n1].[CollectionAssociateId] -ORDER BY [r].[Id], [a].[Id], [n].[Id], [n0].[Id] +ORDER BY [r].[Id] """); } @@ -177,14 +177,14 @@ public override async Task Select_required_associate_via_optional_navigation(Que AssertSql( """ -SELECT [a].[Id], [a].[CollectionRootId], [a].[Int], [a].[Ints], [a].[Name], [a].[OptionalNestedAssociateId], [a].[RequiredNestedAssociateId], [a].[String], [r].[Id], [r0].[Id], [n].[Id], [n0].[Id], [n1].[Id], [n1].[CollectionAssociateId], [n1].[Int], [n1].[Ints], [n1].[Name], [n1].[String], [n].[CollectionAssociateId], [n].[Int], [n].[Ints], [n].[Name], [n].[String], [n0].[CollectionAssociateId], [n0].[Int], [n0].[Ints], [n0].[Name], [n0].[String] +SELECT [a].[Id], [a].[CollectionRootId], [a].[Int], [a].[Ints], [a].[Name], [a].[OptionalNestedAssociateId], [a].[RequiredNestedAssociateId], [a].[String], [r].[Id], [n1].[Id], [n1].[CollectionAssociateId], [n1].[Int], [n1].[Ints], [n1].[Name], [n1].[String], [n].[Id], [n].[CollectionAssociateId], [n].[Int], [n].[Ints], [n].[Name], [n].[String], [n0].[Id], [n0].[CollectionAssociateId], [n0].[Int], [n0].[Ints], [n0].[Name], [n0].[String] FROM [RootReferencingEntity] AS [r] LEFT JOIN [RootEntity] AS [r0] ON [r].[RootEntityId] = [r0].[Id] LEFT JOIN [AssociateType] AS [a] ON [r0].[RequiredAssociateId] = [a].[Id] LEFT JOIN [NestedAssociateType] AS [n] ON [a].[OptionalNestedAssociateId] = [n].[Id] LEFT JOIN [NestedAssociateType] AS [n0] ON [a].[RequiredNestedAssociateId] = [n0].[Id] LEFT JOIN [NestedAssociateType] AS [n1] ON [a].[Id] = [n1].[CollectionAssociateId] -ORDER BY [r].[Id], [r0].[Id], [a].[Id], [n].[Id], [n0].[Id] +ORDER BY [r].[Id] """); } @@ -194,13 +194,13 @@ public override async Task Select_unmapped_associate_scalar_property(QueryTracki AssertSql( """ -SELECT [a].[Id], [a].[CollectionRootId], [a].[Int], [a].[Ints], [a].[Name], [a].[OptionalNestedAssociateId], [a].[RequiredNestedAssociateId], [a].[String], [r].[Id], [n].[Id], [n0].[Id], [n1].[Id], [n1].[CollectionAssociateId], [n1].[Int], [n1].[Ints], [n1].[Name], [n1].[String], [n].[CollectionAssociateId], [n].[Int], [n].[Ints], [n].[Name], [n].[String], [n0].[CollectionAssociateId], [n0].[Int], [n0].[Ints], [n0].[Name], [n0].[String] +SELECT [a].[Id], [a].[CollectionRootId], [a].[Int], [a].[Ints], [a].[Name], [a].[OptionalNestedAssociateId], [a].[RequiredNestedAssociateId], [a].[String], [r].[Id], [n1].[Id], [n1].[CollectionAssociateId], [n1].[Int], [n1].[Ints], [n1].[Name], [n1].[String], [n].[Id], [n].[CollectionAssociateId], [n].[Int], [n].[Ints], [n].[Name], [n].[String], [n0].[Id], [n0].[CollectionAssociateId], [n0].[Int], [n0].[Ints], [n0].[Name], [n0].[String] FROM [RootEntity] AS [r] INNER JOIN [AssociateType] AS [a] ON [r].[RequiredAssociateId] = [a].[Id] LEFT JOIN [NestedAssociateType] AS [n] ON [a].[OptionalNestedAssociateId] = [n].[Id] INNER JOIN [NestedAssociateType] AS [n0] ON [a].[RequiredNestedAssociateId] = [n0].[Id] LEFT JOIN [NestedAssociateType] AS [n1] ON [a].[Id] = [n1].[CollectionAssociateId] -ORDER BY [r].[Id], [a].[Id], [n].[Id], [n0].[Id] +ORDER BY [r].[Id] """); } @@ -226,16 +226,16 @@ public override async Task Select_associate_collection(QueryTrackingBehavior que AssertSql( """ -SELECT [r].[Id], [s].[Id], [s].[CollectionRootId], [s].[Int], [s].[Ints], [s].[Name], [s].[OptionalNestedAssociateId], [s].[RequiredNestedAssociateId], [s].[String], [s].[Id0], [s].[Id1], [s].[Id2], [s].[CollectionAssociateId], [s].[Int0], [s].[Ints0], [s].[Name0], [s].[String0], [s].[CollectionAssociateId0], [s].[Int1], [s].[Ints1], [s].[Name1], [s].[String1], [s].[CollectionAssociateId1], [s].[Int2], [s].[Ints2], [s].[Name2], [s].[String2] +SELECT [r].[Id], [s].[Id], [s].[CollectionRootId], [s].[Int], [s].[Ints], [s].[Name], [s].[OptionalNestedAssociateId], [s].[RequiredNestedAssociateId], [s].[String], [s].[Id0], [s].[CollectionAssociateId], [s].[Int0], [s].[Ints0], [s].[Name0], [s].[String0], [s].[Id1], [s].[CollectionAssociateId0], [s].[Int1], [s].[Ints1], [s].[Name1], [s].[String1], [s].[Id2], [s].[CollectionAssociateId1], [s].[Int2], [s].[Ints2], [s].[Name2], [s].[String2] FROM [RootEntity] AS [r] LEFT JOIN ( - SELECT [a].[Id], [a].[CollectionRootId], [a].[Int], [a].[Ints], [a].[Name], [a].[OptionalNestedAssociateId], [a].[RequiredNestedAssociateId], [a].[String], [n].[Id] AS [Id0], [n0].[Id] AS [Id1], [n1].[Id] AS [Id2], [n1].[CollectionAssociateId], [n1].[Int] AS [Int0], [n1].[Ints] AS [Ints0], [n1].[Name] AS [Name0], [n1].[String] AS [String0], [n].[CollectionAssociateId] AS [CollectionAssociateId0], [n].[Int] AS [Int1], [n].[Ints] AS [Ints1], [n].[Name] AS [Name1], [n].[String] AS [String1], [n0].[CollectionAssociateId] AS [CollectionAssociateId1], [n0].[Int] AS [Int2], [n0].[Ints] AS [Ints2], [n0].[Name] AS [Name2], [n0].[String] AS [String2] + SELECT [a].[Id], [a].[CollectionRootId], [a].[Int], [a].[Ints], [a].[Name], [a].[OptionalNestedAssociateId], [a].[RequiredNestedAssociateId], [a].[String], [n1].[Id] AS [Id0], [n1].[CollectionAssociateId], [n1].[Int] AS [Int0], [n1].[Ints] AS [Ints0], [n1].[Name] AS [Name0], [n1].[String] AS [String0], [n].[Id] AS [Id1], [n].[CollectionAssociateId] AS [CollectionAssociateId0], [n].[Int] AS [Int1], [n].[Ints] AS [Ints1], [n].[Name] AS [Name1], [n].[String] AS [String1], [n0].[Id] AS [Id2], [n0].[CollectionAssociateId] AS [CollectionAssociateId1], [n0].[Int] AS [Int2], [n0].[Ints] AS [Ints2], [n0].[Name] AS [Name2], [n0].[String] AS [String2] FROM [AssociateType] AS [a] LEFT JOIN [NestedAssociateType] AS [n] ON [a].[OptionalNestedAssociateId] = [n].[Id] INNER JOIN [NestedAssociateType] AS [n0] ON [a].[RequiredNestedAssociateId] = [n0].[Id] LEFT JOIN [NestedAssociateType] AS [n1] ON [a].[Id] = [n1].[CollectionAssociateId] ) AS [s] ON [r].[Id] = [s].[CollectionRootId] -ORDER BY [r].[Id], [s].[Id], [s].[Id0], [s].[Id1] +ORDER BY [r].[Id], [s].[Id] """); } @@ -245,11 +245,11 @@ public override async Task Select_nested_collection_on_required_associate(QueryT AssertSql( """ -SELECT [r].[Id], [a].[Id], [n].[Id], [n].[CollectionAssociateId], [n].[Int], [n].[Ints], [n].[Name], [n].[String] +SELECT [r].[Id], [n].[Id], [n].[CollectionAssociateId], [n].[Int], [n].[Ints], [n].[Name], [n].[String] FROM [RootEntity] AS [r] INNER JOIN [AssociateType] AS [a] ON [r].[RequiredAssociateId] = [a].[Id] LEFT JOIN [NestedAssociateType] AS [n] ON [a].[Id] = [n].[CollectionAssociateId] -ORDER BY [r].[Id], [a].[Id] +ORDER BY [r].[Id] """); } @@ -259,11 +259,11 @@ public override async Task Select_nested_collection_on_optional_associate(QueryT AssertSql( """ -SELECT [r].[Id], [a].[Id], [n].[Id], [n].[CollectionAssociateId], [n].[Int], [n].[Ints], [n].[Name], [n].[String] +SELECT [r].[Id], [n].[Id], [n].[CollectionAssociateId], [n].[Int], [n].[Ints], [n].[Name], [n].[String] FROM [RootEntity] AS [r] LEFT JOIN [AssociateType] AS [a] ON [r].[OptionalAssociateId] = [a].[Id] LEFT JOIN [NestedAssociateType] AS [n] ON [a].[Id] = [n].[CollectionAssociateId] -ORDER BY [r].[Id], [a].[Id] +ORDER BY [r].[Id] """); } @@ -273,13 +273,13 @@ public override async Task SelectMany_associate_collection(QueryTrackingBehavior AssertSql( """ -SELECT [a].[Id], [a].[CollectionRootId], [a].[Int], [a].[Ints], [a].[Name], [a].[OptionalNestedAssociateId], [a].[RequiredNestedAssociateId], [a].[String], [r].[Id], [n].[Id], [n0].[Id], [n1].[Id], [n1].[CollectionAssociateId], [n1].[Int], [n1].[Ints], [n1].[Name], [n1].[String], [n].[CollectionAssociateId], [n].[Int], [n].[Ints], [n].[Name], [n].[String], [n0].[CollectionAssociateId], [n0].[Int], [n0].[Ints], [n0].[Name], [n0].[String] +SELECT [a].[Id], [a].[CollectionRootId], [a].[Int], [a].[Ints], [a].[Name], [a].[OptionalNestedAssociateId], [a].[RequiredNestedAssociateId], [a].[String], [r].[Id], [n1].[Id], [n1].[CollectionAssociateId], [n1].[Int], [n1].[Ints], [n1].[Name], [n1].[String], [n].[Id], [n].[CollectionAssociateId], [n].[Int], [n].[Ints], [n].[Name], [n].[String], [n0].[Id], [n0].[CollectionAssociateId], [n0].[Int], [n0].[Ints], [n0].[Name], [n0].[String] FROM [RootEntity] AS [r] INNER JOIN [AssociateType] AS [a] ON [r].[Id] = [a].[CollectionRootId] LEFT JOIN [NestedAssociateType] AS [n] ON [a].[OptionalNestedAssociateId] = [n].[Id] INNER JOIN [NestedAssociateType] AS [n0] ON [a].[RequiredNestedAssociateId] = [n0].[Id] LEFT JOIN [NestedAssociateType] AS [n1] ON [a].[Id] = [n1].[CollectionAssociateId] -ORDER BY [r].[Id], [a].[Id], [n].[Id], [n0].[Id] +ORDER BY [r].[Id], [a].[Id] """); } @@ -319,7 +319,7 @@ public override async Task Select_root_duplicated(QueryTrackingBehavior queryTra AssertSql( """ -SELECT [r].[Id], [r].[Name], [r].[OptionalAssociateId], [r].[RequiredAssociateId], [a].[Id], [n].[Id], [n0].[Id], [a0].[Id], [n1].[Id], [n2].[Id], [s].[Id], [s].[CollectionRootId], [s].[Int], [s].[Ints], [s].[Name], [s].[OptionalNestedAssociateId], [s].[RequiredNestedAssociateId], [s].[String], [s].[Id0], [s].[Id1], [s].[Id2], [s].[CollectionAssociateId], [s].[Int0], [s].[Ints0], [s].[Name0], [s].[String0], [s].[CollectionAssociateId0], [s].[Int1], [s].[Ints1], [s].[Name1], [s].[String1], [s].[CollectionAssociateId1], [s].[Int2], [s].[Ints2], [s].[Name2], [s].[String2], [a].[CollectionRootId], [a].[Int], [a].[Ints], [a].[Name], [a].[OptionalNestedAssociateId], [a].[RequiredNestedAssociateId], [a].[String], [n6].[Id], [n6].[CollectionAssociateId], [n6].[Int], [n6].[Ints], [n6].[Name], [n6].[String], [n].[CollectionAssociateId], [n].[Int], [n].[Ints], [n].[Name], [n].[String], [n0].[CollectionAssociateId], [n0].[Int], [n0].[Ints], [n0].[Name], [n0].[String], [a0].[CollectionRootId], [a0].[Int], [a0].[Ints], [a0].[Name], [a0].[OptionalNestedAssociateId], [a0].[RequiredNestedAssociateId], [a0].[String], [n7].[Id], [n7].[CollectionAssociateId], [n7].[Int], [n7].[Ints], [n7].[Name], [n7].[String], [n1].[CollectionAssociateId], [n1].[Int], [n1].[Ints], [n1].[Name], [n1].[String], [n2].[CollectionAssociateId], [n2].[Int], [n2].[Ints], [n2].[Name], [n2].[String], [s0].[Id], [s0].[CollectionRootId], [s0].[Int], [s0].[Ints], [s0].[Name], [s0].[OptionalNestedAssociateId], [s0].[RequiredNestedAssociateId], [s0].[String], [s0].[Id0], [s0].[Id1], [s0].[Id2], [s0].[CollectionAssociateId], [s0].[Int0], [s0].[Ints0], [s0].[Name0], [s0].[String0], [s0].[CollectionAssociateId0], [s0].[Int1], [s0].[Ints1], [s0].[Name1], [s0].[String1], [s0].[CollectionAssociateId1], [s0].[Int2], [s0].[Ints2], [s0].[Name2], [s0].[String2], [n11].[Id], [n11].[CollectionAssociateId], [n11].[Int], [n11].[Ints], [n11].[Name], [n11].[String], [n12].[Id], [n12].[CollectionAssociateId], [n12].[Int], [n12].[Ints], [n12].[Name], [n12].[String] +SELECT [r].[Id], [r].[Name], [r].[OptionalAssociateId], [r].[RequiredAssociateId], [s].[Id], [s].[CollectionRootId], [s].[Int], [s].[Ints], [s].[Name], [s].[OptionalNestedAssociateId], [s].[RequiredNestedAssociateId], [s].[String], [s].[Id0], [s].[CollectionAssociateId], [s].[Int0], [s].[Ints0], [s].[Name0], [s].[String0], [s].[Id1], [s].[CollectionAssociateId0], [s].[Int1], [s].[Ints1], [s].[Name1], [s].[String1], [s].[Id2], [s].[CollectionAssociateId1], [s].[Int2], [s].[Ints2], [s].[Name2], [s].[String2], [a].[Id], [a].[CollectionRootId], [a].[Int], [a].[Ints], [a].[Name], [a].[OptionalNestedAssociateId], [a].[RequiredNestedAssociateId], [a].[String], [n6].[Id], [n6].[CollectionAssociateId], [n6].[Int], [n6].[Ints], [n6].[Name], [n6].[String], [n].[Id], [n].[CollectionAssociateId], [n].[Int], [n].[Ints], [n].[Name], [n].[String], [n0].[Id], [n0].[CollectionAssociateId], [n0].[Int], [n0].[Ints], [n0].[Name], [n0].[String], [a0].[Id], [a0].[CollectionRootId], [a0].[Int], [a0].[Ints], [a0].[Name], [a0].[OptionalNestedAssociateId], [a0].[RequiredNestedAssociateId], [a0].[String], [n7].[Id], [n7].[CollectionAssociateId], [n7].[Int], [n7].[Ints], [n7].[Name], [n7].[String], [n1].[Id], [n1].[CollectionAssociateId], [n1].[Int], [n1].[Ints], [n1].[Name], [n1].[String], [n2].[Id], [n2].[CollectionAssociateId], [n2].[Int], [n2].[Ints], [n2].[Name], [n2].[String], [s0].[Id], [s0].[CollectionRootId], [s0].[Int], [s0].[Ints], [s0].[Name], [s0].[OptionalNestedAssociateId], [s0].[RequiredNestedAssociateId], [s0].[String], [s0].[Id0], [s0].[CollectionAssociateId], [s0].[Int0], [s0].[Ints0], [s0].[Name0], [s0].[String0], [s0].[Id1], [s0].[CollectionAssociateId0], [s0].[Int1], [s0].[Ints1], [s0].[Name1], [s0].[String1], [s0].[Id2], [s0].[CollectionAssociateId1], [s0].[Int2], [s0].[Ints2], [s0].[Name2], [s0].[String2], [n11].[Id], [n11].[CollectionAssociateId], [n11].[Int], [n11].[Ints], [n11].[Name], [n11].[String], [n12].[Id], [n12].[CollectionAssociateId], [n12].[Int], [n12].[Ints], [n12].[Name], [n12].[String] FROM [RootEntity] AS [r] LEFT JOIN [AssociateType] AS [a] ON [r].[OptionalAssociateId] = [a].[Id] LEFT JOIN [NestedAssociateType] AS [n] ON [a].[OptionalNestedAssociateId] = [n].[Id] @@ -328,7 +328,7 @@ FROM [RootEntity] AS [r] LEFT JOIN [NestedAssociateType] AS [n1] ON [a0].[OptionalNestedAssociateId] = [n1].[Id] INNER JOIN [NestedAssociateType] AS [n2] ON [a0].[RequiredNestedAssociateId] = [n2].[Id] LEFT JOIN ( - SELECT [a1].[Id], [a1].[CollectionRootId], [a1].[Int], [a1].[Ints], [a1].[Name], [a1].[OptionalNestedAssociateId], [a1].[RequiredNestedAssociateId], [a1].[String], [n3].[Id] AS [Id0], [n4].[Id] AS [Id1], [n5].[Id] AS [Id2], [n5].[CollectionAssociateId], [n5].[Int] AS [Int0], [n5].[Ints] AS [Ints0], [n5].[Name] AS [Name0], [n5].[String] AS [String0], [n3].[CollectionAssociateId] AS [CollectionAssociateId0], [n3].[Int] AS [Int1], [n3].[Ints] AS [Ints1], [n3].[Name] AS [Name1], [n3].[String] AS [String1], [n4].[CollectionAssociateId] AS [CollectionAssociateId1], [n4].[Int] AS [Int2], [n4].[Ints] AS [Ints2], [n4].[Name] AS [Name2], [n4].[String] AS [String2] + SELECT [a1].[Id], [a1].[CollectionRootId], [a1].[Int], [a1].[Ints], [a1].[Name], [a1].[OptionalNestedAssociateId], [a1].[RequiredNestedAssociateId], [a1].[String], [n5].[Id] AS [Id0], [n5].[CollectionAssociateId], [n5].[Int] AS [Int0], [n5].[Ints] AS [Ints0], [n5].[Name] AS [Name0], [n5].[String] AS [String0], [n3].[Id] AS [Id1], [n3].[CollectionAssociateId] AS [CollectionAssociateId0], [n3].[Int] AS [Int1], [n3].[Ints] AS [Ints1], [n3].[Name] AS [Name1], [n3].[String] AS [String1], [n4].[Id] AS [Id2], [n4].[CollectionAssociateId] AS [CollectionAssociateId1], [n4].[Int] AS [Int2], [n4].[Ints] AS [Ints2], [n4].[Name] AS [Name2], [n4].[String] AS [String2] FROM [AssociateType] AS [a1] LEFT JOIN [NestedAssociateType] AS [n3] ON [a1].[OptionalNestedAssociateId] = [n3].[Id] INNER JOIN [NestedAssociateType] AS [n4] ON [a1].[RequiredNestedAssociateId] = [n4].[Id] @@ -337,7 +337,7 @@ FROM [AssociateType] AS [a1] LEFT JOIN [NestedAssociateType] AS [n6] ON [a].[Id] = [n6].[CollectionAssociateId] LEFT JOIN [NestedAssociateType] AS [n7] ON [a0].[Id] = [n7].[CollectionAssociateId] LEFT JOIN ( - SELECT [a2].[Id], [a2].[CollectionRootId], [a2].[Int], [a2].[Ints], [a2].[Name], [a2].[OptionalNestedAssociateId], [a2].[RequiredNestedAssociateId], [a2].[String], [n8].[Id] AS [Id0], [n9].[Id] AS [Id1], [n10].[Id] AS [Id2], [n10].[CollectionAssociateId], [n10].[Int] AS [Int0], [n10].[Ints] AS [Ints0], [n10].[Name] AS [Name0], [n10].[String] AS [String0], [n8].[CollectionAssociateId] AS [CollectionAssociateId0], [n8].[Int] AS [Int1], [n8].[Ints] AS [Ints1], [n8].[Name] AS [Name1], [n8].[String] AS [String1], [n9].[CollectionAssociateId] AS [CollectionAssociateId1], [n9].[Int] AS [Int2], [n9].[Ints] AS [Ints2], [n9].[Name] AS [Name2], [n9].[String] AS [String2] + SELECT [a2].[Id], [a2].[CollectionRootId], [a2].[Int], [a2].[Ints], [a2].[Name], [a2].[OptionalNestedAssociateId], [a2].[RequiredNestedAssociateId], [a2].[String], [n10].[Id] AS [Id0], [n10].[CollectionAssociateId], [n10].[Int] AS [Int0], [n10].[Ints] AS [Ints0], [n10].[Name] AS [Name0], [n10].[String] AS [String0], [n8].[Id] AS [Id1], [n8].[CollectionAssociateId] AS [CollectionAssociateId0], [n8].[Int] AS [Int1], [n8].[Ints] AS [Ints1], [n8].[Name] AS [Name1], [n8].[String] AS [String1], [n9].[Id] AS [Id2], [n9].[CollectionAssociateId] AS [CollectionAssociateId1], [n9].[Int] AS [Int2], [n9].[Ints] AS [Ints2], [n9].[Name] AS [Name2], [n9].[String] AS [String2] FROM [AssociateType] AS [a2] LEFT JOIN [NestedAssociateType] AS [n8] ON [a2].[OptionalNestedAssociateId] = [n8].[Id] INNER JOIN [NestedAssociateType] AS [n9] ON [a2].[RequiredNestedAssociateId] = [n9].[Id] @@ -345,7 +345,7 @@ FROM [AssociateType] AS [a2] ) AS [s0] ON [r].[Id] = [s0].[CollectionRootId] LEFT JOIN [NestedAssociateType] AS [n11] ON [a].[Id] = [n11].[CollectionAssociateId] LEFT JOIN [NestedAssociateType] AS [n12] ON [a0].[Id] = [n12].[CollectionAssociateId] -ORDER BY [r].[Id], [a].[Id], [n].[Id], [n0].[Id], [a0].[Id], [n1].[Id], [n2].[Id], [s].[Id], [s].[Id0], [s].[Id1], [s].[Id2], [n6].[Id], [n7].[Id], [s0].[Id], [s0].[Id0], [s0].[Id1], [s0].[Id2], [n11].[Id] +ORDER BY [r].[Id], [s].[Id], [s].[Id0], [n6].[Id], [n7].[Id], [s0].[Id], [s0].[Id0], [n11].[Id] """); } @@ -355,13 +355,13 @@ public override async Task Select_associate_and_target_to_index_based_binding_vi AssertSql( """ -SELECT [r].[Id], [a].[Id], [a].[CollectionRootId], [a].[Int], [a].[Ints], [a].[Name], [a].[OptionalNestedAssociateId], [a].[RequiredNestedAssociateId], [a].[String], [n].[Id], [n0].[Id], [n1].[Id], [n1].[CollectionAssociateId], [n1].[Int], [n1].[Ints], [n1].[Name], [n1].[String], [n].[CollectionAssociateId], [n].[Int], [n].[Ints], [n].[Name], [n].[String], [n0].[CollectionAssociateId], [n0].[Int], [n0].[Ints], [n0].[Name], [n0].[String] +SELECT [r].[Id], [a].[Id], [a].[CollectionRootId], [a].[Int], [a].[Ints], [a].[Name], [a].[OptionalNestedAssociateId], [a].[RequiredNestedAssociateId], [a].[String], [n1].[Id], [n1].[CollectionAssociateId], [n1].[Int], [n1].[Ints], [n1].[Name], [n1].[String], [n].[Id], [n].[CollectionAssociateId], [n].[Int], [n].[Ints], [n].[Name], [n].[String], [n0].[Id], [n0].[CollectionAssociateId], [n0].[Int], [n0].[Ints], [n0].[Name], [n0].[String] FROM [RootEntity] AS [r] INNER JOIN [AssociateType] AS [a] ON [r].[RequiredAssociateId] = [a].[Id] LEFT JOIN [NestedAssociateType] AS [n] ON [a].[OptionalNestedAssociateId] = [n].[Id] INNER JOIN [NestedAssociateType] AS [n0] ON [a].[RequiredNestedAssociateId] = [n0].[Id] LEFT JOIN [NestedAssociateType] AS [n1] ON [a].[Id] = [n1].[CollectionAssociateId] -ORDER BY [r].[Id], [a].[Id], [n].[Id], [n0].[Id] +ORDER BY [r].[Id] """); } @@ -375,7 +375,7 @@ public override async Task Select_subquery_FirstOrDefault_complex_collection(Que AssertSql( """ -SELECT [r].[Id], [r1].[Id], [s].[Id], [s].[CollectionRootId], [s].[Int], [s].[Ints], [s].[Name], [s].[OptionalNestedAssociateId], [s].[RequiredNestedAssociateId], [s].[String], [s].[Id0], [s].[Id1], [s].[Id2], [s].[CollectionAssociateId], [s].[Int0], [s].[Ints0], [s].[Name0], [s].[String0], [s].[CollectionAssociateId0], [s].[Int1], [s].[Ints1], [s].[Name1], [s].[String1], [s].[CollectionAssociateId1], [s].[Int2], [s].[Ints2], [s].[Name2], [s].[String2], [r1].[c] +SELECT [r].[Id], [s].[Id], [s].[CollectionRootId], [s].[Int], [s].[Ints], [s].[Name], [s].[OptionalNestedAssociateId], [s].[RequiredNestedAssociateId], [s].[String], [s].[Id0], [s].[CollectionAssociateId], [s].[Int0], [s].[Ints0], [s].[Name0], [s].[String0], [s].[Id1], [s].[CollectionAssociateId0], [s].[Int1], [s].[Ints1], [s].[Name1], [s].[String1], [s].[Id2], [s].[CollectionAssociateId1], [s].[Int2], [s].[Ints2], [s].[Name2], [s].[String2], [r1].[c] FROM [RootEntity] AS [r] OUTER APPLY ( SELECT TOP(1) 1 AS [c], [r0].[Id] @@ -383,13 +383,13 @@ FROM [RootEntity] AS [r0] ORDER BY [r0].[Id] ) AS [r1] LEFT JOIN ( - SELECT [a].[Id], [a].[CollectionRootId], [a].[Int], [a].[Ints], [a].[Name], [a].[OptionalNestedAssociateId], [a].[RequiredNestedAssociateId], [a].[String], [n].[Id] AS [Id0], [n0].[Id] AS [Id1], [n1].[Id] AS [Id2], [n1].[CollectionAssociateId], [n1].[Int] AS [Int0], [n1].[Ints] AS [Ints0], [n1].[Name] AS [Name0], [n1].[String] AS [String0], [n].[CollectionAssociateId] AS [CollectionAssociateId0], [n].[Int] AS [Int1], [n].[Ints] AS [Ints1], [n].[Name] AS [Name1], [n].[String] AS [String1], [n0].[CollectionAssociateId] AS [CollectionAssociateId1], [n0].[Int] AS [Int2], [n0].[Ints] AS [Ints2], [n0].[Name] AS [Name2], [n0].[String] AS [String2] + SELECT [a].[Id], [a].[CollectionRootId], [a].[Int], [a].[Ints], [a].[Name], [a].[OptionalNestedAssociateId], [a].[RequiredNestedAssociateId], [a].[String], [n1].[Id] AS [Id0], [n1].[CollectionAssociateId], [n1].[Int] AS [Int0], [n1].[Ints] AS [Ints0], [n1].[Name] AS [Name0], [n1].[String] AS [String0], [n].[Id] AS [Id1], [n].[CollectionAssociateId] AS [CollectionAssociateId0], [n].[Int] AS [Int1], [n].[Ints] AS [Ints1], [n].[Name] AS [Name1], [n].[String] AS [String1], [n0].[Id] AS [Id2], [n0].[CollectionAssociateId] AS [CollectionAssociateId1], [n0].[Int] AS [Int2], [n0].[Ints] AS [Ints2], [n0].[Name] AS [Name2], [n0].[String] AS [String2] FROM [AssociateType] AS [a] LEFT JOIN [NestedAssociateType] AS [n] ON [a].[OptionalNestedAssociateId] = [n].[Id] INNER JOIN [NestedAssociateType] AS [n0] ON [a].[RequiredNestedAssociateId] = [n0].[Id] LEFT JOIN [NestedAssociateType] AS [n1] ON [a].[Id] = [n1].[CollectionAssociateId] ) AS [s] ON [r1].[Id] = [s].[CollectionRootId] -ORDER BY [r].[Id], [r1].[Id], [s].[Id], [s].[Id0], [s].[Id1] +ORDER BY [r].[Id], [s].[Id] """); } diff --git a/test/EFCore.SqlServer.FunctionalTests/Query/Associations/Navigations/NavigationsSetOperationsSqlServerTest.cs b/test/EFCore.SqlServer.FunctionalTests/Query/Associations/Navigations/NavigationsSetOperationsSqlServerTest.cs index 3ea1f502fac..e93b56d973d 100644 --- a/test/EFCore.SqlServer.FunctionalTests/Query/Associations/Navigations/NavigationsSetOperationsSqlServerTest.cs +++ b/test/EFCore.SqlServer.FunctionalTests/Query/Associations/Navigations/NavigationsSetOperationsSqlServerTest.cs @@ -14,7 +14,7 @@ public override async Task Over_associate_collections() AssertSql( """ -SELECT [r].[Id], [r].[Name], [r].[OptionalAssociateId], [r].[RequiredAssociateId], [a1].[Id], [n].[Id], [n0].[Id], [a2].[Id], [n1].[Id], [n2].[Id], [s].[Id], [s].[CollectionRootId], [s].[Int], [s].[Ints], [s].[Name], [s].[OptionalNestedAssociateId], [s].[RequiredNestedAssociateId], [s].[String], [s].[Id0], [s].[Id1], [s].[Id2], [s].[CollectionAssociateId], [s].[Int0], [s].[Ints0], [s].[Name0], [s].[String0], [s].[CollectionAssociateId0], [s].[Int1], [s].[Ints1], [s].[Name1], [s].[String1], [s].[CollectionAssociateId1], [s].[Int2], [s].[Ints2], [s].[Name2], [s].[String2], [a1].[CollectionRootId], [a1].[Int], [a1].[Ints], [a1].[Name], [a1].[OptionalNestedAssociateId], [a1].[RequiredNestedAssociateId], [a1].[String], [n6].[Id], [n6].[CollectionAssociateId], [n6].[Int], [n6].[Ints], [n6].[Name], [n6].[String], [n].[CollectionAssociateId], [n].[Int], [n].[Ints], [n].[Name], [n].[String], [n0].[CollectionAssociateId], [n0].[Int], [n0].[Ints], [n0].[Name], [n0].[String], [a2].[CollectionRootId], [a2].[Int], [a2].[Ints], [a2].[Name], [a2].[OptionalNestedAssociateId], [a2].[RequiredNestedAssociateId], [a2].[String], [n7].[Id], [n7].[CollectionAssociateId], [n7].[Int], [n7].[Ints], [n7].[Name], [n7].[String], [n1].[CollectionAssociateId], [n1].[Int], [n1].[Ints], [n1].[Name], [n1].[String], [n2].[CollectionAssociateId], [n2].[Int], [n2].[Ints], [n2].[Name], [n2].[String] +SELECT [r].[Id], [r].[Name], [r].[OptionalAssociateId], [r].[RequiredAssociateId], [s].[Id], [s].[CollectionRootId], [s].[Int], [s].[Ints], [s].[Name], [s].[OptionalNestedAssociateId], [s].[RequiredNestedAssociateId], [s].[String], [s].[Id0], [s].[CollectionAssociateId], [s].[Int0], [s].[Ints0], [s].[Name0], [s].[String0], [s].[Id1], [s].[CollectionAssociateId0], [s].[Int1], [s].[Ints1], [s].[Name1], [s].[String1], [s].[Id2], [s].[CollectionAssociateId1], [s].[Int2], [s].[Ints2], [s].[Name2], [s].[String2], [a1].[Id], [a1].[CollectionRootId], [a1].[Int], [a1].[Ints], [a1].[Name], [a1].[OptionalNestedAssociateId], [a1].[RequiredNestedAssociateId], [a1].[String], [n6].[Id], [n6].[CollectionAssociateId], [n6].[Int], [n6].[Ints], [n6].[Name], [n6].[String], [n].[Id], [n].[CollectionAssociateId], [n].[Int], [n].[Ints], [n].[Name], [n].[String], [n0].[Id], [n0].[CollectionAssociateId], [n0].[Int], [n0].[Ints], [n0].[Name], [n0].[String], [a2].[Id], [a2].[CollectionRootId], [a2].[Int], [a2].[Ints], [a2].[Name], [a2].[OptionalNestedAssociateId], [a2].[RequiredNestedAssociateId], [a2].[String], [n7].[Id], [n7].[CollectionAssociateId], [n7].[Int], [n7].[Ints], [n7].[Name], [n7].[String], [n1].[Id], [n1].[CollectionAssociateId], [n1].[Int], [n1].[Ints], [n1].[Name], [n1].[String], [n2].[Id], [n2].[CollectionAssociateId], [n2].[Int], [n2].[Ints], [n2].[Name], [n2].[String] FROM [RootEntity] AS [r] LEFT JOIN [AssociateType] AS [a1] ON [r].[OptionalAssociateId] = [a1].[Id] LEFT JOIN [NestedAssociateType] AS [n] ON [a1].[OptionalNestedAssociateId] = [n].[Id] @@ -23,7 +23,7 @@ FROM [RootEntity] AS [r] LEFT JOIN [NestedAssociateType] AS [n1] ON [a2].[OptionalNestedAssociateId] = [n1].[Id] INNER JOIN [NestedAssociateType] AS [n2] ON [a2].[RequiredNestedAssociateId] = [n2].[Id] LEFT JOIN ( - SELECT [a3].[Id], [a3].[CollectionRootId], [a3].[Int], [a3].[Ints], [a3].[Name], [a3].[OptionalNestedAssociateId], [a3].[RequiredNestedAssociateId], [a3].[String], [n3].[Id] AS [Id0], [n4].[Id] AS [Id1], [n5].[Id] AS [Id2], [n5].[CollectionAssociateId], [n5].[Int] AS [Int0], [n5].[Ints] AS [Ints0], [n5].[Name] AS [Name0], [n5].[String] AS [String0], [n3].[CollectionAssociateId] AS [CollectionAssociateId0], [n3].[Int] AS [Int1], [n3].[Ints] AS [Ints1], [n3].[Name] AS [Name1], [n3].[String] AS [String1], [n4].[CollectionAssociateId] AS [CollectionAssociateId1], [n4].[Int] AS [Int2], [n4].[Ints] AS [Ints2], [n4].[Name] AS [Name2], [n4].[String] AS [String2] + SELECT [a3].[Id], [a3].[CollectionRootId], [a3].[Int], [a3].[Ints], [a3].[Name], [a3].[OptionalNestedAssociateId], [a3].[RequiredNestedAssociateId], [a3].[String], [n5].[Id] AS [Id0], [n5].[CollectionAssociateId], [n5].[Int] AS [Int0], [n5].[Ints] AS [Ints0], [n5].[Name] AS [Name0], [n5].[String] AS [String0], [n3].[Id] AS [Id1], [n3].[CollectionAssociateId] AS [CollectionAssociateId0], [n3].[Int] AS [Int1], [n3].[Ints] AS [Ints1], [n3].[Name] AS [Name1], [n3].[String] AS [String1], [n4].[Id] AS [Id2], [n4].[CollectionAssociateId] AS [CollectionAssociateId1], [n4].[Int] AS [Int2], [n4].[Ints] AS [Ints2], [n4].[Name] AS [Name2], [n4].[String] AS [String2] FROM [AssociateType] AS [a3] LEFT JOIN [NestedAssociateType] AS [n3] ON [a3].[OptionalNestedAssociateId] = [n3].[Id] INNER JOIN [NestedAssociateType] AS [n4] ON [a3].[RequiredNestedAssociateId] = [n4].[Id] @@ -42,7 +42,7 @@ SELECT 1 AS empty FROM [AssociateType] AS [a0] WHERE [r].[Id] = [a0].[CollectionRootId] AND [a0].[String] = N'foo' ) AS [u]) = 4 -ORDER BY [r].[Id], [a1].[Id], [n].[Id], [n0].[Id], [a2].[Id], [n1].[Id], [n2].[Id], [s].[Id], [s].[Id0], [s].[Id1], [s].[Id2], [n6].[Id] +ORDER BY [r].[Id], [s].[Id], [s].[Id0], [n6].[Id] """); } @@ -85,7 +85,7 @@ public override async Task Over_nested_associate_collection() AssertSql( """ -SELECT [r].[Id], [r].[Name], [r].[OptionalAssociateId], [r].[RequiredAssociateId], [a].[Id], [a0].[Id], [n1].[Id], [n2].[Id], [n3].[Id], [n4].[Id], [s].[Id], [s].[CollectionRootId], [s].[Int], [s].[Ints], [s].[Name], [s].[OptionalNestedAssociateId], [s].[RequiredNestedAssociateId], [s].[String], [s].[Id0], [s].[Id1], [s].[Id2], [s].[CollectionAssociateId], [s].[Int0], [s].[Ints0], [s].[Name0], [s].[String0], [s].[CollectionAssociateId0], [s].[Int1], [s].[Ints1], [s].[Name1], [s].[String1], [s].[CollectionAssociateId1], [s].[Int2], [s].[Ints2], [s].[Name2], [s].[String2], [a0].[CollectionRootId], [a0].[Int], [a0].[Ints], [a0].[Name], [a0].[OptionalNestedAssociateId], [a0].[RequiredNestedAssociateId], [a0].[String], [n8].[Id], [n8].[CollectionAssociateId], [n8].[Int], [n8].[Ints], [n8].[Name], [n8].[String], [n1].[CollectionAssociateId], [n1].[Int], [n1].[Ints], [n1].[Name], [n1].[String], [n2].[CollectionAssociateId], [n2].[Int], [n2].[Ints], [n2].[Name], [n2].[String], [a].[CollectionRootId], [a].[Int], [a].[Ints], [a].[Name], [a].[OptionalNestedAssociateId], [a].[RequiredNestedAssociateId], [a].[String], [n9].[Id], [n9].[CollectionAssociateId], [n9].[Int], [n9].[Ints], [n9].[Name], [n9].[String], [n3].[CollectionAssociateId], [n3].[Int], [n3].[Ints], [n3].[Name], [n3].[String], [n4].[CollectionAssociateId], [n4].[Int], [n4].[Ints], [n4].[Name], [n4].[String] +SELECT [r].[Id], [r].[Name], [r].[OptionalAssociateId], [r].[RequiredAssociateId], [s].[Id], [s].[CollectionRootId], [s].[Int], [s].[Ints], [s].[Name], [s].[OptionalNestedAssociateId], [s].[RequiredNestedAssociateId], [s].[String], [s].[Id0], [s].[CollectionAssociateId], [s].[Int0], [s].[Ints0], [s].[Name0], [s].[String0], [s].[Id1], [s].[CollectionAssociateId0], [s].[Int1], [s].[Ints1], [s].[Name1], [s].[String1], [s].[Id2], [s].[CollectionAssociateId1], [s].[Int2], [s].[Ints2], [s].[Name2], [s].[String2], [a0].[Id], [a0].[CollectionRootId], [a0].[Int], [a0].[Ints], [a0].[Name], [a0].[OptionalNestedAssociateId], [a0].[RequiredNestedAssociateId], [a0].[String], [n8].[Id], [n8].[CollectionAssociateId], [n8].[Int], [n8].[Ints], [n8].[Name], [n8].[String], [n1].[Id], [n1].[CollectionAssociateId], [n1].[Int], [n1].[Ints], [n1].[Name], [n1].[String], [n2].[Id], [n2].[CollectionAssociateId], [n2].[Int], [n2].[Ints], [n2].[Name], [n2].[String], [a].[Id], [a].[CollectionRootId], [a].[Int], [a].[Ints], [a].[Name], [a].[OptionalNestedAssociateId], [a].[RequiredNestedAssociateId], [a].[String], [n9].[Id], [n9].[CollectionAssociateId], [n9].[Int], [n9].[Ints], [n9].[Name], [n9].[String], [n3].[Id], [n3].[CollectionAssociateId], [n3].[Int], [n3].[Ints], [n3].[Name], [n3].[String], [n4].[Id], [n4].[CollectionAssociateId], [n4].[Int], [n4].[Ints], [n4].[Name], [n4].[String] FROM [RootEntity] AS [r] INNER JOIN [AssociateType] AS [a] ON [r].[RequiredAssociateId] = [a].[Id] LEFT JOIN [AssociateType] AS [a0] ON [r].[OptionalAssociateId] = [a0].[Id] @@ -94,7 +94,7 @@ FROM [RootEntity] AS [r] LEFT JOIN [NestedAssociateType] AS [n3] ON [a].[OptionalNestedAssociateId] = [n3].[Id] INNER JOIN [NestedAssociateType] AS [n4] ON [a].[RequiredNestedAssociateId] = [n4].[Id] LEFT JOIN ( - SELECT [a1].[Id], [a1].[CollectionRootId], [a1].[Int], [a1].[Ints], [a1].[Name], [a1].[OptionalNestedAssociateId], [a1].[RequiredNestedAssociateId], [a1].[String], [n5].[Id] AS [Id0], [n6].[Id] AS [Id1], [n7].[Id] AS [Id2], [n7].[CollectionAssociateId], [n7].[Int] AS [Int0], [n7].[Ints] AS [Ints0], [n7].[Name] AS [Name0], [n7].[String] AS [String0], [n5].[CollectionAssociateId] AS [CollectionAssociateId0], [n5].[Int] AS [Int1], [n5].[Ints] AS [Ints1], [n5].[Name] AS [Name1], [n5].[String] AS [String1], [n6].[CollectionAssociateId] AS [CollectionAssociateId1], [n6].[Int] AS [Int2], [n6].[Ints] AS [Ints2], [n6].[Name] AS [Name2], [n6].[String] AS [String2] + SELECT [a1].[Id], [a1].[CollectionRootId], [a1].[Int], [a1].[Ints], [a1].[Name], [a1].[OptionalNestedAssociateId], [a1].[RequiredNestedAssociateId], [a1].[String], [n7].[Id] AS [Id0], [n7].[CollectionAssociateId], [n7].[Int] AS [Int0], [n7].[Ints] AS [Ints0], [n7].[Name] AS [Name0], [n7].[String] AS [String0], [n5].[Id] AS [Id1], [n5].[CollectionAssociateId] AS [CollectionAssociateId0], [n5].[Int] AS [Int1], [n5].[Ints] AS [Ints1], [n5].[Name] AS [Name1], [n5].[String] AS [String1], [n6].[Id] AS [Id2], [n6].[CollectionAssociateId] AS [CollectionAssociateId1], [n6].[Int] AS [Int2], [n6].[Ints] AS [Ints2], [n6].[Name] AS [Name2], [n6].[String] AS [String2] FROM [AssociateType] AS [a1] LEFT JOIN [NestedAssociateType] AS [n5] ON [a1].[OptionalNestedAssociateId] = [n5].[Id] INNER JOIN [NestedAssociateType] AS [n6] ON [a1].[RequiredNestedAssociateId] = [n6].[Id] @@ -113,7 +113,7 @@ SELECT 1 AS empty FROM [NestedAssociateType] AS [n0] WHERE [a].[Id] = [n0].[CollectionAssociateId] AND [n0].[String] = N'foo' ) AS [u]) = 4 -ORDER BY [r].[Id], [a].[Id], [a0].[Id], [n1].[Id], [n2].[Id], [n3].[Id], [n4].[Id], [s].[Id], [s].[Id0], [s].[Id1], [s].[Id2], [n8].[Id] +ORDER BY [r].[Id], [s].[Id], [s].[Id0], [n8].[Id] """); } @@ -123,7 +123,7 @@ public override async Task Over_different_collection_properties() AssertSql( """ -SELECT [r].[Id], [r].[Name], [r].[OptionalAssociateId], [r].[RequiredAssociateId], [a].[Id], [a0].[Id], [n1].[Id], [n2].[Id], [n3].[Id], [n4].[Id], [s].[Id], [s].[CollectionRootId], [s].[Int], [s].[Ints], [s].[Name], [s].[OptionalNestedAssociateId], [s].[RequiredNestedAssociateId], [s].[String], [s].[Id0], [s].[Id1], [s].[Id2], [s].[CollectionAssociateId], [s].[Int0], [s].[Ints0], [s].[Name0], [s].[String0], [s].[CollectionAssociateId0], [s].[Int1], [s].[Ints1], [s].[Name1], [s].[String1], [s].[CollectionAssociateId1], [s].[Int2], [s].[Ints2], [s].[Name2], [s].[String2], [a0].[CollectionRootId], [a0].[Int], [a0].[Ints], [a0].[Name], [a0].[OptionalNestedAssociateId], [a0].[RequiredNestedAssociateId], [a0].[String], [n8].[Id], [n8].[CollectionAssociateId], [n8].[Int], [n8].[Ints], [n8].[Name], [n8].[String], [n1].[CollectionAssociateId], [n1].[Int], [n1].[Ints], [n1].[Name], [n1].[String], [n2].[CollectionAssociateId], [n2].[Int], [n2].[Ints], [n2].[Name], [n2].[String], [a].[CollectionRootId], [a].[Int], [a].[Ints], [a].[Name], [a].[OptionalNestedAssociateId], [a].[RequiredNestedAssociateId], [a].[String], [n9].[Id], [n9].[CollectionAssociateId], [n9].[Int], [n9].[Ints], [n9].[Name], [n9].[String], [n3].[CollectionAssociateId], [n3].[Int], [n3].[Ints], [n3].[Name], [n3].[String], [n4].[CollectionAssociateId], [n4].[Int], [n4].[Ints], [n4].[Name], [n4].[String] +SELECT [r].[Id], [r].[Name], [r].[OptionalAssociateId], [r].[RequiredAssociateId], [s].[Id], [s].[CollectionRootId], [s].[Int], [s].[Ints], [s].[Name], [s].[OptionalNestedAssociateId], [s].[RequiredNestedAssociateId], [s].[String], [s].[Id0], [s].[CollectionAssociateId], [s].[Int0], [s].[Ints0], [s].[Name0], [s].[String0], [s].[Id1], [s].[CollectionAssociateId0], [s].[Int1], [s].[Ints1], [s].[Name1], [s].[String1], [s].[Id2], [s].[CollectionAssociateId1], [s].[Int2], [s].[Ints2], [s].[Name2], [s].[String2], [a0].[Id], [a0].[CollectionRootId], [a0].[Int], [a0].[Ints], [a0].[Name], [a0].[OptionalNestedAssociateId], [a0].[RequiredNestedAssociateId], [a0].[String], [n8].[Id], [n8].[CollectionAssociateId], [n8].[Int], [n8].[Ints], [n8].[Name], [n8].[String], [n1].[Id], [n1].[CollectionAssociateId], [n1].[Int], [n1].[Ints], [n1].[Name], [n1].[String], [n2].[Id], [n2].[CollectionAssociateId], [n2].[Int], [n2].[Ints], [n2].[Name], [n2].[String], [a].[Id], [a].[CollectionRootId], [a].[Int], [a].[Ints], [a].[Name], [a].[OptionalNestedAssociateId], [a].[RequiredNestedAssociateId], [a].[String], [n9].[Id], [n9].[CollectionAssociateId], [n9].[Int], [n9].[Ints], [n9].[Name], [n9].[String], [n3].[Id], [n3].[CollectionAssociateId], [n3].[Int], [n3].[Ints], [n3].[Name], [n3].[String], [n4].[Id], [n4].[CollectionAssociateId], [n4].[Int], [n4].[Ints], [n4].[Name], [n4].[String] FROM [RootEntity] AS [r] INNER JOIN [AssociateType] AS [a] ON [r].[RequiredAssociateId] = [a].[Id] LEFT JOIN [AssociateType] AS [a0] ON [r].[OptionalAssociateId] = [a0].[Id] @@ -132,7 +132,7 @@ FROM [RootEntity] AS [r] LEFT JOIN [NestedAssociateType] AS [n3] ON [a].[OptionalNestedAssociateId] = [n3].[Id] INNER JOIN [NestedAssociateType] AS [n4] ON [a].[RequiredNestedAssociateId] = [n4].[Id] LEFT JOIN ( - SELECT [a1].[Id], [a1].[CollectionRootId], [a1].[Int], [a1].[Ints], [a1].[Name], [a1].[OptionalNestedAssociateId], [a1].[RequiredNestedAssociateId], [a1].[String], [n5].[Id] AS [Id0], [n6].[Id] AS [Id1], [n7].[Id] AS [Id2], [n7].[CollectionAssociateId], [n7].[Int] AS [Int0], [n7].[Ints] AS [Ints0], [n7].[Name] AS [Name0], [n7].[String] AS [String0], [n5].[CollectionAssociateId] AS [CollectionAssociateId0], [n5].[Int] AS [Int1], [n5].[Ints] AS [Ints1], [n5].[Name] AS [Name1], [n5].[String] AS [String1], [n6].[CollectionAssociateId] AS [CollectionAssociateId1], [n6].[Int] AS [Int2], [n6].[Ints] AS [Ints2], [n6].[Name] AS [Name2], [n6].[String] AS [String2] + SELECT [a1].[Id], [a1].[CollectionRootId], [a1].[Int], [a1].[Ints], [a1].[Name], [a1].[OptionalNestedAssociateId], [a1].[RequiredNestedAssociateId], [a1].[String], [n7].[Id] AS [Id0], [n7].[CollectionAssociateId], [n7].[Int] AS [Int0], [n7].[Ints] AS [Ints0], [n7].[Name] AS [Name0], [n7].[String] AS [String0], [n5].[Id] AS [Id1], [n5].[CollectionAssociateId] AS [CollectionAssociateId0], [n5].[Int] AS [Int1], [n5].[Ints] AS [Ints1], [n5].[Name] AS [Name1], [n5].[String] AS [String1], [n6].[Id] AS [Id2], [n6].[CollectionAssociateId] AS [CollectionAssociateId1], [n6].[Int] AS [Int2], [n6].[Ints] AS [Ints2], [n6].[Name] AS [Name2], [n6].[String] AS [String2] FROM [AssociateType] AS [a1] LEFT JOIN [NestedAssociateType] AS [n5] ON [a1].[OptionalNestedAssociateId] = [n5].[Id] INNER JOIN [NestedAssociateType] AS [n6] ON [a1].[RequiredNestedAssociateId] = [n6].[Id] @@ -151,7 +151,7 @@ SELECT 1 AS empty FROM [NestedAssociateType] AS [n0] WHERE [a0].[Id] IS NOT NULL AND [a0].[Id] = [n0].[CollectionAssociateId] ) AS [u]) = 4 -ORDER BY [r].[Id], [a].[Id], [a0].[Id], [n1].[Id], [n2].[Id], [n3].[Id], [n4].[Id], [s].[Id], [s].[Id0], [s].[Id1], [s].[Id2], [n8].[Id] +ORDER BY [r].[Id], [s].[Id], [s].[Id0], [n8].[Id] """); } diff --git a/test/EFCore.SqlServer.FunctionalTests/Query/Associations/Navigations/NavigationsStructuralEqualitySqlServerTest.cs b/test/EFCore.SqlServer.FunctionalTests/Query/Associations/Navigations/NavigationsStructuralEqualitySqlServerTest.cs index 17eff5f0b9d..2d4e5a054aa 100644 --- a/test/EFCore.SqlServer.FunctionalTests/Query/Associations/Navigations/NavigationsStructuralEqualitySqlServerTest.cs +++ b/test/EFCore.SqlServer.FunctionalTests/Query/Associations/Navigations/NavigationsStructuralEqualitySqlServerTest.cs @@ -14,7 +14,7 @@ public override async Task Two_associates() AssertSql( """ -SELECT [r].[Id], [r].[Name], [r].[OptionalAssociateId], [r].[RequiredAssociateId], [a].[Id], [a0].[Id], [n].[Id], [n0].[Id], [n1].[Id], [n2].[Id], [s].[Id], [s].[CollectionRootId], [s].[Int], [s].[Ints], [s].[Name], [s].[OptionalNestedAssociateId], [s].[RequiredNestedAssociateId], [s].[String], [s].[Id0], [s].[Id1], [s].[Id2], [s].[CollectionAssociateId], [s].[Int0], [s].[Ints0], [s].[Name0], [s].[String0], [s].[CollectionAssociateId0], [s].[Int1], [s].[Ints1], [s].[Name1], [s].[String1], [s].[CollectionAssociateId1], [s].[Int2], [s].[Ints2], [s].[Name2], [s].[String2], [a0].[CollectionRootId], [a0].[Int], [a0].[Ints], [a0].[Name], [a0].[OptionalNestedAssociateId], [a0].[RequiredNestedAssociateId], [a0].[String], [n6].[Id], [n6].[CollectionAssociateId], [n6].[Int], [n6].[Ints], [n6].[Name], [n6].[String], [n].[CollectionAssociateId], [n].[Int], [n].[Ints], [n].[Name], [n].[String], [n0].[CollectionAssociateId], [n0].[Int], [n0].[Ints], [n0].[Name], [n0].[String], [a].[CollectionRootId], [a].[Int], [a].[Ints], [a].[Name], [a].[OptionalNestedAssociateId], [a].[RequiredNestedAssociateId], [a].[String], [n7].[Id], [n7].[CollectionAssociateId], [n7].[Int], [n7].[Ints], [n7].[Name], [n7].[String], [n1].[CollectionAssociateId], [n1].[Int], [n1].[Ints], [n1].[Name], [n1].[String], [n2].[CollectionAssociateId], [n2].[Int], [n2].[Ints], [n2].[Name], [n2].[String] +SELECT [r].[Id], [r].[Name], [r].[OptionalAssociateId], [r].[RequiredAssociateId], [s].[Id], [s].[CollectionRootId], [s].[Int], [s].[Ints], [s].[Name], [s].[OptionalNestedAssociateId], [s].[RequiredNestedAssociateId], [s].[String], [s].[Id0], [s].[CollectionAssociateId], [s].[Int0], [s].[Ints0], [s].[Name0], [s].[String0], [s].[Id1], [s].[CollectionAssociateId0], [s].[Int1], [s].[Ints1], [s].[Name1], [s].[String1], [s].[Id2], [s].[CollectionAssociateId1], [s].[Int2], [s].[Ints2], [s].[Name2], [s].[String2], [a0].[Id], [a0].[CollectionRootId], [a0].[Int], [a0].[Ints], [a0].[Name], [a0].[OptionalNestedAssociateId], [a0].[RequiredNestedAssociateId], [a0].[String], [n6].[Id], [n6].[CollectionAssociateId], [n6].[Int], [n6].[Ints], [n6].[Name], [n6].[String], [n].[Id], [n].[CollectionAssociateId], [n].[Int], [n].[Ints], [n].[Name], [n].[String], [n0].[Id], [n0].[CollectionAssociateId], [n0].[Int], [n0].[Ints], [n0].[Name], [n0].[String], [a].[Id], [a].[CollectionRootId], [a].[Int], [a].[Ints], [a].[Name], [a].[OptionalNestedAssociateId], [a].[RequiredNestedAssociateId], [a].[String], [n7].[Id], [n7].[CollectionAssociateId], [n7].[Int], [n7].[Ints], [n7].[Name], [n7].[String], [n1].[Id], [n1].[CollectionAssociateId], [n1].[Int], [n1].[Ints], [n1].[Name], [n1].[String], [n2].[Id], [n2].[CollectionAssociateId], [n2].[Int], [n2].[Ints], [n2].[Name], [n2].[String] FROM [RootEntity] AS [r] INNER JOIN [AssociateType] AS [a] ON [r].[RequiredAssociateId] = [a].[Id] LEFT JOIN [AssociateType] AS [a0] ON [r].[OptionalAssociateId] = [a0].[Id] @@ -23,7 +23,7 @@ FROM [RootEntity] AS [r] LEFT JOIN [NestedAssociateType] AS [n1] ON [a].[OptionalNestedAssociateId] = [n1].[Id] INNER JOIN [NestedAssociateType] AS [n2] ON [a].[RequiredNestedAssociateId] = [n2].[Id] LEFT JOIN ( - SELECT [a1].[Id], [a1].[CollectionRootId], [a1].[Int], [a1].[Ints], [a1].[Name], [a1].[OptionalNestedAssociateId], [a1].[RequiredNestedAssociateId], [a1].[String], [n3].[Id] AS [Id0], [n4].[Id] AS [Id1], [n5].[Id] AS [Id2], [n5].[CollectionAssociateId], [n5].[Int] AS [Int0], [n5].[Ints] AS [Ints0], [n5].[Name] AS [Name0], [n5].[String] AS [String0], [n3].[CollectionAssociateId] AS [CollectionAssociateId0], [n3].[Int] AS [Int1], [n3].[Ints] AS [Ints1], [n3].[Name] AS [Name1], [n3].[String] AS [String1], [n4].[CollectionAssociateId] AS [CollectionAssociateId1], [n4].[Int] AS [Int2], [n4].[Ints] AS [Ints2], [n4].[Name] AS [Name2], [n4].[String] AS [String2] + SELECT [a1].[Id], [a1].[CollectionRootId], [a1].[Int], [a1].[Ints], [a1].[Name], [a1].[OptionalNestedAssociateId], [a1].[RequiredNestedAssociateId], [a1].[String], [n5].[Id] AS [Id0], [n5].[CollectionAssociateId], [n5].[Int] AS [Int0], [n5].[Ints] AS [Ints0], [n5].[Name] AS [Name0], [n5].[String] AS [String0], [n3].[Id] AS [Id1], [n3].[CollectionAssociateId] AS [CollectionAssociateId0], [n3].[Int] AS [Int1], [n3].[Ints] AS [Ints1], [n3].[Name] AS [Name1], [n3].[String] AS [String1], [n4].[Id] AS [Id2], [n4].[CollectionAssociateId] AS [CollectionAssociateId1], [n4].[Int] AS [Int2], [n4].[Ints] AS [Ints2], [n4].[Name] AS [Name2], [n4].[String] AS [String2] FROM [AssociateType] AS [a1] LEFT JOIN [NestedAssociateType] AS [n3] ON [a1].[OptionalNestedAssociateId] = [n3].[Id] INNER JOIN [NestedAssociateType] AS [n4] ON [a1].[RequiredNestedAssociateId] = [n4].[Id] @@ -32,7 +32,7 @@ FROM [AssociateType] AS [a1] LEFT JOIN [NestedAssociateType] AS [n6] ON [a0].[Id] = [n6].[CollectionAssociateId] LEFT JOIN [NestedAssociateType] AS [n7] ON [a].[Id] = [n7].[CollectionAssociateId] WHERE [a].[Id] = [a0].[Id] -ORDER BY [r].[Id], [a].[Id], [a0].[Id], [n].[Id], [n0].[Id], [n1].[Id], [n2].[Id], [s].[Id], [s].[Id0], [s].[Id1], [s].[Id2], [n6].[Id] +ORDER BY [r].[Id], [s].[Id], [s].[Id0], [n6].[Id] """); } @@ -42,7 +42,7 @@ public override async Task Two_nested_associates() AssertSql( """ -SELECT [r].[Id], [r].[Name], [r].[OptionalAssociateId], [r].[RequiredAssociateId], [a].[Id], [n].[Id], [a0].[Id], [n0].[Id], [n1].[Id], [n2].[Id], [s].[Id], [s].[CollectionRootId], [s].[Int], [s].[Ints], [s].[Name], [s].[OptionalNestedAssociateId], [s].[RequiredNestedAssociateId], [s].[String], [s].[Id0], [s].[Id1], [s].[Id2], [s].[CollectionAssociateId], [s].[Int0], [s].[Ints0], [s].[Name0], [s].[String0], [s].[CollectionAssociateId0], [s].[Int1], [s].[Ints1], [s].[Name1], [s].[String1], [s].[CollectionAssociateId1], [s].[Int2], [s].[Ints2], [s].[Name2], [s].[String2], [a0].[CollectionRootId], [a0].[Int], [a0].[Ints], [a0].[Name], [a0].[OptionalNestedAssociateId], [a0].[RequiredNestedAssociateId], [a0].[String], [n6].[Id], [n6].[CollectionAssociateId], [n6].[Int], [n6].[Ints], [n6].[Name], [n6].[String], [n1].[CollectionAssociateId], [n1].[Int], [n1].[Ints], [n1].[Name], [n1].[String], [n0].[CollectionAssociateId], [n0].[Int], [n0].[Ints], [n0].[Name], [n0].[String], [a].[CollectionRootId], [a].[Int], [a].[Ints], [a].[Name], [a].[OptionalNestedAssociateId], [a].[RequiredNestedAssociateId], [a].[String], [n7].[Id], [n7].[CollectionAssociateId], [n7].[Int], [n7].[Ints], [n7].[Name], [n7].[String], [n2].[CollectionAssociateId], [n2].[Int], [n2].[Ints], [n2].[Name], [n2].[String], [n].[CollectionAssociateId], [n].[Int], [n].[Ints], [n].[Name], [n].[String] +SELECT [r].[Id], [r].[Name], [r].[OptionalAssociateId], [r].[RequiredAssociateId], [s].[Id], [s].[CollectionRootId], [s].[Int], [s].[Ints], [s].[Name], [s].[OptionalNestedAssociateId], [s].[RequiredNestedAssociateId], [s].[String], [s].[Id0], [s].[CollectionAssociateId], [s].[Int0], [s].[Ints0], [s].[Name0], [s].[String0], [s].[Id1], [s].[CollectionAssociateId0], [s].[Int1], [s].[Ints1], [s].[Name1], [s].[String1], [s].[Id2], [s].[CollectionAssociateId1], [s].[Int2], [s].[Ints2], [s].[Name2], [s].[String2], [a0].[Id], [a0].[CollectionRootId], [a0].[Int], [a0].[Ints], [a0].[Name], [a0].[OptionalNestedAssociateId], [a0].[RequiredNestedAssociateId], [a0].[String], [n6].[Id], [n6].[CollectionAssociateId], [n6].[Int], [n6].[Ints], [n6].[Name], [n6].[String], [n1].[Id], [n1].[CollectionAssociateId], [n1].[Int], [n1].[Ints], [n1].[Name], [n1].[String], [n0].[Id], [n0].[CollectionAssociateId], [n0].[Int], [n0].[Ints], [n0].[Name], [n0].[String], [a].[Id], [a].[CollectionRootId], [a].[Int], [a].[Ints], [a].[Name], [a].[OptionalNestedAssociateId], [a].[RequiredNestedAssociateId], [a].[String], [n7].[Id], [n7].[CollectionAssociateId], [n7].[Int], [n7].[Ints], [n7].[Name], [n7].[String], [n2].[Id], [n2].[CollectionAssociateId], [n2].[Int], [n2].[Ints], [n2].[Name], [n2].[String], [n].[Id], [n].[CollectionAssociateId], [n].[Int], [n].[Ints], [n].[Name], [n].[String] FROM [RootEntity] AS [r] INNER JOIN [AssociateType] AS [a] ON [r].[RequiredAssociateId] = [a].[Id] INNER JOIN [NestedAssociateType] AS [n] ON [a].[RequiredNestedAssociateId] = [n].[Id] @@ -51,7 +51,7 @@ FROM [RootEntity] AS [r] LEFT JOIN [NestedAssociateType] AS [n1] ON [a0].[OptionalNestedAssociateId] = [n1].[Id] LEFT JOIN [NestedAssociateType] AS [n2] ON [a].[OptionalNestedAssociateId] = [n2].[Id] LEFT JOIN ( - SELECT [a1].[Id], [a1].[CollectionRootId], [a1].[Int], [a1].[Ints], [a1].[Name], [a1].[OptionalNestedAssociateId], [a1].[RequiredNestedAssociateId], [a1].[String], [n3].[Id] AS [Id0], [n4].[Id] AS [Id1], [n5].[Id] AS [Id2], [n5].[CollectionAssociateId], [n5].[Int] AS [Int0], [n5].[Ints] AS [Ints0], [n5].[Name] AS [Name0], [n5].[String] AS [String0], [n3].[CollectionAssociateId] AS [CollectionAssociateId0], [n3].[Int] AS [Int1], [n3].[Ints] AS [Ints1], [n3].[Name] AS [Name1], [n3].[String] AS [String1], [n4].[CollectionAssociateId] AS [CollectionAssociateId1], [n4].[Int] AS [Int2], [n4].[Ints] AS [Ints2], [n4].[Name] AS [Name2], [n4].[String] AS [String2] + SELECT [a1].[Id], [a1].[CollectionRootId], [a1].[Int], [a1].[Ints], [a1].[Name], [a1].[OptionalNestedAssociateId], [a1].[RequiredNestedAssociateId], [a1].[String], [n5].[Id] AS [Id0], [n5].[CollectionAssociateId], [n5].[Int] AS [Int0], [n5].[Ints] AS [Ints0], [n5].[Name] AS [Name0], [n5].[String] AS [String0], [n3].[Id] AS [Id1], [n3].[CollectionAssociateId] AS [CollectionAssociateId0], [n3].[Int] AS [Int1], [n3].[Ints] AS [Ints1], [n3].[Name] AS [Name1], [n3].[String] AS [String1], [n4].[Id] AS [Id2], [n4].[CollectionAssociateId] AS [CollectionAssociateId1], [n4].[Int] AS [Int2], [n4].[Ints] AS [Ints2], [n4].[Name] AS [Name2], [n4].[String] AS [String2] FROM [AssociateType] AS [a1] LEFT JOIN [NestedAssociateType] AS [n3] ON [a1].[OptionalNestedAssociateId] = [n3].[Id] INNER JOIN [NestedAssociateType] AS [n4] ON [a1].[RequiredNestedAssociateId] = [n4].[Id] @@ -60,7 +60,7 @@ FROM [AssociateType] AS [a1] LEFT JOIN [NestedAssociateType] AS [n6] ON [a0].[Id] = [n6].[CollectionAssociateId] LEFT JOIN [NestedAssociateType] AS [n7] ON [a].[Id] = [n7].[CollectionAssociateId] WHERE [n].[Id] = [n0].[Id] -ORDER BY [r].[Id], [a].[Id], [n].[Id], [a0].[Id], [n0].[Id], [n1].[Id], [n2].[Id], [s].[Id], [s].[Id0], [s].[Id1], [s].[Id2], [n6].[Id] +ORDER BY [r].[Id], [s].[Id], [s].[Id0], [n6].[Id] """); } @@ -70,7 +70,7 @@ public override async Task Not_equals() AssertSql( """ -SELECT [r].[Id], [r].[Name], [r].[OptionalAssociateId], [r].[RequiredAssociateId], [a].[Id], [a0].[Id], [n].[Id], [n0].[Id], [n1].[Id], [n2].[Id], [s].[Id], [s].[CollectionRootId], [s].[Int], [s].[Ints], [s].[Name], [s].[OptionalNestedAssociateId], [s].[RequiredNestedAssociateId], [s].[String], [s].[Id0], [s].[Id1], [s].[Id2], [s].[CollectionAssociateId], [s].[Int0], [s].[Ints0], [s].[Name0], [s].[String0], [s].[CollectionAssociateId0], [s].[Int1], [s].[Ints1], [s].[Name1], [s].[String1], [s].[CollectionAssociateId1], [s].[Int2], [s].[Ints2], [s].[Name2], [s].[String2], [a0].[CollectionRootId], [a0].[Int], [a0].[Ints], [a0].[Name], [a0].[OptionalNestedAssociateId], [a0].[RequiredNestedAssociateId], [a0].[String], [n6].[Id], [n6].[CollectionAssociateId], [n6].[Int], [n6].[Ints], [n6].[Name], [n6].[String], [n].[CollectionAssociateId], [n].[Int], [n].[Ints], [n].[Name], [n].[String], [n0].[CollectionAssociateId], [n0].[Int], [n0].[Ints], [n0].[Name], [n0].[String], [a].[CollectionRootId], [a].[Int], [a].[Ints], [a].[Name], [a].[OptionalNestedAssociateId], [a].[RequiredNestedAssociateId], [a].[String], [n7].[Id], [n7].[CollectionAssociateId], [n7].[Int], [n7].[Ints], [n7].[Name], [n7].[String], [n1].[CollectionAssociateId], [n1].[Int], [n1].[Ints], [n1].[Name], [n1].[String], [n2].[CollectionAssociateId], [n2].[Int], [n2].[Ints], [n2].[Name], [n2].[String] +SELECT [r].[Id], [r].[Name], [r].[OptionalAssociateId], [r].[RequiredAssociateId], [s].[Id], [s].[CollectionRootId], [s].[Int], [s].[Ints], [s].[Name], [s].[OptionalNestedAssociateId], [s].[RequiredNestedAssociateId], [s].[String], [s].[Id0], [s].[CollectionAssociateId], [s].[Int0], [s].[Ints0], [s].[Name0], [s].[String0], [s].[Id1], [s].[CollectionAssociateId0], [s].[Int1], [s].[Ints1], [s].[Name1], [s].[String1], [s].[Id2], [s].[CollectionAssociateId1], [s].[Int2], [s].[Ints2], [s].[Name2], [s].[String2], [a0].[Id], [a0].[CollectionRootId], [a0].[Int], [a0].[Ints], [a0].[Name], [a0].[OptionalNestedAssociateId], [a0].[RequiredNestedAssociateId], [a0].[String], [n6].[Id], [n6].[CollectionAssociateId], [n6].[Int], [n6].[Ints], [n6].[Name], [n6].[String], [n].[Id], [n].[CollectionAssociateId], [n].[Int], [n].[Ints], [n].[Name], [n].[String], [n0].[Id], [n0].[CollectionAssociateId], [n0].[Int], [n0].[Ints], [n0].[Name], [n0].[String], [a].[Id], [a].[CollectionRootId], [a].[Int], [a].[Ints], [a].[Name], [a].[OptionalNestedAssociateId], [a].[RequiredNestedAssociateId], [a].[String], [n7].[Id], [n7].[CollectionAssociateId], [n7].[Int], [n7].[Ints], [n7].[Name], [n7].[String], [n1].[Id], [n1].[CollectionAssociateId], [n1].[Int], [n1].[Ints], [n1].[Name], [n1].[String], [n2].[Id], [n2].[CollectionAssociateId], [n2].[Int], [n2].[Ints], [n2].[Name], [n2].[String] FROM [RootEntity] AS [r] INNER JOIN [AssociateType] AS [a] ON [r].[RequiredAssociateId] = [a].[Id] LEFT JOIN [AssociateType] AS [a0] ON [r].[OptionalAssociateId] = [a0].[Id] @@ -79,7 +79,7 @@ FROM [RootEntity] AS [r] LEFT JOIN [NestedAssociateType] AS [n1] ON [a].[OptionalNestedAssociateId] = [n1].[Id] INNER JOIN [NestedAssociateType] AS [n2] ON [a].[RequiredNestedAssociateId] = [n2].[Id] LEFT JOIN ( - SELECT [a1].[Id], [a1].[CollectionRootId], [a1].[Int], [a1].[Ints], [a1].[Name], [a1].[OptionalNestedAssociateId], [a1].[RequiredNestedAssociateId], [a1].[String], [n3].[Id] AS [Id0], [n4].[Id] AS [Id1], [n5].[Id] AS [Id2], [n5].[CollectionAssociateId], [n5].[Int] AS [Int0], [n5].[Ints] AS [Ints0], [n5].[Name] AS [Name0], [n5].[String] AS [String0], [n3].[CollectionAssociateId] AS [CollectionAssociateId0], [n3].[Int] AS [Int1], [n3].[Ints] AS [Ints1], [n3].[Name] AS [Name1], [n3].[String] AS [String1], [n4].[CollectionAssociateId] AS [CollectionAssociateId1], [n4].[Int] AS [Int2], [n4].[Ints] AS [Ints2], [n4].[Name] AS [Name2], [n4].[String] AS [String2] + SELECT [a1].[Id], [a1].[CollectionRootId], [a1].[Int], [a1].[Ints], [a1].[Name], [a1].[OptionalNestedAssociateId], [a1].[RequiredNestedAssociateId], [a1].[String], [n5].[Id] AS [Id0], [n5].[CollectionAssociateId], [n5].[Int] AS [Int0], [n5].[Ints] AS [Ints0], [n5].[Name] AS [Name0], [n5].[String] AS [String0], [n3].[Id] AS [Id1], [n3].[CollectionAssociateId] AS [CollectionAssociateId0], [n3].[Int] AS [Int1], [n3].[Ints] AS [Ints1], [n3].[Name] AS [Name1], [n3].[String] AS [String1], [n4].[Id] AS [Id2], [n4].[CollectionAssociateId] AS [CollectionAssociateId1], [n4].[Int] AS [Int2], [n4].[Ints] AS [Ints2], [n4].[Name] AS [Name2], [n4].[String] AS [String2] FROM [AssociateType] AS [a1] LEFT JOIN [NestedAssociateType] AS [n3] ON [a1].[OptionalNestedAssociateId] = [n3].[Id] INNER JOIN [NestedAssociateType] AS [n4] ON [a1].[RequiredNestedAssociateId] = [n4].[Id] @@ -88,7 +88,7 @@ FROM [AssociateType] AS [a1] LEFT JOIN [NestedAssociateType] AS [n6] ON [a0].[Id] = [n6].[CollectionAssociateId] LEFT JOIN [NestedAssociateType] AS [n7] ON [a].[Id] = [n7].[CollectionAssociateId] WHERE [a].[Id] <> [a0].[Id] OR [a0].[Id] IS NULL -ORDER BY [r].[Id], [a].[Id], [a0].[Id], [n].[Id], [n0].[Id], [n1].[Id], [n2].[Id], [s].[Id], [s].[Id0], [s].[Id1], [s].[Id2], [n6].[Id] +ORDER BY [r].[Id], [s].[Id], [s].[Id0], [n6].[Id] """); } @@ -98,7 +98,7 @@ public override async Task Associate_with_inline_null() AssertSql( """ -SELECT [r].[Id], [r].[Name], [r].[OptionalAssociateId], [r].[RequiredAssociateId], [a].[Id], [n].[Id], [n0].[Id], [a0].[Id], [n1].[Id], [n2].[Id], [s].[Id], [s].[CollectionRootId], [s].[Int], [s].[Ints], [s].[Name], [s].[OptionalNestedAssociateId], [s].[RequiredNestedAssociateId], [s].[String], [s].[Id0], [s].[Id1], [s].[Id2], [s].[CollectionAssociateId], [s].[Int0], [s].[Ints0], [s].[Name0], [s].[String0], [s].[CollectionAssociateId0], [s].[Int1], [s].[Ints1], [s].[Name1], [s].[String1], [s].[CollectionAssociateId1], [s].[Int2], [s].[Ints2], [s].[Name2], [s].[String2], [a].[CollectionRootId], [a].[Int], [a].[Ints], [a].[Name], [a].[OptionalNestedAssociateId], [a].[RequiredNestedAssociateId], [a].[String], [n6].[Id], [n6].[CollectionAssociateId], [n6].[Int], [n6].[Ints], [n6].[Name], [n6].[String], [n].[CollectionAssociateId], [n].[Int], [n].[Ints], [n].[Name], [n].[String], [n0].[CollectionAssociateId], [n0].[Int], [n0].[Ints], [n0].[Name], [n0].[String], [a0].[CollectionRootId], [a0].[Int], [a0].[Ints], [a0].[Name], [a0].[OptionalNestedAssociateId], [a0].[RequiredNestedAssociateId], [a0].[String], [n7].[Id], [n7].[CollectionAssociateId], [n7].[Int], [n7].[Ints], [n7].[Name], [n7].[String], [n1].[CollectionAssociateId], [n1].[Int], [n1].[Ints], [n1].[Name], [n1].[String], [n2].[CollectionAssociateId], [n2].[Int], [n2].[Ints], [n2].[Name], [n2].[String] +SELECT [r].[Id], [r].[Name], [r].[OptionalAssociateId], [r].[RequiredAssociateId], [s].[Id], [s].[CollectionRootId], [s].[Int], [s].[Ints], [s].[Name], [s].[OptionalNestedAssociateId], [s].[RequiredNestedAssociateId], [s].[String], [s].[Id0], [s].[CollectionAssociateId], [s].[Int0], [s].[Ints0], [s].[Name0], [s].[String0], [s].[Id1], [s].[CollectionAssociateId0], [s].[Int1], [s].[Ints1], [s].[Name1], [s].[String1], [s].[Id2], [s].[CollectionAssociateId1], [s].[Int2], [s].[Ints2], [s].[Name2], [s].[String2], [a].[Id], [a].[CollectionRootId], [a].[Int], [a].[Ints], [a].[Name], [a].[OptionalNestedAssociateId], [a].[RequiredNestedAssociateId], [a].[String], [n6].[Id], [n6].[CollectionAssociateId], [n6].[Int], [n6].[Ints], [n6].[Name], [n6].[String], [n].[Id], [n].[CollectionAssociateId], [n].[Int], [n].[Ints], [n].[Name], [n].[String], [n0].[Id], [n0].[CollectionAssociateId], [n0].[Int], [n0].[Ints], [n0].[Name], [n0].[String], [a0].[Id], [a0].[CollectionRootId], [a0].[Int], [a0].[Ints], [a0].[Name], [a0].[OptionalNestedAssociateId], [a0].[RequiredNestedAssociateId], [a0].[String], [n7].[Id], [n7].[CollectionAssociateId], [n7].[Int], [n7].[Ints], [n7].[Name], [n7].[String], [n1].[Id], [n1].[CollectionAssociateId], [n1].[Int], [n1].[Ints], [n1].[Name], [n1].[String], [n2].[Id], [n2].[CollectionAssociateId], [n2].[Int], [n2].[Ints], [n2].[Name], [n2].[String] FROM [RootEntity] AS [r] LEFT JOIN [AssociateType] AS [a] ON [r].[OptionalAssociateId] = [a].[Id] LEFT JOIN [NestedAssociateType] AS [n] ON [a].[OptionalNestedAssociateId] = [n].[Id] @@ -107,7 +107,7 @@ FROM [RootEntity] AS [r] LEFT JOIN [NestedAssociateType] AS [n1] ON [a0].[OptionalNestedAssociateId] = [n1].[Id] INNER JOIN [NestedAssociateType] AS [n2] ON [a0].[RequiredNestedAssociateId] = [n2].[Id] LEFT JOIN ( - SELECT [a1].[Id], [a1].[CollectionRootId], [a1].[Int], [a1].[Ints], [a1].[Name], [a1].[OptionalNestedAssociateId], [a1].[RequiredNestedAssociateId], [a1].[String], [n3].[Id] AS [Id0], [n4].[Id] AS [Id1], [n5].[Id] AS [Id2], [n5].[CollectionAssociateId], [n5].[Int] AS [Int0], [n5].[Ints] AS [Ints0], [n5].[Name] AS [Name0], [n5].[String] AS [String0], [n3].[CollectionAssociateId] AS [CollectionAssociateId0], [n3].[Int] AS [Int1], [n3].[Ints] AS [Ints1], [n3].[Name] AS [Name1], [n3].[String] AS [String1], [n4].[CollectionAssociateId] AS [CollectionAssociateId1], [n4].[Int] AS [Int2], [n4].[Ints] AS [Ints2], [n4].[Name] AS [Name2], [n4].[String] AS [String2] + SELECT [a1].[Id], [a1].[CollectionRootId], [a1].[Int], [a1].[Ints], [a1].[Name], [a1].[OptionalNestedAssociateId], [a1].[RequiredNestedAssociateId], [a1].[String], [n5].[Id] AS [Id0], [n5].[CollectionAssociateId], [n5].[Int] AS [Int0], [n5].[Ints] AS [Ints0], [n5].[Name] AS [Name0], [n5].[String] AS [String0], [n3].[Id] AS [Id1], [n3].[CollectionAssociateId] AS [CollectionAssociateId0], [n3].[Int] AS [Int1], [n3].[Ints] AS [Ints1], [n3].[Name] AS [Name1], [n3].[String] AS [String1], [n4].[Id] AS [Id2], [n4].[CollectionAssociateId] AS [CollectionAssociateId1], [n4].[Int] AS [Int2], [n4].[Ints] AS [Ints2], [n4].[Name] AS [Name2], [n4].[String] AS [String2] FROM [AssociateType] AS [a1] LEFT JOIN [NestedAssociateType] AS [n3] ON [a1].[OptionalNestedAssociateId] = [n3].[Id] INNER JOIN [NestedAssociateType] AS [n4] ON [a1].[RequiredNestedAssociateId] = [n4].[Id] @@ -116,7 +116,7 @@ FROM [AssociateType] AS [a1] LEFT JOIN [NestedAssociateType] AS [n6] ON [a].[Id] = [n6].[CollectionAssociateId] LEFT JOIN [NestedAssociateType] AS [n7] ON [a0].[Id] = [n7].[CollectionAssociateId] WHERE [a].[Id] IS NULL -ORDER BY [r].[Id], [a].[Id], [n].[Id], [n0].[Id], [a0].[Id], [n1].[Id], [n2].[Id], [s].[Id], [s].[Id0], [s].[Id1], [s].[Id2], [n6].[Id] +ORDER BY [r].[Id], [s].[Id], [s].[Id0], [n6].[Id] """); } @@ -126,7 +126,7 @@ public override async Task Associate_with_parameter_null() AssertSql( """ -SELECT [r].[Id], [r].[Name], [r].[OptionalAssociateId], [r].[RequiredAssociateId], [a].[Id], [n].[Id], [n0].[Id], [a0].[Id], [n1].[Id], [n2].[Id], [s].[Id], [s].[CollectionRootId], [s].[Int], [s].[Ints], [s].[Name], [s].[OptionalNestedAssociateId], [s].[RequiredNestedAssociateId], [s].[String], [s].[Id0], [s].[Id1], [s].[Id2], [s].[CollectionAssociateId], [s].[Int0], [s].[Ints0], [s].[Name0], [s].[String0], [s].[CollectionAssociateId0], [s].[Int1], [s].[Ints1], [s].[Name1], [s].[String1], [s].[CollectionAssociateId1], [s].[Int2], [s].[Ints2], [s].[Name2], [s].[String2], [a].[CollectionRootId], [a].[Int], [a].[Ints], [a].[Name], [a].[OptionalNestedAssociateId], [a].[RequiredNestedAssociateId], [a].[String], [n6].[Id], [n6].[CollectionAssociateId], [n6].[Int], [n6].[Ints], [n6].[Name], [n6].[String], [n].[CollectionAssociateId], [n].[Int], [n].[Ints], [n].[Name], [n].[String], [n0].[CollectionAssociateId], [n0].[Int], [n0].[Ints], [n0].[Name], [n0].[String], [a0].[CollectionRootId], [a0].[Int], [a0].[Ints], [a0].[Name], [a0].[OptionalNestedAssociateId], [a0].[RequiredNestedAssociateId], [a0].[String], [n7].[Id], [n7].[CollectionAssociateId], [n7].[Int], [n7].[Ints], [n7].[Name], [n7].[String], [n1].[CollectionAssociateId], [n1].[Int], [n1].[Ints], [n1].[Name], [n1].[String], [n2].[CollectionAssociateId], [n2].[Int], [n2].[Ints], [n2].[Name], [n2].[String] +SELECT [r].[Id], [r].[Name], [r].[OptionalAssociateId], [r].[RequiredAssociateId], [s].[Id], [s].[CollectionRootId], [s].[Int], [s].[Ints], [s].[Name], [s].[OptionalNestedAssociateId], [s].[RequiredNestedAssociateId], [s].[String], [s].[Id0], [s].[CollectionAssociateId], [s].[Int0], [s].[Ints0], [s].[Name0], [s].[String0], [s].[Id1], [s].[CollectionAssociateId0], [s].[Int1], [s].[Ints1], [s].[Name1], [s].[String1], [s].[Id2], [s].[CollectionAssociateId1], [s].[Int2], [s].[Ints2], [s].[Name2], [s].[String2], [a].[Id], [a].[CollectionRootId], [a].[Int], [a].[Ints], [a].[Name], [a].[OptionalNestedAssociateId], [a].[RequiredNestedAssociateId], [a].[String], [n6].[Id], [n6].[CollectionAssociateId], [n6].[Int], [n6].[Ints], [n6].[Name], [n6].[String], [n].[Id], [n].[CollectionAssociateId], [n].[Int], [n].[Ints], [n].[Name], [n].[String], [n0].[Id], [n0].[CollectionAssociateId], [n0].[Int], [n0].[Ints], [n0].[Name], [n0].[String], [a0].[Id], [a0].[CollectionRootId], [a0].[Int], [a0].[Ints], [a0].[Name], [a0].[OptionalNestedAssociateId], [a0].[RequiredNestedAssociateId], [a0].[String], [n7].[Id], [n7].[CollectionAssociateId], [n7].[Int], [n7].[Ints], [n7].[Name], [n7].[String], [n1].[Id], [n1].[CollectionAssociateId], [n1].[Int], [n1].[Ints], [n1].[Name], [n1].[String], [n2].[Id], [n2].[CollectionAssociateId], [n2].[Int], [n2].[Ints], [n2].[Name], [n2].[String] FROM [RootEntity] AS [r] LEFT JOIN [AssociateType] AS [a] ON [r].[OptionalAssociateId] = [a].[Id] LEFT JOIN [NestedAssociateType] AS [n] ON [a].[OptionalNestedAssociateId] = [n].[Id] @@ -135,7 +135,7 @@ FROM [RootEntity] AS [r] LEFT JOIN [NestedAssociateType] AS [n1] ON [a0].[OptionalNestedAssociateId] = [n1].[Id] INNER JOIN [NestedAssociateType] AS [n2] ON [a0].[RequiredNestedAssociateId] = [n2].[Id] LEFT JOIN ( - SELECT [a1].[Id], [a1].[CollectionRootId], [a1].[Int], [a1].[Ints], [a1].[Name], [a1].[OptionalNestedAssociateId], [a1].[RequiredNestedAssociateId], [a1].[String], [n3].[Id] AS [Id0], [n4].[Id] AS [Id1], [n5].[Id] AS [Id2], [n5].[CollectionAssociateId], [n5].[Int] AS [Int0], [n5].[Ints] AS [Ints0], [n5].[Name] AS [Name0], [n5].[String] AS [String0], [n3].[CollectionAssociateId] AS [CollectionAssociateId0], [n3].[Int] AS [Int1], [n3].[Ints] AS [Ints1], [n3].[Name] AS [Name1], [n3].[String] AS [String1], [n4].[CollectionAssociateId] AS [CollectionAssociateId1], [n4].[Int] AS [Int2], [n4].[Ints] AS [Ints2], [n4].[Name] AS [Name2], [n4].[String] AS [String2] + SELECT [a1].[Id], [a1].[CollectionRootId], [a1].[Int], [a1].[Ints], [a1].[Name], [a1].[OptionalNestedAssociateId], [a1].[RequiredNestedAssociateId], [a1].[String], [n5].[Id] AS [Id0], [n5].[CollectionAssociateId], [n5].[Int] AS [Int0], [n5].[Ints] AS [Ints0], [n5].[Name] AS [Name0], [n5].[String] AS [String0], [n3].[Id] AS [Id1], [n3].[CollectionAssociateId] AS [CollectionAssociateId0], [n3].[Int] AS [Int1], [n3].[Ints] AS [Ints1], [n3].[Name] AS [Name1], [n3].[String] AS [String1], [n4].[Id] AS [Id2], [n4].[CollectionAssociateId] AS [CollectionAssociateId1], [n4].[Int] AS [Int2], [n4].[Ints] AS [Ints2], [n4].[Name] AS [Name2], [n4].[String] AS [String2] FROM [AssociateType] AS [a1] LEFT JOIN [NestedAssociateType] AS [n3] ON [a1].[OptionalNestedAssociateId] = [n3].[Id] INNER JOIN [NestedAssociateType] AS [n4] ON [a1].[RequiredNestedAssociateId] = [n4].[Id] @@ -144,7 +144,7 @@ FROM [AssociateType] AS [a1] LEFT JOIN [NestedAssociateType] AS [n6] ON [a].[Id] = [n6].[CollectionAssociateId] LEFT JOIN [NestedAssociateType] AS [n7] ON [a0].[Id] = [n7].[CollectionAssociateId] WHERE [a].[Id] IS NULL -ORDER BY [r].[Id], [a].[Id], [n].[Id], [n0].[Id], [a0].[Id], [n1].[Id], [n2].[Id], [s].[Id], [s].[Id0], [s].[Id1], [s].[Id2], [n6].[Id] +ORDER BY [r].[Id], [s].[Id], [s].[Id0], [n6].[Id] """); } @@ -154,7 +154,7 @@ public override async Task Nested_associate_with_inline_null() AssertSql( """ -SELECT [r].[Id], [r].[Name], [r].[OptionalAssociateId], [r].[RequiredAssociateId], [a].[Id], [n].[Id], [a0].[Id], [n0].[Id], [n1].[Id], [n2].[Id], [s].[Id], [s].[CollectionRootId], [s].[Int], [s].[Ints], [s].[Name], [s].[OptionalNestedAssociateId], [s].[RequiredNestedAssociateId], [s].[String], [s].[Id0], [s].[Id1], [s].[Id2], [s].[CollectionAssociateId], [s].[Int0], [s].[Ints0], [s].[Name0], [s].[String0], [s].[CollectionAssociateId0], [s].[Int1], [s].[Ints1], [s].[Name1], [s].[String1], [s].[CollectionAssociateId1], [s].[Int2], [s].[Ints2], [s].[Name2], [s].[String2], [a0].[CollectionRootId], [a0].[Int], [a0].[Ints], [a0].[Name], [a0].[OptionalNestedAssociateId], [a0].[RequiredNestedAssociateId], [a0].[String], [n6].[Id], [n6].[CollectionAssociateId], [n6].[Int], [n6].[Ints], [n6].[Name], [n6].[String], [n0].[CollectionAssociateId], [n0].[Int], [n0].[Ints], [n0].[Name], [n0].[String], [n1].[CollectionAssociateId], [n1].[Int], [n1].[Ints], [n1].[Name], [n1].[String], [a].[CollectionRootId], [a].[Int], [a].[Ints], [a].[Name], [a].[OptionalNestedAssociateId], [a].[RequiredNestedAssociateId], [a].[String], [n7].[Id], [n7].[CollectionAssociateId], [n7].[Int], [n7].[Ints], [n7].[Name], [n7].[String], [n].[CollectionAssociateId], [n].[Int], [n].[Ints], [n].[Name], [n].[String], [n2].[CollectionAssociateId], [n2].[Int], [n2].[Ints], [n2].[Name], [n2].[String] +SELECT [r].[Id], [r].[Name], [r].[OptionalAssociateId], [r].[RequiredAssociateId], [s].[Id], [s].[CollectionRootId], [s].[Int], [s].[Ints], [s].[Name], [s].[OptionalNestedAssociateId], [s].[RequiredNestedAssociateId], [s].[String], [s].[Id0], [s].[CollectionAssociateId], [s].[Int0], [s].[Ints0], [s].[Name0], [s].[String0], [s].[Id1], [s].[CollectionAssociateId0], [s].[Int1], [s].[Ints1], [s].[Name1], [s].[String1], [s].[Id2], [s].[CollectionAssociateId1], [s].[Int2], [s].[Ints2], [s].[Name2], [s].[String2], [a0].[Id], [a0].[CollectionRootId], [a0].[Int], [a0].[Ints], [a0].[Name], [a0].[OptionalNestedAssociateId], [a0].[RequiredNestedAssociateId], [a0].[String], [n6].[Id], [n6].[CollectionAssociateId], [n6].[Int], [n6].[Ints], [n6].[Name], [n6].[String], [n0].[Id], [n0].[CollectionAssociateId], [n0].[Int], [n0].[Ints], [n0].[Name], [n0].[String], [n1].[Id], [n1].[CollectionAssociateId], [n1].[Int], [n1].[Ints], [n1].[Name], [n1].[String], [a].[Id], [a].[CollectionRootId], [a].[Int], [a].[Ints], [a].[Name], [a].[OptionalNestedAssociateId], [a].[RequiredNestedAssociateId], [a].[String], [n7].[Id], [n7].[CollectionAssociateId], [n7].[Int], [n7].[Ints], [n7].[Name], [n7].[String], [n].[Id], [n].[CollectionAssociateId], [n].[Int], [n].[Ints], [n].[Name], [n].[String], [n2].[Id], [n2].[CollectionAssociateId], [n2].[Int], [n2].[Ints], [n2].[Name], [n2].[String] FROM [RootEntity] AS [r] INNER JOIN [AssociateType] AS [a] ON [r].[RequiredAssociateId] = [a].[Id] LEFT JOIN [NestedAssociateType] AS [n] ON [a].[OptionalNestedAssociateId] = [n].[Id] @@ -163,7 +163,7 @@ FROM [RootEntity] AS [r] LEFT JOIN [NestedAssociateType] AS [n1] ON [a0].[RequiredNestedAssociateId] = [n1].[Id] INNER JOIN [NestedAssociateType] AS [n2] ON [a].[RequiredNestedAssociateId] = [n2].[Id] LEFT JOIN ( - SELECT [a1].[Id], [a1].[CollectionRootId], [a1].[Int], [a1].[Ints], [a1].[Name], [a1].[OptionalNestedAssociateId], [a1].[RequiredNestedAssociateId], [a1].[String], [n3].[Id] AS [Id0], [n4].[Id] AS [Id1], [n5].[Id] AS [Id2], [n5].[CollectionAssociateId], [n5].[Int] AS [Int0], [n5].[Ints] AS [Ints0], [n5].[Name] AS [Name0], [n5].[String] AS [String0], [n3].[CollectionAssociateId] AS [CollectionAssociateId0], [n3].[Int] AS [Int1], [n3].[Ints] AS [Ints1], [n3].[Name] AS [Name1], [n3].[String] AS [String1], [n4].[CollectionAssociateId] AS [CollectionAssociateId1], [n4].[Int] AS [Int2], [n4].[Ints] AS [Ints2], [n4].[Name] AS [Name2], [n4].[String] AS [String2] + SELECT [a1].[Id], [a1].[CollectionRootId], [a1].[Int], [a1].[Ints], [a1].[Name], [a1].[OptionalNestedAssociateId], [a1].[RequiredNestedAssociateId], [a1].[String], [n5].[Id] AS [Id0], [n5].[CollectionAssociateId], [n5].[Int] AS [Int0], [n5].[Ints] AS [Ints0], [n5].[Name] AS [Name0], [n5].[String] AS [String0], [n3].[Id] AS [Id1], [n3].[CollectionAssociateId] AS [CollectionAssociateId0], [n3].[Int] AS [Int1], [n3].[Ints] AS [Ints1], [n3].[Name] AS [Name1], [n3].[String] AS [String1], [n4].[Id] AS [Id2], [n4].[CollectionAssociateId] AS [CollectionAssociateId1], [n4].[Int] AS [Int2], [n4].[Ints] AS [Ints2], [n4].[Name] AS [Name2], [n4].[String] AS [String2] FROM [AssociateType] AS [a1] LEFT JOIN [NestedAssociateType] AS [n3] ON [a1].[OptionalNestedAssociateId] = [n3].[Id] INNER JOIN [NestedAssociateType] AS [n4] ON [a1].[RequiredNestedAssociateId] = [n4].[Id] @@ -172,7 +172,7 @@ FROM [AssociateType] AS [a1] LEFT JOIN [NestedAssociateType] AS [n6] ON [a0].[Id] = [n6].[CollectionAssociateId] LEFT JOIN [NestedAssociateType] AS [n7] ON [a].[Id] = [n7].[CollectionAssociateId] WHERE [n].[Id] IS NULL -ORDER BY [r].[Id], [a].[Id], [n].[Id], [a0].[Id], [n0].[Id], [n1].[Id], [n2].[Id], [s].[Id], [s].[Id0], [s].[Id1], [s].[Id2], [n6].[Id] +ORDER BY [r].[Id], [s].[Id], [s].[Id0], [n6].[Id] """); } @@ -182,7 +182,7 @@ public override async Task Nested_associate_with_inline() AssertSql( """ -SELECT [r].[Id], [r].[Name], [r].[OptionalAssociateId], [r].[RequiredAssociateId], [a].[Id], [n].[Id], [a0].[Id], [n0].[Id], [n1].[Id], [n2].[Id], [s].[Id], [s].[CollectionRootId], [s].[Int], [s].[Ints], [s].[Name], [s].[OptionalNestedAssociateId], [s].[RequiredNestedAssociateId], [s].[String], [s].[Id0], [s].[Id1], [s].[Id2], [s].[CollectionAssociateId], [s].[Int0], [s].[Ints0], [s].[Name0], [s].[String0], [s].[CollectionAssociateId0], [s].[Int1], [s].[Ints1], [s].[Name1], [s].[String1], [s].[CollectionAssociateId1], [s].[Int2], [s].[Ints2], [s].[Name2], [s].[String2], [a0].[CollectionRootId], [a0].[Int], [a0].[Ints], [a0].[Name], [a0].[OptionalNestedAssociateId], [a0].[RequiredNestedAssociateId], [a0].[String], [n6].[Id], [n6].[CollectionAssociateId], [n6].[Int], [n6].[Ints], [n6].[Name], [n6].[String], [n0].[CollectionAssociateId], [n0].[Int], [n0].[Ints], [n0].[Name], [n0].[String], [n1].[CollectionAssociateId], [n1].[Int], [n1].[Ints], [n1].[Name], [n1].[String], [a].[CollectionRootId], [a].[Int], [a].[Ints], [a].[Name], [a].[OptionalNestedAssociateId], [a].[RequiredNestedAssociateId], [a].[String], [n7].[Id], [n7].[CollectionAssociateId], [n7].[Int], [n7].[Ints], [n7].[Name], [n7].[String], [n2].[CollectionAssociateId], [n2].[Int], [n2].[Ints], [n2].[Name], [n2].[String], [n].[CollectionAssociateId], [n].[Int], [n].[Ints], [n].[Name], [n].[String] +SELECT [r].[Id], [r].[Name], [r].[OptionalAssociateId], [r].[RequiredAssociateId], [s].[Id], [s].[CollectionRootId], [s].[Int], [s].[Ints], [s].[Name], [s].[OptionalNestedAssociateId], [s].[RequiredNestedAssociateId], [s].[String], [s].[Id0], [s].[CollectionAssociateId], [s].[Int0], [s].[Ints0], [s].[Name0], [s].[String0], [s].[Id1], [s].[CollectionAssociateId0], [s].[Int1], [s].[Ints1], [s].[Name1], [s].[String1], [s].[Id2], [s].[CollectionAssociateId1], [s].[Int2], [s].[Ints2], [s].[Name2], [s].[String2], [a0].[Id], [a0].[CollectionRootId], [a0].[Int], [a0].[Ints], [a0].[Name], [a0].[OptionalNestedAssociateId], [a0].[RequiredNestedAssociateId], [a0].[String], [n6].[Id], [n6].[CollectionAssociateId], [n6].[Int], [n6].[Ints], [n6].[Name], [n6].[String], [n0].[Id], [n0].[CollectionAssociateId], [n0].[Int], [n0].[Ints], [n0].[Name], [n0].[String], [n1].[Id], [n1].[CollectionAssociateId], [n1].[Int], [n1].[Ints], [n1].[Name], [n1].[String], [a].[Id], [a].[CollectionRootId], [a].[Int], [a].[Ints], [a].[Name], [a].[OptionalNestedAssociateId], [a].[RequiredNestedAssociateId], [a].[String], [n7].[Id], [n7].[CollectionAssociateId], [n7].[Int], [n7].[Ints], [n7].[Name], [n7].[String], [n2].[Id], [n2].[CollectionAssociateId], [n2].[Int], [n2].[Ints], [n2].[Name], [n2].[String], [n].[Id], [n].[CollectionAssociateId], [n].[Int], [n].[Ints], [n].[Name], [n].[String] FROM [RootEntity] AS [r] INNER JOIN [AssociateType] AS [a] ON [r].[RequiredAssociateId] = [a].[Id] INNER JOIN [NestedAssociateType] AS [n] ON [a].[RequiredNestedAssociateId] = [n].[Id] @@ -191,7 +191,7 @@ FROM [RootEntity] AS [r] LEFT JOIN [NestedAssociateType] AS [n1] ON [a0].[RequiredNestedAssociateId] = [n1].[Id] LEFT JOIN [NestedAssociateType] AS [n2] ON [a].[OptionalNestedAssociateId] = [n2].[Id] LEFT JOIN ( - SELECT [a1].[Id], [a1].[CollectionRootId], [a1].[Int], [a1].[Ints], [a1].[Name], [a1].[OptionalNestedAssociateId], [a1].[RequiredNestedAssociateId], [a1].[String], [n3].[Id] AS [Id0], [n4].[Id] AS [Id1], [n5].[Id] AS [Id2], [n5].[CollectionAssociateId], [n5].[Int] AS [Int0], [n5].[Ints] AS [Ints0], [n5].[Name] AS [Name0], [n5].[String] AS [String0], [n3].[CollectionAssociateId] AS [CollectionAssociateId0], [n3].[Int] AS [Int1], [n3].[Ints] AS [Ints1], [n3].[Name] AS [Name1], [n3].[String] AS [String1], [n4].[CollectionAssociateId] AS [CollectionAssociateId1], [n4].[Int] AS [Int2], [n4].[Ints] AS [Ints2], [n4].[Name] AS [Name2], [n4].[String] AS [String2] + SELECT [a1].[Id], [a1].[CollectionRootId], [a1].[Int], [a1].[Ints], [a1].[Name], [a1].[OptionalNestedAssociateId], [a1].[RequiredNestedAssociateId], [a1].[String], [n5].[Id] AS [Id0], [n5].[CollectionAssociateId], [n5].[Int] AS [Int0], [n5].[Ints] AS [Ints0], [n5].[Name] AS [Name0], [n5].[String] AS [String0], [n3].[Id] AS [Id1], [n3].[CollectionAssociateId] AS [CollectionAssociateId0], [n3].[Int] AS [Int1], [n3].[Ints] AS [Ints1], [n3].[Name] AS [Name1], [n3].[String] AS [String1], [n4].[Id] AS [Id2], [n4].[CollectionAssociateId] AS [CollectionAssociateId1], [n4].[Int] AS [Int2], [n4].[Ints] AS [Ints2], [n4].[Name] AS [Name2], [n4].[String] AS [String2] FROM [AssociateType] AS [a1] LEFT JOIN [NestedAssociateType] AS [n3] ON [a1].[OptionalNestedAssociateId] = [n3].[Id] INNER JOIN [NestedAssociateType] AS [n4] ON [a1].[RequiredNestedAssociateId] = [n4].[Id] @@ -200,7 +200,7 @@ FROM [AssociateType] AS [a1] LEFT JOIN [NestedAssociateType] AS [n6] ON [a0].[Id] = [n6].[CollectionAssociateId] LEFT JOIN [NestedAssociateType] AS [n7] ON [a].[Id] = [n7].[CollectionAssociateId] WHERE [n].[Id] = 1000 -ORDER BY [r].[Id], [a].[Id], [n].[Id], [a0].[Id], [n0].[Id], [n1].[Id], [n2].[Id], [s].[Id], [s].[Id0], [s].[Id1], [s].[Id2], [n6].[Id] +ORDER BY [r].[Id], [s].[Id], [s].[Id0], [n6].[Id] """); } @@ -212,7 +212,7 @@ public override async Task Nested_associate_with_parameter() """ @entity_equality_nested_Id='1000' (Nullable = true) -SELECT [r].[Id], [r].[Name], [r].[OptionalAssociateId], [r].[RequiredAssociateId], [a].[Id], [n].[Id], [a0].[Id], [n0].[Id], [n1].[Id], [n2].[Id], [s].[Id], [s].[CollectionRootId], [s].[Int], [s].[Ints], [s].[Name], [s].[OptionalNestedAssociateId], [s].[RequiredNestedAssociateId], [s].[String], [s].[Id0], [s].[Id1], [s].[Id2], [s].[CollectionAssociateId], [s].[Int0], [s].[Ints0], [s].[Name0], [s].[String0], [s].[CollectionAssociateId0], [s].[Int1], [s].[Ints1], [s].[Name1], [s].[String1], [s].[CollectionAssociateId1], [s].[Int2], [s].[Ints2], [s].[Name2], [s].[String2], [a0].[CollectionRootId], [a0].[Int], [a0].[Ints], [a0].[Name], [a0].[OptionalNestedAssociateId], [a0].[RequiredNestedAssociateId], [a0].[String], [n6].[Id], [n6].[CollectionAssociateId], [n6].[Int], [n6].[Ints], [n6].[Name], [n6].[String], [n0].[CollectionAssociateId], [n0].[Int], [n0].[Ints], [n0].[Name], [n0].[String], [n1].[CollectionAssociateId], [n1].[Int], [n1].[Ints], [n1].[Name], [n1].[String], [a].[CollectionRootId], [a].[Int], [a].[Ints], [a].[Name], [a].[OptionalNestedAssociateId], [a].[RequiredNestedAssociateId], [a].[String], [n7].[Id], [n7].[CollectionAssociateId], [n7].[Int], [n7].[Ints], [n7].[Name], [n7].[String], [n2].[CollectionAssociateId], [n2].[Int], [n2].[Ints], [n2].[Name], [n2].[String], [n].[CollectionAssociateId], [n].[Int], [n].[Ints], [n].[Name], [n].[String] +SELECT [r].[Id], [r].[Name], [r].[OptionalAssociateId], [r].[RequiredAssociateId], [s].[Id], [s].[CollectionRootId], [s].[Int], [s].[Ints], [s].[Name], [s].[OptionalNestedAssociateId], [s].[RequiredNestedAssociateId], [s].[String], [s].[Id0], [s].[CollectionAssociateId], [s].[Int0], [s].[Ints0], [s].[Name0], [s].[String0], [s].[Id1], [s].[CollectionAssociateId0], [s].[Int1], [s].[Ints1], [s].[Name1], [s].[String1], [s].[Id2], [s].[CollectionAssociateId1], [s].[Int2], [s].[Ints2], [s].[Name2], [s].[String2], [a0].[Id], [a0].[CollectionRootId], [a0].[Int], [a0].[Ints], [a0].[Name], [a0].[OptionalNestedAssociateId], [a0].[RequiredNestedAssociateId], [a0].[String], [n6].[Id], [n6].[CollectionAssociateId], [n6].[Int], [n6].[Ints], [n6].[Name], [n6].[String], [n0].[Id], [n0].[CollectionAssociateId], [n0].[Int], [n0].[Ints], [n0].[Name], [n0].[String], [n1].[Id], [n1].[CollectionAssociateId], [n1].[Int], [n1].[Ints], [n1].[Name], [n1].[String], [a].[Id], [a].[CollectionRootId], [a].[Int], [a].[Ints], [a].[Name], [a].[OptionalNestedAssociateId], [a].[RequiredNestedAssociateId], [a].[String], [n7].[Id], [n7].[CollectionAssociateId], [n7].[Int], [n7].[Ints], [n7].[Name], [n7].[String], [n2].[Id], [n2].[CollectionAssociateId], [n2].[Int], [n2].[Ints], [n2].[Name], [n2].[String], [n].[Id], [n].[CollectionAssociateId], [n].[Int], [n].[Ints], [n].[Name], [n].[String] FROM [RootEntity] AS [r] INNER JOIN [AssociateType] AS [a] ON [r].[RequiredAssociateId] = [a].[Id] INNER JOIN [NestedAssociateType] AS [n] ON [a].[RequiredNestedAssociateId] = [n].[Id] @@ -221,7 +221,7 @@ FROM [RootEntity] AS [r] LEFT JOIN [NestedAssociateType] AS [n1] ON [a0].[RequiredNestedAssociateId] = [n1].[Id] LEFT JOIN [NestedAssociateType] AS [n2] ON [a].[OptionalNestedAssociateId] = [n2].[Id] LEFT JOIN ( - SELECT [a1].[Id], [a1].[CollectionRootId], [a1].[Int], [a1].[Ints], [a1].[Name], [a1].[OptionalNestedAssociateId], [a1].[RequiredNestedAssociateId], [a1].[String], [n3].[Id] AS [Id0], [n4].[Id] AS [Id1], [n5].[Id] AS [Id2], [n5].[CollectionAssociateId], [n5].[Int] AS [Int0], [n5].[Ints] AS [Ints0], [n5].[Name] AS [Name0], [n5].[String] AS [String0], [n3].[CollectionAssociateId] AS [CollectionAssociateId0], [n3].[Int] AS [Int1], [n3].[Ints] AS [Ints1], [n3].[Name] AS [Name1], [n3].[String] AS [String1], [n4].[CollectionAssociateId] AS [CollectionAssociateId1], [n4].[Int] AS [Int2], [n4].[Ints] AS [Ints2], [n4].[Name] AS [Name2], [n4].[String] AS [String2] + SELECT [a1].[Id], [a1].[CollectionRootId], [a1].[Int], [a1].[Ints], [a1].[Name], [a1].[OptionalNestedAssociateId], [a1].[RequiredNestedAssociateId], [a1].[String], [n5].[Id] AS [Id0], [n5].[CollectionAssociateId], [n5].[Int] AS [Int0], [n5].[Ints] AS [Ints0], [n5].[Name] AS [Name0], [n5].[String] AS [String0], [n3].[Id] AS [Id1], [n3].[CollectionAssociateId] AS [CollectionAssociateId0], [n3].[Int] AS [Int1], [n3].[Ints] AS [Ints1], [n3].[Name] AS [Name1], [n3].[String] AS [String1], [n4].[Id] AS [Id2], [n4].[CollectionAssociateId] AS [CollectionAssociateId1], [n4].[Int] AS [Int2], [n4].[Ints] AS [Ints2], [n4].[Name] AS [Name2], [n4].[String] AS [String2] FROM [AssociateType] AS [a1] LEFT JOIN [NestedAssociateType] AS [n3] ON [a1].[OptionalNestedAssociateId] = [n3].[Id] INNER JOIN [NestedAssociateType] AS [n4] ON [a1].[RequiredNestedAssociateId] = [n4].[Id] @@ -230,7 +230,7 @@ FROM [AssociateType] AS [a1] LEFT JOIN [NestedAssociateType] AS [n6] ON [a0].[Id] = [n6].[CollectionAssociateId] LEFT JOIN [NestedAssociateType] AS [n7] ON [a].[Id] = [n7].[CollectionAssociateId] WHERE [n].[Id] = @entity_equality_nested_Id -ORDER BY [r].[Id], [a].[Id], [n].[Id], [a0].[Id], [n0].[Id], [n1].[Id], [n2].[Id], [s].[Id], [s].[Id0], [s].[Id1], [s].[Id2], [n6].[Id] +ORDER BY [r].[Id], [s].[Id], [s].[Id0], [n6].[Id] """); } @@ -240,7 +240,7 @@ public override async Task Two_nested_collections() AssertSql( """ -SELECT [r].[Id], [r].[Name], [r].[OptionalAssociateId], [r].[RequiredAssociateId], [a].[Id], [a0].[Id], [n].[Id], [n0].[Id], [n1].[Id], [n2].[Id], [s].[Id], [s].[CollectionRootId], [s].[Int], [s].[Ints], [s].[Name], [s].[OptionalNestedAssociateId], [s].[RequiredNestedAssociateId], [s].[String], [s].[Id0], [s].[Id1], [s].[Id2], [s].[CollectionAssociateId], [s].[Int0], [s].[Ints0], [s].[Name0], [s].[String0], [s].[CollectionAssociateId0], [s].[Int1], [s].[Ints1], [s].[Name1], [s].[String1], [s].[CollectionAssociateId1], [s].[Int2], [s].[Ints2], [s].[Name2], [s].[String2], [a0].[CollectionRootId], [a0].[Int], [a0].[Ints], [a0].[Name], [a0].[OptionalNestedAssociateId], [a0].[RequiredNestedAssociateId], [a0].[String], [n6].[Id], [n6].[CollectionAssociateId], [n6].[Int], [n6].[Ints], [n6].[Name], [n6].[String], [n].[CollectionAssociateId], [n].[Int], [n].[Ints], [n].[Name], [n].[String], [n0].[CollectionAssociateId], [n0].[Int], [n0].[Ints], [n0].[Name], [n0].[String], [a].[CollectionRootId], [a].[Int], [a].[Ints], [a].[Name], [a].[OptionalNestedAssociateId], [a].[RequiredNestedAssociateId], [a].[String], [n7].[Id], [n7].[CollectionAssociateId], [n7].[Int], [n7].[Ints], [n7].[Name], [n7].[String], [n1].[CollectionAssociateId], [n1].[Int], [n1].[Ints], [n1].[Name], [n1].[String], [n2].[CollectionAssociateId], [n2].[Int], [n2].[Ints], [n2].[Name], [n2].[String] +SELECT [r].[Id], [r].[Name], [r].[OptionalAssociateId], [r].[RequiredAssociateId], [s].[Id], [s].[CollectionRootId], [s].[Int], [s].[Ints], [s].[Name], [s].[OptionalNestedAssociateId], [s].[RequiredNestedAssociateId], [s].[String], [s].[Id0], [s].[CollectionAssociateId], [s].[Int0], [s].[Ints0], [s].[Name0], [s].[String0], [s].[Id1], [s].[CollectionAssociateId0], [s].[Int1], [s].[Ints1], [s].[Name1], [s].[String1], [s].[Id2], [s].[CollectionAssociateId1], [s].[Int2], [s].[Ints2], [s].[Name2], [s].[String2], [a0].[Id], [a0].[CollectionRootId], [a0].[Int], [a0].[Ints], [a0].[Name], [a0].[OptionalNestedAssociateId], [a0].[RequiredNestedAssociateId], [a0].[String], [n6].[Id], [n6].[CollectionAssociateId], [n6].[Int], [n6].[Ints], [n6].[Name], [n6].[String], [n].[Id], [n].[CollectionAssociateId], [n].[Int], [n].[Ints], [n].[Name], [n].[String], [n0].[Id], [n0].[CollectionAssociateId], [n0].[Int], [n0].[Ints], [n0].[Name], [n0].[String], [a].[Id], [a].[CollectionRootId], [a].[Int], [a].[Ints], [a].[Name], [a].[OptionalNestedAssociateId], [a].[RequiredNestedAssociateId], [a].[String], [n7].[Id], [n7].[CollectionAssociateId], [n7].[Int], [n7].[Ints], [n7].[Name], [n7].[String], [n1].[Id], [n1].[CollectionAssociateId], [n1].[Int], [n1].[Ints], [n1].[Name], [n1].[String], [n2].[Id], [n2].[CollectionAssociateId], [n2].[Int], [n2].[Ints], [n2].[Name], [n2].[String] FROM [RootEntity] AS [r] INNER JOIN [AssociateType] AS [a] ON [r].[RequiredAssociateId] = [a].[Id] LEFT JOIN [AssociateType] AS [a0] ON [r].[OptionalAssociateId] = [a0].[Id] @@ -249,7 +249,7 @@ FROM [RootEntity] AS [r] LEFT JOIN [NestedAssociateType] AS [n1] ON [a].[OptionalNestedAssociateId] = [n1].[Id] INNER JOIN [NestedAssociateType] AS [n2] ON [a].[RequiredNestedAssociateId] = [n2].[Id] LEFT JOIN ( - SELECT [a1].[Id], [a1].[CollectionRootId], [a1].[Int], [a1].[Ints], [a1].[Name], [a1].[OptionalNestedAssociateId], [a1].[RequiredNestedAssociateId], [a1].[String], [n3].[Id] AS [Id0], [n4].[Id] AS [Id1], [n5].[Id] AS [Id2], [n5].[CollectionAssociateId], [n5].[Int] AS [Int0], [n5].[Ints] AS [Ints0], [n5].[Name] AS [Name0], [n5].[String] AS [String0], [n3].[CollectionAssociateId] AS [CollectionAssociateId0], [n3].[Int] AS [Int1], [n3].[Ints] AS [Ints1], [n3].[Name] AS [Name1], [n3].[String] AS [String1], [n4].[CollectionAssociateId] AS [CollectionAssociateId1], [n4].[Int] AS [Int2], [n4].[Ints] AS [Ints2], [n4].[Name] AS [Name2], [n4].[String] AS [String2] + SELECT [a1].[Id], [a1].[CollectionRootId], [a1].[Int], [a1].[Ints], [a1].[Name], [a1].[OptionalNestedAssociateId], [a1].[RequiredNestedAssociateId], [a1].[String], [n5].[Id] AS [Id0], [n5].[CollectionAssociateId], [n5].[Int] AS [Int0], [n5].[Ints] AS [Ints0], [n5].[Name] AS [Name0], [n5].[String] AS [String0], [n3].[Id] AS [Id1], [n3].[CollectionAssociateId] AS [CollectionAssociateId0], [n3].[Int] AS [Int1], [n3].[Ints] AS [Ints1], [n3].[Name] AS [Name1], [n3].[String] AS [String1], [n4].[Id] AS [Id2], [n4].[CollectionAssociateId] AS [CollectionAssociateId1], [n4].[Int] AS [Int2], [n4].[Ints] AS [Ints2], [n4].[Name] AS [Name2], [n4].[String] AS [String2] FROM [AssociateType] AS [a1] LEFT JOIN [NestedAssociateType] AS [n3] ON [a1].[OptionalNestedAssociateId] = [n3].[Id] INNER JOIN [NestedAssociateType] AS [n4] ON [a1].[RequiredNestedAssociateId] = [n4].[Id] @@ -258,7 +258,7 @@ FROM [AssociateType] AS [a1] LEFT JOIN [NestedAssociateType] AS [n6] ON [a0].[Id] = [n6].[CollectionAssociateId] LEFT JOIN [NestedAssociateType] AS [n7] ON [a].[Id] = [n7].[CollectionAssociateId] WHERE [a].[Id] = [a0].[Id] -ORDER BY [r].[Id], [a].[Id], [a0].[Id], [n].[Id], [n0].[Id], [n1].[Id], [n2].[Id], [s].[Id], [s].[Id0], [s].[Id1], [s].[Id2], [n6].[Id] +ORDER BY [r].[Id], [s].[Id], [s].[Id0], [n6].[Id] """); } @@ -284,7 +284,7 @@ public override async Task Contains_with_inline() AssertSql( """ -SELECT [r].[Id], [r].[Name], [r].[OptionalAssociateId], [r].[RequiredAssociateId], [a].[Id], [a0].[Id], [n0].[Id], [n1].[Id], [n2].[Id], [n3].[Id], [s].[Id], [s].[CollectionRootId], [s].[Int], [s].[Ints], [s].[Name], [s].[OptionalNestedAssociateId], [s].[RequiredNestedAssociateId], [s].[String], [s].[Id0], [s].[Id1], [s].[Id2], [s].[CollectionAssociateId], [s].[Int0], [s].[Ints0], [s].[Name0], [s].[String0], [s].[CollectionAssociateId0], [s].[Int1], [s].[Ints1], [s].[Name1], [s].[String1], [s].[CollectionAssociateId1], [s].[Int2], [s].[Ints2], [s].[Name2], [s].[String2], [a0].[CollectionRootId], [a0].[Int], [a0].[Ints], [a0].[Name], [a0].[OptionalNestedAssociateId], [a0].[RequiredNestedAssociateId], [a0].[String], [n7].[Id], [n7].[CollectionAssociateId], [n7].[Int], [n7].[Ints], [n7].[Name], [n7].[String], [n0].[CollectionAssociateId], [n0].[Int], [n0].[Ints], [n0].[Name], [n0].[String], [n1].[CollectionAssociateId], [n1].[Int], [n1].[Ints], [n1].[Name], [n1].[String], [a].[CollectionRootId], [a].[Int], [a].[Ints], [a].[Name], [a].[OptionalNestedAssociateId], [a].[RequiredNestedAssociateId], [a].[String], [n8].[Id], [n8].[CollectionAssociateId], [n8].[Int], [n8].[Ints], [n8].[Name], [n8].[String], [n2].[CollectionAssociateId], [n2].[Int], [n2].[Ints], [n2].[Name], [n2].[String], [n3].[CollectionAssociateId], [n3].[Int], [n3].[Ints], [n3].[Name], [n3].[String] +SELECT [r].[Id], [r].[Name], [r].[OptionalAssociateId], [r].[RequiredAssociateId], [s].[Id], [s].[CollectionRootId], [s].[Int], [s].[Ints], [s].[Name], [s].[OptionalNestedAssociateId], [s].[RequiredNestedAssociateId], [s].[String], [s].[Id0], [s].[CollectionAssociateId], [s].[Int0], [s].[Ints0], [s].[Name0], [s].[String0], [s].[Id1], [s].[CollectionAssociateId0], [s].[Int1], [s].[Ints1], [s].[Name1], [s].[String1], [s].[Id2], [s].[CollectionAssociateId1], [s].[Int2], [s].[Ints2], [s].[Name2], [s].[String2], [a0].[Id], [a0].[CollectionRootId], [a0].[Int], [a0].[Ints], [a0].[Name], [a0].[OptionalNestedAssociateId], [a0].[RequiredNestedAssociateId], [a0].[String], [n7].[Id], [n7].[CollectionAssociateId], [n7].[Int], [n7].[Ints], [n7].[Name], [n7].[String], [n0].[Id], [n0].[CollectionAssociateId], [n0].[Int], [n0].[Ints], [n0].[Name], [n0].[String], [n1].[Id], [n1].[CollectionAssociateId], [n1].[Int], [n1].[Ints], [n1].[Name], [n1].[String], [a].[Id], [a].[CollectionRootId], [a].[Int], [a].[Ints], [a].[Name], [a].[OptionalNestedAssociateId], [a].[RequiredNestedAssociateId], [a].[String], [n8].[Id], [n8].[CollectionAssociateId], [n8].[Int], [n8].[Ints], [n8].[Name], [n8].[String], [n2].[Id], [n2].[CollectionAssociateId], [n2].[Int], [n2].[Ints], [n2].[Name], [n2].[String], [n3].[Id], [n3].[CollectionAssociateId], [n3].[Int], [n3].[Ints], [n3].[Name], [n3].[String] FROM [RootEntity] AS [r] INNER JOIN [AssociateType] AS [a] ON [r].[RequiredAssociateId] = [a].[Id] LEFT JOIN [AssociateType] AS [a0] ON [r].[OptionalAssociateId] = [a0].[Id] @@ -293,7 +293,7 @@ FROM [RootEntity] AS [r] LEFT JOIN [NestedAssociateType] AS [n2] ON [a].[OptionalNestedAssociateId] = [n2].[Id] INNER JOIN [NestedAssociateType] AS [n3] ON [a].[RequiredNestedAssociateId] = [n3].[Id] LEFT JOIN ( - SELECT [a1].[Id], [a1].[CollectionRootId], [a1].[Int], [a1].[Ints], [a1].[Name], [a1].[OptionalNestedAssociateId], [a1].[RequiredNestedAssociateId], [a1].[String], [n4].[Id] AS [Id0], [n5].[Id] AS [Id1], [n6].[Id] AS [Id2], [n6].[CollectionAssociateId], [n6].[Int] AS [Int0], [n6].[Ints] AS [Ints0], [n6].[Name] AS [Name0], [n6].[String] AS [String0], [n4].[CollectionAssociateId] AS [CollectionAssociateId0], [n4].[Int] AS [Int1], [n4].[Ints] AS [Ints1], [n4].[Name] AS [Name1], [n4].[String] AS [String1], [n5].[CollectionAssociateId] AS [CollectionAssociateId1], [n5].[Int] AS [Int2], [n5].[Ints] AS [Ints2], [n5].[Name] AS [Name2], [n5].[String] AS [String2] + SELECT [a1].[Id], [a1].[CollectionRootId], [a1].[Int], [a1].[Ints], [a1].[Name], [a1].[OptionalNestedAssociateId], [a1].[RequiredNestedAssociateId], [a1].[String], [n6].[Id] AS [Id0], [n6].[CollectionAssociateId], [n6].[Int] AS [Int0], [n6].[Ints] AS [Ints0], [n6].[Name] AS [Name0], [n6].[String] AS [String0], [n4].[Id] AS [Id1], [n4].[CollectionAssociateId] AS [CollectionAssociateId0], [n4].[Int] AS [Int1], [n4].[Ints] AS [Ints1], [n4].[Name] AS [Name1], [n4].[String] AS [String1], [n5].[Id] AS [Id2], [n5].[CollectionAssociateId] AS [CollectionAssociateId1], [n5].[Int] AS [Int2], [n5].[Ints] AS [Ints2], [n5].[Name] AS [Name2], [n5].[String] AS [String2] FROM [AssociateType] AS [a1] LEFT JOIN [NestedAssociateType] AS [n4] ON [a1].[OptionalNestedAssociateId] = [n4].[Id] INNER JOIN [NestedAssociateType] AS [n5] ON [a1].[RequiredNestedAssociateId] = [n5].[Id] @@ -305,7 +305,7 @@ WHERE EXISTS ( SELECT 1 FROM [NestedAssociateType] AS [n] WHERE [a].[Id] = [n].[CollectionAssociateId] AND [n].[Id] = 1002) -ORDER BY [r].[Id], [a].[Id], [a0].[Id], [n0].[Id], [n1].[Id], [n2].[Id], [n3].[Id], [s].[Id], [s].[Id0], [s].[Id1], [s].[Id2], [n7].[Id] +ORDER BY [r].[Id], [s].[Id], [s].[Id0], [n7].[Id] """); } @@ -317,7 +317,7 @@ public override async Task Contains_with_parameter() """ @entity_equality_nested_Id='1002' (Nullable = true) -SELECT [r].[Id], [r].[Name], [r].[OptionalAssociateId], [r].[RequiredAssociateId], [a].[Id], [a0].[Id], [n0].[Id], [n1].[Id], [n2].[Id], [n3].[Id], [s].[Id], [s].[CollectionRootId], [s].[Int], [s].[Ints], [s].[Name], [s].[OptionalNestedAssociateId], [s].[RequiredNestedAssociateId], [s].[String], [s].[Id0], [s].[Id1], [s].[Id2], [s].[CollectionAssociateId], [s].[Int0], [s].[Ints0], [s].[Name0], [s].[String0], [s].[CollectionAssociateId0], [s].[Int1], [s].[Ints1], [s].[Name1], [s].[String1], [s].[CollectionAssociateId1], [s].[Int2], [s].[Ints2], [s].[Name2], [s].[String2], [a0].[CollectionRootId], [a0].[Int], [a0].[Ints], [a0].[Name], [a0].[OptionalNestedAssociateId], [a0].[RequiredNestedAssociateId], [a0].[String], [n7].[Id], [n7].[CollectionAssociateId], [n7].[Int], [n7].[Ints], [n7].[Name], [n7].[String], [n0].[CollectionAssociateId], [n0].[Int], [n0].[Ints], [n0].[Name], [n0].[String], [n1].[CollectionAssociateId], [n1].[Int], [n1].[Ints], [n1].[Name], [n1].[String], [a].[CollectionRootId], [a].[Int], [a].[Ints], [a].[Name], [a].[OptionalNestedAssociateId], [a].[RequiredNestedAssociateId], [a].[String], [n8].[Id], [n8].[CollectionAssociateId], [n8].[Int], [n8].[Ints], [n8].[Name], [n8].[String], [n2].[CollectionAssociateId], [n2].[Int], [n2].[Ints], [n2].[Name], [n2].[String], [n3].[CollectionAssociateId], [n3].[Int], [n3].[Ints], [n3].[Name], [n3].[String] +SELECT [r].[Id], [r].[Name], [r].[OptionalAssociateId], [r].[RequiredAssociateId], [s].[Id], [s].[CollectionRootId], [s].[Int], [s].[Ints], [s].[Name], [s].[OptionalNestedAssociateId], [s].[RequiredNestedAssociateId], [s].[String], [s].[Id0], [s].[CollectionAssociateId], [s].[Int0], [s].[Ints0], [s].[Name0], [s].[String0], [s].[Id1], [s].[CollectionAssociateId0], [s].[Int1], [s].[Ints1], [s].[Name1], [s].[String1], [s].[Id2], [s].[CollectionAssociateId1], [s].[Int2], [s].[Ints2], [s].[Name2], [s].[String2], [a0].[Id], [a0].[CollectionRootId], [a0].[Int], [a0].[Ints], [a0].[Name], [a0].[OptionalNestedAssociateId], [a0].[RequiredNestedAssociateId], [a0].[String], [n7].[Id], [n7].[CollectionAssociateId], [n7].[Int], [n7].[Ints], [n7].[Name], [n7].[String], [n0].[Id], [n0].[CollectionAssociateId], [n0].[Int], [n0].[Ints], [n0].[Name], [n0].[String], [n1].[Id], [n1].[CollectionAssociateId], [n1].[Int], [n1].[Ints], [n1].[Name], [n1].[String], [a].[Id], [a].[CollectionRootId], [a].[Int], [a].[Ints], [a].[Name], [a].[OptionalNestedAssociateId], [a].[RequiredNestedAssociateId], [a].[String], [n8].[Id], [n8].[CollectionAssociateId], [n8].[Int], [n8].[Ints], [n8].[Name], [n8].[String], [n2].[Id], [n2].[CollectionAssociateId], [n2].[Int], [n2].[Ints], [n2].[Name], [n2].[String], [n3].[Id], [n3].[CollectionAssociateId], [n3].[Int], [n3].[Ints], [n3].[Name], [n3].[String] FROM [RootEntity] AS [r] INNER JOIN [AssociateType] AS [a] ON [r].[RequiredAssociateId] = [a].[Id] LEFT JOIN [AssociateType] AS [a0] ON [r].[OptionalAssociateId] = [a0].[Id] @@ -326,7 +326,7 @@ FROM [RootEntity] AS [r] LEFT JOIN [NestedAssociateType] AS [n2] ON [a].[OptionalNestedAssociateId] = [n2].[Id] INNER JOIN [NestedAssociateType] AS [n3] ON [a].[RequiredNestedAssociateId] = [n3].[Id] LEFT JOIN ( - SELECT [a1].[Id], [a1].[CollectionRootId], [a1].[Int], [a1].[Ints], [a1].[Name], [a1].[OptionalNestedAssociateId], [a1].[RequiredNestedAssociateId], [a1].[String], [n4].[Id] AS [Id0], [n5].[Id] AS [Id1], [n6].[Id] AS [Id2], [n6].[CollectionAssociateId], [n6].[Int] AS [Int0], [n6].[Ints] AS [Ints0], [n6].[Name] AS [Name0], [n6].[String] AS [String0], [n4].[CollectionAssociateId] AS [CollectionAssociateId0], [n4].[Int] AS [Int1], [n4].[Ints] AS [Ints1], [n4].[Name] AS [Name1], [n4].[String] AS [String1], [n5].[CollectionAssociateId] AS [CollectionAssociateId1], [n5].[Int] AS [Int2], [n5].[Ints] AS [Ints2], [n5].[Name] AS [Name2], [n5].[String] AS [String2] + SELECT [a1].[Id], [a1].[CollectionRootId], [a1].[Int], [a1].[Ints], [a1].[Name], [a1].[OptionalNestedAssociateId], [a1].[RequiredNestedAssociateId], [a1].[String], [n6].[Id] AS [Id0], [n6].[CollectionAssociateId], [n6].[Int] AS [Int0], [n6].[Ints] AS [Ints0], [n6].[Name] AS [Name0], [n6].[String] AS [String0], [n4].[Id] AS [Id1], [n4].[CollectionAssociateId] AS [CollectionAssociateId0], [n4].[Int] AS [Int1], [n4].[Ints] AS [Ints1], [n4].[Name] AS [Name1], [n4].[String] AS [String1], [n5].[Id] AS [Id2], [n5].[CollectionAssociateId] AS [CollectionAssociateId1], [n5].[Int] AS [Int2], [n5].[Ints] AS [Ints2], [n5].[Name] AS [Name2], [n5].[String] AS [String2] FROM [AssociateType] AS [a1] LEFT JOIN [NestedAssociateType] AS [n4] ON [a1].[OptionalNestedAssociateId] = [n4].[Id] INNER JOIN [NestedAssociateType] AS [n5] ON [a1].[RequiredNestedAssociateId] = [n5].[Id] @@ -338,7 +338,7 @@ WHERE EXISTS ( SELECT 1 FROM [NestedAssociateType] AS [n] WHERE [a].[Id] = [n].[CollectionAssociateId] AND [n].[Id] = @entity_equality_nested_Id) -ORDER BY [r].[Id], [a].[Id], [a0].[Id], [n0].[Id], [n1].[Id], [n2].[Id], [n3].[Id], [s].[Id], [s].[Id0], [s].[Id1], [s].[Id2], [n7].[Id] +ORDER BY [r].[Id], [s].[Id], [s].[Id0], [n7].[Id] """); } @@ -351,7 +351,7 @@ public override async Task Contains_with_operators_composed_on_the_collection() @get_Item_Int='106' @entity_equality_get_Item_Id='3003' (Nullable = true) -SELECT [r].[Id], [r].[Name], [r].[OptionalAssociateId], [r].[RequiredAssociateId], [a].[Id], [a0].[Id], [n0].[Id], [n1].[Id], [n2].[Id], [n3].[Id], [s].[Id], [s].[CollectionRootId], [s].[Int], [s].[Ints], [s].[Name], [s].[OptionalNestedAssociateId], [s].[RequiredNestedAssociateId], [s].[String], [s].[Id0], [s].[Id1], [s].[Id2], [s].[CollectionAssociateId], [s].[Int0], [s].[Ints0], [s].[Name0], [s].[String0], [s].[CollectionAssociateId0], [s].[Int1], [s].[Ints1], [s].[Name1], [s].[String1], [s].[CollectionAssociateId1], [s].[Int2], [s].[Ints2], [s].[Name2], [s].[String2], [a0].[CollectionRootId], [a0].[Int], [a0].[Ints], [a0].[Name], [a0].[OptionalNestedAssociateId], [a0].[RequiredNestedAssociateId], [a0].[String], [n7].[Id], [n7].[CollectionAssociateId], [n7].[Int], [n7].[Ints], [n7].[Name], [n7].[String], [n0].[CollectionAssociateId], [n0].[Int], [n0].[Ints], [n0].[Name], [n0].[String], [n1].[CollectionAssociateId], [n1].[Int], [n1].[Ints], [n1].[Name], [n1].[String], [a].[CollectionRootId], [a].[Int], [a].[Ints], [a].[Name], [a].[OptionalNestedAssociateId], [a].[RequiredNestedAssociateId], [a].[String], [n8].[Id], [n8].[CollectionAssociateId], [n8].[Int], [n8].[Ints], [n8].[Name], [n8].[String], [n2].[CollectionAssociateId], [n2].[Int], [n2].[Ints], [n2].[Name], [n2].[String], [n3].[CollectionAssociateId], [n3].[Int], [n3].[Ints], [n3].[Name], [n3].[String] +SELECT [r].[Id], [r].[Name], [r].[OptionalAssociateId], [r].[RequiredAssociateId], [s].[Id], [s].[CollectionRootId], [s].[Int], [s].[Ints], [s].[Name], [s].[OptionalNestedAssociateId], [s].[RequiredNestedAssociateId], [s].[String], [s].[Id0], [s].[CollectionAssociateId], [s].[Int0], [s].[Ints0], [s].[Name0], [s].[String0], [s].[Id1], [s].[CollectionAssociateId0], [s].[Int1], [s].[Ints1], [s].[Name1], [s].[String1], [s].[Id2], [s].[CollectionAssociateId1], [s].[Int2], [s].[Ints2], [s].[Name2], [s].[String2], [a0].[Id], [a0].[CollectionRootId], [a0].[Int], [a0].[Ints], [a0].[Name], [a0].[OptionalNestedAssociateId], [a0].[RequiredNestedAssociateId], [a0].[String], [n7].[Id], [n7].[CollectionAssociateId], [n7].[Int], [n7].[Ints], [n7].[Name], [n7].[String], [n0].[Id], [n0].[CollectionAssociateId], [n0].[Int], [n0].[Ints], [n0].[Name], [n0].[String], [n1].[Id], [n1].[CollectionAssociateId], [n1].[Int], [n1].[Ints], [n1].[Name], [n1].[String], [a].[Id], [a].[CollectionRootId], [a].[Int], [a].[Ints], [a].[Name], [a].[OptionalNestedAssociateId], [a].[RequiredNestedAssociateId], [a].[String], [n8].[Id], [n8].[CollectionAssociateId], [n8].[Int], [n8].[Ints], [n8].[Name], [n8].[String], [n2].[Id], [n2].[CollectionAssociateId], [n2].[Int], [n2].[Ints], [n2].[Name], [n2].[String], [n3].[Id], [n3].[CollectionAssociateId], [n3].[Int], [n3].[Ints], [n3].[Name], [n3].[String] FROM [RootEntity] AS [r] INNER JOIN [AssociateType] AS [a] ON [r].[RequiredAssociateId] = [a].[Id] LEFT JOIN [AssociateType] AS [a0] ON [r].[OptionalAssociateId] = [a0].[Id] @@ -360,7 +360,7 @@ FROM [RootEntity] AS [r] LEFT JOIN [NestedAssociateType] AS [n2] ON [a].[OptionalNestedAssociateId] = [n2].[Id] INNER JOIN [NestedAssociateType] AS [n3] ON [a].[RequiredNestedAssociateId] = [n3].[Id] LEFT JOIN ( - SELECT [a1].[Id], [a1].[CollectionRootId], [a1].[Int], [a1].[Ints], [a1].[Name], [a1].[OptionalNestedAssociateId], [a1].[RequiredNestedAssociateId], [a1].[String], [n4].[Id] AS [Id0], [n5].[Id] AS [Id1], [n6].[Id] AS [Id2], [n6].[CollectionAssociateId], [n6].[Int] AS [Int0], [n6].[Ints] AS [Ints0], [n6].[Name] AS [Name0], [n6].[String] AS [String0], [n4].[CollectionAssociateId] AS [CollectionAssociateId0], [n4].[Int] AS [Int1], [n4].[Ints] AS [Ints1], [n4].[Name] AS [Name1], [n4].[String] AS [String1], [n5].[CollectionAssociateId] AS [CollectionAssociateId1], [n5].[Int] AS [Int2], [n5].[Ints] AS [Ints2], [n5].[Name] AS [Name2], [n5].[String] AS [String2] + SELECT [a1].[Id], [a1].[CollectionRootId], [a1].[Int], [a1].[Ints], [a1].[Name], [a1].[OptionalNestedAssociateId], [a1].[RequiredNestedAssociateId], [a1].[String], [n6].[Id] AS [Id0], [n6].[CollectionAssociateId], [n6].[Int] AS [Int0], [n6].[Ints] AS [Ints0], [n6].[Name] AS [Name0], [n6].[String] AS [String0], [n4].[Id] AS [Id1], [n4].[CollectionAssociateId] AS [CollectionAssociateId0], [n4].[Int] AS [Int1], [n4].[Ints] AS [Ints1], [n4].[Name] AS [Name1], [n4].[String] AS [String1], [n5].[Id] AS [Id2], [n5].[CollectionAssociateId] AS [CollectionAssociateId1], [n5].[Int] AS [Int2], [n5].[Ints] AS [Ints2], [n5].[Name] AS [Name2], [n5].[String] AS [String2] FROM [AssociateType] AS [a1] LEFT JOIN [NestedAssociateType] AS [n4] ON [a1].[OptionalNestedAssociateId] = [n4].[Id] INNER JOIN [NestedAssociateType] AS [n5] ON [a1].[RequiredNestedAssociateId] = [n5].[Id] @@ -372,7 +372,7 @@ WHERE EXISTS ( SELECT 1 FROM [NestedAssociateType] AS [n] WHERE [a].[Id] = [n].[CollectionAssociateId] AND [n].[Int] > @get_Item_Int AND [n].[Id] = @entity_equality_get_Item_Id) -ORDER BY [r].[Id], [a].[Id], [a0].[Id], [n0].[Id], [n1].[Id], [n2].[Id], [n3].[Id], [s].[Id], [s].[Id0], [s].[Id1], [s].[Id2], [n7].[Id] +ORDER BY [r].[Id], [s].[Id], [s].[Id0], [n7].[Id] """); } @@ -385,7 +385,7 @@ public override async Task Contains_with_nested_and_composed_operators() @get_Item_Id='302' @entity_equality_get_Item_Id='303' (Nullable = true) -SELECT [r].[Id], [r].[Name], [r].[OptionalAssociateId], [r].[RequiredAssociateId], [a0].[Id], [n].[Id], [n0].[Id], [a1].[Id], [n1].[Id], [n2].[Id], [s].[Id], [s].[CollectionRootId], [s].[Int], [s].[Ints], [s].[Name], [s].[OptionalNestedAssociateId], [s].[RequiredNestedAssociateId], [s].[String], [s].[Id0], [s].[Id1], [s].[Id2], [s].[CollectionAssociateId], [s].[Int0], [s].[Ints0], [s].[Name0], [s].[String0], [s].[CollectionAssociateId0], [s].[Int1], [s].[Ints1], [s].[Name1], [s].[String1], [s].[CollectionAssociateId1], [s].[Int2], [s].[Ints2], [s].[Name2], [s].[String2], [a0].[CollectionRootId], [a0].[Int], [a0].[Ints], [a0].[Name], [a0].[OptionalNestedAssociateId], [a0].[RequiredNestedAssociateId], [a0].[String], [n6].[Id], [n6].[CollectionAssociateId], [n6].[Int], [n6].[Ints], [n6].[Name], [n6].[String], [n].[CollectionAssociateId], [n].[Int], [n].[Ints], [n].[Name], [n].[String], [n0].[CollectionAssociateId], [n0].[Int], [n0].[Ints], [n0].[Name], [n0].[String], [a1].[CollectionRootId], [a1].[Int], [a1].[Ints], [a1].[Name], [a1].[OptionalNestedAssociateId], [a1].[RequiredNestedAssociateId], [a1].[String], [n7].[Id], [n7].[CollectionAssociateId], [n7].[Int], [n7].[Ints], [n7].[Name], [n7].[String], [n1].[CollectionAssociateId], [n1].[Int], [n1].[Ints], [n1].[Name], [n1].[String], [n2].[CollectionAssociateId], [n2].[Int], [n2].[Ints], [n2].[Name], [n2].[String] +SELECT [r].[Id], [r].[Name], [r].[OptionalAssociateId], [r].[RequiredAssociateId], [s].[Id], [s].[CollectionRootId], [s].[Int], [s].[Ints], [s].[Name], [s].[OptionalNestedAssociateId], [s].[RequiredNestedAssociateId], [s].[String], [s].[Id0], [s].[CollectionAssociateId], [s].[Int0], [s].[Ints0], [s].[Name0], [s].[String0], [s].[Id1], [s].[CollectionAssociateId0], [s].[Int1], [s].[Ints1], [s].[Name1], [s].[String1], [s].[Id2], [s].[CollectionAssociateId1], [s].[Int2], [s].[Ints2], [s].[Name2], [s].[String2], [a0].[Id], [a0].[CollectionRootId], [a0].[Int], [a0].[Ints], [a0].[Name], [a0].[OptionalNestedAssociateId], [a0].[RequiredNestedAssociateId], [a0].[String], [n6].[Id], [n6].[CollectionAssociateId], [n6].[Int], [n6].[Ints], [n6].[Name], [n6].[String], [n].[Id], [n].[CollectionAssociateId], [n].[Int], [n].[Ints], [n].[Name], [n].[String], [n0].[Id], [n0].[CollectionAssociateId], [n0].[Int], [n0].[Ints], [n0].[Name], [n0].[String], [a1].[Id], [a1].[CollectionRootId], [a1].[Int], [a1].[Ints], [a1].[Name], [a1].[OptionalNestedAssociateId], [a1].[RequiredNestedAssociateId], [a1].[String], [n7].[Id], [n7].[CollectionAssociateId], [n7].[Int], [n7].[Ints], [n7].[Name], [n7].[String], [n1].[Id], [n1].[CollectionAssociateId], [n1].[Int], [n1].[Ints], [n1].[Name], [n1].[String], [n2].[Id], [n2].[CollectionAssociateId], [n2].[Int], [n2].[Ints], [n2].[Name], [n2].[String] FROM [RootEntity] AS [r] LEFT JOIN [AssociateType] AS [a0] ON [r].[OptionalAssociateId] = [a0].[Id] LEFT JOIN [NestedAssociateType] AS [n] ON [a0].[OptionalNestedAssociateId] = [n].[Id] @@ -394,7 +394,7 @@ FROM [RootEntity] AS [r] LEFT JOIN [NestedAssociateType] AS [n1] ON [a1].[OptionalNestedAssociateId] = [n1].[Id] INNER JOIN [NestedAssociateType] AS [n2] ON [a1].[RequiredNestedAssociateId] = [n2].[Id] LEFT JOIN ( - SELECT [a2].[Id], [a2].[CollectionRootId], [a2].[Int], [a2].[Ints], [a2].[Name], [a2].[OptionalNestedAssociateId], [a2].[RequiredNestedAssociateId], [a2].[String], [n3].[Id] AS [Id0], [n4].[Id] AS [Id1], [n5].[Id] AS [Id2], [n5].[CollectionAssociateId], [n5].[Int] AS [Int0], [n5].[Ints] AS [Ints0], [n5].[Name] AS [Name0], [n5].[String] AS [String0], [n3].[CollectionAssociateId] AS [CollectionAssociateId0], [n3].[Int] AS [Int1], [n3].[Ints] AS [Ints1], [n3].[Name] AS [Name1], [n3].[String] AS [String1], [n4].[CollectionAssociateId] AS [CollectionAssociateId1], [n4].[Int] AS [Int2], [n4].[Ints] AS [Ints2], [n4].[Name] AS [Name2], [n4].[String] AS [String2] + SELECT [a2].[Id], [a2].[CollectionRootId], [a2].[Int], [a2].[Ints], [a2].[Name], [a2].[OptionalNestedAssociateId], [a2].[RequiredNestedAssociateId], [a2].[String], [n5].[Id] AS [Id0], [n5].[CollectionAssociateId], [n5].[Int] AS [Int0], [n5].[Ints] AS [Ints0], [n5].[Name] AS [Name0], [n5].[String] AS [String0], [n3].[Id] AS [Id1], [n3].[CollectionAssociateId] AS [CollectionAssociateId0], [n3].[Int] AS [Int1], [n3].[Ints] AS [Ints1], [n3].[Name] AS [Name1], [n3].[String] AS [String1], [n4].[Id] AS [Id2], [n4].[CollectionAssociateId] AS [CollectionAssociateId1], [n4].[Int] AS [Int2], [n4].[Ints] AS [Ints2], [n4].[Name] AS [Name2], [n4].[String] AS [String2] FROM [AssociateType] AS [a2] LEFT JOIN [NestedAssociateType] AS [n3] ON [a2].[OptionalNestedAssociateId] = [n3].[Id] INNER JOIN [NestedAssociateType] AS [n4] ON [a2].[RequiredNestedAssociateId] = [n4].[Id] @@ -406,7 +406,7 @@ WHERE EXISTS ( SELECT 1 FROM [AssociateType] AS [a] WHERE [r].[Id] = [a].[CollectionRootId] AND [a].[Id] > @get_Item_Id AND [a].[Id] = @entity_equality_get_Item_Id) -ORDER BY [r].[Id], [a0].[Id], [n].[Id], [n0].[Id], [a1].[Id], [n1].[Id], [n2].[Id], [s].[Id], [s].[Id0], [s].[Id1], [s].[Id2], [n6].[Id] +ORDER BY [r].[Id], [s].[Id], [s].[Id0], [n6].[Id] """); } diff --git a/test/EFCore.SqlServer.FunctionalTests/Query/Associations/OwnedNavigations/OwnedNavigationsProjectionSqlServerTest.cs b/test/EFCore.SqlServer.FunctionalTests/Query/Associations/OwnedNavigations/OwnedNavigationsProjectionSqlServerTest.cs index 8b57be8d69c..d27d6d21e1c 100644 --- a/test/EFCore.SqlServer.FunctionalTests/Query/Associations/OwnedNavigations/OwnedNavigationsProjectionSqlServerTest.cs +++ b/test/EFCore.SqlServer.FunctionalTests/Query/Associations/OwnedNavigations/OwnedNavigationsProjectionSqlServerTest.cs @@ -197,14 +197,14 @@ public override async Task Select_required_associate_via_optional_navigation(Que { AssertSql( """ -SELECT [r1].[RootEntityId], [r1].[Id], [r1].[Int], [r1].[Ints], [r1].[Name], [r1].[String], [r].[Id], [r0].[Id], [r2].[AssociateTypeRootEntityId], [r3].[AssociateTypeRootEntityId], [r4].[AssociateTypeRootEntityId], [r4].[Id], [r4].[Int], [r4].[Ints], [r4].[Name], [r4].[String], [r2].[Id], [r2].[Int], [r2].[Ints], [r2].[Name], [r2].[String], [r3].[Id], [r3].[Int], [r3].[Ints], [r3].[Name], [r3].[String] +SELECT [r1].[RootEntityId], [r1].[Id], [r1].[Int], [r1].[Ints], [r1].[Name], [r1].[String], [r].[Id], [r2].[AssociateTypeRootEntityId], [r3].[AssociateTypeRootEntityId], [r4].[AssociateTypeRootEntityId], [r4].[Id], [r4].[Int], [r4].[Ints], [r4].[Name], [r4].[String], [r2].[Id], [r2].[Int], [r2].[Ints], [r2].[Name], [r2].[String], [r3].[Id], [r3].[Int], [r3].[Ints], [r3].[Name], [r3].[String] FROM [RootReferencingEntity] AS [r] LEFT JOIN [RootEntity] AS [r0] ON [r].[RootEntityId] = [r0].[Id] LEFT JOIN [RequiredRelated] AS [r1] ON [r0].[Id] = [r1].[RootEntityId] LEFT JOIN [RequiredRelated_OptionalNested] AS [r2] ON [r1].[RootEntityId] = [r2].[AssociateTypeRootEntityId] LEFT JOIN [RequiredRelated_RequiredNested] AS [r3] ON [r1].[RootEntityId] = [r3].[AssociateTypeRootEntityId] LEFT JOIN [RequiredRelated_NestedCollection] AS [r4] ON [r1].[RootEntityId] = [r4].[AssociateTypeRootEntityId] -ORDER BY [r].[Id], [r0].[Id], [r1].[RootEntityId], [r2].[AssociateTypeRootEntityId], [r3].[AssociateTypeRootEntityId], [r4].[AssociateTypeRootEntityId] +ORDER BY [r].[Id], [r1].[RootEntityId], [r2].[AssociateTypeRootEntityId], [r3].[AssociateTypeRootEntityId], [r4].[AssociateTypeRootEntityId] """); } } @@ -422,7 +422,7 @@ public override async Task Select_subquery_FirstOrDefault_complex_collection(Que { AssertSql( """ -SELECT [r].[Id], [r5].[Id], [s].[RootEntityId], [s].[Id], [s].[Int], [s].[Ints], [s].[Name], [s].[String], [s].[AssociateTypeRootEntityId], [s].[AssociateTypeId], [s].[AssociateTypeRootEntityId0], [s].[AssociateTypeId0], [s].[AssociateTypeRootEntityId1], [s].[AssociateTypeId1], [s].[Id0], [s].[Int0], [s].[Ints0], [s].[Name0], [s].[String0], [s].[Id1], [s].[Int1], [s].[Ints1], [s].[Name1], [s].[String1], [s].[Id2], [s].[Int2], [s].[Ints2], [s].[Name2], [s].[String2], [r5].[c] +SELECT [r].[Id], [s].[RootEntityId], [s].[Id], [s].[Int], [s].[Ints], [s].[Name], [s].[String], [s].[AssociateTypeRootEntityId], [s].[AssociateTypeId], [s].[AssociateTypeRootEntityId0], [s].[AssociateTypeId0], [s].[AssociateTypeRootEntityId1], [s].[AssociateTypeId1], [s].[Id0], [s].[Int0], [s].[Ints0], [s].[Name0], [s].[String0], [s].[Id1], [s].[Int1], [s].[Ints1], [s].[Name1], [s].[String1], [s].[Id2], [s].[Int2], [s].[Ints2], [s].[Name2], [s].[String2], [r5].[c] FROM [RootEntity] AS [r] OUTER APPLY ( SELECT TOP(1) 1 AS [c], [r0].[Id] @@ -436,7 +436,7 @@ FROM [RelatedCollection] AS [r1] LEFT JOIN [RelatedCollection_RequiredNested] AS [r3] ON [r1].[RootEntityId] = [r3].[AssociateTypeRootEntityId] AND [r1].[Id] = [r3].[AssociateTypeId] LEFT JOIN [RelatedCollection_NestedCollection] AS [r4] ON [r1].[RootEntityId] = [r4].[AssociateTypeRootEntityId] AND [r1].[Id] = [r4].[AssociateTypeId] ) AS [s] ON [r5].[Id] = [s].[RootEntityId] -ORDER BY [r].[Id], [r5].[Id], [s].[RootEntityId], [s].[Id], [s].[AssociateTypeRootEntityId], [s].[AssociateTypeId], [s].[AssociateTypeRootEntityId0], [s].[AssociateTypeId0], [s].[AssociateTypeRootEntityId1], [s].[AssociateTypeId1] +ORDER BY [r].[Id], [s].[RootEntityId], [s].[Id], [s].[AssociateTypeRootEntityId], [s].[AssociateTypeId], [s].[AssociateTypeRootEntityId0], [s].[AssociateTypeId0], [s].[AssociateTypeRootEntityId1], [s].[AssociateTypeId1] """); } } diff --git a/test/EFCore.SqlServer.FunctionalTests/Query/Associations/OwnedTableSplitting/OwnedTableSplittingProjectionSqlServerTest.cs b/test/EFCore.SqlServer.FunctionalTests/Query/Associations/OwnedTableSplitting/OwnedTableSplittingProjectionSqlServerTest.cs index 7ac9f81e98e..887c458bf6d 100644 --- a/test/EFCore.SqlServer.FunctionalTests/Query/Associations/OwnedTableSplitting/OwnedTableSplittingProjectionSqlServerTest.cs +++ b/test/EFCore.SqlServer.FunctionalTests/Query/Associations/OwnedTableSplitting/OwnedTableSplittingProjectionSqlServerTest.cs @@ -179,7 +179,7 @@ public override async Task Select_required_associate_via_optional_navigation(Que FROM [RootReferencingEntity] AS [r] LEFT JOIN [RootEntity] AS [r0] ON [r].[RootEntityId] = [r0].[Id] LEFT JOIN [RequiredRelated_NestedCollection] AS [r1] ON [r0].[Id] = [r1].[AssociateTypeRootEntityId] -ORDER BY [r].[Id], [r0].[Id], [r1].[AssociateTypeRootEntityId] +ORDER BY [r].[Id], [r1].[AssociateTypeRootEntityId] """); } } @@ -380,7 +380,7 @@ public override async Task Select_subquery_FirstOrDefault_complex_collection(Que { AssertSql( """ -SELECT [r].[Id], [r3].[Id], [s].[RootEntityId], [s].[Id], [s].[Int], [s].[Ints], [s].[Name], [s].[String], [s].[AssociateTypeRootEntityId], [s].[AssociateTypeId], [s].[Id0], [s].[Int0], [s].[Ints0], [s].[Name0], [s].[String0], [s].[OptionalNestedAssociate_Id], [s].[OptionalNestedAssociate_Int], [s].[OptionalNestedAssociate_Ints], [s].[OptionalNestedAssociate_Name], [s].[OptionalNestedAssociate_String], [s].[RequiredNestedAssociate_Id], [s].[RequiredNestedAssociate_Int], [s].[RequiredNestedAssociate_Ints], [s].[RequiredNestedAssociate_Name], [s].[RequiredNestedAssociate_String], [r3].[c] +SELECT [r].[Id], [s].[RootEntityId], [s].[Id], [s].[Int], [s].[Ints], [s].[Name], [s].[String], [s].[AssociateTypeRootEntityId], [s].[AssociateTypeId], [s].[Id0], [s].[Int0], [s].[Ints0], [s].[Name0], [s].[String0], [s].[OptionalNestedAssociate_Id], [s].[OptionalNestedAssociate_Int], [s].[OptionalNestedAssociate_Ints], [s].[OptionalNestedAssociate_Name], [s].[OptionalNestedAssociate_String], [s].[RequiredNestedAssociate_Id], [s].[RequiredNestedAssociate_Int], [s].[RequiredNestedAssociate_Ints], [s].[RequiredNestedAssociate_Name], [s].[RequiredNestedAssociate_String], [r3].[c] FROM [RootEntity] AS [r] OUTER APPLY ( SELECT TOP(1) 1 AS [c], [r0].[Id] @@ -392,7 +392,7 @@ LEFT JOIN ( FROM [RelatedCollection] AS [r1] LEFT JOIN [RelatedCollection_NestedCollection] AS [r2] ON [r1].[RootEntityId] = [r2].[AssociateTypeRootEntityId] AND [r1].[Id] = [r2].[AssociateTypeId] ) AS [s] ON [r3].[Id] = [s].[RootEntityId] -ORDER BY [r].[Id], [r3].[Id], [s].[RootEntityId], [s].[Id], [s].[AssociateTypeRootEntityId], [s].[AssociateTypeId] +ORDER BY [r].[Id], [s].[RootEntityId], [s].[Id], [s].[AssociateTypeRootEntityId], [s].[AssociateTypeId] """); } } diff --git a/test/EFCore.SqlServer.FunctionalTests/Query/ComplexNavigationsCollectionsQuerySqlServerTest.cs b/test/EFCore.SqlServer.FunctionalTests/Query/ComplexNavigationsCollectionsQuerySqlServerTest.cs index e3d172f871e..e8955bd48ac 100644 --- a/test/EFCore.SqlServer.FunctionalTests/Query/ComplexNavigationsCollectionsQuerySqlServerTest.cs +++ b/test/EFCore.SqlServer.FunctionalTests/Query/ComplexNavigationsCollectionsQuerySqlServerTest.cs @@ -58,7 +58,7 @@ FROM [LevelThree] AS [l1] LEFT JOIN [LevelThree] AS [l3] ON [l2].[Id] = [l3].[OneToMany_Optional_Inverse3Id] ) AS [s] ON [l0].[Id] = [s].[OneToMany_Optional_Inverse3Id] ) AS [s0] ON [l].[Id] = [s0].[OneToMany_Optional_Inverse2Id] -ORDER BY [l].[Id], [s0].[Id], [s0].[Id0], [s0].[Id00] +ORDER BY [l].[Id], [s0].[Id], [s0].[Id0] """); } @@ -77,7 +77,7 @@ LEFT JOIN ( FROM [LevelTwo] AS [l2] LEFT JOIN [LevelThree] AS [l3] ON [l2].[Id] = [l3].[Level2_Optional_Id] ) AS [s] ON [l].[Id] = [s].[OneToMany_Optional_Inverse2Id] -ORDER BY [l].[Id], [l0].[Id], [l1].[Id], [s].[Id] +ORDER BY [l].[Id], [l1].[Id] """); } @@ -96,7 +96,7 @@ LEFT JOIN ( FROM [LevelOne] AS [l2] LEFT JOIN [LevelOne] AS [l3] ON [l2].[OneToOne_Optional_Self1Id] = [l3].[Id] ) AS [s] ON [l].[Id] = [s].[OneToMany_Optional_Self_Inverse1Id] -ORDER BY [l].[Id], [l0].[Id], [l1].[Id], [s].[Id] +ORDER BY [l].[Id], [l1].[Id] """); } @@ -110,7 +110,7 @@ public override async Task Include_reference_and_collection_order_by(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].[OneToMany_Optional_Inverse3Id] -ORDER BY [l].[Name], [l].[Id], [l0].[Id] +ORDER BY [l].[Name], [l].[Id] """); } @@ -124,7 +124,7 @@ public override async Task Include_reference_ThenInclude_collection_order_by(boo 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].[OneToMany_Optional_Inverse3Id] -ORDER BY [l].[Name], [l].[Id], [l0].[Id] +ORDER BY [l].[Name], [l].[Id] """); } @@ -141,7 +141,7 @@ LEFT JOIN ( FROM [LevelTwo] AS [l0] LEFT JOIN [LevelThree] AS [l1] ON [l0].[Id] = [l1].[Level2_Optional_Id] ) AS [s] ON [l].[Id] = [s].[OneToMany_Optional_Inverse2Id] -ORDER BY [l].[Id], [s].[Id] +ORDER BY [l].[Id] """); } @@ -176,7 +176,7 @@ LEFT JOIN ( FROM [LevelTwo] AS [l2] LEFT JOIN [LevelThree] AS [l3] ON [l2].[Id] = [l3].[Level2_Optional_Id] ) AS [s] ON [l].[Id] = [s].[OneToMany_Optional_Inverse2Id] -ORDER BY [l].[Id], [l0].[Id], [l1].[Id], [s].[Id] +ORDER BY [l].[Id], [l1].[Id] """); } @@ -195,7 +195,7 @@ FROM [LevelThree] AS [l1] LEFT JOIN [LevelFour] AS [l2] ON [l1].[Id] = [l2].[Level3_Required_Id] ) AS [s] ON [l0].[Id] = [s].[OneToMany_Required_Inverse3Id] WHERE [l0].[Name] <> N'L2 09' OR [l0].[Name] IS NULL -ORDER BY [l].[Id], [l0].[Id], [s].[Id] +ORDER BY [l].[Id] """); } @@ -218,7 +218,7 @@ OFFSET @p ROWS FETCH NEXT @p1 ROWS ONLY LEFT JOIN [LevelTwo] AS [l0] ON [l1].[Id] = [l0].[Level1_Required_Id] LEFT JOIN [LevelThree] AS [l2] ON [l0].[Id] = [l2].[OneToMany_Optional_Inverse3Id] LEFT JOIN [LevelThree] AS [l3] ON [l0].[Id] = [l3].[OneToMany_Required_Inverse3Id] -ORDER BY [l1].[Name], [l1].[Id], [l0].[Id], [l2].[Id] +ORDER BY [l1].[Name], [l1].[Id], [l2].[Id] """); } @@ -231,7 +231,7 @@ public override async Task Complex_multi_include_with_order_by_and_paging_joins_ @p='0' @p1='10' -SELECT [l1].[Id], [l1].[Date], [l1].[Name], [l1].[OneToMany_Optional_Self_Inverse1Id], [l1].[OneToMany_Required_Self_Inverse1Id], [l1].[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], [l2].[Id], [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], [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], [l4].[Id], [l4].[Level2_Optional_Id], [l4].[Level2_Required_Id], [l4].[Name], [l4].[OneToMany_Optional_Inverse3Id], [l4].[OneToMany_Optional_Self_Inverse3Id], [l4].[OneToMany_Required_Inverse3Id], [l4].[OneToMany_Required_Self_Inverse3Id], [l4].[OneToOne_Optional_PK_Inverse3Id], [l4].[OneToOne_Optional_Self3Id] +SELECT [l1].[Id], [l1].[Date], [l1].[Name], [l1].[OneToMany_Optional_Self_Inverse1Id], [l1].[OneToMany_Required_Self_Inverse1Id], [l1].[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], [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], [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], [l4].[Id], [l4].[Level2_Optional_Id], [l4].[Level2_Required_Id], [l4].[Name], [l4].[OneToMany_Optional_Inverse3Id], [l4].[OneToMany_Optional_Self_Inverse3Id], [l4].[OneToMany_Required_Inverse3Id], [l4].[OneToMany_Required_Self_Inverse3Id], [l4].[OneToOne_Optional_PK_Inverse3Id], [l4].[OneToOne_Optional_Self3Id] FROM ( 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] @@ -242,7 +242,7 @@ OFFSET @p ROWS FETCH NEXT @p1 ROWS ONLY LEFT JOIN [LevelTwo] AS [l2] ON [l1].[Id] = [l2].[Level1_Required_Id] LEFT JOIN [LevelThree] AS [l3] ON [l0].[Id] = [l3].[OneToMany_Optional_Inverse3Id] LEFT JOIN [LevelThree] AS [l4] ON [l2].[Id] = [l4].[OneToMany_Required_Inverse3Id] -ORDER BY [l1].[Name], [l1].[Id], [l0].[Id], [l2].[Id], [l3].[Id] +ORDER BY [l1].[Name], [l1].[Id], [l3].[Id] """); } @@ -265,7 +265,7 @@ OFFSET @p ROWS FETCH NEXT @p1 ROWS ONLY LEFT JOIN [LevelTwo] AS [l0] ON [l1].[Id] = [l0].[Level1_Optional_Id] LEFT JOIN [LevelThree] AS [l2] ON [l0].[Id] = [l2].[Level2_Required_Id] LEFT JOIN [LevelFour] AS [l3] ON [l2].[Id] = [l3].[OneToMany_Optional_Inverse4Id] -ORDER BY [l1].[Name], [l1].[Id], [l0].[Id], [l2].[Id] +ORDER BY [l1].[Name], [l1].[Id] """); } @@ -275,7 +275,7 @@ public override async Task Multiple_include_with_multiple_optional_navigations(b AssertSql( """ -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], [l1].[Id], [l2].[Id], [l3].[Id], [l4].[Id], [l5].[Id], [l5].[Level2_Optional_Id], [l5].[Level2_Required_Id], [l5].[Name], [l5].[OneToMany_Optional_Inverse3Id], [l5].[OneToMany_Optional_Self_Inverse3Id], [l5].[OneToMany_Required_Inverse3Id], [l5].[OneToMany_Required_Self_Inverse3Id], [l5].[OneToOne_Optional_PK_Inverse3Id], [l5].[OneToOne_Optional_Self3Id], [l2].[Level2_Optional_Id], [l2].[Level2_Required_Id], [l2].[Name], [l2].[OneToMany_Optional_Inverse3Id], [l2].[OneToMany_Optional_Self_Inverse3Id], [l2].[OneToMany_Required_Inverse3Id], [l2].[OneToMany_Required_Self_Inverse3Id], [l2].[OneToOne_Optional_PK_Inverse3Id], [l2].[OneToOne_Optional_Self3Id], [l3].[Date], [l3].[Level1_Optional_Id], [l3].[Level1_Required_Id], [l3].[Name], [l3].[OneToMany_Optional_Inverse2Id], [l3].[OneToMany_Optional_Self_Inverse2Id], [l3].[OneToMany_Required_Inverse2Id], [l3].[OneToMany_Required_Self_Inverse2Id], [l3].[OneToOne_Optional_PK_Inverse2Id], [l3].[OneToOne_Optional_Self2Id], [l4].[Level2_Optional_Id], [l4].[Level2_Required_Id], [l4].[Name], [l4].[OneToMany_Optional_Inverse3Id], [l4].[OneToMany_Optional_Self_Inverse3Id], [l4].[OneToMany_Required_Inverse3Id], [l4].[OneToMany_Required_Self_Inverse3Id], [l4].[OneToOne_Optional_PK_Inverse3Id], [l4].[OneToOne_Optional_Self3Id] +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], [l5].[Id], [l5].[Level2_Optional_Id], [l5].[Level2_Required_Id], [l5].[Name], [l5].[OneToMany_Optional_Inverse3Id], [l5].[OneToMany_Optional_Self_Inverse3Id], [l5].[OneToMany_Required_Inverse3Id], [l5].[OneToMany_Required_Self_Inverse3Id], [l5].[OneToOne_Optional_PK_Inverse3Id], [l5].[OneToOne_Optional_Self3Id], [l2].[Id], [l2].[Level2_Optional_Id], [l2].[Level2_Required_Id], [l2].[Name], [l2].[OneToMany_Optional_Inverse3Id], [l2].[OneToMany_Optional_Self_Inverse3Id], [l2].[OneToMany_Required_Inverse3Id], [l2].[OneToMany_Required_Self_Inverse3Id], [l2].[OneToOne_Optional_PK_Inverse3Id], [l2].[OneToOne_Optional_Self3Id], [l3].[Id], [l3].[Date], [l3].[Level1_Optional_Id], [l3].[Level1_Required_Id], [l3].[Name], [l3].[OneToMany_Optional_Inverse2Id], [l3].[OneToMany_Optional_Self_Inverse2Id], [l3].[OneToMany_Required_Inverse2Id], [l3].[OneToMany_Required_Self_Inverse2Id], [l3].[OneToOne_Optional_PK_Inverse2Id], [l3].[OneToOne_Optional_Self2Id], [l4].[Id], [l4].[Level2_Optional_Id], [l4].[Level2_Required_Id], [l4].[Name], [l4].[OneToMany_Optional_Inverse3Id], [l4].[OneToMany_Optional_Self_Inverse3Id], [l4].[OneToMany_Required_Inverse3Id], [l4].[OneToMany_Required_Self_Inverse3Id], [l4].[OneToOne_Optional_PK_Inverse3Id], [l4].[OneToOne_Optional_Self3Id] 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].[OneToOne_Optional_PK_Inverse3Id] @@ -284,7 +284,7 @@ FROM [LevelOne] AS [l] 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 -ORDER BY [l].[Id], [l0].[Id], [l1].[Id], [l2].[Id], [l3].[Id], [l4].[Id] +ORDER BY [l].[Id] """); } @@ -340,7 +340,7 @@ FROM [LevelOne] AS [l] INNER JOIN [LevelTwo] AS [l0] ON [l].[Id] = [l0].[OneToMany_Optional_Inverse2Id] LEFT JOIN [LevelThree] AS [l1] ON [l0].[Id] = [l1].[Level2_Required_Id] LEFT JOIN [LevelFour] AS [l2] ON [l1].[Id] = [l2].[OneToMany_Optional_Inverse4Id] -ORDER BY [l].[Id], [l0].[Id], [l1].[Id] +ORDER BY [l].[Id], [l0].[Id] """); } @@ -356,7 +356,7 @@ FROM [LevelOne] AS [l] INNER JOIN [LevelThree] AS [l1] ON [l0].[Id] = [l1].[OneToMany_Optional_Inverse3Id] LEFT JOIN [LevelFour] AS [l2] ON [l1].[Id] = [l2].[Level3_Required_Id] LEFT JOIN [LevelFour] AS [l3] ON [l1].[Id] = [l3].[OneToMany_Optional_Inverse4Id] -ORDER BY [l].[Id], [l0].[Id], [l1].[Id], [l2].[Id] +ORDER BY [l].[Id], [l0].[Id], [l1].[Id] """); } @@ -401,7 +401,7 @@ LEFT JOIN ( FROM [LevelThree] AS [l1] LEFT JOIN [LevelFour] AS [l2] ON [l1].[Id] = [l2].[Level3_Optional_Id] ) AS [s] ON [l0].[Id] = [s].[OneToMany_Optional_Inverse3Id] -ORDER BY [l].[Id], [l0].[Id], [s].[Id] +ORDER BY [l].[Id] """); } @@ -415,7 +415,7 @@ public override async Task Optional_navigation_with_order_by_and_Include(bool as 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].[OneToMany_Optional_Inverse3Id] -ORDER BY [l0].[Name], [l].[Id], [l0].[Id] +ORDER BY [l0].[Name], [l].[Id] """); } @@ -429,7 +429,7 @@ public override async Task Optional_navigation_with_Include_and_order(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].[OneToMany_Optional_Inverse3Id] -ORDER BY [l0].[Name], [l].[Id], [l0].[Id] +ORDER BY [l0].[Name], [l].[Id] """); } @@ -503,20 +503,20 @@ await base.Complex_SelectMany_with_nested_navigations_and_explicit_DefaultIfEmpt AssertSql( """ -SELECT [l2].[Id], [l2].[Level3_Optional_Id], [l2].[Level3_Required_Id], [l2].[Name], [l2].[OneToMany_Optional_Inverse4Id], [l2].[OneToMany_Optional_Self_Inverse4Id], [l2].[OneToMany_Required_Inverse4Id], [l2].[OneToMany_Required_Self_Inverse4Id], [l2].[OneToOne_Optional_PK_Inverse4Id], [l2].[OneToOne_Optional_Self4Id], [l].[Id], [l0].[Id], [l1].[Id], [s].[Id], [s].[Id0], [s].[Id1], [s].[Id2], [s0].[Id], [s0].[Id0], [s0].[Id1], [s0].[Id2], [l11].[Id], [l12].[Id], [l13].[Id], [l14].[Id], [l16].[Id], [l16].[Date], [l16].[Level1_Optional_Id], [l16].[Level1_Required_Id], [l16].[Name], [l16].[OneToMany_Optional_Inverse2Id], [l16].[OneToMany_Optional_Self_Inverse2Id], [l16].[OneToMany_Required_Inverse2Id], [l16].[OneToMany_Required_Self_Inverse2Id], [l16].[OneToOne_Optional_PK_Inverse2Id], [l16].[OneToOne_Optional_Self2Id], [l14].[Name] +SELECT [l2].[Id], [l2].[Level3_Optional_Id], [l2].[Level3_Required_Id], [l2].[Name], [l2].[OneToMany_Optional_Inverse4Id], [l2].[OneToMany_Optional_Self_Inverse4Id], [l2].[OneToMany_Required_Inverse4Id], [l2].[OneToMany_Required_Self_Inverse4Id], [l2].[OneToOne_Optional_PK_Inverse4Id], [l2].[OneToOne_Optional_Self4Id], [l].[Id], [s].[Id], [s].[Id2], [s0].[Id], [s0].[Id2], [l16].[Id], [l16].[Date], [l16].[Level1_Optional_Id], [l16].[Level1_Required_Id], [l16].[Name], [l16].[OneToMany_Optional_Inverse2Id], [l16].[OneToMany_Optional_Self_Inverse2Id], [l16].[OneToMany_Required_Inverse2Id], [l16].[OneToMany_Required_Self_Inverse2Id], [l16].[OneToOne_Optional_PK_Inverse2Id], [l16].[OneToOne_Optional_Self2Id], [l14].[Name] 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_Optional_Id] LEFT JOIN [LevelFour] AS [l2] ON [l1].[Id] = [l2].[OneToMany_Required_Inverse4Id] INNER JOIN ( - SELECT [l3].[Id], [l4].[Id] AS [Id0], [l5].[Id] AS [Id1], [l6].[Id] AS [Id2] + SELECT [l3].[Id], [l6].[Id] AS [Id2] FROM [LevelFour] AS [l3] INNER JOIN [LevelThree] AS [l4] ON [l3].[Level3_Required_Id] = [l4].[Id] LEFT JOIN [LevelTwo] AS [l5] ON [l4].[Level2_Optional_Id] = [l5].[Id] LEFT JOIN [LevelTwo] AS [l6] ON [l5].[Id] = [l6].[OneToMany_Required_Self_Inverse2Id] ) AS [s] ON [l2].[Id] = [s].[Id2] LEFT JOIN ( - SELECT [l7].[Id], [l8].[Id] AS [Id0], [l9].[Id] AS [Id1], [l10].[Id] AS [Id2], [l10].[Level2_Optional_Id] AS [Level2_Optional_Id0] + SELECT [l7].[Id], [l10].[Id] AS [Id2], [l10].[Level2_Optional_Id] AS [Level2_Optional_Id0] FROM [LevelFour] AS [l7] INNER JOIN [LevelThree] AS [l8] ON [l7].[Level3_Required_Id] = [l8].[Id] INNER JOIN [LevelTwo] AS [l9] ON [l8].[Level2_Required_Id] = [l9].[Id] @@ -532,7 +532,7 @@ FROM [LevelTwo] AS [l15] WHERE [l15].[Id] <> 42 ) AS [l16] ON [s].[Id2] = [l16].[OneToMany_Optional_Self_Inverse2Id] WHERE [l11].[Name] <> N'Foo' OR [l11].[Name] IS NULL -ORDER BY [l12].[Id], [l].[Id], [l0].[Id], [l1].[Id], [l2].[Id], [s].[Id], [s].[Id0], [s].[Id1], [s].[Id2], [s0].[Id], [s0].[Id0], [s0].[Id1], [s0].[Id2], [l11].[Id], [l13].[Id], [l14].[Id] +ORDER BY [l12].[Id], [l].[Id], [l2].[Id], [s].[Id], [s].[Id2], [s0].[Id], [s0].[Id2] """); } @@ -555,11 +555,11 @@ public override async Task Project_collection_navigation_nested(bool async) AssertSql( """ -SELECT [l].[Id], [l0].[Id], [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] +SELECT [l].[Id], [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 [LevelOne] AS [l] LEFT JOIN [LevelTwo] AS [l0] ON [l].[Id] = [l0].[Level1_Optional_Id] LEFT JOIN [LevelThree] AS [l1] ON [l0].[Id] = [l1].[OneToMany_Optional_Inverse3Id] -ORDER BY [l].[Id], [l0].[Id] +ORDER BY [l].[Id] """); } @@ -569,11 +569,11 @@ public override async Task Project_collection_navigation_using_ef_property(bool AssertSql( """ -SELECT [l].[Id], [l0].[Id], [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] +SELECT [l].[Id], [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 [LevelOne] AS [l] LEFT JOIN [LevelTwo] AS [l0] ON [l].[Id] = [l0].[Level1_Optional_Id] LEFT JOIN [LevelThree] AS [l1] ON [l0].[Id] = [l1].[OneToMany_Optional_Inverse3Id] -ORDER BY [l].[Id], [l0].[Id] +ORDER BY [l].[Id] """); } @@ -583,11 +583,11 @@ public override async Task Project_collection_navigation_nested_anonymous(bool a AssertSql( """ -SELECT [l].[Id], [l0].[Id], [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] +SELECT [l].[Id], [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 [LevelOne] AS [l] LEFT JOIN [LevelTwo] AS [l0] ON [l].[Id] = [l0].[Level1_Optional_Id] LEFT JOIN [LevelThree] AS [l1] ON [l0].[Id] = [l1].[OneToMany_Optional_Inverse3Id] -ORDER BY [l].[Id], [l0].[Id] +ORDER BY [l].[Id] """); } @@ -646,7 +646,7 @@ public override async Task Project_navigation_and_collection(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].[OneToMany_Optional_Inverse3Id] -ORDER BY [l].[Id], [l0].[Id] +ORDER BY [l].[Id] """); } @@ -755,7 +755,7 @@ FROM [LevelOne] AS [l0] WHERE [l3].[row] <= 1 ) AS [l4] ON [l2].[Name] = [l4].[Name] LEFT JOIN [LevelTwo] AS [l1] ON [l4].[Id] = [l1].[OneToMany_Optional_Inverse2Id] -ORDER BY [l2].[Name], [l4].[Id] +ORDER BY [l2].[Name] """); } @@ -782,7 +782,7 @@ WHERE [l0].[Id] > 3 WHERE [l3].[row] <= 1 ) AS [l4] ON [l2].[Name] = [l4].[Name] LEFT JOIN [LevelTwo] AS [l1] ON [l4].[Id] = [l1].[OneToMany_Optional_Inverse2Id] -ORDER BY [l2].[Name], [l4].[Id] +ORDER BY [l2].[Name] """); } @@ -808,7 +808,7 @@ FROM [LevelOne] AS [l0] WHERE [l3].[row] <= 1 ) AS [l4] ON [l2].[Name] = [l4].[Name] LEFT JOIN [LevelTwo] AS [l1] ON [l4].[Id] = [l1].[OneToMany_Optional_Inverse2Id] -ORDER BY [l2].[Name], [l4].[Id] +ORDER BY [l2].[Name] """); } @@ -852,7 +852,7 @@ FROM [LevelOne] AS [l] INNER JOIN [LevelThree] AS [l1] ON [l0].[Id] = [l1].[OneToMany_Optional_Inverse3Id] LEFT JOIN [LevelFour] AS [l2] ON [l1].[Id] = [l2].[Level3_Required_Id] LEFT JOIN [LevelFour] AS [l3] ON [l2].[Id] = [l3].[OneToMany_Required_Self_Inverse4Id] -ORDER BY [l].[Id], [l0].[Id], [l1].[Id], [l2].[Id] +ORDER BY [l].[Id], [l0].[Id], [l1].[Id] """); } @@ -862,13 +862,13 @@ public override async Task Include_after_SelectMany_and_multiple_reference_navig AssertSql( """ -SELECT [l2].[Id], [l2].[Level3_Optional_Id], [l2].[Level3_Required_Id], [l2].[Name], [l2].[OneToMany_Optional_Inverse4Id], [l2].[OneToMany_Optional_Self_Inverse4Id], [l2].[OneToMany_Required_Inverse4Id], [l2].[OneToMany_Required_Self_Inverse4Id], [l2].[OneToOne_Optional_PK_Inverse4Id], [l2].[OneToOne_Optional_Self4Id], [l].[Id], [l0].[Id], [l1].[Id], [l3].[Id], [l3].[Level3_Optional_Id], [l3].[Level3_Required_Id], [l3].[Name], [l3].[OneToMany_Optional_Inverse4Id], [l3].[OneToMany_Optional_Self_Inverse4Id], [l3].[OneToMany_Required_Inverse4Id], [l3].[OneToMany_Required_Self_Inverse4Id], [l3].[OneToOne_Optional_PK_Inverse4Id], [l3].[OneToOne_Optional_Self4Id] +SELECT [l2].[Id], [l2].[Level3_Optional_Id], [l2].[Level3_Required_Id], [l2].[Name], [l2].[OneToMany_Optional_Inverse4Id], [l2].[OneToMany_Optional_Self_Inverse4Id], [l2].[OneToMany_Required_Inverse4Id], [l2].[OneToMany_Required_Self_Inverse4Id], [l2].[OneToOne_Optional_PK_Inverse4Id], [l2].[OneToOne_Optional_Self4Id], [l].[Id], [l0].[Id], [l3].[Id], [l3].[Level3_Optional_Id], [l3].[Level3_Required_Id], [l3].[Name], [l3].[OneToMany_Optional_Inverse4Id], [l3].[OneToMany_Optional_Self_Inverse4Id], [l3].[OneToMany_Required_Inverse4Id], [l3].[OneToMany_Required_Self_Inverse4Id], [l3].[OneToOne_Optional_PK_Inverse4Id], [l3].[OneToOne_Optional_Self4Id] FROM [LevelOne] AS [l] INNER JOIN [LevelTwo] AS [l0] ON [l].[Id] = [l0].[OneToMany_Required_Inverse2Id] LEFT JOIN [LevelThree] AS [l1] ON [l0].[Id] = [l1].[Level2_Optional_Id] LEFT JOIN [LevelFour] AS [l2] ON [l1].[Id] = [l2].[Level3_Required_Id] LEFT JOIN [LevelFour] AS [l3] ON [l2].[Id] = [l3].[OneToMany_Optional_Self_Inverse4Id] -ORDER BY [l].[Id], [l0].[Id], [l1].[Id], [l2].[Id] +ORDER BY [l].[Id], [l0].[Id] """); } @@ -878,17 +878,17 @@ public override async Task Null_check_in_anonymous_type_projection_should_not_be AssertSql( """ -SELECT [l].[Id], [s].[c], [s].[Name], [s].[Id], [s].[Id0] +SELECT [l].[Id], [s].[c], [s].[Name], [s].[Id] FROM [LevelOne] AS [l] LEFT JOIN ( SELECT CASE WHEN [l1].[Id] IS NULL THEN CAST(1 AS bit) ELSE CAST(0 AS bit) - END AS [c], [l1].[Name], [l0].[Id], [l1].[Id] AS [Id0], [l0].[OneToMany_Optional_Inverse2Id] + END AS [c], [l1].[Name], [l0].[Id], [l0].[OneToMany_Optional_Inverse2Id] FROM [LevelTwo] AS [l0] LEFT JOIN [LevelThree] AS [l1] ON [l0].[Id] = [l1].[Level2_Required_Id] ) AS [s] ON [l].[Id] = [s].[OneToMany_Optional_Inverse2Id] -ORDER BY [l].[Id], [s].[Id] +ORDER BY [l].[Id] """); } @@ -898,17 +898,17 @@ public override async Task Null_check_in_Dto_projection_should_not_be_removed(bo AssertSql( """ -SELECT [l].[Id], [s].[c], [s].[Name], [s].[Id], [s].[Id0] +SELECT [l].[Id], [s].[c], [s].[Name], [s].[Id] FROM [LevelOne] AS [l] LEFT JOIN ( SELECT CASE WHEN [l1].[Id] IS NULL THEN CAST(1 AS bit) ELSE CAST(0 AS bit) - END AS [c], [l1].[Name], [l0].[Id], [l1].[Id] AS [Id0], [l0].[OneToMany_Optional_Inverse2Id] + END AS [c], [l1].[Name], [l0].[Id], [l0].[OneToMany_Optional_Inverse2Id] FROM [LevelTwo] AS [l0] LEFT JOIN [LevelThree] AS [l1] ON [l0].[Id] = [l1].[Level2_Required_Id] ) AS [s] ON [l].[Id] = [s].[OneToMany_Optional_Inverse2Id] -ORDER BY [l].[Id], [s].[Id] +ORDER BY [l].[Id] """); } @@ -982,7 +982,7 @@ LEFT JOIN ( FROM [LevelTwo] AS [l0] LEFT JOIN [LevelThree] AS [l1] ON [l0].[Id] = [l1].[OneToOne_Optional_PK_Inverse3Id] ) AS [s] ON [l].[Id] = [s].[OneToMany_Optional_Inverse2Id] -ORDER BY [l].[Id], [s].[Id] +ORDER BY [l].[Id] """); } @@ -996,7 +996,7 @@ public override async Task Include_reference_followed_by_include_collection(bool 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].[OneToMany_Optional_Inverse3Id] -ORDER BY [l].[Id], [l0].[Id] +ORDER BY [l].[Id] """); } @@ -1026,7 +1026,7 @@ LEFT JOIN ( FROM [LevelTwo] AS [l0] LEFT JOIN [LevelThree] AS [l1] ON [l0].[Id] = [l1].[OneToOne_Optional_PK_Inverse3Id] ) AS [s] ON [l].[Id] = [s].[OneToMany_Optional_Inverse2Id] -ORDER BY [l].[Id], [s].[Id] +ORDER BY [l].[Id] """); } @@ -1044,7 +1044,7 @@ FROM [LevelTwo] AS [l0] LEFT JOIN [LevelThree] AS [l1] ON [l0].[Id] = [l1].[OneToOne_Optional_PK_Inverse3Id] LEFT JOIN [LevelFour] AS [l2] ON [l1].[Id] = [l2].[Level3_Optional_Id] ) AS [s] ON [l].[Id] = [s].[OneToMany_Optional_Inverse2Id] -ORDER BY [l].[Id], [s].[Id], [s].[Id0] +ORDER BY [l].[Id] """); } @@ -1062,7 +1062,7 @@ FROM [LevelTwo] AS [l0] LEFT JOIN [LevelThree] AS [l1] ON [l0].[Id] = [l1].[OneToOne_Optional_PK_Inverse3Id] LEFT JOIN [LevelFour] AS [l2] ON [l1].[Id] = [l2].[Level3_Optional_Id] ) AS [s] ON [l].[Id] = [s].[OneToMany_Optional_Inverse2Id] -ORDER BY [l].[Id], [s].[Id], [s].[Id0] +ORDER BY [l].[Id] """); } @@ -1082,7 +1082,7 @@ FROM [LevelTwo] AS [l0] LEFT JOIN [LevelThree] AS [l3] ON [l0].[Id] = [l3].[Level2_Optional_Id] LEFT JOIN [LevelFour] AS [l4] ON [l3].[Id] = [l4].[OneToMany_Optional_Inverse4Id] ) AS [s] ON [l].[Id] = [s].[OneToMany_Optional_Inverse2Id] -ORDER BY [l].[Id], [s].[Id], [s].[Id0], [s].[Id1], [s].[Id2] +ORDER BY [l].[Id], [s].[Id] """); } @@ -1102,7 +1102,7 @@ FROM [LevelTwo] AS [l0] LEFT JOIN [LevelThree] AS [l3] ON [l0].[Id] = [l3].[Level2_Optional_Id] LEFT JOIN [LevelFour] AS [l4] ON [l3].[Id] = [l4].[OneToMany_Optional_Inverse4Id] ) AS [s] ON [l].[Id] = [s].[OneToMany_Optional_Inverse2Id] -ORDER BY [l].[Id], [s].[Id], [s].[Id0], [s].[Id1], [s].[Id2] +ORDER BY [l].[Id], [s].[Id] """); } @@ -1120,7 +1120,7 @@ FROM [LevelTwo] AS [l0] LEFT JOIN [LevelThree] AS [l1] ON [l0].[Id] = [l1].[OneToOne_Optional_PK_Inverse3Id] LEFT JOIN [LevelFour] AS [l2] ON [l1].[Id] = [l2].[Level3_Optional_Id] ) AS [s] ON [l].[Id] = [s].[OneToMany_Optional_Inverse2Id] -ORDER BY [l].[Id], [s].[Id1], [s].[Id] +ORDER BY [l].[Id] """); } @@ -1142,7 +1142,7 @@ LEFT JOIN ( FROM [LevelTwo] AS [l2] LEFT JOIN [LevelThree] AS [l3] ON [l2].[Id] = [l3].[OneToOne_Optional_PK_Inverse3Id] ) AS [s0] ON [l].[Id] = [s0].[OneToMany_Optional_Inverse2Id] -ORDER BY [l].[Id], [s].[Id], [s].[Id0], [s0].[Id] +ORDER BY [l].[Id], [s].[Id] """); } @@ -1165,7 +1165,7 @@ 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 -ORDER BY [l].[Id], [s].[Id], [s].[Id0] +ORDER BY [l].[Id] """); } @@ -1177,7 +1177,7 @@ public override async Task Lift_projection_mapping_when_pushing_down_subquery(bo """ @p='25' -SELECT [l2].[Id], [l4].[Id], [l1].[Id], [l4].[c] +SELECT [l2].[Id], [l1].[Id], [l4].[Id], [l4].[c] FROM ( SELECT TOP(@p) [l].[Id] FROM [LevelOne] AS [l] @@ -1191,7 +1191,7 @@ FROM [LevelTwo] AS [l0] WHERE [l3].[row] <= 1 ) AS [l4] ON [l2].[Id] = [l4].[OneToMany_Required_Inverse2Id] LEFT JOIN [LevelTwo] AS [l1] ON [l2].[Id] = [l1].[OneToMany_Required_Inverse2Id] -ORDER BY [l2].[Id], [l4].[Id] +ORDER BY [l2].[Id] """); } @@ -1206,7 +1206,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_Optional_Id] LEFT JOIN [LevelTwo] AS [l2] ON [l].[Id] = [l2].[OneToMany_Required_Inverse2Id] -ORDER BY [l].[Id], [l0].[Id], [l1].[Id] +ORDER BY [l].[Id] """); } @@ -1222,12 +1222,12 @@ public override async Task LeftJoin_with_Any_on_outer_source_and_projecting_coll SELECT CASE WHEN [l0].[Id] IS NULL THEN 0 ELSE [l0].[Id] -END, [l].[Id], [l0].[Id], [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] +END, [l].[Id], [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 [LevelOne] AS [l] LEFT JOIN [LevelTwo] AS [l0] ON [l].[Id] = [l0].[Level1_Required_Id] LEFT JOIN [LevelThree] AS [l1] ON [l0].[Id] = [l1].[OneToMany_Required_Inverse3Id] WHERE [l].[Name] IN (@validIds1, @validIds2) -ORDER BY [l].[Id], [l0].[Id] +ORDER BY [l].[Id] """); } @@ -1237,7 +1237,7 @@ public override async Task Select_subquery_single_nested_subquery(bool async) AssertSql( """ -SELECT [l].[Id], [l3].[Id], [l1].[Id], [l3].[c] +SELECT [l].[Id], [l1].[Id], [l3].[c] FROM [LevelOne] AS [l] LEFT JOIN ( SELECT [l2].[c], [l2].[Id], [l2].[OneToMany_Optional_Inverse2Id] @@ -1248,7 +1248,7 @@ FROM [LevelTwo] AS [l0] WHERE [l2].[row] <= 1 ) AS [l3] ON [l].[Id] = [l3].[OneToMany_Optional_Inverse2Id] LEFT JOIN [LevelThree] AS [l1] ON [l3].[Id] = [l1].[OneToMany_Optional_Inverse3Id] -ORDER BY [l].[Id], [l3].[Id], [l1].[Id] +ORDER BY [l].[Id], [l1].[Id] """); } @@ -1258,10 +1258,10 @@ public override async Task Select_subquery_single_nested_subquery2(bool async) AssertSql( """ -SELECT [l].[Id], [s].[Id], [s].[Id0], [s].[Id1], [s].[c] +SELECT [l].[Id], [s].[Id], [s].[Id0], [s].[c] FROM [LevelOne] AS [l] LEFT JOIN ( - SELECT [l0].[Id], [l4].[Id] AS [Id0], [l2].[Id] AS [Id1], [l4].[c], [l0].[OneToMany_Optional_Inverse2Id] + SELECT [l0].[Id], [l2].[Id] AS [Id0], [l4].[c], [l0].[OneToMany_Optional_Inverse2Id] FROM [LevelTwo] AS [l0] LEFT JOIN ( SELECT [l3].[c], [l3].[Id], [l3].[OneToMany_Optional_Inverse3Id] @@ -1273,7 +1273,7 @@ FROM [LevelThree] AS [l1] ) AS [l4] ON [l0].[Id] = [l4].[OneToMany_Optional_Inverse3Id] LEFT JOIN [LevelFour] AS [l2] ON [l4].[Id] = [l2].[OneToMany_Optional_Inverse4Id] ) AS [s] ON [l].[Id] = [s].[OneToMany_Optional_Inverse2Id] -ORDER BY [l].[Id], [s].[Id], [s].[Id0], [s].[Id1] +ORDER BY [l].[Id], [s].[Id], [s].[Id0] """); } @@ -1459,7 +1459,7 @@ WHERE [l1].[Name] <> N'Foo' OR [l1].[Name] IS NULL ) AS [l2] WHERE 1 < [l2].[row] AND [l2].[row] <= 4 ) AS [l3] ON [l0].[Id] = [l3].[OneToMany_Optional_Inverse3Id] -ORDER BY [l].[Id], [l0].[Id], [l3].[OneToMany_Optional_Inverse3Id], [l3].[Name] +ORDER BY [l].[Id], [l3].[OneToMany_Optional_Inverse3Id], [l3].[Name] """); } @@ -1481,7 +1481,7 @@ WHERE [l1].[Name] <> N'Foo' OR [l1].[Name] IS NULL ) AS [l2] WHERE 1 < [l2].[row] AND [l2].[row] <= 4 ) AS [l3] ON [l0].[Id] = [l3].[OneToMany_Optional_Inverse3Id] -ORDER BY [l].[Id], [l0].[Id], [l3].[OneToMany_Optional_Inverse3Id], [l3].[Name] +ORDER BY [l].[Id], [l3].[OneToMany_Optional_Inverse3Id], [l3].[Name] """); } @@ -1572,10 +1572,10 @@ public override async Task Filtered_include_same_filter_set_on_same_navigation_t AssertSql( """ -SELECT [l].[Id], [l].[Date], [l].[Name], [l].[OneToMany_Optional_Self_Inverse1Id], [l].[OneToMany_Required_Self_Inverse1Id], [l].[OneToOne_Optional_Self1Id], [s].[Id], [s].[Date], [s].[Level1_Optional_Id], [s].[Level1_Required_Id], [s].[Name], [s].[OneToMany_Optional_Inverse2Id], [s].[OneToMany_Optional_Self_Inverse2Id], [s].[OneToMany_Required_Inverse2Id], [s].[OneToMany_Required_Self_Inverse2Id], [s].[OneToOne_Optional_PK_Inverse2Id], [s].[OneToOne_Optional_Self2Id], [s].[Id0], [s].[Id1], [s].[Level2_Optional_Id], [s].[Level2_Required_Id], [s].[Name0], [s].[OneToMany_Optional_Inverse3Id], [s].[OneToMany_Optional_Self_Inverse3Id], [s].[OneToMany_Required_Inverse3Id], [s].[OneToMany_Required_Self_Inverse3Id], [s].[OneToOne_Optional_PK_Inverse3Id], [s].[OneToOne_Optional_Self3Id], [s].[Level2_Optional_Id0], [s].[Level2_Required_Id0], [s].[Name1], [s].[OneToMany_Optional_Inverse3Id0], [s].[OneToMany_Optional_Self_Inverse3Id0], [s].[OneToMany_Required_Inverse3Id0], [s].[OneToMany_Required_Self_Inverse3Id0], [s].[OneToOne_Optional_PK_Inverse3Id0], [s].[OneToOne_Optional_Self3Id0] +SELECT [l].[Id], [l].[Date], [l].[Name], [l].[OneToMany_Optional_Self_Inverse1Id], [l].[OneToMany_Required_Self_Inverse1Id], [l].[OneToOne_Optional_Self1Id], [s].[Id], [s].[Date], [s].[Level1_Optional_Id], [s].[Level1_Required_Id], [s].[Name], [s].[OneToMany_Optional_Inverse2Id], [s].[OneToMany_Optional_Self_Inverse2Id], [s].[OneToMany_Required_Inverse2Id], [s].[OneToMany_Required_Self_Inverse2Id], [s].[OneToOne_Optional_PK_Inverse2Id], [s].[OneToOne_Optional_Self2Id], [s].[Id0], [s].[Level2_Optional_Id], [s].[Level2_Required_Id], [s].[Name0], [s].[OneToMany_Optional_Inverse3Id], [s].[OneToMany_Optional_Self_Inverse3Id], [s].[OneToMany_Required_Inverse3Id], [s].[OneToMany_Required_Self_Inverse3Id], [s].[OneToOne_Optional_PK_Inverse3Id], [s].[OneToOne_Optional_Self3Id], [s].[Id1], [s].[Level2_Optional_Id0], [s].[Level2_Required_Id0], [s].[Name1], [s].[OneToMany_Optional_Inverse3Id0], [s].[OneToMany_Optional_Self_Inverse3Id0], [s].[OneToMany_Required_Inverse3Id0], [s].[OneToMany_Required_Self_Inverse3Id0], [s].[OneToOne_Optional_PK_Inverse3Id0], [s].[OneToOne_Optional_Self3Id0] FROM [LevelOne] AS [l] OUTER APPLY ( - SELECT [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], [l1].[Id] AS [Id0], [l3].[Id] AS [Id1], [l3].[Level2_Optional_Id], [l3].[Level2_Required_Id], [l3].[Name] AS [Name0], [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], [l1].[Level2_Optional_Id] AS [Level2_Optional_Id0], [l1].[Level2_Required_Id] AS [Level2_Required_Id0], [l1].[Name] AS [Name1], [l1].[OneToMany_Optional_Inverse3Id] AS [OneToMany_Optional_Inverse3Id0], [l1].[OneToMany_Optional_Self_Inverse3Id] AS [OneToMany_Optional_Self_Inverse3Id0], [l1].[OneToMany_Required_Inverse3Id] AS [OneToMany_Required_Inverse3Id0], [l1].[OneToMany_Required_Self_Inverse3Id] AS [OneToMany_Required_Self_Inverse3Id0], [l1].[OneToOne_Optional_PK_Inverse3Id] AS [OneToOne_Optional_PK_Inverse3Id0], [l1].[OneToOne_Optional_Self3Id] AS [OneToOne_Optional_Self3Id0] + SELECT [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], [l3].[Id] AS [Id0], [l3].[Level2_Optional_Id], [l3].[Level2_Required_Id], [l3].[Name] AS [Name0], [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], [l1].[Id] AS [Id1], [l1].[Level2_Optional_Id] AS [Level2_Optional_Id0], [l1].[Level2_Required_Id] AS [Level2_Required_Id0], [l1].[Name] AS [Name1], [l1].[OneToMany_Optional_Inverse3Id] AS [OneToMany_Optional_Inverse3Id0], [l1].[OneToMany_Optional_Self_Inverse3Id] AS [OneToMany_Optional_Self_Inverse3Id0], [l1].[OneToMany_Required_Inverse3Id] AS [OneToMany_Required_Inverse3Id0], [l1].[OneToMany_Required_Self_Inverse3Id] AS [OneToMany_Required_Self_Inverse3Id0], [l1].[OneToOne_Optional_PK_Inverse3Id] AS [OneToOne_Optional_PK_Inverse3Id0], [l1].[OneToOne_Optional_Self3Id] AS [OneToOne_Optional_Self3Id0] FROM ( SELECT TOP(2) [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] @@ -1585,7 +1585,7 @@ ORDER BY [l0].[Id] LEFT JOIN [LevelThree] AS [l1] ON [l2].[Id] = [l1].[Level2_Required_Id] LEFT JOIN [LevelThree] AS [l3] ON [l2].[Id] = [l3].[OneToMany_Optional_Inverse3Id] ) AS [s] -ORDER BY [l].[Id], [s].[Id], [s].[Id0] +ORDER BY [l].[Id], [s].[Id] """); } @@ -1597,10 +1597,10 @@ await base AssertSql( """ -SELECT [l].[Id], [l].[Date], [l].[Name], [l].[OneToMany_Optional_Self_Inverse1Id], [l].[OneToMany_Required_Self_Inverse1Id], [l].[OneToOne_Optional_Self1Id], [s].[Id], [s].[Date], [s].[Level1_Optional_Id], [s].[Level1_Required_Id], [s].[Name], [s].[OneToMany_Optional_Inverse2Id], [s].[OneToMany_Optional_Self_Inverse2Id], [s].[OneToMany_Required_Inverse2Id], [s].[OneToMany_Required_Self_Inverse2Id], [s].[OneToOne_Optional_PK_Inverse2Id], [s].[OneToOne_Optional_Self2Id], [s].[Id0], [s].[Id1], [s].[Level2_Optional_Id], [s].[Level2_Required_Id], [s].[Name0], [s].[OneToMany_Optional_Inverse3Id], [s].[OneToMany_Optional_Self_Inverse3Id], [s].[OneToMany_Required_Inverse3Id], [s].[OneToMany_Required_Self_Inverse3Id], [s].[OneToOne_Optional_PK_Inverse3Id], [s].[OneToOne_Optional_Self3Id], [s].[Level2_Optional_Id0], [s].[Level2_Required_Id0], [s].[Name1], [s].[OneToMany_Optional_Inverse3Id0], [s].[OneToMany_Optional_Self_Inverse3Id0], [s].[OneToMany_Required_Inverse3Id0], [s].[OneToMany_Required_Self_Inverse3Id0], [s].[OneToOne_Optional_PK_Inverse3Id0], [s].[OneToOne_Optional_Self3Id0] +SELECT [l].[Id], [l].[Date], [l].[Name], [l].[OneToMany_Optional_Self_Inverse1Id], [l].[OneToMany_Required_Self_Inverse1Id], [l].[OneToOne_Optional_Self1Id], [s].[Id], [s].[Date], [s].[Level1_Optional_Id], [s].[Level1_Required_Id], [s].[Name], [s].[OneToMany_Optional_Inverse2Id], [s].[OneToMany_Optional_Self_Inverse2Id], [s].[OneToMany_Required_Inverse2Id], [s].[OneToMany_Required_Self_Inverse2Id], [s].[OneToOne_Optional_PK_Inverse2Id], [s].[OneToOne_Optional_Self2Id], [s].[Id0], [s].[Level2_Optional_Id], [s].[Level2_Required_Id], [s].[Name0], [s].[OneToMany_Optional_Inverse3Id], [s].[OneToMany_Optional_Self_Inverse3Id], [s].[OneToMany_Required_Inverse3Id], [s].[OneToMany_Required_Self_Inverse3Id], [s].[OneToOne_Optional_PK_Inverse3Id], [s].[OneToOne_Optional_Self3Id], [s].[Id1], [s].[Level2_Optional_Id0], [s].[Level2_Required_Id0], [s].[Name1], [s].[OneToMany_Optional_Inverse3Id0], [s].[OneToMany_Optional_Self_Inverse3Id0], [s].[OneToMany_Required_Inverse3Id0], [s].[OneToMany_Required_Self_Inverse3Id0], [s].[OneToOne_Optional_PK_Inverse3Id0], [s].[OneToOne_Optional_Self3Id0] FROM [LevelOne] AS [l] OUTER APPLY ( - SELECT [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], [l1].[Id] AS [Id0], [l3].[Id] AS [Id1], [l3].[Level2_Optional_Id], [l3].[Level2_Required_Id], [l3].[Name] AS [Name0], [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], [l1].[Level2_Optional_Id] AS [Level2_Optional_Id0], [l1].[Level2_Required_Id] AS [Level2_Required_Id0], [l1].[Name] AS [Name1], [l1].[OneToMany_Optional_Inverse3Id] AS [OneToMany_Optional_Inverse3Id0], [l1].[OneToMany_Optional_Self_Inverse3Id] AS [OneToMany_Optional_Self_Inverse3Id0], [l1].[OneToMany_Required_Inverse3Id] AS [OneToMany_Required_Inverse3Id0], [l1].[OneToMany_Required_Self_Inverse3Id] AS [OneToMany_Required_Self_Inverse3Id0], [l1].[OneToOne_Optional_PK_Inverse3Id] AS [OneToOne_Optional_PK_Inverse3Id0], [l1].[OneToOne_Optional_Self3Id] AS [OneToOne_Optional_Self3Id0] + SELECT [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], [l3].[Id] AS [Id0], [l3].[Level2_Optional_Id], [l3].[Level2_Required_Id], [l3].[Name] AS [Name0], [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], [l1].[Id] AS [Id1], [l1].[Level2_Optional_Id] AS [Level2_Optional_Id0], [l1].[Level2_Required_Id] AS [Level2_Required_Id0], [l1].[Name] AS [Name1], [l1].[OneToMany_Optional_Inverse3Id] AS [OneToMany_Optional_Inverse3Id0], [l1].[OneToMany_Optional_Self_Inverse3Id] AS [OneToMany_Optional_Self_Inverse3Id0], [l1].[OneToMany_Required_Inverse3Id] AS [OneToMany_Required_Inverse3Id0], [l1].[OneToMany_Required_Self_Inverse3Id] AS [OneToMany_Required_Self_Inverse3Id0], [l1].[OneToOne_Optional_PK_Inverse3Id] AS [OneToOne_Optional_PK_Inverse3Id0], [l1].[OneToOne_Optional_Self3Id] AS [OneToOne_Optional_Self3Id0] FROM ( SELECT TOP(2) [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] @@ -1610,7 +1610,7 @@ ORDER BY [l0].[Id] LEFT JOIN [LevelThree] AS [l1] ON [l2].[Id] = [l1].[Level2_Required_Id] LEFT JOIN [LevelThree] AS [l3] ON [l2].[Id] = [l3].[OneToMany_Optional_Inverse3Id] ) AS [s] -ORDER BY [l].[Id], [s].[Id], [s].[Id0] +ORDER BY [l].[Id], [s].[Id] """); } @@ -1679,7 +1679,7 @@ FROM [LevelFour] AS [l3] WHERE [l3].[Id] > 1 ) AS [l4] ON [l1].[Id] = [l4].[OneToMany_Optional_Inverse4Id] ) AS [s] -ORDER BY [l].[Id], [s].[Id], [s].[Id0] +ORDER BY [l].[Id], [s].[Id] """); } @@ -1844,7 +1844,7 @@ public override async Task Complex_query_with_let_collection_projection_FirstOrD AssertSql( """ -SELECT [l].[Id], [l4].[Id], [l5].[Name], [l5].[Id], [l4].[c] +SELECT [l].[Id], [l5].[Name], [l5].[Id], [l4].[c] FROM [LevelOne] AS [l] LEFT JOIN ( SELECT [l3].[c], [l3].[Id], [l3].[OneToMany_Optional_Inverse2Id] @@ -1863,7 +1863,7 @@ SELECT 1 FROM [LevelTwo] AS [l2] WHERE [l1].[Id] = [l2].[OneToMany_Optional_Inverse2Id] AND [l2].[Id] = [l4].[Id]) ) AS [l5] -ORDER BY [l].[Id], [l4].[Id] +ORDER BY [l].[Id] """); } @@ -1873,20 +1873,20 @@ public override async Task SelectMany_DefaultIfEmpty_multiple_times_with_joins_p AssertSql( """ -SELECT [l2].[Id], [l2].[Level3_Optional_Id], [l2].[Level3_Required_Id], [l2].[Name], [l2].[OneToMany_Optional_Inverse4Id], [l2].[OneToMany_Optional_Self_Inverse4Id], [l2].[OneToMany_Required_Inverse4Id], [l2].[OneToMany_Required_Self_Inverse4Id], [l2].[OneToOne_Optional_PK_Inverse4Id], [l2].[OneToOne_Optional_Self4Id], [l].[Id], [l0].[Id], [l1].[Id], [s].[Id], [s].[Id0], [s].[Id1], [s].[Id2], [s0].[Id], [s0].[Id0], [s0].[Id1], [s0].[Id2], [l11].[Id], [l12].[Id], [l13].[Id], [l14].[Id], [l16].[Id], [l16].[Date], [l16].[Level1_Optional_Id], [l16].[Level1_Required_Id], [l16].[Name], [l16].[OneToMany_Optional_Inverse2Id], [l16].[OneToMany_Optional_Self_Inverse2Id], [l16].[OneToMany_Required_Inverse2Id], [l16].[OneToMany_Required_Self_Inverse2Id], [l16].[OneToOne_Optional_PK_Inverse2Id], [l16].[OneToOne_Optional_Self2Id], [l14].[Name] +SELECT [l2].[Id], [l2].[Level3_Optional_Id], [l2].[Level3_Required_Id], [l2].[Name], [l2].[OneToMany_Optional_Inverse4Id], [l2].[OneToMany_Optional_Self_Inverse4Id], [l2].[OneToMany_Required_Inverse4Id], [l2].[OneToMany_Required_Self_Inverse4Id], [l2].[OneToOne_Optional_PK_Inverse4Id], [l2].[OneToOne_Optional_Self4Id], [l].[Id], [s].[Id], [s].[Id2], [s0].[Id], [s0].[Id2], [l16].[Id], [l16].[Date], [l16].[Level1_Optional_Id], [l16].[Level1_Required_Id], [l16].[Name], [l16].[OneToMany_Optional_Inverse2Id], [l16].[OneToMany_Optional_Self_Inverse2Id], [l16].[OneToMany_Required_Inverse2Id], [l16].[OneToMany_Required_Self_Inverse2Id], [l16].[OneToOne_Optional_PK_Inverse2Id], [l16].[OneToOne_Optional_Self2Id], [l14].[Name] 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_Optional_Id] LEFT JOIN [LevelFour] AS [l2] ON [l1].[Id] = [l2].[OneToMany_Required_Inverse4Id] INNER JOIN ( - SELECT [l3].[Id], [l4].[Id] AS [Id0], [l5].[Id] AS [Id1], [l6].[Id] AS [Id2] + SELECT [l3].[Id], [l6].[Id] AS [Id2] FROM [LevelFour] AS [l3] INNER JOIN [LevelThree] AS [l4] ON [l3].[Level3_Required_Id] = [l4].[Id] LEFT JOIN [LevelTwo] AS [l5] ON [l4].[Level2_Optional_Id] = [l5].[Id] LEFT JOIN [LevelTwo] AS [l6] ON [l5].[Id] = [l6].[OneToMany_Required_Self_Inverse2Id] ) AS [s] ON [l2].[Id] = [s].[Id2] LEFT JOIN ( - SELECT [l7].[Id], [l8].[Id] AS [Id0], [l9].[Id] AS [Id1], [l10].[Id] AS [Id2], [l10].[Level2_Optional_Id] AS [Level2_Optional_Id0] + SELECT [l7].[Id], [l10].[Id] AS [Id2], [l10].[Level2_Optional_Id] AS [Level2_Optional_Id0] FROM [LevelFour] AS [l7] INNER JOIN [LevelThree] AS [l8] ON [l7].[Level3_Required_Id] = [l8].[Id] INNER JOIN [LevelTwo] AS [l9] ON [l8].[Level2_Required_Id] = [l9].[Id] @@ -1902,7 +1902,7 @@ FROM [LevelTwo] AS [l15] WHERE [l15].[Id] <> 42 ) AS [l16] ON [s].[Id2] = [l16].[OneToMany_Optional_Self_Inverse2Id] WHERE [l11].[Name] <> N'Foo' OR [l11].[Name] IS NULL -ORDER BY [l12].[Id], [l].[Id], [l0].[Id], [l1].[Id], [l2].[Id], [s].[Id], [s].[Id0], [s].[Id1], [s].[Id2], [s0].[Id], [s0].[Id0], [s0].[Id1], [s0].[Id2], [l11].[Id], [l13].[Id], [l14].[Id] +ORDER BY [l12].[Id], [l].[Id], [l2].[Id], [s].[Id], [s].[Id2], [s0].[Id], [s0].[Id2] """); } @@ -2005,7 +2005,7 @@ ORDER BY [l0].[Name] DESC ) AS [l2] LEFT JOIN [LevelThree] AS [l1] ON [l2].[Id] = [l1].[Level2_Optional_Id] ) AS [s] -ORDER BY [l3].[Id], [s].[Name] DESC, [s].[Id] +ORDER BY [l3].[Id], [s].[Name] DESC """); } @@ -2036,7 +2036,7 @@ OFFSET 1 ROWS FETCH NEXT 4 ROWS ONLY ) AS [l2] LEFT JOIN [LevelThree] AS [l1] ON [l2].[Id] = [l1].[Level2_Optional_Id] ) AS [s] -ORDER BY [l3].[Id] DESC, [s].[Name] DESC, [s].[Id] +ORDER BY [l3].[Id] DESC, [s].[Name] DESC """); } @@ -2062,7 +2062,7 @@ FROM [LevelTwo] AS [l0] ) AS [l2] LEFT JOIN [LevelThree] AS [l1] ON [l2].[Id] = [l1].[Level2_Optional_Id] ) AS [s] -ORDER BY [l3].[Id], [s].[Id] +ORDER BY [l3].[Id] """); } @@ -2090,7 +2090,7 @@ FROM [LevelTwo] AS [l0] ) AS [l2] LEFT JOIN [LevelThree] AS [l1] ON [l2].[Id] = [l1].[Level2_Optional_Id] ) AS [s] -ORDER BY [l3].[Id], [s].[Id] +ORDER BY [l3].[Id] """); } @@ -2290,7 +2290,7 @@ OFFSET 1 ROWS FETCH NEXT 5 ROWS ONLY ) AS [l2] LEFT JOIN [LevelTwo] AS [l1] ON [l2].[Id] = [l1].[Level1_Optional_Id] ) AS [s] -ORDER BY [l3].[Date], [s].[Name], [s].[Id] +ORDER BY [l3].[Date], [s].[Name] """); } @@ -2355,7 +2355,7 @@ public override async Task Include_partially_added_before_Where_and_then_build_u AssertSql( """ -SELECT [l].[Id], [l].[Date], [l].[Name], [l].[OneToMany_Optional_Self_Inverse1Id], [l].[OneToMany_Required_Self_Inverse1Id], [l].[OneToOne_Optional_Self1Id], [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], [l0].[Id], [s].[Id], [s].[Level2_Optional_Id], [s].[Level2_Required_Id], [s].[Name], [s].[OneToMany_Optional_Inverse3Id], [s].[OneToMany_Optional_Self_Inverse3Id], [s].[OneToMany_Required_Inverse3Id], [s].[OneToMany_Required_Self_Inverse3Id], [s].[OneToOne_Optional_PK_Inverse3Id], [s].[OneToOne_Optional_Self3Id], [s].[Id0], [s].[Level3_Optional_Id], [s].[Level3_Required_Id], [s].[Name0], [s].[OneToMany_Optional_Inverse4Id], [s].[OneToMany_Optional_Self_Inverse4Id], [s].[OneToMany_Required_Inverse4Id], [s].[OneToMany_Required_Self_Inverse4Id], [s].[OneToOne_Optional_PK_Inverse4Id], [s].[OneToOne_Optional_Self4Id] +SELECT [l].[Id], [l].[Date], [l].[Name], [l].[OneToMany_Optional_Self_Inverse1Id], [l].[OneToMany_Required_Self_Inverse1Id], [l].[OneToOne_Optional_Self1Id], [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], [s].[Id], [s].[Level2_Optional_Id], [s].[Level2_Required_Id], [s].[Name], [s].[OneToMany_Optional_Inverse3Id], [s].[OneToMany_Optional_Self_Inverse3Id], [s].[OneToMany_Required_Inverse3Id], [s].[OneToMany_Required_Self_Inverse3Id], [s].[OneToOne_Optional_PK_Inverse3Id], [s].[OneToOne_Optional_Self3Id], [s].[Id0], [s].[Level3_Optional_Id], [s].[Level3_Required_Id], [s].[Name0], [s].[OneToMany_Optional_Inverse4Id], [s].[OneToMany_Optional_Self_Inverse4Id], [s].[OneToMany_Required_Inverse4Id], [s].[OneToMany_Required_Self_Inverse4Id], [s].[OneToOne_Optional_PK_Inverse4Id], [s].[OneToOne_Optional_Self4Id] FROM [LevelOne] AS [l] LEFT JOIN [LevelTwo] AS [l0] ON [l].[Id] = [l0].[OneToOne_Optional_PK_Inverse2Id] LEFT JOIN [LevelTwo] AS [l1] ON [l].[Id] = [l1].[Level1_Optional_Id] @@ -2365,7 +2365,7 @@ FROM [LevelThree] AS [l2] LEFT JOIN [LevelFour] AS [l3] ON [l2].[Id] = [l3].[Level3_Optional_Id] ) AS [s] ON [l1].[Id] = [s].[OneToMany_Optional_Inverse3Id] WHERE [l0].[Id] < 3 OR [l1].[Id] > 8 -ORDER BY [l].[Id], [l0].[Id], [l1].[Id], [s].[Id] +ORDER BY [l].[Id] """); } @@ -2375,7 +2375,7 @@ public override async Task Include_partially_added_before_Where_and_then_build_u AssertSql( """ -SELECT [l].[Id], [l].[Date], [l].[Name], [l].[OneToMany_Optional_Self_Inverse1Id], [l].[OneToMany_Required_Self_Inverse1Id], [l].[OneToOne_Optional_Self1Id], [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], [l0].[Id], [l6].[Id], [l6].[Level2_Optional_Id], [l6].[Level2_Required_Id], [l6].[Name], [l6].[OneToMany_Optional_Inverse3Id], [l6].[OneToMany_Optional_Self_Inverse3Id], [l6].[OneToMany_Required_Inverse3Id], [l6].[OneToMany_Required_Self_Inverse3Id], [l6].[OneToOne_Optional_PK_Inverse3Id], [l6].[OneToOne_Optional_Self3Id], [s].[Id], [s].[Level2_Optional_Id], [s].[Level2_Required_Id], [s].[Name], [s].[OneToMany_Optional_Inverse3Id], [s].[OneToMany_Optional_Self_Inverse3Id], [s].[OneToMany_Required_Inverse3Id], [s].[OneToMany_Required_Self_Inverse3Id], [s].[OneToOne_Optional_PK_Inverse3Id], [s].[OneToOne_Optional_Self3Id], [s].[Id0], [s].[Level3_Optional_Id], [s].[Level3_Required_Id], [s].[Name0], [s].[OneToMany_Optional_Inverse4Id], [s].[OneToMany_Optional_Self_Inverse4Id], [s].[OneToMany_Required_Inverse4Id], [s].[OneToMany_Required_Self_Inverse4Id], [s].[OneToOne_Optional_PK_Inverse4Id], [s].[OneToOne_Optional_Self4Id] +SELECT [l].[Id], [l].[Date], [l].[Name], [l].[OneToMany_Optional_Self_Inverse1Id], [l].[OneToMany_Required_Self_Inverse1Id], [l].[OneToOne_Optional_Self1Id], [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], [l6].[Id], [l6].[Level2_Optional_Id], [l6].[Level2_Required_Id], [l6].[Name], [l6].[OneToMany_Optional_Inverse3Id], [l6].[OneToMany_Optional_Self_Inverse3Id], [l6].[OneToMany_Required_Inverse3Id], [l6].[OneToMany_Required_Self_Inverse3Id], [l6].[OneToOne_Optional_PK_Inverse3Id], [l6].[OneToOne_Optional_Self3Id], [s].[Id], [s].[Level2_Optional_Id], [s].[Level2_Required_Id], [s].[Name], [s].[OneToMany_Optional_Inverse3Id], [s].[OneToMany_Optional_Self_Inverse3Id], [s].[OneToMany_Required_Inverse3Id], [s].[OneToMany_Required_Self_Inverse3Id], [s].[OneToOne_Optional_PK_Inverse3Id], [s].[OneToOne_Optional_Self3Id], [s].[Id0], [s].[Level3_Optional_Id], [s].[Level3_Required_Id], [s].[Name0], [s].[OneToMany_Optional_Inverse4Id], [s].[OneToMany_Optional_Self_Inverse4Id], [s].[OneToMany_Required_Inverse4Id], [s].[OneToMany_Required_Self_Inverse4Id], [s].[OneToOne_Optional_PK_Inverse4Id], [s].[OneToOne_Optional_Self4Id] FROM [LevelOne] AS [l] LEFT JOIN [LevelTwo] AS [l0] ON [l].[Id] = [l0].[OneToOne_Optional_PK_Inverse2Id] LEFT JOIN [LevelTwo] AS [l1] ON [l].[Id] = [l1].[Level1_Optional_Id] @@ -2393,7 +2393,7 @@ FROM [LevelThree] AS [l3] LEFT JOIN [LevelFour] AS [l4] ON [l3].[Id] = [l4].[Level3_Optional_Id] ) AS [s] ON [l1].[Id] = [s].[OneToMany_Required_Inverse3Id] WHERE [l0].[Id] < 3 OR [l1].[Id] > 8 -ORDER BY [l].[Id], [l0].[Id], [l1].[Id], [l6].[OneToMany_Optional_Inverse3Id], [l6].[Id], [s].[Id] +ORDER BY [l].[Id], [l6].[OneToMany_Optional_Inverse3Id], [l6].[Id] """); } @@ -2461,7 +2461,7 @@ public override async Task Complex_query_issue_21665(bool async) AssertSql( """ -SELECT [s].[Id], [s].[Date], [s].[Name], [s].[OneToMany_Optional_Self_Inverse1Id], [s].[OneToMany_Required_Self_Inverse1Id], [s].[OneToOne_Optional_Self1Id], [s].[Name0], [s].[c], [s].[c0], [s].[c1], [s].[Id0], [s0].[Id], [s0].[Date], [s0].[Name], [s0].[OneToMany_Optional_Self_Inverse1Id], [s0].[OneToMany_Required_Self_Inverse1Id], [s0].[OneToOne_Optional_Self1Id], [s0].[ChildCount], [s0].[Level2Name], [s0].[Level2Count], [s0].[IsLevel2There], [s0].[Id0] +SELECT [s].[Id], [s].[Date], [s].[Name], [s].[OneToMany_Optional_Self_Inverse1Id], [s].[OneToMany_Required_Self_Inverse1Id], [s].[OneToOne_Optional_Self1Id], [s].[Name0], [s].[c], [s].[c0], [s].[c1], [s0].[Id], [s0].[Date], [s0].[Name], [s0].[OneToMany_Optional_Self_Inverse1Id], [s0].[OneToMany_Required_Self_Inverse1Id], [s0].[OneToOne_Optional_Self1Id], [s0].[ChildCount], [s0].[Level2Name], [s0].[Level2Count], [s0].[IsLevel2There] FROM ( SELECT TOP(1) [l].[Id], [l].[Date], [l].[Name], [l].[OneToMany_Optional_Self_Inverse1Id], [l].[OneToMany_Required_Self_Inverse1Id], [l].[OneToOne_Optional_Self1Id], [l0].[Name] AS [Name0], ( SELECT COUNT(*) @@ -2475,7 +2475,7 @@ SELECT 1 FROM [LevelTwo] AS [l3] WHERE [l].[Id] = [l3].[OneToMany_Optional_Inverse2Id] AND [l3].[Id] = 2) THEN CAST(1 AS bit) ELSE CAST(0 AS bit) - END AS [c1], [l0].[Id] AS [Id0] + END AS [c1] FROM [LevelOne] AS [l] LEFT JOIN [LevelTwo] AS [l0] ON [l].[Id] = [l0].[Level1_Optional_Id] WHERE [l].[Id] = 2 @@ -2494,7 +2494,7 @@ SELECT 1 FROM [LevelTwo] AS [l9] WHERE [l6].[Id] = [l9].[OneToMany_Optional_Inverse2Id] AND [l9].[Id] = 2) THEN CAST(1 AS bit) ELSE CAST(0 AS bit) - END AS [IsLevel2There], [l5].[Id] AS [Id0] + END AS [IsLevel2There] FROM ( SELECT [l4].[Id], [l4].[Date], [l4].[Name], [l4].[OneToMany_Optional_Self_Inverse1Id], [l4].[OneToMany_Required_Self_Inverse1Id], [l4].[OneToOne_Optional_Self1Id] FROM [LevelOne] AS [l4] @@ -2504,7 +2504,7 @@ OFFSET 1 ROWS FETCH NEXT 5 ROWS ONLY ) AS [l6] LEFT JOIN [LevelTwo] AS [l5] ON [l6].[Id] = [l5].[Level1_Optional_Id] ) AS [s0] -ORDER BY [s].[Name], [s].[Id], [s].[Id0], [s0].[Name], [s0].[Id] +ORDER BY [s].[Name], [s].[Id], [s0].[Name] """); } @@ -2617,7 +2617,7 @@ public override async Task Project_collection_navigation_nested_with_take(bool a AssertSql( """ -SELECT [l].[Id], [l0].[Id], [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] +SELECT [l].[Id], [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 [LevelOne] AS [l] LEFT JOIN [LevelTwo] AS [l0] ON [l].[Id] = [l0].[Level1_Optional_Id] LEFT JOIN ( @@ -2628,7 +2628,7 @@ FROM [LevelThree] AS [l1] ) AS [l2] WHERE [l2].[row] <= 50 ) AS [l3] ON [l0].[Id] = [l3].[OneToMany_Optional_Inverse3Id] -ORDER BY [l].[Id], [l0].[Id] +ORDER BY [l].[Id] """); } @@ -2638,12 +2638,12 @@ public override async Task Multiple_optional_navigation_with_Include(bool async) AssertSql( """ -SELECT [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Name], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Optional_Self_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[OneToMany_Required_Self_Inverse3Id], [l1].[OneToOne_Optional_PK_Inverse3Id], [l1].[OneToOne_Optional_Self3Id], [l].[Id], [l0].[Id], [l2].[Id], [l2].[Level3_Optional_Id], [l2].[Level3_Required_Id], [l2].[Name], [l2].[OneToMany_Optional_Inverse4Id], [l2].[OneToMany_Optional_Self_Inverse4Id], [l2].[OneToMany_Required_Inverse4Id], [l2].[OneToMany_Required_Self_Inverse4Id], [l2].[OneToOne_Optional_PK_Inverse4Id], [l2].[OneToOne_Optional_Self4Id] +SELECT [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Name], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Optional_Self_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[OneToMany_Required_Self_Inverse3Id], [l1].[OneToOne_Optional_PK_Inverse3Id], [l1].[OneToOne_Optional_Self3Id], [l].[Id], [l2].[Id], [l2].[Level3_Optional_Id], [l2].[Level3_Required_Id], [l2].[Name], [l2].[OneToMany_Optional_Inverse4Id], [l2].[OneToMany_Optional_Self_Inverse4Id], [l2].[OneToMany_Required_Inverse4Id], [l2].[OneToMany_Required_Self_Inverse4Id], [l2].[OneToOne_Optional_PK_Inverse4Id], [l2].[OneToOne_Optional_Self4Id] 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].[OneToOne_Optional_PK_Inverse3Id] LEFT JOIN [LevelFour] AS [l2] ON [l1].[Id] = [l2].[OneToMany_Optional_Inverse4Id] -ORDER BY [l].[Id], [l0].[Id], [l1].[Id] +ORDER BY [l].[Id] """); } @@ -2653,7 +2653,7 @@ public override async Task Complex_query_with_let_collection_projection_FirstOrD AssertSql( """ -SELECT [l].[Id], [l3].[Id], [l4].[Name], [l4].[Id], [l3].[c] +SELECT [l].[Id], [l4].[Name], [l4].[Id], [l3].[c] FROM [LevelOne] AS [l] OUTER APPLY ( SELECT TOP(1) 1 AS [c], [l0].[Id] @@ -2668,7 +2668,7 @@ SELECT 1 FROM [LevelTwo] AS [l2] WHERE [l1].[Id] = [l2].[OneToMany_Optional_Inverse2Id] AND [l2].[Id] = [l3].[Id]) ) AS [l4] -ORDER BY [l].[Id], [l3].[Id] +ORDER BY [l].[Id] """); } @@ -2691,12 +2691,12 @@ public override async Task Multiple_optional_navigation_with_string_based_Includ AssertSql( """ -SELECT [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Name], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Optional_Self_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[OneToMany_Required_Self_Inverse3Id], [l1].[OneToOne_Optional_PK_Inverse3Id], [l1].[OneToOne_Optional_Self3Id], [l].[Id], [l0].[Id], [l2].[Id], [l2].[Level3_Optional_Id], [l2].[Level3_Required_Id], [l2].[Name], [l2].[OneToMany_Optional_Inverse4Id], [l2].[OneToMany_Optional_Self_Inverse4Id], [l2].[OneToMany_Required_Inverse4Id], [l2].[OneToMany_Required_Self_Inverse4Id], [l2].[OneToOne_Optional_PK_Inverse4Id], [l2].[OneToOne_Optional_Self4Id] +SELECT [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Name], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Optional_Self_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[OneToMany_Required_Self_Inverse3Id], [l1].[OneToOne_Optional_PK_Inverse3Id], [l1].[OneToOne_Optional_Self3Id], [l].[Id], [l2].[Id], [l2].[Level3_Optional_Id], [l2].[Level3_Required_Id], [l2].[Name], [l2].[OneToMany_Optional_Inverse4Id], [l2].[OneToMany_Optional_Self_Inverse4Id], [l2].[OneToMany_Required_Inverse4Id], [l2].[OneToMany_Required_Self_Inverse4Id], [l2].[OneToOne_Optional_PK_Inverse4Id], [l2].[OneToOne_Optional_Self4Id] 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].[OneToOne_Optional_PK_Inverse3Id] LEFT JOIN [LevelFour] AS [l2] ON [l1].[Id] = [l2].[OneToMany_Optional_Inverse4Id] -ORDER BY [l].[Id], [l0].[Id], [l1].[Id] +ORDER BY [l].[Id] """); } @@ -2706,7 +2706,7 @@ public override async Task Projecting_collection_after_optional_reference_correl AssertSql( """ -SELECT [l].[Id], [l0].[Id], [l2].[ChildId], [l2].[ParentName] +SELECT [l].[Id], [l2].[ChildId], [l2].[ParentName] FROM [LevelOne] AS [l] LEFT JOIN [LevelTwo] AS [l0] ON [l].[Id] = [l0].[Level1_Optional_Id] OUTER APPLY ( @@ -2714,7 +2714,7 @@ OUTER APPLY ( FROM [LevelThree] AS [l1] WHERE [l0].[Id] IS NOT NULL AND [l0].[Id] = [l1].[OneToMany_Optional_Inverse3Id] ) AS [l2] -ORDER BY [l].[Id], [l0].[Id] +ORDER BY [l].[Id] """); } @@ -2724,7 +2724,7 @@ public override async Task Projecting_collection_with_group_by_after_optional_re AssertSql( """ -SELECT [l].[Id], [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], [l0].[Id], [l3].[Key], [l3].[Count] +SELECT [l].[Id], [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], [l3].[Key], [l3].[Count] 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] @@ -2734,7 +2734,7 @@ FROM [LevelThree] AS [l2] WHERE [l0].[Id] IS NOT NULL AND [l0].[Id] = [l2].[OneToMany_Optional_Inverse3Id] GROUP BY [l2].[Name] ) AS [l3] -ORDER BY [l].[Id], [l0].[Id], [l1].[Id] +ORDER BY [l].[Id] """); } @@ -2753,7 +2753,7 @@ LEFT JOIN ( FROM [LevelTwo] AS [l2] LEFT JOIN [LevelThree] AS [l3] ON [l2].[Id] = [l3].[Level2_Optional_Id] ) AS [s] ON [l].[Id] = [s].[OneToMany_Optional_Inverse2Id] -ORDER BY [l].[Id], [l0].[Id], [l1].[Id], [s].[Id] +ORDER BY [l].[Id], [l1].[Id] """); } @@ -2772,7 +2772,7 @@ LEFT JOIN ( FROM [LevelOne] AS [l2] LEFT JOIN [LevelOne] AS [l3] ON [l2].[OneToOne_Optional_Self1Id] = [l3].[Id] ) AS [s] ON [l].[Id] = [s].[OneToMany_Optional_Self_Inverse1Id] -ORDER BY [l].[Id], [l0].[Id], [l1].[Id], [s].[Id] +ORDER BY [l].[Id], [l1].[Id] """); } @@ -2795,7 +2795,7 @@ 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 -ORDER BY [l].[Id], [s].[Id], [s].[Id0] +ORDER BY [l].[Id] """); } @@ -2867,7 +2867,7 @@ WHERE [l1].[Name] <> N'Foo' OR [l1].[Name] IS NULL ) AS [l2] WHERE 1 < [l2].[row] AND [l2].[row] <= 4 ) AS [l3] ON [l0].[Id] = [l3].[OneToMany_Optional_Inverse3Id] -ORDER BY [l].[Id], [l0].[Id], [l3].[OneToMany_Optional_Inverse3Id], [l3].[Name] +ORDER BY [l].[Id], [l3].[OneToMany_Optional_Inverse3Id], [l3].[Name] """); } @@ -2914,7 +2914,7 @@ LEFT JOIN ( FROM [LevelTwo] AS [l0] LEFT JOIN [LevelThree] AS [l1] ON [l0].[Id] = [l1].[Level2_Optional_Id] ) AS [s] ON [l].[Id] = [s].[OneToMany_Optional_Inverse2Id] -ORDER BY [l].[Name], [l].[Id], [s].[Id] +ORDER BY [l].[Name], [l].[Id] """); } @@ -2938,11 +2938,11 @@ public override async Task Final_GroupBy_property_entity_Include_collection_refe AssertSql( """ -SELECT [l].[Name], [l].[Id], [l].[Date], [l].[OneToMany_Optional_Self_Inverse1Id], [l].[OneToMany_Required_Self_Inverse1Id], [l].[OneToOne_Optional_Self1Id], [l0].[Id], [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], [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] +SELECT [l].[Name], [l].[Id], [l].[Date], [l].[OneToMany_Optional_Self_Inverse1Id], [l].[OneToMany_Required_Self_Inverse1Id], [l].[OneToOne_Optional_Self1Id], [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], [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] LEFT JOIN [LevelTwo] AS [l1] ON [l].[Id] = [l1].[OneToMany_Optional_Inverse2Id] -ORDER BY [l].[Name], [l].[Id], [l0].[Id] +ORDER BY [l].[Name], [l].[Id] """); } diff --git a/test/EFCore.SqlServer.FunctionalTests/Query/ComplexNavigationsCollectionsSharedTypeQuerySqlServerTest.cs b/test/EFCore.SqlServer.FunctionalTests/Query/ComplexNavigationsCollectionsSharedTypeQuerySqlServerTest.cs index 7cea1548613..c96fba58231 100644 --- a/test/EFCore.SqlServer.FunctionalTests/Query/ComplexNavigationsCollectionsSharedTypeQuerySqlServerTest.cs +++ b/test/EFCore.SqlServer.FunctionalTests/Query/ComplexNavigationsCollectionsSharedTypeQuerySqlServerTest.cs @@ -27,10 +27,10 @@ public override async Task Complex_query_with_let_collection_projection_FirstOrD AssertSql( """ -SELECT [l].[Id], [s].[Id], [s].[Id0], [l5].[Name], [l5].[Id], [s].[c] +SELECT [l].[Id], [l5].[Name], [l5].[Id], [s].[c] FROM [Level1] AS [l] OUTER APPLY ( - SELECT TOP(1) 1 AS [c], [l0].[Id], [l2].[Id] AS [Id0], [l2].[OneToOne_Required_PK_Date], [l2].[Level1_Required_Id], [l2].[OneToMany_Required_Inverse2Id] + SELECT TOP(1) 1 AS [c], [l2].[OneToOne_Required_PK_Date], [l2].[Level1_Required_Id], [l2].[OneToMany_Required_Inverse2Id], [l2].[Id] AS [Id0] 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] @@ -51,7 +51,7 @@ FROM [Level1] AS [l4] WHEN [s].[OneToOne_Required_PK_Date] IS NOT NULL AND [s].[Level1_Required_Id] IS NOT NULL AND [s].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [s].[Id0] END) ) AS [l5] -ORDER BY [l].[Id], [s].[Id], [s].[Id0] +ORDER BY [l].[Id] """); } @@ -132,7 +132,7 @@ WHEN [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] ) AS [l2] INNER JOIN [Level1] AS [l1] ON [l2].[Level1_Required_Id] = [l1].[Id] ) AS [s] -ORDER BY [l3].[Id], [s].[c], [s].[Id1] +ORDER BY [l3].[Id], [s].[c] """); } @@ -168,7 +168,7 @@ OFFSET 1 ROWS FETCH NEXT 3 ROWS ONLY ) AS [l2] INNER JOIN [Level1] AS [l1] ON [l2].[Level1_Required_Id] = [l1].[Id] ) AS [s] -ORDER BY [l3].[Id], [s].[c], [s].[Id1] +ORDER BY [l3].[Id], [s].[c] """); } @@ -258,7 +258,7 @@ WHERE [l2].[Level2_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse ) AS [l3] ON 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 = [l3].[OneToMany_Optional_Inverse3Id] -ORDER BY [l1].[Level2_Name], [l].[Id], [l1].[Id] +ORDER BY [l1].[Level2_Name], [l].[Id] """); } @@ -289,7 +289,7 @@ public override async Task Multiple_include_with_multiple_optional_navigations(b AssertSql( """ -SELECT [l].[Id], [l].[Date], [l].[Name], [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], [l3].[Id], [l5].[Id], [l7].[Id], [l9].[Id], [l11].[Id], [l11].[Level2_Optional_Id], [l11].[Level2_Required_Id], [l11].[Level3_Name], [l11].[OneToMany_Optional_Inverse3Id], [l11].[OneToMany_Required_Inverse3Id], [l11].[OneToOne_Optional_PK_Inverse3Id], [l5].[Level2_Optional_Id], [l5].[Level2_Required_Id], [l5].[Level3_Name], [l5].[OneToMany_Optional_Inverse3Id], [l5].[OneToMany_Required_Inverse3Id], [l5].[OneToOne_Optional_PK_Inverse3Id], [l7].[OneToOne_Required_PK_Date], [l7].[Level1_Optional_Id], [l7].[Level1_Required_Id], [l7].[Level2_Name], [l7].[OneToMany_Optional_Inverse2Id], [l7].[OneToMany_Required_Inverse2Id], [l7].[OneToOne_Optional_PK_Inverse2Id], [l9].[Level2_Optional_Id], [l9].[Level2_Required_Id], [l9].[Level3_Name], [l9].[OneToMany_Optional_Inverse3Id], [l9].[OneToMany_Required_Inverse3Id], [l9].[OneToOne_Optional_PK_Inverse3Id] +SELECT [l].[Id], [l].[Date], [l].[Name], [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], [l11].[Id], [l11].[Level2_Optional_Id], [l11].[Level2_Required_Id], [l11].[Level3_Name], [l11].[OneToMany_Optional_Inverse3Id], [l11].[OneToMany_Required_Inverse3Id], [l11].[OneToOne_Optional_PK_Inverse3Id], [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], [l7].[Id], [l7].[OneToOne_Required_PK_Date], [l7].[Level1_Optional_Id], [l7].[Level1_Required_Id], [l7].[Level2_Name], [l7].[OneToMany_Optional_Inverse2Id], [l7].[OneToMany_Required_Inverse2Id], [l7].[OneToOne_Optional_PK_Inverse2Id], [l9].[Id], [l9].[Level2_Optional_Id], [l9].[Level2_Required_Id], [l9].[Level3_Name], [l9].[OneToMany_Optional_Inverse3Id], [l9].[OneToMany_Required_Inverse3Id], [l9].[OneToOne_Optional_PK_Inverse3Id] 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] @@ -297,7 +297,7 @@ FROM [Level1] AS [l0] WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [l1] ON [l].[Id] = [l1].[Level1_Required_Id] LEFT JOIN ( - SELECT [l2].[Id], [l2].[Level3_Name], [l2].[OneToOne_Optional_PK_Inverse3Id] + SELECT [l2].[Level3_Name], [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 ) AS [l3] ON CASE @@ -330,7 +330,7 @@ WHERE [l10].[Level2_Required_Id] IS NOT NULL AND [l10].[OneToMany_Required_Inver 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 = [l11].[OneToMany_Optional_Inverse3Id] WHERE [l3].[Level3_Name] <> N'Foo' OR [l3].[Level3_Name] IS NULL -ORDER BY [l].[Id], [l1].[Id], [l3].[Id], [l5].[Id], [l7].[Id], [l9].[Id] +ORDER BY [l].[Id] """); } @@ -364,7 +364,7 @@ WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse 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 = [l3].[Level2_Optional_Id] ) AS [s] -ORDER BY [l4].[Id], [s].[Level2_Name] DESC, [s].[Id] +ORDER BY [l4].[Id], [s].[Level2_Name] DESC """); } @@ -463,7 +463,7 @@ WHERE [l2].[Level2_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse ) AS [l4] ON 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 = [l4].[OneToMany_Optional_Inverse3Id] -ORDER BY [l].[Id], [l1].[Id], [l4].[OneToMany_Optional_Inverse3Id], [l4].[Level3_Name] +ORDER BY [l].[Id], [l4].[OneToMany_Optional_Inverse3Id], [l4].[Level3_Name] """); } @@ -515,7 +515,7 @@ WHERE [l2].[Level2_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse 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 = [s].[OneToMany_Required_Inverse3Id] WHERE [l1].[Level2_Name] <> N'L2 09' OR [l1].[Level2_Name] IS NULL -ORDER BY [l].[Id], [l1].[Id], [s].[Id] +ORDER BY [l].[Id] """); } @@ -528,7 +528,7 @@ public override async Task Complex_multi_include_with_order_by_and_paging_joins_ @p='0' @p1='10' -SELECT [l1].[Id], [l1].[Date], [l1].[Name], [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], [l4].[Id], [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], [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], [l8].[Id], [l8].[Level2_Optional_Id], [l8].[Level2_Required_Id], [l8].[Level3_Name], [l8].[OneToMany_Optional_Inverse3Id], [l8].[OneToMany_Required_Inverse3Id], [l8].[OneToOne_Optional_PK_Inverse3Id] +SELECT [l1].[Id], [l1].[Date], [l1].[Name], [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], [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], [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], [l8].[Id], [l8].[Level2_Optional_Id], [l8].[Level2_Required_Id], [l8].[Level3_Name], [l8].[OneToMany_Optional_Inverse3Id], [l8].[OneToMany_Required_Inverse3Id], [l8].[OneToOne_Optional_PK_Inverse3Id] FROM ( SELECT [l].[Id], [l].[Date], [l].[Name] FROM [Level1] AS [l] @@ -559,7 +559,7 @@ WHERE [l6].[Level2_Required_Id] IS NOT NULL AND [l6].[OneToMany_Required_Inverse ) AS [l8] ON CASE WHEN [l4].[OneToOne_Required_PK_Date] IS NOT NULL AND [l4].[Level1_Required_Id] IS NOT NULL AND [l4].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [l4].[Id] END = [l8].[OneToMany_Required_Inverse3Id] -ORDER BY [l1].[Name], [l1].[Id], [l2].[Id], [l4].[Id], [l7].[Id] +ORDER BY [l1].[Name], [l1].[Id], [l7].[Id] """); } @@ -569,10 +569,10 @@ public override async Task Select_subquery_single_nested_subquery2(bool async) AssertSql( """ -SELECT [l].[Id], [s].[Id], [s].[Id0], [s].[Id1], [s].[Id00], [s].[c] +SELECT [l].[Id], [s].[Id], [s].[Id0], [s].[Id00], [s].[c] FROM [Level1] AS [l] LEFT JOIN ( - SELECT [l0].[Id], [l4].[Id] AS [Id0], [l5].[Id] AS [Id1], [l5].[Id0] AS [Id00], [l4].[c], CASE + SELECT [l0].[Id], [l5].[Id] AS [Id0], [l5].[Id0] AS [Id00], [l4].[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] END AS [c0], [l0].[OneToMany_Optional_Inverse2Id] FROM [Level1] AS [l0] @@ -600,7 +600,7 @@ WHEN [l4].[Level2_Required_Id] IS NOT NULL AND [l4].[OneToMany_Required_Inverse3 END = [l5].[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 ) AS [s] ON [l].[Id] = [s].[OneToMany_Optional_Inverse2Id] -ORDER BY [l].[Id], [s].[c0], [s].[Id], [s].[Id0], [s].[Id1] +ORDER BY [l].[Id], [s].[c0], [s].[Id], [s].[Id0] """); } @@ -660,7 +660,7 @@ WHEN [l3].[OneToOne_Required_PK_Date] IS NOT NULL AND [l3].[Level1_Required_Id] END = [l5].[Level2_Optional_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 ) AS [s] ON [l].[Id] = [s].[OneToMany_Optional_Inverse2Id] -ORDER BY [l].[Id], [l1].[Id], [l6].[Id], [s].[Id] +ORDER BY [l].[Id], [l6].[Id] """); } @@ -684,7 +684,7 @@ WHEN [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] END = [l2].[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 ) AS [s] ON [l].[Id] = [s].[OneToMany_Optional_Inverse2Id] -ORDER BY [l].[Id], [s].[Id] +ORDER BY [l].[Id] """); } @@ -708,7 +708,7 @@ WHERE [l2].[Level2_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse ) AS [l3] ON 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 = [l3].[OneToMany_Optional_Inverse3Id] -ORDER BY [l].[Id], [l1].[Id] +ORDER BY [l].[Id] """); } @@ -718,7 +718,7 @@ public override async Task Multiple_optional_navigation_with_string_based_Includ AssertSql( """ -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], [l].[Id], [l1].[Id], [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] +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], [l].[Id], [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 [l] LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[OneToMany_Required_Inverse2Id] @@ -739,7 +739,7 @@ WHERE [l4].[Level3_Required_Id] IS NOT NULL AND [l4].[OneToMany_Required_Inverse ) AS [l5] ON CASE WHEN [l3].[Level2_Required_Id] IS NOT NULL AND [l3].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [l3].[Id] END = [l5].[OneToMany_Optional_Inverse4Id] -ORDER BY [l].[Id], [l1].[Id], [l3].[Id] +ORDER BY [l].[Id] """); } @@ -801,7 +801,7 @@ WHERE [l4].[Level3_Required_Id] IS NOT NULL AND [l4].[OneToMany_Required_Inverse ) AS [l5] ON CASE WHEN [l3].[Level2_Required_Id] IS NOT NULL AND [l3].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [l3].[Id] END = [l5].[OneToMany_Optional_Inverse4Id] -ORDER BY [l].[Id], [l1].[Id], [l3].[Id] +ORDER BY [l].[Id], [l1].[Id] """); } @@ -866,7 +866,7 @@ WHEN [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] END = [s].[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 ) AS [s0] ON [l].[Id] = [s0].[OneToMany_Optional_Inverse2Id] -ORDER BY [l].[Id], [s0].[Id], [s0].[Id0], [s0].[Id00] +ORDER BY [l].[Id], [s0].[Id], [s0].[Id0] """); } @@ -1004,7 +1004,7 @@ WHERE [l4].[Level3_Required_Id] IS NOT NULL AND [l4].[OneToMany_Required_Inverse WHEN [l3].[Level2_Required_Id] IS NOT NULL AND [l3].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [l3].[Id] END = [l5].[OneToMany_Optional_Inverse4Id] ) AS [s] -ORDER BY [l].[Id], [s].[c], [s].[Id], [s].[Id0] +ORDER BY [l].[Id], [s].[c], [s].[Id] """); } @@ -1033,7 +1033,7 @@ LEFT JOIN ( 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 ) AS [l5] ON [l4].[Id] = [l5].[OneToMany_Optional_Inverse2Id] -ORDER BY [l2].[Name], [l4].[Id] +ORDER BY [l2].[Name] """); } @@ -1067,7 +1067,7 @@ public override async Task Project_collection_navigation_nested_with_take(bool a AssertSql( """ -SELECT [l].[Id], [l1].[Id], [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] +SELECT [l].[Id], [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 [l] LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[OneToMany_Required_Inverse2Id] @@ -1085,7 +1085,7 @@ WHERE [l2].[Level2_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse ) AS [l4] ON 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 = [l4].[OneToMany_Optional_Inverse3Id] -ORDER BY [l].[Id], [l1].[Id] +ORDER BY [l].[Id] """); } @@ -1149,7 +1149,7 @@ 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 ) AS [l3] ON [l2].[Id] = [l3].[Level1_Optional_Id] ) AS [s] -ORDER BY [l4].[Date], [s].[Name], [s].[Id] +ORDER BY [l4].[Date], [s].[Name] """); } @@ -1179,7 +1179,7 @@ LEFT JOIN ( 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 ) AS [l4] ON [l].[Id] = [l4].[OneToMany_Optional_Inverse2Id] -ORDER BY [l].[Id], [s].[Id0], [s].[Id] +ORDER BY [l].[Id], [s].[Id0] """); } @@ -1211,7 +1211,7 @@ WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse 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 = [l3].[Level2_Optional_Id] ) AS [s] -ORDER BY [l4].[Id], [s].[Id] +ORDER BY [l4].[Id] """); } @@ -1250,7 +1250,7 @@ WHERE [l5].[Level3_Required_Id] IS NOT NULL AND [l5].[OneToMany_Required_Inverse ) AS [l6] ON CASE WHEN [l4].[Level2_Required_Id] IS NOT NULL AND [l4].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [l4].[Id] END = [l6].[OneToMany_Optional_Inverse4Id] -ORDER BY [l1].[Name], [l1].[Id], [l2].[Id], [l4].[Id] +ORDER BY [l1].[Name], [l1].[Id] """); } @@ -1307,7 +1307,7 @@ LEFT JOIN ( 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 ) AS [l5] ON [l4].[Id] = [l5].[OneToMany_Optional_Inverse2Id] -ORDER BY [l2].[Name], [l4].[Id] +ORDER BY [l2].[Name] """); } @@ -1335,7 +1335,7 @@ WHERE [l2].[Level2_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse ) AS [l4] ON 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 = [l4].[OneToMany_Optional_Inverse3Id] -ORDER BY [l].[Id], [l1].[Id], [l4].[OneToMany_Optional_Inverse3Id], [l4].[Level3_Name] +ORDER BY [l].[Id], [l4].[OneToMany_Optional_Inverse3Id], [l4].[Level3_Name] """); } @@ -1345,7 +1345,7 @@ public override async Task Project_collection_navigation_nested(bool async) AssertSql( """ -SELECT [l].[Id], [l1].[Id], [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] +SELECT [l].[Id], [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 [l] LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[OneToMany_Required_Inverse2Id] @@ -1359,7 +1359,7 @@ WHERE [l2].[Level2_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse ) AS [l3] ON 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 = [l3].[OneToMany_Optional_Inverse3Id] -ORDER BY [l].[Id], [l1].[Id] +ORDER BY [l].[Id] """); } @@ -1371,17 +1371,17 @@ public override async Task Lift_projection_mapping_when_pushing_down_subquery(bo """ @p='25' -SELECT [l2].[Id], [l4].[Id0], [l5].[Id], [l5].[Id0], [l4].[Id], [l4].[c] +SELECT [l2].[Id], [l5].[Id], [l5].[Id0], [l4].[Id], [l4].[c] FROM ( SELECT TOP(@p) [l].[Id] FROM [Level1] AS [l] ) AS [l2] LEFT JOIN ( - SELECT [l3].[Id], [l3].[c], [l3].[Id0], [l3].[OneToMany_Required_Inverse2Id] + SELECT [l3].[Id], [l3].[c], [l3].[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] - 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] + END AS [Id], 1 AS [c], [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 ) AS [l3] @@ -1394,7 +1394,7 @@ WHEN [l1].[OneToOne_Required_PK_Date] IS NOT NULL AND [l1].[Level1_Required_Id] 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 ) AS [l5] ON [l2].[Id] = [l5].[OneToMany_Required_Inverse2Id] -ORDER BY [l2].[Id], [l4].[Id0] +ORDER BY [l2].[Id] """); } @@ -1430,7 +1430,7 @@ WHEN [l3].[OneToOne_Required_PK_Date] IS NOT NULL AND [l3].[Level1_Required_Id] END = [l5].[OneToOne_Optional_PK_Inverse3Id] WHERE [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 [s0] ON [l].[Id] = [s0].[OneToMany_Optional_Inverse2Id] -ORDER BY [l].[Id], [s].[Id], [s].[Id0], [s0].[Id] +ORDER BY [l].[Id], [s].[Id] """); } @@ -1440,7 +1440,7 @@ public override async Task Project_collection_navigation_nested_anonymous(bool a AssertSql( """ -SELECT [l].[Id], [l1].[Id], [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] +SELECT [l].[Id], [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 [l] LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[OneToMany_Required_Inverse2Id] @@ -1454,7 +1454,7 @@ WHERE [l2].[Level2_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse ) AS [l3] ON 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 = [l3].[OneToMany_Optional_Inverse3Id] -ORDER BY [l].[Id], [l1].[Id] +ORDER BY [l].[Id] """); } @@ -1529,7 +1529,7 @@ WHEN [l6].[Level2_Required_Id] IS NOT NULL AND [l6].[OneToMany_Required_Inverse3 END = [l8].[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 ) AS [s] ON [l].[Id] = [s].[OneToMany_Optional_Inverse2Id] -ORDER BY [l].[Id], [s].[Id], [s].[Id0], [s].[Id1], [s].[Id2] +ORDER BY [l].[Id], [s].[Id] """); } @@ -1585,7 +1585,7 @@ WHEN [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] END = [l2].[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 ) AS [s] ON [l].[Id] = [s].[OneToMany_Optional_Inverse2Id] -ORDER BY [l].[Id], [s].[Id] +ORDER BY [l].[Id] """); } @@ -1624,7 +1624,7 @@ WHERE [l4].[Level2_Required_Id] IS NOT NULL AND [l4].[OneToMany_Required_Inverse ) AS [l6] 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] END = [l6].[OneToMany_Required_Inverse3Id] -ORDER BY [l1].[Name], [l1].[Id], [l2].[Id], [l5].[Id] +ORDER BY [l1].[Name], [l1].[Id], [l5].[Id] """); } @@ -1661,7 +1661,7 @@ WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse 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 = [l3].[Level2_Optional_Id] ) AS [s] -ORDER BY [l4].[Id] DESC, [s].[Level2_Name] DESC, [s].[Id] +ORDER BY [l4].[Id] DESC, [s].[Level2_Name] DESC """); } @@ -1702,16 +1702,16 @@ public override async Task Null_check_in_anonymous_type_projection_should_not_be AssertSql( """ -SELECT [l].[Id], [s].[c], [s].[Level3_Name], [s].[Id], [s].[Id0] +SELECT [l].[Id], [s].[c], [s].[Level3_Name], [s].[Id] FROM [Level1] AS [l] LEFT JOIN ( SELECT CASE WHEN [l2].[Level2_Required_Id] IS NULL OR [l2].[OneToMany_Required_Inverse3Id] IS NULL THEN CAST(1 AS bit) ELSE CAST(0 AS bit) - END AS [c], [l2].[Level3_Name], [l0].[Id], [l2].[Id] AS [Id0], [l0].[OneToMany_Optional_Inverse2Id] + END AS [c], [l2].[Level3_Name], [l0].[Id], [l0].[OneToMany_Optional_Inverse2Id] FROM [Level1] AS [l0] LEFT JOIN ( - SELECT [l1].[Id], [l1].[Level2_Required_Id], [l1].[Level3_Name], [l1].[OneToMany_Required_Inverse3Id] + SELECT [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 ) AS [l2] ON CASE @@ -1719,7 +1719,7 @@ WHEN [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] END = [l2].[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 ) AS [s] ON [l].[Id] = [s].[OneToMany_Optional_Inverse2Id] -ORDER BY [l].[Id], [s].[Id] +ORDER BY [l].[Id] """); } @@ -1788,7 +1788,7 @@ WHEN [l2].[Level2_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse3 END = [l4].[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 ) AS [s] ON [l].[Id] = [s].[OneToMany_Optional_Inverse2Id] -ORDER BY [l].[Id], [s].[Id], [s].[Id0] +ORDER BY [l].[Id] """); } @@ -1905,7 +1905,7 @@ WHEN [l1].[OneToOne_Required_PK_Date] IS NOT NULL AND [l1].[Level1_Required_Id] END = [l3].[OneToMany_Optional_Inverse3Id] 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, [l].[Id], [l1].[Id] +END, [l].[Id] """); } @@ -1915,7 +1915,7 @@ public override async Task Multiple_optional_navigation_with_Include(bool async) AssertSql( """ -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], [l].[Id], [l1].[Id], [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] +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], [l].[Id], [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 [l] LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[OneToMany_Required_Inverse2Id] @@ -1936,7 +1936,7 @@ WHERE [l4].[Level3_Required_Id] IS NOT NULL AND [l4].[OneToMany_Required_Inverse ) AS [l5] ON CASE WHEN [l3].[Level2_Required_Id] IS NOT NULL AND [l3].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [l3].[Id] END = [l5].[OneToMany_Optional_Inverse4Id] -ORDER BY [l].[Id], [l1].[Id], [l3].[Id] +ORDER BY [l].[Id] """); } @@ -1984,7 +1984,7 @@ WHEN [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] END = [l2].[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 ) AS [s] ON [l].[Id] = [s].[OneToMany_Optional_Inverse2Id] -ORDER BY [l].[Id], [s].[Id] +ORDER BY [l].[Id] """); } @@ -2056,7 +2056,7 @@ WHEN [l3].[OneToOne_Required_PK_Date] IS NOT NULL AND [l3].[Level1_Required_Id] END = [l5].[Level2_Optional_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 ) AS [s] ON [l].[Id] = [s].[OneToMany_Optional_Inverse2Id] -ORDER BY [l].[Id], [l1].[Id], [l6].[Id], [s].[Id] +ORDER BY [l].[Id], [l6].[Id] """); } @@ -2066,7 +2066,7 @@ public override async Task Project_collection_navigation_using_ef_property(bool AssertSql( """ -SELECT [l].[Id], [l1].[Id], [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] +SELECT [l].[Id], [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 [l] LEFT JOIN ( SELECT [l0].[Id], [l0].[OneToOne_Required_PK_Date], [l0].[Level1_Optional_Id], [l0].[Level1_Required_Id], [l0].[OneToMany_Required_Inverse2Id] @@ -2080,7 +2080,7 @@ WHERE [l2].[Level2_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse ) AS [l3] ON 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 = [l3].[OneToMany_Optional_Inverse3Id] -ORDER BY [l].[Id], [l1].[Id] +ORDER BY [l].[Id] """); } @@ -2139,7 +2139,7 @@ WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse 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 = [l3].[Level2_Optional_Id] ) AS [s] -ORDER BY [l4].[Id], [s].[Id] +ORDER BY [l4].[Id] """); } @@ -2171,7 +2171,7 @@ public override async Task Complex_query_with_let_collection_projection_FirstOrD AssertSql( """ -SELECT [l].[Id], [l4].[Id], [l5].[Name], [l5].[Id], [l4].[c] +SELECT [l].[Id], [l5].[Name], [l5].[Id], [l4].[c] FROM [Level1] AS [l] LEFT JOIN ( SELECT [l3].[c], [l3].[Id], [l3].[OneToOne_Required_PK_Date], [l3].[Level1_Required_Id], [l3].[OneToMany_Required_Inverse2Id], [l3].[OneToMany_Optional_Inverse2Id] @@ -2192,7 +2192,7 @@ FROM [Level1] AS [l2] WHEN [l4].[OneToOne_Required_PK_Date] IS NOT NULL AND [l4].[Level1_Required_Id] IS NOT NULL AND [l4].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [l4].[Id] END) ) AS [l5] -ORDER BY [l].[Id], [l4].[Id] +ORDER BY [l].[Id] """); } @@ -2202,7 +2202,7 @@ public override async Task Include_partially_added_before_Where_and_then_build_u AssertSql( """ -SELECT [l].[Id], [l].[Date], [l].[Name], [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], [l1].[Id], [l9].[Id], [l9].[Level2_Optional_Id], [l9].[Level2_Required_Id], [l9].[Level3_Name], [l9].[OneToMany_Optional_Inverse3Id], [l9].[OneToMany_Required_Inverse3Id], [l9].[OneToOne_Optional_PK_Inverse3Id], [s].[Id], [s].[Level2_Optional_Id], [s].[Level2_Required_Id], [s].[Level3_Name], [s].[OneToMany_Optional_Inverse3Id], [s].[OneToMany_Required_Inverse3Id], [s].[OneToOne_Optional_PK_Inverse3Id], [s].[Id0], [s].[Level3_Optional_Id], [s].[Level3_Required_Id], [s].[Level4_Name], [s].[OneToMany_Optional_Inverse4Id], [s].[OneToMany_Required_Inverse4Id], [s].[OneToOne_Optional_PK_Inverse4Id] +SELECT [l].[Id], [l].[Date], [l].[Name], [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], [l9].[Id], [l9].[Level2_Optional_Id], [l9].[Level2_Required_Id], [l9].[Level3_Name], [l9].[OneToMany_Optional_Inverse3Id], [l9].[OneToMany_Required_Inverse3Id], [l9].[OneToOne_Optional_PK_Inverse3Id], [s].[Id], [s].[Level2_Optional_Id], [s].[Level2_Required_Id], [s].[Level3_Name], [s].[OneToMany_Optional_Inverse3Id], [s].[OneToMany_Required_Inverse3Id], [s].[OneToOne_Optional_PK_Inverse3Id], [s].[Id0], [s].[Level3_Optional_Id], [s].[Level3_Required_Id], [s].[Level4_Name], [s].[OneToMany_Optional_Inverse4Id], [s].[OneToMany_Required_Inverse4Id], [s].[OneToOne_Optional_PK_Inverse4Id] 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] @@ -2248,7 +2248,7 @@ WHEN [l1].[OneToOne_Required_PK_Date] IS NOT NULL AND [l1].[Level1_Required_Id] END < 3 OR CASE WHEN [l3].[OneToOne_Required_PK_Date] IS NOT NULL AND [l3].[Level1_Required_Id] IS NOT NULL AND [l3].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [l3].[Id] END > 8 -ORDER BY [l].[Id], [l1].[Id], [l3].[Id], [l9].[OneToMany_Optional_Inverse3Id], [l9].[c], [l9].[Id], [s].[Id] +ORDER BY [l].[Id], [l9].[OneToMany_Optional_Inverse3Id], [l9].[c], [l9].[Id] """); } @@ -2286,7 +2286,7 @@ WHERE [l6].[Level3_Required_Id] IS NOT NULL AND [l6].[OneToMany_Required_Inverse ) AS [l7] ON CASE WHEN [l3].[Level2_Required_Id] IS NOT NULL AND [l3].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [l3].[Id] END = [l7].[OneToMany_Optional_Inverse4Id] -ORDER BY [l].[Id], [l1].[Id], [l3].[Id], [l5].[Id] +ORDER BY [l].[Id], [l1].[Id], [l3].[Id] """); } @@ -2341,7 +2341,7 @@ public override async Task Select_subquery_single_nested_subquery(bool async) AssertSql( """ -SELECT [l].[Id], [l3].[Id], [l4].[Id], [l4].[Id0], [l3].[c] +SELECT [l].[Id], [l4].[Id], [l4].[Id0], [l3].[c] FROM [Level1] AS [l] LEFT JOIN ( SELECT [l2].[c], [l2].[Id], [l2].[OneToOne_Required_PK_Date], [l2].[Level1_Required_Id], [l2].[OneToMany_Required_Inverse2Id], [l2].[OneToMany_Optional_Inverse2Id] @@ -2363,7 +2363,7 @@ WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse ) AS [l4] ON CASE WHEN [l3].[OneToOne_Required_PK_Date] IS NOT NULL AND [l3].[Level1_Required_Id] IS NOT NULL AND [l3].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [l3].[Id] END = [l4].[OneToMany_Optional_Inverse3Id] -ORDER BY [l].[Id], [l3].[Id], [l4].[Id] +ORDER BY [l].[Id], [l4].[Id] """); } @@ -2390,10 +2390,10 @@ public override async Task Filtered_include_same_filter_set_on_same_navigation_t AssertSql( """ -SELECT [l].[Id], [l].[Date], [l].[Name], [s].[Id], [s].[OneToOne_Required_PK_Date], [s].[Level1_Optional_Id], [s].[Level1_Required_Id], [s].[Level2_Name], [s].[OneToMany_Optional_Inverse2Id], [s].[OneToMany_Required_Inverse2Id], [s].[OneToOne_Optional_PK_Inverse2Id], [s].[Id0], [s].[Id1], [s].[Level2_Optional_Id], [s].[Level2_Required_Id], [s].[Level3_Name], [s].[OneToMany_Optional_Inverse3Id], [s].[OneToMany_Required_Inverse3Id], [s].[OneToOne_Optional_PK_Inverse3Id], [s].[Level2_Optional_Id0], [s].[Level2_Required_Id0], [s].[Level3_Name0], [s].[OneToMany_Optional_Inverse3Id0], [s].[OneToMany_Required_Inverse3Id0], [s].[OneToOne_Optional_PK_Inverse3Id0] +SELECT [l].[Id], [l].[Date], [l].[Name], [s].[Id], [s].[OneToOne_Required_PK_Date], [s].[Level1_Optional_Id], [s].[Level1_Required_Id], [s].[Level2_Name], [s].[OneToMany_Optional_Inverse2Id], [s].[OneToMany_Required_Inverse2Id], [s].[OneToOne_Optional_PK_Inverse2Id], [s].[Id0], [s].[Level2_Optional_Id], [s].[Level2_Required_Id], [s].[Level3_Name], [s].[OneToMany_Optional_Inverse3Id], [s].[OneToMany_Required_Inverse3Id], [s].[OneToOne_Optional_PK_Inverse3Id], [s].[Id1], [s].[Level2_Optional_Id0], [s].[Level2_Required_Id0], [s].[Level3_Name0], [s].[OneToMany_Optional_Inverse3Id0], [s].[OneToMany_Required_Inverse3Id0], [s].[OneToOne_Optional_PK_Inverse3Id0] FROM [Level1] AS [l] OUTER APPLY ( - SELECT [l2].[Id], [l2].[OneToOne_Required_PK_Date], [l2].[Level1_Optional_Id], [l2].[Level1_Required_Id], [l2].[Level2_Name], [l2].[OneToMany_Optional_Inverse2Id], [l2].[OneToMany_Required_Inverse2Id], [l2].[OneToOne_Optional_PK_Inverse2Id], [l3].[Id] AS [Id0], [l5].[Id] AS [Id1], [l5].[Level2_Optional_Id], [l5].[Level2_Required_Id], [l5].[Level3_Name], [l5].[OneToMany_Optional_Inverse3Id], [l5].[OneToMany_Required_Inverse3Id], [l5].[OneToOne_Optional_PK_Inverse3Id], [l3].[Level2_Optional_Id] AS [Level2_Optional_Id0], [l3].[Level2_Required_Id] AS [Level2_Required_Id0], [l3].[Level3_Name] AS [Level3_Name0], [l3].[OneToMany_Optional_Inverse3Id] AS [OneToMany_Optional_Inverse3Id0], [l3].[OneToMany_Required_Inverse3Id] AS [OneToMany_Required_Inverse3Id0], [l3].[OneToOne_Optional_PK_Inverse3Id] AS [OneToOne_Optional_PK_Inverse3Id0], [l2].[c] + 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], [l5].[Id] AS [Id0], [l5].[Level2_Optional_Id], [l5].[Level2_Required_Id], [l5].[Level3_Name], [l5].[OneToMany_Optional_Inverse3Id], [l5].[OneToMany_Required_Inverse3Id], [l5].[OneToOne_Optional_PK_Inverse3Id], [l3].[Id] AS [Id1], [l3].[Level2_Optional_Id] AS [Level2_Optional_Id0], [l3].[Level2_Required_Id] AS [Level2_Required_Id0], [l3].[Level3_Name] AS [Level3_Name0], [l3].[OneToMany_Optional_Inverse3Id] AS [OneToMany_Optional_Inverse3Id0], [l3].[OneToMany_Required_Inverse3Id] AS [OneToMany_Required_Inverse3Id0], [l3].[OneToOne_Optional_PK_Inverse3Id] AS [OneToOne_Optional_PK_Inverse3Id0], [l2].[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] @@ -2419,7 +2419,7 @@ WHERE [l4].[Level2_Required_Id] IS NOT NULL AND [l4].[OneToMany_Required_Inverse 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 = [l5].[OneToMany_Optional_Inverse3Id] ) AS [s] -ORDER BY [l].[Id], [s].[c], [s].[Id], [s].[Id0] +ORDER BY [l].[Id], [s].[c], [s].[Id] """); } @@ -2449,7 +2449,7 @@ LEFT JOIN ( 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 ) AS [l5] ON [l4].[Id] = [l5].[OneToMany_Optional_Inverse2Id] -ORDER BY [l2].[Name], [l4].[Id] +ORDER BY [l2].[Name] """); } @@ -2512,10 +2512,10 @@ await base AssertSql( """ -SELECT [l].[Id], [l].[Date], [l].[Name], [s].[Id], [s].[OneToOne_Required_PK_Date], [s].[Level1_Optional_Id], [s].[Level1_Required_Id], [s].[Level2_Name], [s].[OneToMany_Optional_Inverse2Id], [s].[OneToMany_Required_Inverse2Id], [s].[OneToOne_Optional_PK_Inverse2Id], [s].[Id0], [s].[Id1], [s].[Level2_Optional_Id], [s].[Level2_Required_Id], [s].[Level3_Name], [s].[OneToMany_Optional_Inverse3Id], [s].[OneToMany_Required_Inverse3Id], [s].[OneToOne_Optional_PK_Inverse3Id], [s].[Level2_Optional_Id0], [s].[Level2_Required_Id0], [s].[Level3_Name0], [s].[OneToMany_Optional_Inverse3Id0], [s].[OneToMany_Required_Inverse3Id0], [s].[OneToOne_Optional_PK_Inverse3Id0] +SELECT [l].[Id], [l].[Date], [l].[Name], [s].[Id], [s].[OneToOne_Required_PK_Date], [s].[Level1_Optional_Id], [s].[Level1_Required_Id], [s].[Level2_Name], [s].[OneToMany_Optional_Inverse2Id], [s].[OneToMany_Required_Inverse2Id], [s].[OneToOne_Optional_PK_Inverse2Id], [s].[Id0], [s].[Level2_Optional_Id], [s].[Level2_Required_Id], [s].[Level3_Name], [s].[OneToMany_Optional_Inverse3Id], [s].[OneToMany_Required_Inverse3Id], [s].[OneToOne_Optional_PK_Inverse3Id], [s].[Id1], [s].[Level2_Optional_Id0], [s].[Level2_Required_Id0], [s].[Level3_Name0], [s].[OneToMany_Optional_Inverse3Id0], [s].[OneToMany_Required_Inverse3Id0], [s].[OneToOne_Optional_PK_Inverse3Id0] FROM [Level1] AS [l] OUTER APPLY ( - SELECT [l2].[Id], [l2].[OneToOne_Required_PK_Date], [l2].[Level1_Optional_Id], [l2].[Level1_Required_Id], [l2].[Level2_Name], [l2].[OneToMany_Optional_Inverse2Id], [l2].[OneToMany_Required_Inverse2Id], [l2].[OneToOne_Optional_PK_Inverse2Id], [l3].[Id] AS [Id0], [l5].[Id] AS [Id1], [l5].[Level2_Optional_Id], [l5].[Level2_Required_Id], [l5].[Level3_Name], [l5].[OneToMany_Optional_Inverse3Id], [l5].[OneToMany_Required_Inverse3Id], [l5].[OneToOne_Optional_PK_Inverse3Id], [l3].[Level2_Optional_Id] AS [Level2_Optional_Id0], [l3].[Level2_Required_Id] AS [Level2_Required_Id0], [l3].[Level3_Name] AS [Level3_Name0], [l3].[OneToMany_Optional_Inverse3Id] AS [OneToMany_Optional_Inverse3Id0], [l3].[OneToMany_Required_Inverse3Id] AS [OneToMany_Required_Inverse3Id0], [l3].[OneToOne_Optional_PK_Inverse3Id] AS [OneToOne_Optional_PK_Inverse3Id0], [l2].[c] + 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], [l5].[Id] AS [Id0], [l5].[Level2_Optional_Id], [l5].[Level2_Required_Id], [l5].[Level3_Name], [l5].[OneToMany_Optional_Inverse3Id], [l5].[OneToMany_Required_Inverse3Id], [l5].[OneToOne_Optional_PK_Inverse3Id], [l3].[Id] AS [Id1], [l3].[Level2_Optional_Id] AS [Level2_Optional_Id0], [l3].[Level2_Required_Id] AS [Level2_Required_Id0], [l3].[Level3_Name] AS [Level3_Name0], [l3].[OneToMany_Optional_Inverse3Id] AS [OneToMany_Optional_Inverse3Id0], [l3].[OneToMany_Required_Inverse3Id] AS [OneToMany_Required_Inverse3Id0], [l3].[OneToOne_Optional_PK_Inverse3Id] AS [OneToOne_Optional_PK_Inverse3Id0], [l2].[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] @@ -2541,7 +2541,7 @@ WHERE [l4].[Level2_Required_Id] IS NOT NULL AND [l4].[OneToMany_Required_Inverse 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 = [l5].[OneToMany_Optional_Inverse3Id] ) AS [s] -ORDER BY [l].[Id], [s].[c], [s].[Id], [s].[Id0] +ORDER BY [l].[Id], [s].[c], [s].[Id] """); } @@ -2631,7 +2631,7 @@ WHEN [l6].[Level2_Required_Id] IS NOT NULL AND [l6].[OneToMany_Required_Inverse3 END = [l8].[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 ) AS [s] ON [l].[Id] = [s].[OneToMany_Optional_Inverse2Id] -ORDER BY [l].[Id], [s].[Id], [s].[Id0], [s].[Id1], [s].[Id2] +ORDER BY [l].[Id], [s].[Id] """); } @@ -2683,7 +2683,7 @@ WHERE [l2].[Level2_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse ) AS [s] ON 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 = [s].[OneToMany_Optional_Inverse3Id] -ORDER BY [l].[Id], [l1].[Id], [s].[Id] +ORDER BY [l].[Id] """); } @@ -2712,7 +2712,7 @@ LEFT JOIN ( 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 ) AS [l5] ON [l].[Id] = [l5].[OneToMany_Required_Inverse2Id] -ORDER BY [l].[Id], [l1].[Id], [l3].[Id] +ORDER BY [l].[Id] """); } @@ -2736,7 +2736,7 @@ WHERE [l2].[Level2_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse ) AS [l3] ON 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 = [l3].[OneToMany_Optional_Inverse3Id] -ORDER BY [l1].[Level2_Name], [l].[Id], [l1].[Id] +ORDER BY [l1].[Level2_Name], [l].[Id] """); } @@ -2746,7 +2746,7 @@ public override async Task Include_partially_added_before_Where_and_then_build_u AssertSql( """ -SELECT [l].[Id], [l].[Date], [l].[Name], [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], [l1].[Id], [s].[Id], [s].[Level2_Optional_Id], [s].[Level2_Required_Id], [s].[Level3_Name], [s].[OneToMany_Optional_Inverse3Id], [s].[OneToMany_Required_Inverse3Id], [s].[OneToOne_Optional_PK_Inverse3Id], [s].[Id0], [s].[Level3_Optional_Id], [s].[Level3_Required_Id], [s].[Level4_Name], [s].[OneToMany_Optional_Inverse4Id], [s].[OneToMany_Required_Inverse4Id], [s].[OneToOne_Optional_PK_Inverse4Id] +SELECT [l].[Id], [l].[Date], [l].[Name], [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], [s].[Id], [s].[Level2_Optional_Id], [s].[Level2_Required_Id], [s].[Level3_Name], [s].[OneToMany_Optional_Inverse3Id], [s].[OneToMany_Required_Inverse3Id], [s].[OneToOne_Optional_PK_Inverse3Id], [s].[Id0], [s].[Level3_Optional_Id], [s].[Level3_Required_Id], [s].[Level4_Name], [s].[OneToMany_Optional_Inverse4Id], [s].[OneToMany_Required_Inverse4Id], [s].[OneToOne_Optional_PK_Inverse4Id] 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] @@ -2777,7 +2777,7 @@ WHEN [l1].[OneToOne_Required_PK_Date] IS NOT NULL AND [l1].[Level1_Required_Id] END < 3 OR CASE WHEN [l3].[OneToOne_Required_PK_Date] IS NOT NULL AND [l3].[Level1_Required_Id] IS NOT NULL AND [l3].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [l3].[Id] END > 8 -ORDER BY [l].[Id], [l1].[Id], [l3].[Id], [s].[Id] +ORDER BY [l].[Id] """); } @@ -2819,7 +2819,7 @@ WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse WHEN [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [l0].[Id] END = [l2].[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 ([l2].[Level3_Name] <> N'Foo' OR [l2].[Level3_Name] IS NULL)) > 0 -ORDER BY [l].[Id], [s].[Id], [s].[Id0] +ORDER BY [l].[Id] """); } @@ -2852,7 +2852,7 @@ public override async Task LeftJoin_with_Any_on_outer_source_and_projecting_coll SELECT CASE WHEN [s].[OneToOne_Required_PK_Date] IS NULL OR [s].[Level1_Required_Id] IS NULL OR [s].[OneToMany_Required_Inverse2Id] IS NULL THEN 0 WHEN [s].[OneToOne_Required_PK_Date] IS NOT NULL AND [s].[Level1_Required_Id] IS NOT NULL AND [s].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [s].[Id0] -END, [l].[Id], [s].[Id], [s].[Id0], [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] +END, [l].[Id], [s].[Id], [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 [l] LEFT JOIN ( SELECT [l0].[Id], [l2].[Id] AS [Id0], [l2].[OneToOne_Required_PK_Date], [l2].[Level1_Required_Id], [l2].[OneToMany_Required_Inverse2Id] @@ -2874,7 +2874,7 @@ WHERE [l3].[Level2_Required_Id] IS NOT NULL AND [l3].[OneToMany_Required_Inverse WHEN [s].[OneToOne_Required_PK_Date] IS NOT NULL AND [s].[Level1_Required_Id] IS NOT NULL AND [s].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [s].[Id0] END = [l4].[OneToMany_Required_Inverse3Id] WHERE [l].[Name] IN (@validIds1, @validIds2) -ORDER BY [l].[Id], [s].[Id], [s].[Id0] +ORDER BY [l].[Id], [s].[Id] """); } @@ -2932,16 +2932,16 @@ public override async Task Null_check_in_Dto_projection_should_not_be_removed(bo AssertSql( """ -SELECT [l].[Id], [s].[c], [s].[Level3_Name], [s].[Id], [s].[Id0] +SELECT [l].[Id], [s].[c], [s].[Level3_Name], [s].[Id] FROM [Level1] AS [l] LEFT JOIN ( SELECT CASE WHEN [l2].[Level2_Required_Id] IS NULL OR [l2].[OneToMany_Required_Inverse3Id] IS NULL THEN CAST(1 AS bit) ELSE CAST(0 AS bit) - END AS [c], [l2].[Level3_Name], [l0].[Id], [l2].[Id] AS [Id0], [l0].[OneToMany_Optional_Inverse2Id] + END AS [c], [l2].[Level3_Name], [l0].[Id], [l0].[OneToMany_Optional_Inverse2Id] FROM [Level1] AS [l0] LEFT JOIN ( - SELECT [l1].[Id], [l1].[Level2_Required_Id], [l1].[Level3_Name], [l1].[OneToMany_Required_Inverse3Id] + SELECT [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 ) AS [l2] ON CASE @@ -2949,7 +2949,7 @@ WHEN [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] END = [l2].[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 ) AS [s] ON [l].[Id] = [s].[OneToMany_Optional_Inverse2Id] -ORDER BY [l].[Id], [s].[Id] +ORDER BY [l].[Id] """); } @@ -3098,7 +3098,7 @@ WHERE [l2].[Level2_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse ) AS [l3] ON 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 = [l3].[OneToMany_Optional_Inverse3Id] -ORDER BY [l].[Name], [l].[Id], [l1].[Id] +ORDER BY [l].[Name], [l].[Id] """); } @@ -3155,7 +3155,7 @@ WHEN [l2].[Level2_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse3 END = [l4].[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 ) AS [s] ON [l].[Id] = [s].[OneToMany_Optional_Inverse2Id] -ORDER BY [l].[Id], [s].[Id], [s].[Id0] +ORDER BY [l].[Id] """); } @@ -3236,7 +3236,7 @@ WHEN [l2].[Level2_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse3 END = [l4].[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 ) AS [s] ON [l].[Id] = [s].[OneToMany_Optional_Inverse2Id] -ORDER BY [l].[Id], [s].[Id1], [s].[Id] +ORDER BY [l].[Id] """); } @@ -3260,7 +3260,7 @@ WHERE [l2].[Level2_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse ) AS [l3] ON 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 = [l3].[OneToMany_Optional_Inverse3Id] -ORDER BY [l].[Id], [l1].[Id] +ORDER BY [l].[Id] """); } @@ -3284,7 +3284,7 @@ WHERE [l2].[Level2_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse ) AS [l3] ON 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 = [l3].[OneToMany_Optional_Inverse3Id] -ORDER BY [l].[Name], [l].[Id], [l1].[Id] +ORDER BY [l].[Name], [l].[Id] """); } @@ -3485,7 +3485,7 @@ public override async Task Projecting_collection_after_optional_reference_correl AssertSql( """ -SELECT [l].[Id], [l1].[Id], [l3].[ChildId], [l3].[ParentName], [l3].[Id] +SELECT [l].[Id], [l3].[ChildId], [l3].[ParentName], [l3].[Id] 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] @@ -3505,7 +3505,7 @@ WHEN [l1].[OneToOne_Required_PK_Date] IS NOT NULL AND [l1].[Level1_Required_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 IS NULL AND [l2].[OneToMany_Optional_Inverse3Id] IS NULL)) ) AS [l3] -ORDER BY [l].[Id], [l1].[Id] +ORDER BY [l].[Id] """); } @@ -3515,7 +3515,7 @@ public override async Task Projecting_collection_with_group_by_after_optional_re AssertSql( """ -SELECT [l].[Id], [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], [l1].[Id], [l5].[Key], [l5].[Count] +SELECT [l].[Id], [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], [l5].[Key], [l5].[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] @@ -3541,7 +3541,7 @@ WHEN [l1].[OneToOne_Required_PK_Date] IS NOT NULL AND [l1].[Level1_Required_Id] END IS NULL AND [l4].[OneToMany_Optional_Inverse3Id] IS NULL)) GROUP BY [l4].[Level3_Name] ) AS [l5] -ORDER BY [l].[Id], [l1].[Id], [l3].[Id] +ORDER BY [l].[Id] """); } @@ -3584,7 +3584,7 @@ WHEN [l3].[OneToOne_Required_PK_Date] IS NOT NULL AND [l3].[Level1_Required_Id] END = [l5].[Level2_Optional_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 ) AS [s] ON [l].[Id] = [s].[OneToMany_Optional_Inverse2Id] -ORDER BY [l].[Id], [l1].[Id], [l6].[Id], [s].[Id] +ORDER BY [l].[Id], [l6].[Id] """); } @@ -3626,7 +3626,7 @@ WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse WHEN [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [l0].[Id] END = [l2].[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 ([l2].[Level3_Name] <> N'Foo' OR [l2].[Level3_Name] IS NULL)) > 0 -ORDER BY [l].[Id], [s].[Id], [s].[Id0] +ORDER BY [l].[Id] """); } @@ -3709,7 +3709,7 @@ WHERE [l2].[Level2_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse ) AS [l4] ON 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 = [l4].[OneToMany_Optional_Inverse3Id] -ORDER BY [l].[Id], [l1].[Id], [l4].[OneToMany_Optional_Inverse3Id], [l4].[Level3_Name] +ORDER BY [l].[Id], [l4].[OneToMany_Optional_Inverse3Id], [l4].[Level3_Name] """); } @@ -3774,7 +3774,7 @@ WHEN [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] END = [l2].[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 ) AS [s] ON [l].[Id] = [s].[OneToMany_Optional_Inverse2Id] -ORDER BY [l].[Name], [l].[Id], [s].[Id] +ORDER BY [l].[Name], [l].[Id] """); } @@ -3806,7 +3806,7 @@ public override async Task Final_GroupBy_property_entity_Include_collection_refe AssertSql( """ -SELECT [l].[Name], [l].[Id], [l].[Date], [l1].[Id], [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], [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] +SELECT [l].[Name], [l].[Id], [l].[Date], [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], [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 [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] @@ -3818,7 +3818,7 @@ LEFT JOIN ( 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 ) AS [l3] ON [l].[Id] = [l3].[OneToMany_Optional_Inverse2Id] -ORDER BY [l].[Name], [l].[Id], [l1].[Id] +ORDER BY [l].[Name], [l].[Id] """); } diff --git a/test/EFCore.SqlServer.FunctionalTests/Query/ComplexNavigationsCollectionsSplitQuerySqlServerTest.cs b/test/EFCore.SqlServer.FunctionalTests/Query/ComplexNavigationsCollectionsSplitQuerySqlServerTest.cs index 397431f911c..010b4b2ed0b 100644 --- a/test/EFCore.SqlServer.FunctionalTests/Query/ComplexNavigationsCollectionsSplitQuerySqlServerTest.cs +++ b/test/EFCore.SqlServer.FunctionalTests/Query/ComplexNavigationsCollectionsSplitQuerySqlServerTest.cs @@ -256,11 +256,11 @@ public override async Task Filtered_include_on_ThenInclude(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] -ORDER BY [l].[Id], [l0].[Id] +ORDER BY [l].[Id] """, // """ -SELECT [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], [l].[Id], [l0].[Id] +SELECT [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], [l].[Id] FROM [LevelOne] AS [l] LEFT JOIN [LevelTwo] AS [l0] ON [l].[Id] = [l0].[Level1_Optional_Id] INNER JOIN ( @@ -272,7 +272,7 @@ WHERE [l1].[Name] <> N'Foo' OR [l1].[Name] IS NULL ) AS [l2] WHERE 1 < [l2].[row] AND [l2].[row] <= 4 ) AS [l3] ON [l0].[Id] = [l3].[OneToMany_Optional_Inverse3Id] -ORDER BY [l].[Id], [l0].[Id], [l3].[OneToMany_Optional_Inverse3Id], [l3].[Name] +ORDER BY [l].[Id], [l3].[OneToMany_Optional_Inverse3Id], [l3].[Name] """); } @@ -285,11 +285,11 @@ public override async Task Filtered_include_after_reference_navigation(bool asyn 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] -ORDER BY [l].[Id], [l0].[Id] +ORDER BY [l].[Id] """, // """ -SELECT [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], [l].[Id], [l0].[Id] +SELECT [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], [l].[Id] FROM [LevelOne] AS [l] LEFT JOIN [LevelTwo] AS [l0] ON [l].[Id] = [l0].[Level1_Optional_Id] INNER JOIN ( @@ -301,7 +301,7 @@ WHERE [l1].[Name] <> N'Foo' OR [l1].[Name] IS NULL ) AS [l2] WHERE 1 < [l2].[row] AND [l2].[row] <= 4 ) AS [l3] ON [l0].[Id] = [l3].[OneToMany_Optional_Inverse3Id] -ORDER BY [l].[Id], [l0].[Id], [l3].[OneToMany_Optional_Inverse3Id], [l3].[Name] +ORDER BY [l].[Id], [l3].[OneToMany_Optional_Inverse3Id], [l3].[Name] """); } @@ -449,24 +449,23 @@ ORDER BY [l0].[Id] ) AS [l2] LEFT JOIN [LevelThree] AS [l1] ON [l2].[Id] = [l1].[Level2_Required_Id] ) AS [s] -ORDER BY [l].[Id], [s].[Id], [s].[Id0] +ORDER BY [l].[Id], [s].[Id] """, // """ -SELECT [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], [l].[Id], [s].[Id], [s].[Id0] +SELECT [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], [l].[Id], [s].[Id] FROM [LevelOne] AS [l] CROSS APPLY ( - SELECT [l2].[Id], [l1].[Id] AS [Id0] + SELECT [l2].[Id] FROM ( SELECT TOP(2) [l0].[Id] FROM [LevelTwo] AS [l0] WHERE [l].[Id] = [l0].[OneToMany_Optional_Inverse2Id] AND ([l0].[Name] <> N'Foo' OR [l0].[Name] IS NULL) ORDER BY [l0].[Id] ) AS [l2] - LEFT JOIN [LevelThree] AS [l1] ON [l2].[Id] = [l1].[Level2_Required_Id] ) AS [s] INNER JOIN [LevelThree] AS [l3] ON [s].[Id] = [l3].[OneToMany_Optional_Inverse3Id] -ORDER BY [l].[Id], [s].[Id], [s].[Id0] +ORDER BY [l].[Id], [s].[Id] """); } @@ -496,24 +495,23 @@ ORDER BY [l0].[Id] ) AS [l2] LEFT JOIN [LevelThree] AS [l1] ON [l2].[Id] = [l1].[Level2_Required_Id] ) AS [s] -ORDER BY [l].[Id], [s].[Id], [s].[Id0] +ORDER BY [l].[Id], [s].[Id] """, // """ -SELECT [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], [l].[Id], [s].[Id], [s].[Id0] +SELECT [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], [l].[Id], [s].[Id] FROM [LevelOne] AS [l] CROSS APPLY ( - SELECT [l2].[Id], [l1].[Id] AS [Id0] + SELECT [l2].[Id] FROM ( SELECT TOP(2) [l0].[Id] FROM [LevelTwo] AS [l0] WHERE [l].[Id] = [l0].[OneToMany_Optional_Inverse2Id] AND ([l0].[Name] <> N'Foo' OR [l0].[Name] IS NULL) ORDER BY [l0].[Id] ) AS [l2] - LEFT JOIN [LevelThree] AS [l1] ON [l2].[Id] = [l1].[Level2_Required_Id] ) AS [s] INNER JOIN [LevelThree] AS [l3] ON [s].[Id] = [l3].[OneToMany_Optional_Inverse3Id] -ORDER BY [l].[Id], [s].[Id], [s].[Id0] +ORDER BY [l].[Id], [s].[Id] """); } @@ -595,11 +593,11 @@ ORDER BY [l0].[Id] ) AS [l2] LEFT JOIN [LevelThree] AS [l1] ON [l2].[Id] = [l1].[OneToOne_Optional_PK_Inverse3Id] ) AS [s] -ORDER BY [l].[Id], [s].[Id], [s].[Id0] +ORDER BY [l].[Id], [s].[Id] """, // """ -SELECT [l4].[Id], [l4].[Level3_Optional_Id], [l4].[Level3_Required_Id], [l4].[Name], [l4].[OneToMany_Optional_Inverse4Id], [l4].[OneToMany_Optional_Self_Inverse4Id], [l4].[OneToMany_Required_Inverse4Id], [l4].[OneToMany_Required_Self_Inverse4Id], [l4].[OneToOne_Optional_PK_Inverse4Id], [l4].[OneToOne_Optional_Self4Id], [l].[Id], [s].[Id], [s].[Id0] +SELECT [l4].[Id], [l4].[Level3_Optional_Id], [l4].[Level3_Required_Id], [l4].[Name], [l4].[OneToMany_Optional_Inverse4Id], [l4].[OneToMany_Optional_Self_Inverse4Id], [l4].[OneToMany_Required_Inverse4Id], [l4].[OneToMany_Required_Self_Inverse4Id], [l4].[OneToOne_Optional_PK_Inverse4Id], [l4].[OneToOne_Optional_Self4Id], [l].[Id], [s].[Id] FROM [LevelOne] AS [l] CROSS APPLY ( SELECT [l2].[Id], [l1].[Id] AS [Id0] @@ -616,7 +614,7 @@ INNER JOIN ( FROM [LevelFour] AS [l3] WHERE [l3].[Id] > 1 ) AS [l4] ON [s].[Id0] = [l4].[OneToMany_Optional_Inverse4Id] -ORDER BY [l].[Id], [s].[Id], [s].[Id0] +ORDER BY [l].[Id], [s].[Id] """); } @@ -920,20 +918,20 @@ await base.Complex_SelectMany_with_nested_navigations_and_explicit_DefaultIfEmpt AssertSql( """ -SELECT [l2].[Id], [l2].[Level3_Optional_Id], [l2].[Level3_Required_Id], [l2].[Name], [l2].[OneToMany_Optional_Inverse4Id], [l2].[OneToMany_Optional_Self_Inverse4Id], [l2].[OneToMany_Required_Inverse4Id], [l2].[OneToMany_Required_Self_Inverse4Id], [l2].[OneToOne_Optional_PK_Inverse4Id], [l2].[OneToOne_Optional_Self4Id], [l].[Id], [l0].[Id], [l1].[Id], [s].[Id], [s].[Id0], [s].[Id1], [s].[Id2], [s0].[Id], [s0].[Id0], [s0].[Id1], [s0].[Id2], [l11].[Id], [l12].[Id], [l13].[Id], [l14].[Id], [l14].[Name] +SELECT [l2].[Id], [l2].[Level3_Optional_Id], [l2].[Level3_Required_Id], [l2].[Name], [l2].[OneToMany_Optional_Inverse4Id], [l2].[OneToMany_Optional_Self_Inverse4Id], [l2].[OneToMany_Required_Inverse4Id], [l2].[OneToMany_Required_Self_Inverse4Id], [l2].[OneToOne_Optional_PK_Inverse4Id], [l2].[OneToOne_Optional_Self4Id], [l].[Id], [s].[Id], [s].[Id2], [s0].[Id], [s0].[Id2], [l14].[Name] 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_Optional_Id] LEFT JOIN [LevelFour] AS [l2] ON [l1].[Id] = [l2].[OneToMany_Required_Inverse4Id] INNER JOIN ( - SELECT [l3].[Id], [l4].[Id] AS [Id0], [l5].[Id] AS [Id1], [l6].[Id] AS [Id2] + SELECT [l3].[Id], [l6].[Id] AS [Id2] FROM [LevelFour] AS [l3] INNER JOIN [LevelThree] AS [l4] ON [l3].[Level3_Required_Id] = [l4].[Id] LEFT JOIN [LevelTwo] AS [l5] ON [l4].[Level2_Optional_Id] = [l5].[Id] LEFT JOIN [LevelTwo] AS [l6] ON [l5].[Id] = [l6].[OneToMany_Required_Self_Inverse2Id] ) AS [s] ON [l2].[Id] = [s].[Id2] LEFT JOIN ( - SELECT [l7].[Id], [l8].[Id] AS [Id0], [l9].[Id] AS [Id1], [l10].[Id] AS [Id2], [l10].[Level2_Optional_Id] AS [Level2_Optional_Id0] + SELECT [l7].[Id], [l10].[Id] AS [Id2], [l10].[Level2_Optional_Id] AS [Level2_Optional_Id0] FROM [LevelFour] AS [l7] INNER JOIN [LevelThree] AS [l8] ON [l7].[Level3_Required_Id] = [l8].[Id] INNER JOIN [LevelTwo] AS [l9] ON [l8].[Level2_Required_Id] = [l9].[Id] @@ -944,24 +942,24 @@ FROM [LevelFour] AS [l7] LEFT JOIN [LevelTwo] AS [l13] ON [s0].[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 -ORDER BY [l12].[Id], [l].[Id], [l0].[Id], [l1].[Id], [l2].[Id], [s].[Id], [s].[Id0], [s].[Id1], [s].[Id2], [s0].[Id], [s0].[Id0], [s0].[Id1], [s0].[Id2], [l11].[Id], [l13].[Id], [l14].[Id] +ORDER BY [l12].[Id], [l].[Id], [l2].[Id], [s].[Id], [s].[Id2], [s0].[Id], [s0].[Id2] """, // """ -SELECT [l18].[Id], [l18].[Date], [l18].[Level1_Optional_Id], [l18].[Level1_Required_Id], [l18].[Name], [l18].[OneToMany_Optional_Inverse2Id], [l18].[OneToMany_Optional_Self_Inverse2Id], [l18].[OneToMany_Required_Inverse2Id], [l18].[OneToMany_Required_Self_Inverse2Id], [l18].[OneToOne_Optional_PK_Inverse2Id], [l18].[OneToOne_Optional_Self2Id], [l].[Id], [l0].[Id], [l1].[Id], [l2].[Id], [s].[Id], [s].[Id0], [s].[Id1], [s].[Id2], [s0].[Id], [s0].[Id0], [s0].[Id1], [s0].[Id2], [l11].[Id], [l12].[Id], [l13].[Id], [l14].[Id] +SELECT [l18].[Id], [l18].[Date], [l18].[Level1_Optional_Id], [l18].[Level1_Required_Id], [l18].[Name], [l18].[OneToMany_Optional_Inverse2Id], [l18].[OneToMany_Optional_Self_Inverse2Id], [l18].[OneToMany_Required_Inverse2Id], [l18].[OneToMany_Required_Self_Inverse2Id], [l18].[OneToOne_Optional_PK_Inverse2Id], [l18].[OneToOne_Optional_Self2Id], [l].[Id], [l2].[Id], [s].[Id], [s].[Id2], [s0].[Id], [s0].[Id2] 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_Optional_Id] LEFT JOIN [LevelFour] AS [l2] ON [l1].[Id] = [l2].[OneToMany_Required_Inverse4Id] INNER JOIN ( - SELECT [l3].[Id], [l4].[Id] AS [Id0], [l5].[Id] AS [Id1], [l6].[Id] AS [Id2] + SELECT [l3].[Id], [l6].[Id] AS [Id2] FROM [LevelFour] AS [l3] INNER JOIN [LevelThree] AS [l4] ON [l3].[Level3_Required_Id] = [l4].[Id] LEFT JOIN [LevelTwo] AS [l5] ON [l4].[Level2_Optional_Id] = [l5].[Id] LEFT JOIN [LevelTwo] AS [l6] ON [l5].[Id] = [l6].[OneToMany_Required_Self_Inverse2Id] ) AS [s] ON [l2].[Id] = [s].[Id2] LEFT JOIN ( - SELECT [l7].[Id], [l8].[Id] AS [Id0], [l9].[Id] AS [Id1], [l10].[Id] AS [Id2], [l10].[Level2_Optional_Id] AS [Level2_Optional_Id0] + SELECT [l7].[Id], [l10].[Id] AS [Id2] FROM [LevelFour] AS [l7] INNER JOIN [LevelThree] AS [l8] ON [l7].[Level3_Required_Id] = [l8].[Id] INNER JOIN [LevelTwo] AS [l9] ON [l8].[Level2_Required_Id] = [l9].[Id] @@ -969,15 +967,13 @@ FROM [LevelFour] AS [l7] ) AS [s0] ON [s].[Id2] = [s0].[Id2] LEFT JOIN [LevelThree] AS [l11] ON [l2].[OneToMany_Optional_Inverse4Id] = [l11].[Id] LEFT JOIN [LevelThree] AS [l12] ON [s].[Id2] = [l12].[Level2_Optional_Id] -LEFT JOIN [LevelTwo] AS [l13] ON [s0].[Level2_Optional_Id0] = [l13].[Id] -LEFT JOIN [LevelThree] AS [l14] ON [l13].[Id] = [l14].[Level2_Required_Id] INNER JOIN ( SELECT [l17].[Id], [l17].[Date], [l17].[Level1_Optional_Id], [l17].[Level1_Required_Id], [l17].[Name], [l17].[OneToMany_Optional_Inverse2Id], [l17].[OneToMany_Optional_Self_Inverse2Id], [l17].[OneToMany_Required_Inverse2Id], [l17].[OneToMany_Required_Self_Inverse2Id], [l17].[OneToOne_Optional_PK_Inverse2Id], [l17].[OneToOne_Optional_Self2Id] FROM [LevelTwo] AS [l17] WHERE [l17].[Id] <> 42 ) AS [l18] ON [s].[Id2] = [l18].[OneToMany_Optional_Self_Inverse2Id] WHERE [l11].[Name] <> N'Foo' OR [l11].[Name] IS NULL -ORDER BY [l12].[Id], [l].[Id], [l0].[Id], [l1].[Id], [l2].[Id], [s].[Id], [s].[Id0], [s].[Id1], [s].[Id2], [s0].[Id], [s0].[Id0], [s0].[Id1], [s0].[Id2], [l11].[Id], [l13].[Id], [l14].[Id] +ORDER BY [l12].[Id], [l].[Id], [l2].[Id], [s].[Id], [s].[Id2], [s0].[Id], [s0].[Id2] """); } @@ -1006,18 +1002,17 @@ public override async Task Project_collection_navigation_nested(bool async) AssertSql( """ -SELECT [l].[Id], [l0].[Id] +SELECT [l].[Id] FROM [LevelOne] AS [l] -LEFT JOIN [LevelTwo] AS [l0] ON [l].[Id] = [l0].[Level1_Optional_Id] -ORDER BY [l].[Id], [l0].[Id] +ORDER BY [l].[Id] """, // """ -SELECT [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Name], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Optional_Self_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[OneToMany_Required_Self_Inverse3Id], [l1].[OneToOne_Optional_PK_Inverse3Id], [l1].[OneToOne_Optional_Self3Id], [l].[Id], [l0].[Id] +SELECT [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Name], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Optional_Self_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[OneToMany_Required_Self_Inverse3Id], [l1].[OneToOne_Optional_PK_Inverse3Id], [l1].[OneToOne_Optional_Self3Id], [l].[Id] FROM [LevelOne] AS [l] LEFT JOIN [LevelTwo] AS [l0] ON [l].[Id] = [l0].[Level1_Optional_Id] INNER JOIN [LevelThree] AS [l1] ON [l0].[Id] = [l1].[OneToMany_Optional_Inverse3Id] -ORDER BY [l].[Id], [l0].[Id] +ORDER BY [l].[Id] """); } @@ -1027,14 +1022,13 @@ public override async Task Project_collection_navigation_nested_with_take(bool a AssertSql( """ -SELECT [l].[Id], [l0].[Id] +SELECT [l].[Id] FROM [LevelOne] AS [l] -LEFT JOIN [LevelTwo] AS [l0] ON [l].[Id] = [l0].[Level1_Optional_Id] -ORDER BY [l].[Id], [l0].[Id] +ORDER BY [l].[Id] """, // """ -SELECT [l5].[Id], [l5].[Level2_Optional_Id], [l5].[Level2_Required_Id], [l5].[Name], [l5].[OneToMany_Optional_Inverse3Id], [l5].[OneToMany_Optional_Self_Inverse3Id], [l5].[OneToMany_Required_Inverse3Id], [l5].[OneToMany_Required_Self_Inverse3Id], [l5].[OneToOne_Optional_PK_Inverse3Id], [l5].[OneToOne_Optional_Self3Id], [l].[Id], [l0].[Id] +SELECT [l5].[Id], [l5].[Level2_Optional_Id], [l5].[Level2_Required_Id], [l5].[Name], [l5].[OneToMany_Optional_Inverse3Id], [l5].[OneToMany_Optional_Self_Inverse3Id], [l5].[OneToMany_Required_Inverse3Id], [l5].[OneToMany_Required_Self_Inverse3Id], [l5].[OneToOne_Optional_PK_Inverse3Id], [l5].[OneToOne_Optional_Self3Id], [l].[Id] FROM [LevelOne] AS [l] LEFT JOIN [LevelTwo] AS [l0] ON [l].[Id] = [l0].[Level1_Optional_Id] INNER JOIN ( @@ -1045,7 +1039,7 @@ FROM [LevelThree] AS [l3] ) AS [l4] WHERE [l4].[row] <= 50 ) AS [l5] ON [l0].[Id] = [l5].[OneToMany_Optional_Inverse3Id] -ORDER BY [l].[Id], [l0].[Id] +ORDER BY [l].[Id] """); } @@ -1055,18 +1049,17 @@ public override async Task Project_collection_navigation_using_ef_property(bool AssertSql( """ -SELECT [l].[Id], [l0].[Id] +SELECT [l].[Id] FROM [LevelOne] AS [l] -LEFT JOIN [LevelTwo] AS [l0] ON [l].[Id] = [l0].[Level1_Optional_Id] -ORDER BY [l].[Id], [l0].[Id] +ORDER BY [l].[Id] """, // """ -SELECT [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Name], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Optional_Self_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[OneToMany_Required_Self_Inverse3Id], [l1].[OneToOne_Optional_PK_Inverse3Id], [l1].[OneToOne_Optional_Self3Id], [l].[Id], [l0].[Id] +SELECT [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Name], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Optional_Self_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[OneToMany_Required_Self_Inverse3Id], [l1].[OneToOne_Optional_PK_Inverse3Id], [l1].[OneToOne_Optional_Self3Id], [l].[Id] FROM [LevelOne] AS [l] LEFT JOIN [LevelTwo] AS [l0] ON [l].[Id] = [l0].[Level1_Optional_Id] INNER JOIN [LevelThree] AS [l1] ON [l0].[Id] = [l1].[OneToMany_Optional_Inverse3Id] -ORDER BY [l].[Id], [l0].[Id] +ORDER BY [l].[Id] """); } @@ -1076,18 +1069,17 @@ public override async Task Project_collection_navigation_nested_anonymous(bool a AssertSql( """ -SELECT [l].[Id], [l0].[Id] +SELECT [l].[Id] FROM [LevelOne] AS [l] -LEFT JOIN [LevelTwo] AS [l0] ON [l].[Id] = [l0].[Level1_Optional_Id] -ORDER BY [l].[Id], [l0].[Id] +ORDER BY [l].[Id] """, // """ -SELECT [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Name], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Optional_Self_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[OneToMany_Required_Self_Inverse3Id], [l1].[OneToOne_Optional_PK_Inverse3Id], [l1].[OneToOne_Optional_Self3Id], [l].[Id], [l0].[Id] +SELECT [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Name], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Optional_Self_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[OneToMany_Required_Self_Inverse3Id], [l1].[OneToOne_Optional_PK_Inverse3Id], [l1].[OneToOne_Optional_Self3Id], [l].[Id] FROM [LevelOne] AS [l] LEFT JOIN [LevelTwo] AS [l0] ON [l].[Id] = [l0].[Level1_Optional_Id] INNER JOIN [LevelThree] AS [l1] ON [l0].[Id] = [l1].[OneToMany_Optional_Inverse3Id] -ORDER BY [l].[Id], [l0].[Id] +ORDER BY [l].[Id] """); } @@ -1170,15 +1162,15 @@ public override async Task Project_navigation_and_collection(bool async) 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], [l].[Id] FROM [LevelOne] AS [l] LEFT JOIN [LevelTwo] AS [l0] ON [l].[Id] = [l0].[Level1_Optional_Id] -ORDER BY [l].[Id], [l0].[Id] +ORDER BY [l].[Id] """, // """ -SELECT [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Name], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Optional_Self_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[OneToMany_Required_Self_Inverse3Id], [l1].[OneToOne_Optional_PK_Inverse3Id], [l1].[OneToOne_Optional_Self3Id], [l].[Id], [l0].[Id] +SELECT [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Name], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Optional_Self_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[OneToMany_Required_Self_Inverse3Id], [l1].[OneToOne_Optional_PK_Inverse3Id], [l1].[OneToOne_Optional_Self3Id], [l].[Id] FROM [LevelOne] AS [l] LEFT JOIN [LevelTwo] AS [l0] ON [l].[Id] = [l0].[Level1_Optional_Id] INNER JOIN [LevelThree] AS [l1] ON [l0].[Id] = [l1].[OneToMany_Optional_Inverse3Id] -ORDER BY [l].[Id], [l0].[Id] +ORDER BY [l].[Id] """); } @@ -1388,21 +1380,21 @@ public override async Task Select_subquery_single_nested_subquery(bool async) AssertSql( """ -SELECT [l].[Id], [l2].[Id], [l2].[c] +SELECT [l].[Id], [l2].[c] FROM [LevelOne] AS [l] LEFT JOIN ( - SELECT [l1].[c], [l1].[Id], [l1].[OneToMany_Optional_Inverse2Id] + SELECT [l1].[c], [l1].[OneToMany_Optional_Inverse2Id] 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] + SELECT 1 AS [c], [l0].[OneToMany_Optional_Inverse2Id], ROW_NUMBER() OVER(PARTITION BY [l0].[OneToMany_Optional_Inverse2Id] ORDER BY [l0].[Id]) AS [row] FROM [LevelTwo] AS [l0] ) AS [l1] WHERE [l1].[row] <= 1 ) AS [l2] ON [l].[Id] = [l2].[OneToMany_Optional_Inverse2Id] -ORDER BY [l].[Id], [l2].[Id] +ORDER BY [l].[Id] """, // """ -SELECT [l11].[Id], [l].[Id], [l13].[Id] +SELECT [l11].[Id], [l].[Id] FROM [LevelOne] AS [l] LEFT JOIN ( SELECT [l12].[Id], [l12].[OneToMany_Optional_Inverse2Id] @@ -1413,7 +1405,7 @@ FROM [LevelTwo] AS [l8] WHERE [l12].[row] <= 1 ) AS [l13] ON [l].[Id] = [l13].[OneToMany_Optional_Inverse2Id] INNER JOIN [LevelThree] AS [l11] ON [l13].[Id] = [l11].[OneToMany_Optional_Inverse3Id] -ORDER BY [l].[Id], [l13].[Id], [l11].[Id] +ORDER BY [l].[Id], [l11].[Id] """); } @@ -1429,22 +1421,22 @@ ORDER BY [l].[Id] """, // """ -SELECT [l].[Id], [l26].[Id], [l40].[Id], [l40].[c] +SELECT [l].[Id], [l26].[Id], [l40].[c] FROM [LevelOne] AS [l] INNER JOIN [LevelTwo] AS [l26] ON [l].[Id] = [l26].[OneToMany_Optional_Inverse2Id] LEFT JOIN ( - SELECT [l39].[c], [l39].[Id], [l39].[OneToMany_Optional_Inverse3Id] + SELECT [l39].[c], [l39].[OneToMany_Optional_Inverse3Id] FROM ( - SELECT 1 AS [c], [l35].[Id], [l35].[OneToMany_Optional_Inverse3Id], ROW_NUMBER() OVER(PARTITION BY [l35].[OneToMany_Optional_Inverse3Id] ORDER BY [l35].[Id]) AS [row] + SELECT 1 AS [c], [l35].[OneToMany_Optional_Inverse3Id], ROW_NUMBER() OVER(PARTITION BY [l35].[OneToMany_Optional_Inverse3Id] ORDER BY [l35].[Id]) AS [row] FROM [LevelThree] AS [l35] ) AS [l39] WHERE [l39].[row] <= 1 ) AS [l40] ON [l26].[Id] = [l40].[OneToMany_Optional_Inverse3Id] -ORDER BY [l].[Id], [l26].[Id], [l40].[Id] +ORDER BY [l].[Id], [l26].[Id] """, // """ -SELECT [l38].[Id], [l].[Id], [l26].[Id], [l40].[Id] +SELECT [l38].[Id], [l].[Id], [l26].[Id] FROM [LevelOne] AS [l] INNER JOIN [LevelTwo] AS [l26] ON [l].[Id] = [l26].[OneToMany_Optional_Inverse2Id] LEFT JOIN ( @@ -1456,7 +1448,7 @@ FROM [LevelThree] AS [l35] WHERE [l39].[row] <= 1 ) AS [l40] ON [l26].[Id] = [l40].[OneToMany_Optional_Inverse3Id] INNER JOIN [LevelFour] AS [l38] ON [l40].[Id] = [l38].[OneToMany_Optional_Inverse4Id] -ORDER BY [l].[Id], [l26].[Id], [l40].[Id], [l38].[Id] +ORDER BY [l].[Id], [l26].[Id], [l38].[Id] """); } @@ -1473,18 +1465,18 @@ public override async Task Complex_query_with_let_collection_projection_FirstOrD AssertSql( """ -SELECT [l].[Id], [l1].[Id], [l1].[c] +SELECT [l].[Id], [l1].[c] FROM [LevelOne] AS [l] OUTER APPLY ( - SELECT TOP(1) 1 AS [c], [l0].[Id] + SELECT TOP(1) 1 AS [c] FROM [LevelTwo] AS [l0] WHERE [l0].[Name] <> N'Foo' OR [l0].[Name] IS NULL ) AS [l1] -ORDER BY [l].[Id], [l1].[Id] +ORDER BY [l].[Id] """, // """ -SELECT [l29].[Name], [l].[Id], [l28].[Id] +SELECT [l29].[Name], [l].[Id] FROM [LevelOne] AS [l] OUTER APPLY ( SELECT TOP(1) [l21].[Id] @@ -1499,7 +1491,7 @@ SELECT 1 FROM [LevelTwo] AS [l27] WHERE [l26].[Id] = [l27].[OneToMany_Optional_Inverse2Id] AND [l27].[Id] = [l28].[Id]) ) AS [l29] -ORDER BY [l].[Id], [l28].[Id] +ORDER BY [l].[Id] """); } @@ -1509,22 +1501,22 @@ public override async Task Complex_query_with_let_collection_projection_FirstOrD AssertSql( """ -SELECT [l].[Id], [l2].[Id], [l2].[c] +SELECT [l].[Id], [l2].[c] FROM [LevelOne] AS [l] LEFT JOIN ( - SELECT [l1].[c], [l1].[Id], [l1].[OneToMany_Optional_Inverse2Id] + SELECT [l1].[c], [l1].[OneToMany_Optional_Inverse2Id] 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] + SELECT 1 AS [c], [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 ) AS [l1] WHERE [l1].[row] <= 1 ) AS [l2] ON [l].[Id] = [l2].[OneToMany_Optional_Inverse2Id] -ORDER BY [l].[Id], [l2].[Id] +ORDER BY [l].[Id] """, // """ -SELECT [l23].[Name], [l].[Id], [l22].[Id] +SELECT [l23].[Name], [l].[Id] FROM [LevelOne] AS [l] LEFT JOIN ( SELECT [l21].[Id], [l21].[OneToMany_Optional_Inverse2Id] @@ -1543,7 +1535,7 @@ SELECT 1 FROM [LevelTwo] AS [l20] WHERE [l19].[Id] = [l20].[OneToMany_Optional_Inverse2Id] AND [l20].[Id] = [l22].[Id]) ) AS [l23] -ORDER BY [l].[Id], [l22].[Id] +ORDER BY [l].[Id] """); } @@ -1553,20 +1545,20 @@ public override async Task SelectMany_DefaultIfEmpty_multiple_times_with_joins_p AssertSql( """ -SELECT [l2].[Id], [l2].[Level3_Optional_Id], [l2].[Level3_Required_Id], [l2].[Name], [l2].[OneToMany_Optional_Inverse4Id], [l2].[OneToMany_Optional_Self_Inverse4Id], [l2].[OneToMany_Required_Inverse4Id], [l2].[OneToMany_Required_Self_Inverse4Id], [l2].[OneToOne_Optional_PK_Inverse4Id], [l2].[OneToOne_Optional_Self4Id], [l].[Id], [l0].[Id], [l1].[Id], [s].[Id], [s].[Id0], [s].[Id1], [s].[Id2], [s0].[Id], [s0].[Id0], [s0].[Id1], [s0].[Id2], [l11].[Id], [l12].[Id], [l13].[Id], [l14].[Id], [l14].[Name] +SELECT [l2].[Id], [l2].[Level3_Optional_Id], [l2].[Level3_Required_Id], [l2].[Name], [l2].[OneToMany_Optional_Inverse4Id], [l2].[OneToMany_Optional_Self_Inverse4Id], [l2].[OneToMany_Required_Inverse4Id], [l2].[OneToMany_Required_Self_Inverse4Id], [l2].[OneToOne_Optional_PK_Inverse4Id], [l2].[OneToOne_Optional_Self4Id], [l].[Id], [s].[Id], [s].[Id2], [s0].[Id], [s0].[Id2], [l14].[Name] 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_Optional_Id] LEFT JOIN [LevelFour] AS [l2] ON [l1].[Id] = [l2].[OneToMany_Required_Inverse4Id] INNER JOIN ( - SELECT [l3].[Id], [l4].[Id] AS [Id0], [l5].[Id] AS [Id1], [l6].[Id] AS [Id2] + SELECT [l3].[Id], [l6].[Id] AS [Id2] FROM [LevelFour] AS [l3] INNER JOIN [LevelThree] AS [l4] ON [l3].[Level3_Required_Id] = [l4].[Id] LEFT JOIN [LevelTwo] AS [l5] ON [l4].[Level2_Optional_Id] = [l5].[Id] LEFT JOIN [LevelTwo] AS [l6] ON [l5].[Id] = [l6].[OneToMany_Required_Self_Inverse2Id] ) AS [s] ON [l2].[Id] = [s].[Id2] LEFT JOIN ( - SELECT [l7].[Id], [l8].[Id] AS [Id0], [l9].[Id] AS [Id1], [l10].[Id] AS [Id2], [l10].[Level2_Optional_Id] AS [Level2_Optional_Id0] + SELECT [l7].[Id], [l10].[Id] AS [Id2], [l10].[Level2_Optional_Id] AS [Level2_Optional_Id0] FROM [LevelFour] AS [l7] INNER JOIN [LevelThree] AS [l8] ON [l7].[Level3_Required_Id] = [l8].[Id] INNER JOIN [LevelTwo] AS [l9] ON [l8].[Level2_Required_Id] = [l9].[Id] @@ -1577,24 +1569,24 @@ FROM [LevelFour] AS [l7] LEFT JOIN [LevelTwo] AS [l13] ON [s0].[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 -ORDER BY [l12].[Id], [l].[Id], [l0].[Id], [l1].[Id], [l2].[Id], [s].[Id], [s].[Id0], [s].[Id1], [s].[Id2], [s0].[Id], [s0].[Id0], [s0].[Id1], [s0].[Id2], [l11].[Id], [l13].[Id], [l14].[Id] +ORDER BY [l12].[Id], [l].[Id], [l2].[Id], [s].[Id], [s].[Id2], [s0].[Id], [s0].[Id2] """, // """ -SELECT [l18].[Id], [l18].[Date], [l18].[Level1_Optional_Id], [l18].[Level1_Required_Id], [l18].[Name], [l18].[OneToMany_Optional_Inverse2Id], [l18].[OneToMany_Optional_Self_Inverse2Id], [l18].[OneToMany_Required_Inverse2Id], [l18].[OneToMany_Required_Self_Inverse2Id], [l18].[OneToOne_Optional_PK_Inverse2Id], [l18].[OneToOne_Optional_Self2Id], [l].[Id], [l0].[Id], [l1].[Id], [l2].[Id], [s].[Id], [s].[Id0], [s].[Id1], [s].[Id2], [s0].[Id], [s0].[Id0], [s0].[Id1], [s0].[Id2], [l11].[Id], [l12].[Id], [l13].[Id], [l14].[Id] +SELECT [l18].[Id], [l18].[Date], [l18].[Level1_Optional_Id], [l18].[Level1_Required_Id], [l18].[Name], [l18].[OneToMany_Optional_Inverse2Id], [l18].[OneToMany_Optional_Self_Inverse2Id], [l18].[OneToMany_Required_Inverse2Id], [l18].[OneToMany_Required_Self_Inverse2Id], [l18].[OneToOne_Optional_PK_Inverse2Id], [l18].[OneToOne_Optional_Self2Id], [l].[Id], [l2].[Id], [s].[Id], [s].[Id2], [s0].[Id], [s0].[Id2] 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_Optional_Id] LEFT JOIN [LevelFour] AS [l2] ON [l1].[Id] = [l2].[OneToMany_Required_Inverse4Id] INNER JOIN ( - SELECT [l3].[Id], [l4].[Id] AS [Id0], [l5].[Id] AS [Id1], [l6].[Id] AS [Id2] + SELECT [l3].[Id], [l6].[Id] AS [Id2] FROM [LevelFour] AS [l3] INNER JOIN [LevelThree] AS [l4] ON [l3].[Level3_Required_Id] = [l4].[Id] LEFT JOIN [LevelTwo] AS [l5] ON [l4].[Level2_Optional_Id] = [l5].[Id] LEFT JOIN [LevelTwo] AS [l6] ON [l5].[Id] = [l6].[OneToMany_Required_Self_Inverse2Id] ) AS [s] ON [l2].[Id] = [s].[Id2] LEFT JOIN ( - SELECT [l7].[Id], [l8].[Id] AS [Id0], [l9].[Id] AS [Id1], [l10].[Id] AS [Id2], [l10].[Level2_Optional_Id] AS [Level2_Optional_Id0] + SELECT [l7].[Id], [l10].[Id] AS [Id2] FROM [LevelFour] AS [l7] INNER JOIN [LevelThree] AS [l8] ON [l7].[Level3_Required_Id] = [l8].[Id] INNER JOIN [LevelTwo] AS [l9] ON [l8].[Level2_Required_Id] = [l9].[Id] @@ -1602,15 +1594,13 @@ FROM [LevelFour] AS [l7] ) AS [s0] ON [s].[Id2] = [s0].[Id2] LEFT JOIN [LevelThree] AS [l11] ON [l2].[OneToMany_Optional_Inverse4Id] = [l11].[Id] LEFT JOIN [LevelThree] AS [l12] ON [s].[Id2] = [l12].[Level2_Optional_Id] -LEFT JOIN [LevelTwo] AS [l13] ON [s0].[Level2_Optional_Id0] = [l13].[Id] -LEFT JOIN [LevelThree] AS [l14] ON [l13].[Id] = [l14].[Level2_Required_Id] INNER JOIN ( SELECT [l17].[Id], [l17].[Date], [l17].[Level1_Optional_Id], [l17].[Level1_Required_Id], [l17].[Name], [l17].[OneToMany_Optional_Inverse2Id], [l17].[OneToMany_Optional_Self_Inverse2Id], [l17].[OneToMany_Required_Inverse2Id], [l17].[OneToMany_Required_Self_Inverse2Id], [l17].[OneToOne_Optional_PK_Inverse2Id], [l17].[OneToOne_Optional_Self2Id] FROM [LevelTwo] AS [l17] WHERE [l17].[Id] <> 42 ) AS [l18] ON [s].[Id2] = [l18].[OneToMany_Optional_Self_Inverse2Id] WHERE [l11].[Name] <> N'Foo' OR [l11].[Name] IS NULL -ORDER BY [l12].[Id], [l].[Id], [l0].[Id], [l1].[Id], [l2].[Id], [s].[Id], [s].[Id0], [s].[Id1], [s].[Id2], [s0].[Id], [s0].[Id0], [s0].[Id1], [s0].[Id2], [l11].[Id], [l13].[Id], [l14].[Id] +ORDER BY [l12].[Id], [l].[Id], [l2].[Id], [s].[Id], [s].[Id2], [s0].[Id], [s0].[Id2] """); } @@ -1745,11 +1735,11 @@ INNER JOIN ( FROM [LevelThree] AS [l1] INNER JOIN [LevelTwo] AS [l2] ON [l1].[OneToMany_Required_Inverse3Id] = [l2].[Id] ) AS [s] ON [l0].[Id] = [s].[OneToMany_Optional_Inverse3Id] -ORDER BY [l].[Id], [l0].[Id], [s].[Id], [s].[Id0] +ORDER BY [l].[Id], [l0].[Id], [s].[Id] """, // """ -SELECT [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], [l].[Id], [l0].[Id], [s].[Id], [s].[Id0] +SELECT [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], [l].[Id], [l0].[Id], [s].[Id] FROM [LevelOne] AS [l] INNER JOIN [LevelTwo] AS [l0] ON [l].[Id] = [l0].[OneToMany_Optional_Inverse2Id] INNER JOIN ( @@ -1758,7 +1748,7 @@ FROM [LevelThree] AS [l1] INNER JOIN [LevelTwo] AS [l2] ON [l1].[OneToMany_Required_Inverse3Id] = [l2].[Id] ) AS [s] ON [l0].[Id] = [s].[OneToMany_Optional_Inverse3Id] INNER JOIN [LevelThree] AS [l3] ON [s].[Id0] = [l3].[OneToMany_Optional_Inverse3Id] -ORDER BY [l].[Id], [l0].[Id], [s].[Id], [s].[Id0] +ORDER BY [l].[Id], [l0].[Id], [s].[Id] """); } @@ -1771,27 +1761,26 @@ public override async Task Multiple_complex_includes(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] -ORDER BY [l].[Id], [l0].[Id] +ORDER BY [l].[Id] """, // """ -SELECT [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Name], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Optional_Self_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[OneToMany_Required_Self_Inverse3Id], [l1].[OneToOne_Optional_PK_Inverse3Id], [l1].[OneToOne_Optional_Self3Id], [l].[Id], [l0].[Id] +SELECT [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Name], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Optional_Self_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[OneToMany_Required_Self_Inverse3Id], [l1].[OneToOne_Optional_PK_Inverse3Id], [l1].[OneToOne_Optional_Self3Id], [l].[Id] FROM [LevelOne] AS [l] LEFT JOIN [LevelTwo] AS [l0] ON [l].[Id] = [l0].[Level1_Optional_Id] INNER JOIN [LevelThree] AS [l1] ON [l0].[Id] = [l1].[OneToMany_Optional_Inverse3Id] -ORDER BY [l].[Id], [l0].[Id] +ORDER BY [l].[Id] """, // """ -SELECT [s].[Id], [s].[Date], [s].[Level1_Optional_Id], [s].[Level1_Required_Id], [s].[Name], [s].[OneToMany_Optional_Inverse2Id], [s].[OneToMany_Optional_Self_Inverse2Id], [s].[OneToMany_Required_Inverse2Id], [s].[OneToMany_Required_Self_Inverse2Id], [s].[OneToOne_Optional_PK_Inverse2Id], [s].[OneToOne_Optional_Self2Id], [s].[Id0], [s].[Level2_Optional_Id], [s].[Level2_Required_Id], [s].[Name0], [s].[OneToMany_Optional_Inverse3Id], [s].[OneToMany_Optional_Self_Inverse3Id], [s].[OneToMany_Required_Inverse3Id], [s].[OneToMany_Required_Self_Inverse3Id], [s].[OneToOne_Optional_PK_Inverse3Id], [s].[OneToOne_Optional_Self3Id], [l].[Id], [l0].[Id] +SELECT [s].[Id], [s].[Date], [s].[Level1_Optional_Id], [s].[Level1_Required_Id], [s].[Name], [s].[OneToMany_Optional_Inverse2Id], [s].[OneToMany_Optional_Self_Inverse2Id], [s].[OneToMany_Required_Inverse2Id], [s].[OneToMany_Required_Self_Inverse2Id], [s].[OneToOne_Optional_PK_Inverse2Id], [s].[OneToOne_Optional_Self2Id], [s].[Id0], [s].[Level2_Optional_Id], [s].[Level2_Required_Id], [s].[Name0], [s].[OneToMany_Optional_Inverse3Id], [s].[OneToMany_Optional_Self_Inverse3Id], [s].[OneToMany_Required_Inverse3Id], [s].[OneToMany_Required_Self_Inverse3Id], [s].[OneToOne_Optional_PK_Inverse3Id], [s].[OneToOne_Optional_Self3Id], [l].[Id] FROM [LevelOne] AS [l] -LEFT JOIN [LevelTwo] AS [l0] ON [l].[Id] = [l0].[Level1_Optional_Id] INNER JOIN ( SELECT [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], [l3].[Id] AS [Id0], [l3].[Level2_Optional_Id], [l3].[Level2_Required_Id], [l3].[Name] AS [Name0], [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 [LevelTwo] AS [l2] LEFT JOIN [LevelThree] AS [l3] ON [l2].[Id] = [l3].[Level2_Optional_Id] ) AS [s] ON [l].[Id] = [s].[OneToMany_Optional_Inverse2Id] -ORDER BY [l].[Id], [l0].[Id] +ORDER BY [l].[Id] """); } @@ -1804,27 +1793,26 @@ public override async Task Multiple_complex_includes_self_ref(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].[Name], [l0].[OneToMany_Optional_Self_Inverse1Id], [l0].[OneToMany_Required_Self_Inverse1Id], [l0].[OneToOne_Optional_Self1Id] FROM [LevelOne] AS [l] LEFT JOIN [LevelOne] AS [l0] ON [l].[OneToOne_Optional_Self1Id] = [l0].[Id] -ORDER BY [l].[Id], [l0].[Id] +ORDER BY [l].[Id] """, // """ -SELECT [l1].[Id], [l1].[Date], [l1].[Name], [l1].[OneToMany_Optional_Self_Inverse1Id], [l1].[OneToMany_Required_Self_Inverse1Id], [l1].[OneToOne_Optional_Self1Id], [l].[Id], [l0].[Id] +SELECT [l1].[Id], [l1].[Date], [l1].[Name], [l1].[OneToMany_Optional_Self_Inverse1Id], [l1].[OneToMany_Required_Self_Inverse1Id], [l1].[OneToOne_Optional_Self1Id], [l].[Id] FROM [LevelOne] AS [l] LEFT JOIN [LevelOne] AS [l0] ON [l].[OneToOne_Optional_Self1Id] = [l0].[Id] INNER JOIN [LevelOne] AS [l1] ON [l0].[Id] = [l1].[OneToMany_Optional_Self_Inverse1Id] -ORDER BY [l].[Id], [l0].[Id] +ORDER BY [l].[Id] """, // """ -SELECT [s].[Id], [s].[Date], [s].[Name], [s].[OneToMany_Optional_Self_Inverse1Id], [s].[OneToMany_Required_Self_Inverse1Id], [s].[OneToOne_Optional_Self1Id], [s].[Id0], [s].[Date0], [s].[Name0], [s].[OneToMany_Optional_Self_Inverse1Id0], [s].[OneToMany_Required_Self_Inverse1Id0], [s].[OneToOne_Optional_Self1Id0], [l].[Id], [l0].[Id] +SELECT [s].[Id], [s].[Date], [s].[Name], [s].[OneToMany_Optional_Self_Inverse1Id], [s].[OneToMany_Required_Self_Inverse1Id], [s].[OneToOne_Optional_Self1Id], [s].[Id0], [s].[Date0], [s].[Name0], [s].[OneToMany_Optional_Self_Inverse1Id0], [s].[OneToMany_Required_Self_Inverse1Id0], [s].[OneToOne_Optional_Self1Id0], [l].[Id] FROM [LevelOne] AS [l] -LEFT JOIN [LevelOne] AS [l0] ON [l].[OneToOne_Optional_Self1Id] = [l0].[Id] INNER JOIN ( SELECT [l2].[Id], [l2].[Date], [l2].[Name], [l2].[OneToMany_Optional_Self_Inverse1Id], [l2].[OneToMany_Required_Self_Inverse1Id], [l2].[OneToOne_Optional_Self1Id], [l3].[Id] AS [Id0], [l3].[Date] AS [Date0], [l3].[Name] AS [Name0], [l3].[OneToMany_Optional_Self_Inverse1Id] AS [OneToMany_Optional_Self_Inverse1Id0], [l3].[OneToMany_Required_Self_Inverse1Id] AS [OneToMany_Required_Self_Inverse1Id0], [l3].[OneToOne_Optional_Self1Id] AS [OneToOne_Optional_Self1Id0] FROM [LevelOne] AS [l2] LEFT JOIN [LevelOne] AS [l3] ON [l2].[OneToOne_Optional_Self1Id] = [l3].[Id] ) AS [s] ON [l].[Id] = [s].[OneToMany_Optional_Self_Inverse1Id] -ORDER BY [l].[Id], [l0].[Id] +ORDER BY [l].[Id] """); } @@ -1837,15 +1825,15 @@ public override async Task Include_reference_and_collection_order_by(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] -ORDER BY [l].[Name], [l].[Id], [l0].[Id] +ORDER BY [l].[Name], [l].[Id] """, // """ -SELECT [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Name], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Optional_Self_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[OneToMany_Required_Self_Inverse3Id], [l1].[OneToOne_Optional_PK_Inverse3Id], [l1].[OneToOne_Optional_Self3Id], [l].[Id], [l0].[Id] +SELECT [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Name], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Optional_Self_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[OneToMany_Required_Self_Inverse3Id], [l1].[OneToOne_Optional_PK_Inverse3Id], [l1].[OneToOne_Optional_Self3Id], [l].[Id] FROM [LevelOne] AS [l] LEFT JOIN [LevelTwo] AS [l0] ON [l].[Id] = [l0].[Level1_Optional_Id] INNER JOIN [LevelThree] AS [l1] ON [l0].[Id] = [l1].[OneToMany_Optional_Inverse3Id] -ORDER BY [l].[Name], [l].[Id], [l0].[Id] +ORDER BY [l].[Name], [l].[Id] """); } @@ -1858,15 +1846,15 @@ public override async Task Include_reference_ThenInclude_collection_order_by(boo 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] -ORDER BY [l].[Name], [l].[Id], [l0].[Id] +ORDER BY [l].[Name], [l].[Id] """, // """ -SELECT [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Name], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Optional_Self_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[OneToMany_Required_Self_Inverse3Id], [l1].[OneToOne_Optional_PK_Inverse3Id], [l1].[OneToOne_Optional_Self3Id], [l].[Id], [l0].[Id] +SELECT [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Name], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Optional_Self_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[OneToMany_Required_Self_Inverse3Id], [l1].[OneToOne_Optional_PK_Inverse3Id], [l1].[OneToOne_Optional_Self3Id], [l].[Id] FROM [LevelOne] AS [l] LEFT JOIN [LevelTwo] AS [l0] ON [l].[Id] = [l0].[Level1_Optional_Id] INNER JOIN [LevelThree] AS [l1] ON [l0].[Id] = [l1].[OneToMany_Optional_Inverse3Id] -ORDER BY [l].[Name], [l].[Id], [l0].[Id] +ORDER BY [l].[Name], [l].[Id] """); } @@ -1927,27 +1915,26 @@ public override async Task Multiple_complex_include_select(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] -ORDER BY [l].[Id], [l0].[Id] +ORDER BY [l].[Id] """, // """ -SELECT [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Name], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Optional_Self_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[OneToMany_Required_Self_Inverse3Id], [l1].[OneToOne_Optional_PK_Inverse3Id], [l1].[OneToOne_Optional_Self3Id], [l].[Id], [l0].[Id] +SELECT [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Name], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Optional_Self_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[OneToMany_Required_Self_Inverse3Id], [l1].[OneToOne_Optional_PK_Inverse3Id], [l1].[OneToOne_Optional_Self3Id], [l].[Id] FROM [LevelOne] AS [l] LEFT JOIN [LevelTwo] AS [l0] ON [l].[Id] = [l0].[Level1_Optional_Id] INNER JOIN [LevelThree] AS [l1] ON [l0].[Id] = [l1].[OneToMany_Optional_Inverse3Id] -ORDER BY [l].[Id], [l0].[Id] +ORDER BY [l].[Id] """, // """ -SELECT [s].[Id], [s].[Date], [s].[Level1_Optional_Id], [s].[Level1_Required_Id], [s].[Name], [s].[OneToMany_Optional_Inverse2Id], [s].[OneToMany_Optional_Self_Inverse2Id], [s].[OneToMany_Required_Inverse2Id], [s].[OneToMany_Required_Self_Inverse2Id], [s].[OneToOne_Optional_PK_Inverse2Id], [s].[OneToOne_Optional_Self2Id], [s].[Id0], [s].[Level2_Optional_Id], [s].[Level2_Required_Id], [s].[Name0], [s].[OneToMany_Optional_Inverse3Id], [s].[OneToMany_Optional_Self_Inverse3Id], [s].[OneToMany_Required_Inverse3Id], [s].[OneToMany_Required_Self_Inverse3Id], [s].[OneToOne_Optional_PK_Inverse3Id], [s].[OneToOne_Optional_Self3Id], [l].[Id], [l0].[Id] +SELECT [s].[Id], [s].[Date], [s].[Level1_Optional_Id], [s].[Level1_Required_Id], [s].[Name], [s].[OneToMany_Optional_Inverse2Id], [s].[OneToMany_Optional_Self_Inverse2Id], [s].[OneToMany_Required_Inverse2Id], [s].[OneToMany_Required_Self_Inverse2Id], [s].[OneToOne_Optional_PK_Inverse2Id], [s].[OneToOne_Optional_Self2Id], [s].[Id0], [s].[Level2_Optional_Id], [s].[Level2_Required_Id], [s].[Name0], [s].[OneToMany_Optional_Inverse3Id], [s].[OneToMany_Optional_Self_Inverse3Id], [s].[OneToMany_Required_Inverse3Id], [s].[OneToMany_Required_Self_Inverse3Id], [s].[OneToOne_Optional_PK_Inverse3Id], [s].[OneToOne_Optional_Self3Id], [l].[Id] FROM [LevelOne] AS [l] -LEFT JOIN [LevelTwo] AS [l0] ON [l].[Id] = [l0].[Level1_Optional_Id] INNER JOIN ( SELECT [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], [l3].[Id] AS [Id0], [l3].[Level2_Optional_Id], [l3].[Level2_Required_Id], [l3].[Name] AS [Name0], [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 [LevelTwo] AS [l2] LEFT JOIN [LevelThree] AS [l3] ON [l2].[Id] = [l3].[Level2_Optional_Id] ) AS [s] ON [l].[Id] = [s].[OneToMany_Optional_Inverse2Id] -ORDER BY [l].[Id], [l0].[Id] +ORDER BY [l].[Id] """); } @@ -1961,11 +1948,11 @@ public override async Task Include_nested_with_optional_navigation(bool async) 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 -ORDER BY [l].[Id], [l0].[Id] +ORDER BY [l].[Id] """, // """ -SELECT [s].[Id], [s].[Level2_Optional_Id], [s].[Level2_Required_Id], [s].[Name], [s].[OneToMany_Optional_Inverse3Id], [s].[OneToMany_Optional_Self_Inverse3Id], [s].[OneToMany_Required_Inverse3Id], [s].[OneToMany_Required_Self_Inverse3Id], [s].[OneToOne_Optional_PK_Inverse3Id], [s].[OneToOne_Optional_Self3Id], [s].[Id0], [s].[Level3_Optional_Id], [s].[Level3_Required_Id], [s].[Name0], [s].[OneToMany_Optional_Inverse4Id], [s].[OneToMany_Optional_Self_Inverse4Id], [s].[OneToMany_Required_Inverse4Id], [s].[OneToMany_Required_Self_Inverse4Id], [s].[OneToOne_Optional_PK_Inverse4Id], [s].[OneToOne_Optional_Self4Id], [l].[Id], [l0].[Id] +SELECT [s].[Id], [s].[Level2_Optional_Id], [s].[Level2_Required_Id], [s].[Name], [s].[OneToMany_Optional_Inverse3Id], [s].[OneToMany_Optional_Self_Inverse3Id], [s].[OneToMany_Required_Inverse3Id], [s].[OneToMany_Required_Self_Inverse3Id], [s].[OneToOne_Optional_PK_Inverse3Id], [s].[OneToOne_Optional_Self3Id], [s].[Id0], [s].[Level3_Optional_Id], [s].[Level3_Required_Id], [s].[Name0], [s].[OneToMany_Optional_Inverse4Id], [s].[OneToMany_Optional_Self_Inverse4Id], [s].[OneToMany_Required_Inverse4Id], [s].[OneToMany_Required_Self_Inverse4Id], [s].[OneToOne_Optional_PK_Inverse4Id], [s].[OneToOne_Optional_Self4Id], [l].[Id] FROM [LevelOne] AS [l] LEFT JOIN [LevelTwo] AS [l0] ON [l].[Id] = [l0].[Level1_Optional_Id] INNER JOIN ( @@ -1974,7 +1961,7 @@ FROM [LevelThree] AS [l1] LEFT JOIN [LevelFour] AS [l2] ON [l1].[Id] = [l2].[Level3_Required_Id] ) AS [s] ON [l0].[Id] = [s].[OneToMany_Required_Inverse3Id] WHERE [l0].[Name] <> N'L2 09' OR [l0].[Name] IS NULL -ORDER BY [l].[Id], [l0].[Id] +ORDER BY [l].[Id] """); } @@ -1995,14 +1982,14 @@ ORDER BY [l].[Name] OFFSET @p ROWS FETCH NEXT @p1 ROWS ONLY ) AS [l1] LEFT JOIN [LevelTwo] AS [l0] ON [l1].[Id] = [l0].[Level1_Required_Id] -ORDER BY [l1].[Name], [l1].[Id], [l0].[Id] +ORDER BY [l1].[Name], [l1].[Id] """, // """ @p='0' @p1='10' -SELECT [l2].[Id], [l2].[Level2_Optional_Id], [l2].[Level2_Required_Id], [l2].[Name], [l2].[OneToMany_Optional_Inverse3Id], [l2].[OneToMany_Optional_Self_Inverse3Id], [l2].[OneToMany_Required_Inverse3Id], [l2].[OneToMany_Required_Self_Inverse3Id], [l2].[OneToOne_Optional_PK_Inverse3Id], [l2].[OneToOne_Optional_Self3Id], [l1].[Id], [l0].[Id] +SELECT [l2].[Id], [l2].[Level2_Optional_Id], [l2].[Level2_Required_Id], [l2].[Name], [l2].[OneToMany_Optional_Inverse3Id], [l2].[OneToMany_Optional_Self_Inverse3Id], [l2].[OneToMany_Required_Inverse3Id], [l2].[OneToMany_Required_Self_Inverse3Id], [l2].[OneToOne_Optional_PK_Inverse3Id], [l2].[OneToOne_Optional_Self3Id], [l1].[Id] FROM ( SELECT [l].[Id], [l].[Name] FROM [LevelOne] AS [l] @@ -2011,14 +1998,14 @@ OFFSET @p ROWS FETCH NEXT @p1 ROWS ONLY ) AS [l1] LEFT JOIN [LevelTwo] AS [l0] ON [l1].[Id] = [l0].[Level1_Required_Id] INNER JOIN [LevelThree] AS [l2] ON [l0].[Id] = [l2].[OneToMany_Optional_Inverse3Id] -ORDER BY [l1].[Name], [l1].[Id], [l0].[Id] +ORDER BY [l1].[Name], [l1].[Id] """, // """ @p='0' @p1='10' -SELECT [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], [l1].[Id], [l0].[Id] +SELECT [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], [l1].[Id] FROM ( SELECT [l].[Id], [l].[Name] FROM [LevelOne] AS [l] @@ -2027,7 +2014,7 @@ OFFSET @p ROWS FETCH NEXT @p1 ROWS ONLY ) AS [l1] LEFT JOIN [LevelTwo] AS [l0] ON [l1].[Id] = [l0].[Level1_Required_Id] INNER JOIN [LevelThree] AS [l3] ON [l0].[Id] = [l3].[OneToMany_Required_Inverse3Id] -ORDER BY [l1].[Name], [l1].[Id], [l0].[Id] +ORDER BY [l1].[Name], [l1].[Id] """); } @@ -2049,14 +2036,14 @@ OFFSET @p ROWS FETCH NEXT @p1 ROWS ONLY ) AS [l1] LEFT JOIN [LevelTwo] AS [l0] ON [l1].[Id] = [l0].[Level1_Optional_Id] LEFT JOIN [LevelTwo] AS [l2] ON [l1].[Id] = [l2].[Level1_Required_Id] -ORDER BY [l1].[Name], [l1].[Id], [l0].[Id], [l2].[Id] +ORDER BY [l1].[Name], [l1].[Id] """, // """ @p='0' @p1='10' -SELECT [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], [l1].[Id], [l0].[Id], [l2].[Id] +SELECT [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], [l1].[Id] FROM ( SELECT [l].[Id], [l].[Name] FROM [LevelOne] AS [l] @@ -2064,26 +2051,24 @@ ORDER BY [l].[Name] OFFSET @p ROWS FETCH NEXT @p1 ROWS ONLY ) AS [l1] LEFT JOIN [LevelTwo] AS [l0] ON [l1].[Id] = [l0].[Level1_Optional_Id] -LEFT JOIN [LevelTwo] AS [l2] ON [l1].[Id] = [l2].[Level1_Required_Id] INNER JOIN [LevelThree] AS [l3] ON [l0].[Id] = [l3].[OneToMany_Optional_Inverse3Id] -ORDER BY [l1].[Name], [l1].[Id], [l0].[Id], [l2].[Id] +ORDER BY [l1].[Name], [l1].[Id] """, // """ @p='0' @p1='10' -SELECT [l4].[Id], [l4].[Level2_Optional_Id], [l4].[Level2_Required_Id], [l4].[Name], [l4].[OneToMany_Optional_Inverse3Id], [l4].[OneToMany_Optional_Self_Inverse3Id], [l4].[OneToMany_Required_Inverse3Id], [l4].[OneToMany_Required_Self_Inverse3Id], [l4].[OneToOne_Optional_PK_Inverse3Id], [l4].[OneToOne_Optional_Self3Id], [l1].[Id], [l0].[Id], [l2].[Id] +SELECT [l4].[Id], [l4].[Level2_Optional_Id], [l4].[Level2_Required_Id], [l4].[Name], [l4].[OneToMany_Optional_Inverse3Id], [l4].[OneToMany_Optional_Self_Inverse3Id], [l4].[OneToMany_Required_Inverse3Id], [l4].[OneToMany_Required_Self_Inverse3Id], [l4].[OneToOne_Optional_PK_Inverse3Id], [l4].[OneToOne_Optional_Self3Id], [l1].[Id] FROM ( SELECT [l].[Id], [l].[Name] FROM [LevelOne] AS [l] ORDER BY [l].[Name] OFFSET @p ROWS FETCH NEXT @p1 ROWS ONLY ) AS [l1] -LEFT JOIN [LevelTwo] AS [l0] ON [l1].[Id] = [l0].[Level1_Optional_Id] LEFT JOIN [LevelTwo] AS [l2] ON [l1].[Id] = [l2].[Level1_Required_Id] INNER JOIN [LevelThree] AS [l4] ON [l2].[Id] = [l4].[OneToMany_Required_Inverse3Id] -ORDER BY [l1].[Name], [l1].[Id], [l0].[Id], [l2].[Id] +ORDER BY [l1].[Name], [l1].[Id] """); } @@ -2105,14 +2090,14 @@ OFFSET @p ROWS FETCH NEXT @p1 ROWS ONLY ) AS [l1] LEFT JOIN [LevelTwo] AS [l0] ON [l1].[Id] = [l0].[Level1_Optional_Id] LEFT JOIN [LevelThree] AS [l2] ON [l0].[Id] = [l2].[Level2_Required_Id] -ORDER BY [l1].[Name], [l1].[Id], [l0].[Id], [l2].[Id] +ORDER BY [l1].[Name], [l1].[Id] """, // """ @p='0' @p1='10' -SELECT [l3].[Id], [l3].[Level3_Optional_Id], [l3].[Level3_Required_Id], [l3].[Name], [l3].[OneToMany_Optional_Inverse4Id], [l3].[OneToMany_Optional_Self_Inverse4Id], [l3].[OneToMany_Required_Inverse4Id], [l3].[OneToMany_Required_Self_Inverse4Id], [l3].[OneToOne_Optional_PK_Inverse4Id], [l3].[OneToOne_Optional_Self4Id], [l1].[Id], [l0].[Id], [l2].[Id] +SELECT [l3].[Id], [l3].[Level3_Optional_Id], [l3].[Level3_Required_Id], [l3].[Name], [l3].[OneToMany_Optional_Inverse4Id], [l3].[OneToMany_Optional_Self_Inverse4Id], [l3].[OneToMany_Required_Inverse4Id], [l3].[OneToMany_Required_Self_Inverse4Id], [l3].[OneToOne_Optional_PK_Inverse4Id], [l3].[OneToOne_Optional_Self4Id], [l1].[Id] FROM ( SELECT [l].[Id], [l].[Name] FROM [LevelOne] AS [l] @@ -2122,7 +2107,7 @@ OFFSET @p ROWS FETCH NEXT @p1 ROWS ONLY LEFT JOIN [LevelTwo] AS [l0] ON [l1].[Id] = [l0].[Level1_Optional_Id] LEFT JOIN [LevelThree] AS [l2] ON [l0].[Id] = [l2].[Level2_Required_Id] INNER JOIN [LevelFour] AS [l3] ON [l2].[Id] = [l3].[OneToMany_Optional_Inverse4Id] -ORDER BY [l1].[Name], [l1].[Id], [l0].[Id], [l2].[Id] +ORDER BY [l1].[Name], [l1].[Id] """); } @@ -2132,7 +2117,7 @@ public override async Task Multiple_include_with_multiple_optional_navigations(b AssertSql( """ -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], [l1].[Id], [l2].[Id], [l3].[Id], [l4].[Id], [l2].[Level2_Optional_Id], [l2].[Level2_Required_Id], [l2].[Name], [l2].[OneToMany_Optional_Inverse3Id], [l2].[OneToMany_Optional_Self_Inverse3Id], [l2].[OneToMany_Required_Inverse3Id], [l2].[OneToMany_Required_Self_Inverse3Id], [l2].[OneToOne_Optional_PK_Inverse3Id], [l2].[OneToOne_Optional_Self3Id], [l3].[Date], [l3].[Level1_Optional_Id], [l3].[Level1_Required_Id], [l3].[Name], [l3].[OneToMany_Optional_Inverse2Id], [l3].[OneToMany_Optional_Self_Inverse2Id], [l3].[OneToMany_Required_Inverse2Id], [l3].[OneToMany_Required_Self_Inverse2Id], [l3].[OneToOne_Optional_PK_Inverse2Id], [l3].[OneToOne_Optional_Self2Id], [l4].[Level2_Optional_Id], [l4].[Level2_Required_Id], [l4].[Name], [l4].[OneToMany_Optional_Inverse3Id], [l4].[OneToMany_Optional_Self_Inverse3Id], [l4].[OneToMany_Required_Inverse3Id], [l4].[OneToMany_Required_Self_Inverse3Id], [l4].[OneToOne_Optional_PK_Inverse3Id], [l4].[OneToOne_Optional_Self3Id] +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], [l2].[Id], [l2].[Level2_Optional_Id], [l2].[Level2_Required_Id], [l2].[Name], [l2].[OneToMany_Optional_Inverse3Id], [l2].[OneToMany_Optional_Self_Inverse3Id], [l2].[OneToMany_Required_Inverse3Id], [l2].[OneToMany_Required_Self_Inverse3Id], [l2].[OneToOne_Optional_PK_Inverse3Id], [l2].[OneToOne_Optional_Self3Id], [l3].[Id], [l3].[Date], [l3].[Level1_Optional_Id], [l3].[Level1_Required_Id], [l3].[Name], [l3].[OneToMany_Optional_Inverse2Id], [l3].[OneToMany_Optional_Self_Inverse2Id], [l3].[OneToMany_Required_Inverse2Id], [l3].[OneToMany_Required_Self_Inverse2Id], [l3].[OneToOne_Optional_PK_Inverse2Id], [l3].[OneToOne_Optional_Self2Id], [l4].[Id], [l4].[Level2_Optional_Id], [l4].[Level2_Required_Id], [l4].[Name], [l4].[OneToMany_Optional_Inverse3Id], [l4].[OneToMany_Optional_Self_Inverse3Id], [l4].[OneToMany_Required_Inverse3Id], [l4].[OneToMany_Required_Self_Inverse3Id], [l4].[OneToOne_Optional_PK_Inverse3Id], [l4].[OneToOne_Optional_Self3Id] 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].[OneToOne_Optional_PK_Inverse3Id] @@ -2140,20 +2125,17 @@ 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] WHERE [l1].[Name] <> N'Foo' OR [l1].[Name] IS NULL -ORDER BY [l].[Id], [l0].[Id], [l1].[Id], [l2].[Id], [l3].[Id], [l4].[Id] +ORDER BY [l].[Id] """, // """ -SELECT [l5].[Id], [l5].[Level2_Optional_Id], [l5].[Level2_Required_Id], [l5].[Name], [l5].[OneToMany_Optional_Inverse3Id], [l5].[OneToMany_Optional_Self_Inverse3Id], [l5].[OneToMany_Required_Inverse3Id], [l5].[OneToMany_Required_Self_Inverse3Id], [l5].[OneToOne_Optional_PK_Inverse3Id], [l5].[OneToOne_Optional_Self3Id], [l].[Id], [l0].[Id], [l1].[Id], [l2].[Id], [l3].[Id], [l4].[Id] +SELECT [l5].[Id], [l5].[Level2_Optional_Id], [l5].[Level2_Required_Id], [l5].[Name], [l5].[OneToMany_Optional_Inverse3Id], [l5].[OneToMany_Optional_Self_Inverse3Id], [l5].[OneToMany_Required_Inverse3Id], [l5].[OneToMany_Required_Self_Inverse3Id], [l5].[OneToOne_Optional_PK_Inverse3Id], [l5].[OneToOne_Optional_Self3Id], [l].[Id] 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].[OneToOne_Optional_PK_Inverse3Id] -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] INNER JOIN [LevelThree] AS [l5] ON [l0].[Id] = [l5].[OneToMany_Optional_Inverse3Id] WHERE [l1].[Name] <> N'Foo' OR [l1].[Name] IS NULL -ORDER BY [l].[Id], [l0].[Id], [l1].[Id], [l2].[Id], [l3].[Id], [l4].[Id] +ORDER BY [l].[Id] """); } @@ -2222,16 +2204,16 @@ public override async Task SelectMany_with_Include_ThenInclude(bool async) FROM [LevelOne] AS [l] INNER JOIN [LevelTwo] AS [l0] ON [l].[Id] = [l0].[OneToMany_Optional_Inverse2Id] LEFT JOIN [LevelThree] AS [l1] ON [l0].[Id] = [l1].[Level2_Required_Id] -ORDER BY [l].[Id], [l0].[Id], [l1].[Id] +ORDER BY [l].[Id], [l0].[Id] """, // """ -SELECT [l2].[Id], [l2].[Level3_Optional_Id], [l2].[Level3_Required_Id], [l2].[Name], [l2].[OneToMany_Optional_Inverse4Id], [l2].[OneToMany_Optional_Self_Inverse4Id], [l2].[OneToMany_Required_Inverse4Id], [l2].[OneToMany_Required_Self_Inverse4Id], [l2].[OneToOne_Optional_PK_Inverse4Id], [l2].[OneToOne_Optional_Self4Id], [l].[Id], [l0].[Id], [l1].[Id] +SELECT [l2].[Id], [l2].[Level3_Optional_Id], [l2].[Level3_Required_Id], [l2].[Name], [l2].[OneToMany_Optional_Inverse4Id], [l2].[OneToMany_Optional_Self_Inverse4Id], [l2].[OneToMany_Required_Inverse4Id], [l2].[OneToMany_Required_Self_Inverse4Id], [l2].[OneToOne_Optional_PK_Inverse4Id], [l2].[OneToOne_Optional_Self4Id], [l].[Id], [l0].[Id] FROM [LevelOne] AS [l] INNER JOIN [LevelTwo] AS [l0] ON [l].[Id] = [l0].[OneToMany_Optional_Inverse2Id] LEFT JOIN [LevelThree] AS [l1] ON [l0].[Id] = [l1].[Level2_Required_Id] INNER JOIN [LevelFour] AS [l2] ON [l1].[Id] = [l2].[OneToMany_Optional_Inverse4Id] -ORDER BY [l].[Id], [l0].[Id], [l1].[Id] +ORDER BY [l].[Id], [l0].[Id] """); } @@ -2246,17 +2228,16 @@ FROM [LevelOne] AS [l] INNER JOIN [LevelTwo] AS [l0] ON [l].[Id] = [l0].[OneToMany_Optional_Inverse2Id] INNER JOIN [LevelThree] AS [l1] ON [l0].[Id] = [l1].[OneToMany_Optional_Inverse3Id] LEFT JOIN [LevelFour] AS [l2] ON [l1].[Id] = [l2].[Level3_Required_Id] -ORDER BY [l].[Id], [l0].[Id], [l1].[Id], [l2].[Id] +ORDER BY [l].[Id], [l0].[Id], [l1].[Id] """, // """ -SELECT [l3].[Id], [l3].[Level3_Optional_Id], [l3].[Level3_Required_Id], [l3].[Name], [l3].[OneToMany_Optional_Inverse4Id], [l3].[OneToMany_Optional_Self_Inverse4Id], [l3].[OneToMany_Required_Inverse4Id], [l3].[OneToMany_Required_Self_Inverse4Id], [l3].[OneToOne_Optional_PK_Inverse4Id], [l3].[OneToOne_Optional_Self4Id], [l].[Id], [l0].[Id], [l1].[Id], [l2].[Id] +SELECT [l3].[Id], [l3].[Level3_Optional_Id], [l3].[Level3_Required_Id], [l3].[Name], [l3].[OneToMany_Optional_Inverse4Id], [l3].[OneToMany_Optional_Self_Inverse4Id], [l3].[OneToMany_Required_Inverse4Id], [l3].[OneToMany_Required_Self_Inverse4Id], [l3].[OneToOne_Optional_PK_Inverse4Id], [l3].[OneToOne_Optional_Self4Id], [l].[Id], [l0].[Id], [l1].[Id] FROM [LevelOne] AS [l] INNER JOIN [LevelTwo] AS [l0] ON [l].[Id] = [l0].[OneToMany_Optional_Inverse2Id] INNER JOIN [LevelThree] AS [l1] ON [l0].[Id] = [l1].[OneToMany_Optional_Inverse3Id] -LEFT JOIN [LevelFour] AS [l2] ON [l1].[Id] = [l2].[Level3_Required_Id] INNER JOIN [LevelFour] AS [l3] ON [l1].[Id] = [l3].[OneToMany_Optional_Inverse4Id] -ORDER BY [l].[Id], [l0].[Id], [l1].[Id], [l2].[Id] +ORDER BY [l].[Id], [l0].[Id], [l1].[Id] """); } @@ -2296,11 +2277,11 @@ public override async Task Optional_navigation_with_Include_ThenInclude(bool asy 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], [l].[Id] FROM [LevelOne] AS [l] LEFT JOIN [LevelTwo] AS [l0] ON [l].[Id] = [l0].[Level1_Optional_Id] -ORDER BY [l].[Id], [l0].[Id] +ORDER BY [l].[Id] """, // """ -SELECT [s].[Id], [s].[Level2_Optional_Id], [s].[Level2_Required_Id], [s].[Name], [s].[OneToMany_Optional_Inverse3Id], [s].[OneToMany_Optional_Self_Inverse3Id], [s].[OneToMany_Required_Inverse3Id], [s].[OneToMany_Required_Self_Inverse3Id], [s].[OneToOne_Optional_PK_Inverse3Id], [s].[OneToOne_Optional_Self3Id], [s].[Id0], [s].[Level3_Optional_Id], [s].[Level3_Required_Id], [s].[Name0], [s].[OneToMany_Optional_Inverse4Id], [s].[OneToMany_Optional_Self_Inverse4Id], [s].[OneToMany_Required_Inverse4Id], [s].[OneToMany_Required_Self_Inverse4Id], [s].[OneToOne_Optional_PK_Inverse4Id], [s].[OneToOne_Optional_Self4Id], [l].[Id], [l0].[Id] +SELECT [s].[Id], [s].[Level2_Optional_Id], [s].[Level2_Required_Id], [s].[Name], [s].[OneToMany_Optional_Inverse3Id], [s].[OneToMany_Optional_Self_Inverse3Id], [s].[OneToMany_Required_Inverse3Id], [s].[OneToMany_Required_Self_Inverse3Id], [s].[OneToOne_Optional_PK_Inverse3Id], [s].[OneToOne_Optional_Self3Id], [s].[Id0], [s].[Level3_Optional_Id], [s].[Level3_Required_Id], [s].[Name0], [s].[OneToMany_Optional_Inverse4Id], [s].[OneToMany_Optional_Self_Inverse4Id], [s].[OneToMany_Required_Inverse4Id], [s].[OneToMany_Required_Self_Inverse4Id], [s].[OneToOne_Optional_PK_Inverse4Id], [s].[OneToOne_Optional_Self4Id], [l].[Id] FROM [LevelOne] AS [l] LEFT JOIN [LevelTwo] AS [l0] ON [l].[Id] = [l0].[Level1_Optional_Id] INNER JOIN ( @@ -2308,7 +2289,7 @@ INNER JOIN ( FROM [LevelThree] AS [l1] LEFT JOIN [LevelFour] AS [l2] ON [l1].[Id] = [l2].[Level3_Optional_Id] ) AS [s] ON [l0].[Id] = [s].[OneToMany_Optional_Inverse3Id] -ORDER BY [l].[Id], [l0].[Id] +ORDER BY [l].[Id] """); } @@ -2318,20 +2299,20 @@ public override async Task Multiple_optional_navigation_with_Include(bool async) AssertSql( """ -SELECT [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Name], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Optional_Self_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[OneToMany_Required_Self_Inverse3Id], [l1].[OneToOne_Optional_PK_Inverse3Id], [l1].[OneToOne_Optional_Self3Id], [l].[Id], [l0].[Id] +SELECT [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Name], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Optional_Self_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[OneToMany_Required_Self_Inverse3Id], [l1].[OneToOne_Optional_PK_Inverse3Id], [l1].[OneToOne_Optional_Self3Id], [l].[Id] 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].[OneToOne_Optional_PK_Inverse3Id] -ORDER BY [l].[Id], [l0].[Id], [l1].[Id] +ORDER BY [l].[Id] """, // """ -SELECT [l2].[Id], [l2].[Level3_Optional_Id], [l2].[Level3_Required_Id], [l2].[Name], [l2].[OneToMany_Optional_Inverse4Id], [l2].[OneToMany_Optional_Self_Inverse4Id], [l2].[OneToMany_Required_Inverse4Id], [l2].[OneToMany_Required_Self_Inverse4Id], [l2].[OneToOne_Optional_PK_Inverse4Id], [l2].[OneToOne_Optional_Self4Id], [l].[Id], [l0].[Id], [l1].[Id] +SELECT [l2].[Id], [l2].[Level3_Optional_Id], [l2].[Level3_Required_Id], [l2].[Name], [l2].[OneToMany_Optional_Inverse4Id], [l2].[OneToMany_Optional_Self_Inverse4Id], [l2].[OneToMany_Required_Inverse4Id], [l2].[OneToMany_Required_Self_Inverse4Id], [l2].[OneToOne_Optional_PK_Inverse4Id], [l2].[OneToOne_Optional_Self4Id], [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].[OneToOne_Optional_PK_Inverse3Id] INNER JOIN [LevelFour] AS [l2] ON [l1].[Id] = [l2].[OneToMany_Optional_Inverse4Id] -ORDER BY [l].[Id], [l0].[Id], [l1].[Id] +ORDER BY [l].[Id] """); } @@ -2341,20 +2322,20 @@ public override async Task Multiple_optional_navigation_with_string_based_Includ AssertSql( """ -SELECT [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Name], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Optional_Self_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[OneToMany_Required_Self_Inverse3Id], [l1].[OneToOne_Optional_PK_Inverse3Id], [l1].[OneToOne_Optional_Self3Id], [l].[Id], [l0].[Id] +SELECT [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Name], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Optional_Self_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[OneToMany_Required_Self_Inverse3Id], [l1].[OneToOne_Optional_PK_Inverse3Id], [l1].[OneToOne_Optional_Self3Id], [l].[Id] 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].[OneToOne_Optional_PK_Inverse3Id] -ORDER BY [l].[Id], [l0].[Id], [l1].[Id] +ORDER BY [l].[Id] """, // """ -SELECT [l2].[Id], [l2].[Level3_Optional_Id], [l2].[Level3_Required_Id], [l2].[Name], [l2].[OneToMany_Optional_Inverse4Id], [l2].[OneToMany_Optional_Self_Inverse4Id], [l2].[OneToMany_Required_Inverse4Id], [l2].[OneToMany_Required_Self_Inverse4Id], [l2].[OneToOne_Optional_PK_Inverse4Id], [l2].[OneToOne_Optional_Self4Id], [l].[Id], [l0].[Id], [l1].[Id] +SELECT [l2].[Id], [l2].[Level3_Optional_Id], [l2].[Level3_Required_Id], [l2].[Name], [l2].[OneToMany_Optional_Inverse4Id], [l2].[OneToMany_Optional_Self_Inverse4Id], [l2].[OneToMany_Required_Inverse4Id], [l2].[OneToMany_Required_Self_Inverse4Id], [l2].[OneToOne_Optional_PK_Inverse4Id], [l2].[OneToOne_Optional_Self4Id], [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].[OneToOne_Optional_PK_Inverse3Id] INNER JOIN [LevelFour] AS [l2] ON [l1].[Id] = [l2].[OneToMany_Optional_Inverse4Id] -ORDER BY [l].[Id], [l0].[Id], [l1].[Id] +ORDER BY [l].[Id] """); } @@ -2367,15 +2348,15 @@ public override async Task Optional_navigation_with_order_by_and_Include(bool as 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], [l].[Id] FROM [LevelOne] AS [l] LEFT JOIN [LevelTwo] AS [l0] ON [l].[Id] = [l0].[Level1_Optional_Id] -ORDER BY [l0].[Name], [l].[Id], [l0].[Id] +ORDER BY [l0].[Name], [l].[Id] """, // """ -SELECT [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Name], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Optional_Self_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[OneToMany_Required_Self_Inverse3Id], [l1].[OneToOne_Optional_PK_Inverse3Id], [l1].[OneToOne_Optional_Self3Id], [l].[Id], [l0].[Id] +SELECT [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Name], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Optional_Self_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[OneToMany_Required_Self_Inverse3Id], [l1].[OneToOne_Optional_PK_Inverse3Id], [l1].[OneToOne_Optional_Self3Id], [l].[Id] FROM [LevelOne] AS [l] LEFT JOIN [LevelTwo] AS [l0] ON [l].[Id] = [l0].[Level1_Optional_Id] INNER JOIN [LevelThree] AS [l1] ON [l0].[Id] = [l1].[OneToMany_Optional_Inverse3Id] -ORDER BY [l0].[Name], [l].[Id], [l0].[Id] +ORDER BY [l0].[Name], [l].[Id] """); } @@ -2388,15 +2369,15 @@ public override async Task Optional_navigation_with_Include_and_order(bool async 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], [l].[Id] FROM [LevelOne] AS [l] LEFT JOIN [LevelTwo] AS [l0] ON [l].[Id] = [l0].[Level1_Optional_Id] -ORDER BY [l0].[Name], [l].[Id], [l0].[Id] +ORDER BY [l0].[Name], [l].[Id] """, // """ -SELECT [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Name], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Optional_Self_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[OneToMany_Required_Self_Inverse3Id], [l1].[OneToOne_Optional_PK_Inverse3Id], [l1].[OneToOne_Optional_Self3Id], [l].[Id], [l0].[Id] +SELECT [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Name], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Optional_Self_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[OneToMany_Required_Self_Inverse3Id], [l1].[OneToOne_Optional_PK_Inverse3Id], [l1].[OneToOne_Optional_Self3Id], [l].[Id] FROM [LevelOne] AS [l] LEFT JOIN [LevelTwo] AS [l0] ON [l].[Id] = [l0].[Level1_Optional_Id] INNER JOIN [LevelThree] AS [l1] ON [l0].[Id] = [l1].[OneToMany_Optional_Inverse3Id] -ORDER BY [l0].[Name], [l].[Id], [l0].[Id] +ORDER BY [l0].[Name], [l].[Id] """); } @@ -2630,11 +2611,11 @@ FROM [LevelOne] AS [l0] ) AS [l2] WHERE [l2].[row] <= 1 ) AS [l3] ON [l1].[Name] = [l3].[Name] -ORDER BY [l1].[Name], [l3].[Id] +ORDER BY [l1].[Name] """, // """ -SELECT [l6].[Id], [l6].[Date], [l6].[Level1_Optional_Id], [l6].[Level1_Required_Id], [l6].[Name], [l6].[OneToMany_Optional_Inverse2Id], [l6].[OneToMany_Optional_Self_Inverse2Id], [l6].[OneToMany_Required_Inverse2Id], [l6].[OneToMany_Required_Self_Inverse2Id], [l6].[OneToOne_Optional_PK_Inverse2Id], [l6].[OneToOne_Optional_Self2Id], [l7].[Name], [l9].[Id] +SELECT [l6].[Id], [l6].[Date], [l6].[Level1_Optional_Id], [l6].[Level1_Required_Id], [l6].[Name], [l6].[OneToMany_Optional_Inverse2Id], [l6].[OneToMany_Optional_Self_Inverse2Id], [l6].[OneToMany_Required_Inverse2Id], [l6].[OneToMany_Required_Self_Inverse2Id], [l6].[OneToOne_Optional_PK_Inverse2Id], [l6].[OneToOne_Optional_Self2Id], [l7].[Name] FROM ( SELECT [l].[Name] FROM [LevelOne] AS [l] @@ -2649,7 +2630,7 @@ FROM [LevelOne] AS [l5] WHERE [l8].[row] <= 1 ) AS [l9] ON [l7].[Name] = [l9].[Name] INNER JOIN [LevelTwo] AS [l6] ON [l9].[Id] = [l6].[OneToMany_Optional_Inverse2Id] -ORDER BY [l7].[Name], [l9].[Id] +ORDER BY [l7].[Name] """); } @@ -2675,11 +2656,11 @@ WHERE [l0].[Id] > 3 ) AS [l2] WHERE [l2].[row] <= 1 ) AS [l3] ON [l1].[Name] = [l3].[Name] -ORDER BY [l1].[Name], [l3].[Id] +ORDER BY [l1].[Name] """, // """ -SELECT [l6].[Id], [l6].[Date], [l6].[Level1_Optional_Id], [l6].[Level1_Required_Id], [l6].[Name], [l6].[OneToMany_Optional_Inverse2Id], [l6].[OneToMany_Optional_Self_Inverse2Id], [l6].[OneToMany_Required_Inverse2Id], [l6].[OneToMany_Required_Self_Inverse2Id], [l6].[OneToOne_Optional_PK_Inverse2Id], [l6].[OneToOne_Optional_Self2Id], [l7].[Name], [l9].[Id] +SELECT [l6].[Id], [l6].[Date], [l6].[Level1_Optional_Id], [l6].[Level1_Required_Id], [l6].[Name], [l6].[OneToMany_Optional_Inverse2Id], [l6].[OneToMany_Optional_Self_Inverse2Id], [l6].[OneToMany_Required_Inverse2Id], [l6].[OneToMany_Required_Self_Inverse2Id], [l6].[OneToOne_Optional_PK_Inverse2Id], [l6].[OneToOne_Optional_Self2Id], [l7].[Name] FROM ( SELECT [l].[Name] FROM [LevelOne] AS [l] @@ -2696,7 +2677,7 @@ WHERE [l5].[Id] > 3 WHERE [l8].[row] <= 1 ) AS [l9] ON [l7].[Name] = [l9].[Name] INNER JOIN [LevelTwo] AS [l6] ON [l9].[Id] = [l6].[OneToMany_Optional_Inverse2Id] -ORDER BY [l7].[Name], [l9].[Id] +ORDER BY [l7].[Name] """); } @@ -2721,11 +2702,11 @@ FROM [LevelOne] AS [l0] ) AS [l2] WHERE [l2].[row] <= 1 ) AS [l3] ON [l1].[Name] = [l3].[Name] -ORDER BY [l1].[Name], [l3].[Id] +ORDER BY [l1].[Name] """, // """ -SELECT [l6].[Id], [l6].[Date], [l6].[Level1_Optional_Id], [l6].[Level1_Required_Id], [l6].[Name], [l6].[OneToMany_Optional_Inverse2Id], [l6].[OneToMany_Optional_Self_Inverse2Id], [l6].[OneToMany_Required_Inverse2Id], [l6].[OneToMany_Required_Self_Inverse2Id], [l6].[OneToOne_Optional_PK_Inverse2Id], [l6].[OneToOne_Optional_Self2Id], [l7].[Name], [l9].[Id] +SELECT [l6].[Id], [l6].[Date], [l6].[Level1_Optional_Id], [l6].[Level1_Required_Id], [l6].[Name], [l6].[OneToMany_Optional_Inverse2Id], [l6].[OneToMany_Optional_Self_Inverse2Id], [l6].[OneToMany_Required_Inverse2Id], [l6].[OneToMany_Required_Self_Inverse2Id], [l6].[OneToOne_Optional_PK_Inverse2Id], [l6].[OneToOne_Optional_Self2Id], [l7].[Name] FROM ( SELECT [l].[Name] FROM [LevelOne] AS [l] @@ -2741,7 +2722,7 @@ FROM [LevelOne] AS [l5] WHERE [l8].[row] <= 1 ) AS [l9] ON [l7].[Name] = [l9].[Name] INNER JOIN [LevelTwo] AS [l6] ON [l9].[Id] = [l6].[OneToMany_Optional_Inverse2Id] -ORDER BY [l7].[Name], [l9].[Id] +ORDER BY [l7].[Name] """); } @@ -2758,7 +2739,7 @@ FROM [LevelOne] AS [l] """, // """ -SELECT [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Name], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Optional_Self_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[OneToMany_Required_Self_Inverse3Id], [l1].[OneToOne_Optional_PK_Inverse3Id], [l1].[OneToOne_Optional_Self3Id], [l].[Id], [l0].[Id] +SELECT [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Name], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Optional_Self_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[OneToMany_Required_Self_Inverse3Id], [l1].[OneToOne_Optional_PK_Inverse3Id], [l1].[OneToOne_Optional_Self3Id], [l].[Id] FROM [LevelOne] AS [l] LEFT JOIN [LevelTwo] AS [l0] ON [l].[Id] = [l0].[Level1_Optional_Id] INNER JOIN [LevelThree] AS [l1] ON [l0].[Id] = [l1].[OneToMany_Optional_Inverse3Id] @@ -2798,17 +2779,17 @@ FROM [LevelOne] AS [l] INNER JOIN [LevelTwo] AS [l0] ON [l].[Id] = [l0].[OneToMany_Required_Inverse2Id] INNER JOIN [LevelThree] AS [l1] ON [l0].[Id] = [l1].[OneToMany_Optional_Inverse3Id] LEFT JOIN [LevelFour] AS [l2] ON [l1].[Id] = [l2].[Level3_Required_Id] -ORDER BY [l].[Id], [l0].[Id], [l1].[Id], [l2].[Id] +ORDER BY [l].[Id], [l0].[Id], [l1].[Id] """, // """ -SELECT [l3].[Id], [l3].[Level3_Optional_Id], [l3].[Level3_Required_Id], [l3].[Name], [l3].[OneToMany_Optional_Inverse4Id], [l3].[OneToMany_Optional_Self_Inverse4Id], [l3].[OneToMany_Required_Inverse4Id], [l3].[OneToMany_Required_Self_Inverse4Id], [l3].[OneToOne_Optional_PK_Inverse4Id], [l3].[OneToOne_Optional_Self4Id], [l].[Id], [l0].[Id], [l1].[Id], [l2].[Id] +SELECT [l3].[Id], [l3].[Level3_Optional_Id], [l3].[Level3_Required_Id], [l3].[Name], [l3].[OneToMany_Optional_Inverse4Id], [l3].[OneToMany_Optional_Self_Inverse4Id], [l3].[OneToMany_Required_Inverse4Id], [l3].[OneToMany_Required_Self_Inverse4Id], [l3].[OneToOne_Optional_PK_Inverse4Id], [l3].[OneToOne_Optional_Self4Id], [l].[Id], [l0].[Id], [l1].[Id] FROM [LevelOne] AS [l] INNER JOIN [LevelTwo] AS [l0] ON [l].[Id] = [l0].[OneToMany_Required_Inverse2Id] INNER JOIN [LevelThree] AS [l1] ON [l0].[Id] = [l1].[OneToMany_Optional_Inverse3Id] LEFT JOIN [LevelFour] AS [l2] ON [l1].[Id] = [l2].[Level3_Required_Id] INNER JOIN [LevelFour] AS [l3] ON [l2].[Id] = [l3].[OneToMany_Required_Self_Inverse4Id] -ORDER BY [l].[Id], [l0].[Id], [l1].[Id], [l2].[Id] +ORDER BY [l].[Id], [l0].[Id], [l1].[Id] """); } @@ -2818,22 +2799,22 @@ public override async Task Include_after_SelectMany_and_multiple_reference_navig AssertSql( """ -SELECT [l2].[Id], [l2].[Level3_Optional_Id], [l2].[Level3_Required_Id], [l2].[Name], [l2].[OneToMany_Optional_Inverse4Id], [l2].[OneToMany_Optional_Self_Inverse4Id], [l2].[OneToMany_Required_Inverse4Id], [l2].[OneToMany_Required_Self_Inverse4Id], [l2].[OneToOne_Optional_PK_Inverse4Id], [l2].[OneToOne_Optional_Self4Id], [l].[Id], [l0].[Id], [l1].[Id] +SELECT [l2].[Id], [l2].[Level3_Optional_Id], [l2].[Level3_Required_Id], [l2].[Name], [l2].[OneToMany_Optional_Inverse4Id], [l2].[OneToMany_Optional_Self_Inverse4Id], [l2].[OneToMany_Required_Inverse4Id], [l2].[OneToMany_Required_Self_Inverse4Id], [l2].[OneToOne_Optional_PK_Inverse4Id], [l2].[OneToOne_Optional_Self4Id], [l].[Id], [l0].[Id] FROM [LevelOne] AS [l] INNER JOIN [LevelTwo] AS [l0] ON [l].[Id] = [l0].[OneToMany_Required_Inverse2Id] LEFT JOIN [LevelThree] AS [l1] ON [l0].[Id] = [l1].[Level2_Optional_Id] LEFT JOIN [LevelFour] AS [l2] ON [l1].[Id] = [l2].[Level3_Required_Id] -ORDER BY [l].[Id], [l0].[Id], [l1].[Id], [l2].[Id] +ORDER BY [l].[Id], [l0].[Id] """, // """ -SELECT [l3].[Id], [l3].[Level3_Optional_Id], [l3].[Level3_Required_Id], [l3].[Name], [l3].[OneToMany_Optional_Inverse4Id], [l3].[OneToMany_Optional_Self_Inverse4Id], [l3].[OneToMany_Required_Inverse4Id], [l3].[OneToMany_Required_Self_Inverse4Id], [l3].[OneToOne_Optional_PK_Inverse4Id], [l3].[OneToOne_Optional_Self4Id], [l].[Id], [l0].[Id], [l1].[Id], [l2].[Id] +SELECT [l3].[Id], [l3].[Level3_Optional_Id], [l3].[Level3_Required_Id], [l3].[Name], [l3].[OneToMany_Optional_Inverse4Id], [l3].[OneToMany_Optional_Self_Inverse4Id], [l3].[OneToMany_Required_Inverse4Id], [l3].[OneToMany_Required_Self_Inverse4Id], [l3].[OneToOne_Optional_PK_Inverse4Id], [l3].[OneToOne_Optional_Self4Id], [l].[Id], [l0].[Id] FROM [LevelOne] AS [l] INNER JOIN [LevelTwo] AS [l0] ON [l].[Id] = [l0].[OneToMany_Required_Inverse2Id] LEFT JOIN [LevelThree] AS [l1] ON [l0].[Id] = [l1].[Level2_Optional_Id] LEFT JOIN [LevelFour] AS [l2] ON [l1].[Id] = [l2].[Level3_Required_Id] INNER JOIN [LevelFour] AS [l3] ON [l2].[Id] = [l3].[OneToMany_Optional_Self_Inverse4Id] -ORDER BY [l].[Id], [l0].[Id], [l1].[Id], [l2].[Id] +ORDER BY [l].[Id], [l0].[Id] """); } @@ -2888,15 +2869,15 @@ public override async Task Include_reference_followed_by_include_collection(bool 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] -ORDER BY [l].[Id], [l0].[Id] +ORDER BY [l].[Id] """, // """ -SELECT [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Name], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Optional_Self_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[OneToMany_Required_Self_Inverse3Id], [l1].[OneToOne_Optional_PK_Inverse3Id], [l1].[OneToOne_Optional_Self3Id], [l].[Id], [l0].[Id] +SELECT [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Name], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Optional_Self_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[OneToMany_Required_Self_Inverse3Id], [l1].[OneToOne_Optional_PK_Inverse3Id], [l1].[OneToOne_Optional_Self3Id], [l].[Id] FROM [LevelOne] AS [l] LEFT JOIN [LevelTwo] AS [l0] ON [l].[Id] = [l0].[Level1_Optional_Id] INNER JOIN [LevelThree] AS [l1] ON [l0].[Id] = [l1].[OneToMany_Optional_Inverse3Id] -ORDER BY [l].[Id], [l0].[Id] +ORDER BY [l].[Id] """); } @@ -3011,21 +2992,19 @@ FROM [LevelTwo] AS [l0] LEFT JOIN [LevelFour] AS [l2] ON [l1].[Id] = [l2].[Level3_Optional_Id] LEFT JOIN [LevelThree] AS [l3] ON [l0].[Id] = [l3].[Level2_Optional_Id] ) AS [s] ON [l].[Id] = [s].[OneToMany_Optional_Inverse2Id] -ORDER BY [l].[Id], [s].[Id], [s].[Id0], [s].[Id1], [s].[Id2] +ORDER BY [l].[Id], [s].[Id] """, // """ -SELECT [l4].[Id], [l4].[Level3_Optional_Id], [l4].[Level3_Required_Id], [l4].[Name], [l4].[OneToMany_Optional_Inverse4Id], [l4].[OneToMany_Optional_Self_Inverse4Id], [l4].[OneToMany_Required_Inverse4Id], [l4].[OneToMany_Required_Self_Inverse4Id], [l4].[OneToOne_Optional_PK_Inverse4Id], [l4].[OneToOne_Optional_Self4Id], [l].[Id], [s].[Id], [s].[Id0], [s].[Id1], [s].[Id2] +SELECT [l4].[Id], [l4].[Level3_Optional_Id], [l4].[Level3_Required_Id], [l4].[Name], [l4].[OneToMany_Optional_Inverse4Id], [l4].[OneToMany_Optional_Self_Inverse4Id], [l4].[OneToMany_Required_Inverse4Id], [l4].[OneToMany_Required_Self_Inverse4Id], [l4].[OneToOne_Optional_PK_Inverse4Id], [l4].[OneToOne_Optional_Self4Id], [l].[Id], [s].[Id] FROM [LevelOne] AS [l] INNER JOIN ( - SELECT [l0].[Id], [l0].[OneToMany_Optional_Inverse2Id], [l1].[Id] AS [Id0], [l2].[Id] AS [Id1], [l3].[Id] AS [Id2] + SELECT [l0].[Id], [l0].[OneToMany_Optional_Inverse2Id], [l3].[Id] AS [Id2] FROM [LevelTwo] AS [l0] - LEFT JOIN [LevelThree] AS [l1] ON [l0].[Id] = [l1].[OneToOne_Optional_PK_Inverse3Id] - LEFT JOIN [LevelFour] AS [l2] ON [l1].[Id] = [l2].[Level3_Optional_Id] LEFT JOIN [LevelThree] AS [l3] ON [l0].[Id] = [l3].[Level2_Optional_Id] ) AS [s] ON [l].[Id] = [s].[OneToMany_Optional_Inverse2Id] INNER JOIN [LevelFour] AS [l4] ON [s].[Id2] = [l4].[OneToMany_Optional_Inverse4Id] -ORDER BY [l].[Id], [s].[Id], [s].[Id0], [s].[Id1], [s].[Id2] +ORDER BY [l].[Id], [s].[Id] """); } @@ -3050,21 +3029,19 @@ FROM [LevelTwo] AS [l0] LEFT JOIN [LevelFour] AS [l2] ON [l1].[Id] = [l2].[Level3_Optional_Id] LEFT JOIN [LevelThree] AS [l3] ON [l0].[Id] = [l3].[Level2_Optional_Id] ) AS [s] ON [l].[Id] = [s].[OneToMany_Optional_Inverse2Id] -ORDER BY [l].[Id], [s].[Id], [s].[Id0], [s].[Id1], [s].[Id2] +ORDER BY [l].[Id], [s].[Id] """, // """ -SELECT [l4].[Id], [l4].[Level3_Optional_Id], [l4].[Level3_Required_Id], [l4].[Name], [l4].[OneToMany_Optional_Inverse4Id], [l4].[OneToMany_Optional_Self_Inverse4Id], [l4].[OneToMany_Required_Inverse4Id], [l4].[OneToMany_Required_Self_Inverse4Id], [l4].[OneToOne_Optional_PK_Inverse4Id], [l4].[OneToOne_Optional_Self4Id], [l].[Id], [s].[Id], [s].[Id0], [s].[Id1], [s].[Id2] +SELECT [l4].[Id], [l4].[Level3_Optional_Id], [l4].[Level3_Required_Id], [l4].[Name], [l4].[OneToMany_Optional_Inverse4Id], [l4].[OneToMany_Optional_Self_Inverse4Id], [l4].[OneToMany_Required_Inverse4Id], [l4].[OneToMany_Required_Self_Inverse4Id], [l4].[OneToOne_Optional_PK_Inverse4Id], [l4].[OneToOne_Optional_Self4Id], [l].[Id], [s].[Id] FROM [LevelOne] AS [l] INNER JOIN ( - SELECT [l0].[Id], [l0].[OneToMany_Optional_Inverse2Id], [l1].[Id] AS [Id0], [l2].[Id] AS [Id1], [l3].[Id] AS [Id2] + SELECT [l0].[Id], [l0].[OneToMany_Optional_Inverse2Id], [l3].[Id] AS [Id2] FROM [LevelTwo] AS [l0] - LEFT JOIN [LevelThree] AS [l1] ON [l0].[Id] = [l1].[OneToOne_Optional_PK_Inverse3Id] - LEFT JOIN [LevelFour] AS [l2] ON [l1].[Id] = [l2].[Level3_Optional_Id] LEFT JOIN [LevelThree] AS [l3] ON [l0].[Id] = [l3].[Level2_Optional_Id] ) AS [s] ON [l].[Id] = [s].[OneToMany_Optional_Inverse2Id] INNER JOIN [LevelFour] AS [l4] ON [s].[Id2] = [l4].[OneToMany_Optional_Inverse4Id] -ORDER BY [l].[Id], [s].[Id], [s].[Id0], [s].[Id1], [s].[Id2] +ORDER BY [l].[Id], [s].[Id] """); } @@ -3170,16 +3147,14 @@ public override async Task Including_reference_navigation_and_projecting_collect 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_Optional_Id] -ORDER BY [l].[Id], [l0].[Id], [l1].[Id] +ORDER BY [l].[Id] """, // """ -SELECT [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], [l].[Id], [l0].[Id], [l1].[Id] +SELECT [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], [l].[Id] 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_Optional_Id] INNER JOIN [LevelTwo] AS [l2] ON [l].[Id] = [l2].[OneToMany_Required_Inverse2Id] -ORDER BY [l].[Id], [l0].[Id], [l1].[Id] +ORDER BY [l].[Id] """); } @@ -3195,23 +3170,23 @@ public override async Task LeftJoin_with_Any_on_outer_source_and_projecting_coll SELECT CASE WHEN [l0].[Id] IS NULL THEN 0 ELSE [l0].[Id] -END, [l].[Id], [l0].[Id] +END, [l].[Id] FROM [LevelOne] AS [l] LEFT JOIN [LevelTwo] AS [l0] ON [l].[Id] = [l0].[Level1_Required_Id] WHERE [l].[Name] IN (@validIds1, @validIds2) -ORDER BY [l].[Id], [l0].[Id] +ORDER BY [l].[Id] """, // """ @validIds3='L1 01' (Size = 4000) @validIds4='L1 02' (Size = 4000) -SELECT [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Name], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Optional_Self_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[OneToMany_Required_Self_Inverse3Id], [l1].[OneToOne_Optional_PK_Inverse3Id], [l1].[OneToOne_Optional_Self3Id], [l].[Id], [l0].[Id] +SELECT [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Name], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Optional_Self_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[OneToMany_Required_Self_Inverse3Id], [l1].[OneToOne_Optional_PK_Inverse3Id], [l1].[OneToOne_Optional_Self3Id], [l].[Id] FROM [LevelOne] AS [l] LEFT JOIN [LevelTwo] AS [l0] ON [l].[Id] = [l0].[Level1_Required_Id] INNER JOIN [LevelThree] AS [l1] ON [l0].[Id] = [l1].[OneToMany_Required_Inverse3Id] WHERE [l].[Name] IN (@validIds3, @validIds4) -ORDER BY [l].[Id], [l0].[Id] +ORDER BY [l].[Id] """); } @@ -3779,16 +3754,16 @@ public override async Task Include_partially_added_before_Where_and_then_build_u AssertSql( """ -SELECT [l].[Id], [l].[Date], [l].[Name], [l].[OneToMany_Optional_Self_Inverse1Id], [l].[OneToMany_Required_Self_Inverse1Id], [l].[OneToOne_Optional_Self1Id], [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], [l0].[Id] +SELECT [l].[Id], [l].[Date], [l].[Name], [l].[OneToMany_Optional_Self_Inverse1Id], [l].[OneToMany_Required_Self_Inverse1Id], [l].[OneToOne_Optional_Self1Id], [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 [LevelOne] AS [l] LEFT JOIN [LevelTwo] AS [l0] ON [l].[Id] = [l0].[OneToOne_Optional_PK_Inverse2Id] LEFT JOIN [LevelTwo] AS [l1] ON [l].[Id] = [l1].[Level1_Optional_Id] WHERE [l0].[Id] < 3 OR [l1].[Id] > 8 -ORDER BY [l].[Id], [l0].[Id], [l1].[Id] +ORDER BY [l].[Id] """, // """ -SELECT [s].[Id], [s].[Level2_Optional_Id], [s].[Level2_Required_Id], [s].[Name], [s].[OneToMany_Optional_Inverse3Id], [s].[OneToMany_Optional_Self_Inverse3Id], [s].[OneToMany_Required_Inverse3Id], [s].[OneToMany_Required_Self_Inverse3Id], [s].[OneToOne_Optional_PK_Inverse3Id], [s].[OneToOne_Optional_Self3Id], [s].[Id0], [s].[Level3_Optional_Id], [s].[Level3_Required_Id], [s].[Name0], [s].[OneToMany_Optional_Inverse4Id], [s].[OneToMany_Optional_Self_Inverse4Id], [s].[OneToMany_Required_Inverse4Id], [s].[OneToMany_Required_Self_Inverse4Id], [s].[OneToOne_Optional_PK_Inverse4Id], [s].[OneToOne_Optional_Self4Id], [l].[Id], [l0].[Id], [l1].[Id] +SELECT [s].[Id], [s].[Level2_Optional_Id], [s].[Level2_Required_Id], [s].[Name], [s].[OneToMany_Optional_Inverse3Id], [s].[OneToMany_Optional_Self_Inverse3Id], [s].[OneToMany_Required_Inverse3Id], [s].[OneToMany_Required_Self_Inverse3Id], [s].[OneToOne_Optional_PK_Inverse3Id], [s].[OneToOne_Optional_Self3Id], [s].[Id0], [s].[Level3_Optional_Id], [s].[Level3_Required_Id], [s].[Name0], [s].[OneToMany_Optional_Inverse4Id], [s].[OneToMany_Optional_Self_Inverse4Id], [s].[OneToMany_Required_Inverse4Id], [s].[OneToMany_Required_Self_Inverse4Id], [s].[OneToOne_Optional_PK_Inverse4Id], [s].[OneToOne_Optional_Self4Id], [l].[Id] FROM [LevelOne] AS [l] LEFT JOIN [LevelTwo] AS [l0] ON [l].[Id] = [l0].[OneToOne_Optional_PK_Inverse2Id] LEFT JOIN [LevelTwo] AS [l1] ON [l].[Id] = [l1].[Level1_Optional_Id] @@ -3798,7 +3773,7 @@ FROM [LevelThree] AS [l2] LEFT JOIN [LevelFour] AS [l3] ON [l2].[Id] = [l3].[Level3_Optional_Id] ) AS [s] ON [l1].[Id] = [s].[OneToMany_Optional_Inverse3Id] WHERE [l0].[Id] < 3 OR [l1].[Id] > 8 -ORDER BY [l].[Id], [l0].[Id], [l1].[Id] +ORDER BY [l].[Id] """); } @@ -3808,16 +3783,16 @@ public override async Task Include_partially_added_before_Where_and_then_build_u AssertSql( """ -SELECT [l].[Id], [l].[Date], [l].[Name], [l].[OneToMany_Optional_Self_Inverse1Id], [l].[OneToMany_Required_Self_Inverse1Id], [l].[OneToOne_Optional_Self1Id], [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], [l0].[Id] +SELECT [l].[Id], [l].[Date], [l].[Name], [l].[OneToMany_Optional_Self_Inverse1Id], [l].[OneToMany_Required_Self_Inverse1Id], [l].[OneToOne_Optional_Self1Id], [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 [LevelOne] AS [l] LEFT JOIN [LevelTwo] AS [l0] ON [l].[Id] = [l0].[OneToOne_Optional_PK_Inverse2Id] LEFT JOIN [LevelTwo] AS [l1] ON [l].[Id] = [l1].[Level1_Optional_Id] WHERE [l0].[Id] < 3 OR [l1].[Id] > 8 -ORDER BY [l].[Id], [l0].[Id], [l1].[Id] +ORDER BY [l].[Id] """, // """ -SELECT [l6].[Id], [l6].[Level2_Optional_Id], [l6].[Level2_Required_Id], [l6].[Name], [l6].[OneToMany_Optional_Inverse3Id], [l6].[OneToMany_Optional_Self_Inverse3Id], [l6].[OneToMany_Required_Inverse3Id], [l6].[OneToMany_Required_Self_Inverse3Id], [l6].[OneToOne_Optional_PK_Inverse3Id], [l6].[OneToOne_Optional_Self3Id], [l].[Id], [l0].[Id], [l1].[Id] +SELECT [l6].[Id], [l6].[Level2_Optional_Id], [l6].[Level2_Required_Id], [l6].[Name], [l6].[OneToMany_Optional_Inverse3Id], [l6].[OneToMany_Optional_Self_Inverse3Id], [l6].[OneToMany_Required_Inverse3Id], [l6].[OneToMany_Required_Self_Inverse3Id], [l6].[OneToOne_Optional_PK_Inverse3Id], [l6].[OneToOne_Optional_Self3Id], [l].[Id] FROM [LevelOne] AS [l] LEFT JOIN [LevelTwo] AS [l0] ON [l].[Id] = [l0].[OneToOne_Optional_PK_Inverse2Id] LEFT JOIN [LevelTwo] AS [l1] ON [l].[Id] = [l1].[Level1_Optional_Id] @@ -3830,11 +3805,11 @@ FROM [LevelThree] AS [l2] WHERE [l5].[row] <= 3 ) AS [l6] ON [l1].[Id] = [l6].[OneToMany_Optional_Inverse3Id] WHERE [l0].[Id] < 3 OR [l1].[Id] > 8 -ORDER BY [l].[Id], [l0].[Id], [l1].[Id], [l6].[OneToMany_Optional_Inverse3Id], [l6].[Id] +ORDER BY [l].[Id], [l6].[OneToMany_Optional_Inverse3Id], [l6].[Id] """, // """ -SELECT [s].[Id], [s].[Level2_Optional_Id], [s].[Level2_Required_Id], [s].[Name], [s].[OneToMany_Optional_Inverse3Id], [s].[OneToMany_Optional_Self_Inverse3Id], [s].[OneToMany_Required_Inverse3Id], [s].[OneToMany_Required_Self_Inverse3Id], [s].[OneToOne_Optional_PK_Inverse3Id], [s].[OneToOne_Optional_Self3Id], [s].[Id0], [s].[Level3_Optional_Id], [s].[Level3_Required_Id], [s].[Name0], [s].[OneToMany_Optional_Inverse4Id], [s].[OneToMany_Optional_Self_Inverse4Id], [s].[OneToMany_Required_Inverse4Id], [s].[OneToMany_Required_Self_Inverse4Id], [s].[OneToOne_Optional_PK_Inverse4Id], [s].[OneToOne_Optional_Self4Id], [l].[Id], [l0].[Id], [l1].[Id] +SELECT [s].[Id], [s].[Level2_Optional_Id], [s].[Level2_Required_Id], [s].[Name], [s].[OneToMany_Optional_Inverse3Id], [s].[OneToMany_Optional_Self_Inverse3Id], [s].[OneToMany_Required_Inverse3Id], [s].[OneToMany_Required_Self_Inverse3Id], [s].[OneToOne_Optional_PK_Inverse3Id], [s].[OneToOne_Optional_Self3Id], [s].[Id0], [s].[Level3_Optional_Id], [s].[Level3_Required_Id], [s].[Name0], [s].[OneToMany_Optional_Inverse4Id], [s].[OneToMany_Optional_Self_Inverse4Id], [s].[OneToMany_Required_Inverse4Id], [s].[OneToMany_Required_Self_Inverse4Id], [s].[OneToOne_Optional_PK_Inverse4Id], [s].[OneToOne_Optional_Self4Id], [l].[Id] FROM [LevelOne] AS [l] LEFT JOIN [LevelTwo] AS [l0] ON [l].[Id] = [l0].[OneToOne_Optional_PK_Inverse2Id] LEFT JOIN [LevelTwo] AS [l1] ON [l].[Id] = [l1].[Level1_Optional_Id] @@ -3844,7 +3819,7 @@ FROM [LevelThree] AS [l3] LEFT JOIN [LevelFour] AS [l4] ON [l3].[Id] = [l4].[Level3_Optional_Id] ) AS [s] ON [l1].[Id] = [s].[OneToMany_Required_Inverse3Id] WHERE [l0].[Id] < 3 OR [l1].[Id] > 8 -ORDER BY [l].[Id], [l0].[Id], [l1].[Id] +ORDER BY [l].[Id] """); } @@ -3941,21 +3916,20 @@ SELECT 1 FROM [LevelTwo] AS [l3] WHERE [l].[Id] = [l3].[OneToMany_Optional_Inverse2Id] AND [l3].[Id] = 2) THEN CAST(1 AS bit) ELSE CAST(0 AS bit) -END, [l0].[Id] +END FROM [LevelOne] AS [l] LEFT JOIN [LevelTwo] AS [l0] ON [l].[Id] = [l0].[Level1_Optional_Id] WHERE [l].[Id] = 2 -ORDER BY [l].[Name], [l].[Id], [l0].[Id] +ORDER BY [l].[Name], [l].[Id] """, // """ -SELECT [s0].[Id], [s0].[Date], [s0].[Name], [s0].[OneToMany_Optional_Self_Inverse1Id], [s0].[OneToMany_Required_Self_Inverse1Id], [s0].[OneToOne_Optional_Self1Id], [s0].[ChildCount], [s0].[Level2Name], [s0].[Level2Count], [s0].[IsLevel2There], [s].[Id], [s].[Id0] +SELECT [s0].[Id], [s0].[Date], [s0].[Name], [s0].[OneToMany_Optional_Self_Inverse1Id], [s0].[OneToMany_Required_Self_Inverse1Id], [s0].[OneToOne_Optional_Self1Id], [s0].[ChildCount], [s0].[Level2Name], [s0].[Level2Count], [s0].[IsLevel2There], [s].[Id] FROM ( - SELECT TOP(1) [l].[Id], [l0].[Id] AS [Id0], [l].[Name] + SELECT TOP(1) [l].[Id], [l].[Name] FROM [LevelOne] AS [l] - LEFT JOIN [LevelTwo] AS [l0] ON [l].[Id] = [l0].[Level1_Optional_Id] WHERE [l].[Id] = 2 - ORDER BY [l].[Name], [l].[Id], [l0].[Id] + ORDER BY [l].[Name], [l].[Id] ) AS [s] CROSS APPLY ( SELECT [l21].[Id], [l21].[Date], [l21].[Name], [l21].[OneToMany_Optional_Self_Inverse1Id], [l21].[OneToMany_Required_Self_Inverse1Id], [l21].[OneToOne_Optional_Self1Id], ( @@ -3980,7 +3954,7 @@ OFFSET 1 ROWS FETCH NEXT 5 ROWS ONLY ) AS [l21] LEFT JOIN [LevelTwo] AS [l20] ON [l21].[Id] = [l20].[Level1_Optional_Id] ) AS [s0] -ORDER BY [s].[Name], [s].[Id], [s].[Id0], [s0].[Name] +ORDER BY [s].[Name], [s].[Id], [s0].[Name] """); } @@ -4018,14 +3992,13 @@ public override async Task Projecting_collection_after_optional_reference_correl AssertSql( """ -SELECT [l].[Id], [l0].[Id] +SELECT [l].[Id] FROM [LevelOne] AS [l] -LEFT JOIN [LevelTwo] AS [l0] ON [l].[Id] = [l0].[Level1_Optional_Id] -ORDER BY [l].[Id], [l0].[Id] +ORDER BY [l].[Id] """, // """ -SELECT [l4].[ChildId], [l4].[ParentName], [l].[Id], [l0].[Id] +SELECT [l4].[ChildId], [l4].[ParentName], [l].[Id] FROM [LevelOne] AS [l] LEFT JOIN [LevelTwo] AS [l0] ON [l].[Id] = [l0].[Level1_Optional_Id] CROSS APPLY ( @@ -4033,7 +4006,7 @@ CROSS APPLY ( FROM [LevelThree] AS [l3] WHERE [l0].[Id] IS NOT NULL AND [l0].[Id] = [l3].[OneToMany_Optional_Inverse3Id] ) AS [l4] -ORDER BY [l].[Id], [l0].[Id] +ORDER BY [l].[Id] """); } @@ -4043,25 +4016,24 @@ public override async Task Projecting_collection_with_group_by_after_optional_re AssertSql( """ -SELECT [l].[Id], [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], [l0].[Id] +SELECT [l].[Id], [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 [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] -ORDER BY [l].[Id], [l0].[Id], [l1].[Id] +ORDER BY [l].[Id] """, // """ -SELECT [l8].[Key], [l8].[Count], [l].[Id], [l0].[Id], [l1].[Id] +SELECT [l8].[Key], [l8].[Count], [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_Optional_Id] CROSS APPLY ( SELECT [l6].[Name] AS [Key], COUNT(*) AS [Count] FROM [LevelThree] AS [l6] WHERE [l0].[Id] IS NOT NULL AND [l0].[Id] = [l6].[OneToMany_Optional_Inverse3Id] GROUP BY [l6].[Name] ) AS [l8] -ORDER BY [l].[Id], [l0].[Id], [l1].[Id] +ORDER BY [l].[Id] """); } @@ -4074,27 +4046,26 @@ public override async Task Multiple_complex_includes_EF_Property(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] -ORDER BY [l].[Id], [l0].[Id] +ORDER BY [l].[Id] """, // """ -SELECT [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Name], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Optional_Self_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[OneToMany_Required_Self_Inverse3Id], [l1].[OneToOne_Optional_PK_Inverse3Id], [l1].[OneToOne_Optional_Self3Id], [l].[Id], [l0].[Id] +SELECT [l1].[Id], [l1].[Level2_Optional_Id], [l1].[Level2_Required_Id], [l1].[Name], [l1].[OneToMany_Optional_Inverse3Id], [l1].[OneToMany_Optional_Self_Inverse3Id], [l1].[OneToMany_Required_Inverse3Id], [l1].[OneToMany_Required_Self_Inverse3Id], [l1].[OneToOne_Optional_PK_Inverse3Id], [l1].[OneToOne_Optional_Self3Id], [l].[Id] FROM [LevelOne] AS [l] LEFT JOIN [LevelTwo] AS [l0] ON [l].[Id] = [l0].[Level1_Optional_Id] INNER JOIN [LevelThree] AS [l1] ON [l0].[Id] = [l1].[OneToMany_Optional_Inverse3Id] -ORDER BY [l].[Id], [l0].[Id] +ORDER BY [l].[Id] """, // """ -SELECT [s].[Id], [s].[Date], [s].[Level1_Optional_Id], [s].[Level1_Required_Id], [s].[Name], [s].[OneToMany_Optional_Inverse2Id], [s].[OneToMany_Optional_Self_Inverse2Id], [s].[OneToMany_Required_Inverse2Id], [s].[OneToMany_Required_Self_Inverse2Id], [s].[OneToOne_Optional_PK_Inverse2Id], [s].[OneToOne_Optional_Self2Id], [s].[Id0], [s].[Level2_Optional_Id], [s].[Level2_Required_Id], [s].[Name0], [s].[OneToMany_Optional_Inverse3Id], [s].[OneToMany_Optional_Self_Inverse3Id], [s].[OneToMany_Required_Inverse3Id], [s].[OneToMany_Required_Self_Inverse3Id], [s].[OneToOne_Optional_PK_Inverse3Id], [s].[OneToOne_Optional_Self3Id], [l].[Id], [l0].[Id] +SELECT [s].[Id], [s].[Date], [s].[Level1_Optional_Id], [s].[Level1_Required_Id], [s].[Name], [s].[OneToMany_Optional_Inverse2Id], [s].[OneToMany_Optional_Self_Inverse2Id], [s].[OneToMany_Required_Inverse2Id], [s].[OneToMany_Required_Self_Inverse2Id], [s].[OneToOne_Optional_PK_Inverse2Id], [s].[OneToOne_Optional_Self2Id], [s].[Id0], [s].[Level2_Optional_Id], [s].[Level2_Required_Id], [s].[Name0], [s].[OneToMany_Optional_Inverse3Id], [s].[OneToMany_Optional_Self_Inverse3Id], [s].[OneToMany_Required_Inverse3Id], [s].[OneToMany_Required_Self_Inverse3Id], [s].[OneToOne_Optional_PK_Inverse3Id], [s].[OneToOne_Optional_Self3Id], [l].[Id] FROM [LevelOne] AS [l] -LEFT JOIN [LevelTwo] AS [l0] ON [l].[Id] = [l0].[Level1_Optional_Id] INNER JOIN ( SELECT [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], [l3].[Id] AS [Id0], [l3].[Level2_Optional_Id], [l3].[Level2_Required_Id], [l3].[Name] AS [Name0], [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 [LevelTwo] AS [l2] LEFT JOIN [LevelThree] AS [l3] ON [l2].[Id] = [l3].[Level2_Optional_Id] ) AS [s] ON [l].[Id] = [s].[OneToMany_Optional_Inverse2Id] -ORDER BY [l].[Id], [l0].[Id] +ORDER BY [l].[Id] """); } @@ -4107,27 +4078,26 @@ public override async Task Multiple_complex_includes_self_ref_EF_Property(bool a 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].[Name], [l0].[OneToMany_Optional_Self_Inverse1Id], [l0].[OneToMany_Required_Self_Inverse1Id], [l0].[OneToOne_Optional_Self1Id] FROM [LevelOne] AS [l] LEFT JOIN [LevelOne] AS [l0] ON [l].[OneToOne_Optional_Self1Id] = [l0].[Id] -ORDER BY [l].[Id], [l0].[Id] +ORDER BY [l].[Id] """, // """ -SELECT [l1].[Id], [l1].[Date], [l1].[Name], [l1].[OneToMany_Optional_Self_Inverse1Id], [l1].[OneToMany_Required_Self_Inverse1Id], [l1].[OneToOne_Optional_Self1Id], [l].[Id], [l0].[Id] +SELECT [l1].[Id], [l1].[Date], [l1].[Name], [l1].[OneToMany_Optional_Self_Inverse1Id], [l1].[OneToMany_Required_Self_Inverse1Id], [l1].[OneToOne_Optional_Self1Id], [l].[Id] FROM [LevelOne] AS [l] LEFT JOIN [LevelOne] AS [l0] ON [l].[OneToOne_Optional_Self1Id] = [l0].[Id] INNER JOIN [LevelOne] AS [l1] ON [l0].[Id] = [l1].[OneToMany_Optional_Self_Inverse1Id] -ORDER BY [l].[Id], [l0].[Id] +ORDER BY [l].[Id] """, // """ -SELECT [s].[Id], [s].[Date], [s].[Name], [s].[OneToMany_Optional_Self_Inverse1Id], [s].[OneToMany_Required_Self_Inverse1Id], [s].[OneToOne_Optional_Self1Id], [s].[Id0], [s].[Date0], [s].[Name0], [s].[OneToMany_Optional_Self_Inverse1Id0], [s].[OneToMany_Required_Self_Inverse1Id0], [s].[OneToOne_Optional_Self1Id0], [l].[Id], [l0].[Id] +SELECT [s].[Id], [s].[Date], [s].[Name], [s].[OneToMany_Optional_Self_Inverse1Id], [s].[OneToMany_Required_Self_Inverse1Id], [s].[OneToOne_Optional_Self1Id], [s].[Id0], [s].[Date0], [s].[Name0], [s].[OneToMany_Optional_Self_Inverse1Id0], [s].[OneToMany_Required_Self_Inverse1Id0], [s].[OneToOne_Optional_Self1Id0], [l].[Id] FROM [LevelOne] AS [l] -LEFT JOIN [LevelOne] AS [l0] ON [l].[OneToOne_Optional_Self1Id] = [l0].[Id] INNER JOIN ( SELECT [l2].[Id], [l2].[Date], [l2].[Name], [l2].[OneToMany_Optional_Self_Inverse1Id], [l2].[OneToMany_Required_Self_Inverse1Id], [l2].[OneToOne_Optional_Self1Id], [l3].[Id] AS [Id0], [l3].[Date] AS [Date0], [l3].[Name] AS [Name0], [l3].[OneToMany_Optional_Self_Inverse1Id] AS [OneToMany_Optional_Self_Inverse1Id0], [l3].[OneToMany_Required_Self_Inverse1Id] AS [OneToMany_Required_Self_Inverse1Id0], [l3].[OneToOne_Optional_Self1Id] AS [OneToOne_Optional_Self1Id0] FROM [LevelOne] AS [l2] LEFT JOIN [LevelOne] AS [l3] ON [l2].[OneToOne_Optional_Self1Id] = [l3].[Id] ) AS [s] ON [l].[Id] = [s].[OneToMany_Optional_Self_Inverse1Id] -ORDER BY [l].[Id], [l0].[Id] +ORDER BY [l].[Id] """); } @@ -4242,11 +4212,11 @@ public override async Task Filtered_include_on_ThenInclude_EF_Property(bool asyn 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] -ORDER BY [l].[Id], [l0].[Id] +ORDER BY [l].[Id] """, // """ -SELECT [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], [l].[Id], [l0].[Id] +SELECT [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], [l].[Id] FROM [LevelOne] AS [l] LEFT JOIN [LevelTwo] AS [l0] ON [l].[Id] = [l0].[Level1_Optional_Id] INNER JOIN ( @@ -4258,7 +4228,7 @@ WHERE [l1].[Name] <> N'Foo' OR [l1].[Name] IS NULL ) AS [l2] WHERE 1 < [l2].[row] AND [l2].[row] <= 4 ) AS [l3] ON [l0].[Id] = [l3].[OneToMany_Optional_Inverse3Id] -ORDER BY [l].[Id], [l0].[Id], [l3].[OneToMany_Optional_Inverse3Id], [l3].[Name] +ORDER BY [l].[Id], [l3].[OneToMany_Optional_Inverse3Id], [l3].[Name] """); } @@ -4366,15 +4336,14 @@ public override async Task Final_GroupBy_property_entity_Include_collection_refe SELECT [l].[Name], [l].[Id], [l].[Date], [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] -ORDER BY [l].[Name], [l].[Id], [l0].[Id] +ORDER BY [l].[Name], [l].[Id] """, // """ -SELECT [l].[Name], [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], [l].[Id], [l0].[Id] +SELECT [l].[Name], [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], [l].[Id] FROM [LevelOne] AS [l] -LEFT JOIN [LevelTwo] AS [l0] ON [l].[Id] = [l0].[Level1_Optional_Id] INNER JOIN [LevelTwo] AS [l1] ON [l].[Id] = [l1].[OneToMany_Optional_Inverse2Id] -ORDER BY [l].[Name], [l].[Id], [l0].[Id] +ORDER BY [l].[Name], [l].[Id] """); } diff --git a/test/EFCore.SqlServer.FunctionalTests/Query/ComplexNavigationsQuerySqlServer160Test.cs b/test/EFCore.SqlServer.FunctionalTests/Query/ComplexNavigationsQuerySqlServer160Test.cs index 4def73b16a3..35bf8946a5a 100644 --- a/test/EFCore.SqlServer.FunctionalTests/Query/ComplexNavigationsQuerySqlServer160Test.cs +++ b/test/EFCore.SqlServer.FunctionalTests/Query/ComplexNavigationsQuerySqlServer160Test.cs @@ -233,7 +233,7 @@ public override async Task Multi_level_include_with_short_circuiting(bool async) AssertSql( """ -SELECT [f].[Name], [f].[LabelDefaultText], [f].[PlaceholderDefaultText], [m].[DefaultText], [m0].[DefaultText], [s].[Text], [s].[ComplexNavigationStringDefaultText], [s].[LanguageName], [s].[Name], [s].[CultureString], [s0].[Text], [s0].[ComplexNavigationStringDefaultText], [s0].[LanguageName], [s0].[Name], [s0].[CultureString] +SELECT [f].[Name], [f].[LabelDefaultText], [f].[PlaceholderDefaultText], [m].[DefaultText], [s].[Text], [s].[ComplexNavigationStringDefaultText], [s].[LanguageName], [s].[Name], [s].[CultureString], [m0].[DefaultText], [s0].[Text], [s0].[ComplexNavigationStringDefaultText], [s0].[LanguageName], [s0].[Name], [s0].[CultureString] FROM [Fields] AS [f] LEFT JOIN [MultilingualStrings] AS [m] ON [f].[LabelDefaultText] = [m].[DefaultText] LEFT JOIN [MultilingualStrings] AS [m0] ON [f].[PlaceholderDefaultText] = [m0].[DefaultText] @@ -247,7 +247,7 @@ LEFT JOIN ( FROM [Globalizations] AS [g0] LEFT JOIN [Languages] AS [l0] ON [g0].[LanguageName] = [l0].[Name] ) AS [s0] ON [m0].[DefaultText] = [s0].[ComplexNavigationStringDefaultText] -ORDER BY [f].[Name], [m].[DefaultText], [m0].[DefaultText], [s].[Text], [s].[Name], [s0].[Text] +ORDER BY [f].[Name], [s].[Text] """); } @@ -1349,7 +1349,7 @@ LEFT JOIN ( FROM [LevelTwo] AS [l1] LEFT JOIN [LevelThree] AS [l2] ON [l1].[Id] = [l2].[Level2_Optional_Id] ) AS [s] ON [m].[Id] = [s].[OneToMany_Optional_Inverse2Id] -ORDER BY [m].[Id], [l].[Id], [l0].[Id], [s].[Id] +ORDER BY [m].[Id], [l0].[Id] """); } @@ -2091,10 +2091,9 @@ public override async Task Required_navigation_on_a_subquery_with_complex_projec AssertSql( """ SELECT ( - SELECT TOP(1) [l2].[Name] + SELECT TOP(1) [l1].[Name] FROM [LevelTwo] AS [l0] INNER JOIN [LevelOne] AS [l1] ON [l0].[Level1_Required_Id] = [l1].[Id] - INNER JOIN [LevelOne] AS [l2] ON [l0].[Level1_Required_Id] = [l2].[Id] ORDER BY [l0].[Id]) FROM [LevelTwo] AS [l] WHERE [l].[Id] = 7 @@ -2223,7 +2222,6 @@ FROM [LevelOne] AS [l] LEFT JOIN ( SELECT [l0].[Id], [l0].[Level1_Optional_Id] FROM [LevelTwo] AS [l0] - INNER JOIN [LevelOne] AS [l1] ON [l0].[Level1_Required_Id] = [l1].[Id] ) AS [s] ON [l].[Id] = [s].[Level1_Optional_Id] """); } @@ -2239,7 +2237,6 @@ FROM [LevelOne] AS [l] LEFT JOIN ( SELECT [l0].[Id], [l0].[Level1_Optional_Id] FROM [LevelTwo] AS [l0] - INNER JOIN [LevelOne] AS [l1] ON [l0].[Level1_Required_Id] = [l1].[Id] ) AS [s] ON [l].[Id] = [s].[Level1_Optional_Id] """); } @@ -2255,7 +2252,6 @@ FROM [LevelOne] AS [l] LEFT JOIN ( SELECT [l0].[Id], [l0].[Level1_Required_Id] FROM [LevelTwo] AS [l0] - LEFT JOIN [LevelOne] AS [l1] ON [l0].[Level1_Required_Id] = [l1].[Id] ) AS [s] ON [l].[Id] = [s].[Level1_Required_Id] """); } @@ -2268,14 +2264,13 @@ public override async Task GroupJoin_on_a_subquery_containing_another_GroupJoin_ """ @p='2' -SELECT [l1].[Name] +SELECT [l0].[Name] FROM ( SELECT TOP(@p) [l].[Id] FROM [LevelOne] AS [l] - LEFT JOIN [LevelTwo] AS [l0] ON [l].[Id] = [l0].[Level1_Optional_Id] ORDER BY [l].[Id] ) AS [s] -LEFT JOIN [LevelTwo] AS [l1] ON [s].[Id] = [l1].[Level1_Optional_Id] +LEFT JOIN [LevelTwo] AS [l0] ON [s].[Id] = [l0].[Level1_Optional_Id] ORDER BY [s].[Id] """); } @@ -2375,7 +2370,6 @@ SELECT COUNT(*) FROM ( SELECT DISTINCT [l0].[Id], [l0].[Date], [l0].[Name], [l0].[OneToMany_Optional_Self_Inverse1Id], [l0].[OneToMany_Required_Self_Inverse1Id], [l0].[OneToOne_Optional_Self1Id] FROM [LevelOne] AS [l0] - LEFT JOIN [LevelTwo] AS [l1] ON [l0].[Id] = [l1].[Level1_Optional_Id] ) AS [s]) > 7 AND [l].[Id] < 3 """); } @@ -2390,8 +2384,7 @@ SELECT [l].[Name] FROM [LevelOne] AS [l] WHERE ( SELECT COUNT(*) - FROM [LevelOne] AS [l0] - LEFT JOIN [LevelTwo] AS [l1] ON [l0].[Id] = [l1].[Level1_Optional_Id]) > 7 AND [l].[Id] < 3 + FROM [LevelOne] AS [l0]) > 7 AND [l].[Id] < 3 """); } @@ -2408,11 +2401,9 @@ SELECT COUNT(*) FROM ( SELECT TOP(10) 1 AS empty FROM [LevelOne] AS [l0] - LEFT JOIN [LevelTwo] AS [l1] ON [l0].[Id] = [l1].[Level1_Optional_Id] WHERE ( SELECT COUNT(*) - FROM [LevelOne] AS [l2] - LEFT JOIN [LevelTwo] AS [l3] ON [l2].[Id] = [l3].[Level1_Optional_Id]) > 7 + FROM [LevelOne] AS [l1]) > 7 ORDER BY [l0].[Id] ) AS [s]) > 4 AND [l].[Id] < 2 """); @@ -2429,11 +2420,9 @@ FROM [LevelOne] AS [l] WHERE ( SELECT COUNT(*) FROM [LevelOne] AS [l0] - LEFT JOIN [LevelTwo] AS [l1] ON [l0].[Id] = [l1].[Level1_Optional_Id] WHERE ( SELECT COUNT(*) - FROM [LevelOne] AS [l2] - LEFT JOIN [LevelTwo] AS [l3] ON [l2].[Id] = [l3].[Level1_Optional_Id]) > 7) > 4 AND [l].[Id] < 2 + FROM [LevelOne] AS [l1]) > 7) > 4 AND [l].[Id] < 2 """); } @@ -2445,7 +2434,6 @@ public override async Task GroupJoin_client_method_on_outer(bool async) """ SELECT [l].[Id] FROM [LevelOne] AS [l] -LEFT JOIN [LevelTwo] AS [l0] ON [l].[Id] = [l0].[Level1_Optional_Id] """); } @@ -2602,8 +2590,7 @@ public override async Task Explicit_GroupJoin_in_subquery_with_scalar_result_ope FROM [LevelOne] AS [l] WHERE ( SELECT COUNT(*) - FROM [LevelOne] AS [l0] - LEFT JOIN [LevelTwo] AS [l1] ON [l0].[Id] = [l1].[Level1_Optional_Id]) > 4 + FROM [LevelOne] AS [l0]) > 4 """); } @@ -2621,7 +2608,6 @@ SELECT COUNT(*) FROM ( SELECT DISTINCT [l0].[Id], [l0].[Date], [l0].[Name], [l0].[OneToMany_Optional_Self_Inverse1Id], [l0].[OneToMany_Required_Self_Inverse1Id], [l0].[OneToOne_Optional_Self1Id] FROM [LevelOne] AS [l0] - LEFT JOIN [LevelTwo] AS [l1] ON [l0].[Id] = [l1].[Level1_Optional_Id] ) AS [s]) > 4 """); } @@ -2796,11 +2782,10 @@ public override async Task Navigations_compared_to_each_other5(bool async) SELECT [l].[Name] FROM [LevelTwo] AS [l] LEFT JOIN [LevelThree] AS [l0] ON [l].[Id] = [l0].[Level2_Required_Id] -LEFT JOIN [LevelThree] AS [l1] ON [l].[Id] = [l1].[OneToOne_Optional_PK_Inverse3Id] WHERE EXISTS ( SELECT 1 - FROM [LevelFour] AS [l2] - WHERE [l0].[Id] IS NOT NULL AND [l0].[Id] = [l2].[OneToMany_Optional_Inverse4Id]) + FROM [LevelFour] AS [l1] + WHERE [l0].[Id] IS NOT NULL AND [l0].[Id] = [l1].[OneToMany_Optional_Inverse4Id]) """); } @@ -2995,7 +2980,7 @@ FROM [LevelOne] AS [l0] WHERE [s].[row] <= 1 ) AS [s0] ON [l3].[Name] = [s0].[Name] LEFT JOIN [LevelThree] AS [l2] ON [s0].[Id0] = [l2].[OneToMany_Optional_Inverse3Id] -ORDER BY [l3].[Name], [s0].[Id], [s0].[Id0] +ORDER BY [l3].[Name] """); } @@ -3040,7 +3025,7 @@ FROM [InheritanceOne] AS [i] LEFT JOIN [InheritanceLeafOne] AS [i0] ON [i].[Id] = [i0].[DifferentTypeReference_InheritanceDerived1Id] LEFT JOIN [InheritanceLeafTwo] AS [i1] ON [i].[Id] = [i1].[DifferentTypeReference_InheritanceDerived2Id] LEFT JOIN [InheritanceTwo] AS [i2] ON [i1].[Id] = [i2].[InheritanceLeaf2Id] -ORDER BY [i].[Id], [i0].[Id], [i1].[Id] +ORDER BY [i].[Id] """); } @@ -3111,7 +3096,7 @@ FROM [InheritanceOne] AS [i3] LEFT JOIN [InheritanceLeafOne] AS [i4] ON [i3].[Id] = [i4].[SameTypeReference_InheritanceDerived1Id] LEFT JOIN [InheritanceLeafOne] AS [i5] ON [i3].[Id] = [i5].[SameTypeReference_InheritanceDerived2Id] ) AS [s] ON [i].[Id] = [s].[InheritanceBase2Id1] -ORDER BY [i].[Id], [i0].[Id], [i1].[Id], [i2].[Id], [s].[Id], [s].[Id0] +ORDER BY [i].[Id], [i1].[Id], [i2].[Id] """); } @@ -3557,12 +3542,12 @@ public override async Task Join_with_navigations_in_the_result_selector2(bool as AssertSql( """ -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], [l].[Id], [l0].[Id], [l2].[Id], [l2].[Level2_Optional_Id], [l2].[Level2_Required_Id], [l2].[Name], [l2].[OneToMany_Optional_Inverse3Id], [l2].[OneToMany_Optional_Self_Inverse3Id], [l2].[OneToMany_Required_Inverse3Id], [l2].[OneToMany_Required_Self_Inverse3Id], [l2].[OneToOne_Optional_PK_Inverse3Id], [l2].[OneToOne_Optional_Self3Id] +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], [l].[Id], [l2].[Id], [l2].[Level2_Optional_Id], [l2].[Level2_Required_Id], [l2].[Name], [l2].[OneToMany_Optional_Inverse3Id], [l2].[OneToMany_Optional_Self_Inverse3Id], [l2].[OneToMany_Required_Inverse3Id], [l2].[OneToMany_Required_Self_Inverse3Id], [l2].[OneToOne_Optional_PK_Inverse3Id], [l2].[OneToOne_Optional_Self3Id] FROM [LevelOne] AS [l] INNER JOIN [LevelTwo] AS [l0] ON [l].[Id] = [l0].[Level1_Required_Id] LEFT JOIN [LevelTwo] AS [l1] ON [l].[Id] = [l1].[Level1_Optional_Id] LEFT JOIN [LevelThree] AS [l2] ON [l0].[Id] = [l2].[OneToMany_Optional_Inverse3Id] -ORDER BY [l].[Id], [l0].[Id], [l1].[Id] +ORDER BY [l].[Id] """); } @@ -3731,12 +3716,11 @@ public override async Task Union_over_entities_with_different_nullability(bool a """ SELECT [l].[Id] FROM [LevelOne] AS [l] -LEFT JOIN [LevelTwo] AS [l0] ON [l].[Id] = [l0].[Level1_Optional_Id] UNION ALL -SELECT [l2].[Id] -FROM [LevelTwo] AS [l1] -LEFT JOIN [LevelOne] AS [l2] ON [l1].[Level1_Optional_Id] = [l2].[Id] -WHERE [l2].[Id] IS NULL +SELECT [l1].[Id] +FROM [LevelTwo] AS [l0] +LEFT JOIN [LevelOne] AS [l1] ON [l0].[Level1_Optional_Id] = [l1].[Id] +WHERE [l1].[Id] IS NULL """); } @@ -3758,7 +3742,7 @@ FROM [LevelTwo] AS [l2] ) AS [l3] WHERE [l3].[row] <= 1 ) AS [l4] ON [l].[Id] = [l4].[OneToMany_Required_Inverse2Id] -ORDER BY [l].[Id], [l0].[Id] +ORDER BY [l].[Id] """); } @@ -4186,7 +4170,7 @@ FROM [LevelOne] AS [l] LEFT JOIN ( SELECT [s].[Id], [s].[Level2_Optional_Id], [s].[Level2_Required_Id], [s].[Name], [s].[OneToMany_Optional_Inverse3Id], [s].[OneToMany_Optional_Self_Inverse3Id], [s].[OneToMany_Required_Inverse3Id], [s].[OneToMany_Required_Self_Inverse3Id], [s].[OneToOne_Optional_PK_Inverse3Id], [s].[OneToOne_Optional_Self3Id], [s].[OneToMany_Optional_Inverse2Id] 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], [l0].[OneToMany_Optional_Inverse2Id], ROW_NUMBER() OVER(PARTITION BY [l0].[OneToMany_Optional_Inverse2Id] ORDER BY [l0].[Id], [l1].[Id]) AS [row] + 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], [l0].[OneToMany_Optional_Inverse2Id], ROW_NUMBER() OVER(PARTITION BY [l0].[OneToMany_Optional_Inverse2Id] ORDER BY [l0].[Id]) AS [row] FROM [LevelTwo] AS [l0] LEFT JOIN [LevelThree] AS [l1] ON [l0].[Id] = [l1].[Level2_Optional_Id] WHERE [l0].[Name] = N'L2 02' @@ -4203,7 +4187,7 @@ public override async Task Collection_FirstOrDefault_entity_collection_accesses_ AssertSql( """ -SELECT [l].[Id], [l3].[Id], [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], [l3].[c] +SELECT [l].[Id], [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], [l3].[c] FROM [LevelOne] AS [l] LEFT JOIN ( SELECT [l2].[c], [l2].[Id], [l2].[OneToMany_Optional_Inverse2Id] @@ -4216,7 +4200,7 @@ FROM [LevelTwo] AS [l0] ) AS [l3] ON [l].[Id] = [l3].[OneToMany_Optional_Inverse2Id] LEFT JOIN [LevelThree] AS [l1] ON [l3].[Id] = [l1].[OneToMany_Optional_Inverse3Id] WHERE [l].[Id] < 2 -ORDER BY [l].[Id], [l3].[Id] +ORDER BY [l].[Id] """); } @@ -4782,7 +4766,7 @@ FROM [LevelThree] AS [l] INNER JOIN [LevelOne] AS [l1] ON [l0].[OneToMany_Required_Inverse2Id] = [l1].[Id] LEFT JOIN [LevelFour] AS [l2] ON [l].[Id] = [l2].[OneToMany_Optional_Inverse4Id] WHERE [l1].[Name] = N'L1 01' -ORDER BY [l].[Id], [l0].[Id], [l1].[Id] +ORDER BY [l].[Id] """); } @@ -4812,7 +4796,7 @@ FROM [LevelTwo] AS [l2] WHERE [l].[Id] = [l2].[OneToMany_Optional_Inverse2Id] ORDER BY [l2].[Id]) IS NULL AND [l0].[OneToMany_Optional_Inverse3Id] IS NULL)) ) AS [s] -ORDER BY [l].[Id], [s].[Id0] +ORDER BY [l].[Id] """); } @@ -4842,7 +4826,7 @@ FROM [LevelTwo] AS [l0] LEFT JOIN [LevelThree] AS [l1] ON [l0].[Id] = [l1].[Level2_Required_Id] LEFT JOIN [LevelFour] AS [l2] ON [l1].[Id] = [l2].[Level3_Required_Id] ) AS [s] ON [l4].[Id] = [s].[OneToMany_Optional_Inverse2Id] -ORDER BY [l4].[Id], [s].[Id], [s].[Id0] +ORDER BY [l4].[Id] """); } @@ -4869,7 +4853,7 @@ ORDER BY [l1].[Id] ) AS [s] LEFT JOIN [LevelFour] AS [l2] ON [s].[Id0] = [l2].[Level3_Optional_Id] ) AS [s0] -ORDER BY [l].[Id], [s0].[Id], [s0].[Id0] +ORDER BY [l].[Id], [s0].[Id] """); } @@ -4892,7 +4876,7 @@ ORDER BY [l1].[Id] ) AS [s] LEFT JOIN [LevelFour] AS [l2] ON [s].[Id0] = [l2].[Level3_Optional_Id] ) AS [s0] -ORDER BY [l].[Id], [s0].[Id], [s0].[Id0] +ORDER BY [l].[Id], [s0].[Id] """); } diff --git a/test/EFCore.SqlServer.FunctionalTests/Query/ComplexNavigationsQuerySqlServerTest.cs b/test/EFCore.SqlServer.FunctionalTests/Query/ComplexNavigationsQuerySqlServerTest.cs index 7429e1f9e2f..7fe54b7bc67 100644 --- a/test/EFCore.SqlServer.FunctionalTests/Query/ComplexNavigationsQuerySqlServerTest.cs +++ b/test/EFCore.SqlServer.FunctionalTests/Query/ComplexNavigationsQuerySqlServerTest.cs @@ -233,7 +233,7 @@ public override async Task Multi_level_include_with_short_circuiting(bool async) AssertSql( """ -SELECT [f].[Name], [f].[LabelDefaultText], [f].[PlaceholderDefaultText], [m].[DefaultText], [m0].[DefaultText], [s].[Text], [s].[ComplexNavigationStringDefaultText], [s].[LanguageName], [s].[Name], [s].[CultureString], [s0].[Text], [s0].[ComplexNavigationStringDefaultText], [s0].[LanguageName], [s0].[Name], [s0].[CultureString] +SELECT [f].[Name], [f].[LabelDefaultText], [f].[PlaceholderDefaultText], [m].[DefaultText], [s].[Text], [s].[ComplexNavigationStringDefaultText], [s].[LanguageName], [s].[Name], [s].[CultureString], [m0].[DefaultText], [s0].[Text], [s0].[ComplexNavigationStringDefaultText], [s0].[LanguageName], [s0].[Name], [s0].[CultureString] FROM [Fields] AS [f] LEFT JOIN [MultilingualStrings] AS [m] ON [f].[LabelDefaultText] = [m].[DefaultText] LEFT JOIN [MultilingualStrings] AS [m0] ON [f].[PlaceholderDefaultText] = [m0].[DefaultText] @@ -247,7 +247,7 @@ LEFT JOIN ( FROM [Globalizations] AS [g0] LEFT JOIN [Languages] AS [l0] ON [g0].[LanguageName] = [l0].[Name] ) AS [s0] ON [m0].[DefaultText] = [s0].[ComplexNavigationStringDefaultText] -ORDER BY [f].[Name], [m].[DefaultText], [m0].[DefaultText], [s].[Text], [s].[Name], [s0].[Text] +ORDER BY [f].[Name], [s].[Text] """); } @@ -1349,7 +1349,7 @@ LEFT JOIN ( FROM [LevelTwo] AS [l1] LEFT JOIN [LevelThree] AS [l2] ON [l1].[Id] = [l2].[Level2_Optional_Id] ) AS [s] ON [m].[Id] = [s].[OneToMany_Optional_Inverse2Id] -ORDER BY [m].[Id], [l].[Id], [l0].[Id], [s].[Id] +ORDER BY [m].[Id], [l0].[Id] """); } @@ -2091,10 +2091,9 @@ public override async Task Required_navigation_on_a_subquery_with_complex_projec AssertSql( """ SELECT ( - SELECT TOP(1) [l2].[Name] + SELECT TOP(1) [l1].[Name] FROM [LevelTwo] AS [l0] INNER JOIN [LevelOne] AS [l1] ON [l0].[Level1_Required_Id] = [l1].[Id] - INNER JOIN [LevelOne] AS [l2] ON [l0].[Level1_Required_Id] = [l2].[Id] ORDER BY [l0].[Id]) FROM [LevelTwo] AS [l] WHERE [l].[Id] = 7 @@ -2223,7 +2222,6 @@ FROM [LevelOne] AS [l] LEFT JOIN ( SELECT [l0].[Id], [l0].[Level1_Optional_Id] FROM [LevelTwo] AS [l0] - INNER JOIN [LevelOne] AS [l1] ON [l0].[Level1_Required_Id] = [l1].[Id] ) AS [s] ON [l].[Id] = [s].[Level1_Optional_Id] """); } @@ -2239,7 +2237,6 @@ FROM [LevelOne] AS [l] LEFT JOIN ( SELECT [l0].[Id], [l0].[Level1_Optional_Id] FROM [LevelTwo] AS [l0] - INNER JOIN [LevelOne] AS [l1] ON [l0].[Level1_Required_Id] = [l1].[Id] ) AS [s] ON [l].[Id] = [s].[Level1_Optional_Id] """); } @@ -2255,7 +2252,6 @@ FROM [LevelOne] AS [l] LEFT JOIN ( SELECT [l0].[Id], [l0].[Level1_Required_Id] FROM [LevelTwo] AS [l0] - LEFT JOIN [LevelOne] AS [l1] ON [l0].[Level1_Required_Id] = [l1].[Id] ) AS [s] ON [l].[Id] = [s].[Level1_Required_Id] """); } @@ -2268,14 +2264,13 @@ public override async Task GroupJoin_on_a_subquery_containing_another_GroupJoin_ """ @p='2' -SELECT [l1].[Name] +SELECT [l0].[Name] FROM ( SELECT TOP(@p) [l].[Id] FROM [LevelOne] AS [l] - LEFT JOIN [LevelTwo] AS [l0] ON [l].[Id] = [l0].[Level1_Optional_Id] ORDER BY [l].[Id] ) AS [s] -LEFT JOIN [LevelTwo] AS [l1] ON [s].[Id] = [l1].[Level1_Optional_Id] +LEFT JOIN [LevelTwo] AS [l0] ON [s].[Id] = [l0].[Level1_Optional_Id] ORDER BY [s].[Id] """); } @@ -2375,7 +2370,6 @@ SELECT COUNT(*) FROM ( SELECT DISTINCT [l0].[Id], [l0].[Date], [l0].[Name], [l0].[OneToMany_Optional_Self_Inverse1Id], [l0].[OneToMany_Required_Self_Inverse1Id], [l0].[OneToOne_Optional_Self1Id] FROM [LevelOne] AS [l0] - LEFT JOIN [LevelTwo] AS [l1] ON [l0].[Id] = [l1].[Level1_Optional_Id] ) AS [s]) > 7 AND [l].[Id] < 3 """); } @@ -2390,8 +2384,7 @@ SELECT [l].[Name] FROM [LevelOne] AS [l] WHERE ( SELECT COUNT(*) - FROM [LevelOne] AS [l0] - LEFT JOIN [LevelTwo] AS [l1] ON [l0].[Id] = [l1].[Level1_Optional_Id]) > 7 AND [l].[Id] < 3 + FROM [LevelOne] AS [l0]) > 7 AND [l].[Id] < 3 """); } @@ -2408,11 +2401,9 @@ SELECT COUNT(*) FROM ( SELECT TOP(10) 1 AS empty FROM [LevelOne] AS [l0] - LEFT JOIN [LevelTwo] AS [l1] ON [l0].[Id] = [l1].[Level1_Optional_Id] WHERE ( SELECT COUNT(*) - FROM [LevelOne] AS [l2] - LEFT JOIN [LevelTwo] AS [l3] ON [l2].[Id] = [l3].[Level1_Optional_Id]) > 7 + FROM [LevelOne] AS [l1]) > 7 ORDER BY [l0].[Id] ) AS [s]) > 4 AND [l].[Id] < 2 """); @@ -2429,11 +2420,9 @@ FROM [LevelOne] AS [l] WHERE ( SELECT COUNT(*) FROM [LevelOne] AS [l0] - LEFT JOIN [LevelTwo] AS [l1] ON [l0].[Id] = [l1].[Level1_Optional_Id] WHERE ( SELECT COUNT(*) - FROM [LevelOne] AS [l2] - LEFT JOIN [LevelTwo] AS [l3] ON [l2].[Id] = [l3].[Level1_Optional_Id]) > 7) > 4 AND [l].[Id] < 2 + FROM [LevelOne] AS [l1]) > 7) > 4 AND [l].[Id] < 2 """); } @@ -2445,7 +2434,6 @@ public override async Task GroupJoin_client_method_on_outer(bool async) """ SELECT [l].[Id] FROM [LevelOne] AS [l] -LEFT JOIN [LevelTwo] AS [l0] ON [l].[Id] = [l0].[Level1_Optional_Id] """); } @@ -2602,8 +2590,7 @@ public override async Task Explicit_GroupJoin_in_subquery_with_scalar_result_ope FROM [LevelOne] AS [l] WHERE ( SELECT COUNT(*) - FROM [LevelOne] AS [l0] - LEFT JOIN [LevelTwo] AS [l1] ON [l0].[Id] = [l1].[Level1_Optional_Id]) > 4 + FROM [LevelOne] AS [l0]) > 4 """); } @@ -2621,7 +2608,6 @@ SELECT COUNT(*) FROM ( SELECT DISTINCT [l0].[Id], [l0].[Date], [l0].[Name], [l0].[OneToMany_Optional_Self_Inverse1Id], [l0].[OneToMany_Required_Self_Inverse1Id], [l0].[OneToOne_Optional_Self1Id] FROM [LevelOne] AS [l0] - LEFT JOIN [LevelTwo] AS [l1] ON [l0].[Id] = [l1].[Level1_Optional_Id] ) AS [s]) > 4 """); } @@ -2796,11 +2782,10 @@ public override async Task Navigations_compared_to_each_other5(bool async) SELECT [l].[Name] FROM [LevelTwo] AS [l] LEFT JOIN [LevelThree] AS [l0] ON [l].[Id] = [l0].[Level2_Required_Id] -LEFT JOIN [LevelThree] AS [l1] ON [l].[Id] = [l1].[OneToOne_Optional_PK_Inverse3Id] WHERE EXISTS ( SELECT 1 - FROM [LevelFour] AS [l2] - WHERE [l0].[Id] IS NOT NULL AND [l0].[Id] = [l2].[OneToMany_Optional_Inverse4Id]) + FROM [LevelFour] AS [l1] + WHERE [l0].[Id] IS NOT NULL AND [l0].[Id] = [l1].[OneToMany_Optional_Inverse4Id]) """); } @@ -2995,7 +2980,7 @@ FROM [LevelOne] AS [l0] WHERE [s].[row] <= 1 ) AS [s0] ON [l3].[Name] = [s0].[Name] LEFT JOIN [LevelThree] AS [l2] ON [s0].[Id0] = [l2].[OneToMany_Optional_Inverse3Id] -ORDER BY [l3].[Name], [s0].[Id], [s0].[Id0] +ORDER BY [l3].[Name] """); } @@ -3040,7 +3025,7 @@ FROM [InheritanceOne] AS [i] LEFT JOIN [InheritanceLeafOne] AS [i0] ON [i].[Id] = [i0].[DifferentTypeReference_InheritanceDerived1Id] LEFT JOIN [InheritanceLeafTwo] AS [i1] ON [i].[Id] = [i1].[DifferentTypeReference_InheritanceDerived2Id] LEFT JOIN [InheritanceTwo] AS [i2] ON [i1].[Id] = [i2].[InheritanceLeaf2Id] -ORDER BY [i].[Id], [i0].[Id], [i1].[Id] +ORDER BY [i].[Id] """); } @@ -3111,7 +3096,7 @@ FROM [InheritanceOne] AS [i3] LEFT JOIN [InheritanceLeafOne] AS [i4] ON [i3].[Id] = [i4].[SameTypeReference_InheritanceDerived1Id] LEFT JOIN [InheritanceLeafOne] AS [i5] ON [i3].[Id] = [i5].[SameTypeReference_InheritanceDerived2Id] ) AS [s] ON [i].[Id] = [s].[InheritanceBase2Id1] -ORDER BY [i].[Id], [i0].[Id], [i1].[Id], [i2].[Id], [s].[Id], [s].[Id0] +ORDER BY [i].[Id], [i1].[Id], [i2].[Id] """); } @@ -3557,12 +3542,12 @@ public override async Task Join_with_navigations_in_the_result_selector2(bool as AssertSql( """ -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], [l].[Id], [l0].[Id], [l2].[Id], [l2].[Level2_Optional_Id], [l2].[Level2_Required_Id], [l2].[Name], [l2].[OneToMany_Optional_Inverse3Id], [l2].[OneToMany_Optional_Self_Inverse3Id], [l2].[OneToMany_Required_Inverse3Id], [l2].[OneToMany_Required_Self_Inverse3Id], [l2].[OneToOne_Optional_PK_Inverse3Id], [l2].[OneToOne_Optional_Self3Id] +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], [l].[Id], [l2].[Id], [l2].[Level2_Optional_Id], [l2].[Level2_Required_Id], [l2].[Name], [l2].[OneToMany_Optional_Inverse3Id], [l2].[OneToMany_Optional_Self_Inverse3Id], [l2].[OneToMany_Required_Inverse3Id], [l2].[OneToMany_Required_Self_Inverse3Id], [l2].[OneToOne_Optional_PK_Inverse3Id], [l2].[OneToOne_Optional_Self3Id] FROM [LevelOne] AS [l] INNER JOIN [LevelTwo] AS [l0] ON [l].[Id] = [l0].[Level1_Required_Id] LEFT JOIN [LevelTwo] AS [l1] ON [l].[Id] = [l1].[Level1_Optional_Id] LEFT JOIN [LevelThree] AS [l2] ON [l0].[Id] = [l2].[OneToMany_Optional_Inverse3Id] -ORDER BY [l].[Id], [l0].[Id], [l1].[Id] +ORDER BY [l].[Id] """); } @@ -3731,12 +3716,11 @@ public override async Task Union_over_entities_with_different_nullability(bool a """ SELECT [l].[Id] FROM [LevelOne] AS [l] -LEFT JOIN [LevelTwo] AS [l0] ON [l].[Id] = [l0].[Level1_Optional_Id] UNION ALL -SELECT [l2].[Id] -FROM [LevelTwo] AS [l1] -LEFT JOIN [LevelOne] AS [l2] ON [l1].[Level1_Optional_Id] = [l2].[Id] -WHERE [l2].[Id] IS NULL +SELECT [l1].[Id] +FROM [LevelTwo] AS [l0] +LEFT JOIN [LevelOne] AS [l1] ON [l0].[Level1_Optional_Id] = [l1].[Id] +WHERE [l1].[Id] IS NULL """); } @@ -3758,7 +3742,7 @@ FROM [LevelTwo] AS [l2] ) AS [l3] WHERE [l3].[row] <= 1 ) AS [l4] ON [l].[Id] = [l4].[OneToMany_Required_Inverse2Id] -ORDER BY [l].[Id], [l0].[Id] +ORDER BY [l].[Id] """); } @@ -4186,7 +4170,7 @@ FROM [LevelOne] AS [l] LEFT JOIN ( SELECT [s].[Id], [s].[Level2_Optional_Id], [s].[Level2_Required_Id], [s].[Name], [s].[OneToMany_Optional_Inverse3Id], [s].[OneToMany_Optional_Self_Inverse3Id], [s].[OneToMany_Required_Inverse3Id], [s].[OneToMany_Required_Self_Inverse3Id], [s].[OneToOne_Optional_PK_Inverse3Id], [s].[OneToOne_Optional_Self3Id], [s].[OneToMany_Optional_Inverse2Id] 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], [l0].[OneToMany_Optional_Inverse2Id], ROW_NUMBER() OVER(PARTITION BY [l0].[OneToMany_Optional_Inverse2Id] ORDER BY [l0].[Id], [l1].[Id]) AS [row] + 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], [l0].[OneToMany_Optional_Inverse2Id], ROW_NUMBER() OVER(PARTITION BY [l0].[OneToMany_Optional_Inverse2Id] ORDER BY [l0].[Id]) AS [row] FROM [LevelTwo] AS [l0] LEFT JOIN [LevelThree] AS [l1] ON [l0].[Id] = [l1].[Level2_Optional_Id] WHERE [l0].[Name] = N'L2 02' @@ -4203,7 +4187,7 @@ public override async Task Collection_FirstOrDefault_entity_collection_accesses_ AssertSql( """ -SELECT [l].[Id], [l3].[Id], [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], [l3].[c] +SELECT [l].[Id], [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], [l3].[c] FROM [LevelOne] AS [l] LEFT JOIN ( SELECT [l2].[c], [l2].[Id], [l2].[OneToMany_Optional_Inverse2Id] @@ -4216,7 +4200,7 @@ FROM [LevelTwo] AS [l0] ) AS [l3] ON [l].[Id] = [l3].[OneToMany_Optional_Inverse2Id] LEFT JOIN [LevelThree] AS [l1] ON [l3].[Id] = [l1].[OneToMany_Optional_Inverse3Id] WHERE [l].[Id] < 2 -ORDER BY [l].[Id], [l3].[Id] +ORDER BY [l].[Id] """); } @@ -4782,7 +4766,7 @@ FROM [LevelThree] AS [l] INNER JOIN [LevelOne] AS [l1] ON [l0].[OneToMany_Required_Inverse2Id] = [l1].[Id] LEFT JOIN [LevelFour] AS [l2] ON [l].[Id] = [l2].[OneToMany_Optional_Inverse4Id] WHERE [l1].[Name] = N'L1 01' -ORDER BY [l].[Id], [l0].[Id], [l1].[Id] +ORDER BY [l].[Id] """); } @@ -4812,7 +4796,7 @@ FROM [LevelTwo] AS [l2] WHERE [l].[Id] = [l2].[OneToMany_Optional_Inverse2Id] ORDER BY [l2].[Id]) IS NULL AND [l0].[OneToMany_Optional_Inverse3Id] IS NULL)) ) AS [s] -ORDER BY [l].[Id], [s].[Id0] +ORDER BY [l].[Id] """); } @@ -4842,7 +4826,7 @@ FROM [LevelTwo] AS [l0] LEFT JOIN [LevelThree] AS [l1] ON [l0].[Id] = [l1].[Level2_Required_Id] LEFT JOIN [LevelFour] AS [l2] ON [l1].[Id] = [l2].[Level3_Required_Id] ) AS [s] ON [l4].[Id] = [s].[OneToMany_Optional_Inverse2Id] -ORDER BY [l4].[Id], [s].[Id], [s].[Id0] +ORDER BY [l4].[Id] """); } @@ -4869,7 +4853,7 @@ ORDER BY [l1].[Id] ) AS [s] LEFT JOIN [LevelFour] AS [l2] ON [s].[Id0] = [l2].[Level3_Optional_Id] ) AS [s0] -ORDER BY [l].[Id], [s0].[Id], [s0].[Id0] +ORDER BY [l].[Id], [s0].[Id] """); } @@ -4892,7 +4876,7 @@ ORDER BY [l1].[Id] ) AS [s] LEFT JOIN [LevelFour] AS [l2] ON [s].[Id0] = [l2].[Level3_Optional_Id] ) AS [s0] -ORDER BY [l].[Id], [s0].[Id], [s0].[Id0] +ORDER BY [l].[Id], [s0].[Id] """); } diff --git a/test/EFCore.SqlServer.FunctionalTests/Query/ComplexNavigationsSharedTypeQuerySqlServer160Test.cs b/test/EFCore.SqlServer.FunctionalTests/Query/ComplexNavigationsSharedTypeQuerySqlServer160Test.cs index 15a49e03b72..53a9fb99e5b 100644 --- a/test/EFCore.SqlServer.FunctionalTests/Query/ComplexNavigationsSharedTypeQuerySqlServer160Test.cs +++ b/test/EFCore.SqlServer.FunctionalTests/Query/ComplexNavigationsSharedTypeQuerySqlServer160Test.cs @@ -605,10 +605,10 @@ public override async Task Let_let_contains_from_outer_let(bool async) AssertSql( """ -SELECT [l].[Id], [l].[Date], [l].[Name], [s].[Id0], [s].[Id1], [s].[Id], [l7].[Id], [l7].[OneToOne_Required_PK_Date], [l7].[Level1_Optional_Id], [l7].[Level1_Required_Id], [l7].[Level2_Name], [l7].[OneToMany_Optional_Inverse2Id], [l7].[OneToMany_Required_Inverse2Id], [l7].[OneToOne_Optional_PK_Inverse2Id], [s].[Level2_Optional_Id], [s].[Level2_Required_Id], [s].[Level3_Name], [s].[OneToMany_Optional_Inverse3Id], [s].[OneToMany_Required_Inverse3Id], [s].[OneToOne_Optional_PK_Inverse3Id] +SELECT [l].[Id], [l].[Date], [l].[Name], [s].[Id0], [l7].[Id], [l7].[OneToOne_Required_PK_Date], [l7].[Level1_Optional_Id], [l7].[Level1_Required_Id], [l7].[Level2_Name], [l7].[OneToMany_Optional_Inverse2Id], [l7].[OneToMany_Required_Inverse2Id], [l7].[OneToOne_Optional_PK_Inverse2Id], [s].[Id], [s].[Level2_Optional_Id], [s].[Level2_Required_Id], [s].[Level3_Name], [s].[OneToMany_Optional_Inverse3Id], [s].[OneToMany_Required_Inverse3Id], [s].[OneToOne_Optional_PK_Inverse3Id] FROM [Level1] AS [l] OUTER APPLY ( - 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], [l0].[Id] AS [Id0], [l2].[Id] AS [Id1] + 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], [l0].[Id] AS [Id0] FROM [Level1] AS [l0] LEFT JOIN ( SELECT [l1].[Id], [l1].[OneToOne_Required_PK_Date], [l1].[Level1_Required_Id], [l1].[OneToMany_Required_Inverse2Id] @@ -639,7 +639,7 @@ LEFT JOIN ( 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 ) AS [l7] ON [l].[Id] = [l7].[OneToMany_Required_Inverse2Id] -ORDER BY [l].[Id], [s].[Id0], [s].[Id1], [s].[Id] +ORDER BY [l].[Id], [s].[Id0] """); } @@ -1131,7 +1131,7 @@ WHERE [l3].[OneToOne_Required_PK_Date] IS NOT NULL AND [l3].[Level1_Required_Id] ) AS [l5] WHERE [l5].[row] <= 1 ) AS [l6] ON [l].[Id] = [l6].[OneToMany_Required_Inverse2Id] -ORDER BY [l].[Id], [l1].[Id] +ORDER BY [l].[Id] """); } @@ -1719,7 +1719,7 @@ public override async Task Collection_FirstOrDefault_entity_collection_accesses_ AssertSql( """ -SELECT [l].[Id], [l3].[Id], [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], [l3].[c] +SELECT [l].[Id], [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], [l3].[c] FROM [Level1] AS [l] LEFT JOIN ( SELECT [l2].[c], [l2].[Id], [l2].[OneToOne_Required_PK_Date], [l2].[Level1_Required_Id], [l2].[OneToMany_Required_Inverse2Id], [l2].[OneToMany_Optional_Inverse2Id] @@ -1738,7 +1738,7 @@ WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse WHEN [l3].[OneToOne_Required_PK_Date] IS NOT NULL AND [l3].[Level1_Required_Id] IS NOT NULL AND [l3].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [l3].[Id] END = [l4].[OneToMany_Optional_Inverse3Id] WHERE [l].[Id] < 2 -ORDER BY [l].[Id], [l3].[Id] +ORDER BY [l].[Id] """); } @@ -1753,7 +1753,7 @@ FROM [Level1] AS [l] LEFT JOIN ( SELECT [s].[Id], [s].[Level2_Optional_Id], [s].[Level2_Required_Id], [s].[Level3_Name], [s].[OneToMany_Optional_Inverse3Id], [s].[OneToMany_Required_Inverse3Id], [s].[OneToOne_Optional_PK_Inverse3Id], [s].[OneToMany_Optional_Inverse2Id] 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], [l0].[OneToMany_Optional_Inverse2Id], ROW_NUMBER() OVER(PARTITION BY [l0].[OneToMany_Optional_Inverse2Id] ORDER BY [l0].[Id], [l2].[Id]) AS [row] + 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], [l0].[OneToMany_Optional_Inverse2Id], ROW_NUMBER() OVER(PARTITION BY [l0].[OneToMany_Optional_Inverse2Id] ORDER BY [l0].[Id]) AS [row] 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] @@ -2575,7 +2575,6 @@ WHERE [l1].[OneToOne_Required_PK_Date] IS NOT NULL AND [l1].[Level1_Required_Id] ) AS [l2] ON [l0].[Id] = 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 - LEFT JOIN [Level1] AS [l3] ON [l2].[Level1_Required_Id] = [l3].[Id] WHERE [l2].[OneToOne_Required_PK_Date] IS NOT NULL AND [l2].[Level1_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [s] ON [l].[Id] = [s].[Level1_Required_Id] """); @@ -4330,7 +4329,7 @@ FROM [InheritanceOne] AS [i] LEFT JOIN [InheritanceLeafOne] AS [i0] ON [i].[Id] = [i0].[DifferentTypeReference_InheritanceDerived1Id] LEFT JOIN [InheritanceLeafTwo] AS [i1] ON [i].[Id] = [i1].[DifferentTypeReference_InheritanceDerived2Id] LEFT JOIN [InheritanceTwo] AS [i2] ON [i1].[Id] = [i2].[InheritanceLeaf2Id] -ORDER BY [i].[Id], [i0].[Id], [i1].[Id] +ORDER BY [i].[Id] """); } @@ -5647,7 +5646,7 @@ WHERE [l3].[Level2_Required_Id] IS NOT NULL AND [l3].[OneToMany_Required_Inverse ) AS [l5] ON CASE WHEN [s0].[OneToOne_Required_PK_Date] IS NOT NULL AND [s0].[Level1_Required_Id] IS NOT NULL AND [s0].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [s0].[Id0] END = [l5].[OneToMany_Optional_Inverse3Id] -ORDER BY [l4].[Name], [s0].[Id], [s0].[Id0] +ORDER BY [l4].[Name] """); } @@ -5827,23 +5826,16 @@ WHERE [l2].[Level2_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse ) AS [l3] ON 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 = [l3].[Level2_Required_Id] -LEFT JOIN ( - SELECT [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 -) AS [l5] ON 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 = [l5].[OneToOne_Optional_PK_Inverse3Id] WHERE [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 EXISTS ( SELECT 1 - FROM [Level1] AS [l6] - WHERE [l6].[Level3_Required_Id] IS NOT NULL AND [l6].[OneToMany_Required_Inverse4Id] IS NOT NULL AND CASE + FROM [Level1] AS [l4] + WHERE [l4].[Level3_Required_Id] IS NOT NULL AND [l4].[OneToMany_Required_Inverse4Id] IS NOT NULL AND CASE WHEN [l3].[Level2_Required_Id] IS NOT NULL AND [l3].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [l3].[Id] END IS NOT NULL AND (CASE WHEN [l3].[Level2_Required_Id] IS NOT NULL AND [l3].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [l3].[Id] - END = [l6].[OneToMany_Optional_Inverse4Id] OR (CASE + END = [l4].[OneToMany_Optional_Inverse4Id] OR (CASE WHEN [l3].[Level2_Required_Id] IS NOT NULL AND [l3].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [l3].[Id] - END IS NULL AND [l6].[OneToMany_Optional_Inverse4Id] IS NULL))) + END IS NULL AND [l4].[OneToMany_Optional_Inverse4Id] IS NULL))) """); } @@ -7585,7 +7577,7 @@ public override async Task Multi_level_include_with_short_circuiting(bool async) AssertSql( """ -SELECT [f].[Name], [f].[LabelDefaultText], [f].[PlaceholderDefaultText], [m].[DefaultText], [m0].[DefaultText], [s].[Text], [s].[ComplexNavigationStringDefaultText], [s].[LanguageName], [s].[Name], [s].[CultureString], [s0].[Text], [s0].[ComplexNavigationStringDefaultText], [s0].[LanguageName], [s0].[Name], [s0].[CultureString] +SELECT [f].[Name], [f].[LabelDefaultText], [f].[PlaceholderDefaultText], [m].[DefaultText], [s].[Text], [s].[ComplexNavigationStringDefaultText], [s].[LanguageName], [s].[Name], [s].[CultureString], [m0].[DefaultText], [s0].[Text], [s0].[ComplexNavigationStringDefaultText], [s0].[LanguageName], [s0].[Name], [s0].[CultureString] FROM [Fields] AS [f] LEFT JOIN [MultilingualStrings] AS [m] ON [f].[LabelDefaultText] = [m].[DefaultText] LEFT JOIN [MultilingualStrings] AS [m0] ON [f].[PlaceholderDefaultText] = [m0].[DefaultText] @@ -7599,7 +7591,7 @@ LEFT JOIN ( FROM [Globalizations] AS [g0] LEFT JOIN [Languages] AS [l0] ON [g0].[LanguageName] = [l0].[Name] ) AS [s0] ON [m0].[DefaultText] = [s0].[ComplexNavigationStringDefaultText] -ORDER BY [f].[Name], [m].[DefaultText], [m0].[DefaultText], [s].[Text], [s].[Name], [s0].[Text] +ORDER BY [f].[Name], [s].[Text] """); } @@ -7939,7 +7931,7 @@ FROM [InheritanceOne] AS [i3] LEFT JOIN [InheritanceLeafOne] AS [i4] ON [i3].[Id] = [i4].[SameTypeReference_InheritanceDerived1Id] LEFT JOIN [InheritanceLeafOne] AS [i5] ON [i3].[Id] = [i5].[SameTypeReference_InheritanceDerived2Id] ) AS [s] ON [i].[Id] = [s].[InheritanceBase2Id1] -ORDER BY [i].[Id], [i0].[Id], [i1].[Id], [i2].[Id], [s].[Id], [s].[Id0] +ORDER BY [i].[Id], [i1].[Id], [i2].[Id] """); } @@ -8319,12 +8311,12 @@ public override async Task Correlated_projection_with_first(bool async) AssertSql( """ -SELECT [l].[Id], [s].[c], [s].[Id], [s].[Id0] +SELECT [l].[Id], [s].[c], [s].[Id] FROM [Level1] AS [l] OUTER APPLY ( SELECT CASE WHEN [l4].[Level3_Required_Id] IS NOT NULL AND [l4].[OneToMany_Required_Inverse4Id] IS NOT NULL THEN [l4].[Id] - END AS [c], [l0].[Id], [l4].[Id] AS [Id0] + END AS [c], [l0].[Id] FROM [Level1] AS [l0] LEFT JOIN ( SELECT [l3].[Id], [l3].[Level3_Required_Id], [l3].[OneToMany_Required_Inverse4Id] @@ -8359,7 +8351,7 @@ 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)) ) AS [s] -ORDER BY [l].[Id], [s].[Id] +ORDER BY [l].[Id] """); } @@ -8371,7 +8363,7 @@ public override async Task Max_in_multi_level_nested_subquery(bool async) """ @p='2' -SELECT [l6].[Id], [s].[Id], [s].[Id0], [s].[Id1], [s].[Result], [s].[Id2], [s].[Id3], [s].[Id4] +SELECT [l6].[Id], [s].[Id], [s].[Id0], [s].[Id1], [s].[Result], [s].[Id2] FROM ( SELECT TOP(@p) [l].[Id] FROM [Level1] AS [l] @@ -8398,7 +8390,7 @@ WHEN [l2].[Level2_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse3 WHEN [l2].[Level2_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [l2].[Id] END IS NULL AND [l5].[OneToMany_Optional_Inverse4Id] IS NULL))), 0) > 1 THEN CAST(1 AS bit) ELSE CAST(0 AS bit) - END AS [Result], [l0].[Id] AS [Id2], [l2].[Id] AS [Id3], [l4].[Id] AS [Id4], [l0].[OneToMany_Optional_Inverse2Id] + END AS [Result], [l0].[Id] AS [Id2], [l0].[OneToMany_Optional_Inverse2Id] FROM [Level1] AS [l0] LEFT JOIN ( SELECT [l1].[Id], [l1].[Level2_Required_Id], [l1].[OneToMany_Required_Inverse3Id] @@ -8416,7 +8408,7 @@ WHEN [l2].[Level2_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse3 END = [l4].[Level3_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 ) AS [s] ON [l6].[Id] = [s].[OneToMany_Optional_Inverse2Id] -ORDER BY [l6].[Id], [s].[Id2], [s].[Id3] +ORDER BY [l6].[Id] """); } @@ -8426,7 +8418,7 @@ public override async Task Multiple_select_many_in_projection(bool async) AssertSql( """ -SELECT [l].[Id], [s0].[Id], [s0].[RefId], [s0].[Id0], [s0].[Id00], [s0].[Id1], ( +SELECT [l].[Id], [s0].[Id], [s0].[RefId], [s0].[Id0], [s0].[Id00], ( SELECT COUNT(*) FROM [Level1] AS [l5] INNER JOIN ( @@ -8443,7 +8435,7 @@ SELECT CASE WHEN [s].[Level2_Required_Id] IS NOT NULL AND [s].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [s].[Id0] END AS [Id], CASE WHEN [l4].[Level3_Required_Id] IS NOT NULL AND [l4].[OneToMany_Required_Inverse4Id] IS NOT NULL THEN [l4].[Id] - END AS [RefId], [s].[Id] AS [Id0], [s].[Id0] AS [Id00], [l4].[Id] AS [Id1], [s].[c] + END AS [RefId], [s].[Id] AS [Id0], [s].[Id0] AS [Id00], [s].[c] FROM ( SELECT TOP(12) [l0].[Id], [l2].[Id] AS [Id0], [l2].[Level2_Required_Id], [l2].[OneToMany_Required_Inverse3Id], CASE WHEN [l2].[Level2_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [l2].[Id] @@ -8469,7 +8461,7 @@ WHERE [l3].[Level3_Required_Id] IS NOT NULL AND [l3].[OneToMany_Required_Inverse WHEN [s].[Level2_Required_Id] IS NOT NULL AND [s].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [s].[Id0] END = [l4].[Level3_Optional_Id] ) AS [s0] -ORDER BY [l].[Id], [s0].[c], [s0].[Id0], [s0].[Id00] +ORDER BY [l].[Id], [s0].[c], [s0].[Id0] """); } @@ -8479,14 +8471,14 @@ public override async Task Single_select_many_in_projection_with_take(bool async AssertSql( """ -SELECT [l].[Id], [s0].[Id], [s0].[RefId], [s0].[Id0], [s0].[Id00], [s0].[Id1] +SELECT [l].[Id], [s0].[Id], [s0].[RefId], [s0].[Id0], [s0].[Id00] FROM [Level1] AS [l] OUTER APPLY ( SELECT CASE WHEN [s].[Level2_Required_Id] IS NOT NULL AND [s].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [s].[Id0] END AS [Id], CASE WHEN [l4].[Level3_Required_Id] IS NOT NULL AND [l4].[OneToMany_Required_Inverse4Id] IS NOT NULL THEN [l4].[Id] - END AS [RefId], [s].[Id] AS [Id0], [s].[Id0] AS [Id00], [l4].[Id] AS [Id1], [s].[c] + END AS [RefId], [s].[Id] AS [Id0], [s].[Id0] AS [Id00], [s].[c] FROM ( SELECT TOP(12) [l0].[Id], [l2].[Id] AS [Id0], [l2].[Level2_Required_Id], [l2].[OneToMany_Required_Inverse3Id], CASE WHEN [l2].[Level2_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [l2].[Id] @@ -8512,7 +8504,7 @@ WHERE [l3].[Level3_Required_Id] IS NOT NULL AND [l3].[OneToMany_Required_Inverse WHEN [s].[Level2_Required_Id] IS NOT NULL AND [s].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [s].[Id0] END = [l4].[Level3_Optional_Id] ) AS [s0] -ORDER BY [l].[Id], [s0].[c], [s0].[Id0], [s0].[Id00] +ORDER BY [l].[Id], [s0].[c], [s0].[Id0] """); } diff --git a/test/EFCore.SqlServer.FunctionalTests/Query/ComplexNavigationsSharedTypeQuerySqlServerTest.cs b/test/EFCore.SqlServer.FunctionalTests/Query/ComplexNavigationsSharedTypeQuerySqlServerTest.cs index c5d550d4cd3..79d544085d5 100644 --- a/test/EFCore.SqlServer.FunctionalTests/Query/ComplexNavigationsSharedTypeQuerySqlServerTest.cs +++ b/test/EFCore.SqlServer.FunctionalTests/Query/ComplexNavigationsSharedTypeQuerySqlServerTest.cs @@ -607,10 +607,10 @@ public override async Task Let_let_contains_from_outer_let(bool async) AssertSql( """ -SELECT [l].[Id], [l].[Date], [l].[Name], [s].[Id0], [s].[Id1], [s].[Id], [l7].[Id], [l7].[OneToOne_Required_PK_Date], [l7].[Level1_Optional_Id], [l7].[Level1_Required_Id], [l7].[Level2_Name], [l7].[OneToMany_Optional_Inverse2Id], [l7].[OneToMany_Required_Inverse2Id], [l7].[OneToOne_Optional_PK_Inverse2Id], [s].[Level2_Optional_Id], [s].[Level2_Required_Id], [s].[Level3_Name], [s].[OneToMany_Optional_Inverse3Id], [s].[OneToMany_Required_Inverse3Id], [s].[OneToOne_Optional_PK_Inverse3Id] +SELECT [l].[Id], [l].[Date], [l].[Name], [s].[Id0], [l7].[Id], [l7].[OneToOne_Required_PK_Date], [l7].[Level1_Optional_Id], [l7].[Level1_Required_Id], [l7].[Level2_Name], [l7].[OneToMany_Optional_Inverse2Id], [l7].[OneToMany_Required_Inverse2Id], [l7].[OneToOne_Optional_PK_Inverse2Id], [s].[Id], [s].[Level2_Optional_Id], [s].[Level2_Required_Id], [s].[Level3_Name], [s].[OneToMany_Optional_Inverse3Id], [s].[OneToMany_Required_Inverse3Id], [s].[OneToOne_Optional_PK_Inverse3Id] FROM [Level1] AS [l] OUTER APPLY ( - 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], [l0].[Id] AS [Id0], [l2].[Id] AS [Id1] + 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], [l0].[Id] AS [Id0] FROM [Level1] AS [l0] LEFT JOIN ( SELECT [l1].[Id], [l1].[OneToOne_Required_PK_Date], [l1].[Level1_Required_Id], [l1].[OneToMany_Required_Inverse2Id] @@ -641,7 +641,7 @@ LEFT JOIN ( 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 ) AS [l7] ON [l].[Id] = [l7].[OneToMany_Required_Inverse2Id] -ORDER BY [l].[Id], [s].[Id0], [s].[Id1], [s].[Id] +ORDER BY [l].[Id], [s].[Id0] """); } @@ -1133,7 +1133,7 @@ WHERE [l3].[OneToOne_Required_PK_Date] IS NOT NULL AND [l3].[Level1_Required_Id] ) AS [l5] WHERE [l5].[row] <= 1 ) AS [l6] ON [l].[Id] = [l6].[OneToMany_Required_Inverse2Id] -ORDER BY [l].[Id], [l1].[Id] +ORDER BY [l].[Id] """); } @@ -1721,7 +1721,7 @@ public override async Task Collection_FirstOrDefault_entity_collection_accesses_ AssertSql( """ -SELECT [l].[Id], [l3].[Id], [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], [l3].[c] +SELECT [l].[Id], [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], [l3].[c] FROM [Level1] AS [l] LEFT JOIN ( SELECT [l2].[c], [l2].[Id], [l2].[OneToOne_Required_PK_Date], [l2].[Level1_Required_Id], [l2].[OneToMany_Required_Inverse2Id], [l2].[OneToMany_Optional_Inverse2Id] @@ -1740,7 +1740,7 @@ WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse WHEN [l3].[OneToOne_Required_PK_Date] IS NOT NULL AND [l3].[Level1_Required_Id] IS NOT NULL AND [l3].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [l3].[Id] END = [l4].[OneToMany_Optional_Inverse3Id] WHERE [l].[Id] < 2 -ORDER BY [l].[Id], [l3].[Id] +ORDER BY [l].[Id] """); } @@ -1755,7 +1755,7 @@ FROM [Level1] AS [l] LEFT JOIN ( SELECT [s].[Id], [s].[Level2_Optional_Id], [s].[Level2_Required_Id], [s].[Level3_Name], [s].[OneToMany_Optional_Inverse3Id], [s].[OneToMany_Required_Inverse3Id], [s].[OneToOne_Optional_PK_Inverse3Id], [s].[OneToMany_Optional_Inverse2Id] 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], [l0].[OneToMany_Optional_Inverse2Id], ROW_NUMBER() OVER(PARTITION BY [l0].[OneToMany_Optional_Inverse2Id] ORDER BY [l0].[Id], [l2].[Id]) AS [row] + 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], [l0].[OneToMany_Optional_Inverse2Id], ROW_NUMBER() OVER(PARTITION BY [l0].[OneToMany_Optional_Inverse2Id] ORDER BY [l0].[Id]) AS [row] 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] @@ -2577,7 +2577,6 @@ WHERE [l1].[OneToOne_Required_PK_Date] IS NOT NULL AND [l1].[Level1_Required_Id] ) AS [l2] ON [l0].[Id] = 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 - LEFT JOIN [Level1] AS [l3] ON [l2].[Level1_Required_Id] = [l3].[Id] WHERE [l2].[OneToOne_Required_PK_Date] IS NOT NULL AND [l2].[Level1_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [s] ON [l].[Id] = [s].[Level1_Required_Id] """); @@ -4332,7 +4331,7 @@ FROM [InheritanceOne] AS [i] LEFT JOIN [InheritanceLeafOne] AS [i0] ON [i].[Id] = [i0].[DifferentTypeReference_InheritanceDerived1Id] LEFT JOIN [InheritanceLeafTwo] AS [i1] ON [i].[Id] = [i1].[DifferentTypeReference_InheritanceDerived2Id] LEFT JOIN [InheritanceTwo] AS [i2] ON [i1].[Id] = [i2].[InheritanceLeaf2Id] -ORDER BY [i].[Id], [i0].[Id], [i1].[Id] +ORDER BY [i].[Id] """); } @@ -5649,7 +5648,7 @@ WHERE [l3].[Level2_Required_Id] IS NOT NULL AND [l3].[OneToMany_Required_Inverse ) AS [l5] ON CASE WHEN [s0].[OneToOne_Required_PK_Date] IS NOT NULL AND [s0].[Level1_Required_Id] IS NOT NULL AND [s0].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [s0].[Id0] END = [l5].[OneToMany_Optional_Inverse3Id] -ORDER BY [l4].[Name], [s0].[Id], [s0].[Id0] +ORDER BY [l4].[Name] """); } @@ -5829,23 +5828,16 @@ WHERE [l2].[Level2_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse ) AS [l3] ON 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 = [l3].[Level2_Required_Id] -LEFT JOIN ( - SELECT [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 -) AS [l5] ON 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 = [l5].[OneToOne_Optional_PK_Inverse3Id] WHERE [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 EXISTS ( SELECT 1 - FROM [Level1] AS [l6] - WHERE [l6].[Level3_Required_Id] IS NOT NULL AND [l6].[OneToMany_Required_Inverse4Id] IS NOT NULL AND CASE + FROM [Level1] AS [l4] + WHERE [l4].[Level3_Required_Id] IS NOT NULL AND [l4].[OneToMany_Required_Inverse4Id] IS NOT NULL AND CASE WHEN [l3].[Level2_Required_Id] IS NOT NULL AND [l3].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [l3].[Id] END IS NOT NULL AND (CASE WHEN [l3].[Level2_Required_Id] IS NOT NULL AND [l3].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [l3].[Id] - END = [l6].[OneToMany_Optional_Inverse4Id] OR (CASE + END = [l4].[OneToMany_Optional_Inverse4Id] OR (CASE WHEN [l3].[Level2_Required_Id] IS NOT NULL AND [l3].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [l3].[Id] - END IS NULL AND [l6].[OneToMany_Optional_Inverse4Id] IS NULL))) + END IS NULL AND [l4].[OneToMany_Optional_Inverse4Id] IS NULL))) """); } @@ -7586,7 +7578,7 @@ public override async Task Multi_level_include_with_short_circuiting(bool async) AssertSql( """ -SELECT [f].[Name], [f].[LabelDefaultText], [f].[PlaceholderDefaultText], [m].[DefaultText], [m0].[DefaultText], [s].[Text], [s].[ComplexNavigationStringDefaultText], [s].[LanguageName], [s].[Name], [s].[CultureString], [s0].[Text], [s0].[ComplexNavigationStringDefaultText], [s0].[LanguageName], [s0].[Name], [s0].[CultureString] +SELECT [f].[Name], [f].[LabelDefaultText], [f].[PlaceholderDefaultText], [m].[DefaultText], [s].[Text], [s].[ComplexNavigationStringDefaultText], [s].[LanguageName], [s].[Name], [s].[CultureString], [m0].[DefaultText], [s0].[Text], [s0].[ComplexNavigationStringDefaultText], [s0].[LanguageName], [s0].[Name], [s0].[CultureString] FROM [Fields] AS [f] LEFT JOIN [MultilingualStrings] AS [m] ON [f].[LabelDefaultText] = [m].[DefaultText] LEFT JOIN [MultilingualStrings] AS [m0] ON [f].[PlaceholderDefaultText] = [m0].[DefaultText] @@ -7600,7 +7592,7 @@ LEFT JOIN ( FROM [Globalizations] AS [g0] LEFT JOIN [Languages] AS [l0] ON [g0].[LanguageName] = [l0].[Name] ) AS [s0] ON [m0].[DefaultText] = [s0].[ComplexNavigationStringDefaultText] -ORDER BY [f].[Name], [m].[DefaultText], [m0].[DefaultText], [s].[Text], [s].[Name], [s0].[Text] +ORDER BY [f].[Name], [s].[Text] """); } @@ -7940,7 +7932,7 @@ FROM [InheritanceOne] AS [i3] LEFT JOIN [InheritanceLeafOne] AS [i4] ON [i3].[Id] = [i4].[SameTypeReference_InheritanceDerived1Id] LEFT JOIN [InheritanceLeafOne] AS [i5] ON [i3].[Id] = [i5].[SameTypeReference_InheritanceDerived2Id] ) AS [s] ON [i].[Id] = [s].[InheritanceBase2Id1] -ORDER BY [i].[Id], [i0].[Id], [i1].[Id], [i2].[Id], [s].[Id], [s].[Id0] +ORDER BY [i].[Id], [i1].[Id], [i2].[Id] """); } @@ -8320,12 +8312,12 @@ public override async Task Correlated_projection_with_first(bool async) AssertSql( """ -SELECT [l].[Id], [s].[c], [s].[Id], [s].[Id0] +SELECT [l].[Id], [s].[c], [s].[Id] FROM [Level1] AS [l] OUTER APPLY ( SELECT CASE WHEN [l4].[Level3_Required_Id] IS NOT NULL AND [l4].[OneToMany_Required_Inverse4Id] IS NOT NULL THEN [l4].[Id] - END AS [c], [l0].[Id], [l4].[Id] AS [Id0] + END AS [c], [l0].[Id] FROM [Level1] AS [l0] LEFT JOIN ( SELECT [l3].[Id], [l3].[Level3_Required_Id], [l3].[OneToMany_Required_Inverse4Id] @@ -8360,7 +8352,7 @@ 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)) ) AS [s] -ORDER BY [l].[Id], [s].[Id] +ORDER BY [l].[Id] """); } @@ -8372,7 +8364,7 @@ public override async Task Max_in_multi_level_nested_subquery(bool async) """ @p='2' -SELECT [l6].[Id], [s].[Id], [s].[Id0], [s].[Id1], [s].[Result], [s].[Id2], [s].[Id3], [s].[Id4] +SELECT [l6].[Id], [s].[Id], [s].[Id0], [s].[Id1], [s].[Result], [s].[Id2] FROM ( SELECT TOP(@p) [l].[Id] FROM [Level1] AS [l] @@ -8399,7 +8391,7 @@ WHEN [l2].[Level2_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse3 WHEN [l2].[Level2_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [l2].[Id] END IS NULL AND [l5].[OneToMany_Optional_Inverse4Id] IS NULL))), 0) > 1 THEN CAST(1 AS bit) ELSE CAST(0 AS bit) - END AS [Result], [l0].[Id] AS [Id2], [l2].[Id] AS [Id3], [l4].[Id] AS [Id4], [l0].[OneToMany_Optional_Inverse2Id] + END AS [Result], [l0].[Id] AS [Id2], [l0].[OneToMany_Optional_Inverse2Id] FROM [Level1] AS [l0] LEFT JOIN ( SELECT [l1].[Id], [l1].[Level2_Required_Id], [l1].[OneToMany_Required_Inverse3Id] @@ -8417,7 +8409,7 @@ WHEN [l2].[Level2_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse3 END = [l4].[Level3_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 ) AS [s] ON [l6].[Id] = [s].[OneToMany_Optional_Inverse2Id] -ORDER BY [l6].[Id], [s].[Id2], [s].[Id3] +ORDER BY [l6].[Id] """); } @@ -8427,7 +8419,7 @@ public override async Task Multiple_select_many_in_projection(bool async) AssertSql( """ -SELECT [l].[Id], [s0].[Id], [s0].[RefId], [s0].[Id0], [s0].[Id00], [s0].[Id1], ( +SELECT [l].[Id], [s0].[Id], [s0].[RefId], [s0].[Id0], [s0].[Id00], ( SELECT COUNT(*) FROM [Level1] AS [l5] INNER JOIN ( @@ -8444,7 +8436,7 @@ SELECT CASE WHEN [s].[Level2_Required_Id] IS NOT NULL AND [s].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [s].[Id0] END AS [Id], CASE WHEN [l4].[Level3_Required_Id] IS NOT NULL AND [l4].[OneToMany_Required_Inverse4Id] IS NOT NULL THEN [l4].[Id] - END AS [RefId], [s].[Id] AS [Id0], [s].[Id0] AS [Id00], [l4].[Id] AS [Id1], [s].[c] + END AS [RefId], [s].[Id] AS [Id0], [s].[Id0] AS [Id00], [s].[c] FROM ( SELECT TOP(12) [l0].[Id], [l2].[Id] AS [Id0], [l2].[Level2_Required_Id], [l2].[OneToMany_Required_Inverse3Id], CASE WHEN [l2].[Level2_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [l2].[Id] @@ -8470,7 +8462,7 @@ WHERE [l3].[Level3_Required_Id] IS NOT NULL AND [l3].[OneToMany_Required_Inverse WHEN [s].[Level2_Required_Id] IS NOT NULL AND [s].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [s].[Id0] END = [l4].[Level3_Optional_Id] ) AS [s0] -ORDER BY [l].[Id], [s0].[c], [s0].[Id0], [s0].[Id00] +ORDER BY [l].[Id], [s0].[c], [s0].[Id0] """); } @@ -8480,14 +8472,14 @@ public override async Task Single_select_many_in_projection_with_take(bool async AssertSql( """ -SELECT [l].[Id], [s0].[Id], [s0].[RefId], [s0].[Id0], [s0].[Id00], [s0].[Id1] +SELECT [l].[Id], [s0].[Id], [s0].[RefId], [s0].[Id0], [s0].[Id00] FROM [Level1] AS [l] OUTER APPLY ( SELECT CASE WHEN [s].[Level2_Required_Id] IS NOT NULL AND [s].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [s].[Id0] END AS [Id], CASE WHEN [l4].[Level3_Required_Id] IS NOT NULL AND [l4].[OneToMany_Required_Inverse4Id] IS NOT NULL THEN [l4].[Id] - END AS [RefId], [s].[Id] AS [Id0], [s].[Id0] AS [Id00], [l4].[Id] AS [Id1], [s].[c] + END AS [RefId], [s].[Id] AS [Id0], [s].[Id0] AS [Id00], [s].[c] FROM ( SELECT TOP(12) [l0].[Id], [l2].[Id] AS [Id0], [l2].[Level2_Required_Id], [l2].[OneToMany_Required_Inverse3Id], CASE WHEN [l2].[Level2_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [l2].[Id] @@ -8513,7 +8505,7 @@ WHERE [l3].[Level3_Required_Id] IS NOT NULL AND [l3].[OneToMany_Required_Inverse WHEN [s].[Level2_Required_Id] IS NOT NULL AND [s].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [s].[Id0] END = [l4].[Level3_Optional_Id] ) AS [s0] -ORDER BY [l].[Id], [s0].[c], [s0].[Id0], [s0].[Id00] +ORDER BY [l].[Id], [s0].[c], [s0].[Id0] """); } diff --git a/test/EFCore.SqlServer.FunctionalTests/Query/Ef6GroupBySqlServerTest.cs b/test/EFCore.SqlServer.FunctionalTests/Query/Ef6GroupBySqlServerTest.cs index c389821b466..aac11dfdb09 100644 --- a/test/EFCore.SqlServer.FunctionalTests/Query/Ef6GroupBySqlServerTest.cs +++ b/test/EFCore.SqlServer.FunctionalTests/Query/Ef6GroupBySqlServerTest.cs @@ -481,14 +481,14 @@ public override async Task Group_Join_from_LINQ_101(bool async) AssertSql( """ -SELECT [c].[Id], [c].[CompanyName], [c].[Region], [s].[Id], [s].[CustomerId], [s].[OrderDate], [s].[Total], [s].[Id0] +SELECT [c].[Id], [c].[CompanyName], [c].[Region], [s].[Id], [s].[CustomerId], [s].[OrderDate], [s].[Total] FROM [CustomerForLinq] AS [c] LEFT JOIN ( SELECT [o].[Id], [o].[CustomerId], [o].[OrderDate], [o].[Total], [c0].[Id] AS [Id0] FROM [OrderForLinq] AS [o] LEFT JOIN [CustomerForLinq] AS [c0] ON [o].[CustomerId] = [c0].[Id] ) AS [s] ON [c].[Id] = [s].[Id0] -ORDER BY [c].[Id], [s].[Id] +ORDER BY [c].[Id] """); } @@ -752,7 +752,7 @@ FROM [Person] AS [p0] WHERE [p2].[row] <= 1 ) AS [p3] ON [p1].[FirstName] = [p3].[FirstName] LEFT JOIN [Shoes] AS [s] ON [p3].[Id] = [s].[PersonId] -ORDER BY [p1].[FirstName], [p3].[Id] +ORDER BY [p1].[FirstName] """); } @@ -854,7 +854,7 @@ public override async Task Left_Outer_Join_with_Group_Join_from_LINQ_101(bool as AssertSql( """ -SELECT [c].[Id], [c].[CompanyName], [c].[Region], [s].[Id], [s].[Id0], [o0].[Id], [o0].[CustomerId], [o0].[OrderDate], [o0].[Total], CASE +SELECT [c].[Id], [c].[CompanyName], [c].[Region], [s].[Id], [o0].[Id], [o0].[CustomerId], [o0].[OrderDate], [o0].[Total], CASE WHEN [s].[Id] IS NULL THEN -1 ELSE [s].[Id] END @@ -865,7 +865,7 @@ FROM [OrderForLinq] AS [o] LEFT JOIN [CustomerForLinq] AS [c0] ON [o].[CustomerId] = [c0].[Id] ) AS [s] ON [c].[Id] = [s].[Id0] LEFT JOIN [OrderForLinq] AS [o0] ON [c].[Id] = [o0].[CustomerId] -ORDER BY [c].[Id], [s].[Id], [s].[Id0] +ORDER BY [c].[Id], [s].[Id] """); } @@ -887,7 +887,7 @@ public override async Task Whats_new_2021_sample_11(bool async) AssertSql( """ -SELECT [p2].[LastName], [p2].[c], [p4].[Id], [p6].[Id], [p6].[Age], [p6].[FirstName], [p6].[LastName], [p6].[MiddleInitial], [p4].[Age], [p4].[FirstName], [p4].[LastName], [p4].[MiddleInitial] +SELECT [p2].[LastName], [p2].[c], [p6].[Id], [p6].[Age], [p6].[FirstName], [p6].[LastName], [p6].[MiddleInitial], [p4].[Id], [p4].[Age], [p4].[FirstName], [p4].[LastName], [p4].[MiddleInitial] FROM ( SELECT [p].[LastName], COUNT(*) AS [c] FROM [Person] AS [p] @@ -909,7 +909,7 @@ FROM [Person] AS [p1] ) AS [p5] WHERE [p5].[row] <= 2 ) AS [p6] ON [p2].[LastName] = [p6].[LastName] -ORDER BY [p2].[LastName] DESC, [p4].[Id], [p6].[LastName], [p6].[Id] +ORDER BY [p2].[LastName] DESC, [p6].[LastName], [p6].[Id] """); } diff --git a/test/EFCore.SqlServer.FunctionalTests/Query/GearsOfWarQuerySqlServerTest.cs b/test/EFCore.SqlServer.FunctionalTests/Query/GearsOfWarQuerySqlServerTest.cs index 255ab5c7a75..3251f548d5a 100644 --- a/test/EFCore.SqlServer.FunctionalTests/Query/GearsOfWarQuerySqlServerTest.cs +++ b/test/EFCore.SqlServer.FunctionalTests/Query/GearsOfWarQuerySqlServerTest.cs @@ -42,7 +42,7 @@ public override async Task Include_multiple_one_to_one_and_one_to_many(bool asyn FROM [Tags] AS [t] LEFT JOIN [Gears] AS [g] ON [t].[GearNickName] = [g].[Nickname] AND [t].[GearSquadId] = [g].[SquadId] LEFT JOIN [Weapons] AS [w] ON [g].[FullName] = [w].[OwnerFullName] -ORDER BY [t].[Id], [g].[Nickname], [g].[SquadId] +ORDER BY [t].[Id] """); } @@ -69,7 +69,7 @@ public override async Task Include_multiple_circular(bool async) FROM [Gears] AS [g] INNER JOIN [Cities] AS [c] ON [g].[CityOfBirthName] = [c].[Name] LEFT JOIN [Gears] AS [g0] ON [c].[Name] = [g0].[AssignedCityName] -ORDER BY [g].[Nickname], [g].[SquadId], [c].[Name], [g0].[Nickname] +ORDER BY [g].[Nickname], [g].[SquadId], [g0].[Nickname] """); } @@ -84,7 +84,7 @@ FROM [Gears] AS [g] INNER JOIN [Cities] AS [c] ON [g].[CityOfBirthName] = [c].[Name] LEFT JOIN [Gears] AS [g0] ON [c].[Name] = [g0].[AssignedCityName] WHERE [g].[Nickname] = N'Marcus' -ORDER BY [g].[Nickname], [g].[SquadId], [c].[Name], [g0].[Nickname] +ORDER BY [g].[Nickname], [g].[SquadId], [g0].[Nickname] """); } @@ -296,7 +296,7 @@ FROM [Gears] AS [g] INNER JOIN [Tags] AS [t] ON [g].[SquadId] = [t].[GearSquadId] AND [g].[Nickname] = [t].[GearNickName] INNER JOIN [Cities] AS [c] ON [g].[CityOfBirthName] = [c].[Name] LEFT JOIN [Gears] AS [g0] ON [c].[Name] = [g0].[AssignedCityName] -ORDER BY [g].[Nickname], [g].[SquadId], [t].[Id], [c].[Name], [g0].[Nickname] +ORDER BY [g].[Nickname], [g].[SquadId], [t].[Id], [g0].[Nickname] """); } @@ -1437,11 +1437,6 @@ FROM [Gears] AS [g] WHERE [g].[HasSoulPatch] = CAST(1 AS bit) AND ( SELECT TOP(1) [w].[IsAutomatic] FROM [Weapons] AS [w] - LEFT JOIN ( - SELECT [w0].[Id] - FROM [Weapons] AS [w0] - WHERE [g].[FullName] = [w0].[OwnerFullName] - ) AS [w1] ON [w].[Id] = [w1].[Id] WHERE [g].[FullName] = [w].[OwnerFullName] ORDER BY [w].[Id]) = CAST(1 AS bit) """); @@ -2266,7 +2261,7 @@ public override async Task Select_correlated_filtered_collection(bool async) AssertSql( """ -SELECT [g].[Nickname], [g].[SquadId], [c].[Name], [w0].[Id], [w0].[AmmunitionType], [w0].[IsAutomatic], [w0].[Name], [w0].[OwnerFullName], [w0].[SynergyWithId] +SELECT [g].[Nickname], [g].[SquadId], [w0].[Id], [w0].[AmmunitionType], [w0].[IsAutomatic], [w0].[Name], [w0].[OwnerFullName], [w0].[SynergyWithId] FROM [Gears] AS [g] INNER JOIN [Cities] AS [c] ON [g].[CityOfBirthName] = [c].[Name] LEFT JOIN ( @@ -2275,7 +2270,7 @@ FROM [Weapons] AS [w] WHERE [w].[Name] <> N'Lancer' OR [w].[Name] IS NULL ) AS [w0] ON [g].[FullName] = [w0].[OwnerFullName] WHERE [c].[Name] IN (N'Ephyra', N'Hanover') -ORDER BY [g].[Nickname], [g].[SquadId], [c].[Name] +ORDER BY [g].[Nickname], [g].[SquadId] """); } @@ -2998,7 +2993,7 @@ FROM [LocustLeaders] AS [l] WHERE [l].[Discriminator] = N'LocustCommander' ) AS [l0] ON [f].[CommanderName] = [l0].[Name] LEFT JOIN [LocustLeaders] AS [l1] ON [f].[Id] = [l1].[LocustHordeId] -ORDER BY [f].[Name], [f].[Id], [l0].[Name] +ORDER BY [f].[Name], [f].[Id] """); } @@ -3145,7 +3140,7 @@ public override async Task Project_collection_navigation_with_inheritance1(bool AssertSql( """ -SELECT [f].[Id], [l0].[Name], [f0].[Id], [l1].[Name], [l1].[Discriminator], [l1].[LocustHordeId], [l1].[ThreatLevel], [l1].[ThreatLevelByte], [l1].[ThreatLevelNullableByte], [l1].[DefeatedByNickname], [l1].[DefeatedBySquadId], [l1].[HighCommandId] +SELECT [f].[Id], [l1].[Name], [l1].[Discriminator], [l1].[LocustHordeId], [l1].[ThreatLevel], [l1].[ThreatLevelByte], [l1].[ThreatLevelNullableByte], [l1].[DefeatedByNickname], [l1].[DefeatedBySquadId], [l1].[HighCommandId] FROM [Factions] AS [f] LEFT JOIN ( SELECT [l].[Name] @@ -3154,7 +3149,7 @@ FROM [LocustLeaders] AS [l] ) AS [l0] ON [f].[CommanderName] = [l0].[Name] LEFT JOIN [Factions] AS [f0] ON [l0].[Name] = [f0].[CommanderName] LEFT JOIN [LocustLeaders] AS [l1] ON [f0].[Id] = [l1].[LocustHordeId] -ORDER BY [f].[Id], [l0].[Name], [f0].[Id] +ORDER BY [f].[Id] """); } @@ -3164,7 +3159,7 @@ public override async Task Project_collection_navigation_with_inheritance2(bool AssertSql( """ -SELECT [f].[Id], [l0].[Name], [g].[Nickname], [g].[SquadId], [g0].[Nickname], [g0].[SquadId], [g0].[AssignedCityName], [g0].[CityOfBirthName], [g0].[Discriminator], [g0].[FullName], [g0].[HasSoulPatch], [g0].[LeaderNickname], [g0].[LeaderSquadId], [g0].[Rank] +SELECT [f].[Id], [g0].[Nickname], [g0].[SquadId], [g0].[AssignedCityName], [g0].[CityOfBirthName], [g0].[Discriminator], [g0].[FullName], [g0].[HasSoulPatch], [g0].[LeaderNickname], [g0].[LeaderSquadId], [g0].[Rank] FROM [Factions] AS [f] LEFT JOIN ( SELECT [l].[Name], [l].[DefeatedByNickname], [l].[DefeatedBySquadId] @@ -3173,7 +3168,7 @@ FROM [LocustLeaders] AS [l] ) AS [l0] ON [f].[CommanderName] = [l0].[Name] LEFT JOIN [Gears] AS [g] ON [l0].[DefeatedByNickname] = [g].[Nickname] AND [l0].[DefeatedBySquadId] = [g].[SquadId] LEFT JOIN [Gears] AS [g0] ON ([g].[Nickname] = [g0].[LeaderNickname] OR ([g].[Nickname] IS NULL AND [g0].[LeaderNickname] IS NULL)) AND [g].[SquadId] = [g0].[LeaderSquadId] -ORDER BY [f].[Id], [l0].[Name], [g].[Nickname], [g].[SquadId], [g0].[Nickname] +ORDER BY [f].[Id], [g0].[Nickname] """); } @@ -3183,7 +3178,7 @@ public override async Task Project_collection_navigation_with_inheritance3(bool AssertSql( """ -SELECT [f].[Id], [l0].[Name], [g].[Nickname], [g].[SquadId], [g0].[Nickname], [g0].[SquadId], [g0].[AssignedCityName], [g0].[CityOfBirthName], [g0].[Discriminator], [g0].[FullName], [g0].[HasSoulPatch], [g0].[LeaderNickname], [g0].[LeaderSquadId], [g0].[Rank] +SELECT [f].[Id], [g0].[Nickname], [g0].[SquadId], [g0].[AssignedCityName], [g0].[CityOfBirthName], [g0].[Discriminator], [g0].[FullName], [g0].[HasSoulPatch], [g0].[LeaderNickname], [g0].[LeaderSquadId], [g0].[Rank] FROM [Factions] AS [f] LEFT JOIN ( SELECT [l].[Name], [l].[DefeatedByNickname], [l].[DefeatedBySquadId] @@ -3192,7 +3187,7 @@ FROM [LocustLeaders] AS [l] ) AS [l0] ON [f].[CommanderName] = [l0].[Name] LEFT JOIN [Gears] AS [g] ON [l0].[DefeatedByNickname] = [g].[Nickname] AND [l0].[DefeatedBySquadId] = [g].[SquadId] LEFT JOIN [Gears] AS [g0] ON ([g].[Nickname] = [g0].[LeaderNickname] OR ([g].[Nickname] IS NULL AND [g0].[LeaderNickname] IS NULL)) AND [g].[SquadId] = [g0].[LeaderSquadId] -ORDER BY [f].[Id], [l0].[Name], [g].[Nickname], [g].[SquadId], [g0].[Nickname] +ORDER BY [f].[Id], [g0].[Nickname] """); } @@ -3235,7 +3230,7 @@ LEFT JOIN ( FROM [Gears] AS [g0] INNER JOIN [Cities] AS [c] ON [g0].[CityOfBirthName] = [c].[Name] ) AS [s] ON ([g].[Nickname] = [s].[LeaderNickname] OR ([g].[Nickname] IS NULL AND [s].[LeaderNickname] IS NULL)) AND [g].[SquadId] = [s].[LeaderSquadId] -ORDER BY [l].[Name], [g].[Nickname], [g].[SquadId], [s].[Nickname], [s].[SquadId] +ORDER BY [l].[Name], [s].[Nickname] """); } @@ -3324,7 +3319,7 @@ public override async Task Include_base_navigation_on_derived_entity(bool async) FROM [Gears] AS [g] LEFT JOIN [Tags] AS [t] ON [g].[Nickname] = [t].[GearNickName] AND [g].[SquadId] = [t].[GearSquadId] LEFT JOIN [Weapons] AS [w] ON [g].[FullName] = [w].[OwnerFullName] -ORDER BY [g].[Nickname], [g].[SquadId], [t].[Id] +ORDER BY [g].[Nickname], [g].[SquadId] """); } @@ -3338,7 +3333,7 @@ public override async Task ThenInclude_collection_on_derived_after_base_referenc FROM [Tags] AS [t] LEFT JOIN [Gears] AS [g] ON [t].[GearNickName] = [g].[Nickname] AND [t].[GearSquadId] = [g].[SquadId] LEFT JOIN [Weapons] AS [w] ON [g].[FullName] = [w].[OwnerFullName] -ORDER BY [t].[Id], [g].[Nickname], [g].[SquadId] +ORDER BY [t].[Id] """); } @@ -3357,7 +3352,7 @@ FROM [LocustLeaders] AS [l] ) AS [l0] ON [f].[CommanderName] = [l0].[Name] LEFT JOIN [Gears] AS [g] ON [l0].[DefeatedByNickname] = [g].[Nickname] AND [l0].[DefeatedBySquadId] = [g].[SquadId] LEFT JOIN [Gears] AS [g0] ON ([g].[Nickname] = [g0].[LeaderNickname] OR ([g].[Nickname] IS NULL AND [g0].[LeaderNickname] IS NULL)) AND [g].[SquadId] = [g0].[LeaderSquadId] -ORDER BY [f].[Id], [l0].[Name], [g].[Nickname], [g].[SquadId], [g0].[Nickname] +ORDER BY [f].[Id], [g0].[Nickname] """); } @@ -3391,7 +3386,7 @@ LEFT JOIN ( FROM [LocustLeaders] AS [l] LEFT JOIN [Gears] AS [g] ON [l].[DefeatedByNickname] = [g].[Nickname] AND [l].[DefeatedBySquadId] = [g].[SquadId] ) AS [s] ON [f].[Id] = [s].[LocustHordeId] -ORDER BY [f].[Id], [s].[Name], [s].[Nickname] +ORDER BY [f].[Id] """); } @@ -3410,7 +3405,7 @@ FROM [LocustLeaders] AS [l] ) AS [l0] ON [f].[CommanderName] = [l0].[Name] LEFT JOIN [Gears] AS [g] ON [l0].[DefeatedByNickname] = [g].[Nickname] AND [l0].[DefeatedBySquadId] = [g].[SquadId] LEFT JOIN [Gears] AS [g0] ON ([g].[Nickname] = [g0].[LeaderNickname] OR ([g].[Nickname] IS NULL AND [g0].[LeaderNickname] IS NULL)) AND [g].[SquadId] = [g0].[LeaderSquadId] -ORDER BY [f].[Id], [l0].[Name], [g].[Nickname], [g].[SquadId], [g0].[Nickname] +ORDER BY [f].[Id], [g0].[Nickname] """); } @@ -3428,7 +3423,7 @@ FROM [Gears] AS [g0] INNER JOIN [Squads] AS [s] ON [g0].[SquadId] = [s].[Id] LEFT JOIN [SquadMissions] AS [s0] ON [s].[Id] = [s0].[SquadId] ) AS [s1] ON [g].[Nickname] = [s1].[LeaderNickname] AND [g].[SquadId] = [s1].[LeaderSquadId] -ORDER BY [g].[Nickname], [g].[SquadId], [s1].[Nickname], [s1].[SquadId], [s1].[Id], [s1].[SquadId0] +ORDER BY [g].[Nickname], [g].[SquadId], [s1].[Nickname], [s1].[SquadId], [s1].[SquadId0] """); } @@ -3765,7 +3760,7 @@ public override async Task Correlated_collections_projection_of_collection_thru_ AssertSql( """ -SELECT [g].[Nickname], [g].[SquadId], [s].[Id], [s1].[SquadId], [s1].[MissionId] +SELECT [g].[Nickname], [g].[SquadId], [s1].[SquadId], [s1].[MissionId] FROM [Gears] AS [g] INNER JOIN [Squads] AS [s] ON [g].[SquadId] = [s].[Id] LEFT JOIN ( @@ -3774,7 +3769,7 @@ FROM [SquadMissions] AS [s0] WHERE [s0].[MissionId] <> 17 ) AS [s1] ON [s].[Id] = [s1].[SquadId] WHERE [g].[Nickname] <> N'Marcus' -ORDER BY [g].[FullName], [g].[Nickname], [g].[SquadId], [s].[Id], [s1].[SquadId] +ORDER BY [g].[FullName], [g].[Nickname], [g].[SquadId], [s1].[SquadId] """); } @@ -3798,10 +3793,10 @@ public override async Task Correlated_collections_nested(bool async) AssertSql( """ -SELECT [s].[Id], [s3].[SquadId], [s3].[MissionId], [s3].[Id], [s3].[SquadId0], [s3].[MissionId0] +SELECT [s].[Id], [s3].[SquadId], [s3].[MissionId], [s3].[SquadId0], [s3].[MissionId0] FROM [Squads] AS [s] LEFT JOIN ( - SELECT [s0].[SquadId], [s0].[MissionId], [m].[Id], [s2].[SquadId] AS [SquadId0], [s2].[MissionId] AS [MissionId0] + SELECT [s0].[SquadId], [s0].[MissionId], [s2].[SquadId] AS [SquadId0], [s2].[MissionId] AS [MissionId0] FROM [SquadMissions] AS [s0] INNER JOIN [Missions] AS [m] ON [s0].[MissionId] = [m].[Id] LEFT JOIN ( @@ -3811,7 +3806,7 @@ WHERE [s1].[SquadId] < 7 ) AS [s2] ON [m].[Id] = [s2].[MissionId] WHERE [s0].[MissionId] < 42 ) AS [s3] ON [s].[Id] = [s3].[SquadId] -ORDER BY [s].[Id], [s3].[SquadId], [s3].[MissionId], [s3].[Id], [s3].[SquadId0] +ORDER BY [s].[Id], [s3].[SquadId], [s3].[MissionId], [s3].[SquadId0] """); } @@ -3821,10 +3816,10 @@ public override async Task Correlated_collections_nested_mixed_streaming_with_bu AssertSql( """ -SELECT [s].[Id], [s3].[SquadId], [s3].[MissionId], [s3].[Id], [s3].[SquadId0], [s3].[MissionId0] +SELECT [s].[Id], [s3].[SquadId], [s3].[MissionId], [s3].[SquadId0], [s3].[MissionId0] FROM [Squads] AS [s] LEFT JOIN ( - SELECT [s0].[SquadId], [s0].[MissionId], [m].[Id], [s2].[SquadId] AS [SquadId0], [s2].[MissionId] AS [MissionId0] + SELECT [s0].[SquadId], [s0].[MissionId], [s2].[SquadId] AS [SquadId0], [s2].[MissionId] AS [MissionId0] FROM [SquadMissions] AS [s0] INNER JOIN [Missions] AS [m] ON [s0].[MissionId] = [m].[Id] LEFT JOIN ( @@ -3834,7 +3829,7 @@ WHERE [s1].[SquadId] < 2 ) AS [s2] ON [m].[Id] = [s2].[MissionId] WHERE [s0].[MissionId] < 3 ) AS [s3] ON [s].[Id] = [s3].[SquadId] -ORDER BY [s].[Id], [s3].[SquadId], [s3].[MissionId], [s3].[Id], [s3].[SquadId0] +ORDER BY [s].[Id], [s3].[SquadId], [s3].[MissionId], [s3].[SquadId0] """); } @@ -3844,10 +3839,10 @@ public override async Task Correlated_collections_nested_mixed_streaming_with_bu AssertSql( """ -SELECT [s].[Id], [s3].[SquadId], [s3].[MissionId], [s3].[Id], [s3].[SquadId0], [s3].[MissionId0] +SELECT [s].[Id], [s3].[SquadId], [s3].[MissionId], [s3].[SquadId0], [s3].[MissionId0] FROM [Squads] AS [s] LEFT JOIN ( - SELECT [s0].[SquadId], [s0].[MissionId], [m].[Id], [s2].[SquadId] AS [SquadId0], [s2].[MissionId] AS [MissionId0] + SELECT [s0].[SquadId], [s0].[MissionId], [s2].[SquadId] AS [SquadId0], [s2].[MissionId] AS [MissionId0] FROM [SquadMissions] AS [s0] INNER JOIN [Missions] AS [m] ON [s0].[MissionId] = [m].[Id] LEFT JOIN ( @@ -3857,7 +3852,7 @@ WHERE [s1].[SquadId] < 7 ) AS [s2] ON [m].[Id] = [s2].[MissionId] WHERE [s0].[MissionId] < 42 ) AS [s3] ON [s].[Id] = [s3].[SquadId] -ORDER BY [s].[Id], [s3].[SquadId], [s3].[MissionId], [s3].[Id], [s3].[SquadId0] +ORDER BY [s].[Id], [s3].[SquadId], [s3].[MissionId], [s3].[SquadId0] """); } @@ -3970,12 +3965,12 @@ public override async Task Multiple_orderby_with_navigation_expansion_on_one_of_ AssertSql( """ -SELECT [g].[FullName], [g].[Nickname], [g].[SquadId], [t].[Id], [g1].[Nickname], [g1].[SquadId], [s].[Id], [s].[AmmunitionType], [s].[IsAutomatic], [s].[Name], [s].[OwnerFullName], [s].[SynergyWithId], [s].[Nickname], [s].[SquadId] +SELECT [g].[FullName], [g].[Nickname], [g].[SquadId], [s].[Id], [s].[AmmunitionType], [s].[IsAutomatic], [s].[Name], [s].[OwnerFullName], [s].[SynergyWithId] FROM [Gears] AS [g] LEFT JOIN [Tags] AS [t] ON [g].[Nickname] = [t].[GearNickName] AND [g].[SquadId] = [t].[GearSquadId] LEFT JOIN [Gears] AS [g1] ON [t].[GearNickName] = [g1].[Nickname] AND [t].[GearSquadId] = [g1].[SquadId] LEFT JOIN ( - SELECT [w].[Id], [w].[AmmunitionType], [w].[IsAutomatic], [w].[Name], [w].[OwnerFullName], [w].[SynergyWithId], [g2].[Nickname], [g2].[SquadId] + SELECT [w].[Id], [w].[AmmunitionType], [w].[IsAutomatic], [w].[Name], [w].[OwnerFullName], [w].[SynergyWithId], [g2].[Nickname] FROM [Weapons] AS [w] LEFT JOIN [Gears] AS [g2] ON [w].[OwnerFullName] = [g2].[FullName] ) AS [s] ON [g1].[FullName] = [s].[OwnerFullName] @@ -3983,7 +3978,7 @@ FROM [Weapons] AS [w] SELECT 1 FROM [Gears] AS [g0] WHERE [g].[Nickname] = [g0].[LeaderNickname] AND [g].[SquadId] = [g0].[LeaderSquadId]) -ORDER BY [g].[HasSoulPatch] DESC, [t].[Note], [g].[Nickname], [g].[SquadId], [t].[Id], [g1].[Nickname], [g1].[SquadId], [s].[IsAutomatic], [s].[Nickname] DESC, [s].[Id] +ORDER BY [g].[HasSoulPatch] DESC, [t].[Note], [g].[Nickname], [g].[SquadId], [s].[IsAutomatic], [s].[Nickname] DESC """); } @@ -3994,12 +3989,12 @@ public override async Task Multiple_orderby_with_navigation_expansion_on_one_of_ AssertSql( """ -SELECT [g].[FullName], [g].[Nickname], [g].[SquadId], [t].[Id], [g1].[Nickname], [g1].[SquadId], [s].[Id], [s].[AmmunitionType], [s].[IsAutomatic], [s].[Name], [s].[OwnerFullName], [s].[SynergyWithId], [s].[Nickname], [s].[SquadId] +SELECT [g].[FullName], [g].[Nickname], [g].[SquadId], [s].[Id], [s].[AmmunitionType], [s].[IsAutomatic], [s].[Name], [s].[OwnerFullName], [s].[SynergyWithId] FROM [Gears] AS [g] LEFT JOIN [Tags] AS [t] ON [g].[Nickname] = [t].[GearNickName] AND [g].[SquadId] = [t].[GearSquadId] LEFT JOIN [Gears] AS [g1] ON [t].[GearNickName] = [g1].[Nickname] AND [t].[GearSquadId] = [g1].[SquadId] LEFT JOIN ( - SELECT [w].[Id], [w].[AmmunitionType], [w].[IsAutomatic], [w].[Name], [w].[OwnerFullName], [w].[SynergyWithId], [g2].[Nickname], [g2].[SquadId] + SELECT [w].[Id], [w].[AmmunitionType], [w].[IsAutomatic], [w].[Name], [w].[OwnerFullName], [w].[SynergyWithId], [g2].[Nickname] FROM [Weapons] AS [w] LEFT JOIN [Gears] AS [g2] ON [w].[OwnerFullName] = [g2].[FullName] ) AS [s] ON [g1].[FullName] = [s].[OwnerFullName] @@ -4007,7 +4002,7 @@ FROM [Weapons] AS [w] SELECT 1 FROM [Gears] AS [g0] WHERE [g].[Nickname] = [g0].[LeaderNickname] AND [g].[SquadId] = [g0].[LeaderSquadId]) -ORDER BY [g].[HasSoulPatch] DESC, [t].[Note], [g].[Nickname], [g].[SquadId], [t].[Id], [g1].[Nickname], [g1].[SquadId], [s].[IsAutomatic], [s].[Nickname] DESC, [s].[Id] +ORDER BY [g].[HasSoulPatch] DESC, [t].[Note], [g].[Nickname], [g].[SquadId], [s].[IsAutomatic], [s].[Nickname] DESC """); } @@ -4018,12 +4013,12 @@ public override async Task Multiple_orderby_with_navigation_expansion_on_one_of_ AssertSql( """ -SELECT [g].[FullName], [g].[Nickname], [g].[SquadId], [t].[Id], [g1].[Nickname], [g1].[SquadId], [s].[Id], [s].[AmmunitionType], [s].[IsAutomatic], [s].[Name], [s].[OwnerFullName], [s].[SynergyWithId], [s].[Nickname], [s].[SquadId] +SELECT [g].[FullName], [g].[Nickname], [g].[SquadId], [s].[Id], [s].[AmmunitionType], [s].[IsAutomatic], [s].[Name], [s].[OwnerFullName], [s].[SynergyWithId] FROM [Gears] AS [g] LEFT JOIN [Tags] AS [t] ON [g].[Nickname] = [t].[GearNickName] AND [g].[SquadId] = [t].[GearSquadId] LEFT JOIN [Gears] AS [g1] ON [t].[GearNickName] = [g1].[Nickname] AND [t].[GearSquadId] = [g1].[SquadId] LEFT JOIN ( - SELECT [w].[Id], [w].[AmmunitionType], [w].[IsAutomatic], [w].[Name], [w].[OwnerFullName], [w].[SynergyWithId], [g2].[Nickname], [g2].[SquadId], ( + SELECT [w].[Id], [w].[AmmunitionType], [w].[IsAutomatic], [w].[Name], [w].[OwnerFullName], [w].[SynergyWithId], ( SELECT COUNT(*) FROM [Weapons] AS [w0] WHERE [g2].[FullName] IS NOT NULL AND [g2].[FullName] = [w0].[OwnerFullName]) AS [c] @@ -4034,7 +4029,7 @@ FROM [Weapons] AS [w] SELECT 1 FROM [Gears] AS [g0] WHERE [g].[Nickname] = [g0].[LeaderNickname] AND [g].[SquadId] = [g0].[LeaderSquadId]) -ORDER BY [g].[HasSoulPatch] DESC, [t].[Note], [g].[Nickname], [g].[SquadId], [t].[Id], [g1].[Nickname], [g1].[SquadId], [s].[Id] DESC, [s].[c], [s].[Nickname] +ORDER BY [g].[HasSoulPatch] DESC, [t].[Note], [g].[Nickname], [g].[SquadId], [s].[Id] DESC, [s].[c] """); } @@ -4044,15 +4039,15 @@ public override async Task Correlated_collections_multiple_nested_complex_collec AssertSql( """ -SELECT [g].[FullName], [g].[Nickname], [g].[SquadId], [t].[Id], [g1].[Nickname], [g1].[SquadId], [s1].[FullName], [s1].[Nickname], [s1].[SquadId], [s1].[Id], [s1].[Nickname0], [s1].[SquadId0], [s1].[Id0], [s1].[Name], [s1].[IsAutomatic], [s1].[Id1], [s1].[Nickname00], [s1].[HasSoulPatch], [s1].[SquadId00], [s2].[Id], [s2].[AmmunitionType], [s2].[IsAutomatic], [s2].[Name], [s2].[OwnerFullName], [s2].[SynergyWithId], [s2].[Nickname], [s2].[SquadId] +SELECT [g].[FullName], [g].[Nickname], [g].[SquadId], [s1].[FullName], [s1].[Nickname], [s1].[SquadId], [s1].[Id], [s1].[Name], [s1].[IsAutomatic], [s1].[Id0], [s1].[Nickname0], [s1].[HasSoulPatch], [s1].[SquadId0], [s2].[Id], [s2].[AmmunitionType], [s2].[IsAutomatic], [s2].[Name], [s2].[OwnerFullName], [s2].[SynergyWithId] FROM [Gears] AS [g] LEFT JOIN [Tags] AS [t] ON [g].[Nickname] = [t].[GearNickName] AND [g].[SquadId] = [t].[GearSquadId] LEFT JOIN [Gears] AS [g1] ON [t].[GearNickName] = [g1].[Nickname] AND [t].[GearSquadId] = [g1].[SquadId] LEFT JOIN ( - SELECT [g2].[FullName], [g2].[Nickname], [g2].[SquadId], [s0].[Id], [s0].[Nickname] AS [Nickname0], [s0].[SquadId] AS [SquadId0], [s0].[Id0], [s0].[Name], [s0].[IsAutomatic], [s0].[Id1], [s0].[Nickname0] AS [Nickname00], [s0].[HasSoulPatch], [s0].[SquadId0] AS [SquadId00], [g2].[Rank], [s0].[IsAutomatic0], [g2].[LeaderNickname], [g2].[LeaderSquadId] + SELECT [g2].[FullName], [g2].[Nickname], [g2].[SquadId], [s0].[Id], [s0].[Name], [s0].[IsAutomatic], [s0].[Id0], [s0].[Nickname] AS [Nickname0], [s0].[HasSoulPatch], [s0].[SquadId] AS [SquadId0], [g2].[Rank], [s0].[IsAutomatic0], [g2].[LeaderNickname], [g2].[LeaderSquadId] FROM [Gears] AS [g2] LEFT JOIN ( - SELECT [w].[Id], [g3].[Nickname], [g3].[SquadId], [s].[Id] AS [Id0], [w0].[Name], [w0].[IsAutomatic], [w0].[Id] AS [Id1], [g4].[Nickname] AS [Nickname0], [g4].[HasSoulPatch], [g4].[SquadId] AS [SquadId0], [w].[IsAutomatic] AS [IsAutomatic0], [w].[OwnerFullName] + SELECT [w].[Id], [w0].[Name], [w0].[IsAutomatic], [w0].[Id] AS [Id0], [g4].[Nickname], [g4].[HasSoulPatch], [g4].[SquadId], [w].[IsAutomatic] AS [IsAutomatic0], [w].[OwnerFullName] FROM [Weapons] AS [w] LEFT JOIN [Gears] AS [g3] ON [w].[OwnerFullName] = [g3].[FullName] LEFT JOIN [Squads] AS [s] ON [g3].[SquadId] = [s].[Id] @@ -4063,7 +4058,7 @@ WHERE [w].[Name] <> N'Bar' OR [w].[Name] IS NULL WHERE [g2].[FullName] <> N'Foo' ) AS [s1] ON [g].[Nickname] = [s1].[LeaderNickname] AND [g].[SquadId] = [s1].[LeaderSquadId] LEFT JOIN ( - SELECT [w1].[Id], [w1].[AmmunitionType], [w1].[IsAutomatic], [w1].[Name], [w1].[OwnerFullName], [w1].[SynergyWithId], [g5].[Nickname], [g5].[SquadId] + SELECT [w1].[Id], [w1].[AmmunitionType], [w1].[IsAutomatic], [w1].[Name], [w1].[OwnerFullName], [w1].[SynergyWithId], [g5].[Nickname] FROM [Weapons] AS [w1] LEFT JOIN [Gears] AS [g5] ON [w1].[OwnerFullName] = [g5].[FullName] ) AS [s2] ON [g1].[FullName] = [s2].[OwnerFullName] @@ -4071,7 +4066,7 @@ FROM [Weapons] AS [w1] SELECT 1 FROM [Gears] AS [g0] WHERE [g].[Nickname] = [g0].[LeaderNickname] AND [g].[SquadId] = [g0].[LeaderSquadId]) -ORDER BY [g].[HasSoulPatch] DESC, [t].[Note], [g].[Nickname], [g].[SquadId], [t].[Id], [g1].[Nickname], [g1].[SquadId], [s1].[Rank], [s1].[Nickname], [s1].[SquadId], [s1].[IsAutomatic0], [s1].[Id], [s1].[Nickname0], [s1].[SquadId0], [s1].[Id0], [s1].[Id1], [s1].[Nickname00], [s1].[SquadId00], [s2].[IsAutomatic], [s2].[Nickname] DESC, [s2].[Id] +ORDER BY [g].[HasSoulPatch] DESC, [t].[Note], [g].[Nickname], [g].[SquadId], [s1].[Rank], [s1].[Nickname], [s1].[SquadId], [s1].[IsAutomatic0], [s1].[Id], [s1].[Id0], [s1].[Nickname0], [s1].[SquadId0], [s2].[IsAutomatic], [s2].[Nickname] DESC """); } @@ -4327,7 +4322,7 @@ public override async Task Correlated_collections_deeply_nested_left_join(bool a AssertSql( """ -SELECT [t].[Id], [g].[Nickname], [g].[SquadId], [s].[Id], [s0].[Nickname], [s0].[SquadId], [s0].[Id], [s0].[AmmunitionType], [s0].[IsAutomatic], [s0].[Name], [s0].[OwnerFullName], [s0].[SynergyWithId] +SELECT [t].[Id], [g].[Nickname], [g].[SquadId], [s0].[Nickname], [s0].[SquadId], [s0].[Id], [s0].[AmmunitionType], [s0].[IsAutomatic], [s0].[Name], [s0].[OwnerFullName], [s0].[SynergyWithId] FROM [Tags] AS [t] LEFT JOIN [Gears] AS [g] ON [t].[GearNickName] = [g].[Nickname] LEFT JOIN [Squads] AS [s] ON [g].[SquadId] = [s].[Id] @@ -4341,7 +4336,7 @@ FROM [Weapons] AS [w] ) AS [w0] ON [g0].[FullName] = [w0].[OwnerFullName] WHERE [g0].[HasSoulPatch] = CAST(1 AS bit) ) AS [s0] ON [s].[Id] = [s0].[SquadId] -ORDER BY [t].[Note], [g].[Nickname] DESC, [t].[Id], [g].[SquadId], [s].[Id], [s0].[Nickname], [s0].[SquadId] +ORDER BY [t].[Note], [g].[Nickname] DESC, [t].[Id], [g].[SquadId], [s0].[Nickname], [s0].[SquadId] """); } @@ -4351,7 +4346,7 @@ public override async Task Correlated_collections_from_left_join_with_additional AssertSql( """ -SELECT [w].[Id], [g].[Nickname], [g].[SquadId], [s].[Id], [s0].[Nickname], [s0].[SquadId], [s0].[Id], [s0].[AmmunitionType], [s0].[IsAutomatic], [s0].[Name], [s0].[OwnerFullName], [s0].[SynergyWithId], [s0].[Rank] +SELECT [w].[Id], [s0].[Nickname], [s0].[SquadId], [s0].[Id], [s0].[AmmunitionType], [s0].[IsAutomatic], [s0].[Name], [s0].[OwnerFullName], [s0].[SynergyWithId], [s0].[Rank] FROM [Weapons] AS [w] LEFT JOIN [Gears] AS [g] ON [w].[OwnerFullName] = [g].[FullName] LEFT JOIN [Squads] AS [s] ON [g].[SquadId] = [s].[Id] @@ -4364,7 +4359,7 @@ FROM [Weapons] AS [w0] WHERE [w0].[IsAutomatic] = CAST(0 AS bit) ) AS [w1] ON [g0].[FullName] = [w1].[OwnerFullName] ) AS [s0] ON [s].[Id] = [s0].[SquadId] -ORDER BY [w].[Name], [w].[Id], [g].[Nickname], [g].[SquadId], [s].[Id], [s0].[FullName] DESC, [s0].[Nickname], [s0].[SquadId], [s0].[Id] +ORDER BY [w].[Name], [w].[Id], [s0].[FullName] DESC, [s0].[Nickname], [s0].[SquadId], [s0].[Id] """); } @@ -4374,16 +4369,16 @@ public override async Task Correlated_collections_complex_scenario1(bool async) AssertSql( """ -SELECT [g].[FullName], [g].[Nickname], [g].[SquadId], [s0].[Id], [s0].[Nickname], [s0].[SquadId], [s0].[Id0], [s0].[Nickname0], [s0].[HasSoulPatch], [s0].[SquadId0] +SELECT [g].[FullName], [g].[Nickname], [g].[SquadId], [s0].[Id], [s0].[Nickname], [s0].[HasSoulPatch], [s0].[SquadId] FROM [Gears] AS [g] LEFT JOIN ( - SELECT [w].[Id], [g0].[Nickname], [g0].[SquadId], [s].[Id] AS [Id0], [g1].[Nickname] AS [Nickname0], [g1].[HasSoulPatch], [g1].[SquadId] AS [SquadId0], [w].[OwnerFullName] + SELECT [w].[Id], [g1].[Nickname], [g1].[HasSoulPatch], [g1].[SquadId], [w].[OwnerFullName] FROM [Weapons] AS [w] LEFT JOIN [Gears] AS [g0] ON [w].[OwnerFullName] = [g0].[FullName] LEFT JOIN [Squads] AS [s] ON [g0].[SquadId] = [s].[Id] LEFT JOIN [Gears] AS [g1] ON [s].[Id] = [g1].[SquadId] ) AS [s0] ON [g].[FullName] = [s0].[OwnerFullName] -ORDER BY [g].[Nickname], [g].[SquadId], [s0].[Id], [s0].[Nickname], [s0].[SquadId], [s0].[Id0], [s0].[Nickname0] +ORDER BY [g].[Nickname], [g].[SquadId], [s0].[Id], [s0].[Nickname] """); } @@ -4393,13 +4388,13 @@ public override async Task Correlated_collections_complex_scenario2(bool async) AssertSql( """ -SELECT [g].[FullName], [g].[Nickname], [g].[SquadId], [s1].[FullName], [s1].[Nickname], [s1].[SquadId], [s1].[Id], [s1].[Nickname0], [s1].[SquadId0], [s1].[Id0], [s1].[Nickname00], [s1].[HasSoulPatch], [s1].[SquadId00] +SELECT [g].[FullName], [g].[Nickname], [g].[SquadId], [s1].[FullName], [s1].[Nickname], [s1].[SquadId], [s1].[Id], [s1].[Nickname0], [s1].[HasSoulPatch], [s1].[SquadId0] FROM [Gears] AS [g] LEFT JOIN ( - SELECT [g0].[FullName], [g0].[Nickname], [g0].[SquadId], [s0].[Id], [s0].[Nickname] AS [Nickname0], [s0].[SquadId] AS [SquadId0], [s0].[Id0], [s0].[Nickname0] AS [Nickname00], [s0].[HasSoulPatch], [s0].[SquadId0] AS [SquadId00], [g0].[LeaderNickname], [g0].[LeaderSquadId] + SELECT [g0].[FullName], [g0].[Nickname], [g0].[SquadId], [s0].[Id], [s0].[Nickname] AS [Nickname0], [s0].[HasSoulPatch], [s0].[SquadId] AS [SquadId0], [g0].[LeaderNickname], [g0].[LeaderSquadId] FROM [Gears] AS [g0] LEFT JOIN ( - SELECT [w].[Id], [g1].[Nickname], [g1].[SquadId], [s].[Id] AS [Id0], [g2].[Nickname] AS [Nickname0], [g2].[HasSoulPatch], [g2].[SquadId] AS [SquadId0], [w].[OwnerFullName] + SELECT [w].[Id], [g2].[Nickname], [g2].[HasSoulPatch], [g2].[SquadId], [w].[OwnerFullName] FROM [Weapons] AS [w] LEFT JOIN [Gears] AS [g1] ON [w].[OwnerFullName] = [g1].[FullName] LEFT JOIN [Squads] AS [s] ON [g1].[SquadId] = [s].[Id] @@ -4407,7 +4402,7 @@ FROM [Weapons] AS [w] ) AS [s0] ON [g0].[FullName] = [s0].[OwnerFullName] ) AS [s1] ON [g].[Nickname] = [s1].[LeaderNickname] AND [g].[SquadId] = [s1].[LeaderSquadId] WHERE [g].[Discriminator] = N'Officer' -ORDER BY [g].[Nickname], [g].[SquadId], [s1].[Nickname], [s1].[SquadId], [s1].[Id], [s1].[Nickname0], [s1].[SquadId0], [s1].[Id0], [s1].[Nickname00] +ORDER BY [g].[Nickname], [g].[SquadId], [s1].[Nickname], [s1].[SquadId], [s1].[Id], [s1].[Nickname0] """); } @@ -4417,16 +4412,16 @@ public override async Task Correlated_collections_with_funky_orderby_complex_sce AssertSql( """ -SELECT [g].[FullName], [g].[Nickname], [g].[SquadId], [s0].[Id], [s0].[Nickname], [s0].[SquadId], [s0].[Id0], [s0].[Nickname0], [s0].[HasSoulPatch], [s0].[SquadId0] +SELECT [g].[FullName], [g].[Nickname], [g].[SquadId], [s0].[Id], [s0].[Nickname], [s0].[HasSoulPatch], [s0].[SquadId] FROM [Gears] AS [g] LEFT JOIN ( - SELECT [w].[Id], [g0].[Nickname], [g0].[SquadId], [s].[Id] AS [Id0], [g1].[Nickname] AS [Nickname0], [g1].[HasSoulPatch], [g1].[SquadId] AS [SquadId0], [w].[OwnerFullName] + SELECT [w].[Id], [g1].[Nickname], [g1].[HasSoulPatch], [g1].[SquadId], [w].[OwnerFullName] FROM [Weapons] AS [w] LEFT JOIN [Gears] AS [g0] ON [w].[OwnerFullName] = [g0].[FullName] LEFT JOIN [Squads] AS [s] ON [g0].[SquadId] = [s].[Id] LEFT JOIN [Gears] AS [g1] ON [s].[Id] = [g1].[SquadId] ) AS [s0] ON [g].[FullName] = [s0].[OwnerFullName] -ORDER BY [g].[FullName], [g].[Nickname] DESC, [g].[SquadId], [s0].[Id], [s0].[Nickname], [s0].[SquadId], [s0].[Id0], [s0].[Nickname0] +ORDER BY [g].[FullName], [g].[Nickname] DESC, [g].[SquadId], [s0].[Id], [s0].[Nickname] """); } @@ -4436,13 +4431,13 @@ public override async Task Correlated_collections_with_funky_orderby_complex_sce AssertSql( """ -SELECT [g].[FullName], [g].[Nickname], [g].[SquadId], [s1].[FullName], [s1].[Nickname], [s1].[SquadId], [s1].[Id], [s1].[Nickname0], [s1].[SquadId0], [s1].[Id0], [s1].[Nickname00], [s1].[HasSoulPatch], [s1].[SquadId00] +SELECT [g].[FullName], [g].[Nickname], [g].[SquadId], [s1].[FullName], [s1].[Nickname], [s1].[SquadId], [s1].[Id], [s1].[Nickname0], [s1].[HasSoulPatch], [s1].[SquadId0] FROM [Gears] AS [g] LEFT JOIN ( - SELECT [g0].[FullName], [g0].[Nickname], [g0].[SquadId], [s0].[Id], [s0].[Nickname] AS [Nickname0], [s0].[SquadId] AS [SquadId0], [s0].[Id0], [s0].[Nickname0] AS [Nickname00], [s0].[HasSoulPatch], [s0].[SquadId0] AS [SquadId00], [g0].[HasSoulPatch] AS [HasSoulPatch0], [s0].[IsAutomatic], [s0].[Name], [g0].[LeaderNickname], [g0].[LeaderSquadId] + SELECT [g0].[FullName], [g0].[Nickname], [g0].[SquadId], [s0].[Id], [s0].[Nickname] AS [Nickname0], [s0].[HasSoulPatch], [s0].[SquadId] AS [SquadId0], [g0].[HasSoulPatch] AS [HasSoulPatch0], [s0].[IsAutomatic], [s0].[Name], [g0].[LeaderNickname], [g0].[LeaderSquadId] FROM [Gears] AS [g0] LEFT JOIN ( - SELECT [w].[Id], [g1].[Nickname], [g1].[SquadId], [s].[Id] AS [Id0], [g2].[Nickname] AS [Nickname0], [g2].[HasSoulPatch], [g2].[SquadId] AS [SquadId0], [w].[IsAutomatic], [w].[Name], [w].[OwnerFullName] + SELECT [w].[Id], [g2].[Nickname], [g2].[HasSoulPatch], [g2].[SquadId], [w].[IsAutomatic], [w].[Name], [w].[OwnerFullName] FROM [Weapons] AS [w] LEFT JOIN [Gears] AS [g1] ON [w].[OwnerFullName] = [g1].[FullName] LEFT JOIN [Squads] AS [s] ON [g1].[SquadId] = [s].[Id] @@ -4450,7 +4445,7 @@ FROM [Weapons] AS [w] ) AS [s0] ON [g0].[FullName] = [s0].[OwnerFullName] ) AS [s1] ON [g].[Nickname] = [s1].[LeaderNickname] AND [g].[SquadId] = [s1].[LeaderSquadId] WHERE [g].[Discriminator] = N'Officer' -ORDER BY [g].[HasSoulPatch], [g].[LeaderNickname], [g].[FullName], [g].[Nickname], [g].[SquadId], [s1].[FullName], [s1].[HasSoulPatch0] DESC, [s1].[Nickname], [s1].[SquadId], [s1].[IsAutomatic], [s1].[Name] DESC, [s1].[Id], [s1].[Nickname0], [s1].[SquadId0], [s1].[Id0], [s1].[Nickname00] +ORDER BY [g].[HasSoulPatch], [g].[LeaderNickname], [g].[FullName], [g].[Nickname], [g].[SquadId], [s1].[FullName], [s1].[HasSoulPatch0] DESC, [s1].[Nickname], [s1].[SquadId], [s1].[IsAutomatic], [s1].[Name] DESC, [s1].[Id], [s1].[Nickname0] """); } @@ -4558,16 +4553,16 @@ public override async Task Include_on_derived_type_with_order_by_and_paging(bool """ @p='10' -SELECT [s].[Name], [s].[Discriminator], [s].[LocustHordeId], [s].[ThreatLevel], [s].[ThreatLevelByte], [s].[ThreatLevelNullableByte], [s].[DefeatedByNickname], [s].[DefeatedBySquadId], [s].[HighCommandId], [s].[Nickname], [s].[SquadId], [s].[AssignedCityName], [s].[CityOfBirthName], [s].[Discriminator0], [s].[FullName], [s].[HasSoulPatch], [s].[LeaderNickname], [s].[LeaderSquadId], [s].[Rank], [s].[Id], [w].[Id], [w].[AmmunitionType], [w].[IsAutomatic], [w].[Name], [w].[OwnerFullName], [w].[SynergyWithId] +SELECT [s].[Name], [s].[Discriminator], [s].[LocustHordeId], [s].[ThreatLevel], [s].[ThreatLevelByte], [s].[ThreatLevelNullableByte], [s].[DefeatedByNickname], [s].[DefeatedBySquadId], [s].[HighCommandId], [s].[Nickname], [s].[SquadId], [s].[AssignedCityName], [s].[CityOfBirthName], [s].[Discriminator0], [s].[FullName], [s].[HasSoulPatch], [s].[LeaderNickname], [s].[LeaderSquadId], [s].[Rank], [w].[Id], [w].[AmmunitionType], [w].[IsAutomatic], [w].[Name], [w].[OwnerFullName], [w].[SynergyWithId] FROM ( - SELECT TOP(@p) [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] + SELECT TOP(@p) [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].[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)) ORDER BY [t].[Note] ) AS [s] LEFT JOIN [Weapons] AS [w] ON [s].[FullName] = [w].[OwnerFullName] -ORDER BY [s].[Note], [s].[Name], [s].[Nickname], [s].[SquadId], [s].[Id] +ORDER BY [s].[Note], [s].[Name] """); } @@ -4614,15 +4609,15 @@ public override async Task Outer_parameter_in_join_key(bool async) AssertSql( """ -SELECT [g].[Nickname], [g].[SquadId], [s].[Note], [s].[Id], [s].[Nickname], [s].[SquadId] +SELECT [g].[Nickname], [g].[SquadId], [s].[Note], [s].[Id] FROM [Gears] AS [g] OUTER APPLY ( - SELECT [t].[Note], [t].[Id], [g0].[Nickname], [g0].[SquadId] + SELECT [t].[Note], [t].[Id] FROM [Tags] AS [t] INNER JOIN [Gears] AS [g0] ON [g].[FullName] = [g0].[FullName] ) AS [s] WHERE [g].[Discriminator] = N'Officer' -ORDER BY [g].[Nickname], [g].[SquadId], [s].[Id], [s].[Nickname] +ORDER BY [g].[Nickname], [g].[SquadId] """); } @@ -4650,15 +4645,14 @@ public override async Task Outer_parameter_in_group_join_with_DefaultIfEmpty(boo AssertSql( """ -SELECT [g].[Nickname], [g].[SquadId], [s].[Note], [s].[Id], [s].[Nickname], [s].[SquadId] +SELECT [g].[Nickname], [g].[SquadId], [s].[Note], [s].[Id] FROM [Gears] AS [g] OUTER APPLY ( - SELECT [t].[Note], [t].[Id], [g0].[Nickname], [g0].[SquadId] + SELECT [t].[Note], [t].[Id] FROM [Tags] AS [t] - LEFT JOIN [Gears] AS [g0] ON [g].[FullName] = [g0].[FullName] ) AS [s] WHERE [g].[Discriminator] = N'Officer' -ORDER BY [g].[Nickname], [g].[SquadId], [s].[Id], [s].[Nickname] +ORDER BY [g].[Nickname], [g].[SquadId] """); } @@ -5732,7 +5726,7 @@ GROUP BY [g].[Rank] LEFT JOIN ( SELECT [s].[Nickname], [s].[SquadId], [s].[AssignedCityName], [s].[CityOfBirthName], [s].[Discriminator], [s].[FullName], [s].[HasSoulPatch], [s].[LeaderNickname], [s].[LeaderSquadId], [s].[Rank], [s].[Name], [s].[Location], [s].[Nation] FROM ( - 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], ROW_NUMBER() OVER(PARTITION BY [g0].[Rank] ORDER BY [g0].[Nickname], [g0].[SquadId], [c].[Name]) AS [row] + 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], ROW_NUMBER() OVER(PARTITION BY [g0].[Rank] ORDER BY [g0].[Nickname], [g0].[SquadId]) AS [row] FROM [Gears] AS [g0] INNER JOIN [Cities] AS [c] ON [g0].[CityOfBirthName] = [c].[Name] WHERE [g0].[HasSoulPatch] = CAST(1 AS bit) @@ -6200,7 +6194,7 @@ public override async Task Project_collection_navigation_nested_with_take_compos AssertSql( """ -SELECT [t].[Id], [g].[Nickname], [g].[SquadId], [g2].[Nickname], [g2].[SquadId], [g2].[AssignedCityName], [g2].[CityOfBirthName], [g2].[Discriminator], [g2].[FullName], [g2].[HasSoulPatch], [g2].[LeaderNickname], [g2].[LeaderSquadId], [g2].[Rank] +SELECT [t].[Id], [g2].[Nickname], [g2].[SquadId], [g2].[AssignedCityName], [g2].[CityOfBirthName], [g2].[Discriminator], [g2].[FullName], [g2].[HasSoulPatch], [g2].[LeaderNickname], [g2].[LeaderSquadId], [g2].[Rank] FROM [Tags] AS [t] LEFT JOIN [Gears] AS [g] ON [t].[GearNickName] = [g].[Nickname] AND [t].[GearSquadId] = [g].[SquadId] LEFT JOIN ( @@ -6212,7 +6206,7 @@ FROM [Gears] AS [g0] WHERE [g1].[row] <= 50 ) AS [g2] ON ([g].[Nickname] = [g2].[LeaderNickname] OR ([g].[Nickname] IS NULL AND [g2].[LeaderNickname] IS NULL)) AND [g].[SquadId] = [g2].[LeaderSquadId] WHERE [g].[Discriminator] = N'Officer' -ORDER BY [t].[Id], [g].[Nickname], [g].[SquadId], [g2].[Nickname] +ORDER BY [t].[Id], [g2].[Nickname] """); } @@ -6222,12 +6216,12 @@ public override async Task Project_collection_navigation_nested_composite_key(bo AssertSql( """ -SELECT [t].[Id], [g].[Nickname], [g].[SquadId], [g0].[Nickname], [g0].[SquadId], [g0].[AssignedCityName], [g0].[CityOfBirthName], [g0].[Discriminator], [g0].[FullName], [g0].[HasSoulPatch], [g0].[LeaderNickname], [g0].[LeaderSquadId], [g0].[Rank] +SELECT [t].[Id], [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] WHERE [g].[Discriminator] = N'Officer' -ORDER BY [t].[Id], [g].[Nickname], [g].[SquadId], [g0].[Nickname] +ORDER BY [t].[Id], [g0].[Nickname] """); } @@ -6564,14 +6558,14 @@ public override async Task Accessing_reference_navigation_collection_composition AssertSql( """ -SELECT [g].[Nickname], [g].[SquadId], [s].[Id], [s].[IsAutomatic], [s].[Name], [s].[Id0] +SELECT [g].[Nickname], [g].[SquadId], [s].[Id], [s].[IsAutomatic], [s].[Name] FROM [Gears] AS [g] LEFT JOIN ( - SELECT [w].[Id], [w].[IsAutomatic], [w0].[Name], [w0].[Id] AS [Id0], [w].[OwnerFullName] + SELECT [w].[Id], [w].[IsAutomatic], [w0].[Name], [w].[OwnerFullName] FROM [Weapons] AS [w] LEFT JOIN [Weapons] AS [w0] ON [w].[SynergyWithId] = [w0].[Id] ) AS [s] ON [g].[FullName] = [s].[OwnerFullName] -ORDER BY [g].[Nickname], [g].[SquadId], [s].[Id] +ORDER BY [g].[Nickname], [g].[SquadId] """); } @@ -6598,15 +6592,15 @@ public override async Task Accessing_property_of_optional_navigation_in_child_pr SELECT CASE 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], [s].[Nickname], [s].[Id], [s].[SquadId] +END, [t].[Id], [s].[Nickname], [s].[Id] FROM [Tags] AS [t] LEFT JOIN [Gears] AS [g] ON [t].[GearNickName] = [g].[Nickname] AND [t].[GearSquadId] = [g].[SquadId] LEFT JOIN ( - SELECT [g0].[Nickname], [w].[Id], [g0].[SquadId], [w].[OwnerFullName] + SELECT [g0].[Nickname], [w].[Id], [w].[OwnerFullName] FROM [Weapons] AS [w] LEFT JOIN [Gears] AS [g0] ON [w].[OwnerFullName] = [g0].[FullName] ) AS [s] ON [g].[FullName] = [s].[OwnerFullName] -ORDER BY [t].[Note], [t].[Id], [g].[Nickname], [g].[SquadId], [s].[Id], [s].[Nickname] +ORDER BY [t].[Note], [t].[Id] """); } @@ -6773,7 +6767,6 @@ public override async Task Left_join_with_GroupBy_with_composite_group_key(bool """ SELECT [g].[CityOfBirthName], [g].[HasSoulPatch] FROM [Gears] AS [g] -INNER JOIN [Squads] AS [s] ON [g].[SquadId] = [s].[Id] LEFT JOIN [Tags] AS [t] ON [g].[Nickname] = [t].[GearNickName] GROUP BY [g].[CityOfBirthName], [g].[HasSoulPatch] """); @@ -7720,7 +7713,7 @@ public override async Task Correlated_collection_take(bool async) AssertSql( """ -SELECT [g].[Nickname], [g].[SquadId], [c].[Name], [w1].[Id], [w1].[AmmunitionType], [w1].[IsAutomatic], [w1].[Name], [w1].[OwnerFullName], [w1].[SynergyWithId], [c].[Location], [c].[Nation] +SELECT [g].[Nickname], [g].[SquadId], [w1].[Id], [w1].[AmmunitionType], [w1].[IsAutomatic], [w1].[Name], [w1].[OwnerFullName], [w1].[SynergyWithId], [c].[Name], [c].[Location], [c].[Nation] FROM [Gears] AS [g] INNER JOIN [Cities] AS [c] ON [g].[CityOfBirthName] = [c].[Name] LEFT JOIN ( @@ -7731,7 +7724,7 @@ FROM [Weapons] AS [w] ) AS [w0] WHERE [w0].[row] <= 10 ) AS [w1] ON [g].[FullName] = [w1].[OwnerFullName] -ORDER BY [g].[Nickname], [g].[SquadId], [c].[Name] +ORDER BY [g].[Nickname], [g].[SquadId] """); } @@ -8568,7 +8561,7 @@ FROM [LocustLeaders] AS [l] LEFT JOIN [Gears] AS [g] ON [l].[DefeatedByNickname] = [g].[Nickname] AND [l].[DefeatedBySquadId] = [g].[SquadId] LEFT JOIN [Weapons] AS [w] ON [g].[FullName] = [w].[OwnerFullName] WHERE [l].[Name] LIKE N'%Queen%' -ORDER BY [l].[Name], [g].[Nickname], [g].[SquadId] +ORDER BY [l].[Name] """); } @@ -8627,7 +8620,7 @@ FROM [Weapons] AS [w0] ) AS [w1] WHERE [w1].[row] <= 1 ) AS [w2] ON [g].[FullName] = [w2].[OwnerFullName] -ORDER BY [g].[Nickname], [g].[SquadId], [s].[Id] +ORDER BY [g].[Nickname], [g].[SquadId] """); } diff --git a/test/EFCore.SqlServer.FunctionalTests/Query/Inheritance/TPCGearsOfWarQuerySqlServerTest.cs b/test/EFCore.SqlServer.FunctionalTests/Query/Inheritance/TPCGearsOfWarQuerySqlServerTest.cs index da1f9dcabb9..ca1c14a3aa8 100644 --- a/test/EFCore.SqlServer.FunctionalTests/Query/Inheritance/TPCGearsOfWarQuerySqlServerTest.cs +++ b/test/EFCore.SqlServer.FunctionalTests/Query/Inheritance/TPCGearsOfWarQuerySqlServerTest.cs @@ -65,7 +65,7 @@ UNION ALL FROM [Officers] AS [o] ) AS [u] ON [t].[GearNickName] = [u].[Nickname] AND [t].[GearSquadId] = [u].[SquadId] LEFT JOIN [Weapons] AS [w] ON [u].[FullName] = [w].[OwnerFullName] -ORDER BY [t].[Id], [u].[Nickname], [u].[SquadId] +ORDER BY [t].[Id] """); } @@ -110,7 +110,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 [u0] ON [c].[Name] = [u0].[AssignedCityName] -ORDER BY [u].[Nickname], [u].[SquadId], [c].[Name], [u0].[Nickname] +ORDER BY [u].[Nickname], [u].[SquadId], [u0].[Nickname] """); } @@ -137,7 +137,7 @@ UNION ALL FROM [Officers] AS [o0] ) AS [u0] ON [c].[Name] = [u0].[AssignedCityName] WHERE [u].[Nickname] = N'Marcus' -ORDER BY [u].[Nickname], [u].[SquadId], [c].[Name], [u0].[Nickname] +ORDER BY [u].[Nickname], [u].[SquadId], [u0].[Nickname] """); } @@ -431,7 +431,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 [u0] ON [c].[Name] = [u0].[AssignedCityName] -ORDER BY [u].[Nickname], [u].[SquadId], [t].[Id], [c].[Name], [u0].[Nickname] +ORDER BY [u].[Nickname], [u].[SquadId], [t].[Id], [u0].[Nickname] """); } @@ -1963,11 +1963,6 @@ FROM [Officers] AS [o] WHERE [u].[HasSoulPatch] = CAST(1 AS bit) AND ( SELECT TOP(1) [w].[IsAutomatic] FROM [Weapons] AS [w] - LEFT JOIN ( - SELECT [w0].[Id] - FROM [Weapons] AS [w0] - WHERE [u].[FullName] = [w0].[OwnerFullName] - ) AS [w1] ON [w].[Id] = [w1].[Id] WHERE [u].[FullName] = [w].[OwnerFullName] ORDER BY [w].[Id]) = CAST(1 AS bit) """); @@ -3121,7 +3116,7 @@ public override async Task Select_correlated_filtered_collection(bool async) AssertSql( """ -SELECT [u].[Nickname], [u].[SquadId], [c].[Name], [w0].[Id], [w0].[AmmunitionType], [w0].[IsAutomatic], [w0].[Name], [w0].[OwnerFullName], [w0].[SynergyWithId] +SELECT [u].[Nickname], [u].[SquadId], [w0].[Id], [w0].[AmmunitionType], [w0].[IsAutomatic], [w0].[Name], [w0].[OwnerFullName], [w0].[SynergyWithId] FROM ( SELECT [g].[Nickname], [g].[SquadId], [g].[CityOfBirthName], [g].[FullName] FROM [Gears] AS [g] @@ -3136,7 +3131,7 @@ FROM [Weapons] AS [w] WHERE [w].[Name] <> N'Lancer' OR [w].[Name] IS NULL ) AS [w0] ON [u].[FullName] = [w0].[OwnerFullName] WHERE [c].[Name] IN (N'Ephyra', N'Hanover') -ORDER BY [u].[Nickname], [u].[SquadId], [c].[Name] +ORDER BY [u].[Nickname], [u].[SquadId] """); } @@ -3985,7 +3980,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 [u] ON [l].[Id] = [u].[LocustHordeId] -ORDER BY [l].[Name], [l].[Id], [l0].[Name] +ORDER BY [l].[Name], [l].[Id] """); } @@ -4174,7 +4169,7 @@ public override async Task Project_collection_navigation_with_inheritance1(bool AssertSql( """ -SELECT [l].[Id], [l0].[Name], [l1].[Id], [u].[Name], [u].[LocustHordeId], [u].[ThreatLevel], [u].[ThreatLevelByte], [u].[ThreatLevelNullableByte], [u].[DefeatedByNickname], [u].[DefeatedBySquadId], [u].[HighCommandId], [u].[Discriminator] +SELECT [l].[Id], [u].[Name], [u].[LocustHordeId], [u].[ThreatLevel], [u].[ThreatLevelByte], [u].[ThreatLevelNullableByte], [u].[DefeatedByNickname], [u].[DefeatedBySquadId], [u].[HighCommandId], [u].[Discriminator] FROM [LocustHordes] AS [l] LEFT JOIN [LocustCommanders] AS [l0] ON [l].[CommanderName] = [l0].[Name] LEFT JOIN [LocustHordes] AS [l1] ON [l0].[Name] = [l1].[CommanderName] @@ -4185,7 +4180,7 @@ UNION ALL SELECT [l3].[Name], [l3].[LocustHordeId], [l3].[ThreatLevel], [l3].[ThreatLevelByte], [l3].[ThreatLevelNullableByte], [l3].[DefeatedByNickname], [l3].[DefeatedBySquadId], [l3].[HighCommandId], N'LocustCommander' AS [Discriminator] FROM [LocustCommanders] AS [l3] ) AS [u] ON [l1].[Id] = [u].[LocustHordeId] -ORDER BY [l].[Id], [l0].[Name], [l1].[Id] +ORDER BY [l].[Id] """); } @@ -4195,7 +4190,7 @@ public override async Task Project_collection_navigation_with_inheritance2(bool AssertSql( """ -SELECT [l].[Id], [l0].[Name], [u].[Nickname], [u].[SquadId], [u0].[Nickname], [u0].[SquadId], [u0].[AssignedCityName], [u0].[CityOfBirthName], [u0].[FullName], [u0].[HasSoulPatch], [u0].[LeaderNickname], [u0].[LeaderSquadId], [u0].[Rank], [u0].[Discriminator] +SELECT [l].[Id], [u0].[Nickname], [u0].[SquadId], [u0].[AssignedCityName], [u0].[CityOfBirthName], [u0].[FullName], [u0].[HasSoulPatch], [u0].[LeaderNickname], [u0].[LeaderSquadId], [u0].[Rank], [u0].[Discriminator] FROM [LocustHordes] AS [l] LEFT JOIN [LocustCommanders] AS [l0] ON [l].[CommanderName] = [l0].[Name] LEFT JOIN ( @@ -4212,7 +4207,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 [u0] ON ([u].[Nickname] = [u0].[LeaderNickname] OR ([u].[Nickname] IS NULL AND [u0].[LeaderNickname] IS NULL)) AND [u].[SquadId] = [u0].[LeaderSquadId] -ORDER BY [l].[Id], [l0].[Name], [u].[Nickname], [u].[SquadId], [u0].[Nickname] +ORDER BY [l].[Id], [u0].[Nickname] """); } @@ -4222,7 +4217,7 @@ public override async Task Project_collection_navigation_with_inheritance3(bool AssertSql( """ -SELECT [l].[Id], [l0].[Name], [u].[Nickname], [u].[SquadId], [u0].[Nickname], [u0].[SquadId], [u0].[AssignedCityName], [u0].[CityOfBirthName], [u0].[FullName], [u0].[HasSoulPatch], [u0].[LeaderNickname], [u0].[LeaderSquadId], [u0].[Rank], [u0].[Discriminator] +SELECT [l].[Id], [u0].[Nickname], [u0].[SquadId], [u0].[AssignedCityName], [u0].[CityOfBirthName], [u0].[FullName], [u0].[HasSoulPatch], [u0].[LeaderNickname], [u0].[LeaderSquadId], [u0].[Rank], [u0].[Discriminator] FROM [LocustHordes] AS [l] LEFT JOIN [LocustCommanders] AS [l0] ON [l].[CommanderName] = [l0].[Name] LEFT JOIN ( @@ -4239,7 +4234,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 [u0] ON ([u].[Nickname] = [u0].[LeaderNickname] OR ([u].[Nickname] IS NULL AND [u0].[LeaderNickname] IS NULL)) AND [u].[SquadId] = [u0].[LeaderSquadId] -ORDER BY [l].[Id], [l0].[Name], [u].[Nickname], [u].[SquadId], [u0].[Nickname] +ORDER BY [l].[Id], [u0].[Nickname] """); } @@ -4324,7 +4319,7 @@ FROM [Officers] AS [o0] ) AS [u1] INNER JOIN [Cities] AS [c] ON [u1].[CityOfBirthName] = [c].[Name] ) AS [s] ON ([u0].[Nickname] = [s].[LeaderNickname] OR ([u0].[Nickname] IS NULL AND [s].[LeaderNickname] IS NULL)) AND [u0].[SquadId] = [s].[LeaderSquadId] -ORDER BY [u].[Name], [u0].[Nickname], [u0].[SquadId], [s].[Nickname], [s].[SquadId] +ORDER BY [u].[Name], [s].[Nickname] """); } @@ -4491,7 +4486,7 @@ FROM [Officers] AS [o] ) AS [u] LEFT JOIN [Tags] AS [t] ON [u].[Nickname] = [t].[GearNickName] AND [u].[SquadId] = [t].[GearSquadId] LEFT JOIN [Weapons] AS [w] ON [u].[FullName] = [w].[OwnerFullName] -ORDER BY [u].[Nickname], [u].[SquadId], [t].[Id] +ORDER BY [u].[Nickname], [u].[SquadId] """); } @@ -4511,7 +4506,7 @@ UNION ALL FROM [Officers] AS [o] ) AS [u] ON [t].[GearNickName] = [u].[Nickname] AND [t].[GearSquadId] = [u].[SquadId] LEFT JOIN [Weapons] AS [w] ON [u].[FullName] = [w].[OwnerFullName] -ORDER BY [t].[Id], [u].[Nickname], [u].[SquadId] +ORDER BY [t].[Id] """); } @@ -4538,7 +4533,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 [u0] ON ([u].[Nickname] = [u0].[LeaderNickname] OR ([u].[Nickname] IS NULL AND [u0].[LeaderNickname] IS NULL)) AND [u].[SquadId] = [u0].[LeaderSquadId] -ORDER BY [l].[Id], [l0].[Name], [u].[Nickname], [u].[SquadId], [u0].[Nickname] +ORDER BY [l].[Id], [u0].[Nickname] """); } @@ -4602,7 +4597,7 @@ UNION ALL FROM [Officers] AS [o] ) AS [u0] ON [u].[DefeatedByNickname] = [u0].[Nickname] AND [u].[DefeatedBySquadId] = [u0].[SquadId] ) AS [s] ON [l].[Id] = [s].[LocustHordeId] -ORDER BY [l].[Id], [s].[Name], [s].[Nickname] +ORDER BY [l].[Id] """); } @@ -4629,7 +4624,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 [u0] ON ([u].[Nickname] = [u0].[LeaderNickname] OR ([u].[Nickname] IS NULL AND [u0].[LeaderNickname] IS NULL)) AND [u].[SquadId] = [u0].[LeaderSquadId] -ORDER BY [l].[Id], [l0].[Name], [u].[Nickname], [u].[SquadId], [u0].[Nickname] +ORDER BY [l].[Id], [u0].[Nickname] """); } @@ -4659,7 +4654,7 @@ FROM [Officers] AS [o0] INNER JOIN [Squads] AS [s] ON [u0].[SquadId] = [s].[Id] LEFT JOIN [SquadMissions] AS [s0] ON [s].[Id] = [s0].[SquadId] ) AS [s1] ON [u].[Nickname] = [s1].[LeaderNickname] AND [u].[SquadId] = [s1].[LeaderSquadId] -ORDER BY [u].[Nickname], [u].[SquadId], [s1].[Nickname], [s1].[SquadId], [s1].[Id], [s1].[SquadId0] +ORDER BY [u].[Nickname], [u].[SquadId], [s1].[Nickname], [s1].[SquadId], [s1].[SquadId0] """); } @@ -5018,7 +5013,7 @@ public override async Task Correlated_collections_projection_of_collection_thru_ AssertSql( """ -SELECT [u].[Nickname], [u].[SquadId], [s].[Id], [s1].[SquadId], [s1].[MissionId] +SELECT [u].[Nickname], [u].[SquadId], [s1].[SquadId], [s1].[MissionId] FROM ( SELECT [g].[Nickname], [g].[SquadId], [g].[FullName] FROM [Gears] AS [g] @@ -5033,7 +5028,7 @@ FROM [SquadMissions] AS [s0] WHERE [s0].[MissionId] <> 17 ) AS [s1] ON [s].[Id] = [s1].[SquadId] WHERE [u].[Nickname] <> N'Marcus' -ORDER BY [u].[FullName], [u].[Nickname], [u].[SquadId], [s].[Id], [s1].[SquadId] +ORDER BY [u].[FullName], [u].[Nickname], [u].[SquadId], [s1].[SquadId] """); } @@ -5063,10 +5058,10 @@ public override async Task Correlated_collections_nested(bool async) AssertSql( """ -SELECT [s].[Id], [s3].[SquadId], [s3].[MissionId], [s3].[Id], [s3].[SquadId0], [s3].[MissionId0] +SELECT [s].[Id], [s3].[SquadId], [s3].[MissionId], [s3].[SquadId0], [s3].[MissionId0] FROM [Squads] AS [s] LEFT JOIN ( - SELECT [s0].[SquadId], [s0].[MissionId], [m].[Id], [s2].[SquadId] AS [SquadId0], [s2].[MissionId] AS [MissionId0] + SELECT [s0].[SquadId], [s0].[MissionId], [s2].[SquadId] AS [SquadId0], [s2].[MissionId] AS [MissionId0] FROM [SquadMissions] AS [s0] INNER JOIN [Missions] AS [m] ON [s0].[MissionId] = [m].[Id] LEFT JOIN ( @@ -5076,7 +5071,7 @@ WHERE [s1].[SquadId] < 7 ) AS [s2] ON [m].[Id] = [s2].[MissionId] WHERE [s0].[MissionId] < 42 ) AS [s3] ON [s].[Id] = [s3].[SquadId] -ORDER BY [s].[Id], [s3].[SquadId], [s3].[MissionId], [s3].[Id], [s3].[SquadId0] +ORDER BY [s].[Id], [s3].[SquadId], [s3].[MissionId], [s3].[SquadId0] """); } @@ -5086,10 +5081,10 @@ public override async Task Correlated_collections_nested_mixed_streaming_with_bu AssertSql( """ -SELECT [s].[Id], [s3].[SquadId], [s3].[MissionId], [s3].[Id], [s3].[SquadId0], [s3].[MissionId0] +SELECT [s].[Id], [s3].[SquadId], [s3].[MissionId], [s3].[SquadId0], [s3].[MissionId0] FROM [Squads] AS [s] LEFT JOIN ( - SELECT [s0].[SquadId], [s0].[MissionId], [m].[Id], [s2].[SquadId] AS [SquadId0], [s2].[MissionId] AS [MissionId0] + SELECT [s0].[SquadId], [s0].[MissionId], [s2].[SquadId] AS [SquadId0], [s2].[MissionId] AS [MissionId0] FROM [SquadMissions] AS [s0] INNER JOIN [Missions] AS [m] ON [s0].[MissionId] = [m].[Id] LEFT JOIN ( @@ -5099,7 +5094,7 @@ WHERE [s1].[SquadId] < 2 ) AS [s2] ON [m].[Id] = [s2].[MissionId] WHERE [s0].[MissionId] < 3 ) AS [s3] ON [s].[Id] = [s3].[SquadId] -ORDER BY [s].[Id], [s3].[SquadId], [s3].[MissionId], [s3].[Id], [s3].[SquadId0] +ORDER BY [s].[Id], [s3].[SquadId], [s3].[MissionId], [s3].[SquadId0] """); } @@ -5109,10 +5104,10 @@ public override async Task Correlated_collections_nested_mixed_streaming_with_bu AssertSql( """ -SELECT [s].[Id], [s3].[SquadId], [s3].[MissionId], [s3].[Id], [s3].[SquadId0], [s3].[MissionId0] +SELECT [s].[Id], [s3].[SquadId], [s3].[MissionId], [s3].[SquadId0], [s3].[MissionId0] FROM [Squads] AS [s] LEFT JOIN ( - SELECT [s0].[SquadId], [s0].[MissionId], [m].[Id], [s2].[SquadId] AS [SquadId0], [s2].[MissionId] AS [MissionId0] + SELECT [s0].[SquadId], [s0].[MissionId], [s2].[SquadId] AS [SquadId0], [s2].[MissionId] AS [MissionId0] FROM [SquadMissions] AS [s0] INNER JOIN [Missions] AS [m] ON [s0].[MissionId] = [m].[Id] LEFT JOIN ( @@ -5122,7 +5117,7 @@ WHERE [s1].[SquadId] < 7 ) AS [s2] ON [m].[Id] = [s2].[MissionId] WHERE [s0].[MissionId] < 42 ) AS [s3] ON [s].[Id] = [s3].[SquadId] -ORDER BY [s].[Id], [s3].[SquadId], [s3].[MissionId], [s3].[Id], [s3].[SquadId0] +ORDER BY [s].[Id], [s3].[SquadId], [s3].[MissionId], [s3].[SquadId0] """); } @@ -5272,7 +5267,7 @@ public override async Task Multiple_orderby_with_navigation_expansion_on_one_of_ AssertSql( """ -SELECT [u].[FullName], [u].[Nickname], [u].[SquadId], [t].[Id], [u1].[Nickname], [u1].[SquadId], [s].[Id], [s].[AmmunitionType], [s].[IsAutomatic], [s].[Name], [s].[OwnerFullName], [s].[SynergyWithId], [s].[Nickname], [s].[SquadId] +SELECT [u].[FullName], [u].[Nickname], [u].[SquadId], [s].[Id], [s].[AmmunitionType], [s].[IsAutomatic], [s].[Name], [s].[OwnerFullName], [s].[SynergyWithId] FROM ( SELECT [o].[Nickname], [o].[SquadId], [o].[FullName], [o].[HasSoulPatch] FROM [Officers] AS [o] @@ -5286,13 +5281,13 @@ UNION ALL FROM [Officers] AS [o1] ) AS [u1] ON [t].[GearNickName] = [u1].[Nickname] AND [t].[GearSquadId] = [u1].[SquadId] LEFT JOIN ( - SELECT [w].[Id], [w].[AmmunitionType], [w].[IsAutomatic], [w].[Name], [w].[OwnerFullName], [w].[SynergyWithId], [u2].[Nickname], [u2].[SquadId] + SELECT [w].[Id], [w].[AmmunitionType], [w].[IsAutomatic], [w].[Name], [w].[OwnerFullName], [w].[SynergyWithId], [u2].[Nickname] FROM [Weapons] AS [w] LEFT JOIN ( - SELECT [g1].[Nickname], [g1].[SquadId], [g1].[FullName] + SELECT [g1].[Nickname], [g1].[FullName] FROM [Gears] AS [g1] UNION ALL - SELECT [o2].[Nickname], [o2].[SquadId], [o2].[FullName] + SELECT [o2].[Nickname], [o2].[FullName] FROM [Officers] AS [o2] ) AS [u2] ON [w].[OwnerFullName] = [u2].[FullName] ) AS [s] ON [u1].[FullName] = [s].[OwnerFullName] @@ -5306,7 +5301,7 @@ UNION ALL FROM [Officers] AS [o0] ) AS [u0] WHERE [u].[Nickname] = [u0].[LeaderNickname] AND [u].[SquadId] = [u0].[LeaderSquadId]) -ORDER BY [u].[HasSoulPatch] DESC, [t].[Note], [u].[Nickname], [u].[SquadId], [t].[Id], [u1].[Nickname], [u1].[SquadId], [s].[IsAutomatic], [s].[Nickname] DESC, [s].[Id] +ORDER BY [u].[HasSoulPatch] DESC, [t].[Note], [u].[Nickname], [u].[SquadId], [s].[IsAutomatic], [s].[Nickname] DESC """); } @@ -5317,7 +5312,7 @@ public override async Task Multiple_orderby_with_navigation_expansion_on_one_of_ AssertSql( """ -SELECT [u].[FullName], [u].[Nickname], [u].[SquadId], [t].[Id], [u1].[Nickname], [u1].[SquadId], [s].[Id], [s].[AmmunitionType], [s].[IsAutomatic], [s].[Name], [s].[OwnerFullName], [s].[SynergyWithId], [s].[Nickname], [s].[SquadId] +SELECT [u].[FullName], [u].[Nickname], [u].[SquadId], [s].[Id], [s].[AmmunitionType], [s].[IsAutomatic], [s].[Name], [s].[OwnerFullName], [s].[SynergyWithId] FROM ( SELECT [o].[Nickname], [o].[SquadId], [o].[FullName], [o].[HasSoulPatch] FROM [Officers] AS [o] @@ -5331,13 +5326,13 @@ UNION ALL FROM [Officers] AS [o1] ) AS [u1] ON [t].[GearNickName] = [u1].[Nickname] AND [t].[GearSquadId] = [u1].[SquadId] LEFT JOIN ( - SELECT [w].[Id], [w].[AmmunitionType], [w].[IsAutomatic], [w].[Name], [w].[OwnerFullName], [w].[SynergyWithId], [u2].[Nickname], [u2].[SquadId] + SELECT [w].[Id], [w].[AmmunitionType], [w].[IsAutomatic], [w].[Name], [w].[OwnerFullName], [w].[SynergyWithId], [u2].[Nickname] FROM [Weapons] AS [w] LEFT JOIN ( - SELECT [g1].[Nickname], [g1].[SquadId], [g1].[FullName] + SELECT [g1].[Nickname], [g1].[FullName] FROM [Gears] AS [g1] UNION ALL - SELECT [o2].[Nickname], [o2].[SquadId], [o2].[FullName] + SELECT [o2].[Nickname], [o2].[FullName] FROM [Officers] AS [o2] ) AS [u2] ON [w].[OwnerFullName] = [u2].[FullName] ) AS [s] ON [u1].[FullName] = [s].[OwnerFullName] @@ -5351,7 +5346,7 @@ UNION ALL FROM [Officers] AS [o0] ) AS [u0] WHERE [u].[Nickname] = [u0].[LeaderNickname] AND [u].[SquadId] = [u0].[LeaderSquadId]) -ORDER BY [u].[HasSoulPatch] DESC, [t].[Note], [u].[Nickname], [u].[SquadId], [t].[Id], [u1].[Nickname], [u1].[SquadId], [s].[IsAutomatic], [s].[Nickname] DESC, [s].[Id] +ORDER BY [u].[HasSoulPatch] DESC, [t].[Note], [u].[Nickname], [u].[SquadId], [s].[IsAutomatic], [s].[Nickname] DESC """); } @@ -5362,7 +5357,7 @@ public override async Task Multiple_orderby_with_navigation_expansion_on_one_of_ AssertSql( """ -SELECT [u].[FullName], [u].[Nickname], [u].[SquadId], [t].[Id], [u1].[Nickname], [u1].[SquadId], [s].[Id], [s].[AmmunitionType], [s].[IsAutomatic], [s].[Name], [s].[OwnerFullName], [s].[SynergyWithId], [s].[Nickname], [s].[SquadId] +SELECT [u].[FullName], [u].[Nickname], [u].[SquadId], [s].[Id], [s].[AmmunitionType], [s].[IsAutomatic], [s].[Name], [s].[OwnerFullName], [s].[SynergyWithId] FROM ( SELECT [o].[Nickname], [o].[SquadId], [o].[FullName], [o].[HasSoulPatch] FROM [Officers] AS [o] @@ -5376,16 +5371,16 @@ UNION ALL FROM [Officers] AS [o1] ) AS [u1] ON [t].[GearNickName] = [u1].[Nickname] AND [t].[GearSquadId] = [u1].[SquadId] LEFT JOIN ( - SELECT [w].[Id], [w].[AmmunitionType], [w].[IsAutomatic], [w].[Name], [w].[OwnerFullName], [w].[SynergyWithId], [u2].[Nickname], [u2].[SquadId], ( + SELECT [w].[Id], [w].[AmmunitionType], [w].[IsAutomatic], [w].[Name], [w].[OwnerFullName], [w].[SynergyWithId], ( SELECT COUNT(*) FROM [Weapons] AS [w0] WHERE [u2].[FullName] IS NOT NULL AND [u2].[FullName] = [w0].[OwnerFullName]) AS [c] FROM [Weapons] AS [w] LEFT JOIN ( - SELECT [g1].[Nickname], [g1].[SquadId], [g1].[FullName] + SELECT [g1].[FullName] FROM [Gears] AS [g1] UNION ALL - SELECT [o2].[Nickname], [o2].[SquadId], [o2].[FullName] + SELECT [o2].[FullName] FROM [Officers] AS [o2] ) AS [u2] ON [w].[OwnerFullName] = [u2].[FullName] ) AS [s] ON [u1].[FullName] = [s].[OwnerFullName] @@ -5399,7 +5394,7 @@ UNION ALL FROM [Officers] AS [o0] ) AS [u0] WHERE [u].[Nickname] = [u0].[LeaderNickname] AND [u].[SquadId] = [u0].[LeaderSquadId]) -ORDER BY [u].[HasSoulPatch] DESC, [t].[Note], [u].[Nickname], [u].[SquadId], [t].[Id], [u1].[Nickname], [u1].[SquadId], [s].[Id] DESC, [s].[c], [s].[Nickname] +ORDER BY [u].[HasSoulPatch] DESC, [t].[Note], [u].[Nickname], [u].[SquadId], [s].[Id] DESC, [s].[c] """); } @@ -5409,7 +5404,7 @@ public override async Task Correlated_collections_multiple_nested_complex_collec AssertSql( """ -SELECT [u].[FullName], [u].[Nickname], [u].[SquadId], [t].[Id], [u1].[Nickname], [u1].[SquadId], [s1].[FullName], [s1].[Nickname], [s1].[SquadId], [s1].[Id], [s1].[Nickname0], [s1].[SquadId0], [s1].[Id0], [s1].[Name], [s1].[IsAutomatic], [s1].[Id1], [s1].[Nickname00], [s1].[HasSoulPatch], [s1].[SquadId00], [s2].[Id], [s2].[AmmunitionType], [s2].[IsAutomatic], [s2].[Name], [s2].[OwnerFullName], [s2].[SynergyWithId], [s2].[Nickname], [s2].[SquadId] +SELECT [u].[FullName], [u].[Nickname], [u].[SquadId], [s1].[FullName], [s1].[Nickname], [s1].[SquadId], [s1].[Id], [s1].[Name], [s1].[IsAutomatic], [s1].[Id0], [s1].[Nickname0], [s1].[HasSoulPatch], [s1].[SquadId0], [s2].[Id], [s2].[AmmunitionType], [s2].[IsAutomatic], [s2].[Name], [s2].[OwnerFullName], [s2].[SynergyWithId] FROM ( SELECT [o].[Nickname], [o].[SquadId], [o].[FullName], [o].[HasSoulPatch] FROM [Officers] AS [o] @@ -5423,7 +5418,7 @@ UNION ALL FROM [Officers] AS [o1] ) AS [u1] ON [t].[GearNickName] = [u1].[Nickname] AND [t].[GearSquadId] = [u1].[SquadId] LEFT JOIN ( - SELECT [u2].[FullName], [u2].[Nickname], [u2].[SquadId], [s0].[Id], [s0].[Nickname] AS [Nickname0], [s0].[SquadId] AS [SquadId0], [s0].[Id0], [s0].[Name], [s0].[IsAutomatic], [s0].[Id1], [s0].[Nickname0] AS [Nickname00], [s0].[HasSoulPatch], [s0].[SquadId0] AS [SquadId00], [u2].[Rank], [s0].[IsAutomatic0], [u2].[LeaderNickname], [u2].[LeaderSquadId] + SELECT [u2].[FullName], [u2].[Nickname], [u2].[SquadId], [s0].[Id], [s0].[Name], [s0].[IsAutomatic], [s0].[Id0], [s0].[Nickname] AS [Nickname0], [s0].[HasSoulPatch], [s0].[SquadId] AS [SquadId0], [u2].[Rank], [s0].[IsAutomatic0], [u2].[LeaderNickname], [u2].[LeaderSquadId] FROM ( SELECT [g1].[Nickname], [g1].[SquadId], [g1].[FullName], [g1].[LeaderNickname], [g1].[LeaderSquadId], [g1].[Rank] FROM [Gears] AS [g1] @@ -5432,13 +5427,13 @@ UNION ALL FROM [Officers] AS [o2] ) AS [u2] LEFT JOIN ( - SELECT [w].[Id], [u3].[Nickname], [u3].[SquadId], [s].[Id] AS [Id0], [w0].[Name], [w0].[IsAutomatic], [w0].[Id] AS [Id1], [u4].[Nickname] AS [Nickname0], [u4].[HasSoulPatch], [u4].[SquadId] AS [SquadId0], [w].[IsAutomatic] AS [IsAutomatic0], [w].[OwnerFullName] + SELECT [w].[Id], [w0].[Name], [w0].[IsAutomatic], [w0].[Id] AS [Id0], [u4].[Nickname], [u4].[HasSoulPatch], [u4].[SquadId], [w].[IsAutomatic] AS [IsAutomatic0], [w].[OwnerFullName] FROM [Weapons] AS [w] LEFT JOIN ( - SELECT [g2].[Nickname], [g2].[SquadId], [g2].[FullName] + SELECT [g2].[SquadId], [g2].[FullName] FROM [Gears] AS [g2] UNION ALL - SELECT [o3].[Nickname], [o3].[SquadId], [o3].[FullName] + SELECT [o3].[SquadId], [o3].[FullName] FROM [Officers] AS [o3] ) AS [u3] ON [w].[OwnerFullName] = [u3].[FullName] LEFT JOIN [Squads] AS [s] ON [u3].[SquadId] = [s].[Id] @@ -5455,13 +5450,13 @@ WHERE [w].[Name] <> N'Bar' OR [w].[Name] IS NULL WHERE [u2].[FullName] <> N'Foo' ) AS [s1] ON [u].[Nickname] = [s1].[LeaderNickname] AND [u].[SquadId] = [s1].[LeaderSquadId] LEFT JOIN ( - SELECT [w1].[Id], [w1].[AmmunitionType], [w1].[IsAutomatic], [w1].[Name], [w1].[OwnerFullName], [w1].[SynergyWithId], [u5].[Nickname], [u5].[SquadId] + SELECT [w1].[Id], [w1].[AmmunitionType], [w1].[IsAutomatic], [w1].[Name], [w1].[OwnerFullName], [w1].[SynergyWithId], [u5].[Nickname] FROM [Weapons] AS [w1] LEFT JOIN ( - SELECT [g4].[Nickname], [g4].[SquadId], [g4].[FullName] + SELECT [g4].[Nickname], [g4].[FullName] FROM [Gears] AS [g4] UNION ALL - SELECT [o5].[Nickname], [o5].[SquadId], [o5].[FullName] + SELECT [o5].[Nickname], [o5].[FullName] FROM [Officers] AS [o5] ) AS [u5] ON [w1].[OwnerFullName] = [u5].[FullName] ) AS [s2] ON [u1].[FullName] = [s2].[OwnerFullName] @@ -5475,7 +5470,7 @@ UNION ALL FROM [Officers] AS [o0] ) AS [u0] WHERE [u].[Nickname] = [u0].[LeaderNickname] AND [u].[SquadId] = [u0].[LeaderSquadId]) -ORDER BY [u].[HasSoulPatch] DESC, [t].[Note], [u].[Nickname], [u].[SquadId], [t].[Id], [u1].[Nickname], [u1].[SquadId], [s1].[Rank], [s1].[Nickname], [s1].[SquadId], [s1].[IsAutomatic0], [s1].[Id], [s1].[Nickname0], [s1].[SquadId0], [s1].[Id0], [s1].[Id1], [s1].[Nickname00], [s1].[SquadId00], [s2].[IsAutomatic], [s2].[Nickname] DESC, [s2].[Id] +ORDER BY [u].[HasSoulPatch] DESC, [t].[Note], [u].[Nickname], [u].[SquadId], [s1].[Rank], [s1].[Nickname], [s1].[SquadId], [s1].[IsAutomatic0], [s1].[Id], [s1].[Id0], [s1].[Nickname0], [s1].[SquadId0], [s2].[IsAutomatic], [s2].[Nickname] DESC """); } @@ -5822,7 +5817,7 @@ public override async Task Correlated_collections_deeply_nested_left_join(bool a AssertSql( """ -SELECT [t].[Id], [u].[Nickname], [u].[SquadId], [s].[Id], [s0].[Nickname], [s0].[SquadId], [s0].[Id], [s0].[AmmunitionType], [s0].[IsAutomatic], [s0].[Name], [s0].[OwnerFullName], [s0].[SynergyWithId] +SELECT [t].[Id], [u].[Nickname], [u].[SquadId], [s0].[Nickname], [s0].[SquadId], [s0].[Id], [s0].[AmmunitionType], [s0].[IsAutomatic], [s0].[Name], [s0].[OwnerFullName], [s0].[SynergyWithId] FROM [Tags] AS [t] LEFT JOIN ( SELECT [g].[Nickname], [g].[SquadId] @@ -5848,7 +5843,7 @@ FROM [Weapons] AS [w] ) AS [w0] ON [u0].[FullName] = [w0].[OwnerFullName] WHERE [u0].[HasSoulPatch] = CAST(1 AS bit) ) AS [s0] ON [s].[Id] = [s0].[SquadId] -ORDER BY [t].[Note], [u].[Nickname] DESC, [t].[Id], [u].[SquadId], [s].[Id], [s0].[Nickname], [s0].[SquadId] +ORDER BY [t].[Note], [u].[Nickname] DESC, [t].[Id], [u].[SquadId], [s0].[Nickname], [s0].[SquadId] """); } @@ -5858,13 +5853,13 @@ public override async Task Correlated_collections_from_left_join_with_additional AssertSql( """ -SELECT [w].[Id], [u].[Nickname], [u].[SquadId], [s].[Id], [s0].[Nickname], [s0].[SquadId], [s0].[Id], [s0].[AmmunitionType], [s0].[IsAutomatic], [s0].[Name], [s0].[OwnerFullName], [s0].[SynergyWithId], [s0].[Rank] +SELECT [w].[Id], [s0].[Nickname], [s0].[SquadId], [s0].[Id], [s0].[AmmunitionType], [s0].[IsAutomatic], [s0].[Name], [s0].[OwnerFullName], [s0].[SynergyWithId], [s0].[Rank] FROM [Weapons] AS [w] LEFT JOIN ( - SELECT [g].[Nickname], [g].[SquadId], [g].[FullName] + SELECT [g].[SquadId], [g].[FullName] FROM [Gears] AS [g] UNION ALL - SELECT [o].[Nickname], [o].[SquadId], [o].[FullName] + SELECT [o].[SquadId], [o].[FullName] FROM [Officers] AS [o] ) AS [u] ON [w].[OwnerFullName] = [u].[FullName] LEFT JOIN [Squads] AS [s] ON [u].[SquadId] = [s].[Id] @@ -5883,7 +5878,7 @@ FROM [Weapons] AS [w0] WHERE [w0].[IsAutomatic] = CAST(0 AS bit) ) AS [w1] ON [u0].[FullName] = [w1].[OwnerFullName] ) AS [s0] ON [s].[Id] = [s0].[SquadId] -ORDER BY [w].[Name], [w].[Id], [u].[Nickname], [u].[SquadId], [s].[Id], [s0].[FullName] DESC, [s0].[Nickname], [s0].[SquadId], [s0].[Id] +ORDER BY [w].[Name], [w].[Id], [s0].[FullName] DESC, [s0].[Nickname], [s0].[SquadId], [s0].[Id] """); } @@ -5893,7 +5888,7 @@ public override async Task Correlated_collections_complex_scenario1(bool async) AssertSql( """ -SELECT [u].[FullName], [u].[Nickname], [u].[SquadId], [s0].[Id], [s0].[Nickname], [s0].[SquadId], [s0].[Id0], [s0].[Nickname0], [s0].[HasSoulPatch], [s0].[SquadId0] +SELECT [u].[FullName], [u].[Nickname], [u].[SquadId], [s0].[Id], [s0].[Nickname], [s0].[HasSoulPatch], [s0].[SquadId] FROM ( SELECT [g].[Nickname], [g].[SquadId], [g].[FullName] FROM [Gears] AS [g] @@ -5902,13 +5897,13 @@ UNION ALL FROM [Officers] AS [o] ) AS [u] LEFT JOIN ( - SELECT [w].[Id], [u0].[Nickname], [u0].[SquadId], [s].[Id] AS [Id0], [u1].[Nickname] AS [Nickname0], [u1].[HasSoulPatch], [u1].[SquadId] AS [SquadId0], [w].[OwnerFullName] + SELECT [w].[Id], [u1].[Nickname], [u1].[HasSoulPatch], [u1].[SquadId], [w].[OwnerFullName] FROM [Weapons] AS [w] LEFT JOIN ( - SELECT [g0].[Nickname], [g0].[SquadId], [g0].[FullName] + SELECT [g0].[SquadId], [g0].[FullName] FROM [Gears] AS [g0] UNION ALL - SELECT [o0].[Nickname], [o0].[SquadId], [o0].[FullName] + SELECT [o0].[SquadId], [o0].[FullName] FROM [Officers] AS [o0] ) AS [u0] ON [w].[OwnerFullName] = [u0].[FullName] LEFT JOIN [Squads] AS [s] ON [u0].[SquadId] = [s].[Id] @@ -5920,7 +5915,7 @@ UNION ALL FROM [Officers] AS [o1] ) AS [u1] ON [s].[Id] = [u1].[SquadId] ) AS [s0] ON [u].[FullName] = [s0].[OwnerFullName] -ORDER BY [u].[Nickname], [u].[SquadId], [s0].[Id], [s0].[Nickname], [s0].[SquadId], [s0].[Id0], [s0].[Nickname0] +ORDER BY [u].[Nickname], [u].[SquadId], [s0].[Id], [s0].[Nickname] """); } @@ -5930,13 +5925,13 @@ public override async Task Correlated_collections_complex_scenario2(bool async) AssertSql( """ -SELECT [u].[FullName], [u].[Nickname], [u].[SquadId], [s1].[FullName], [s1].[Nickname], [s1].[SquadId], [s1].[Id], [s1].[Nickname0], [s1].[SquadId0], [s1].[Id0], [s1].[Nickname00], [s1].[HasSoulPatch], [s1].[SquadId00] +SELECT [u].[FullName], [u].[Nickname], [u].[SquadId], [s1].[FullName], [s1].[Nickname], [s1].[SquadId], [s1].[Id], [s1].[Nickname0], [s1].[HasSoulPatch], [s1].[SquadId0] FROM ( SELECT [o].[Nickname], [o].[SquadId], [o].[FullName] FROM [Officers] AS [o] ) AS [u] LEFT JOIN ( - SELECT [u0].[FullName], [u0].[Nickname], [u0].[SquadId], [s0].[Id], [s0].[Nickname] AS [Nickname0], [s0].[SquadId] AS [SquadId0], [s0].[Id0], [s0].[Nickname0] AS [Nickname00], [s0].[HasSoulPatch], [s0].[SquadId0] AS [SquadId00], [u0].[LeaderNickname], [u0].[LeaderSquadId] + SELECT [u0].[FullName], [u0].[Nickname], [u0].[SquadId], [s0].[Id], [s0].[Nickname] AS [Nickname0], [s0].[HasSoulPatch], [s0].[SquadId] AS [SquadId0], [u0].[LeaderNickname], [u0].[LeaderSquadId] FROM ( SELECT [g].[Nickname], [g].[SquadId], [g].[FullName], [g].[LeaderNickname], [g].[LeaderSquadId] FROM [Gears] AS [g] @@ -5945,13 +5940,13 @@ UNION ALL FROM [Officers] AS [o0] ) AS [u0] LEFT JOIN ( - SELECT [w].[Id], [u1].[Nickname], [u1].[SquadId], [s].[Id] AS [Id0], [u2].[Nickname] AS [Nickname0], [u2].[HasSoulPatch], [u2].[SquadId] AS [SquadId0], [w].[OwnerFullName] + SELECT [w].[Id], [u2].[Nickname], [u2].[HasSoulPatch], [u2].[SquadId], [w].[OwnerFullName] FROM [Weapons] AS [w] LEFT JOIN ( - SELECT [g0].[Nickname], [g0].[SquadId], [g0].[FullName] + SELECT [g0].[SquadId], [g0].[FullName] FROM [Gears] AS [g0] UNION ALL - SELECT [o1].[Nickname], [o1].[SquadId], [o1].[FullName] + SELECT [o1].[SquadId], [o1].[FullName] FROM [Officers] AS [o1] ) AS [u1] ON [w].[OwnerFullName] = [u1].[FullName] LEFT JOIN [Squads] AS [s] ON [u1].[SquadId] = [s].[Id] @@ -5964,7 +5959,7 @@ FROM [Officers] AS [o2] ) AS [u2] ON [s].[Id] = [u2].[SquadId] ) AS [s0] ON [u0].[FullName] = [s0].[OwnerFullName] ) AS [s1] ON [u].[Nickname] = [s1].[LeaderNickname] AND [u].[SquadId] = [s1].[LeaderSquadId] -ORDER BY [u].[Nickname], [u].[SquadId], [s1].[Nickname], [s1].[SquadId], [s1].[Id], [s1].[Nickname0], [s1].[SquadId0], [s1].[Id0], [s1].[Nickname00] +ORDER BY [u].[Nickname], [u].[SquadId], [s1].[Nickname], [s1].[SquadId], [s1].[Id], [s1].[Nickname0] """); } @@ -5974,7 +5969,7 @@ public override async Task Correlated_collections_with_funky_orderby_complex_sce AssertSql( """ -SELECT [u].[FullName], [u].[Nickname], [u].[SquadId], [s0].[Id], [s0].[Nickname], [s0].[SquadId], [s0].[Id0], [s0].[Nickname0], [s0].[HasSoulPatch], [s0].[SquadId0] +SELECT [u].[FullName], [u].[Nickname], [u].[SquadId], [s0].[Id], [s0].[Nickname], [s0].[HasSoulPatch], [s0].[SquadId] FROM ( SELECT [g].[Nickname], [g].[SquadId], [g].[FullName] FROM [Gears] AS [g] @@ -5983,13 +5978,13 @@ UNION ALL FROM [Officers] AS [o] ) AS [u] LEFT JOIN ( - SELECT [w].[Id], [u0].[Nickname], [u0].[SquadId], [s].[Id] AS [Id0], [u1].[Nickname] AS [Nickname0], [u1].[HasSoulPatch], [u1].[SquadId] AS [SquadId0], [w].[OwnerFullName] + SELECT [w].[Id], [u1].[Nickname], [u1].[HasSoulPatch], [u1].[SquadId], [w].[OwnerFullName] FROM [Weapons] AS [w] LEFT JOIN ( - SELECT [g0].[Nickname], [g0].[SquadId], [g0].[FullName] + SELECT [g0].[SquadId], [g0].[FullName] FROM [Gears] AS [g0] UNION ALL - SELECT [o0].[Nickname], [o0].[SquadId], [o0].[FullName] + SELECT [o0].[SquadId], [o0].[FullName] FROM [Officers] AS [o0] ) AS [u0] ON [w].[OwnerFullName] = [u0].[FullName] LEFT JOIN [Squads] AS [s] ON [u0].[SquadId] = [s].[Id] @@ -6001,7 +5996,7 @@ UNION ALL FROM [Officers] AS [o1] ) AS [u1] ON [s].[Id] = [u1].[SquadId] ) AS [s0] ON [u].[FullName] = [s0].[OwnerFullName] -ORDER BY [u].[FullName], [u].[Nickname] DESC, [u].[SquadId], [s0].[Id], [s0].[Nickname], [s0].[SquadId], [s0].[Id0], [s0].[Nickname0] +ORDER BY [u].[FullName], [u].[Nickname] DESC, [u].[SquadId], [s0].[Id], [s0].[Nickname] """); } @@ -6011,13 +6006,13 @@ public override async Task Correlated_collections_with_funky_orderby_complex_sce AssertSql( """ -SELECT [u].[FullName], [u].[Nickname], [u].[SquadId], [s1].[FullName], [s1].[Nickname], [s1].[SquadId], [s1].[Id], [s1].[Nickname0], [s1].[SquadId0], [s1].[Id0], [s1].[Nickname00], [s1].[HasSoulPatch], [s1].[SquadId00] +SELECT [u].[FullName], [u].[Nickname], [u].[SquadId], [s1].[FullName], [s1].[Nickname], [s1].[SquadId], [s1].[Id], [s1].[Nickname0], [s1].[HasSoulPatch], [s1].[SquadId0] FROM ( SELECT [o].[Nickname], [o].[SquadId], [o].[FullName], [o].[HasSoulPatch], [o].[LeaderNickname] FROM [Officers] AS [o] ) AS [u] LEFT JOIN ( - SELECT [u0].[FullName], [u0].[Nickname], [u0].[SquadId], [s0].[Id], [s0].[Nickname] AS [Nickname0], [s0].[SquadId] AS [SquadId0], [s0].[Id0], [s0].[Nickname0] AS [Nickname00], [s0].[HasSoulPatch], [s0].[SquadId0] AS [SquadId00], [u0].[HasSoulPatch] AS [HasSoulPatch0], [s0].[IsAutomatic], [s0].[Name], [u0].[LeaderNickname], [u0].[LeaderSquadId] + SELECT [u0].[FullName], [u0].[Nickname], [u0].[SquadId], [s0].[Id], [s0].[Nickname] AS [Nickname0], [s0].[HasSoulPatch], [s0].[SquadId] AS [SquadId0], [u0].[HasSoulPatch] AS [HasSoulPatch0], [s0].[IsAutomatic], [s0].[Name], [u0].[LeaderNickname], [u0].[LeaderSquadId] FROM ( SELECT [g].[Nickname], [g].[SquadId], [g].[FullName], [g].[HasSoulPatch], [g].[LeaderNickname], [g].[LeaderSquadId] FROM [Gears] AS [g] @@ -6026,13 +6021,13 @@ UNION ALL FROM [Officers] AS [o0] ) AS [u0] LEFT JOIN ( - SELECT [w].[Id], [u1].[Nickname], [u1].[SquadId], [s].[Id] AS [Id0], [u2].[Nickname] AS [Nickname0], [u2].[HasSoulPatch], [u2].[SquadId] AS [SquadId0], [w].[IsAutomatic], [w].[Name], [w].[OwnerFullName] + SELECT [w].[Id], [u2].[Nickname], [u2].[HasSoulPatch], [u2].[SquadId], [w].[IsAutomatic], [w].[Name], [w].[OwnerFullName] FROM [Weapons] AS [w] LEFT JOIN ( - SELECT [g0].[Nickname], [g0].[SquadId], [g0].[FullName] + SELECT [g0].[SquadId], [g0].[FullName] FROM [Gears] AS [g0] UNION ALL - SELECT [o1].[Nickname], [o1].[SquadId], [o1].[FullName] + SELECT [o1].[SquadId], [o1].[FullName] FROM [Officers] AS [o1] ) AS [u1] ON [w].[OwnerFullName] = [u1].[FullName] LEFT JOIN [Squads] AS [s] ON [u1].[SquadId] = [s].[Id] @@ -6045,7 +6040,7 @@ FROM [Officers] AS [o2] ) AS [u2] ON [s].[Id] = [u2].[SquadId] ) AS [s0] ON [u0].[FullName] = [s0].[OwnerFullName] ) AS [s1] ON [u].[Nickname] = [s1].[LeaderNickname] AND [u].[SquadId] = [s1].[LeaderSquadId] -ORDER BY [u].[HasSoulPatch], [u].[LeaderNickname], [u].[FullName], [u].[Nickname], [u].[SquadId], [s1].[FullName], [s1].[HasSoulPatch0] DESC, [s1].[Nickname], [s1].[SquadId], [s1].[IsAutomatic], [s1].[Name] DESC, [s1].[Id], [s1].[Nickname0], [s1].[SquadId0], [s1].[Id0], [s1].[Nickname00] +ORDER BY [u].[HasSoulPatch], [u].[LeaderNickname], [u].[FullName], [u].[Nickname], [u].[SquadId], [s1].[FullName], [s1].[HasSoulPatch0] DESC, [s1].[Nickname], [s1].[SquadId], [s1].[IsAutomatic], [s1].[Name] DESC, [s1].[Id], [s1].[Nickname0] """); } @@ -6189,9 +6184,9 @@ public override async Task Include_on_derived_type_with_order_by_and_paging(bool """ @p='10' -SELECT [s].[Name], [s].[LocustHordeId], [s].[ThreatLevel], [s].[ThreatLevelByte], [s].[ThreatLevelNullableByte], [s].[DefeatedByNickname], [s].[DefeatedBySquadId], [s].[HighCommandId], [s].[Discriminator], [s].[Nickname], [s].[SquadId], [s].[AssignedCityName], [s].[CityOfBirthName], [s].[FullName], [s].[HasSoulPatch], [s].[LeaderNickname], [s].[LeaderSquadId], [s].[Rank], [s].[Discriminator0] AS [Discriminator], [s].[Id], [w].[Id], [w].[AmmunitionType], [w].[IsAutomatic], [w].[Name], [w].[OwnerFullName], [w].[SynergyWithId] +SELECT [s].[Name], [s].[LocustHordeId], [s].[ThreatLevel], [s].[ThreatLevelByte], [s].[ThreatLevelNullableByte], [s].[DefeatedByNickname], [s].[DefeatedBySquadId], [s].[HighCommandId], [s].[Discriminator], [s].[Nickname], [s].[SquadId], [s].[AssignedCityName], [s].[CityOfBirthName], [s].[FullName], [s].[HasSoulPatch], [s].[LeaderNickname], [s].[LeaderSquadId], [s].[Rank], [s].[Discriminator0] AS [Discriminator], [w].[Id], [w].[AmmunitionType], [w].[IsAutomatic], [w].[Name], [w].[OwnerFullName], [w].[SynergyWithId] FROM ( - SELECT TOP(@p) [u].[Name], [u].[LocustHordeId], [u].[ThreatLevel], [u].[ThreatLevelByte], [u].[ThreatLevelNullableByte], [u].[DefeatedByNickname], [u].[DefeatedBySquadId], [u].[HighCommandId], [u].[Discriminator], [u0].[Nickname], [u0].[SquadId], [u0].[AssignedCityName], [u0].[CityOfBirthName], [u0].[FullName], [u0].[HasSoulPatch], [u0].[LeaderNickname], [u0].[LeaderSquadId], [u0].[Rank], [u0].[Discriminator] AS [Discriminator0], [t].[Id], [t].[Note] + SELECT TOP(@p) [u].[Name], [u].[LocustHordeId], [u].[ThreatLevel], [u].[ThreatLevelByte], [u].[ThreatLevelNullableByte], [u].[DefeatedByNickname], [u].[DefeatedBySquadId], [u].[HighCommandId], [u].[Discriminator], [u0].[Nickname], [u0].[SquadId], [u0].[AssignedCityName], [u0].[CityOfBirthName], [u0].[FullName], [u0].[HasSoulPatch], [u0].[LeaderNickname], [u0].[LeaderSquadId], [u0].[Rank], [u0].[Discriminator] AS [Discriminator0], [t].[Note] FROM ( SELECT [l].[Name], [l].[LocustHordeId], [l].[ThreatLevel], [l].[ThreatLevelByte], [l].[ThreatLevelNullableByte], NULL AS [DefeatedByNickname], NULL AS [DefeatedBySquadId], NULL AS [HighCommandId], N'LocustLeader' AS [Discriminator] FROM [LocustLeaders] AS [l] @@ -6210,7 +6205,7 @@ LEFT JOIN [Tags] AS [t] ON ([u0].[Nickname] = [t].[GearNickName] OR ([u0].[Nickn ORDER BY [t].[Note] ) AS [s] LEFT JOIN [Weapons] AS [w] ON [s].[FullName] = [w].[OwnerFullName] -ORDER BY [s].[Note], [s].[Name], [s].[Nickname], [s].[SquadId], [s].[Id] +ORDER BY [s].[Note], [s].[Name] """); } @@ -6275,23 +6270,23 @@ public override async Task Outer_parameter_in_join_key(bool async) AssertSql( """ -SELECT [u].[Nickname], [u].[SquadId], [s].[Note], [s].[Id], [s].[Nickname], [s].[SquadId] +SELECT [u].[Nickname], [u].[SquadId], [s].[Note], [s].[Id] FROM ( SELECT [o].[Nickname], [o].[SquadId], [o].[FullName] FROM [Officers] AS [o] ) AS [u] OUTER APPLY ( - SELECT [t].[Note], [t].[Id], [u0].[Nickname], [u0].[SquadId] + SELECT [t].[Note], [t].[Id] FROM [Tags] AS [t] INNER JOIN ( - SELECT [g].[Nickname], [g].[SquadId], [g].[FullName] + SELECT [g].[FullName] FROM [Gears] AS [g] UNION ALL - SELECT [o0].[Nickname], [o0].[SquadId], [o0].[FullName] + SELECT [o0].[FullName] FROM [Officers] AS [o0] ) AS [u0] ON [u].[FullName] = [u0].[FullName] ) AS [s] -ORDER BY [u].[Nickname], [u].[SquadId], [s].[Id], [s].[Nickname] +ORDER BY [u].[Nickname], [u].[SquadId] """); } @@ -6327,23 +6322,16 @@ public override async Task Outer_parameter_in_group_join_with_DefaultIfEmpty(boo AssertSql( """ -SELECT [u].[Nickname], [u].[SquadId], [s].[Note], [s].[Id], [s].[Nickname], [s].[SquadId] +SELECT [u].[Nickname], [u].[SquadId], [s].[Note], [s].[Id] FROM ( - SELECT [o].[Nickname], [o].[SquadId], [o].[FullName] + SELECT [o].[Nickname], [o].[SquadId] FROM [Officers] AS [o] ) AS [u] OUTER APPLY ( - SELECT [t].[Note], [t].[Id], [u0].[Nickname], [u0].[SquadId] + SELECT [t].[Note], [t].[Id] FROM [Tags] AS [t] - LEFT JOIN ( - SELECT [g].[Nickname], [g].[SquadId], [g].[FullName] - FROM [Gears] AS [g] - UNION ALL - SELECT [o0].[Nickname], [o0].[SquadId], [o0].[FullName] - FROM [Officers] AS [o0] - ) AS [u0] ON [u].[FullName] = [u0].[FullName] ) AS [s] -ORDER BY [u].[Nickname], [u].[SquadId], [s].[Id], [s].[Nickname] +ORDER BY [u].[Nickname], [u].[SquadId] """); } @@ -7787,7 +7775,7 @@ GROUP BY [u].[Rank] LEFT JOIN ( SELECT [s].[Nickname], [s].[SquadId], [s].[AssignedCityName], [s].[CityOfBirthName], [s].[FullName], [s].[HasSoulPatch], [s].[LeaderNickname], [s].[LeaderSquadId], [s].[Rank], [s].[Discriminator], [s].[Name], [s].[Location], [s].[Nation] FROM ( - SELECT [u0].[Nickname], [u0].[SquadId], [u0].[AssignedCityName], [u0].[CityOfBirthName], [u0].[FullName], [u0].[HasSoulPatch], [u0].[LeaderNickname], [u0].[LeaderSquadId], [u0].[Rank], [u0].[Discriminator], [c].[Name], [c].[Location], [c].[Nation], ROW_NUMBER() OVER(PARTITION BY [u0].[Rank] ORDER BY [u0].[Nickname], [u0].[SquadId], [c].[Name]) AS [row] + SELECT [u0].[Nickname], [u0].[SquadId], [u0].[AssignedCityName], [u0].[CityOfBirthName], [u0].[FullName], [u0].[HasSoulPatch], [u0].[LeaderNickname], [u0].[LeaderSquadId], [u0].[Rank], [u0].[Discriminator], [c].[Name], [c].[Location], [c].[Nation], ROW_NUMBER() OVER(PARTITION BY [u0].[Rank] ORDER BY [u0].[Nickname], [u0].[SquadId]) AS [row] FROM ( SELECT [g0].[Nickname], [g0].[SquadId], [g0].[AssignedCityName], [g0].[CityOfBirthName], [g0].[FullName], [g0].[HasSoulPatch], [g0].[LeaderNickname], [g0].[LeaderSquadId], [g0].[Rank], N'Gear' AS [Discriminator] FROM [Gears] AS [g0] @@ -8362,7 +8350,7 @@ public override async Task Project_collection_navigation_nested_with_take_compos AssertSql( """ -SELECT [t].[Id], [u].[Nickname], [u].[SquadId], [u2].[Nickname], [u2].[SquadId], [u2].[AssignedCityName], [u2].[CityOfBirthName], [u2].[FullName], [u2].[HasSoulPatch], [u2].[LeaderNickname], [u2].[LeaderSquadId], [u2].[Rank], [u2].[Discriminator] +SELECT [t].[Id], [u2].[Nickname], [u2].[SquadId], [u2].[AssignedCityName], [u2].[CityOfBirthName], [u2].[FullName], [u2].[HasSoulPatch], [u2].[LeaderNickname], [u2].[LeaderSquadId], [u2].[Rank], [u2].[Discriminator] FROM [Tags] AS [t] LEFT JOIN ( SELECT [g].[Nickname], [g].[SquadId], N'Gear' AS [Discriminator] @@ -8386,7 +8374,7 @@ FROM [Officers] AS [o0] WHERE [u1].[row] <= 50 ) AS [u2] ON ([u].[Nickname] = [u2].[LeaderNickname] OR ([u].[Nickname] IS NULL AND [u2].[LeaderNickname] IS NULL)) AND [u].[SquadId] = [u2].[LeaderSquadId] WHERE [u].[Discriminator] = N'Officer' -ORDER BY [t].[Id], [u].[Nickname], [u].[SquadId], [u2].[Nickname] +ORDER BY [t].[Id], [u2].[Nickname] """); } @@ -8396,7 +8384,7 @@ public override async Task Project_collection_navigation_nested_composite_key(bo AssertSql( """ -SELECT [t].[Id], [u].[Nickname], [u].[SquadId], [u0].[Nickname], [u0].[SquadId], [u0].[AssignedCityName], [u0].[CityOfBirthName], [u0].[FullName], [u0].[HasSoulPatch], [u0].[LeaderNickname], [u0].[LeaderSquadId], [u0].[Rank], [u0].[Discriminator] +SELECT [t].[Id], [u0].[Nickname], [u0].[SquadId], [u0].[AssignedCityName], [u0].[CityOfBirthName], [u0].[FullName], [u0].[HasSoulPatch], [u0].[LeaderNickname], [u0].[LeaderSquadId], [u0].[Rank], [u0].[Discriminator] FROM [Tags] AS [t] LEFT JOIN ( SELECT [g].[Nickname], [g].[SquadId], N'Gear' AS [Discriminator] @@ -8413,7 +8401,7 @@ UNION ALL FROM [Officers] AS [o0] ) AS [u0] ON ([u].[Nickname] = [u0].[LeaderNickname] OR ([u].[Nickname] IS NULL AND [u0].[LeaderNickname] IS NULL)) AND [u].[SquadId] = [u0].[LeaderSquadId] WHERE [u].[Discriminator] = N'Officer' -ORDER BY [t].[Id], [u].[Nickname], [u].[SquadId], [u0].[Nickname] +ORDER BY [t].[Id], [u0].[Nickname] """); } @@ -8667,7 +8655,7 @@ public override async Task Accessing_reference_navigation_collection_composition AssertSql( """ -SELECT [u].[Nickname], [u].[SquadId], [s].[Id], [s].[IsAutomatic], [s].[Name], [s].[Id0] +SELECT [u].[Nickname], [u].[SquadId], [s].[Id], [s].[IsAutomatic], [s].[Name] FROM ( SELECT [g].[Nickname], [g].[SquadId], [g].[FullName] FROM [Gears] AS [g] @@ -8676,11 +8664,11 @@ UNION ALL FROM [Officers] AS [o] ) AS [u] LEFT JOIN ( - SELECT [w].[Id], [w].[IsAutomatic], [w0].[Name], [w0].[Id] AS [Id0], [w].[OwnerFullName] + SELECT [w].[Id], [w].[IsAutomatic], [w0].[Name], [w].[OwnerFullName] FROM [Weapons] AS [w] LEFT JOIN [Weapons] AS [w0] ON [w].[SynergyWithId] = [w0].[Id] ) AS [s] ON [u].[FullName] = [s].[OwnerFullName] -ORDER BY [u].[Nickname], [u].[SquadId], [s].[Id] +ORDER BY [u].[Nickname], [u].[SquadId] """); } @@ -8713,7 +8701,7 @@ public override async Task Accessing_property_of_optional_navigation_in_child_pr SELECT CASE WHEN [u].[Nickname] IS NOT NULL AND [u].[SquadId] IS NOT NULL THEN CAST(1 AS bit) ELSE CAST(0 AS bit) -END, [t].[Id], [u].[Nickname], [u].[SquadId], [s].[Nickname], [s].[Id], [s].[SquadId] +END, [t].[Id], [s].[Nickname], [s].[Id] FROM [Tags] AS [t] LEFT JOIN ( SELECT [g].[Nickname], [g].[SquadId], [g].[FullName] @@ -8723,17 +8711,17 @@ UNION ALL FROM [Officers] AS [o] ) AS [u] ON [t].[GearNickName] = [u].[Nickname] AND [t].[GearSquadId] = [u].[SquadId] LEFT JOIN ( - SELECT [u0].[Nickname], [w].[Id], [u0].[SquadId], [w].[OwnerFullName] + SELECT [u0].[Nickname], [w].[Id], [w].[OwnerFullName] FROM [Weapons] AS [w] LEFT JOIN ( - SELECT [g0].[Nickname], [g0].[SquadId], [g0].[FullName] + SELECT [g0].[Nickname], [g0].[FullName] FROM [Gears] AS [g0] UNION ALL - SELECT [o0].[Nickname], [o0].[SquadId], [o0].[FullName] + SELECT [o0].[Nickname], [o0].[FullName] FROM [Officers] AS [o0] ) AS [u0] ON [w].[OwnerFullName] = [u0].[FullName] ) AS [s] ON [u].[FullName] = [s].[OwnerFullName] -ORDER BY [t].[Note], [t].[Id], [u].[Nickname], [u].[SquadId], [s].[Id], [s].[Nickname] +ORDER BY [t].[Note], [t].[Id] """); } @@ -8957,13 +8945,12 @@ public override async Task Left_join_with_GroupBy_with_composite_group_key(bool """ SELECT [u].[CityOfBirthName], [u].[HasSoulPatch] FROM ( - SELECT [g].[Nickname], [g].[SquadId], [g].[CityOfBirthName], [g].[HasSoulPatch] + SELECT [g].[Nickname], [g].[CityOfBirthName], [g].[HasSoulPatch] FROM [Gears] AS [g] UNION ALL - SELECT [o].[Nickname], [o].[SquadId], [o].[CityOfBirthName], [o].[HasSoulPatch] + SELECT [o].[Nickname], [o].[CityOfBirthName], [o].[HasSoulPatch] FROM [Officers] AS [o] ) AS [u] -INNER JOIN [Squads] AS [s] ON [u].[SquadId] = [s].[Id] LEFT JOIN [Tags] AS [t] ON [u].[Nickname] = [t].[GearNickName] GROUP BY [u].[CityOfBirthName], [u].[HasSoulPatch] """); @@ -10316,7 +10303,7 @@ public override async Task Correlated_collection_take(bool async) AssertSql( """ -SELECT [u].[Nickname], [u].[SquadId], [c].[Name], [w1].[Id], [w1].[AmmunitionType], [w1].[IsAutomatic], [w1].[Name], [w1].[OwnerFullName], [w1].[SynergyWithId], [c].[Location], [c].[Nation] +SELECT [u].[Nickname], [u].[SquadId], [w1].[Id], [w1].[AmmunitionType], [w1].[IsAutomatic], [w1].[Name], [w1].[OwnerFullName], [w1].[SynergyWithId], [c].[Name], [c].[Location], [c].[Nation] FROM ( SELECT [g].[Nickname], [g].[SquadId], [g].[CityOfBirthName], [g].[FullName] FROM [Gears] AS [g] @@ -10333,7 +10320,7 @@ FROM [Weapons] AS [w] ) AS [w0] WHERE [w0].[row] <= 10 ) AS [w1] ON [u].[FullName] = [w1].[OwnerFullName] -ORDER BY [u].[Nickname], [u].[SquadId], [c].[Name] +ORDER BY [u].[Nickname], [u].[SquadId] """); } @@ -11019,7 +11006,7 @@ FROM [Weapons] AS [w0] ) AS [w1] WHERE [w1].[row] <= 1 ) AS [w2] ON [u].[FullName] = [w2].[OwnerFullName] -ORDER BY [u].[Nickname], [u].[SquadId], [s].[Id] +ORDER BY [u].[Nickname], [u].[SquadId] """); } @@ -11293,7 +11280,7 @@ FROM [Officers] AS [o] ) AS [u0] ON [u].[DefeatedByNickname] = [u0].[Nickname] AND [u].[DefeatedBySquadId] = [u0].[SquadId] LEFT JOIN [Weapons] AS [w] ON [u0].[FullName] = [w].[OwnerFullName] WHERE [u].[Name] LIKE N'%Queen%' -ORDER BY [u].[Name], [u0].[Nickname], [u0].[SquadId] +ORDER BY [u].[Name] """); } diff --git a/test/EFCore.SqlServer.FunctionalTests/Query/Inheritance/TPCManyToManyNoTrackingQuerySqlServerTest.cs b/test/EFCore.SqlServer.FunctionalTests/Query/Inheritance/TPCManyToManyNoTrackingQuerySqlServerTest.cs index 4666c6bd00d..4975ed463ad 100644 --- a/test/EFCore.SqlServer.FunctionalTests/Query/Inheritance/TPCManyToManyNoTrackingQuerySqlServerTest.cs +++ b/test/EFCore.SqlServer.FunctionalTests/Query/Inheritance/TPCManyToManyNoTrackingQuerySqlServerTest.cs @@ -93,7 +93,6 @@ FROM [EntityOnes] AS [e] WHERE EXISTS ( SELECT 1 FROM [JoinOneSelfPayload] AS [j] - INNER JOIN [EntityOnes] AS [e0] ON [j].[LeftId] = [e0].[Id] WHERE [e].[Id] = [j].[RightId]) """); } @@ -131,7 +130,6 @@ FROM [EntityTwos] AS [e] WHERE ( SELECT COUNT_BIG(*) FROM [JoinTwoToThree] AS [j] - INNER JOIN [EntityThrees] AS [e0] ON [j].[ThreeId] = [e0].[Id] WHERE [e].[Id] = [j].[TwoId]) > CAST(0 AS bigint) """); } @@ -399,7 +397,7 @@ LEFT JOIN ( FROM [JoinCompositeKeyToLeaf] AS [j] INNER JOIN [Leaves] AS [l] ON [j].[LeafId] = [l].[Id] ) AS [s] ON [e].[Key1] = [s].[CompositeId1] AND [e].[Key2] = [s].[CompositeId2] AND [e].[Key3] = [s].[CompositeId3] -ORDER BY [e].[Key1], [e].[Key2], [e].[Key3], [s].[LeafId], [s].[CompositeId1], [s].[CompositeId2], [s].[CompositeId3] +ORDER BY [e].[Key1], [e].[Key2], [e].[Key3], [s].[LeafId], [s].[CompositeId1], [s].[CompositeId2] """); } @@ -429,7 +427,7 @@ FROM [Leaf2s] AS [l0] ) AS [u] ON [e0].[RootSkipSharedId] = [u].[Id] WHERE [u].[Discriminator] = N'EntityLeaf' ) AS [s] ON [e].[Key1] = [s].[CompositeKeySkipSharedKey1] AND [e].[Key2] = [s].[CompositeKeySkipSharedKey2] AND [e].[Key3] = [s].[CompositeKeySkipSharedKey3] -ORDER BY [e].[Key1], [e].[Key2], [e].[Key3], [s].[RootSkipSharedId], [s].[CompositeKeySkipSharedKey1], [s].[CompositeKeySkipSharedKey2], [s].[CompositeKeySkipSharedKey3] +ORDER BY [e].[Key1], [e].[Key2], [e].[Key3], [s].[RootSkipSharedId], [s].[CompositeKeySkipSharedKey1], [s].[CompositeKeySkipSharedKey2] """); } @@ -641,7 +639,7 @@ LEFT JOIN ( FROM [JoinOneSelfPayload] AS [j] INNER JOIN [EntityOnes] AS [e0] ON [j].[LeftId] = [e0].[Id] ) AS [s] ON [e].[Id] = [s].[RightId] -ORDER BY [e].[Id], [s].[LeftId], [s].[RightId] +ORDER BY [e].[Id], [s].[LeftId] """); } @@ -668,7 +666,7 @@ LEFT JOIN ( FROM [EntityCompositeKeyEntityTwo] AS [e3] INNER JOIN [EntityCompositeKeys] AS [e4] ON [e3].[CompositeKeySkipSharedKey1] = [e4].[Key1] AND [e3].[CompositeKeySkipSharedKey2] = [e4].[Key2] AND [e3].[CompositeKeySkipSharedKey3] = [e4].[Key3] ) AS [s1] ON [e].[Id] = [s1].[TwoSkipSharedId] -ORDER BY [e].[Id], [s].[ThreeId], [s].[TwoId], [s].[Id], [s0].[SelfSkipSharedLeftId], [s0].[SelfSkipSharedRightId], [s0].[Id], [s1].[TwoSkipSharedId], [s1].[CompositeKeySkipSharedKey1], [s1].[CompositeKeySkipSharedKey2], [s1].[CompositeKeySkipSharedKey3], [s1].[Key1], [s1].[Key2] +ORDER BY [e].[Id], [s].[ThreeId], [s].[TwoId], [s0].[SelfSkipSharedLeftId], [s0].[SelfSkipSharedRightId], [s1].[TwoSkipSharedId], [s1].[CompositeKeySkipSharedKey1], [s1].[CompositeKeySkipSharedKey2] """); } @@ -718,7 +716,7 @@ UNION ALL FROM [Leaf2s] AS [l0] ) AS [u] ON [e0].[RootSkipSharedId] = [u].[Id] ) AS [s] ON [e].[Key1] = [s].[CompositeKeySkipSharedKey1] AND [e].[Key2] = [s].[CompositeKeySkipSharedKey2] AND [e].[Key3] = [s].[CompositeKeySkipSharedKey3] -ORDER BY [e].[Key1], [e].[Key2], [e].[Key3], [s].[RootSkipSharedId], [s].[CompositeKeySkipSharedKey1], [s].[CompositeKeySkipSharedKey2], [s].[CompositeKeySkipSharedKey3] +ORDER BY [e].[Key1], [e].[Key2], [e].[Key3], [s].[RootSkipSharedId], [s].[CompositeKeySkipSharedKey1], [s].[CompositeKeySkipSharedKey2] """); } @@ -736,7 +734,7 @@ FROM [JoinOneToTwo] AS [j] INNER JOIN [EntityOnes] AS [e0] ON [j].[OneId] = [e0].[Id] LEFT JOIN [EntityTwos] AS [e1] ON [e0].[Id] = [e1].[ReferenceInverseId] ) AS [s] ON [e].[Id] = [s].[TwoId] -ORDER BY [e].[Id], [s].[OneId], [s].[TwoId], [s].[Id] +ORDER BY [e].[Id], [s].[OneId] """); } @@ -758,7 +756,7 @@ FROM [JoinOneToBranch] AS [j0] INNER JOIN [EntityOnes] AS [e0] ON [j0].[EntityOneId] = [e0].[Id] ) AS [s] ON [l].[Id] = [s].[EntityBranchId] ) AS [s0] ON [e].[Key1] = [s0].[CompositeId1] AND [e].[Key2] = [s0].[CompositeId2] AND [e].[Key3] = [s0].[CompositeId3] -ORDER BY [e].[Key1], [e].[Key2], [e].[Key3], [s0].[LeafId], [s0].[CompositeId1], [s0].[CompositeId2], [s0].[CompositeId3], [s0].[Id], [s0].[EntityBranchId], [s0].[EntityOneId] +ORDER BY [e].[Key1], [e].[Key2], [e].[Key3], [s0].[LeafId], [s0].[CompositeId1], [s0].[CompositeId2], [s0].[CompositeId3], [s0].[EntityBranchId] """); } @@ -781,7 +779,7 @@ FROM [JoinOneSelfPayload] AS [j0] INNER JOIN [EntityOnes] AS [e2] ON [j0].[RightId] = [e2].[Id] ) AS [s] ON [e0].[Id] = [s].[LeftId] ) AS [s0] ON [e].[Id] = [s0].[ThreeId] -ORDER BY [e].[Id], [s0].[OneId], [s0].[ThreeId], [s0].[Id], [s0].[Id0], [s0].[LeftId], [s0].[RightId] +ORDER BY [e].[Id], [s0].[OneId], [s0].[ThreeId], [s0].[LeftId] """); } @@ -791,7 +789,7 @@ public override async Task Include_skip_navigation_and_reference(bool async) AssertSql( """ -SELECT [e].[Id], [e].[CollectionInverseId], [e].[ExtraId], [e].[Name], [e].[ReferenceInverseId], [e0].[Id], [s].[Id], [s].[Name], [s].[OneSkipSharedId], [s].[TwoSkipSharedId], [e0].[CollectionInverseId], [e0].[Name], [e0].[ReferenceInverseId] +SELECT [e].[Id], [e].[CollectionInverseId], [e].[ExtraId], [e].[Name], [e].[ReferenceInverseId], [s].[Id], [s].[Name], [s].[OneSkipSharedId], [s].[TwoSkipSharedId], [e0].[Id], [e0].[CollectionInverseId], [e0].[Name], [e0].[ReferenceInverseId] FROM [EntityTwos] AS [e] LEFT JOIN [EntityThrees] AS [e0] ON [e].[Id] = [e0].[ReferenceInverseId] LEFT JOIN ( @@ -799,7 +797,7 @@ LEFT JOIN ( FROM [EntityOneEntityTwo] AS [e1] INNER JOIN [EntityOnes] AS [e2] ON [e1].[OneSkipSharedId] = [e2].[Id] ) AS [s] ON [e].[Id] = [s].[TwoSkipSharedId] -ORDER BY [e].[Id], [e0].[Id], [s].[OneSkipSharedId], [s].[TwoSkipSharedId] +ORDER BY [e].[Id], [s].[OneSkipSharedId] """); } @@ -817,7 +815,7 @@ FROM [JoinOneToThreePayloadFullShared] AS [j] INNER JOIN [EntityOnes] AS [e0] ON [j].[OneId] = [e0].[Id] WHERE [e0].[Id] < 10 ) AS [s] ON [e].[Id] = [s].[ThreeId] -ORDER BY [e].[Id], [s].[OneId], [s].[ThreeId] +ORDER BY [e].[Id], [s].[OneId] """); } @@ -932,7 +930,7 @@ FROM [JoinOneToThreePayloadFullShared] AS [j] WHERE [e1].[Id] < 10 ) AS [s] ON [e0].[Id] = [s].[ThreeId] ) AS [s0] ON [u].[Id] = [s0].[RootSkipSharedId] -ORDER BY [u].[Id], [s0].[RootSkipSharedId], [s0].[ThreeSkipSharedId], [s0].[Id], [s0].[OneId], [s0].[ThreeId] +ORDER BY [u].[Id], [s0].[RootSkipSharedId], [s0].[ThreeSkipSharedId], [s0].[OneId] """); } @@ -970,7 +968,7 @@ FROM [JoinThreeToCompositeKeyFull] AS [j] WHERE 1 < [s].[row] AND [s].[row] <= 3 ) AS [s0] ON [e0].[Key1] = [s0].[CompositeId1] AND [e0].[Key2] = [s0].[CompositeId2] AND [e0].[Key3] = [s0].[CompositeId3] ) AS [s1] ON [u].[Id] = [s1].[RootSkipSharedId] -ORDER BY [u].[Id], [s1].[RootSkipSharedId], [s1].[CompositeKeySkipSharedKey1], [s1].[CompositeKeySkipSharedKey2], [s1].[CompositeKeySkipSharedKey3], [s1].[Key1], [s1].[Key2], [s1].[Key3], [s1].[CompositeId1], [s1].[CompositeId2], [s1].[CompositeId3], [s1].[Id] +ORDER BY [u].[Id], [s1].[RootSkipSharedId], [s1].[CompositeKeySkipSharedKey1], [s1].[CompositeKeySkipSharedKey2], [s1].[CompositeKeySkipSharedKey3], [s1].[CompositeId1], [s1].[CompositeId2], [s1].[CompositeId3], [s1].[Id] """); } @@ -993,7 +991,7 @@ FROM [EntityCompositeKeyEntityTwo] AS [e0] ) AS [s] ON [e].[Key1] = [s].[CompositeKeySkipSharedKey1] AND [e].[Key2] = [s].[CompositeKeySkipSharedKey2] AND [e].[Key3] = [s].[CompositeKeySkipSharedKey3] WHERE [e].[Key1] < 5 ) AS [s0] ON [l].[Id] = [s0].[LeafId] -ORDER BY [l].[Id], [s0].[LeafId], [s0].[CompositeId1], [s0].[CompositeId2], [s0].[CompositeId3], [s0].[Key1], [s0].[Key2], [s0].[Key3], [s0].[TwoSkipSharedId], [s0].[CompositeKeySkipSharedKey1], [s0].[CompositeKeySkipSharedKey2], [s0].[CompositeKeySkipSharedKey3] +ORDER BY [l].[Id], [s0].[LeafId], [s0].[CompositeId1], [s0].[CompositeId2], [s0].[CompositeId3], [s0].[TwoSkipSharedId], [s0].[CompositeKeySkipSharedKey1], [s0].[CompositeKeySkipSharedKey2] """); } @@ -1022,7 +1020,7 @@ FROM [JoinTwoToThree] AS [j0] WHERE [e1].[Id] < 10 ) AS [s0] ON [s].[Id] = [s0].[TwoId] ) AS [s1] -ORDER BY [e].[Id], [s1].[Id], [s1].[OneId], [s1].[TwoId], [s1].[ThreeId], [s1].[TwoId0] +ORDER BY [e].[Id], [s1].[Id], [s1].[OneId], [s1].[TwoId], [s1].[ThreeId] """); } @@ -1049,7 +1047,7 @@ FROM [JoinTwoToThree] AS [j0] ) AS [s0] ON [e0].[Id] = [s0].[TwoId] WHERE [e0].[Id] < 10 ) AS [s1] ON [e].[Id] = [s1].[OneId] -ORDER BY [e].[Id], [s1].[OneId], [s1].[TwoId], [s1].[Id], [s1].[TwoId0], [s1].[Id0] +ORDER BY [e].[Id], [s1].[OneId], [s1].[TwoId], [s1].[TwoId0], [s1].[Id0] """); } @@ -1069,7 +1067,7 @@ FROM [JoinOneToTwo] AS [j] LEFT JOIN [EntityTwos] AS [e2] ON [e0].[Id] = [e2].[CollectionInverseId] WHERE [e0].[Id] < 10 ) AS [s] ON [e].[Id] = [s].[TwoId] -ORDER BY [e].[Id], [s].[OneId], [s].[TwoId], [s].[Id], [s].[Id0] +ORDER BY [e].[Id], [s].[OneId], [s].[TwoId] """); } @@ -1108,7 +1106,7 @@ WHERE [u].[Id] < 20 ) AS [s1] ON [e0].[Id] = [s1].[EntityOneId] WHERE [e0].[Id] < 10 ) AS [s2] ON [e].[Id] = [s2].[ThreeId] -ORDER BY [e].[Id], [s2].[OneId], [s2].[ThreeId], [s2].[Id], [s2].[OneId0], [s2].[Id0], [s2].[TwoId], [s2].[EntityBranchId], [s2].[EntityOneId] +ORDER BY [e].[Id], [s2].[OneId], [s2].[ThreeId], [s2].[OneId0], [s2].[Id0], [s2].[TwoId], [s2].[EntityBranchId] """); } @@ -1131,7 +1129,7 @@ WHERE [e1].[Id] < 5 ) AS [e2] ON [e0].[Id] = [e2].[CollectionInverseId] WHERE [e0].[Id] > 15 ) AS [s] ON [e].[Id] = [s].[ThreeId] -ORDER BY [e].[Id], [s].[OneId], [s].[ThreeId], [s].[Id] +ORDER BY [e].[Id], [s].[OneId], [s].[ThreeId] """); } @@ -1154,7 +1152,7 @@ WHERE [e1].[Id] < 5 ) AS [s] ON [e0].[Id] = [s].[TwoId] WHERE [e0].[Id] > 15 ) AS [s0] ON [e].[Id] = [s0].[CollectionInverseId] -ORDER BY [e].[Id], [s0].[Id], [s0].[ThreeId], [s0].[TwoId] +ORDER BY [e].[Id], [s0].[Id], [s0].[ThreeId] """); } @@ -1250,11 +1248,11 @@ INNER JOIN ( FROM [JoinCompositeKeyToLeaf] AS [j] INNER JOIN [Leaves] AS [l] ON [j].[LeafId] = [l].[Id] ) AS [s] ON [e].[Key1] = [s].[CompositeId1] AND [e].[Key2] = [s].[CompositeId2] AND [e].[Key3] = [s].[CompositeId3] -ORDER BY [e].[Key1], [e].[Key2], [e].[Key3], [s].[LeafId], [s].[CompositeId1], [s].[CompositeId2], [s].[CompositeId3], [s].[Id] +ORDER BY [e].[Key1], [e].[Key2], [e].[Key3], [s].[LeafId], [s].[CompositeId1], [s].[CompositeId2], [s].[CompositeId3] """, // """ -SELECT [s0].[Id], [s0].[Name], [e].[Key1], [e].[Key2], [e].[Key3], [s].[LeafId], [s].[CompositeId1], [s].[CompositeId2], [s].[CompositeId3], [s].[Id] +SELECT [s0].[Id], [s0].[Name], [e].[Key1], [e].[Key2], [e].[Key3], [s].[LeafId], [s].[CompositeId1], [s].[CompositeId2], [s].[CompositeId3] FROM [EntityCompositeKeys] AS [e] INNER JOIN ( SELECT [l].[Id], [j].[LeafId], [j].[CompositeId1], [j].[CompositeId2], [j].[CompositeId3] @@ -1266,7 +1264,7 @@ INNER JOIN ( FROM [JoinOneToBranch] AS [j0] INNER JOIN [EntityOnes] AS [e0] ON [j0].[EntityOneId] = [e0].[Id] ) AS [s0] ON [s].[Id] = [s0].[EntityBranchId] -ORDER BY [e].[Key1], [e].[Key2], [e].[Key3], [s].[LeafId], [s].[CompositeId1], [s].[CompositeId2], [s].[CompositeId3], [s].[Id] +ORDER BY [e].[Key1], [e].[Key2], [e].[Key3], [s].[LeafId], [s].[CompositeId1], [s].[CompositeId2], [s].[CompositeId3] """); } @@ -1290,24 +1288,23 @@ FROM [JoinOneToThreePayloadFull] AS [j] INNER JOIN [EntityOnes] AS [e0] ON [j].[OneId] = [e0].[Id] LEFT JOIN [EntityTwos] AS [e1] ON [e0].[Id] = [e1].[ReferenceInverseId] ) AS [s] ON [e].[Id] = [s].[ThreeId] -ORDER BY [e].[Id], [s].[OneId], [s].[ThreeId], [s].[Id], [s].[Id0] +ORDER BY [e].[Id], [s].[OneId], [s].[ThreeId] """, // """ -SELECT [s0].[Id], [s0].[Name], [e].[Id], [s].[OneId], [s].[ThreeId], [s].[Id], [s].[Id0] +SELECT [s0].[Id], [s0].[Name], [e].[Id], [s].[OneId], [s].[ThreeId] FROM [EntityThrees] AS [e] INNER JOIN ( - SELECT [e0].[Id], [e1].[Id] AS [Id0], [j].[OneId], [j].[ThreeId] + SELECT [e0].[Id], [j].[OneId], [j].[ThreeId] FROM [JoinOneToThreePayloadFull] AS [j] INNER JOIN [EntityOnes] AS [e0] ON [j].[OneId] = [e0].[Id] - LEFT JOIN [EntityTwos] AS [e1] ON [e0].[Id] = [e1].[ReferenceInverseId] ) AS [s] ON [e].[Id] = [s].[ThreeId] INNER JOIN ( SELECT [e2].[Id], [e2].[Name], [j0].[LeftId] FROM [JoinOneSelfPayload] AS [j0] INNER JOIN [EntityOnes] AS [e2] ON [j0].[RightId] = [e2].[Id] ) AS [s0] ON [s].[Id] = [s0].[LeftId] -ORDER BY [e].[Id], [s].[OneId], [s].[ThreeId], [s].[Id], [s].[Id0] +ORDER BY [e].[Id], [s].[OneId], [s].[ThreeId] """); } @@ -1320,19 +1317,18 @@ public override async Task Include_skip_navigation_and_reference_split(bool asyn SELECT [e].[Id], [e].[CollectionInverseId], [e].[ExtraId], [e].[Name], [e].[ReferenceInverseId], [e0].[Id], [e0].[CollectionInverseId], [e0].[Name], [e0].[ReferenceInverseId] FROM [EntityTwos] AS [e] LEFT JOIN [EntityThrees] AS [e0] ON [e].[Id] = [e0].[ReferenceInverseId] -ORDER BY [e].[Id], [e0].[Id] +ORDER BY [e].[Id] """, // """ -SELECT [s].[Id], [s].[Name], [e].[Id], [e0].[Id] +SELECT [s].[Id], [s].[Name], [e].[Id] FROM [EntityTwos] AS [e] -LEFT JOIN [EntityThrees] AS [e0] ON [e].[Id] = [e0].[ReferenceInverseId] INNER JOIN ( SELECT [e2].[Id], [e2].[Name], [e1].[TwoSkipSharedId] FROM [EntityOneEntityTwo] AS [e1] INNER JOIN [EntityOnes] AS [e2] ON [e1].[OneSkipSharedId] = [e2].[Id] ) AS [s] ON [e].[Id] = [s].[TwoSkipSharedId] -ORDER BY [e].[Id], [e0].[Id] +ORDER BY [e].[Id] """); } @@ -1507,11 +1503,11 @@ INNER JOIN ( FROM [EntityRootEntityThree] AS [e] INNER JOIN [EntityThrees] AS [e0] ON [e].[ThreeSkipSharedId] = [e0].[Id] ) AS [s] ON [u].[Id] = [s].[RootSkipSharedId] -ORDER BY [u].[Id], [s].[RootSkipSharedId], [s].[ThreeSkipSharedId], [s].[Id] +ORDER BY [u].[Id], [s].[RootSkipSharedId], [s].[ThreeSkipSharedId] """, // """ -SELECT [s0].[Id], [s0].[Name], [u].[Id], [s].[RootSkipSharedId], [s].[ThreeSkipSharedId], [s].[Id] +SELECT [s0].[Id], [s0].[Name], [u].[Id], [s].[RootSkipSharedId], [s].[ThreeSkipSharedId] FROM ( SELECT [r].[Id] FROM [Roots] AS [r] @@ -1536,7 +1532,7 @@ FROM [JoinOneToThreePayloadFullShared] AS [j] INNER JOIN [EntityOnes] AS [e1] ON [j].[OneId] = [e1].[Id] WHERE [e1].[Id] < 10 ) AS [s0] ON [s].[Id] = [s0].[ThreeId] -ORDER BY [u].[Id], [s].[RootSkipSharedId], [s].[ThreeSkipSharedId], [s].[Id] +ORDER BY [u].[Id], [s].[RootSkipSharedId], [s].[ThreeSkipSharedId] """); } @@ -1583,11 +1579,11 @@ INNER JOIN ( FROM [EntityCompositeKeyEntityRoot] AS [e] INNER JOIN [EntityCompositeKeys] AS [e0] ON [e].[CompositeKeySkipSharedKey1] = [e0].[Key1] AND [e].[CompositeKeySkipSharedKey2] = [e0].[Key2] AND [e].[CompositeKeySkipSharedKey3] = [e0].[Key3] ) AS [s] ON [u].[Id] = [s].[RootSkipSharedId] -ORDER BY [u].[Id], [s].[RootSkipSharedId], [s].[CompositeKeySkipSharedKey1], [s].[CompositeKeySkipSharedKey2], [s].[CompositeKeySkipSharedKey3], [s].[Key1], [s].[Key2], [s].[Key3] +ORDER BY [u].[Id], [s].[RootSkipSharedId], [s].[CompositeKeySkipSharedKey1], [s].[CompositeKeySkipSharedKey2], [s].[CompositeKeySkipSharedKey3] """, // """ -SELECT [s1].[Id], [s1].[CollectionInverseId], [s1].[Name], [s1].[ReferenceInverseId], [u].[Id], [s].[RootSkipSharedId], [s].[CompositeKeySkipSharedKey1], [s].[CompositeKeySkipSharedKey2], [s].[CompositeKeySkipSharedKey3], [s].[Key1], [s].[Key2], [s].[Key3] +SELECT [s1].[Id], [s1].[CollectionInverseId], [s1].[Name], [s1].[ReferenceInverseId], [u].[Id], [s].[RootSkipSharedId], [s].[CompositeKeySkipSharedKey1], [s].[CompositeKeySkipSharedKey2], [s].[CompositeKeySkipSharedKey3] FROM ( SELECT [r].[Id] FROM [Roots] AS [r] @@ -1615,7 +1611,7 @@ FROM [JoinThreeToCompositeKeyFull] AS [j] ) AS [s0] WHERE 1 < [s0].[row] AND [s0].[row] <= 3 ) AS [s1] ON [s].[Key1] = [s1].[CompositeId1] AND [s].[Key2] = [s1].[CompositeId2] AND [s].[Key3] = [s1].[CompositeId3] -ORDER BY [u].[Id], [s].[RootSkipSharedId], [s].[CompositeKeySkipSharedKey1], [s].[CompositeKeySkipSharedKey2], [s].[CompositeKeySkipSharedKey3], [s].[Key1], [s].[Key2], [s].[Key3], [s1].[CompositeId1], [s1].[CompositeId2], [s1].[CompositeId3], [s1].[Id] +ORDER BY [u].[Id], [s].[RootSkipSharedId], [s].[CompositeKeySkipSharedKey1], [s].[CompositeKeySkipSharedKey2], [s].[CompositeKeySkipSharedKey3], [s1].[CompositeId1], [s1].[CompositeId2], [s1].[CompositeId3], [s1].[Id] """); } @@ -1639,11 +1635,11 @@ FROM [JoinCompositeKeyToLeaf] AS [j] INNER JOIN [EntityCompositeKeys] AS [e] ON [j].[CompositeId1] = [e].[Key1] AND [j].[CompositeId2] = [e].[Key2] AND [j].[CompositeId3] = [e].[Key3] WHERE [e].[Key1] < 5 ) AS [s] ON [l].[Id] = [s].[LeafId] -ORDER BY [l].[Id], [s].[LeafId], [s].[CompositeId1], [s].[CompositeId2], [s].[CompositeId3], [s].[Key1], [s].[Key2], [s].[Key3] +ORDER BY [l].[Id], [s].[LeafId], [s].[CompositeId1], [s].[CompositeId2], [s].[CompositeId3] """, // """ -SELECT [s0].[Id], [s0].[CollectionInverseId], [s0].[ExtraId], [s0].[Name], [s0].[ReferenceInverseId], [l].[Id], [s].[LeafId], [s].[CompositeId1], [s].[CompositeId2], [s].[CompositeId3], [s].[Key1], [s].[Key2], [s].[Key3] +SELECT [s0].[Id], [s0].[CollectionInverseId], [s0].[ExtraId], [s0].[Name], [s0].[ReferenceInverseId], [l].[Id], [s].[LeafId], [s].[CompositeId1], [s].[CompositeId2], [s].[CompositeId3] FROM [Leaves] AS [l] INNER JOIN ( SELECT [e].[Key1], [e].[Key2], [e].[Key3], [j].[LeafId], [j].[CompositeId1], [j].[CompositeId2], [j].[CompositeId3] @@ -1656,7 +1652,7 @@ INNER JOIN ( FROM [EntityCompositeKeyEntityTwo] AS [e0] INNER JOIN [EntityTwos] AS [e1] ON [e0].[TwoSkipSharedId] = [e1].[Id] ) AS [s0] ON [s].[Key1] = [s0].[CompositeKeySkipSharedKey1] AND [s].[Key2] = [s0].[CompositeKeySkipSharedKey2] AND [s].[Key3] = [s0].[CompositeKeySkipSharedKey3] -ORDER BY [l].[Id], [s].[LeafId], [s].[CompositeId1], [s].[CompositeId2], [s].[CompositeId3], [s].[Key1], [s].[Key2], [s].[Key3] +ORDER BY [l].[Id], [s].[LeafId], [s].[CompositeId1], [s].[CompositeId2], [s].[CompositeId3] """); } @@ -1687,7 +1683,7 @@ FROM [JoinOneToTwo] AS [j] """, // """ -SELECT [s1].[Id], [s1].[CollectionInverseId], [s1].[Name], [s1].[ReferenceInverseId], [e].[Id], [s0].[OneId], [s0].[TwoId], [s0].[Id] +SELECT [s1].[Id], [s1].[CollectionInverseId], [s1].[Name], [s1].[ReferenceInverseId], [e].[Id], [s0].[OneId], [s0].[TwoId] FROM [EntityOnes] AS [e] INNER JOIN ( SELECT [s].[Id], [s].[OneId], [s].[TwoId] @@ -1728,11 +1724,11 @@ FROM [JoinOneToTwo] AS [j] INNER JOIN [EntityTwos] AS [e0] ON [j].[TwoId] = [e0].[Id] WHERE [e0].[Id] < 10 ) AS [s] ON [e].[Id] = [s].[OneId] -ORDER BY [e].[Id], [s].[OneId], [s].[TwoId], [s].[Id] +ORDER BY [e].[Id], [s].[OneId], [s].[TwoId] """, // """ -SELECT [s1].[Id], [s1].[CollectionInverseId], [s1].[Name], [s1].[ReferenceInverseId], [e].[Id], [s].[OneId], [s].[TwoId], [s].[Id] +SELECT [s1].[Id], [s1].[CollectionInverseId], [s1].[Name], [s1].[ReferenceInverseId], [e].[Id], [s].[OneId], [s].[TwoId] FROM [EntityOnes] AS [e] INNER JOIN ( SELECT [e0].[Id], [j].[OneId], [j].[TwoId] @@ -1749,7 +1745,7 @@ FROM [JoinTwoToThree] AS [j0] ) AS [s0] WHERE 1 < [s0].[row] AND [s0].[row] <= 3 ) AS [s1] ON [s].[Id] = [s1].[TwoId] -ORDER BY [e].[Id], [s].[OneId], [s].[TwoId], [s].[Id], [s1].[TwoId], [s1].[Id] +ORDER BY [e].[Id], [s].[OneId], [s].[TwoId], [s1].[TwoId], [s1].[Id] """); } @@ -1774,21 +1770,20 @@ FROM [JoinOneToTwo] AS [j] LEFT JOIN [EntityTwos] AS [e1] ON [e0].[Id] = [e1].[ReferenceInverseId] WHERE [e0].[Id] < 10 ) AS [s] ON [e].[Id] = [s].[TwoId] -ORDER BY [e].[Id], [s].[OneId], [s].[TwoId], [s].[Id], [s].[Id0] +ORDER BY [e].[Id], [s].[OneId], [s].[TwoId] """, // """ -SELECT [e2].[Id], [e2].[CollectionInverseId], [e2].[ExtraId], [e2].[Name], [e2].[ReferenceInverseId], [e].[Id], [s].[OneId], [s].[TwoId], [s].[Id], [s].[Id0] +SELECT [e2].[Id], [e2].[CollectionInverseId], [e2].[ExtraId], [e2].[Name], [e2].[ReferenceInverseId], [e].[Id], [s].[OneId], [s].[TwoId] FROM [EntityTwos] AS [e] INNER JOIN ( - SELECT [e0].[Id], [e1].[Id] AS [Id0], [j].[OneId], [j].[TwoId] + SELECT [e0].[Id], [j].[OneId], [j].[TwoId] FROM [JoinOneToTwo] AS [j] INNER JOIN [EntityOnes] AS [e0] ON [j].[OneId] = [e0].[Id] - LEFT JOIN [EntityTwos] AS [e1] ON [e0].[Id] = [e1].[ReferenceInverseId] WHERE [e0].[Id] < 10 ) AS [s] ON [e].[Id] = [s].[TwoId] INNER JOIN [EntityTwos] AS [e2] ON [s].[Id] = [e2].[CollectionInverseId] -ORDER BY [e].[Id], [s].[OneId], [s].[TwoId], [s].[Id], [s].[Id0] +ORDER BY [e].[Id], [s].[OneId], [s].[TwoId] """); } @@ -1812,11 +1807,11 @@ FROM [JoinOneToThreePayloadFull] AS [j] INNER JOIN [EntityOnes] AS [e0] ON [j].[OneId] = [e0].[Id] WHERE [e0].[Id] < 10 ) AS [s] ON [e].[Id] = [s].[ThreeId] -ORDER BY [e].[Id], [s].[OneId], [s].[ThreeId], [s].[Id] +ORDER BY [e].[Id], [s].[OneId], [s].[ThreeId] """, // """ -SELECT [s1].[Id], [s1].[CollectionInverseId], [s1].[ExtraId], [s1].[Name], [s1].[ReferenceInverseId], [e].[Id], [s].[OneId], [s].[ThreeId], [s].[Id] +SELECT [s1].[Id], [s1].[CollectionInverseId], [s1].[ExtraId], [s1].[Name], [s1].[ReferenceInverseId], [e].[Id], [s].[OneId], [s].[ThreeId] FROM [EntityThrees] AS [e] INNER JOIN ( SELECT [e0].[Id], [j].[OneId], [j].[ThreeId] @@ -1833,11 +1828,11 @@ FROM [JoinOneToTwo] AS [j0] ) AS [s0] WHERE 1 < [s0].[row] AND [s0].[row] <= 3 ) AS [s1] ON [s].[Id] = [s1].[OneId] -ORDER BY [e].[Id], [s].[OneId], [s].[ThreeId], [s].[Id], [s1].[OneId], [s1].[Id] +ORDER BY [e].[Id], [s].[OneId], [s].[ThreeId], [s1].[OneId], [s1].[Id] """, // """ -SELECT [s2].[Id], [s2].[Name], [s2].[Number], [s2].[IsGreen], [s2].[Discriminator], [e].[Id], [s].[OneId], [s].[ThreeId], [s].[Id] +SELECT [s2].[Id], [s2].[Name], [s2].[Number], [s2].[IsGreen], [s2].[Discriminator], [e].[Id], [s].[OneId], [s].[ThreeId] FROM [EntityThrees] AS [e] INNER JOIN ( SELECT [e0].[Id], [j].[OneId], [j].[ThreeId] @@ -1857,7 +1852,7 @@ FROM [Leaves] AS [l] ) AS [u] ON [j1].[EntityBranchId] = [u].[Id] WHERE [u].[Id] < 20 ) AS [s2] ON [s].[Id] = [s2].[EntityOneId] -ORDER BY [e].[Id], [s].[OneId], [s].[ThreeId], [s].[Id] +ORDER BY [e].[Id], [s].[OneId], [s].[ThreeId] """); } @@ -1881,11 +1876,11 @@ FROM [JoinOneToThreePayloadFull] AS [j] INNER JOIN [EntityOnes] AS [e0] ON [j].[OneId] = [e0].[Id] WHERE [e0].[Id] > 15 ) AS [s] ON [e].[Id] = [s].[ThreeId] -ORDER BY [e].[Id], [s].[OneId], [s].[ThreeId], [s].[Id] +ORDER BY [e].[Id], [s].[OneId], [s].[ThreeId] """, // """ -SELECT [e2].[Id], [e2].[CollectionInverseId], [e2].[ExtraId], [e2].[Name], [e2].[ReferenceInverseId], [e].[Id], [s].[OneId], [s].[ThreeId], [s].[Id] +SELECT [e2].[Id], [e2].[CollectionInverseId], [e2].[ExtraId], [e2].[Name], [e2].[ReferenceInverseId], [e].[Id], [s].[OneId], [s].[ThreeId] FROM [EntityThrees] AS [e] INNER JOIN ( SELECT [e0].[Id], [j].[OneId], [j].[ThreeId] @@ -1898,7 +1893,7 @@ INNER JOIN ( FROM [EntityTwos] AS [e1] WHERE [e1].[Id] < 5 ) AS [e2] ON [s].[Id] = [e2].[CollectionInverseId] -ORDER BY [e].[Id], [s].[OneId], [s].[ThreeId], [s].[Id] +ORDER BY [e].[Id], [s].[OneId], [s].[ThreeId] """); } @@ -2109,7 +2104,7 @@ FROM [JoinTwoToThree] AS [j0] WHERE [e1].[Id] < 10 ) AS [s0] ON [s].[Id] = [s0].[TwoId] ) AS [s1] -ORDER BY [e].[Id], [s1].[Id], [s1].[OneId], [s1].[TwoId], [s1].[ThreeId], [s1].[TwoId0] +ORDER BY [e].[Id], [s1].[Id], [s1].[OneId], [s1].[TwoId], [s1].[ThreeId] """); } @@ -2179,7 +2174,6 @@ FROM [UnidirectionalEntityOnes] AS [u] WHERE EXISTS ( SELECT 1 FROM [UnidirectionalJoinOneSelfPayload] AS [u0] - INNER JOIN [UnidirectionalEntityOnes] AS [u1] ON [u0].[LeftId] = [u1].[Id] WHERE [u].[Id] = [u0].[RightId]) """); } @@ -2264,7 +2258,7 @@ FROM [UnidirectionalLeaves] AS [u4] ) AS [u1] ON [u0].[RootSkipSharedId] = [u1].[Id] WHERE [u1].[Discriminator] = N'UnidirectionalEntityLeaf' ) AS [s] ON [u].[Key1] = [s].[UnidirectionalEntityCompositeKeyKey1] AND [u].[Key2] = [s].[UnidirectionalEntityCompositeKeyKey2] AND [u].[Key3] = [s].[UnidirectionalEntityCompositeKeyKey3] -ORDER BY [u].[Key1], [u].[Key2], [u].[Key3], [s].[RootSkipSharedId], [s].[UnidirectionalEntityCompositeKeyKey1], [s].[UnidirectionalEntityCompositeKeyKey2], [s].[UnidirectionalEntityCompositeKeyKey3] +ORDER BY [u].[Key1], [u].[Key2], [u].[Key3], [s].[RootSkipSharedId], [s].[UnidirectionalEntityCompositeKeyKey1], [s].[UnidirectionalEntityCompositeKeyKey2] """); } @@ -2424,7 +2418,7 @@ LEFT JOIN ( FROM [UnidirectionalJoinOneSelfPayload] AS [u0] INNER JOIN [UnidirectionalEntityOnes] AS [u1] ON [u0].[LeftId] = [u1].[Id] ) AS [s] ON [u].[Id] = [s].[RightId] -ORDER BY [u].[Id], [s].[LeftId], [s].[RightId] +ORDER BY [u].[Id], [s].[LeftId] """); } @@ -2450,7 +2444,7 @@ UNION ALL FROM [UnidirectionalLeaves] AS [u4] ) AS [u1] ON [u0].[RootSkipSharedId] = [u1].[Id] ) AS [s] ON [u].[Key1] = [s].[UnidirectionalEntityCompositeKeyKey1] AND [u].[Key2] = [s].[UnidirectionalEntityCompositeKeyKey2] AND [u].[Key3] = [s].[UnidirectionalEntityCompositeKeyKey3] -ORDER BY [u].[Key1], [u].[Key2], [u].[Key3], [s].[RootSkipSharedId], [s].[UnidirectionalEntityCompositeKeyKey1], [s].[UnidirectionalEntityCompositeKeyKey2], [s].[UnidirectionalEntityCompositeKeyKey3] +ORDER BY [u].[Key1], [u].[Key2], [u].[Key3], [s].[RootSkipSharedId], [s].[UnidirectionalEntityCompositeKeyKey1], [s].[UnidirectionalEntityCompositeKeyKey2] """); } @@ -2468,7 +2462,7 @@ FROM [UnidirectionalJoinOneToTwo] AS [u0] INNER JOIN [UnidirectionalEntityOnes] AS [u1] ON [u0].[OneId] = [u1].[Id] LEFT JOIN [UnidirectionalEntityTwos] AS [u2] ON [u1].[Id] = [u2].[ReferenceInverseId] ) AS [s] ON [u].[Id] = [s].[TwoId] -ORDER BY [u].[Id], [s].[OneId], [s].[TwoId], [s].[Id] +ORDER BY [u].[Id], [s].[OneId] """); } @@ -2490,7 +2484,7 @@ FROM [UnidirectionalJoinOneToBranch] AS [u2] INNER JOIN [UnidirectionalEntityOnes] AS [u3] ON [u2].[UnidirectionalEntityOneId] = [u3].[Id] ) AS [s] ON [u1].[Id] = [s].[UnidirectionalEntityBranchId] ) AS [s0] ON [u].[Key1] = [s0].[CompositeId1] AND [u].[Key2] = [s0].[CompositeId2] AND [u].[Key3] = [s0].[CompositeId3] -ORDER BY [u].[Key1], [u].[Key2], [u].[Key3], [s0].[LeafId], [s0].[CompositeId1], [s0].[CompositeId2], [s0].[CompositeId3], [s0].[Id], [s0].[UnidirectionalEntityBranchId], [s0].[UnidirectionalEntityOneId] +ORDER BY [u].[Key1], [u].[Key2], [u].[Key3], [s0].[LeafId], [s0].[CompositeId1], [s0].[CompositeId2], [s0].[CompositeId3], [s0].[UnidirectionalEntityBranchId] """); } @@ -2513,7 +2507,7 @@ FROM [UnidirectionalJoinOneSelfPayload] AS [u3] INNER JOIN [UnidirectionalEntityOnes] AS [u4] ON [u3].[RightId] = [u4].[Id] ) AS [s] ON [u1].[Id] = [s].[LeftId] ) AS [s0] ON [u].[Id] = [s0].[ThreeId] -ORDER BY [u].[Id], [s0].[OneId], [s0].[ThreeId], [s0].[Id], [s0].[Id0], [s0].[LeftId], [s0].[RightId] +ORDER BY [u].[Id], [s0].[OneId], [s0].[ThreeId], [s0].[LeftId] """); } @@ -2523,7 +2517,7 @@ public override async Task Include_skip_navigation_and_reference_unidirectional( AssertSql( """ -SELECT [u].[Id], [u].[CollectionInverseId], [u].[ExtraId], [u].[Name], [u].[ReferenceInverseId], [u0].[Id], [s].[Id], [s].[Name], [s].[TwoSkipSharedId], [s].[UnidirectionalEntityOneId], [u0].[CollectionInverseId], [u0].[Name], [u0].[ReferenceInverseId] +SELECT [u].[Id], [u].[CollectionInverseId], [u].[ExtraId], [u].[Name], [u].[ReferenceInverseId], [s].[Id], [s].[Name], [s].[TwoSkipSharedId], [s].[UnidirectionalEntityOneId], [u0].[Id], [u0].[CollectionInverseId], [u0].[Name], [u0].[ReferenceInverseId] FROM [UnidirectionalEntityTwos] AS [u] LEFT JOIN [UnidirectionalEntityThrees] AS [u0] ON [u].[Id] = [u0].[ReferenceInverseId] LEFT JOIN ( @@ -2531,7 +2525,7 @@ LEFT JOIN ( FROM [UnidirectionalEntityOneUnidirectionalEntityTwo] AS [u1] INNER JOIN [UnidirectionalEntityOnes] AS [u2] ON [u1].[UnidirectionalEntityOneId] = [u2].[Id] ) AS [s] ON [u].[Id] = [s].[TwoSkipSharedId] -ORDER BY [u].[Id], [u0].[Id], [s].[TwoSkipSharedId], [s].[UnidirectionalEntityOneId] +ORDER BY [u].[Id], [s].[TwoSkipSharedId] """); } @@ -2549,7 +2543,7 @@ FROM [JoinOneToThreePayloadFullShared] AS [j] INNER JOIN [EntityOnes] AS [e0] ON [j].[OneId] = [e0].[Id] WHERE [e0].[Id] < 10 ) AS [s] ON [e].[Id] = [s].[ThreeId] -ORDER BY [e].[Id], [s].[OneId], [s].[ThreeId] +ORDER BY [e].[Id], [s].[OneId] """); } @@ -2651,7 +2645,7 @@ FROM [UnidirectionalEntityCompositeKeyUnidirectionalEntityTwo] AS [u2] ) AS [s] ON [u1].[Key1] = [s].[UnidirectionalEntityCompositeKeyKey1] AND [u1].[Key2] = [s].[UnidirectionalEntityCompositeKeyKey2] AND [u1].[Key3] = [s].[UnidirectionalEntityCompositeKeyKey3] WHERE [u1].[Key1] < 5 ) AS [s0] ON [u].[Id] = [s0].[LeafId] -ORDER BY [u].[Id], [s0].[LeafId], [s0].[CompositeId1], [s0].[CompositeId2], [s0].[CompositeId3], [s0].[Key1], [s0].[Key2], [s0].[Key3], [s0].[TwoSkipSharedId], [s0].[UnidirectionalEntityCompositeKeyKey1], [s0].[UnidirectionalEntityCompositeKeyKey2], [s0].[UnidirectionalEntityCompositeKeyKey3] +ORDER BY [u].[Id], [s0].[LeafId], [s0].[CompositeId1], [s0].[CompositeId2], [s0].[CompositeId3], [s0].[TwoSkipSharedId], [s0].[UnidirectionalEntityCompositeKeyKey1], [s0].[UnidirectionalEntityCompositeKeyKey2] """); } @@ -2671,7 +2665,7 @@ FROM [JoinOneToTwo] AS [j] LEFT JOIN [EntityTwos] AS [e2] ON [e0].[Id] = [e2].[CollectionInverseId] WHERE [e0].[Id] < 10 ) AS [s] ON [e].[Id] = [s].[TwoId] -ORDER BY [e].[Id], [s].[OneId], [s].[TwoId], [s].[Id], [s].[Id0] +ORDER BY [e].[Id], [s].[OneId], [s].[TwoId] """); } diff --git a/test/EFCore.SqlServer.FunctionalTests/Query/Inheritance/TPCManyToManyQuerySqlServerTest.cs b/test/EFCore.SqlServer.FunctionalTests/Query/Inheritance/TPCManyToManyQuerySqlServerTest.cs index 338965af09a..d71dc709784 100644 --- a/test/EFCore.SqlServer.FunctionalTests/Query/Inheritance/TPCManyToManyQuerySqlServerTest.cs +++ b/test/EFCore.SqlServer.FunctionalTests/Query/Inheritance/TPCManyToManyQuerySqlServerTest.cs @@ -93,7 +93,6 @@ FROM [EntityOnes] AS [e] WHERE EXISTS ( SELECT 1 FROM [JoinOneSelfPayload] AS [j] - INNER JOIN [EntityOnes] AS [e0] ON [j].[LeftId] = [e0].[Id] WHERE [e].[Id] = [j].[RightId]) """); } @@ -131,7 +130,6 @@ FROM [EntityTwos] AS [e] WHERE ( SELECT COUNT_BIG(*) FROM [JoinTwoToThree] AS [j] - INNER JOIN [EntityThrees] AS [e0] ON [j].[ThreeId] = [e0].[Id] WHERE [e].[Id] = [j].[TwoId]) > CAST(0 AS bigint) """); } @@ -399,7 +397,7 @@ LEFT JOIN ( FROM [JoinCompositeKeyToLeaf] AS [j] INNER JOIN [Leaves] AS [l] ON [j].[LeafId] = [l].[Id] ) AS [s] ON [e].[Key1] = [s].[CompositeId1] AND [e].[Key2] = [s].[CompositeId2] AND [e].[Key3] = [s].[CompositeId3] -ORDER BY [e].[Key1], [e].[Key2], [e].[Key3], [s].[LeafId], [s].[CompositeId1], [s].[CompositeId2], [s].[CompositeId3] +ORDER BY [e].[Key1], [e].[Key2], [e].[Key3], [s].[LeafId], [s].[CompositeId1], [s].[CompositeId2] """); } @@ -429,7 +427,7 @@ FROM [Leaf2s] AS [l0] ) AS [u] ON [e0].[RootSkipSharedId] = [u].[Id] WHERE [u].[Discriminator] = N'EntityLeaf' ) AS [s] ON [e].[Key1] = [s].[CompositeKeySkipSharedKey1] AND [e].[Key2] = [s].[CompositeKeySkipSharedKey2] AND [e].[Key3] = [s].[CompositeKeySkipSharedKey3] -ORDER BY [e].[Key1], [e].[Key2], [e].[Key3], [s].[RootSkipSharedId], [s].[CompositeKeySkipSharedKey1], [s].[CompositeKeySkipSharedKey2], [s].[CompositeKeySkipSharedKey3] +ORDER BY [e].[Key1], [e].[Key2], [e].[Key3], [s].[RootSkipSharedId], [s].[CompositeKeySkipSharedKey1], [s].[CompositeKeySkipSharedKey2] """); } @@ -641,7 +639,7 @@ LEFT JOIN ( FROM [JoinOneSelfPayload] AS [j] INNER JOIN [EntityOnes] AS [e0] ON [j].[LeftId] = [e0].[Id] ) AS [s] ON [e].[Id] = [s].[RightId] -ORDER BY [e].[Id], [s].[LeftId], [s].[RightId] +ORDER BY [e].[Id], [s].[LeftId] """); } @@ -668,7 +666,7 @@ LEFT JOIN ( FROM [EntityCompositeKeyEntityTwo] AS [e3] INNER JOIN [EntityCompositeKeys] AS [e4] ON [e3].[CompositeKeySkipSharedKey1] = [e4].[Key1] AND [e3].[CompositeKeySkipSharedKey2] = [e4].[Key2] AND [e3].[CompositeKeySkipSharedKey3] = [e4].[Key3] ) AS [s1] ON [e].[Id] = [s1].[TwoSkipSharedId] -ORDER BY [e].[Id], [s].[ThreeId], [s].[TwoId], [s].[Id], [s0].[SelfSkipSharedLeftId], [s0].[SelfSkipSharedRightId], [s0].[Id], [s1].[TwoSkipSharedId], [s1].[CompositeKeySkipSharedKey1], [s1].[CompositeKeySkipSharedKey2], [s1].[CompositeKeySkipSharedKey3], [s1].[Key1], [s1].[Key2] +ORDER BY [e].[Id], [s].[ThreeId], [s].[TwoId], [s0].[SelfSkipSharedLeftId], [s0].[SelfSkipSharedRightId], [s1].[TwoSkipSharedId], [s1].[CompositeKeySkipSharedKey1], [s1].[CompositeKeySkipSharedKey2] """); } @@ -718,7 +716,7 @@ UNION ALL FROM [Leaf2s] AS [l0] ) AS [u] ON [e0].[RootSkipSharedId] = [u].[Id] ) AS [s] ON [e].[Key1] = [s].[CompositeKeySkipSharedKey1] AND [e].[Key2] = [s].[CompositeKeySkipSharedKey2] AND [e].[Key3] = [s].[CompositeKeySkipSharedKey3] -ORDER BY [e].[Key1], [e].[Key2], [e].[Key3], [s].[RootSkipSharedId], [s].[CompositeKeySkipSharedKey1], [s].[CompositeKeySkipSharedKey2], [s].[CompositeKeySkipSharedKey3] +ORDER BY [e].[Key1], [e].[Key2], [e].[Key3], [s].[RootSkipSharedId], [s].[CompositeKeySkipSharedKey1], [s].[CompositeKeySkipSharedKey2] """); } @@ -736,7 +734,7 @@ FROM [JoinOneToTwo] AS [j] INNER JOIN [EntityOnes] AS [e0] ON [j].[OneId] = [e0].[Id] LEFT JOIN [EntityTwos] AS [e1] ON [e0].[Id] = [e1].[ReferenceInverseId] ) AS [s] ON [e].[Id] = [s].[TwoId] -ORDER BY [e].[Id], [s].[OneId], [s].[TwoId], [s].[Id] +ORDER BY [e].[Id], [s].[OneId] """); } @@ -758,7 +756,7 @@ FROM [JoinOneToBranch] AS [j0] INNER JOIN [EntityOnes] AS [e0] ON [j0].[EntityOneId] = [e0].[Id] ) AS [s] ON [l].[Id] = [s].[EntityBranchId] ) AS [s0] ON [e].[Key1] = [s0].[CompositeId1] AND [e].[Key2] = [s0].[CompositeId2] AND [e].[Key3] = [s0].[CompositeId3] -ORDER BY [e].[Key1], [e].[Key2], [e].[Key3], [s0].[LeafId], [s0].[CompositeId1], [s0].[CompositeId2], [s0].[CompositeId3], [s0].[Id], [s0].[EntityBranchId], [s0].[EntityOneId] +ORDER BY [e].[Key1], [e].[Key2], [e].[Key3], [s0].[LeafId], [s0].[CompositeId1], [s0].[CompositeId2], [s0].[CompositeId3], [s0].[EntityBranchId] """); } @@ -781,7 +779,7 @@ FROM [JoinOneSelfPayload] AS [j0] INNER JOIN [EntityOnes] AS [e2] ON [j0].[RightId] = [e2].[Id] ) AS [s] ON [e0].[Id] = [s].[LeftId] ) AS [s0] ON [e].[Id] = [s0].[ThreeId] -ORDER BY [e].[Id], [s0].[OneId], [s0].[ThreeId], [s0].[Id], [s0].[Id0], [s0].[LeftId], [s0].[RightId] +ORDER BY [e].[Id], [s0].[OneId], [s0].[ThreeId], [s0].[LeftId] """); } @@ -791,7 +789,7 @@ public override async Task Include_skip_navigation_and_reference(bool async) AssertSql( """ -SELECT [e].[Id], [e].[CollectionInverseId], [e].[ExtraId], [e].[Name], [e].[ReferenceInverseId], [e0].[Id], [s].[OneSkipSharedId], [s].[TwoSkipSharedId], [s].[Id], [s].[Name], [e0].[CollectionInverseId], [e0].[Name], [e0].[ReferenceInverseId] +SELECT [e].[Id], [e].[CollectionInverseId], [e].[ExtraId], [e].[Name], [e].[ReferenceInverseId], [s].[OneSkipSharedId], [s].[TwoSkipSharedId], [s].[Id], [s].[Name], [e0].[Id], [e0].[CollectionInverseId], [e0].[Name], [e0].[ReferenceInverseId] FROM [EntityTwos] AS [e] LEFT JOIN [EntityThrees] AS [e0] ON [e].[Id] = [e0].[ReferenceInverseId] LEFT JOIN ( @@ -799,7 +797,7 @@ LEFT JOIN ( FROM [EntityOneEntityTwo] AS [e1] INNER JOIN [EntityOnes] AS [e2] ON [e1].[OneSkipSharedId] = [e2].[Id] ) AS [s] ON [e].[Id] = [s].[TwoSkipSharedId] -ORDER BY [e].[Id], [e0].[Id], [s].[OneSkipSharedId], [s].[TwoSkipSharedId] +ORDER BY [e].[Id], [s].[OneSkipSharedId] """); } @@ -817,7 +815,7 @@ FROM [JoinOneToThreePayloadFullShared] AS [j] INNER JOIN [EntityOnes] AS [e0] ON [j].[OneId] = [e0].[Id] WHERE [e0].[Id] < 10 ) AS [s] ON [e].[Id] = [s].[ThreeId] -ORDER BY [e].[Id], [s].[OneId], [s].[ThreeId] +ORDER BY [e].[Id], [s].[OneId] """); } @@ -932,7 +930,7 @@ FROM [JoinOneToThreePayloadFullShared] AS [j] WHERE [e1].[Id] < 10 ) AS [s] ON [e0].[Id] = [s].[ThreeId] ) AS [s0] ON [u].[Id] = [s0].[RootSkipSharedId] -ORDER BY [u].[Id], [s0].[RootSkipSharedId], [s0].[ThreeSkipSharedId], [s0].[Id], [s0].[OneId], [s0].[ThreeId] +ORDER BY [u].[Id], [s0].[RootSkipSharedId], [s0].[ThreeSkipSharedId], [s0].[OneId] """); } @@ -970,7 +968,7 @@ FROM [JoinThreeToCompositeKeyFull] AS [j] WHERE 1 < [s].[row] AND [s].[row] <= 3 ) AS [s0] ON [e0].[Key1] = [s0].[CompositeId1] AND [e0].[Key2] = [s0].[CompositeId2] AND [e0].[Key3] = [s0].[CompositeId3] ) AS [s1] ON [u].[Id] = [s1].[RootSkipSharedId] -ORDER BY [u].[Id], [s1].[RootSkipSharedId], [s1].[CompositeKeySkipSharedKey1], [s1].[CompositeKeySkipSharedKey2], [s1].[CompositeKeySkipSharedKey3], [s1].[Key1], [s1].[Key2], [s1].[Key3], [s1].[CompositeId1], [s1].[CompositeId2], [s1].[CompositeId3], [s1].[Id0] +ORDER BY [u].[Id], [s1].[RootSkipSharedId], [s1].[CompositeKeySkipSharedKey1], [s1].[CompositeKeySkipSharedKey2], [s1].[CompositeKeySkipSharedKey3], [s1].[CompositeId1], [s1].[CompositeId2], [s1].[CompositeId3], [s1].[Id0] """); } @@ -993,7 +991,7 @@ FROM [EntityCompositeKeyEntityTwo] AS [e0] ) AS [s] ON [e].[Key1] = [s].[CompositeKeySkipSharedKey1] AND [e].[Key2] = [s].[CompositeKeySkipSharedKey2] AND [e].[Key3] = [s].[CompositeKeySkipSharedKey3] WHERE [e].[Key1] < 5 ) AS [s0] ON [l].[Id] = [s0].[LeafId] -ORDER BY [l].[Id], [s0].[LeafId], [s0].[CompositeId1], [s0].[CompositeId2], [s0].[CompositeId3], [s0].[Key1], [s0].[Key2], [s0].[Key3], [s0].[TwoSkipSharedId], [s0].[CompositeKeySkipSharedKey1], [s0].[CompositeKeySkipSharedKey2], [s0].[CompositeKeySkipSharedKey3] +ORDER BY [l].[Id], [s0].[LeafId], [s0].[CompositeId1], [s0].[CompositeId2], [s0].[CompositeId3], [s0].[TwoSkipSharedId], [s0].[CompositeKeySkipSharedKey1], [s0].[CompositeKeySkipSharedKey2] """); } @@ -1022,7 +1020,7 @@ FROM [JoinTwoToThree] AS [j0] WHERE [e1].[Id] < 10 ) AS [s0] ON [s].[Id] = [s0].[TwoId] ) AS [s1] -ORDER BY [e].[Id], [s1].[Id], [s1].[OneId], [s1].[TwoId], [s1].[ThreeId], [s1].[TwoId0] +ORDER BY [e].[Id], [s1].[Id], [s1].[OneId], [s1].[TwoId], [s1].[ThreeId] """); } @@ -1049,7 +1047,7 @@ FROM [JoinTwoToThree] AS [j0] ) AS [s0] ON [e0].[Id] = [s0].[TwoId] WHERE [e0].[Id] < 10 ) AS [s1] ON [e].[Id] = [s1].[OneId] -ORDER BY [e].[Id], [s1].[OneId], [s1].[TwoId], [s1].[Id], [s1].[TwoId0], [s1].[Id0] +ORDER BY [e].[Id], [s1].[OneId], [s1].[TwoId], [s1].[TwoId0], [s1].[Id0] """); } @@ -1069,7 +1067,7 @@ FROM [JoinOneToTwo] AS [j] LEFT JOIN [EntityTwos] AS [e2] ON [e0].[Id] = [e2].[CollectionInverseId] WHERE [e0].[Id] < 10 ) AS [s] ON [e].[Id] = [s].[TwoId] -ORDER BY [e].[Id], [s].[OneId], [s].[TwoId], [s].[Id], [s].[Id0] +ORDER BY [e].[Id], [s].[OneId], [s].[TwoId] """); } @@ -1108,7 +1106,7 @@ WHERE [u].[Id] < 20 ) AS [s1] ON [e0].[Id] = [s1].[EntityOneId] WHERE [e0].[Id] < 10 ) AS [s2] ON [e].[Id] = [s2].[ThreeId] -ORDER BY [e].[Id], [s2].[OneId], [s2].[ThreeId], [s2].[Id], [s2].[OneId0], [s2].[Id0], [s2].[TwoId], [s2].[EntityBranchId], [s2].[EntityOneId] +ORDER BY [e].[Id], [s2].[OneId], [s2].[ThreeId], [s2].[OneId0], [s2].[Id0], [s2].[TwoId], [s2].[EntityBranchId] """); } @@ -1131,7 +1129,7 @@ WHERE [e1].[Id] < 5 ) AS [e2] ON [e0].[Id] = [e2].[CollectionInverseId] WHERE [e0].[Id] > 15 ) AS [s] ON [e].[Id] = [s].[ThreeId] -ORDER BY [e].[Id], [s].[OneId], [s].[ThreeId], [s].[Id] +ORDER BY [e].[Id], [s].[OneId], [s].[ThreeId] """); } @@ -1154,7 +1152,7 @@ WHERE [e1].[Id] < 5 ) AS [s] ON [e0].[Id] = [s].[TwoId] WHERE [e0].[Id] > 15 ) AS [s0] ON [e].[Id] = [s0].[CollectionInverseId] -ORDER BY [e].[Id], [s0].[Id], [s0].[ThreeId], [s0].[TwoId] +ORDER BY [e].[Id], [s0].[Id], [s0].[ThreeId] """); } @@ -1250,11 +1248,11 @@ INNER JOIN ( FROM [JoinCompositeKeyToLeaf] AS [j] INNER JOIN [Leaves] AS [l] ON [j].[LeafId] = [l].[Id] ) AS [s] ON [e].[Key1] = [s].[CompositeId1] AND [e].[Key2] = [s].[CompositeId2] AND [e].[Key3] = [s].[CompositeId3] -ORDER BY [e].[Key1], [e].[Key2], [e].[Key3], [s].[LeafId], [s].[CompositeId1], [s].[CompositeId2], [s].[CompositeId3], [s].[Id] +ORDER BY [e].[Key1], [e].[Key2], [e].[Key3], [s].[LeafId], [s].[CompositeId1], [s].[CompositeId2], [s].[CompositeId3] """, // """ -SELECT [s0].[EntityBranchId], [s0].[EntityOneId], [s0].[Id], [s0].[Name], [e].[Key1], [e].[Key2], [e].[Key3], [s].[LeafId], [s].[CompositeId1], [s].[CompositeId2], [s].[CompositeId3], [s].[Id] +SELECT [s0].[EntityBranchId], [s0].[EntityOneId], [s0].[Id], [s0].[Name], [e].[Key1], [e].[Key2], [e].[Key3], [s].[LeafId], [s].[CompositeId1], [s].[CompositeId2], [s].[CompositeId3] FROM [EntityCompositeKeys] AS [e] INNER JOIN ( SELECT [j].[LeafId], [j].[CompositeId1], [j].[CompositeId2], [j].[CompositeId3], [l].[Id] @@ -1266,7 +1264,7 @@ INNER JOIN ( FROM [JoinOneToBranch] AS [j0] INNER JOIN [EntityOnes] AS [e0] ON [j0].[EntityOneId] = [e0].[Id] ) AS [s0] ON [s].[Id] = [s0].[EntityBranchId] -ORDER BY [e].[Key1], [e].[Key2], [e].[Key3], [s].[LeafId], [s].[CompositeId1], [s].[CompositeId2], [s].[CompositeId3], [s].[Id] +ORDER BY [e].[Key1], [e].[Key2], [e].[Key3], [s].[LeafId], [s].[CompositeId1], [s].[CompositeId2], [s].[CompositeId3] """); } @@ -1290,24 +1288,23 @@ FROM [JoinOneToThreePayloadFull] AS [j] INNER JOIN [EntityOnes] AS [e0] ON [j].[OneId] = [e0].[Id] LEFT JOIN [EntityTwos] AS [e1] ON [e0].[Id] = [e1].[ReferenceInverseId] ) AS [s] ON [e].[Id] = [s].[ThreeId] -ORDER BY [e].[Id], [s].[OneId], [s].[ThreeId], [s].[Id], [s].[Id0] +ORDER BY [e].[Id], [s].[OneId], [s].[ThreeId] """, // """ -SELECT [s0].[LeftId], [s0].[RightId], [s0].[Payload], [s0].[Id], [s0].[Name], [e].[Id], [s].[OneId], [s].[ThreeId], [s].[Id], [s].[Id0] +SELECT [s0].[LeftId], [s0].[RightId], [s0].[Payload], [s0].[Id], [s0].[Name], [e].[Id], [s].[OneId], [s].[ThreeId] FROM [EntityThrees] AS [e] INNER JOIN ( - SELECT [j].[OneId], [j].[ThreeId], [e0].[Id], [e1].[Id] AS [Id0] + SELECT [j].[OneId], [j].[ThreeId], [e0].[Id] FROM [JoinOneToThreePayloadFull] AS [j] INNER JOIN [EntityOnes] AS [e0] ON [j].[OneId] = [e0].[Id] - LEFT JOIN [EntityTwos] AS [e1] ON [e0].[Id] = [e1].[ReferenceInverseId] ) AS [s] ON [e].[Id] = [s].[ThreeId] INNER JOIN ( SELECT [j0].[LeftId], [j0].[RightId], [j0].[Payload], [e2].[Id], [e2].[Name] FROM [JoinOneSelfPayload] AS [j0] INNER JOIN [EntityOnes] AS [e2] ON [j0].[RightId] = [e2].[Id] ) AS [s0] ON [s].[Id] = [s0].[LeftId] -ORDER BY [e].[Id], [s].[OneId], [s].[ThreeId], [s].[Id], [s].[Id0] +ORDER BY [e].[Id], [s].[OneId], [s].[ThreeId] """); } @@ -1320,19 +1317,18 @@ public override async Task Include_skip_navigation_and_reference_split(bool asyn SELECT [e].[Id], [e].[CollectionInverseId], [e].[ExtraId], [e].[Name], [e].[ReferenceInverseId], [e0].[Id], [e0].[CollectionInverseId], [e0].[Name], [e0].[ReferenceInverseId] FROM [EntityTwos] AS [e] LEFT JOIN [EntityThrees] AS [e0] ON [e].[Id] = [e0].[ReferenceInverseId] -ORDER BY [e].[Id], [e0].[Id] +ORDER BY [e].[Id] """, // """ -SELECT [s].[OneSkipSharedId], [s].[TwoSkipSharedId], [s].[Id], [s].[Name], [e].[Id], [e0].[Id] +SELECT [s].[OneSkipSharedId], [s].[TwoSkipSharedId], [s].[Id], [s].[Name], [e].[Id] FROM [EntityTwos] AS [e] -LEFT JOIN [EntityThrees] AS [e0] ON [e].[Id] = [e0].[ReferenceInverseId] INNER JOIN ( SELECT [e1].[OneSkipSharedId], [e1].[TwoSkipSharedId], [e2].[Id], [e2].[Name] FROM [EntityOneEntityTwo] AS [e1] INNER JOIN [EntityOnes] AS [e2] ON [e1].[OneSkipSharedId] = [e2].[Id] ) AS [s] ON [e].[Id] = [s].[TwoSkipSharedId] -ORDER BY [e].[Id], [e0].[Id] +ORDER BY [e].[Id] """); } @@ -1507,11 +1503,11 @@ INNER JOIN ( FROM [EntityRootEntityThree] AS [e] INNER JOIN [EntityThrees] AS [e0] ON [e].[ThreeSkipSharedId] = [e0].[Id] ) AS [s] ON [u].[Id] = [s].[RootSkipSharedId] -ORDER BY [u].[Id], [s].[RootSkipSharedId], [s].[ThreeSkipSharedId], [s].[Id] +ORDER BY [u].[Id], [s].[RootSkipSharedId], [s].[ThreeSkipSharedId] """, // """ -SELECT [s0].[OneId], [s0].[ThreeId], [s0].[Payload], [s0].[Id], [s0].[Name], [u].[Id], [s].[RootSkipSharedId], [s].[ThreeSkipSharedId], [s].[Id] +SELECT [s0].[OneId], [s0].[ThreeId], [s0].[Payload], [s0].[Id], [s0].[Name], [u].[Id], [s].[RootSkipSharedId], [s].[ThreeSkipSharedId] FROM ( SELECT [r].[Id] FROM [Roots] AS [r] @@ -1536,7 +1532,7 @@ FROM [JoinOneToThreePayloadFullShared] AS [j] INNER JOIN [EntityOnes] AS [e1] ON [j].[OneId] = [e1].[Id] WHERE [e1].[Id] < 10 ) AS [s0] ON [s].[Id] = [s0].[ThreeId] -ORDER BY [u].[Id], [s].[RootSkipSharedId], [s].[ThreeSkipSharedId], [s].[Id] +ORDER BY [u].[Id], [s].[RootSkipSharedId], [s].[ThreeSkipSharedId] """); } @@ -1583,11 +1579,11 @@ INNER JOIN ( FROM [EntityCompositeKeyEntityRoot] AS [e] INNER JOIN [EntityCompositeKeys] AS [e0] ON [e].[CompositeKeySkipSharedKey1] = [e0].[Key1] AND [e].[CompositeKeySkipSharedKey2] = [e0].[Key2] AND [e].[CompositeKeySkipSharedKey3] = [e0].[Key3] ) AS [s] ON [u].[Id] = [s].[RootSkipSharedId] -ORDER BY [u].[Id], [s].[RootSkipSharedId], [s].[CompositeKeySkipSharedKey1], [s].[CompositeKeySkipSharedKey2], [s].[CompositeKeySkipSharedKey3], [s].[Key1], [s].[Key2], [s].[Key3] +ORDER BY [u].[Id], [s].[RootSkipSharedId], [s].[CompositeKeySkipSharedKey1], [s].[CompositeKeySkipSharedKey2], [s].[CompositeKeySkipSharedKey3] """, // """ -SELECT [s1].[Id], [s1].[CompositeId1], [s1].[CompositeId2], [s1].[CompositeId3], [s1].[ThreeId], [s1].[Id0], [s1].[CollectionInverseId], [s1].[Name], [s1].[ReferenceInverseId], [u].[Id], [s].[RootSkipSharedId], [s].[CompositeKeySkipSharedKey1], [s].[CompositeKeySkipSharedKey2], [s].[CompositeKeySkipSharedKey3], [s].[Key1], [s].[Key2], [s].[Key3] +SELECT [s1].[Id], [s1].[CompositeId1], [s1].[CompositeId2], [s1].[CompositeId3], [s1].[ThreeId], [s1].[Id0], [s1].[CollectionInverseId], [s1].[Name], [s1].[ReferenceInverseId], [u].[Id], [s].[RootSkipSharedId], [s].[CompositeKeySkipSharedKey1], [s].[CompositeKeySkipSharedKey2], [s].[CompositeKeySkipSharedKey3] FROM ( SELECT [r].[Id] FROM [Roots] AS [r] @@ -1615,7 +1611,7 @@ FROM [JoinThreeToCompositeKeyFull] AS [j] ) AS [s0] WHERE 1 < [s0].[row] AND [s0].[row] <= 3 ) AS [s1] ON [s].[Key1] = [s1].[CompositeId1] AND [s].[Key2] = [s1].[CompositeId2] AND [s].[Key3] = [s1].[CompositeId3] -ORDER BY [u].[Id], [s].[RootSkipSharedId], [s].[CompositeKeySkipSharedKey1], [s].[CompositeKeySkipSharedKey2], [s].[CompositeKeySkipSharedKey3], [s].[Key1], [s].[Key2], [s].[Key3], [s1].[CompositeId1], [s1].[CompositeId2], [s1].[CompositeId3], [s1].[Id0] +ORDER BY [u].[Id], [s].[RootSkipSharedId], [s].[CompositeKeySkipSharedKey1], [s].[CompositeKeySkipSharedKey2], [s].[CompositeKeySkipSharedKey3], [s1].[CompositeId1], [s1].[CompositeId2], [s1].[CompositeId3], [s1].[Id0] """); } @@ -1639,11 +1635,11 @@ FROM [JoinCompositeKeyToLeaf] AS [j] INNER JOIN [EntityCompositeKeys] AS [e] ON [j].[CompositeId1] = [e].[Key1] AND [j].[CompositeId2] = [e].[Key2] AND [j].[CompositeId3] = [e].[Key3] WHERE [e].[Key1] < 5 ) AS [s] ON [l].[Id] = [s].[LeafId] -ORDER BY [l].[Id], [s].[LeafId], [s].[CompositeId1], [s].[CompositeId2], [s].[CompositeId3], [s].[Key1], [s].[Key2], [s].[Key3] +ORDER BY [l].[Id], [s].[LeafId], [s].[CompositeId1], [s].[CompositeId2], [s].[CompositeId3] """, // """ -SELECT [s0].[TwoSkipSharedId], [s0].[CompositeKeySkipSharedKey1], [s0].[CompositeKeySkipSharedKey2], [s0].[CompositeKeySkipSharedKey3], [s0].[Id], [s0].[CollectionInverseId], [s0].[ExtraId], [s0].[Name], [s0].[ReferenceInverseId], [l].[Id], [s].[LeafId], [s].[CompositeId1], [s].[CompositeId2], [s].[CompositeId3], [s].[Key1], [s].[Key2], [s].[Key3] +SELECT [s0].[TwoSkipSharedId], [s0].[CompositeKeySkipSharedKey1], [s0].[CompositeKeySkipSharedKey2], [s0].[CompositeKeySkipSharedKey3], [s0].[Id], [s0].[CollectionInverseId], [s0].[ExtraId], [s0].[Name], [s0].[ReferenceInverseId], [l].[Id], [s].[LeafId], [s].[CompositeId1], [s].[CompositeId2], [s].[CompositeId3] FROM [Leaves] AS [l] INNER JOIN ( SELECT [j].[LeafId], [j].[CompositeId1], [j].[CompositeId2], [j].[CompositeId3], [e].[Key1], [e].[Key2], [e].[Key3] @@ -1656,7 +1652,7 @@ INNER JOIN ( FROM [EntityCompositeKeyEntityTwo] AS [e0] INNER JOIN [EntityTwos] AS [e1] ON [e0].[TwoSkipSharedId] = [e1].[Id] ) AS [s0] ON [s].[Key1] = [s0].[CompositeKeySkipSharedKey1] AND [s].[Key2] = [s0].[CompositeKeySkipSharedKey2] AND [s].[Key3] = [s0].[CompositeKeySkipSharedKey3] -ORDER BY [l].[Id], [s].[LeafId], [s].[CompositeId1], [s].[CompositeId2], [s].[CompositeId3], [s].[Key1], [s].[Key2], [s].[Key3] +ORDER BY [l].[Id], [s].[LeafId], [s].[CompositeId1], [s].[CompositeId2], [s].[CompositeId3] """); } @@ -1687,7 +1683,7 @@ FROM [JoinOneToTwo] AS [j] """, // """ -SELECT [s1].[ThreeId], [s1].[TwoId], [s1].[Id], [s1].[CollectionInverseId], [s1].[Name], [s1].[ReferenceInverseId], [e].[Id], [s0].[OneId], [s0].[TwoId], [s0].[Id] +SELECT [s1].[ThreeId], [s1].[TwoId], [s1].[Id], [s1].[CollectionInverseId], [s1].[Name], [s1].[ReferenceInverseId], [e].[Id], [s0].[OneId], [s0].[TwoId] FROM [EntityOnes] AS [e] INNER JOIN ( SELECT [s].[OneId], [s].[TwoId], [s].[Id] @@ -1728,11 +1724,11 @@ FROM [JoinOneToTwo] AS [j] INNER JOIN [EntityTwos] AS [e0] ON [j].[TwoId] = [e0].[Id] WHERE [e0].[Id] < 10 ) AS [s] ON [e].[Id] = [s].[OneId] -ORDER BY [e].[Id], [s].[OneId], [s].[TwoId], [s].[Id] +ORDER BY [e].[Id], [s].[OneId], [s].[TwoId] """, // """ -SELECT [s1].[ThreeId], [s1].[TwoId], [s1].[Id], [s1].[CollectionInverseId], [s1].[Name], [s1].[ReferenceInverseId], [e].[Id], [s].[OneId], [s].[TwoId], [s].[Id] +SELECT [s1].[ThreeId], [s1].[TwoId], [s1].[Id], [s1].[CollectionInverseId], [s1].[Name], [s1].[ReferenceInverseId], [e].[Id], [s].[OneId], [s].[TwoId] FROM [EntityOnes] AS [e] INNER JOIN ( SELECT [j].[OneId], [j].[TwoId], [e0].[Id] @@ -1749,7 +1745,7 @@ FROM [JoinTwoToThree] AS [j0] ) AS [s0] WHERE 1 < [s0].[row] AND [s0].[row] <= 3 ) AS [s1] ON [s].[Id] = [s1].[TwoId] -ORDER BY [e].[Id], [s].[OneId], [s].[TwoId], [s].[Id], [s1].[TwoId], [s1].[Id] +ORDER BY [e].[Id], [s].[OneId], [s].[TwoId], [s1].[TwoId], [s1].[Id] """); } @@ -1774,21 +1770,20 @@ FROM [JoinOneToTwo] AS [j] LEFT JOIN [EntityTwos] AS [e1] ON [e0].[Id] = [e1].[ReferenceInverseId] WHERE [e0].[Id] < 10 ) AS [s] ON [e].[Id] = [s].[TwoId] -ORDER BY [e].[Id], [s].[OneId], [s].[TwoId], [s].[Id], [s].[Id0] +ORDER BY [e].[Id], [s].[OneId], [s].[TwoId] """, // """ -SELECT [e2].[Id], [e2].[CollectionInverseId], [e2].[ExtraId], [e2].[Name], [e2].[ReferenceInverseId], [e].[Id], [s].[OneId], [s].[TwoId], [s].[Id], [s].[Id0] +SELECT [e2].[Id], [e2].[CollectionInverseId], [e2].[ExtraId], [e2].[Name], [e2].[ReferenceInverseId], [e].[Id], [s].[OneId], [s].[TwoId] FROM [EntityTwos] AS [e] INNER JOIN ( - SELECT [j].[OneId], [j].[TwoId], [e0].[Id], [e1].[Id] AS [Id0] + SELECT [j].[OneId], [j].[TwoId], [e0].[Id] FROM [JoinOneToTwo] AS [j] INNER JOIN [EntityOnes] AS [e0] ON [j].[OneId] = [e0].[Id] - LEFT JOIN [EntityTwos] AS [e1] ON [e0].[Id] = [e1].[ReferenceInverseId] WHERE [e0].[Id] < 10 ) AS [s] ON [e].[Id] = [s].[TwoId] INNER JOIN [EntityTwos] AS [e2] ON [s].[Id] = [e2].[CollectionInverseId] -ORDER BY [e].[Id], [s].[OneId], [s].[TwoId], [s].[Id], [s].[Id0] +ORDER BY [e].[Id], [s].[OneId], [s].[TwoId] """); } @@ -1812,11 +1807,11 @@ FROM [JoinOneToThreePayloadFull] AS [j] INNER JOIN [EntityOnes] AS [e0] ON [j].[OneId] = [e0].[Id] WHERE [e0].[Id] < 10 ) AS [s] ON [e].[Id] = [s].[ThreeId] -ORDER BY [e].[Id], [s].[OneId], [s].[ThreeId], [s].[Id] +ORDER BY [e].[Id], [s].[OneId], [s].[ThreeId] """, // """ -SELECT [s1].[OneId], [s1].[TwoId], [s1].[JoinOneToTwoExtraId], [s1].[Id], [s1].[CollectionInverseId], [s1].[ExtraId], [s1].[Name], [s1].[ReferenceInverseId], [e].[Id], [s].[OneId], [s].[ThreeId], [s].[Id] +SELECT [s1].[OneId], [s1].[TwoId], [s1].[JoinOneToTwoExtraId], [s1].[Id], [s1].[CollectionInverseId], [s1].[ExtraId], [s1].[Name], [s1].[ReferenceInverseId], [e].[Id], [s].[OneId], [s].[ThreeId] FROM [EntityThrees] AS [e] INNER JOIN ( SELECT [j].[OneId], [j].[ThreeId], [e0].[Id] @@ -1833,11 +1828,11 @@ FROM [JoinOneToTwo] AS [j0] ) AS [s0] WHERE 1 < [s0].[row] AND [s0].[row] <= 3 ) AS [s1] ON [s].[Id] = [s1].[OneId] -ORDER BY [e].[Id], [s].[OneId], [s].[ThreeId], [s].[Id], [s1].[OneId], [s1].[Id] +ORDER BY [e].[Id], [s].[OneId], [s].[ThreeId], [s1].[OneId], [s1].[Id] """, // """ -SELECT [s2].[EntityBranchId], [s2].[EntityOneId], [s2].[Id], [s2].[Name], [s2].[Number], [s2].[IsGreen], [s2].[Discriminator], [e].[Id], [s].[OneId], [s].[ThreeId], [s].[Id] +SELECT [s2].[EntityBranchId], [s2].[EntityOneId], [s2].[Id], [s2].[Name], [s2].[Number], [s2].[IsGreen], [s2].[Discriminator], [e].[Id], [s].[OneId], [s].[ThreeId] FROM [EntityThrees] AS [e] INNER JOIN ( SELECT [j].[OneId], [j].[ThreeId], [e0].[Id] @@ -1857,7 +1852,7 @@ FROM [Leaves] AS [l] ) AS [u] ON [j1].[EntityBranchId] = [u].[Id] WHERE [u].[Id] < 20 ) AS [s2] ON [s].[Id] = [s2].[EntityOneId] -ORDER BY [e].[Id], [s].[OneId], [s].[ThreeId], [s].[Id] +ORDER BY [e].[Id], [s].[OneId], [s].[ThreeId] """); } @@ -1881,11 +1876,11 @@ FROM [JoinOneToThreePayloadFull] AS [j] INNER JOIN [EntityOnes] AS [e0] ON [j].[OneId] = [e0].[Id] WHERE [e0].[Id] > 15 ) AS [s] ON [e].[Id] = [s].[ThreeId] -ORDER BY [e].[Id], [s].[OneId], [s].[ThreeId], [s].[Id] +ORDER BY [e].[Id], [s].[OneId], [s].[ThreeId] """, // """ -SELECT [e2].[Id], [e2].[CollectionInverseId], [e2].[ExtraId], [e2].[Name], [e2].[ReferenceInverseId], [e].[Id], [s].[OneId], [s].[ThreeId], [s].[Id] +SELECT [e2].[Id], [e2].[CollectionInverseId], [e2].[ExtraId], [e2].[Name], [e2].[ReferenceInverseId], [e].[Id], [s].[OneId], [s].[ThreeId] FROM [EntityThrees] AS [e] INNER JOIN ( SELECT [j].[OneId], [j].[ThreeId], [e0].[Id] @@ -1898,7 +1893,7 @@ INNER JOIN ( FROM [EntityTwos] AS [e1] WHERE [e1].[Id] < 5 ) AS [e2] ON [s].[Id] = [e2].[CollectionInverseId] -ORDER BY [e].[Id], [s].[OneId], [s].[ThreeId], [s].[Id] +ORDER BY [e].[Id], [s].[OneId], [s].[ThreeId] """); } @@ -1960,7 +1955,7 @@ FROM [JoinOneToThreePayloadFullShared] AS [j0] INNER JOIN [EntityThrees] AS [e1] ON [j0].[ThreeId] = [e1].[Id] ) AS [s] ON [e0].[Id] = [s].[OneId] ) AS [s0] ON [e].[Id] = [s0].[ThreeId] -ORDER BY [e].[Id], [s0].[OneId], [s0].[ThreeId], [s0].[Id], [s0].[OneId0], [s0].[ThreeId0] +ORDER BY [e].[Id], [s0].[OneId], [s0].[ThreeId], [s0].[OneId0] """); } @@ -2117,7 +2112,7 @@ FROM [JoinTwoToThree] AS [j0] WHERE [e1].[Id] < 10 ) AS [s0] ON [s].[Id] = [s0].[TwoId] ) AS [s1] -ORDER BY [e].[Id], [s1].[Id], [s1].[OneId], [s1].[TwoId], [s1].[ThreeId], [s1].[TwoId0] +ORDER BY [e].[Id], [s1].[Id], [s1].[OneId], [s1].[TwoId], [s1].[ThreeId] """); } @@ -2180,7 +2175,6 @@ FROM [UnidirectionalEntityOnes] AS [u] WHERE EXISTS ( SELECT 1 FROM [UnidirectionalJoinOneSelfPayload] AS [u0] - INNER JOIN [UnidirectionalEntityOnes] AS [u1] ON [u0].[LeftId] = [u1].[Id] WHERE [u].[Id] = [u0].[RightId]) """); } @@ -2265,7 +2259,7 @@ FROM [UnidirectionalLeaves] AS [u4] ) AS [u1] ON [u0].[RootSkipSharedId] = [u1].[Id] WHERE [u1].[Discriminator] = N'UnidirectionalEntityLeaf' ) AS [s] ON [u].[Key1] = [s].[UnidirectionalEntityCompositeKeyKey1] AND [u].[Key2] = [s].[UnidirectionalEntityCompositeKeyKey2] AND [u].[Key3] = [s].[UnidirectionalEntityCompositeKeyKey3] -ORDER BY [u].[Key1], [u].[Key2], [u].[Key3], [s].[RootSkipSharedId], [s].[UnidirectionalEntityCompositeKeyKey1], [s].[UnidirectionalEntityCompositeKeyKey2], [s].[UnidirectionalEntityCompositeKeyKey3] +ORDER BY [u].[Key1], [u].[Key2], [u].[Key3], [s].[RootSkipSharedId], [s].[UnidirectionalEntityCompositeKeyKey1], [s].[UnidirectionalEntityCompositeKeyKey2] """); } @@ -2424,7 +2418,7 @@ LEFT JOIN ( FROM [UnidirectionalJoinOneSelfPayload] AS [u0] INNER JOIN [UnidirectionalEntityOnes] AS [u1] ON [u0].[LeftId] = [u1].[Id] ) AS [s] ON [u].[Id] = [s].[RightId] -ORDER BY [u].[Id], [s].[LeftId], [s].[RightId] +ORDER BY [u].[Id], [s].[LeftId] """); } @@ -2450,7 +2444,7 @@ UNION ALL FROM [UnidirectionalLeaves] AS [u4] ) AS [u1] ON [u0].[RootSkipSharedId] = [u1].[Id] ) AS [s] ON [u].[Key1] = [s].[UnidirectionalEntityCompositeKeyKey1] AND [u].[Key2] = [s].[UnidirectionalEntityCompositeKeyKey2] AND [u].[Key3] = [s].[UnidirectionalEntityCompositeKeyKey3] -ORDER BY [u].[Key1], [u].[Key2], [u].[Key3], [s].[RootSkipSharedId], [s].[UnidirectionalEntityCompositeKeyKey1], [s].[UnidirectionalEntityCompositeKeyKey2], [s].[UnidirectionalEntityCompositeKeyKey3] +ORDER BY [u].[Key1], [u].[Key2], [u].[Key3], [s].[RootSkipSharedId], [s].[UnidirectionalEntityCompositeKeyKey1], [s].[UnidirectionalEntityCompositeKeyKey2] """); } @@ -2468,7 +2462,7 @@ FROM [UnidirectionalJoinOneToTwo] AS [u0] INNER JOIN [UnidirectionalEntityOnes] AS [u1] ON [u0].[OneId] = [u1].[Id] LEFT JOIN [UnidirectionalEntityTwos] AS [u2] ON [u1].[Id] = [u2].[ReferenceInverseId] ) AS [s] ON [u].[Id] = [s].[TwoId] -ORDER BY [u].[Id], [s].[OneId], [s].[TwoId], [s].[Id] +ORDER BY [u].[Id], [s].[OneId] """); } @@ -2490,7 +2484,7 @@ FROM [UnidirectionalJoinOneToBranch] AS [u2] INNER JOIN [UnidirectionalEntityOnes] AS [u3] ON [u2].[UnidirectionalEntityOneId] = [u3].[Id] ) AS [s] ON [u1].[Id] = [s].[UnidirectionalEntityBranchId] ) AS [s0] ON [u].[Key1] = [s0].[CompositeId1] AND [u].[Key2] = [s0].[CompositeId2] AND [u].[Key3] = [s0].[CompositeId3] -ORDER BY [u].[Key1], [u].[Key2], [u].[Key3], [s0].[LeafId], [s0].[CompositeId1], [s0].[CompositeId2], [s0].[CompositeId3], [s0].[Id], [s0].[UnidirectionalEntityBranchId], [s0].[UnidirectionalEntityOneId] +ORDER BY [u].[Key1], [u].[Key2], [u].[Key3], [s0].[LeafId], [s0].[CompositeId1], [s0].[CompositeId2], [s0].[CompositeId3], [s0].[UnidirectionalEntityBranchId] """); } @@ -2513,7 +2507,7 @@ FROM [UnidirectionalJoinOneSelfPayload] AS [u3] INNER JOIN [UnidirectionalEntityOnes] AS [u4] ON [u3].[RightId] = [u4].[Id] ) AS [s] ON [u1].[Id] = [s].[LeftId] ) AS [s0] ON [u].[Id] = [s0].[ThreeId] -ORDER BY [u].[Id], [s0].[OneId], [s0].[ThreeId], [s0].[Id], [s0].[Id0], [s0].[LeftId], [s0].[RightId] +ORDER BY [u].[Id], [s0].[OneId], [s0].[ThreeId], [s0].[LeftId] """); } @@ -2523,7 +2517,7 @@ public override async Task Include_skip_navigation_and_reference_unidirectional( AssertSql( """ -SELECT [u].[Id], [u].[CollectionInverseId], [u].[ExtraId], [u].[Name], [u].[ReferenceInverseId], [u0].[Id], [s].[TwoSkipSharedId], [s].[UnidirectionalEntityOneId], [s].[Id], [s].[Name], [u0].[CollectionInverseId], [u0].[Name], [u0].[ReferenceInverseId] +SELECT [u].[Id], [u].[CollectionInverseId], [u].[ExtraId], [u].[Name], [u].[ReferenceInverseId], [s].[TwoSkipSharedId], [s].[UnidirectionalEntityOneId], [s].[Id], [s].[Name], [u0].[Id], [u0].[CollectionInverseId], [u0].[Name], [u0].[ReferenceInverseId] FROM [UnidirectionalEntityTwos] AS [u] LEFT JOIN [UnidirectionalEntityThrees] AS [u0] ON [u].[Id] = [u0].[ReferenceInverseId] LEFT JOIN ( @@ -2531,7 +2525,7 @@ LEFT JOIN ( FROM [UnidirectionalEntityOneUnidirectionalEntityTwo] AS [u1] INNER JOIN [UnidirectionalEntityOnes] AS [u2] ON [u1].[UnidirectionalEntityOneId] = [u2].[Id] ) AS [s] ON [u].[Id] = [s].[TwoSkipSharedId] -ORDER BY [u].[Id], [u0].[Id], [s].[TwoSkipSharedId], [s].[UnidirectionalEntityOneId] +ORDER BY [u].[Id], [s].[TwoSkipSharedId] """); } @@ -2553,7 +2547,7 @@ FROM [UnidirectionalJoinOneToThreePayloadFullShared] AS [u2] INNER JOIN [UnidirectionalEntityThrees] AS [u3] ON [u2].[ThreeId] = [u3].[Id] ) AS [s] ON [u1].[Id] = [s].[OneId] ) AS [s0] ON [u].[Id] = [s0].[ThreeId] -ORDER BY [u].[Id], [s0].[OneId], [s0].[ThreeId], [s0].[Id], [s0].[OneId0], [s0].[ThreeId0] +ORDER BY [u].[Id], [s0].[OneId], [s0].[ThreeId], [s0].[OneId0] """); } @@ -2571,7 +2565,7 @@ FROM [JoinOneToThreePayloadFullShared] AS [j] INNER JOIN [EntityOnes] AS [e0] ON [j].[OneId] = [e0].[Id] WHERE [e0].[Id] < 10 ) AS [s] ON [e].[Id] = [s].[ThreeId] -ORDER BY [e].[Id], [s].[OneId], [s].[ThreeId] +ORDER BY [e].[Id], [s].[OneId] """); } @@ -2674,7 +2668,7 @@ FROM [UnidirectionalEntityCompositeKeyUnidirectionalEntityTwo] AS [u2] ) AS [s] ON [u1].[Key1] = [s].[UnidirectionalEntityCompositeKeyKey1] AND [u1].[Key2] = [s].[UnidirectionalEntityCompositeKeyKey2] AND [u1].[Key3] = [s].[UnidirectionalEntityCompositeKeyKey3] WHERE [u1].[Key1] < 5 ) AS [s0] ON [u].[Id] = [s0].[LeafId] -ORDER BY [u].[Id], [s0].[LeafId], [s0].[CompositeId1], [s0].[CompositeId2], [s0].[CompositeId3], [s0].[Key1], [s0].[Key2], [s0].[Key3], [s0].[TwoSkipSharedId], [s0].[UnidirectionalEntityCompositeKeyKey1], [s0].[UnidirectionalEntityCompositeKeyKey2], [s0].[UnidirectionalEntityCompositeKeyKey3] +ORDER BY [u].[Id], [s0].[LeafId], [s0].[CompositeId1], [s0].[CompositeId2], [s0].[CompositeId3], [s0].[TwoSkipSharedId], [s0].[UnidirectionalEntityCompositeKeyKey1], [s0].[UnidirectionalEntityCompositeKeyKey2] """); } @@ -2694,7 +2688,7 @@ FROM [JoinOneToTwo] AS [j] LEFT JOIN [EntityTwos] AS [e2] ON [e0].[Id] = [e2].[CollectionInverseId] WHERE [e0].[Id] < 10 ) AS [s] ON [e].[Id] = [s].[TwoId] -ORDER BY [e].[Id], [s].[OneId], [s].[TwoId], [s].[Id], [s].[Id0] +ORDER BY [e].[Id], [s].[OneId], [s].[TwoId] """); } diff --git a/test/EFCore.SqlServer.FunctionalTests/Query/Inheritance/TPCRelationshipsQuerySqlServerTest.cs b/test/EFCore.SqlServer.FunctionalTests/Query/Inheritance/TPCRelationshipsQuerySqlServerTest.cs index e0f2c837098..ff56d443c00 100644 --- a/test/EFCore.SqlServer.FunctionalTests/Query/Inheritance/TPCRelationshipsQuerySqlServerTest.cs +++ b/test/EFCore.SqlServer.FunctionalTests/Query/Inheritance/TPCRelationshipsQuerySqlServerTest.cs @@ -96,7 +96,7 @@ FROM [DerivedEntities] AS [d] LEFT JOIN [DerivedEntities] AS [d0] ON [u].[Id] = [d0].[Id] LEFT JOIN [OwnedCollections] AS [o0] ON [u].[Id] = [o0].[BaseInheritanceRelationshipEntityId] LEFT JOIN [DerivedEntities_OwnedCollectionOnDerived] AS [d1] ON [u].[Id] = [d1].[DerivedInheritanceRelationshipEntityId] -ORDER BY [c].[Id], [u].[Id], [o].[BaseInheritanceRelationshipEntityId], [d0].[Id], [o0].[BaseInheritanceRelationshipEntityId], [o0].[Id], [d1].[DerivedInheritanceRelationshipEntityId] +ORDER BY [c].[Id], [o].[BaseInheritanceRelationshipEntityId], [d0].[Id], [o0].[BaseInheritanceRelationshipEntityId], [o0].[Id], [d1].[DerivedInheritanceRelationshipEntityId] """); } @@ -144,7 +144,7 @@ FROM [DerivedEntities] AS [d] LEFT JOIN [OwnedCollections] AS [o0] ON [u].[Id] = [o0].[BaseInheritanceRelationshipEntityId] LEFT JOIN [DerivedEntities_OwnedCollectionOnDerived] AS [d1] ON [u].[Id] = [d1].[DerivedInheritanceRelationshipEntityId] WHERE [c].[Name] <> N'Bar' OR [c].[Name] IS NULL -ORDER BY [c].[Id], [u].[Id], [o].[BaseInheritanceRelationshipEntityId], [d0].[Id], [o0].[BaseInheritanceRelationshipEntityId], [o0].[Id], [d1].[DerivedInheritanceRelationshipEntityId] +ORDER BY [c].[Id], [o].[BaseInheritanceRelationshipEntityId], [d0].[Id], [o0].[BaseInheritanceRelationshipEntityId], [o0].[Id], [d1].[DerivedInheritanceRelationshipEntityId] """); } @@ -255,7 +255,7 @@ FROM [DerivedCollectionsOnDerived] AS [d] LEFT JOIN [OwnedReferences] AS [o] ON [d0].[Id] = [o].[BaseInheritanceRelationshipEntityId] LEFT JOIN [OwnedCollections] AS [o0] ON [d0].[Id] = [o0].[BaseInheritanceRelationshipEntityId] LEFT JOIN [DerivedEntities_OwnedCollectionOnDerived] AS [d1] ON [d0].[Id] = [d1].[DerivedInheritanceRelationshipEntityId] -ORDER BY [u].[Id], [d0].[Id], [o].[BaseInheritanceRelationshipEntityId], [o0].[BaseInheritanceRelationshipEntityId], [o0].[Id], [d1].[DerivedInheritanceRelationshipEntityId] +ORDER BY [u].[Id], [o].[BaseInheritanceRelationshipEntityId], [o0].[BaseInheritanceRelationshipEntityId], [o0].[Id], [d1].[DerivedInheritanceRelationshipEntityId] """); } @@ -284,7 +284,7 @@ FROM [DerivedEntities] AS [d0] LEFT JOIN [DerivedEntities] AS [d1] ON [u0].[Id] = [d1].[Id] LEFT JOIN [OwnedCollections] AS [o0] ON [u0].[Id] = [o0].[BaseInheritanceRelationshipEntityId] LEFT JOIN [DerivedEntities_OwnedCollectionOnDerived] AS [d2] ON [u0].[Id] = [d2].[DerivedInheritanceRelationshipEntityId] -ORDER BY [u].[Id], [u0].[Id], [o].[BaseInheritanceRelationshipEntityId], [d1].[Id], [o0].[BaseInheritanceRelationshipEntityId], [o0].[Id], [d2].[DerivedInheritanceRelationshipEntityId] +ORDER BY [u].[Id], [o].[BaseInheritanceRelationshipEntityId], [d1].[Id], [o0].[BaseInheritanceRelationshipEntityId], [o0].[Id], [d2].[DerivedInheritanceRelationshipEntityId] """); } @@ -344,7 +344,7 @@ FROM [DerivedEntities] AS [d0] LEFT JOIN [OwnedCollections] AS [o0] ON [u0].[Id] = [o0].[BaseInheritanceRelationshipEntityId] LEFT JOIN [DerivedEntities_OwnedCollectionOnDerived] AS [d2] ON [u0].[Id] = [d2].[DerivedInheritanceRelationshipEntityId] WHERE [u].[Name] <> N'Bar' OR [u].[Name] IS NULL -ORDER BY [u].[Id], [u0].[Id], [o].[BaseInheritanceRelationshipEntityId], [d1].[Id], [o0].[BaseInheritanceRelationshipEntityId], [o0].[Id], [d2].[DerivedInheritanceRelationshipEntityId] +ORDER BY [u].[Id], [o].[BaseInheritanceRelationshipEntityId], [d1].[Id], [o0].[BaseInheritanceRelationshipEntityId], [o0].[Id], [d2].[DerivedInheritanceRelationshipEntityId] """); } @@ -354,7 +354,7 @@ public override async Task Include_reference_without_inheritance(bool async) AssertSql( """ -SELECT [u].[Id], [u].[Name], [u].[BaseId], [u].[Discriminator], [r].[Id], [o].[BaseInheritanceRelationshipEntityId], [d0].[Id], [o0].[BaseInheritanceRelationshipEntityId], [o0].[Id], [o0].[Name], [o].[Id], [o].[Name], [d1].[DerivedInheritanceRelationshipEntityId], [d1].[Id], [d1].[Name], [d0].[OwnedReferenceOnDerived_Id], [d0].[OwnedReferenceOnDerived_Name], [r].[Name], [r].[ParentId] +SELECT [u].[Id], [u].[Name], [u].[BaseId], [u].[Discriminator], [o].[BaseInheritanceRelationshipEntityId], [d0].[Id], [o0].[BaseInheritanceRelationshipEntityId], [o0].[Id], [o0].[Name], [o].[Id], [o].[Name], [d1].[DerivedInheritanceRelationshipEntityId], [d1].[Id], [d1].[Name], [d0].[OwnedReferenceOnDerived_Id], [d0].[OwnedReferenceOnDerived_Name], [r].[Id], [r].[Name], [r].[ParentId] FROM ( SELECT [b].[Id], [b].[Name], NULL AS [BaseId], N'BaseInheritanceRelationshipEntity' AS [Discriminator] FROM [BaseEntities] AS [b] @@ -367,7 +367,7 @@ FROM [DerivedEntities] AS [d] LEFT JOIN [DerivedEntities] AS [d0] ON [u].[Id] = [d0].[Id] LEFT JOIN [OwnedCollections] AS [o0] ON [u].[Id] = [o0].[BaseInheritanceRelationshipEntityId] LEFT JOIN [DerivedEntities_OwnedCollectionOnDerived] AS [d1] ON [u].[Id] = [d1].[DerivedInheritanceRelationshipEntityId] -ORDER BY [u].[Id], [r].[Id], [o].[BaseInheritanceRelationshipEntityId], [d0].[Id], [o0].[BaseInheritanceRelationshipEntityId], [o0].[Id], [d1].[DerivedInheritanceRelationshipEntityId] +ORDER BY [u].[Id], [o].[BaseInheritanceRelationshipEntityId], [d0].[Id], [o0].[BaseInheritanceRelationshipEntityId], [o0].[Id], [d1].[DerivedInheritanceRelationshipEntityId] """); } @@ -377,13 +377,13 @@ public override async Task Include_reference_without_inheritance_on_derived1(boo AssertSql( """ -SELECT [d].[Id], [d].[Name], [d].[BaseId], [r].[Id], [o].[BaseInheritanceRelationshipEntityId], [o0].[BaseInheritanceRelationshipEntityId], [o0].[Id], [o0].[Name], [o].[Id], [o].[Name], [d0].[DerivedInheritanceRelationshipEntityId], [d0].[Id], [d0].[Name], [d].[Id], [d].[OwnedReferenceOnDerived_Id], [d].[OwnedReferenceOnDerived_Name], [r].[Name], [r].[ParentId] +SELECT [d].[Id], [d].[Name], [d].[BaseId], [o].[BaseInheritanceRelationshipEntityId], [o0].[BaseInheritanceRelationshipEntityId], [o0].[Id], [o0].[Name], [o].[Id], [o].[Name], [d0].[DerivedInheritanceRelationshipEntityId], [d0].[Id], [d0].[Name], [d].[Id], [d].[OwnedReferenceOnDerived_Id], [d].[OwnedReferenceOnDerived_Name], [r].[Id], [r].[Name], [r].[ParentId] FROM [DerivedEntities] AS [d] LEFT JOIN [ReferencesOnBase] AS [r] ON [d].[Id] = [r].[ParentId] 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] -ORDER BY [d].[Id], [r].[Id], [o].[BaseInheritanceRelationshipEntityId], [o0].[BaseInheritanceRelationshipEntityId], [o0].[Id], [d0].[DerivedInheritanceRelationshipEntityId] +ORDER BY [d].[Id], [o].[BaseInheritanceRelationshipEntityId], [o0].[BaseInheritanceRelationshipEntityId], [o0].[Id], [d0].[DerivedInheritanceRelationshipEntityId] """); } @@ -393,13 +393,13 @@ public override async Task Include_reference_without_inheritance_on_derived2(boo AssertSql( """ -SELECT [d].[Id], [d].[Name], [d].[BaseId], [r].[Id], [o].[BaseInheritanceRelationshipEntityId], [o0].[BaseInheritanceRelationshipEntityId], [o0].[Id], [o0].[Name], [o].[Id], [o].[Name], [d0].[DerivedInheritanceRelationshipEntityId], [d0].[Id], [d0].[Name], [d].[Id], [d].[OwnedReferenceOnDerived_Id], [d].[OwnedReferenceOnDerived_Name], [r].[Name], [r].[ParentId] +SELECT [d].[Id], [d].[Name], [d].[BaseId], [o].[BaseInheritanceRelationshipEntityId], [o0].[BaseInheritanceRelationshipEntityId], [o0].[Id], [o0].[Name], [o].[Id], [o].[Name], [d0].[DerivedInheritanceRelationshipEntityId], [d0].[Id], [d0].[Name], [d].[Id], [d].[OwnedReferenceOnDerived_Id], [d].[OwnedReferenceOnDerived_Name], [r].[Id], [r].[Name], [r].[ParentId] FROM [DerivedEntities] AS [d] LEFT JOIN [ReferencesOnDerived] AS [r] ON [d].[Id] = [r].[ParentId] 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] -ORDER BY [d].[Id], [r].[Id], [o].[BaseInheritanceRelationshipEntityId], [o0].[BaseInheritanceRelationshipEntityId], [o0].[Id], [d0].[DerivedInheritanceRelationshipEntityId] +ORDER BY [d].[Id], [o].[BaseInheritanceRelationshipEntityId], [o0].[BaseInheritanceRelationshipEntityId], [o0].[Id], [d0].[DerivedInheritanceRelationshipEntityId] """); } @@ -415,7 +415,7 @@ FROM [ReferencesOnDerived] AS [r] 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] -ORDER BY [r].[Id], [d].[Id], [o].[BaseInheritanceRelationshipEntityId], [o0].[BaseInheritanceRelationshipEntityId], [o0].[Id], [d0].[DerivedInheritanceRelationshipEntityId] +ORDER BY [r].[Id], [o].[BaseInheritanceRelationshipEntityId], [o0].[BaseInheritanceRelationshipEntityId], [o0].[Id], [d0].[DerivedInheritanceRelationshipEntityId] """); } @@ -438,7 +438,7 @@ FROM [DerivedEntities] AS [d] LEFT JOIN [DerivedEntities] AS [d0] ON [u].[Id] = [d0].[Id] LEFT JOIN [OwnedCollections] AS [o0] ON [u].[Id] = [o0].[BaseInheritanceRelationshipEntityId] LEFT JOIN [DerivedEntities_OwnedCollectionOnDerived] AS [d1] ON [u].[Id] = [d1].[DerivedInheritanceRelationshipEntityId] -ORDER BY [r].[Id], [u].[Id], [o].[BaseInheritanceRelationshipEntityId], [d0].[Id], [o0].[BaseInheritanceRelationshipEntityId], [o0].[Id], [d1].[DerivedInheritanceRelationshipEntityId] +ORDER BY [r].[Id], [o].[BaseInheritanceRelationshipEntityId], [d0].[Id], [o0].[BaseInheritanceRelationshipEntityId], [o0].[Id], [d1].[DerivedInheritanceRelationshipEntityId] """); } @@ -448,7 +448,7 @@ public override async Task Include_reference_without_inheritance_with_filter(boo AssertSql( """ -SELECT [u].[Id], [u].[Name], [u].[BaseId], [u].[Discriminator], [r].[Id], [o].[BaseInheritanceRelationshipEntityId], [d0].[Id], [o0].[BaseInheritanceRelationshipEntityId], [o0].[Id], [o0].[Name], [o].[Id], [o].[Name], [d1].[DerivedInheritanceRelationshipEntityId], [d1].[Id], [d1].[Name], [d0].[OwnedReferenceOnDerived_Id], [d0].[OwnedReferenceOnDerived_Name], [r].[Name], [r].[ParentId] +SELECT [u].[Id], [u].[Name], [u].[BaseId], [u].[Discriminator], [o].[BaseInheritanceRelationshipEntityId], [d0].[Id], [o0].[BaseInheritanceRelationshipEntityId], [o0].[Id], [o0].[Name], [o].[Id], [o].[Name], [d1].[DerivedInheritanceRelationshipEntityId], [d1].[Id], [d1].[Name], [d0].[OwnedReferenceOnDerived_Id], [d0].[OwnedReferenceOnDerived_Name], [r].[Id], [r].[Name], [r].[ParentId] FROM ( SELECT [b].[Id], [b].[Name], NULL AS [BaseId], N'BaseInheritanceRelationshipEntity' AS [Discriminator] FROM [BaseEntities] AS [b] @@ -462,7 +462,7 @@ FROM [DerivedEntities] AS [d] LEFT JOIN [OwnedCollections] AS [o0] ON [u].[Id] = [o0].[BaseInheritanceRelationshipEntityId] LEFT JOIN [DerivedEntities_OwnedCollectionOnDerived] AS [d1] ON [u].[Id] = [d1].[DerivedInheritanceRelationshipEntityId] WHERE [u].[Name] <> N'Bar' OR [u].[Name] IS NULL -ORDER BY [u].[Id], [r].[Id], [o].[BaseInheritanceRelationshipEntityId], [d0].[Id], [o0].[BaseInheritanceRelationshipEntityId], [o0].[Id], [d1].[DerivedInheritanceRelationshipEntityId] +ORDER BY [u].[Id], [o].[BaseInheritanceRelationshipEntityId], [d0].[Id], [o0].[BaseInheritanceRelationshipEntityId], [o0].[Id], [d1].[DerivedInheritanceRelationshipEntityId] """); } @@ -486,7 +486,7 @@ FROM [DerivedEntities] AS [d] LEFT JOIN [OwnedCollections] AS [o0] ON [u].[Id] = [o0].[BaseInheritanceRelationshipEntityId] LEFT JOIN [DerivedEntities_OwnedCollectionOnDerived] AS [d1] ON [u].[Id] = [d1].[DerivedInheritanceRelationshipEntityId] WHERE [r].[Name] <> N'Bar' OR [r].[Name] IS NULL -ORDER BY [r].[Id], [u].[Id], [o].[BaseInheritanceRelationshipEntityId], [d0].[Id], [o0].[BaseInheritanceRelationshipEntityId], [o0].[Id], [d1].[DerivedInheritanceRelationshipEntityId] +ORDER BY [r].[Id], [o].[BaseInheritanceRelationshipEntityId], [d0].[Id], [o0].[BaseInheritanceRelationshipEntityId], [o0].[Id], [d1].[DerivedInheritanceRelationshipEntityId] """); } @@ -496,7 +496,7 @@ public override async Task Include_reference_with_inheritance(bool async) AssertSql( """ -SELECT [u].[Id], [u].[Name], [u].[BaseId], [u].[Discriminator], [u0].[Id], [o].[BaseInheritanceRelationshipEntityId], [d1].[Id], [o0].[BaseInheritanceRelationshipEntityId], [o0].[Id], [o0].[Name], [o].[Id], [o].[Name], [d2].[DerivedInheritanceRelationshipEntityId], [d2].[Id], [d2].[Name], [d1].[OwnedReferenceOnDerived_Id], [d1].[OwnedReferenceOnDerived_Name], [u0].[BaseParentId], [u0].[Name], [u0].[Discriminator] +SELECT [u].[Id], [u].[Name], [u].[BaseId], [u].[Discriminator], [o].[BaseInheritanceRelationshipEntityId], [d1].[Id], [o0].[BaseInheritanceRelationshipEntityId], [o0].[Id], [o0].[Name], [o].[Id], [o].[Name], [d2].[DerivedInheritanceRelationshipEntityId], [d2].[Id], [d2].[Name], [d1].[OwnedReferenceOnDerived_Id], [d1].[OwnedReferenceOnDerived_Name], [u0].[Id], [u0].[BaseParentId], [u0].[Name], [u0].[Discriminator] FROM ( SELECT [b].[Id], [b].[Name], NULL AS [BaseId], N'BaseInheritanceRelationshipEntity' AS [Discriminator] FROM [BaseEntities] AS [b] @@ -515,7 +515,7 @@ FROM [DerivedReferencesOnBase] AS [d0] LEFT JOIN [DerivedEntities] AS [d1] ON [u].[Id] = [d1].[Id] LEFT JOIN [OwnedCollections] AS [o0] ON [u].[Id] = [o0].[BaseInheritanceRelationshipEntityId] LEFT JOIN [DerivedEntities_OwnedCollectionOnDerived] AS [d2] ON [u].[Id] = [d2].[DerivedInheritanceRelationshipEntityId] -ORDER BY [u].[Id], [u0].[Id], [o].[BaseInheritanceRelationshipEntityId], [d1].[Id], [o0].[BaseInheritanceRelationshipEntityId], [o0].[Id], [d2].[DerivedInheritanceRelationshipEntityId] +ORDER BY [u].[Id], [o].[BaseInheritanceRelationshipEntityId], [d1].[Id], [o0].[BaseInheritanceRelationshipEntityId], [o0].[Id], [d2].[DerivedInheritanceRelationshipEntityId] """); } @@ -525,7 +525,7 @@ public override async Task Include_reference_with_inheritance_on_derived1(bool a AssertSql( """ -SELECT [d].[Id], [d].[Name], [d].[BaseId], [u].[Id], [o].[BaseInheritanceRelationshipEntityId], [o0].[BaseInheritanceRelationshipEntityId], [o0].[Id], [o0].[Name], [o].[Id], [o].[Name], [d1].[DerivedInheritanceRelationshipEntityId], [d1].[Id], [d1].[Name], [d].[Id], [d].[OwnedReferenceOnDerived_Id], [d].[OwnedReferenceOnDerived_Name], [u].[BaseParentId], [u].[Name], [u].[Discriminator] +SELECT [d].[Id], [d].[Name], [d].[BaseId], [o].[BaseInheritanceRelationshipEntityId], [o0].[BaseInheritanceRelationshipEntityId], [o0].[Id], [o0].[Name], [o].[Id], [o].[Name], [d1].[DerivedInheritanceRelationshipEntityId], [d1].[Id], [d1].[Name], [d].[Id], [d].[OwnedReferenceOnDerived_Id], [d].[OwnedReferenceOnDerived_Name], [u].[Id], [u].[BaseParentId], [u].[Name], [u].[Discriminator] FROM [DerivedEntities] AS [d] LEFT JOIN ( SELECT [b].[Id], [b].[BaseParentId], [b].[Name], N'BaseReferenceOnBase' AS [Discriminator] @@ -537,7 +537,7 @@ FROM [DerivedReferencesOnBase] AS [d0] 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] -ORDER BY [d].[Id], [u].[Id], [o].[BaseInheritanceRelationshipEntityId], [o0].[BaseInheritanceRelationshipEntityId], [o0].[Id], [d1].[DerivedInheritanceRelationshipEntityId] +ORDER BY [d].[Id], [o].[BaseInheritanceRelationshipEntityId], [o0].[BaseInheritanceRelationshipEntityId], [o0].[Id], [d1].[DerivedInheritanceRelationshipEntityId] """); } @@ -547,7 +547,7 @@ public override async Task Include_reference_with_inheritance_on_derived2(bool a AssertSql( """ -SELECT [d].[Id], [d].[Name], [d].[BaseId], [u].[Id], [o].[BaseInheritanceRelationshipEntityId], [o0].[BaseInheritanceRelationshipEntityId], [o0].[Id], [o0].[Name], [o].[Id], [o].[Name], [d1].[DerivedInheritanceRelationshipEntityId], [d1].[Id], [d1].[Name], [d].[Id], [d].[OwnedReferenceOnDerived_Id], [d].[OwnedReferenceOnDerived_Name], [u].[BaseParentId], [u].[Name], [u].[DerivedInheritanceRelationshipEntityId], [u].[Discriminator] +SELECT [d].[Id], [d].[Name], [d].[BaseId], [o].[BaseInheritanceRelationshipEntityId], [o0].[BaseInheritanceRelationshipEntityId], [o0].[Id], [o0].[Name], [o].[Id], [o].[Name], [d1].[DerivedInheritanceRelationshipEntityId], [d1].[Id], [d1].[Name], [d].[Id], [d].[OwnedReferenceOnDerived_Id], [d].[OwnedReferenceOnDerived_Name], [u].[Id], [u].[BaseParentId], [u].[Name], [u].[DerivedInheritanceRelationshipEntityId], [u].[Discriminator] FROM [DerivedEntities] AS [d] LEFT JOIN ( SELECT [b].[Id], [b].[BaseParentId], [b].[Name], NULL AS [DerivedInheritanceRelationshipEntityId], N'BaseReferenceOnDerived' AS [Discriminator] @@ -559,7 +559,7 @@ FROM [DerivedReferencesOnDerived] AS [d0] 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] -ORDER BY [d].[Id], [u].[Id], [o].[BaseInheritanceRelationshipEntityId], [o0].[BaseInheritanceRelationshipEntityId], [o0].[Id], [d1].[DerivedInheritanceRelationshipEntityId] +ORDER BY [d].[Id], [o].[BaseInheritanceRelationshipEntityId], [o0].[BaseInheritanceRelationshipEntityId], [o0].[Id], [d1].[DerivedInheritanceRelationshipEntityId] """); } @@ -569,13 +569,13 @@ public override async Task Include_reference_with_inheritance_on_derived4(bool a AssertSql( """ -SELECT [d].[Id], [d].[Name], [d].[BaseId], [d0].[Id], [o].[BaseInheritanceRelationshipEntityId], [o0].[BaseInheritanceRelationshipEntityId], [o0].[Id], [o0].[Name], [o].[Id], [o].[Name], [d1].[DerivedInheritanceRelationshipEntityId], [d1].[Id], [d1].[Name], [d].[Id], [d].[OwnedReferenceOnDerived_Id], [d].[OwnedReferenceOnDerived_Name], [d0].[BaseParentId], [d0].[Name], [d0].[DerivedInheritanceRelationshipEntityId] +SELECT [d].[Id], [d].[Name], [d].[BaseId], [o].[BaseInheritanceRelationshipEntityId], [o0].[BaseInheritanceRelationshipEntityId], [o0].[Id], [o0].[Name], [o].[Id], [o].[Name], [d1].[DerivedInheritanceRelationshipEntityId], [d1].[Id], [d1].[Name], [d].[Id], [d].[OwnedReferenceOnDerived_Id], [d].[OwnedReferenceOnDerived_Name], [d0].[Id], [d0].[BaseParentId], [d0].[Name], [d0].[DerivedInheritanceRelationshipEntityId] FROM [DerivedEntities] AS [d] LEFT JOIN [DerivedReferencesOnDerived] AS [d0] ON [d].[Id] = [d0].[DerivedInheritanceRelationshipEntityId] 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] -ORDER BY [d].[Id], [d0].[Id], [o].[BaseInheritanceRelationshipEntityId], [o0].[BaseInheritanceRelationshipEntityId], [o0].[Id], [d1].[DerivedInheritanceRelationshipEntityId] +ORDER BY [d].[Id], [o].[BaseInheritanceRelationshipEntityId], [o0].[BaseInheritanceRelationshipEntityId], [o0].[Id], [d1].[DerivedInheritanceRelationshipEntityId] """); } @@ -597,7 +597,7 @@ FROM [DerivedReferencesOnDerived] AS [d] LEFT JOIN [OwnedReferences] AS [o] ON [d0].[Id] = [o].[BaseInheritanceRelationshipEntityId] LEFT JOIN [OwnedCollections] AS [o0] ON [d0].[Id] = [o0].[BaseInheritanceRelationshipEntityId] LEFT JOIN [DerivedEntities_OwnedCollectionOnDerived] AS [d1] ON [d0].[Id] = [d1].[DerivedInheritanceRelationshipEntityId] -ORDER BY [u].[Id], [d0].[Id], [o].[BaseInheritanceRelationshipEntityId], [o0].[BaseInheritanceRelationshipEntityId], [o0].[Id], [d1].[DerivedInheritanceRelationshipEntityId] +ORDER BY [u].[Id], [o].[BaseInheritanceRelationshipEntityId], [o0].[BaseInheritanceRelationshipEntityId], [o0].[Id], [d1].[DerivedInheritanceRelationshipEntityId] """); } @@ -607,7 +607,7 @@ public override async Task Include_reference_with_inheritance_on_derived_with_fi AssertSql( """ -SELECT [d].[Id], [d].[Name], [d].[BaseId], [u].[Id], [o].[BaseInheritanceRelationshipEntityId], [o0].[BaseInheritanceRelationshipEntityId], [o0].[Id], [o0].[Name], [o].[Id], [o].[Name], [d1].[DerivedInheritanceRelationshipEntityId], [d1].[Id], [d1].[Name], [d].[Id], [d].[OwnedReferenceOnDerived_Id], [d].[OwnedReferenceOnDerived_Name], [u].[BaseParentId], [u].[Name], [u].[Discriminator] +SELECT [d].[Id], [d].[Name], [d].[BaseId], [o].[BaseInheritanceRelationshipEntityId], [o0].[BaseInheritanceRelationshipEntityId], [o0].[Id], [o0].[Name], [o].[Id], [o].[Name], [d1].[DerivedInheritanceRelationshipEntityId], [d1].[Id], [d1].[Name], [d].[Id], [d].[OwnedReferenceOnDerived_Id], [d].[OwnedReferenceOnDerived_Name], [u].[Id], [u].[BaseParentId], [u].[Name], [u].[Discriminator] FROM [DerivedEntities] AS [d] LEFT JOIN ( SELECT [b].[Id], [b].[BaseParentId], [b].[Name], N'BaseReferenceOnBase' AS [Discriminator] @@ -620,7 +620,7 @@ FROM [DerivedReferencesOnBase] AS [d0] 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 -ORDER BY [d].[Id], [u].[Id], [o].[BaseInheritanceRelationshipEntityId], [o0].[BaseInheritanceRelationshipEntityId], [o0].[Id], [d1].[DerivedInheritanceRelationshipEntityId] +ORDER BY [d].[Id], [o].[BaseInheritanceRelationshipEntityId], [o0].[BaseInheritanceRelationshipEntityId], [o0].[Id], [d1].[DerivedInheritanceRelationshipEntityId] """); } @@ -630,7 +630,7 @@ public override async Task Include_reference_with_inheritance_on_derived_with_fi AssertSql( """ -SELECT [d].[Id], [d].[Name], [d].[BaseId], [u].[Id], [o].[BaseInheritanceRelationshipEntityId], [o0].[BaseInheritanceRelationshipEntityId], [o0].[Id], [o0].[Name], [o].[Id], [o].[Name], [d1].[DerivedInheritanceRelationshipEntityId], [d1].[Id], [d1].[Name], [d].[Id], [d].[OwnedReferenceOnDerived_Id], [d].[OwnedReferenceOnDerived_Name], [u].[BaseParentId], [u].[Name], [u].[DerivedInheritanceRelationshipEntityId], [u].[Discriminator] +SELECT [d].[Id], [d].[Name], [d].[BaseId], [o].[BaseInheritanceRelationshipEntityId], [o0].[BaseInheritanceRelationshipEntityId], [o0].[Id], [o0].[Name], [o].[Id], [o].[Name], [d1].[DerivedInheritanceRelationshipEntityId], [d1].[Id], [d1].[Name], [d].[Id], [d].[OwnedReferenceOnDerived_Id], [d].[OwnedReferenceOnDerived_Name], [u].[Id], [u].[BaseParentId], [u].[Name], [u].[DerivedInheritanceRelationshipEntityId], [u].[Discriminator] FROM [DerivedEntities] AS [d] LEFT JOIN ( SELECT [b].[Id], [b].[BaseParentId], [b].[Name], NULL AS [DerivedInheritanceRelationshipEntityId], N'BaseReferenceOnDerived' AS [Discriminator] @@ -643,7 +643,7 @@ FROM [DerivedReferencesOnDerived] AS [d0] 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 -ORDER BY [d].[Id], [u].[Id], [o].[BaseInheritanceRelationshipEntityId], [o0].[BaseInheritanceRelationshipEntityId], [o0].[Id], [d1].[DerivedInheritanceRelationshipEntityId] +ORDER BY [d].[Id], [o].[BaseInheritanceRelationshipEntityId], [o0].[BaseInheritanceRelationshipEntityId], [o0].[Id], [d1].[DerivedInheritanceRelationshipEntityId] """); } @@ -653,14 +653,14 @@ public override async Task Include_reference_with_inheritance_on_derived_with_fi AssertSql( """ -SELECT [d].[Id], [d].[Name], [d].[BaseId], [d0].[Id], [o].[BaseInheritanceRelationshipEntityId], [o0].[BaseInheritanceRelationshipEntityId], [o0].[Id], [o0].[Name], [o].[Id], [o].[Name], [d1].[DerivedInheritanceRelationshipEntityId], [d1].[Id], [d1].[Name], [d].[Id], [d].[OwnedReferenceOnDerived_Id], [d].[OwnedReferenceOnDerived_Name], [d0].[BaseParentId], [d0].[Name], [d0].[DerivedInheritanceRelationshipEntityId] +SELECT [d].[Id], [d].[Name], [d].[BaseId], [o].[BaseInheritanceRelationshipEntityId], [o0].[BaseInheritanceRelationshipEntityId], [o0].[Id], [o0].[Name], [o].[Id], [o].[Name], [d1].[DerivedInheritanceRelationshipEntityId], [d1].[Id], [d1].[Name], [d].[Id], [d].[OwnedReferenceOnDerived_Id], [d].[OwnedReferenceOnDerived_Name], [d0].[Id], [d0].[BaseParentId], [d0].[Name], [d0].[DerivedInheritanceRelationshipEntityId] FROM [DerivedEntities] AS [d] LEFT JOIN [DerivedReferencesOnDerived] AS [d0] ON [d].[Id] = [d0].[DerivedInheritanceRelationshipEntityId] 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 -ORDER BY [d].[Id], [d0].[Id], [o].[BaseInheritanceRelationshipEntityId], [o0].[BaseInheritanceRelationshipEntityId], [o0].[Id], [d1].[DerivedInheritanceRelationshipEntityId] +ORDER BY [d].[Id], [o].[BaseInheritanceRelationshipEntityId], [o0].[BaseInheritanceRelationshipEntityId], [o0].[Id], [d1].[DerivedInheritanceRelationshipEntityId] """); } @@ -683,7 +683,7 @@ FROM [DerivedReferencesOnDerived] AS [d] LEFT JOIN [OwnedCollections] AS [o0] ON [d0].[Id] = [o0].[BaseInheritanceRelationshipEntityId] LEFT JOIN [DerivedEntities_OwnedCollectionOnDerived] AS [d1] ON [d0].[Id] = [d1].[DerivedInheritanceRelationshipEntityId] WHERE [u].[Name] <> N'Bar' OR [u].[Name] IS NULL -ORDER BY [u].[Id], [d0].[Id], [o].[BaseInheritanceRelationshipEntityId], [o0].[BaseInheritanceRelationshipEntityId], [o0].[Id], [d1].[DerivedInheritanceRelationshipEntityId] +ORDER BY [u].[Id], [o].[BaseInheritanceRelationshipEntityId], [o0].[BaseInheritanceRelationshipEntityId], [o0].[Id], [d1].[DerivedInheritanceRelationshipEntityId] """); } @@ -712,7 +712,7 @@ FROM [DerivedEntities] AS [d0] LEFT JOIN [DerivedEntities] AS [d1] ON [u0].[Id] = [d1].[Id] LEFT JOIN [OwnedCollections] AS [o0] ON [u0].[Id] = [o0].[BaseInheritanceRelationshipEntityId] LEFT JOIN [DerivedEntities_OwnedCollectionOnDerived] AS [d2] ON [u0].[Id] = [d2].[DerivedInheritanceRelationshipEntityId] -ORDER BY [u].[Id], [u0].[Id], [o].[BaseInheritanceRelationshipEntityId], [d1].[Id], [o0].[BaseInheritanceRelationshipEntityId], [o0].[Id], [d2].[DerivedInheritanceRelationshipEntityId] +ORDER BY [u].[Id], [o].[BaseInheritanceRelationshipEntityId], [d1].[Id], [o0].[BaseInheritanceRelationshipEntityId], [o0].[Id], [d2].[DerivedInheritanceRelationshipEntityId] """); } @@ -722,7 +722,7 @@ public override async Task Include_reference_with_inheritance_with_filter(bool a AssertSql( """ -SELECT [u].[Id], [u].[Name], [u].[BaseId], [u].[Discriminator], [u0].[Id], [o].[BaseInheritanceRelationshipEntityId], [d1].[Id], [o0].[BaseInheritanceRelationshipEntityId], [o0].[Id], [o0].[Name], [o].[Id], [o].[Name], [d2].[DerivedInheritanceRelationshipEntityId], [d2].[Id], [d2].[Name], [d1].[OwnedReferenceOnDerived_Id], [d1].[OwnedReferenceOnDerived_Name], [u0].[BaseParentId], [u0].[Name], [u0].[Discriminator] +SELECT [u].[Id], [u].[Name], [u].[BaseId], [u].[Discriminator], [o].[BaseInheritanceRelationshipEntityId], [d1].[Id], [o0].[BaseInheritanceRelationshipEntityId], [o0].[Id], [o0].[Name], [o].[Id], [o].[Name], [d2].[DerivedInheritanceRelationshipEntityId], [d2].[Id], [d2].[Name], [d1].[OwnedReferenceOnDerived_Id], [d1].[OwnedReferenceOnDerived_Name], [u0].[Id], [u0].[BaseParentId], [u0].[Name], [u0].[Discriminator] FROM ( SELECT [b].[Id], [b].[Name], NULL AS [BaseId], N'BaseInheritanceRelationshipEntity' AS [Discriminator] FROM [BaseEntities] AS [b] @@ -742,7 +742,7 @@ FROM [DerivedReferencesOnBase] AS [d0] LEFT JOIN [OwnedCollections] AS [o0] ON [u].[Id] = [o0].[BaseInheritanceRelationshipEntityId] LEFT JOIN [DerivedEntities_OwnedCollectionOnDerived] AS [d2] ON [u].[Id] = [d2].[DerivedInheritanceRelationshipEntityId] WHERE [u].[Name] <> N'Bar' OR [u].[Name] IS NULL -ORDER BY [u].[Id], [u0].[Id], [o].[BaseInheritanceRelationshipEntityId], [d1].[Id], [o0].[BaseInheritanceRelationshipEntityId], [o0].[Id], [d2].[DerivedInheritanceRelationshipEntityId] +ORDER BY [u].[Id], [o].[BaseInheritanceRelationshipEntityId], [d1].[Id], [o0].[BaseInheritanceRelationshipEntityId], [o0].[Id], [d2].[DerivedInheritanceRelationshipEntityId] """); } @@ -772,7 +772,7 @@ FROM [DerivedEntities] AS [d0] LEFT JOIN [OwnedCollections] AS [o0] ON [u0].[Id] = [o0].[BaseInheritanceRelationshipEntityId] LEFT JOIN [DerivedEntities_OwnedCollectionOnDerived] AS [d2] ON [u0].[Id] = [d2].[DerivedInheritanceRelationshipEntityId] WHERE [u].[Name] <> N'Bar' OR [u].[Name] IS NULL -ORDER BY [u].[Id], [u0].[Id], [o].[BaseInheritanceRelationshipEntityId], [d1].[Id], [o0].[BaseInheritanceRelationshipEntityId], [o0].[Id], [d2].[DerivedInheritanceRelationshipEntityId] +ORDER BY [u].[Id], [o].[BaseInheritanceRelationshipEntityId], [d1].[Id], [o0].[BaseInheritanceRelationshipEntityId], [o0].[Id], [d2].[DerivedInheritanceRelationshipEntityId] """); } @@ -782,7 +782,7 @@ public override async Task Include_self_reference_with_inheritance(bool async) AssertSql( """ -SELECT [u].[Id], [u].[Name], [u].[BaseId], [u].[Discriminator], [d0].[Id], [o].[BaseInheritanceRelationshipEntityId], [d1].[Id], [o0].[BaseInheritanceRelationshipEntityId], [o1].[BaseInheritanceRelationshipEntityId], [o1].[Id], [o1].[Name], [o].[Id], [o].[Name], [d2].[DerivedInheritanceRelationshipEntityId], [d2].[Id], [d2].[Name], [d1].[OwnedReferenceOnDerived_Id], [d1].[OwnedReferenceOnDerived_Name], [d0].[Name], [d0].[BaseId], [o2].[BaseInheritanceRelationshipEntityId], [o2].[Id], [o2].[Name], [o0].[Id], [o0].[Name], [d3].[DerivedInheritanceRelationshipEntityId], [d3].[Id], [d3].[Name], [d0].[OwnedReferenceOnDerived_Id], [d0].[OwnedReferenceOnDerived_Name] +SELECT [u].[Id], [u].[Name], [u].[BaseId], [u].[Discriminator], [o].[BaseInheritanceRelationshipEntityId], [d1].[Id], [o0].[BaseInheritanceRelationshipEntityId], [o1].[BaseInheritanceRelationshipEntityId], [o1].[Id], [o1].[Name], [o].[Id], [o].[Name], [d2].[DerivedInheritanceRelationshipEntityId], [d2].[Id], [d2].[Name], [d1].[OwnedReferenceOnDerived_Id], [d1].[OwnedReferenceOnDerived_Name], [d0].[Id], [d0].[Name], [d0].[BaseId], [o2].[BaseInheritanceRelationshipEntityId], [o2].[Id], [o2].[Name], [o0].[Id], [o0].[Name], [d3].[DerivedInheritanceRelationshipEntityId], [d3].[Id], [d3].[Name], [d0].[OwnedReferenceOnDerived_Id], [d0].[OwnedReferenceOnDerived_Name] FROM ( SELECT [b].[Id], [b].[Name], NULL AS [BaseId], N'BaseInheritanceRelationshipEntity' AS [Discriminator] FROM [BaseEntities] AS [b] @@ -798,7 +798,7 @@ FROM [DerivedEntities] AS [d] LEFT JOIN [DerivedEntities_OwnedCollectionOnDerived] AS [d2] ON [u].[Id] = [d2].[DerivedInheritanceRelationshipEntityId] LEFT JOIN [OwnedCollections] AS [o2] ON [d0].[Id] = [o2].[BaseInheritanceRelationshipEntityId] LEFT JOIN [DerivedEntities_OwnedCollectionOnDerived] AS [d3] ON [d0].[Id] = [d3].[DerivedInheritanceRelationshipEntityId] -ORDER BY [u].[Id], [d0].[Id], [o].[BaseInheritanceRelationshipEntityId], [d1].[Id], [o0].[BaseInheritanceRelationshipEntityId], [o1].[BaseInheritanceRelationshipEntityId], [o1].[Id], [d2].[DerivedInheritanceRelationshipEntityId], [d2].[Id], [o2].[BaseInheritanceRelationshipEntityId], [o2].[Id], [d3].[DerivedInheritanceRelationshipEntityId] +ORDER BY [u].[Id], [o].[BaseInheritanceRelationshipEntityId], [d1].[Id], [o0].[BaseInheritanceRelationshipEntityId], [o1].[BaseInheritanceRelationshipEntityId], [o1].[Id], [d2].[DerivedInheritanceRelationshipEntityId], [d2].[Id], [o2].[BaseInheritanceRelationshipEntityId], [o2].[Id], [d3].[DerivedInheritanceRelationshipEntityId] """); } @@ -808,7 +808,7 @@ public override async Task Include_self_reference_with_inheritance_reverse(bool AssertSql( """ -SELECT [d].[Id], [d].[Name], [d].[BaseId], [u].[Id], [o].[BaseInheritanceRelationshipEntityId], [o0].[BaseInheritanceRelationshipEntityId], [d1].[Id], [o1].[BaseInheritanceRelationshipEntityId], [o1].[Id], [o1].[Name], [o].[Id], [o].[Name], [d2].[DerivedInheritanceRelationshipEntityId], [d2].[Id], [d2].[Name], [d].[Id], [d].[OwnedReferenceOnDerived_Id], [d].[OwnedReferenceOnDerived_Name], [u].[Name], [u].[BaseId], [u].[Discriminator], [o2].[BaseInheritanceRelationshipEntityId], [o2].[Id], [o2].[Name], [o0].[Id], [o0].[Name], [d3].[DerivedInheritanceRelationshipEntityId], [d3].[Id], [d3].[Name], [d1].[OwnedReferenceOnDerived_Id], [d1].[OwnedReferenceOnDerived_Name] +SELECT [d].[Id], [d].[Name], [d].[BaseId], [o].[BaseInheritanceRelationshipEntityId], [o0].[BaseInheritanceRelationshipEntityId], [d1].[Id], [o1].[BaseInheritanceRelationshipEntityId], [o1].[Id], [o1].[Name], [o].[Id], [o].[Name], [d2].[DerivedInheritanceRelationshipEntityId], [d2].[Id], [d2].[Name], [d].[Id], [d].[OwnedReferenceOnDerived_Id], [d].[OwnedReferenceOnDerived_Name], [u].[Id], [u].[Name], [u].[BaseId], [u].[Discriminator], [o2].[BaseInheritanceRelationshipEntityId], [o2].[Id], [o2].[Name], [o0].[Id], [o0].[Name], [d3].[DerivedInheritanceRelationshipEntityId], [d3].[Id], [d3].[Name], [d1].[OwnedReferenceOnDerived_Id], [d1].[OwnedReferenceOnDerived_Name] FROM [DerivedEntities] AS [d] LEFT JOIN ( SELECT [b].[Id], [b].[Name], NULL AS [BaseId], N'BaseInheritanceRelationshipEntity' AS [Discriminator] @@ -824,7 +824,7 @@ FROM [DerivedEntities] AS [d0] LEFT JOIN [DerivedEntities_OwnedCollectionOnDerived] AS [d2] ON [d].[Id] = [d2].[DerivedInheritanceRelationshipEntityId] LEFT JOIN [OwnedCollections] AS [o2] ON [u].[Id] = [o2].[BaseInheritanceRelationshipEntityId] LEFT JOIN [DerivedEntities_OwnedCollectionOnDerived] AS [d3] ON [u].[Id] = [d3].[DerivedInheritanceRelationshipEntityId] -ORDER BY [d].[Id], [u].[Id], [o].[BaseInheritanceRelationshipEntityId], [o0].[BaseInheritanceRelationshipEntityId], [d1].[Id], [o1].[BaseInheritanceRelationshipEntityId], [o1].[Id], [d2].[DerivedInheritanceRelationshipEntityId], [d2].[Id], [o2].[BaseInheritanceRelationshipEntityId], [o2].[Id], [d3].[DerivedInheritanceRelationshipEntityId] +ORDER BY [d].[Id], [o].[BaseInheritanceRelationshipEntityId], [o0].[BaseInheritanceRelationshipEntityId], [d1].[Id], [o1].[BaseInheritanceRelationshipEntityId], [o1].[Id], [d2].[DerivedInheritanceRelationshipEntityId], [d2].[Id], [o2].[BaseInheritanceRelationshipEntityId], [o2].[Id], [d3].[DerivedInheritanceRelationshipEntityId] """); } @@ -841,7 +841,7 @@ LEFT JOIN ( FROM [PrincipalEntities] AS [p] LEFT JOIN [ReferencedEntities] AS [r0] ON [p].[ReferenceId] = [r0].[Id] ) AS [s] ON [r].[Id] = [s].[ReferencedEntityId] -ORDER BY [r].[Id], [s].[Id] +ORDER BY [r].[Id] """); } @@ -916,7 +916,7 @@ FROM [DerivedEntities] AS [d0] LEFT JOIN [DerivedEntities] AS [d1] ON [u1].[Id] = [d1].[Id] LEFT JOIN [OwnedCollections] AS [o0] ON [u1].[Id] = [o0].[BaseInheritanceRelationshipEntityId] LEFT JOIN [DerivedEntities_OwnedCollectionOnDerived] AS [d2] ON [u1].[Id] = [d2].[DerivedInheritanceRelationshipEntityId] -ORDER BY [u].[Id], [u0].[Id], [u1].[Id], [o].[BaseInheritanceRelationshipEntityId], [d1].[Id], [o0].[BaseInheritanceRelationshipEntityId], [o0].[Id], [d2].[DerivedInheritanceRelationshipEntityId] +ORDER BY [u].[Id], [o].[BaseInheritanceRelationshipEntityId], [d1].[Id], [o0].[BaseInheritanceRelationshipEntityId], [o0].[Id], [d2].[DerivedInheritanceRelationshipEntityId] """); } @@ -955,7 +955,7 @@ UNION ALL FROM [NestedReferencesDerived] AS [n0] ) AS [u1] ON [u0].[Id] = [u1].[ParentCollectionId] ) AS [s] ON [u].[Id] = [s].[BaseParentId] -ORDER BY [u].[Id], [o].[BaseInheritanceRelationshipEntityId], [d0].[Id], [o0].[BaseInheritanceRelationshipEntityId], [o0].[Id], [d1].[DerivedInheritanceRelationshipEntityId], [d1].[Id], [s].[Id] +ORDER BY [u].[Id], [o].[BaseInheritanceRelationshipEntityId], [d0].[Id], [o0].[BaseInheritanceRelationshipEntityId], [o0].[Id], [d1].[DerivedInheritanceRelationshipEntityId], [d1].[Id] """); } @@ -991,7 +991,7 @@ FROM [DerivedEntities] AS [d0] LEFT JOIN [DerivedEntities] AS [d1] ON [u1].[Id] = [d1].[Id] LEFT JOIN [OwnedCollections] AS [o0] ON [u1].[Id] = [o0].[BaseInheritanceRelationshipEntityId] LEFT JOIN [DerivedEntities_OwnedCollectionOnDerived] AS [d2] ON [u1].[Id] = [d2].[DerivedInheritanceRelationshipEntityId] -ORDER BY [u].[Id], [u0].[Id], [u1].[Id], [o].[BaseInheritanceRelationshipEntityId], [d1].[Id], [o0].[BaseInheritanceRelationshipEntityId], [o0].[Id], [d2].[DerivedInheritanceRelationshipEntityId] +ORDER BY [u].[Id], [o].[BaseInheritanceRelationshipEntityId], [d1].[Id], [o0].[BaseInheritanceRelationshipEntityId], [o0].[Id], [d2].[DerivedInheritanceRelationshipEntityId] """); } @@ -1001,7 +1001,7 @@ public override async Task Nested_include_with_inheritance_reference_collection( AssertSql( """ -SELECT [u].[Id], [u].[Name], [u].[BaseId], [u].[Discriminator], [u0].[Id], [o].[BaseInheritanceRelationshipEntityId], [d1].[Id], [o0].[BaseInheritanceRelationshipEntityId], [o0].[Id], [o0].[Name], [o].[Id], [o].[Name], [d2].[DerivedInheritanceRelationshipEntityId], [d2].[Id], [d2].[Name], [d1].[OwnedReferenceOnDerived_Id], [d1].[OwnedReferenceOnDerived_Name], [u0].[BaseParentId], [u0].[Name], [u0].[Discriminator], [u1].[Id], [u1].[Name], [u1].[ParentCollectionId], [u1].[ParentReferenceId], [u1].[Discriminator] +SELECT [u].[Id], [u].[Name], [u].[BaseId], [u].[Discriminator], [o].[BaseInheritanceRelationshipEntityId], [d1].[Id], [o0].[BaseInheritanceRelationshipEntityId], [o0].[Id], [o0].[Name], [o].[Id], [o].[Name], [d2].[DerivedInheritanceRelationshipEntityId], [d2].[Id], [d2].[Name], [d1].[OwnedReferenceOnDerived_Id], [d1].[OwnedReferenceOnDerived_Name], [u0].[Id], [u0].[BaseParentId], [u0].[Name], [u0].[Discriminator], [u1].[Id], [u1].[Name], [u1].[ParentCollectionId], [u1].[ParentReferenceId], [u1].[Discriminator] FROM ( SELECT [b].[Id], [b].[Name], NULL AS [BaseId], N'BaseInheritanceRelationshipEntity' AS [Discriminator] FROM [BaseEntities] AS [b] @@ -1027,7 +1027,7 @@ UNION ALL SELECT [n0].[Id], [n0].[Name], [n0].[ParentCollectionId], [n0].[ParentReferenceId], N'NestedCollectionDerived' AS [Discriminator] FROM [NestedCollectionsDerived] AS [n0] ) AS [u1] ON [u0].[Id] = [u1].[ParentReferenceId] -ORDER BY [u].[Id], [u0].[Id], [o].[BaseInheritanceRelationshipEntityId], [d1].[Id], [o0].[BaseInheritanceRelationshipEntityId], [o0].[Id], [d2].[DerivedInheritanceRelationshipEntityId], [d2].[Id] +ORDER BY [u].[Id], [o].[BaseInheritanceRelationshipEntityId], [d1].[Id], [o0].[BaseInheritanceRelationshipEntityId], [o0].[Id], [d2].[DerivedInheritanceRelationshipEntityId], [d2].[Id] """); } @@ -1037,7 +1037,7 @@ public override async Task Nested_include_with_inheritance_reference_collection_ AssertSql( """ -SELECT [d].[Id], [d].[Name], [d].[BaseId], [u].[Id], [o].[BaseInheritanceRelationshipEntityId], [o0].[BaseInheritanceRelationshipEntityId], [o0].[Id], [o0].[Name], [o].[Id], [o].[Name], [d1].[DerivedInheritanceRelationshipEntityId], [d1].[Id], [d1].[Name], [d].[Id], [d].[OwnedReferenceOnDerived_Id], [d].[OwnedReferenceOnDerived_Name], [u].[BaseParentId], [u].[Name], [u].[Discriminator], [u0].[Id], [u0].[Name], [u0].[ParentCollectionId], [u0].[ParentReferenceId], [u0].[Discriminator] +SELECT [d].[Id], [d].[Name], [d].[BaseId], [o].[BaseInheritanceRelationshipEntityId], [o0].[BaseInheritanceRelationshipEntityId], [o0].[Id], [o0].[Name], [o].[Id], [o].[Name], [d1].[DerivedInheritanceRelationshipEntityId], [d1].[Id], [d1].[Name], [d].[Id], [d].[OwnedReferenceOnDerived_Id], [d].[OwnedReferenceOnDerived_Name], [u].[Id], [u].[BaseParentId], [u].[Name], [u].[Discriminator], [u0].[Id], [u0].[Name], [u0].[ParentCollectionId], [u0].[ParentReferenceId], [u0].[Discriminator] FROM [DerivedEntities] AS [d] LEFT JOIN ( SELECT [b].[Id], [b].[BaseParentId], [b].[Name], N'BaseReferenceOnBase' AS [Discriminator] @@ -1056,7 +1056,7 @@ UNION ALL SELECT [n0].[Id], [n0].[Name], [n0].[ParentCollectionId], [n0].[ParentReferenceId], N'NestedCollectionDerived' AS [Discriminator] FROM [NestedCollectionsDerived] AS [n0] ) AS [u0] ON [u].[Id] = [u0].[ParentReferenceId] -ORDER BY [d].[Id], [u].[Id], [o].[BaseInheritanceRelationshipEntityId], [o0].[BaseInheritanceRelationshipEntityId], [o0].[Id], [d1].[DerivedInheritanceRelationshipEntityId], [d1].[Id] +ORDER BY [d].[Id], [o].[BaseInheritanceRelationshipEntityId], [o0].[BaseInheritanceRelationshipEntityId], [o0].[Id], [d1].[DerivedInheritanceRelationshipEntityId], [d1].[Id] """); } @@ -1092,7 +1092,7 @@ FROM [DerivedEntities] AS [d0] LEFT JOIN [DerivedEntities] AS [d1] ON [u1].[Id] = [d1].[Id] LEFT JOIN [OwnedCollections] AS [o0] ON [u1].[Id] = [o0].[BaseInheritanceRelationshipEntityId] LEFT JOIN [DerivedEntities_OwnedCollectionOnDerived] AS [d2] ON [u1].[Id] = [d2].[DerivedInheritanceRelationshipEntityId] -ORDER BY [u].[Id], [u0].[Id], [u1].[Id], [o].[BaseInheritanceRelationshipEntityId], [d1].[Id], [o0].[BaseInheritanceRelationshipEntityId], [o0].[Id], [d2].[DerivedInheritanceRelationshipEntityId] +ORDER BY [u].[Id], [o].[BaseInheritanceRelationshipEntityId], [d1].[Id], [o0].[BaseInheritanceRelationshipEntityId], [o0].[Id], [d2].[DerivedInheritanceRelationshipEntityId] """); } @@ -1102,7 +1102,7 @@ public override async Task Nested_include_with_inheritance_reference_reference(b AssertSql( """ -SELECT [u].[Id], [u].[Name], [u].[BaseId], [u].[Discriminator], [u0].[Id], [u1].[Id], [o].[BaseInheritanceRelationshipEntityId], [d1].[Id], [o0].[BaseInheritanceRelationshipEntityId], [o0].[Id], [o0].[Name], [o].[Id], [o].[Name], [d2].[DerivedInheritanceRelationshipEntityId], [d2].[Id], [d2].[Name], [d1].[OwnedReferenceOnDerived_Id], [d1].[OwnedReferenceOnDerived_Name], [u0].[BaseParentId], [u0].[Name], [u0].[Discriminator], [u1].[Name], [u1].[ParentCollectionId], [u1].[ParentReferenceId], [u1].[Discriminator] +SELECT [u].[Id], [u].[Name], [u].[BaseId], [u].[Discriminator], [o].[BaseInheritanceRelationshipEntityId], [d1].[Id], [o0].[BaseInheritanceRelationshipEntityId], [o0].[Id], [o0].[Name], [o].[Id], [o].[Name], [d2].[DerivedInheritanceRelationshipEntityId], [d2].[Id], [d2].[Name], [d1].[OwnedReferenceOnDerived_Id], [d1].[OwnedReferenceOnDerived_Name], [u0].[Id], [u0].[BaseParentId], [u0].[Name], [u0].[Discriminator], [u1].[Id], [u1].[Name], [u1].[ParentCollectionId], [u1].[ParentReferenceId], [u1].[Discriminator] FROM ( SELECT [b].[Id], [b].[Name], NULL AS [BaseId], N'BaseInheritanceRelationshipEntity' AS [Discriminator] FROM [BaseEntities] AS [b] @@ -1128,7 +1128,7 @@ FROM [NestedReferencesDerived] AS [n0] LEFT JOIN [DerivedEntities] AS [d1] ON [u].[Id] = [d1].[Id] LEFT JOIN [OwnedCollections] AS [o0] ON [u].[Id] = [o0].[BaseInheritanceRelationshipEntityId] LEFT JOIN [DerivedEntities_OwnedCollectionOnDerived] AS [d2] ON [u].[Id] = [d2].[DerivedInheritanceRelationshipEntityId] -ORDER BY [u].[Id], [u0].[Id], [u1].[Id], [o].[BaseInheritanceRelationshipEntityId], [d1].[Id], [o0].[BaseInheritanceRelationshipEntityId], [o0].[Id], [d2].[DerivedInheritanceRelationshipEntityId] +ORDER BY [u].[Id], [o].[BaseInheritanceRelationshipEntityId], [d1].[Id], [o0].[BaseInheritanceRelationshipEntityId], [o0].[Id], [d2].[DerivedInheritanceRelationshipEntityId] """); } @@ -1138,7 +1138,7 @@ public override async Task Nested_include_with_inheritance_reference_reference_o AssertSql( """ -SELECT [d].[Id], [d].[Name], [d].[BaseId], [u].[Id], [u0].[Id], [o].[BaseInheritanceRelationshipEntityId], [o0].[BaseInheritanceRelationshipEntityId], [o0].[Id], [o0].[Name], [o].[Id], [o].[Name], [d1].[DerivedInheritanceRelationshipEntityId], [d1].[Id], [d1].[Name], [d].[Id], [d].[OwnedReferenceOnDerived_Id], [d].[OwnedReferenceOnDerived_Name], [u].[BaseParentId], [u].[Name], [u].[Discriminator], [u0].[Name], [u0].[ParentCollectionId], [u0].[ParentReferenceId], [u0].[Discriminator] +SELECT [d].[Id], [d].[Name], [d].[BaseId], [o].[BaseInheritanceRelationshipEntityId], [o0].[BaseInheritanceRelationshipEntityId], [o0].[Id], [o0].[Name], [o].[Id], [o].[Name], [d1].[DerivedInheritanceRelationshipEntityId], [d1].[Id], [d1].[Name], [d].[Id], [d].[OwnedReferenceOnDerived_Id], [d].[OwnedReferenceOnDerived_Name], [u].[Id], [u].[BaseParentId], [u].[Name], [u].[Discriminator], [u0].[Id], [u0].[Name], [u0].[ParentCollectionId], [u0].[ParentReferenceId], [u0].[Discriminator] FROM [DerivedEntities] AS [d] LEFT JOIN ( SELECT [b].[Id], [b].[BaseParentId], [b].[Name], N'BaseReferenceOnBase' AS [Discriminator] @@ -1157,7 +1157,7 @@ FROM [NestedReferencesDerived] AS [n0] 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] -ORDER BY [d].[Id], [u].[Id], [u0].[Id], [o].[BaseInheritanceRelationshipEntityId], [o0].[BaseInheritanceRelationshipEntityId], [o0].[Id], [d1].[DerivedInheritanceRelationshipEntityId] +ORDER BY [d].[Id], [o].[BaseInheritanceRelationshipEntityId], [o0].[BaseInheritanceRelationshipEntityId], [o0].[Id], [d1].[DerivedInheritanceRelationshipEntityId] """); } @@ -1193,7 +1193,7 @@ FROM [DerivedEntities] AS [d0] LEFT JOIN [DerivedEntities] AS [d1] ON [u1].[Id] = [d1].[Id] LEFT JOIN [OwnedCollections] AS [o0] ON [u1].[Id] = [o0].[BaseInheritanceRelationshipEntityId] LEFT JOIN [DerivedEntities_OwnedCollectionOnDerived] AS [d2] ON [u1].[Id] = [d2].[DerivedInheritanceRelationshipEntityId] -ORDER BY [u].[Id], [u0].[Id], [u1].[Id], [o].[BaseInheritanceRelationshipEntityId], [d1].[Id], [o0].[BaseInheritanceRelationshipEntityId], [o0].[Id], [d2].[DerivedInheritanceRelationshipEntityId] +ORDER BY [u].[Id], [o].[BaseInheritanceRelationshipEntityId], [d1].[Id], [o0].[BaseInheritanceRelationshipEntityId], [o0].[Id], [d2].[DerivedInheritanceRelationshipEntityId] """); } @@ -1340,11 +1340,11 @@ FROM [DerivedEntities] AS [d0] ) AS [u0] ON [u].[BaseParentId] = [u0].[Id] LEFT JOIN [OwnedReferences] AS [o] ON [u0].[Id] = [o].[BaseInheritanceRelationshipEntityId] LEFT JOIN [DerivedEntities] AS [d1] ON [u0].[Id] = [d1].[Id] -ORDER BY [u].[Id], [u0].[Id], [o].[BaseInheritanceRelationshipEntityId], [d1].[Id] +ORDER BY [u].[Id], [o].[BaseInheritanceRelationshipEntityId], [d1].[Id] """, // """ -SELECT [o1].[BaseInheritanceRelationshipEntityId], [o1].[Id], [o1].[Name], [u].[Id], [u0].[Id], [o0].[BaseInheritanceRelationshipEntityId], [d2].[Id] +SELECT [o1].[BaseInheritanceRelationshipEntityId], [o1].[Id], [o1].[Name], [u].[Id], [o0].[BaseInheritanceRelationshipEntityId], [d2].[Id] FROM ( SELECT [b].[Id], [b].[BaseParentId] FROM [BaseCollectionsOnBase] AS [b] @@ -1362,11 +1362,11 @@ FROM [DerivedEntities] AS [d0] LEFT JOIN [OwnedReferences] AS [o0] ON [u0].[Id] = [o0].[BaseInheritanceRelationshipEntityId] LEFT JOIN [DerivedEntities] AS [d2] ON [u0].[Id] = [d2].[Id] INNER JOIN [OwnedCollections] AS [o1] ON [u0].[Id] = [o1].[BaseInheritanceRelationshipEntityId] -ORDER BY [u].[Id], [u0].[Id], [o0].[BaseInheritanceRelationshipEntityId], [d2].[Id] +ORDER BY [u].[Id], [o0].[BaseInheritanceRelationshipEntityId], [d2].[Id] """, // """ -SELECT [d3].[DerivedInheritanceRelationshipEntityId], [d3].[Id], [d3].[Name], [u].[Id], [u0].[Id], [o0].[BaseInheritanceRelationshipEntityId], [d2].[Id] +SELECT [d3].[DerivedInheritanceRelationshipEntityId], [d3].[Id], [d3].[Name], [u].[Id], [o0].[BaseInheritanceRelationshipEntityId], [d2].[Id] FROM ( SELECT [b].[Id], [b].[BaseParentId] FROM [BaseCollectionsOnBase] AS [b] @@ -1384,7 +1384,7 @@ FROM [DerivedEntities] AS [d0] LEFT JOIN [OwnedReferences] AS [o0] ON [u0].[Id] = [o0].[BaseInheritanceRelationshipEntityId] LEFT JOIN [DerivedEntities] AS [d2] ON [u0].[Id] = [d2].[Id] INNER JOIN [DerivedEntities_OwnedCollectionOnDerived] AS [d3] ON [u0].[Id] = [d3].[DerivedInheritanceRelationshipEntityId] -ORDER BY [u].[Id], [u0].[Id], [o0].[BaseInheritanceRelationshipEntityId], [d2].[Id] +ORDER BY [u].[Id], [o0].[BaseInheritanceRelationshipEntityId], [d2].[Id] """); } @@ -1487,11 +1487,11 @@ FROM [DerivedEntities] AS [d0] LEFT JOIN [OwnedReferences] AS [o] ON [u0].[Id] = [o].[BaseInheritanceRelationshipEntityId] LEFT JOIN [DerivedEntities] AS [d1] ON [u0].[Id] = [d1].[Id] WHERE [u].[Name] <> N'Bar' OR [u].[Name] IS NULL -ORDER BY [u].[Id], [u0].[Id], [o].[BaseInheritanceRelationshipEntityId], [d1].[Id] +ORDER BY [u].[Id], [o].[BaseInheritanceRelationshipEntityId], [d1].[Id] """, // """ -SELECT [o1].[BaseInheritanceRelationshipEntityId], [o1].[Id], [o1].[Name], [u].[Id], [u0].[Id], [o0].[BaseInheritanceRelationshipEntityId], [d2].[Id] +SELECT [o1].[BaseInheritanceRelationshipEntityId], [o1].[Id], [o1].[Name], [u].[Id], [o0].[BaseInheritanceRelationshipEntityId], [d2].[Id] FROM ( SELECT [b].[Id], [b].[BaseParentId], [b].[Name] FROM [BaseCollectionsOnBase] AS [b] @@ -1510,11 +1510,11 @@ FROM [DerivedEntities] AS [d0] LEFT JOIN [DerivedEntities] AS [d2] ON [u0].[Id] = [d2].[Id] INNER JOIN [OwnedCollections] AS [o1] ON [u0].[Id] = [o1].[BaseInheritanceRelationshipEntityId] WHERE [u].[Name] <> N'Bar' OR [u].[Name] IS NULL -ORDER BY [u].[Id], [u0].[Id], [o0].[BaseInheritanceRelationshipEntityId], [d2].[Id] +ORDER BY [u].[Id], [o0].[BaseInheritanceRelationshipEntityId], [d2].[Id] """, // """ -SELECT [d3].[DerivedInheritanceRelationshipEntityId], [d3].[Id], [d3].[Name], [u].[Id], [u0].[Id], [o0].[BaseInheritanceRelationshipEntityId], [d2].[Id] +SELECT [d3].[DerivedInheritanceRelationshipEntityId], [d3].[Id], [d3].[Name], [u].[Id], [o0].[BaseInheritanceRelationshipEntityId], [d2].[Id] FROM ( SELECT [b].[Id], [b].[BaseParentId], [b].[Name] FROM [BaseCollectionsOnBase] AS [b] @@ -1533,7 +1533,7 @@ FROM [DerivedEntities] AS [d0] LEFT JOIN [DerivedEntities] AS [d2] ON [u0].[Id] = [d2].[Id] INNER JOIN [DerivedEntities_OwnedCollectionOnDerived] AS [d3] ON [u0].[Id] = [d3].[DerivedInheritanceRelationshipEntityId] WHERE [u].[Name] <> N'Bar' OR [u].[Name] IS NULL -ORDER BY [u].[Id], [u0].[Id], [o0].[BaseInheritanceRelationshipEntityId], [d2].[Id] +ORDER BY [u].[Id], [o0].[BaseInheritanceRelationshipEntityId], [d2].[Id] """); } @@ -1619,11 +1619,11 @@ FROM [DerivedEntities] AS [d] ) AS [u] ON [c].[ParentId] = [u].[Id] LEFT JOIN [OwnedReferences] AS [o] ON [u].[Id] = [o].[BaseInheritanceRelationshipEntityId] LEFT JOIN [DerivedEntities] AS [d0] ON [u].[Id] = [d0].[Id] -ORDER BY [c].[Id], [u].[Id], [o].[BaseInheritanceRelationshipEntityId], [d0].[Id] +ORDER BY [c].[Id], [o].[BaseInheritanceRelationshipEntityId], [d0].[Id] """, // """ -SELECT [o1].[BaseInheritanceRelationshipEntityId], [o1].[Id], [o1].[Name], [c].[Id], [u].[Id], [o0].[BaseInheritanceRelationshipEntityId], [d1].[Id] +SELECT [o1].[BaseInheritanceRelationshipEntityId], [o1].[Id], [o1].[Name], [c].[Id], [o0].[BaseInheritanceRelationshipEntityId], [d1].[Id] FROM [CollectionsOnBase] AS [c] LEFT JOIN ( SELECT [b].[Id] @@ -1635,11 +1635,11 @@ FROM [DerivedEntities] AS [d] LEFT JOIN [OwnedReferences] AS [o0] ON [u].[Id] = [o0].[BaseInheritanceRelationshipEntityId] LEFT JOIN [DerivedEntities] AS [d1] ON [u].[Id] = [d1].[Id] INNER JOIN [OwnedCollections] AS [o1] ON [u].[Id] = [o1].[BaseInheritanceRelationshipEntityId] -ORDER BY [c].[Id], [u].[Id], [o0].[BaseInheritanceRelationshipEntityId], [d1].[Id] +ORDER BY [c].[Id], [o0].[BaseInheritanceRelationshipEntityId], [d1].[Id] """, // """ -SELECT [d2].[DerivedInheritanceRelationshipEntityId], [d2].[Id], [d2].[Name], [c].[Id], [u].[Id], [o0].[BaseInheritanceRelationshipEntityId], [d1].[Id] +SELECT [d2].[DerivedInheritanceRelationshipEntityId], [d2].[Id], [d2].[Name], [c].[Id], [o0].[BaseInheritanceRelationshipEntityId], [d1].[Id] FROM [CollectionsOnBase] AS [c] LEFT JOIN ( SELECT [b].[Id] @@ -1651,7 +1651,7 @@ FROM [DerivedEntities] AS [d] LEFT JOIN [OwnedReferences] AS [o0] ON [u].[Id] = [o0].[BaseInheritanceRelationshipEntityId] LEFT JOIN [DerivedEntities] AS [d1] ON [u].[Id] = [d1].[Id] INNER JOIN [DerivedEntities_OwnedCollectionOnDerived] AS [d2] ON [u].[Id] = [d2].[DerivedInheritanceRelationshipEntityId] -ORDER BY [c].[Id], [u].[Id], [o0].[BaseInheritanceRelationshipEntityId], [d1].[Id] +ORDER BY [c].[Id], [o0].[BaseInheritanceRelationshipEntityId], [d1].[Id] """); } @@ -1742,11 +1742,11 @@ FROM [DerivedEntities] AS [d] LEFT JOIN [OwnedReferences] AS [o] ON [u].[Id] = [o].[BaseInheritanceRelationshipEntityId] LEFT JOIN [DerivedEntities] AS [d0] ON [u].[Id] = [d0].[Id] WHERE [c].[Name] <> N'Bar' OR [c].[Name] IS NULL -ORDER BY [c].[Id], [u].[Id], [o].[BaseInheritanceRelationshipEntityId], [d0].[Id] +ORDER BY [c].[Id], [o].[BaseInheritanceRelationshipEntityId], [d0].[Id] """, // """ -SELECT [o1].[BaseInheritanceRelationshipEntityId], [o1].[Id], [o1].[Name], [c].[Id], [u].[Id], [o0].[BaseInheritanceRelationshipEntityId], [d1].[Id] +SELECT [o1].[BaseInheritanceRelationshipEntityId], [o1].[Id], [o1].[Name], [c].[Id], [o0].[BaseInheritanceRelationshipEntityId], [d1].[Id] FROM [CollectionsOnBase] AS [c] LEFT JOIN ( SELECT [b].[Id] @@ -1759,11 +1759,11 @@ FROM [DerivedEntities] AS [d] LEFT JOIN [DerivedEntities] AS [d1] ON [u].[Id] = [d1].[Id] INNER JOIN [OwnedCollections] AS [o1] ON [u].[Id] = [o1].[BaseInheritanceRelationshipEntityId] WHERE [c].[Name] <> N'Bar' OR [c].[Name] IS NULL -ORDER BY [c].[Id], [u].[Id], [o0].[BaseInheritanceRelationshipEntityId], [d1].[Id] +ORDER BY [c].[Id], [o0].[BaseInheritanceRelationshipEntityId], [d1].[Id] """, // """ -SELECT [d2].[DerivedInheritanceRelationshipEntityId], [d2].[Id], [d2].[Name], [c].[Id], [u].[Id], [o0].[BaseInheritanceRelationshipEntityId], [d1].[Id] +SELECT [d2].[DerivedInheritanceRelationshipEntityId], [d2].[Id], [d2].[Name], [c].[Id], [o0].[BaseInheritanceRelationshipEntityId], [d1].[Id] FROM [CollectionsOnBase] AS [c] LEFT JOIN ( SELECT [b].[Id] @@ -1776,7 +1776,7 @@ FROM [DerivedEntities] AS [d] LEFT JOIN [DerivedEntities] AS [d1] ON [u].[Id] = [d1].[Id] INNER JOIN [DerivedEntities_OwnedCollectionOnDerived] AS [d2] ON [u].[Id] = [d2].[DerivedInheritanceRelationshipEntityId] WHERE [c].[Name] <> N'Bar' OR [c].[Name] IS NULL -ORDER BY [c].[Id], [u].[Id], [o0].[BaseInheritanceRelationshipEntityId], [d1].[Id] +ORDER BY [c].[Id], [o0].[BaseInheritanceRelationshipEntityId], [d1].[Id] """); } @@ -1918,11 +1918,11 @@ FROM [DerivedCollectionsOnDerived] AS [d] ) AS [u] LEFT JOIN [DerivedEntities] AS [d0] ON [u].[ParentId] = [d0].[Id] LEFT JOIN [OwnedReferences] AS [o] ON [d0].[Id] = [o].[BaseInheritanceRelationshipEntityId] -ORDER BY [u].[Id], [d0].[Id], [o].[BaseInheritanceRelationshipEntityId] +ORDER BY [u].[Id], [o].[BaseInheritanceRelationshipEntityId] """, // """ -SELECT [o1].[BaseInheritanceRelationshipEntityId], [o1].[Id], [o1].[Name], [u].[Id], [d0].[Id], [o0].[BaseInheritanceRelationshipEntityId] +SELECT [o1].[BaseInheritanceRelationshipEntityId], [o1].[Id], [o1].[Name], [u].[Id], [o0].[BaseInheritanceRelationshipEntityId] FROM ( SELECT [b].[Id], [b].[ParentId] FROM [BaseCollectionsOnDerived] AS [b] @@ -1933,11 +1933,11 @@ FROM [DerivedCollectionsOnDerived] AS [d] LEFT JOIN [DerivedEntities] AS [d0] ON [u].[ParentId] = [d0].[Id] LEFT JOIN [OwnedReferences] AS [o0] ON [d0].[Id] = [o0].[BaseInheritanceRelationshipEntityId] INNER JOIN [OwnedCollections] AS [o1] ON [d0].[Id] = [o1].[BaseInheritanceRelationshipEntityId] -ORDER BY [u].[Id], [d0].[Id], [o0].[BaseInheritanceRelationshipEntityId] +ORDER BY [u].[Id], [o0].[BaseInheritanceRelationshipEntityId] """, // """ -SELECT [d2].[DerivedInheritanceRelationshipEntityId], [d2].[Id], [d2].[Name], [u].[Id], [d0].[Id], [o0].[BaseInheritanceRelationshipEntityId] +SELECT [d2].[DerivedInheritanceRelationshipEntityId], [d2].[Id], [d2].[Name], [u].[Id], [o0].[BaseInheritanceRelationshipEntityId] FROM ( SELECT [b].[Id], [b].[ParentId] FROM [BaseCollectionsOnDerived] AS [b] @@ -1948,7 +1948,7 @@ FROM [DerivedCollectionsOnDerived] AS [d] LEFT JOIN [DerivedEntities] AS [d0] ON [u].[ParentId] = [d0].[Id] LEFT JOIN [OwnedReferences] AS [o0] ON [d0].[Id] = [o0].[BaseInheritanceRelationshipEntityId] INNER JOIN [DerivedEntities_OwnedCollectionOnDerived] AS [d2] ON [d0].[Id] = [d2].[DerivedInheritanceRelationshipEntityId] -ORDER BY [u].[Id], [d0].[Id], [o0].[BaseInheritanceRelationshipEntityId] +ORDER BY [u].[Id], [o0].[BaseInheritanceRelationshipEntityId] """); } @@ -1958,7 +1958,7 @@ public override async Task Nested_include_with_inheritance_reference_collection_ AssertSql( """ -SELECT [u].[Id], [u].[Name], [u].[BaseId], [u].[Discriminator], [u0].[Id], [o].[BaseInheritanceRelationshipEntityId], [d1].[Id], [o].[Id], [o].[Name], [d1].[OwnedReferenceOnDerived_Id], [d1].[OwnedReferenceOnDerived_Name], [u0].[BaseParentId], [u0].[Name], [u0].[Discriminator] +SELECT [u].[Id], [u].[Name], [u].[BaseId], [u].[Discriminator], [o].[BaseInheritanceRelationshipEntityId], [d1].[Id], [o].[Id], [o].[Name], [d1].[OwnedReferenceOnDerived_Id], [d1].[OwnedReferenceOnDerived_Name], [u0].[Id], [u0].[BaseParentId], [u0].[Name], [u0].[Discriminator] FROM ( SELECT [b].[Id], [b].[Name], NULL AS [BaseId], N'BaseInheritanceRelationshipEntity' AS [Discriminator] FROM [BaseEntities] AS [b] @@ -1975,11 +1975,11 @@ FROM [DerivedReferencesOnBase] AS [d0] ) AS [u0] ON [u].[Id] = [u0].[BaseParentId] LEFT JOIN [OwnedReferences] AS [o] ON [u].[Id] = [o].[BaseInheritanceRelationshipEntityId] LEFT JOIN [DerivedEntities] AS [d1] ON [u].[Id] = [d1].[Id] -ORDER BY [u].[Id], [u0].[Id], [o].[BaseInheritanceRelationshipEntityId], [d1].[Id] +ORDER BY [u].[Id], [o].[BaseInheritanceRelationshipEntityId], [d1].[Id] """, // """ -SELECT [o1].[BaseInheritanceRelationshipEntityId], [o1].[Id], [o1].[Name], [u].[Id], [u0].[Id], [o0].[BaseInheritanceRelationshipEntityId], [d2].[Id] +SELECT [o1].[BaseInheritanceRelationshipEntityId], [o1].[Id], [o1].[Name], [u].[Id], [o0].[BaseInheritanceRelationshipEntityId], [d2].[Id] FROM ( SELECT [b].[Id] FROM [BaseEntities] AS [b] @@ -1987,21 +1987,14 @@ UNION ALL SELECT [d].[Id] FROM [DerivedEntities] AS [d] ) AS [u] -LEFT JOIN ( - SELECT [b0].[Id], [b0].[BaseParentId] - FROM [BaseReferencesOnBase] AS [b0] - UNION ALL - SELECT [d0].[Id], [d0].[BaseParentId] - FROM [DerivedReferencesOnBase] AS [d0] -) AS [u0] ON [u].[Id] = [u0].[BaseParentId] LEFT JOIN [OwnedReferences] AS [o0] ON [u].[Id] = [o0].[BaseInheritanceRelationshipEntityId] LEFT JOIN [DerivedEntities] AS [d2] ON [u].[Id] = [d2].[Id] INNER JOIN [OwnedCollections] AS [o1] ON [u].[Id] = [o1].[BaseInheritanceRelationshipEntityId] -ORDER BY [u].[Id], [u0].[Id], [o0].[BaseInheritanceRelationshipEntityId], [d2].[Id] +ORDER BY [u].[Id], [o0].[BaseInheritanceRelationshipEntityId], [d2].[Id] """, // """ -SELECT [d3].[DerivedInheritanceRelationshipEntityId], [d3].[Id], [d3].[Name], [u].[Id], [u0].[Id], [o0].[BaseInheritanceRelationshipEntityId], [d2].[Id] +SELECT [d3].[DerivedInheritanceRelationshipEntityId], [d3].[Id], [d3].[Name], [u].[Id], [o0].[BaseInheritanceRelationshipEntityId], [d2].[Id] FROM ( SELECT [b].[Id] FROM [BaseEntities] AS [b] @@ -2009,21 +2002,14 @@ UNION ALL SELECT [d].[Id] FROM [DerivedEntities] AS [d] ) AS [u] -LEFT JOIN ( - SELECT [b0].[Id], [b0].[BaseParentId] - FROM [BaseReferencesOnBase] AS [b0] - UNION ALL - SELECT [d0].[Id], [d0].[BaseParentId] - FROM [DerivedReferencesOnBase] AS [d0] -) AS [u0] ON [u].[Id] = [u0].[BaseParentId] LEFT JOIN [OwnedReferences] AS [o0] ON [u].[Id] = [o0].[BaseInheritanceRelationshipEntityId] LEFT JOIN [DerivedEntities] AS [d2] ON [u].[Id] = [d2].[Id] INNER JOIN [DerivedEntities_OwnedCollectionOnDerived] AS [d3] ON [u].[Id] = [d3].[DerivedInheritanceRelationshipEntityId] -ORDER BY [u].[Id], [u0].[Id], [o0].[BaseInheritanceRelationshipEntityId], [d2].[Id] +ORDER BY [u].[Id], [o0].[BaseInheritanceRelationshipEntityId], [d2].[Id] """, // """ -SELECT [u1].[Id], [u1].[Name], [u1].[ParentCollectionId], [u1].[ParentReferenceId], [u1].[Discriminator], [u].[Id], [u0].[Id], [o0].[BaseInheritanceRelationshipEntityId], [d2].[Id] +SELECT [u1].[Id], [u1].[Name], [u1].[ParentCollectionId], [u1].[ParentReferenceId], [u1].[Discriminator], [u].[Id], [o0].[BaseInheritanceRelationshipEntityId], [d2].[Id] FROM ( SELECT [b].[Id] FROM [BaseEntities] AS [b] @@ -2047,7 +2033,7 @@ UNION ALL SELECT [n0].[Id], [n0].[Name], [n0].[ParentCollectionId], [n0].[ParentReferenceId], N'NestedCollectionDerived' AS [Discriminator] FROM [NestedCollectionsDerived] AS [n0] ) AS [u1] ON [u0].[Id] = [u1].[ParentReferenceId] -ORDER BY [u].[Id], [u0].[Id], [o0].[BaseInheritanceRelationshipEntityId], [d2].[Id] +ORDER BY [u].[Id], [o0].[BaseInheritanceRelationshipEntityId], [d2].[Id] """); } @@ -2057,7 +2043,7 @@ public override async Task Nested_include_with_inheritance_reference_collection_ AssertSql( """ -SELECT [d].[Id], [d].[Name], [d].[BaseId], [u].[Id], [o].[BaseInheritanceRelationshipEntityId], [o].[Id], [o].[Name], [d].[Id], [d].[OwnedReferenceOnDerived_Id], [d].[OwnedReferenceOnDerived_Name], [u].[BaseParentId], [u].[Name], [u].[Discriminator] +SELECT [d].[Id], [d].[Name], [d].[BaseId], [o].[BaseInheritanceRelationshipEntityId], [o].[Id], [o].[Name], [d].[Id], [d].[OwnedReferenceOnDerived_Id], [d].[OwnedReferenceOnDerived_Name], [u].[Id], [u].[BaseParentId], [u].[Name], [u].[Discriminator] FROM [DerivedEntities] AS [d] LEFT JOIN ( SELECT [b].[Id], [b].[BaseParentId], [b].[Name], N'BaseReferenceOnBase' AS [Discriminator] @@ -2067,41 +2053,27 @@ UNION ALL FROM [DerivedReferencesOnBase] AS [d0] ) AS [u] ON [d].[Id] = [u].[BaseParentId] LEFT JOIN [OwnedReferences] AS [o] ON [d].[Id] = [o].[BaseInheritanceRelationshipEntityId] -ORDER BY [d].[Id], [u].[Id], [o].[BaseInheritanceRelationshipEntityId] +ORDER BY [d].[Id], [o].[BaseInheritanceRelationshipEntityId] """, // """ -SELECT [o1].[BaseInheritanceRelationshipEntityId], [o1].[Id], [o1].[Name], [d].[Id], [u].[Id], [o0].[BaseInheritanceRelationshipEntityId] +SELECT [o1].[BaseInheritanceRelationshipEntityId], [o1].[Id], [o1].[Name], [d].[Id], [o0].[BaseInheritanceRelationshipEntityId] FROM [DerivedEntities] AS [d] -LEFT JOIN ( - SELECT [b].[Id], [b].[BaseParentId] - FROM [BaseReferencesOnBase] AS [b] - UNION ALL - SELECT [d0].[Id], [d0].[BaseParentId] - FROM [DerivedReferencesOnBase] AS [d0] -) AS [u] ON [d].[Id] = [u].[BaseParentId] LEFT JOIN [OwnedReferences] AS [o0] ON [d].[Id] = [o0].[BaseInheritanceRelationshipEntityId] INNER JOIN [OwnedCollections] AS [o1] ON [d].[Id] = [o1].[BaseInheritanceRelationshipEntityId] -ORDER BY [d].[Id], [u].[Id], [o0].[BaseInheritanceRelationshipEntityId] +ORDER BY [d].[Id], [o0].[BaseInheritanceRelationshipEntityId] """, // """ -SELECT [d2].[DerivedInheritanceRelationshipEntityId], [d2].[Id], [d2].[Name], [d].[Id], [u].[Id], [o0].[BaseInheritanceRelationshipEntityId] +SELECT [d2].[DerivedInheritanceRelationshipEntityId], [d2].[Id], [d2].[Name], [d].[Id], [o0].[BaseInheritanceRelationshipEntityId] FROM [DerivedEntities] AS [d] -LEFT JOIN ( - SELECT [b].[Id], [b].[BaseParentId] - FROM [BaseReferencesOnBase] AS [b] - UNION ALL - SELECT [d0].[Id], [d0].[BaseParentId] - FROM [DerivedReferencesOnBase] AS [d0] -) AS [u] ON [d].[Id] = [u].[BaseParentId] LEFT JOIN [OwnedReferences] AS [o0] ON [d].[Id] = [o0].[BaseInheritanceRelationshipEntityId] INNER JOIN [DerivedEntities_OwnedCollectionOnDerived] AS [d2] ON [d].[Id] = [d2].[DerivedInheritanceRelationshipEntityId] -ORDER BY [d].[Id], [u].[Id], [o0].[BaseInheritanceRelationshipEntityId] +ORDER BY [d].[Id], [o0].[BaseInheritanceRelationshipEntityId] """, // """ -SELECT [u0].[Id], [u0].[Name], [u0].[ParentCollectionId], [u0].[ParentReferenceId], [u0].[Discriminator], [d].[Id], [u].[Id], [o0].[BaseInheritanceRelationshipEntityId] +SELECT [u0].[Id], [u0].[Name], [u0].[ParentCollectionId], [u0].[ParentReferenceId], [u0].[Discriminator], [d].[Id], [o0].[BaseInheritanceRelationshipEntityId] FROM [DerivedEntities] AS [d] LEFT JOIN ( SELECT [b].[Id], [b].[BaseParentId] @@ -2118,7 +2090,7 @@ UNION ALL SELECT [n0].[Id], [n0].[Name], [n0].[ParentCollectionId], [n0].[ParentReferenceId], N'NestedCollectionDerived' AS [Discriminator] FROM [NestedCollectionsDerived] AS [n0] ) AS [u0] ON [u].[Id] = [u0].[ParentReferenceId] -ORDER BY [d].[Id], [u].[Id], [o0].[BaseInheritanceRelationshipEntityId] +ORDER BY [d].[Id], [o0].[BaseInheritanceRelationshipEntityId] """); } @@ -2152,11 +2124,11 @@ FROM [DerivedEntities] AS [d0] ) AS [u1] ON [u0].[BaseParentId] = [u1].[Id] LEFT JOIN [OwnedReferences] AS [o] ON [u1].[Id] = [o].[BaseInheritanceRelationshipEntityId] LEFT JOIN [DerivedEntities] AS [d1] ON [u1].[Id] = [d1].[Id] -ORDER BY [u].[Id], [u0].[Id], [u1].[Id], [o].[BaseInheritanceRelationshipEntityId], [d1].[Id] +ORDER BY [u].[Id], [o].[BaseInheritanceRelationshipEntityId], [d1].[Id] """, // """ -SELECT [o1].[BaseInheritanceRelationshipEntityId], [o1].[Id], [o1].[Name], [u].[Id], [u0].[Id], [u1].[Id], [o0].[BaseInheritanceRelationshipEntityId], [d2].[Id] +SELECT [o1].[BaseInheritanceRelationshipEntityId], [o1].[Id], [o1].[Name], [u].[Id], [o0].[BaseInheritanceRelationshipEntityId], [d2].[Id] FROM ( SELECT [n].[Id], [n].[ParentReferenceId] FROM [NestedCollections] AS [n] @@ -2181,11 +2153,11 @@ FROM [DerivedEntities] AS [d0] LEFT JOIN [OwnedReferences] AS [o0] ON [u1].[Id] = [o0].[BaseInheritanceRelationshipEntityId] LEFT JOIN [DerivedEntities] AS [d2] ON [u1].[Id] = [d2].[Id] INNER JOIN [OwnedCollections] AS [o1] ON [u1].[Id] = [o1].[BaseInheritanceRelationshipEntityId] -ORDER BY [u].[Id], [u0].[Id], [u1].[Id], [o0].[BaseInheritanceRelationshipEntityId], [d2].[Id] +ORDER BY [u].[Id], [o0].[BaseInheritanceRelationshipEntityId], [d2].[Id] """, // """ -SELECT [d3].[DerivedInheritanceRelationshipEntityId], [d3].[Id], [d3].[Name], [u].[Id], [u0].[Id], [u1].[Id], [o0].[BaseInheritanceRelationshipEntityId], [d2].[Id] +SELECT [d3].[DerivedInheritanceRelationshipEntityId], [d3].[Id], [d3].[Name], [u].[Id], [o0].[BaseInheritanceRelationshipEntityId], [d2].[Id] FROM ( SELECT [n].[Id], [n].[ParentReferenceId] FROM [NestedCollections] AS [n] @@ -2210,7 +2182,7 @@ FROM [DerivedEntities] AS [d0] LEFT JOIN [OwnedReferences] AS [o0] ON [u1].[Id] = [o0].[BaseInheritanceRelationshipEntityId] LEFT JOIN [DerivedEntities] AS [d2] ON [u1].[Id] = [d2].[Id] INNER JOIN [DerivedEntities_OwnedCollectionOnDerived] AS [d3] ON [u1].[Id] = [d3].[DerivedInheritanceRelationshipEntityId] -ORDER BY [u].[Id], [u0].[Id], [u1].[Id], [o0].[BaseInheritanceRelationshipEntityId], [d2].[Id] +ORDER BY [u].[Id], [o0].[BaseInheritanceRelationshipEntityId], [d2].[Id] """); } @@ -2325,11 +2297,11 @@ FROM [DerivedEntities] AS [d0] ) AS [u1] ON [u0].[BaseParentId] = [u1].[Id] LEFT JOIN [OwnedReferences] AS [o] ON [u1].[Id] = [o].[BaseInheritanceRelationshipEntityId] LEFT JOIN [DerivedEntities] AS [d1] ON [u1].[Id] = [d1].[Id] -ORDER BY [u].[Id], [u0].[Id], [u1].[Id], [o].[BaseInheritanceRelationshipEntityId], [d1].[Id] +ORDER BY [u].[Id], [o].[BaseInheritanceRelationshipEntityId], [d1].[Id] """, // """ -SELECT [o1].[BaseInheritanceRelationshipEntityId], [o1].[Id], [o1].[Name], [u].[Id], [u0].[Id], [u1].[Id], [o0].[BaseInheritanceRelationshipEntityId], [d2].[Id] +SELECT [o1].[BaseInheritanceRelationshipEntityId], [o1].[Id], [o1].[Name], [u].[Id], [o0].[BaseInheritanceRelationshipEntityId], [d2].[Id] FROM ( SELECT [n].[Id], [n].[ParentCollectionId] FROM [NestedReferences] AS [n] @@ -2354,11 +2326,11 @@ FROM [DerivedEntities] AS [d0] LEFT JOIN [OwnedReferences] AS [o0] ON [u1].[Id] = [o0].[BaseInheritanceRelationshipEntityId] LEFT JOIN [DerivedEntities] AS [d2] ON [u1].[Id] = [d2].[Id] INNER JOIN [OwnedCollections] AS [o1] ON [u1].[Id] = [o1].[BaseInheritanceRelationshipEntityId] -ORDER BY [u].[Id], [u0].[Id], [u1].[Id], [o0].[BaseInheritanceRelationshipEntityId], [d2].[Id] +ORDER BY [u].[Id], [o0].[BaseInheritanceRelationshipEntityId], [d2].[Id] """, // """ -SELECT [d3].[DerivedInheritanceRelationshipEntityId], [d3].[Id], [d3].[Name], [u].[Id], [u0].[Id], [u1].[Id], [o0].[BaseInheritanceRelationshipEntityId], [d2].[Id] +SELECT [d3].[DerivedInheritanceRelationshipEntityId], [d3].[Id], [d3].[Name], [u].[Id], [o0].[BaseInheritanceRelationshipEntityId], [d2].[Id] FROM ( SELECT [n].[Id], [n].[ParentCollectionId] FROM [NestedReferences] AS [n] @@ -2383,7 +2355,7 @@ FROM [DerivedEntities] AS [d0] LEFT JOIN [OwnedReferences] AS [o0] ON [u1].[Id] = [o0].[BaseInheritanceRelationshipEntityId] LEFT JOIN [DerivedEntities] AS [d2] ON [u1].[Id] = [d2].[Id] INNER JOIN [DerivedEntities_OwnedCollectionOnDerived] AS [d3] ON [u1].[Id] = [d3].[DerivedInheritanceRelationshipEntityId] -ORDER BY [u].[Id], [u0].[Id], [u1].[Id], [o0].[BaseInheritanceRelationshipEntityId], [d2].[Id] +ORDER BY [u].[Id], [o0].[BaseInheritanceRelationshipEntityId], [d2].[Id] """); } @@ -2516,11 +2488,11 @@ FROM [DerivedEntities] AS [d0] ) AS [u1] ON [u0].[BaseParentId] = [u1].[Id] LEFT JOIN [OwnedReferences] AS [o] ON [u1].[Id] = [o].[BaseInheritanceRelationshipEntityId] LEFT JOIN [DerivedEntities] AS [d1] ON [u1].[Id] = [d1].[Id] -ORDER BY [u].[Id], [u0].[Id], [u1].[Id], [o].[BaseInheritanceRelationshipEntityId], [d1].[Id] +ORDER BY [u].[Id], [o].[BaseInheritanceRelationshipEntityId], [d1].[Id] """, // """ -SELECT [o1].[BaseInheritanceRelationshipEntityId], [o1].[Id], [o1].[Name], [u].[Id], [u0].[Id], [u1].[Id], [o0].[BaseInheritanceRelationshipEntityId], [d2].[Id] +SELECT [o1].[BaseInheritanceRelationshipEntityId], [o1].[Id], [o1].[Name], [u].[Id], [o0].[BaseInheritanceRelationshipEntityId], [d2].[Id] FROM ( SELECT [n].[Id], [n].[ParentCollectionId] FROM [NestedCollections] AS [n] @@ -2545,11 +2517,11 @@ FROM [DerivedEntities] AS [d0] LEFT JOIN [OwnedReferences] AS [o0] ON [u1].[Id] = [o0].[BaseInheritanceRelationshipEntityId] LEFT JOIN [DerivedEntities] AS [d2] ON [u1].[Id] = [d2].[Id] INNER JOIN [OwnedCollections] AS [o1] ON [u1].[Id] = [o1].[BaseInheritanceRelationshipEntityId] -ORDER BY [u].[Id], [u0].[Id], [u1].[Id], [o0].[BaseInheritanceRelationshipEntityId], [d2].[Id] +ORDER BY [u].[Id], [o0].[BaseInheritanceRelationshipEntityId], [d2].[Id] """, // """ -SELECT [d3].[DerivedInheritanceRelationshipEntityId], [d3].[Id], [d3].[Name], [u].[Id], [u0].[Id], [u1].[Id], [o0].[BaseInheritanceRelationshipEntityId], [d2].[Id] +SELECT [d3].[DerivedInheritanceRelationshipEntityId], [d3].[Id], [d3].[Name], [u].[Id], [o0].[BaseInheritanceRelationshipEntityId], [d2].[Id] FROM ( SELECT [n].[Id], [n].[ParentCollectionId] FROM [NestedCollections] AS [n] @@ -2574,7 +2546,7 @@ FROM [DerivedEntities] AS [d0] LEFT JOIN [OwnedReferences] AS [o0] ON [u1].[Id] = [o0].[BaseInheritanceRelationshipEntityId] LEFT JOIN [DerivedEntities] AS [d2] ON [u1].[Id] = [d2].[Id] INNER JOIN [DerivedEntities_OwnedCollectionOnDerived] AS [d3] ON [u1].[Id] = [d3].[DerivedInheritanceRelationshipEntityId] -ORDER BY [u].[Id], [u0].[Id], [u1].[Id], [o0].[BaseInheritanceRelationshipEntityId], [d2].[Id] +ORDER BY [u].[Id], [o0].[BaseInheritanceRelationshipEntityId], [d2].[Id] """); } diff --git a/test/EFCore.SqlServer.FunctionalTests/Query/Inheritance/TPTGearsOfWarQuerySqlServerTest.cs b/test/EFCore.SqlServer.FunctionalTests/Query/Inheritance/TPTGearsOfWarQuerySqlServerTest.cs index 701b86327e1..8ad0f930981 100644 --- a/test/EFCore.SqlServer.FunctionalTests/Query/Inheritance/TPTGearsOfWarQuerySqlServerTest.cs +++ b/test/EFCore.SqlServer.FunctionalTests/Query/Inheritance/TPTGearsOfWarQuerySqlServerTest.cs @@ -62,7 +62,7 @@ FROM [Gears] AS [g] LEFT JOIN [Officers] AS [o] ON [g].[Nickname] = [o].[Nickname] AND [g].[SquadId] = [o].[SquadId] ) AS [s] ON [t].[GearNickName] = [s].[Nickname] AND [t].[GearSquadId] = [s].[SquadId] LEFT JOIN [Weapons] AS [w] ON [s].[FullName] = [w].[OwnerFullName] -ORDER BY [t].[Id], [s].[Nickname], [s].[SquadId] +ORDER BY [t].[Id] """); } @@ -104,7 +104,7 @@ END AS [Discriminator] FROM [Gears] AS [g0] LEFT JOIN [Officers] AS [o0] ON [g0].[Nickname] = [o0].[Nickname] AND [g0].[SquadId] = [o0].[SquadId] ) AS [s] ON [c].[Name] = [s].[AssignedCityName] -ORDER BY [g].[Nickname], [g].[SquadId], [c].[Name], [s].[Nickname] +ORDER BY [g].[Nickname], [g].[SquadId], [s].[Nickname] """); } @@ -128,7 +128,7 @@ FROM [Gears] AS [g0] LEFT JOIN [Officers] AS [o0] ON [g0].[Nickname] = [o0].[Nickname] AND [g0].[SquadId] = [o0].[SquadId] ) AS [s] ON [c].[Name] = [s].[AssignedCityName] WHERE [g].[Nickname] = N'Marcus' -ORDER BY [g].[Nickname], [g].[SquadId], [c].[Name], [s].[Nickname] +ORDER BY [g].[Nickname], [g].[SquadId], [s].[Nickname] """); } @@ -403,7 +403,7 @@ END AS [Discriminator] FROM [Gears] AS [g0] LEFT JOIN [Officers] AS [o0] ON [g0].[Nickname] = [o0].[Nickname] AND [g0].[SquadId] = [o0].[SquadId] ) AS [s] ON [c].[Name] = [s].[AssignedCityName] -ORDER BY [g].[Nickname], [g].[SquadId], [t].[Id], [c].[Name], [s].[Nickname] +ORDER BY [g].[Nickname], [g].[SquadId], [t].[Id], [s].[Nickname] """); } @@ -1705,11 +1705,6 @@ FROM [Gears] AS [g] WHERE [g].[HasSoulPatch] = CAST(1 AS bit) AND ( SELECT TOP(1) [w].[IsAutomatic] FROM [Weapons] AS [w] - LEFT JOIN ( - SELECT [w0].[Id] - FROM [Weapons] AS [w0] - WHERE [g].[FullName] = [w0].[OwnerFullName] - ) AS [w1] ON [w].[Id] = [w1].[Id] WHERE [g].[FullName] = [w].[OwnerFullName] ORDER BY [w].[Id]) = CAST(1 AS bit) """); @@ -2691,7 +2686,7 @@ public override async Task Select_correlated_filtered_collection(bool async) AssertSql( """ -SELECT [g].[Nickname], [g].[SquadId], [c].[Name], [w0].[Id], [w0].[AmmunitionType], [w0].[IsAutomatic], [w0].[Name], [w0].[OwnerFullName], [w0].[SynergyWithId] +SELECT [g].[Nickname], [g].[SquadId], [w0].[Id], [w0].[AmmunitionType], [w0].[IsAutomatic], [w0].[Name], [w0].[OwnerFullName], [w0].[SynergyWithId] FROM [Gears] AS [g] INNER JOIN [Cities] AS [c] ON [g].[CityOfBirthName] = [c].[Name] LEFT JOIN ( @@ -2700,7 +2695,7 @@ FROM [Weapons] AS [w] WHERE [w].[Name] <> N'Lancer' OR [w].[Name] IS NULL ) AS [w0] ON [g].[FullName] = [w0].[OwnerFullName] WHERE [c].[Name] IN (N'Ephyra', N'Hanover') -ORDER BY [g].[Nickname], [g].[SquadId], [c].[Name] +ORDER BY [g].[Nickname], [g].[SquadId] """); } @@ -3434,7 +3429,7 @@ FROM [LocustLeaders] AS [l2] LEFT JOIN [LocustCommanders] AS [l3] ON [l2].[Name] = [l3].[Name] ) AS [s0] ON [f].[Id] = [s0].[LocustHordeId] WHERE [l].[Id] IS NOT NULL -ORDER BY [f].[Name], [f].[Id], [s].[Name] +ORDER BY [f].[Name], [f].[Id] """); } @@ -3607,7 +3602,7 @@ public override async Task Project_collection_navigation_with_inheritance1(bool AssertSql( """ -SELECT [f].[Id], [s].[Name], [s0].[Id], [s1].[Name], [s1].[LocustHordeId], [s1].[ThreatLevel], [s1].[ThreatLevelByte], [s1].[ThreatLevelNullableByte], [s1].[DefeatedByNickname], [s1].[DefeatedBySquadId], [s1].[HighCommandId], [s1].[Discriminator] +SELECT [f].[Id], [s1].[Name], [s1].[LocustHordeId], [s1].[ThreatLevel], [s1].[ThreatLevelByte], [s1].[ThreatLevelNullableByte], [s1].[DefeatedByNickname], [s1].[DefeatedBySquadId], [s1].[HighCommandId], [s1].[Discriminator] FROM [Factions] AS [f] LEFT JOIN [LocustHordes] AS [l] ON [f].[Id] = [l].[Id] LEFT JOIN ( @@ -3628,7 +3623,7 @@ FROM [LocustLeaders] AS [l3] LEFT JOIN [LocustCommanders] AS [l4] ON [l3].[Name] = [l4].[Name] ) AS [s1] ON [s0].[Id] = [s1].[LocustHordeId] WHERE [l].[Id] IS NOT NULL -ORDER BY [f].[Id], [s].[Name], [s0].[Id] +ORDER BY [f].[Id] """); } @@ -3638,7 +3633,7 @@ public override async Task Project_collection_navigation_with_inheritance2(bool AssertSql( """ -SELECT [f].[Id], [s].[Name], [s0].[Nickname], [s0].[SquadId], [s1].[Nickname], [s1].[SquadId], [s1].[AssignedCityName], [s1].[CityOfBirthName], [s1].[FullName], [s1].[HasSoulPatch], [s1].[LeaderNickname], [s1].[LeaderSquadId], [s1].[Rank], [s1].[Discriminator] +SELECT [f].[Id], [s1].[Nickname], [s1].[SquadId], [s1].[AssignedCityName], [s1].[CityOfBirthName], [s1].[FullName], [s1].[HasSoulPatch], [s1].[LeaderNickname], [s1].[LeaderSquadId], [s1].[Rank], [s1].[Discriminator] FROM [Factions] AS [f] LEFT JOIN [LocustHordes] AS [l] ON [f].[Id] = [l].[Id] LEFT JOIN ( @@ -3658,7 +3653,7 @@ FROM [Gears] AS [g0] LEFT JOIN [Officers] AS [o] ON [g0].[Nickname] = [o].[Nickname] AND [g0].[SquadId] = [o].[SquadId] ) AS [s1] ON ([s0].[Nickname] = [s1].[LeaderNickname] OR ([s0].[Nickname] IS NULL AND [s1].[LeaderNickname] IS NULL)) AND [s0].[SquadId] = [s1].[LeaderSquadId] WHERE [l].[Id] IS NOT NULL -ORDER BY [f].[Id], [s].[Name], [s0].[Nickname], [s0].[SquadId], [s1].[Nickname] +ORDER BY [f].[Id], [s1].[Nickname] """); } @@ -3668,7 +3663,7 @@ public override async Task Project_collection_navigation_with_inheritance3(bool AssertSql( """ -SELECT [f].[Id], [s].[Name], [s0].[Nickname], [s0].[SquadId], [s1].[Nickname], [s1].[SquadId], [s1].[AssignedCityName], [s1].[CityOfBirthName], [s1].[FullName], [s1].[HasSoulPatch], [s1].[LeaderNickname], [s1].[LeaderSquadId], [s1].[Rank], [s1].[Discriminator] +SELECT [f].[Id], [s1].[Nickname], [s1].[SquadId], [s1].[AssignedCityName], [s1].[CityOfBirthName], [s1].[FullName], [s1].[HasSoulPatch], [s1].[LeaderNickname], [s1].[LeaderSquadId], [s1].[Rank], [s1].[Discriminator] FROM [Factions] AS [f] LEFT JOIN [LocustHordes] AS [l] ON [f].[Id] = [l].[Id] LEFT JOIN ( @@ -3688,7 +3683,7 @@ FROM [Gears] AS [g0] LEFT JOIN [Officers] AS [o] ON [g0].[Nickname] = [o].[Nickname] AND [g0].[SquadId] = [o].[SquadId] ) AS [s1] ON ([s0].[Nickname] = [s1].[LeaderNickname] OR ([s0].[Nickname] IS NULL AND [s1].[LeaderNickname] IS NULL)) AND [s0].[SquadId] = [s1].[LeaderSquadId] WHERE [l].[Id] IS NOT NULL -ORDER BY [f].[Id], [s].[Name], [s0].[Nickname], [s0].[SquadId], [s1].[Nickname] +ORDER BY [f].[Id], [s1].[Nickname] """); } @@ -3761,7 +3756,7 @@ 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 [s0] ON ([s].[Nickname] = [s0].[LeaderNickname] OR ([s].[Nickname] IS NULL AND [s0].[LeaderNickname] IS NULL)) AND [s].[SquadId] = [s0].[LeaderSquadId] -ORDER BY [l].[Name], [s].[Nickname], [s].[SquadId], [s0].[Nickname], [s0].[SquadId] +ORDER BY [l].[Name], [s0].[Nickname] """); } @@ -3907,7 +3902,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 [Weapons] AS [w] ON [g].[FullName] = [w].[OwnerFullName] -ORDER BY [g].[Nickname], [g].[SquadId], [t].[Id] +ORDER BY [g].[Nickname], [g].[SquadId] """); } @@ -3927,7 +3922,7 @@ FROM [Gears] AS [g] LEFT JOIN [Officers] AS [o] ON [g].[Nickname] = [o].[Nickname] AND [g].[SquadId] = [o].[SquadId] ) AS [s] ON [t].[GearNickName] = [s].[Nickname] AND [t].[GearSquadId] = [s].[SquadId] LEFT JOIN [Weapons] AS [w] ON [s].[FullName] = [w].[OwnerFullName] -ORDER BY [t].[Id], [s].[Nickname], [s].[SquadId] +ORDER BY [t].[Id] """); } @@ -3961,7 +3956,7 @@ END AS [Discriminator] FROM [Gears] AS [g0] LEFT JOIN [Officers] AS [o0] ON [g0].[Nickname] = [o0].[Nickname] AND [g0].[SquadId] = [o0].[SquadId] ) AS [s1] ON ([s0].[Nickname] = [s1].[LeaderNickname] OR ([s0].[Nickname] IS NULL AND [s1].[LeaderNickname] IS NULL)) AND [s0].[SquadId] = [s1].[LeaderSquadId] -ORDER BY [f].[Id], [s].[Name], [s0].[Nickname], [s0].[SquadId], [s1].[Nickname] +ORDER BY [f].[Id], [s1].[Nickname] """); } @@ -4019,7 +4014,7 @@ FROM [Gears] AS [g] LEFT JOIN [Officers] AS [o] ON [g].[Nickname] = [o].[Nickname] AND [g].[SquadId] = [o].[SquadId] ) AS [s] ON [l1].[DefeatedByNickname] = [s].[Nickname] AND [l1].[DefeatedBySquadId] = [s].[SquadId] ) AS [s0] ON [f].[Id] = [s0].[LocustHordeId] -ORDER BY [f].[Id], [s0].[Name], [s0].[Nickname] +ORDER BY [f].[Id] """); } @@ -4053,7 +4048,7 @@ END AS [Discriminator] FROM [Gears] AS [g0] LEFT JOIN [Officers] AS [o0] ON [g0].[Nickname] = [o0].[Nickname] AND [g0].[SquadId] = [o0].[SquadId] ) AS [s1] ON ([s0].[Nickname] = [s1].[LeaderNickname] OR ([s0].[Nickname] IS NULL AND [s1].[LeaderNickname] IS NULL)) AND [s0].[SquadId] = [s1].[LeaderSquadId] -ORDER BY [f].[Id], [s].[Name], [s0].[Nickname], [s0].[SquadId], [s1].[Nickname] +ORDER BY [f].[Id], [s1].[Nickname] """); } @@ -4077,7 +4072,7 @@ FROM [Gears] AS [g0] INNER JOIN [Squads] AS [s] ON [g0].[SquadId] = [s].[Id] LEFT JOIN [SquadMissions] AS [s0] ON [s].[Id] = [s0].[SquadId] ) AS [s1] ON [g].[Nickname] = [s1].[LeaderNickname] AND [g].[SquadId] = [s1].[LeaderSquadId] -ORDER BY [g].[Nickname], [g].[SquadId], [s1].[Nickname], [s1].[SquadId], [s1].[Id], [s1].[SquadId0] +ORDER BY [g].[Nickname], [g].[SquadId], [s1].[Nickname], [s1].[SquadId], [s1].[SquadId0] """); } @@ -4359,7 +4354,7 @@ public override async Task Correlated_collections_projection_of_collection_thru_ AssertSql( """ -SELECT [g].[Nickname], [g].[SquadId], [s].[Id], [s1].[SquadId], [s1].[MissionId] +SELECT [g].[Nickname], [g].[SquadId], [s1].[SquadId], [s1].[MissionId] FROM [Gears] AS [g] INNER JOIN [Squads] AS [s] ON [g].[SquadId] = [s].[Id] LEFT JOIN ( @@ -4368,7 +4363,7 @@ FROM [SquadMissions] AS [s0] WHERE [s0].[MissionId] <> 17 ) AS [s1] ON [s].[Id] = [s1].[SquadId] WHERE [g].[Nickname] <> N'Marcus' -ORDER BY [g].[FullName], [g].[Nickname], [g].[SquadId], [s].[Id], [s1].[SquadId] +ORDER BY [g].[FullName], [g].[Nickname], [g].[SquadId], [s1].[SquadId] """); } @@ -4395,10 +4390,10 @@ public override async Task Correlated_collections_nested(bool async) AssertSql( """ -SELECT [s].[Id], [s3].[SquadId], [s3].[MissionId], [s3].[Id], [s3].[SquadId0], [s3].[MissionId0] +SELECT [s].[Id], [s3].[SquadId], [s3].[MissionId], [s3].[SquadId0], [s3].[MissionId0] FROM [Squads] AS [s] LEFT JOIN ( - SELECT [s0].[SquadId], [s0].[MissionId], [m].[Id], [s2].[SquadId] AS [SquadId0], [s2].[MissionId] AS [MissionId0] + SELECT [s0].[SquadId], [s0].[MissionId], [s2].[SquadId] AS [SquadId0], [s2].[MissionId] AS [MissionId0] FROM [SquadMissions] AS [s0] INNER JOIN [Missions] AS [m] ON [s0].[MissionId] = [m].[Id] LEFT JOIN ( @@ -4408,7 +4403,7 @@ WHERE [s1].[SquadId] < 7 ) AS [s2] ON [m].[Id] = [s2].[MissionId] WHERE [s0].[MissionId] < 42 ) AS [s3] ON [s].[Id] = [s3].[SquadId] -ORDER BY [s].[Id], [s3].[SquadId], [s3].[MissionId], [s3].[Id], [s3].[SquadId0] +ORDER BY [s].[Id], [s3].[SquadId], [s3].[MissionId], [s3].[SquadId0] """); } @@ -4418,10 +4413,10 @@ public override async Task Correlated_collections_nested_mixed_streaming_with_bu AssertSql( """ -SELECT [s].[Id], [s3].[SquadId], [s3].[MissionId], [s3].[Id], [s3].[SquadId0], [s3].[MissionId0] +SELECT [s].[Id], [s3].[SquadId], [s3].[MissionId], [s3].[SquadId0], [s3].[MissionId0] FROM [Squads] AS [s] LEFT JOIN ( - SELECT [s0].[SquadId], [s0].[MissionId], [m].[Id], [s2].[SquadId] AS [SquadId0], [s2].[MissionId] AS [MissionId0] + SELECT [s0].[SquadId], [s0].[MissionId], [s2].[SquadId] AS [SquadId0], [s2].[MissionId] AS [MissionId0] FROM [SquadMissions] AS [s0] INNER JOIN [Missions] AS [m] ON [s0].[MissionId] = [m].[Id] LEFT JOIN ( @@ -4431,7 +4426,7 @@ WHERE [s1].[SquadId] < 2 ) AS [s2] ON [m].[Id] = [s2].[MissionId] WHERE [s0].[MissionId] < 3 ) AS [s3] ON [s].[Id] = [s3].[SquadId] -ORDER BY [s].[Id], [s3].[SquadId], [s3].[MissionId], [s3].[Id], [s3].[SquadId0] +ORDER BY [s].[Id], [s3].[SquadId], [s3].[MissionId], [s3].[SquadId0] """); } @@ -4441,10 +4436,10 @@ public override async Task Correlated_collections_nested_mixed_streaming_with_bu AssertSql( """ -SELECT [s].[Id], [s3].[SquadId], [s3].[MissionId], [s3].[Id], [s3].[SquadId0], [s3].[MissionId0] +SELECT [s].[Id], [s3].[SquadId], [s3].[MissionId], [s3].[SquadId0], [s3].[MissionId0] FROM [Squads] AS [s] LEFT JOIN ( - SELECT [s0].[SquadId], [s0].[MissionId], [m].[Id], [s2].[SquadId] AS [SquadId0], [s2].[MissionId] AS [MissionId0] + SELECT [s0].[SquadId], [s0].[MissionId], [s2].[SquadId] AS [SquadId0], [s2].[MissionId] AS [MissionId0] FROM [SquadMissions] AS [s0] INNER JOIN [Missions] AS [m] ON [s0].[MissionId] = [m].[Id] LEFT JOIN ( @@ -4454,7 +4449,7 @@ WHERE [s1].[SquadId] < 7 ) AS [s2] ON [m].[Id] = [s2].[MissionId] WHERE [s0].[MissionId] < 42 ) AS [s3] ON [s].[Id] = [s3].[SquadId] -ORDER BY [s].[Id], [s3].[SquadId], [s3].[MissionId], [s3].[Id], [s3].[SquadId0] +ORDER BY [s].[Id], [s3].[SquadId], [s3].[MissionId], [s3].[SquadId0] """); } @@ -4573,7 +4568,7 @@ public override async Task Multiple_orderby_with_navigation_expansion_on_one_of_ AssertSql( """ -SELECT [g].[FullName], [g].[Nickname], [g].[SquadId], [t].[Id], [s].[Nickname], [s].[SquadId], [s1].[Id], [s1].[AmmunitionType], [s1].[IsAutomatic], [s1].[Name], [s1].[OwnerFullName], [s1].[SynergyWithId], [s1].[Nickname], [s1].[SquadId] +SELECT [g].[FullName], [g].[Nickname], [g].[SquadId], [s1].[Id], [s1].[AmmunitionType], [s1].[IsAutomatic], [s1].[Name], [s1].[OwnerFullName], [s1].[SynergyWithId] FROM [Gears] AS [g] LEFT JOIN [Officers] AS [o] ON [g].[Nickname] = [o].[Nickname] AND [g].[SquadId] = [o].[SquadId] LEFT JOIN [Tags] AS [t] ON [g].[Nickname] = [t].[GearNickName] AND [g].[SquadId] = [t].[GearSquadId] @@ -4582,10 +4577,10 @@ LEFT JOIN ( FROM [Gears] AS [g1] ) AS [s] ON [t].[GearNickName] = [s].[Nickname] AND [t].[GearSquadId] = [s].[SquadId] LEFT JOIN ( - SELECT [w].[Id], [w].[AmmunitionType], [w].[IsAutomatic], [w].[Name], [w].[OwnerFullName], [w].[SynergyWithId], [s0].[Nickname], [s0].[SquadId] + SELECT [w].[Id], [w].[AmmunitionType], [w].[IsAutomatic], [w].[Name], [w].[OwnerFullName], [w].[SynergyWithId], [s0].[Nickname] FROM [Weapons] AS [w] LEFT JOIN ( - SELECT [g2].[Nickname], [g2].[SquadId], [g2].[FullName] + SELECT [g2].[Nickname], [g2].[FullName] FROM [Gears] AS [g2] ) AS [s0] ON [w].[OwnerFullName] = [s0].[FullName] ) AS [s1] ON [s].[FullName] = [s1].[OwnerFullName] @@ -4593,7 +4588,7 @@ WHERE [o].[Nickname] IS NOT NULL AND EXISTS ( SELECT 1 FROM [Gears] AS [g0] WHERE [g].[Nickname] = [g0].[LeaderNickname] AND [g].[SquadId] = [g0].[LeaderSquadId]) -ORDER BY [g].[HasSoulPatch] DESC, [t].[Note], [g].[Nickname], [g].[SquadId], [t].[Id], [s].[Nickname], [s].[SquadId], [s1].[IsAutomatic], [s1].[Nickname] DESC, [s1].[Id] +ORDER BY [g].[HasSoulPatch] DESC, [t].[Note], [g].[Nickname], [g].[SquadId], [s1].[IsAutomatic], [s1].[Nickname] DESC """); } @@ -4604,7 +4599,7 @@ public override async Task Multiple_orderby_with_navigation_expansion_on_one_of_ AssertSql( """ -SELECT [g].[FullName], [g].[Nickname], [g].[SquadId], [t].[Id], [s].[Nickname], [s].[SquadId], [s1].[Id], [s1].[AmmunitionType], [s1].[IsAutomatic], [s1].[Name], [s1].[OwnerFullName], [s1].[SynergyWithId], [s1].[Nickname], [s1].[SquadId] +SELECT [g].[FullName], [g].[Nickname], [g].[SquadId], [s1].[Id], [s1].[AmmunitionType], [s1].[IsAutomatic], [s1].[Name], [s1].[OwnerFullName], [s1].[SynergyWithId] FROM [Gears] AS [g] LEFT JOIN [Officers] AS [o] ON [g].[Nickname] = [o].[Nickname] AND [g].[SquadId] = [o].[SquadId] LEFT JOIN [Tags] AS [t] ON [g].[Nickname] = [t].[GearNickName] AND [g].[SquadId] = [t].[GearSquadId] @@ -4613,10 +4608,10 @@ LEFT JOIN ( FROM [Gears] AS [g1] ) AS [s] ON [t].[GearNickName] = [s].[Nickname] AND [t].[GearSquadId] = [s].[SquadId] LEFT JOIN ( - SELECT [w].[Id], [w].[AmmunitionType], [w].[IsAutomatic], [w].[Name], [w].[OwnerFullName], [w].[SynergyWithId], [s0].[Nickname], [s0].[SquadId] + SELECT [w].[Id], [w].[AmmunitionType], [w].[IsAutomatic], [w].[Name], [w].[OwnerFullName], [w].[SynergyWithId], [s0].[Nickname] FROM [Weapons] AS [w] LEFT JOIN ( - SELECT [g2].[Nickname], [g2].[SquadId], [g2].[FullName] + SELECT [g2].[Nickname], [g2].[FullName] FROM [Gears] AS [g2] ) AS [s0] ON [w].[OwnerFullName] = [s0].[FullName] ) AS [s1] ON [s].[FullName] = [s1].[OwnerFullName] @@ -4624,7 +4619,7 @@ WHERE [o].[Nickname] IS NOT NULL AND EXISTS ( SELECT 1 FROM [Gears] AS [g0] WHERE [g].[Nickname] = [g0].[LeaderNickname] AND [g].[SquadId] = [g0].[LeaderSquadId]) -ORDER BY [g].[HasSoulPatch] DESC, [t].[Note], [g].[Nickname], [g].[SquadId], [t].[Id], [s].[Nickname], [s].[SquadId], [s1].[IsAutomatic], [s1].[Nickname] DESC, [s1].[Id] +ORDER BY [g].[HasSoulPatch] DESC, [t].[Note], [g].[Nickname], [g].[SquadId], [s1].[IsAutomatic], [s1].[Nickname] DESC """); } @@ -4635,7 +4630,7 @@ public override async Task Multiple_orderby_with_navigation_expansion_on_one_of_ AssertSql( """ -SELECT [g].[FullName], [g].[Nickname], [g].[SquadId], [t].[Id], [s].[Nickname], [s].[SquadId], [s1].[Id], [s1].[AmmunitionType], [s1].[IsAutomatic], [s1].[Name], [s1].[OwnerFullName], [s1].[SynergyWithId], [s1].[Nickname], [s1].[SquadId] +SELECT [g].[FullName], [g].[Nickname], [g].[SquadId], [s1].[Id], [s1].[AmmunitionType], [s1].[IsAutomatic], [s1].[Name], [s1].[OwnerFullName], [s1].[SynergyWithId] FROM [Gears] AS [g] LEFT JOIN [Officers] AS [o] ON [g].[Nickname] = [o].[Nickname] AND [g].[SquadId] = [o].[SquadId] LEFT JOIN [Tags] AS [t] ON [g].[Nickname] = [t].[GearNickName] AND [g].[SquadId] = [t].[GearSquadId] @@ -4644,13 +4639,13 @@ LEFT JOIN ( FROM [Gears] AS [g1] ) AS [s] ON [t].[GearNickName] = [s].[Nickname] AND [t].[GearSquadId] = [s].[SquadId] LEFT JOIN ( - SELECT [w].[Id], [w].[AmmunitionType], [w].[IsAutomatic], [w].[Name], [w].[OwnerFullName], [w].[SynergyWithId], [s0].[Nickname], [s0].[SquadId], ( + SELECT [w].[Id], [w].[AmmunitionType], [w].[IsAutomatic], [w].[Name], [w].[OwnerFullName], [w].[SynergyWithId], ( SELECT COUNT(*) FROM [Weapons] AS [w0] WHERE [s0].[FullName] IS NOT NULL AND [s0].[FullName] = [w0].[OwnerFullName]) AS [c] FROM [Weapons] AS [w] LEFT JOIN ( - SELECT [g2].[Nickname], [g2].[SquadId], [g2].[FullName] + SELECT [g2].[FullName] FROM [Gears] AS [g2] ) AS [s0] ON [w].[OwnerFullName] = [s0].[FullName] ) AS [s1] ON [s].[FullName] = [s1].[OwnerFullName] @@ -4658,7 +4653,7 @@ WHERE [o].[Nickname] IS NOT NULL AND EXISTS ( SELECT 1 FROM [Gears] AS [g0] WHERE [g].[Nickname] = [g0].[LeaderNickname] AND [g].[SquadId] = [g0].[LeaderSquadId]) -ORDER BY [g].[HasSoulPatch] DESC, [t].[Note], [g].[Nickname], [g].[SquadId], [t].[Id], [s].[Nickname], [s].[SquadId], [s1].[Id] DESC, [s1].[c], [s1].[Nickname] +ORDER BY [g].[HasSoulPatch] DESC, [t].[Note], [g].[Nickname], [g].[SquadId], [s1].[Id] DESC, [s1].[c] """); } @@ -4668,7 +4663,7 @@ public override async Task Correlated_collections_multiple_nested_complex_collec AssertSql( """ -SELECT [g].[FullName], [g].[Nickname], [g].[SquadId], [t].[Id], [s].[Nickname], [s].[SquadId], [s5].[FullName], [s5].[Nickname], [s5].[SquadId], [s5].[Id], [s5].[Nickname0], [s5].[SquadId0], [s5].[Id0], [s5].[Name], [s5].[IsAutomatic], [s5].[Id1], [s5].[Nickname00], [s5].[HasSoulPatch], [s5].[SquadId00], [s6].[Id], [s6].[AmmunitionType], [s6].[IsAutomatic], [s6].[Name], [s6].[OwnerFullName], [s6].[SynergyWithId], [s6].[Nickname], [s6].[SquadId] +SELECT [g].[FullName], [g].[Nickname], [g].[SquadId], [s5].[FullName], [s5].[Nickname], [s5].[SquadId], [s5].[Id], [s5].[Name], [s5].[IsAutomatic], [s5].[Id0], [s5].[Nickname0], [s5].[HasSoulPatch], [s5].[SquadId0], [s6].[Id], [s6].[AmmunitionType], [s6].[IsAutomatic], [s6].[Name], [s6].[OwnerFullName], [s6].[SynergyWithId] FROM [Gears] AS [g] LEFT JOIN [Officers] AS [o] ON [g].[Nickname] = [o].[Nickname] AND [g].[SquadId] = [o].[SquadId] LEFT JOIN [Tags] AS [t] ON [g].[Nickname] = [t].[GearNickName] AND [g].[SquadId] = [t].[GearSquadId] @@ -4677,13 +4672,13 @@ LEFT JOIN ( FROM [Gears] AS [g1] ) AS [s] ON [t].[GearNickName] = [s].[Nickname] AND [t].[GearSquadId] = [s].[SquadId] LEFT JOIN ( - SELECT [g2].[FullName], [g2].[Nickname], [g2].[SquadId], [s4].[Id], [s4].[Nickname] AS [Nickname0], [s4].[SquadId] AS [SquadId0], [s4].[Id0], [s4].[Name], [s4].[IsAutomatic], [s4].[Id1], [s4].[Nickname0] AS [Nickname00], [s4].[HasSoulPatch], [s4].[SquadId0] AS [SquadId00], [g2].[Rank], [s4].[IsAutomatic0], [g2].[LeaderNickname], [g2].[LeaderSquadId] + SELECT [g2].[FullName], [g2].[Nickname], [g2].[SquadId], [s4].[Id], [s4].[Name], [s4].[IsAutomatic], [s4].[Id0], [s4].[Nickname] AS [Nickname0], [s4].[HasSoulPatch], [s4].[SquadId] AS [SquadId0], [g2].[Rank], [s4].[IsAutomatic0], [g2].[LeaderNickname], [g2].[LeaderSquadId] FROM [Gears] AS [g2] LEFT JOIN ( - SELECT [w].[Id], [s0].[Nickname], [s0].[SquadId], [s1].[Id] AS [Id0], [w0].[Name], [w0].[IsAutomatic], [w0].[Id] AS [Id1], [s3].[Nickname] AS [Nickname0], [s3].[HasSoulPatch], [s3].[SquadId] AS [SquadId0], [w].[IsAutomatic] AS [IsAutomatic0], [w].[OwnerFullName] + SELECT [w].[Id], [w0].[Name], [w0].[IsAutomatic], [w0].[Id] AS [Id0], [s3].[Nickname], [s3].[HasSoulPatch], [s3].[SquadId], [w].[IsAutomatic] AS [IsAutomatic0], [w].[OwnerFullName] FROM [Weapons] AS [w] LEFT JOIN ( - SELECT [g3].[Nickname], [g3].[SquadId], [g3].[FullName] + SELECT [g3].[SquadId], [g3].[FullName] FROM [Gears] AS [g3] ) AS [s0] ON [w].[OwnerFullName] = [s0].[FullName] LEFT JOIN [Squads] AS [s1] ON [s0].[SquadId] = [s1].[Id] @@ -4697,10 +4692,10 @@ WHERE [w].[Name] <> N'Bar' OR [w].[Name] IS NULL WHERE [g2].[FullName] <> N'Foo' ) AS [s5] ON [g].[Nickname] = [s5].[LeaderNickname] AND [g].[SquadId] = [s5].[LeaderSquadId] LEFT JOIN ( - SELECT [w1].[Id], [w1].[AmmunitionType], [w1].[IsAutomatic], [w1].[Name], [w1].[OwnerFullName], [w1].[SynergyWithId], [s2].[Nickname], [s2].[SquadId] + SELECT [w1].[Id], [w1].[AmmunitionType], [w1].[IsAutomatic], [w1].[Name], [w1].[OwnerFullName], [w1].[SynergyWithId], [s2].[Nickname] FROM [Weapons] AS [w1] LEFT JOIN ( - SELECT [g5].[Nickname], [g5].[SquadId], [g5].[FullName] + SELECT [g5].[Nickname], [g5].[FullName] FROM [Gears] AS [g5] ) AS [s2] ON [w1].[OwnerFullName] = [s2].[FullName] ) AS [s6] ON [s].[FullName] = [s6].[OwnerFullName] @@ -4708,7 +4703,7 @@ WHERE [o].[Nickname] IS NOT NULL AND EXISTS ( SELECT 1 FROM [Gears] AS [g0] WHERE [g].[Nickname] = [g0].[LeaderNickname] AND [g].[SquadId] = [g0].[LeaderSquadId]) -ORDER BY [g].[HasSoulPatch] DESC, [t].[Note], [g].[Nickname], [g].[SquadId], [t].[Id], [s].[Nickname], [s].[SquadId], [s5].[Rank], [s5].[Nickname], [s5].[SquadId], [s5].[IsAutomatic0], [s5].[Id], [s5].[Nickname0], [s5].[SquadId0], [s5].[Id0], [s5].[Id1], [s5].[Nickname00], [s5].[SquadId00], [s6].[IsAutomatic], [s6].[Nickname] DESC, [s6].[Id] +ORDER BY [g].[HasSoulPatch] DESC, [t].[Note], [g].[Nickname], [g].[SquadId], [s5].[Rank], [s5].[Nickname], [s5].[SquadId], [s5].[IsAutomatic0], [s5].[Id], [s5].[Id0], [s5].[Nickname0], [s5].[SquadId0], [s6].[IsAutomatic], [s6].[Nickname] DESC """); } @@ -4990,7 +4985,7 @@ public override async Task Correlated_collections_deeply_nested_left_join(bool a AssertSql( """ -SELECT [t].[Id], [s].[Nickname], [s].[SquadId], [s0].[Id], [s1].[Nickname], [s1].[SquadId], [s1].[Id], [s1].[AmmunitionType], [s1].[IsAutomatic], [s1].[Name], [s1].[OwnerFullName], [s1].[SynergyWithId] +SELECT [t].[Id], [s].[Nickname], [s].[SquadId], [s1].[Nickname], [s1].[SquadId], [s1].[Id], [s1].[AmmunitionType], [s1].[IsAutomatic], [s1].[Name], [s1].[OwnerFullName], [s1].[SynergyWithId] FROM [Tags] AS [t] LEFT JOIN ( SELECT [g].[Nickname], [g].[SquadId] @@ -5007,7 +5002,7 @@ FROM [Weapons] AS [w] ) AS [w0] ON [g0].[FullName] = [w0].[OwnerFullName] WHERE [g0].[HasSoulPatch] = CAST(1 AS bit) ) AS [s1] ON [s0].[Id] = [s1].[SquadId] -ORDER BY [t].[Note], [s].[Nickname] DESC, [t].[Id], [s].[SquadId], [s0].[Id], [s1].[Nickname], [s1].[SquadId] +ORDER BY [t].[Note], [s].[Nickname] DESC, [t].[Id], [s].[SquadId], [s1].[Nickname], [s1].[SquadId] """); } @@ -5017,10 +5012,10 @@ public override async Task Correlated_collections_from_left_join_with_additional AssertSql( """ -SELECT [w].[Id], [s].[Nickname], [s].[SquadId], [s0].[Id], [s1].[Nickname], [s1].[SquadId], [s1].[Id], [s1].[AmmunitionType], [s1].[IsAutomatic], [s1].[Name], [s1].[OwnerFullName], [s1].[SynergyWithId], [s1].[Rank] +SELECT [w].[Id], [s1].[Nickname], [s1].[SquadId], [s1].[Id], [s1].[AmmunitionType], [s1].[IsAutomatic], [s1].[Name], [s1].[OwnerFullName], [s1].[SynergyWithId], [s1].[Rank] FROM [Weapons] AS [w] LEFT JOIN ( - SELECT [g].[Nickname], [g].[SquadId], [g].[FullName] + SELECT [g].[SquadId], [g].[FullName] FROM [Gears] AS [g] ) AS [s] ON [w].[OwnerFullName] = [s].[FullName] LEFT JOIN [Squads] AS [s0] ON [s].[SquadId] = [s0].[Id] @@ -5033,7 +5028,7 @@ FROM [Weapons] AS [w0] WHERE [w0].[IsAutomatic] = CAST(0 AS bit) ) AS [w1] ON [g0].[FullName] = [w1].[OwnerFullName] ) AS [s1] ON [s0].[Id] = [s1].[SquadId] -ORDER BY [w].[Name], [w].[Id], [s].[Nickname], [s].[SquadId], [s0].[Id], [s1].[FullName] DESC, [s1].[Nickname], [s1].[SquadId], [s1].[Id] +ORDER BY [w].[Name], [w].[Id], [s1].[FullName] DESC, [s1].[Nickname], [s1].[SquadId], [s1].[Id] """); } @@ -5043,13 +5038,13 @@ public override async Task Correlated_collections_complex_scenario1(bool async) AssertSql( """ -SELECT [g].[FullName], [g].[Nickname], [g].[SquadId], [s2].[Id], [s2].[Nickname], [s2].[SquadId], [s2].[Id0], [s2].[Nickname0], [s2].[HasSoulPatch], [s2].[SquadId0] +SELECT [g].[FullName], [g].[Nickname], [g].[SquadId], [s2].[Id], [s2].[Nickname], [s2].[HasSoulPatch], [s2].[SquadId] FROM [Gears] AS [g] LEFT JOIN ( - SELECT [w].[Id], [s].[Nickname], [s].[SquadId], [s0].[Id] AS [Id0], [s1].[Nickname] AS [Nickname0], [s1].[HasSoulPatch], [s1].[SquadId] AS [SquadId0], [w].[OwnerFullName] + SELECT [w].[Id], [s1].[Nickname], [s1].[HasSoulPatch], [s1].[SquadId], [w].[OwnerFullName] FROM [Weapons] AS [w] LEFT JOIN ( - SELECT [g0].[Nickname], [g0].[SquadId], [g0].[FullName] + SELECT [g0].[SquadId], [g0].[FullName] FROM [Gears] AS [g0] ) AS [s] ON [w].[OwnerFullName] = [s].[FullName] LEFT JOIN [Squads] AS [s0] ON [s].[SquadId] = [s0].[Id] @@ -5058,7 +5053,7 @@ LEFT JOIN ( FROM [Gears] AS [g1] ) AS [s1] ON [s0].[Id] = [s1].[SquadId] ) AS [s2] ON [g].[FullName] = [s2].[OwnerFullName] -ORDER BY [g].[Nickname], [g].[SquadId], [s2].[Id], [s2].[Nickname], [s2].[SquadId], [s2].[Id0], [s2].[Nickname0] +ORDER BY [g].[Nickname], [g].[SquadId], [s2].[Id], [s2].[Nickname] """); } @@ -5068,17 +5063,17 @@ public override async Task Correlated_collections_complex_scenario2(bool async) AssertSql( """ -SELECT [g].[FullName], [g].[Nickname], [g].[SquadId], [s3].[FullName], [s3].[Nickname], [s3].[SquadId], [s3].[Id], [s3].[Nickname0], [s3].[SquadId0], [s3].[Id0], [s3].[Nickname00], [s3].[HasSoulPatch], [s3].[SquadId00] +SELECT [g].[FullName], [g].[Nickname], [g].[SquadId], [s3].[FullName], [s3].[Nickname], [s3].[SquadId], [s3].[Id], [s3].[Nickname0], [s3].[HasSoulPatch], [s3].[SquadId0] FROM [Gears] AS [g] LEFT JOIN [Officers] AS [o] ON [g].[Nickname] = [o].[Nickname] AND [g].[SquadId] = [o].[SquadId] LEFT JOIN ( - SELECT [g0].[FullName], [g0].[Nickname], [g0].[SquadId], [s2].[Id], [s2].[Nickname] AS [Nickname0], [s2].[SquadId] AS [SquadId0], [s2].[Id0], [s2].[Nickname0] AS [Nickname00], [s2].[HasSoulPatch], [s2].[SquadId0] AS [SquadId00], [g0].[LeaderNickname], [g0].[LeaderSquadId] + SELECT [g0].[FullName], [g0].[Nickname], [g0].[SquadId], [s2].[Id], [s2].[Nickname] AS [Nickname0], [s2].[HasSoulPatch], [s2].[SquadId] AS [SquadId0], [g0].[LeaderNickname], [g0].[LeaderSquadId] FROM [Gears] AS [g0] LEFT JOIN ( - SELECT [w].[Id], [s].[Nickname], [s].[SquadId], [s0].[Id] AS [Id0], [s1].[Nickname] AS [Nickname0], [s1].[HasSoulPatch], [s1].[SquadId] AS [SquadId0], [w].[OwnerFullName] + SELECT [w].[Id], [s1].[Nickname], [s1].[HasSoulPatch], [s1].[SquadId], [w].[OwnerFullName] FROM [Weapons] AS [w] LEFT JOIN ( - SELECT [g1].[Nickname], [g1].[SquadId], [g1].[FullName] + SELECT [g1].[SquadId], [g1].[FullName] FROM [Gears] AS [g1] ) AS [s] ON [w].[OwnerFullName] = [s].[FullName] LEFT JOIN [Squads] AS [s0] ON [s].[SquadId] = [s0].[Id] @@ -5089,7 +5084,7 @@ FROM [Gears] AS [g2] ) AS [s2] ON [g0].[FullName] = [s2].[OwnerFullName] ) AS [s3] ON [g].[Nickname] = [s3].[LeaderNickname] AND [g].[SquadId] = [s3].[LeaderSquadId] WHERE [o].[Nickname] IS NOT NULL -ORDER BY [g].[Nickname], [g].[SquadId], [s3].[Nickname], [s3].[SquadId], [s3].[Id], [s3].[Nickname0], [s3].[SquadId0], [s3].[Id0], [s3].[Nickname00] +ORDER BY [g].[Nickname], [g].[SquadId], [s3].[Nickname], [s3].[SquadId], [s3].[Id], [s3].[Nickname0] """); } @@ -5099,13 +5094,13 @@ public override async Task Correlated_collections_with_funky_orderby_complex_sce AssertSql( """ -SELECT [g].[FullName], [g].[Nickname], [g].[SquadId], [s2].[Id], [s2].[Nickname], [s2].[SquadId], [s2].[Id0], [s2].[Nickname0], [s2].[HasSoulPatch], [s2].[SquadId0] +SELECT [g].[FullName], [g].[Nickname], [g].[SquadId], [s2].[Id], [s2].[Nickname], [s2].[HasSoulPatch], [s2].[SquadId] FROM [Gears] AS [g] LEFT JOIN ( - SELECT [w].[Id], [s].[Nickname], [s].[SquadId], [s0].[Id] AS [Id0], [s1].[Nickname] AS [Nickname0], [s1].[HasSoulPatch], [s1].[SquadId] AS [SquadId0], [w].[OwnerFullName] + SELECT [w].[Id], [s1].[Nickname], [s1].[HasSoulPatch], [s1].[SquadId], [w].[OwnerFullName] FROM [Weapons] AS [w] LEFT JOIN ( - SELECT [g0].[Nickname], [g0].[SquadId], [g0].[FullName] + SELECT [g0].[SquadId], [g0].[FullName] FROM [Gears] AS [g0] ) AS [s] ON [w].[OwnerFullName] = [s].[FullName] LEFT JOIN [Squads] AS [s0] ON [s].[SquadId] = [s0].[Id] @@ -5114,7 +5109,7 @@ LEFT JOIN ( FROM [Gears] AS [g1] ) AS [s1] ON [s0].[Id] = [s1].[SquadId] ) AS [s2] ON [g].[FullName] = [s2].[OwnerFullName] -ORDER BY [g].[FullName], [g].[Nickname] DESC, [g].[SquadId], [s2].[Id], [s2].[Nickname], [s2].[SquadId], [s2].[Id0], [s2].[Nickname0] +ORDER BY [g].[FullName], [g].[Nickname] DESC, [g].[SquadId], [s2].[Id], [s2].[Nickname] """); } @@ -5124,17 +5119,17 @@ public override async Task Correlated_collections_with_funky_orderby_complex_sce AssertSql( """ -SELECT [g].[FullName], [g].[Nickname], [g].[SquadId], [s3].[FullName], [s3].[Nickname], [s3].[SquadId], [s3].[Id], [s3].[Nickname0], [s3].[SquadId0], [s3].[Id0], [s3].[Nickname00], [s3].[HasSoulPatch], [s3].[SquadId00] +SELECT [g].[FullName], [g].[Nickname], [g].[SquadId], [s3].[FullName], [s3].[Nickname], [s3].[SquadId], [s3].[Id], [s3].[Nickname0], [s3].[HasSoulPatch], [s3].[SquadId0] FROM [Gears] AS [g] LEFT JOIN [Officers] AS [o] ON [g].[Nickname] = [o].[Nickname] AND [g].[SquadId] = [o].[SquadId] LEFT JOIN ( - SELECT [g0].[FullName], [g0].[Nickname], [g0].[SquadId], [s2].[Id], [s2].[Nickname] AS [Nickname0], [s2].[SquadId] AS [SquadId0], [s2].[Id0], [s2].[Nickname0] AS [Nickname00], [s2].[HasSoulPatch], [s2].[SquadId0] AS [SquadId00], [g0].[HasSoulPatch] AS [HasSoulPatch0], [s2].[IsAutomatic], [s2].[Name], [g0].[LeaderNickname], [g0].[LeaderSquadId] + SELECT [g0].[FullName], [g0].[Nickname], [g0].[SquadId], [s2].[Id], [s2].[Nickname] AS [Nickname0], [s2].[HasSoulPatch], [s2].[SquadId] AS [SquadId0], [g0].[HasSoulPatch] AS [HasSoulPatch0], [s2].[IsAutomatic], [s2].[Name], [g0].[LeaderNickname], [g0].[LeaderSquadId] FROM [Gears] AS [g0] LEFT JOIN ( - SELECT [w].[Id], [s].[Nickname], [s].[SquadId], [s0].[Id] AS [Id0], [s1].[Nickname] AS [Nickname0], [s1].[HasSoulPatch], [s1].[SquadId] AS [SquadId0], [w].[IsAutomatic], [w].[Name], [w].[OwnerFullName] + SELECT [w].[Id], [s1].[Nickname], [s1].[HasSoulPatch], [s1].[SquadId], [w].[IsAutomatic], [w].[Name], [w].[OwnerFullName] FROM [Weapons] AS [w] LEFT JOIN ( - SELECT [g1].[Nickname], [g1].[SquadId], [g1].[FullName] + SELECT [g1].[SquadId], [g1].[FullName] FROM [Gears] AS [g1] ) AS [s] ON [w].[OwnerFullName] = [s].[FullName] LEFT JOIN [Squads] AS [s0] ON [s].[SquadId] = [s0].[Id] @@ -5145,7 +5140,7 @@ FROM [Gears] AS [g2] ) AS [s2] ON [g0].[FullName] = [s2].[OwnerFullName] ) AS [s3] ON [g].[Nickname] = [s3].[LeaderNickname] AND [g].[SquadId] = [s3].[LeaderSquadId] WHERE [o].[Nickname] IS NOT NULL -ORDER BY [g].[HasSoulPatch], [g].[LeaderNickname], [g].[FullName], [g].[Nickname], [g].[SquadId], [s3].[FullName], [s3].[HasSoulPatch0] DESC, [s3].[Nickname], [s3].[SquadId], [s3].[IsAutomatic], [s3].[Name] DESC, [s3].[Id], [s3].[Nickname0], [s3].[SquadId0], [s3].[Id0], [s3].[Nickname00] +ORDER BY [g].[HasSoulPatch], [g].[LeaderNickname], [g].[FullName], [g].[Nickname], [g].[SquadId], [s3].[FullName], [s3].[HasSoulPatch0] DESC, [s3].[Nickname], [s3].[SquadId], [s3].[IsAutomatic], [s3].[Name] DESC, [s3].[Id], [s3].[Nickname0] """); } @@ -5259,11 +5254,11 @@ public override async Task Include_on_derived_type_with_order_by_and_paging(bool """ @p='10' -SELECT [s0].[Name], [s0].[LocustHordeId], [s0].[ThreatLevel], [s0].[ThreatLevelByte], [s0].[ThreatLevelNullableByte], [s0].[DefeatedByNickname], [s0].[DefeatedBySquadId], [s0].[HighCommandId], [s0].[Discriminator], [s0].[Nickname], [s0].[SquadId], [s0].[AssignedCityName], [s0].[CityOfBirthName], [s0].[FullName], [s0].[HasSoulPatch], [s0].[LeaderNickname], [s0].[LeaderSquadId], [s0].[Rank], [s0].[Discriminator0] AS [Discriminator], [s0].[Id], [w].[Id], [w].[AmmunitionType], [w].[IsAutomatic], [w].[Name], [w].[OwnerFullName], [w].[SynergyWithId] +SELECT [s0].[Name], [s0].[LocustHordeId], [s0].[ThreatLevel], [s0].[ThreatLevelByte], [s0].[ThreatLevelNullableByte], [s0].[DefeatedByNickname], [s0].[DefeatedBySquadId], [s0].[HighCommandId], [s0].[Discriminator], [s0].[Nickname], [s0].[SquadId], [s0].[AssignedCityName], [s0].[CityOfBirthName], [s0].[FullName], [s0].[HasSoulPatch], [s0].[LeaderNickname], [s0].[LeaderSquadId], [s0].[Rank], [s0].[Discriminator0] AS [Discriminator], [w].[Id], [w].[AmmunitionType], [w].[IsAutomatic], [w].[Name], [w].[OwnerFullName], [w].[SynergyWithId] FROM ( SELECT TOP(@p) [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], [s].[Nickname], [s].[SquadId], [s].[AssignedCityName], [s].[CityOfBirthName], [s].[FullName], [s].[HasSoulPatch], [s].[LeaderNickname], [s].[LeaderSquadId], [s].[Rank], [s].[Discriminator] AS [Discriminator0], [t].[Id], [t].[Note] + END AS [Discriminator], [s].[Nickname], [s].[SquadId], [s].[AssignedCityName], [s].[CityOfBirthName], [s].[FullName], [s].[HasSoulPatch], [s].[LeaderNickname], [s].[LeaderSquadId], [s].[Rank], [s].[Discriminator] AS [Discriminator0], [t].[Note] FROM [LocustLeaders] AS [l] LEFT JOIN [LocustCommanders] AS [l0] ON [l].[Name] = [l0].[Name] LEFT JOIN ( @@ -5277,7 +5272,7 @@ LEFT JOIN [Tags] AS [t] ON ([s].[Nickname] = [t].[GearNickName] OR ([s].[Nicknam ORDER BY [t].[Note] ) AS [s0] LEFT JOIN [Weapons] AS [w] ON [s0].[FullName] = [w].[OwnerFullName] -ORDER BY [s0].[Note], [s0].[Name], [s0].[Nickname], [s0].[SquadId], [s0].[Id] +ORDER BY [s0].[Note], [s0].[Name] """); } @@ -5328,19 +5323,19 @@ public override async Task Outer_parameter_in_join_key(bool async) AssertSql( """ -SELECT [g].[Nickname], [g].[SquadId], [s0].[Note], [s0].[Id], [s0].[Nickname], [s0].[SquadId] +SELECT [g].[Nickname], [g].[SquadId], [s0].[Note], [s0].[Id] FROM [Gears] AS [g] LEFT JOIN [Officers] AS [o] ON [g].[Nickname] = [o].[Nickname] AND [g].[SquadId] = [o].[SquadId] OUTER APPLY ( - SELECT [t].[Note], [t].[Id], [s].[Nickname], [s].[SquadId] + SELECT [t].[Note], [t].[Id] FROM [Tags] AS [t] INNER JOIN ( - SELECT [g0].[Nickname], [g0].[SquadId], [g0].[FullName] + SELECT [g0].[FullName] FROM [Gears] AS [g0] ) AS [s] ON [g].[FullName] = [s].[FullName] ) AS [s0] WHERE [o].[Nickname] IS NOT NULL -ORDER BY [g].[Nickname], [g].[SquadId], [s0].[Id], [s0].[Nickname] +ORDER BY [g].[Nickname], [g].[SquadId] """); } @@ -5372,19 +5367,15 @@ public override async Task Outer_parameter_in_group_join_with_DefaultIfEmpty(boo AssertSql( """ -SELECT [g].[Nickname], [g].[SquadId], [s0].[Note], [s0].[Id], [s0].[Nickname], [s0].[SquadId] +SELECT [g].[Nickname], [g].[SquadId], [s].[Note], [s].[Id] FROM [Gears] AS [g] LEFT JOIN [Officers] AS [o] ON [g].[Nickname] = [o].[Nickname] AND [g].[SquadId] = [o].[SquadId] OUTER APPLY ( - SELECT [t].[Note], [t].[Id], [s].[Nickname], [s].[SquadId] + SELECT [t].[Note], [t].[Id] FROM [Tags] AS [t] - LEFT JOIN ( - SELECT [g0].[Nickname], [g0].[SquadId], [g0].[FullName] - FROM [Gears] AS [g0] - ) AS [s] ON [g].[FullName] = [s].[FullName] -) AS [s0] +) AS [s] WHERE [o].[Nickname] IS NOT NULL -ORDER BY [g].[Nickname], [g].[SquadId], [s0].[Id], [s0].[Nickname] +ORDER BY [g].[Nickname], [g].[SquadId] """); } @@ -6536,7 +6527,7 @@ LEFT JOIN ( FROM ( SELECT [g0].[Nickname], [g0].[SquadId], [g0].[AssignedCityName], [g0].[CityOfBirthName], [g0].[FullName], [g0].[HasSoulPatch], [g0].[LeaderNickname], [g0].[LeaderSquadId], [g0].[Rank], CASE WHEN [o].[Nickname] IS NOT NULL THEN N'Officer' - END AS [Discriminator], [c].[Name], [c].[Location], [c].[Nation], ROW_NUMBER() OVER(PARTITION BY [g0].[Rank] ORDER BY [g0].[Nickname], [g0].[SquadId], [c].[Name]) AS [row] + END AS [Discriminator], [c].[Name], [c].[Location], [c].[Nation], ROW_NUMBER() OVER(PARTITION BY [g0].[Rank] ORDER BY [g0].[Nickname], [g0].[SquadId]) AS [row] FROM [Gears] AS [g0] LEFT JOIN [Officers] AS [o] ON [g0].[Nickname] = [o].[Nickname] AND [g0].[SquadId] = [o].[SquadId] INNER JOIN [Cities] AS [c] ON [g0].[CityOfBirthName] = [c].[Name] @@ -7066,7 +7057,7 @@ public override async Task Project_collection_navigation_nested_with_take_compos AssertSql( """ -SELECT [t].[Id], [s].[Nickname], [s].[SquadId], [s1].[Nickname], [s1].[SquadId], [s1].[AssignedCityName], [s1].[CityOfBirthName], [s1].[FullName], [s1].[HasSoulPatch], [s1].[LeaderNickname], [s1].[LeaderSquadId], [s1].[Rank], [s1].[Discriminator] +SELECT [t].[Id], [s1].[Nickname], [s1].[SquadId], [s1].[AssignedCityName], [s1].[CityOfBirthName], [s1].[FullName], [s1].[HasSoulPatch], [s1].[LeaderNickname], [s1].[LeaderSquadId], [s1].[Rank], [s1].[Discriminator] FROM [Tags] AS [t] LEFT JOIN ( SELECT [g].[Nickname], [g].[SquadId], CASE @@ -7087,7 +7078,7 @@ FROM [Gears] AS [g0] WHERE [s0].[row] <= 50 ) AS [s1] ON ([s].[Nickname] = [s1].[LeaderNickname] OR ([s].[Nickname] IS NULL AND [s1].[LeaderNickname] IS NULL)) AND [s].[SquadId] = [s1].[LeaderSquadId] WHERE [s].[Discriminator] = N'Officer' -ORDER BY [t].[Id], [s].[Nickname], [s].[SquadId], [s1].[Nickname] +ORDER BY [t].[Id], [s1].[Nickname] """); } @@ -7097,7 +7088,7 @@ public override async Task Project_collection_navigation_nested_composite_key(bo AssertSql( """ -SELECT [t].[Id], [s].[Nickname], [s].[SquadId], [s0].[Nickname], [s0].[SquadId], [s0].[AssignedCityName], [s0].[CityOfBirthName], [s0].[FullName], [s0].[HasSoulPatch], [s0].[LeaderNickname], [s0].[LeaderSquadId], [s0].[Rank], [s0].[Discriminator] +SELECT [t].[Id], [s0].[Nickname], [s0].[SquadId], [s0].[AssignedCityName], [s0].[CityOfBirthName], [s0].[FullName], [s0].[HasSoulPatch], [s0].[LeaderNickname], [s0].[LeaderSquadId], [s0].[Rank], [s0].[Discriminator] FROM [Tags] AS [t] LEFT JOIN ( SELECT [g].[Nickname], [g].[SquadId], CASE @@ -7114,7 +7105,7 @@ FROM [Gears] AS [g0] LEFT JOIN [Officers] AS [o0] ON [g0].[Nickname] = [o0].[Nickname] AND [g0].[SquadId] = [o0].[SquadId] ) AS [s0] ON ([s].[Nickname] = [s0].[LeaderNickname] OR ([s].[Nickname] IS NULL AND [s0].[LeaderNickname] IS NULL)) AND [s].[SquadId] = [s0].[LeaderSquadId] WHERE [s].[Discriminator] = N'Officer' -ORDER BY [t].[Id], [s].[Nickname], [s].[SquadId], [s0].[Nickname] +ORDER BY [t].[Id], [s0].[Nickname] """); } @@ -7406,14 +7397,14 @@ public override async Task Accessing_reference_navigation_collection_composition AssertSql( """ -SELECT [g].[Nickname], [g].[SquadId], [s].[Id], [s].[IsAutomatic], [s].[Name], [s].[Id0] +SELECT [g].[Nickname], [g].[SquadId], [s].[Id], [s].[IsAutomatic], [s].[Name] FROM [Gears] AS [g] LEFT JOIN ( - SELECT [w].[Id], [w].[IsAutomatic], [w0].[Name], [w0].[Id] AS [Id0], [w].[OwnerFullName] + SELECT [w].[Id], [w].[IsAutomatic], [w0].[Name], [w].[OwnerFullName] FROM [Weapons] AS [w] LEFT JOIN [Weapons] AS [w0] ON [w].[SynergyWithId] = [w0].[Id] ) AS [s] ON [g].[FullName] = [s].[OwnerFullName] -ORDER BY [g].[Nickname], [g].[SquadId], [s].[Id] +ORDER BY [g].[Nickname], [g].[SquadId] """); } @@ -7446,21 +7437,21 @@ public override async Task Accessing_property_of_optional_navigation_in_child_pr SELECT CASE WHEN [s].[Nickname] IS NOT NULL AND [s].[SquadId] IS NOT NULL THEN CAST(1 AS bit) ELSE CAST(0 AS bit) -END, [t].[Id], [s].[Nickname], [s].[SquadId], [s1].[Nickname], [s1].[Id], [s1].[SquadId] +END, [t].[Id], [s1].[Nickname], [s1].[Id] FROM [Tags] AS [t] LEFT JOIN ( SELECT [g].[Nickname], [g].[SquadId], [g].[FullName] FROM [Gears] AS [g] ) AS [s] ON [t].[GearNickName] = [s].[Nickname] AND [t].[GearSquadId] = [s].[SquadId] LEFT JOIN ( - SELECT [s0].[Nickname], [w].[Id], [s0].[SquadId], [w].[OwnerFullName] + SELECT [s0].[Nickname], [w].[Id], [w].[OwnerFullName] FROM [Weapons] AS [w] LEFT JOIN ( - SELECT [g0].[Nickname], [g0].[SquadId], [g0].[FullName] + SELECT [g0].[Nickname], [g0].[FullName] FROM [Gears] AS [g0] ) AS [s0] ON [w].[OwnerFullName] = [s0].[FullName] ) AS [s1] ON [s].[FullName] = [s1].[OwnerFullName] -ORDER BY [t].[Note], [t].[Id], [s].[Nickname], [s].[SquadId], [s1].[Id], [s1].[Nickname] +ORDER BY [t].[Note], [t].[Id] """); } @@ -7640,7 +7631,6 @@ public override async Task Left_join_with_GroupBy_with_composite_group_key(bool """ SELECT [g].[CityOfBirthName], [g].[HasSoulPatch] FROM [Gears] AS [g] -INNER JOIN [Squads] AS [s] ON [g].[SquadId] = [s].[Id] LEFT JOIN [Tags] AS [t] ON [g].[Nickname] = [t].[GearNickName] GROUP BY [g].[CityOfBirthName], [g].[HasSoulPatch] """); @@ -8705,7 +8695,7 @@ public override async Task Correlated_collection_take(bool async) AssertSql( """ -SELECT [g].[Nickname], [g].[SquadId], [c].[Name], [w1].[Id], [w1].[AmmunitionType], [w1].[IsAutomatic], [w1].[Name], [w1].[OwnerFullName], [w1].[SynergyWithId], [c].[Location], [c].[Nation] +SELECT [g].[Nickname], [g].[SquadId], [w1].[Id], [w1].[AmmunitionType], [w1].[IsAutomatic], [w1].[Name], [w1].[OwnerFullName], [w1].[SynergyWithId], [c].[Name], [c].[Location], [c].[Nation] FROM [Gears] AS [g] INNER JOIN [Cities] AS [c] ON [g].[CityOfBirthName] = [c].[Name] LEFT JOIN ( @@ -8716,7 +8706,7 @@ FROM [Weapons] AS [w] ) AS [w0] WHERE [w0].[row] <= 10 ) AS [w1] ON [g].[FullName] = [w1].[OwnerFullName] -ORDER BY [g].[Nickname], [g].[SquadId], [c].[Name] +ORDER BY [g].[Nickname], [g].[SquadId] """); } @@ -9316,7 +9306,7 @@ FROM [Weapons] AS [w0] ) AS [w1] WHERE [w1].[row] <= 1 ) AS [w2] ON [g].[FullName] = [w2].[OwnerFullName] -ORDER BY [g].[Nickname], [g].[SquadId], [s].[Id] +ORDER BY [g].[Nickname], [g].[SquadId] """); } @@ -9582,7 +9572,7 @@ FROM [Gears] AS [g] ) AS [s] ON [l0].[DefeatedByNickname] = [s].[Nickname] AND [l0].[DefeatedBySquadId] = [s].[SquadId] LEFT JOIN [Weapons] AS [w] ON [s].[FullName] = [w].[OwnerFullName] WHERE [l].[Name] LIKE N'%Queen%' -ORDER BY [l].[Name], [s].[Nickname], [s].[SquadId] +ORDER BY [l].[Name] """); } diff --git a/test/EFCore.SqlServer.FunctionalTests/Query/Inheritance/TPTManyToManyNoTrackingQuerySqlServerTest.cs b/test/EFCore.SqlServer.FunctionalTests/Query/Inheritance/TPTManyToManyNoTrackingQuerySqlServerTest.cs index aeb9256d874..22dccf5295d 100644 --- a/test/EFCore.SqlServer.FunctionalTests/Query/Inheritance/TPTManyToManyNoTrackingQuerySqlServerTest.cs +++ b/test/EFCore.SqlServer.FunctionalTests/Query/Inheritance/TPTManyToManyNoTrackingQuerySqlServerTest.cs @@ -94,7 +94,6 @@ FROM [EntityOnes] AS [e] WHERE EXISTS ( SELECT 1 FROM [JoinOneSelfPayload] AS [j] - INNER JOIN [EntityOnes] AS [e0] ON [j].[LeftId] = [e0].[Id] WHERE [e].[Id] = [j].[RightId]) """); } @@ -130,7 +129,6 @@ FROM [EntityTwos] AS [e] WHERE ( SELECT COUNT_BIG(*) FROM [JoinTwoToThree] AS [j] - INNER JOIN [EntityThrees] AS [e0] ON [j].[ThreeId] = [e0].[Id] WHERE [e].[Id] = [j].[TwoId]) > CAST(0 AS bigint) """); } @@ -379,7 +377,7 @@ FROM [Roots] AS [r] INNER JOIN [Leaves] AS [l] ON [r].[Id] = [l].[Id] ) AS [s] ON [j].[LeafId] = [s].[Id] ) AS [s0] ON [e].[Key1] = [s0].[CompositeId1] AND [e].[Key2] = [s0].[CompositeId2] AND [e].[Key3] = [s0].[CompositeId3] -ORDER BY [e].[Key1], [e].[Key2], [e].[Key3], [s0].[LeafId], [s0].[CompositeId1], [s0].[CompositeId2], [s0].[CompositeId3] +ORDER BY [e].[Key1], [e].[Key2], [e].[Key3], [s0].[LeafId], [s0].[CompositeId1], [s0].[CompositeId2] """); } @@ -407,7 +405,7 @@ FROM [Roots] AS [r] ) AS [s] ON [e0].[RootSkipSharedId] = [s].[Id] WHERE [s].[Discriminator] = N'EntityLeaf' ) AS [s0] ON [e].[Key1] = [s0].[CompositeKeySkipSharedKey1] AND [e].[Key2] = [s0].[CompositeKeySkipSharedKey2] AND [e].[Key3] = [s0].[CompositeKeySkipSharedKey3] -ORDER BY [e].[Key1], [e].[Key2], [e].[Key3], [s0].[RootSkipSharedId], [s0].[CompositeKeySkipSharedKey1], [s0].[CompositeKeySkipSharedKey2], [s0].[CompositeKeySkipSharedKey3] +ORDER BY [e].[Key1], [e].[Key2], [e].[Key3], [s0].[RootSkipSharedId], [s0].[CompositeKeySkipSharedKey1], [s0].[CompositeKeySkipSharedKey2] """); } @@ -606,7 +604,7 @@ LEFT JOIN ( FROM [JoinOneSelfPayload] AS [j] INNER JOIN [EntityOnes] AS [e0] ON [j].[LeftId] = [e0].[Id] ) AS [s] ON [e].[Id] = [s].[RightId] -ORDER BY [e].[Id], [s].[LeftId], [s].[RightId] +ORDER BY [e].[Id], [s].[LeftId] """); } @@ -633,7 +631,7 @@ LEFT JOIN ( FROM [EntityCompositeKeyEntityTwo] AS [e3] INNER JOIN [EntityCompositeKeys] AS [e4] ON [e3].[CompositeKeySkipSharedKey1] = [e4].[Key1] AND [e3].[CompositeKeySkipSharedKey2] = [e4].[Key2] AND [e3].[CompositeKeySkipSharedKey3] = [e4].[Key3] ) AS [s1] ON [e].[Id] = [s1].[TwoSkipSharedId] -ORDER BY [e].[Id], [s].[ThreeId], [s].[TwoId], [s].[Id], [s0].[SelfSkipSharedLeftId], [s0].[SelfSkipSharedRightId], [s0].[Id], [s1].[TwoSkipSharedId], [s1].[CompositeKeySkipSharedKey1], [s1].[CompositeKeySkipSharedKey2], [s1].[CompositeKeySkipSharedKey3], [s1].[Key1], [s1].[Key2] +ORDER BY [e].[Id], [s].[ThreeId], [s].[TwoId], [s0].[SelfSkipSharedLeftId], [s0].[SelfSkipSharedRightId], [s1].[TwoSkipSharedId], [s1].[CompositeKeySkipSharedKey1], [s1].[CompositeKeySkipSharedKey2] """); } @@ -682,7 +680,7 @@ FROM [Roots] AS [r] LEFT JOIN [Leaf2s] AS [l0] ON [r].[Id] = [l0].[Id] ) AS [s] ON [e0].[RootSkipSharedId] = [s].[Id] ) AS [s0] ON [e].[Key1] = [s0].[CompositeKeySkipSharedKey1] AND [e].[Key2] = [s0].[CompositeKeySkipSharedKey2] AND [e].[Key3] = [s0].[CompositeKeySkipSharedKey3] -ORDER BY [e].[Key1], [e].[Key2], [e].[Key3], [s0].[RootSkipSharedId], [s0].[CompositeKeySkipSharedKey1], [s0].[CompositeKeySkipSharedKey2], [s0].[CompositeKeySkipSharedKey3] +ORDER BY [e].[Key1], [e].[Key2], [e].[Key3], [s0].[RootSkipSharedId], [s0].[CompositeKeySkipSharedKey1], [s0].[CompositeKeySkipSharedKey2] """); } @@ -700,7 +698,7 @@ FROM [JoinOneToTwo] AS [j] INNER JOIN [EntityOnes] AS [e0] ON [j].[OneId] = [e0].[Id] LEFT JOIN [EntityTwos] AS [e1] ON [e0].[Id] = [e1].[ReferenceInverseId] ) AS [s] ON [e].[Id] = [s].[TwoId] -ORDER BY [e].[Id], [s].[OneId], [s].[TwoId], [s].[Id] +ORDER BY [e].[Id], [s].[OneId] """); } @@ -727,7 +725,7 @@ FROM [JoinOneToBranch] AS [j0] INNER JOIN [EntityOnes] AS [e0] ON [j0].[EntityOneId] = [e0].[Id] ) AS [s0] ON [s].[Id] = [s0].[EntityBranchId] ) AS [s1] ON [e].[Key1] = [s1].[CompositeId1] AND [e].[Key2] = [s1].[CompositeId2] AND [e].[Key3] = [s1].[CompositeId3] -ORDER BY [e].[Key1], [e].[Key2], [e].[Key3], [s1].[LeafId], [s1].[CompositeId1], [s1].[CompositeId2], [s1].[CompositeId3], [s1].[Id], [s1].[EntityBranchId], [s1].[EntityOneId] +ORDER BY [e].[Key1], [e].[Key2], [e].[Key3], [s1].[LeafId], [s1].[CompositeId1], [s1].[CompositeId2], [s1].[CompositeId3], [s1].[EntityBranchId] """); } @@ -750,7 +748,7 @@ FROM [JoinOneSelfPayload] AS [j0] INNER JOIN [EntityOnes] AS [e2] ON [j0].[RightId] = [e2].[Id] ) AS [s] ON [e0].[Id] = [s].[LeftId] ) AS [s0] ON [e].[Id] = [s0].[ThreeId] -ORDER BY [e].[Id], [s0].[OneId], [s0].[ThreeId], [s0].[Id], [s0].[Id0], [s0].[LeftId], [s0].[RightId] +ORDER BY [e].[Id], [s0].[OneId], [s0].[ThreeId], [s0].[LeftId] """); } @@ -760,7 +758,7 @@ public override async Task Include_skip_navigation_and_reference(bool async) AssertSql( """ -SELECT [e].[Id], [e].[CollectionInverseId], [e].[ExtraId], [e].[Name], [e].[ReferenceInverseId], [e0].[Id], [s].[Id], [s].[Name], [s].[OneSkipSharedId], [s].[TwoSkipSharedId], [e0].[CollectionInverseId], [e0].[Name], [e0].[ReferenceInverseId] +SELECT [e].[Id], [e].[CollectionInverseId], [e].[ExtraId], [e].[Name], [e].[ReferenceInverseId], [s].[Id], [s].[Name], [s].[OneSkipSharedId], [s].[TwoSkipSharedId], [e0].[Id], [e0].[CollectionInverseId], [e0].[Name], [e0].[ReferenceInverseId] FROM [EntityTwos] AS [e] LEFT JOIN [EntityThrees] AS [e0] ON [e].[Id] = [e0].[ReferenceInverseId] LEFT JOIN ( @@ -768,7 +766,7 @@ LEFT JOIN ( FROM [EntityOneEntityTwo] AS [e1] INNER JOIN [EntityOnes] AS [e2] ON [e1].[OneSkipSharedId] = [e2].[Id] ) AS [s] ON [e].[Id] = [s].[TwoSkipSharedId] -ORDER BY [e].[Id], [e0].[Id], [s].[OneSkipSharedId], [s].[TwoSkipSharedId] +ORDER BY [e].[Id], [s].[OneSkipSharedId] """); } @@ -786,7 +784,7 @@ FROM [JoinOneToThreePayloadFullShared] AS [j] INNER JOIN [EntityOnes] AS [e0] ON [j].[OneId] = [e0].[Id] WHERE [e0].[Id] < 10 ) AS [s] ON [e].[Id] = [s].[ThreeId] -ORDER BY [e].[Id], [s].[OneId], [s].[ThreeId] +ORDER BY [e].[Id], [s].[OneId] """); } @@ -897,7 +895,7 @@ FROM [JoinOneToThreePayloadFullShared] AS [j] WHERE [e1].[Id] < 10 ) AS [s] ON [e0].[Id] = [s].[ThreeId] ) AS [s0] ON [r].[Id] = [s0].[RootSkipSharedId] -ORDER BY [r].[Id], [s0].[RootSkipSharedId], [s0].[ThreeSkipSharedId], [s0].[Id], [s0].[OneId], [s0].[ThreeId] +ORDER BY [r].[Id], [s0].[RootSkipSharedId], [s0].[ThreeSkipSharedId], [s0].[OneId] """); } @@ -931,7 +929,7 @@ FROM [JoinThreeToCompositeKeyFull] AS [j] WHERE 1 < [s].[row] AND [s].[row] <= 3 ) AS [s0] ON [e0].[Key1] = [s0].[CompositeId1] AND [e0].[Key2] = [s0].[CompositeId2] AND [e0].[Key3] = [s0].[CompositeId3] ) AS [s1] ON [r].[Id] = [s1].[RootSkipSharedId] -ORDER BY [r].[Id], [s1].[RootSkipSharedId], [s1].[CompositeKeySkipSharedKey1], [s1].[CompositeKeySkipSharedKey2], [s1].[CompositeKeySkipSharedKey3], [s1].[Key1], [s1].[Key2], [s1].[Key3], [s1].[CompositeId1], [s1].[CompositeId2], [s1].[CompositeId3], [s1].[Id] +ORDER BY [r].[Id], [s1].[RootSkipSharedId], [s1].[CompositeKeySkipSharedKey1], [s1].[CompositeKeySkipSharedKey2], [s1].[CompositeKeySkipSharedKey3], [s1].[CompositeId1], [s1].[CompositeId2], [s1].[CompositeId3], [s1].[Id] """); } @@ -956,7 +954,7 @@ FROM [EntityCompositeKeyEntityTwo] AS [e0] ) AS [s] ON [e].[Key1] = [s].[CompositeKeySkipSharedKey1] AND [e].[Key2] = [s].[CompositeKeySkipSharedKey2] AND [e].[Key3] = [s].[CompositeKeySkipSharedKey3] WHERE [e].[Key1] < 5 ) AS [s0] ON [r].[Id] = [s0].[LeafId] -ORDER BY [r].[Id], [s0].[LeafId], [s0].[CompositeId1], [s0].[CompositeId2], [s0].[CompositeId3], [s0].[Key1], [s0].[Key2], [s0].[Key3], [s0].[TwoSkipSharedId], [s0].[CompositeKeySkipSharedKey1], [s0].[CompositeKeySkipSharedKey2], [s0].[CompositeKeySkipSharedKey3] +ORDER BY [r].[Id], [s0].[LeafId], [s0].[CompositeId1], [s0].[CompositeId2], [s0].[CompositeId3], [s0].[TwoSkipSharedId], [s0].[CompositeKeySkipSharedKey1], [s0].[CompositeKeySkipSharedKey2] """); } @@ -985,7 +983,7 @@ FROM [JoinTwoToThree] AS [j0] WHERE [e1].[Id] < 10 ) AS [s0] ON [s].[Id] = [s0].[TwoId] ) AS [s1] -ORDER BY [e].[Id], [s1].[Id], [s1].[OneId], [s1].[TwoId], [s1].[ThreeId], [s1].[TwoId0] +ORDER BY [e].[Id], [s1].[Id], [s1].[OneId], [s1].[TwoId], [s1].[ThreeId] """); } @@ -1012,7 +1010,7 @@ FROM [JoinTwoToThree] AS [j0] ) AS [s0] ON [e0].[Id] = [s0].[TwoId] WHERE [e0].[Id] < 10 ) AS [s1] ON [e].[Id] = [s1].[OneId] -ORDER BY [e].[Id], [s1].[OneId], [s1].[TwoId], [s1].[Id], [s1].[TwoId0], [s1].[Id0] +ORDER BY [e].[Id], [s1].[OneId], [s1].[TwoId], [s1].[TwoId0], [s1].[Id0] """); } @@ -1032,7 +1030,7 @@ FROM [JoinOneToTwo] AS [j] LEFT JOIN [EntityTwos] AS [e2] ON [e0].[Id] = [e2].[CollectionInverseId] WHERE [e0].[Id] < 10 ) AS [s] ON [e].[Id] = [s].[TwoId] -ORDER BY [e].[Id], [s].[OneId], [s].[TwoId], [s].[Id], [s].[Id0] +ORDER BY [e].[Id], [s].[OneId], [s].[TwoId] """); } @@ -1072,7 +1070,7 @@ WHERE [s].[Id] < 20 ) AS [s2] ON [e0].[Id] = [s2].[EntityOneId] WHERE [e0].[Id] < 10 ) AS [s3] ON [e].[Id] = [s3].[ThreeId] -ORDER BY [e].[Id], [s3].[OneId], [s3].[ThreeId], [s3].[Id], [s3].[OneId0], [s3].[Id0], [s3].[TwoId], [s3].[EntityBranchId], [s3].[EntityOneId] +ORDER BY [e].[Id], [s3].[OneId], [s3].[ThreeId], [s3].[OneId0], [s3].[Id0], [s3].[TwoId], [s3].[EntityBranchId] """); } @@ -1095,7 +1093,7 @@ WHERE [e1].[Id] < 5 ) AS [e2] ON [e0].[Id] = [e2].[CollectionInverseId] WHERE [e0].[Id] > 15 ) AS [s] ON [e].[Id] = [s].[ThreeId] -ORDER BY [e].[Id], [s].[OneId], [s].[ThreeId], [s].[Id] +ORDER BY [e].[Id], [s].[OneId], [s].[ThreeId] """); } @@ -1118,7 +1116,7 @@ WHERE [e1].[Id] < 5 ) AS [s] ON [e0].[Id] = [s].[TwoId] WHERE [e0].[Id] > 15 ) AS [s0] ON [e].[Id] = [s0].[CollectionInverseId] -ORDER BY [e].[Id], [s0].[Id], [s0].[ThreeId], [s0].[TwoId] +ORDER BY [e].[Id], [s0].[Id], [s0].[ThreeId] """); } @@ -1218,11 +1216,11 @@ FROM [Roots] AS [r] INNER JOIN [Leaves] AS [l] ON [r].[Id] = [l].[Id] ) AS [s] ON [j].[LeafId] = [s].[Id] ) AS [s0] ON [e].[Key1] = [s0].[CompositeId1] AND [e].[Key2] = [s0].[CompositeId2] AND [e].[Key3] = [s0].[CompositeId3] -ORDER BY [e].[Key1], [e].[Key2], [e].[Key3], [s0].[LeafId], [s0].[CompositeId1], [s0].[CompositeId2], [s0].[CompositeId3], [s0].[Id] +ORDER BY [e].[Key1], [e].[Key2], [e].[Key3], [s0].[LeafId], [s0].[CompositeId1], [s0].[CompositeId2], [s0].[CompositeId3] """, // """ -SELECT [s1].[Id], [s1].[Name], [e].[Key1], [e].[Key2], [e].[Key3], [s0].[LeafId], [s0].[CompositeId1], [s0].[CompositeId2], [s0].[CompositeId3], [s0].[Id] +SELECT [s1].[Id], [s1].[Name], [e].[Key1], [e].[Key2], [e].[Key3], [s0].[LeafId], [s0].[CompositeId1], [s0].[CompositeId2], [s0].[CompositeId3] FROM [EntityCompositeKeys] AS [e] INNER JOIN ( SELECT [s].[Id], [j].[LeafId], [j].[CompositeId1], [j].[CompositeId2], [j].[CompositeId3] @@ -1239,7 +1237,7 @@ INNER JOIN ( FROM [JoinOneToBranch] AS [j0] INNER JOIN [EntityOnes] AS [e0] ON [j0].[EntityOneId] = [e0].[Id] ) AS [s1] ON [s0].[Id] = [s1].[EntityBranchId] -ORDER BY [e].[Key1], [e].[Key2], [e].[Key3], [s0].[LeafId], [s0].[CompositeId1], [s0].[CompositeId2], [s0].[CompositeId3], [s0].[Id] +ORDER BY [e].[Key1], [e].[Key2], [e].[Key3], [s0].[LeafId], [s0].[CompositeId1], [s0].[CompositeId2], [s0].[CompositeId3] """); } @@ -1263,24 +1261,23 @@ FROM [JoinOneToThreePayloadFull] AS [j] INNER JOIN [EntityOnes] AS [e0] ON [j].[OneId] = [e0].[Id] LEFT JOIN [EntityTwos] AS [e1] ON [e0].[Id] = [e1].[ReferenceInverseId] ) AS [s] ON [e].[Id] = [s].[ThreeId] -ORDER BY [e].[Id], [s].[OneId], [s].[ThreeId], [s].[Id], [s].[Id0] +ORDER BY [e].[Id], [s].[OneId], [s].[ThreeId] """, // """ -SELECT [s0].[Id], [s0].[Name], [e].[Id], [s].[OneId], [s].[ThreeId], [s].[Id], [s].[Id0] +SELECT [s0].[Id], [s0].[Name], [e].[Id], [s].[OneId], [s].[ThreeId] FROM [EntityThrees] AS [e] INNER JOIN ( - SELECT [e0].[Id], [e1].[Id] AS [Id0], [j].[OneId], [j].[ThreeId] + SELECT [e0].[Id], [j].[OneId], [j].[ThreeId] FROM [JoinOneToThreePayloadFull] AS [j] INNER JOIN [EntityOnes] AS [e0] ON [j].[OneId] = [e0].[Id] - LEFT JOIN [EntityTwos] AS [e1] ON [e0].[Id] = [e1].[ReferenceInverseId] ) AS [s] ON [e].[Id] = [s].[ThreeId] INNER JOIN ( SELECT [e2].[Id], [e2].[Name], [j0].[LeftId] FROM [JoinOneSelfPayload] AS [j0] INNER JOIN [EntityOnes] AS [e2] ON [j0].[RightId] = [e2].[Id] ) AS [s0] ON [s].[Id] = [s0].[LeftId] -ORDER BY [e].[Id], [s].[OneId], [s].[ThreeId], [s].[Id], [s].[Id0] +ORDER BY [e].[Id], [s].[OneId], [s].[ThreeId] """); } @@ -1293,19 +1290,18 @@ public override async Task Include_skip_navigation_and_reference_split(bool asyn SELECT [e].[Id], [e].[CollectionInverseId], [e].[ExtraId], [e].[Name], [e].[ReferenceInverseId], [e0].[Id], [e0].[CollectionInverseId], [e0].[Name], [e0].[ReferenceInverseId] FROM [EntityTwos] AS [e] LEFT JOIN [EntityThrees] AS [e0] ON [e].[Id] = [e0].[ReferenceInverseId] -ORDER BY [e].[Id], [e0].[Id] +ORDER BY [e].[Id] """, // """ -SELECT [s].[Id], [s].[Name], [e].[Id], [e0].[Id] +SELECT [s].[Id], [s].[Name], [e].[Id] FROM [EntityTwos] AS [e] -LEFT JOIN [EntityThrees] AS [e0] ON [e].[Id] = [e0].[ReferenceInverseId] INNER JOIN ( SELECT [e2].[Id], [e2].[Name], [e1].[TwoSkipSharedId] FROM [EntityOneEntityTwo] AS [e1] INNER JOIN [EntityOnes] AS [e2] ON [e1].[OneSkipSharedId] = [e2].[Id] ) AS [s] ON [e].[Id] = [s].[TwoSkipSharedId] -ORDER BY [e].[Id], [e0].[Id] +ORDER BY [e].[Id] """); } @@ -1464,11 +1460,11 @@ INNER JOIN ( FROM [EntityRootEntityThree] AS [e] INNER JOIN [EntityThrees] AS [e0] ON [e].[ThreeSkipSharedId] = [e0].[Id] ) AS [s] ON [r].[Id] = [s].[RootSkipSharedId] -ORDER BY [r].[Id], [s].[RootSkipSharedId], [s].[ThreeSkipSharedId], [s].[Id] +ORDER BY [r].[Id], [s].[RootSkipSharedId], [s].[ThreeSkipSharedId] """, // """ -SELECT [s0].[Id], [s0].[Name], [r].[Id], [s].[RootSkipSharedId], [s].[ThreeSkipSharedId], [s].[Id] +SELECT [s0].[Id], [s0].[Name], [r].[Id], [s].[RootSkipSharedId], [s].[ThreeSkipSharedId] FROM [Roots] AS [r] INNER JOIN ( SELECT [e0].[Id], [e].[RootSkipSharedId], [e].[ThreeSkipSharedId] @@ -1481,7 +1477,7 @@ FROM [JoinOneToThreePayloadFullShared] AS [j] INNER JOIN [EntityOnes] AS [e1] ON [j].[OneId] = [e1].[Id] WHERE [e1].[Id] < 10 ) AS [s0] ON [s].[Id] = [s0].[ThreeId] -ORDER BY [r].[Id], [s].[RootSkipSharedId], [s].[ThreeSkipSharedId], [s].[Id] +ORDER BY [r].[Id], [s].[RootSkipSharedId], [s].[ThreeSkipSharedId] """); } @@ -1512,11 +1508,11 @@ INNER JOIN ( FROM [EntityCompositeKeyEntityRoot] AS [e] INNER JOIN [EntityCompositeKeys] AS [e0] ON [e].[CompositeKeySkipSharedKey1] = [e0].[Key1] AND [e].[CompositeKeySkipSharedKey2] = [e0].[Key2] AND [e].[CompositeKeySkipSharedKey3] = [e0].[Key3] ) AS [s] ON [r].[Id] = [s].[RootSkipSharedId] -ORDER BY [r].[Id], [s].[RootSkipSharedId], [s].[CompositeKeySkipSharedKey1], [s].[CompositeKeySkipSharedKey2], [s].[CompositeKeySkipSharedKey3], [s].[Key1], [s].[Key2], [s].[Key3] +ORDER BY [r].[Id], [s].[RootSkipSharedId], [s].[CompositeKeySkipSharedKey1], [s].[CompositeKeySkipSharedKey2], [s].[CompositeKeySkipSharedKey3] """, // """ -SELECT [s1].[Id], [s1].[CollectionInverseId], [s1].[Name], [s1].[ReferenceInverseId], [r].[Id], [s].[RootSkipSharedId], [s].[CompositeKeySkipSharedKey1], [s].[CompositeKeySkipSharedKey2], [s].[CompositeKeySkipSharedKey3], [s].[Key1], [s].[Key2], [s].[Key3] +SELECT [s1].[Id], [s1].[CollectionInverseId], [s1].[Name], [s1].[ReferenceInverseId], [r].[Id], [s].[RootSkipSharedId], [s].[CompositeKeySkipSharedKey1], [s].[CompositeKeySkipSharedKey2], [s].[CompositeKeySkipSharedKey3] FROM [Roots] AS [r] INNER JOIN ( SELECT [e0].[Key1], [e0].[Key2], [e0].[Key3], [e].[RootSkipSharedId], [e].[CompositeKeySkipSharedKey1], [e].[CompositeKeySkipSharedKey2], [e].[CompositeKeySkipSharedKey3] @@ -1532,7 +1528,7 @@ FROM [JoinThreeToCompositeKeyFull] AS [j] ) AS [s0] WHERE 1 < [s0].[row] AND [s0].[row] <= 3 ) AS [s1] ON [s].[Key1] = [s1].[CompositeId1] AND [s].[Key2] = [s1].[CompositeId2] AND [s].[Key3] = [s1].[CompositeId3] -ORDER BY [r].[Id], [s].[RootSkipSharedId], [s].[CompositeKeySkipSharedKey1], [s].[CompositeKeySkipSharedKey2], [s].[CompositeKeySkipSharedKey3], [s].[Key1], [s].[Key2], [s].[Key3], [s1].[CompositeId1], [s1].[CompositeId2], [s1].[CompositeId3], [s1].[Id] +ORDER BY [r].[Id], [s].[RootSkipSharedId], [s].[CompositeKeySkipSharedKey1], [s].[CompositeKeySkipSharedKey2], [s].[CompositeKeySkipSharedKey3], [s1].[CompositeId1], [s1].[CompositeId2], [s1].[CompositeId3], [s1].[Id] """); } @@ -1560,11 +1556,11 @@ FROM [JoinCompositeKeyToLeaf] AS [j] INNER JOIN [EntityCompositeKeys] AS [e] ON [j].[CompositeId1] = [e].[Key1] AND [j].[CompositeId2] = [e].[Key2] AND [j].[CompositeId3] = [e].[Key3] WHERE [e].[Key1] < 5 ) AS [s] ON [r].[Id] = [s].[LeafId] -ORDER BY [r].[Id], [s].[LeafId], [s].[CompositeId1], [s].[CompositeId2], [s].[CompositeId3], [s].[Key1], [s].[Key2], [s].[Key3] +ORDER BY [r].[Id], [s].[LeafId], [s].[CompositeId1], [s].[CompositeId2], [s].[CompositeId3] """, // """ -SELECT [s0].[Id], [s0].[CollectionInverseId], [s0].[ExtraId], [s0].[Name], [s0].[ReferenceInverseId], [r].[Id], [s].[LeafId], [s].[CompositeId1], [s].[CompositeId2], [s].[CompositeId3], [s].[Key1], [s].[Key2], [s].[Key3] +SELECT [s0].[Id], [s0].[CollectionInverseId], [s0].[ExtraId], [s0].[Name], [s0].[ReferenceInverseId], [r].[Id], [s].[LeafId], [s].[CompositeId1], [s].[CompositeId2], [s].[CompositeId3] FROM [Roots] AS [r] INNER JOIN [Branches] AS [b] ON [r].[Id] = [b].[Id] INNER JOIN [Leaves] AS [l] ON [r].[Id] = [l].[Id] @@ -1579,7 +1575,7 @@ INNER JOIN ( FROM [EntityCompositeKeyEntityTwo] AS [e0] INNER JOIN [EntityTwos] AS [e1] ON [e0].[TwoSkipSharedId] = [e1].[Id] ) AS [s0] ON [s].[Key1] = [s0].[CompositeKeySkipSharedKey1] AND [s].[Key2] = [s0].[CompositeKeySkipSharedKey2] AND [s].[Key3] = [s0].[CompositeKeySkipSharedKey3] -ORDER BY [r].[Id], [s].[LeafId], [s].[CompositeId1], [s].[CompositeId2], [s].[CompositeId3], [s].[Key1], [s].[Key2], [s].[Key3] +ORDER BY [r].[Id], [s].[LeafId], [s].[CompositeId1], [s].[CompositeId2], [s].[CompositeId3] """); } @@ -1610,7 +1606,7 @@ FROM [JoinOneToTwo] AS [j] """, // """ -SELECT [s1].[Id], [s1].[CollectionInverseId], [s1].[Name], [s1].[ReferenceInverseId], [e].[Id], [s0].[OneId], [s0].[TwoId], [s0].[Id] +SELECT [s1].[Id], [s1].[CollectionInverseId], [s1].[Name], [s1].[ReferenceInverseId], [e].[Id], [s0].[OneId], [s0].[TwoId] FROM [EntityOnes] AS [e] INNER JOIN ( SELECT [s].[Id], [s].[OneId], [s].[TwoId] @@ -1651,11 +1647,11 @@ FROM [JoinOneToTwo] AS [j] INNER JOIN [EntityTwos] AS [e0] ON [j].[TwoId] = [e0].[Id] WHERE [e0].[Id] < 10 ) AS [s] ON [e].[Id] = [s].[OneId] -ORDER BY [e].[Id], [s].[OneId], [s].[TwoId], [s].[Id] +ORDER BY [e].[Id], [s].[OneId], [s].[TwoId] """, // """ -SELECT [s1].[Id], [s1].[CollectionInverseId], [s1].[Name], [s1].[ReferenceInverseId], [e].[Id], [s].[OneId], [s].[TwoId], [s].[Id] +SELECT [s1].[Id], [s1].[CollectionInverseId], [s1].[Name], [s1].[ReferenceInverseId], [e].[Id], [s].[OneId], [s].[TwoId] FROM [EntityOnes] AS [e] INNER JOIN ( SELECT [e0].[Id], [j].[OneId], [j].[TwoId] @@ -1672,7 +1668,7 @@ FROM [JoinTwoToThree] AS [j0] ) AS [s0] WHERE 1 < [s0].[row] AND [s0].[row] <= 3 ) AS [s1] ON [s].[Id] = [s1].[TwoId] -ORDER BY [e].[Id], [s].[OneId], [s].[TwoId], [s].[Id], [s1].[TwoId], [s1].[Id] +ORDER BY [e].[Id], [s].[OneId], [s].[TwoId], [s1].[TwoId], [s1].[Id] """); } @@ -1697,21 +1693,20 @@ FROM [JoinOneToTwo] AS [j] LEFT JOIN [EntityTwos] AS [e1] ON [e0].[Id] = [e1].[ReferenceInverseId] WHERE [e0].[Id] < 10 ) AS [s] ON [e].[Id] = [s].[TwoId] -ORDER BY [e].[Id], [s].[OneId], [s].[TwoId], [s].[Id], [s].[Id0] +ORDER BY [e].[Id], [s].[OneId], [s].[TwoId] """, // """ -SELECT [e2].[Id], [e2].[CollectionInverseId], [e2].[ExtraId], [e2].[Name], [e2].[ReferenceInverseId], [e].[Id], [s].[OneId], [s].[TwoId], [s].[Id], [s].[Id0] +SELECT [e2].[Id], [e2].[CollectionInverseId], [e2].[ExtraId], [e2].[Name], [e2].[ReferenceInverseId], [e].[Id], [s].[OneId], [s].[TwoId] FROM [EntityTwos] AS [e] INNER JOIN ( - SELECT [e0].[Id], [e1].[Id] AS [Id0], [j].[OneId], [j].[TwoId] + SELECT [e0].[Id], [j].[OneId], [j].[TwoId] FROM [JoinOneToTwo] AS [j] INNER JOIN [EntityOnes] AS [e0] ON [j].[OneId] = [e0].[Id] - LEFT JOIN [EntityTwos] AS [e1] ON [e0].[Id] = [e1].[ReferenceInverseId] WHERE [e0].[Id] < 10 ) AS [s] ON [e].[Id] = [s].[TwoId] INNER JOIN [EntityTwos] AS [e2] ON [s].[Id] = [e2].[CollectionInverseId] -ORDER BY [e].[Id], [s].[OneId], [s].[TwoId], [s].[Id], [s].[Id0] +ORDER BY [e].[Id], [s].[OneId], [s].[TwoId] """); } @@ -1735,11 +1730,11 @@ FROM [JoinOneToThreePayloadFull] AS [j] INNER JOIN [EntityOnes] AS [e0] ON [j].[OneId] = [e0].[Id] WHERE [e0].[Id] < 10 ) AS [s0] ON [e].[Id] = [s0].[ThreeId] -ORDER BY [e].[Id], [s0].[OneId], [s0].[ThreeId], [s0].[Id] +ORDER BY [e].[Id], [s0].[OneId], [s0].[ThreeId] """, // """ -SELECT [s2].[Id], [s2].[CollectionInverseId], [s2].[ExtraId], [s2].[Name], [s2].[ReferenceInverseId], [e].[Id], [s0].[OneId], [s0].[ThreeId], [s0].[Id] +SELECT [s2].[Id], [s2].[CollectionInverseId], [s2].[ExtraId], [s2].[Name], [s2].[ReferenceInverseId], [e].[Id], [s0].[OneId], [s0].[ThreeId] FROM [EntityThrees] AS [e] INNER JOIN ( SELECT [e0].[Id], [j].[OneId], [j].[ThreeId] @@ -1756,11 +1751,11 @@ FROM [JoinOneToTwo] AS [j0] ) AS [s1] WHERE 1 < [s1].[row] AND [s1].[row] <= 3 ) AS [s2] ON [s0].[Id] = [s2].[OneId] -ORDER BY [e].[Id], [s0].[OneId], [s0].[ThreeId], [s0].[Id], [s2].[OneId], [s2].[Id] +ORDER BY [e].[Id], [s0].[OneId], [s0].[ThreeId], [s2].[OneId], [s2].[Id] """, // """ -SELECT [s3].[Id], [s3].[Name], [s3].[Number], [s3].[IsGreen], [s3].[Discriminator], [e].[Id], [s0].[OneId], [s0].[ThreeId], [s0].[Id] +SELECT [s3].[Id], [s3].[Name], [s3].[Number], [s3].[IsGreen], [s3].[Discriminator], [e].[Id], [s0].[OneId], [s0].[ThreeId] FROM [EntityThrees] AS [e] INNER JOIN ( SELECT [e0].[Id], [j].[OneId], [j].[ThreeId] @@ -1781,7 +1776,7 @@ FROM [Roots] AS [r] ) AS [s] ON [j1].[EntityBranchId] = [s].[Id] WHERE [s].[Id] < 20 ) AS [s3] ON [s0].[Id] = [s3].[EntityOneId] -ORDER BY [e].[Id], [s0].[OneId], [s0].[ThreeId], [s0].[Id] +ORDER BY [e].[Id], [s0].[OneId], [s0].[ThreeId] """); } @@ -1805,11 +1800,11 @@ FROM [JoinOneToThreePayloadFull] AS [j] INNER JOIN [EntityOnes] AS [e0] ON [j].[OneId] = [e0].[Id] WHERE [e0].[Id] > 15 ) AS [s] ON [e].[Id] = [s].[ThreeId] -ORDER BY [e].[Id], [s].[OneId], [s].[ThreeId], [s].[Id] +ORDER BY [e].[Id], [s].[OneId], [s].[ThreeId] """, // """ -SELECT [e2].[Id], [e2].[CollectionInverseId], [e2].[ExtraId], [e2].[Name], [e2].[ReferenceInverseId], [e].[Id], [s].[OneId], [s].[ThreeId], [s].[Id] +SELECT [e2].[Id], [e2].[CollectionInverseId], [e2].[ExtraId], [e2].[Name], [e2].[ReferenceInverseId], [e].[Id], [s].[OneId], [s].[ThreeId] FROM [EntityThrees] AS [e] INNER JOIN ( SELECT [e0].[Id], [j].[OneId], [j].[ThreeId] @@ -1822,7 +1817,7 @@ INNER JOIN ( FROM [EntityTwos] AS [e1] WHERE [e1].[Id] < 5 ) AS [e2] ON [s].[Id] = [e2].[CollectionInverseId] -ORDER BY [e].[Id], [s].[OneId], [s].[ThreeId], [s].[Id] +ORDER BY [e].[Id], [s].[OneId], [s].[ThreeId] """); } @@ -2058,7 +2053,7 @@ FROM [JoinTwoToThree] AS [j0] WHERE [e1].[Id] < 10 ) AS [s0] ON [s].[Id] = [s0].[TwoId] ) AS [s1] -ORDER BY [e].[Id], [s1].[Id], [s1].[OneId], [s1].[TwoId], [s1].[ThreeId], [s1].[TwoId0] +ORDER BY [e].[Id], [s1].[Id], [s1].[OneId], [s1].[TwoId], [s1].[ThreeId] """); } @@ -2128,7 +2123,6 @@ FROM [UnidirectionalEntityOnes] AS [u] WHERE EXISTS ( SELECT 1 FROM [UnidirectionalJoinOneSelfPayload] AS [u0] - INNER JOIN [UnidirectionalEntityOnes] AS [u1] ON [u0].[LeftId] = [u1].[Id] WHERE [u].[Id] = [u0].[RightId]) """); } @@ -2212,7 +2206,7 @@ FROM [UnidirectionalRoots] AS [u1] ) AS [s] ON [u0].[RootSkipSharedId] = [s].[Id] WHERE [s].[Discriminator] = N'UnidirectionalEntityLeaf' ) AS [s0] ON [u].[Key1] = [s0].[UnidirectionalEntityCompositeKeyKey1] AND [u].[Key2] = [s0].[UnidirectionalEntityCompositeKeyKey2] AND [u].[Key3] = [s0].[UnidirectionalEntityCompositeKeyKey3] -ORDER BY [u].[Key1], [u].[Key2], [u].[Key3], [s0].[RootSkipSharedId], [s0].[UnidirectionalEntityCompositeKeyKey1], [s0].[UnidirectionalEntityCompositeKeyKey2], [s0].[UnidirectionalEntityCompositeKeyKey3] +ORDER BY [u].[Key1], [u].[Key2], [u].[Key3], [s0].[RootSkipSharedId], [s0].[UnidirectionalEntityCompositeKeyKey1], [s0].[UnidirectionalEntityCompositeKeyKey2] """); } @@ -2364,7 +2358,7 @@ LEFT JOIN ( FROM [UnidirectionalJoinOneSelfPayload] AS [u0] INNER JOIN [UnidirectionalEntityOnes] AS [u1] ON [u0].[LeftId] = [u1].[Id] ) AS [s] ON [u].[Id] = [s].[RightId] -ORDER BY [u].[Id], [s].[LeftId], [s].[RightId] +ORDER BY [u].[Id], [s].[LeftId] """); } @@ -2389,7 +2383,7 @@ FROM [UnidirectionalRoots] AS [u1] LEFT JOIN [UnidirectionalLeaves] AS [u3] ON [u1].[Id] = [u3].[Id] ) AS [s] ON [u0].[RootSkipSharedId] = [s].[Id] ) AS [s0] ON [u].[Key1] = [s0].[UnidirectionalEntityCompositeKeyKey1] AND [u].[Key2] = [s0].[UnidirectionalEntityCompositeKeyKey2] AND [u].[Key3] = [s0].[UnidirectionalEntityCompositeKeyKey3] -ORDER BY [u].[Key1], [u].[Key2], [u].[Key3], [s0].[RootSkipSharedId], [s0].[UnidirectionalEntityCompositeKeyKey1], [s0].[UnidirectionalEntityCompositeKeyKey2], [s0].[UnidirectionalEntityCompositeKeyKey3] +ORDER BY [u].[Key1], [u].[Key2], [u].[Key3], [s0].[RootSkipSharedId], [s0].[UnidirectionalEntityCompositeKeyKey1], [s0].[UnidirectionalEntityCompositeKeyKey2] """); } @@ -2407,7 +2401,7 @@ FROM [UnidirectionalJoinOneToTwo] AS [u0] INNER JOIN [UnidirectionalEntityOnes] AS [u1] ON [u0].[OneId] = [u1].[Id] LEFT JOIN [UnidirectionalEntityTwos] AS [u2] ON [u1].[Id] = [u2].[ReferenceInverseId] ) AS [s] ON [u].[Id] = [s].[TwoId] -ORDER BY [u].[Id], [s].[OneId], [s].[TwoId], [s].[Id] +ORDER BY [u].[Id], [s].[OneId] """); } @@ -2434,7 +2428,7 @@ FROM [UnidirectionalJoinOneToBranch] AS [u4] INNER JOIN [UnidirectionalEntityOnes] AS [u5] ON [u4].[UnidirectionalEntityOneId] = [u5].[Id] ) AS [s0] ON [s].[Id] = [s0].[UnidirectionalEntityBranchId] ) AS [s1] ON [u].[Key1] = [s1].[CompositeId1] AND [u].[Key2] = [s1].[CompositeId2] AND [u].[Key3] = [s1].[CompositeId3] -ORDER BY [u].[Key1], [u].[Key2], [u].[Key3], [s1].[LeafId], [s1].[CompositeId1], [s1].[CompositeId2], [s1].[CompositeId3], [s1].[Id], [s1].[UnidirectionalEntityBranchId], [s1].[UnidirectionalEntityOneId] +ORDER BY [u].[Key1], [u].[Key2], [u].[Key3], [s1].[LeafId], [s1].[CompositeId1], [s1].[CompositeId2], [s1].[CompositeId3], [s1].[UnidirectionalEntityBranchId] """); } @@ -2457,7 +2451,7 @@ FROM [UnidirectionalJoinOneSelfPayload] AS [u3] INNER JOIN [UnidirectionalEntityOnes] AS [u4] ON [u3].[RightId] = [u4].[Id] ) AS [s] ON [u1].[Id] = [s].[LeftId] ) AS [s0] ON [u].[Id] = [s0].[ThreeId] -ORDER BY [u].[Id], [s0].[OneId], [s0].[ThreeId], [s0].[Id], [s0].[Id0], [s0].[LeftId], [s0].[RightId] +ORDER BY [u].[Id], [s0].[OneId], [s0].[ThreeId], [s0].[LeftId] """); } @@ -2467,7 +2461,7 @@ public override async Task Include_skip_navigation_and_reference_unidirectional( AssertSql( """ -SELECT [u].[Id], [u].[CollectionInverseId], [u].[ExtraId], [u].[Name], [u].[ReferenceInverseId], [u0].[Id], [s].[Id], [s].[Name], [s].[TwoSkipSharedId], [s].[UnidirectionalEntityOneId], [u0].[CollectionInverseId], [u0].[Name], [u0].[ReferenceInverseId] +SELECT [u].[Id], [u].[CollectionInverseId], [u].[ExtraId], [u].[Name], [u].[ReferenceInverseId], [s].[Id], [s].[Name], [s].[TwoSkipSharedId], [s].[UnidirectionalEntityOneId], [u0].[Id], [u0].[CollectionInverseId], [u0].[Name], [u0].[ReferenceInverseId] FROM [UnidirectionalEntityTwos] AS [u] LEFT JOIN [UnidirectionalEntityThrees] AS [u0] ON [u].[Id] = [u0].[ReferenceInverseId] LEFT JOIN ( @@ -2475,7 +2469,7 @@ LEFT JOIN ( FROM [UnidirectionalEntityOneUnidirectionalEntityTwo] AS [u1] INNER JOIN [UnidirectionalEntityOnes] AS [u2] ON [u1].[UnidirectionalEntityOneId] = [u2].[Id] ) AS [s] ON [u].[Id] = [s].[TwoSkipSharedId] -ORDER BY [u].[Id], [u0].[Id], [s].[TwoSkipSharedId], [s].[UnidirectionalEntityOneId] +ORDER BY [u].[Id], [s].[TwoSkipSharedId] """); } @@ -2493,7 +2487,7 @@ FROM [JoinOneToThreePayloadFullShared] AS [j] INNER JOIN [EntityOnes] AS [e0] ON [j].[OneId] = [e0].[Id] WHERE [e0].[Id] < 10 ) AS [s] ON [e].[Id] = [s].[ThreeId] -ORDER BY [e].[Id], [s].[OneId], [s].[ThreeId] +ORDER BY [e].[Id], [s].[OneId] """); } @@ -2596,7 +2590,7 @@ FROM [UnidirectionalEntityCompositeKeyUnidirectionalEntityTwo] AS [u4] ) AS [s] ON [u3].[Key1] = [s].[UnidirectionalEntityCompositeKeyKey1] AND [u3].[Key2] = [s].[UnidirectionalEntityCompositeKeyKey2] AND [u3].[Key3] = [s].[UnidirectionalEntityCompositeKeyKey3] WHERE [u3].[Key1] < 5 ) AS [s0] ON [u].[Id] = [s0].[LeafId] -ORDER BY [u].[Id], [s0].[LeafId], [s0].[CompositeId1], [s0].[CompositeId2], [s0].[CompositeId3], [s0].[Key1], [s0].[Key2], [s0].[Key3], [s0].[TwoSkipSharedId], [s0].[UnidirectionalEntityCompositeKeyKey1], [s0].[UnidirectionalEntityCompositeKeyKey2], [s0].[UnidirectionalEntityCompositeKeyKey3] +ORDER BY [u].[Id], [s0].[LeafId], [s0].[CompositeId1], [s0].[CompositeId2], [s0].[CompositeId3], [s0].[TwoSkipSharedId], [s0].[UnidirectionalEntityCompositeKeyKey1], [s0].[UnidirectionalEntityCompositeKeyKey2] """); } @@ -2616,7 +2610,7 @@ FROM [JoinOneToTwo] AS [j] LEFT JOIN [EntityTwos] AS [e2] ON [e0].[Id] = [e2].[CollectionInverseId] WHERE [e0].[Id] < 10 ) AS [s] ON [e].[Id] = [s].[TwoId] -ORDER BY [e].[Id], [s].[OneId], [s].[TwoId], [s].[Id], [s].[Id0] +ORDER BY [e].[Id], [s].[OneId], [s].[TwoId] """); } diff --git a/test/EFCore.SqlServer.FunctionalTests/Query/Inheritance/TPTManyToManyQuerySqlServerTest.cs b/test/EFCore.SqlServer.FunctionalTests/Query/Inheritance/TPTManyToManyQuerySqlServerTest.cs index 05ba2fb710b..1ca70e15275 100644 --- a/test/EFCore.SqlServer.FunctionalTests/Query/Inheritance/TPTManyToManyQuerySqlServerTest.cs +++ b/test/EFCore.SqlServer.FunctionalTests/Query/Inheritance/TPTManyToManyQuerySqlServerTest.cs @@ -93,7 +93,6 @@ FROM [EntityOnes] AS [e] WHERE EXISTS ( SELECT 1 FROM [JoinOneSelfPayload] AS [j] - INNER JOIN [EntityOnes] AS [e0] ON [j].[LeftId] = [e0].[Id] WHERE [e].[Id] = [j].[RightId]) """); } @@ -129,7 +128,6 @@ FROM [EntityTwos] AS [e] WHERE ( SELECT COUNT_BIG(*) FROM [JoinTwoToThree] AS [j] - INNER JOIN [EntityThrees] AS [e0] ON [j].[ThreeId] = [e0].[Id] WHERE [e].[Id] = [j].[TwoId]) > CAST(0 AS bigint) """); } @@ -378,7 +376,7 @@ FROM [Roots] AS [r] INNER JOIN [Leaves] AS [l] ON [r].[Id] = [l].[Id] ) AS [s] ON [j].[LeafId] = [s].[Id] ) AS [s0] ON [e].[Key1] = [s0].[CompositeId1] AND [e].[Key2] = [s0].[CompositeId2] AND [e].[Key3] = [s0].[CompositeId3] -ORDER BY [e].[Key1], [e].[Key2], [e].[Key3], [s0].[LeafId], [s0].[CompositeId1], [s0].[CompositeId2], [s0].[CompositeId3] +ORDER BY [e].[Key1], [e].[Key2], [e].[Key3], [s0].[LeafId], [s0].[CompositeId1], [s0].[CompositeId2] """); } @@ -406,7 +404,7 @@ FROM [Roots] AS [r] ) AS [s] ON [e0].[RootSkipSharedId] = [s].[Id] WHERE [s].[Discriminator] = N'EntityLeaf' ) AS [s0] ON [e].[Key1] = [s0].[CompositeKeySkipSharedKey1] AND [e].[Key2] = [s0].[CompositeKeySkipSharedKey2] AND [e].[Key3] = [s0].[CompositeKeySkipSharedKey3] -ORDER BY [e].[Key1], [e].[Key2], [e].[Key3], [s0].[RootSkipSharedId], [s0].[CompositeKeySkipSharedKey1], [s0].[CompositeKeySkipSharedKey2], [s0].[CompositeKeySkipSharedKey3] +ORDER BY [e].[Key1], [e].[Key2], [e].[Key3], [s0].[RootSkipSharedId], [s0].[CompositeKeySkipSharedKey1], [s0].[CompositeKeySkipSharedKey2] """); } @@ -605,7 +603,7 @@ LEFT JOIN ( FROM [JoinOneSelfPayload] AS [j] INNER JOIN [EntityOnes] AS [e0] ON [j].[LeftId] = [e0].[Id] ) AS [s] ON [e].[Id] = [s].[RightId] -ORDER BY [e].[Id], [s].[LeftId], [s].[RightId] +ORDER BY [e].[Id], [s].[LeftId] """); } @@ -632,7 +630,7 @@ LEFT JOIN ( FROM [EntityCompositeKeyEntityTwo] AS [e3] INNER JOIN [EntityCompositeKeys] AS [e4] ON [e3].[CompositeKeySkipSharedKey1] = [e4].[Key1] AND [e3].[CompositeKeySkipSharedKey2] = [e4].[Key2] AND [e3].[CompositeKeySkipSharedKey3] = [e4].[Key3] ) AS [s1] ON [e].[Id] = [s1].[TwoSkipSharedId] -ORDER BY [e].[Id], [s].[ThreeId], [s].[TwoId], [s].[Id], [s0].[SelfSkipSharedLeftId], [s0].[SelfSkipSharedRightId], [s0].[Id], [s1].[TwoSkipSharedId], [s1].[CompositeKeySkipSharedKey1], [s1].[CompositeKeySkipSharedKey2], [s1].[CompositeKeySkipSharedKey3], [s1].[Key1], [s1].[Key2] +ORDER BY [e].[Id], [s].[ThreeId], [s].[TwoId], [s0].[SelfSkipSharedLeftId], [s0].[SelfSkipSharedRightId], [s1].[TwoSkipSharedId], [s1].[CompositeKeySkipSharedKey1], [s1].[CompositeKeySkipSharedKey2] """); } @@ -681,7 +679,7 @@ FROM [Roots] AS [r] LEFT JOIN [Leaf2s] AS [l0] ON [r].[Id] = [l0].[Id] ) AS [s] ON [e0].[RootSkipSharedId] = [s].[Id] ) AS [s0] ON [e].[Key1] = [s0].[CompositeKeySkipSharedKey1] AND [e].[Key2] = [s0].[CompositeKeySkipSharedKey2] AND [e].[Key3] = [s0].[CompositeKeySkipSharedKey3] -ORDER BY [e].[Key1], [e].[Key2], [e].[Key3], [s0].[RootSkipSharedId], [s0].[CompositeKeySkipSharedKey1], [s0].[CompositeKeySkipSharedKey2], [s0].[CompositeKeySkipSharedKey3] +ORDER BY [e].[Key1], [e].[Key2], [e].[Key3], [s0].[RootSkipSharedId], [s0].[CompositeKeySkipSharedKey1], [s0].[CompositeKeySkipSharedKey2] """); } @@ -699,7 +697,7 @@ FROM [JoinOneToTwo] AS [j] INNER JOIN [EntityOnes] AS [e0] ON [j].[OneId] = [e0].[Id] LEFT JOIN [EntityTwos] AS [e1] ON [e0].[Id] = [e1].[ReferenceInverseId] ) AS [s] ON [e].[Id] = [s].[TwoId] -ORDER BY [e].[Id], [s].[OneId], [s].[TwoId], [s].[Id] +ORDER BY [e].[Id], [s].[OneId] """); } @@ -726,7 +724,7 @@ FROM [JoinOneToBranch] AS [j0] INNER JOIN [EntityOnes] AS [e0] ON [j0].[EntityOneId] = [e0].[Id] ) AS [s0] ON [s].[Id] = [s0].[EntityBranchId] ) AS [s1] ON [e].[Key1] = [s1].[CompositeId1] AND [e].[Key2] = [s1].[CompositeId2] AND [e].[Key3] = [s1].[CompositeId3] -ORDER BY [e].[Key1], [e].[Key2], [e].[Key3], [s1].[LeafId], [s1].[CompositeId1], [s1].[CompositeId2], [s1].[CompositeId3], [s1].[Id], [s1].[EntityBranchId], [s1].[EntityOneId] +ORDER BY [e].[Key1], [e].[Key2], [e].[Key3], [s1].[LeafId], [s1].[CompositeId1], [s1].[CompositeId2], [s1].[CompositeId3], [s1].[EntityBranchId] """); } @@ -749,7 +747,7 @@ FROM [JoinOneSelfPayload] AS [j0] INNER JOIN [EntityOnes] AS [e2] ON [j0].[RightId] = [e2].[Id] ) AS [s] ON [e0].[Id] = [s].[LeftId] ) AS [s0] ON [e].[Id] = [s0].[ThreeId] -ORDER BY [e].[Id], [s0].[OneId], [s0].[ThreeId], [s0].[Id], [s0].[Id0], [s0].[LeftId], [s0].[RightId] +ORDER BY [e].[Id], [s0].[OneId], [s0].[ThreeId], [s0].[LeftId] """); } @@ -759,7 +757,7 @@ public override async Task Include_skip_navigation_and_reference(bool async) AssertSql( """ -SELECT [e].[Id], [e].[CollectionInverseId], [e].[ExtraId], [e].[Name], [e].[ReferenceInverseId], [e0].[Id], [s].[OneSkipSharedId], [s].[TwoSkipSharedId], [s].[Id], [s].[Name], [e0].[CollectionInverseId], [e0].[Name], [e0].[ReferenceInverseId] +SELECT [e].[Id], [e].[CollectionInverseId], [e].[ExtraId], [e].[Name], [e].[ReferenceInverseId], [s].[OneSkipSharedId], [s].[TwoSkipSharedId], [s].[Id], [s].[Name], [e0].[Id], [e0].[CollectionInverseId], [e0].[Name], [e0].[ReferenceInverseId] FROM [EntityTwos] AS [e] LEFT JOIN [EntityThrees] AS [e0] ON [e].[Id] = [e0].[ReferenceInverseId] LEFT JOIN ( @@ -767,7 +765,7 @@ LEFT JOIN ( FROM [EntityOneEntityTwo] AS [e1] INNER JOIN [EntityOnes] AS [e2] ON [e1].[OneSkipSharedId] = [e2].[Id] ) AS [s] ON [e].[Id] = [s].[TwoSkipSharedId] -ORDER BY [e].[Id], [e0].[Id], [s].[OneSkipSharedId], [s].[TwoSkipSharedId] +ORDER BY [e].[Id], [s].[OneSkipSharedId] """); } @@ -785,7 +783,7 @@ FROM [JoinOneToThreePayloadFullShared] AS [j] INNER JOIN [EntityOnes] AS [e0] ON [j].[OneId] = [e0].[Id] WHERE [e0].[Id] < 10 ) AS [s] ON [e].[Id] = [s].[ThreeId] -ORDER BY [e].[Id], [s].[OneId], [s].[ThreeId] +ORDER BY [e].[Id], [s].[OneId] """); } @@ -896,7 +894,7 @@ FROM [JoinOneToThreePayloadFullShared] AS [j] WHERE [e1].[Id] < 10 ) AS [s] ON [e0].[Id] = [s].[ThreeId] ) AS [s0] ON [r].[Id] = [s0].[RootSkipSharedId] -ORDER BY [r].[Id], [s0].[RootSkipSharedId], [s0].[ThreeSkipSharedId], [s0].[Id], [s0].[OneId], [s0].[ThreeId] +ORDER BY [r].[Id], [s0].[RootSkipSharedId], [s0].[ThreeSkipSharedId], [s0].[OneId] """); } @@ -930,7 +928,7 @@ FROM [JoinThreeToCompositeKeyFull] AS [j] WHERE 1 < [s].[row] AND [s].[row] <= 3 ) AS [s0] ON [e0].[Key1] = [s0].[CompositeId1] AND [e0].[Key2] = [s0].[CompositeId2] AND [e0].[Key3] = [s0].[CompositeId3] ) AS [s1] ON [r].[Id] = [s1].[RootSkipSharedId] -ORDER BY [r].[Id], [s1].[RootSkipSharedId], [s1].[CompositeKeySkipSharedKey1], [s1].[CompositeKeySkipSharedKey2], [s1].[CompositeKeySkipSharedKey3], [s1].[Key1], [s1].[Key2], [s1].[Key3], [s1].[CompositeId1], [s1].[CompositeId2], [s1].[CompositeId3], [s1].[Id0] +ORDER BY [r].[Id], [s1].[RootSkipSharedId], [s1].[CompositeKeySkipSharedKey1], [s1].[CompositeKeySkipSharedKey2], [s1].[CompositeKeySkipSharedKey3], [s1].[CompositeId1], [s1].[CompositeId2], [s1].[CompositeId3], [s1].[Id0] """); } @@ -955,7 +953,7 @@ FROM [EntityCompositeKeyEntityTwo] AS [e0] ) AS [s] ON [e].[Key1] = [s].[CompositeKeySkipSharedKey1] AND [e].[Key2] = [s].[CompositeKeySkipSharedKey2] AND [e].[Key3] = [s].[CompositeKeySkipSharedKey3] WHERE [e].[Key1] < 5 ) AS [s0] ON [r].[Id] = [s0].[LeafId] -ORDER BY [r].[Id], [s0].[LeafId], [s0].[CompositeId1], [s0].[CompositeId2], [s0].[CompositeId3], [s0].[Key1], [s0].[Key2], [s0].[Key3], [s0].[TwoSkipSharedId], [s0].[CompositeKeySkipSharedKey1], [s0].[CompositeKeySkipSharedKey2], [s0].[CompositeKeySkipSharedKey3] +ORDER BY [r].[Id], [s0].[LeafId], [s0].[CompositeId1], [s0].[CompositeId2], [s0].[CompositeId3], [s0].[TwoSkipSharedId], [s0].[CompositeKeySkipSharedKey1], [s0].[CompositeKeySkipSharedKey2] """); } @@ -984,7 +982,7 @@ FROM [JoinTwoToThree] AS [j0] WHERE [e1].[Id] < 10 ) AS [s0] ON [s].[Id] = [s0].[TwoId] ) AS [s1] -ORDER BY [e].[Id], [s1].[Id], [s1].[OneId], [s1].[TwoId], [s1].[ThreeId], [s1].[TwoId0] +ORDER BY [e].[Id], [s1].[Id], [s1].[OneId], [s1].[TwoId], [s1].[ThreeId] """); } @@ -1011,7 +1009,7 @@ FROM [JoinTwoToThree] AS [j0] ) AS [s0] ON [e0].[Id] = [s0].[TwoId] WHERE [e0].[Id] < 10 ) AS [s1] ON [e].[Id] = [s1].[OneId] -ORDER BY [e].[Id], [s1].[OneId], [s1].[TwoId], [s1].[Id], [s1].[TwoId0], [s1].[Id0] +ORDER BY [e].[Id], [s1].[OneId], [s1].[TwoId], [s1].[TwoId0], [s1].[Id0] """); } @@ -1031,7 +1029,7 @@ FROM [JoinOneToTwo] AS [j] LEFT JOIN [EntityTwos] AS [e2] ON [e0].[Id] = [e2].[CollectionInverseId] WHERE [e0].[Id] < 10 ) AS [s] ON [e].[Id] = [s].[TwoId] -ORDER BY [e].[Id], [s].[OneId], [s].[TwoId], [s].[Id], [s].[Id0] +ORDER BY [e].[Id], [s].[OneId], [s].[TwoId] """); } @@ -1071,7 +1069,7 @@ WHERE [s].[Id] < 20 ) AS [s2] ON [e0].[Id] = [s2].[EntityOneId] WHERE [e0].[Id] < 10 ) AS [s3] ON [e].[Id] = [s3].[ThreeId] -ORDER BY [e].[Id], [s3].[OneId], [s3].[ThreeId], [s3].[Id], [s3].[OneId0], [s3].[Id0], [s3].[TwoId], [s3].[EntityBranchId], [s3].[EntityOneId] +ORDER BY [e].[Id], [s3].[OneId], [s3].[ThreeId], [s3].[OneId0], [s3].[Id0], [s3].[TwoId], [s3].[EntityBranchId] """); } @@ -1094,7 +1092,7 @@ WHERE [e1].[Id] < 5 ) AS [e2] ON [e0].[Id] = [e2].[CollectionInverseId] WHERE [e0].[Id] > 15 ) AS [s] ON [e].[Id] = [s].[ThreeId] -ORDER BY [e].[Id], [s].[OneId], [s].[ThreeId], [s].[Id] +ORDER BY [e].[Id], [s].[OneId], [s].[ThreeId] """); } @@ -1117,7 +1115,7 @@ WHERE [e1].[Id] < 5 ) AS [s] ON [e0].[Id] = [s].[TwoId] WHERE [e0].[Id] > 15 ) AS [s0] ON [e].[Id] = [s0].[CollectionInverseId] -ORDER BY [e].[Id], [s0].[Id], [s0].[ThreeId], [s0].[TwoId] +ORDER BY [e].[Id], [s0].[Id], [s0].[ThreeId] """); } @@ -1217,11 +1215,11 @@ FROM [Roots] AS [r] INNER JOIN [Leaves] AS [l] ON [r].[Id] = [l].[Id] ) AS [s] ON [j].[LeafId] = [s].[Id] ) AS [s0] ON [e].[Key1] = [s0].[CompositeId1] AND [e].[Key2] = [s0].[CompositeId2] AND [e].[Key3] = [s0].[CompositeId3] -ORDER BY [e].[Key1], [e].[Key2], [e].[Key3], [s0].[LeafId], [s0].[CompositeId1], [s0].[CompositeId2], [s0].[CompositeId3], [s0].[Id] +ORDER BY [e].[Key1], [e].[Key2], [e].[Key3], [s0].[LeafId], [s0].[CompositeId1], [s0].[CompositeId2], [s0].[CompositeId3] """, // """ -SELECT [s1].[EntityBranchId], [s1].[EntityOneId], [s1].[Id], [s1].[Name], [e].[Key1], [e].[Key2], [e].[Key3], [s0].[LeafId], [s0].[CompositeId1], [s0].[CompositeId2], [s0].[CompositeId3], [s0].[Id] +SELECT [s1].[EntityBranchId], [s1].[EntityOneId], [s1].[Id], [s1].[Name], [e].[Key1], [e].[Key2], [e].[Key3], [s0].[LeafId], [s0].[CompositeId1], [s0].[CompositeId2], [s0].[CompositeId3] FROM [EntityCompositeKeys] AS [e] INNER JOIN ( SELECT [j].[LeafId], [j].[CompositeId1], [j].[CompositeId2], [j].[CompositeId3], [s].[Id] @@ -1238,7 +1236,7 @@ INNER JOIN ( FROM [JoinOneToBranch] AS [j0] INNER JOIN [EntityOnes] AS [e0] ON [j0].[EntityOneId] = [e0].[Id] ) AS [s1] ON [s0].[Id] = [s1].[EntityBranchId] -ORDER BY [e].[Key1], [e].[Key2], [e].[Key3], [s0].[LeafId], [s0].[CompositeId1], [s0].[CompositeId2], [s0].[CompositeId3], [s0].[Id] +ORDER BY [e].[Key1], [e].[Key2], [e].[Key3], [s0].[LeafId], [s0].[CompositeId1], [s0].[CompositeId2], [s0].[CompositeId3] """); } @@ -1262,24 +1260,23 @@ FROM [JoinOneToThreePayloadFull] AS [j] INNER JOIN [EntityOnes] AS [e0] ON [j].[OneId] = [e0].[Id] LEFT JOIN [EntityTwos] AS [e1] ON [e0].[Id] = [e1].[ReferenceInverseId] ) AS [s] ON [e].[Id] = [s].[ThreeId] -ORDER BY [e].[Id], [s].[OneId], [s].[ThreeId], [s].[Id], [s].[Id0] +ORDER BY [e].[Id], [s].[OneId], [s].[ThreeId] """, // """ -SELECT [s0].[LeftId], [s0].[RightId], [s0].[Payload], [s0].[Id], [s0].[Name], [e].[Id], [s].[OneId], [s].[ThreeId], [s].[Id], [s].[Id0] +SELECT [s0].[LeftId], [s0].[RightId], [s0].[Payload], [s0].[Id], [s0].[Name], [e].[Id], [s].[OneId], [s].[ThreeId] FROM [EntityThrees] AS [e] INNER JOIN ( - SELECT [j].[OneId], [j].[ThreeId], [e0].[Id], [e1].[Id] AS [Id0] + SELECT [j].[OneId], [j].[ThreeId], [e0].[Id] FROM [JoinOneToThreePayloadFull] AS [j] INNER JOIN [EntityOnes] AS [e0] ON [j].[OneId] = [e0].[Id] - LEFT JOIN [EntityTwos] AS [e1] ON [e0].[Id] = [e1].[ReferenceInverseId] ) AS [s] ON [e].[Id] = [s].[ThreeId] INNER JOIN ( SELECT [j0].[LeftId], [j0].[RightId], [j0].[Payload], [e2].[Id], [e2].[Name] FROM [JoinOneSelfPayload] AS [j0] INNER JOIN [EntityOnes] AS [e2] ON [j0].[RightId] = [e2].[Id] ) AS [s0] ON [s].[Id] = [s0].[LeftId] -ORDER BY [e].[Id], [s].[OneId], [s].[ThreeId], [s].[Id], [s].[Id0] +ORDER BY [e].[Id], [s].[OneId], [s].[ThreeId] """); } @@ -1292,19 +1289,18 @@ public override async Task Include_skip_navigation_and_reference_split(bool asyn SELECT [e].[Id], [e].[CollectionInverseId], [e].[ExtraId], [e].[Name], [e].[ReferenceInverseId], [e0].[Id], [e0].[CollectionInverseId], [e0].[Name], [e0].[ReferenceInverseId] FROM [EntityTwos] AS [e] LEFT JOIN [EntityThrees] AS [e0] ON [e].[Id] = [e0].[ReferenceInverseId] -ORDER BY [e].[Id], [e0].[Id] +ORDER BY [e].[Id] """, // """ -SELECT [s].[OneSkipSharedId], [s].[TwoSkipSharedId], [s].[Id], [s].[Name], [e].[Id], [e0].[Id] +SELECT [s].[OneSkipSharedId], [s].[TwoSkipSharedId], [s].[Id], [s].[Name], [e].[Id] FROM [EntityTwos] AS [e] -LEFT JOIN [EntityThrees] AS [e0] ON [e].[Id] = [e0].[ReferenceInverseId] INNER JOIN ( SELECT [e1].[OneSkipSharedId], [e1].[TwoSkipSharedId], [e2].[Id], [e2].[Name] FROM [EntityOneEntityTwo] AS [e1] INNER JOIN [EntityOnes] AS [e2] ON [e1].[OneSkipSharedId] = [e2].[Id] ) AS [s] ON [e].[Id] = [s].[TwoSkipSharedId] -ORDER BY [e].[Id], [e0].[Id] +ORDER BY [e].[Id] """); } @@ -1463,11 +1459,11 @@ INNER JOIN ( FROM [EntityRootEntityThree] AS [e] INNER JOIN [EntityThrees] AS [e0] ON [e].[ThreeSkipSharedId] = [e0].[Id] ) AS [s] ON [r].[Id] = [s].[RootSkipSharedId] -ORDER BY [r].[Id], [s].[RootSkipSharedId], [s].[ThreeSkipSharedId], [s].[Id] +ORDER BY [r].[Id], [s].[RootSkipSharedId], [s].[ThreeSkipSharedId] """, // """ -SELECT [s0].[OneId], [s0].[ThreeId], [s0].[Payload], [s0].[Id], [s0].[Name], [r].[Id], [s].[RootSkipSharedId], [s].[ThreeSkipSharedId], [s].[Id] +SELECT [s0].[OneId], [s0].[ThreeId], [s0].[Payload], [s0].[Id], [s0].[Name], [r].[Id], [s].[RootSkipSharedId], [s].[ThreeSkipSharedId] FROM [Roots] AS [r] INNER JOIN ( SELECT [e].[RootSkipSharedId], [e].[ThreeSkipSharedId], [e0].[Id] @@ -1480,7 +1476,7 @@ FROM [JoinOneToThreePayloadFullShared] AS [j] INNER JOIN [EntityOnes] AS [e1] ON [j].[OneId] = [e1].[Id] WHERE [e1].[Id] < 10 ) AS [s0] ON [s].[Id] = [s0].[ThreeId] -ORDER BY [r].[Id], [s].[RootSkipSharedId], [s].[ThreeSkipSharedId], [s].[Id] +ORDER BY [r].[Id], [s].[RootSkipSharedId], [s].[ThreeSkipSharedId] """); } @@ -1511,11 +1507,11 @@ INNER JOIN ( FROM [EntityCompositeKeyEntityRoot] AS [e] INNER JOIN [EntityCompositeKeys] AS [e0] ON [e].[CompositeKeySkipSharedKey1] = [e0].[Key1] AND [e].[CompositeKeySkipSharedKey2] = [e0].[Key2] AND [e].[CompositeKeySkipSharedKey3] = [e0].[Key3] ) AS [s] ON [r].[Id] = [s].[RootSkipSharedId] -ORDER BY [r].[Id], [s].[RootSkipSharedId], [s].[CompositeKeySkipSharedKey1], [s].[CompositeKeySkipSharedKey2], [s].[CompositeKeySkipSharedKey3], [s].[Key1], [s].[Key2], [s].[Key3] +ORDER BY [r].[Id], [s].[RootSkipSharedId], [s].[CompositeKeySkipSharedKey1], [s].[CompositeKeySkipSharedKey2], [s].[CompositeKeySkipSharedKey3] """, // """ -SELECT [s1].[Id], [s1].[CompositeId1], [s1].[CompositeId2], [s1].[CompositeId3], [s1].[ThreeId], [s1].[Id0], [s1].[CollectionInverseId], [s1].[Name], [s1].[ReferenceInverseId], [r].[Id], [s].[RootSkipSharedId], [s].[CompositeKeySkipSharedKey1], [s].[CompositeKeySkipSharedKey2], [s].[CompositeKeySkipSharedKey3], [s].[Key1], [s].[Key2], [s].[Key3] +SELECT [s1].[Id], [s1].[CompositeId1], [s1].[CompositeId2], [s1].[CompositeId3], [s1].[ThreeId], [s1].[Id0], [s1].[CollectionInverseId], [s1].[Name], [s1].[ReferenceInverseId], [r].[Id], [s].[RootSkipSharedId], [s].[CompositeKeySkipSharedKey1], [s].[CompositeKeySkipSharedKey2], [s].[CompositeKeySkipSharedKey3] FROM [Roots] AS [r] INNER JOIN ( SELECT [e].[RootSkipSharedId], [e].[CompositeKeySkipSharedKey1], [e].[CompositeKeySkipSharedKey2], [e].[CompositeKeySkipSharedKey3], [e0].[Key1], [e0].[Key2], [e0].[Key3] @@ -1531,7 +1527,7 @@ FROM [JoinThreeToCompositeKeyFull] AS [j] ) AS [s0] WHERE 1 < [s0].[row] AND [s0].[row] <= 3 ) AS [s1] ON [s].[Key1] = [s1].[CompositeId1] AND [s].[Key2] = [s1].[CompositeId2] AND [s].[Key3] = [s1].[CompositeId3] -ORDER BY [r].[Id], [s].[RootSkipSharedId], [s].[CompositeKeySkipSharedKey1], [s].[CompositeKeySkipSharedKey2], [s].[CompositeKeySkipSharedKey3], [s].[Key1], [s].[Key2], [s].[Key3], [s1].[CompositeId1], [s1].[CompositeId2], [s1].[CompositeId3], [s1].[Id0] +ORDER BY [r].[Id], [s].[RootSkipSharedId], [s].[CompositeKeySkipSharedKey1], [s].[CompositeKeySkipSharedKey2], [s].[CompositeKeySkipSharedKey3], [s1].[CompositeId1], [s1].[CompositeId2], [s1].[CompositeId3], [s1].[Id0] """); } @@ -1559,11 +1555,11 @@ FROM [JoinCompositeKeyToLeaf] AS [j] INNER JOIN [EntityCompositeKeys] AS [e] ON [j].[CompositeId1] = [e].[Key1] AND [j].[CompositeId2] = [e].[Key2] AND [j].[CompositeId3] = [e].[Key3] WHERE [e].[Key1] < 5 ) AS [s] ON [r].[Id] = [s].[LeafId] -ORDER BY [r].[Id], [s].[LeafId], [s].[CompositeId1], [s].[CompositeId2], [s].[CompositeId3], [s].[Key1], [s].[Key2], [s].[Key3] +ORDER BY [r].[Id], [s].[LeafId], [s].[CompositeId1], [s].[CompositeId2], [s].[CompositeId3] """, // """ -SELECT [s0].[TwoSkipSharedId], [s0].[CompositeKeySkipSharedKey1], [s0].[CompositeKeySkipSharedKey2], [s0].[CompositeKeySkipSharedKey3], [s0].[Id], [s0].[CollectionInverseId], [s0].[ExtraId], [s0].[Name], [s0].[ReferenceInverseId], [r].[Id], [s].[LeafId], [s].[CompositeId1], [s].[CompositeId2], [s].[CompositeId3], [s].[Key1], [s].[Key2], [s].[Key3] +SELECT [s0].[TwoSkipSharedId], [s0].[CompositeKeySkipSharedKey1], [s0].[CompositeKeySkipSharedKey2], [s0].[CompositeKeySkipSharedKey3], [s0].[Id], [s0].[CollectionInverseId], [s0].[ExtraId], [s0].[Name], [s0].[ReferenceInverseId], [r].[Id], [s].[LeafId], [s].[CompositeId1], [s].[CompositeId2], [s].[CompositeId3] FROM [Roots] AS [r] INNER JOIN [Branches] AS [b] ON [r].[Id] = [b].[Id] INNER JOIN [Leaves] AS [l] ON [r].[Id] = [l].[Id] @@ -1578,7 +1574,7 @@ INNER JOIN ( FROM [EntityCompositeKeyEntityTwo] AS [e0] INNER JOIN [EntityTwos] AS [e1] ON [e0].[TwoSkipSharedId] = [e1].[Id] ) AS [s0] ON [s].[Key1] = [s0].[CompositeKeySkipSharedKey1] AND [s].[Key2] = [s0].[CompositeKeySkipSharedKey2] AND [s].[Key3] = [s0].[CompositeKeySkipSharedKey3] -ORDER BY [r].[Id], [s].[LeafId], [s].[CompositeId1], [s].[CompositeId2], [s].[CompositeId3], [s].[Key1], [s].[Key2], [s].[Key3] +ORDER BY [r].[Id], [s].[LeafId], [s].[CompositeId1], [s].[CompositeId2], [s].[CompositeId3] """); } @@ -1609,7 +1605,7 @@ FROM [JoinOneToTwo] AS [j] """, // """ -SELECT [s1].[ThreeId], [s1].[TwoId], [s1].[Id], [s1].[CollectionInverseId], [s1].[Name], [s1].[ReferenceInverseId], [e].[Id], [s0].[OneId], [s0].[TwoId], [s0].[Id] +SELECT [s1].[ThreeId], [s1].[TwoId], [s1].[Id], [s1].[CollectionInverseId], [s1].[Name], [s1].[ReferenceInverseId], [e].[Id], [s0].[OneId], [s0].[TwoId] FROM [EntityOnes] AS [e] INNER JOIN ( SELECT [s].[OneId], [s].[TwoId], [s].[Id] @@ -1650,11 +1646,11 @@ FROM [JoinOneToTwo] AS [j] INNER JOIN [EntityTwos] AS [e0] ON [j].[TwoId] = [e0].[Id] WHERE [e0].[Id] < 10 ) AS [s] ON [e].[Id] = [s].[OneId] -ORDER BY [e].[Id], [s].[OneId], [s].[TwoId], [s].[Id] +ORDER BY [e].[Id], [s].[OneId], [s].[TwoId] """, // """ -SELECT [s1].[ThreeId], [s1].[TwoId], [s1].[Id], [s1].[CollectionInverseId], [s1].[Name], [s1].[ReferenceInverseId], [e].[Id], [s].[OneId], [s].[TwoId], [s].[Id] +SELECT [s1].[ThreeId], [s1].[TwoId], [s1].[Id], [s1].[CollectionInverseId], [s1].[Name], [s1].[ReferenceInverseId], [e].[Id], [s].[OneId], [s].[TwoId] FROM [EntityOnes] AS [e] INNER JOIN ( SELECT [j].[OneId], [j].[TwoId], [e0].[Id] @@ -1671,7 +1667,7 @@ FROM [JoinTwoToThree] AS [j0] ) AS [s0] WHERE 1 < [s0].[row] AND [s0].[row] <= 3 ) AS [s1] ON [s].[Id] = [s1].[TwoId] -ORDER BY [e].[Id], [s].[OneId], [s].[TwoId], [s].[Id], [s1].[TwoId], [s1].[Id] +ORDER BY [e].[Id], [s].[OneId], [s].[TwoId], [s1].[TwoId], [s1].[Id] """); } @@ -1696,21 +1692,20 @@ FROM [JoinOneToTwo] AS [j] LEFT JOIN [EntityTwos] AS [e1] ON [e0].[Id] = [e1].[ReferenceInverseId] WHERE [e0].[Id] < 10 ) AS [s] ON [e].[Id] = [s].[TwoId] -ORDER BY [e].[Id], [s].[OneId], [s].[TwoId], [s].[Id], [s].[Id0] +ORDER BY [e].[Id], [s].[OneId], [s].[TwoId] """, // """ -SELECT [e2].[Id], [e2].[CollectionInverseId], [e2].[ExtraId], [e2].[Name], [e2].[ReferenceInverseId], [e].[Id], [s].[OneId], [s].[TwoId], [s].[Id], [s].[Id0] +SELECT [e2].[Id], [e2].[CollectionInverseId], [e2].[ExtraId], [e2].[Name], [e2].[ReferenceInverseId], [e].[Id], [s].[OneId], [s].[TwoId] FROM [EntityTwos] AS [e] INNER JOIN ( - SELECT [j].[OneId], [j].[TwoId], [e0].[Id], [e1].[Id] AS [Id0] + SELECT [j].[OneId], [j].[TwoId], [e0].[Id] FROM [JoinOneToTwo] AS [j] INNER JOIN [EntityOnes] AS [e0] ON [j].[OneId] = [e0].[Id] - LEFT JOIN [EntityTwos] AS [e1] ON [e0].[Id] = [e1].[ReferenceInverseId] WHERE [e0].[Id] < 10 ) AS [s] ON [e].[Id] = [s].[TwoId] INNER JOIN [EntityTwos] AS [e2] ON [s].[Id] = [e2].[CollectionInverseId] -ORDER BY [e].[Id], [s].[OneId], [s].[TwoId], [s].[Id], [s].[Id0] +ORDER BY [e].[Id], [s].[OneId], [s].[TwoId] """); } @@ -1734,11 +1729,11 @@ FROM [JoinOneToThreePayloadFull] AS [j] INNER JOIN [EntityOnes] AS [e0] ON [j].[OneId] = [e0].[Id] WHERE [e0].[Id] < 10 ) AS [s0] ON [e].[Id] = [s0].[ThreeId] -ORDER BY [e].[Id], [s0].[OneId], [s0].[ThreeId], [s0].[Id] +ORDER BY [e].[Id], [s0].[OneId], [s0].[ThreeId] """, // """ -SELECT [s2].[OneId], [s2].[TwoId], [s2].[JoinOneToTwoExtraId], [s2].[Id], [s2].[CollectionInverseId], [s2].[ExtraId], [s2].[Name], [s2].[ReferenceInverseId], [e].[Id], [s0].[OneId], [s0].[ThreeId], [s0].[Id] +SELECT [s2].[OneId], [s2].[TwoId], [s2].[JoinOneToTwoExtraId], [s2].[Id], [s2].[CollectionInverseId], [s2].[ExtraId], [s2].[Name], [s2].[ReferenceInverseId], [e].[Id], [s0].[OneId], [s0].[ThreeId] FROM [EntityThrees] AS [e] INNER JOIN ( SELECT [j].[OneId], [j].[ThreeId], [e0].[Id] @@ -1755,11 +1750,11 @@ FROM [JoinOneToTwo] AS [j0] ) AS [s1] WHERE 1 < [s1].[row] AND [s1].[row] <= 3 ) AS [s2] ON [s0].[Id] = [s2].[OneId] -ORDER BY [e].[Id], [s0].[OneId], [s0].[ThreeId], [s0].[Id], [s2].[OneId], [s2].[Id] +ORDER BY [e].[Id], [s0].[OneId], [s0].[ThreeId], [s2].[OneId], [s2].[Id] """, // """ -SELECT [s3].[EntityBranchId], [s3].[EntityOneId], [s3].[Id], [s3].[Name], [s3].[Number], [s3].[IsGreen], [s3].[Discriminator], [e].[Id], [s0].[OneId], [s0].[ThreeId], [s0].[Id] +SELECT [s3].[EntityBranchId], [s3].[EntityOneId], [s3].[Id], [s3].[Name], [s3].[Number], [s3].[IsGreen], [s3].[Discriminator], [e].[Id], [s0].[OneId], [s0].[ThreeId] FROM [EntityThrees] AS [e] INNER JOIN ( SELECT [j].[OneId], [j].[ThreeId], [e0].[Id] @@ -1780,7 +1775,7 @@ FROM [Roots] AS [r] ) AS [s] ON [j1].[EntityBranchId] = [s].[Id] WHERE [s].[Id] < 20 ) AS [s3] ON [s0].[Id] = [s3].[EntityOneId] -ORDER BY [e].[Id], [s0].[OneId], [s0].[ThreeId], [s0].[Id] +ORDER BY [e].[Id], [s0].[OneId], [s0].[ThreeId] """); } @@ -1804,11 +1799,11 @@ FROM [JoinOneToThreePayloadFull] AS [j] INNER JOIN [EntityOnes] AS [e0] ON [j].[OneId] = [e0].[Id] WHERE [e0].[Id] > 15 ) AS [s] ON [e].[Id] = [s].[ThreeId] -ORDER BY [e].[Id], [s].[OneId], [s].[ThreeId], [s].[Id] +ORDER BY [e].[Id], [s].[OneId], [s].[ThreeId] """, // """ -SELECT [e2].[Id], [e2].[CollectionInverseId], [e2].[ExtraId], [e2].[Name], [e2].[ReferenceInverseId], [e].[Id], [s].[OneId], [s].[ThreeId], [s].[Id] +SELECT [e2].[Id], [e2].[CollectionInverseId], [e2].[ExtraId], [e2].[Name], [e2].[ReferenceInverseId], [e].[Id], [s].[OneId], [s].[ThreeId] FROM [EntityThrees] AS [e] INNER JOIN ( SELECT [j].[OneId], [j].[ThreeId], [e0].[Id] @@ -1821,7 +1816,7 @@ INNER JOIN ( FROM [EntityTwos] AS [e1] WHERE [e1].[Id] < 5 ) AS [e2] ON [s].[Id] = [e2].[CollectionInverseId] -ORDER BY [e].[Id], [s].[OneId], [s].[ThreeId], [s].[Id] +ORDER BY [e].[Id], [s].[OneId], [s].[ThreeId] """); } @@ -1883,7 +1878,7 @@ FROM [JoinOneToThreePayloadFullShared] AS [j0] INNER JOIN [EntityThrees] AS [e1] ON [j0].[ThreeId] = [e1].[Id] ) AS [s] ON [e0].[Id] = [s].[OneId] ) AS [s0] ON [e].[Id] = [s0].[ThreeId] -ORDER BY [e].[Id], [s0].[OneId], [s0].[ThreeId], [s0].[Id], [s0].[OneId0], [s0].[ThreeId0] +ORDER BY [e].[Id], [s0].[OneId], [s0].[ThreeId], [s0].[OneId0] """); } @@ -2065,7 +2060,7 @@ FROM [JoinTwoToThree] AS [j0] WHERE [e1].[Id] < 10 ) AS [s0] ON [s].[Id] = [s0].[TwoId] ) AS [s1] -ORDER BY [e].[Id], [s1].[Id], [s1].[OneId], [s1].[TwoId], [s1].[ThreeId], [s1].[TwoId0] +ORDER BY [e].[Id], [s1].[Id], [s1].[OneId], [s1].[TwoId], [s1].[ThreeId] """); } @@ -2128,7 +2123,6 @@ FROM [UnidirectionalEntityOnes] AS [u] WHERE EXISTS ( SELECT 1 FROM [UnidirectionalJoinOneSelfPayload] AS [u0] - INNER JOIN [UnidirectionalEntityOnes] AS [u1] ON [u0].[LeftId] = [u1].[Id] WHERE [u].[Id] = [u0].[RightId]) """); } @@ -2212,7 +2206,7 @@ FROM [UnidirectionalRoots] AS [u1] ) AS [s] ON [u0].[RootSkipSharedId] = [s].[Id] WHERE [s].[Discriminator] = N'UnidirectionalEntityLeaf' ) AS [s0] ON [u].[Key1] = [s0].[UnidirectionalEntityCompositeKeyKey1] AND [u].[Key2] = [s0].[UnidirectionalEntityCompositeKeyKey2] AND [u].[Key3] = [s0].[UnidirectionalEntityCompositeKeyKey3] -ORDER BY [u].[Key1], [u].[Key2], [u].[Key3], [s0].[RootSkipSharedId], [s0].[UnidirectionalEntityCompositeKeyKey1], [s0].[UnidirectionalEntityCompositeKeyKey2], [s0].[UnidirectionalEntityCompositeKeyKey3] +ORDER BY [u].[Key1], [u].[Key2], [u].[Key3], [s0].[RootSkipSharedId], [s0].[UnidirectionalEntityCompositeKeyKey1], [s0].[UnidirectionalEntityCompositeKeyKey2] """); } @@ -2364,7 +2358,7 @@ LEFT JOIN ( FROM [UnidirectionalJoinOneSelfPayload] AS [u0] INNER JOIN [UnidirectionalEntityOnes] AS [u1] ON [u0].[LeftId] = [u1].[Id] ) AS [s] ON [u].[Id] = [s].[RightId] -ORDER BY [u].[Id], [s].[LeftId], [s].[RightId] +ORDER BY [u].[Id], [s].[LeftId] """); } @@ -2389,7 +2383,7 @@ FROM [UnidirectionalRoots] AS [u1] LEFT JOIN [UnidirectionalLeaves] AS [u3] ON [u1].[Id] = [u3].[Id] ) AS [s] ON [u0].[RootSkipSharedId] = [s].[Id] ) AS [s0] ON [u].[Key1] = [s0].[UnidirectionalEntityCompositeKeyKey1] AND [u].[Key2] = [s0].[UnidirectionalEntityCompositeKeyKey2] AND [u].[Key3] = [s0].[UnidirectionalEntityCompositeKeyKey3] -ORDER BY [u].[Key1], [u].[Key2], [u].[Key3], [s0].[RootSkipSharedId], [s0].[UnidirectionalEntityCompositeKeyKey1], [s0].[UnidirectionalEntityCompositeKeyKey2], [s0].[UnidirectionalEntityCompositeKeyKey3] +ORDER BY [u].[Key1], [u].[Key2], [u].[Key3], [s0].[RootSkipSharedId], [s0].[UnidirectionalEntityCompositeKeyKey1], [s0].[UnidirectionalEntityCompositeKeyKey2] """); } @@ -2407,7 +2401,7 @@ FROM [UnidirectionalJoinOneToTwo] AS [u0] INNER JOIN [UnidirectionalEntityOnes] AS [u1] ON [u0].[OneId] = [u1].[Id] LEFT JOIN [UnidirectionalEntityTwos] AS [u2] ON [u1].[Id] = [u2].[ReferenceInverseId] ) AS [s] ON [u].[Id] = [s].[TwoId] -ORDER BY [u].[Id], [s].[OneId], [s].[TwoId], [s].[Id] +ORDER BY [u].[Id], [s].[OneId] """); } @@ -2434,7 +2428,7 @@ FROM [UnidirectionalJoinOneToBranch] AS [u4] INNER JOIN [UnidirectionalEntityOnes] AS [u5] ON [u4].[UnidirectionalEntityOneId] = [u5].[Id] ) AS [s0] ON [s].[Id] = [s0].[UnidirectionalEntityBranchId] ) AS [s1] ON [u].[Key1] = [s1].[CompositeId1] AND [u].[Key2] = [s1].[CompositeId2] AND [u].[Key3] = [s1].[CompositeId3] -ORDER BY [u].[Key1], [u].[Key2], [u].[Key3], [s1].[LeafId], [s1].[CompositeId1], [s1].[CompositeId2], [s1].[CompositeId3], [s1].[Id], [s1].[UnidirectionalEntityBranchId], [s1].[UnidirectionalEntityOneId] +ORDER BY [u].[Key1], [u].[Key2], [u].[Key3], [s1].[LeafId], [s1].[CompositeId1], [s1].[CompositeId2], [s1].[CompositeId3], [s1].[UnidirectionalEntityBranchId] """); } @@ -2457,7 +2451,7 @@ FROM [UnidirectionalJoinOneSelfPayload] AS [u3] INNER JOIN [UnidirectionalEntityOnes] AS [u4] ON [u3].[RightId] = [u4].[Id] ) AS [s] ON [u1].[Id] = [s].[LeftId] ) AS [s0] ON [u].[Id] = [s0].[ThreeId] -ORDER BY [u].[Id], [s0].[OneId], [s0].[ThreeId], [s0].[Id], [s0].[Id0], [s0].[LeftId], [s0].[RightId] +ORDER BY [u].[Id], [s0].[OneId], [s0].[ThreeId], [s0].[LeftId] """); } @@ -2467,7 +2461,7 @@ public override async Task Include_skip_navigation_and_reference_unidirectional( AssertSql( """ -SELECT [u].[Id], [u].[CollectionInverseId], [u].[ExtraId], [u].[Name], [u].[ReferenceInverseId], [u0].[Id], [s].[TwoSkipSharedId], [s].[UnidirectionalEntityOneId], [s].[Id], [s].[Name], [u0].[CollectionInverseId], [u0].[Name], [u0].[ReferenceInverseId] +SELECT [u].[Id], [u].[CollectionInverseId], [u].[ExtraId], [u].[Name], [u].[ReferenceInverseId], [s].[TwoSkipSharedId], [s].[UnidirectionalEntityOneId], [s].[Id], [s].[Name], [u0].[Id], [u0].[CollectionInverseId], [u0].[Name], [u0].[ReferenceInverseId] FROM [UnidirectionalEntityTwos] AS [u] LEFT JOIN [UnidirectionalEntityThrees] AS [u0] ON [u].[Id] = [u0].[ReferenceInverseId] LEFT JOIN ( @@ -2475,7 +2469,7 @@ LEFT JOIN ( FROM [UnidirectionalEntityOneUnidirectionalEntityTwo] AS [u1] INNER JOIN [UnidirectionalEntityOnes] AS [u2] ON [u1].[UnidirectionalEntityOneId] = [u2].[Id] ) AS [s] ON [u].[Id] = [s].[TwoSkipSharedId] -ORDER BY [u].[Id], [u0].[Id], [s].[TwoSkipSharedId], [s].[UnidirectionalEntityOneId] +ORDER BY [u].[Id], [s].[TwoSkipSharedId] """); } @@ -2497,7 +2491,7 @@ FROM [UnidirectionalJoinOneToThreePayloadFullShared] AS [u2] INNER JOIN [UnidirectionalEntityThrees] AS [u3] ON [u2].[ThreeId] = [u3].[Id] ) AS [s] ON [u1].[Id] = [s].[OneId] ) AS [s0] ON [u].[Id] = [s0].[ThreeId] -ORDER BY [u].[Id], [s0].[OneId], [s0].[ThreeId], [s0].[Id], [s0].[OneId0], [s0].[ThreeId0] +ORDER BY [u].[Id], [s0].[OneId], [s0].[ThreeId], [s0].[OneId0] """); } @@ -2515,7 +2509,7 @@ FROM [JoinOneToThreePayloadFullShared] AS [j] INNER JOIN [EntityOnes] AS [e0] ON [j].[OneId] = [e0].[Id] WHERE [e0].[Id] < 10 ) AS [s] ON [e].[Id] = [s].[ThreeId] -ORDER BY [e].[Id], [s].[OneId], [s].[ThreeId] +ORDER BY [e].[Id], [s].[OneId] """); } @@ -2620,7 +2614,7 @@ FROM [UnidirectionalEntityCompositeKeyUnidirectionalEntityTwo] AS [u4] ) AS [s] ON [u3].[Key1] = [s].[UnidirectionalEntityCompositeKeyKey1] AND [u3].[Key2] = [s].[UnidirectionalEntityCompositeKeyKey2] AND [u3].[Key3] = [s].[UnidirectionalEntityCompositeKeyKey3] WHERE [u3].[Key1] < 5 ) AS [s0] ON [u].[Id] = [s0].[LeafId] -ORDER BY [u].[Id], [s0].[LeafId], [s0].[CompositeId1], [s0].[CompositeId2], [s0].[CompositeId3], [s0].[Key1], [s0].[Key2], [s0].[Key3], [s0].[TwoSkipSharedId], [s0].[UnidirectionalEntityCompositeKeyKey1], [s0].[UnidirectionalEntityCompositeKeyKey2], [s0].[UnidirectionalEntityCompositeKeyKey3] +ORDER BY [u].[Id], [s0].[LeafId], [s0].[CompositeId1], [s0].[CompositeId2], [s0].[CompositeId3], [s0].[TwoSkipSharedId], [s0].[UnidirectionalEntityCompositeKeyKey1], [s0].[UnidirectionalEntityCompositeKeyKey2] """); } @@ -2640,7 +2634,7 @@ FROM [JoinOneToTwo] AS [j] LEFT JOIN [EntityTwos] AS [e2] ON [e0].[Id] = [e2].[CollectionInverseId] WHERE [e0].[Id] < 10 ) AS [s] ON [e].[Id] = [s].[TwoId] -ORDER BY [e].[Id], [s].[OneId], [s].[TwoId], [s].[Id], [s].[Id0] +ORDER BY [e].[Id], [s].[OneId], [s].[TwoId] """); } diff --git a/test/EFCore.SqlServer.FunctionalTests/Query/Inheritance/TPTRelationshipsQuerySqlServerTest.cs b/test/EFCore.SqlServer.FunctionalTests/Query/Inheritance/TPTRelationshipsQuerySqlServerTest.cs index b59bc0d2945..cc08569001d 100644 --- a/test/EFCore.SqlServer.FunctionalTests/Query/Inheritance/TPTRelationshipsQuerySqlServerTest.cs +++ b/test/EFCore.SqlServer.FunctionalTests/Query/Inheritance/TPTRelationshipsQuerySqlServerTest.cs @@ -81,7 +81,7 @@ FROM [BaseEntities] AS [b] ) AS [s] ON [c].[ParentId] = [s].[Id] LEFT JOIN [BaseEntities_OwnedCollectionOnBase] AS [b0] ON [s].[Id] = [b0].[BaseInheritanceRelationshipEntityId] LEFT JOIN [DerivedEntities_OwnedCollectionOnDerived] AS [d0] ON [s].[Id] = [d0].[DerivedInheritanceRelationshipEntityId] -ORDER BY [c].[Id], [s].[Id], [b0].[BaseInheritanceRelationshipEntityId], [b0].[Id], [d0].[DerivedInheritanceRelationshipEntityId] +ORDER BY [c].[Id], [b0].[BaseInheritanceRelationshipEntityId], [b0].[Id], [d0].[DerivedInheritanceRelationshipEntityId] """); } @@ -122,7 +122,7 @@ FROM [BaseEntities] AS [b] LEFT JOIN [BaseEntities_OwnedCollectionOnBase] AS [b0] ON [s].[Id] = [b0].[BaseInheritanceRelationshipEntityId] LEFT JOIN [DerivedEntities_OwnedCollectionOnDerived] AS [d0] ON [s].[Id] = [d0].[DerivedInheritanceRelationshipEntityId] WHERE [c].[Name] <> N'Bar' OR [c].[Name] IS NULL -ORDER BY [c].[Id], [s].[Id], [b0].[BaseInheritanceRelationshipEntityId], [b0].[Id], [d0].[DerivedInheritanceRelationshipEntityId] +ORDER BY [c].[Id], [b0].[BaseInheritanceRelationshipEntityId], [b0].[Id], [d0].[DerivedInheritanceRelationshipEntityId] """); } @@ -232,7 +232,7 @@ FROM [BaseEntities] AS [b0] ) AS [s] ON [b].[ParentId] = [s].[Id] LEFT JOIN [BaseEntities_OwnedCollectionOnBase] AS [b1] ON [s].[Id] = [b1].[BaseInheritanceRelationshipEntityId] LEFT JOIN [DerivedEntities_OwnedCollectionOnDerived] AS [d1] ON [s].[Id] = [d1].[DerivedInheritanceRelationshipEntityId] -ORDER BY [b].[Id], [s].[Id], [b1].[BaseInheritanceRelationshipEntityId], [b1].[Id], [d1].[DerivedInheritanceRelationshipEntityId] +ORDER BY [b].[Id], [b1].[BaseInheritanceRelationshipEntityId], [b1].[Id], [d1].[DerivedInheritanceRelationshipEntityId] """); } @@ -256,7 +256,7 @@ FROM [BaseEntities] AS [b0] ) AS [s] ON [b].[BaseParentId] = [s].[Id] LEFT JOIN [BaseEntities_OwnedCollectionOnBase] AS [b1] ON [s].[Id] = [b1].[BaseInheritanceRelationshipEntityId] LEFT JOIN [DerivedEntities_OwnedCollectionOnDerived] AS [d1] ON [s].[Id] = [d1].[DerivedInheritanceRelationshipEntityId] -ORDER BY [b].[Id], [s].[Id], [b1].[BaseInheritanceRelationshipEntityId], [b1].[Id], [d1].[DerivedInheritanceRelationshipEntityId] +ORDER BY [b].[Id], [b1].[BaseInheritanceRelationshipEntityId], [b1].[Id], [d1].[DerivedInheritanceRelationshipEntityId] """); } @@ -306,7 +306,7 @@ FROM [BaseEntities] AS [b0] LEFT JOIN [BaseEntities_OwnedCollectionOnBase] AS [b1] ON [s].[Id] = [b1].[BaseInheritanceRelationshipEntityId] LEFT JOIN [DerivedEntities_OwnedCollectionOnDerived] AS [d1] ON [s].[Id] = [d1].[DerivedInheritanceRelationshipEntityId] WHERE [b].[Name] <> N'Bar' OR [b].[Name] IS NULL -ORDER BY [b].[Id], [s].[Id], [b1].[BaseInheritanceRelationshipEntityId], [b1].[Id], [d1].[DerivedInheritanceRelationshipEntityId] +ORDER BY [b].[Id], [b1].[BaseInheritanceRelationshipEntityId], [b1].[Id], [d1].[DerivedInheritanceRelationshipEntityId] """); } @@ -318,13 +318,13 @@ public override async Task Include_reference_without_inheritance(bool async) """ SELECT [b].[Id], [b].[Name], [d].[BaseId], CASE WHEN [d].[Id] IS NOT NULL THEN N'DerivedInheritanceRelationshipEntity' -END AS [Discriminator], [r].[Id], [b0].[BaseInheritanceRelationshipEntityId], [b0].[Id], [b0].[Name], [b].[OwnedReferenceOnBase_Id], [b].[OwnedReferenceOnBase_Name], [d0].[DerivedInheritanceRelationshipEntityId], [d0].[Id], [d0].[Name], [d].[Id], [d].[OwnedReferenceOnDerived_Id], [d].[OwnedReferenceOnDerived_Name], [r].[Name], [r].[ParentId] +END AS [Discriminator], [b0].[BaseInheritanceRelationshipEntityId], [b0].[Id], [b0].[Name], [b].[OwnedReferenceOnBase_Id], [b].[OwnedReferenceOnBase_Name], [d0].[DerivedInheritanceRelationshipEntityId], [d0].[Id], [d0].[Name], [d].[Id], [d].[OwnedReferenceOnDerived_Id], [d].[OwnedReferenceOnDerived_Name], [r].[Id], [r].[Name], [r].[ParentId] FROM [BaseEntities] AS [b] LEFT JOIN [DerivedEntities] AS [d] ON [b].[Id] = [d].[Id] 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] -ORDER BY [b].[Id], [r].[Id], [b0].[BaseInheritanceRelationshipEntityId], [b0].[Id], [d0].[DerivedInheritanceRelationshipEntityId] +ORDER BY [b].[Id], [b0].[BaseInheritanceRelationshipEntityId], [b0].[Id], [d0].[DerivedInheritanceRelationshipEntityId] """); } @@ -334,13 +334,13 @@ public override async Task Include_reference_without_inheritance_on_derived1(boo AssertSql( """ -SELECT [b].[Id], [b].[Name], [d].[BaseId], [r].[Id], [b0].[BaseInheritanceRelationshipEntityId], [b0].[Id], [b0].[Name], [b].[OwnedReferenceOnBase_Id], [b].[OwnedReferenceOnBase_Name], [d0].[DerivedInheritanceRelationshipEntityId], [d0].[Id], [d0].[Name], [d].[Id], [d].[OwnedReferenceOnDerived_Id], [d].[OwnedReferenceOnDerived_Name], [r].[Name], [r].[ParentId] +SELECT [b].[Id], [b].[Name], [d].[BaseId], [b0].[BaseInheritanceRelationshipEntityId], [b0].[Id], [b0].[Name], [b].[OwnedReferenceOnBase_Id], [b].[OwnedReferenceOnBase_Name], [d0].[DerivedInheritanceRelationshipEntityId], [d0].[Id], [d0].[Name], [d].[Id], [d].[OwnedReferenceOnDerived_Id], [d].[OwnedReferenceOnDerived_Name], [r].[Id], [r].[Name], [r].[ParentId] FROM [BaseEntities] AS [b] INNER JOIN [DerivedEntities] AS [d] ON [b].[Id] = [d].[Id] 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] -ORDER BY [b].[Id], [r].[Id], [b0].[BaseInheritanceRelationshipEntityId], [b0].[Id], [d0].[DerivedInheritanceRelationshipEntityId] +ORDER BY [b].[Id], [b0].[BaseInheritanceRelationshipEntityId], [b0].[Id], [d0].[DerivedInheritanceRelationshipEntityId] """); } @@ -350,13 +350,13 @@ public override async Task Include_reference_without_inheritance_on_derived2(boo AssertSql( """ -SELECT [b].[Id], [b].[Name], [d].[BaseId], [r].[Id], [b0].[BaseInheritanceRelationshipEntityId], [b0].[Id], [b0].[Name], [b].[OwnedReferenceOnBase_Id], [b].[OwnedReferenceOnBase_Name], [d0].[DerivedInheritanceRelationshipEntityId], [d0].[Id], [d0].[Name], [d].[Id], [d].[OwnedReferenceOnDerived_Id], [d].[OwnedReferenceOnDerived_Name], [r].[Name], [r].[ParentId] +SELECT [b].[Id], [b].[Name], [d].[BaseId], [b0].[BaseInheritanceRelationshipEntityId], [b0].[Id], [b0].[Name], [b].[OwnedReferenceOnBase_Id], [b].[OwnedReferenceOnBase_Name], [d0].[DerivedInheritanceRelationshipEntityId], [d0].[Id], [d0].[Name], [d].[Id], [d].[OwnedReferenceOnDerived_Id], [d].[OwnedReferenceOnDerived_Name], [r].[Id], [r].[Name], [r].[ParentId] FROM [BaseEntities] AS [b] INNER JOIN [DerivedEntities] AS [d] ON [b].[Id] = [d].[Id] LEFT JOIN [ReferencesOnDerived] 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] -ORDER BY [b].[Id], [r].[Id], [b0].[BaseInheritanceRelationshipEntityId], [b0].[Id], [d0].[DerivedInheritanceRelationshipEntityId] +ORDER BY [b].[Id], [b0].[BaseInheritanceRelationshipEntityId], [b0].[Id], [d0].[DerivedInheritanceRelationshipEntityId] """); } @@ -375,7 +375,7 @@ FROM [BaseEntities] AS [b] ) AS [s] ON [r].[ParentId] = [s].[Id] LEFT JOIN [BaseEntities_OwnedCollectionOnBase] AS [b0] ON [s].[Id] = [b0].[BaseInheritanceRelationshipEntityId] LEFT JOIN [DerivedEntities_OwnedCollectionOnDerived] AS [d0] ON [s].[Id] = [d0].[DerivedInheritanceRelationshipEntityId] -ORDER BY [r].[Id], [s].[Id], [b0].[BaseInheritanceRelationshipEntityId], [b0].[Id], [d0].[DerivedInheritanceRelationshipEntityId] +ORDER BY [r].[Id], [b0].[BaseInheritanceRelationshipEntityId], [b0].[Id], [d0].[DerivedInheritanceRelationshipEntityId] """); } @@ -396,7 +396,7 @@ FROM [BaseEntities] AS [b] ) AS [s] ON [r].[ParentId] = [s].[Id] LEFT JOIN [BaseEntities_OwnedCollectionOnBase] AS [b0] ON [s].[Id] = [b0].[BaseInheritanceRelationshipEntityId] LEFT JOIN [DerivedEntities_OwnedCollectionOnDerived] AS [d0] ON [s].[Id] = [d0].[DerivedInheritanceRelationshipEntityId] -ORDER BY [r].[Id], [s].[Id], [b0].[BaseInheritanceRelationshipEntityId], [b0].[Id], [d0].[DerivedInheritanceRelationshipEntityId] +ORDER BY [r].[Id], [b0].[BaseInheritanceRelationshipEntityId], [b0].[Id], [d0].[DerivedInheritanceRelationshipEntityId] """); } @@ -408,14 +408,14 @@ public override async Task Include_reference_without_inheritance_with_filter(boo """ SELECT [b].[Id], [b].[Name], [d].[BaseId], CASE WHEN [d].[Id] IS NOT NULL THEN N'DerivedInheritanceRelationshipEntity' -END AS [Discriminator], [r].[Id], [b0].[BaseInheritanceRelationshipEntityId], [b0].[Id], [b0].[Name], [b].[OwnedReferenceOnBase_Id], [b].[OwnedReferenceOnBase_Name], [d0].[DerivedInheritanceRelationshipEntityId], [d0].[Id], [d0].[Name], [d].[Id], [d].[OwnedReferenceOnDerived_Id], [d].[OwnedReferenceOnDerived_Name], [r].[Name], [r].[ParentId] +END AS [Discriminator], [b0].[BaseInheritanceRelationshipEntityId], [b0].[Id], [b0].[Name], [b].[OwnedReferenceOnBase_Id], [b].[OwnedReferenceOnBase_Name], [d0].[DerivedInheritanceRelationshipEntityId], [d0].[Id], [d0].[Name], [d].[Id], [d].[OwnedReferenceOnDerived_Id], [d].[OwnedReferenceOnDerived_Name], [r].[Id], [r].[Name], [r].[ParentId] FROM [BaseEntities] AS [b] LEFT JOIN [DerivedEntities] AS [d] ON [b].[Id] = [d].[Id] 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 -ORDER BY [b].[Id], [r].[Id], [b0].[BaseInheritanceRelationshipEntityId], [b0].[Id], [d0].[DerivedInheritanceRelationshipEntityId] +ORDER BY [b].[Id], [b0].[BaseInheritanceRelationshipEntityId], [b0].[Id], [d0].[DerivedInheritanceRelationshipEntityId] """); } @@ -437,7 +437,7 @@ FROM [BaseEntities] AS [b] LEFT JOIN [BaseEntities_OwnedCollectionOnBase] AS [b0] ON [s].[Id] = [b0].[BaseInheritanceRelationshipEntityId] LEFT JOIN [DerivedEntities_OwnedCollectionOnDerived] AS [d0] ON [s].[Id] = [d0].[DerivedInheritanceRelationshipEntityId] WHERE [r].[Name] <> N'Bar' OR [r].[Name] IS NULL -ORDER BY [r].[Id], [s].[Id], [b0].[BaseInheritanceRelationshipEntityId], [b0].[Id], [d0].[DerivedInheritanceRelationshipEntityId] +ORDER BY [r].[Id], [b0].[BaseInheritanceRelationshipEntityId], [b0].[Id], [d0].[DerivedInheritanceRelationshipEntityId] """); } @@ -449,7 +449,7 @@ public override async Task Include_reference_with_inheritance(bool async) """ SELECT [b].[Id], [b].[Name], [d].[BaseId], CASE WHEN [d].[Id] IS NOT NULL THEN N'DerivedInheritanceRelationshipEntity' -END AS [Discriminator], [s].[Id], [b1].[BaseInheritanceRelationshipEntityId], [b1].[Id], [b1].[Name], [b].[OwnedReferenceOnBase_Id], [b].[OwnedReferenceOnBase_Name], [d1].[DerivedInheritanceRelationshipEntityId], [d1].[Id], [d1].[Name], [d].[Id], [d].[OwnedReferenceOnDerived_Id], [d].[OwnedReferenceOnDerived_Name], [s].[BaseParentId], [s].[Name], [s].[Discriminator] +END AS [Discriminator], [b1].[BaseInheritanceRelationshipEntityId], [b1].[Id], [b1].[Name], [b].[OwnedReferenceOnBase_Id], [b].[OwnedReferenceOnBase_Name], [d1].[DerivedInheritanceRelationshipEntityId], [d1].[Id], [d1].[Name], [d].[Id], [d].[OwnedReferenceOnDerived_Id], [d].[OwnedReferenceOnDerived_Name], [s].[Id], [s].[BaseParentId], [s].[Name], [s].[Discriminator] FROM [BaseEntities] AS [b] LEFT JOIN [DerivedEntities] AS [d] ON [b].[Id] = [d].[Id] LEFT JOIN ( @@ -461,7 +461,7 @@ FROM [BaseReferencesOnBase] AS [b0] ) AS [s] ON [b].[Id] = [s].[BaseParentId] LEFT JOIN [BaseEntities_OwnedCollectionOnBase] AS [b1] ON [b].[Id] = [b1].[BaseInheritanceRelationshipEntityId] LEFT JOIN [DerivedEntities_OwnedCollectionOnDerived] AS [d1] ON [b].[Id] = [d1].[DerivedInheritanceRelationshipEntityId] -ORDER BY [b].[Id], [s].[Id], [b1].[BaseInheritanceRelationshipEntityId], [b1].[Id], [d1].[DerivedInheritanceRelationshipEntityId] +ORDER BY [b].[Id], [b1].[BaseInheritanceRelationshipEntityId], [b1].[Id], [d1].[DerivedInheritanceRelationshipEntityId] """); } @@ -471,7 +471,7 @@ public override async Task Include_reference_with_inheritance_on_derived1(bool a AssertSql( """ -SELECT [b].[Id], [b].[Name], [d].[BaseId], [s].[Id], [b1].[BaseInheritanceRelationshipEntityId], [b1].[Id], [b1].[Name], [b].[OwnedReferenceOnBase_Id], [b].[OwnedReferenceOnBase_Name], [d1].[DerivedInheritanceRelationshipEntityId], [d1].[Id], [d1].[Name], [d].[Id], [d].[OwnedReferenceOnDerived_Id], [d].[OwnedReferenceOnDerived_Name], [s].[BaseParentId], [s].[Name], [s].[Discriminator] +SELECT [b].[Id], [b].[Name], [d].[BaseId], [b1].[BaseInheritanceRelationshipEntityId], [b1].[Id], [b1].[Name], [b].[OwnedReferenceOnBase_Id], [b].[OwnedReferenceOnBase_Name], [d1].[DerivedInheritanceRelationshipEntityId], [d1].[Id], [d1].[Name], [d].[Id], [d].[OwnedReferenceOnDerived_Id], [d].[OwnedReferenceOnDerived_Name], [s].[Id], [s].[BaseParentId], [s].[Name], [s].[Discriminator] FROM [BaseEntities] AS [b] INNER JOIN [DerivedEntities] AS [d] ON [b].[Id] = [d].[Id] LEFT JOIN ( @@ -483,7 +483,7 @@ FROM [BaseReferencesOnBase] AS [b0] ) AS [s] ON [b].[Id] = [s].[BaseParentId] LEFT JOIN [BaseEntities_OwnedCollectionOnBase] AS [b1] ON [b].[Id] = [b1].[BaseInheritanceRelationshipEntityId] LEFT JOIN [DerivedEntities_OwnedCollectionOnDerived] AS [d1] ON [b].[Id] = [d1].[DerivedInheritanceRelationshipEntityId] -ORDER BY [b].[Id], [s].[Id], [b1].[BaseInheritanceRelationshipEntityId], [b1].[Id], [d1].[DerivedInheritanceRelationshipEntityId] +ORDER BY [b].[Id], [b1].[BaseInheritanceRelationshipEntityId], [b1].[Id], [d1].[DerivedInheritanceRelationshipEntityId] """); } @@ -493,7 +493,7 @@ public override async Task Include_reference_with_inheritance_on_derived2(bool a AssertSql( """ -SELECT [b].[Id], [b].[Name], [d].[BaseId], [s].[Id], [b1].[BaseInheritanceRelationshipEntityId], [b1].[Id], [b1].[Name], [b].[OwnedReferenceOnBase_Id], [b].[OwnedReferenceOnBase_Name], [d1].[DerivedInheritanceRelationshipEntityId], [d1].[Id], [d1].[Name], [d].[Id], [d].[OwnedReferenceOnDerived_Id], [d].[OwnedReferenceOnDerived_Name], [s].[BaseParentId], [s].[Name], [s].[DerivedInheritanceRelationshipEntityId], [s].[Discriminator] +SELECT [b].[Id], [b].[Name], [d].[BaseId], [b1].[BaseInheritanceRelationshipEntityId], [b1].[Id], [b1].[Name], [b].[OwnedReferenceOnBase_Id], [b].[OwnedReferenceOnBase_Name], [d1].[DerivedInheritanceRelationshipEntityId], [d1].[Id], [d1].[Name], [d].[Id], [d].[OwnedReferenceOnDerived_Id], [d].[OwnedReferenceOnDerived_Name], [s].[Id], [s].[BaseParentId], [s].[Name], [s].[DerivedInheritanceRelationshipEntityId], [s].[Discriminator] FROM [BaseEntities] AS [b] INNER JOIN [DerivedEntities] AS [d] ON [b].[Id] = [d].[Id] LEFT JOIN ( @@ -505,7 +505,7 @@ FROM [BaseReferencesOnDerived] AS [b0] ) AS [s] ON [b].[Id] = [s].[BaseParentId] LEFT JOIN [BaseEntities_OwnedCollectionOnBase] AS [b1] ON [b].[Id] = [b1].[BaseInheritanceRelationshipEntityId] LEFT JOIN [DerivedEntities_OwnedCollectionOnDerived] AS [d1] ON [b].[Id] = [d1].[DerivedInheritanceRelationshipEntityId] -ORDER BY [b].[Id], [s].[Id], [b1].[BaseInheritanceRelationshipEntityId], [b1].[Id], [d1].[DerivedInheritanceRelationshipEntityId] +ORDER BY [b].[Id], [b1].[BaseInheritanceRelationshipEntityId], [b1].[Id], [d1].[DerivedInheritanceRelationshipEntityId] """); } @@ -515,7 +515,7 @@ public override async Task Include_reference_with_inheritance_on_derived4(bool a AssertSql( """ -SELECT [b].[Id], [b].[Name], [d].[BaseId], [s].[Id], [b1].[BaseInheritanceRelationshipEntityId], [b1].[Id], [b1].[Name], [b].[OwnedReferenceOnBase_Id], [b].[OwnedReferenceOnBase_Name], [d1].[DerivedInheritanceRelationshipEntityId], [d1].[Id], [d1].[Name], [d].[Id], [d].[OwnedReferenceOnDerived_Id], [d].[OwnedReferenceOnDerived_Name], [s].[BaseParentId], [s].[Name], [s].[DerivedInheritanceRelationshipEntityId] +SELECT [b].[Id], [b].[Name], [d].[BaseId], [b1].[BaseInheritanceRelationshipEntityId], [b1].[Id], [b1].[Name], [b].[OwnedReferenceOnBase_Id], [b].[OwnedReferenceOnBase_Name], [d1].[DerivedInheritanceRelationshipEntityId], [d1].[Id], [d1].[Name], [d].[Id], [d].[OwnedReferenceOnDerived_Id], [d].[OwnedReferenceOnDerived_Name], [s].[Id], [s].[BaseParentId], [s].[Name], [s].[DerivedInheritanceRelationshipEntityId] FROM [BaseEntities] AS [b] INNER JOIN [DerivedEntities] AS [d] ON [b].[Id] = [d].[Id] LEFT JOIN ( @@ -525,7 +525,7 @@ FROM [BaseReferencesOnDerived] AS [b0] ) AS [s] ON [b].[Id] = [s].[DerivedInheritanceRelationshipEntityId] LEFT JOIN [BaseEntities_OwnedCollectionOnBase] AS [b1] ON [b].[Id] = [b1].[BaseInheritanceRelationshipEntityId] LEFT JOIN [DerivedEntities_OwnedCollectionOnDerived] AS [d1] ON [b].[Id] = [d1].[DerivedInheritanceRelationshipEntityId] -ORDER BY [b].[Id], [s].[Id], [b1].[BaseInheritanceRelationshipEntityId], [b1].[Id], [d1].[DerivedInheritanceRelationshipEntityId] +ORDER BY [b].[Id], [b1].[BaseInheritanceRelationshipEntityId], [b1].[Id], [d1].[DerivedInheritanceRelationshipEntityId] """); } @@ -547,7 +547,7 @@ FROM [BaseEntities] AS [b0] ) AS [s] ON [b].[BaseParentId] = [s].[Id] LEFT JOIN [BaseEntities_OwnedCollectionOnBase] AS [b1] ON [s].[Id] = [b1].[BaseInheritanceRelationshipEntityId] LEFT JOIN [DerivedEntities_OwnedCollectionOnDerived] AS [d1] ON [s].[Id] = [d1].[DerivedInheritanceRelationshipEntityId] -ORDER BY [b].[Id], [s].[Id], [b1].[BaseInheritanceRelationshipEntityId], [b1].[Id], [d1].[DerivedInheritanceRelationshipEntityId] +ORDER BY [b].[Id], [b1].[BaseInheritanceRelationshipEntityId], [b1].[Id], [d1].[DerivedInheritanceRelationshipEntityId] """); } @@ -557,7 +557,7 @@ public override async Task Include_reference_with_inheritance_on_derived_with_fi AssertSql( """ -SELECT [b].[Id], [b].[Name], [d].[BaseId], [s].[Id], [b1].[BaseInheritanceRelationshipEntityId], [b1].[Id], [b1].[Name], [b].[OwnedReferenceOnBase_Id], [b].[OwnedReferenceOnBase_Name], [d1].[DerivedInheritanceRelationshipEntityId], [d1].[Id], [d1].[Name], [d].[Id], [d].[OwnedReferenceOnDerived_Id], [d].[OwnedReferenceOnDerived_Name], [s].[BaseParentId], [s].[Name], [s].[Discriminator] +SELECT [b].[Id], [b].[Name], [d].[BaseId], [b1].[BaseInheritanceRelationshipEntityId], [b1].[Id], [b1].[Name], [b].[OwnedReferenceOnBase_Id], [b].[OwnedReferenceOnBase_Name], [d1].[DerivedInheritanceRelationshipEntityId], [d1].[Id], [d1].[Name], [d].[Id], [d].[OwnedReferenceOnDerived_Id], [d].[OwnedReferenceOnDerived_Name], [s].[Id], [s].[BaseParentId], [s].[Name], [s].[Discriminator] FROM [BaseEntities] AS [b] INNER JOIN [DerivedEntities] AS [d] ON [b].[Id] = [d].[Id] LEFT JOIN ( @@ -570,7 +570,7 @@ FROM [BaseReferencesOnBase] AS [b0] 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 -ORDER BY [b].[Id], [s].[Id], [b1].[BaseInheritanceRelationshipEntityId], [b1].[Id], [d1].[DerivedInheritanceRelationshipEntityId] +ORDER BY [b].[Id], [b1].[BaseInheritanceRelationshipEntityId], [b1].[Id], [d1].[DerivedInheritanceRelationshipEntityId] """); } @@ -580,7 +580,7 @@ public override async Task Include_reference_with_inheritance_on_derived_with_fi AssertSql( """ -SELECT [b].[Id], [b].[Name], [d].[BaseId], [s].[Id], [b1].[BaseInheritanceRelationshipEntityId], [b1].[Id], [b1].[Name], [b].[OwnedReferenceOnBase_Id], [b].[OwnedReferenceOnBase_Name], [d1].[DerivedInheritanceRelationshipEntityId], [d1].[Id], [d1].[Name], [d].[Id], [d].[OwnedReferenceOnDerived_Id], [d].[OwnedReferenceOnDerived_Name], [s].[BaseParentId], [s].[Name], [s].[DerivedInheritanceRelationshipEntityId], [s].[Discriminator] +SELECT [b].[Id], [b].[Name], [d].[BaseId], [b1].[BaseInheritanceRelationshipEntityId], [b1].[Id], [b1].[Name], [b].[OwnedReferenceOnBase_Id], [b].[OwnedReferenceOnBase_Name], [d1].[DerivedInheritanceRelationshipEntityId], [d1].[Id], [d1].[Name], [d].[Id], [d].[OwnedReferenceOnDerived_Id], [d].[OwnedReferenceOnDerived_Name], [s].[Id], [s].[BaseParentId], [s].[Name], [s].[DerivedInheritanceRelationshipEntityId], [s].[Discriminator] FROM [BaseEntities] AS [b] INNER JOIN [DerivedEntities] AS [d] ON [b].[Id] = [d].[Id] LEFT JOIN ( @@ -593,7 +593,7 @@ FROM [BaseReferencesOnDerived] AS [b0] 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 -ORDER BY [b].[Id], [s].[Id], [b1].[BaseInheritanceRelationshipEntityId], [b1].[Id], [d1].[DerivedInheritanceRelationshipEntityId] +ORDER BY [b].[Id], [b1].[BaseInheritanceRelationshipEntityId], [b1].[Id], [d1].[DerivedInheritanceRelationshipEntityId] """); } @@ -603,7 +603,7 @@ public override async Task Include_reference_with_inheritance_on_derived_with_fi AssertSql( """ -SELECT [b].[Id], [b].[Name], [d].[BaseId], [s].[Id], [b1].[BaseInheritanceRelationshipEntityId], [b1].[Id], [b1].[Name], [b].[OwnedReferenceOnBase_Id], [b].[OwnedReferenceOnBase_Name], [d1].[DerivedInheritanceRelationshipEntityId], [d1].[Id], [d1].[Name], [d].[Id], [d].[OwnedReferenceOnDerived_Id], [d].[OwnedReferenceOnDerived_Name], [s].[BaseParentId], [s].[Name], [s].[DerivedInheritanceRelationshipEntityId] +SELECT [b].[Id], [b].[Name], [d].[BaseId], [b1].[BaseInheritanceRelationshipEntityId], [b1].[Id], [b1].[Name], [b].[OwnedReferenceOnBase_Id], [b].[OwnedReferenceOnBase_Name], [d1].[DerivedInheritanceRelationshipEntityId], [d1].[Id], [d1].[Name], [d].[Id], [d].[OwnedReferenceOnDerived_Id], [d].[OwnedReferenceOnDerived_Name], [s].[Id], [s].[BaseParentId], [s].[Name], [s].[DerivedInheritanceRelationshipEntityId] FROM [BaseEntities] AS [b] INNER JOIN [DerivedEntities] AS [d] ON [b].[Id] = [d].[Id] LEFT JOIN ( @@ -614,7 +614,7 @@ FROM [BaseReferencesOnDerived] AS [b0] 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 -ORDER BY [b].[Id], [s].[Id], [b1].[BaseInheritanceRelationshipEntityId], [b1].[Id], [d1].[DerivedInheritanceRelationshipEntityId] +ORDER BY [b].[Id], [b1].[BaseInheritanceRelationshipEntityId], [b1].[Id], [d1].[DerivedInheritanceRelationshipEntityId] """); } @@ -637,7 +637,7 @@ FROM [BaseEntities] AS [b0] LEFT JOIN [BaseEntities_OwnedCollectionOnBase] AS [b1] ON [s].[Id] = [b1].[BaseInheritanceRelationshipEntityId] LEFT JOIN [DerivedEntities_OwnedCollectionOnDerived] AS [d1] ON [s].[Id] = [d1].[DerivedInheritanceRelationshipEntityId] WHERE [b].[Name] <> N'Bar' OR [b].[Name] IS NULL -ORDER BY [b].[Id], [s].[Id], [b1].[BaseInheritanceRelationshipEntityId], [b1].[Id], [d1].[DerivedInheritanceRelationshipEntityId] +ORDER BY [b].[Id], [b1].[BaseInheritanceRelationshipEntityId], [b1].[Id], [d1].[DerivedInheritanceRelationshipEntityId] """); } @@ -661,7 +661,7 @@ FROM [BaseEntities] AS [b0] ) AS [s] ON [b].[BaseParentId] = [s].[Id] LEFT JOIN [BaseEntities_OwnedCollectionOnBase] AS [b1] ON [s].[Id] = [b1].[BaseInheritanceRelationshipEntityId] LEFT JOIN [DerivedEntities_OwnedCollectionOnDerived] AS [d1] ON [s].[Id] = [d1].[DerivedInheritanceRelationshipEntityId] -ORDER BY [b].[Id], [s].[Id], [b1].[BaseInheritanceRelationshipEntityId], [b1].[Id], [d1].[DerivedInheritanceRelationshipEntityId] +ORDER BY [b].[Id], [b1].[BaseInheritanceRelationshipEntityId], [b1].[Id], [d1].[DerivedInheritanceRelationshipEntityId] """); } @@ -673,7 +673,7 @@ public override async Task Include_reference_with_inheritance_with_filter(bool a """ SELECT [b].[Id], [b].[Name], [d].[BaseId], CASE WHEN [d].[Id] IS NOT NULL THEN N'DerivedInheritanceRelationshipEntity' -END AS [Discriminator], [s].[Id], [b1].[BaseInheritanceRelationshipEntityId], [b1].[Id], [b1].[Name], [b].[OwnedReferenceOnBase_Id], [b].[OwnedReferenceOnBase_Name], [d1].[DerivedInheritanceRelationshipEntityId], [d1].[Id], [d1].[Name], [d].[Id], [d].[OwnedReferenceOnDerived_Id], [d].[OwnedReferenceOnDerived_Name], [s].[BaseParentId], [s].[Name], [s].[Discriminator] +END AS [Discriminator], [b1].[BaseInheritanceRelationshipEntityId], [b1].[Id], [b1].[Name], [b].[OwnedReferenceOnBase_Id], [b].[OwnedReferenceOnBase_Name], [d1].[DerivedInheritanceRelationshipEntityId], [d1].[Id], [d1].[Name], [d].[Id], [d].[OwnedReferenceOnDerived_Id], [d].[OwnedReferenceOnDerived_Name], [s].[Id], [s].[BaseParentId], [s].[Name], [s].[Discriminator] FROM [BaseEntities] AS [b] LEFT JOIN [DerivedEntities] AS [d] ON [b].[Id] = [d].[Id] LEFT JOIN ( @@ -686,7 +686,7 @@ FROM [BaseReferencesOnBase] AS [b0] 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 -ORDER BY [b].[Id], [s].[Id], [b1].[BaseInheritanceRelationshipEntityId], [b1].[Id], [d1].[DerivedInheritanceRelationshipEntityId] +ORDER BY [b].[Id], [b1].[BaseInheritanceRelationshipEntityId], [b1].[Id], [d1].[DerivedInheritanceRelationshipEntityId] """); } @@ -711,7 +711,7 @@ FROM [BaseEntities] AS [b0] LEFT JOIN [BaseEntities_OwnedCollectionOnBase] AS [b1] ON [s].[Id] = [b1].[BaseInheritanceRelationshipEntityId] LEFT JOIN [DerivedEntities_OwnedCollectionOnDerived] AS [d1] ON [s].[Id] = [d1].[DerivedInheritanceRelationshipEntityId] WHERE [b].[Name] <> N'Bar' OR [b].[Name] IS NULL -ORDER BY [b].[Id], [s].[Id], [b1].[BaseInheritanceRelationshipEntityId], [b1].[Id], [d1].[DerivedInheritanceRelationshipEntityId] +ORDER BY [b].[Id], [b1].[BaseInheritanceRelationshipEntityId], [b1].[Id], [d1].[DerivedInheritanceRelationshipEntityId] """); } @@ -723,7 +723,7 @@ public override async Task Include_self_reference_with_inheritance(bool async) """ SELECT [b].[Id], [b].[Name], [d].[BaseId], CASE WHEN [d].[Id] IS NOT NULL THEN N'DerivedInheritanceRelationshipEntity' -END AS [Discriminator], [s].[Id], [b1].[BaseInheritanceRelationshipEntityId], [b1].[Id], [b1].[Name], [b].[OwnedReferenceOnBase_Id], [b].[OwnedReferenceOnBase_Name], [d1].[DerivedInheritanceRelationshipEntityId], [d1].[Id], [d1].[Name], [d].[Id], [d].[OwnedReferenceOnDerived_Id], [d].[OwnedReferenceOnDerived_Name], [s].[Name], [s].[BaseId], [b2].[BaseInheritanceRelationshipEntityId], [b2].[Id], [b2].[Name], [s].[OwnedReferenceOnBase_Id], [s].[OwnedReferenceOnBase_Name], [d2].[DerivedInheritanceRelationshipEntityId], [d2].[Id], [d2].[Name], [s].[Id0], [s].[OwnedReferenceOnDerived_Id], [s].[OwnedReferenceOnDerived_Name] +END AS [Discriminator], [b1].[BaseInheritanceRelationshipEntityId], [b1].[Id], [b1].[Name], [b].[OwnedReferenceOnBase_Id], [b].[OwnedReferenceOnBase_Name], [d1].[DerivedInheritanceRelationshipEntityId], [d1].[Id], [d1].[Name], [d].[Id], [d].[OwnedReferenceOnDerived_Id], [d].[OwnedReferenceOnDerived_Name], [s].[Id], [s].[Name], [s].[BaseId], [b2].[BaseInheritanceRelationshipEntityId], [b2].[Id], [b2].[Name], [s].[OwnedReferenceOnBase_Id], [s].[OwnedReferenceOnBase_Name], [d2].[DerivedInheritanceRelationshipEntityId], [d2].[Id], [d2].[Name], [s].[Id0], [s].[OwnedReferenceOnDerived_Id], [s].[OwnedReferenceOnDerived_Name] FROM [BaseEntities] AS [b] LEFT JOIN [DerivedEntities] AS [d] ON [b].[Id] = [d].[Id] LEFT JOIN ( @@ -735,7 +735,7 @@ FROM [BaseEntities] AS [b0] LEFT JOIN [DerivedEntities_OwnedCollectionOnDerived] AS [d1] ON [b].[Id] = [d1].[DerivedInheritanceRelationshipEntityId] LEFT JOIN [BaseEntities_OwnedCollectionOnBase] AS [b2] ON [s].[Id] = [b2].[BaseInheritanceRelationshipEntityId] LEFT JOIN [DerivedEntities_OwnedCollectionOnDerived] AS [d2] ON [s].[Id] = [d2].[DerivedInheritanceRelationshipEntityId] -ORDER BY [b].[Id], [s].[Id], [b1].[BaseInheritanceRelationshipEntityId], [b1].[Id], [d1].[DerivedInheritanceRelationshipEntityId], [d1].[Id], [b2].[BaseInheritanceRelationshipEntityId], [b2].[Id], [d2].[DerivedInheritanceRelationshipEntityId] +ORDER BY [b].[Id], [b1].[BaseInheritanceRelationshipEntityId], [b1].[Id], [d1].[DerivedInheritanceRelationshipEntityId], [d1].[Id], [b2].[BaseInheritanceRelationshipEntityId], [b2].[Id], [d2].[DerivedInheritanceRelationshipEntityId] """); } @@ -745,7 +745,7 @@ public override async Task Include_self_reference_with_inheritance_reverse(bool AssertSql( """ -SELECT [b].[Id], [b].[Name], [d].[BaseId], [s].[Id], [b1].[BaseInheritanceRelationshipEntityId], [b1].[Id], [b1].[Name], [b].[OwnedReferenceOnBase_Id], [b].[OwnedReferenceOnBase_Name], [d1].[DerivedInheritanceRelationshipEntityId], [d1].[Id], [d1].[Name], [d].[Id], [d].[OwnedReferenceOnDerived_Id], [d].[OwnedReferenceOnDerived_Name], [s].[Name], [s].[BaseId], [s].[Discriminator], [b2].[BaseInheritanceRelationshipEntityId], [b2].[Id], [b2].[Name], [s].[OwnedReferenceOnBase_Id], [s].[OwnedReferenceOnBase_Name], [d2].[DerivedInheritanceRelationshipEntityId], [d2].[Id], [d2].[Name], [s].[Id0], [s].[OwnedReferenceOnDerived_Id], [s].[OwnedReferenceOnDerived_Name] +SELECT [b].[Id], [b].[Name], [d].[BaseId], [b1].[BaseInheritanceRelationshipEntityId], [b1].[Id], [b1].[Name], [b].[OwnedReferenceOnBase_Id], [b].[OwnedReferenceOnBase_Name], [d1].[DerivedInheritanceRelationshipEntityId], [d1].[Id], [d1].[Name], [d].[Id], [d].[OwnedReferenceOnDerived_Id], [d].[OwnedReferenceOnDerived_Name], [s].[Id], [s].[Name], [s].[BaseId], [s].[Discriminator], [b2].[BaseInheritanceRelationshipEntityId], [b2].[Id], [b2].[Name], [s].[OwnedReferenceOnBase_Id], [s].[OwnedReferenceOnBase_Name], [d2].[DerivedInheritanceRelationshipEntityId], [d2].[Id], [d2].[Name], [s].[Id0], [s].[OwnedReferenceOnDerived_Id], [s].[OwnedReferenceOnDerived_Name] FROM [BaseEntities] AS [b] INNER JOIN [DerivedEntities] AS [d] ON [b].[Id] = [d].[Id] LEFT JOIN ( @@ -759,7 +759,7 @@ FROM [BaseEntities] AS [b0] LEFT JOIN [DerivedEntities_OwnedCollectionOnDerived] AS [d1] ON [b].[Id] = [d1].[DerivedInheritanceRelationshipEntityId] LEFT JOIN [BaseEntities_OwnedCollectionOnBase] AS [b2] ON [s].[Id] = [b2].[BaseInheritanceRelationshipEntityId] LEFT JOIN [DerivedEntities_OwnedCollectionOnDerived] AS [d2] ON [s].[Id] = [d2].[DerivedInheritanceRelationshipEntityId] -ORDER BY [b].[Id], [s].[Id], [b1].[BaseInheritanceRelationshipEntityId], [b1].[Id], [d1].[DerivedInheritanceRelationshipEntityId], [d1].[Id], [b2].[BaseInheritanceRelationshipEntityId], [b2].[Id], [d2].[DerivedInheritanceRelationshipEntityId] +ORDER BY [b].[Id], [b1].[BaseInheritanceRelationshipEntityId], [b1].[Id], [d1].[DerivedInheritanceRelationshipEntityId], [d1].[Id], [b2].[BaseInheritanceRelationshipEntityId], [b2].[Id], [d2].[DerivedInheritanceRelationshipEntityId] """); } @@ -776,7 +776,7 @@ LEFT JOIN ( FROM [PrincipalEntities] AS [p] LEFT JOIN [ReferencedEntities] AS [r0] ON [p].[ReferenceId] = [r0].[Id] ) AS [s] ON [r].[Id] = [s].[ReferencedEntityId] -ORDER BY [r].[Id], [s].[Id] +ORDER BY [r].[Id] """); } @@ -838,7 +838,7 @@ FROM [BaseEntities] AS [b0] ) AS [s0] ON [s].[BaseParentId] = [s0].[Id] LEFT JOIN [BaseEntities_OwnedCollectionOnBase] AS [b1] ON [s0].[Id] = [b1].[BaseInheritanceRelationshipEntityId] LEFT JOIN [DerivedEntities_OwnedCollectionOnDerived] AS [d1] ON [s0].[Id] = [d1].[DerivedInheritanceRelationshipEntityId] -ORDER BY [n].[Id], [s].[Id], [s0].[Id], [b1].[BaseInheritanceRelationshipEntityId], [b1].[Id], [d1].[DerivedInheritanceRelationshipEntityId] +ORDER BY [n].[Id], [b1].[BaseInheritanceRelationshipEntityId], [b1].[Id], [d1].[DerivedInheritanceRelationshipEntityId] """); } @@ -869,7 +869,7 @@ FROM [NestedReferences] AS [n] LEFT JOIN [NestedReferencesDerived] AS [n0] ON [n].[Id] = [n0].[Id] ) AS [s] ON [b1].[Id] = [s].[ParentCollectionId] ) AS [s0] ON [b].[Id] = [s0].[BaseParentId] -ORDER BY [b].[Id], [b0].[BaseInheritanceRelationshipEntityId], [b0].[Id], [d0].[DerivedInheritanceRelationshipEntityId], [d0].[Id], [s0].[Id] +ORDER BY [b].[Id], [b0].[BaseInheritanceRelationshipEntityId], [b0].[Id], [d0].[DerivedInheritanceRelationshipEntityId], [d0].[Id] """); } @@ -900,7 +900,7 @@ FROM [BaseEntities] AS [b0] ) AS [s0] ON [s].[BaseParentId] = [s0].[Id] LEFT JOIN [BaseEntities_OwnedCollectionOnBase] AS [b1] ON [s0].[Id] = [b1].[BaseInheritanceRelationshipEntityId] LEFT JOIN [DerivedEntities_OwnedCollectionOnDerived] AS [d1] ON [s0].[Id] = [d1].[DerivedInheritanceRelationshipEntityId] -ORDER BY [n].[Id], [s].[Id], [s0].[Id], [b1].[BaseInheritanceRelationshipEntityId], [b1].[Id], [d1].[DerivedInheritanceRelationshipEntityId] +ORDER BY [n].[Id], [b1].[BaseInheritanceRelationshipEntityId], [b1].[Id], [d1].[DerivedInheritanceRelationshipEntityId] """); } @@ -912,7 +912,7 @@ public override async Task Nested_include_with_inheritance_reference_collection( """ SELECT [b].[Id], [b].[Name], [d].[BaseId], CASE WHEN [d].[Id] IS NOT NULL THEN N'DerivedInheritanceRelationshipEntity' -END AS [Discriminator], [s].[Id], [b1].[BaseInheritanceRelationshipEntityId], [b1].[Id], [b1].[Name], [b].[OwnedReferenceOnBase_Id], [b].[OwnedReferenceOnBase_Name], [d1].[DerivedInheritanceRelationshipEntityId], [d1].[Id], [d1].[Name], [d].[Id], [d].[OwnedReferenceOnDerived_Id], [d].[OwnedReferenceOnDerived_Name], [s].[BaseParentId], [s].[Name], [s].[Discriminator], [s0].[Id], [s0].[Name], [s0].[ParentCollectionId], [s0].[ParentReferenceId], [s0].[Discriminator] +END AS [Discriminator], [b1].[BaseInheritanceRelationshipEntityId], [b1].[Id], [b1].[Name], [b].[OwnedReferenceOnBase_Id], [b].[OwnedReferenceOnBase_Name], [d1].[DerivedInheritanceRelationshipEntityId], [d1].[Id], [d1].[Name], [d].[Id], [d].[OwnedReferenceOnDerived_Id], [d].[OwnedReferenceOnDerived_Name], [s].[Id], [s].[BaseParentId], [s].[Name], [s].[Discriminator], [s0].[Id], [s0].[Name], [s0].[ParentCollectionId], [s0].[ParentReferenceId], [s0].[Discriminator] FROM [BaseEntities] AS [b] LEFT JOIN [DerivedEntities] AS [d] ON [b].[Id] = [d].[Id] LEFT JOIN ( @@ -931,7 +931,7 @@ END AS [Discriminator] FROM [NestedCollections] AS [n] LEFT JOIN [NestedCollectionsDerived] AS [n0] ON [n].[Id] = [n0].[Id] ) AS [s0] ON [s].[Id] = [s0].[ParentReferenceId] -ORDER BY [b].[Id], [s].[Id], [b1].[BaseInheritanceRelationshipEntityId], [b1].[Id], [d1].[DerivedInheritanceRelationshipEntityId], [d1].[Id] +ORDER BY [b].[Id], [b1].[BaseInheritanceRelationshipEntityId], [b1].[Id], [d1].[DerivedInheritanceRelationshipEntityId], [d1].[Id] """); } @@ -941,7 +941,7 @@ public override async Task Nested_include_with_inheritance_reference_collection_ AssertSql( """ -SELECT [b].[Id], [b].[Name], [d].[BaseId], [s].[Id], [b1].[BaseInheritanceRelationshipEntityId], [b1].[Id], [b1].[Name], [b].[OwnedReferenceOnBase_Id], [b].[OwnedReferenceOnBase_Name], [d1].[DerivedInheritanceRelationshipEntityId], [d1].[Id], [d1].[Name], [d].[Id], [d].[OwnedReferenceOnDerived_Id], [d].[OwnedReferenceOnDerived_Name], [s].[BaseParentId], [s].[Name], [s].[Discriminator], [s0].[Id], [s0].[Name], [s0].[ParentCollectionId], [s0].[ParentReferenceId], [s0].[Discriminator] +SELECT [b].[Id], [b].[Name], [d].[BaseId], [b1].[BaseInheritanceRelationshipEntityId], [b1].[Id], [b1].[Name], [b].[OwnedReferenceOnBase_Id], [b].[OwnedReferenceOnBase_Name], [d1].[DerivedInheritanceRelationshipEntityId], [d1].[Id], [d1].[Name], [d].[Id], [d].[OwnedReferenceOnDerived_Id], [d].[OwnedReferenceOnDerived_Name], [s].[Id], [s].[BaseParentId], [s].[Name], [s].[Discriminator], [s0].[Id], [s0].[Name], [s0].[ParentCollectionId], [s0].[ParentReferenceId], [s0].[Discriminator] FROM [BaseEntities] AS [b] INNER JOIN [DerivedEntities] AS [d] ON [b].[Id] = [d].[Id] LEFT JOIN ( @@ -960,7 +960,7 @@ END AS [Discriminator] FROM [NestedCollections] AS [n] LEFT JOIN [NestedCollectionsDerived] AS [n0] ON [n].[Id] = [n0].[Id] ) AS [s0] ON [s].[Id] = [s0].[ParentReferenceId] -ORDER BY [b].[Id], [s].[Id], [b1].[BaseInheritanceRelationshipEntityId], [b1].[Id], [d1].[DerivedInheritanceRelationshipEntityId], [d1].[Id] +ORDER BY [b].[Id], [b1].[BaseInheritanceRelationshipEntityId], [b1].[Id], [d1].[DerivedInheritanceRelationshipEntityId], [d1].[Id] """); } @@ -991,7 +991,7 @@ FROM [BaseEntities] AS [b0] ) AS [s0] ON [s].[BaseParentId] = [s0].[Id] LEFT JOIN [BaseEntities_OwnedCollectionOnBase] AS [b1] ON [s0].[Id] = [b1].[BaseInheritanceRelationshipEntityId] LEFT JOIN [DerivedEntities_OwnedCollectionOnDerived] AS [d1] ON [s0].[Id] = [d1].[DerivedInheritanceRelationshipEntityId] -ORDER BY [n].[Id], [s].[Id], [s0].[Id], [b1].[BaseInheritanceRelationshipEntityId], [b1].[Id], [d1].[DerivedInheritanceRelationshipEntityId] +ORDER BY [n].[Id], [b1].[BaseInheritanceRelationshipEntityId], [b1].[Id], [d1].[DerivedInheritanceRelationshipEntityId] """); } @@ -1003,7 +1003,7 @@ public override async Task Nested_include_with_inheritance_reference_reference(b """ SELECT [b].[Id], [b].[Name], [d].[BaseId], CASE WHEN [d].[Id] IS NOT NULL THEN N'DerivedInheritanceRelationshipEntity' -END AS [Discriminator], [s].[Id], [s0].[Id], [b1].[BaseInheritanceRelationshipEntityId], [b1].[Id], [b1].[Name], [b].[OwnedReferenceOnBase_Id], [b].[OwnedReferenceOnBase_Name], [d1].[DerivedInheritanceRelationshipEntityId], [d1].[Id], [d1].[Name], [d].[Id], [d].[OwnedReferenceOnDerived_Id], [d].[OwnedReferenceOnDerived_Name], [s].[BaseParentId], [s].[Name], [s].[Discriminator], [s0].[Name], [s0].[ParentCollectionId], [s0].[ParentReferenceId], [s0].[Discriminator] +END AS [Discriminator], [b1].[BaseInheritanceRelationshipEntityId], [b1].[Id], [b1].[Name], [b].[OwnedReferenceOnBase_Id], [b].[OwnedReferenceOnBase_Name], [d1].[DerivedInheritanceRelationshipEntityId], [d1].[Id], [d1].[Name], [d].[Id], [d].[OwnedReferenceOnDerived_Id], [d].[OwnedReferenceOnDerived_Name], [s].[Id], [s].[BaseParentId], [s].[Name], [s].[Discriminator], [s0].[Id], [s0].[Name], [s0].[ParentCollectionId], [s0].[ParentReferenceId], [s0].[Discriminator] FROM [BaseEntities] AS [b] LEFT JOIN [DerivedEntities] AS [d] ON [b].[Id] = [d].[Id] LEFT JOIN ( @@ -1022,7 +1022,7 @@ FROM [NestedReferences] AS [n] ) AS [s0] ON [s].[Id] = [s0].[ParentReferenceId] LEFT JOIN [BaseEntities_OwnedCollectionOnBase] AS [b1] ON [b].[Id] = [b1].[BaseInheritanceRelationshipEntityId] LEFT JOIN [DerivedEntities_OwnedCollectionOnDerived] AS [d1] ON [b].[Id] = [d1].[DerivedInheritanceRelationshipEntityId] -ORDER BY [b].[Id], [s].[Id], [s0].[Id], [b1].[BaseInheritanceRelationshipEntityId], [b1].[Id], [d1].[DerivedInheritanceRelationshipEntityId] +ORDER BY [b].[Id], [b1].[BaseInheritanceRelationshipEntityId], [b1].[Id], [d1].[DerivedInheritanceRelationshipEntityId] """); } @@ -1032,7 +1032,7 @@ public override async Task Nested_include_with_inheritance_reference_reference_o AssertSql( """ -SELECT [b].[Id], [b].[Name], [d].[BaseId], [s].[Id], [s0].[Id], [b1].[BaseInheritanceRelationshipEntityId], [b1].[Id], [b1].[Name], [b].[OwnedReferenceOnBase_Id], [b].[OwnedReferenceOnBase_Name], [d1].[DerivedInheritanceRelationshipEntityId], [d1].[Id], [d1].[Name], [d].[Id], [d].[OwnedReferenceOnDerived_Id], [d].[OwnedReferenceOnDerived_Name], [s].[BaseParentId], [s].[Name], [s].[Discriminator], [s0].[Name], [s0].[ParentCollectionId], [s0].[ParentReferenceId], [s0].[Discriminator] +SELECT [b].[Id], [b].[Name], [d].[BaseId], [b1].[BaseInheritanceRelationshipEntityId], [b1].[Id], [b1].[Name], [b].[OwnedReferenceOnBase_Id], [b].[OwnedReferenceOnBase_Name], [d1].[DerivedInheritanceRelationshipEntityId], [d1].[Id], [d1].[Name], [d].[Id], [d].[OwnedReferenceOnDerived_Id], [d].[OwnedReferenceOnDerived_Name], [s].[Id], [s].[BaseParentId], [s].[Name], [s].[Discriminator], [s0].[Id], [s0].[Name], [s0].[ParentCollectionId], [s0].[ParentReferenceId], [s0].[Discriminator] FROM [BaseEntities] AS [b] INNER JOIN [DerivedEntities] AS [d] ON [b].[Id] = [d].[Id] LEFT JOIN ( @@ -1051,7 +1051,7 @@ FROM [NestedReferences] AS [n] ) AS [s0] ON [s].[Id] = [s0].[ParentReferenceId] LEFT JOIN [BaseEntities_OwnedCollectionOnBase] AS [b1] ON [b].[Id] = [b1].[BaseInheritanceRelationshipEntityId] LEFT JOIN [DerivedEntities_OwnedCollectionOnDerived] AS [d1] ON [b].[Id] = [d1].[DerivedInheritanceRelationshipEntityId] -ORDER BY [b].[Id], [s].[Id], [s0].[Id], [b1].[BaseInheritanceRelationshipEntityId], [b1].[Id], [d1].[DerivedInheritanceRelationshipEntityId] +ORDER BY [b].[Id], [b1].[BaseInheritanceRelationshipEntityId], [b1].[Id], [d1].[DerivedInheritanceRelationshipEntityId] """); } @@ -1082,7 +1082,7 @@ FROM [BaseEntities] AS [b0] ) AS [s0] ON [s].[BaseParentId] = [s0].[Id] LEFT JOIN [BaseEntities_OwnedCollectionOnBase] AS [b1] ON [s0].[Id] = [b1].[BaseInheritanceRelationshipEntityId] LEFT JOIN [DerivedEntities_OwnedCollectionOnDerived] AS [d1] ON [s0].[Id] = [d1].[DerivedInheritanceRelationshipEntityId] -ORDER BY [n].[Id], [s].[Id], [s0].[Id], [b1].[BaseInheritanceRelationshipEntityId], [b1].[Id], [d1].[DerivedInheritanceRelationshipEntityId] +ORDER BY [n].[Id], [b1].[BaseInheritanceRelationshipEntityId], [b1].[Id], [d1].[DerivedInheritanceRelationshipEntityId] """); } @@ -1188,29 +1188,29 @@ WHEN [d0].[Id] IS NOT NULL THEN N'DerivedInheritanceRelationshipEntity' FROM [BaseEntities] AS [b0] LEFT JOIN [DerivedEntities] AS [d0] ON [b0].[Id] = [d0].[Id] ) AS [s] ON [b].[BaseParentId] = [s].[Id] -ORDER BY [b].[Id], [s].[Id] +ORDER BY [b].[Id] """, // """ -SELECT [b2].[BaseInheritanceRelationshipEntityId], [b2].[Id], [b2].[Name], [b].[Id], [s].[Id] +SELECT [b2].[BaseInheritanceRelationshipEntityId], [b2].[Id], [b2].[Name], [b].[Id] FROM [BaseCollectionsOnBase] AS [b] LEFT JOIN ( SELECT [b0].[Id] FROM [BaseEntities] AS [b0] ) AS [s] ON [b].[BaseParentId] = [s].[Id] INNER JOIN [BaseEntities_OwnedCollectionOnBase] AS [b2] ON [s].[Id] = [b2].[BaseInheritanceRelationshipEntityId] -ORDER BY [b].[Id], [s].[Id] +ORDER BY [b].[Id] """, // """ -SELECT [d2].[DerivedInheritanceRelationshipEntityId], [d2].[Id], [d2].[Name], [b].[Id], [s].[Id] +SELECT [d2].[DerivedInheritanceRelationshipEntityId], [d2].[Id], [d2].[Name], [b].[Id] FROM [BaseCollectionsOnBase] AS [b] LEFT JOIN ( SELECT [b0].[Id] FROM [BaseEntities] AS [b0] ) AS [s] ON [b].[BaseParentId] = [s].[Id] INNER JOIN [DerivedEntities_OwnedCollectionOnDerived] AS [d2] ON [s].[Id] = [d2].[DerivedInheritanceRelationshipEntityId] -ORDER BY [b].[Id], [s].[Id] +ORDER BY [b].[Id] """); } @@ -1279,11 +1279,11 @@ FROM [BaseEntities] AS [b0] LEFT JOIN [DerivedEntities] AS [d0] ON [b0].[Id] = [d0].[Id] ) AS [s] ON [b].[BaseParentId] = [s].[Id] WHERE [b].[Name] <> N'Bar' OR [b].[Name] IS NULL -ORDER BY [b].[Id], [s].[Id] +ORDER BY [b].[Id] """, // """ -SELECT [b2].[BaseInheritanceRelationshipEntityId], [b2].[Id], [b2].[Name], [b].[Id], [s].[Id] +SELECT [b2].[BaseInheritanceRelationshipEntityId], [b2].[Id], [b2].[Name], [b].[Id] FROM [BaseCollectionsOnBase] AS [b] LEFT JOIN ( SELECT [b0].[Id] @@ -1291,11 +1291,11 @@ FROM [BaseEntities] AS [b0] ) AS [s] ON [b].[BaseParentId] = [s].[Id] INNER JOIN [BaseEntities_OwnedCollectionOnBase] AS [b2] ON [s].[Id] = [b2].[BaseInheritanceRelationshipEntityId] WHERE [b].[Name] <> N'Bar' OR [b].[Name] IS NULL -ORDER BY [b].[Id], [s].[Id] +ORDER BY [b].[Id] """, // """ -SELECT [d2].[DerivedInheritanceRelationshipEntityId], [d2].[Id], [d2].[Name], [b].[Id], [s].[Id] +SELECT [d2].[DerivedInheritanceRelationshipEntityId], [d2].[Id], [d2].[Name], [b].[Id] FROM [BaseCollectionsOnBase] AS [b] LEFT JOIN ( SELECT [b0].[Id] @@ -1303,7 +1303,7 @@ FROM [BaseEntities] AS [b0] ) AS [s] ON [b].[BaseParentId] = [s].[Id] INNER JOIN [DerivedEntities_OwnedCollectionOnDerived] AS [d2] ON [s].[Id] = [d2].[DerivedInheritanceRelationshipEntityId] WHERE [b].[Name] <> N'Bar' OR [b].[Name] IS NULL -ORDER BY [b].[Id], [s].[Id] +ORDER BY [b].[Id] """); } @@ -1358,29 +1358,29 @@ WHEN [d].[Id] IS NOT NULL THEN N'DerivedInheritanceRelationshipEntity' FROM [BaseEntities] AS [b] LEFT JOIN [DerivedEntities] AS [d] ON [b].[Id] = [d].[Id] ) AS [s] ON [c].[ParentId] = [s].[Id] -ORDER BY [c].[Id], [s].[Id] +ORDER BY [c].[Id] """, // """ -SELECT [b1].[BaseInheritanceRelationshipEntityId], [b1].[Id], [b1].[Name], [c].[Id], [s].[Id] +SELECT [b1].[BaseInheritanceRelationshipEntityId], [b1].[Id], [b1].[Name], [c].[Id] FROM [CollectionsOnBase] AS [c] LEFT JOIN ( SELECT [b].[Id] FROM [BaseEntities] AS [b] ) AS [s] ON [c].[ParentId] = [s].[Id] INNER JOIN [BaseEntities_OwnedCollectionOnBase] AS [b1] ON [s].[Id] = [b1].[BaseInheritanceRelationshipEntityId] -ORDER BY [c].[Id], [s].[Id] +ORDER BY [c].[Id] """, // """ -SELECT [d1].[DerivedInheritanceRelationshipEntityId], [d1].[Id], [d1].[Name], [c].[Id], [s].[Id] +SELECT [d1].[DerivedInheritanceRelationshipEntityId], [d1].[Id], [d1].[Name], [c].[Id] FROM [CollectionsOnBase] AS [c] LEFT JOIN ( SELECT [b].[Id] FROM [BaseEntities] AS [b] ) AS [s] ON [c].[ParentId] = [s].[Id] INNER JOIN [DerivedEntities_OwnedCollectionOnDerived] AS [d1] ON [s].[Id] = [d1].[DerivedInheritanceRelationshipEntityId] -ORDER BY [c].[Id], [s].[Id] +ORDER BY [c].[Id] """); } @@ -1440,11 +1440,11 @@ FROM [BaseEntities] AS [b] LEFT JOIN [DerivedEntities] AS [d] ON [b].[Id] = [d].[Id] ) AS [s] ON [c].[ParentId] = [s].[Id] WHERE [c].[Name] <> N'Bar' OR [c].[Name] IS NULL -ORDER BY [c].[Id], [s].[Id] +ORDER BY [c].[Id] """, // """ -SELECT [b1].[BaseInheritanceRelationshipEntityId], [b1].[Id], [b1].[Name], [c].[Id], [s].[Id] +SELECT [b1].[BaseInheritanceRelationshipEntityId], [b1].[Id], [b1].[Name], [c].[Id] FROM [CollectionsOnBase] AS [c] LEFT JOIN ( SELECT [b].[Id] @@ -1452,11 +1452,11 @@ FROM [BaseEntities] AS [b] ) AS [s] ON [c].[ParentId] = [s].[Id] INNER JOIN [BaseEntities_OwnedCollectionOnBase] AS [b1] ON [s].[Id] = [b1].[BaseInheritanceRelationshipEntityId] WHERE [c].[Name] <> N'Bar' OR [c].[Name] IS NULL -ORDER BY [c].[Id], [s].[Id] +ORDER BY [c].[Id] """, // """ -SELECT [d1].[DerivedInheritanceRelationshipEntityId], [d1].[Id], [d1].[Name], [c].[Id], [s].[Id] +SELECT [d1].[DerivedInheritanceRelationshipEntityId], [d1].[Id], [d1].[Name], [c].[Id] FROM [CollectionsOnBase] AS [c] LEFT JOIN ( SELECT [b].[Id] @@ -1464,7 +1464,7 @@ FROM [BaseEntities] AS [b] ) AS [s] ON [c].[ParentId] = [s].[Id] INNER JOIN [DerivedEntities_OwnedCollectionOnDerived] AS [d1] ON [s].[Id] = [d1].[DerivedInheritanceRelationshipEntityId] WHERE [c].[Name] <> N'Bar' OR [c].[Name] IS NULL -ORDER BY [c].[Id], [s].[Id] +ORDER BY [c].[Id] """); } @@ -1611,11 +1611,11 @@ LEFT JOIN ( FROM [BaseEntities] AS [b0] INNER JOIN [DerivedEntities] AS [d0] ON [b0].[Id] = [d0].[Id] ) AS [s] ON [b].[ParentId] = [s].[Id] -ORDER BY [b].[Id], [s].[Id] +ORDER BY [b].[Id] """, // """ -SELECT [b2].[BaseInheritanceRelationshipEntityId], [b2].[Id], [b2].[Name], [b].[Id], [s].[Id] +SELECT [b2].[BaseInheritanceRelationshipEntityId], [b2].[Id], [b2].[Name], [b].[Id] FROM [BaseCollectionsOnDerived] AS [b] LEFT JOIN ( SELECT [b0].[Id] @@ -1623,11 +1623,11 @@ FROM [BaseEntities] AS [b0] INNER JOIN [DerivedEntities] AS [d0] ON [b0].[Id] = [d0].[Id] ) AS [s] ON [b].[ParentId] = [s].[Id] INNER JOIN [BaseEntities_OwnedCollectionOnBase] AS [b2] ON [s].[Id] = [b2].[BaseInheritanceRelationshipEntityId] -ORDER BY [b].[Id], [s].[Id] +ORDER BY [b].[Id] """, // """ -SELECT [d2].[DerivedInheritanceRelationshipEntityId], [d2].[Id], [d2].[Name], [b].[Id], [s].[Id] +SELECT [d2].[DerivedInheritanceRelationshipEntityId], [d2].[Id], [d2].[Name], [b].[Id] FROM [BaseCollectionsOnDerived] AS [b] LEFT JOIN ( SELECT [b0].[Id] @@ -1635,7 +1635,7 @@ FROM [BaseEntities] AS [b0] INNER JOIN [DerivedEntities] AS [d0] ON [b0].[Id] = [d0].[Id] ) AS [s] ON [b].[ParentId] = [s].[Id] INNER JOIN [DerivedEntities_OwnedCollectionOnDerived] AS [d2] ON [s].[Id] = [d2].[DerivedInheritanceRelationshipEntityId] -ORDER BY [b].[Id], [s].[Id] +ORDER BY [b].[Id] """); } @@ -1647,7 +1647,7 @@ public override async Task Nested_include_with_inheritance_reference_collection_ """ SELECT [b].[Id], [b].[Name], [d].[BaseId], CASE WHEN [d].[Id] IS NOT NULL THEN N'DerivedInheritanceRelationshipEntity' -END AS [Discriminator], [s].[Id], [b].[OwnedReferenceOnBase_Id], [b].[OwnedReferenceOnBase_Name], [d].[Id], [d].[OwnedReferenceOnDerived_Id], [d].[OwnedReferenceOnDerived_Name], [s].[BaseParentId], [s].[Name], [s].[Discriminator] +END AS [Discriminator], [b].[OwnedReferenceOnBase_Id], [b].[OwnedReferenceOnBase_Name], [d].[Id], [d].[OwnedReferenceOnDerived_Id], [d].[OwnedReferenceOnDerived_Name], [s].[Id], [s].[BaseParentId], [s].[Name], [s].[Discriminator] FROM [BaseEntities] AS [b] LEFT JOIN [DerivedEntities] AS [d] ON [b].[Id] = [d].[Id] LEFT JOIN ( @@ -1657,33 +1657,25 @@ END AS [Discriminator] FROM [BaseReferencesOnBase] AS [b0] LEFT JOIN [DerivedReferencesOnBase] AS [d0] ON [b0].[Id] = [d0].[Id] ) AS [s] ON [b].[Id] = [s].[BaseParentId] -ORDER BY [b].[Id], [s].[Id] +ORDER BY [b].[Id] """, // """ -SELECT [b2].[BaseInheritanceRelationshipEntityId], [b2].[Id], [b2].[Name], [b].[Id], [s].[Id] +SELECT [b2].[BaseInheritanceRelationshipEntityId], [b2].[Id], [b2].[Name], [b].[Id] FROM [BaseEntities] AS [b] -LEFT JOIN ( - SELECT [b0].[Id], [b0].[BaseParentId] - FROM [BaseReferencesOnBase] AS [b0] -) AS [s] ON [b].[Id] = [s].[BaseParentId] INNER JOIN [BaseEntities_OwnedCollectionOnBase] AS [b2] ON [b].[Id] = [b2].[BaseInheritanceRelationshipEntityId] -ORDER BY [b].[Id], [s].[Id] +ORDER BY [b].[Id] """, // """ -SELECT [d2].[DerivedInheritanceRelationshipEntityId], [d2].[Id], [d2].[Name], [b].[Id], [s].[Id] +SELECT [d2].[DerivedInheritanceRelationshipEntityId], [d2].[Id], [d2].[Name], [b].[Id] FROM [BaseEntities] AS [b] -LEFT JOIN ( - SELECT [b0].[Id], [b0].[BaseParentId] - FROM [BaseReferencesOnBase] AS [b0] -) AS [s] ON [b].[Id] = [s].[BaseParentId] INNER JOIN [DerivedEntities_OwnedCollectionOnDerived] AS [d2] ON [b].[Id] = [d2].[DerivedInheritanceRelationshipEntityId] -ORDER BY [b].[Id], [s].[Id] +ORDER BY [b].[Id] """, // """ -SELECT [s0].[Id], [s0].[Name], [s0].[ParentCollectionId], [s0].[ParentReferenceId], [s0].[Discriminator], [b].[Id], [s].[Id] +SELECT [s0].[Id], [s0].[Name], [s0].[ParentCollectionId], [s0].[ParentReferenceId], [s0].[Discriminator], [b].[Id] FROM [BaseEntities] AS [b] LEFT JOIN ( SELECT [b0].[Id], [b0].[BaseParentId] @@ -1696,7 +1688,7 @@ END AS [Discriminator] FROM [NestedCollections] AS [n] LEFT JOIN [NestedCollectionsDerived] AS [n0] ON [n].[Id] = [n0].[Id] ) AS [s0] ON [s].[Id] = [s0].[ParentReferenceId] -ORDER BY [b].[Id], [s].[Id] +ORDER BY [b].[Id] """); } @@ -1706,7 +1698,7 @@ public override async Task Nested_include_with_inheritance_reference_collection_ AssertSql( """ -SELECT [b].[Id], [b].[Name], [d].[BaseId], [s].[Id], [b].[OwnedReferenceOnBase_Id], [b].[OwnedReferenceOnBase_Name], [d].[Id], [d].[OwnedReferenceOnDerived_Id], [d].[OwnedReferenceOnDerived_Name], [s].[BaseParentId], [s].[Name], [s].[Discriminator] +SELECT [b].[Id], [b].[Name], [d].[BaseId], [b].[OwnedReferenceOnBase_Id], [b].[OwnedReferenceOnBase_Name], [d].[Id], [d].[OwnedReferenceOnDerived_Id], [d].[OwnedReferenceOnDerived_Name], [s].[Id], [s].[BaseParentId], [s].[Name], [s].[Discriminator] FROM [BaseEntities] AS [b] INNER JOIN [DerivedEntities] AS [d] ON [b].[Id] = [d].[Id] LEFT JOIN ( @@ -1716,35 +1708,27 @@ END AS [Discriminator] FROM [BaseReferencesOnBase] AS [b0] LEFT JOIN [DerivedReferencesOnBase] AS [d0] ON [b0].[Id] = [d0].[Id] ) AS [s] ON [b].[Id] = [s].[BaseParentId] -ORDER BY [b].[Id], [s].[Id] +ORDER BY [b].[Id] """, // """ -SELECT [b2].[BaseInheritanceRelationshipEntityId], [b2].[Id], [b2].[Name], [b].[Id], [s].[Id] +SELECT [b2].[BaseInheritanceRelationshipEntityId], [b2].[Id], [b2].[Name], [b].[Id] FROM [BaseEntities] AS [b] INNER JOIN [DerivedEntities] AS [d] ON [b].[Id] = [d].[Id] -LEFT JOIN ( - SELECT [b0].[Id], [b0].[BaseParentId] - FROM [BaseReferencesOnBase] AS [b0] -) AS [s] ON [b].[Id] = [s].[BaseParentId] INNER JOIN [BaseEntities_OwnedCollectionOnBase] AS [b2] ON [b].[Id] = [b2].[BaseInheritanceRelationshipEntityId] -ORDER BY [b].[Id], [s].[Id] +ORDER BY [b].[Id] """, // """ -SELECT [d2].[DerivedInheritanceRelationshipEntityId], [d2].[Id], [d2].[Name], [b].[Id], [s].[Id] +SELECT [d2].[DerivedInheritanceRelationshipEntityId], [d2].[Id], [d2].[Name], [b].[Id] FROM [BaseEntities] AS [b] INNER JOIN [DerivedEntities] AS [d] ON [b].[Id] = [d].[Id] -LEFT JOIN ( - SELECT [b0].[Id], [b0].[BaseParentId] - FROM [BaseReferencesOnBase] AS [b0] -) AS [s] ON [b].[Id] = [s].[BaseParentId] INNER JOIN [DerivedEntities_OwnedCollectionOnDerived] AS [d2] ON [b].[Id] = [d2].[DerivedInheritanceRelationshipEntityId] -ORDER BY [b].[Id], [s].[Id] +ORDER BY [b].[Id] """, // """ -SELECT [s0].[Id], [s0].[Name], [s0].[ParentCollectionId], [s0].[ParentReferenceId], [s0].[Discriminator], [b].[Id], [s].[Id] +SELECT [s0].[Id], [s0].[Name], [s0].[ParentCollectionId], [s0].[ParentReferenceId], [s0].[Discriminator], [b].[Id] FROM [BaseEntities] AS [b] INNER JOIN [DerivedEntities] AS [d] ON [b].[Id] = [d].[Id] LEFT JOIN ( @@ -1758,7 +1742,7 @@ END AS [Discriminator] FROM [NestedCollections] AS [n] LEFT JOIN [NestedCollectionsDerived] AS [n0] ON [n].[Id] = [n0].[Id] ) AS [s0] ON [s].[Id] = [s0].[ParentReferenceId] -ORDER BY [b].[Id], [s].[Id] +ORDER BY [b].[Id] """); } @@ -1787,11 +1771,11 @@ WHEN [d0].[Id] IS NOT NULL THEN N'DerivedInheritanceRelationshipEntity' FROM [BaseEntities] AS [b0] LEFT JOIN [DerivedEntities] AS [d0] ON [b0].[Id] = [d0].[Id] ) AS [s0] ON [s].[BaseParentId] = [s0].[Id] -ORDER BY [n].[Id], [s].[Id], [s0].[Id] +ORDER BY [n].[Id] """, // """ -SELECT [b2].[BaseInheritanceRelationshipEntityId], [b2].[Id], [b2].[Name], [n].[Id], [s].[Id], [s0].[Id] +SELECT [b2].[BaseInheritanceRelationshipEntityId], [b2].[Id], [b2].[Name], [n].[Id] FROM [NestedCollections] AS [n] LEFT JOIN ( SELECT [b].[Id], [b].[BaseParentId] @@ -1802,11 +1786,11 @@ SELECT [b0].[Id] FROM [BaseEntities] AS [b0] ) AS [s0] ON [s].[BaseParentId] = [s0].[Id] INNER JOIN [BaseEntities_OwnedCollectionOnBase] AS [b2] ON [s0].[Id] = [b2].[BaseInheritanceRelationshipEntityId] -ORDER BY [n].[Id], [s].[Id], [s0].[Id] +ORDER BY [n].[Id] """, // """ -SELECT [d2].[DerivedInheritanceRelationshipEntityId], [d2].[Id], [d2].[Name], [n].[Id], [s].[Id], [s0].[Id] +SELECT [d2].[DerivedInheritanceRelationshipEntityId], [d2].[Id], [d2].[Name], [n].[Id] FROM [NestedCollections] AS [n] LEFT JOIN ( SELECT [b].[Id], [b].[BaseParentId] @@ -1817,7 +1801,7 @@ SELECT [b0].[Id] FROM [BaseEntities] AS [b0] ) AS [s0] ON [s].[BaseParentId] = [s0].[Id] INNER JOIN [DerivedEntities_OwnedCollectionOnDerived] AS [d2] ON [s0].[Id] = [d2].[DerivedInheritanceRelationshipEntityId] -ORDER BY [n].[Id], [s].[Id], [s0].[Id] +ORDER BY [n].[Id] """); } @@ -1895,11 +1879,11 @@ WHEN [d0].[Id] IS NOT NULL THEN N'DerivedInheritanceRelationshipEntity' FROM [BaseEntities] AS [b0] LEFT JOIN [DerivedEntities] AS [d0] ON [b0].[Id] = [d0].[Id] ) AS [s0] ON [s].[BaseParentId] = [s0].[Id] -ORDER BY [n].[Id], [s].[Id], [s0].[Id] +ORDER BY [n].[Id] """, // """ -SELECT [b2].[BaseInheritanceRelationshipEntityId], [b2].[Id], [b2].[Name], [n].[Id], [s].[Id], [s0].[Id] +SELECT [b2].[BaseInheritanceRelationshipEntityId], [b2].[Id], [b2].[Name], [n].[Id] FROM [NestedReferences] AS [n] LEFT JOIN ( SELECT [b].[Id], [b].[BaseParentId] @@ -1910,11 +1894,11 @@ SELECT [b0].[Id] FROM [BaseEntities] AS [b0] ) AS [s0] ON [s].[BaseParentId] = [s0].[Id] INNER JOIN [BaseEntities_OwnedCollectionOnBase] AS [b2] ON [s0].[Id] = [b2].[BaseInheritanceRelationshipEntityId] -ORDER BY [n].[Id], [s].[Id], [s0].[Id] +ORDER BY [n].[Id] """, // """ -SELECT [d2].[DerivedInheritanceRelationshipEntityId], [d2].[Id], [d2].[Name], [n].[Id], [s].[Id], [s0].[Id] +SELECT [d2].[DerivedInheritanceRelationshipEntityId], [d2].[Id], [d2].[Name], [n].[Id] FROM [NestedReferences] AS [n] LEFT JOIN ( SELECT [b].[Id], [b].[BaseParentId] @@ -1925,7 +1909,7 @@ SELECT [b0].[Id] FROM [BaseEntities] AS [b0] ) AS [s0] ON [s].[BaseParentId] = [s0].[Id] INNER JOIN [DerivedEntities_OwnedCollectionOnDerived] AS [d2] ON [s0].[Id] = [d2].[DerivedInheritanceRelationshipEntityId] -ORDER BY [n].[Id], [s].[Id], [s0].[Id] +ORDER BY [n].[Id] """); } @@ -2013,11 +1997,11 @@ WHEN [d0].[Id] IS NOT NULL THEN N'DerivedInheritanceRelationshipEntity' FROM [BaseEntities] AS [b0] LEFT JOIN [DerivedEntities] AS [d0] ON [b0].[Id] = [d0].[Id] ) AS [s0] ON [s].[BaseParentId] = [s0].[Id] -ORDER BY [n].[Id], [s].[Id], [s0].[Id] +ORDER BY [n].[Id] """, // """ -SELECT [b2].[BaseInheritanceRelationshipEntityId], [b2].[Id], [b2].[Name], [n].[Id], [s].[Id], [s0].[Id] +SELECT [b2].[BaseInheritanceRelationshipEntityId], [b2].[Id], [b2].[Name], [n].[Id] FROM [NestedCollections] AS [n] LEFT JOIN ( SELECT [b].[Id], [b].[BaseParentId] @@ -2028,11 +2012,11 @@ SELECT [b0].[Id] FROM [BaseEntities] AS [b0] ) AS [s0] ON [s].[BaseParentId] = [s0].[Id] INNER JOIN [BaseEntities_OwnedCollectionOnBase] AS [b2] ON [s0].[Id] = [b2].[BaseInheritanceRelationshipEntityId] -ORDER BY [n].[Id], [s].[Id], [s0].[Id] +ORDER BY [n].[Id] """, // """ -SELECT [d2].[DerivedInheritanceRelationshipEntityId], [d2].[Id], [d2].[Name], [n].[Id], [s].[Id], [s0].[Id] +SELECT [d2].[DerivedInheritanceRelationshipEntityId], [d2].[Id], [d2].[Name], [n].[Id] FROM [NestedCollections] AS [n] LEFT JOIN ( SELECT [b].[Id], [b].[BaseParentId] @@ -2043,7 +2027,7 @@ SELECT [b0].[Id] FROM [BaseEntities] AS [b0] ) AS [s0] ON [s].[BaseParentId] = [s0].[Id] INNER JOIN [DerivedEntities_OwnedCollectionOnDerived] AS [d2] ON [s0].[Id] = [d2].[DerivedInheritanceRelationshipEntityId] -ORDER BY [n].[Id], [s].[Id], [s0].[Id] +ORDER BY [n].[Id] """); } diff --git a/test/EFCore.SqlServer.FunctionalTests/Query/InheritanceRelationshipsQuerySqlServerTest.cs b/test/EFCore.SqlServer.FunctionalTests/Query/InheritanceRelationshipsQuerySqlServerTest.cs index a59684c3a3d..66afd52c949 100644 --- a/test/EFCore.SqlServer.FunctionalTests/Query/InheritanceRelationshipsQuerySqlServerTest.cs +++ b/test/EFCore.SqlServer.FunctionalTests/Query/InheritanceRelationshipsQuerySqlServerTest.cs @@ -25,12 +25,12 @@ public override async Task Include_reference_with_inheritance(bool async) AssertSql( """ -SELECT [b].[Id], [b].[Discriminator], [b].[Name], [b].[BaseId], [b0].[Id], [b1].[BaseInheritanceRelationshipEntityId], [b1].[Id], [b1].[Name], [b].[OwnedReferenceOnBase_Id], [b].[OwnedReferenceOnBase_Name], [b2].[DerivedInheritanceRelationshipEntityId], [b2].[Id], [b2].[Name], [b].[OwnedReferenceOnDerived_Id], [b].[OwnedReferenceOnDerived_Name], [b0].[BaseParentId], [b0].[Discriminator], [b0].[Name] +SELECT [b].[Id], [b].[Discriminator], [b].[Name], [b].[BaseId], [b1].[BaseInheritanceRelationshipEntityId], [b1].[Id], [b1].[Name], [b].[OwnedReferenceOnBase_Id], [b].[OwnedReferenceOnBase_Name], [b2].[DerivedInheritanceRelationshipEntityId], [b2].[Id], [b2].[Name], [b].[OwnedReferenceOnDerived_Id], [b].[OwnedReferenceOnDerived_Name], [b0].[Id], [b0].[BaseParentId], [b0].[Discriminator], [b0].[Name] 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] -ORDER BY [b].[Id], [b0].[Id], [b1].[BaseInheritanceRelationshipEntityId], [b1].[Id], [b2].[DerivedInheritanceRelationshipEntityId] +ORDER BY [b].[Id], [b1].[BaseInheritanceRelationshipEntityId], [b1].[Id], [b2].[DerivedInheritanceRelationshipEntityId] """); } @@ -45,7 +45,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] -ORDER BY [b].[Id], [b0].[Id], [b1].[BaseInheritanceRelationshipEntityId], [b1].[Id], [b2].[DerivedInheritanceRelationshipEntityId] +ORDER BY [b].[Id], [b1].[BaseInheritanceRelationshipEntityId], [b1].[Id], [b2].[DerivedInheritanceRelationshipEntityId] """); } @@ -55,7 +55,7 @@ public override async Task Include_self_reference_with_inheritance(bool async) AssertSql( """ -SELECT [b].[Id], [b].[Discriminator], [b].[Name], [b].[BaseId], [b1].[Id], [b2].[BaseInheritanceRelationshipEntityId], [b2].[Id], [b2].[Name], [b].[OwnedReferenceOnBase_Id], [b].[OwnedReferenceOnBase_Name], [b3].[DerivedInheritanceRelationshipEntityId], [b3].[Id], [b3].[Name], [b].[OwnedReferenceOnDerived_Id], [b].[OwnedReferenceOnDerived_Name], [b1].[Discriminator], [b1].[Name], [b1].[BaseId], [b4].[BaseInheritanceRelationshipEntityId], [b4].[Id], [b4].[Name], [b1].[OwnedReferenceOnBase_Id], [b1].[OwnedReferenceOnBase_Name], [b5].[DerivedInheritanceRelationshipEntityId], [b5].[Id], [b5].[Name], [b1].[OwnedReferenceOnDerived_Id], [b1].[OwnedReferenceOnDerived_Name] +SELECT [b].[Id], [b].[Discriminator], [b].[Name], [b].[BaseId], [b2].[BaseInheritanceRelationshipEntityId], [b2].[Id], [b2].[Name], [b].[OwnedReferenceOnBase_Id], [b].[OwnedReferenceOnBase_Name], [b3].[DerivedInheritanceRelationshipEntityId], [b3].[Id], [b3].[Name], [b].[OwnedReferenceOnDerived_Id], [b].[OwnedReferenceOnDerived_Name], [b1].[Id], [b1].[Discriminator], [b1].[Name], [b1].[BaseId], [b4].[BaseInheritanceRelationshipEntityId], [b4].[Id], [b4].[Name], [b1].[OwnedReferenceOnBase_Id], [b1].[OwnedReferenceOnBase_Name], [b5].[DerivedInheritanceRelationshipEntityId], [b5].[Id], [b5].[Name], [b1].[OwnedReferenceOnDerived_Id], [b1].[OwnedReferenceOnDerived_Name] FROM [BaseEntities] AS [b] LEFT JOIN ( SELECT [b0].[Id], [b0].[Discriminator], [b0].[Name], [b0].[BaseId], [b0].[OwnedReferenceOnBase_Id], [b0].[OwnedReferenceOnBase_Name], [b0].[OwnedReferenceOnDerived_Id], [b0].[OwnedReferenceOnDerived_Name] @@ -66,7 +66,7 @@ FROM [BaseEntities] AS [b0] LEFT JOIN [BaseEntities_OwnedCollectionOnDerived] AS [b3] ON [b].[Id] = [b3].[DerivedInheritanceRelationshipEntityId] LEFT JOIN [BaseEntities_OwnedCollectionOnBase] AS [b4] ON [b1].[Id] = [b4].[BaseInheritanceRelationshipEntityId] LEFT JOIN [BaseEntities_OwnedCollectionOnDerived] AS [b5] ON [b1].[Id] = [b5].[DerivedInheritanceRelationshipEntityId] -ORDER BY [b].[Id], [b1].[Id], [b2].[BaseInheritanceRelationshipEntityId], [b2].[Id], [b3].[DerivedInheritanceRelationshipEntityId], [b3].[Id], [b4].[BaseInheritanceRelationshipEntityId], [b4].[Id], [b5].[DerivedInheritanceRelationshipEntityId] +ORDER BY [b].[Id], [b2].[BaseInheritanceRelationshipEntityId], [b2].[Id], [b3].[DerivedInheritanceRelationshipEntityId], [b3].[Id], [b4].[BaseInheritanceRelationshipEntityId], [b4].[Id], [b5].[DerivedInheritanceRelationshipEntityId] """); } @@ -76,7 +76,7 @@ public override async Task Include_self_reference_with_inheritance_reverse(bool AssertSql( """ -SELECT [b].[Id], [b].[Discriminator], [b].[Name], [b].[BaseId], [b0].[Id], [b1].[BaseInheritanceRelationshipEntityId], [b1].[Id], [b1].[Name], [b].[OwnedReferenceOnBase_Id], [b].[OwnedReferenceOnBase_Name], [b2].[DerivedInheritanceRelationshipEntityId], [b2].[Id], [b2].[Name], [b].[OwnedReferenceOnDerived_Id], [b].[OwnedReferenceOnDerived_Name], [b0].[Discriminator], [b0].[Name], [b0].[BaseId], [b3].[BaseInheritanceRelationshipEntityId], [b3].[Id], [b3].[Name], [b0].[OwnedReferenceOnBase_Id], [b0].[OwnedReferenceOnBase_Name], [b4].[DerivedInheritanceRelationshipEntityId], [b4].[Id], [b4].[Name], [b0].[OwnedReferenceOnDerived_Id], [b0].[OwnedReferenceOnDerived_Name] +SELECT [b].[Id], [b].[Discriminator], [b].[Name], [b].[BaseId], [b1].[BaseInheritanceRelationshipEntityId], [b1].[Id], [b1].[Name], [b].[OwnedReferenceOnBase_Id], [b].[OwnedReferenceOnBase_Name], [b2].[DerivedInheritanceRelationshipEntityId], [b2].[Id], [b2].[Name], [b].[OwnedReferenceOnDerived_Id], [b].[OwnedReferenceOnDerived_Name], [b0].[Id], [b0].[Discriminator], [b0].[Name], [b0].[BaseId], [b3].[BaseInheritanceRelationshipEntityId], [b3].[Id], [b3].[Name], [b0].[OwnedReferenceOnBase_Id], [b0].[OwnedReferenceOnBase_Name], [b4].[DerivedInheritanceRelationshipEntityId], [b4].[Id], [b4].[Name], [b0].[OwnedReferenceOnDerived_Id], [b0].[OwnedReferenceOnDerived_Name] FROM [BaseEntities] AS [b] LEFT JOIN [BaseEntities] AS [b0] ON [b].[BaseId] = [b0].[Id] LEFT JOIN [BaseEntities_OwnedCollectionOnBase] AS [b1] ON [b].[Id] = [b1].[BaseInheritanceRelationshipEntityId] @@ -84,7 +84,7 @@ FROM [BaseEntities] AS [b] LEFT JOIN [BaseEntities_OwnedCollectionOnBase] AS [b3] ON [b0].[Id] = [b3].[BaseInheritanceRelationshipEntityId] LEFT JOIN [BaseEntities_OwnedCollectionOnDerived] AS [b4] ON [b0].[Id] = [b4].[DerivedInheritanceRelationshipEntityId] WHERE [b].[Discriminator] = N'DerivedInheritanceRelationshipEntity' -ORDER BY [b].[Id], [b0].[Id], [b1].[BaseInheritanceRelationshipEntityId], [b1].[Id], [b2].[DerivedInheritanceRelationshipEntityId], [b2].[Id], [b3].[BaseInheritanceRelationshipEntityId], [b3].[Id], [b4].[DerivedInheritanceRelationshipEntityId] +ORDER BY [b].[Id], [b1].[BaseInheritanceRelationshipEntityId], [b1].[Id], [b2].[DerivedInheritanceRelationshipEntityId], [b2].[Id], [b3].[BaseInheritanceRelationshipEntityId], [b3].[Id], [b4].[DerivedInheritanceRelationshipEntityId] """); } @@ -94,13 +94,13 @@ public override async Task Include_reference_with_inheritance_with_filter(bool a AssertSql( """ -SELECT [b].[Id], [b].[Discriminator], [b].[Name], [b].[BaseId], [b0].[Id], [b1].[BaseInheritanceRelationshipEntityId], [b1].[Id], [b1].[Name], [b].[OwnedReferenceOnBase_Id], [b].[OwnedReferenceOnBase_Name], [b2].[DerivedInheritanceRelationshipEntityId], [b2].[Id], [b2].[Name], [b].[OwnedReferenceOnDerived_Id], [b].[OwnedReferenceOnDerived_Name], [b0].[BaseParentId], [b0].[Discriminator], [b0].[Name] +SELECT [b].[Id], [b].[Discriminator], [b].[Name], [b].[BaseId], [b1].[BaseInheritanceRelationshipEntityId], [b1].[Id], [b1].[Name], [b].[OwnedReferenceOnBase_Id], [b].[OwnedReferenceOnBase_Name], [b2].[DerivedInheritanceRelationshipEntityId], [b2].[Id], [b2].[Name], [b].[OwnedReferenceOnDerived_Id], [b].[OwnedReferenceOnDerived_Name], [b0].[Id], [b0].[BaseParentId], [b0].[Discriminator], [b0].[Name] 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 -ORDER BY [b].[Id], [b0].[Id], [b1].[BaseInheritanceRelationshipEntityId], [b1].[Id], [b2].[DerivedInheritanceRelationshipEntityId] +ORDER BY [b].[Id], [b1].[BaseInheritanceRelationshipEntityId], [b1].[Id], [b2].[DerivedInheritanceRelationshipEntityId] """); } @@ -116,7 +116,7 @@ FROM [BaseReferencesOnBase] AS [b] 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 -ORDER BY [b].[Id], [b0].[Id], [b1].[BaseInheritanceRelationshipEntityId], [b1].[Id], [b2].[DerivedInheritanceRelationshipEntityId] +ORDER BY [b].[Id], [b1].[BaseInheritanceRelationshipEntityId], [b1].[Id], [b2].[DerivedInheritanceRelationshipEntityId] """); } @@ -126,12 +126,12 @@ public override async Task Include_reference_without_inheritance(bool async) AssertSql( """ -SELECT [b].[Id], [b].[Discriminator], [b].[Name], [b].[BaseId], [r].[Id], [b0].[BaseInheritanceRelationshipEntityId], [b0].[Id], [b0].[Name], [b].[OwnedReferenceOnBase_Id], [b].[OwnedReferenceOnBase_Name], [b1].[DerivedInheritanceRelationshipEntityId], [b1].[Id], [b1].[Name], [b].[OwnedReferenceOnDerived_Id], [b].[OwnedReferenceOnDerived_Name], [r].[Name], [r].[ParentId] +SELECT [b].[Id], [b].[Discriminator], [b].[Name], [b].[BaseId], [b0].[BaseInheritanceRelationshipEntityId], [b0].[Id], [b0].[Name], [b].[OwnedReferenceOnBase_Id], [b].[OwnedReferenceOnBase_Name], [b1].[DerivedInheritanceRelationshipEntityId], [b1].[Id], [b1].[Name], [b].[OwnedReferenceOnDerived_Id], [b].[OwnedReferenceOnDerived_Name], [r].[Id], [r].[Name], [r].[ParentId] 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] -ORDER BY [b].[Id], [r].[Id], [b0].[BaseInheritanceRelationshipEntityId], [b0].[Id], [b1].[DerivedInheritanceRelationshipEntityId] +ORDER BY [b].[Id], [b0].[BaseInheritanceRelationshipEntityId], [b0].[Id], [b1].[DerivedInheritanceRelationshipEntityId] """); } @@ -146,7 +146,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] -ORDER BY [r].[Id], [b].[Id], [b0].[BaseInheritanceRelationshipEntityId], [b0].[Id], [b1].[DerivedInheritanceRelationshipEntityId] +ORDER BY [r].[Id], [b0].[BaseInheritanceRelationshipEntityId], [b0].[Id], [b1].[DerivedInheritanceRelationshipEntityId] """); } @@ -156,13 +156,13 @@ public override async Task Include_reference_without_inheritance_with_filter(boo AssertSql( """ -SELECT [b].[Id], [b].[Discriminator], [b].[Name], [b].[BaseId], [r].[Id], [b0].[BaseInheritanceRelationshipEntityId], [b0].[Id], [b0].[Name], [b].[OwnedReferenceOnBase_Id], [b].[OwnedReferenceOnBase_Name], [b1].[DerivedInheritanceRelationshipEntityId], [b1].[Id], [b1].[Name], [b].[OwnedReferenceOnDerived_Id], [b].[OwnedReferenceOnDerived_Name], [r].[Name], [r].[ParentId] +SELECT [b].[Id], [b].[Discriminator], [b].[Name], [b].[BaseId], [b0].[BaseInheritanceRelationshipEntityId], [b0].[Id], [b0].[Name], [b].[OwnedReferenceOnBase_Id], [b].[OwnedReferenceOnBase_Name], [b1].[DerivedInheritanceRelationshipEntityId], [b1].[Id], [b1].[Name], [b].[OwnedReferenceOnDerived_Id], [b].[OwnedReferenceOnDerived_Name], [r].[Id], [r].[Name], [r].[ParentId] 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 -ORDER BY [b].[Id], [r].[Id], [b0].[BaseInheritanceRelationshipEntityId], [b0].[Id], [b1].[DerivedInheritanceRelationshipEntityId] +ORDER BY [b].[Id], [b0].[BaseInheritanceRelationshipEntityId], [b0].[Id], [b1].[DerivedInheritanceRelationshipEntityId] """); } @@ -178,7 +178,7 @@ FROM [ReferencesOnBase] AS [r] 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 -ORDER BY [r].[Id], [b].[Id], [b0].[BaseInheritanceRelationshipEntityId], [b0].[Id], [b1].[DerivedInheritanceRelationshipEntityId] +ORDER BY [r].[Id], [b0].[BaseInheritanceRelationshipEntityId], [b0].[Id], [b1].[DerivedInheritanceRelationshipEntityId] """); } @@ -208,7 +208,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] -ORDER BY [b].[Id], [b0].[Id], [b1].[BaseInheritanceRelationshipEntityId], [b1].[Id], [b2].[DerivedInheritanceRelationshipEntityId] +ORDER BY [b].[Id], [b1].[BaseInheritanceRelationshipEntityId], [b1].[Id], [b2].[DerivedInheritanceRelationshipEntityId] """); } @@ -240,7 +240,7 @@ FROM [BaseCollectionsOnBase] AS [b] 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 -ORDER BY [b].[Id], [b0].[Id], [b1].[BaseInheritanceRelationshipEntityId], [b1].[Id], [b2].[DerivedInheritanceRelationshipEntityId] +ORDER BY [b].[Id], [b1].[BaseInheritanceRelationshipEntityId], [b1].[Id], [b2].[DerivedInheritanceRelationshipEntityId] """); } @@ -270,7 +270,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] -ORDER BY [c].[Id], [b].[Id], [b0].[BaseInheritanceRelationshipEntityId], [b0].[Id], [b1].[DerivedInheritanceRelationshipEntityId] +ORDER BY [c].[Id], [b0].[BaseInheritanceRelationshipEntityId], [b0].[Id], [b1].[DerivedInheritanceRelationshipEntityId] """); } @@ -302,7 +302,7 @@ FROM [CollectionsOnBase] AS [c] 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 -ORDER BY [c].[Id], [b].[Id], [b0].[BaseInheritanceRelationshipEntityId], [b0].[Id], [b1].[DerivedInheritanceRelationshipEntityId] +ORDER BY [c].[Id], [b0].[BaseInheritanceRelationshipEntityId], [b0].[Id], [b1].[DerivedInheritanceRelationshipEntityId] """); } @@ -312,13 +312,13 @@ public override async Task Include_reference_with_inheritance_on_derived1(bool a AssertSql( """ -SELECT [b].[Id], [b].[Discriminator], [b].[Name], [b].[BaseId], [b0].[Id], [b1].[BaseInheritanceRelationshipEntityId], [b1].[Id], [b1].[Name], [b].[OwnedReferenceOnBase_Id], [b].[OwnedReferenceOnBase_Name], [b2].[DerivedInheritanceRelationshipEntityId], [b2].[Id], [b2].[Name], [b].[OwnedReferenceOnDerived_Id], [b].[OwnedReferenceOnDerived_Name], [b0].[BaseParentId], [b0].[Discriminator], [b0].[Name] +SELECT [b].[Id], [b].[Discriminator], [b].[Name], [b].[BaseId], [b1].[BaseInheritanceRelationshipEntityId], [b1].[Id], [b1].[Name], [b].[OwnedReferenceOnBase_Id], [b].[OwnedReferenceOnBase_Name], [b2].[DerivedInheritanceRelationshipEntityId], [b2].[Id], [b2].[Name], [b].[OwnedReferenceOnDerived_Id], [b].[OwnedReferenceOnDerived_Name], [b0].[Id], [b0].[BaseParentId], [b0].[Discriminator], [b0].[Name] 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' -ORDER BY [b].[Id], [b0].[Id], [b1].[BaseInheritanceRelationshipEntityId], [b1].[Id], [b2].[DerivedInheritanceRelationshipEntityId] +ORDER BY [b].[Id], [b1].[BaseInheritanceRelationshipEntityId], [b1].[Id], [b2].[DerivedInheritanceRelationshipEntityId] """); } @@ -328,13 +328,13 @@ public override async Task Include_reference_with_inheritance_on_derived2(bool a AssertSql( """ -SELECT [b].[Id], [b].[Discriminator], [b].[Name], [b].[BaseId], [b0].[Id], [b1].[BaseInheritanceRelationshipEntityId], [b1].[Id], [b1].[Name], [b].[OwnedReferenceOnBase_Id], [b].[OwnedReferenceOnBase_Name], [b2].[DerivedInheritanceRelationshipEntityId], [b2].[Id], [b2].[Name], [b].[OwnedReferenceOnDerived_Id], [b].[OwnedReferenceOnDerived_Name], [b0].[BaseParentId], [b0].[Discriminator], [b0].[Name], [b0].[DerivedInheritanceRelationshipEntityId] +SELECT [b].[Id], [b].[Discriminator], [b].[Name], [b].[BaseId], [b1].[BaseInheritanceRelationshipEntityId], [b1].[Id], [b1].[Name], [b].[OwnedReferenceOnBase_Id], [b].[OwnedReferenceOnBase_Name], [b2].[DerivedInheritanceRelationshipEntityId], [b2].[Id], [b2].[Name], [b].[OwnedReferenceOnDerived_Id], [b].[OwnedReferenceOnDerived_Name], [b0].[Id], [b0].[BaseParentId], [b0].[Discriminator], [b0].[Name], [b0].[DerivedInheritanceRelationshipEntityId] 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' -ORDER BY [b].[Id], [b0].[Id], [b1].[BaseInheritanceRelationshipEntityId], [b1].[Id], [b2].[DerivedInheritanceRelationshipEntityId] +ORDER BY [b].[Id], [b1].[BaseInheritanceRelationshipEntityId], [b1].[Id], [b2].[DerivedInheritanceRelationshipEntityId] """); } @@ -344,7 +344,7 @@ public override async Task Include_reference_with_inheritance_on_derived4(bool a AssertSql( """ -SELECT [b].[Id], [b].[Discriminator], [b].[Name], [b].[BaseId], [b1].[Id], [b2].[BaseInheritanceRelationshipEntityId], [b2].[Id], [b2].[Name], [b].[OwnedReferenceOnBase_Id], [b].[OwnedReferenceOnBase_Name], [b3].[DerivedInheritanceRelationshipEntityId], [b3].[Id], [b3].[Name], [b].[OwnedReferenceOnDerived_Id], [b].[OwnedReferenceOnDerived_Name], [b1].[BaseParentId], [b1].[Discriminator], [b1].[Name], [b1].[DerivedInheritanceRelationshipEntityId] +SELECT [b].[Id], [b].[Discriminator], [b].[Name], [b].[BaseId], [b2].[BaseInheritanceRelationshipEntityId], [b2].[Id], [b2].[Name], [b].[OwnedReferenceOnBase_Id], [b].[OwnedReferenceOnBase_Name], [b3].[DerivedInheritanceRelationshipEntityId], [b3].[Id], [b3].[Name], [b].[OwnedReferenceOnDerived_Id], [b].[OwnedReferenceOnDerived_Name], [b1].[Id], [b1].[BaseParentId], [b1].[Discriminator], [b1].[Name], [b1].[DerivedInheritanceRelationshipEntityId] FROM [BaseEntities] AS [b] LEFT JOIN ( SELECT [b0].[Id], [b0].[BaseParentId], [b0].[Discriminator], [b0].[Name], [b0].[DerivedInheritanceRelationshipEntityId] @@ -354,7 +354,7 @@ FROM [BaseReferencesOnDerived] AS [b0] LEFT JOIN [BaseEntities_OwnedCollectionOnBase] AS [b2] ON [b].[Id] = [b2].[BaseInheritanceRelationshipEntityId] LEFT JOIN [BaseEntities_OwnedCollectionOnDerived] AS [b3] ON [b].[Id] = [b3].[DerivedInheritanceRelationshipEntityId] WHERE [b].[Discriminator] = N'DerivedInheritanceRelationshipEntity' -ORDER BY [b].[Id], [b1].[Id], [b2].[BaseInheritanceRelationshipEntityId], [b2].[Id], [b3].[DerivedInheritanceRelationshipEntityId] +ORDER BY [b].[Id], [b2].[BaseInheritanceRelationshipEntityId], [b2].[Id], [b3].[DerivedInheritanceRelationshipEntityId] """); } @@ -373,7 +373,7 @@ FROM [BaseEntities] AS [b0] ) AS [b1] ON [b].[BaseParentId] = [b1].[Id] LEFT JOIN [BaseEntities_OwnedCollectionOnBase] AS [b2] ON [b1].[Id] = [b2].[BaseInheritanceRelationshipEntityId] LEFT JOIN [BaseEntities_OwnedCollectionOnDerived] AS [b3] ON [b1].[Id] = [b3].[DerivedInheritanceRelationshipEntityId] -ORDER BY [b].[Id], [b1].[Id], [b2].[BaseInheritanceRelationshipEntityId], [b2].[Id], [b3].[DerivedInheritanceRelationshipEntityId] +ORDER BY [b].[Id], [b2].[BaseInheritanceRelationshipEntityId], [b2].[Id], [b3].[DerivedInheritanceRelationshipEntityId] """); } @@ -383,13 +383,13 @@ public override async Task Include_reference_with_inheritance_on_derived_with_fi AssertSql( """ -SELECT [b].[Id], [b].[Discriminator], [b].[Name], [b].[BaseId], [b0].[Id], [b1].[BaseInheritanceRelationshipEntityId], [b1].[Id], [b1].[Name], [b].[OwnedReferenceOnBase_Id], [b].[OwnedReferenceOnBase_Name], [b2].[DerivedInheritanceRelationshipEntityId], [b2].[Id], [b2].[Name], [b].[OwnedReferenceOnDerived_Id], [b].[OwnedReferenceOnDerived_Name], [b0].[BaseParentId], [b0].[Discriminator], [b0].[Name] +SELECT [b].[Id], [b].[Discriminator], [b].[Name], [b].[BaseId], [b1].[BaseInheritanceRelationshipEntityId], [b1].[Id], [b1].[Name], [b].[OwnedReferenceOnBase_Id], [b].[OwnedReferenceOnBase_Name], [b2].[DerivedInheritanceRelationshipEntityId], [b2].[Id], [b2].[Name], [b].[OwnedReferenceOnDerived_Id], [b].[OwnedReferenceOnDerived_Name], [b0].[Id], [b0].[BaseParentId], [b0].[Discriminator], [b0].[Name] 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) -ORDER BY [b].[Id], [b0].[Id], [b1].[BaseInheritanceRelationshipEntityId], [b1].[Id], [b2].[DerivedInheritanceRelationshipEntityId] +ORDER BY [b].[Id], [b1].[BaseInheritanceRelationshipEntityId], [b1].[Id], [b2].[DerivedInheritanceRelationshipEntityId] """); } @@ -399,13 +399,13 @@ public override async Task Include_reference_with_inheritance_on_derived_with_fi AssertSql( """ -SELECT [b].[Id], [b].[Discriminator], [b].[Name], [b].[BaseId], [b0].[Id], [b1].[BaseInheritanceRelationshipEntityId], [b1].[Id], [b1].[Name], [b].[OwnedReferenceOnBase_Id], [b].[OwnedReferenceOnBase_Name], [b2].[DerivedInheritanceRelationshipEntityId], [b2].[Id], [b2].[Name], [b].[OwnedReferenceOnDerived_Id], [b].[OwnedReferenceOnDerived_Name], [b0].[BaseParentId], [b0].[Discriminator], [b0].[Name], [b0].[DerivedInheritanceRelationshipEntityId] +SELECT [b].[Id], [b].[Discriminator], [b].[Name], [b].[BaseId], [b1].[BaseInheritanceRelationshipEntityId], [b1].[Id], [b1].[Name], [b].[OwnedReferenceOnBase_Id], [b].[OwnedReferenceOnBase_Name], [b2].[DerivedInheritanceRelationshipEntityId], [b2].[Id], [b2].[Name], [b].[OwnedReferenceOnDerived_Id], [b].[OwnedReferenceOnDerived_Name], [b0].[Id], [b0].[BaseParentId], [b0].[Discriminator], [b0].[Name], [b0].[DerivedInheritanceRelationshipEntityId] 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) -ORDER BY [b].[Id], [b0].[Id], [b1].[BaseInheritanceRelationshipEntityId], [b1].[Id], [b2].[DerivedInheritanceRelationshipEntityId] +ORDER BY [b].[Id], [b1].[BaseInheritanceRelationshipEntityId], [b1].[Id], [b2].[DerivedInheritanceRelationshipEntityId] """); } @@ -415,7 +415,7 @@ public override async Task Include_reference_with_inheritance_on_derived_with_fi AssertSql( """ -SELECT [b].[Id], [b].[Discriminator], [b].[Name], [b].[BaseId], [b1].[Id], [b2].[BaseInheritanceRelationshipEntityId], [b2].[Id], [b2].[Name], [b].[OwnedReferenceOnBase_Id], [b].[OwnedReferenceOnBase_Name], [b3].[DerivedInheritanceRelationshipEntityId], [b3].[Id], [b3].[Name], [b].[OwnedReferenceOnDerived_Id], [b].[OwnedReferenceOnDerived_Name], [b1].[BaseParentId], [b1].[Discriminator], [b1].[Name], [b1].[DerivedInheritanceRelationshipEntityId] +SELECT [b].[Id], [b].[Discriminator], [b].[Name], [b].[BaseId], [b2].[BaseInheritanceRelationshipEntityId], [b2].[Id], [b2].[Name], [b].[OwnedReferenceOnBase_Id], [b].[OwnedReferenceOnBase_Name], [b3].[DerivedInheritanceRelationshipEntityId], [b3].[Id], [b3].[Name], [b].[OwnedReferenceOnDerived_Id], [b].[OwnedReferenceOnDerived_Name], [b1].[Id], [b1].[BaseParentId], [b1].[Discriminator], [b1].[Name], [b1].[DerivedInheritanceRelationshipEntityId] FROM [BaseEntities] AS [b] LEFT JOIN ( SELECT [b0].[Id], [b0].[BaseParentId], [b0].[Discriminator], [b0].[Name], [b0].[DerivedInheritanceRelationshipEntityId] @@ -425,7 +425,7 @@ FROM [BaseReferencesOnDerived] AS [b0] LEFT JOIN [BaseEntities_OwnedCollectionOnBase] AS [b2] ON [b].[Id] = [b2].[BaseInheritanceRelationshipEntityId] LEFT JOIN [BaseEntities_OwnedCollectionOnDerived] AS [b3] ON [b].[Id] = [b3].[DerivedInheritanceRelationshipEntityId] WHERE [b].[Discriminator] = N'DerivedInheritanceRelationshipEntity' AND ([b].[Name] <> N'Bar' OR [b].[Name] IS NULL) -ORDER BY [b].[Id], [b1].[Id], [b2].[BaseInheritanceRelationshipEntityId], [b2].[Id], [b3].[DerivedInheritanceRelationshipEntityId] +ORDER BY [b].[Id], [b2].[BaseInheritanceRelationshipEntityId], [b2].[Id], [b3].[DerivedInheritanceRelationshipEntityId] """); } @@ -445,7 +445,7 @@ FROM [BaseEntities] AS [b0] LEFT JOIN [BaseEntities_OwnedCollectionOnBase] AS [b2] ON [b1].[Id] = [b2].[BaseInheritanceRelationshipEntityId] LEFT JOIN [BaseEntities_OwnedCollectionOnDerived] AS [b3] ON [b1].[Id] = [b3].[DerivedInheritanceRelationshipEntityId] WHERE [b].[Name] <> N'Bar' OR [b].[Name] IS NULL -ORDER BY [b].[Id], [b1].[Id], [b2].[BaseInheritanceRelationshipEntityId], [b2].[Id], [b3].[DerivedInheritanceRelationshipEntityId] +ORDER BY [b].[Id], [b2].[BaseInheritanceRelationshipEntityId], [b2].[Id], [b3].[DerivedInheritanceRelationshipEntityId] """); } @@ -455,13 +455,13 @@ public override async Task Include_reference_without_inheritance_on_derived1(boo AssertSql( """ -SELECT [b].[Id], [b].[Discriminator], [b].[Name], [b].[BaseId], [r].[Id], [b0].[BaseInheritanceRelationshipEntityId], [b0].[Id], [b0].[Name], [b].[OwnedReferenceOnBase_Id], [b].[OwnedReferenceOnBase_Name], [b1].[DerivedInheritanceRelationshipEntityId], [b1].[Id], [b1].[Name], [b].[OwnedReferenceOnDerived_Id], [b].[OwnedReferenceOnDerived_Name], [r].[Name], [r].[ParentId] +SELECT [b].[Id], [b].[Discriminator], [b].[Name], [b].[BaseId], [b0].[BaseInheritanceRelationshipEntityId], [b0].[Id], [b0].[Name], [b].[OwnedReferenceOnBase_Id], [b].[OwnedReferenceOnBase_Name], [b1].[DerivedInheritanceRelationshipEntityId], [b1].[Id], [b1].[Name], [b].[OwnedReferenceOnDerived_Id], [b].[OwnedReferenceOnDerived_Name], [r].[Id], [r].[Name], [r].[ParentId] 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].[Discriminator] = N'DerivedInheritanceRelationshipEntity' -ORDER BY [b].[Id], [r].[Id], [b0].[BaseInheritanceRelationshipEntityId], [b0].[Id], [b1].[DerivedInheritanceRelationshipEntityId] +ORDER BY [b].[Id], [b0].[BaseInheritanceRelationshipEntityId], [b0].[Id], [b1].[DerivedInheritanceRelationshipEntityId] """); } @@ -471,13 +471,13 @@ public override async Task Include_reference_without_inheritance_on_derived2(boo AssertSql( """ -SELECT [b].[Id], [b].[Discriminator], [b].[Name], [b].[BaseId], [r].[Id], [b0].[BaseInheritanceRelationshipEntityId], [b0].[Id], [b0].[Name], [b].[OwnedReferenceOnBase_Id], [b].[OwnedReferenceOnBase_Name], [b1].[DerivedInheritanceRelationshipEntityId], [b1].[Id], [b1].[Name], [b].[OwnedReferenceOnDerived_Id], [b].[OwnedReferenceOnDerived_Name], [r].[Name], [r].[ParentId] +SELECT [b].[Id], [b].[Discriminator], [b].[Name], [b].[BaseId], [b0].[BaseInheritanceRelationshipEntityId], [b0].[Id], [b0].[Name], [b].[OwnedReferenceOnBase_Id], [b].[OwnedReferenceOnBase_Name], [b1].[DerivedInheritanceRelationshipEntityId], [b1].[Id], [b1].[Name], [b].[OwnedReferenceOnDerived_Id], [b].[OwnedReferenceOnDerived_Name], [r].[Id], [r].[Name], [r].[ParentId] FROM [BaseEntities] AS [b] LEFT JOIN [ReferencesOnDerived] 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].[Discriminator] = N'DerivedInheritanceRelationshipEntity' -ORDER BY [b].[Id], [r].[Id], [b0].[BaseInheritanceRelationshipEntityId], [b0].[Id], [b1].[DerivedInheritanceRelationshipEntityId] +ORDER BY [b].[Id], [b0].[BaseInheritanceRelationshipEntityId], [b0].[Id], [b1].[DerivedInheritanceRelationshipEntityId] """); } @@ -496,7 +496,7 @@ FROM [BaseEntities] AS [b] ) AS [b0] ON [r].[ParentId] = [b0].[Id] LEFT JOIN [BaseEntities_OwnedCollectionOnBase] AS [b1] ON [b0].[Id] = [b1].[BaseInheritanceRelationshipEntityId] LEFT JOIN [BaseEntities_OwnedCollectionOnDerived] AS [b2] ON [b0].[Id] = [b2].[DerivedInheritanceRelationshipEntityId] -ORDER BY [r].[Id], [b0].[Id], [b1].[BaseInheritanceRelationshipEntityId], [b1].[Id], [b2].[DerivedInheritanceRelationshipEntityId] +ORDER BY [r].[Id], [b1].[BaseInheritanceRelationshipEntityId], [b1].[Id], [b2].[DerivedInheritanceRelationshipEntityId] """); } @@ -567,7 +567,7 @@ FROM [BaseEntities] AS [b0] ) AS [b1] ON [b].[ParentId] = [b1].[Id] LEFT JOIN [BaseEntities_OwnedCollectionOnBase] AS [b2] ON [b1].[Id] = [b2].[BaseInheritanceRelationshipEntityId] LEFT JOIN [BaseEntities_OwnedCollectionOnDerived] AS [b3] ON [b1].[Id] = [b3].[DerivedInheritanceRelationshipEntityId] -ORDER BY [b].[Id], [b1].[Id], [b2].[BaseInheritanceRelationshipEntityId], [b2].[Id], [b3].[DerivedInheritanceRelationshipEntityId] +ORDER BY [b].[Id], [b2].[BaseInheritanceRelationshipEntityId], [b2].[Id], [b3].[DerivedInheritanceRelationshipEntityId] """); } @@ -577,13 +577,13 @@ public override async Task Nested_include_with_inheritance_reference_reference(b AssertSql( """ -SELECT [b].[Id], [b].[Discriminator], [b].[Name], [b].[BaseId], [b0].[Id], [n].[Id], [b1].[BaseInheritanceRelationshipEntityId], [b1].[Id], [b1].[Name], [b].[OwnedReferenceOnBase_Id], [b].[OwnedReferenceOnBase_Name], [b2].[DerivedInheritanceRelationshipEntityId], [b2].[Id], [b2].[Name], [b].[OwnedReferenceOnDerived_Id], [b].[OwnedReferenceOnDerived_Name], [b0].[BaseParentId], [b0].[Discriminator], [b0].[Name], [n].[Discriminator], [n].[Name], [n].[ParentCollectionId], [n].[ParentReferenceId] +SELECT [b].[Id], [b].[Discriminator], [b].[Name], [b].[BaseId], [b1].[BaseInheritanceRelationshipEntityId], [b1].[Id], [b1].[Name], [b].[OwnedReferenceOnBase_Id], [b].[OwnedReferenceOnBase_Name], [b2].[DerivedInheritanceRelationshipEntityId], [b2].[Id], [b2].[Name], [b].[OwnedReferenceOnDerived_Id], [b].[OwnedReferenceOnDerived_Name], [b0].[Id], [b0].[BaseParentId], [b0].[Discriminator], [b0].[Name], [n].[Id], [n].[Discriminator], [n].[Name], [n].[ParentCollectionId], [n].[ParentReferenceId] FROM [BaseEntities] AS [b] LEFT JOIN [BaseReferencesOnBase] AS [b0] ON [b].[Id] = [b0].[BaseParentId] LEFT JOIN [NestedReferences] AS [n] ON [b0].[Id] = [n].[ParentReferenceId] LEFT JOIN [BaseEntities_OwnedCollectionOnBase] AS [b1] ON [b].[Id] = [b1].[BaseInheritanceRelationshipEntityId] LEFT JOIN [BaseEntities_OwnedCollectionOnDerived] AS [b2] ON [b].[Id] = [b2].[DerivedInheritanceRelationshipEntityId] -ORDER BY [b].[Id], [b0].[Id], [n].[Id], [b1].[BaseInheritanceRelationshipEntityId], [b1].[Id], [b2].[DerivedInheritanceRelationshipEntityId] +ORDER BY [b].[Id], [b1].[BaseInheritanceRelationshipEntityId], [b1].[Id], [b2].[DerivedInheritanceRelationshipEntityId] """); } @@ -593,14 +593,14 @@ public override async Task Nested_include_with_inheritance_reference_reference_o AssertSql( """ -SELECT [b].[Id], [b].[Discriminator], [b].[Name], [b].[BaseId], [b0].[Id], [n].[Id], [b1].[BaseInheritanceRelationshipEntityId], [b1].[Id], [b1].[Name], [b].[OwnedReferenceOnBase_Id], [b].[OwnedReferenceOnBase_Name], [b2].[DerivedInheritanceRelationshipEntityId], [b2].[Id], [b2].[Name], [b].[OwnedReferenceOnDerived_Id], [b].[OwnedReferenceOnDerived_Name], [b0].[BaseParentId], [b0].[Discriminator], [b0].[Name], [n].[Discriminator], [n].[Name], [n].[ParentCollectionId], [n].[ParentReferenceId] +SELECT [b].[Id], [b].[Discriminator], [b].[Name], [b].[BaseId], [b1].[BaseInheritanceRelationshipEntityId], [b1].[Id], [b1].[Name], [b].[OwnedReferenceOnBase_Id], [b].[OwnedReferenceOnBase_Name], [b2].[DerivedInheritanceRelationshipEntityId], [b2].[Id], [b2].[Name], [b].[OwnedReferenceOnDerived_Id], [b].[OwnedReferenceOnDerived_Name], [b0].[Id], [b0].[BaseParentId], [b0].[Discriminator], [b0].[Name], [n].[Id], [n].[Discriminator], [n].[Name], [n].[ParentCollectionId], [n].[ParentReferenceId] FROM [BaseEntities] AS [b] LEFT JOIN [BaseReferencesOnBase] AS [b0] ON [b].[Id] = [b0].[BaseParentId] LEFT JOIN [NestedReferences] AS [n] ON [b0].[Id] = [n].[ParentReferenceId] 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' -ORDER BY [b].[Id], [b0].[Id], [n].[Id], [b1].[BaseInheritanceRelationshipEntityId], [b1].[Id], [b2].[DerivedInheritanceRelationshipEntityId] +ORDER BY [b].[Id], [b1].[BaseInheritanceRelationshipEntityId], [b1].[Id], [b2].[DerivedInheritanceRelationshipEntityId] """); } @@ -616,7 +616,7 @@ FROM [NestedReferences] AS [n] 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] -ORDER BY [n].[Id], [b].[Id], [b0].[Id], [b1].[BaseInheritanceRelationshipEntityId], [b1].[Id], [b2].[DerivedInheritanceRelationshipEntityId] +ORDER BY [n].[Id], [b1].[BaseInheritanceRelationshipEntityId], [b1].[Id], [b2].[DerivedInheritanceRelationshipEntityId] """); } @@ -626,13 +626,13 @@ public override async Task Nested_include_with_inheritance_reference_collection( AssertSql( """ -SELECT [b].[Id], [b].[Discriminator], [b].[Name], [b].[BaseId], [b0].[Id], [b1].[BaseInheritanceRelationshipEntityId], [b1].[Id], [b1].[Name], [b].[OwnedReferenceOnBase_Id], [b].[OwnedReferenceOnBase_Name], [b2].[DerivedInheritanceRelationshipEntityId], [b2].[Id], [b2].[Name], [b].[OwnedReferenceOnDerived_Id], [b].[OwnedReferenceOnDerived_Name], [b0].[BaseParentId], [b0].[Discriminator], [b0].[Name], [n].[Id], [n].[Discriminator], [n].[Name], [n].[ParentCollectionId], [n].[ParentReferenceId] +SELECT [b].[Id], [b].[Discriminator], [b].[Name], [b].[BaseId], [b1].[BaseInheritanceRelationshipEntityId], [b1].[Id], [b1].[Name], [b].[OwnedReferenceOnBase_Id], [b].[OwnedReferenceOnBase_Name], [b2].[DerivedInheritanceRelationshipEntityId], [b2].[Id], [b2].[Name], [b].[OwnedReferenceOnDerived_Id], [b].[OwnedReferenceOnDerived_Name], [b0].[Id], [b0].[BaseParentId], [b0].[Discriminator], [b0].[Name], [n].[Id], [n].[Discriminator], [n].[Name], [n].[ParentCollectionId], [n].[ParentReferenceId] 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] LEFT JOIN [NestedCollections] AS [n] ON [b0].[Id] = [n].[ParentReferenceId] -ORDER BY [b].[Id], [b0].[Id], [b1].[BaseInheritanceRelationshipEntityId], [b1].[Id], [b2].[DerivedInheritanceRelationshipEntityId], [b2].[Id] +ORDER BY [b].[Id], [b1].[BaseInheritanceRelationshipEntityId], [b1].[Id], [b2].[DerivedInheritanceRelationshipEntityId], [b2].[Id] """); } @@ -642,14 +642,14 @@ public override async Task Nested_include_with_inheritance_reference_collection_ AssertSql( """ -SELECT [b].[Id], [b].[Discriminator], [b].[Name], [b].[BaseId], [b0].[Id], [b1].[BaseInheritanceRelationshipEntityId], [b1].[Id], [b1].[Name], [b].[OwnedReferenceOnBase_Id], [b].[OwnedReferenceOnBase_Name], [b2].[DerivedInheritanceRelationshipEntityId], [b2].[Id], [b2].[Name], [b].[OwnedReferenceOnDerived_Id], [b].[OwnedReferenceOnDerived_Name], [b0].[BaseParentId], [b0].[Discriminator], [b0].[Name], [n].[Id], [n].[Discriminator], [n].[Name], [n].[ParentCollectionId], [n].[ParentReferenceId] +SELECT [b].[Id], [b].[Discriminator], [b].[Name], [b].[BaseId], [b1].[BaseInheritanceRelationshipEntityId], [b1].[Id], [b1].[Name], [b].[OwnedReferenceOnBase_Id], [b].[OwnedReferenceOnBase_Name], [b2].[DerivedInheritanceRelationshipEntityId], [b2].[Id], [b2].[Name], [b].[OwnedReferenceOnDerived_Id], [b].[OwnedReferenceOnDerived_Name], [b0].[Id], [b0].[BaseParentId], [b0].[Discriminator], [b0].[Name], [n].[Id], [n].[Discriminator], [n].[Name], [n].[ParentCollectionId], [n].[ParentReferenceId] 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] LEFT JOIN [NestedCollections] AS [n] ON [b0].[Id] = [n].[ParentReferenceId] WHERE [b].[Discriminator] = N'DerivedInheritanceRelationshipEntity' -ORDER BY [b].[Id], [b0].[Id], [b1].[BaseInheritanceRelationshipEntityId], [b1].[Id], [b2].[DerivedInheritanceRelationshipEntityId], [b2].[Id] +ORDER BY [b].[Id], [b1].[BaseInheritanceRelationshipEntityId], [b1].[Id], [b2].[DerivedInheritanceRelationshipEntityId], [b2].[Id] """); } @@ -665,7 +665,7 @@ FROM [NestedCollections] AS [n] 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] -ORDER BY [n].[Id], [b].[Id], [b0].[Id], [b1].[BaseInheritanceRelationshipEntityId], [b1].[Id], [b2].[DerivedInheritanceRelationshipEntityId] +ORDER BY [n].[Id], [b1].[BaseInheritanceRelationshipEntityId], [b1].[Id], [b2].[DerivedInheritanceRelationshipEntityId] """); } @@ -684,7 +684,7 @@ LEFT JOIN ( FROM [BaseCollectionsOnBase] AS [b2] LEFT JOIN [NestedReferences] AS [n] ON [b2].[Id] = [n].[ParentCollectionId] ) AS [s] ON [b].[Id] = [s].[BaseParentId] -ORDER BY [b].[Id], [b0].[BaseInheritanceRelationshipEntityId], [b0].[Id], [b1].[DerivedInheritanceRelationshipEntityId], [b1].[Id], [s].[Id] +ORDER BY [b].[Id], [b0].[BaseInheritanceRelationshipEntityId], [b0].[Id], [b1].[DerivedInheritanceRelationshipEntityId], [b1].[Id] """); } @@ -700,7 +700,7 @@ FROM [NestedReferences] AS [n] 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] -ORDER BY [n].[Id], [b].[Id], [b0].[Id], [b1].[BaseInheritanceRelationshipEntityId], [b1].[Id], [b2].[DerivedInheritanceRelationshipEntityId] +ORDER BY [n].[Id], [b1].[BaseInheritanceRelationshipEntityId], [b1].[Id], [b2].[DerivedInheritanceRelationshipEntityId] """); } @@ -735,7 +735,7 @@ FROM [NestedCollections] AS [n] 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] -ORDER BY [n].[Id], [b].[Id], [b0].[Id], [b1].[BaseInheritanceRelationshipEntityId], [b1].[Id], [b2].[DerivedInheritanceRelationshipEntityId] +ORDER BY [n].[Id], [b1].[BaseInheritanceRelationshipEntityId], [b1].[Id], [b2].[DerivedInheritanceRelationshipEntityId] """); } @@ -752,7 +752,7 @@ LEFT JOIN ( FROM [PrincipalEntities] AS [p] LEFT JOIN [ReferencedEntities] AS [r0] ON [p].[ReferenceId] = [r0].[Id] ) AS [s] ON [r].[Id] = [s].[ReferencedEntityId] -ORDER BY [r].[Id], [s].[Id] +ORDER BY [r].[Id] """); } @@ -831,23 +831,23 @@ public override async Task Include_collection_with_inheritance_reverse_split(boo 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] -ORDER BY [b].[Id], [b0].[Id] +ORDER BY [b].[Id] """, // """ -SELECT [b3].[BaseInheritanceRelationshipEntityId], [b3].[Id], [b3].[Name], [b].[Id], [b0].[Id] +SELECT [b3].[BaseInheritanceRelationshipEntityId], [b3].[Id], [b3].[Name], [b].[Id] FROM [BaseCollectionsOnBase] AS [b] LEFT JOIN [BaseEntities] AS [b0] ON [b].[BaseParentId] = [b0].[Id] INNER JOIN [BaseEntities_OwnedCollectionOnBase] AS [b3] ON [b0].[Id] = [b3].[BaseInheritanceRelationshipEntityId] -ORDER BY [b].[Id], [b0].[Id] +ORDER BY [b].[Id] """, // """ -SELECT [b4].[DerivedInheritanceRelationshipEntityId], [b4].[Id], [b4].[Name], [b].[Id], [b0].[Id] +SELECT [b4].[DerivedInheritanceRelationshipEntityId], [b4].[Id], [b4].[Name], [b].[Id] FROM [BaseCollectionsOnBase] AS [b] LEFT JOIN [BaseEntities] AS [b0] ON [b].[BaseParentId] = [b0].[Id] INNER JOIN [BaseEntities_OwnedCollectionOnDerived] AS [b4] ON [b0].[Id] = [b4].[DerivedInheritanceRelationshipEntityId] -ORDER BY [b].[Id], [b0].[Id] +ORDER BY [b].[Id] """); } @@ -898,25 +898,25 @@ public override async Task Include_collection_with_inheritance_with_filter_rever FROM [BaseCollectionsOnBase] AS [b] LEFT JOIN [BaseEntities] AS [b0] ON [b].[BaseParentId] = [b0].[Id] WHERE [b].[Name] <> N'Bar' OR [b].[Name] IS NULL -ORDER BY [b].[Id], [b0].[Id] +ORDER BY [b].[Id] """, // """ -SELECT [b3].[BaseInheritanceRelationshipEntityId], [b3].[Id], [b3].[Name], [b].[Id], [b0].[Id] +SELECT [b3].[BaseInheritanceRelationshipEntityId], [b3].[Id], [b3].[Name], [b].[Id] FROM [BaseCollectionsOnBase] AS [b] LEFT JOIN [BaseEntities] AS [b0] ON [b].[BaseParentId] = [b0].[Id] INNER JOIN [BaseEntities_OwnedCollectionOnBase] AS [b3] ON [b0].[Id] = [b3].[BaseInheritanceRelationshipEntityId] WHERE [b].[Name] <> N'Bar' OR [b].[Name] IS NULL -ORDER BY [b].[Id], [b0].[Id] +ORDER BY [b].[Id] """, // """ -SELECT [b4].[DerivedInheritanceRelationshipEntityId], [b4].[Id], [b4].[Name], [b].[Id], [b0].[Id] +SELECT [b4].[DerivedInheritanceRelationshipEntityId], [b4].[Id], [b4].[Name], [b].[Id] FROM [BaseCollectionsOnBase] AS [b] LEFT JOIN [BaseEntities] AS [b0] ON [b].[BaseParentId] = [b0].[Id] INNER JOIN [BaseEntities_OwnedCollectionOnDerived] AS [b4] ON [b0].[Id] = [b4].[DerivedInheritanceRelationshipEntityId] WHERE [b].[Name] <> N'Bar' OR [b].[Name] IS NULL -ORDER BY [b].[Id], [b0].[Id] +ORDER BY [b].[Id] """); } @@ -962,23 +962,23 @@ public override async Task Include_collection_without_inheritance_reverse_split( 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] -ORDER BY [c].[Id], [b].[Id] +ORDER BY [c].[Id] """, // """ -SELECT [b2].[BaseInheritanceRelationshipEntityId], [b2].[Id], [b2].[Name], [c].[Id], [b].[Id] +SELECT [b2].[BaseInheritanceRelationshipEntityId], [b2].[Id], [b2].[Name], [c].[Id] FROM [CollectionsOnBase] AS [c] LEFT JOIN [BaseEntities] AS [b] ON [c].[ParentId] = [b].[Id] INNER JOIN [BaseEntities_OwnedCollectionOnBase] AS [b2] ON [b].[Id] = [b2].[BaseInheritanceRelationshipEntityId] -ORDER BY [c].[Id], [b].[Id] +ORDER BY [c].[Id] """, // """ -SELECT [b3].[DerivedInheritanceRelationshipEntityId], [b3].[Id], [b3].[Name], [c].[Id], [b].[Id] +SELECT [b3].[DerivedInheritanceRelationshipEntityId], [b3].[Id], [b3].[Name], [c].[Id] FROM [CollectionsOnBase] AS [c] LEFT JOIN [BaseEntities] AS [b] ON [c].[ParentId] = [b].[Id] INNER JOIN [BaseEntities_OwnedCollectionOnDerived] AS [b3] ON [b].[Id] = [b3].[DerivedInheritanceRelationshipEntityId] -ORDER BY [c].[Id], [b].[Id] +ORDER BY [c].[Id] """); } @@ -1029,25 +1029,25 @@ public override async Task Include_collection_without_inheritance_with_filter_re FROM [CollectionsOnBase] AS [c] LEFT JOIN [BaseEntities] AS [b] ON [c].[ParentId] = [b].[Id] WHERE [c].[Name] <> N'Bar' OR [c].[Name] IS NULL -ORDER BY [c].[Id], [b].[Id] +ORDER BY [c].[Id] """, // """ -SELECT [b2].[BaseInheritanceRelationshipEntityId], [b2].[Id], [b2].[Name], [c].[Id], [b].[Id] +SELECT [b2].[BaseInheritanceRelationshipEntityId], [b2].[Id], [b2].[Name], [c].[Id] FROM [CollectionsOnBase] AS [c] LEFT JOIN [BaseEntities] AS [b] ON [c].[ParentId] = [b].[Id] INNER JOIN [BaseEntities_OwnedCollectionOnBase] AS [b2] ON [b].[Id] = [b2].[BaseInheritanceRelationshipEntityId] WHERE [c].[Name] <> N'Bar' OR [c].[Name] IS NULL -ORDER BY [c].[Id], [b].[Id] +ORDER BY [c].[Id] """, // """ -SELECT [b3].[DerivedInheritanceRelationshipEntityId], [b3].[Id], [b3].[Name], [c].[Id], [b].[Id] +SELECT [b3].[DerivedInheritanceRelationshipEntityId], [b3].[Id], [b3].[Name], [c].[Id] FROM [CollectionsOnBase] AS [c] LEFT JOIN [BaseEntities] AS [b] ON [c].[ParentId] = [b].[Id] INNER JOIN [BaseEntities_OwnedCollectionOnDerived] AS [b3] ON [b].[Id] = [b3].[DerivedInheritanceRelationshipEntityId] WHERE [c].[Name] <> N'Bar' OR [c].[Name] IS NULL -ORDER BY [c].[Id], [b].[Id] +ORDER BY [c].[Id] """); } @@ -1179,11 +1179,11 @@ LEFT JOIN ( FROM [BaseEntities] AS [b0] WHERE [b0].[Discriminator] = N'DerivedInheritanceRelationshipEntity' ) AS [b1] ON [b].[ParentId] = [b1].[Id] -ORDER BY [b].[Id], [b1].[Id] +ORDER BY [b].[Id] """, // """ -SELECT [b4].[BaseInheritanceRelationshipEntityId], [b4].[Id], [b4].[Name], [b].[Id], [b1].[Id] +SELECT [b4].[BaseInheritanceRelationshipEntityId], [b4].[Id], [b4].[Name], [b].[Id] FROM [BaseCollectionsOnDerived] AS [b] LEFT JOIN ( SELECT [b0].[Id] @@ -1191,11 +1191,11 @@ FROM [BaseEntities] AS [b0] WHERE [b0].[Discriminator] = N'DerivedInheritanceRelationshipEntity' ) AS [b1] ON [b].[ParentId] = [b1].[Id] INNER JOIN [BaseEntities_OwnedCollectionOnBase] AS [b4] ON [b1].[Id] = [b4].[BaseInheritanceRelationshipEntityId] -ORDER BY [b].[Id], [b1].[Id] +ORDER BY [b].[Id] """, // """ -SELECT [b5].[DerivedInheritanceRelationshipEntityId], [b5].[Id], [b5].[Name], [b].[Id], [b1].[Id] +SELECT [b5].[DerivedInheritanceRelationshipEntityId], [b5].[Id], [b5].[Name], [b].[Id] FROM [BaseCollectionsOnDerived] AS [b] LEFT JOIN ( SELECT [b0].[Id] @@ -1203,7 +1203,7 @@ FROM [BaseEntities] AS [b0] WHERE [b0].[Discriminator] = N'DerivedInheritanceRelationshipEntity' ) AS [b1] ON [b].[ParentId] = [b1].[Id] INNER JOIN [BaseEntities_OwnedCollectionOnDerived] AS [b5] ON [b1].[Id] = [b5].[DerivedInheritanceRelationshipEntityId] -ORDER BY [b].[Id], [b1].[Id] +ORDER BY [b].[Id] """); } @@ -1213,34 +1213,32 @@ public override async Task Nested_include_with_inheritance_reference_collection_ AssertSql( """ -SELECT [b].[Id], [b].[Discriminator], [b].[Name], [b].[BaseId], [b0].[Id], [b].[OwnedReferenceOnBase_Id], [b].[OwnedReferenceOnBase_Name], [b].[OwnedReferenceOnDerived_Id], [b].[OwnedReferenceOnDerived_Name], [b0].[BaseParentId], [b0].[Discriminator], [b0].[Name] +SELECT [b].[Id], [b].[Discriminator], [b].[Name], [b].[BaseId], [b].[OwnedReferenceOnBase_Id], [b].[OwnedReferenceOnBase_Name], [b].[OwnedReferenceOnDerived_Id], [b].[OwnedReferenceOnDerived_Name], [b0].[Id], [b0].[BaseParentId], [b0].[Discriminator], [b0].[Name] FROM [BaseEntities] AS [b] LEFT JOIN [BaseReferencesOnBase] AS [b0] ON [b].[Id] = [b0].[BaseParentId] -ORDER BY [b].[Id], [b0].[Id] +ORDER BY [b].[Id] """, // """ -SELECT [b3].[BaseInheritanceRelationshipEntityId], [b3].[Id], [b3].[Name], [b].[Id], [b0].[Id] +SELECT [b3].[BaseInheritanceRelationshipEntityId], [b3].[Id], [b3].[Name], [b].[Id] FROM [BaseEntities] AS [b] -LEFT JOIN [BaseReferencesOnBase] AS [b0] ON [b].[Id] = [b0].[BaseParentId] INNER JOIN [BaseEntities_OwnedCollectionOnBase] AS [b3] ON [b].[Id] = [b3].[BaseInheritanceRelationshipEntityId] -ORDER BY [b].[Id], [b0].[Id] +ORDER BY [b].[Id] """, // """ -SELECT [b4].[DerivedInheritanceRelationshipEntityId], [b4].[Id], [b4].[Name], [b].[Id], [b0].[Id] +SELECT [b4].[DerivedInheritanceRelationshipEntityId], [b4].[Id], [b4].[Name], [b].[Id] FROM [BaseEntities] AS [b] -LEFT JOIN [BaseReferencesOnBase] AS [b0] ON [b].[Id] = [b0].[BaseParentId] INNER JOIN [BaseEntities_OwnedCollectionOnDerived] AS [b4] ON [b].[Id] = [b4].[DerivedInheritanceRelationshipEntityId] -ORDER BY [b].[Id], [b0].[Id] +ORDER BY [b].[Id] """, // """ -SELECT [n].[Id], [n].[Discriminator], [n].[Name], [n].[ParentCollectionId], [n].[ParentReferenceId], [b].[Id], [b0].[Id] +SELECT [n].[Id], [n].[Discriminator], [n].[Name], [n].[ParentCollectionId], [n].[ParentReferenceId], [b].[Id] FROM [BaseEntities] AS [b] LEFT JOIN [BaseReferencesOnBase] AS [b0] ON [b].[Id] = [b0].[BaseParentId] INNER JOIN [NestedCollections] AS [n] ON [b0].[Id] = [n].[ParentReferenceId] -ORDER BY [b].[Id], [b0].[Id] +ORDER BY [b].[Id] """); } @@ -1250,38 +1248,36 @@ public override async Task Nested_include_with_inheritance_reference_collection_ AssertSql( """ -SELECT [b].[Id], [b].[Discriminator], [b].[Name], [b].[BaseId], [b0].[Id], [b].[OwnedReferenceOnBase_Id], [b].[OwnedReferenceOnBase_Name], [b].[OwnedReferenceOnDerived_Id], [b].[OwnedReferenceOnDerived_Name], [b0].[BaseParentId], [b0].[Discriminator], [b0].[Name] +SELECT [b].[Id], [b].[Discriminator], [b].[Name], [b].[BaseId], [b].[OwnedReferenceOnBase_Id], [b].[OwnedReferenceOnBase_Name], [b].[OwnedReferenceOnDerived_Id], [b].[OwnedReferenceOnDerived_Name], [b0].[Id], [b0].[BaseParentId], [b0].[Discriminator], [b0].[Name] FROM [BaseEntities] AS [b] LEFT JOIN [BaseReferencesOnBase] AS [b0] ON [b].[Id] = [b0].[BaseParentId] WHERE [b].[Discriminator] = N'DerivedInheritanceRelationshipEntity' -ORDER BY [b].[Id], [b0].[Id] +ORDER BY [b].[Id] """, // """ -SELECT [b3].[BaseInheritanceRelationshipEntityId], [b3].[Id], [b3].[Name], [b].[Id], [b0].[Id] +SELECT [b3].[BaseInheritanceRelationshipEntityId], [b3].[Id], [b3].[Name], [b].[Id] FROM [BaseEntities] AS [b] -LEFT JOIN [BaseReferencesOnBase] AS [b0] ON [b].[Id] = [b0].[BaseParentId] INNER JOIN [BaseEntities_OwnedCollectionOnBase] AS [b3] ON [b].[Id] = [b3].[BaseInheritanceRelationshipEntityId] WHERE [b].[Discriminator] = N'DerivedInheritanceRelationshipEntity' -ORDER BY [b].[Id], [b0].[Id] +ORDER BY [b].[Id] """, // """ -SELECT [b4].[DerivedInheritanceRelationshipEntityId], [b4].[Id], [b4].[Name], [b].[Id], [b0].[Id] +SELECT [b4].[DerivedInheritanceRelationshipEntityId], [b4].[Id], [b4].[Name], [b].[Id] FROM [BaseEntities] AS [b] -LEFT JOIN [BaseReferencesOnBase] AS [b0] ON [b].[Id] = [b0].[BaseParentId] INNER JOIN [BaseEntities_OwnedCollectionOnDerived] AS [b4] ON [b].[Id] = [b4].[DerivedInheritanceRelationshipEntityId] WHERE [b].[Discriminator] = N'DerivedInheritanceRelationshipEntity' -ORDER BY [b].[Id], [b0].[Id] +ORDER BY [b].[Id] """, // """ -SELECT [n].[Id], [n].[Discriminator], [n].[Name], [n].[ParentCollectionId], [n].[ParentReferenceId], [b].[Id], [b0].[Id] +SELECT [n].[Id], [n].[Discriminator], [n].[Name], [n].[ParentCollectionId], [n].[ParentReferenceId], [b].[Id] FROM [BaseEntities] AS [b] LEFT JOIN [BaseReferencesOnBase] AS [b0] ON [b].[Id] = [b0].[BaseParentId] INNER JOIN [NestedCollections] AS [n] ON [b0].[Id] = [n].[ParentReferenceId] WHERE [b].[Discriminator] = N'DerivedInheritanceRelationshipEntity' -ORDER BY [b].[Id], [b0].[Id] +ORDER BY [b].[Id] """); } @@ -1295,25 +1291,25 @@ public override async Task Nested_include_with_inheritance_reference_collection_ FROM [NestedCollections] AS [n] LEFT JOIN [BaseReferencesOnBase] AS [b] ON [n].[ParentReferenceId] = [b].[Id] LEFT JOIN [BaseEntities] AS [b0] ON [b].[BaseParentId] = [b0].[Id] -ORDER BY [n].[Id], [b].[Id], [b0].[Id] +ORDER BY [n].[Id] """, // """ -SELECT [b3].[BaseInheritanceRelationshipEntityId], [b3].[Id], [b3].[Name], [n].[Id], [b].[Id], [b0].[Id] +SELECT [b3].[BaseInheritanceRelationshipEntityId], [b3].[Id], [b3].[Name], [n].[Id] FROM [NestedCollections] AS [n] LEFT JOIN [BaseReferencesOnBase] AS [b] ON [n].[ParentReferenceId] = [b].[Id] LEFT JOIN [BaseEntities] AS [b0] ON [b].[BaseParentId] = [b0].[Id] INNER JOIN [BaseEntities_OwnedCollectionOnBase] AS [b3] ON [b0].[Id] = [b3].[BaseInheritanceRelationshipEntityId] -ORDER BY [n].[Id], [b].[Id], [b0].[Id] +ORDER BY [n].[Id] """, // """ -SELECT [b4].[DerivedInheritanceRelationshipEntityId], [b4].[Id], [b4].[Name], [n].[Id], [b].[Id], [b0].[Id] +SELECT [b4].[DerivedInheritanceRelationshipEntityId], [b4].[Id], [b4].[Name], [n].[Id] FROM [NestedCollections] AS [n] LEFT JOIN [BaseReferencesOnBase] AS [b] ON [n].[ParentReferenceId] = [b].[Id] LEFT JOIN [BaseEntities] AS [b0] ON [b].[BaseParentId] = [b0].[Id] INNER JOIN [BaseEntities_OwnedCollectionOnDerived] AS [b4] ON [b0].[Id] = [b4].[DerivedInheritanceRelationshipEntityId] -ORDER BY [n].[Id], [b].[Id], [b0].[Id] +ORDER BY [n].[Id] """); } @@ -1364,25 +1360,25 @@ public override async Task Nested_include_with_inheritance_collection_reference_ FROM [NestedReferences] AS [n] LEFT JOIN [BaseCollectionsOnBase] AS [b] ON [n].[ParentCollectionId] = [b].[Id] LEFT JOIN [BaseEntities] AS [b0] ON [b].[BaseParentId] = [b0].[Id] -ORDER BY [n].[Id], [b].[Id], [b0].[Id] +ORDER BY [n].[Id] """, // """ -SELECT [b3].[BaseInheritanceRelationshipEntityId], [b3].[Id], [b3].[Name], [n].[Id], [b].[Id], [b0].[Id] +SELECT [b3].[BaseInheritanceRelationshipEntityId], [b3].[Id], [b3].[Name], [n].[Id] FROM [NestedReferences] AS [n] LEFT JOIN [BaseCollectionsOnBase] AS [b] ON [n].[ParentCollectionId] = [b].[Id] LEFT JOIN [BaseEntities] AS [b0] ON [b].[BaseParentId] = [b0].[Id] INNER JOIN [BaseEntities_OwnedCollectionOnBase] AS [b3] ON [b0].[Id] = [b3].[BaseInheritanceRelationshipEntityId] -ORDER BY [n].[Id], [b].[Id], [b0].[Id] +ORDER BY [n].[Id] """, // """ -SELECT [b4].[DerivedInheritanceRelationshipEntityId], [b4].[Id], [b4].[Name], [n].[Id], [b].[Id], [b0].[Id] +SELECT [b4].[DerivedInheritanceRelationshipEntityId], [b4].[Id], [b4].[Name], [n].[Id] FROM [NestedReferences] AS [n] LEFT JOIN [BaseCollectionsOnBase] AS [b] ON [n].[ParentCollectionId] = [b].[Id] LEFT JOIN [BaseEntities] AS [b0] ON [b].[BaseParentId] = [b0].[Id] INNER JOIN [BaseEntities_OwnedCollectionOnDerived] AS [b4] ON [b0].[Id] = [b4].[DerivedInheritanceRelationshipEntityId] -ORDER BY [n].[Id], [b].[Id], [b0].[Id] +ORDER BY [n].[Id] """); } @@ -1437,25 +1433,25 @@ public override async Task Nested_include_with_inheritance_collection_collection FROM [NestedCollections] AS [n] LEFT JOIN [BaseCollectionsOnBase] AS [b] ON [n].[ParentCollectionId] = [b].[Id] LEFT JOIN [BaseEntities] AS [b0] ON [b].[BaseParentId] = [b0].[Id] -ORDER BY [n].[Id], [b].[Id], [b0].[Id] +ORDER BY [n].[Id] """, // """ -SELECT [b3].[BaseInheritanceRelationshipEntityId], [b3].[Id], [b3].[Name], [n].[Id], [b].[Id], [b0].[Id] +SELECT [b3].[BaseInheritanceRelationshipEntityId], [b3].[Id], [b3].[Name], [n].[Id] FROM [NestedCollections] AS [n] LEFT JOIN [BaseCollectionsOnBase] AS [b] ON [n].[ParentCollectionId] = [b].[Id] LEFT JOIN [BaseEntities] AS [b0] ON [b].[BaseParentId] = [b0].[Id] INNER JOIN [BaseEntities_OwnedCollectionOnBase] AS [b3] ON [b0].[Id] = [b3].[BaseInheritanceRelationshipEntityId] -ORDER BY [n].[Id], [b].[Id], [b0].[Id] +ORDER BY [n].[Id] """, // """ -SELECT [b4].[DerivedInheritanceRelationshipEntityId], [b4].[Id], [b4].[Name], [n].[Id], [b].[Id], [b0].[Id] +SELECT [b4].[DerivedInheritanceRelationshipEntityId], [b4].[Id], [b4].[Name], [n].[Id] FROM [NestedCollections] AS [n] LEFT JOIN [BaseCollectionsOnBase] AS [b] ON [n].[ParentCollectionId] = [b].[Id] LEFT JOIN [BaseEntities] AS [b0] ON [b].[BaseParentId] = [b0].[Id] INNER JOIN [BaseEntities_OwnedCollectionOnDerived] AS [b4] ON [b0].[Id] = [b4].[DerivedInheritanceRelationshipEntityId] -ORDER BY [n].[Id], [b].[Id], [b0].[Id] +ORDER BY [n].[Id] """); } diff --git a/test/EFCore.SqlServer.FunctionalTests/Query/JsonQueryJsonTypeSqlServerTest.cs b/test/EFCore.SqlServer.FunctionalTests/Query/JsonQueryJsonTypeSqlServerTest.cs index 5a46b59f420..bb033e9a23b 100644 --- a/test/EFCore.SqlServer.FunctionalTests/Query/JsonQueryJsonTypeSqlServerTest.cs +++ b/test/EFCore.SqlServer.FunctionalTests/Query/JsonQueryJsonTypeSqlServerTest.cs @@ -2152,7 +2152,7 @@ public override async Task Json_with_include_on_entity_collection_and_reference( FROM [JsonEntitiesBasic] AS [j] LEFT JOIN [JsonEntitiesBasicForReference] AS [j0] ON [j].[Id] = [j0].[ParentId] LEFT JOIN [JsonEntitiesBasicForCollection] AS [j1] ON [j].[Id] = [j1].[ParentId] -ORDER BY [j].[Id], [j0].[Id] +ORDER BY [j].[Id] """); } @@ -2231,7 +2231,7 @@ SELECT JSON_QUERY([j].[OwnedCollectionRoot], '$[0]'), [j].[Id], [j0].[Id], [j0]. FROM [JsonEntitiesBasic] AS [j] LEFT JOIN [JsonEntitiesBasicForReference] AS [j0] ON [j].[Id] = [j0].[ParentId] LEFT JOIN [JsonEntitiesBasicForCollection] AS [j1] ON [j].[Id] = [j1].[ParentId] -ORDER BY [j].[Id], [j0].[Id] +ORDER BY [j].[Id] """); } @@ -2245,7 +2245,7 @@ SELECT JSON_QUERY([j].[OwnedReferenceRoot], '$.OwnedReferenceBranch.OwnedCollect FROM [JsonEntitiesBasic] AS [j] LEFT JOIN [JsonEntitiesBasicForReference] AS [j0] ON [j].[Id] = [j0].[ParentId] LEFT JOIN [JsonEntitiesBasicForCollection] AS [j1] ON [j].[Id] = [j1].[ParentId] -ORDER BY [j].[Id], [j0].[Id] +ORDER BY [j].[Id] """); // AssertSql( diff --git a/test/EFCore.SqlServer.FunctionalTests/Query/JsonQuerySqlServerTest.cs b/test/EFCore.SqlServer.FunctionalTests/Query/JsonQuerySqlServerTest.cs index 6b4b4bb2c87..eb72c972bc3 100644 --- a/test/EFCore.SqlServer.FunctionalTests/Query/JsonQuerySqlServerTest.cs +++ b/test/EFCore.SqlServer.FunctionalTests/Query/JsonQuerySqlServerTest.cs @@ -2117,7 +2117,7 @@ public override async Task Json_with_include_on_entity_collection_and_reference( FROM [JsonEntitiesBasic] AS [j] LEFT JOIN [JsonEntitiesBasicForReference] AS [j0] ON [j].[Id] = [j0].[ParentId] LEFT JOIN [JsonEntitiesBasicForCollection] AS [j1] ON [j].[Id] = [j1].[ParentId] -ORDER BY [j].[Id], [j0].[Id] +ORDER BY [j].[Id] """); } @@ -2196,7 +2196,7 @@ SELECT JSON_QUERY([j].[OwnedCollectionRoot], '$[0]'), [j].[Id], [j0].[Id], [j0]. FROM [JsonEntitiesBasic] AS [j] LEFT JOIN [JsonEntitiesBasicForReference] AS [j0] ON [j].[Id] = [j0].[ParentId] LEFT JOIN [JsonEntitiesBasicForCollection] AS [j1] ON [j].[Id] = [j1].[ParentId] -ORDER BY [j].[Id], [j0].[Id] +ORDER BY [j].[Id] """); } @@ -2210,7 +2210,7 @@ SELECT JSON_QUERY([j].[OwnedReferenceRoot], '$.OwnedReferenceBranch.OwnedCollect FROM [JsonEntitiesBasic] AS [j] LEFT JOIN [JsonEntitiesBasicForReference] AS [j0] ON [j].[Id] = [j0].[ParentId] LEFT JOIN [JsonEntitiesBasicForCollection] AS [j1] ON [j].[Id] = [j1].[ParentId] -ORDER BY [j].[Id], [j0].[Id] +ORDER BY [j].[Id] """); // AssertSql( diff --git a/test/EFCore.SqlServer.FunctionalTests/Query/ManyToManyNoTrackingQuerySqlServerTest.cs b/test/EFCore.SqlServer.FunctionalTests/Query/ManyToManyNoTrackingQuerySqlServerTest.cs index fe73be2f481..4fada534e32 100644 --- a/test/EFCore.SqlServer.FunctionalTests/Query/ManyToManyNoTrackingQuerySqlServerTest.cs +++ b/test/EFCore.SqlServer.FunctionalTests/Query/ManyToManyNoTrackingQuerySqlServerTest.cs @@ -90,7 +90,6 @@ FROM [EntityOnes] AS [e] WHERE EXISTS ( SELECT 1 FROM [JoinOneSelfPayload] AS [j] - INNER JOIN [EntityOnes] AS [e0] ON [j].[LeftId] = [e0].[Id] WHERE [e].[Id] = [j].[RightId]) """); } @@ -126,7 +125,6 @@ FROM [EntityTwos] AS [e] WHERE ( SELECT COUNT_BIG(*) FROM [JoinTwoToThree] AS [j] - INNER JOIN [EntityThrees] AS [e0] ON [j].[ThreeId] = [e0].[Id] WHERE [e].[Id] = [j].[TwoId]) > CAST(0 AS bigint) """); } @@ -370,7 +368,7 @@ FROM [EntityRoots] AS [e0] WHERE [e0].[Discriminator] = N'EntityLeaf' ) AS [e1] ON [j].[LeafId] = [e1].[Id] ) AS [s] ON [e].[Key1] = [s].[CompositeId1] AND [e].[Key2] = [s].[CompositeId2] AND [e].[Key3] = [s].[CompositeId3] -ORDER BY [e].[Key1], [e].[Key2], [e].[Key3], [s].[LeafId], [s].[CompositeId1], [s].[CompositeId2], [s].[CompositeId3] +ORDER BY [e].[Key1], [e].[Key2], [e].[Key3], [s].[LeafId], [s].[CompositeId1], [s].[CompositeId2] """); } @@ -388,7 +386,7 @@ FROM [EntityCompositeKeyEntityRoot] AS [e0] INNER JOIN [EntityRoots] AS [e1] ON [e0].[RootSkipSharedId] = [e1].[Id] WHERE [e1].[Discriminator] = N'EntityLeaf' ) AS [s] ON [e].[Key1] = [s].[CompositeKeySkipSharedKey1] AND [e].[Key2] = [s].[CompositeKeySkipSharedKey2] AND [e].[Key3] = [s].[CompositeKeySkipSharedKey3] -ORDER BY [e].[Key1], [e].[Key2], [e].[Key3], [s].[RootSkipSharedId], [s].[CompositeKeySkipSharedKey1], [s].[CompositeKeySkipSharedKey2], [s].[CompositeKeySkipSharedKey3] +ORDER BY [e].[Key1], [e].[Key2], [e].[Key3], [s].[RootSkipSharedId], [s].[CompositeKeySkipSharedKey1], [s].[CompositeKeySkipSharedKey2] """); } @@ -574,7 +572,7 @@ LEFT JOIN ( FROM [JoinOneSelfPayload] AS [j] INNER JOIN [EntityOnes] AS [e0] ON [j].[LeftId] = [e0].[Id] ) AS [s] ON [e].[Id] = [s].[RightId] -ORDER BY [e].[Id], [s].[LeftId], [s].[RightId] +ORDER BY [e].[Id], [s].[LeftId] """); } @@ -601,7 +599,7 @@ LEFT JOIN ( FROM [EntityCompositeKeyEntityTwo] AS [e3] INNER JOIN [EntityCompositeKeys] AS [e4] ON [e3].[CompositeKeySkipSharedKey1] = [e4].[Key1] AND [e3].[CompositeKeySkipSharedKey2] = [e4].[Key2] AND [e3].[CompositeKeySkipSharedKey3] = [e4].[Key3] ) AS [s1] ON [e].[Id] = [s1].[TwoSkipSharedId] -ORDER BY [e].[Id], [s].[ThreeId], [s].[TwoId], [s].[Id], [s0].[SelfSkipSharedLeftId], [s0].[SelfSkipSharedRightId], [s0].[Id], [s1].[TwoSkipSharedId], [s1].[CompositeKeySkipSharedKey1], [s1].[CompositeKeySkipSharedKey2], [s1].[CompositeKeySkipSharedKey3], [s1].[Key1], [s1].[Key2] +ORDER BY [e].[Id], [s].[ThreeId], [s].[TwoId], [s0].[SelfSkipSharedLeftId], [s0].[SelfSkipSharedRightId], [s1].[TwoSkipSharedId], [s1].[CompositeKeySkipSharedKey1], [s1].[CompositeKeySkipSharedKey2] """); } @@ -639,7 +637,7 @@ LEFT JOIN ( FROM [EntityCompositeKeyEntityRoot] AS [e0] INNER JOIN [EntityRoots] AS [e1] ON [e0].[RootSkipSharedId] = [e1].[Id] ) AS [s] ON [e].[Key1] = [s].[CompositeKeySkipSharedKey1] AND [e].[Key2] = [s].[CompositeKeySkipSharedKey2] AND [e].[Key3] = [s].[CompositeKeySkipSharedKey3] -ORDER BY [e].[Key1], [e].[Key2], [e].[Key3], [s].[RootSkipSharedId], [s].[CompositeKeySkipSharedKey1], [s].[CompositeKeySkipSharedKey2], [s].[CompositeKeySkipSharedKey3] +ORDER BY [e].[Key1], [e].[Key2], [e].[Key3], [s].[RootSkipSharedId], [s].[CompositeKeySkipSharedKey1], [s].[CompositeKeySkipSharedKey2] """); } @@ -657,7 +655,7 @@ FROM [JoinOneToTwo] AS [j] INNER JOIN [EntityOnes] AS [e0] ON [j].[OneId] = [e0].[Id] LEFT JOIN [EntityTwos] AS [e1] ON [e0].[Id] = [e1].[ReferenceInverseId] ) AS [s] ON [e].[Id] = [s].[TwoId] -ORDER BY [e].[Id], [s].[OneId], [s].[TwoId], [s].[Id] +ORDER BY [e].[Id], [s].[OneId] """); } @@ -683,7 +681,7 @@ FROM [JoinOneToBranch] AS [j0] INNER JOIN [EntityOnes] AS [e2] ON [j0].[EntityOneId] = [e2].[Id] ) AS [s] ON [e1].[Id] = [s].[EntityBranchId] ) AS [s0] ON [e].[Key1] = [s0].[CompositeId1] AND [e].[Key2] = [s0].[CompositeId2] AND [e].[Key3] = [s0].[CompositeId3] -ORDER BY [e].[Key1], [e].[Key2], [e].[Key3], [s0].[LeafId], [s0].[CompositeId1], [s0].[CompositeId2], [s0].[CompositeId3], [s0].[Id], [s0].[EntityBranchId], [s0].[EntityOneId] +ORDER BY [e].[Key1], [e].[Key2], [e].[Key3], [s0].[LeafId], [s0].[CompositeId1], [s0].[CompositeId2], [s0].[CompositeId3], [s0].[EntityBranchId] """); } @@ -706,7 +704,7 @@ FROM [JoinOneSelfPayload] AS [j0] INNER JOIN [EntityOnes] AS [e2] ON [j0].[RightId] = [e2].[Id] ) AS [s] ON [e0].[Id] = [s].[LeftId] ) AS [s0] ON [e].[Id] = [s0].[ThreeId] -ORDER BY [e].[Id], [s0].[OneId], [s0].[ThreeId], [s0].[Id], [s0].[Id0], [s0].[LeftId], [s0].[RightId] +ORDER BY [e].[Id], [s0].[OneId], [s0].[ThreeId], [s0].[LeftId] """); } @@ -716,7 +714,7 @@ public override async Task Include_skip_navigation_and_reference(bool async) AssertSql( """ -SELECT [e].[Id], [e].[CollectionInverseId], [e].[ExtraId], [e].[Name], [e].[ReferenceInverseId], [e0].[Id], [s].[Id], [s].[Name], [s].[OneSkipSharedId], [s].[TwoSkipSharedId], [e0].[CollectionInverseId], [e0].[Name], [e0].[ReferenceInverseId] +SELECT [e].[Id], [e].[CollectionInverseId], [e].[ExtraId], [e].[Name], [e].[ReferenceInverseId], [s].[Id], [s].[Name], [s].[OneSkipSharedId], [s].[TwoSkipSharedId], [e0].[Id], [e0].[CollectionInverseId], [e0].[Name], [e0].[ReferenceInverseId] FROM [EntityTwos] AS [e] LEFT JOIN [EntityThrees] AS [e0] ON [e].[Id] = [e0].[ReferenceInverseId] LEFT JOIN ( @@ -724,7 +722,7 @@ LEFT JOIN ( FROM [EntityOneEntityTwo] AS [e1] INNER JOIN [EntityOnes] AS [e2] ON [e1].[OneSkipSharedId] = [e2].[Id] ) AS [s] ON [e].[Id] = [s].[TwoSkipSharedId] -ORDER BY [e].[Id], [e0].[Id], [s].[OneSkipSharedId], [s].[TwoSkipSharedId] +ORDER BY [e].[Id], [s].[OneSkipSharedId] """); } @@ -742,7 +740,7 @@ FROM [JoinOneToThreePayloadFullShared] AS [j] INNER JOIN [EntityOnes] AS [e0] ON [j].[OneId] = [e0].[Id] WHERE [e0].[Id] < 10 ) AS [s] ON [e].[Id] = [s].[ThreeId] -ORDER BY [e].[Id], [s].[OneId], [s].[ThreeId] +ORDER BY [e].[Id], [s].[OneId] """); } @@ -845,7 +843,7 @@ FROM [JoinOneToThreePayloadFullShared] AS [j] WHERE [e2].[Id] < 10 ) AS [s] ON [e1].[Id] = [s].[ThreeId] ) AS [s0] ON [e].[Id] = [s0].[RootSkipSharedId] -ORDER BY [e].[Id], [s0].[RootSkipSharedId], [s0].[ThreeSkipSharedId], [s0].[Id], [s0].[OneId], [s0].[ThreeId] +ORDER BY [e].[Id], [s0].[RootSkipSharedId], [s0].[ThreeSkipSharedId], [s0].[OneId] """); } @@ -871,7 +869,7 @@ FROM [JoinThreeToCompositeKeyFull] AS [j] WHERE 1 < [s].[row] AND [s].[row] <= 3 ) AS [s0] ON [e1].[Key1] = [s0].[CompositeId1] AND [e1].[Key2] = [s0].[CompositeId2] AND [e1].[Key3] = [s0].[CompositeId3] ) AS [s1] ON [e].[Id] = [s1].[RootSkipSharedId] -ORDER BY [e].[Id], [s1].[RootSkipSharedId], [s1].[CompositeKeySkipSharedKey1], [s1].[CompositeKeySkipSharedKey2], [s1].[CompositeKeySkipSharedKey3], [s1].[Key1], [s1].[Key2], [s1].[Key3], [s1].[CompositeId1], [s1].[CompositeId2], [s1].[CompositeId3], [s1].[Id] +ORDER BY [e].[Id], [s1].[RootSkipSharedId], [s1].[CompositeKeySkipSharedKey1], [s1].[CompositeKeySkipSharedKey2], [s1].[CompositeKeySkipSharedKey3], [s1].[CompositeId1], [s1].[CompositeId2], [s1].[CompositeId3], [s1].[Id] """); } @@ -895,7 +893,7 @@ FROM [EntityCompositeKeyEntityTwo] AS [e1] WHERE [e0].[Key1] < 5 ) AS [s0] ON [e].[Id] = [s0].[LeafId] WHERE [e].[Discriminator] = N'EntityLeaf' -ORDER BY [e].[Id], [s0].[LeafId], [s0].[CompositeId1], [s0].[CompositeId2], [s0].[CompositeId3], [s0].[Key1], [s0].[Key2], [s0].[Key3], [s0].[TwoSkipSharedId], [s0].[CompositeKeySkipSharedKey1], [s0].[CompositeKeySkipSharedKey2], [s0].[CompositeKeySkipSharedKey3] +ORDER BY [e].[Id], [s0].[LeafId], [s0].[CompositeId1], [s0].[CompositeId2], [s0].[CompositeId3], [s0].[TwoSkipSharedId], [s0].[CompositeKeySkipSharedKey1], [s0].[CompositeKeySkipSharedKey2] """); } @@ -924,7 +922,7 @@ FROM [JoinTwoToThree] AS [j0] WHERE [e1].[Id] < 10 ) AS [s0] ON [s].[Id] = [s0].[TwoId] ) AS [s1] -ORDER BY [e].[Id], [s1].[Id], [s1].[OneId], [s1].[TwoId], [s1].[ThreeId], [s1].[TwoId0] +ORDER BY [e].[Id], [s1].[Id], [s1].[OneId], [s1].[TwoId], [s1].[ThreeId] """); } @@ -951,7 +949,7 @@ FROM [JoinTwoToThree] AS [j0] ) AS [s0] ON [e0].[Id] = [s0].[TwoId] WHERE [e0].[Id] < 10 ) AS [s1] ON [e].[Id] = [s1].[OneId] -ORDER BY [e].[Id], [s1].[OneId], [s1].[TwoId], [s1].[Id], [s1].[TwoId0], [s1].[Id0] +ORDER BY [e].[Id], [s1].[OneId], [s1].[TwoId], [s1].[TwoId0], [s1].[Id0] """); } @@ -971,7 +969,7 @@ FROM [JoinOneToTwo] AS [j] LEFT JOIN [EntityTwos] AS [e2] ON [e0].[Id] = [e2].[CollectionInverseId] WHERE [e0].[Id] < 10 ) AS [s] ON [e].[Id] = [s].[TwoId] -ORDER BY [e].[Id], [s].[OneId], [s].[TwoId], [s].[Id], [s].[Id0] +ORDER BY [e].[Id], [s].[OneId], [s].[TwoId] """); } @@ -1008,7 +1006,7 @@ WHERE [e3].[Id] < 20 ) AS [s1] ON [e0].[Id] = [s1].[EntityOneId] WHERE [e0].[Id] < 10 ) AS [s2] ON [e].[Id] = [s2].[ThreeId] -ORDER BY [e].[Id], [s2].[OneId], [s2].[ThreeId], [s2].[Id], [s2].[OneId0], [s2].[Id0], [s2].[TwoId], [s2].[EntityBranchId], [s2].[EntityOneId] +ORDER BY [e].[Id], [s2].[OneId], [s2].[ThreeId], [s2].[OneId0], [s2].[Id0], [s2].[TwoId], [s2].[EntityBranchId] """); } @@ -1031,7 +1029,7 @@ WHERE [e1].[Id] < 5 ) AS [e2] ON [e0].[Id] = [e2].[CollectionInverseId] WHERE [e0].[Id] > 15 ) AS [s] ON [e].[Id] = [s].[ThreeId] -ORDER BY [e].[Id], [s].[OneId], [s].[ThreeId], [s].[Id] +ORDER BY [e].[Id], [s].[OneId], [s].[ThreeId] """); } @@ -1054,7 +1052,7 @@ WHERE [e1].[Id] < 5 ) AS [s] ON [e0].[Id] = [s].[TwoId] WHERE [e0].[Id] > 15 ) AS [s0] ON [e].[Id] = [s0].[CollectionInverseId] -ORDER BY [e].[Id], [s0].[Id], [s0].[ThreeId], [s0].[TwoId] +ORDER BY [e].[Id], [s0].[Id], [s0].[ThreeId] """); } @@ -1142,11 +1140,11 @@ FROM [EntityRoots] AS [e0] WHERE [e0].[Discriminator] = N'EntityLeaf' ) AS [e1] ON [j].[LeafId] = [e1].[Id] ) AS [s] ON [e].[Key1] = [s].[CompositeId1] AND [e].[Key2] = [s].[CompositeId2] AND [e].[Key3] = [s].[CompositeId3] -ORDER BY [e].[Key1], [e].[Key2], [e].[Key3], [s].[LeafId], [s].[CompositeId1], [s].[CompositeId2], [s].[CompositeId3], [s].[Id] +ORDER BY [e].[Key1], [e].[Key2], [e].[Key3], [s].[LeafId], [s].[CompositeId1], [s].[CompositeId2], [s].[CompositeId3] """, // """ -SELECT [s0].[Id], [s0].[Name], [e].[Key1], [e].[Key2], [e].[Key3], [s].[LeafId], [s].[CompositeId1], [s].[CompositeId2], [s].[CompositeId3], [s].[Id] +SELECT [s0].[Id], [s0].[Name], [e].[Key1], [e].[Key2], [e].[Key3], [s].[LeafId], [s].[CompositeId1], [s].[CompositeId2], [s].[CompositeId3] FROM [EntityCompositeKeys] AS [e] INNER JOIN ( SELECT [e1].[Id], [j].[LeafId], [j].[CompositeId1], [j].[CompositeId2], [j].[CompositeId3] @@ -1162,7 +1160,7 @@ INNER JOIN ( FROM [JoinOneToBranch] AS [j0] INNER JOIN [EntityOnes] AS [e2] ON [j0].[EntityOneId] = [e2].[Id] ) AS [s0] ON [s].[Id] = [s0].[EntityBranchId] -ORDER BY [e].[Key1], [e].[Key2], [e].[Key3], [s].[LeafId], [s].[CompositeId1], [s].[CompositeId2], [s].[CompositeId3], [s].[Id] +ORDER BY [e].[Key1], [e].[Key2], [e].[Key3], [s].[LeafId], [s].[CompositeId1], [s].[CompositeId2], [s].[CompositeId3] """); } @@ -1186,24 +1184,23 @@ FROM [JoinOneToThreePayloadFull] AS [j] INNER JOIN [EntityOnes] AS [e0] ON [j].[OneId] = [e0].[Id] LEFT JOIN [EntityTwos] AS [e1] ON [e0].[Id] = [e1].[ReferenceInverseId] ) AS [s] ON [e].[Id] = [s].[ThreeId] -ORDER BY [e].[Id], [s].[OneId], [s].[ThreeId], [s].[Id], [s].[Id0] +ORDER BY [e].[Id], [s].[OneId], [s].[ThreeId] """, // """ -SELECT [s0].[Id], [s0].[Name], [e].[Id], [s].[OneId], [s].[ThreeId], [s].[Id], [s].[Id0] +SELECT [s0].[Id], [s0].[Name], [e].[Id], [s].[OneId], [s].[ThreeId] FROM [EntityThrees] AS [e] INNER JOIN ( - SELECT [e0].[Id], [e1].[Id] AS [Id0], [j].[OneId], [j].[ThreeId] + SELECT [e0].[Id], [j].[OneId], [j].[ThreeId] FROM [JoinOneToThreePayloadFull] AS [j] INNER JOIN [EntityOnes] AS [e0] ON [j].[OneId] = [e0].[Id] - LEFT JOIN [EntityTwos] AS [e1] ON [e0].[Id] = [e1].[ReferenceInverseId] ) AS [s] ON [e].[Id] = [s].[ThreeId] INNER JOIN ( SELECT [e2].[Id], [e2].[Name], [j0].[LeftId] FROM [JoinOneSelfPayload] AS [j0] INNER JOIN [EntityOnes] AS [e2] ON [j0].[RightId] = [e2].[Id] ) AS [s0] ON [s].[Id] = [s0].[LeftId] -ORDER BY [e].[Id], [s].[OneId], [s].[ThreeId], [s].[Id], [s].[Id0] +ORDER BY [e].[Id], [s].[OneId], [s].[ThreeId] """); } @@ -1216,19 +1213,18 @@ public override async Task Include_skip_navigation_and_reference_split(bool asyn SELECT [e].[Id], [e].[CollectionInverseId], [e].[ExtraId], [e].[Name], [e].[ReferenceInverseId], [e0].[Id], [e0].[CollectionInverseId], [e0].[Name], [e0].[ReferenceInverseId] FROM [EntityTwos] AS [e] LEFT JOIN [EntityThrees] AS [e0] ON [e].[Id] = [e0].[ReferenceInverseId] -ORDER BY [e].[Id], [e0].[Id] +ORDER BY [e].[Id] """, // """ -SELECT [s].[Id], [s].[Name], [e].[Id], [e0].[Id] +SELECT [s].[Id], [s].[Name], [e].[Id] FROM [EntityTwos] AS [e] -LEFT JOIN [EntityThrees] AS [e0] ON [e].[Id] = [e0].[ReferenceInverseId] INNER JOIN ( SELECT [e2].[Id], [e2].[Name], [e1].[TwoSkipSharedId] FROM [EntityOneEntityTwo] AS [e1] INNER JOIN [EntityOnes] AS [e2] ON [e1].[OneSkipSharedId] = [e2].[Id] ) AS [s] ON [e].[Id] = [s].[TwoSkipSharedId] -ORDER BY [e].[Id], [e0].[Id] +ORDER BY [e].[Id] """); } @@ -1379,11 +1375,11 @@ INNER JOIN ( FROM [EntityRootEntityThree] AS [e0] INNER JOIN [EntityThrees] AS [e1] ON [e0].[ThreeSkipSharedId] = [e1].[Id] ) AS [s] ON [e].[Id] = [s].[RootSkipSharedId] -ORDER BY [e].[Id], [s].[RootSkipSharedId], [s].[ThreeSkipSharedId], [s].[Id] +ORDER BY [e].[Id], [s].[RootSkipSharedId], [s].[ThreeSkipSharedId] """, // """ -SELECT [s0].[Id], [s0].[Name], [e].[Id], [s].[RootSkipSharedId], [s].[ThreeSkipSharedId], [s].[Id] +SELECT [s0].[Id], [s0].[Name], [e].[Id], [s].[RootSkipSharedId], [s].[ThreeSkipSharedId] FROM [EntityRoots] AS [e] INNER JOIN ( SELECT [e1].[Id], [e0].[RootSkipSharedId], [e0].[ThreeSkipSharedId] @@ -1396,7 +1392,7 @@ FROM [JoinOneToThreePayloadFullShared] AS [j] INNER JOIN [EntityOnes] AS [e2] ON [j].[OneId] = [e2].[Id] WHERE [e2].[Id] < 10 ) AS [s0] ON [s].[Id] = [s0].[ThreeId] -ORDER BY [e].[Id], [s].[RootSkipSharedId], [s].[ThreeSkipSharedId], [s].[Id] +ORDER BY [e].[Id], [s].[RootSkipSharedId], [s].[ThreeSkipSharedId] """); } @@ -1419,11 +1415,11 @@ INNER JOIN ( FROM [EntityCompositeKeyEntityRoot] AS [e0] INNER JOIN [EntityCompositeKeys] AS [e1] ON [e0].[CompositeKeySkipSharedKey1] = [e1].[Key1] AND [e0].[CompositeKeySkipSharedKey2] = [e1].[Key2] AND [e0].[CompositeKeySkipSharedKey3] = [e1].[Key3] ) AS [s] ON [e].[Id] = [s].[RootSkipSharedId] -ORDER BY [e].[Id], [s].[RootSkipSharedId], [s].[CompositeKeySkipSharedKey1], [s].[CompositeKeySkipSharedKey2], [s].[CompositeKeySkipSharedKey3], [s].[Key1], [s].[Key2], [s].[Key3] +ORDER BY [e].[Id], [s].[RootSkipSharedId], [s].[CompositeKeySkipSharedKey1], [s].[CompositeKeySkipSharedKey2], [s].[CompositeKeySkipSharedKey3] """, // """ -SELECT [s1].[Id], [s1].[CollectionInverseId], [s1].[Name], [s1].[ReferenceInverseId], [e].[Id], [s].[RootSkipSharedId], [s].[CompositeKeySkipSharedKey1], [s].[CompositeKeySkipSharedKey2], [s].[CompositeKeySkipSharedKey3], [s].[Key1], [s].[Key2], [s].[Key3] +SELECT [s1].[Id], [s1].[CollectionInverseId], [s1].[Name], [s1].[ReferenceInverseId], [e].[Id], [s].[RootSkipSharedId], [s].[CompositeKeySkipSharedKey1], [s].[CompositeKeySkipSharedKey2], [s].[CompositeKeySkipSharedKey3] FROM [EntityRoots] AS [e] INNER JOIN ( SELECT [e1].[Key1], [e1].[Key2], [e1].[Key3], [e0].[RootSkipSharedId], [e0].[CompositeKeySkipSharedKey1], [e0].[CompositeKeySkipSharedKey2], [e0].[CompositeKeySkipSharedKey3] @@ -1439,7 +1435,7 @@ FROM [JoinThreeToCompositeKeyFull] AS [j] ) AS [s0] WHERE 1 < [s0].[row] AND [s0].[row] <= 3 ) AS [s1] ON [s].[Key1] = [s1].[CompositeId1] AND [s].[Key2] = [s1].[CompositeId2] AND [s].[Key3] = [s1].[CompositeId3] -ORDER BY [e].[Id], [s].[RootSkipSharedId], [s].[CompositeKeySkipSharedKey1], [s].[CompositeKeySkipSharedKey2], [s].[CompositeKeySkipSharedKey3], [s].[Key1], [s].[Key2], [s].[Key3], [s1].[CompositeId1], [s1].[CompositeId2], [s1].[CompositeId3], [s1].[Id] +ORDER BY [e].[Id], [s].[RootSkipSharedId], [s].[CompositeKeySkipSharedKey1], [s].[CompositeKeySkipSharedKey2], [s].[CompositeKeySkipSharedKey3], [s1].[CompositeId1], [s1].[CompositeId2], [s1].[CompositeId3], [s1].[Id] """); } @@ -1465,11 +1461,11 @@ FROM [JoinCompositeKeyToLeaf] AS [j] WHERE [e0].[Key1] < 5 ) AS [s] ON [e].[Id] = [s].[LeafId] WHERE [e].[Discriminator] = N'EntityLeaf' -ORDER BY [e].[Id], [s].[LeafId], [s].[CompositeId1], [s].[CompositeId2], [s].[CompositeId3], [s].[Key1], [s].[Key2], [s].[Key3] +ORDER BY [e].[Id], [s].[LeafId], [s].[CompositeId1], [s].[CompositeId2], [s].[CompositeId3] """, // """ -SELECT [s0].[Id], [s0].[CollectionInverseId], [s0].[ExtraId], [s0].[Name], [s0].[ReferenceInverseId], [e].[Id], [s].[LeafId], [s].[CompositeId1], [s].[CompositeId2], [s].[CompositeId3], [s].[Key1], [s].[Key2], [s].[Key3] +SELECT [s0].[Id], [s0].[CollectionInverseId], [s0].[ExtraId], [s0].[Name], [s0].[ReferenceInverseId], [e].[Id], [s].[LeafId], [s].[CompositeId1], [s].[CompositeId2], [s].[CompositeId3] FROM [EntityRoots] AS [e] INNER JOIN ( SELECT [e0].[Key1], [e0].[Key2], [e0].[Key3], [j].[LeafId], [j].[CompositeId1], [j].[CompositeId2], [j].[CompositeId3] @@ -1483,7 +1479,7 @@ FROM [EntityCompositeKeyEntityTwo] AS [e1] INNER JOIN [EntityTwos] AS [e2] ON [e1].[TwoSkipSharedId] = [e2].[Id] ) AS [s0] ON [s].[Key1] = [s0].[CompositeKeySkipSharedKey1] AND [s].[Key2] = [s0].[CompositeKeySkipSharedKey2] AND [s].[Key3] = [s0].[CompositeKeySkipSharedKey3] WHERE [e].[Discriminator] = N'EntityLeaf' -ORDER BY [e].[Id], [s].[LeafId], [s].[CompositeId1], [s].[CompositeId2], [s].[CompositeId3], [s].[Key1], [s].[Key2], [s].[Key3] +ORDER BY [e].[Id], [s].[LeafId], [s].[CompositeId1], [s].[CompositeId2], [s].[CompositeId3] """); } @@ -1514,7 +1510,7 @@ FROM [JoinOneToTwo] AS [j] """, // """ -SELECT [s1].[Id], [s1].[CollectionInverseId], [s1].[Name], [s1].[ReferenceInverseId], [e].[Id], [s0].[OneId], [s0].[TwoId], [s0].[Id] +SELECT [s1].[Id], [s1].[CollectionInverseId], [s1].[Name], [s1].[ReferenceInverseId], [e].[Id], [s0].[OneId], [s0].[TwoId] FROM [EntityOnes] AS [e] INNER JOIN ( SELECT [s].[Id], [s].[OneId], [s].[TwoId] @@ -1555,11 +1551,11 @@ FROM [JoinOneToTwo] AS [j] INNER JOIN [EntityTwos] AS [e0] ON [j].[TwoId] = [e0].[Id] WHERE [e0].[Id] < 10 ) AS [s] ON [e].[Id] = [s].[OneId] -ORDER BY [e].[Id], [s].[OneId], [s].[TwoId], [s].[Id] +ORDER BY [e].[Id], [s].[OneId], [s].[TwoId] """, // """ -SELECT [s1].[Id], [s1].[CollectionInverseId], [s1].[Name], [s1].[ReferenceInverseId], [e].[Id], [s].[OneId], [s].[TwoId], [s].[Id] +SELECT [s1].[Id], [s1].[CollectionInverseId], [s1].[Name], [s1].[ReferenceInverseId], [e].[Id], [s].[OneId], [s].[TwoId] FROM [EntityOnes] AS [e] INNER JOIN ( SELECT [e0].[Id], [j].[OneId], [j].[TwoId] @@ -1576,7 +1572,7 @@ FROM [JoinTwoToThree] AS [j0] ) AS [s0] WHERE 1 < [s0].[row] AND [s0].[row] <= 3 ) AS [s1] ON [s].[Id] = [s1].[TwoId] -ORDER BY [e].[Id], [s].[OneId], [s].[TwoId], [s].[Id], [s1].[TwoId], [s1].[Id] +ORDER BY [e].[Id], [s].[OneId], [s].[TwoId], [s1].[TwoId], [s1].[Id] """); } @@ -1601,21 +1597,20 @@ FROM [JoinOneToTwo] AS [j] LEFT JOIN [EntityTwos] AS [e1] ON [e0].[Id] = [e1].[ReferenceInverseId] WHERE [e0].[Id] < 10 ) AS [s] ON [e].[Id] = [s].[TwoId] -ORDER BY [e].[Id], [s].[OneId], [s].[TwoId], [s].[Id], [s].[Id0] +ORDER BY [e].[Id], [s].[OneId], [s].[TwoId] """, // """ -SELECT [e2].[Id], [e2].[CollectionInverseId], [e2].[ExtraId], [e2].[Name], [e2].[ReferenceInverseId], [e].[Id], [s].[OneId], [s].[TwoId], [s].[Id], [s].[Id0] +SELECT [e2].[Id], [e2].[CollectionInverseId], [e2].[ExtraId], [e2].[Name], [e2].[ReferenceInverseId], [e].[Id], [s].[OneId], [s].[TwoId] FROM [EntityTwos] AS [e] INNER JOIN ( - SELECT [e0].[Id], [e1].[Id] AS [Id0], [j].[OneId], [j].[TwoId] + SELECT [e0].[Id], [j].[OneId], [j].[TwoId] FROM [JoinOneToTwo] AS [j] INNER JOIN [EntityOnes] AS [e0] ON [j].[OneId] = [e0].[Id] - LEFT JOIN [EntityTwos] AS [e1] ON [e0].[Id] = [e1].[ReferenceInverseId] WHERE [e0].[Id] < 10 ) AS [s] ON [e].[Id] = [s].[TwoId] INNER JOIN [EntityTwos] AS [e2] ON [s].[Id] = [e2].[CollectionInverseId] -ORDER BY [e].[Id], [s].[OneId], [s].[TwoId], [s].[Id], [s].[Id0] +ORDER BY [e].[Id], [s].[OneId], [s].[TwoId] """); } @@ -1639,11 +1634,11 @@ FROM [JoinOneToThreePayloadFull] AS [j] INNER JOIN [EntityOnes] AS [e0] ON [j].[OneId] = [e0].[Id] WHERE [e0].[Id] < 10 ) AS [s] ON [e].[Id] = [s].[ThreeId] -ORDER BY [e].[Id], [s].[OneId], [s].[ThreeId], [s].[Id] +ORDER BY [e].[Id], [s].[OneId], [s].[ThreeId] """, // """ -SELECT [s1].[Id], [s1].[CollectionInverseId], [s1].[ExtraId], [s1].[Name], [s1].[ReferenceInverseId], [e].[Id], [s].[OneId], [s].[ThreeId], [s].[Id] +SELECT [s1].[Id], [s1].[CollectionInverseId], [s1].[ExtraId], [s1].[Name], [s1].[ReferenceInverseId], [e].[Id], [s].[OneId], [s].[ThreeId] FROM [EntityThrees] AS [e] INNER JOIN ( SELECT [e0].[Id], [j].[OneId], [j].[ThreeId] @@ -1660,11 +1655,11 @@ FROM [JoinOneToTwo] AS [j0] ) AS [s0] WHERE 1 < [s0].[row] AND [s0].[row] <= 3 ) AS [s1] ON [s].[Id] = [s1].[OneId] -ORDER BY [e].[Id], [s].[OneId], [s].[ThreeId], [s].[Id], [s1].[OneId], [s1].[Id] +ORDER BY [e].[Id], [s].[OneId], [s].[ThreeId], [s1].[OneId], [s1].[Id] """, // """ -SELECT [s2].[Id], [s2].[Discriminator], [s2].[Name], [s2].[Number], [s2].[IsGreen], [e].[Id], [s].[OneId], [s].[ThreeId], [s].[Id] +SELECT [s2].[Id], [s2].[Discriminator], [s2].[Name], [s2].[Number], [s2].[IsGreen], [e].[Id], [s].[OneId], [s].[ThreeId] FROM [EntityThrees] AS [e] INNER JOIN ( SELECT [e0].[Id], [j].[OneId], [j].[ThreeId] @@ -1682,7 +1677,7 @@ WHERE [e2].[Discriminator] IN (N'EntityBranch', N'EntityLeaf') ) AS [e3] ON [j1].[EntityBranchId] = [e3].[Id] WHERE [e3].[Id] < 20 ) AS [s2] ON [s].[Id] = [s2].[EntityOneId] -ORDER BY [e].[Id], [s].[OneId], [s].[ThreeId], [s].[Id] +ORDER BY [e].[Id], [s].[OneId], [s].[ThreeId] """); } @@ -1706,11 +1701,11 @@ FROM [JoinOneToThreePayloadFull] AS [j] INNER JOIN [EntityOnes] AS [e0] ON [j].[OneId] = [e0].[Id] WHERE [e0].[Id] > 15 ) AS [s] ON [e].[Id] = [s].[ThreeId] -ORDER BY [e].[Id], [s].[OneId], [s].[ThreeId], [s].[Id] +ORDER BY [e].[Id], [s].[OneId], [s].[ThreeId] """, // """ -SELECT [e2].[Id], [e2].[CollectionInverseId], [e2].[ExtraId], [e2].[Name], [e2].[ReferenceInverseId], [e].[Id], [s].[OneId], [s].[ThreeId], [s].[Id] +SELECT [e2].[Id], [e2].[CollectionInverseId], [e2].[ExtraId], [e2].[Name], [e2].[ReferenceInverseId], [e].[Id], [s].[OneId], [s].[ThreeId] FROM [EntityThrees] AS [e] INNER JOIN ( SELECT [e0].[Id], [j].[OneId], [j].[ThreeId] @@ -1723,7 +1718,7 @@ INNER JOIN ( FROM [EntityTwos] AS [e1] WHERE [e1].[Id] < 5 ) AS [e2] ON [s].[Id] = [e2].[CollectionInverseId] -ORDER BY [e].[Id], [s].[OneId], [s].[ThreeId], [s].[Id] +ORDER BY [e].[Id], [s].[OneId], [s].[ThreeId] """); } diff --git a/test/EFCore.SqlServer.FunctionalTests/Query/ManyToManyQuerySqlServerTest.cs b/test/EFCore.SqlServer.FunctionalTests/Query/ManyToManyQuerySqlServerTest.cs index 2542abbca90..a722514a591 100644 --- a/test/EFCore.SqlServer.FunctionalTests/Query/ManyToManyQuerySqlServerTest.cs +++ b/test/EFCore.SqlServer.FunctionalTests/Query/ManyToManyQuerySqlServerTest.cs @@ -89,7 +89,6 @@ FROM [EntityOnes] AS [e] WHERE EXISTS ( SELECT 1 FROM [JoinOneSelfPayload] AS [j] - INNER JOIN [EntityOnes] AS [e0] ON [j].[LeftId] = [e0].[Id] WHERE [e].[Id] = [j].[RightId]) """); } @@ -125,7 +124,6 @@ FROM [EntityTwos] AS [e] WHERE ( SELECT COUNT_BIG(*) FROM [JoinTwoToThree] AS [j] - INNER JOIN [EntityThrees] AS [e0] ON [j].[ThreeId] = [e0].[Id] WHERE [e].[Id] = [j].[TwoId]) > CAST(0 AS bigint) """); } @@ -369,7 +367,7 @@ FROM [EntityRoots] AS [e0] WHERE [e0].[Discriminator] = N'EntityLeaf' ) AS [e1] ON [j].[LeafId] = [e1].[Id] ) AS [s] ON [e].[Key1] = [s].[CompositeId1] AND [e].[Key2] = [s].[CompositeId2] AND [e].[Key3] = [s].[CompositeId3] -ORDER BY [e].[Key1], [e].[Key2], [e].[Key3], [s].[LeafId], [s].[CompositeId1], [s].[CompositeId2], [s].[CompositeId3] +ORDER BY [e].[Key1], [e].[Key2], [e].[Key3], [s].[LeafId], [s].[CompositeId1], [s].[CompositeId2] """); } @@ -387,7 +385,7 @@ FROM [EntityCompositeKeyEntityRoot] AS [e0] INNER JOIN [EntityRoots] AS [e1] ON [e0].[RootSkipSharedId] = [e1].[Id] WHERE [e1].[Discriminator] = N'EntityLeaf' ) AS [s] ON [e].[Key1] = [s].[CompositeKeySkipSharedKey1] AND [e].[Key2] = [s].[CompositeKeySkipSharedKey2] AND [e].[Key3] = [s].[CompositeKeySkipSharedKey3] -ORDER BY [e].[Key1], [e].[Key2], [e].[Key3], [s].[RootSkipSharedId], [s].[CompositeKeySkipSharedKey1], [s].[CompositeKeySkipSharedKey2], [s].[CompositeKeySkipSharedKey3] +ORDER BY [e].[Key1], [e].[Key2], [e].[Key3], [s].[RootSkipSharedId], [s].[CompositeKeySkipSharedKey1], [s].[CompositeKeySkipSharedKey2] """); } @@ -573,7 +571,7 @@ LEFT JOIN ( FROM [JoinOneSelfPayload] AS [j] INNER JOIN [EntityOnes] AS [e0] ON [j].[LeftId] = [e0].[Id] ) AS [s] ON [e].[Id] = [s].[RightId] -ORDER BY [e].[Id], [s].[LeftId], [s].[RightId] +ORDER BY [e].[Id], [s].[LeftId] """); } @@ -600,7 +598,7 @@ LEFT JOIN ( FROM [EntityCompositeKeyEntityTwo] AS [e3] INNER JOIN [EntityCompositeKeys] AS [e4] ON [e3].[CompositeKeySkipSharedKey1] = [e4].[Key1] AND [e3].[CompositeKeySkipSharedKey2] = [e4].[Key2] AND [e3].[CompositeKeySkipSharedKey3] = [e4].[Key3] ) AS [s1] ON [e].[Id] = [s1].[TwoSkipSharedId] -ORDER BY [e].[Id], [s].[ThreeId], [s].[TwoId], [s].[Id], [s0].[SelfSkipSharedLeftId], [s0].[SelfSkipSharedRightId], [s0].[Id], [s1].[TwoSkipSharedId], [s1].[CompositeKeySkipSharedKey1], [s1].[CompositeKeySkipSharedKey2], [s1].[CompositeKeySkipSharedKey3], [s1].[Key1], [s1].[Key2] +ORDER BY [e].[Id], [s].[ThreeId], [s].[TwoId], [s0].[SelfSkipSharedLeftId], [s0].[SelfSkipSharedRightId], [s1].[TwoSkipSharedId], [s1].[CompositeKeySkipSharedKey1], [s1].[CompositeKeySkipSharedKey2] """); } @@ -638,7 +636,7 @@ LEFT JOIN ( FROM [EntityCompositeKeyEntityRoot] AS [e0] INNER JOIN [EntityRoots] AS [e1] ON [e0].[RootSkipSharedId] = [e1].[Id] ) AS [s] ON [e].[Key1] = [s].[CompositeKeySkipSharedKey1] AND [e].[Key2] = [s].[CompositeKeySkipSharedKey2] AND [e].[Key3] = [s].[CompositeKeySkipSharedKey3] -ORDER BY [e].[Key1], [e].[Key2], [e].[Key3], [s].[RootSkipSharedId], [s].[CompositeKeySkipSharedKey1], [s].[CompositeKeySkipSharedKey2], [s].[CompositeKeySkipSharedKey3] +ORDER BY [e].[Key1], [e].[Key2], [e].[Key3], [s].[RootSkipSharedId], [s].[CompositeKeySkipSharedKey1], [s].[CompositeKeySkipSharedKey2] """); } @@ -656,7 +654,7 @@ FROM [JoinOneToTwo] AS [j] INNER JOIN [EntityOnes] AS [e0] ON [j].[OneId] = [e0].[Id] LEFT JOIN [EntityTwos] AS [e1] ON [e0].[Id] = [e1].[ReferenceInverseId] ) AS [s] ON [e].[Id] = [s].[TwoId] -ORDER BY [e].[Id], [s].[OneId], [s].[TwoId], [s].[Id] +ORDER BY [e].[Id], [s].[OneId] """); } @@ -682,7 +680,7 @@ FROM [JoinOneToBranch] AS [j0] INNER JOIN [EntityOnes] AS [e2] ON [j0].[EntityOneId] = [e2].[Id] ) AS [s] ON [e1].[Id] = [s].[EntityBranchId] ) AS [s0] ON [e].[Key1] = [s0].[CompositeId1] AND [e].[Key2] = [s0].[CompositeId2] AND [e].[Key3] = [s0].[CompositeId3] -ORDER BY [e].[Key1], [e].[Key2], [e].[Key3], [s0].[LeafId], [s0].[CompositeId1], [s0].[CompositeId2], [s0].[CompositeId3], [s0].[Id], [s0].[EntityBranchId], [s0].[EntityOneId] +ORDER BY [e].[Key1], [e].[Key2], [e].[Key3], [s0].[LeafId], [s0].[CompositeId1], [s0].[CompositeId2], [s0].[CompositeId3], [s0].[EntityBranchId] """); } @@ -705,7 +703,7 @@ FROM [JoinOneSelfPayload] AS [j0] INNER JOIN [EntityOnes] AS [e2] ON [j0].[RightId] = [e2].[Id] ) AS [s] ON [e0].[Id] = [s].[LeftId] ) AS [s0] ON [e].[Id] = [s0].[ThreeId] -ORDER BY [e].[Id], [s0].[OneId], [s0].[ThreeId], [s0].[Id], [s0].[Id0], [s0].[LeftId], [s0].[RightId] +ORDER BY [e].[Id], [s0].[OneId], [s0].[ThreeId], [s0].[LeftId] """); } @@ -715,7 +713,7 @@ public override async Task Include_skip_navigation_and_reference(bool async) AssertSql( """ -SELECT [e].[Id], [e].[CollectionInverseId], [e].[ExtraId], [e].[Name], [e].[ReferenceInverseId], [e0].[Id], [s].[OneSkipSharedId], [s].[TwoSkipSharedId], [s].[Id], [s].[Name], [e0].[CollectionInverseId], [e0].[Name], [e0].[ReferenceInverseId] +SELECT [e].[Id], [e].[CollectionInverseId], [e].[ExtraId], [e].[Name], [e].[ReferenceInverseId], [s].[OneSkipSharedId], [s].[TwoSkipSharedId], [s].[Id], [s].[Name], [e0].[Id], [e0].[CollectionInverseId], [e0].[Name], [e0].[ReferenceInverseId] FROM [EntityTwos] AS [e] LEFT JOIN [EntityThrees] AS [e0] ON [e].[Id] = [e0].[ReferenceInverseId] LEFT JOIN ( @@ -723,7 +721,7 @@ LEFT JOIN ( FROM [EntityOneEntityTwo] AS [e1] INNER JOIN [EntityOnes] AS [e2] ON [e1].[OneSkipSharedId] = [e2].[Id] ) AS [s] ON [e].[Id] = [s].[TwoSkipSharedId] -ORDER BY [e].[Id], [e0].[Id], [s].[OneSkipSharedId], [s].[TwoSkipSharedId] +ORDER BY [e].[Id], [s].[OneSkipSharedId] """); } @@ -741,7 +739,7 @@ FROM [JoinOneToThreePayloadFullShared] AS [j] INNER JOIN [EntityOnes] AS [e0] ON [j].[OneId] = [e0].[Id] WHERE [e0].[Id] < 10 ) AS [s] ON [e].[Id] = [s].[ThreeId] -ORDER BY [e].[Id], [s].[OneId], [s].[ThreeId] +ORDER BY [e].[Id], [s].[OneId] """); } @@ -844,7 +842,7 @@ FROM [JoinOneToThreePayloadFullShared] AS [j] WHERE [e2].[Id] < 10 ) AS [s] ON [e1].[Id] = [s].[ThreeId] ) AS [s0] ON [e].[Id] = [s0].[RootSkipSharedId] -ORDER BY [e].[Id], [s0].[RootSkipSharedId], [s0].[ThreeSkipSharedId], [s0].[Id], [s0].[OneId], [s0].[ThreeId] +ORDER BY [e].[Id], [s0].[RootSkipSharedId], [s0].[ThreeSkipSharedId], [s0].[OneId] """); } @@ -870,7 +868,7 @@ FROM [JoinThreeToCompositeKeyFull] AS [j] WHERE 1 < [s].[row] AND [s].[row] <= 3 ) AS [s0] ON [e1].[Key1] = [s0].[CompositeId1] AND [e1].[Key2] = [s0].[CompositeId2] AND [e1].[Key3] = [s0].[CompositeId3] ) AS [s1] ON [e].[Id] = [s1].[RootSkipSharedId] -ORDER BY [e].[Id], [s1].[RootSkipSharedId], [s1].[CompositeKeySkipSharedKey1], [s1].[CompositeKeySkipSharedKey2], [s1].[CompositeKeySkipSharedKey3], [s1].[Key1], [s1].[Key2], [s1].[Key3], [s1].[CompositeId1], [s1].[CompositeId2], [s1].[CompositeId3], [s1].[Id0] +ORDER BY [e].[Id], [s1].[RootSkipSharedId], [s1].[CompositeKeySkipSharedKey1], [s1].[CompositeKeySkipSharedKey2], [s1].[CompositeKeySkipSharedKey3], [s1].[CompositeId1], [s1].[CompositeId2], [s1].[CompositeId3], [s1].[Id0] """); } @@ -894,7 +892,7 @@ FROM [EntityCompositeKeyEntityTwo] AS [e1] WHERE [e0].[Key1] < 5 ) AS [s0] ON [e].[Id] = [s0].[LeafId] WHERE [e].[Discriminator] = N'EntityLeaf' -ORDER BY [e].[Id], [s0].[LeafId], [s0].[CompositeId1], [s0].[CompositeId2], [s0].[CompositeId3], [s0].[Key1], [s0].[Key2], [s0].[Key3], [s0].[TwoSkipSharedId], [s0].[CompositeKeySkipSharedKey1], [s0].[CompositeKeySkipSharedKey2], [s0].[CompositeKeySkipSharedKey3] +ORDER BY [e].[Id], [s0].[LeafId], [s0].[CompositeId1], [s0].[CompositeId2], [s0].[CompositeId3], [s0].[TwoSkipSharedId], [s0].[CompositeKeySkipSharedKey1], [s0].[CompositeKeySkipSharedKey2] """); } @@ -923,7 +921,7 @@ FROM [JoinTwoToThree] AS [j0] WHERE [e1].[Id] < 10 ) AS [s0] ON [s].[Id] = [s0].[TwoId] ) AS [s1] -ORDER BY [e].[Id], [s1].[Id], [s1].[OneId], [s1].[TwoId], [s1].[ThreeId], [s1].[TwoId0] +ORDER BY [e].[Id], [s1].[Id], [s1].[OneId], [s1].[TwoId], [s1].[ThreeId] """); } @@ -950,7 +948,7 @@ FROM [JoinTwoToThree] AS [j0] ) AS [s0] ON [e0].[Id] = [s0].[TwoId] WHERE [e0].[Id] < 10 ) AS [s1] ON [e].[Id] = [s1].[OneId] -ORDER BY [e].[Id], [s1].[OneId], [s1].[TwoId], [s1].[Id], [s1].[TwoId0], [s1].[Id0] +ORDER BY [e].[Id], [s1].[OneId], [s1].[TwoId], [s1].[TwoId0], [s1].[Id0] """); } @@ -970,7 +968,7 @@ FROM [JoinOneToTwo] AS [j] LEFT JOIN [EntityTwos] AS [e2] ON [e0].[Id] = [e2].[CollectionInverseId] WHERE [e0].[Id] < 10 ) AS [s] ON [e].[Id] = [s].[TwoId] -ORDER BY [e].[Id], [s].[OneId], [s].[TwoId], [s].[Id], [s].[Id0] +ORDER BY [e].[Id], [s].[OneId], [s].[TwoId] """); } @@ -1007,7 +1005,7 @@ WHERE [e3].[Id] < 20 ) AS [s1] ON [e0].[Id] = [s1].[EntityOneId] WHERE [e0].[Id] < 10 ) AS [s2] ON [e].[Id] = [s2].[ThreeId] -ORDER BY [e].[Id], [s2].[OneId], [s2].[ThreeId], [s2].[Id], [s2].[OneId0], [s2].[Id0], [s2].[TwoId], [s2].[EntityBranchId], [s2].[EntityOneId] +ORDER BY [e].[Id], [s2].[OneId], [s2].[ThreeId], [s2].[OneId0], [s2].[Id0], [s2].[TwoId], [s2].[EntityBranchId] """); } @@ -1030,7 +1028,7 @@ WHERE [e1].[Id] < 5 ) AS [e2] ON [e0].[Id] = [e2].[CollectionInverseId] WHERE [e0].[Id] > 15 ) AS [s] ON [e].[Id] = [s].[ThreeId] -ORDER BY [e].[Id], [s].[OneId], [s].[ThreeId], [s].[Id] +ORDER BY [e].[Id], [s].[OneId], [s].[ThreeId] """); } @@ -1053,7 +1051,7 @@ WHERE [e1].[Id] < 5 ) AS [s] ON [e0].[Id] = [s].[TwoId] WHERE [e0].[Id] > 15 ) AS [s0] ON [e].[Id] = [s0].[CollectionInverseId] -ORDER BY [e].[Id], [s0].[Id], [s0].[ThreeId], [s0].[TwoId] +ORDER BY [e].[Id], [s0].[Id], [s0].[ThreeId] """); } @@ -1141,11 +1139,11 @@ FROM [EntityRoots] AS [e0] WHERE [e0].[Discriminator] = N'EntityLeaf' ) AS [e1] ON [j].[LeafId] = [e1].[Id] ) AS [s] ON [e].[Key1] = [s].[CompositeId1] AND [e].[Key2] = [s].[CompositeId2] AND [e].[Key3] = [s].[CompositeId3] -ORDER BY [e].[Key1], [e].[Key2], [e].[Key3], [s].[LeafId], [s].[CompositeId1], [s].[CompositeId2], [s].[CompositeId3], [s].[Id] +ORDER BY [e].[Key1], [e].[Key2], [e].[Key3], [s].[LeafId], [s].[CompositeId1], [s].[CompositeId2], [s].[CompositeId3] """, // """ -SELECT [s0].[EntityBranchId], [s0].[EntityOneId], [s0].[Id], [s0].[Name], [e].[Key1], [e].[Key2], [e].[Key3], [s].[LeafId], [s].[CompositeId1], [s].[CompositeId2], [s].[CompositeId3], [s].[Id] +SELECT [s0].[EntityBranchId], [s0].[EntityOneId], [s0].[Id], [s0].[Name], [e].[Key1], [e].[Key2], [e].[Key3], [s].[LeafId], [s].[CompositeId1], [s].[CompositeId2], [s].[CompositeId3] FROM [EntityCompositeKeys] AS [e] INNER JOIN ( SELECT [j].[LeafId], [j].[CompositeId1], [j].[CompositeId2], [j].[CompositeId3], [e1].[Id] @@ -1161,7 +1159,7 @@ INNER JOIN ( FROM [JoinOneToBranch] AS [j0] INNER JOIN [EntityOnes] AS [e2] ON [j0].[EntityOneId] = [e2].[Id] ) AS [s0] ON [s].[Id] = [s0].[EntityBranchId] -ORDER BY [e].[Key1], [e].[Key2], [e].[Key3], [s].[LeafId], [s].[CompositeId1], [s].[CompositeId2], [s].[CompositeId3], [s].[Id] +ORDER BY [e].[Key1], [e].[Key2], [e].[Key3], [s].[LeafId], [s].[CompositeId1], [s].[CompositeId2], [s].[CompositeId3] """); } @@ -1185,24 +1183,23 @@ FROM [JoinOneToThreePayloadFull] AS [j] INNER JOIN [EntityOnes] AS [e0] ON [j].[OneId] = [e0].[Id] LEFT JOIN [EntityTwos] AS [e1] ON [e0].[Id] = [e1].[ReferenceInverseId] ) AS [s] ON [e].[Id] = [s].[ThreeId] -ORDER BY [e].[Id], [s].[OneId], [s].[ThreeId], [s].[Id], [s].[Id0] +ORDER BY [e].[Id], [s].[OneId], [s].[ThreeId] """, // """ -SELECT [s0].[LeftId], [s0].[RightId], [s0].[Payload], [s0].[Id], [s0].[Name], [e].[Id], [s].[OneId], [s].[ThreeId], [s].[Id], [s].[Id0] +SELECT [s0].[LeftId], [s0].[RightId], [s0].[Payload], [s0].[Id], [s0].[Name], [e].[Id], [s].[OneId], [s].[ThreeId] FROM [EntityThrees] AS [e] INNER JOIN ( - SELECT [j].[OneId], [j].[ThreeId], [e0].[Id], [e1].[Id] AS [Id0] + SELECT [j].[OneId], [j].[ThreeId], [e0].[Id] FROM [JoinOneToThreePayloadFull] AS [j] INNER JOIN [EntityOnes] AS [e0] ON [j].[OneId] = [e0].[Id] - LEFT JOIN [EntityTwos] AS [e1] ON [e0].[Id] = [e1].[ReferenceInverseId] ) AS [s] ON [e].[Id] = [s].[ThreeId] INNER JOIN ( SELECT [j0].[LeftId], [j0].[RightId], [j0].[Payload], [e2].[Id], [e2].[Name] FROM [JoinOneSelfPayload] AS [j0] INNER JOIN [EntityOnes] AS [e2] ON [j0].[RightId] = [e2].[Id] ) AS [s0] ON [s].[Id] = [s0].[LeftId] -ORDER BY [e].[Id], [s].[OneId], [s].[ThreeId], [s].[Id], [s].[Id0] +ORDER BY [e].[Id], [s].[OneId], [s].[ThreeId] """); } @@ -1215,19 +1212,18 @@ public override async Task Include_skip_navigation_and_reference_split(bool asyn SELECT [e].[Id], [e].[CollectionInverseId], [e].[ExtraId], [e].[Name], [e].[ReferenceInverseId], [e0].[Id], [e0].[CollectionInverseId], [e0].[Name], [e0].[ReferenceInverseId] FROM [EntityTwos] AS [e] LEFT JOIN [EntityThrees] AS [e0] ON [e].[Id] = [e0].[ReferenceInverseId] -ORDER BY [e].[Id], [e0].[Id] +ORDER BY [e].[Id] """, // """ -SELECT [s].[OneSkipSharedId], [s].[TwoSkipSharedId], [s].[Id], [s].[Name], [e].[Id], [e0].[Id] +SELECT [s].[OneSkipSharedId], [s].[TwoSkipSharedId], [s].[Id], [s].[Name], [e].[Id] FROM [EntityTwos] AS [e] -LEFT JOIN [EntityThrees] AS [e0] ON [e].[Id] = [e0].[ReferenceInverseId] INNER JOIN ( SELECT [e1].[OneSkipSharedId], [e1].[TwoSkipSharedId], [e2].[Id], [e2].[Name] FROM [EntityOneEntityTwo] AS [e1] INNER JOIN [EntityOnes] AS [e2] ON [e1].[OneSkipSharedId] = [e2].[Id] ) AS [s] ON [e].[Id] = [s].[TwoSkipSharedId] -ORDER BY [e].[Id], [e0].[Id] +ORDER BY [e].[Id] """); } @@ -1378,11 +1374,11 @@ INNER JOIN ( FROM [EntityRootEntityThree] AS [e0] INNER JOIN [EntityThrees] AS [e1] ON [e0].[ThreeSkipSharedId] = [e1].[Id] ) AS [s] ON [e].[Id] = [s].[RootSkipSharedId] -ORDER BY [e].[Id], [s].[RootSkipSharedId], [s].[ThreeSkipSharedId], [s].[Id] +ORDER BY [e].[Id], [s].[RootSkipSharedId], [s].[ThreeSkipSharedId] """, // """ -SELECT [s0].[OneId], [s0].[ThreeId], [s0].[Payload], [s0].[Id], [s0].[Name], [e].[Id], [s].[RootSkipSharedId], [s].[ThreeSkipSharedId], [s].[Id] +SELECT [s0].[OneId], [s0].[ThreeId], [s0].[Payload], [s0].[Id], [s0].[Name], [e].[Id], [s].[RootSkipSharedId], [s].[ThreeSkipSharedId] FROM [EntityRoots] AS [e] INNER JOIN ( SELECT [e0].[RootSkipSharedId], [e0].[ThreeSkipSharedId], [e1].[Id] @@ -1395,7 +1391,7 @@ FROM [JoinOneToThreePayloadFullShared] AS [j] INNER JOIN [EntityOnes] AS [e2] ON [j].[OneId] = [e2].[Id] WHERE [e2].[Id] < 10 ) AS [s0] ON [s].[Id] = [s0].[ThreeId] -ORDER BY [e].[Id], [s].[RootSkipSharedId], [s].[ThreeSkipSharedId], [s].[Id] +ORDER BY [e].[Id], [s].[RootSkipSharedId], [s].[ThreeSkipSharedId] """); } @@ -1418,11 +1414,11 @@ INNER JOIN ( FROM [EntityCompositeKeyEntityRoot] AS [e0] INNER JOIN [EntityCompositeKeys] AS [e1] ON [e0].[CompositeKeySkipSharedKey1] = [e1].[Key1] AND [e0].[CompositeKeySkipSharedKey2] = [e1].[Key2] AND [e0].[CompositeKeySkipSharedKey3] = [e1].[Key3] ) AS [s] ON [e].[Id] = [s].[RootSkipSharedId] -ORDER BY [e].[Id], [s].[RootSkipSharedId], [s].[CompositeKeySkipSharedKey1], [s].[CompositeKeySkipSharedKey2], [s].[CompositeKeySkipSharedKey3], [s].[Key1], [s].[Key2], [s].[Key3] +ORDER BY [e].[Id], [s].[RootSkipSharedId], [s].[CompositeKeySkipSharedKey1], [s].[CompositeKeySkipSharedKey2], [s].[CompositeKeySkipSharedKey3] """, // """ -SELECT [s1].[Id], [s1].[CompositeId1], [s1].[CompositeId2], [s1].[CompositeId3], [s1].[ThreeId], [s1].[Id0], [s1].[CollectionInverseId], [s1].[Name], [s1].[ReferenceInverseId], [e].[Id], [s].[RootSkipSharedId], [s].[CompositeKeySkipSharedKey1], [s].[CompositeKeySkipSharedKey2], [s].[CompositeKeySkipSharedKey3], [s].[Key1], [s].[Key2], [s].[Key3] +SELECT [s1].[Id], [s1].[CompositeId1], [s1].[CompositeId2], [s1].[CompositeId3], [s1].[ThreeId], [s1].[Id0], [s1].[CollectionInverseId], [s1].[Name], [s1].[ReferenceInverseId], [e].[Id], [s].[RootSkipSharedId], [s].[CompositeKeySkipSharedKey1], [s].[CompositeKeySkipSharedKey2], [s].[CompositeKeySkipSharedKey3] FROM [EntityRoots] AS [e] INNER JOIN ( SELECT [e0].[RootSkipSharedId], [e0].[CompositeKeySkipSharedKey1], [e0].[CompositeKeySkipSharedKey2], [e0].[CompositeKeySkipSharedKey3], [e1].[Key1], [e1].[Key2], [e1].[Key3] @@ -1438,7 +1434,7 @@ FROM [JoinThreeToCompositeKeyFull] AS [j] ) AS [s0] WHERE 1 < [s0].[row] AND [s0].[row] <= 3 ) AS [s1] ON [s].[Key1] = [s1].[CompositeId1] AND [s].[Key2] = [s1].[CompositeId2] AND [s].[Key3] = [s1].[CompositeId3] -ORDER BY [e].[Id], [s].[RootSkipSharedId], [s].[CompositeKeySkipSharedKey1], [s].[CompositeKeySkipSharedKey2], [s].[CompositeKeySkipSharedKey3], [s].[Key1], [s].[Key2], [s].[Key3], [s1].[CompositeId1], [s1].[CompositeId2], [s1].[CompositeId3], [s1].[Id0] +ORDER BY [e].[Id], [s].[RootSkipSharedId], [s].[CompositeKeySkipSharedKey1], [s].[CompositeKeySkipSharedKey2], [s].[CompositeKeySkipSharedKey3], [s1].[CompositeId1], [s1].[CompositeId2], [s1].[CompositeId3], [s1].[Id0] """); } @@ -1464,11 +1460,11 @@ FROM [JoinCompositeKeyToLeaf] AS [j] WHERE [e0].[Key1] < 5 ) AS [s] ON [e].[Id] = [s].[LeafId] WHERE [e].[Discriminator] = N'EntityLeaf' -ORDER BY [e].[Id], [s].[LeafId], [s].[CompositeId1], [s].[CompositeId2], [s].[CompositeId3], [s].[Key1], [s].[Key2], [s].[Key3] +ORDER BY [e].[Id], [s].[LeafId], [s].[CompositeId1], [s].[CompositeId2], [s].[CompositeId3] """, // """ -SELECT [s0].[TwoSkipSharedId], [s0].[CompositeKeySkipSharedKey1], [s0].[CompositeKeySkipSharedKey2], [s0].[CompositeKeySkipSharedKey3], [s0].[Id], [s0].[CollectionInverseId], [s0].[ExtraId], [s0].[Name], [s0].[ReferenceInverseId], [e].[Id], [s].[LeafId], [s].[CompositeId1], [s].[CompositeId2], [s].[CompositeId3], [s].[Key1], [s].[Key2], [s].[Key3] +SELECT [s0].[TwoSkipSharedId], [s0].[CompositeKeySkipSharedKey1], [s0].[CompositeKeySkipSharedKey2], [s0].[CompositeKeySkipSharedKey3], [s0].[Id], [s0].[CollectionInverseId], [s0].[ExtraId], [s0].[Name], [s0].[ReferenceInverseId], [e].[Id], [s].[LeafId], [s].[CompositeId1], [s].[CompositeId2], [s].[CompositeId3] FROM [EntityRoots] AS [e] INNER JOIN ( SELECT [j].[LeafId], [j].[CompositeId1], [j].[CompositeId2], [j].[CompositeId3], [e0].[Key1], [e0].[Key2], [e0].[Key3] @@ -1482,7 +1478,7 @@ FROM [EntityCompositeKeyEntityTwo] AS [e1] INNER JOIN [EntityTwos] AS [e2] ON [e1].[TwoSkipSharedId] = [e2].[Id] ) AS [s0] ON [s].[Key1] = [s0].[CompositeKeySkipSharedKey1] AND [s].[Key2] = [s0].[CompositeKeySkipSharedKey2] AND [s].[Key3] = [s0].[CompositeKeySkipSharedKey3] WHERE [e].[Discriminator] = N'EntityLeaf' -ORDER BY [e].[Id], [s].[LeafId], [s].[CompositeId1], [s].[CompositeId2], [s].[CompositeId3], [s].[Key1], [s].[Key2], [s].[Key3] +ORDER BY [e].[Id], [s].[LeafId], [s].[CompositeId1], [s].[CompositeId2], [s].[CompositeId3] """); } @@ -1513,7 +1509,7 @@ FROM [JoinOneToTwo] AS [j] """, // """ -SELECT [s1].[ThreeId], [s1].[TwoId], [s1].[Id], [s1].[CollectionInverseId], [s1].[Name], [s1].[ReferenceInverseId], [e].[Id], [s0].[OneId], [s0].[TwoId], [s0].[Id] +SELECT [s1].[ThreeId], [s1].[TwoId], [s1].[Id], [s1].[CollectionInverseId], [s1].[Name], [s1].[ReferenceInverseId], [e].[Id], [s0].[OneId], [s0].[TwoId] FROM [EntityOnes] AS [e] INNER JOIN ( SELECT [s].[OneId], [s].[TwoId], [s].[Id] @@ -1554,11 +1550,11 @@ FROM [JoinOneToTwo] AS [j] INNER JOIN [EntityTwos] AS [e0] ON [j].[TwoId] = [e0].[Id] WHERE [e0].[Id] < 10 ) AS [s] ON [e].[Id] = [s].[OneId] -ORDER BY [e].[Id], [s].[OneId], [s].[TwoId], [s].[Id] +ORDER BY [e].[Id], [s].[OneId], [s].[TwoId] """, // """ -SELECT [s1].[ThreeId], [s1].[TwoId], [s1].[Id], [s1].[CollectionInverseId], [s1].[Name], [s1].[ReferenceInverseId], [e].[Id], [s].[OneId], [s].[TwoId], [s].[Id] +SELECT [s1].[ThreeId], [s1].[TwoId], [s1].[Id], [s1].[CollectionInverseId], [s1].[Name], [s1].[ReferenceInverseId], [e].[Id], [s].[OneId], [s].[TwoId] FROM [EntityOnes] AS [e] INNER JOIN ( SELECT [j].[OneId], [j].[TwoId], [e0].[Id] @@ -1575,7 +1571,7 @@ FROM [JoinTwoToThree] AS [j0] ) AS [s0] WHERE 1 < [s0].[row] AND [s0].[row] <= 3 ) AS [s1] ON [s].[Id] = [s1].[TwoId] -ORDER BY [e].[Id], [s].[OneId], [s].[TwoId], [s].[Id], [s1].[TwoId], [s1].[Id] +ORDER BY [e].[Id], [s].[OneId], [s].[TwoId], [s1].[TwoId], [s1].[Id] """); } @@ -1600,21 +1596,20 @@ FROM [JoinOneToTwo] AS [j] LEFT JOIN [EntityTwos] AS [e1] ON [e0].[Id] = [e1].[ReferenceInverseId] WHERE [e0].[Id] < 10 ) AS [s] ON [e].[Id] = [s].[TwoId] -ORDER BY [e].[Id], [s].[OneId], [s].[TwoId], [s].[Id], [s].[Id0] +ORDER BY [e].[Id], [s].[OneId], [s].[TwoId] """, // """ -SELECT [e2].[Id], [e2].[CollectionInverseId], [e2].[ExtraId], [e2].[Name], [e2].[ReferenceInverseId], [e].[Id], [s].[OneId], [s].[TwoId], [s].[Id], [s].[Id0] +SELECT [e2].[Id], [e2].[CollectionInverseId], [e2].[ExtraId], [e2].[Name], [e2].[ReferenceInverseId], [e].[Id], [s].[OneId], [s].[TwoId] FROM [EntityTwos] AS [e] INNER JOIN ( - SELECT [j].[OneId], [j].[TwoId], [e0].[Id], [e1].[Id] AS [Id0] + SELECT [j].[OneId], [j].[TwoId], [e0].[Id] FROM [JoinOneToTwo] AS [j] INNER JOIN [EntityOnes] AS [e0] ON [j].[OneId] = [e0].[Id] - LEFT JOIN [EntityTwos] AS [e1] ON [e0].[Id] = [e1].[ReferenceInverseId] WHERE [e0].[Id] < 10 ) AS [s] ON [e].[Id] = [s].[TwoId] INNER JOIN [EntityTwos] AS [e2] ON [s].[Id] = [e2].[CollectionInverseId] -ORDER BY [e].[Id], [s].[OneId], [s].[TwoId], [s].[Id], [s].[Id0] +ORDER BY [e].[Id], [s].[OneId], [s].[TwoId] """); } @@ -1638,11 +1633,11 @@ FROM [JoinOneToThreePayloadFull] AS [j] INNER JOIN [EntityOnes] AS [e0] ON [j].[OneId] = [e0].[Id] WHERE [e0].[Id] < 10 ) AS [s] ON [e].[Id] = [s].[ThreeId] -ORDER BY [e].[Id], [s].[OneId], [s].[ThreeId], [s].[Id] +ORDER BY [e].[Id], [s].[OneId], [s].[ThreeId] """, // """ -SELECT [s1].[OneId], [s1].[TwoId], [s1].[JoinOneToTwoExtraId], [s1].[Id], [s1].[CollectionInverseId], [s1].[ExtraId], [s1].[Name], [s1].[ReferenceInverseId], [e].[Id], [s].[OneId], [s].[ThreeId], [s].[Id] +SELECT [s1].[OneId], [s1].[TwoId], [s1].[JoinOneToTwoExtraId], [s1].[Id], [s1].[CollectionInverseId], [s1].[ExtraId], [s1].[Name], [s1].[ReferenceInverseId], [e].[Id], [s].[OneId], [s].[ThreeId] FROM [EntityThrees] AS [e] INNER JOIN ( SELECT [j].[OneId], [j].[ThreeId], [e0].[Id] @@ -1659,11 +1654,11 @@ FROM [JoinOneToTwo] AS [j0] ) AS [s0] WHERE 1 < [s0].[row] AND [s0].[row] <= 3 ) AS [s1] ON [s].[Id] = [s1].[OneId] -ORDER BY [e].[Id], [s].[OneId], [s].[ThreeId], [s].[Id], [s1].[OneId], [s1].[Id] +ORDER BY [e].[Id], [s].[OneId], [s].[ThreeId], [s1].[OneId], [s1].[Id] """, // """ -SELECT [s2].[EntityBranchId], [s2].[EntityOneId], [s2].[Id], [s2].[Discriminator], [s2].[Name], [s2].[Number], [s2].[IsGreen], [e].[Id], [s].[OneId], [s].[ThreeId], [s].[Id] +SELECT [s2].[EntityBranchId], [s2].[EntityOneId], [s2].[Id], [s2].[Discriminator], [s2].[Name], [s2].[Number], [s2].[IsGreen], [e].[Id], [s].[OneId], [s].[ThreeId] FROM [EntityThrees] AS [e] INNER JOIN ( SELECT [j].[OneId], [j].[ThreeId], [e0].[Id] @@ -1681,7 +1676,7 @@ WHERE [e2].[Discriminator] IN (N'EntityBranch', N'EntityLeaf') ) AS [e3] ON [j1].[EntityBranchId] = [e3].[Id] WHERE [e3].[Id] < 20 ) AS [s2] ON [s].[Id] = [s2].[EntityOneId] -ORDER BY [e].[Id], [s].[OneId], [s].[ThreeId], [s].[Id] +ORDER BY [e].[Id], [s].[OneId], [s].[ThreeId] """); } @@ -1705,11 +1700,11 @@ FROM [JoinOneToThreePayloadFull] AS [j] INNER JOIN [EntityOnes] AS [e0] ON [j].[OneId] = [e0].[Id] WHERE [e0].[Id] > 15 ) AS [s] ON [e].[Id] = [s].[ThreeId] -ORDER BY [e].[Id], [s].[OneId], [s].[ThreeId], [s].[Id] +ORDER BY [e].[Id], [s].[OneId], [s].[ThreeId] """, // """ -SELECT [e2].[Id], [e2].[CollectionInverseId], [e2].[ExtraId], [e2].[Name], [e2].[ReferenceInverseId], [e].[Id], [s].[OneId], [s].[ThreeId], [s].[Id] +SELECT [e2].[Id], [e2].[CollectionInverseId], [e2].[ExtraId], [e2].[Name], [e2].[ReferenceInverseId], [e].[Id], [s].[OneId], [s].[ThreeId] FROM [EntityThrees] AS [e] INNER JOIN ( SELECT [j].[OneId], [j].[ThreeId], [e0].[Id] @@ -1722,7 +1717,7 @@ INNER JOIN ( FROM [EntityTwos] AS [e1] WHERE [e1].[Id] < 5 ) AS [e2] ON [s].[Id] = [e2].[CollectionInverseId] -ORDER BY [e].[Id], [s].[OneId], [s].[ThreeId], [s].[Id] +ORDER BY [e].[Id], [s].[OneId], [s].[ThreeId] """); } diff --git a/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindAsNoTrackingQuerySqlServerTest.cs b/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindAsNoTrackingQuerySqlServerTest.cs index 17cc4dd1b7b..4cfbc4fe1ed 100644 --- a/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindAsNoTrackingQuerySqlServerTest.cs +++ b/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindAsNoTrackingQuerySqlServerTest.cs @@ -119,7 +119,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] -ORDER BY [o].[OrderID], [c].[CustomerID], [o0].[OrderID] +ORDER BY [o].[OrderID], [o0].[OrderID] """); } diff --git a/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindEFPropertyIncludeQuerySqlServerTest.cs b/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindEFPropertyIncludeQuerySqlServerTest.cs index fbe0bf0f43f..7eaf99fc82c 100644 --- a/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindEFPropertyIncludeQuerySqlServerTest.cs +++ b/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindEFPropertyIncludeQuerySqlServerTest.cs @@ -67,7 +67,7 @@ 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].[OrderID] < 10800 -ORDER BY [o].[OrderID], [c].[CustomerID] +ORDER BY [o].[OrderID] """); } @@ -219,7 +219,7 @@ FROM [Orders] AS [o] WHERE [o].[OrderID] = 10248 ) AS [s] LEFT JOIN [Orders] AS [o0] ON [s].[CustomerID0] = [o0].[CustomerID] -ORDER BY [s].[OrderID], [s].[CustomerID0] +ORDER BY [s].[OrderID] """); } @@ -234,7 +234,7 @@ 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] LIKE N'F%' -ORDER BY [o].[OrderID], [c].[CustomerID] +ORDER BY [o].[OrderID] """); } @@ -414,9 +414,9 @@ public override async Task Repro9735(bool async) """ @p='2' -SELECT [s].[OrderID], [s].[CustomerID], [s].[EmployeeID], [s].[OrderDate], [s].[CustomerID0], [o0].[OrderID], [o0].[ProductID], [o0].[Discount], [o0].[Quantity], [o0].[UnitPrice] +SELECT [s].[OrderID], [s].[CustomerID], [s].[EmployeeID], [s].[OrderDate], [o0].[OrderID], [o0].[ProductID], [o0].[Discount], [o0].[Quantity], [o0].[UnitPrice] FROM ( - SELECT TOP(@p) [o].[OrderID], [o].[CustomerID], [o].[EmployeeID], [o].[OrderDate], [c].[CustomerID] AS [CustomerID0], CASE + SELECT TOP(@p) [o].[OrderID], [o].[CustomerID], [o].[EmployeeID], [o].[OrderDate], CASE WHEN [c].[CustomerID] IS NOT NULL THEN CAST(1 AS bit) ELSE CAST(0 AS bit) END AS [c], CASE @@ -434,7 +434,7 @@ ELSE N'' END ) AS [s] LEFT JOIN [Order Details] AS [o0] ON [s].[OrderID] = [o0].[OrderID] -ORDER BY [s].[c], [s].[c0], [s].[OrderID], [s].[CustomerID0], [o0].[OrderID] +ORDER BY [s].[c], [s].[c0], [s].[OrderID], [o0].[OrderID] """); } @@ -563,7 +563,7 @@ FROM [Order Details] AS [o0] ) AS [s] ON [o].[OrderID] = [s].[OrderID] ) AS [s0] ON [c].[CustomerID] = [s0].[CustomerID] WHERE [c].[CustomerID] LIKE N'F%' -ORDER BY [c].[CustomerID], [s0].[OrderID], [s0].[OrderID0], [s0].[ProductID] +ORDER BY [c].[CustomerID], [s0].[OrderID], [s0].[OrderID0] """); } @@ -798,7 +798,7 @@ FROM [Order Details] AS [o] 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 -ORDER BY [o].[OrderID], [o].[ProductID], [p].[ProductID], [o0].[OrderID], [c].[CustomerID] +ORDER BY [o].[OrderID], [o].[ProductID] """); } @@ -816,7 +816,7 @@ FROM [Order Details] AS [o] INNER JOIN [Orders] AS [o0] ON [o].[OrderID] = [o0].[OrderID] ) AS [s] ON [p].[ProductID] = [s].[ProductID] WHERE [p].[ProductID] % 17 = 5 -ORDER BY [p].[ProductID], [s].[OrderID], [s].[ProductID] +ORDER BY [p].[ProductID], [s].[OrderID] """); } @@ -932,7 +932,7 @@ LEFT JOIN ( FROM [Order Details] AS [o0] INNER JOIN [Products] AS [p] ON [o0].[ProductID] = [p].[ProductID] ) AS [s] ON [o1].[OrderID] = [s].[OrderID] -ORDER BY [o1].[OrderID], [s].[OrderID], [s].[ProductID] +ORDER BY [o1].[OrderID], [s].[OrderID] """); } @@ -998,7 +998,7 @@ FROM [Order Details] AS [o] 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 -ORDER BY [o].[OrderID], [o].[ProductID], [o0].[OrderID], [c].[CustomerID] +ORDER BY [o].[OrderID], [o].[ProductID] """); } @@ -1054,7 +1054,7 @@ FROM [Orders] AS [o] ) AS [o2] ON [c].[CustomerID] = [o2].[CustomerID] LEFT JOIN [Order Details] AS [o0] ON [o2].[OrderID] = [o0].[OrderID] WHERE [c].[CustomerID] LIKE N'F%' -ORDER BY [c].[CustomerID], [o2].[OrderID], [o0].[OrderID] +ORDER BY [c].[CustomerID], [o0].[OrderID] """); } @@ -1098,9 +1098,9 @@ public override async Task Include_collection_with_multiple_conditional_order_by """ @p='5' -SELECT [s].[OrderID], [s].[CustomerID], [s].[EmployeeID], [s].[OrderDate], [s].[CustomerID0], [o0].[OrderID], [o0].[ProductID], [o0].[Discount], [o0].[Quantity], [o0].[UnitPrice] +SELECT [s].[OrderID], [s].[CustomerID], [s].[EmployeeID], [s].[OrderDate], [o0].[OrderID], [o0].[ProductID], [o0].[Discount], [o0].[Quantity], [o0].[UnitPrice] FROM ( - SELECT TOP(@p) [o].[OrderID], [o].[CustomerID], [o].[EmployeeID], [o].[OrderDate], [c].[CustomerID] AS [CustomerID0], CASE + SELECT TOP(@p) [o].[OrderID], [o].[CustomerID], [o].[EmployeeID], [o].[OrderDate], CASE WHEN [o].[OrderID] > 0 THEN CAST(1 AS bit) ELSE CAST(0 AS bit) END AS [c], CASE @@ -1118,7 +1118,7 @@ ELSE N'' END ) AS [s] LEFT JOIN [Order Details] AS [o0] ON [s].[OrderID] = [o0].[OrderID] -ORDER BY [s].[c], [s].[c0], [s].[OrderID], [s].[CustomerID0], [o0].[OrderID] +ORDER BY [s].[c], [s].[c0], [s].[OrderID], [o0].[OrderID] """); } @@ -1172,7 +1172,7 @@ 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].[OrderID] < 10800 -ORDER BY [o].[OrderID], [c].[CustomerID] +ORDER BY [o].[OrderID] """); } @@ -1188,7 +1188,7 @@ FROM [Order Details] AS [o] 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) -ORDER BY [o].[OrderID], [o].[ProductID], [o0].[OrderID], [c].[CustomerID] +ORDER BY [o].[OrderID], [o].[ProductID] """); } @@ -1265,14 +1265,14 @@ public override async Task Include_multiple_references_then_include_collection_m AssertSql( """ -SELECT [o].[OrderID], [o].[ProductID], [o].[Discount], [o].[Quantity], [o].[UnitPrice], [o0].[OrderID], [o0].[CustomerID], [o0].[EmployeeID], [o0].[OrderDate], [c].[CustomerID], [c].[Address], [c].[City], [c].[CompanyName], [c].[ContactName], [c].[ContactTitle], [c].[Country], [c].[Fax], [c].[Phone], [c].[PostalCode], [c].[Region], [p].[ProductID], [o1].[OrderID], [o1].[CustomerID], [o1].[EmployeeID], [o1].[OrderDate], [p].[Discontinued], [p].[ProductName], [p].[SupplierID], [p].[UnitPrice], [p].[UnitsInStock] +SELECT [o].[OrderID], [o].[ProductID], [o].[Discount], [o].[Quantity], [o].[UnitPrice], [o0].[OrderID], [o0].[CustomerID], [o0].[EmployeeID], [o0].[OrderDate], [c].[CustomerID], [c].[Address], [c].[City], [c].[CompanyName], [c].[ContactName], [c].[ContactTitle], [c].[Country], [c].[Fax], [c].[Phone], [c].[PostalCode], [c].[Region], [o1].[OrderID], [o1].[CustomerID], [o1].[EmployeeID], [o1].[OrderDate], [p].[ProductID], [p].[Discontinued], [p].[ProductName], [p].[SupplierID], [p].[UnitPrice], [p].[UnitsInStock] 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] LEFT JOIN [Orders] AS [o1] ON [c].[CustomerID] = [o1].[CustomerID] WHERE [o].[OrderID] % 23 = 13 -ORDER BY [o].[OrderID], [o].[ProductID], [o0].[OrderID], [c].[CustomerID], [p].[ProductID] +ORDER BY [o].[OrderID], [o].[ProductID] """); } @@ -1325,7 +1325,7 @@ public override async Task Include_collection_SelectMany_GroupBy_Select(bool asy AssertSql( """ -SELECT [s1].[OrderID], [s1].[CustomerID], [s1].[EmployeeID], [s1].[OrderDate], [s].[OrderID], [s1].[OrderID0], [s1].[ProductID], [o3].[OrderID], [o3].[ProductID], [o3].[Discount], [o3].[Quantity], [o3].[UnitPrice] +SELECT [s1].[OrderID], [s1].[CustomerID], [s1].[EmployeeID], [s1].[OrderDate], [s].[OrderID], [o3].[OrderID], [o3].[ProductID], [o3].[Discount], [o3].[Quantity], [o3].[UnitPrice] FROM ( SELECT [o].[OrderID] FROM [Orders] AS [o] @@ -1334,9 +1334,9 @@ CROSS JOIN [Order Details] AS [o0] GROUP BY [o].[OrderID] ) AS [s] LEFT JOIN ( - SELECT [s0].[OrderID], [s0].[CustomerID], [s0].[EmployeeID], [s0].[OrderDate], [s0].[OrderID0], [s0].[ProductID] + SELECT [s0].[OrderID], [s0].[CustomerID], [s0].[EmployeeID], [s0].[OrderDate] FROM ( - SELECT [o1].[OrderID], [o1].[CustomerID], [o1].[EmployeeID], [o1].[OrderDate], [o2].[OrderID] AS [OrderID0], [o2].[ProductID], ROW_NUMBER() OVER(PARTITION BY [o1].[OrderID] ORDER BY [o1].[OrderID]) AS [row] + SELECT [o1].[OrderID], [o1].[CustomerID], [o1].[EmployeeID], [o1].[OrderDate], ROW_NUMBER() OVER(PARTITION BY [o1].[OrderID] ORDER BY [o1].[OrderID]) AS [row] FROM [Orders] AS [o1] CROSS JOIN [Order Details] AS [o2] WHERE [o1].[OrderID] = 10248 @@ -1344,7 +1344,7 @@ CROSS JOIN [Order Details] AS [o2] WHERE [s0].[row] <= 1 ) AS [s1] ON [s].[OrderID] = [s1].[OrderID] LEFT JOIN [Order Details] AS [o3] ON [s1].[OrderID] = [o3].[OrderID] -ORDER BY [s].[OrderID], [s1].[OrderID], [s1].[OrderID0], [s1].[ProductID], [o3].[OrderID] +ORDER BY [s].[OrderID], [o3].[OrderID] """); } @@ -1526,7 +1526,7 @@ FROM [Order Details] AS [o] 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 -ORDER BY [o].[OrderID], [o].[ProductID], [p].[ProductID], [o0].[OrderID], [c].[CustomerID] +ORDER BY [o].[OrderID], [o].[ProductID] """); } @@ -1577,7 +1577,7 @@ public override async Task Include_collection_Join_GroupBy_Select(bool async) AssertSql( """ -SELECT [s1].[OrderID], [s1].[CustomerID], [s1].[EmployeeID], [s1].[OrderDate], [s].[OrderID], [s1].[OrderID0], [s1].[ProductID], [o3].[OrderID], [o3].[ProductID], [o3].[Discount], [o3].[Quantity], [o3].[UnitPrice] +SELECT [s1].[OrderID], [s1].[CustomerID], [s1].[EmployeeID], [s1].[OrderDate], [s].[OrderID], [o3].[OrderID], [o3].[ProductID], [o3].[Discount], [o3].[Quantity], [o3].[UnitPrice] FROM ( SELECT [o].[OrderID] FROM [Orders] AS [o] @@ -1586,9 +1586,9 @@ FROM [Orders] AS [o] GROUP BY [o].[OrderID] ) AS [s] LEFT JOIN ( - SELECT [s0].[OrderID], [s0].[CustomerID], [s0].[EmployeeID], [s0].[OrderDate], [s0].[OrderID0], [s0].[ProductID] + SELECT [s0].[OrderID], [s0].[CustomerID], [s0].[EmployeeID], [s0].[OrderDate] FROM ( - SELECT [o1].[OrderID], [o1].[CustomerID], [o1].[EmployeeID], [o1].[OrderDate], [o2].[OrderID] AS [OrderID0], [o2].[ProductID], ROW_NUMBER() OVER(PARTITION BY [o1].[OrderID] ORDER BY [o1].[OrderID]) AS [row] + SELECT [o1].[OrderID], [o1].[CustomerID], [o1].[EmployeeID], [o1].[OrderDate], ROW_NUMBER() OVER(PARTITION BY [o1].[OrderID] ORDER BY [o1].[OrderID]) AS [row] FROM [Orders] AS [o1] INNER JOIN [Order Details] AS [o2] ON [o1].[OrderID] = [o2].[OrderID] WHERE [o1].[OrderID] = 10248 @@ -1596,7 +1596,7 @@ FROM [Orders] AS [o1] WHERE [s0].[row] <= 1 ) AS [s1] ON [s].[OrderID] = [s1].[OrderID] LEFT JOIN [Order Details] AS [o3] ON [s1].[OrderID] = [o3].[OrderID] -ORDER BY [s].[OrderID], [s1].[OrderID], [s1].[OrderID0], [s1].[ProductID], [o3].[OrderID] +ORDER BY [s].[OrderID], [o3].[OrderID] """); } @@ -1623,7 +1623,7 @@ FROM [Orders] AS [o0] WHERE [o3].[row] <= 1 ) AS [o4] ON [o2].[OrderID] = [o4].[OrderID] LEFT JOIN [Order Details] AS [o1] ON [o4].[OrderID] = [o1].[OrderID] -ORDER BY [o2].[OrderID], [o4].[OrderID], [o1].[OrderID] +ORDER BY [o2].[OrderID], [o1].[OrderID] """); } @@ -1652,7 +1652,7 @@ public override async Task Join_Include_collection_GroupBy_Select(bool async) AssertSql( """ -SELECT [s1].[OrderID], [s1].[CustomerID], [s1].[EmployeeID], [s1].[OrderDate], [s].[OrderID], [s1].[OrderID0], [s1].[ProductID], [o3].[OrderID], [o3].[ProductID], [o3].[Discount], [o3].[Quantity], [o3].[UnitPrice] +SELECT [s1].[OrderID], [s1].[CustomerID], [s1].[EmployeeID], [s1].[OrderDate], [s].[OrderID], [o3].[OrderID], [o3].[ProductID], [o3].[Discount], [o3].[Quantity], [o3].[UnitPrice] FROM ( SELECT [o0].[OrderID] FROM [Order Details] AS [o] @@ -1661,9 +1661,9 @@ FROM [Order Details] AS [o] GROUP BY [o0].[OrderID] ) AS [s] LEFT JOIN ( - SELECT [s0].[OrderID], [s0].[CustomerID], [s0].[EmployeeID], [s0].[OrderDate], [s0].[OrderID0], [s0].[ProductID] + SELECT [s0].[OrderID], [s0].[CustomerID], [s0].[EmployeeID], [s0].[OrderDate] FROM ( - SELECT [o2].[OrderID], [o2].[CustomerID], [o2].[EmployeeID], [o2].[OrderDate], [o1].[OrderID] AS [OrderID0], [o1].[ProductID], ROW_NUMBER() OVER(PARTITION BY [o2].[OrderID] ORDER BY [o2].[OrderID]) AS [row] + SELECT [o2].[OrderID], [o2].[CustomerID], [o2].[EmployeeID], [o2].[OrderDate], ROW_NUMBER() OVER(PARTITION BY [o2].[OrderID] ORDER BY [o2].[OrderID]) AS [row] FROM [Order Details] AS [o1] INNER JOIN [Orders] AS [o2] ON [o1].[OrderID] = [o2].[OrderID] WHERE [o1].[OrderID] = 10248 @@ -1671,7 +1671,7 @@ FROM [Order Details] AS [o1] WHERE [s0].[row] <= 1 ) AS [s1] ON [s].[OrderID] = [s1].[OrderID] LEFT JOIN [Order Details] AS [o3] ON [s1].[OrderID] = [o3].[OrderID] -ORDER BY [s].[OrderID], [s1].[OrderID0], [s1].[ProductID], [s1].[OrderID], [o3].[OrderID] +ORDER BY [s].[OrderID], [o3].[OrderID] """); } @@ -1735,12 +1735,12 @@ public override async Task Include_collection_and_reference(bool async) AssertSql( """ -SELECT [o].[OrderID], [o].[CustomerID], [o].[EmployeeID], [o].[OrderDate], [c].[CustomerID], [o0].[OrderID], [o0].[ProductID], [o0].[Discount], [o0].[Quantity], [o0].[UnitPrice], [c].[Address], [c].[City], [c].[CompanyName], [c].[ContactName], [c].[ContactTitle], [c].[Country], [c].[Fax], [c].[Phone], [c].[PostalCode], [c].[Region] +SELECT [o].[OrderID], [o].[CustomerID], [o].[EmployeeID], [o].[OrderDate], [o0].[OrderID], [o0].[ProductID], [o0].[Discount], [o0].[Quantity], [o0].[UnitPrice], [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] LEFT JOIN [Order Details] AS [o0] ON [o].[OrderID] = [o0].[OrderID] WHERE [o].[CustomerID] LIKE N'F%' -ORDER BY [o].[OrderID], [c].[CustomerID], [o0].[OrderID] +ORDER BY [o].[OrderID], [o0].[OrderID] """); } @@ -1771,7 +1771,7 @@ FROM [Order Details] AS [o] LEFT JOIN [Customers] AS [c] ON [o0].[CustomerID] = [c].[CustomerID] LEFT JOIN [Orders] AS [o1] ON [c].[CustomerID] = [o1].[CustomerID] WHERE [o].[OrderID] = 10248 -ORDER BY [o].[OrderID], [o].[ProductID], [o0].[OrderID], [c].[CustomerID] +ORDER BY [o].[OrderID], [o].[ProductID] """); } @@ -1781,7 +1781,7 @@ public override async Task SelectMany_Include_collection_GroupBy_Select(bool asy AssertSql( """ -SELECT [s1].[OrderID], [s1].[CustomerID], [s1].[EmployeeID], [s1].[OrderDate], [s].[OrderID], [s1].[OrderID0], [s1].[ProductID], [o3].[OrderID], [o3].[ProductID], [o3].[Discount], [o3].[Quantity], [o3].[UnitPrice] +SELECT [s1].[OrderID], [s1].[CustomerID], [s1].[EmployeeID], [s1].[OrderDate], [s].[OrderID], [o3].[OrderID], [o3].[ProductID], [o3].[Discount], [o3].[Quantity], [o3].[UnitPrice] FROM ( SELECT [o0].[OrderID] FROM [Order Details] AS [o] @@ -1790,9 +1790,9 @@ CROSS JOIN [Orders] AS [o0] GROUP BY [o0].[OrderID] ) AS [s] LEFT JOIN ( - SELECT [s0].[OrderID], [s0].[CustomerID], [s0].[EmployeeID], [s0].[OrderDate], [s0].[OrderID0], [s0].[ProductID] + SELECT [s0].[OrderID], [s0].[CustomerID], [s0].[EmployeeID], [s0].[OrderDate] FROM ( - SELECT [o2].[OrderID], [o2].[CustomerID], [o2].[EmployeeID], [o2].[OrderDate], [o1].[OrderID] AS [OrderID0], [o1].[ProductID], ROW_NUMBER() OVER(PARTITION BY [o2].[OrderID] ORDER BY [o2].[OrderID]) AS [row] + SELECT [o2].[OrderID], [o2].[CustomerID], [o2].[EmployeeID], [o2].[OrderDate], ROW_NUMBER() OVER(PARTITION BY [o2].[OrderID] ORDER BY [o2].[OrderID]) AS [row] FROM [Order Details] AS [o1] CROSS JOIN [Orders] AS [o2] WHERE [o1].[OrderID] = 10248 @@ -1800,7 +1800,7 @@ CROSS JOIN [Orders] AS [o2] WHERE [s0].[row] <= 1 ) AS [s1] ON [s].[OrderID] = [s1].[OrderID] LEFT JOIN [Order Details] AS [o3] ON [s1].[OrderID] = [o3].[OrderID] -ORDER BY [s].[OrderID], [s1].[OrderID0], [s1].[ProductID], [s1].[OrderID], [o3].[OrderID] +ORDER BY [s].[OrderID], [o3].[OrderID] """); } @@ -1868,7 +1868,7 @@ 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] LIKE N'F%' -ORDER BY [o].[OrderID], [c].[CustomerID], [o0].[OrderID] +ORDER BY [o].[OrderID], [o0].[OrderID] """); } @@ -1939,7 +1939,7 @@ 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] LIKE N'F%' -ORDER BY [o].[OrderID], [c].[CustomerID] +ORDER BY [o].[OrderID] """); } @@ -2022,7 +2022,7 @@ FROM [Orders] AS [o] WHERE [o].[OrderID] = 10248 ) AS [s] LEFT JOIN [Orders] AS [o0] ON [s].[CustomerID0] = [o0].[CustomerID] -ORDER BY [s].[OrderID], [s].[CustomerID0] +ORDER BY [s].[OrderID] """); } @@ -2032,14 +2032,14 @@ public override async Task Include_multiple_references_and_collection_multi_leve AssertSql( """ -SELECT [o].[OrderID], [o].[ProductID], [o].[Discount], [o].[Quantity], [o].[UnitPrice], [o0].[OrderID], [o0].[CustomerID], [o0].[EmployeeID], [o0].[OrderDate], [c].[CustomerID], [c].[Address], [c].[City], [c].[CompanyName], [c].[ContactName], [c].[ContactTitle], [c].[Country], [c].[Fax], [c].[Phone], [c].[PostalCode], [c].[Region], [p].[ProductID], [o1].[OrderID], [o1].[CustomerID], [o1].[EmployeeID], [o1].[OrderDate], [p].[Discontinued], [p].[ProductName], [p].[SupplierID], [p].[UnitPrice], [p].[UnitsInStock] +SELECT [o].[OrderID], [o].[ProductID], [o].[Discount], [o].[Quantity], [o].[UnitPrice], [o0].[OrderID], [o0].[CustomerID], [o0].[EmployeeID], [o0].[OrderDate], [c].[CustomerID], [c].[Address], [c].[City], [c].[CompanyName], [c].[ContactName], [c].[ContactTitle], [c].[Country], [c].[Fax], [c].[Phone], [c].[PostalCode], [c].[Region], [o1].[OrderID], [o1].[CustomerID], [o1].[EmployeeID], [o1].[OrderDate], [p].[ProductID], [p].[Discontinued], [p].[ProductName], [p].[SupplierID], [p].[UnitPrice], [p].[UnitsInStock] 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] LEFT JOIN [Orders] AS [o1] ON [c].[CustomerID] = [o1].[CustomerID] WHERE [o].[OrderID] % 23 = 13 -ORDER BY [o].[OrderID], [o].[ProductID], [o0].[OrderID], [c].[CustomerID], [p].[ProductID] +ORDER BY [o].[OrderID], [o].[ProductID] """); } @@ -2112,7 +2112,7 @@ FROM [Order Details] AS [o] INNER JOIN [Orders] AS [o0] ON [o].[OrderID] = [o0].[OrderID] ) AS [s] ON [p].[ProductID] = [s].[ProductID] WHERE [p].[ProductID] % 17 = 5 AND [p].[UnitPrice] < 20.0 -ORDER BY [p].[ProductID], [s].[OrderID], [s].[ProductID] +ORDER BY [p].[ProductID], [s].[OrderID] """); } @@ -2141,7 +2141,7 @@ FROM [Order Details] AS [o] LEFT JOIN [Customers] AS [c] ON [o0].[CustomerID] = [c].[CustomerID] LEFT JOIN [Orders] AS [o1] ON [c].[CustomerID] = [o1].[CustomerID] WHERE [o].[OrderID] = 10248 -ORDER BY [o].[OrderID], [o].[ProductID], [o0].[OrderID], [c].[CustomerID] +ORDER BY [o].[OrderID], [o].[ProductID] """); } diff --git a/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindGroupByQuerySqlServerTest.cs b/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindGroupByQuerySqlServerTest.cs index 869ced1f79d..53a0312be1c 100644 --- a/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindGroupByQuerySqlServerTest.cs +++ b/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindGroupByQuerySqlServerTest.cs @@ -1378,7 +1378,6 @@ public override async Task GroupJoin_GroupBy_Aggregate_3(bool async) """ SELECT [o].[CustomerID] AS [Key], AVG(CAST([o].[OrderID] AS float)) AS [Average] FROM [Orders] AS [o] -LEFT JOIN [Customers] AS [c] ON [o].[CustomerID] = [c].[CustomerID] GROUP BY [o].[CustomerID] """); } @@ -1404,7 +1403,6 @@ public override async Task GroupJoin_GroupBy_Aggregate_5(bool async) """ SELECT [o].[OrderID] AS [Value], AVG(CAST([o].[OrderID] AS float)) AS [Average] FROM [Orders] AS [o] -LEFT JOIN [Customers] AS [c] ON [o].[CustomerID] = [c].[CustomerID] GROUP BY [o].[OrderID] """); } @@ -3365,7 +3363,6 @@ public override async Task Key_plus_key_in_projection(bool async) """ SELECT [o].[OrderID] + [o].[OrderID] AS [Value], AVG(CAST([o].[OrderID] AS float)) AS [Average] FROM [Orders] AS [o] -LEFT JOIN [Customers] AS [c] ON [o].[CustomerID] = [c].[CustomerID] GROUP BY [o].[OrderID] """); } @@ -3427,7 +3424,7 @@ FROM [Orders] AS [o0] ) AS [o3] ON [o1].[CustomerID] = [o3].[CustomerID] ) AS [s] WHERE [c].[CustomerID] LIKE N'F%' -ORDER BY [c].[CustomerID], [s].[CustomerID0] +ORDER BY [c].[CustomerID] """); } @@ -3891,7 +3888,7 @@ public override async Task GroupBy_complex_key_without_aggregate(bool async) AssertSql( """ -SELECT [s1].[Key], [s3].[OrderID], [s3].[CustomerID], [s3].[EmployeeID], [s3].[OrderDate], [s3].[CustomerID0] +SELECT [s1].[Key], [s3].[OrderID], [s3].[CustomerID], [s3].[EmployeeID], [s3].[OrderDate] FROM ( SELECT [s].[Key] FROM ( @@ -3902,18 +3899,18 @@ FROM [Orders] AS [o] GROUP BY [s].[Key] ) AS [s1] LEFT JOIN ( - SELECT [s2].[OrderID], [s2].[CustomerID], [s2].[EmployeeID], [s2].[OrderDate], [s2].[CustomerID0], [s2].[Key] + SELECT [s2].[OrderID], [s2].[CustomerID], [s2].[EmployeeID], [s2].[OrderDate], [s2].[Key] FROM ( - SELECT [s0].[OrderID], [s0].[CustomerID], [s0].[EmployeeID], [s0].[OrderDate], [s0].[CustomerID0], [s0].[Key], ROW_NUMBER() OVER(PARTITION BY [s0].[Key] ORDER BY [s0].[OrderID], [s0].[CustomerID0]) AS [row] + SELECT [s0].[OrderID], [s0].[CustomerID], [s0].[EmployeeID], [s0].[OrderDate], [s0].[Key], ROW_NUMBER() OVER(PARTITION BY [s0].[Key] ORDER BY [s0].[OrderID]) AS [row] FROM ( - SELECT [o0].[OrderID], [o0].[CustomerID], [o0].[EmployeeID], [o0].[OrderDate], [c0].[CustomerID] AS [CustomerID0], SUBSTRING([c0].[CustomerID], 0 + 1, 1) AS [Key] + SELECT [o0].[OrderID], [o0].[CustomerID], [o0].[EmployeeID], [o0].[OrderDate], SUBSTRING([c0].[CustomerID], 0 + 1, 1) AS [Key] FROM [Orders] AS [o0] LEFT JOIN [Customers] AS [c0] ON [o0].[CustomerID] = [c0].[CustomerID] ) AS [s0] ) AS [s2] WHERE 1 < [s2].[row] AND [s2].[row] <= 3 ) AS [s3] ON [s1].[Key] = [s3].[Key] -ORDER BY [s1].[Key], [s3].[OrderID] +ORDER BY [s1].[Key] """); } diff --git a/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindIncludeNoTrackingQuerySqlServerTest.cs b/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindIncludeNoTrackingQuerySqlServerTest.cs index 5a6159d1202..774e9ec818c 100644 --- a/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindIncludeNoTrackingQuerySqlServerTest.cs +++ b/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindIncludeNoTrackingQuerySqlServerTest.cs @@ -52,7 +52,7 @@ public override async Task Include_collection_Join_GroupBy_Select(bool async) AssertSql( """ -SELECT [s1].[OrderID], [s1].[CustomerID], [s1].[EmployeeID], [s1].[OrderDate], [s].[OrderID], [s1].[OrderID0], [s1].[ProductID], [o3].[OrderID], [o3].[ProductID], [o3].[Discount], [o3].[Quantity], [o3].[UnitPrice] +SELECT [s1].[OrderID], [s1].[CustomerID], [s1].[EmployeeID], [s1].[OrderDate], [s].[OrderID], [o3].[OrderID], [o3].[ProductID], [o3].[Discount], [o3].[Quantity], [o3].[UnitPrice] FROM ( SELECT [o].[OrderID] FROM [Orders] AS [o] @@ -61,9 +61,9 @@ FROM [Orders] AS [o] GROUP BY [o].[OrderID] ) AS [s] LEFT JOIN ( - SELECT [s0].[OrderID], [s0].[CustomerID], [s0].[EmployeeID], [s0].[OrderDate], [s0].[OrderID0], [s0].[ProductID] + SELECT [s0].[OrderID], [s0].[CustomerID], [s0].[EmployeeID], [s0].[OrderDate] FROM ( - SELECT [o1].[OrderID], [o1].[CustomerID], [o1].[EmployeeID], [o1].[OrderDate], [o2].[OrderID] AS [OrderID0], [o2].[ProductID], ROW_NUMBER() OVER(PARTITION BY [o1].[OrderID] ORDER BY [o1].[OrderID]) AS [row] + SELECT [o1].[OrderID], [o1].[CustomerID], [o1].[EmployeeID], [o1].[OrderDate], ROW_NUMBER() OVER(PARTITION BY [o1].[OrderID] ORDER BY [o1].[OrderID]) AS [row] FROM [Orders] AS [o1] INNER JOIN [Order Details] AS [o2] ON [o1].[OrderID] = [o2].[OrderID] WHERE [o1].[OrderID] = 10248 @@ -71,7 +71,7 @@ FROM [Orders] AS [o1] WHERE [s0].[row] <= 1 ) AS [s1] ON [s].[OrderID] = [s1].[OrderID] LEFT JOIN [Order Details] AS [o3] ON [s1].[OrderID] = [o3].[OrderID] -ORDER BY [s].[OrderID], [s1].[OrderID], [s1].[OrderID0], [s1].[ProductID], [o3].[OrderID] +ORDER BY [s].[OrderID], [o3].[OrderID] """); } @@ -124,7 +124,7 @@ FROM [Order Details] AS [o0] ) AS [s] ON [o].[OrderID] = [s].[OrderID] ) AS [s0] ON [c].[CustomerID] = [s0].[CustomerID] WHERE [c].[CustomerID] LIKE N'F%' -ORDER BY [c].[CustomerID], [s0].[OrderID], [s0].[OrderID0], [s0].[ProductID] +ORDER BY [c].[CustomerID], [s0].[OrderID], [s0].[OrderID0] """); } @@ -139,7 +139,7 @@ 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] LIKE N'F%' -ORDER BY [o].[OrderID], [c].[CustomerID], [o0].[OrderID] +ORDER BY [o].[OrderID], [o0].[OrderID] """); } @@ -221,7 +221,7 @@ LEFT JOIN ( FROM [Order Details] AS [o0] INNER JOIN [Products] AS [p] ON [o0].[ProductID] = [p].[ProductID] ) AS [s] ON [o1].[OrderID] = [s].[OrderID] -ORDER BY [o1].[OrderID], [s].[OrderID], [s].[ProductID] +ORDER BY [o1].[OrderID], [s].[OrderID] """); } @@ -495,7 +495,7 @@ FROM [Order Details] AS [o] INNER JOIN [Orders] AS [o0] ON [o].[OrderID] = [o0].[OrderID] ) AS [s] ON [p].[ProductID] = [s].[ProductID] WHERE [p].[ProductID] % 17 = 5 AND [p].[UnitPrice] < 20.0 -ORDER BY [p].[ProductID], [s].[OrderID], [s].[ProductID] +ORDER BY [p].[ProductID], [s].[OrderID] """); } @@ -628,9 +628,9 @@ public override async Task Include_collection_with_multiple_conditional_order_by """ @p='5' -SELECT [s].[OrderID], [s].[CustomerID], [s].[EmployeeID], [s].[OrderDate], [s].[CustomerID0], [o0].[OrderID], [o0].[ProductID], [o0].[Discount], [o0].[Quantity], [o0].[UnitPrice] +SELECT [s].[OrderID], [s].[CustomerID], [s].[EmployeeID], [s].[OrderDate], [o0].[OrderID], [o0].[ProductID], [o0].[Discount], [o0].[Quantity], [o0].[UnitPrice] FROM ( - SELECT TOP(@p) [o].[OrderID], [o].[CustomerID], [o].[EmployeeID], [o].[OrderDate], [c].[CustomerID] AS [CustomerID0], CASE + SELECT TOP(@p) [o].[OrderID], [o].[CustomerID], [o].[EmployeeID], [o].[OrderDate], CASE WHEN [o].[OrderID] > 0 THEN CAST(1 AS bit) ELSE CAST(0 AS bit) END AS [c], CASE @@ -648,7 +648,7 @@ ELSE N'' END ) AS [s] LEFT JOIN [Order Details] AS [o0] ON [s].[OrderID] = [o0].[OrderID] -ORDER BY [s].[c], [s].[c0], [s].[OrderID], [s].[CustomerID0], [o0].[OrderID] +ORDER BY [s].[c], [s].[c0], [s].[OrderID], [o0].[OrderID] """); } @@ -903,7 +903,7 @@ FROM [Orders] AS [o0] WHERE [o3].[row] <= 1 ) AS [o4] ON [o2].[OrderID] = [o4].[OrderID] LEFT JOIN [Order Details] AS [o1] ON [o4].[OrderID] = [o1].[OrderID] -ORDER BY [o2].[OrderID], [o4].[OrderID], [o1].[OrderID] +ORDER BY [o2].[OrderID], [o1].[OrderID] """); } @@ -970,7 +970,7 @@ public override async Task Include_collection_SelectMany_GroupBy_Select(bool asy AssertSql( """ -SELECT [s1].[OrderID], [s1].[CustomerID], [s1].[EmployeeID], [s1].[OrderDate], [s].[OrderID], [s1].[OrderID0], [s1].[ProductID], [o3].[OrderID], [o3].[ProductID], [o3].[Discount], [o3].[Quantity], [o3].[UnitPrice] +SELECT [s1].[OrderID], [s1].[CustomerID], [s1].[EmployeeID], [s1].[OrderDate], [s].[OrderID], [o3].[OrderID], [o3].[ProductID], [o3].[Discount], [o3].[Quantity], [o3].[UnitPrice] FROM ( SELECT [o].[OrderID] FROM [Orders] AS [o] @@ -979,9 +979,9 @@ CROSS JOIN [Order Details] AS [o0] GROUP BY [o].[OrderID] ) AS [s] LEFT JOIN ( - SELECT [s0].[OrderID], [s0].[CustomerID], [s0].[EmployeeID], [s0].[OrderDate], [s0].[OrderID0], [s0].[ProductID] + SELECT [s0].[OrderID], [s0].[CustomerID], [s0].[EmployeeID], [s0].[OrderDate] FROM ( - SELECT [o1].[OrderID], [o1].[CustomerID], [o1].[EmployeeID], [o1].[OrderDate], [o2].[OrderID] AS [OrderID0], [o2].[ProductID], ROW_NUMBER() OVER(PARTITION BY [o1].[OrderID] ORDER BY [o1].[OrderID]) AS [row] + SELECT [o1].[OrderID], [o1].[CustomerID], [o1].[EmployeeID], [o1].[OrderDate], ROW_NUMBER() OVER(PARTITION BY [o1].[OrderID] ORDER BY [o1].[OrderID]) AS [row] FROM [Orders] AS [o1] CROSS JOIN [Order Details] AS [o2] WHERE [o1].[OrderID] = 10248 @@ -989,7 +989,7 @@ CROSS JOIN [Order Details] AS [o2] WHERE [s0].[row] <= 1 ) AS [s1] ON [s].[OrderID] = [s1].[OrderID] LEFT JOIN [Order Details] AS [o3] ON [s1].[OrderID] = [o3].[OrderID] -ORDER BY [s].[OrderID], [s1].[OrderID], [s1].[OrderID0], [s1].[ProductID], [o3].[OrderID] +ORDER BY [s].[OrderID], [o3].[OrderID] """); } @@ -1016,7 +1016,7 @@ public override async Task Join_Include_collection_GroupBy_Select(bool async) AssertSql( """ -SELECT [s1].[OrderID], [s1].[CustomerID], [s1].[EmployeeID], [s1].[OrderDate], [s].[OrderID], [s1].[OrderID0], [s1].[ProductID], [o3].[OrderID], [o3].[ProductID], [o3].[Discount], [o3].[Quantity], [o3].[UnitPrice] +SELECT [s1].[OrderID], [s1].[CustomerID], [s1].[EmployeeID], [s1].[OrderDate], [s].[OrderID], [o3].[OrderID], [o3].[ProductID], [o3].[Discount], [o3].[Quantity], [o3].[UnitPrice] FROM ( SELECT [o0].[OrderID] FROM [Order Details] AS [o] @@ -1025,9 +1025,9 @@ FROM [Order Details] AS [o] GROUP BY [o0].[OrderID] ) AS [s] LEFT JOIN ( - SELECT [s0].[OrderID], [s0].[CustomerID], [s0].[EmployeeID], [s0].[OrderDate], [s0].[OrderID0], [s0].[ProductID] + SELECT [s0].[OrderID], [s0].[CustomerID], [s0].[EmployeeID], [s0].[OrderDate] FROM ( - SELECT [o2].[OrderID], [o2].[CustomerID], [o2].[EmployeeID], [o2].[OrderDate], [o1].[OrderID] AS [OrderID0], [o1].[ProductID], ROW_NUMBER() OVER(PARTITION BY [o2].[OrderID] ORDER BY [o2].[OrderID]) AS [row] + SELECT [o2].[OrderID], [o2].[CustomerID], [o2].[EmployeeID], [o2].[OrderDate], ROW_NUMBER() OVER(PARTITION BY [o2].[OrderID] ORDER BY [o2].[OrderID]) AS [row] FROM [Order Details] AS [o1] INNER JOIN [Orders] AS [o2] ON [o1].[OrderID] = [o2].[OrderID] WHERE [o1].[OrderID] = 10248 @@ -1035,7 +1035,7 @@ FROM [Order Details] AS [o1] WHERE [s0].[row] <= 1 ) AS [s1] ON [s].[OrderID] = [s1].[OrderID] LEFT JOIN [Order Details] AS [o3] ON [s1].[OrderID] = [o3].[OrderID] -ORDER BY [s].[OrderID], [s1].[OrderID0], [s1].[ProductID], [s1].[OrderID], [o3].[OrderID] +ORDER BY [s].[OrderID], [o3].[OrderID] """); } @@ -1292,9 +1292,9 @@ public override async Task Repro9735(bool async) """ @p='2' -SELECT [s].[OrderID], [s].[CustomerID], [s].[EmployeeID], [s].[OrderDate], [s].[CustomerID0], [o0].[OrderID], [o0].[ProductID], [o0].[Discount], [o0].[Quantity], [o0].[UnitPrice] +SELECT [s].[OrderID], [s].[CustomerID], [s].[EmployeeID], [s].[OrderDate], [o0].[OrderID], [o0].[ProductID], [o0].[Discount], [o0].[Quantity], [o0].[UnitPrice] FROM ( - SELECT TOP(@p) [o].[OrderID], [o].[CustomerID], [o].[EmployeeID], [o].[OrderDate], [c].[CustomerID] AS [CustomerID0], CASE + SELECT TOP(@p) [o].[OrderID], [o].[CustomerID], [o].[EmployeeID], [o].[OrderDate], CASE WHEN [c].[CustomerID] IS NOT NULL THEN CAST(1 AS bit) ELSE CAST(0 AS bit) END AS [c], CASE @@ -1312,7 +1312,7 @@ ELSE N'' END ) AS [s] LEFT JOIN [Order Details] AS [o0] ON [s].[OrderID] = [o0].[OrderID] -ORDER BY [s].[c], [s].[c0], [s].[OrderID], [s].[CustomerID0], [o0].[OrderID] +ORDER BY [s].[c], [s].[c0], [s].[OrderID], [o0].[OrderID] """); } @@ -1330,7 +1330,7 @@ FROM [Order Details] AS [o] INNER JOIN [Orders] AS [o0] ON [o].[OrderID] = [o0].[OrderID] ) AS [s] ON [p].[ProductID] = [s].[ProductID] WHERE [p].[ProductID] % 17 = 5 -ORDER BY [p].[ProductID], [s].[OrderID], [s].[ProductID] +ORDER BY [p].[ProductID], [s].[OrderID] """); } @@ -1482,12 +1482,12 @@ public override async Task Include_collection_and_reference(bool async) AssertSql( """ -SELECT [o].[OrderID], [o].[CustomerID], [o].[EmployeeID], [o].[OrderDate], [c].[CustomerID], [o0].[OrderID], [o0].[ProductID], [o0].[Discount], [o0].[Quantity], [o0].[UnitPrice], [c].[Address], [c].[City], [c].[CompanyName], [c].[ContactName], [c].[ContactTitle], [c].[Country], [c].[Fax], [c].[Phone], [c].[PostalCode], [c].[Region] +SELECT [o].[OrderID], [o].[CustomerID], [o].[EmployeeID], [o].[OrderDate], [o0].[OrderID], [o0].[ProductID], [o0].[Discount], [o0].[Quantity], [o0].[UnitPrice], [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] LEFT JOIN [Order Details] AS [o0] ON [o].[OrderID] = [o0].[OrderID] WHERE [o].[CustomerID] LIKE N'F%' -ORDER BY [o].[OrderID], [c].[CustomerID], [o0].[OrderID] +ORDER BY [o].[OrderID], [o0].[OrderID] """); } @@ -1523,7 +1523,7 @@ FROM [Orders] AS [o] ) AS [o2] ON [c].[CustomerID] = [o2].[CustomerID] LEFT JOIN [Order Details] AS [o0] ON [o2].[OrderID] = [o0].[OrderID] WHERE [c].[CustomerID] LIKE N'F%' -ORDER BY [c].[CustomerID], [o2].[OrderID], [o0].[OrderID] +ORDER BY [c].[CustomerID], [o0].[OrderID] """); } @@ -1620,7 +1620,7 @@ public override async Task SelectMany_Include_collection_GroupBy_Select(bool asy AssertSql( """ -SELECT [s1].[OrderID], [s1].[CustomerID], [s1].[EmployeeID], [s1].[OrderDate], [s].[OrderID], [s1].[OrderID0], [s1].[ProductID], [o3].[OrderID], [o3].[ProductID], [o3].[Discount], [o3].[Quantity], [o3].[UnitPrice] +SELECT [s1].[OrderID], [s1].[CustomerID], [s1].[EmployeeID], [s1].[OrderDate], [s].[OrderID], [o3].[OrderID], [o3].[ProductID], [o3].[Discount], [o3].[Quantity], [o3].[UnitPrice] FROM ( SELECT [o0].[OrderID] FROM [Order Details] AS [o] @@ -1629,9 +1629,9 @@ CROSS JOIN [Orders] AS [o0] GROUP BY [o0].[OrderID] ) AS [s] LEFT JOIN ( - SELECT [s0].[OrderID], [s0].[CustomerID], [s0].[EmployeeID], [s0].[OrderDate], [s0].[OrderID0], [s0].[ProductID] + SELECT [s0].[OrderID], [s0].[CustomerID], [s0].[EmployeeID], [s0].[OrderDate] FROM ( - SELECT [o2].[OrderID], [o2].[CustomerID], [o2].[EmployeeID], [o2].[OrderDate], [o1].[OrderID] AS [OrderID0], [o1].[ProductID], ROW_NUMBER() OVER(PARTITION BY [o2].[OrderID] ORDER BY [o2].[OrderID]) AS [row] + SELECT [o2].[OrderID], [o2].[CustomerID], [o2].[EmployeeID], [o2].[OrderDate], ROW_NUMBER() OVER(PARTITION BY [o2].[OrderID] ORDER BY [o2].[OrderID]) AS [row] FROM [Order Details] AS [o1] CROSS JOIN [Orders] AS [o2] WHERE [o1].[OrderID] = 10248 @@ -1639,7 +1639,7 @@ CROSS JOIN [Orders] AS [o2] WHERE [s0].[row] <= 1 ) AS [s1] ON [s].[OrderID] = [s1].[OrderID] LEFT JOIN [Order Details] AS [o3] ON [s1].[OrderID] = [o3].[OrderID] -ORDER BY [s].[OrderID], [s1].[OrderID0], [s1].[ProductID], [s1].[OrderID], [o3].[OrderID] +ORDER BY [s].[OrderID], [o3].[OrderID] """); } diff --git a/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindIncludeQuerySqlServerTest.cs b/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindIncludeQuerySqlServerTest.cs index 580b59911c4..d1fa87f8633 100644 --- a/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindIncludeQuerySqlServerTest.cs +++ b/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindIncludeQuerySqlServerTest.cs @@ -37,7 +37,7 @@ FROM [Order Details] AS [o] INNER JOIN [Orders] AS [o0] ON [o].[OrderID] = [o0].[OrderID] ) AS [s] ON [p].[ProductID] = [s].[ProductID] WHERE [p].[ProductID] % 17 = 5 AND [p].[UnitPrice] < 20.0 -ORDER BY [p].[ProductID], [s].[OrderID], [s].[ProductID] +ORDER BY [p].[ProductID], [s].[OrderID] """); } @@ -170,7 +170,7 @@ 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] LIKE N'F%' -ORDER BY [o].[OrderID], [c].[CustomerID], [o0].[OrderID] +ORDER BY [o].[OrderID], [o0].[OrderID] """); } @@ -185,7 +185,7 @@ public void ToQueryString_for_include_reference_and_collection() 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] -ORDER BY [o].[OrderID], [c].[CustomerID], [o0].[OrderID] +ORDER BY [o].[OrderID], [o0].[OrderID] """, context.Set().Include(o => o.Customer).Include(o => o.OrderDetails).ToQueryString(), ignoreLineEndingDifferences: true, @@ -248,7 +248,7 @@ FROM [Order Details] AS [o] 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 -ORDER BY [o].[OrderID], [o].[ProductID], [o0].[OrderID], [c].[CustomerID] +ORDER BY [o].[OrderID], [o].[ProductID] """); } @@ -266,7 +266,7 @@ FROM [Orders] AS [o] WHERE [o].[OrderID] = 10248 ) AS [s] LEFT JOIN [Orders] AS [o0] ON [s].[CustomerID0] = [o0].[CustomerID] -ORDER BY [s].[OrderID], [s].[CustomerID0] +ORDER BY [s].[OrderID] """); } @@ -287,7 +287,7 @@ LEFT JOIN ( FROM [Order Details] AS [o0] INNER JOIN [Products] AS [p] ON [o0].[ProductID] = [p].[ProductID] ) AS [s] ON [o1].[OrderID] = [s].[OrderID] -ORDER BY [o1].[OrderID], [s].[OrderID], [s].[ProductID] +ORDER BY [o1].[OrderID], [s].[OrderID] """); } @@ -529,7 +529,7 @@ FROM [Order Details] AS [o0] ) AS [s] ON [o].[OrderID] = [s].[OrderID] ) AS [s0] ON [c].[CustomerID] = [s0].[CustomerID] WHERE [c].[CustomerID] LIKE N'F%' -ORDER BY [c].[CustomerID], [s0].[OrderID], [s0].[OrderID0], [s0].[ProductID] +ORDER BY [c].[CustomerID], [s0].[OrderID], [s0].[OrderID0] """); } @@ -1113,9 +1113,9 @@ public override async Task Include_collection_with_multiple_conditional_order_by """ @p='5' -SELECT [s].[OrderID], [s].[CustomerID], [s].[EmployeeID], [s].[OrderDate], [s].[CustomerID0], [o0].[OrderID], [o0].[ProductID], [o0].[Discount], [o0].[Quantity], [o0].[UnitPrice] +SELECT [s].[OrderID], [s].[CustomerID], [s].[EmployeeID], [s].[OrderDate], [o0].[OrderID], [o0].[ProductID], [o0].[Discount], [o0].[Quantity], [o0].[UnitPrice] FROM ( - SELECT TOP(@p) [o].[OrderID], [o].[CustomerID], [o].[EmployeeID], [o].[OrderDate], [c].[CustomerID] AS [CustomerID0], CASE + SELECT TOP(@p) [o].[OrderID], [o].[CustomerID], [o].[EmployeeID], [o].[OrderDate], CASE WHEN [o].[OrderID] > 0 THEN CAST(1 AS bit) ELSE CAST(0 AS bit) END AS [c], CASE @@ -1133,7 +1133,7 @@ ELSE N'' END ) AS [s] LEFT JOIN [Order Details] AS [o0] ON [s].[OrderID] = [o0].[OrderID] -ORDER BY [s].[c], [s].[c0], [s].[OrderID], [s].[CustomerID0], [o0].[OrderID] +ORDER BY [s].[c], [s].[c0], [s].[OrderID], [o0].[OrderID] """); } @@ -1207,7 +1207,7 @@ FROM [Orders] AS [o0] WHERE [o3].[row] <= 1 ) AS [o4] ON [o2].[OrderID] = [o4].[OrderID] LEFT JOIN [Order Details] AS [o1] ON [o4].[OrderID] = [o1].[OrderID] -ORDER BY [o2].[OrderID], [o4].[OrderID], [o1].[OrderID] +ORDER BY [o2].[OrderID], [o1].[OrderID] """); } @@ -1243,7 +1243,7 @@ public override async Task Include_collection_Join_GroupBy_Select(bool async) AssertSql( """ -SELECT [s1].[OrderID], [s1].[CustomerID], [s1].[EmployeeID], [s1].[OrderDate], [s].[OrderID], [s1].[OrderID0], [s1].[ProductID], [o3].[OrderID], [o3].[ProductID], [o3].[Discount], [o3].[Quantity], [o3].[UnitPrice] +SELECT [s1].[OrderID], [s1].[CustomerID], [s1].[EmployeeID], [s1].[OrderDate], [s].[OrderID], [o3].[OrderID], [o3].[ProductID], [o3].[Discount], [o3].[Quantity], [o3].[UnitPrice] FROM ( SELECT [o].[OrderID] FROM [Orders] AS [o] @@ -1252,9 +1252,9 @@ FROM [Orders] AS [o] GROUP BY [o].[OrderID] ) AS [s] LEFT JOIN ( - SELECT [s0].[OrderID], [s0].[CustomerID], [s0].[EmployeeID], [s0].[OrderDate], [s0].[OrderID0], [s0].[ProductID] + SELECT [s0].[OrderID], [s0].[CustomerID], [s0].[EmployeeID], [s0].[OrderDate] FROM ( - SELECT [o1].[OrderID], [o1].[CustomerID], [o1].[EmployeeID], [o1].[OrderDate], [o2].[OrderID] AS [OrderID0], [o2].[ProductID], ROW_NUMBER() OVER(PARTITION BY [o1].[OrderID] ORDER BY [o1].[OrderID]) AS [row] + SELECT [o1].[OrderID], [o1].[CustomerID], [o1].[EmployeeID], [o1].[OrderDate], ROW_NUMBER() OVER(PARTITION BY [o1].[OrderID] ORDER BY [o1].[OrderID]) AS [row] FROM [Orders] AS [o1] INNER JOIN [Order Details] AS [o2] ON [o1].[OrderID] = [o2].[OrderID] WHERE [o1].[OrderID] = 10248 @@ -1262,7 +1262,7 @@ FROM [Orders] AS [o1] WHERE [s0].[row] <= 1 ) AS [s1] ON [s].[OrderID] = [s1].[OrderID] LEFT JOIN [Order Details] AS [o3] ON [s1].[OrderID] = [o3].[OrderID] -ORDER BY [s].[OrderID], [s1].[OrderID], [s1].[OrderID0], [s1].[ProductID], [o3].[OrderID] +ORDER BY [s].[OrderID], [o3].[OrderID] """); } @@ -1300,7 +1300,7 @@ public override async Task Join_Include_collection_GroupBy_Select(bool async) AssertSql( """ -SELECT [s1].[OrderID], [s1].[CustomerID], [s1].[EmployeeID], [s1].[OrderDate], [s].[OrderID], [s1].[OrderID0], [s1].[ProductID], [o3].[OrderID], [o3].[ProductID], [o3].[Discount], [o3].[Quantity], [o3].[UnitPrice] +SELECT [s1].[OrderID], [s1].[CustomerID], [s1].[EmployeeID], [s1].[OrderDate], [s].[OrderID], [o3].[OrderID], [o3].[ProductID], [o3].[Discount], [o3].[Quantity], [o3].[UnitPrice] FROM ( SELECT [o0].[OrderID] FROM [Order Details] AS [o] @@ -1309,9 +1309,9 @@ FROM [Order Details] AS [o] GROUP BY [o0].[OrderID] ) AS [s] LEFT JOIN ( - SELECT [s0].[OrderID], [s0].[CustomerID], [s0].[EmployeeID], [s0].[OrderDate], [s0].[OrderID0], [s0].[ProductID] + SELECT [s0].[OrderID], [s0].[CustomerID], [s0].[EmployeeID], [s0].[OrderDate] FROM ( - SELECT [o2].[OrderID], [o2].[CustomerID], [o2].[EmployeeID], [o2].[OrderDate], [o1].[OrderID] AS [OrderID0], [o1].[ProductID], ROW_NUMBER() OVER(PARTITION BY [o2].[OrderID] ORDER BY [o2].[OrderID]) AS [row] + SELECT [o2].[OrderID], [o2].[CustomerID], [o2].[EmployeeID], [o2].[OrderDate], ROW_NUMBER() OVER(PARTITION BY [o2].[OrderID] ORDER BY [o2].[OrderID]) AS [row] FROM [Order Details] AS [o1] INNER JOIN [Orders] AS [o2] ON [o1].[OrderID] = [o2].[OrderID] WHERE [o1].[OrderID] = 10248 @@ -1319,7 +1319,7 @@ FROM [Order Details] AS [o1] WHERE [s0].[row] <= 1 ) AS [s1] ON [s].[OrderID] = [s1].[OrderID] LEFT JOIN [Order Details] AS [o3] ON [s1].[OrderID] = [o3].[OrderID] -ORDER BY [s].[OrderID], [s1].[OrderID0], [s1].[ProductID], [s1].[OrderID], [o3].[OrderID] +ORDER BY [s].[OrderID], [o3].[OrderID] """); } @@ -1355,7 +1355,7 @@ public override async Task Include_collection_SelectMany_GroupBy_Select(bool asy AssertSql( """ -SELECT [s1].[OrderID], [s1].[CustomerID], [s1].[EmployeeID], [s1].[OrderDate], [s].[OrderID], [s1].[OrderID0], [s1].[ProductID], [o3].[OrderID], [o3].[ProductID], [o3].[Discount], [o3].[Quantity], [o3].[UnitPrice] +SELECT [s1].[OrderID], [s1].[CustomerID], [s1].[EmployeeID], [s1].[OrderDate], [s].[OrderID], [o3].[OrderID], [o3].[ProductID], [o3].[Discount], [o3].[Quantity], [o3].[UnitPrice] FROM ( SELECT [o].[OrderID] FROM [Orders] AS [o] @@ -1364,9 +1364,9 @@ CROSS JOIN [Order Details] AS [o0] GROUP BY [o].[OrderID] ) AS [s] LEFT JOIN ( - SELECT [s0].[OrderID], [s0].[CustomerID], [s0].[EmployeeID], [s0].[OrderDate], [s0].[OrderID0], [s0].[ProductID] + SELECT [s0].[OrderID], [s0].[CustomerID], [s0].[EmployeeID], [s0].[OrderDate] FROM ( - SELECT [o1].[OrderID], [o1].[CustomerID], [o1].[EmployeeID], [o1].[OrderDate], [o2].[OrderID] AS [OrderID0], [o2].[ProductID], ROW_NUMBER() OVER(PARTITION BY [o1].[OrderID] ORDER BY [o1].[OrderID]) AS [row] + SELECT [o1].[OrderID], [o1].[CustomerID], [o1].[EmployeeID], [o1].[OrderDate], ROW_NUMBER() OVER(PARTITION BY [o1].[OrderID] ORDER BY [o1].[OrderID]) AS [row] FROM [Orders] AS [o1] CROSS JOIN [Order Details] AS [o2] WHERE [o1].[OrderID] = 10248 @@ -1374,7 +1374,7 @@ CROSS JOIN [Order Details] AS [o2] WHERE [s0].[row] <= 1 ) AS [s1] ON [s].[OrderID] = [s1].[OrderID] LEFT JOIN [Order Details] AS [o3] ON [s1].[OrderID] = [o3].[OrderID] -ORDER BY [s].[OrderID], [s1].[OrderID], [s1].[OrderID0], [s1].[ProductID], [o3].[OrderID] +ORDER BY [s].[OrderID], [o3].[OrderID] """); } @@ -1412,7 +1412,7 @@ public override async Task SelectMany_Include_collection_GroupBy_Select(bool asy AssertSql( """ -SELECT [s1].[OrderID], [s1].[CustomerID], [s1].[EmployeeID], [s1].[OrderDate], [s].[OrderID], [s1].[OrderID0], [s1].[ProductID], [o3].[OrderID], [o3].[ProductID], [o3].[Discount], [o3].[Quantity], [o3].[UnitPrice] +SELECT [s1].[OrderID], [s1].[CustomerID], [s1].[EmployeeID], [s1].[OrderDate], [s].[OrderID], [o3].[OrderID], [o3].[ProductID], [o3].[Discount], [o3].[Quantity], [o3].[UnitPrice] FROM ( SELECT [o0].[OrderID] FROM [Order Details] AS [o] @@ -1421,9 +1421,9 @@ CROSS JOIN [Orders] AS [o0] GROUP BY [o0].[OrderID] ) AS [s] LEFT JOIN ( - SELECT [s0].[OrderID], [s0].[CustomerID], [s0].[EmployeeID], [s0].[OrderDate], [s0].[OrderID0], [s0].[ProductID] + SELECT [s0].[OrderID], [s0].[CustomerID], [s0].[EmployeeID], [s0].[OrderDate] FROM ( - SELECT [o2].[OrderID], [o2].[CustomerID], [o2].[EmployeeID], [o2].[OrderDate], [o1].[OrderID] AS [OrderID0], [o1].[ProductID], ROW_NUMBER() OVER(PARTITION BY [o2].[OrderID] ORDER BY [o2].[OrderID]) AS [row] + SELECT [o2].[OrderID], [o2].[CustomerID], [o2].[EmployeeID], [o2].[OrderDate], ROW_NUMBER() OVER(PARTITION BY [o2].[OrderID] ORDER BY [o2].[OrderID]) AS [row] FROM [Order Details] AS [o1] CROSS JOIN [Orders] AS [o2] WHERE [o1].[OrderID] = 10248 @@ -1431,7 +1431,7 @@ CROSS JOIN [Orders] AS [o2] WHERE [s0].[row] <= 1 ) AS [s1] ON [s].[OrderID] = [s1].[OrderID] LEFT JOIN [Order Details] AS [o3] ON [s1].[OrderID] = [o3].[OrderID] -ORDER BY [s].[OrderID], [s1].[OrderID0], [s1].[ProductID], [s1].[OrderID], [o3].[OrderID] +ORDER BY [s].[OrderID], [o3].[OrderID] """); } @@ -1760,7 +1760,7 @@ FROM [Orders] AS [o] ) AS [o2] ON [c].[CustomerID] = [o2].[CustomerID] LEFT JOIN [Order Details] AS [o0] ON [o2].[OrderID] = [o0].[OrderID] WHERE [c].[CustomerID] LIKE N'F%' -ORDER BY [c].[CustomerID], [o2].[OrderID], [o0].[OrderID] +ORDER BY [c].[CustomerID], [o0].[OrderID] """); } @@ -1772,9 +1772,9 @@ public override async Task Repro9735(bool async) """ @p='2' -SELECT [s].[OrderID], [s].[CustomerID], [s].[EmployeeID], [s].[OrderDate], [s].[CustomerID0], [o0].[OrderID], [o0].[ProductID], [o0].[Discount], [o0].[Quantity], [o0].[UnitPrice] +SELECT [s].[OrderID], [s].[CustomerID], [s].[EmployeeID], [s].[OrderDate], [o0].[OrderID], [o0].[ProductID], [o0].[Discount], [o0].[Quantity], [o0].[UnitPrice] FROM ( - SELECT TOP(@p) [o].[OrderID], [o].[CustomerID], [o].[EmployeeID], [o].[OrderDate], [c].[CustomerID] AS [CustomerID0], CASE + SELECT TOP(@p) [o].[OrderID], [o].[CustomerID], [o].[EmployeeID], [o].[OrderDate], CASE WHEN [c].[CustomerID] IS NOT NULL THEN CAST(1 AS bit) ELSE CAST(0 AS bit) END AS [c], CASE @@ -1792,7 +1792,7 @@ ELSE N'' END ) AS [s] LEFT JOIN [Order Details] AS [o0] ON [s].[OrderID] = [o0].[OrderID] -ORDER BY [s].[c], [s].[c0], [s].[OrderID], [s].[CustomerID0], [o0].[OrderID] +ORDER BY [s].[c], [s].[c0], [s].[OrderID], [o0].[OrderID] """); } @@ -1823,14 +1823,14 @@ public override async Task Include_multiple_references_and_collection_multi_leve AssertSql( """ -SELECT [o].[OrderID], [o].[ProductID], [o].[Discount], [o].[Quantity], [o].[UnitPrice], [o0].[OrderID], [o0].[CustomerID], [o0].[EmployeeID], [o0].[OrderDate], [c].[CustomerID], [c].[Address], [c].[City], [c].[CompanyName], [c].[ContactName], [c].[ContactTitle], [c].[Country], [c].[Fax], [c].[Phone], [c].[PostalCode], [c].[Region], [p].[ProductID], [o1].[OrderID], [o1].[CustomerID], [o1].[EmployeeID], [o1].[OrderDate], [p].[Discontinued], [p].[ProductName], [p].[SupplierID], [p].[UnitPrice], [p].[UnitsInStock] +SELECT [o].[OrderID], [o].[ProductID], [o].[Discount], [o].[Quantity], [o].[UnitPrice], [o0].[OrderID], [o0].[CustomerID], [o0].[EmployeeID], [o0].[OrderDate], [c].[CustomerID], [c].[Address], [c].[City], [c].[CompanyName], [c].[ContactName], [c].[ContactTitle], [c].[Country], [c].[Fax], [c].[Phone], [c].[PostalCode], [c].[Region], [o1].[OrderID], [o1].[CustomerID], [o1].[EmployeeID], [o1].[OrderDate], [p].[ProductID], [p].[Discontinued], [p].[ProductName], [p].[SupplierID], [p].[UnitPrice], [p].[UnitsInStock] 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] LEFT JOIN [Orders] AS [o1] ON [c].[CustomerID] = [o1].[CustomerID] WHERE [o].[OrderID] % 23 = 13 -ORDER BY [o].[OrderID], [o].[ProductID], [o0].[OrderID], [c].[CustomerID], [p].[ProductID] +ORDER BY [o].[OrderID], [o].[ProductID] """); } @@ -1893,7 +1893,7 @@ FROM [Order Details] AS [o] INNER JOIN [Orders] AS [o0] ON [o].[OrderID] = [o0].[OrderID] ) AS [s] ON [p].[ProductID] = [s].[ProductID] WHERE [p].[ProductID] % 17 = 5 -ORDER BY [p].[ProductID], [s].[OrderID], [s].[ProductID] +ORDER BY [p].[ProductID], [s].[OrderID] """); } @@ -1922,7 +1922,7 @@ 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].[OrderID] < 10800 -ORDER BY [o].[OrderID], [c].[CustomerID] +ORDER BY [o].[OrderID] """); } @@ -1938,7 +1938,7 @@ FROM [Order Details] AS [o] 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) -ORDER BY [o].[OrderID], [o].[ProductID], [o0].[OrderID], [c].[CustomerID] +ORDER BY [o].[OrderID], [o].[ProductID] """); } @@ -1984,7 +1984,7 @@ FROM [Order Details] AS [o] 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 -ORDER BY [o].[OrderID], [o].[ProductID], [p].[ProductID], [o0].[OrderID], [c].[CustomerID] +ORDER BY [o].[OrderID], [o].[ProductID] """); } @@ -1999,7 +1999,7 @@ 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] LIKE N'F%' -ORDER BY [o].[OrderID], [c].[CustomerID] +ORDER BY [o].[OrderID] """); } @@ -2052,7 +2052,7 @@ 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] LIKE N'F%' -ORDER BY [o].[OrderID], [c].[CustomerID] +ORDER BY [o].[OrderID] """); } @@ -2062,12 +2062,12 @@ public override async Task Include_collection_and_reference(bool async) AssertSql( """ -SELECT [o].[OrderID], [o].[CustomerID], [o].[EmployeeID], [o].[OrderDate], [c].[CustomerID], [o0].[OrderID], [o0].[ProductID], [o0].[Discount], [o0].[Quantity], [o0].[UnitPrice], [c].[Address], [c].[City], [c].[CompanyName], [c].[ContactName], [c].[ContactTitle], [c].[Country], [c].[Fax], [c].[Phone], [c].[PostalCode], [c].[Region] +SELECT [o].[OrderID], [o].[CustomerID], [o].[EmployeeID], [o].[OrderDate], [o0].[OrderID], [o0].[ProductID], [o0].[Discount], [o0].[Quantity], [o0].[UnitPrice], [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] LEFT JOIN [Order Details] AS [o0] ON [o].[OrderID] = [o0].[OrderID] WHERE [o].[CustomerID] LIKE N'F%' -ORDER BY [o].[OrderID], [c].[CustomerID], [o0].[OrderID] +ORDER BY [o].[OrderID], [o0].[OrderID] """); } @@ -2082,7 +2082,7 @@ 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].[OrderID] < 10800 -ORDER BY [o].[OrderID], [c].[CustomerID] +ORDER BY [o].[OrderID] """); } @@ -2092,14 +2092,14 @@ public override async Task Include_multiple_references_then_include_collection_m AssertSql( """ -SELECT [o].[OrderID], [o].[ProductID], [o].[Discount], [o].[Quantity], [o].[UnitPrice], [o0].[OrderID], [o0].[CustomerID], [o0].[EmployeeID], [o0].[OrderDate], [c].[CustomerID], [c].[Address], [c].[City], [c].[CompanyName], [c].[ContactName], [c].[ContactTitle], [c].[Country], [c].[Fax], [c].[Phone], [c].[PostalCode], [c].[Region], [p].[ProductID], [o1].[OrderID], [o1].[CustomerID], [o1].[EmployeeID], [o1].[OrderDate], [p].[Discontinued], [p].[ProductName], [p].[SupplierID], [p].[UnitPrice], [p].[UnitsInStock] +SELECT [o].[OrderID], [o].[ProductID], [o].[Discount], [o].[Quantity], [o].[UnitPrice], [o0].[OrderID], [o0].[CustomerID], [o0].[EmployeeID], [o0].[OrderDate], [c].[CustomerID], [c].[Address], [c].[City], [c].[CompanyName], [c].[ContactName], [c].[ContactTitle], [c].[Country], [c].[Fax], [c].[Phone], [c].[PostalCode], [c].[Region], [o1].[OrderID], [o1].[CustomerID], [o1].[EmployeeID], [o1].[OrderDate], [p].[ProductID], [p].[Discontinued], [p].[ProductName], [p].[SupplierID], [p].[UnitPrice], [p].[UnitsInStock] 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] LEFT JOIN [Orders] AS [o1] ON [c].[CustomerID] = [o1].[CustomerID] WHERE [o].[OrderID] % 23 = 13 -ORDER BY [o].[OrderID], [o].[ProductID], [o0].[OrderID], [c].[CustomerID], [p].[ProductID] +ORDER BY [o].[OrderID], [o].[ProductID] """); } @@ -2115,7 +2115,7 @@ FROM [Order Details] AS [o] LEFT JOIN [Customers] AS [c] ON [o0].[CustomerID] = [c].[CustomerID] LEFT JOIN [Orders] AS [o1] ON [c].[CustomerID] = [o1].[CustomerID] WHERE [o].[OrderID] = 10248 -ORDER BY [o].[OrderID], [o].[ProductID], [o0].[OrderID], [c].[CustomerID] +ORDER BY [o].[OrderID], [o].[ProductID] """); } @@ -2131,7 +2131,7 @@ FROM [Order Details] AS [o] LEFT JOIN [Customers] AS [c] ON [o0].[CustomerID] = [c].[CustomerID] LEFT JOIN [Orders] AS [o1] ON [c].[CustomerID] = [o1].[CustomerID] WHERE [o].[OrderID] = 10248 -ORDER BY [o].[OrderID], [o].[ProductID], [o0].[OrderID], [c].[CustomerID] +ORDER BY [o].[OrderID], [o].[ProductID] """); } @@ -2149,7 +2149,7 @@ FROM [Orders] AS [o] WHERE [o].[OrderID] = 10248 ) AS [s] LEFT JOIN [Orders] AS [o0] ON [s].[CustomerID0] = [o0].[CustomerID] -ORDER BY [s].[OrderID], [s].[CustomerID0] +ORDER BY [s].[OrderID] """); } @@ -2194,7 +2194,7 @@ FROM [Order Details] AS [o] 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 -ORDER BY [o].[OrderID], [o].[ProductID], [p].[ProductID], [o0].[OrderID], [c].[CustomerID] +ORDER BY [o].[OrderID], [o].[ProductID] """); } diff --git a/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindJoinQuerySqlServerTest.cs b/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindJoinQuerySqlServerTest.cs index 5af43749bcc..d13e82df986 100644 --- a/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindJoinQuerySqlServerTest.cs +++ b/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindJoinQuerySqlServerTest.cs @@ -362,7 +362,7 @@ public override async Task Unflattened_GroupJoin_composed_2(bool async) AssertSql( """ -SELECT [c].[CustomerID], [c].[Address], [c].[City], [c].[CompanyName], [c].[ContactName], [c].[ContactTitle], [c].[Country], [c].[Fax], [c].[Phone], [c].[PostalCode], [c].[Region], [c1].[CustomerID], [o].[OrderID], [o].[CustomerID], [o].[EmployeeID], [o].[OrderDate], [c1].[Address], [c1].[City], [c1].[CompanyName], [c1].[ContactName], [c1].[ContactTitle], [c1].[Country], [c1].[Fax], [c1].[Phone], [c1].[PostalCode], [c1].[Region] +SELECT [c].[CustomerID], [c].[Address], [c].[City], [c].[CompanyName], [c].[ContactName], [c].[ContactTitle], [c].[Country], [c].[Fax], [c].[Phone], [c].[PostalCode], [c].[Region], [o].[OrderID], [o].[CustomerID], [o].[EmployeeID], [o].[OrderDate], [c1].[CustomerID], [c1].[Address], [c1].[City], [c1].[CompanyName], [c1].[ContactName], [c1].[ContactTitle], [c1].[Country], [c1].[Fax], [c1].[Phone], [c1].[PostalCode], [c1].[Region] FROM [Customers] AS [c] INNER JOIN ( SELECT [c0].[CustomerID], [c0].[Address], [c0].[City], [c0].[CompanyName], [c0].[ContactName], [c0].[ContactTitle], [c0].[Country], [c0].[Fax], [c0].[Phone], [c0].[PostalCode], [c0].[Region] @@ -371,7 +371,7 @@ FROM [Customers] AS [c0] ) AS [c1] ON [c].[CustomerID] = [c1].[CustomerID] LEFT JOIN [Orders] AS [o] ON [c].[CustomerID] = [o].[CustomerID] WHERE [c].[CustomerID] LIKE N'F%' -ORDER BY [c].[CustomerID], [c1].[CustomerID] +ORDER BY [c].[CustomerID] """); } @@ -907,7 +907,7 @@ public override async Task Take_in_collection_projection_with_FirstOrDefault_on_ AssertSql( """ -SELECT [c1].[CustomerID], [s].[Title], [s].[OrderID], [s].[CustomerID] +SELECT [c1].[CustomerID], [s].[Title], [s].[OrderID] FROM ( SELECT TOP(1) [c].[CustomerID] FROM [Customers] AS [c] @@ -916,7 +916,7 @@ OUTER APPLY ( SELECT CASE WHEN [o0].[CustomerID] = [c0].[City] OR ([o0].[CustomerID] IS NULL AND [c0].[City] IS NULL) THEN N'A' ELSE N'B' - END AS [Title], [o0].[OrderID], [c0].[CustomerID], [o0].[OrderDate] + END AS [Title], [o0].[OrderID], [o0].[OrderDate] FROM ( SELECT TOP(1) [o].[OrderID], [o].[CustomerID], [o].[OrderDate] FROM [Orders] AS [o] @@ -925,7 +925,7 @@ ORDER BY [o].[OrderDate] ) AS [o0] LEFT JOIN [Customers] AS [c0] ON [o0].[CustomerID] = [c0].[CustomerID] ) AS [s] -ORDER BY [c1].[CustomerID], [s].[OrderDate], [s].[OrderID] +ORDER BY [c1].[CustomerID], [s].[OrderDate] """); } diff --git a/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindMiscellaneousQuerySqlServerTest.cs b/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindMiscellaneousQuerySqlServerTest.cs index 8104a760aa1..2eb43292c1a 100644 --- a/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindMiscellaneousQuerySqlServerTest.cs +++ b/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindMiscellaneousQuerySqlServerTest.cs @@ -5949,7 +5949,7 @@ FROM [Orders] AS [o] LEFT JOIN [Customers] AS [c0] ON [o].[CustomerID] = [c0].[CustomerID] WHERE [c].[CustomerID] = [o].[CustomerID] ) AS [s] -ORDER BY [c].[CustomerID], [s].[First], [s].[Second] +ORDER BY [c].[CustomerID] """); } diff --git a/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindNavigationsQuerySqlServerTest.cs b/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindNavigationsQuerySqlServerTest.cs index fd188f8f064..bfeae0b8e99 100644 --- a/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindNavigationsQuerySqlServerTest.cs +++ b/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindNavigationsQuerySqlServerTest.cs @@ -477,12 +477,12 @@ public override async Task Select_collection_navigation_multi_part(bool async) AssertSql( """ -SELECT [o].[OrderID], [c].[CustomerID], [o0].[OrderID], [o0].[CustomerID], [o0].[EmployeeID], [o0].[OrderDate] +SELECT [o].[OrderID], [o0].[OrderID], [o0].[CustomerID], [o0].[EmployeeID], [o0].[OrderDate] 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] = N'ALFKI' -ORDER BY [o].[OrderID], [c].[CustomerID] +ORDER BY [o].[OrderID] """); } @@ -492,13 +492,13 @@ public override async Task Select_collection_navigation_multi_part2(bool async) AssertSql( """ -SELECT [o].[OrderID], [o].[ProductID], [o0].[OrderID], [c].[CustomerID], [o1].[OrderID], [o1].[CustomerID], [o1].[EmployeeID], [o1].[OrderDate] +SELECT [o].[OrderID], [o].[ProductID], [o1].[OrderID], [o1].[CustomerID], [o1].[EmployeeID], [o1].[OrderDate] 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 [o0].[CustomerID] IN (N'ALFKI', N'ANTON') -ORDER BY [o].[OrderID], [o].[ProductID], [o0].[OrderID], [c].[CustomerID] +ORDER BY [o].[OrderID], [o].[ProductID] """); } @@ -789,7 +789,7 @@ FROM [Customers] AS [c] LEFT JOIN ( SELECT [s].[CustomerID], [s].[Address], [s].[City], [s].[CompanyName], [s].[ContactName], [s].[ContactTitle], [s].[Country], [s].[Fax], [s].[Phone], [s].[PostalCode], [s].[Region], [s].[CustomerID0] FROM ( - SELECT [c0].[CustomerID], [c0].[Address], [c0].[City], [c0].[CompanyName], [c0].[ContactName], [c0].[ContactTitle], [c0].[Country], [c0].[Fax], [c0].[Phone], [c0].[PostalCode], [c0].[Region], [o].[CustomerID] AS [CustomerID0], ROW_NUMBER() OVER(PARTITION BY [o].[CustomerID] ORDER BY [o].[OrderID], [c0].[CustomerID]) AS [row] + SELECT [c0].[CustomerID], [c0].[Address], [c0].[City], [c0].[CompanyName], [c0].[ContactName], [c0].[ContactTitle], [c0].[Country], [c0].[Fax], [c0].[Phone], [c0].[PostalCode], [c0].[Region], [o].[CustomerID] AS [CustomerID0], ROW_NUMBER() OVER(PARTITION BY [o].[CustomerID] ORDER BY [o].[OrderID]) AS [row] FROM [Orders] AS [o] LEFT JOIN [Customers] AS [c0] ON [o].[CustomerID] = [c0].[CustomerID] WHERE [o].[OrderID] IN (@orderIds1, @orderIds2, @orderIds3, @orderIds4, @orderIds5, @orderIds6, @orderIds7, @orderIds8, @orderIds9, @orderIds10) diff --git a/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindQueryFiltersQuerySqlServerTest.cs b/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindQueryFiltersQuerySqlServerTest.cs index 80ea474b33b..454be9b4098 100644 --- a/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindQueryFiltersQuerySqlServerTest.cs +++ b/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindQueryFiltersQuerySqlServerTest.cs @@ -138,10 +138,10 @@ public override async Task Include_query(bool async) """ @ef_filter__TenantPrefix_startswith='B%' (Size = 40) -SELECT [c].[CustomerID], [c].[Address], [c].[City], [c].[CompanyName], [c].[ContactName], [c].[ContactTitle], [c].[Country], [c].[Fax], [c].[Phone], [c].[PostalCode], [c].[Region], [s].[OrderID], [s].[CustomerID], [s].[EmployeeID], [s].[OrderDate], [s].[CustomerID0] +SELECT [c].[CustomerID], [c].[Address], [c].[City], [c].[CompanyName], [c].[ContactName], [c].[ContactTitle], [c].[Country], [c].[Fax], [c].[Phone], [c].[PostalCode], [c].[Region], [s].[OrderID], [s].[CustomerID], [s].[EmployeeID], [s].[OrderDate] FROM [Customers] AS [c] LEFT JOIN ( - SELECT [o].[OrderID], [o].[CustomerID], [o].[EmployeeID], [o].[OrderDate], [c1].[CustomerID] AS [CustomerID0] + SELECT [o].[OrderID], [o].[CustomerID], [o].[EmployeeID], [o].[OrderDate] FROM [Orders] AS [o] LEFT JOIN ( SELECT [c0].[CustomerID], [c0].[CompanyName] @@ -151,7 +151,7 @@ WHERE [c0].[CompanyName] LIKE @ef_filter__TenantPrefix_startswith ESCAPE N'\' WHERE [c1].[CustomerID] IS NOT NULL AND [c1].[CompanyName] IS NOT NULL ) AS [s] ON [c].[CustomerID] = [s].[CustomerID] WHERE [c].[CompanyName] LIKE @ef_filter__TenantPrefix_startswith ESCAPE N'\' -ORDER BY [c].[CustomerID], [s].[OrderID] +ORDER BY [c].[CustomerID] """); } diff --git a/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindSelectQuerySqlServerTest.cs b/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindSelectQuerySqlServerTest.cs index 495b6b3bd72..23924f7fe9c 100644 --- a/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindSelectQuerySqlServerTest.cs +++ b/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindSelectQuerySqlServerTest.cs @@ -1501,11 +1501,11 @@ public override async Task Select_chained_entity_navigation_doesnt_materialize_i AssertSql( """ -SELECT [o].[OrderID], [c].[CustomerID], [o0].[OrderID], [o0].[CustomerID], [o0].[EmployeeID], [o0].[OrderDate] +SELECT [o].[OrderID], [o0].[OrderID], [o0].[CustomerID], [o0].[EmployeeID], [o0].[OrderDate] FROM [Orders] AS [o] LEFT JOIN [Customers] AS [c] ON [o].[CustomerID] = [c].[CustomerID] LEFT JOIN [Orders] AS [o0] ON [c].[CustomerID] = [o0].[CustomerID] -ORDER BY [o].[OrderID], [c].[CustomerID] +ORDER BY [o].[OrderID] """); } @@ -2126,7 +2126,7 @@ public override async Task Do_not_erase_projection_mapping_when_adding_single_pr AssertSql( """ -SELECT [o].[OrderID], [o].[CustomerID], [o].[EmployeeID], [o].[OrderDate], [s].[OrderID], [s].[ProductID], [s].[Discount], [s].[Quantity], [s].[UnitPrice], [s].[ProductID0], [s].[Discontinued], [s].[ProductName], [s].[SupplierID], [s].[UnitPrice0], [s].[UnitsInStock], [s1].[OrderID], [s1].[ProductID], [s1].[ProductID0], [s2].[OrderID], [s2].[ProductID], [s2].[Discount], [s2].[Quantity], [s2].[UnitPrice], [s2].[ProductID0], [s2].[Discontinued], [s2].[ProductName], [s2].[SupplierID], [s2].[UnitPrice0], [s2].[UnitsInStock], [s1].[Discount], [s1].[Quantity], [s1].[UnitPrice], [s1].[Discontinued], [s1].[ProductName], [s1].[SupplierID], [s1].[UnitPrice0], [s1].[UnitsInStock] +SELECT [o].[OrderID], [o].[CustomerID], [o].[EmployeeID], [o].[OrderDate], [s].[OrderID], [s].[ProductID], [s].[Discount], [s].[Quantity], [s].[UnitPrice], [s].[ProductID0], [s].[Discontinued], [s].[ProductName], [s].[SupplierID], [s].[UnitPrice0], [s].[UnitsInStock], [s2].[OrderID], [s2].[ProductID], [s2].[Discount], [s2].[Quantity], [s2].[UnitPrice], [s2].[ProductID0], [s2].[Discontinued], [s2].[ProductName], [s2].[SupplierID], [s2].[UnitPrice0], [s2].[UnitsInStock], [s1].[OrderID], [s1].[ProductID], [s1].[Discount], [s1].[Quantity], [s1].[UnitPrice], [s1].[ProductID0], [s1].[Discontinued], [s1].[ProductName], [s1].[SupplierID], [s1].[UnitPrice0], [s1].[UnitsInStock] FROM [Orders] AS [o] LEFT JOIN ( SELECT [o0].[OrderID], [o0].[ProductID], [o0].[Discount], [o0].[Quantity], [o0].[UnitPrice], [p].[ProductID] AS [ProductID0], [p].[Discontinued], [p].[ProductName], [p].[SupplierID], [p].[UnitPrice] AS [UnitPrice0], [p].[UnitsInStock] @@ -2136,7 +2136,7 @@ FROM [Order Details] AS [o0] LEFT JOIN ( SELECT [s0].[OrderID], [s0].[ProductID], [s0].[Discount], [s0].[Quantity], [s0].[UnitPrice], [s0].[ProductID0], [s0].[Discontinued], [s0].[ProductName], [s0].[SupplierID], [s0].[UnitPrice0], [s0].[UnitsInStock] FROM ( - SELECT [o1].[OrderID], [o1].[ProductID], [o1].[Discount], [o1].[Quantity], [o1].[UnitPrice], [p0].[ProductID] AS [ProductID0], [p0].[Discontinued], [p0].[ProductName], [p0].[SupplierID], [p0].[UnitPrice] AS [UnitPrice0], [p0].[UnitsInStock], ROW_NUMBER() OVER(PARTITION BY [o1].[OrderID] ORDER BY [o1].[OrderID], [o1].[ProductID], [p0].[ProductID]) AS [row] + SELECT [o1].[OrderID], [o1].[ProductID], [o1].[Discount], [o1].[Quantity], [o1].[UnitPrice], [p0].[ProductID] AS [ProductID0], [p0].[Discontinued], [p0].[ProductName], [p0].[SupplierID], [p0].[UnitPrice] AS [UnitPrice0], [p0].[UnitsInStock], ROW_NUMBER() OVER(PARTITION BY [o1].[OrderID] ORDER BY [o1].[OrderID], [o1].[ProductID]) AS [row] FROM [Order Details] AS [o1] INNER JOIN [Products] AS [p0] ON [o1].[ProductID] = [p0].[ProductID] WHERE [o1].[UnitPrice] > 10.0 @@ -2150,7 +2150,7 @@ FROM [Order Details] AS [o2] WHERE [o2].[UnitPrice] < 10.0 ) AS [s2] ON [o].[OrderID] = [s2].[OrderID] WHERE [o].[OrderID] < 10350 -ORDER BY [o].[OrderID], [s].[OrderID], [s].[ProductID], [s].[ProductID0], [s1].[OrderID], [s1].[ProductID], [s1].[ProductID0], [s2].[OrderID], [s2].[ProductID] +ORDER BY [o].[OrderID], [s].[OrderID], [s].[ProductID], [s2].[OrderID] """); } @@ -2361,7 +2361,7 @@ FROM [Orders] AS [o1] ) AS [o4] ON [c].[CustomerID] = [o4].[CustomerID] LEFT JOIN [Order Details] AS [o2] ON [o4].[OrderID] = [o2].[OrderID] WHERE [c].[CustomerID] LIKE N'F%' -ORDER BY [c].[CustomerID], [s].[OrderID], [s].[OrderID0], [s].[ProductID], [o4].[OrderID], [o2].[OrderID] +ORDER BY [c].[CustomerID], [s].[OrderID], [s].[OrderID0], [s].[ProductID], [o2].[OrderID] """); } @@ -2417,7 +2417,7 @@ OFFSET 0 ROWS FETCH NEXT 10 ROWS ONLY ) AS [o1] INNER JOIN [Products] AS [p] ON [o1].[ProductID] = [p].[ProductID] ) AS [s] -ORDER BY [o2].[OrderID], [s].[OrderID] DESC, [s].[ProductID0] +ORDER BY [o2].[OrderID], [s].[OrderID] DESC """); } @@ -2427,7 +2427,7 @@ public override async Task Take_on_correlated_collection_in_first(bool async) AssertSql( """ -SELECT [c1].[CustomerID], [s].[Title], [s].[OrderID], [s].[CustomerID] +SELECT [c1].[CustomerID], [s].[Title], [s].[OrderID] FROM ( SELECT TOP(1) [c].[CustomerID] FROM [Customers] AS [c] @@ -2438,7 +2438,7 @@ OUTER APPLY ( SELECT CASE WHEN [o0].[CustomerID] = [c0].[CustomerID] OR ([o0].[CustomerID] IS NULL AND [c0].[CustomerID] IS NULL) THEN N'A' ELSE N'B' - END AS [Title], [o0].[OrderID], [c0].[CustomerID], [o0].[OrderDate] + END AS [Title], [o0].[OrderID], [o0].[OrderDate] FROM ( SELECT TOP(1) [o].[OrderID], [o].[CustomerID], [o].[OrderDate] FROM [Orders] AS [o] @@ -2447,7 +2447,7 @@ ORDER BY [o].[OrderDate] ) AS [o0] LEFT JOIN [Customers] AS [c0] ON [o0].[CustomerID] = [c0].[CustomerID] ) AS [s] -ORDER BY [c1].[CustomerID], [s].[OrderDate], [s].[OrderID] +ORDER BY [c1].[CustomerID], [s].[OrderDate] """); } @@ -2797,7 +2797,7 @@ public override async Task List_from_result_of_single_result_3(bool async) AssertSql( """ -SELECT [c0].[CustomerID], [o2].[OrderID], [o0].[ProductID], [o0].[OrderID], [o2].[c] +SELECT [c0].[CustomerID], [o0].[ProductID], [o0].[OrderID], [o2].[c] FROM ( SELECT TOP(1) [c].[CustomerID] FROM [Customers] AS [c] @@ -2812,7 +2812,7 @@ FROM [Orders] AS [o] WHERE [o1].[row] <= 1 ) AS [o2] ON [c0].[CustomerID] = [o2].[CustomerID] LEFT JOIN [Order Details] AS [o0] ON [o2].[OrderID] = [o0].[OrderID] -ORDER BY [c0].[CustomerID], [o2].[OrderID], [o0].[OrderID] +ORDER BY [c0].[CustomerID], [o0].[OrderID] """); } diff --git a/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindSplitIncludeNoTrackingQuerySqlServerTest.cs b/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindSplitIncludeNoTrackingQuerySqlServerTest.cs index a8a8a1193a3..8344bf4842b 100644 --- a/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindSplitIncludeNoTrackingQuerySqlServerTest.cs +++ b/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindSplitIncludeNoTrackingQuerySqlServerTest.cs @@ -516,16 +516,15 @@ public override async Task Include_collection_and_reference(bool async) FROM [Orders] AS [o] LEFT JOIN [Customers] AS [c] ON [o].[CustomerID] = [c].[CustomerID] WHERE [o].[CustomerID] LIKE N'F%' -ORDER BY [o].[OrderID], [c].[CustomerID] +ORDER BY [o].[OrderID] """, // """ -SELECT [o0].[OrderID], [o0].[ProductID], [o0].[Discount], [o0].[Quantity], [o0].[UnitPrice], [o].[OrderID], [c].[CustomerID] +SELECT [o0].[OrderID], [o0].[ProductID], [o0].[Discount], [o0].[Quantity], [o0].[UnitPrice], [o].[OrderID] 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] LIKE N'F%' -ORDER BY [o].[OrderID], [c].[CustomerID] +ORDER BY [o].[OrderID] """); } @@ -537,7 +536,7 @@ public override async Task Include_collection_with_multiple_conditional_order_by """ @p='5' -SELECT TOP(@p) [o].[OrderID], [o].[CustomerID], [o].[EmployeeID], [o].[OrderDate], [c].[CustomerID] +SELECT TOP(@p) [o].[OrderID], [o].[CustomerID], [o].[EmployeeID], [o].[OrderDate] FROM [Orders] AS [o] LEFT JOIN [Customers] AS [c] ON [o].[CustomerID] = [c].[CustomerID] ORDER BY CASE @@ -546,15 +545,15 @@ ELSE CAST(0 AS bit) END, CASE WHEN [c].[CustomerID] IS NOT NULL THEN [c].[City] ELSE N'' -END, [o].[OrderID], [c].[CustomerID] +END, [o].[OrderID] """, // """ @p='5' -SELECT [o0].[OrderID], [o0].[ProductID], [o0].[Discount], [o0].[Quantity], [o0].[UnitPrice], [s].[OrderID], [s].[CustomerID] +SELECT [o0].[OrderID], [o0].[ProductID], [o0].[Discount], [o0].[Quantity], [o0].[UnitPrice], [s].[OrderID] FROM ( - SELECT TOP(@p) [o].[OrderID], [c].[CustomerID], CASE + SELECT TOP(@p) [o].[OrderID], CASE WHEN [o].[OrderID] > 0 THEN CAST(1 AS bit) ELSE CAST(0 AS bit) END AS [c], CASE @@ -569,10 +568,10 @@ ELSE CAST(0 AS bit) END, CASE WHEN [c].[CustomerID] IS NOT NULL THEN [c].[City] ELSE N'' - END, [o].[OrderID], [c].[CustomerID] + END, [o].[OrderID] ) AS [s] INNER JOIN [Order Details] AS [o0] ON [s].[OrderID] = [o0].[OrderID] -ORDER BY [s].[c], [s].[c0], [s].[OrderID], [s].[CustomerID] +ORDER BY [s].[c], [s].[c0], [s].[OrderID] """); } @@ -620,11 +619,11 @@ FROM [Orders] AS [o0] ) AS [o2] WHERE [o2].[row] <= 1 ) AS [o3] ON [o1].[OrderID] = [o3].[OrderID] -ORDER BY [o1].[OrderID], [o3].[OrderID] +ORDER BY [o1].[OrderID] """, // """ -SELECT [o6].[OrderID], [o6].[ProductID], [o6].[Discount], [o6].[Quantity], [o6].[UnitPrice], [o7].[OrderID], [o9].[OrderID] +SELECT [o6].[OrderID], [o6].[ProductID], [o6].[Discount], [o6].[Quantity], [o6].[UnitPrice], [o7].[OrderID] FROM ( SELECT [o].[OrderID] FROM [Orders] AS [o] @@ -641,7 +640,7 @@ FROM [Orders] AS [o5] WHERE [o8].[row] <= 1 ) AS [o9] ON [o7].[OrderID] = [o9].[OrderID] INNER JOIN [Order Details] AS [o6] ON [o9].[OrderID] = [o6].[OrderID] -ORDER BY [o7].[OrderID], [o9].[OrderID] +ORDER BY [o7].[OrderID] """); } @@ -651,7 +650,7 @@ public override async Task Join_Include_collection_GroupBy_Select(bool async) AssertSql( """ -SELECT [s1].[OrderID], [s1].[CustomerID], [s1].[EmployeeID], [s1].[OrderDate], [s].[OrderID], [s1].[OrderID0], [s1].[ProductID] +SELECT [s1].[OrderID], [s1].[CustomerID], [s1].[EmployeeID], [s1].[OrderDate], [s].[OrderID] FROM ( SELECT [o0].[OrderID] FROM [Order Details] AS [o] @@ -660,20 +659,20 @@ FROM [Order Details] AS [o] GROUP BY [o0].[OrderID] ) AS [s] LEFT JOIN ( - SELECT [s0].[OrderID], [s0].[CustomerID], [s0].[EmployeeID], [s0].[OrderDate], [s0].[OrderID0], [s0].[ProductID] + SELECT [s0].[OrderID], [s0].[CustomerID], [s0].[EmployeeID], [s0].[OrderDate] FROM ( - SELECT [o2].[OrderID], [o2].[CustomerID], [o2].[EmployeeID], [o2].[OrderDate], [o1].[OrderID] AS [OrderID0], [o1].[ProductID], ROW_NUMBER() OVER(PARTITION BY [o2].[OrderID] ORDER BY [o2].[OrderID]) AS [row] + SELECT [o2].[OrderID], [o2].[CustomerID], [o2].[EmployeeID], [o2].[OrderDate], ROW_NUMBER() OVER(PARTITION BY [o2].[OrderID] ORDER BY [o2].[OrderID]) AS [row] FROM [Order Details] AS [o1] INNER JOIN [Orders] AS [o2] ON [o1].[OrderID] = [o2].[OrderID] WHERE [o1].[OrderID] = 10248 ) AS [s0] WHERE [s0].[row] <= 1 ) AS [s1] ON [s].[OrderID] = [s1].[OrderID] -ORDER BY [s].[OrderID], [s1].[OrderID0], [s1].[ProductID], [s1].[OrderID] +ORDER BY [s].[OrderID] """, // """ -SELECT [o11].[OrderID], [o11].[ProductID], [o11].[Discount], [o11].[Quantity], [o11].[UnitPrice], [s].[OrderID], [s1].[OrderID0], [s1].[ProductID], [s1].[OrderID] +SELECT [o11].[OrderID], [o11].[ProductID], [o11].[Discount], [o11].[Quantity], [o11].[UnitPrice], [s].[OrderID] FROM ( SELECT [o0].[OrderID] FROM [Order Details] AS [o] @@ -682,9 +681,9 @@ FROM [Order Details] AS [o] GROUP BY [o0].[OrderID] ) AS [s] LEFT JOIN ( - SELECT [s0].[OrderID], [s0].[OrderID0], [s0].[ProductID] + SELECT [s0].[OrderID] FROM ( - SELECT [o10].[OrderID], [o9].[OrderID] AS [OrderID0], [o9].[ProductID], ROW_NUMBER() OVER(PARTITION BY [o10].[OrderID] ORDER BY [o10].[OrderID]) AS [row] + SELECT [o10].[OrderID], ROW_NUMBER() OVER(PARTITION BY [o10].[OrderID] ORDER BY [o10].[OrderID]) AS [row] FROM [Order Details] AS [o9] INNER JOIN [Orders] AS [o10] ON [o9].[OrderID] = [o10].[OrderID] WHERE [o9].[OrderID] = 10248 @@ -692,7 +691,7 @@ FROM [Order Details] AS [o9] WHERE [s0].[row] <= 1 ) AS [s1] ON [s].[OrderID] = [s1].[OrderID] INNER JOIN [Order Details] AS [o11] ON [s1].[OrderID] = [o11].[OrderID] -ORDER BY [s].[OrderID], [s1].[OrderID0], [s1].[ProductID], [s1].[OrderID] +ORDER BY [s].[OrderID] """); } @@ -810,7 +809,7 @@ public override async Task SelectMany_Include_collection_GroupBy_Select(bool asy AssertSql( """ -SELECT [s1].[OrderID], [s1].[CustomerID], [s1].[EmployeeID], [s1].[OrderDate], [s].[OrderID], [s1].[OrderID0], [s1].[ProductID] +SELECT [s1].[OrderID], [s1].[CustomerID], [s1].[EmployeeID], [s1].[OrderDate], [s].[OrderID] FROM ( SELECT [o0].[OrderID] FROM [Order Details] AS [o] @@ -819,20 +818,20 @@ CROSS JOIN [Orders] AS [o0] GROUP BY [o0].[OrderID] ) AS [s] LEFT JOIN ( - SELECT [s0].[OrderID], [s0].[CustomerID], [s0].[EmployeeID], [s0].[OrderDate], [s0].[OrderID0], [s0].[ProductID] + SELECT [s0].[OrderID], [s0].[CustomerID], [s0].[EmployeeID], [s0].[OrderDate] FROM ( - SELECT [o2].[OrderID], [o2].[CustomerID], [o2].[EmployeeID], [o2].[OrderDate], [o1].[OrderID] AS [OrderID0], [o1].[ProductID], ROW_NUMBER() OVER(PARTITION BY [o2].[OrderID] ORDER BY [o2].[OrderID]) AS [row] + SELECT [o2].[OrderID], [o2].[CustomerID], [o2].[EmployeeID], [o2].[OrderDate], ROW_NUMBER() OVER(PARTITION BY [o2].[OrderID] ORDER BY [o2].[OrderID]) AS [row] FROM [Order Details] AS [o1] CROSS JOIN [Orders] AS [o2] WHERE [o1].[OrderID] = 10248 ) AS [s0] WHERE [s0].[row] <= 1 ) AS [s1] ON [s].[OrderID] = [s1].[OrderID] -ORDER BY [s].[OrderID], [s1].[OrderID0], [s1].[ProductID], [s1].[OrderID] +ORDER BY [s].[OrderID] """, // """ -SELECT [o11].[OrderID], [o11].[ProductID], [o11].[Discount], [o11].[Quantity], [o11].[UnitPrice], [s].[OrderID], [s1].[OrderID0], [s1].[ProductID], [s1].[OrderID] +SELECT [o11].[OrderID], [o11].[ProductID], [o11].[Discount], [o11].[Quantity], [o11].[UnitPrice], [s].[OrderID] FROM ( SELECT [o0].[OrderID] FROM [Order Details] AS [o] @@ -841,9 +840,9 @@ CROSS JOIN [Orders] AS [o0] GROUP BY [o0].[OrderID] ) AS [s] LEFT JOIN ( - SELECT [s0].[OrderID], [s0].[OrderID0], [s0].[ProductID] + SELECT [s0].[OrderID] FROM ( - SELECT [o10].[OrderID], [o9].[OrderID] AS [OrderID0], [o9].[ProductID], ROW_NUMBER() OVER(PARTITION BY [o10].[OrderID] ORDER BY [o10].[OrderID]) AS [row] + SELECT [o10].[OrderID], ROW_NUMBER() OVER(PARTITION BY [o10].[OrderID] ORDER BY [o10].[OrderID]) AS [row] FROM [Order Details] AS [o9] CROSS JOIN [Orders] AS [o10] WHERE [o9].[OrderID] = 10248 @@ -851,7 +850,7 @@ CROSS JOIN [Orders] AS [o10] WHERE [s0].[row] <= 1 ) AS [s1] ON [s].[OrderID] = [s1].[OrderID] INNER JOIN [Order Details] AS [o11] ON [s1].[OrderID] = [o11].[OrderID] -ORDER BY [s].[OrderID], [s1].[OrderID0], [s1].[ProductID], [s1].[OrderID] +ORDER BY [s].[OrderID] """); } @@ -875,7 +874,7 @@ public override async Task Include_collection_SelectMany_GroupBy_Select(bool asy AssertSql( """ -SELECT [s1].[OrderID], [s1].[CustomerID], [s1].[EmployeeID], [s1].[OrderDate], [s].[OrderID], [s1].[OrderID0], [s1].[ProductID] +SELECT [s1].[OrderID], [s1].[CustomerID], [s1].[EmployeeID], [s1].[OrderDate], [s].[OrderID] FROM ( SELECT [o].[OrderID] FROM [Orders] AS [o] @@ -884,20 +883,20 @@ CROSS JOIN [Order Details] AS [o0] GROUP BY [o].[OrderID] ) AS [s] LEFT JOIN ( - SELECT [s0].[OrderID], [s0].[CustomerID], [s0].[EmployeeID], [s0].[OrderDate], [s0].[OrderID0], [s0].[ProductID] + SELECT [s0].[OrderID], [s0].[CustomerID], [s0].[EmployeeID], [s0].[OrderDate] FROM ( - SELECT [o1].[OrderID], [o1].[CustomerID], [o1].[EmployeeID], [o1].[OrderDate], [o2].[OrderID] AS [OrderID0], [o2].[ProductID], ROW_NUMBER() OVER(PARTITION BY [o1].[OrderID] ORDER BY [o1].[OrderID]) AS [row] + SELECT [o1].[OrderID], [o1].[CustomerID], [o1].[EmployeeID], [o1].[OrderDate], ROW_NUMBER() OVER(PARTITION BY [o1].[OrderID] ORDER BY [o1].[OrderID]) AS [row] FROM [Orders] AS [o1] CROSS JOIN [Order Details] AS [o2] WHERE [o1].[OrderID] = 10248 ) AS [s0] WHERE [s0].[row] <= 1 ) AS [s1] ON [s].[OrderID] = [s1].[OrderID] -ORDER BY [s].[OrderID], [s1].[OrderID], [s1].[OrderID0], [s1].[ProductID] +ORDER BY [s].[OrderID] """, // """ -SELECT [o11].[OrderID], [o11].[ProductID], [o11].[Discount], [o11].[Quantity], [o11].[UnitPrice], [s].[OrderID], [s1].[OrderID], [s1].[OrderID0], [s1].[ProductID] +SELECT [o11].[OrderID], [o11].[ProductID], [o11].[Discount], [o11].[Quantity], [o11].[UnitPrice], [s].[OrderID] FROM ( SELECT [o].[OrderID] FROM [Orders] AS [o] @@ -906,9 +905,9 @@ CROSS JOIN [Order Details] AS [o0] GROUP BY [o].[OrderID] ) AS [s] LEFT JOIN ( - SELECT [s0].[OrderID], [s0].[OrderID0], [s0].[ProductID] + SELECT [s0].[OrderID] FROM ( - SELECT [o9].[OrderID], [o10].[OrderID] AS [OrderID0], [o10].[ProductID], ROW_NUMBER() OVER(PARTITION BY [o9].[OrderID] ORDER BY [o9].[OrderID]) AS [row] + SELECT [o9].[OrderID], ROW_NUMBER() OVER(PARTITION BY [o9].[OrderID] ORDER BY [o9].[OrderID]) AS [row] FROM [Orders] AS [o9] CROSS JOIN [Order Details] AS [o10] WHERE [o9].[OrderID] = 10248 @@ -916,7 +915,7 @@ CROSS JOIN [Order Details] AS [o10] WHERE [s0].[row] <= 1 ) AS [s1] ON [s].[OrderID] = [s1].[OrderID] INNER JOIN [Order Details] AS [o11] ON [s1].[OrderID] = [o11].[OrderID] -ORDER BY [s].[OrderID], [s1].[OrderID], [s1].[OrderID0], [s1].[ProductID] +ORDER BY [s].[OrderID] """); } @@ -1076,11 +1075,11 @@ FROM [Orders] AS [o] WHERE [o0].[row] <= 1 ) AS [o1] ON [c].[CustomerID] = [o1].[CustomerID] WHERE [c].[CustomerID] LIKE N'F%' -ORDER BY [c].[CustomerID], [o1].[OrderID] +ORDER BY [c].[CustomerID] """, // """ -SELECT [o4].[OrderID], [o4].[ProductID], [o4].[Discount], [o4].[Quantity], [o4].[UnitPrice], [c].[CustomerID], [o6].[OrderID] +SELECT [o4].[OrderID], [o4].[ProductID], [o4].[Discount], [o4].[Quantity], [o4].[UnitPrice], [c].[CustomerID] FROM [Customers] AS [c] LEFT JOIN ( SELECT [o5].[OrderID], [o5].[CustomerID] @@ -1092,7 +1091,7 @@ FROM [Orders] AS [o3] ) AS [o6] ON [c].[CustomerID] = [o6].[CustomerID] INNER JOIN [Order Details] AS [o4] ON [o6].[OrderID] = [o4].[OrderID] WHERE [c].[CustomerID] LIKE N'F%' -ORDER BY [c].[CustomerID], [o6].[OrderID] +ORDER BY [c].[CustomerID] """); } @@ -1871,7 +1870,7 @@ public override async Task Repro9735(bool async) """ @p='2' -SELECT TOP(@p) [o].[OrderID], [o].[CustomerID], [o].[EmployeeID], [o].[OrderDate], [c].[CustomerID] +SELECT TOP(@p) [o].[OrderID], [o].[CustomerID], [o].[EmployeeID], [o].[OrderDate] FROM [Orders] AS [o] LEFT JOIN [Customers] AS [c] ON [o].[CustomerID] = [c].[CustomerID] ORDER BY CASE @@ -1880,15 +1879,15 @@ ELSE CAST(0 AS bit) END, CASE WHEN [c].[CustomerID] IS NOT NULL THEN [c].[CustomerID] ELSE N'' -END, [o].[OrderID], [c].[CustomerID] +END, [o].[OrderID] """, // """ @p='2' -SELECT [o0].[OrderID], [o0].[ProductID], [o0].[Discount], [o0].[Quantity], [o0].[UnitPrice], [s].[OrderID], [s].[CustomerID] +SELECT [o0].[OrderID], [o0].[ProductID], [o0].[Discount], [o0].[Quantity], [o0].[UnitPrice], [s].[OrderID] FROM ( - SELECT TOP(@p) [o].[OrderID], [c].[CustomerID], CASE + SELECT TOP(@p) [o].[OrderID], CASE WHEN [c].[CustomerID] IS NOT NULL THEN CAST(1 AS bit) ELSE CAST(0 AS bit) END AS [c], CASE @@ -1903,10 +1902,10 @@ ELSE CAST(0 AS bit) END, CASE WHEN [c].[CustomerID] IS NOT NULL THEN [c].[CustomerID] ELSE N'' - END, [o].[OrderID], [c].[CustomerID] + END, [o].[OrderID] ) AS [s] INNER JOIN [Order Details] AS [o0] ON [s].[OrderID] = [o0].[OrderID] -ORDER BY [s].[c], [s].[c0], [s].[OrderID], [s].[CustomerID] +ORDER BY [s].[c], [s].[c0], [s].[OrderID] """); } @@ -2693,7 +2692,7 @@ public override async Task Include_collection_Join_GroupBy_Select(bool async) AssertSql( """ -SELECT [s1].[OrderID], [s1].[CustomerID], [s1].[EmployeeID], [s1].[OrderDate], [s].[OrderID], [s1].[OrderID0], [s1].[ProductID] +SELECT [s1].[OrderID], [s1].[CustomerID], [s1].[EmployeeID], [s1].[OrderDate], [s].[OrderID] FROM ( SELECT [o].[OrderID] FROM [Orders] AS [o] @@ -2702,20 +2701,20 @@ FROM [Orders] AS [o] GROUP BY [o].[OrderID] ) AS [s] LEFT JOIN ( - SELECT [s0].[OrderID], [s0].[CustomerID], [s0].[EmployeeID], [s0].[OrderDate], [s0].[OrderID0], [s0].[ProductID] + SELECT [s0].[OrderID], [s0].[CustomerID], [s0].[EmployeeID], [s0].[OrderDate] FROM ( - SELECT [o1].[OrderID], [o1].[CustomerID], [o1].[EmployeeID], [o1].[OrderDate], [o2].[OrderID] AS [OrderID0], [o2].[ProductID], ROW_NUMBER() OVER(PARTITION BY [o1].[OrderID] ORDER BY [o1].[OrderID]) AS [row] + SELECT [o1].[OrderID], [o1].[CustomerID], [o1].[EmployeeID], [o1].[OrderDate], ROW_NUMBER() OVER(PARTITION BY [o1].[OrderID] ORDER BY [o1].[OrderID]) AS [row] FROM [Orders] AS [o1] INNER JOIN [Order Details] AS [o2] ON [o1].[OrderID] = [o2].[OrderID] WHERE [o1].[OrderID] = 10248 ) AS [s0] WHERE [s0].[row] <= 1 ) AS [s1] ON [s].[OrderID] = [s1].[OrderID] -ORDER BY [s].[OrderID], [s1].[OrderID], [s1].[OrderID0], [s1].[ProductID] +ORDER BY [s].[OrderID] """, // """ -SELECT [o11].[OrderID], [o11].[ProductID], [o11].[Discount], [o11].[Quantity], [o11].[UnitPrice], [s].[OrderID], [s1].[OrderID], [s1].[OrderID0], [s1].[ProductID] +SELECT [o11].[OrderID], [o11].[ProductID], [o11].[Discount], [o11].[Quantity], [o11].[UnitPrice], [s].[OrderID] FROM ( SELECT [o].[OrderID] FROM [Orders] AS [o] @@ -2724,9 +2723,9 @@ FROM [Orders] AS [o] GROUP BY [o].[OrderID] ) AS [s] LEFT JOIN ( - SELECT [s0].[OrderID], [s0].[OrderID0], [s0].[ProductID] + SELECT [s0].[OrderID] FROM ( - SELECT [o9].[OrderID], [o10].[OrderID] AS [OrderID0], [o10].[ProductID], ROW_NUMBER() OVER(PARTITION BY [o9].[OrderID] ORDER BY [o9].[OrderID]) AS [row] + SELECT [o9].[OrderID], ROW_NUMBER() OVER(PARTITION BY [o9].[OrderID] ORDER BY [o9].[OrderID]) AS [row] FROM [Orders] AS [o9] INNER JOIN [Order Details] AS [o10] ON [o9].[OrderID] = [o10].[OrderID] WHERE [o9].[OrderID] = 10248 @@ -2734,7 +2733,7 @@ FROM [Orders] AS [o9] WHERE [s0].[row] <= 1 ) AS [s1] ON [s].[OrderID] = [s1].[OrderID] INNER JOIN [Order Details] AS [o11] ON [s1].[OrderID] = [o11].[OrderID] -ORDER BY [s].[OrderID], [s1].[OrderID], [s1].[OrderID0], [s1].[ProductID] +ORDER BY [s].[OrderID] """); } @@ -2748,16 +2747,15 @@ public override async Task Include_reference_and_collection(bool async) FROM [Orders] AS [o] LEFT JOIN [Customers] AS [c] ON [o].[CustomerID] = [c].[CustomerID] WHERE [o].[CustomerID] LIKE N'F%' -ORDER BY [o].[OrderID], [c].[CustomerID] +ORDER BY [o].[OrderID] """, // """ -SELECT [o0].[OrderID], [o0].[ProductID], [o0].[Discount], [o0].[Quantity], [o0].[UnitPrice], [o].[OrderID], [c].[CustomerID] +SELECT [o0].[OrderID], [o0].[ProductID], [o0].[Discount], [o0].[Quantity], [o0].[UnitPrice], [o].[OrderID] 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] LIKE N'F%' -ORDER BY [o].[OrderID], [c].[CustomerID] +ORDER BY [o].[OrderID] """); } diff --git a/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindSplitIncludeQuerySqlServerTest.cs b/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindSplitIncludeQuerySqlServerTest.cs index a136a8bb361..a371e45ae8c 100644 --- a/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindSplitIncludeQuerySqlServerTest.cs +++ b/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindSplitIncludeQuerySqlServerTest.cs @@ -217,16 +217,15 @@ public override async Task Include_reference_and_collection(bool async) FROM [Orders] AS [o] LEFT JOIN [Customers] AS [c] ON [o].[CustomerID] = [c].[CustomerID] WHERE [o].[CustomerID] LIKE N'F%' -ORDER BY [o].[OrderID], [c].[CustomerID] +ORDER BY [o].[OrderID] """, // """ -SELECT [o0].[OrderID], [o0].[ProductID], [o0].[Discount], [o0].[Quantity], [o0].[UnitPrice], [o].[OrderID], [c].[CustomerID] +SELECT [o0].[OrderID], [o0].[ProductID], [o0].[Discount], [o0].[Quantity], [o0].[UnitPrice], [o].[OrderID] 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] LIKE N'F%' -ORDER BY [o].[OrderID], [c].[CustomerID] +ORDER BY [o].[OrderID] """); } @@ -240,7 +239,7 @@ public virtual void ToQueryString_for_include_reference_and_collection() 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] -ORDER BY [o].[OrderID], [c].[CustomerID] +ORDER BY [o].[OrderID] """ @@ -305,17 +304,17 @@ 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 -ORDER BY [o].[OrderID], [o].[ProductID], [o0].[OrderID], [c].[CustomerID] +ORDER BY [o].[OrderID], [o].[ProductID] """, // """ -SELECT [o1].[OrderID], [o1].[CustomerID], [o1].[EmployeeID], [o1].[OrderDate], [o].[OrderID], [o].[ProductID], [o0].[OrderID], [c].[CustomerID] +SELECT [o1].[OrderID], [o1].[CustomerID], [o1].[EmployeeID], [o1].[OrderDate], [o].[OrderID], [o].[ProductID] 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 -ORDER BY [o].[OrderID], [o].[ProductID], [o0].[OrderID], [c].[CustomerID] +ORDER BY [o].[OrderID], [o].[ProductID] """); } @@ -329,20 +328,20 @@ SELECT TOP(2) [o].[OrderID], [o].[CustomerID], [o].[EmployeeID], [o].[OrderDate] FROM [Orders] AS [o] LEFT JOIN [Customers] AS [c] ON [o].[CustomerID] = [c].[CustomerID] WHERE [o].[OrderID] = 10248 -ORDER BY [o].[OrderID], [c].[CustomerID] +ORDER BY [o].[OrderID] """, // """ -SELECT [o0].[OrderID], [o0].[CustomerID], [o0].[EmployeeID], [o0].[OrderDate], [s].[OrderID], [s].[CustomerID] +SELECT [o0].[OrderID], [o0].[CustomerID], [o0].[EmployeeID], [o0].[OrderDate], [s].[OrderID] FROM ( SELECT TOP(1) [o].[OrderID], [c].[CustomerID] FROM [Orders] AS [o] LEFT JOIN [Customers] AS [c] ON [o].[CustomerID] = [c].[CustomerID] WHERE [o].[OrderID] = 10248 - ORDER BY [o].[OrderID], [c].[CustomerID] + ORDER BY [o].[OrderID] ) AS [s] INNER JOIN [Orders] AS [o0] ON [s].[CustomerID] = [o0].[CustomerID] -ORDER BY [s].[OrderID], [s].[CustomerID] +ORDER BY [s].[OrderID] """); } @@ -1543,7 +1542,7 @@ public override async Task Include_collection_with_multiple_conditional_order_by """ @p='5' -SELECT TOP(@p) [o].[OrderID], [o].[CustomerID], [o].[EmployeeID], [o].[OrderDate], [c].[CustomerID] +SELECT TOP(@p) [o].[OrderID], [o].[CustomerID], [o].[EmployeeID], [o].[OrderDate] FROM [Orders] AS [o] LEFT JOIN [Customers] AS [c] ON [o].[CustomerID] = [c].[CustomerID] ORDER BY CASE @@ -1552,15 +1551,15 @@ ELSE CAST(0 AS bit) END, CASE WHEN [c].[CustomerID] IS NOT NULL THEN [c].[City] ELSE N'' -END, [o].[OrderID], [c].[CustomerID] +END, [o].[OrderID] """, // """ @p='5' -SELECT [o0].[OrderID], [o0].[ProductID], [o0].[Discount], [o0].[Quantity], [o0].[UnitPrice], [s].[OrderID], [s].[CustomerID] +SELECT [o0].[OrderID], [o0].[ProductID], [o0].[Discount], [o0].[Quantity], [o0].[UnitPrice], [s].[OrderID] FROM ( - SELECT TOP(@p) [o].[OrderID], [c].[CustomerID], CASE + SELECT TOP(@p) [o].[OrderID], CASE WHEN [o].[OrderID] > 0 THEN CAST(1 AS bit) ELSE CAST(0 AS bit) END AS [c], CASE @@ -1575,10 +1574,10 @@ ELSE CAST(0 AS bit) END, CASE WHEN [c].[CustomerID] IS NOT NULL THEN [c].[City] ELSE N'' - END, [o].[OrderID], [c].[CustomerID] + END, [o].[OrderID] ) AS [s] INNER JOIN [Order Details] AS [o0] ON [s].[OrderID] = [o0].[OrderID] -ORDER BY [s].[c], [s].[c0], [s].[OrderID], [s].[CustomerID] +ORDER BY [s].[c], [s].[c0], [s].[OrderID] """); } @@ -1689,11 +1688,11 @@ FROM [Orders] AS [o0] ) AS [o2] WHERE [o2].[row] <= 1 ) AS [o3] ON [o1].[OrderID] = [o3].[OrderID] -ORDER BY [o1].[OrderID], [o3].[OrderID] +ORDER BY [o1].[OrderID] """, // """ -SELECT [o6].[OrderID], [o6].[ProductID], [o6].[Discount], [o6].[Quantity], [o6].[UnitPrice], [o7].[OrderID], [o9].[OrderID] +SELECT [o6].[OrderID], [o6].[ProductID], [o6].[Discount], [o6].[Quantity], [o6].[UnitPrice], [o7].[OrderID] FROM ( SELECT [o].[OrderID] FROM [Orders] AS [o] @@ -1710,7 +1709,7 @@ FROM [Orders] AS [o5] WHERE [o8].[row] <= 1 ) AS [o9] ON [o7].[OrderID] = [o9].[OrderID] INNER JOIN [Order Details] AS [o6] ON [o9].[OrderID] = [o6].[OrderID] -ORDER BY [o7].[OrderID], [o9].[OrderID] +ORDER BY [o7].[OrderID] """); } @@ -1746,7 +1745,7 @@ public override async Task Include_collection_Join_GroupBy_Select(bool async) AssertSql( """ -SELECT [s1].[OrderID], [s1].[CustomerID], [s1].[EmployeeID], [s1].[OrderDate], [s].[OrderID], [s1].[OrderID0], [s1].[ProductID] +SELECT [s1].[OrderID], [s1].[CustomerID], [s1].[EmployeeID], [s1].[OrderDate], [s].[OrderID] FROM ( SELECT [o].[OrderID] FROM [Orders] AS [o] @@ -1755,20 +1754,20 @@ FROM [Orders] AS [o] GROUP BY [o].[OrderID] ) AS [s] LEFT JOIN ( - SELECT [s0].[OrderID], [s0].[CustomerID], [s0].[EmployeeID], [s0].[OrderDate], [s0].[OrderID0], [s0].[ProductID] + SELECT [s0].[OrderID], [s0].[CustomerID], [s0].[EmployeeID], [s0].[OrderDate] FROM ( - SELECT [o1].[OrderID], [o1].[CustomerID], [o1].[EmployeeID], [o1].[OrderDate], [o2].[OrderID] AS [OrderID0], [o2].[ProductID], ROW_NUMBER() OVER(PARTITION BY [o1].[OrderID] ORDER BY [o1].[OrderID]) AS [row] + SELECT [o1].[OrderID], [o1].[CustomerID], [o1].[EmployeeID], [o1].[OrderDate], ROW_NUMBER() OVER(PARTITION BY [o1].[OrderID] ORDER BY [o1].[OrderID]) AS [row] FROM [Orders] AS [o1] INNER JOIN [Order Details] AS [o2] ON [o1].[OrderID] = [o2].[OrderID] WHERE [o1].[OrderID] = 10248 ) AS [s0] WHERE [s0].[row] <= 1 ) AS [s1] ON [s].[OrderID] = [s1].[OrderID] -ORDER BY [s].[OrderID], [s1].[OrderID], [s1].[OrderID0], [s1].[ProductID] +ORDER BY [s].[OrderID] """, // """ -SELECT [o11].[OrderID], [o11].[ProductID], [o11].[Discount], [o11].[Quantity], [o11].[UnitPrice], [s].[OrderID], [s1].[OrderID], [s1].[OrderID0], [s1].[ProductID] +SELECT [o11].[OrderID], [o11].[ProductID], [o11].[Discount], [o11].[Quantity], [o11].[UnitPrice], [s].[OrderID] FROM ( SELECT [o].[OrderID] FROM [Orders] AS [o] @@ -1777,9 +1776,9 @@ FROM [Orders] AS [o] GROUP BY [o].[OrderID] ) AS [s] LEFT JOIN ( - SELECT [s0].[OrderID], [s0].[OrderID0], [s0].[ProductID] + SELECT [s0].[OrderID] FROM ( - SELECT [o9].[OrderID], [o10].[OrderID] AS [OrderID0], [o10].[ProductID], ROW_NUMBER() OVER(PARTITION BY [o9].[OrderID] ORDER BY [o9].[OrderID]) AS [row] + SELECT [o9].[OrderID], ROW_NUMBER() OVER(PARTITION BY [o9].[OrderID] ORDER BY [o9].[OrderID]) AS [row] FROM [Orders] AS [o9] INNER JOIN [Order Details] AS [o10] ON [o9].[OrderID] = [o10].[OrderID] WHERE [o9].[OrderID] = 10248 @@ -1787,7 +1786,7 @@ FROM [Orders] AS [o9] WHERE [s0].[row] <= 1 ) AS [s1] ON [s].[OrderID] = [s1].[OrderID] INNER JOIN [Order Details] AS [o11] ON [s1].[OrderID] = [o11].[OrderID] -ORDER BY [s].[OrderID], [s1].[OrderID], [s1].[OrderID0], [s1].[ProductID] +ORDER BY [s].[OrderID] """); } @@ -1825,7 +1824,7 @@ public override async Task Join_Include_collection_GroupBy_Select(bool async) AssertSql( """ -SELECT [s1].[OrderID], [s1].[CustomerID], [s1].[EmployeeID], [s1].[OrderDate], [s].[OrderID], [s1].[OrderID0], [s1].[ProductID] +SELECT [s1].[OrderID], [s1].[CustomerID], [s1].[EmployeeID], [s1].[OrderDate], [s].[OrderID] FROM ( SELECT [o0].[OrderID] FROM [Order Details] AS [o] @@ -1834,20 +1833,20 @@ FROM [Order Details] AS [o] GROUP BY [o0].[OrderID] ) AS [s] LEFT JOIN ( - SELECT [s0].[OrderID], [s0].[CustomerID], [s0].[EmployeeID], [s0].[OrderDate], [s0].[OrderID0], [s0].[ProductID] + SELECT [s0].[OrderID], [s0].[CustomerID], [s0].[EmployeeID], [s0].[OrderDate] FROM ( - SELECT [o2].[OrderID], [o2].[CustomerID], [o2].[EmployeeID], [o2].[OrderDate], [o1].[OrderID] AS [OrderID0], [o1].[ProductID], ROW_NUMBER() OVER(PARTITION BY [o2].[OrderID] ORDER BY [o2].[OrderID]) AS [row] + SELECT [o2].[OrderID], [o2].[CustomerID], [o2].[EmployeeID], [o2].[OrderDate], ROW_NUMBER() OVER(PARTITION BY [o2].[OrderID] ORDER BY [o2].[OrderID]) AS [row] FROM [Order Details] AS [o1] INNER JOIN [Orders] AS [o2] ON [o1].[OrderID] = [o2].[OrderID] WHERE [o1].[OrderID] = 10248 ) AS [s0] WHERE [s0].[row] <= 1 ) AS [s1] ON [s].[OrderID] = [s1].[OrderID] -ORDER BY [s].[OrderID], [s1].[OrderID0], [s1].[ProductID], [s1].[OrderID] +ORDER BY [s].[OrderID] """, // """ -SELECT [o11].[OrderID], [o11].[ProductID], [o11].[Discount], [o11].[Quantity], [o11].[UnitPrice], [s].[OrderID], [s1].[OrderID0], [s1].[ProductID], [s1].[OrderID] +SELECT [o11].[OrderID], [o11].[ProductID], [o11].[Discount], [o11].[Quantity], [o11].[UnitPrice], [s].[OrderID] FROM ( SELECT [o0].[OrderID] FROM [Order Details] AS [o] @@ -1856,9 +1855,9 @@ FROM [Order Details] AS [o] GROUP BY [o0].[OrderID] ) AS [s] LEFT JOIN ( - SELECT [s0].[OrderID], [s0].[OrderID0], [s0].[ProductID] + SELECT [s0].[OrderID] FROM ( - SELECT [o10].[OrderID], [o9].[OrderID] AS [OrderID0], [o9].[ProductID], ROW_NUMBER() OVER(PARTITION BY [o10].[OrderID] ORDER BY [o10].[OrderID]) AS [row] + SELECT [o10].[OrderID], ROW_NUMBER() OVER(PARTITION BY [o10].[OrderID] ORDER BY [o10].[OrderID]) AS [row] FROM [Order Details] AS [o9] INNER JOIN [Orders] AS [o10] ON [o9].[OrderID] = [o10].[OrderID] WHERE [o9].[OrderID] = 10248 @@ -1866,7 +1865,7 @@ FROM [Order Details] AS [o9] WHERE [s0].[row] <= 1 ) AS [s1] ON [s].[OrderID] = [s1].[OrderID] INNER JOIN [Order Details] AS [o11] ON [s1].[OrderID] = [o11].[OrderID] -ORDER BY [s].[OrderID], [s1].[OrderID0], [s1].[ProductID], [s1].[OrderID] +ORDER BY [s].[OrderID] """); } @@ -1902,7 +1901,7 @@ public override async Task Include_collection_SelectMany_GroupBy_Select(bool asy AssertSql( """ -SELECT [s1].[OrderID], [s1].[CustomerID], [s1].[EmployeeID], [s1].[OrderDate], [s].[OrderID], [s1].[OrderID0], [s1].[ProductID] +SELECT [s1].[OrderID], [s1].[CustomerID], [s1].[EmployeeID], [s1].[OrderDate], [s].[OrderID] FROM ( SELECT [o].[OrderID] FROM [Orders] AS [o] @@ -1911,20 +1910,20 @@ CROSS JOIN [Order Details] AS [o0] GROUP BY [o].[OrderID] ) AS [s] LEFT JOIN ( - SELECT [s0].[OrderID], [s0].[CustomerID], [s0].[EmployeeID], [s0].[OrderDate], [s0].[OrderID0], [s0].[ProductID] + SELECT [s0].[OrderID], [s0].[CustomerID], [s0].[EmployeeID], [s0].[OrderDate] FROM ( - SELECT [o1].[OrderID], [o1].[CustomerID], [o1].[EmployeeID], [o1].[OrderDate], [o2].[OrderID] AS [OrderID0], [o2].[ProductID], ROW_NUMBER() OVER(PARTITION BY [o1].[OrderID] ORDER BY [o1].[OrderID]) AS [row] + SELECT [o1].[OrderID], [o1].[CustomerID], [o1].[EmployeeID], [o1].[OrderDate], ROW_NUMBER() OVER(PARTITION BY [o1].[OrderID] ORDER BY [o1].[OrderID]) AS [row] FROM [Orders] AS [o1] CROSS JOIN [Order Details] AS [o2] WHERE [o1].[OrderID] = 10248 ) AS [s0] WHERE [s0].[row] <= 1 ) AS [s1] ON [s].[OrderID] = [s1].[OrderID] -ORDER BY [s].[OrderID], [s1].[OrderID], [s1].[OrderID0], [s1].[ProductID] +ORDER BY [s].[OrderID] """, // """ -SELECT [o11].[OrderID], [o11].[ProductID], [o11].[Discount], [o11].[Quantity], [o11].[UnitPrice], [s].[OrderID], [s1].[OrderID], [s1].[OrderID0], [s1].[ProductID] +SELECT [o11].[OrderID], [o11].[ProductID], [o11].[Discount], [o11].[Quantity], [o11].[UnitPrice], [s].[OrderID] FROM ( SELECT [o].[OrderID] FROM [Orders] AS [o] @@ -1933,9 +1932,9 @@ CROSS JOIN [Order Details] AS [o0] GROUP BY [o].[OrderID] ) AS [s] LEFT JOIN ( - SELECT [s0].[OrderID], [s0].[OrderID0], [s0].[ProductID] + SELECT [s0].[OrderID] FROM ( - SELECT [o9].[OrderID], [o10].[OrderID] AS [OrderID0], [o10].[ProductID], ROW_NUMBER() OVER(PARTITION BY [o9].[OrderID] ORDER BY [o9].[OrderID]) AS [row] + SELECT [o9].[OrderID], ROW_NUMBER() OVER(PARTITION BY [o9].[OrderID] ORDER BY [o9].[OrderID]) AS [row] FROM [Orders] AS [o9] CROSS JOIN [Order Details] AS [o10] WHERE [o9].[OrderID] = 10248 @@ -1943,7 +1942,7 @@ CROSS JOIN [Order Details] AS [o10] WHERE [s0].[row] <= 1 ) AS [s1] ON [s].[OrderID] = [s1].[OrderID] INNER JOIN [Order Details] AS [o11] ON [s1].[OrderID] = [o11].[OrderID] -ORDER BY [s].[OrderID], [s1].[OrderID], [s1].[OrderID0], [s1].[ProductID] +ORDER BY [s].[OrderID] """); } @@ -1981,7 +1980,7 @@ public override async Task SelectMany_Include_collection_GroupBy_Select(bool asy AssertSql( """ -SELECT [s1].[OrderID], [s1].[CustomerID], [s1].[EmployeeID], [s1].[OrderDate], [s].[OrderID], [s1].[OrderID0], [s1].[ProductID] +SELECT [s1].[OrderID], [s1].[CustomerID], [s1].[EmployeeID], [s1].[OrderDate], [s].[OrderID] FROM ( SELECT [o0].[OrderID] FROM [Order Details] AS [o] @@ -1990,20 +1989,20 @@ CROSS JOIN [Orders] AS [o0] GROUP BY [o0].[OrderID] ) AS [s] LEFT JOIN ( - SELECT [s0].[OrderID], [s0].[CustomerID], [s0].[EmployeeID], [s0].[OrderDate], [s0].[OrderID0], [s0].[ProductID] + SELECT [s0].[OrderID], [s0].[CustomerID], [s0].[EmployeeID], [s0].[OrderDate] FROM ( - SELECT [o2].[OrderID], [o2].[CustomerID], [o2].[EmployeeID], [o2].[OrderDate], [o1].[OrderID] AS [OrderID0], [o1].[ProductID], ROW_NUMBER() OVER(PARTITION BY [o2].[OrderID] ORDER BY [o2].[OrderID]) AS [row] + SELECT [o2].[OrderID], [o2].[CustomerID], [o2].[EmployeeID], [o2].[OrderDate], ROW_NUMBER() OVER(PARTITION BY [o2].[OrderID] ORDER BY [o2].[OrderID]) AS [row] FROM [Order Details] AS [o1] CROSS JOIN [Orders] AS [o2] WHERE [o1].[OrderID] = 10248 ) AS [s0] WHERE [s0].[row] <= 1 ) AS [s1] ON [s].[OrderID] = [s1].[OrderID] -ORDER BY [s].[OrderID], [s1].[OrderID0], [s1].[ProductID], [s1].[OrderID] +ORDER BY [s].[OrderID] """, // """ -SELECT [o11].[OrderID], [o11].[ProductID], [o11].[Discount], [o11].[Quantity], [o11].[UnitPrice], [s].[OrderID], [s1].[OrderID0], [s1].[ProductID], [s1].[OrderID] +SELECT [o11].[OrderID], [o11].[ProductID], [o11].[Discount], [o11].[Quantity], [o11].[UnitPrice], [s].[OrderID] FROM ( SELECT [o0].[OrderID] FROM [Order Details] AS [o] @@ -2012,9 +2011,9 @@ CROSS JOIN [Orders] AS [o0] GROUP BY [o0].[OrderID] ) AS [s] LEFT JOIN ( - SELECT [s0].[OrderID], [s0].[OrderID0], [s0].[ProductID] + SELECT [s0].[OrderID] FROM ( - SELECT [o10].[OrderID], [o9].[OrderID] AS [OrderID0], [o9].[ProductID], ROW_NUMBER() OVER(PARTITION BY [o10].[OrderID] ORDER BY [o10].[OrderID]) AS [row] + SELECT [o10].[OrderID], ROW_NUMBER() OVER(PARTITION BY [o10].[OrderID] ORDER BY [o10].[OrderID]) AS [row] FROM [Order Details] AS [o9] CROSS JOIN [Orders] AS [o10] WHERE [o9].[OrderID] = 10248 @@ -2022,7 +2021,7 @@ CROSS JOIN [Orders] AS [o10] WHERE [s0].[row] <= 1 ) AS [s1] ON [s].[OrderID] = [s1].[OrderID] INNER JOIN [Order Details] AS [o11] ON [s1].[OrderID] = [o11].[OrderID] -ORDER BY [s].[OrderID], [s1].[OrderID0], [s1].[ProductID], [s1].[OrderID] +ORDER BY [s].[OrderID] """); } @@ -2510,11 +2509,11 @@ FROM [Orders] AS [o] WHERE [o0].[row] <= 1 ) AS [o1] ON [c].[CustomerID] = [o1].[CustomerID] WHERE [c].[CustomerID] LIKE N'F%' -ORDER BY [c].[CustomerID], [o1].[OrderID] +ORDER BY [c].[CustomerID] """, // """ -SELECT [o4].[OrderID], [o4].[ProductID], [o4].[Discount], [o4].[Quantity], [o4].[UnitPrice], [c].[CustomerID], [o6].[OrderID] +SELECT [o4].[OrderID], [o4].[ProductID], [o4].[Discount], [o4].[Quantity], [o4].[UnitPrice], [c].[CustomerID] FROM [Customers] AS [c] LEFT JOIN ( SELECT [o5].[OrderID], [o5].[CustomerID] @@ -2526,7 +2525,7 @@ FROM [Orders] AS [o3] ) AS [o6] ON [c].[CustomerID] = [o6].[CustomerID] INNER JOIN [Order Details] AS [o4] ON [o6].[OrderID] = [o4].[OrderID] WHERE [c].[CustomerID] LIKE N'F%' -ORDER BY [c].[CustomerID], [o6].[OrderID] +ORDER BY [c].[CustomerID] """); } @@ -2542,18 +2541,17 @@ 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 -ORDER BY [o].[OrderID], [o].[ProductID], [p].[ProductID], [o0].[OrderID], [c].[CustomerID] +ORDER BY [o].[OrderID], [o].[ProductID] """, // """ -SELECT [o1].[OrderID], [o1].[CustomerID], [o1].[EmployeeID], [o1].[OrderDate], [o].[OrderID], [o].[ProductID], [p].[ProductID], [o0].[OrderID], [c].[CustomerID] +SELECT [o1].[OrderID], [o1].[CustomerID], [o1].[EmployeeID], [o1].[OrderDate], [o].[OrderID], [o].[ProductID] 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] INNER JOIN [Orders] AS [o1] ON [c].[CustomerID] = [o1].[CustomerID] WHERE [o].[OrderID] % 23 = 13 -ORDER BY [o].[OrderID], [o].[ProductID], [p].[ProductID], [o0].[OrderID], [c].[CustomerID] +ORDER BY [o].[OrderID], [o].[ProductID] """); } @@ -2588,16 +2586,16 @@ public override async Task Include_with_cycle_does_not_throw_when_AsNoTrackingWi FROM [Orders] AS [o] LEFT JOIN [Customers] AS [c] ON [o].[CustomerID] = [c].[CustomerID] WHERE [o].[OrderID] < 10800 -ORDER BY [o].[OrderID], [c].[CustomerID] +ORDER BY [o].[OrderID] """, // """ -SELECT [o0].[OrderID], [o0].[CustomerID], [o0].[EmployeeID], [o0].[OrderDate], [o].[OrderID], [c].[CustomerID] +SELECT [o0].[OrderID], [o0].[CustomerID], [o0].[EmployeeID], [o0].[OrderDate], [o].[OrderID] 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].[OrderID] < 10800 -ORDER BY [o].[OrderID], [c].[CustomerID] +ORDER BY [o].[OrderID] """); } @@ -2679,18 +2677,18 @@ 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] WHERE [o].[OrderID] % 23 = 13 -ORDER BY [o].[OrderID], [o].[ProductID], [o0].[OrderID], [c].[CustomerID], [p].[ProductID] +ORDER BY [o].[OrderID], [o].[ProductID] """, // """ -SELECT [o1].[OrderID], [o1].[CustomerID], [o1].[EmployeeID], [o1].[OrderDate], [o].[OrderID], [o].[ProductID], [o0].[OrderID], [c].[CustomerID], [p].[ProductID] +SELECT [o1].[OrderID], [o1].[CustomerID], [o1].[EmployeeID], [o1].[OrderDate], [o].[OrderID], [o].[ProductID] 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] INNER JOIN [Orders] AS [o1] ON [c].[CustomerID] = [o1].[CustomerID] WHERE [o].[OrderID] % 23 = 13 -ORDER BY [o].[OrderID], [o].[ProductID], [o0].[OrderID], [c].[CustomerID], [p].[ProductID] +ORDER BY [o].[OrderID], [o].[ProductID] """); } @@ -2732,17 +2730,17 @@ 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] = 10248 -ORDER BY [o].[OrderID], [o].[ProductID], [o0].[OrderID], [c].[CustomerID] +ORDER BY [o].[OrderID], [o].[ProductID] """, // """ -SELECT [o1].[OrderID], [o1].[CustomerID], [o1].[EmployeeID], [o1].[OrderDate], [o].[OrderID], [o].[ProductID], [o0].[OrderID], [c].[CustomerID] +SELECT [o1].[OrderID], [o1].[CustomerID], [o1].[EmployeeID], [o1].[OrderDate], [o].[OrderID], [o].[ProductID] 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] = 10248 -ORDER BY [o].[OrderID], [o].[ProductID], [o0].[OrderID], [c].[CustomerID] +ORDER BY [o].[OrderID], [o].[ProductID] """); } @@ -2757,17 +2755,17 @@ 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] = 10248 -ORDER BY [o].[OrderID], [o].[ProductID], [o0].[OrderID], [c].[CustomerID] +ORDER BY [o].[OrderID], [o].[ProductID] """, // """ -SELECT [o1].[OrderID], [o1].[CustomerID], [o1].[EmployeeID], [o1].[OrderDate], [o].[OrderID], [o].[ProductID], [o0].[OrderID], [c].[CustomerID] +SELECT [o1].[OrderID], [o1].[CustomerID], [o1].[EmployeeID], [o1].[OrderDate], [o].[OrderID], [o].[ProductID] 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] = 10248 -ORDER BY [o].[OrderID], [o].[ProductID], [o0].[OrderID], [c].[CustomerID] +ORDER BY [o].[OrderID], [o].[ProductID] """); } @@ -2809,16 +2807,16 @@ 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] WHERE [o].[CustomerID] LIKE N'F%' -ORDER BY [o].[OrderID], [c].[CustomerID] +ORDER BY [o].[OrderID] """, // """ -SELECT [o0].[OrderID], [o0].[CustomerID], [o0].[EmployeeID], [o0].[OrderDate], [o].[OrderID], [c].[CustomerID] +SELECT [o0].[OrderID], [o0].[CustomerID], [o0].[EmployeeID], [o0].[OrderDate], [o].[OrderID] 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] LIKE N'F%' -ORDER BY [o].[OrderID], [c].[CustomerID] +ORDER BY [o].[OrderID] """); } @@ -2834,18 +2832,17 @@ 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 -ORDER BY [o].[OrderID], [o].[ProductID], [p].[ProductID], [o0].[OrderID], [c].[CustomerID] +ORDER BY [o].[OrderID], [o].[ProductID] """, // """ -SELECT [o1].[OrderID], [o1].[CustomerID], [o1].[EmployeeID], [o1].[OrderDate], [o].[OrderID], [o].[ProductID], [p].[ProductID], [o0].[OrderID], [c].[CustomerID] +SELECT [o1].[OrderID], [o1].[CustomerID], [o1].[EmployeeID], [o1].[OrderDate], [o].[OrderID], [o].[ProductID] 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] INNER JOIN [Orders] AS [o1] ON [c].[CustomerID] = [o1].[CustomerID] WHERE [o].[OrderID] % 23 = 13 -ORDER BY [o].[OrderID], [o].[ProductID], [p].[ProductID], [o0].[OrderID], [c].[CustomerID] +ORDER BY [o].[OrderID], [o].[ProductID] """); } @@ -2860,17 +2857,17 @@ 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) -ORDER BY [o].[OrderID], [o].[ProductID], [o0].[OrderID], [c].[CustomerID] +ORDER BY [o].[OrderID], [o].[ProductID] """, // """ -SELECT [o1].[OrderID], [o1].[CustomerID], [o1].[EmployeeID], [o1].[OrderDate], [o].[OrderID], [o].[ProductID], [o0].[OrderID], [c].[CustomerID] +SELECT [o1].[OrderID], [o1].[CustomerID], [o1].[EmployeeID], [o1].[OrderDate], [o].[OrderID], [o].[ProductID] 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) -ORDER BY [o].[OrderID], [o].[ProductID], [o0].[OrderID], [c].[CustomerID] +ORDER BY [o].[OrderID], [o].[ProductID] """); } @@ -2884,16 +2881,15 @@ public override async Task Include_collection_and_reference(bool async) FROM [Orders] AS [o] LEFT JOIN [Customers] AS [c] ON [o].[CustomerID] = [c].[CustomerID] WHERE [o].[CustomerID] LIKE N'F%' -ORDER BY [o].[OrderID], [c].[CustomerID] +ORDER BY [o].[OrderID] """, // """ -SELECT [o0].[OrderID], [o0].[ProductID], [o0].[Discount], [o0].[Quantity], [o0].[UnitPrice], [o].[OrderID], [c].[CustomerID] +SELECT [o0].[OrderID], [o0].[ProductID], [o0].[Discount], [o0].[Quantity], [o0].[UnitPrice], [o].[OrderID] 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] LIKE N'F%' -ORDER BY [o].[OrderID], [c].[CustomerID] +ORDER BY [o].[OrderID] """); } @@ -2959,16 +2955,16 @@ public override async Task Include_with_cycle_does_not_throw_when_AsTracking_NoT FROM [Orders] AS [o] LEFT JOIN [Customers] AS [c] ON [o].[CustomerID] = [c].[CustomerID] WHERE [o].[OrderID] < 10800 -ORDER BY [o].[OrderID], [c].[CustomerID] +ORDER BY [o].[OrderID] """, // """ -SELECT [o0].[OrderID], [o0].[CustomerID], [o0].[EmployeeID], [o0].[OrderDate], [o].[OrderID], [c].[CustomerID] +SELECT [o0].[OrderID], [o0].[CustomerID], [o0].[EmployeeID], [o0].[OrderDate], [o].[OrderID] 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].[OrderID] < 10800 -ORDER BY [o].[OrderID], [c].[CustomerID] +ORDER BY [o].[OrderID] """); } @@ -2982,16 +2978,16 @@ 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] WHERE [o].[CustomerID] LIKE N'F%' -ORDER BY [o].[OrderID], [c].[CustomerID] +ORDER BY [o].[OrderID] """, // """ -SELECT [o0].[OrderID], [o0].[CustomerID], [o0].[EmployeeID], [o0].[OrderDate], [o].[OrderID], [c].[CustomerID] +SELECT [o0].[OrderID], [o0].[CustomerID], [o0].[EmployeeID], [o0].[OrderDate], [o].[OrderID] 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] LIKE N'F%' -ORDER BY [o].[OrderID], [c].[CustomerID] +ORDER BY [o].[OrderID] """); } @@ -3035,18 +3031,18 @@ 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] WHERE [o].[OrderID] % 23 = 13 -ORDER BY [o].[OrderID], [o].[ProductID], [o0].[OrderID], [c].[CustomerID], [p].[ProductID] +ORDER BY [o].[OrderID], [o].[ProductID] """, // """ -SELECT [o1].[OrderID], [o1].[CustomerID], [o1].[EmployeeID], [o1].[OrderDate], [o].[OrderID], [o].[ProductID], [o0].[OrderID], [c].[CustomerID], [p].[ProductID] +SELECT [o1].[OrderID], [o1].[CustomerID], [o1].[EmployeeID], [o1].[OrderDate], [o].[OrderID], [o].[ProductID] 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] INNER JOIN [Orders] AS [o1] ON [c].[CustomerID] = [o1].[CustomerID] WHERE [o].[OrderID] % 23 = 13 -ORDER BY [o].[OrderID], [o].[ProductID], [o0].[OrderID], [c].[CustomerID], [p].[ProductID] +ORDER BY [o].[OrderID], [o].[ProductID] """); } @@ -3058,7 +3054,7 @@ public override async Task Repro9735(bool async) """ @p='2' -SELECT TOP(@p) [o].[OrderID], [o].[CustomerID], [o].[EmployeeID], [o].[OrderDate], [c].[CustomerID] +SELECT TOP(@p) [o].[OrderID], [o].[CustomerID], [o].[EmployeeID], [o].[OrderDate] FROM [Orders] AS [o] LEFT JOIN [Customers] AS [c] ON [o].[CustomerID] = [c].[CustomerID] ORDER BY CASE @@ -3067,15 +3063,15 @@ ELSE CAST(0 AS bit) END, CASE WHEN [c].[CustomerID] IS NOT NULL THEN [c].[CustomerID] ELSE N'' -END, [o].[OrderID], [c].[CustomerID] +END, [o].[OrderID] """, // """ @p='2' -SELECT [o0].[OrderID], [o0].[ProductID], [o0].[Discount], [o0].[Quantity], [o0].[UnitPrice], [s].[OrderID], [s].[CustomerID] +SELECT [o0].[OrderID], [o0].[ProductID], [o0].[Discount], [o0].[Quantity], [o0].[UnitPrice], [s].[OrderID] FROM ( - SELECT TOP(@p) [o].[OrderID], [c].[CustomerID], CASE + SELECT TOP(@p) [o].[OrderID], CASE WHEN [c].[CustomerID] IS NOT NULL THEN CAST(1 AS bit) ELSE CAST(0 AS bit) END AS [c], CASE @@ -3090,10 +3086,10 @@ ELSE CAST(0 AS bit) END, CASE WHEN [c].[CustomerID] IS NOT NULL THEN [c].[CustomerID] ELSE N'' - END, [o].[OrderID], [c].[CustomerID] + END, [o].[OrderID] ) AS [s] INNER JOIN [Order Details] AS [o0] ON [s].[OrderID] = [o0].[OrderID] -ORDER BY [s].[c], [s].[c0], [s].[OrderID], [s].[CustomerID] +ORDER BY [s].[c], [s].[c0], [s].[OrderID] """); } @@ -3120,20 +3116,20 @@ SELECT TOP(2) [o].[OrderID], [o].[CustomerID], [o].[EmployeeID], [o].[OrderDate] FROM [Orders] AS [o] LEFT JOIN [Customers] AS [c] ON [o].[CustomerID] = [c].[CustomerID] WHERE [o].[OrderID] = 10248 -ORDER BY [o].[OrderID], [c].[CustomerID] +ORDER BY [o].[OrderID] """, // """ -SELECT [o0].[OrderID], [o0].[CustomerID], [o0].[EmployeeID], [o0].[OrderDate], [s].[OrderID], [s].[CustomerID] +SELECT [o0].[OrderID], [o0].[CustomerID], [o0].[EmployeeID], [o0].[OrderDate], [s].[OrderID] FROM ( SELECT TOP(1) [o].[OrderID], [c].[CustomerID] FROM [Orders] AS [o] LEFT JOIN [Customers] AS [c] ON [o].[CustomerID] = [c].[CustomerID] WHERE [o].[OrderID] = 10248 - ORDER BY [o].[OrderID], [c].[CustomerID] + ORDER BY [o].[OrderID] ) AS [s] INNER JOIN [Orders] AS [o0] ON [s].[CustomerID] = [o0].[CustomerID] -ORDER BY [s].[OrderID], [s].[CustomerID] +ORDER BY [s].[OrderID] """); } diff --git a/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindStringIncludeQuerySqlServerTest.cs b/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindStringIncludeQuerySqlServerTest.cs index 708cdb24de9..3990360f3a4 100644 --- a/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindStringIncludeQuerySqlServerTest.cs +++ b/test/EFCore.SqlServer.FunctionalTests/Query/NorthwindStringIncludeQuerySqlServerTest.cs @@ -67,7 +67,7 @@ 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].[OrderID] < 10800 -ORDER BY [o].[OrderID], [c].[CustomerID] +ORDER BY [o].[OrderID] """); } @@ -219,7 +219,7 @@ FROM [Orders] AS [o] WHERE [o].[OrderID] = 10248 ) AS [s] LEFT JOIN [Orders] AS [o0] ON [s].[CustomerID0] = [o0].[CustomerID] -ORDER BY [s].[OrderID], [s].[CustomerID0] +ORDER BY [s].[OrderID] """); } @@ -234,7 +234,7 @@ 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] LIKE N'F%' -ORDER BY [o].[OrderID], [c].[CustomerID] +ORDER BY [o].[OrderID] """); } @@ -414,9 +414,9 @@ public override async Task Repro9735(bool async) """ @p='2' -SELECT [s].[OrderID], [s].[CustomerID], [s].[EmployeeID], [s].[OrderDate], [s].[CustomerID0], [o0].[OrderID], [o0].[ProductID], [o0].[Discount], [o0].[Quantity], [o0].[UnitPrice] +SELECT [s].[OrderID], [s].[CustomerID], [s].[EmployeeID], [s].[OrderDate], [o0].[OrderID], [o0].[ProductID], [o0].[Discount], [o0].[Quantity], [o0].[UnitPrice] FROM ( - SELECT TOP(@p) [o].[OrderID], [o].[CustomerID], [o].[EmployeeID], [o].[OrderDate], [c].[CustomerID] AS [CustomerID0], CASE + SELECT TOP(@p) [o].[OrderID], [o].[CustomerID], [o].[EmployeeID], [o].[OrderDate], CASE WHEN [c].[CustomerID] IS NOT NULL THEN CAST(1 AS bit) ELSE CAST(0 AS bit) END AS [c], CASE @@ -434,7 +434,7 @@ ELSE N'' END ) AS [s] LEFT JOIN [Order Details] AS [o0] ON [s].[OrderID] = [o0].[OrderID] -ORDER BY [s].[c], [s].[c0], [s].[OrderID], [s].[CustomerID0], [o0].[OrderID] +ORDER BY [s].[c], [s].[c0], [s].[OrderID], [o0].[OrderID] """); } @@ -563,7 +563,7 @@ FROM [Order Details] AS [o0] ) AS [s] ON [o].[OrderID] = [s].[OrderID] ) AS [s0] ON [c].[CustomerID] = [s0].[CustomerID] WHERE [c].[CustomerID] LIKE N'F%' -ORDER BY [c].[CustomerID], [s0].[OrderID], [s0].[OrderID0], [s0].[ProductID] +ORDER BY [c].[CustomerID], [s0].[OrderID], [s0].[OrderID0] """); } @@ -798,7 +798,7 @@ FROM [Order Details] AS [o] 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 -ORDER BY [o].[OrderID], [o].[ProductID], [p].[ProductID], [o0].[OrderID], [c].[CustomerID] +ORDER BY [o].[OrderID], [o].[ProductID] """); } @@ -816,7 +816,7 @@ FROM [Order Details] AS [o] INNER JOIN [Orders] AS [o0] ON [o].[OrderID] = [o0].[OrderID] ) AS [s] ON [p].[ProductID] = [s].[ProductID] WHERE [p].[ProductID] % 17 = 5 -ORDER BY [p].[ProductID], [s].[OrderID], [s].[ProductID] +ORDER BY [p].[ProductID], [s].[OrderID] """); } @@ -932,7 +932,7 @@ LEFT JOIN ( FROM [Order Details] AS [o0] INNER JOIN [Products] AS [p] ON [o0].[ProductID] = [p].[ProductID] ) AS [s] ON [o1].[OrderID] = [s].[OrderID] -ORDER BY [o1].[OrderID], [s].[OrderID], [s].[ProductID] +ORDER BY [o1].[OrderID], [s].[OrderID] """); } @@ -998,7 +998,7 @@ FROM [Order Details] AS [o] 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 -ORDER BY [o].[OrderID], [o].[ProductID], [o0].[OrderID], [c].[CustomerID] +ORDER BY [o].[OrderID], [o].[ProductID] """); } @@ -1054,7 +1054,7 @@ FROM [Orders] AS [o] ) AS [o2] ON [c].[CustomerID] = [o2].[CustomerID] LEFT JOIN [Order Details] AS [o0] ON [o2].[OrderID] = [o0].[OrderID] WHERE [c].[CustomerID] LIKE N'F%' -ORDER BY [c].[CustomerID], [o2].[OrderID], [o0].[OrderID] +ORDER BY [c].[CustomerID], [o0].[OrderID] """); } @@ -1098,9 +1098,9 @@ public override async Task Include_collection_with_multiple_conditional_order_by """ @p='5' -SELECT [s].[OrderID], [s].[CustomerID], [s].[EmployeeID], [s].[OrderDate], [s].[CustomerID0], [o0].[OrderID], [o0].[ProductID], [o0].[Discount], [o0].[Quantity], [o0].[UnitPrice] +SELECT [s].[OrderID], [s].[CustomerID], [s].[EmployeeID], [s].[OrderDate], [o0].[OrderID], [o0].[ProductID], [o0].[Discount], [o0].[Quantity], [o0].[UnitPrice] FROM ( - SELECT TOP(@p) [o].[OrderID], [o].[CustomerID], [o].[EmployeeID], [o].[OrderDate], [c].[CustomerID] AS [CustomerID0], CASE + SELECT TOP(@p) [o].[OrderID], [o].[CustomerID], [o].[EmployeeID], [o].[OrderDate], CASE WHEN [o].[OrderID] > 0 THEN CAST(1 AS bit) ELSE CAST(0 AS bit) END AS [c], CASE @@ -1118,7 +1118,7 @@ ELSE N'' END ) AS [s] LEFT JOIN [Order Details] AS [o0] ON [s].[OrderID] = [o0].[OrderID] -ORDER BY [s].[c], [s].[c0], [s].[OrderID], [s].[CustomerID0], [o0].[OrderID] +ORDER BY [s].[c], [s].[c0], [s].[OrderID], [o0].[OrderID] """); } @@ -1172,7 +1172,7 @@ 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].[OrderID] < 10800 -ORDER BY [o].[OrderID], [c].[CustomerID] +ORDER BY [o].[OrderID] """); } @@ -1188,7 +1188,7 @@ FROM [Order Details] AS [o] 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) -ORDER BY [o].[OrderID], [o].[ProductID], [o0].[OrderID], [c].[CustomerID] +ORDER BY [o].[OrderID], [o].[ProductID] """); } @@ -1265,14 +1265,14 @@ public override async Task Include_multiple_references_then_include_collection_m AssertSql( """ -SELECT [o].[OrderID], [o].[ProductID], [o].[Discount], [o].[Quantity], [o].[UnitPrice], [o0].[OrderID], [o0].[CustomerID], [o0].[EmployeeID], [o0].[OrderDate], [c].[CustomerID], [c].[Address], [c].[City], [c].[CompanyName], [c].[ContactName], [c].[ContactTitle], [c].[Country], [c].[Fax], [c].[Phone], [c].[PostalCode], [c].[Region], [p].[ProductID], [o1].[OrderID], [o1].[CustomerID], [o1].[EmployeeID], [o1].[OrderDate], [p].[Discontinued], [p].[ProductName], [p].[SupplierID], [p].[UnitPrice], [p].[UnitsInStock] +SELECT [o].[OrderID], [o].[ProductID], [o].[Discount], [o].[Quantity], [o].[UnitPrice], [o0].[OrderID], [o0].[CustomerID], [o0].[EmployeeID], [o0].[OrderDate], [c].[CustomerID], [c].[Address], [c].[City], [c].[CompanyName], [c].[ContactName], [c].[ContactTitle], [c].[Country], [c].[Fax], [c].[Phone], [c].[PostalCode], [c].[Region], [o1].[OrderID], [o1].[CustomerID], [o1].[EmployeeID], [o1].[OrderDate], [p].[ProductID], [p].[Discontinued], [p].[ProductName], [p].[SupplierID], [p].[UnitPrice], [p].[UnitsInStock] 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] LEFT JOIN [Orders] AS [o1] ON [c].[CustomerID] = [o1].[CustomerID] WHERE [o].[OrderID] % 23 = 13 -ORDER BY [o].[OrderID], [o].[ProductID], [o0].[OrderID], [c].[CustomerID], [p].[ProductID] +ORDER BY [o].[OrderID], [o].[ProductID] """); } @@ -1325,7 +1325,7 @@ public override async Task Include_collection_SelectMany_GroupBy_Select(bool asy AssertSql( """ -SELECT [s1].[OrderID], [s1].[CustomerID], [s1].[EmployeeID], [s1].[OrderDate], [s].[OrderID], [s1].[OrderID0], [s1].[ProductID], [o3].[OrderID], [o3].[ProductID], [o3].[Discount], [o3].[Quantity], [o3].[UnitPrice] +SELECT [s1].[OrderID], [s1].[CustomerID], [s1].[EmployeeID], [s1].[OrderDate], [s].[OrderID], [o3].[OrderID], [o3].[ProductID], [o3].[Discount], [o3].[Quantity], [o3].[UnitPrice] FROM ( SELECT [o].[OrderID] FROM [Orders] AS [o] @@ -1334,9 +1334,9 @@ CROSS JOIN [Order Details] AS [o0] GROUP BY [o].[OrderID] ) AS [s] LEFT JOIN ( - SELECT [s0].[OrderID], [s0].[CustomerID], [s0].[EmployeeID], [s0].[OrderDate], [s0].[OrderID0], [s0].[ProductID] + SELECT [s0].[OrderID], [s0].[CustomerID], [s0].[EmployeeID], [s0].[OrderDate] FROM ( - SELECT [o1].[OrderID], [o1].[CustomerID], [o1].[EmployeeID], [o1].[OrderDate], [o2].[OrderID] AS [OrderID0], [o2].[ProductID], ROW_NUMBER() OVER(PARTITION BY [o1].[OrderID] ORDER BY [o1].[OrderID]) AS [row] + SELECT [o1].[OrderID], [o1].[CustomerID], [o1].[EmployeeID], [o1].[OrderDate], ROW_NUMBER() OVER(PARTITION BY [o1].[OrderID] ORDER BY [o1].[OrderID]) AS [row] FROM [Orders] AS [o1] CROSS JOIN [Order Details] AS [o2] WHERE [o1].[OrderID] = 10248 @@ -1344,7 +1344,7 @@ CROSS JOIN [Order Details] AS [o2] WHERE [s0].[row] <= 1 ) AS [s1] ON [s].[OrderID] = [s1].[OrderID] LEFT JOIN [Order Details] AS [o3] ON [s1].[OrderID] = [o3].[OrderID] -ORDER BY [s].[OrderID], [s1].[OrderID], [s1].[OrderID0], [s1].[ProductID], [o3].[OrderID] +ORDER BY [s].[OrderID], [o3].[OrderID] """); } @@ -1526,7 +1526,7 @@ FROM [Order Details] AS [o] 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 -ORDER BY [o].[OrderID], [o].[ProductID], [p].[ProductID], [o0].[OrderID], [c].[CustomerID] +ORDER BY [o].[OrderID], [o].[ProductID] """); } @@ -1577,7 +1577,7 @@ public override async Task Include_collection_Join_GroupBy_Select(bool async) AssertSql( """ -SELECT [s1].[OrderID], [s1].[CustomerID], [s1].[EmployeeID], [s1].[OrderDate], [s].[OrderID], [s1].[OrderID0], [s1].[ProductID], [o3].[OrderID], [o3].[ProductID], [o3].[Discount], [o3].[Quantity], [o3].[UnitPrice] +SELECT [s1].[OrderID], [s1].[CustomerID], [s1].[EmployeeID], [s1].[OrderDate], [s].[OrderID], [o3].[OrderID], [o3].[ProductID], [o3].[Discount], [o3].[Quantity], [o3].[UnitPrice] FROM ( SELECT [o].[OrderID] FROM [Orders] AS [o] @@ -1586,9 +1586,9 @@ FROM [Orders] AS [o] GROUP BY [o].[OrderID] ) AS [s] LEFT JOIN ( - SELECT [s0].[OrderID], [s0].[CustomerID], [s0].[EmployeeID], [s0].[OrderDate], [s0].[OrderID0], [s0].[ProductID] + SELECT [s0].[OrderID], [s0].[CustomerID], [s0].[EmployeeID], [s0].[OrderDate] FROM ( - SELECT [o1].[OrderID], [o1].[CustomerID], [o1].[EmployeeID], [o1].[OrderDate], [o2].[OrderID] AS [OrderID0], [o2].[ProductID], ROW_NUMBER() OVER(PARTITION BY [o1].[OrderID] ORDER BY [o1].[OrderID]) AS [row] + SELECT [o1].[OrderID], [o1].[CustomerID], [o1].[EmployeeID], [o1].[OrderDate], ROW_NUMBER() OVER(PARTITION BY [o1].[OrderID] ORDER BY [o1].[OrderID]) AS [row] FROM [Orders] AS [o1] INNER JOIN [Order Details] AS [o2] ON [o1].[OrderID] = [o2].[OrderID] WHERE [o1].[OrderID] = 10248 @@ -1596,7 +1596,7 @@ FROM [Orders] AS [o1] WHERE [s0].[row] <= 1 ) AS [s1] ON [s].[OrderID] = [s1].[OrderID] LEFT JOIN [Order Details] AS [o3] ON [s1].[OrderID] = [o3].[OrderID] -ORDER BY [s].[OrderID], [s1].[OrderID], [s1].[OrderID0], [s1].[ProductID], [o3].[OrderID] +ORDER BY [s].[OrderID], [o3].[OrderID] """); } @@ -1623,7 +1623,7 @@ FROM [Orders] AS [o0] WHERE [o3].[row] <= 1 ) AS [o4] ON [o2].[OrderID] = [o4].[OrderID] LEFT JOIN [Order Details] AS [o1] ON [o4].[OrderID] = [o1].[OrderID] -ORDER BY [o2].[OrderID], [o4].[OrderID], [o1].[OrderID] +ORDER BY [o2].[OrderID], [o1].[OrderID] """); } @@ -1652,7 +1652,7 @@ public override async Task Join_Include_collection_GroupBy_Select(bool async) AssertSql( """ -SELECT [s1].[OrderID], [s1].[CustomerID], [s1].[EmployeeID], [s1].[OrderDate], [s].[OrderID], [s1].[OrderID0], [s1].[ProductID], [o3].[OrderID], [o3].[ProductID], [o3].[Discount], [o3].[Quantity], [o3].[UnitPrice] +SELECT [s1].[OrderID], [s1].[CustomerID], [s1].[EmployeeID], [s1].[OrderDate], [s].[OrderID], [o3].[OrderID], [o3].[ProductID], [o3].[Discount], [o3].[Quantity], [o3].[UnitPrice] FROM ( SELECT [o0].[OrderID] FROM [Order Details] AS [o] @@ -1661,9 +1661,9 @@ FROM [Order Details] AS [o] GROUP BY [o0].[OrderID] ) AS [s] LEFT JOIN ( - SELECT [s0].[OrderID], [s0].[CustomerID], [s0].[EmployeeID], [s0].[OrderDate], [s0].[OrderID0], [s0].[ProductID] + SELECT [s0].[OrderID], [s0].[CustomerID], [s0].[EmployeeID], [s0].[OrderDate] FROM ( - SELECT [o2].[OrderID], [o2].[CustomerID], [o2].[EmployeeID], [o2].[OrderDate], [o1].[OrderID] AS [OrderID0], [o1].[ProductID], ROW_NUMBER() OVER(PARTITION BY [o2].[OrderID] ORDER BY [o2].[OrderID]) AS [row] + SELECT [o2].[OrderID], [o2].[CustomerID], [o2].[EmployeeID], [o2].[OrderDate], ROW_NUMBER() OVER(PARTITION BY [o2].[OrderID] ORDER BY [o2].[OrderID]) AS [row] FROM [Order Details] AS [o1] INNER JOIN [Orders] AS [o2] ON [o1].[OrderID] = [o2].[OrderID] WHERE [o1].[OrderID] = 10248 @@ -1671,7 +1671,7 @@ FROM [Order Details] AS [o1] WHERE [s0].[row] <= 1 ) AS [s1] ON [s].[OrderID] = [s1].[OrderID] LEFT JOIN [Order Details] AS [o3] ON [s1].[OrderID] = [o3].[OrderID] -ORDER BY [s].[OrderID], [s1].[OrderID0], [s1].[ProductID], [s1].[OrderID], [o3].[OrderID] +ORDER BY [s].[OrderID], [o3].[OrderID] """); } @@ -1735,12 +1735,12 @@ public override async Task Include_collection_and_reference(bool async) AssertSql( """ -SELECT [o].[OrderID], [o].[CustomerID], [o].[EmployeeID], [o].[OrderDate], [c].[CustomerID], [o0].[OrderID], [o0].[ProductID], [o0].[Discount], [o0].[Quantity], [o0].[UnitPrice], [c].[Address], [c].[City], [c].[CompanyName], [c].[ContactName], [c].[ContactTitle], [c].[Country], [c].[Fax], [c].[Phone], [c].[PostalCode], [c].[Region] +SELECT [o].[OrderID], [o].[CustomerID], [o].[EmployeeID], [o].[OrderDate], [o0].[OrderID], [o0].[ProductID], [o0].[Discount], [o0].[Quantity], [o0].[UnitPrice], [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] LEFT JOIN [Order Details] AS [o0] ON [o].[OrderID] = [o0].[OrderID] WHERE [o].[CustomerID] LIKE N'F%' -ORDER BY [o].[OrderID], [c].[CustomerID], [o0].[OrderID] +ORDER BY [o].[OrderID], [o0].[OrderID] """); } @@ -1771,7 +1771,7 @@ FROM [Order Details] AS [o] LEFT JOIN [Customers] AS [c] ON [o0].[CustomerID] = [c].[CustomerID] LEFT JOIN [Orders] AS [o1] ON [c].[CustomerID] = [o1].[CustomerID] WHERE [o].[OrderID] = 10248 -ORDER BY [o].[OrderID], [o].[ProductID], [o0].[OrderID], [c].[CustomerID] +ORDER BY [o].[OrderID], [o].[ProductID] """); } @@ -1781,7 +1781,7 @@ public override async Task SelectMany_Include_collection_GroupBy_Select(bool asy AssertSql( """ -SELECT [s1].[OrderID], [s1].[CustomerID], [s1].[EmployeeID], [s1].[OrderDate], [s].[OrderID], [s1].[OrderID0], [s1].[ProductID], [o3].[OrderID], [o3].[ProductID], [o3].[Discount], [o3].[Quantity], [o3].[UnitPrice] +SELECT [s1].[OrderID], [s1].[CustomerID], [s1].[EmployeeID], [s1].[OrderDate], [s].[OrderID], [o3].[OrderID], [o3].[ProductID], [o3].[Discount], [o3].[Quantity], [o3].[UnitPrice] FROM ( SELECT [o0].[OrderID] FROM [Order Details] AS [o] @@ -1790,9 +1790,9 @@ CROSS JOIN [Orders] AS [o0] GROUP BY [o0].[OrderID] ) AS [s] LEFT JOIN ( - SELECT [s0].[OrderID], [s0].[CustomerID], [s0].[EmployeeID], [s0].[OrderDate], [s0].[OrderID0], [s0].[ProductID] + SELECT [s0].[OrderID], [s0].[CustomerID], [s0].[EmployeeID], [s0].[OrderDate] FROM ( - SELECT [o2].[OrderID], [o2].[CustomerID], [o2].[EmployeeID], [o2].[OrderDate], [o1].[OrderID] AS [OrderID0], [o1].[ProductID], ROW_NUMBER() OVER(PARTITION BY [o2].[OrderID] ORDER BY [o2].[OrderID]) AS [row] + SELECT [o2].[OrderID], [o2].[CustomerID], [o2].[EmployeeID], [o2].[OrderDate], ROW_NUMBER() OVER(PARTITION BY [o2].[OrderID] ORDER BY [o2].[OrderID]) AS [row] FROM [Order Details] AS [o1] CROSS JOIN [Orders] AS [o2] WHERE [o1].[OrderID] = 10248 @@ -1800,7 +1800,7 @@ CROSS JOIN [Orders] AS [o2] WHERE [s0].[row] <= 1 ) AS [s1] ON [s].[OrderID] = [s1].[OrderID] LEFT JOIN [Order Details] AS [o3] ON [s1].[OrderID] = [o3].[OrderID] -ORDER BY [s].[OrderID], [s1].[OrderID0], [s1].[ProductID], [s1].[OrderID], [o3].[OrderID] +ORDER BY [s].[OrderID], [o3].[OrderID] """); } @@ -1868,7 +1868,7 @@ 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] LIKE N'F%' -ORDER BY [o].[OrderID], [c].[CustomerID], [o0].[OrderID] +ORDER BY [o].[OrderID], [o0].[OrderID] """); } @@ -1939,7 +1939,7 @@ 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] LIKE N'F%' -ORDER BY [o].[OrderID], [c].[CustomerID] +ORDER BY [o].[OrderID] """); } @@ -2022,7 +2022,7 @@ FROM [Orders] AS [o] WHERE [o].[OrderID] = 10248 ) AS [s] LEFT JOIN [Orders] AS [o0] ON [s].[CustomerID0] = [o0].[CustomerID] -ORDER BY [s].[OrderID], [s].[CustomerID0] +ORDER BY [s].[OrderID] """); } @@ -2032,14 +2032,14 @@ public override async Task Include_multiple_references_and_collection_multi_leve AssertSql( """ -SELECT [o].[OrderID], [o].[ProductID], [o].[Discount], [o].[Quantity], [o].[UnitPrice], [o0].[OrderID], [o0].[CustomerID], [o0].[EmployeeID], [o0].[OrderDate], [c].[CustomerID], [c].[Address], [c].[City], [c].[CompanyName], [c].[ContactName], [c].[ContactTitle], [c].[Country], [c].[Fax], [c].[Phone], [c].[PostalCode], [c].[Region], [p].[ProductID], [o1].[OrderID], [o1].[CustomerID], [o1].[EmployeeID], [o1].[OrderDate], [p].[Discontinued], [p].[ProductName], [p].[SupplierID], [p].[UnitPrice], [p].[UnitsInStock] +SELECT [o].[OrderID], [o].[ProductID], [o].[Discount], [o].[Quantity], [o].[UnitPrice], [o0].[OrderID], [o0].[CustomerID], [o0].[EmployeeID], [o0].[OrderDate], [c].[CustomerID], [c].[Address], [c].[City], [c].[CompanyName], [c].[ContactName], [c].[ContactTitle], [c].[Country], [c].[Fax], [c].[Phone], [c].[PostalCode], [c].[Region], [o1].[OrderID], [o1].[CustomerID], [o1].[EmployeeID], [o1].[OrderDate], [p].[ProductID], [p].[Discontinued], [p].[ProductName], [p].[SupplierID], [p].[UnitPrice], [p].[UnitsInStock] 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] LEFT JOIN [Orders] AS [o1] ON [c].[CustomerID] = [o1].[CustomerID] WHERE [o].[OrderID] % 23 = 13 -ORDER BY [o].[OrderID], [o].[ProductID], [o0].[OrderID], [c].[CustomerID], [p].[ProductID] +ORDER BY [o].[OrderID], [o].[ProductID] """); } @@ -2112,7 +2112,7 @@ FROM [Order Details] AS [o] INNER JOIN [Orders] AS [o0] ON [o].[OrderID] = [o0].[OrderID] ) AS [s] ON [p].[ProductID] = [s].[ProductID] WHERE [p].[ProductID] % 17 = 5 AND [p].[UnitPrice] < 20.0 -ORDER BY [p].[ProductID], [s].[OrderID], [s].[ProductID] +ORDER BY [p].[ProductID], [s].[OrderID] """); } @@ -2141,7 +2141,7 @@ FROM [Order Details] AS [o] LEFT JOIN [Customers] AS [c] ON [o0].[CustomerID] = [c].[CustomerID] LEFT JOIN [Orders] AS [o1] ON [c].[CustomerID] = [o1].[CustomerID] WHERE [o].[OrderID] = 10248 -ORDER BY [o].[OrderID], [o].[ProductID], [o0].[OrderID], [c].[CustomerID] +ORDER BY [o].[OrderID], [o].[ProductID] """); } diff --git a/test/EFCore.SqlServer.FunctionalTests/Query/OwnedEntityQuerySqlServerTest.cs b/test/EFCore.SqlServer.FunctionalTests/Query/OwnedEntityQuerySqlServerTest.cs index e91ee641e95..2bce79623e8 100644 --- a/test/EFCore.SqlServer.FunctionalTests/Query/OwnedEntityQuerySqlServerTest.cs +++ b/test/EFCore.SqlServer.FunctionalTests/Query/OwnedEntityQuerySqlServerTest.cs @@ -484,7 +484,7 @@ public override async Task Can_auto_include_navigation_from_model() AssertSql( """ -SELECT [p].[Id], [r].[Id], [c].[Id], [c].[ParentId], [p].[OwnedReference_Id], [r].[ParentId], [s].[Id], [s].[ParentId], [s].[OtherSideId] +SELECT [p].[Id], [c].[Id], [c].[ParentId], [p].[OwnedReference_Id], [r].[Id], [r].[ParentId], [s].[Id], [s].[ParentId], [s].[OtherSideId] FROM [Parents] AS [p] LEFT JOIN [Reference] AS [r] ON [p].[Id] = [r].[ParentId] LEFT JOIN [Collection] AS [c] ON [p].[Id] = [c].[ParentId] @@ -493,7 +493,7 @@ LEFT JOIN ( FROM [JoinEntity] AS [j] INNER JOIN [OtherSide] AS [o] ON [j].[OtherSideId] = [o].[Id] ) AS [s] ON [p].[Id] = [s].[ParentId] -ORDER BY [p].[Id], [r].[Id], [c].[Id], [s].[ParentId], [s].[OtherSideId] +ORDER BY [p].[Id], [c].[Id], [s].[ParentId] """, // """ diff --git a/test/EFCore.SqlServer.FunctionalTests/Query/OwnedQuerySqlServerTest.cs b/test/EFCore.SqlServer.FunctionalTests/Query/OwnedQuerySqlServerTest.cs index 758f0e05409..ceb610b0a44 100644 --- a/test/EFCore.SqlServer.FunctionalTests/Query/OwnedQuerySqlServerTest.cs +++ b/test/EFCore.SqlServer.FunctionalTests/Query/OwnedQuerySqlServerTest.cs @@ -340,7 +340,7 @@ public override async Task Filter_owned_entity_chained_with_regular_entity_follo AssertSql( """ -SELECT [o].[Id], [p].[Id], [s].[ClientId], [s].[Id], [s].[OrderDate], [s].[OrderClientId], [s].[OrderId], [s].[Id0], [s].[Detail] +SELECT [o].[Id], [s].[ClientId], [s].[Id], [s].[OrderDate], [s].[OrderClientId], [s].[OrderId], [s].[Id0], [s].[Detail] FROM [OwnedPerson] AS [o] LEFT JOIN [Planet] AS [p] ON [o].[PersonAddress_Country_PlanetId] = [p].[Id] LEFT JOIN ( @@ -349,7 +349,7 @@ FROM [Order] AS [o0] LEFT JOIN [OrderDetail] AS [o1] ON [o0].[ClientId] = [o1].[OrderClientId] AND [o0].[Id] = [o1].[OrderId] ) AS [s] ON [o].[Id] = [s].[ClientId] WHERE [p].[Id] <> 42 OR [p].[Id] IS NULL -ORDER BY [o].[Id], [p].[Id], [s].[ClientId], [s].[Id], [s].[OrderClientId], [s].[OrderId] +ORDER BY [o].[Id], [s].[ClientId], [s].[Id], [s].[OrderClientId], [s].[OrderId] """); } @@ -359,7 +359,7 @@ public override async Task Project_multiple_owned_navigations(bool async) AssertSql( """ -SELECT [o].[Id], [p].[Id], [s].[ClientId], [s].[Id], [s].[OrderDate], [s].[OrderClientId], [s].[OrderId], [s].[Id0], [s].[Detail], [o].[PersonAddress_AddressLine], [o].[PersonAddress_PlaceType], [o].[PersonAddress_ZipCode], [o].[PersonAddress_Country_Name], [o].[PersonAddress_Country_PlanetId], [p].[Name], [p].[StarId] +SELECT [o].[Id], [s].[ClientId], [s].[Id], [s].[OrderDate], [s].[OrderClientId], [s].[OrderId], [s].[Id0], [s].[Detail], [o].[PersonAddress_AddressLine], [o].[PersonAddress_PlaceType], [o].[PersonAddress_ZipCode], [o].[PersonAddress_Country_Name], [o].[PersonAddress_Country_PlanetId], [p].[Id], [p].[Name], [p].[StarId] FROM [OwnedPerson] AS [o] LEFT JOIN [Planet] AS [p] ON [o].[PersonAddress_Country_PlanetId] = [p].[Id] LEFT JOIN ( @@ -367,7 +367,7 @@ LEFT JOIN ( FROM [Order] AS [o0] LEFT JOIN [OrderDetail] AS [o1] ON [o0].[ClientId] = [o1].[OrderClientId] AND [o0].[Id] = [o1].[OrderId] ) AS [s] ON [o].[Id] = [s].[ClientId] -ORDER BY [o].[Id], [p].[Id], [s].[ClientId], [s].[Id], [s].[OrderClientId], [s].[OrderId] +ORDER BY [o].[Id], [s].[ClientId], [s].[Id], [s].[OrderClientId], [s].[OrderId] """); } @@ -396,7 +396,7 @@ public override async Task Navigation_rewrite_on_owned_reference_followed_by_reg AssertSql( """ -SELECT [o].[Id], [o].[Discriminator], [o].[Name], [p].[Id], [s].[ClientId], [s].[Id], [s].[OrderDate], [s].[OrderClientId], [s].[OrderId], [s].[Id0], [s].[Detail], [o].[PersonAddress_AddressLine], [o].[PersonAddress_PlaceType], [o].[PersonAddress_ZipCode], [o].[PersonAddress_Country_Name], [o].[PersonAddress_Country_PlanetId], [o].[BranchAddress_BranchName], [o].[BranchAddress_PlaceType], [o].[BranchAddress_Country_Name], [o].[BranchAddress_Country_PlanetId], [o].[LeafBAddress_LeafBType], [o].[LeafBAddress_PlaceType], [o].[LeafBAddress_Country_Name], [o].[LeafBAddress_Country_PlanetId], [o].[LeafAAddress_LeafType], [o].[LeafAAddress_PlaceType], [o].[LeafAAddress_Country_Name], [o].[LeafAAddress_Country_PlanetId] +SELECT [o].[Id], [o].[Discriminator], [o].[Name], [s].[ClientId], [s].[Id], [s].[OrderDate], [s].[OrderClientId], [s].[OrderId], [s].[Id0], [s].[Detail], [o].[PersonAddress_AddressLine], [o].[PersonAddress_PlaceType], [o].[PersonAddress_ZipCode], [o].[PersonAddress_Country_Name], [o].[PersonAddress_Country_PlanetId], [o].[BranchAddress_BranchName], [o].[BranchAddress_PlaceType], [o].[BranchAddress_Country_Name], [o].[BranchAddress_Country_PlanetId], [o].[LeafBAddress_LeafBType], [o].[LeafBAddress_PlaceType], [o].[LeafBAddress_Country_Name], [o].[LeafBAddress_Country_PlanetId], [o].[LeafAAddress_LeafType], [o].[LeafAAddress_PlaceType], [o].[LeafAAddress_Country_Name], [o].[LeafAAddress_Country_PlanetId] FROM [OwnedPerson] AS [o] LEFT JOIN [Planet] AS [p] ON [o].[PersonAddress_Country_PlanetId] = [p].[Id] LEFT JOIN ( @@ -405,7 +405,7 @@ FROM [Order] AS [o0] LEFT JOIN [OrderDetail] AS [o1] ON [o0].[ClientId] = [o1].[OrderClientId] AND [o0].[Id] = [o1].[OrderId] ) AS [s] ON [o].[Id] = [s].[ClientId] WHERE [p].[Id] <> 7 OR [p].[Id] IS NULL -ORDER BY [o].[Id], [p].[Id], [s].[ClientId], [s].[Id], [s].[OrderClientId], [s].[OrderId] +ORDER BY [o].[Id], [s].[ClientId], [s].[Id], [s].[OrderClientId], [s].[OrderId] """); } @@ -427,11 +427,11 @@ public override async Task Navigation_rewrite_on_owned_reference_followed_by_reg AssertSql( """ -SELECT [o].[Id], [p].[Id], [m].[Id], [m].[Diameter], [m].[PlanetId] +SELECT [o].[Id], [m].[Id], [m].[Diameter], [m].[PlanetId] FROM [OwnedPerson] AS [o] LEFT JOIN [Planet] AS [p] ON [o].[PersonAddress_Country_PlanetId] = [p].[Id] LEFT JOIN [Moon] AS [m] ON [p].[Id] = [m].[PlanetId] -ORDER BY [o].[Id], [p].[Id] +ORDER BY [o].[Id] """); } @@ -468,12 +468,12 @@ public override async Task Navigation_rewrite_on_owned_reference_followed_by_reg AssertSql( """ -SELECT [s].[Id], [s].[Name], [o].[Id], [p].[Id], [e].[Id], [e].[Name], [e].[StarId] +SELECT [s].[Id], [s].[Name], [o].[Id], [e].[Id], [e].[Name], [e].[StarId] FROM [OwnedPerson] AS [o] LEFT JOIN [Planet] AS [p] ON [o].[PersonAddress_Country_PlanetId] = [p].[Id] LEFT JOIN [Star] AS [s] ON [p].[StarId] = [s].[Id] LEFT JOIN [Element] AS [e] ON [s].[Id] = [e].[StarId] -ORDER BY [o].[Id], [p].[Id], [s].[Id] +ORDER BY [o].[Id] """); } @@ -499,13 +499,13 @@ await base.Navigation_rewrite_on_owned_reference_followed_by_regular_entity_and_ AssertSql( """ -SELECT [s].[Id], [s].[Name], [o].[Id], [p].[Id], [e].[Id], [e].[Name], [e].[StarId] +SELECT [s].[Id], [s].[Name], [o].[Id], [e].[Id], [e].[Name], [e].[StarId] FROM [OwnedPerson] AS [o] LEFT JOIN [Planet] AS [p] ON [o].[PersonAddress_Country_PlanetId] = [p].[Id] LEFT JOIN [Star] AS [s] ON [p].[StarId] = [s].[Id] LEFT JOIN [Element] AS [e] ON [s].[Id] = [e].[StarId] WHERE [s].[Name] = N'Sol' -ORDER BY [o].[Id], [p].[Id], [s].[Id] +ORDER BY [o].[Id] """); } @@ -1170,27 +1170,25 @@ public override async Task Project_multiple_owned_navigations_split(bool async) AssertSql( """ -SELECT [o].[Id], [p].[Id], [o].[PersonAddress_AddressLine], [o].[PersonAddress_PlaceType], [o].[PersonAddress_ZipCode], [o].[PersonAddress_Country_Name], [o].[PersonAddress_Country_PlanetId], [p].[Name], [p].[StarId] +SELECT [o].[Id], [o].[PersonAddress_AddressLine], [o].[PersonAddress_PlaceType], [o].[PersonAddress_ZipCode], [o].[PersonAddress_Country_Name], [o].[PersonAddress_Country_PlanetId], [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], [p].[Id] +ORDER BY [o].[Id] """, // """ -SELECT [o1].[ClientId], [o1].[Id], [o1].[OrderDate], [o].[Id], [p].[Id] +SELECT [o1].[ClientId], [o1].[Id], [o1].[OrderDate], [o].[Id] FROM [OwnedPerson] AS [o] -LEFT JOIN [Planet] AS [p] ON [o].[PersonAddress_Country_PlanetId] = [p].[Id] INNER JOIN [Order] AS [o1] ON [o].[Id] = [o1].[ClientId] -ORDER BY [o].[Id], [p].[Id], [o1].[ClientId], [o1].[Id] +ORDER BY [o].[Id], [o1].[ClientId], [o1].[Id] """, // """ -SELECT [o3].[OrderClientId], [o3].[OrderId], [o3].[Id], [o3].[Detail], [o].[Id], [p].[Id], [o1].[ClientId], [o1].[Id] +SELECT [o3].[OrderClientId], [o3].[OrderId], [o3].[Id], [o3].[Detail], [o].[Id], [o1].[ClientId], [o1].[Id] FROM [OwnedPerson] AS [o] -LEFT JOIN [Planet] AS [p] ON [o].[PersonAddress_Country_PlanetId] = [p].[Id] INNER JOIN [Order] AS [o1] ON [o].[Id] = [o1].[ClientId] INNER JOIN [OrderDetail] AS [o3] ON [o1].[ClientId] = [o3].[OrderClientId] AND [o1].[Id] = [o3].[OrderId] -ORDER BY [o].[Id], [p].[Id], [o1].[ClientId], [o1].[Id] +ORDER BY [o].[Id], [o1].[ClientId], [o1].[Id] """); } @@ -1200,18 +1198,17 @@ public override async Task Navigation_rewrite_on_owned_reference_followed_by_reg AssertSql( """ -SELECT [o].[Id], [p].[Id] +SELECT [o].[Id] FROM [OwnedPerson] AS [o] -LEFT JOIN [Planet] AS [p] ON [o].[PersonAddress_Country_PlanetId] = [p].[Id] -ORDER BY [o].[Id], [p].[Id] +ORDER BY [o].[Id] """, // """ -SELECT [m].[Id], [m].[Diameter], [m].[PlanetId], [o].[Id], [p].[Id] +SELECT [m].[Id], [m].[Diameter], [m].[PlanetId], [o].[Id] FROM [OwnedPerson] AS [o] LEFT JOIN [Planet] AS [p] ON [o].[PersonAddress_Country_PlanetId] = [p].[Id] INNER JOIN [Moon] AS [m] ON [p].[Id] = [m].[PlanetId] -ORDER BY [o].[Id], [p].[Id] +ORDER BY [o].[Id] """); } @@ -1391,11 +1388,11 @@ public override async Task Projecting_collection_correlated_with_keyless_entity_ AssertSql( """ -SELECT [b].[Throned_Value], [f].[Id], [b].[Id], [p].[Id], [p].[Name], [p].[StarId] +SELECT [b].[Throned_Value], [f].[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 -ORDER BY [f].[Id], [b].[Id] +ORDER BY [f].[Id] """); } @@ -1467,7 +1464,7 @@ LEFT JOIN ( FROM [Order] AS [o2] LEFT JOIN [OrderDetail] AS [o3] ON [o2].[ClientId] = [o3].[OrderClientId] AND [o2].[Id] = [o3].[OrderId] ) AS [s0] ON [o].[Id] = [s0].[ClientId] -ORDER BY [p].[Id], [o].[Id], [s].[ClientId], [s].[Id], [s].[OrderClientId], [s].[OrderId], [s].[Id0], [s0].[ClientId], [s0].[Id], [s0].[OrderClientId], [s0].[OrderId] +ORDER BY [p].[Id], [s].[ClientId], [s].[Id], [s].[OrderClientId], [s].[OrderId], [s].[Id0], [s0].[ClientId], [s0].[Id], [s0].[OrderClientId], [s0].[OrderId] """); } @@ -1489,7 +1486,7 @@ LEFT JOIN ( FROM [Order] AS [o0] LEFT JOIN [OrderDetail] AS [o1] ON [o0].[ClientId] = [o1].[OrderClientId] AND [o0].[Id] = [o1].[OrderId] ) AS [s0] ON [s].[Id0] = [s0].[ClientId] -ORDER BY [p].[Id], [s].[Id], [s].[Id0], [s0].[ClientId], [s0].[Id], [s0].[OrderClientId], [s0].[OrderId] +ORDER BY [p].[Id], [s].[Id], [s0].[ClientId], [s0].[Id], [s0].[OrderClientId], [s0].[OrderId] """); } diff --git a/test/EFCore.SqlServer.FunctionalTests/Query/TemporalComplexNavigationsCollectionsQuerySqlServerTest.cs b/test/EFCore.SqlServer.FunctionalTests/Query/TemporalComplexNavigationsCollectionsQuerySqlServerTest.cs index bd7663a5818..07544c66999 100644 --- a/test/EFCore.SqlServer.FunctionalTests/Query/TemporalComplexNavigationsCollectionsQuerySqlServerTest.cs +++ b/test/EFCore.SqlServer.FunctionalTests/Query/TemporalComplexNavigationsCollectionsQuerySqlServerTest.cs @@ -137,7 +137,7 @@ 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 -ORDER BY [l].[Id], [s].[Id], [s].[Id0] +ORDER BY [l].[Id] """); } @@ -159,7 +159,7 @@ WHERE [l1].[Name] <> N'Foo' OR [l1].[Name] IS NULL ) AS [l2] WHERE 1 < [l2].[row] AND [l2].[row] <= 4 ) AS [l3] ON [l0].[Id] = [l3].[OneToMany_Optional_Inverse3Id] -ORDER BY [l].[Id], [l0].[Id], [l3].[OneToMany_Optional_Inverse3Id], [l3].[Name] +ORDER BY [l].[Id], [l3].[OneToMany_Optional_Inverse3Id], [l3].[Name] """); } @@ -209,7 +209,7 @@ SELECT TOP(40) [l0].[Id], [l0].[Date], [l0].[Level1_Optional_Id], [l0].[Level1_R ) AS [l2] LEFT JOIN [LevelThree] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l1] ON [l2].[Id] = [l1].[Level2_Optional_Id] ) AS [s] -ORDER BY [l3].[Id], [s].[Id] +ORDER BY [l3].[Id] """); } @@ -231,7 +231,7 @@ LEFT JOIN ( FROM [LevelTwo] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l2] LEFT JOIN [LevelThree] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l3] ON [l2].[Id] = [l3].[OneToOne_Optional_PK_Inverse3Id] ) AS [s0] ON [l].[Id] = [s0].[OneToMany_Optional_Inverse2Id] -ORDER BY [l].[Id], [s].[Id], [s].[Id0], [s0].[Id] +ORDER BY [l].[Id], [s].[Id] """); } @@ -246,7 +246,7 @@ public override async Task SelectMany_with_Include_ThenInclude(bool async) INNER JOIN [LevelTwo] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l0] ON [l].[Id] = [l0].[OneToMany_Optional_Inverse2Id] LEFT JOIN [LevelThree] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l1] ON [l0].[Id] = [l1].[Level2_Required_Id] LEFT JOIN [LevelFour] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l2] ON [l1].[Id] = [l2].[OneToMany_Optional_Inverse4Id] -ORDER BY [l].[Id], [l0].[Id], [l1].[Id] +ORDER BY [l].[Id], [l0].[Id] """); } @@ -268,7 +268,7 @@ WHERE [l1].[Name] <> N'Foo' OR [l1].[Name] IS NULL ) AS [l2] WHERE 1 < [l2].[row] AND [l2].[row] <= 4 ) AS [l3] ON [l0].[Id] = [l3].[OneToMany_Optional_Inverse3Id] -ORDER BY [l].[Id], [l0].[Id], [l3].[OneToMany_Optional_Inverse3Id], [l3].[Name] +ORDER BY [l].[Id], [l3].[OneToMany_Optional_Inverse3Id], [l3].[Name] """); } @@ -278,7 +278,7 @@ public override async Task Complex_query_with_let_collection_projection_FirstOrD AssertSql( """ -SELECT [l].[Id], [l4].[Id], [l5].[Name], [l5].[Id], [l4].[c] +SELECT [l].[Id], [l5].[Name], [l5].[Id], [l4].[c] FROM [LevelOne] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l] LEFT JOIN ( SELECT [l3].[c], [l3].[Id], [l3].[OneToMany_Optional_Inverse2Id] @@ -297,7 +297,7 @@ SELECT 1 FROM [LevelTwo] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l2] WHERE [l1].[Id] = [l2].[OneToMany_Optional_Inverse2Id] AND [l2].[Id] = [l4].[Id]) ) AS [l5] -ORDER BY [l].[Id], [l4].[Id] +ORDER BY [l].[Id] """); } @@ -348,10 +348,10 @@ public override async Task Filtered_include_same_filter_set_on_same_navigation_t AssertSql( """ -SELECT [l].[Id], [l].[Date], [l].[Name], [l].[OneToMany_Optional_Self_Inverse1Id], [l].[OneToMany_Required_Self_Inverse1Id], [l].[OneToOne_Optional_Self1Id], [l].[PeriodEnd], [l].[PeriodStart], [s].[Id], [s].[Date], [s].[Level1_Optional_Id], [s].[Level1_Required_Id], [s].[Name], [s].[OneToMany_Optional_Inverse2Id], [s].[OneToMany_Optional_Self_Inverse2Id], [s].[OneToMany_Required_Inverse2Id], [s].[OneToMany_Required_Self_Inverse2Id], [s].[OneToOne_Optional_PK_Inverse2Id], [s].[OneToOne_Optional_Self2Id], [s].[PeriodEnd], [s].[PeriodStart], [s].[Id0], [s].[Id1], [s].[Level2_Optional_Id], [s].[Level2_Required_Id], [s].[Name0], [s].[OneToMany_Optional_Inverse3Id], [s].[OneToMany_Optional_Self_Inverse3Id], [s].[OneToMany_Required_Inverse3Id], [s].[OneToMany_Required_Self_Inverse3Id], [s].[OneToOne_Optional_PK_Inverse3Id], [s].[OneToOne_Optional_Self3Id], [s].[PeriodEnd0], [s].[PeriodStart0], [s].[Level2_Optional_Id0], [s].[Level2_Required_Id0], [s].[Name1], [s].[OneToMany_Optional_Inverse3Id0], [s].[OneToMany_Optional_Self_Inverse3Id0], [s].[OneToMany_Required_Inverse3Id0], [s].[OneToMany_Required_Self_Inverse3Id0], [s].[OneToOne_Optional_PK_Inverse3Id0], [s].[OneToOne_Optional_Self3Id0], [s].[PeriodEnd1], [s].[PeriodStart1] +SELECT [l].[Id], [l].[Date], [l].[Name], [l].[OneToMany_Optional_Self_Inverse1Id], [l].[OneToMany_Required_Self_Inverse1Id], [l].[OneToOne_Optional_Self1Id], [l].[PeriodEnd], [l].[PeriodStart], [s].[Id], [s].[Date], [s].[Level1_Optional_Id], [s].[Level1_Required_Id], [s].[Name], [s].[OneToMany_Optional_Inverse2Id], [s].[OneToMany_Optional_Self_Inverse2Id], [s].[OneToMany_Required_Inverse2Id], [s].[OneToMany_Required_Self_Inverse2Id], [s].[OneToOne_Optional_PK_Inverse2Id], [s].[OneToOne_Optional_Self2Id], [s].[PeriodEnd], [s].[PeriodStart], [s].[Id0], [s].[Level2_Optional_Id], [s].[Level2_Required_Id], [s].[Name0], [s].[OneToMany_Optional_Inverse3Id], [s].[OneToMany_Optional_Self_Inverse3Id], [s].[OneToMany_Required_Inverse3Id], [s].[OneToMany_Required_Self_Inverse3Id], [s].[OneToOne_Optional_PK_Inverse3Id], [s].[OneToOne_Optional_Self3Id], [s].[PeriodEnd0], [s].[PeriodStart0], [s].[Id1], [s].[Level2_Optional_Id0], [s].[Level2_Required_Id0], [s].[Name1], [s].[OneToMany_Optional_Inverse3Id0], [s].[OneToMany_Optional_Self_Inverse3Id0], [s].[OneToMany_Required_Inverse3Id0], [s].[OneToMany_Required_Self_Inverse3Id0], [s].[OneToOne_Optional_PK_Inverse3Id0], [s].[OneToOne_Optional_Self3Id0], [s].[PeriodEnd1], [s].[PeriodStart1] FROM [LevelOne] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l] OUTER APPLY ( - SELECT [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], [l1].[Id] AS [Id0], [l3].[Id] AS [Id1], [l3].[Level2_Optional_Id], [l3].[Level2_Required_Id], [l3].[Name] AS [Name0], [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] AS [PeriodEnd0], [l3].[PeriodStart] AS [PeriodStart0], [l1].[Level2_Optional_Id] AS [Level2_Optional_Id0], [l1].[Level2_Required_Id] AS [Level2_Required_Id0], [l1].[Name] AS [Name1], [l1].[OneToMany_Optional_Inverse3Id] AS [OneToMany_Optional_Inverse3Id0], [l1].[OneToMany_Optional_Self_Inverse3Id] AS [OneToMany_Optional_Self_Inverse3Id0], [l1].[OneToMany_Required_Inverse3Id] AS [OneToMany_Required_Inverse3Id0], [l1].[OneToMany_Required_Self_Inverse3Id] AS [OneToMany_Required_Self_Inverse3Id0], [l1].[OneToOne_Optional_PK_Inverse3Id] AS [OneToOne_Optional_PK_Inverse3Id0], [l1].[OneToOne_Optional_Self3Id] AS [OneToOne_Optional_Self3Id0], [l1].[PeriodEnd] AS [PeriodEnd1], [l1].[PeriodStart] AS [PeriodStart1] + SELECT [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], [l3].[Id] AS [Id0], [l3].[Level2_Optional_Id], [l3].[Level2_Required_Id], [l3].[Name] AS [Name0], [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] AS [PeriodEnd0], [l3].[PeriodStart] AS [PeriodStart0], [l1].[Id] AS [Id1], [l1].[Level2_Optional_Id] AS [Level2_Optional_Id0], [l1].[Level2_Required_Id] AS [Level2_Required_Id0], [l1].[Name] AS [Name1], [l1].[OneToMany_Optional_Inverse3Id] AS [OneToMany_Optional_Inverse3Id0], [l1].[OneToMany_Optional_Self_Inverse3Id] AS [OneToMany_Optional_Self_Inverse3Id0], [l1].[OneToMany_Required_Inverse3Id] AS [OneToMany_Required_Inverse3Id0], [l1].[OneToMany_Required_Self_Inverse3Id] AS [OneToMany_Required_Self_Inverse3Id0], [l1].[OneToOne_Optional_PK_Inverse3Id] AS [OneToOne_Optional_PK_Inverse3Id0], [l1].[OneToOne_Optional_Self3Id] AS [OneToOne_Optional_Self3Id0], [l1].[PeriodEnd] AS [PeriodEnd1], [l1].[PeriodStart] AS [PeriodStart1] FROM ( SELECT TOP(2) [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] @@ -361,7 +361,7 @@ ORDER BY [l0].[Id] LEFT JOIN [LevelThree] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l1] ON [l2].[Id] = [l1].[Level2_Required_Id] LEFT JOIN [LevelThree] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l3] ON [l2].[Id] = [l3].[OneToMany_Optional_Inverse3Id] ) AS [s] -ORDER BY [l].[Id], [s].[Id], [s].[Id0] +ORDER BY [l].[Id], [s].[Id] """); } @@ -449,7 +449,7 @@ LEFT JOIN ( WHERE [l3].[row] <= 1 ) AS [l4] ON [l2].[Name] = [l4].[Name] LEFT JOIN [LevelTwo] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l1] ON [l4].[Id] = [l1].[OneToMany_Optional_Inverse2Id] -ORDER BY [l2].[Name], [l4].[Id] +ORDER BY [l2].[Name] """); } @@ -459,10 +459,10 @@ public override async Task Select_subquery_single_nested_subquery2(bool async) AssertSql( """ -SELECT [l].[Id], [s].[Id], [s].[Id0], [s].[Id1], [s].[c] +SELECT [l].[Id], [s].[Id], [s].[Id0], [s].[c] FROM [LevelOne] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l] LEFT JOIN ( - SELECT [l0].[Id], [l4].[Id] AS [Id0], [l2].[Id] AS [Id1], [l4].[c], [l0].[OneToMany_Optional_Inverse2Id] + SELECT [l0].[Id], [l2].[Id] AS [Id0], [l4].[c], [l0].[OneToMany_Optional_Inverse2Id] FROM [LevelTwo] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l0] LEFT JOIN ( SELECT [l3].[c], [l3].[Id], [l3].[OneToMany_Optional_Inverse3Id] @@ -474,7 +474,7 @@ LEFT JOIN ( ) AS [l4] ON [l0].[Id] = [l4].[OneToMany_Optional_Inverse3Id] LEFT JOIN [LevelFour] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l2] ON [l4].[Id] = [l2].[OneToMany_Optional_Inverse4Id] ) AS [s] ON [l].[Id] = [s].[OneToMany_Optional_Inverse2Id] -ORDER BY [l].[Id], [s].[Id], [s].[Id0], [s].[Id1] +ORDER BY [l].[Id], [s].[Id], [s].[Id0] """); } @@ -506,7 +506,7 @@ LEFT JOIN ( FROM [LevelTwo] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l2] LEFT JOIN [LevelThree] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l3] ON [l2].[Id] = [l3].[Level2_Optional_Id] ) AS [s] ON [l].[Id] = [s].[OneToMany_Optional_Inverse2Id] -ORDER BY [l].[Id], [l0].[Id], [l1].[Id], [s].[Id] +ORDER BY [l].[Id], [l1].[Id] """); } @@ -554,7 +554,7 @@ OFFSET 1 ROWS FETCH NEXT 4 ROWS ONLY ) AS [l2] LEFT JOIN [LevelThree] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l1] ON [l2].[Id] = [l1].[Level2_Optional_Id] ) AS [s] -ORDER BY [l3].[Id] DESC, [s].[Name] DESC, [s].[Id] +ORDER BY [l3].[Id] DESC, [s].[Name] DESC """); } @@ -564,17 +564,17 @@ public override async Task Null_check_in_Dto_projection_should_not_be_removed(bo AssertSql( """ -SELECT [l].[Id], [s].[c], [s].[Name], [s].[Id], [s].[Id0] +SELECT [l].[Id], [s].[c], [s].[Name], [s].[Id] FROM [LevelOne] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l] LEFT JOIN ( SELECT CASE WHEN [l1].[Id] IS NULL THEN CAST(1 AS bit) ELSE CAST(0 AS bit) - END AS [c], [l1].[Name], [l0].[Id], [l1].[Id] AS [Id0], [l0].[OneToMany_Optional_Inverse2Id] + END AS [c], [l1].[Name], [l0].[Id], [l0].[OneToMany_Optional_Inverse2Id] 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].[Level2_Required_Id] ) AS [s] ON [l].[Id] = [s].[OneToMany_Optional_Inverse2Id] -ORDER BY [l].[Id], [s].[Id] +ORDER BY [l].[Id] """); } @@ -584,7 +584,7 @@ public override async Task Include_partially_added_before_Where_and_then_build_u AssertSql( """ -SELECT [l].[Id], [l].[Date], [l].[Name], [l].[OneToMany_Optional_Self_Inverse1Id], [l].[OneToMany_Required_Self_Inverse1Id], [l].[OneToOne_Optional_Self1Id], [l].[PeriodEnd], [l].[PeriodStart], [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], [l0].[Id], [s].[Id], [s].[Level2_Optional_Id], [s].[Level2_Required_Id], [s].[Name], [s].[OneToMany_Optional_Inverse3Id], [s].[OneToMany_Optional_Self_Inverse3Id], [s].[OneToMany_Required_Inverse3Id], [s].[OneToMany_Required_Self_Inverse3Id], [s].[OneToOne_Optional_PK_Inverse3Id], [s].[OneToOne_Optional_Self3Id], [s].[PeriodEnd], [s].[PeriodStart], [s].[Id0], [s].[Level3_Optional_Id], [s].[Level3_Required_Id], [s].[Name0], [s].[OneToMany_Optional_Inverse4Id], [s].[OneToMany_Optional_Self_Inverse4Id], [s].[OneToMany_Required_Inverse4Id], [s].[OneToMany_Required_Self_Inverse4Id], [s].[OneToOne_Optional_PK_Inverse4Id], [s].[OneToOne_Optional_Self4Id], [s].[PeriodEnd0], [s].[PeriodStart0] +SELECT [l].[Id], [l].[Date], [l].[Name], [l].[OneToMany_Optional_Self_Inverse1Id], [l].[OneToMany_Required_Self_Inverse1Id], [l].[OneToOne_Optional_Self1Id], [l].[PeriodEnd], [l].[PeriodStart], [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], [s].[Id], [s].[Level2_Optional_Id], [s].[Level2_Required_Id], [s].[Name], [s].[OneToMany_Optional_Inverse3Id], [s].[OneToMany_Optional_Self_Inverse3Id], [s].[OneToMany_Required_Inverse3Id], [s].[OneToMany_Required_Self_Inverse3Id], [s].[OneToOne_Optional_PK_Inverse3Id], [s].[OneToOne_Optional_Self3Id], [s].[PeriodEnd], [s].[PeriodStart], [s].[Id0], [s].[Level3_Optional_Id], [s].[Level3_Required_Id], [s].[Name0], [s].[OneToMany_Optional_Inverse4Id], [s].[OneToMany_Optional_Self_Inverse4Id], [s].[OneToMany_Required_Inverse4Id], [s].[OneToMany_Required_Self_Inverse4Id], [s].[OneToOne_Optional_PK_Inverse4Id], [s].[OneToOne_Optional_Self4Id], [s].[PeriodEnd0], [s].[PeriodStart0] 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].[OneToOne_Optional_PK_Inverse2Id] LEFT JOIN [LevelTwo] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l1] ON [l].[Id] = [l1].[Level1_Optional_Id] @@ -594,7 +594,7 @@ LEFT JOIN ( LEFT JOIN [LevelFour] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l3] ON [l2].[Id] = [l3].[Level3_Optional_Id] ) AS [s] ON [l1].[Id] = [s].[OneToMany_Optional_Inverse3Id] WHERE [l0].[Id] < 3 OR [l1].[Id] > 8 -ORDER BY [l].[Id], [l0].[Id], [l1].[Id], [s].[Id] +ORDER BY [l].[Id] """); } @@ -607,7 +607,7 @@ public override async Task Complex_multi_include_with_order_by_and_paging_joins_ @p='0' @p1='10' -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], [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], [l2].[Id], [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], [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], [l4].[Id], [l4].[Level2_Optional_Id], [l4].[Level2_Required_Id], [l4].[Name], [l4].[OneToMany_Optional_Inverse3Id], [l4].[OneToMany_Optional_Self_Inverse3Id], [l4].[OneToMany_Required_Inverse3Id], [l4].[OneToMany_Required_Self_Inverse3Id], [l4].[OneToOne_Optional_PK_Inverse3Id], [l4].[OneToOne_Optional_Self3Id], [l4].[PeriodEnd], [l4].[PeriodStart] +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], [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], [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], [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], [l4].[Id], [l4].[Level2_Optional_Id], [l4].[Level2_Required_Id], [l4].[Name], [l4].[OneToMany_Optional_Inverse3Id], [l4].[OneToMany_Optional_Self_Inverse3Id], [l4].[OneToMany_Required_Inverse3Id], [l4].[OneToMany_Required_Self_Inverse3Id], [l4].[OneToOne_Optional_PK_Inverse3Id], [l4].[OneToOne_Optional_Self3Id], [l4].[PeriodEnd], [l4].[PeriodStart] FROM ( SELECT [l].[Id], [l].[Date], [l].[Name], [l].[OneToMany_Optional_Self_Inverse1Id], [l].[OneToMany_Required_Self_Inverse1Id], [l].[OneToOne_Optional_Self1Id], [l].[PeriodEnd], [l].[PeriodStart] FROM [LevelOne] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l] @@ -618,7 +618,7 @@ OFFSET @p ROWS FETCH NEXT @p1 ROWS ONLY LEFT JOIN [LevelTwo] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l2] ON [l1].[Id] = [l2].[Level1_Required_Id] LEFT JOIN [LevelThree] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l3] ON [l0].[Id] = [l3].[OneToMany_Optional_Inverse3Id] LEFT JOIN [LevelThree] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l4] ON [l2].[Id] = [l4].[OneToMany_Required_Inverse3Id] -ORDER BY [l1].[Name], [l1].[Id], [l0].[Id], [l2].[Id], [l3].[Id] +ORDER BY [l1].[Name], [l1].[Id], [l3].[Id] """); } @@ -650,7 +650,7 @@ LEFT JOIN ( FROM [LevelTwo] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l2] LEFT JOIN [LevelThree] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l3] ON [l2].[Id] = [l3].[Level2_Optional_Id] ) AS [s] ON [l].[Id] = [s].[OneToMany_Optional_Inverse2Id] -ORDER BY [l].[Id], [l0].[Id], [l1].[Id], [s].[Id] +ORDER BY [l].[Id], [l1].[Id] """); } @@ -677,7 +677,7 @@ OFFSET 1 ROWS FETCH NEXT 5 ROWS ONLY ) AS [l2] LEFT JOIN [LevelTwo] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l1] ON [l2].[Id] = [l1].[Level1_Optional_Id] ) AS [s] -ORDER BY [l3].[Date], [s].[Name], [s].[Id] +ORDER BY [l3].[Date], [s].[Name] """); } @@ -714,7 +714,7 @@ public override async Task Multiple_include_with_multiple_optional_navigations(b AssertSql( """ -SELECT [l].[Id], [l].[Date], [l].[Name], [l].[OneToMany_Optional_Self_Inverse1Id], [l].[OneToMany_Required_Self_Inverse1Id], [l].[OneToOne_Optional_Self1Id], [l].[PeriodEnd], [l].[PeriodStart], [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], [l1].[Id], [l2].[Id], [l3].[Id], [l4].[Id], [l5].[Id], [l5].[Level2_Optional_Id], [l5].[Level2_Required_Id], [l5].[Name], [l5].[OneToMany_Optional_Inverse3Id], [l5].[OneToMany_Optional_Self_Inverse3Id], [l5].[OneToMany_Required_Inverse3Id], [l5].[OneToMany_Required_Self_Inverse3Id], [l5].[OneToOne_Optional_PK_Inverse3Id], [l5].[OneToOne_Optional_Self3Id], [l5].[PeriodEnd], [l5].[PeriodStart], [l2].[Level2_Optional_Id], [l2].[Level2_Required_Id], [l2].[Name], [l2].[OneToMany_Optional_Inverse3Id], [l2].[OneToMany_Optional_Self_Inverse3Id], [l2].[OneToMany_Required_Inverse3Id], [l2].[OneToMany_Required_Self_Inverse3Id], [l2].[OneToOne_Optional_PK_Inverse3Id], [l2].[OneToOne_Optional_Self3Id], [l2].[PeriodEnd], [l2].[PeriodStart], [l3].[Date], [l3].[Level1_Optional_Id], [l3].[Level1_Required_Id], [l3].[Name], [l3].[OneToMany_Optional_Inverse2Id], [l3].[OneToMany_Optional_Self_Inverse2Id], [l3].[OneToMany_Required_Inverse2Id], [l3].[OneToMany_Required_Self_Inverse2Id], [l3].[OneToOne_Optional_PK_Inverse2Id], [l3].[OneToOne_Optional_Self2Id], [l3].[PeriodEnd], [l3].[PeriodStart], [l4].[Level2_Optional_Id], [l4].[Level2_Required_Id], [l4].[Name], [l4].[OneToMany_Optional_Inverse3Id], [l4].[OneToMany_Optional_Self_Inverse3Id], [l4].[OneToMany_Required_Inverse3Id], [l4].[OneToMany_Required_Self_Inverse3Id], [l4].[OneToOne_Optional_PK_Inverse3Id], [l4].[OneToOne_Optional_Self3Id], [l4].[PeriodEnd], [l4].[PeriodStart] +SELECT [l].[Id], [l].[Date], [l].[Name], [l].[OneToMany_Optional_Self_Inverse1Id], [l].[OneToMany_Required_Self_Inverse1Id], [l].[OneToOne_Optional_Self1Id], [l].[PeriodEnd], [l].[PeriodStart], [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], [l5].[Id], [l5].[Level2_Optional_Id], [l5].[Level2_Required_Id], [l5].[Name], [l5].[OneToMany_Optional_Inverse3Id], [l5].[OneToMany_Optional_Self_Inverse3Id], [l5].[OneToMany_Required_Inverse3Id], [l5].[OneToMany_Required_Self_Inverse3Id], [l5].[OneToOne_Optional_PK_Inverse3Id], [l5].[OneToOne_Optional_Self3Id], [l5].[PeriodEnd], [l5].[PeriodStart], [l2].[Id], [l2].[Level2_Optional_Id], [l2].[Level2_Required_Id], [l2].[Name], [l2].[OneToMany_Optional_Inverse3Id], [l2].[OneToMany_Optional_Self_Inverse3Id], [l2].[OneToMany_Required_Inverse3Id], [l2].[OneToMany_Required_Self_Inverse3Id], [l2].[OneToOne_Optional_PK_Inverse3Id], [l2].[OneToOne_Optional_Self3Id], [l2].[PeriodEnd], [l2].[PeriodStart], [l3].[Id], [l3].[Date], [l3].[Level1_Optional_Id], [l3].[Level1_Required_Id], [l3].[Name], [l3].[OneToMany_Optional_Inverse2Id], [l3].[OneToMany_Optional_Self_Inverse2Id], [l3].[OneToMany_Required_Inverse2Id], [l3].[OneToMany_Required_Self_Inverse2Id], [l3].[OneToOne_Optional_PK_Inverse2Id], [l3].[OneToOne_Optional_Self2Id], [l3].[PeriodEnd], [l3].[PeriodStart], [l4].[Id], [l4].[Level2_Optional_Id], [l4].[Level2_Required_Id], [l4].[Name], [l4].[OneToMany_Optional_Inverse3Id], [l4].[OneToMany_Optional_Self_Inverse3Id], [l4].[OneToMany_Required_Inverse3Id], [l4].[OneToMany_Required_Self_Inverse3Id], [l4].[OneToOne_Optional_PK_Inverse3Id], [l4].[OneToOne_Optional_Self3Id], [l4].[PeriodEnd], [l4].[PeriodStart] 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].[Level1_Required_Id] LEFT JOIN [LevelThree] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l1] ON [l0].[Id] = [l1].[OneToOne_Optional_PK_Inverse3Id] @@ -723,7 +723,7 @@ public override async Task Multiple_include_with_multiple_optional_navigations(b 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 -ORDER BY [l].[Id], [l0].[Id], [l1].[Id], [l2].[Id], [l3].[Id], [l4].[Id] +ORDER BY [l].[Id] """); } @@ -776,7 +776,7 @@ WHERE [l0].[Id] > 3 WHERE [l3].[row] <= 1 ) AS [l4] ON [l2].[Name] = [l4].[Name] LEFT JOIN [LevelTwo] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l1] ON [l4].[Id] = [l1].[OneToMany_Optional_Inverse2Id] -ORDER BY [l2].[Name], [l4].[Id] +ORDER BY [l2].[Name] """); } @@ -846,7 +846,7 @@ LEFT JOIN ( LEFT JOIN [LevelThree] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l3] ON [l0].[Id] = [l3].[Level2_Optional_Id] LEFT JOIN [LevelFour] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l4] ON [l3].[Id] = [l4].[OneToMany_Optional_Inverse4Id] ) AS [s] ON [l].[Id] = [s].[OneToMany_Optional_Inverse2Id] -ORDER BY [l].[Id], [s].[Id], [s].[Id0], [s].[Id1], [s].[Id2] +ORDER BY [l].[Id], [s].[Id] """); } @@ -879,12 +879,12 @@ public override async Task Multiple_optional_navigation_with_string_based_Includ AssertSql( """ -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], [l].[Id], [l0].[Id], [l2].[Id], [l2].[Level3_Optional_Id], [l2].[Level3_Required_Id], [l2].[Name], [l2].[OneToMany_Optional_Inverse4Id], [l2].[OneToMany_Optional_Self_Inverse4Id], [l2].[OneToMany_Required_Inverse4Id], [l2].[OneToMany_Required_Self_Inverse4Id], [l2].[OneToOne_Optional_PK_Inverse4Id], [l2].[OneToOne_Optional_Self4Id], [l2].[PeriodEnd], [l2].[PeriodStart] +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], [l].[Id], [l2].[Id], [l2].[Level3_Optional_Id], [l2].[Level3_Required_Id], [l2].[Name], [l2].[OneToMany_Optional_Inverse4Id], [l2].[OneToMany_Optional_Self_Inverse4Id], [l2].[OneToMany_Required_Inverse4Id], [l2].[OneToMany_Required_Self_Inverse4Id], [l2].[OneToOne_Optional_PK_Inverse4Id], [l2].[OneToOne_Optional_Self4Id], [l2].[PeriodEnd], [l2].[PeriodStart] 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].[Level1_Optional_Id] LEFT JOIN [LevelThree] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l1] ON [l0].[Id] = [l1].[OneToOne_Optional_PK_Inverse3Id] LEFT JOIN [LevelFour] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l2] ON [l1].[Id] = [l2].[OneToMany_Optional_Inverse4Id] -ORDER BY [l].[Id], [l0].[Id], [l1].[Id] +ORDER BY [l].[Id] """); } @@ -912,7 +912,7 @@ public override async Task Optional_navigation_with_Include_and_order(bool async 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].[Level1_Optional_Id] LEFT JOIN [LevelThree] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l1] ON [l0].[Id] = [l1].[OneToMany_Optional_Inverse3Id] -ORDER BY [l0].[Name], [l].[Id], [l0].[Id] +ORDER BY [l0].[Name], [l].[Id] """); } @@ -922,20 +922,20 @@ public override async Task SelectMany_DefaultIfEmpty_multiple_times_with_joins_p AssertSql( """ -SELECT [l2].[Id], [l2].[Level3_Optional_Id], [l2].[Level3_Required_Id], [l2].[Name], [l2].[OneToMany_Optional_Inverse4Id], [l2].[OneToMany_Optional_Self_Inverse4Id], [l2].[OneToMany_Required_Inverse4Id], [l2].[OneToMany_Required_Self_Inverse4Id], [l2].[OneToOne_Optional_PK_Inverse4Id], [l2].[OneToOne_Optional_Self4Id], [l2].[PeriodEnd], [l2].[PeriodStart], [l].[Id], [l0].[Id], [l1].[Id], [s].[Id], [s].[Id0], [s].[Id1], [s].[Id2], [s0].[Id], [s0].[Id0], [s0].[Id1], [s0].[Id2], [l11].[Id], [l12].[Id], [l13].[Id], [l14].[Id], [l16].[Id], [l16].[Date], [l16].[Level1_Optional_Id], [l16].[Level1_Required_Id], [l16].[Name], [l16].[OneToMany_Optional_Inverse2Id], [l16].[OneToMany_Optional_Self_Inverse2Id], [l16].[OneToMany_Required_Inverse2Id], [l16].[OneToMany_Required_Self_Inverse2Id], [l16].[OneToOne_Optional_PK_Inverse2Id], [l16].[OneToOne_Optional_Self2Id], [l16].[PeriodEnd], [l16].[PeriodStart], [l14].[Name] +SELECT [l2].[Id], [l2].[Level3_Optional_Id], [l2].[Level3_Required_Id], [l2].[Name], [l2].[OneToMany_Optional_Inverse4Id], [l2].[OneToMany_Optional_Self_Inverse4Id], [l2].[OneToMany_Required_Inverse4Id], [l2].[OneToMany_Required_Self_Inverse4Id], [l2].[OneToOne_Optional_PK_Inverse4Id], [l2].[OneToOne_Optional_Self4Id], [l2].[PeriodEnd], [l2].[PeriodStart], [l].[Id], [s].[Id], [s].[Id2], [s0].[Id], [s0].[Id2], [l16].[Id], [l16].[Date], [l16].[Level1_Optional_Id], [l16].[Level1_Required_Id], [l16].[Name], [l16].[OneToMany_Optional_Inverse2Id], [l16].[OneToMany_Optional_Self_Inverse2Id], [l16].[OneToMany_Required_Inverse2Id], [l16].[OneToMany_Required_Self_Inverse2Id], [l16].[OneToOne_Optional_PK_Inverse2Id], [l16].[OneToOne_Optional_Self2Id], [l16].[PeriodEnd], [l16].[PeriodStart], [l14].[Name] 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].[Level1_Required_Id] LEFT JOIN [LevelThree] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l1] ON [l0].[Id] = [l1].[Level2_Optional_Id] LEFT JOIN [LevelFour] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l2] ON [l1].[Id] = [l2].[OneToMany_Required_Inverse4Id] INNER JOIN ( - SELECT [l3].[Id], [l4].[Id] AS [Id0], [l5].[Id] AS [Id1], [l6].[Id] AS [Id2] + SELECT [l3].[Id], [l6].[Id] AS [Id2] FROM [LevelFour] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l3] INNER JOIN [LevelThree] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l4] ON [l3].[Level3_Required_Id] = [l4].[Id] LEFT JOIN [LevelTwo] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l5] ON [l4].[Level2_Optional_Id] = [l5].[Id] LEFT JOIN [LevelTwo] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l6] ON [l5].[Id] = [l6].[OneToMany_Required_Self_Inverse2Id] ) AS [s] ON [l2].[Id] = [s].[Id2] LEFT JOIN ( - SELECT [l7].[Id], [l8].[Id] AS [Id0], [l9].[Id] AS [Id1], [l10].[Id] AS [Id2], [l10].[Level2_Optional_Id] AS [Level2_Optional_Id0] + SELECT [l7].[Id], [l10].[Id] AS [Id2], [l10].[Level2_Optional_Id] AS [Level2_Optional_Id0] FROM [LevelFour] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l7] INNER JOIN [LevelThree] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l8] ON [l7].[Level3_Required_Id] = [l8].[Id] INNER JOIN [LevelTwo] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l9] ON [l8].[Level2_Required_Id] = [l9].[Id] @@ -951,7 +951,7 @@ LEFT JOIN ( WHERE [l15].[Id] <> 42 ) AS [l16] ON [s].[Id2] = [l16].[OneToMany_Optional_Self_Inverse2Id] WHERE [l11].[Name] <> N'Foo' OR [l11].[Name] IS NULL -ORDER BY [l12].[Id], [l].[Id], [l0].[Id], [l1].[Id], [l2].[Id], [s].[Id], [s].[Id0], [s].[Id1], [s].[Id2], [s0].[Id], [s0].[Id0], [s0].[Id1], [s0].[Id2], [l11].[Id], [l13].[Id], [l14].[Id] +ORDER BY [l12].[Id], [l].[Id], [l2].[Id], [s].[Id], [s].[Id2], [s0].[Id], [s0].[Id2] """); } @@ -970,7 +970,7 @@ LEFT JOIN ( LEFT JOIN [LevelFour] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l2] ON [l1].[Id] = [l2].[Level3_Required_Id] ) AS [s] ON [l0].[Id] = [s].[OneToMany_Required_Inverse3Id] WHERE [l0].[Name] <> N'L2 09' OR [l0].[Name] IS NULL -ORDER BY [l].[Id], [l0].[Id], [s].[Id] +ORDER BY [l].[Id] """); } @@ -998,7 +998,7 @@ public override async Task Include_partially_added_before_Where_and_then_build_u AssertSql( """ -SELECT [l].[Id], [l].[Date], [l].[Name], [l].[OneToMany_Optional_Self_Inverse1Id], [l].[OneToMany_Required_Self_Inverse1Id], [l].[OneToOne_Optional_Self1Id], [l].[PeriodEnd], [l].[PeriodStart], [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], [l0].[Id], [l6].[Id], [l6].[Level2_Optional_Id], [l6].[Level2_Required_Id], [l6].[Name], [l6].[OneToMany_Optional_Inverse3Id], [l6].[OneToMany_Optional_Self_Inverse3Id], [l6].[OneToMany_Required_Inverse3Id], [l6].[OneToMany_Required_Self_Inverse3Id], [l6].[OneToOne_Optional_PK_Inverse3Id], [l6].[OneToOne_Optional_Self3Id], [l6].[PeriodEnd], [l6].[PeriodStart], [s].[Id], [s].[Level2_Optional_Id], [s].[Level2_Required_Id], [s].[Name], [s].[OneToMany_Optional_Inverse3Id], [s].[OneToMany_Optional_Self_Inverse3Id], [s].[OneToMany_Required_Inverse3Id], [s].[OneToMany_Required_Self_Inverse3Id], [s].[OneToOne_Optional_PK_Inverse3Id], [s].[OneToOne_Optional_Self3Id], [s].[PeriodEnd], [s].[PeriodStart], [s].[Id0], [s].[Level3_Optional_Id], [s].[Level3_Required_Id], [s].[Name0], [s].[OneToMany_Optional_Inverse4Id], [s].[OneToMany_Optional_Self_Inverse4Id], [s].[OneToMany_Required_Inverse4Id], [s].[OneToMany_Required_Self_Inverse4Id], [s].[OneToOne_Optional_PK_Inverse4Id], [s].[OneToOne_Optional_Self4Id], [s].[PeriodEnd0], [s].[PeriodStart0] +SELECT [l].[Id], [l].[Date], [l].[Name], [l].[OneToMany_Optional_Self_Inverse1Id], [l].[OneToMany_Required_Self_Inverse1Id], [l].[OneToOne_Optional_Self1Id], [l].[PeriodEnd], [l].[PeriodStart], [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], [l6].[Id], [l6].[Level2_Optional_Id], [l6].[Level2_Required_Id], [l6].[Name], [l6].[OneToMany_Optional_Inverse3Id], [l6].[OneToMany_Optional_Self_Inverse3Id], [l6].[OneToMany_Required_Inverse3Id], [l6].[OneToMany_Required_Self_Inverse3Id], [l6].[OneToOne_Optional_PK_Inverse3Id], [l6].[OneToOne_Optional_Self3Id], [l6].[PeriodEnd], [l6].[PeriodStart], [s].[Id], [s].[Level2_Optional_Id], [s].[Level2_Required_Id], [s].[Name], [s].[OneToMany_Optional_Inverse3Id], [s].[OneToMany_Optional_Self_Inverse3Id], [s].[OneToMany_Required_Inverse3Id], [s].[OneToMany_Required_Self_Inverse3Id], [s].[OneToOne_Optional_PK_Inverse3Id], [s].[OneToOne_Optional_Self3Id], [s].[PeriodEnd], [s].[PeriodStart], [s].[Id0], [s].[Level3_Optional_Id], [s].[Level3_Required_Id], [s].[Name0], [s].[OneToMany_Optional_Inverse4Id], [s].[OneToMany_Optional_Self_Inverse4Id], [s].[OneToMany_Required_Inverse4Id], [s].[OneToMany_Required_Self_Inverse4Id], [s].[OneToOne_Optional_PK_Inverse4Id], [s].[OneToOne_Optional_Self4Id], [s].[PeriodEnd0], [s].[PeriodStart0] 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].[OneToOne_Optional_PK_Inverse2Id] LEFT JOIN [LevelTwo] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l1] ON [l].[Id] = [l1].[Level1_Optional_Id] @@ -1016,7 +1016,7 @@ LEFT JOIN ( LEFT JOIN [LevelFour] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l4] ON [l3].[Id] = [l4].[Level3_Optional_Id] ) AS [s] ON [l1].[Id] = [s].[OneToMany_Required_Inverse3Id] WHERE [l0].[Id] < 3 OR [l1].[Id] > 8 -ORDER BY [l].[Id], [l0].[Id], [l1].[Id], [l6].[OneToMany_Optional_Inverse3Id], [l6].[Id], [s].[Id] +ORDER BY [l].[Id], [l6].[OneToMany_Optional_Inverse3Id], [l6].[Id] """); } @@ -1040,11 +1040,11 @@ public override async Task Project_collection_navigation_using_ef_property(bool AssertSql( """ -SELECT [l].[Id], [l0].[Id], [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] +SELECT [l].[Id], [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] 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].[Level1_Optional_Id] LEFT JOIN [LevelThree] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l1] ON [l0].[Id] = [l1].[OneToMany_Optional_Inverse3Id] -ORDER BY [l].[Id], [l0].[Id] +ORDER BY [l].[Id] """); } @@ -1095,7 +1095,7 @@ OFFSET @p ROWS FETCH NEXT @p1 ROWS ONLY LEFT JOIN [LevelTwo] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l0] ON [l1].[Id] = [l0].[Level1_Required_Id] LEFT JOIN [LevelThree] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l2] ON [l0].[Id] = [l2].[OneToMany_Optional_Inverse3Id] LEFT JOIN [LevelThree] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l3] ON [l0].[Id] = [l3].[OneToMany_Required_Inverse3Id] -ORDER BY [l1].[Name], [l1].[Id], [l0].[Id], [l2].[Id] +ORDER BY [l1].[Name], [l1].[Id], [l2].[Id] """); } @@ -1120,7 +1120,7 @@ LEFT JOIN ( WHERE [l3].[row] <= 1 ) AS [l4] ON [l2].[Name] = [l4].[Name] LEFT JOIN [LevelTwo] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l1] ON [l4].[Id] = [l1].[OneToMany_Optional_Inverse2Id] -ORDER BY [l2].[Name], [l4].[Id] +ORDER BY [l2].[Name] """); } @@ -1147,11 +1147,11 @@ public override async Task Project_collection_navigation_nested(bool async) AssertSql( """ -SELECT [l].[Id], [l0].[Id], [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] +SELECT [l].[Id], [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] 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].[Level1_Optional_Id] LEFT JOIN [LevelThree] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l1] ON [l0].[Id] = [l1].[OneToMany_Optional_Inverse3Id] -ORDER BY [l].[Id], [l0].[Id] +ORDER BY [l].[Id] """); } @@ -1191,17 +1191,17 @@ public override async Task Null_check_in_anonymous_type_projection_should_not_be AssertSql( """ -SELECT [l].[Id], [s].[c], [s].[Name], [s].[Id], [s].[Id0] +SELECT [l].[Id], [s].[c], [s].[Name], [s].[Id] FROM [LevelOne] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l] LEFT JOIN ( SELECT CASE WHEN [l1].[Id] IS NULL THEN CAST(1 AS bit) ELSE CAST(0 AS bit) - END AS [c], [l1].[Name], [l0].[Id], [l1].[Id] AS [Id0], [l0].[OneToMany_Optional_Inverse2Id] + END AS [c], [l1].[Name], [l0].[Id], [l0].[OneToMany_Optional_Inverse2Id] 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].[Level2_Required_Id] ) AS [s] ON [l].[Id] = [s].[OneToMany_Optional_Inverse2Id] -ORDER BY [l].[Id], [s].[Id] +ORDER BY [l].[Id] """); } @@ -1211,7 +1211,7 @@ public override async Task Complex_query_with_let_collection_projection_FirstOrD AssertSql( """ -SELECT [l].[Id], [l3].[Id], [l4].[Name], [l4].[Id], [l3].[c] +SELECT [l].[Id], [l4].[Name], [l4].[Id], [l3].[c] FROM [LevelOne] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l] OUTER APPLY ( SELECT TOP(1) 1 AS [c], [l0].[Id] @@ -1226,7 +1226,7 @@ SELECT 1 FROM [LevelTwo] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l2] WHERE [l1].[Id] = [l2].[OneToMany_Optional_Inverse2Id] AND [l2].[Id] = [l3].[Id]) ) AS [l4] -ORDER BY [l].[Id], [l3].[Id] +ORDER BY [l].[Id] """); } @@ -1280,13 +1280,13 @@ public override async Task Include_after_SelectMany_and_multiple_reference_navig AssertSql( """ -SELECT [l2].[Id], [l2].[Level3_Optional_Id], [l2].[Level3_Required_Id], [l2].[Name], [l2].[OneToMany_Optional_Inverse4Id], [l2].[OneToMany_Optional_Self_Inverse4Id], [l2].[OneToMany_Required_Inverse4Id], [l2].[OneToMany_Required_Self_Inverse4Id], [l2].[OneToOne_Optional_PK_Inverse4Id], [l2].[OneToOne_Optional_Self4Id], [l2].[PeriodEnd], [l2].[PeriodStart], [l].[Id], [l0].[Id], [l1].[Id], [l3].[Id], [l3].[Level3_Optional_Id], [l3].[Level3_Required_Id], [l3].[Name], [l3].[OneToMany_Optional_Inverse4Id], [l3].[OneToMany_Optional_Self_Inverse4Id], [l3].[OneToMany_Required_Inverse4Id], [l3].[OneToMany_Required_Self_Inverse4Id], [l3].[OneToOne_Optional_PK_Inverse4Id], [l3].[OneToOne_Optional_Self4Id], [l3].[PeriodEnd], [l3].[PeriodStart] +SELECT [l2].[Id], [l2].[Level3_Optional_Id], [l2].[Level3_Required_Id], [l2].[Name], [l2].[OneToMany_Optional_Inverse4Id], [l2].[OneToMany_Optional_Self_Inverse4Id], [l2].[OneToMany_Required_Inverse4Id], [l2].[OneToMany_Required_Self_Inverse4Id], [l2].[OneToOne_Optional_PK_Inverse4Id], [l2].[OneToOne_Optional_Self4Id], [l2].[PeriodEnd], [l2].[PeriodStart], [l].[Id], [l0].[Id], [l3].[Id], [l3].[Level3_Optional_Id], [l3].[Level3_Required_Id], [l3].[Name], [l3].[OneToMany_Optional_Inverse4Id], [l3].[OneToMany_Optional_Self_Inverse4Id], [l3].[OneToMany_Required_Inverse4Id], [l3].[OneToMany_Required_Self_Inverse4Id], [l3].[OneToOne_Optional_PK_Inverse4Id], [l3].[OneToOne_Optional_Self4Id], [l3].[PeriodEnd], [l3].[PeriodStart] FROM [LevelOne] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l] INNER JOIN [LevelTwo] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l0] ON [l].[Id] = [l0].[OneToMany_Required_Inverse2Id] LEFT JOIN [LevelThree] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l1] ON [l0].[Id] = [l1].[Level2_Optional_Id] LEFT JOIN [LevelFour] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l2] ON [l1].[Id] = [l2].[Level3_Required_Id] LEFT JOIN [LevelFour] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l3] ON [l2].[Id] = [l3].[OneToMany_Optional_Self_Inverse4Id] -ORDER BY [l].[Id], [l0].[Id], [l1].[Id], [l2].[Id] +ORDER BY [l].[Id], [l0].[Id] """); } @@ -1300,7 +1300,7 @@ public override async Task Include_reference_ThenInclude_collection_order_by(boo 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].[Level1_Optional_Id] LEFT JOIN [LevelThree] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l1] ON [l0].[Id] = [l1].[OneToMany_Optional_Inverse3Id] -ORDER BY [l].[Name], [l].[Id], [l0].[Id] +ORDER BY [l].[Name], [l].[Id] """); } @@ -1371,7 +1371,7 @@ OFFSET @p ROWS FETCH NEXT @p1 ROWS ONLY LEFT JOIN [LevelTwo] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l0] ON [l1].[Id] = [l0].[Level1_Optional_Id] LEFT JOIN [LevelThree] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l2] ON [l0].[Id] = [l2].[Level2_Required_Id] LEFT JOIN [LevelFour] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l3] ON [l2].[Id] = [l3].[OneToMany_Optional_Inverse4Id] -ORDER BY [l1].[Name], [l1].[Id], [l0].[Id], [l2].[Id] +ORDER BY [l1].[Name], [l1].[Id] """); } @@ -1385,7 +1385,7 @@ public override async Task Project_navigation_and_collection(bool async) 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].[Level1_Optional_Id] LEFT JOIN [LevelThree] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l1] ON [l0].[Id] = [l1].[OneToMany_Optional_Inverse3Id] -ORDER BY [l].[Id], [l0].[Id] +ORDER BY [l].[Id] """); } @@ -1395,12 +1395,12 @@ public override async Task Multiple_optional_navigation_with_Include(bool async) AssertSql( """ -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], [l].[Id], [l0].[Id], [l2].[Id], [l2].[Level3_Optional_Id], [l2].[Level3_Required_Id], [l2].[Name], [l2].[OneToMany_Optional_Inverse4Id], [l2].[OneToMany_Optional_Self_Inverse4Id], [l2].[OneToMany_Required_Inverse4Id], [l2].[OneToMany_Required_Self_Inverse4Id], [l2].[OneToOne_Optional_PK_Inverse4Id], [l2].[OneToOne_Optional_Self4Id], [l2].[PeriodEnd], [l2].[PeriodStart] +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], [l].[Id], [l2].[Id], [l2].[Level3_Optional_Id], [l2].[Level3_Required_Id], [l2].[Name], [l2].[OneToMany_Optional_Inverse4Id], [l2].[OneToMany_Optional_Self_Inverse4Id], [l2].[OneToMany_Required_Inverse4Id], [l2].[OneToMany_Required_Self_Inverse4Id], [l2].[OneToOne_Optional_PK_Inverse4Id], [l2].[OneToOne_Optional_Self4Id], [l2].[PeriodEnd], [l2].[PeriodStart] 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].[Level1_Optional_Id] LEFT JOIN [LevelThree] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l1] ON [l0].[Id] = [l1].[OneToOne_Optional_PK_Inverse3Id] LEFT JOIN [LevelFour] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l2] ON [l1].[Id] = [l2].[OneToMany_Optional_Inverse4Id] -ORDER BY [l].[Id], [l0].[Id], [l1].[Id] +ORDER BY [l].[Id] """); } @@ -1410,7 +1410,7 @@ public override async Task Project_collection_navigation_nested_with_take(bool a AssertSql( """ -SELECT [l].[Id], [l0].[Id], [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] +SELECT [l].[Id], [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 [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].[Level1_Optional_Id] LEFT JOIN ( @@ -1421,7 +1421,7 @@ LEFT JOIN ( ) AS [l2] WHERE [l2].[row] <= 50 ) AS [l3] ON [l0].[Id] = [l3].[OneToMany_Optional_Inverse3Id] -ORDER BY [l].[Id], [l0].[Id] +ORDER BY [l].[Id] """); } @@ -1448,7 +1448,7 @@ LEFT JOIN ( WHERE [l3].[Id] > 1 ) AS [l4] ON [l1].[Id] = [l4].[OneToMany_Optional_Inverse4Id] ) AS [s] -ORDER BY [l].[Id], [s].[Id], [s].[Id0] +ORDER BY [l].[Id], [s].[Id] """); } @@ -1545,7 +1545,7 @@ LEFT JOIN ( 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] ) AS [s] ON [l].[Id] = [s].[OneToMany_Optional_Inverse2Id] -ORDER BY [l].[Id], [s].[Id] +ORDER BY [l].[Id] """); } @@ -1573,7 +1573,7 @@ ORDER BY [l0].[Name] DESC ) AS [l2] LEFT JOIN [LevelThree] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l1] ON [l2].[Id] = [l1].[Level2_Optional_Id] ) AS [s] -ORDER BY [l3].[Id], [s].[Name] DESC, [s].[Id] +ORDER BY [l3].[Id], [s].[Name] DESC """); } @@ -1587,7 +1587,7 @@ public override async Task Optional_navigation_with_order_by_and_Include(bool as 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].[Level1_Optional_Id] LEFT JOIN [LevelThree] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l1] ON [l0].[Id] = [l1].[OneToMany_Optional_Inverse3Id] -ORDER BY [l0].[Name], [l].[Id], [l0].[Id] +ORDER BY [l0].[Name], [l].[Id] """); } @@ -1607,7 +1607,7 @@ LEFT JOIN ( LEFT JOIN [LevelThree] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l3] ON [l0].[Id] = [l3].[Level2_Optional_Id] LEFT JOIN [LevelFour] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l4] ON [l3].[Id] = [l4].[OneToMany_Optional_Inverse4Id] ) AS [s] ON [l].[Id] = [s].[OneToMany_Optional_Inverse2Id] -ORDER BY [l].[Id], [s].[Id], [s].[Id0], [s].[Id1], [s].[Id2] +ORDER BY [l].[Id], [s].[Id] """); } @@ -1617,11 +1617,11 @@ public override async Task Project_collection_navigation_nested_anonymous(bool a AssertSql( """ -SELECT [l].[Id], [l0].[Id], [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] +SELECT [l].[Id], [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] 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].[Level1_Optional_Id] LEFT JOIN [LevelThree] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l1] ON [l0].[Id] = [l1].[OneToMany_Optional_Inverse3Id] -ORDER BY [l].[Id], [l0].[Id] +ORDER BY [l].[Id] """); } @@ -1637,7 +1637,7 @@ public override async Task Include_after_multiple_SelectMany_and_reference_navig INNER JOIN [LevelThree] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l1] ON [l0].[Id] = [l1].[OneToMany_Optional_Inverse3Id] LEFT JOIN [LevelFour] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l2] ON [l1].[Id] = [l2].[Level3_Required_Id] LEFT JOIN [LevelFour] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l3] ON [l2].[Id] = [l3].[OneToMany_Required_Self_Inverse4Id] -ORDER BY [l].[Id], [l0].[Id], [l1].[Id], [l2].[Id] +ORDER BY [l].[Id], [l0].[Id], [l1].[Id] """); } @@ -1656,7 +1656,7 @@ LEFT JOIN ( FROM [LevelOne] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l2] LEFT JOIN [LevelOne] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l3] ON [l2].[OneToOne_Optional_Self1Id] = [l3].[Id] ) AS [s] ON [l].[Id] = [s].[OneToMany_Optional_Self_Inverse1Id] -ORDER BY [l].[Id], [l0].[Id], [l1].[Id], [s].[Id] +ORDER BY [l].[Id], [l1].[Id] """); } @@ -1673,7 +1673,7 @@ LEFT JOIN ( 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].[Level2_Optional_Id] ) AS [s] ON [l].[Id] = [s].[OneToMany_Optional_Inverse2Id] -ORDER BY [l].[Id], [s].[Id] +ORDER BY [l].[Id] """); } @@ -1702,7 +1702,7 @@ public override async Task Multiple_SelectMany_with_Include(bool async) INNER JOIN [LevelThree] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l1] ON [l0].[Id] = [l1].[OneToMany_Optional_Inverse3Id] LEFT JOIN [LevelFour] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l2] ON [l1].[Id] = [l2].[Level3_Required_Id] LEFT JOIN [LevelFour] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l3] ON [l1].[Id] = [l3].[OneToMany_Optional_Inverse4Id] -ORDER BY [l].[Id], [l0].[Id], [l1].[Id], [l2].[Id] +ORDER BY [l].[Id], [l0].[Id], [l1].[Id] """); } @@ -1714,7 +1714,7 @@ public override async Task Lift_projection_mapping_when_pushing_down_subquery(bo """ @p='25' -SELECT [l2].[Id], [l4].[Id], [l1].[Id], [l4].[c] +SELECT [l2].[Id], [l1].[Id], [l4].[Id], [l4].[c] FROM ( SELECT TOP(@p) [l].[Id] FROM [LevelOne] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l] @@ -1728,7 +1728,7 @@ LEFT JOIN ( WHERE [l3].[row] <= 1 ) AS [l4] ON [l2].[Id] = [l4].[OneToMany_Required_Inverse2Id] LEFT JOIN [LevelTwo] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l1] ON [l2].[Id] = [l1].[OneToMany_Required_Inverse2Id] -ORDER BY [l2].[Id], [l4].[Id] +ORDER BY [l2].[Id] """); } @@ -1778,7 +1778,7 @@ LEFT JOIN ( LEFT JOIN [LevelThree] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l3] ON [l2].[Id] = [l3].[OneToMany_Optional_Inverse3Id] ) AS [s] ON [l0].[Id] = [s].[OneToMany_Optional_Inverse3Id] ) AS [s0] ON [l].[Id] = [s0].[OneToMany_Optional_Inverse2Id] -ORDER BY [l].[Id], [s0].[Id], [s0].[Id0], [s0].[Id00] +ORDER BY [l].[Id], [s0].[Id], [s0].[Id0] """); } @@ -1788,7 +1788,7 @@ public override async Task Complex_query_issue_21665(bool async) AssertSql( """ -SELECT [s].[Id], [s].[Date], [s].[Name], [s].[OneToMany_Optional_Self_Inverse1Id], [s].[OneToMany_Required_Self_Inverse1Id], [s].[OneToOne_Optional_Self1Id], [s].[PeriodEnd], [s].[PeriodStart], [s].[Name0], [s].[c], [s].[c0], [s].[c1], [s].[Id0], [s0].[Id], [s0].[Date], [s0].[Name], [s0].[OneToMany_Optional_Self_Inverse1Id], [s0].[OneToMany_Required_Self_Inverse1Id], [s0].[OneToOne_Optional_Self1Id], [s0].[PeriodEnd], [s0].[PeriodStart], [s0].[ChildCount], [s0].[Level2Name], [s0].[Level2Count], [s0].[IsLevel2There], [s0].[Id0] +SELECT [s].[Id], [s].[Date], [s].[Name], [s].[OneToMany_Optional_Self_Inverse1Id], [s].[OneToMany_Required_Self_Inverse1Id], [s].[OneToOne_Optional_Self1Id], [s].[PeriodEnd], [s].[PeriodStart], [s].[Name0], [s].[c], [s].[c0], [s].[c1], [s0].[Id], [s0].[Date], [s0].[Name], [s0].[OneToMany_Optional_Self_Inverse1Id], [s0].[OneToMany_Required_Self_Inverse1Id], [s0].[OneToOne_Optional_Self1Id], [s0].[PeriodEnd], [s0].[PeriodStart], [s0].[ChildCount], [s0].[Level2Name], [s0].[Level2Count], [s0].[IsLevel2There] FROM ( SELECT TOP(1) [l].[Id], [l].[Date], [l].[Name], [l].[OneToMany_Optional_Self_Inverse1Id], [l].[OneToMany_Required_Self_Inverse1Id], [l].[OneToOne_Optional_Self1Id], [l].[PeriodEnd], [l].[PeriodStart], [l0].[Name] AS [Name0], ( SELECT COUNT(*) @@ -1802,7 +1802,7 @@ SELECT 1 FROM [LevelTwo] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l3] WHERE [l].[Id] = [l3].[OneToMany_Optional_Inverse2Id] AND [l3].[Id] = 2) THEN CAST(1 AS bit) ELSE CAST(0 AS bit) - END AS [c1], [l0].[Id] AS [Id0] + END AS [c1] 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].[Level1_Optional_Id] WHERE [l].[Id] = 2 @@ -1821,7 +1821,7 @@ SELECT 1 FROM [LevelTwo] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l9] WHERE [l6].[Id] = [l9].[OneToMany_Optional_Inverse2Id] AND [l9].[Id] = 2) THEN CAST(1 AS bit) ELSE CAST(0 AS bit) - END AS [IsLevel2There], [l5].[Id] AS [Id0] + END AS [IsLevel2There] FROM ( SELECT [l4].[Id], [l4].[Date], [l4].[Name], [l4].[OneToMany_Optional_Self_Inverse1Id], [l4].[OneToMany_Required_Self_Inverse1Id], [l4].[OneToOne_Optional_Self1Id], [l4].[PeriodEnd], [l4].[PeriodStart] FROM [LevelOne] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l4] @@ -1831,7 +1831,7 @@ OFFSET 1 ROWS FETCH NEXT 5 ROWS ONLY ) AS [l6] LEFT JOIN [LevelTwo] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l5] ON [l6].[Id] = [l5].[Level1_Optional_Id] ) AS [s0] -ORDER BY [s].[Name], [s].[Id], [s].[Id0], [s0].[Name], [s0].[Id] +ORDER BY [s].[Name], [s].[Id], [s0].[Name] """); } @@ -1864,20 +1864,20 @@ await base.Complex_SelectMany_with_nested_navigations_and_explicit_DefaultIfEmpt AssertSql( """ -SELECT [l2].[Id], [l2].[Level3_Optional_Id], [l2].[Level3_Required_Id], [l2].[Name], [l2].[OneToMany_Optional_Inverse4Id], [l2].[OneToMany_Optional_Self_Inverse4Id], [l2].[OneToMany_Required_Inverse4Id], [l2].[OneToMany_Required_Self_Inverse4Id], [l2].[OneToOne_Optional_PK_Inverse4Id], [l2].[OneToOne_Optional_Self4Id], [l2].[PeriodEnd], [l2].[PeriodStart], [l].[Id], [l0].[Id], [l1].[Id], [s].[Id], [s].[Id0], [s].[Id1], [s].[Id2], [s0].[Id], [s0].[Id0], [s0].[Id1], [s0].[Id2], [l11].[Id], [l12].[Id], [l13].[Id], [l14].[Id], [l16].[Id], [l16].[Date], [l16].[Level1_Optional_Id], [l16].[Level1_Required_Id], [l16].[Name], [l16].[OneToMany_Optional_Inverse2Id], [l16].[OneToMany_Optional_Self_Inverse2Id], [l16].[OneToMany_Required_Inverse2Id], [l16].[OneToMany_Required_Self_Inverse2Id], [l16].[OneToOne_Optional_PK_Inverse2Id], [l16].[OneToOne_Optional_Self2Id], [l16].[PeriodEnd], [l16].[PeriodStart], [l14].[Name] +SELECT [l2].[Id], [l2].[Level3_Optional_Id], [l2].[Level3_Required_Id], [l2].[Name], [l2].[OneToMany_Optional_Inverse4Id], [l2].[OneToMany_Optional_Self_Inverse4Id], [l2].[OneToMany_Required_Inverse4Id], [l2].[OneToMany_Required_Self_Inverse4Id], [l2].[OneToOne_Optional_PK_Inverse4Id], [l2].[OneToOne_Optional_Self4Id], [l2].[PeriodEnd], [l2].[PeriodStart], [l].[Id], [s].[Id], [s].[Id2], [s0].[Id], [s0].[Id2], [l16].[Id], [l16].[Date], [l16].[Level1_Optional_Id], [l16].[Level1_Required_Id], [l16].[Name], [l16].[OneToMany_Optional_Inverse2Id], [l16].[OneToMany_Optional_Self_Inverse2Id], [l16].[OneToMany_Required_Inverse2Id], [l16].[OneToMany_Required_Self_Inverse2Id], [l16].[OneToOne_Optional_PK_Inverse2Id], [l16].[OneToOne_Optional_Self2Id], [l16].[PeriodEnd], [l16].[PeriodStart], [l14].[Name] 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].[Level1_Required_Id] LEFT JOIN [LevelThree] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l1] ON [l0].[Id] = [l1].[Level2_Optional_Id] LEFT JOIN [LevelFour] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l2] ON [l1].[Id] = [l2].[OneToMany_Required_Inverse4Id] INNER JOIN ( - SELECT [l3].[Id], [l4].[Id] AS [Id0], [l5].[Id] AS [Id1], [l6].[Id] AS [Id2] + SELECT [l3].[Id], [l6].[Id] AS [Id2] FROM [LevelFour] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l3] INNER JOIN [LevelThree] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l4] ON [l3].[Level3_Required_Id] = [l4].[Id] LEFT JOIN [LevelTwo] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l5] ON [l4].[Level2_Optional_Id] = [l5].[Id] LEFT JOIN [LevelTwo] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l6] ON [l5].[Id] = [l6].[OneToMany_Required_Self_Inverse2Id] ) AS [s] ON [l2].[Id] = [s].[Id2] LEFT JOIN ( - SELECT [l7].[Id], [l8].[Id] AS [Id0], [l9].[Id] AS [Id1], [l10].[Id] AS [Id2], [l10].[Level2_Optional_Id] AS [Level2_Optional_Id0] + SELECT [l7].[Id], [l10].[Id] AS [Id2], [l10].[Level2_Optional_Id] AS [Level2_Optional_Id0] FROM [LevelFour] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l7] INNER JOIN [LevelThree] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l8] ON [l7].[Level3_Required_Id] = [l8].[Id] INNER JOIN [LevelTwo] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l9] ON [l8].[Level2_Required_Id] = [l9].[Id] @@ -1893,7 +1893,7 @@ LEFT JOIN ( WHERE [l15].[Id] <> 42 ) AS [l16] ON [s].[Id2] = [l16].[OneToMany_Optional_Self_Inverse2Id] WHERE [l11].[Name] <> N'Foo' OR [l11].[Name] IS NULL -ORDER BY [l12].[Id], [l].[Id], [l0].[Id], [l1].[Id], [l2].[Id], [s].[Id], [s].[Id0], [s].[Id1], [s].[Id2], [s0].[Id], [s0].[Id0], [s0].[Id1], [s0].[Id2], [l11].[Id], [l13].[Id], [l14].[Id] +ORDER BY [l12].[Id], [l].[Id], [l2].[Id], [s].[Id], [s].[Id2], [s0].[Id], [s0].[Id2] """); } @@ -1989,7 +1989,7 @@ SELECT TOP(40) [l0].[Id], [l0].[Date], [l0].[Level1_Optional_Id], [l0].[Level1_R ) AS [l2] LEFT JOIN [LevelThree] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l1] ON [l2].[Id] = [l1].[Level2_Optional_Id] ) AS [s] -ORDER BY [l3].[Id], [s].[Id] +ORDER BY [l3].[Id] """); } @@ -2003,7 +2003,7 @@ public override async Task Include_reference_and_collection_order_by(bool async) 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].[Level1_Optional_Id] LEFT JOIN [LevelThree] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l1] ON [l0].[Id] = [l1].[OneToMany_Optional_Inverse3Id] -ORDER BY [l].[Name], [l].[Id], [l0].[Id] +ORDER BY [l].[Name], [l].[Id] """); } @@ -2147,7 +2147,7 @@ public override async Task Select_subquery_single_nested_subquery(bool async) AssertSql( """ -SELECT [l].[Id], [l3].[Id], [l1].[Id], [l3].[c] +SELECT [l].[Id], [l1].[Id], [l3].[c] FROM [LevelOne] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l] LEFT JOIN ( SELECT [l2].[c], [l2].[Id], [l2].[OneToMany_Optional_Inverse2Id] @@ -2158,7 +2158,7 @@ LEFT JOIN ( WHERE [l2].[row] <= 1 ) AS [l3] ON [l].[Id] = [l3].[OneToMany_Optional_Inverse2Id] LEFT JOIN [LevelThree] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l1] ON [l3].[Id] = [l1].[OneToMany_Optional_Inverse3Id] -ORDER BY [l].[Id], [l3].[Id], [l1].[Id] +ORDER BY [l].[Id], [l1].[Id] """); } @@ -2209,7 +2209,7 @@ LEFT JOIN ( LEFT JOIN [LevelThree] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l1] ON [l0].[Id] = [l1].[OneToOne_Optional_PK_Inverse3Id] LEFT JOIN [LevelFour] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l2] ON [l1].[Id] = [l2].[Level3_Optional_Id] ) AS [s] ON [l].[Id] = [s].[OneToMany_Optional_Inverse2Id] -ORDER BY [l].[Id], [s].[Id], [s].[Id0] +ORDER BY [l].[Id] """); } @@ -2350,7 +2350,7 @@ LEFT JOIN ( 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] ) AS [s] ON [l].[Id] = [s].[OneToMany_Optional_Inverse2Id] -ORDER BY [l].[Id], [s].[Id] +ORDER BY [l].[Id] """); } @@ -2399,7 +2399,7 @@ public override async Task Including_reference_navigation_and_projecting_collect LEFT JOIN [LevelTwo] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l0] ON [l].[Id] = [l0].[Level1_Required_Id] LEFT JOIN [LevelThree] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l1] ON [l0].[Id] = [l1].[Level2_Optional_Id] LEFT JOIN [LevelTwo] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l2] ON [l].[Id] = [l2].[OneToMany_Required_Inverse2Id] -ORDER BY [l].[Id], [l0].[Id], [l1].[Id] +ORDER BY [l].[Id] """); } @@ -2447,7 +2447,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_Optional_Id] ) AS [s] ON [l0].[Id] = [s].[OneToMany_Optional_Inverse3Id] -ORDER BY [l].[Id], [l0].[Id], [s].[Id] +ORDER BY [l].[Id] """); } @@ -2461,7 +2461,7 @@ public override async Task Include_reference_followed_by_include_collection(bool 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].[Level1_Optional_Id] LEFT JOIN [LevelThree] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l1] ON [l0].[Id] = [l1].[OneToMany_Optional_Inverse3Id] -ORDER BY [l].[Id], [l0].[Id] +ORDER BY [l].[Id] """); } @@ -2479,7 +2479,7 @@ LEFT JOIN ( LEFT JOIN [LevelThree] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l1] ON [l0].[Id] = [l1].[OneToOne_Optional_PK_Inverse3Id] LEFT JOIN [LevelFour] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l2] ON [l1].[Id] = [l2].[Level3_Optional_Id] ) AS [s] ON [l].[Id] = [s].[OneToMany_Optional_Inverse2Id] -ORDER BY [l].[Id], [s].[Id], [s].[Id0] +ORDER BY [l].[Id] """); } @@ -2517,10 +2517,10 @@ await base AssertSql( """ -SELECT [l].[Id], [l].[Date], [l].[Name], [l].[OneToMany_Optional_Self_Inverse1Id], [l].[OneToMany_Required_Self_Inverse1Id], [l].[OneToOne_Optional_Self1Id], [l].[PeriodEnd], [l].[PeriodStart], [s].[Id], [s].[Date], [s].[Level1_Optional_Id], [s].[Level1_Required_Id], [s].[Name], [s].[OneToMany_Optional_Inverse2Id], [s].[OneToMany_Optional_Self_Inverse2Id], [s].[OneToMany_Required_Inverse2Id], [s].[OneToMany_Required_Self_Inverse2Id], [s].[OneToOne_Optional_PK_Inverse2Id], [s].[OneToOne_Optional_Self2Id], [s].[PeriodEnd], [s].[PeriodStart], [s].[Id0], [s].[Id1], [s].[Level2_Optional_Id], [s].[Level2_Required_Id], [s].[Name0], [s].[OneToMany_Optional_Inverse3Id], [s].[OneToMany_Optional_Self_Inverse3Id], [s].[OneToMany_Required_Inverse3Id], [s].[OneToMany_Required_Self_Inverse3Id], [s].[OneToOne_Optional_PK_Inverse3Id], [s].[OneToOne_Optional_Self3Id], [s].[PeriodEnd0], [s].[PeriodStart0], [s].[Level2_Optional_Id0], [s].[Level2_Required_Id0], [s].[Name1], [s].[OneToMany_Optional_Inverse3Id0], [s].[OneToMany_Optional_Self_Inverse3Id0], [s].[OneToMany_Required_Inverse3Id0], [s].[OneToMany_Required_Self_Inverse3Id0], [s].[OneToOne_Optional_PK_Inverse3Id0], [s].[OneToOne_Optional_Self3Id0], [s].[PeriodEnd1], [s].[PeriodStart1] +SELECT [l].[Id], [l].[Date], [l].[Name], [l].[OneToMany_Optional_Self_Inverse1Id], [l].[OneToMany_Required_Self_Inverse1Id], [l].[OneToOne_Optional_Self1Id], [l].[PeriodEnd], [l].[PeriodStart], [s].[Id], [s].[Date], [s].[Level1_Optional_Id], [s].[Level1_Required_Id], [s].[Name], [s].[OneToMany_Optional_Inverse2Id], [s].[OneToMany_Optional_Self_Inverse2Id], [s].[OneToMany_Required_Inverse2Id], [s].[OneToMany_Required_Self_Inverse2Id], [s].[OneToOne_Optional_PK_Inverse2Id], [s].[OneToOne_Optional_Self2Id], [s].[PeriodEnd], [s].[PeriodStart], [s].[Id0], [s].[Level2_Optional_Id], [s].[Level2_Required_Id], [s].[Name0], [s].[OneToMany_Optional_Inverse3Id], [s].[OneToMany_Optional_Self_Inverse3Id], [s].[OneToMany_Required_Inverse3Id], [s].[OneToMany_Required_Self_Inverse3Id], [s].[OneToOne_Optional_PK_Inverse3Id], [s].[OneToOne_Optional_Self3Id], [s].[PeriodEnd0], [s].[PeriodStart0], [s].[Id1], [s].[Level2_Optional_Id0], [s].[Level2_Required_Id0], [s].[Name1], [s].[OneToMany_Optional_Inverse3Id0], [s].[OneToMany_Optional_Self_Inverse3Id0], [s].[OneToMany_Required_Inverse3Id0], [s].[OneToMany_Required_Self_Inverse3Id0], [s].[OneToOne_Optional_PK_Inverse3Id0], [s].[OneToOne_Optional_Self3Id0], [s].[PeriodEnd1], [s].[PeriodStart1] FROM [LevelOne] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l] OUTER APPLY ( - SELECT [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], [l1].[Id] AS [Id0], [l3].[Id] AS [Id1], [l3].[Level2_Optional_Id], [l3].[Level2_Required_Id], [l3].[Name] AS [Name0], [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] AS [PeriodEnd0], [l3].[PeriodStart] AS [PeriodStart0], [l1].[Level2_Optional_Id] AS [Level2_Optional_Id0], [l1].[Level2_Required_Id] AS [Level2_Required_Id0], [l1].[Name] AS [Name1], [l1].[OneToMany_Optional_Inverse3Id] AS [OneToMany_Optional_Inverse3Id0], [l1].[OneToMany_Optional_Self_Inverse3Id] AS [OneToMany_Optional_Self_Inverse3Id0], [l1].[OneToMany_Required_Inverse3Id] AS [OneToMany_Required_Inverse3Id0], [l1].[OneToMany_Required_Self_Inverse3Id] AS [OneToMany_Required_Self_Inverse3Id0], [l1].[OneToOne_Optional_PK_Inverse3Id] AS [OneToOne_Optional_PK_Inverse3Id0], [l1].[OneToOne_Optional_Self3Id] AS [OneToOne_Optional_Self3Id0], [l1].[PeriodEnd] AS [PeriodEnd1], [l1].[PeriodStart] AS [PeriodStart1] + SELECT [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], [l3].[Id] AS [Id0], [l3].[Level2_Optional_Id], [l3].[Level2_Required_Id], [l3].[Name] AS [Name0], [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] AS [PeriodEnd0], [l3].[PeriodStart] AS [PeriodStart0], [l1].[Id] AS [Id1], [l1].[Level2_Optional_Id] AS [Level2_Optional_Id0], [l1].[Level2_Required_Id] AS [Level2_Required_Id0], [l1].[Name] AS [Name1], [l1].[OneToMany_Optional_Inverse3Id] AS [OneToMany_Optional_Inverse3Id0], [l1].[OneToMany_Optional_Self_Inverse3Id] AS [OneToMany_Optional_Self_Inverse3Id0], [l1].[OneToMany_Required_Inverse3Id] AS [OneToMany_Required_Inverse3Id0], [l1].[OneToMany_Required_Self_Inverse3Id] AS [OneToMany_Required_Self_Inverse3Id0], [l1].[OneToOne_Optional_PK_Inverse3Id] AS [OneToOne_Optional_PK_Inverse3Id0], [l1].[OneToOne_Optional_Self3Id] AS [OneToOne_Optional_Self3Id0], [l1].[PeriodEnd] AS [PeriodEnd1], [l1].[PeriodStart] AS [PeriodStart1] FROM ( SELECT TOP(2) [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] @@ -2530,7 +2530,7 @@ ORDER BY [l0].[Id] LEFT JOIN [LevelThree] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l1] ON [l2].[Id] = [l1].[Level2_Required_Id] LEFT JOIN [LevelThree] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l3] ON [l2].[Id] = [l3].[OneToMany_Optional_Inverse3Id] ) AS [s] -ORDER BY [l].[Id], [s].[Id], [s].[Id0] +ORDER BY [l].[Id], [s].[Id] """); } @@ -2592,7 +2592,7 @@ LEFT JOIN ( LEFT JOIN [LevelThree] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l1] ON [l0].[Id] = [l1].[OneToOne_Optional_PK_Inverse3Id] LEFT JOIN [LevelFour] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l2] ON [l1].[Id] = [l2].[Level3_Optional_Id] ) AS [s] ON [l].[Id] = [s].[OneToMany_Optional_Inverse2Id] -ORDER BY [l].[Id], [s].[Id1], [s].[Id] +ORDER BY [l].[Id] """); } @@ -2621,12 +2621,12 @@ public override async Task LeftJoin_with_Any_on_outer_source_and_projecting_coll SELECT CASE WHEN [l0].[Id] IS NULL THEN 0 ELSE [l0].[Id] -END, [l].[Id], [l0].[Id], [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] +END, [l].[Id], [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] 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].[Level1_Required_Id] LEFT JOIN [LevelThree] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l1] ON [l0].[Id] = [l1].[OneToMany_Required_Inverse3Id] WHERE [l].[Name] IN (@validIds1, @validIds2) -ORDER BY [l].[Id], [l0].[Id] +ORDER BY [l].[Id] """); } @@ -2726,7 +2726,7 @@ public override async Task Projecting_collection_after_optional_reference_correl AssertSql( """ -SELECT [l].[Id], [l0].[Id], [l2].[ChildId], [l2].[ParentName] +SELECT [l].[Id], [l2].[ChildId], [l2].[ParentName] 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].[Level1_Optional_Id] OUTER APPLY ( @@ -2734,7 +2734,7 @@ OUTER APPLY ( 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] ) AS [l2] -ORDER BY [l].[Id], [l0].[Id] +ORDER BY [l].[Id] """); } @@ -2744,7 +2744,7 @@ public override async Task Projecting_collection_with_group_by_after_optional_re AssertSql( """ -SELECT [l].[Id], [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], [l0].[Id], [l3].[Key], [l3].[Count] +SELECT [l].[Id], [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], [l3].[Key], [l3].[Count] 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].[Level1_Optional_Id] LEFT JOIN [LevelThree] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l1] ON [l0].[Id] = [l1].[Level2_Optional_Id] @@ -2754,7 +2754,7 @@ OUTER APPLY ( WHERE [l0].[Id] IS NOT NULL AND [l0].[Id] = [l2].[OneToMany_Optional_Inverse3Id] GROUP BY [l2].[Name] ) AS [l3] -ORDER BY [l].[Id], [l0].[Id], [l1].[Id] +ORDER BY [l].[Id] """); } @@ -2773,7 +2773,7 @@ LEFT JOIN ( FROM [LevelTwo] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l2] LEFT JOIN [LevelThree] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l3] ON [l2].[Id] = [l3].[Level2_Optional_Id] ) AS [s] ON [l].[Id] = [s].[OneToMany_Optional_Inverse2Id] -ORDER BY [l].[Id], [l0].[Id], [l1].[Id], [s].[Id] +ORDER BY [l].[Id], [l1].[Id] """); } @@ -2792,7 +2792,7 @@ LEFT JOIN ( FROM [LevelOne] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l2] LEFT JOIN [LevelOne] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l3] ON [l2].[OneToOne_Optional_Self1Id] = [l3].[Id] ) AS [s] ON [l].[Id] = [s].[OneToMany_Optional_Self_Inverse1Id] -ORDER BY [l].[Id], [l0].[Id], [l1].[Id], [s].[Id] +ORDER BY [l].[Id], [l1].[Id] """); } @@ -2815,7 +2815,7 @@ 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 -ORDER BY [l].[Id], [s].[Id], [s].[Id0] +ORDER BY [l].[Id] """); } @@ -2887,7 +2887,7 @@ WHERE [l1].[Name] <> N'Foo' OR [l1].[Name] IS NULL ) AS [l2] WHERE 1 < [l2].[row] AND [l2].[row] <= 4 ) AS [l3] ON [l0].[Id] = [l3].[OneToMany_Optional_Inverse3Id] -ORDER BY [l].[Id], [l0].[Id], [l3].[OneToMany_Optional_Inverse3Id], [l3].[Name] +ORDER BY [l].[Id], [l3].[OneToMany_Optional_Inverse3Id], [l3].[Name] """); } @@ -2934,7 +2934,7 @@ LEFT JOIN ( 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].[Level2_Optional_Id] ) AS [s] ON [l].[Id] = [s].[OneToMany_Optional_Inverse2Id] -ORDER BY [l].[Name], [l].[Id], [s].[Id] +ORDER BY [l].[Name], [l].[Id] """); } @@ -2958,11 +2958,11 @@ public override async Task Final_GroupBy_property_entity_Include_collection_refe AssertSql( """ -SELECT [l].[Name], [l].[Id], [l].[Date], [l].[OneToMany_Optional_Self_Inverse1Id], [l].[OneToMany_Required_Self_Inverse1Id], [l].[OneToOne_Optional_Self1Id], [l].[PeriodEnd], [l].[PeriodStart], [l0].[Id], [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], [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] +SELECT [l].[Name], [l].[Id], [l].[Date], [l].[OneToMany_Optional_Self_Inverse1Id], [l].[OneToMany_Required_Self_Inverse1Id], [l].[OneToOne_Optional_Self1Id], [l].[PeriodEnd], [l].[PeriodStart], [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], [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 [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].[Level1_Optional_Id] 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].[Name], [l].[Id], [l0].[Id] +ORDER BY [l].[Name], [l].[Id] """); } diff --git a/test/EFCore.SqlServer.FunctionalTests/Query/TemporalComplexNavigationsCollectionsSharedTypeQuerySqlServerTest.cs b/test/EFCore.SqlServer.FunctionalTests/Query/TemporalComplexNavigationsCollectionsSharedTypeQuerySqlServerTest.cs index adbbd671057..071738ab0f6 100644 --- a/test/EFCore.SqlServer.FunctionalTests/Query/TemporalComplexNavigationsCollectionsSharedTypeQuerySqlServerTest.cs +++ b/test/EFCore.SqlServer.FunctionalTests/Query/TemporalComplexNavigationsCollectionsSharedTypeQuerySqlServerTest.cs @@ -72,7 +72,7 @@ WHERE [l4].[Level2_Required_Id] IS NOT NULL AND [l4].[OneToMany_Required_Inverse ) AS [l6] 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 AND [l2].[PeriodEnd] IS NOT NULL AND [l2].[PeriodStart] IS NOT NULL THEN [l2].[Id] END = [l6].[OneToMany_Required_Inverse3Id] -ORDER BY [l1].[Name], [l1].[Id], [l2].[Id], [l5].[Id] +ORDER BY [l1].[Name], [l1].[Id], [l5].[Id] """); } @@ -85,7 +85,7 @@ public override async Task Complex_multi_include_with_order_by_and_paging_joins_ @p='0' @p1='10' -SELECT [l1].[Id], [l1].[Date], [l1].[Name], [l1].[PeriodEnd], [l1].[PeriodStart], [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], [l4].[Id], [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], [l7].[PeriodEnd], [l7].[PeriodStart], [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], [l4].[PeriodEnd], [l4].[PeriodStart], [l8].[Id], [l8].[Level2_Optional_Id], [l8].[Level2_Required_Id], [l8].[Level3_Name], [l8].[OneToMany_Optional_Inverse3Id], [l8].[OneToMany_Required_Inverse3Id], [l8].[OneToOne_Optional_PK_Inverse3Id], [l8].[PeriodEnd], [l8].[PeriodStart] +SELECT [l1].[Id], [l1].[Date], [l1].[Name], [l1].[PeriodEnd], [l1].[PeriodStart], [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], [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], [l7].[PeriodEnd], [l7].[PeriodStart], [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], [l4].[PeriodEnd], [l4].[PeriodStart], [l8].[Id], [l8].[Level2_Optional_Id], [l8].[Level2_Required_Id], [l8].[Level3_Name], [l8].[OneToMany_Optional_Inverse3Id], [l8].[OneToMany_Required_Inverse3Id], [l8].[OneToOne_Optional_PK_Inverse3Id], [l8].[PeriodEnd], [l8].[PeriodStart] FROM ( SELECT [l].[Id], [l].[Date], [l].[Name], [l].[PeriodEnd], [l].[PeriodStart] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l] @@ -116,7 +116,7 @@ WHERE [l6].[Level2_Required_Id] IS NOT NULL AND [l6].[OneToMany_Required_Inverse ) AS [l8] ON CASE WHEN [l4].[OneToOne_Required_PK_Date] IS NOT NULL AND [l4].[Level1_Required_Id] IS NOT NULL AND [l4].[OneToMany_Required_Inverse2Id] IS NOT NULL AND [l4].[PeriodEnd] IS NOT NULL AND [l4].[PeriodStart] IS NOT NULL THEN [l4].[Id] END = [l8].[OneToMany_Required_Inverse3Id] -ORDER BY [l1].[Name], [l1].[Id], [l2].[Id], [l4].[Id], [l7].[Id] +ORDER BY [l1].[Name], [l1].[Id], [l7].[Id] """); } @@ -155,7 +155,7 @@ WHERE [l5].[Level3_Required_Id] IS NOT NULL AND [l5].[OneToMany_Required_Inverse ) AS [l6] ON CASE WHEN [l4].[Level2_Required_Id] IS NOT NULL AND [l4].[OneToMany_Required_Inverse3Id] IS NOT NULL AND [l4].[PeriodEnd] IS NOT NULL AND [l4].[PeriodStart] IS NOT NULL THEN [l4].[Id] END = [l6].[OneToMany_Optional_Inverse4Id] -ORDER BY [l1].[Name], [l1].[Id], [l2].[Id], [l4].[Id] +ORDER BY [l1].[Name], [l1].[Id] """); } @@ -165,7 +165,7 @@ public override async Task Complex_query_with_let_collection_projection_FirstOrD AssertSql( """ -SELECT [l].[Id], [l4].[Id], [l5].[Name], [l5].[Id], [l4].[c] +SELECT [l].[Id], [l5].[Name], [l5].[Id], [l4].[c] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l] LEFT JOIN ( SELECT [l3].[c], [l3].[Id], [l3].[OneToOne_Required_PK_Date], [l3].[Level1_Required_Id], [l3].[OneToMany_Required_Inverse2Id], [l3].[PeriodEnd], [l3].[PeriodStart], [l3].[OneToMany_Optional_Inverse2Id] @@ -186,7 +186,7 @@ SELECT 1 WHEN [l4].[OneToOne_Required_PK_Date] IS NOT NULL AND [l4].[Level1_Required_Id] IS NOT NULL AND [l4].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [l4].[Id] END) ) AS [l5] -ORDER BY [l].[Id], [l4].[Id] +ORDER BY [l].[Id] """); } @@ -308,7 +308,7 @@ WHERE [l2].[Level2_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse ) AS [l4] ON 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 AND [l1].[PeriodEnd] IS NOT NULL AND [l1].[PeriodStart] IS NOT NULL THEN [l1].[Id] END = [l4].[OneToMany_Optional_Inverse3Id] -ORDER BY [l].[Id], [l1].[Id], [l4].[OneToMany_Optional_Inverse3Id], [l4].[Level3_Name] +ORDER BY [l].[Id], [l4].[OneToMany_Optional_Inverse3Id], [l4].[Level3_Name] """); } @@ -347,7 +347,7 @@ WHERE [l4].[Level3_Required_Id] IS NOT NULL AND [l4].[OneToMany_Required_Inverse WHEN [l3].[Level2_Required_Id] IS NOT NULL AND [l3].[OneToMany_Required_Inverse3Id] IS NOT NULL AND [l3].[PeriodEnd] IS NOT NULL AND [l3].[PeriodStart] IS NOT NULL THEN [l3].[Id] END = [l5].[OneToMany_Optional_Inverse4Id] ) AS [s] -ORDER BY [l].[Id], [s].[c], [s].[Id], [s].[Id0] +ORDER BY [l].[Id], [s].[c], [s].[Id] """); } @@ -661,10 +661,10 @@ public override async Task AssertSql( """ -SELECT [l].[Id], [l].[Date], [l].[Name], [l].[PeriodEnd], [l].[PeriodStart], [s].[Id], [s].[OneToOne_Required_PK_Date], [s].[Level1_Optional_Id], [s].[Level1_Required_Id], [s].[Level2_Name], [s].[OneToMany_Optional_Inverse2Id], [s].[OneToMany_Required_Inverse2Id], [s].[OneToOne_Optional_PK_Inverse2Id], [s].[PeriodEnd], [s].[PeriodStart], [s].[Id0], [s].[Id1], [s].[Level2_Optional_Id], [s].[Level2_Required_Id], [s].[Level3_Name], [s].[OneToMany_Optional_Inverse3Id], [s].[OneToMany_Required_Inverse3Id], [s].[OneToOne_Optional_PK_Inverse3Id], [s].[PeriodEnd0], [s].[PeriodStart0], [s].[Level2_Optional_Id0], [s].[Level2_Required_Id0], [s].[Level3_Name0], [s].[OneToMany_Optional_Inverse3Id0], [s].[OneToMany_Required_Inverse3Id0], [s].[OneToOne_Optional_PK_Inverse3Id0], [s].[PeriodEnd1], [s].[PeriodStart1] +SELECT [l].[Id], [l].[Date], [l].[Name], [l].[PeriodEnd], [l].[PeriodStart], [s].[Id], [s].[OneToOne_Required_PK_Date], [s].[Level1_Optional_Id], [s].[Level1_Required_Id], [s].[Level2_Name], [s].[OneToMany_Optional_Inverse2Id], [s].[OneToMany_Required_Inverse2Id], [s].[OneToOne_Optional_PK_Inverse2Id], [s].[PeriodEnd], [s].[PeriodStart], [s].[Id0], [s].[Level2_Optional_Id], [s].[Level2_Required_Id], [s].[Level3_Name], [s].[OneToMany_Optional_Inverse3Id], [s].[OneToMany_Required_Inverse3Id], [s].[OneToOne_Optional_PK_Inverse3Id], [s].[PeriodEnd0], [s].[PeriodStart0], [s].[Id1], [s].[Level2_Optional_Id0], [s].[Level2_Required_Id0], [s].[Level3_Name0], [s].[OneToMany_Optional_Inverse3Id0], [s].[OneToMany_Required_Inverse3Id0], [s].[OneToOne_Optional_PK_Inverse3Id0], [s].[PeriodEnd1], [s].[PeriodStart1] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l] OUTER APPLY ( - 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], [l3].[Id] AS [Id0], [l5].[Id] AS [Id1], [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] AS [PeriodEnd0], [l5].[PeriodStart] AS [PeriodStart0], [l3].[Level2_Optional_Id] AS [Level2_Optional_Id0], [l3].[Level2_Required_Id] AS [Level2_Required_Id0], [l3].[Level3_Name] AS [Level3_Name0], [l3].[OneToMany_Optional_Inverse3Id] AS [OneToMany_Optional_Inverse3Id0], [l3].[OneToMany_Required_Inverse3Id] AS [OneToMany_Required_Inverse3Id0], [l3].[OneToOne_Optional_PK_Inverse3Id] AS [OneToOne_Optional_PK_Inverse3Id0], [l3].[PeriodEnd] AS [PeriodEnd1], [l3].[PeriodStart] AS [PeriodStart1], [l2].[c] + 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], [l5].[Id] AS [Id0], [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] AS [PeriodEnd0], [l5].[PeriodStart] AS [PeriodStart0], [l3].[Id] AS [Id1], [l3].[Level2_Optional_Id] AS [Level2_Optional_Id0], [l3].[Level2_Required_Id] AS [Level2_Required_Id0], [l3].[Level3_Name] AS [Level3_Name0], [l3].[OneToMany_Optional_Inverse3Id] AS [OneToMany_Optional_Inverse3Id0], [l3].[OneToMany_Required_Inverse3Id] AS [OneToMany_Required_Inverse3Id0], [l3].[OneToOne_Optional_PK_Inverse3Id] AS [OneToOne_Optional_PK_Inverse3Id0], [l3].[PeriodEnd] AS [PeriodEnd1], [l3].[PeriodStart] AS [PeriodStart1], [l2].[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] @@ -690,7 +690,7 @@ WHERE [l4].[Level2_Required_Id] IS NOT NULL AND [l4].[OneToMany_Required_Inverse 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 = [l5].[OneToMany_Optional_Inverse3Id] ) AS [s] -ORDER BY [l].[Id], [s].[c], [s].[Id], [s].[Id0] +ORDER BY [l].[Id], [s].[c], [s].[Id] """); } @@ -718,7 +718,7 @@ WHERE [l2].[Level2_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse ) AS [l4] ON 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 AND [l1].[PeriodEnd] IS NOT NULL AND [l1].[PeriodStart] IS NOT NULL THEN [l1].[Id] END = [l4].[OneToMany_Optional_Inverse3Id] -ORDER BY [l].[Id], [l1].[Id], [l4].[OneToMany_Optional_Inverse3Id], [l4].[Level3_Name] +ORDER BY [l].[Id], [l4].[OneToMany_Optional_Inverse3Id], [l4].[Level3_Name] """); } @@ -794,7 +794,7 @@ WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse 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 = [l3].[Level2_Optional_Id] ) AS [s] -ORDER BY [l4].[Id], [s].[Level2_Name] DESC, [s].[Id] +ORDER BY [l4].[Id], [s].[Level2_Name] DESC """); } @@ -877,7 +877,7 @@ WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse 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 = [l3].[Level2_Optional_Id] ) AS [s] -ORDER BY [l4].[Id], [s].[Id] +ORDER BY [l4].[Id] """); } @@ -911,7 +911,7 @@ WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse 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 = [l3].[Level2_Optional_Id] ) AS [s] -ORDER BY [l4].[Id], [s].[Id] +ORDER BY [l4].[Id] """); } @@ -1011,10 +1011,10 @@ public override async Task Filtered_include_same_filter_set_on_same_navigation_t AssertSql( """ -SELECT [l].[Id], [l].[Date], [l].[Name], [l].[PeriodEnd], [l].[PeriodStart], [s].[Id], [s].[OneToOne_Required_PK_Date], [s].[Level1_Optional_Id], [s].[Level1_Required_Id], [s].[Level2_Name], [s].[OneToMany_Optional_Inverse2Id], [s].[OneToMany_Required_Inverse2Id], [s].[OneToOne_Optional_PK_Inverse2Id], [s].[PeriodEnd], [s].[PeriodStart], [s].[Id0], [s].[Id1], [s].[Level2_Optional_Id], [s].[Level2_Required_Id], [s].[Level3_Name], [s].[OneToMany_Optional_Inverse3Id], [s].[OneToMany_Required_Inverse3Id], [s].[OneToOne_Optional_PK_Inverse3Id], [s].[PeriodEnd0], [s].[PeriodStart0], [s].[Level2_Optional_Id0], [s].[Level2_Required_Id0], [s].[Level3_Name0], [s].[OneToMany_Optional_Inverse3Id0], [s].[OneToMany_Required_Inverse3Id0], [s].[OneToOne_Optional_PK_Inverse3Id0], [s].[PeriodEnd1], [s].[PeriodStart1] +SELECT [l].[Id], [l].[Date], [l].[Name], [l].[PeriodEnd], [l].[PeriodStart], [s].[Id], [s].[OneToOne_Required_PK_Date], [s].[Level1_Optional_Id], [s].[Level1_Required_Id], [s].[Level2_Name], [s].[OneToMany_Optional_Inverse2Id], [s].[OneToMany_Required_Inverse2Id], [s].[OneToOne_Optional_PK_Inverse2Id], [s].[PeriodEnd], [s].[PeriodStart], [s].[Id0], [s].[Level2_Optional_Id], [s].[Level2_Required_Id], [s].[Level3_Name], [s].[OneToMany_Optional_Inverse3Id], [s].[OneToMany_Required_Inverse3Id], [s].[OneToOne_Optional_PK_Inverse3Id], [s].[PeriodEnd0], [s].[PeriodStart0], [s].[Id1], [s].[Level2_Optional_Id0], [s].[Level2_Required_Id0], [s].[Level3_Name0], [s].[OneToMany_Optional_Inverse3Id0], [s].[OneToMany_Required_Inverse3Id0], [s].[OneToOne_Optional_PK_Inverse3Id0], [s].[PeriodEnd1], [s].[PeriodStart1] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l] OUTER APPLY ( - 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], [l3].[Id] AS [Id0], [l5].[Id] AS [Id1], [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] AS [PeriodEnd0], [l5].[PeriodStart] AS [PeriodStart0], [l3].[Level2_Optional_Id] AS [Level2_Optional_Id0], [l3].[Level2_Required_Id] AS [Level2_Required_Id0], [l3].[Level3_Name] AS [Level3_Name0], [l3].[OneToMany_Optional_Inverse3Id] AS [OneToMany_Optional_Inverse3Id0], [l3].[OneToMany_Required_Inverse3Id] AS [OneToMany_Required_Inverse3Id0], [l3].[OneToOne_Optional_PK_Inverse3Id] AS [OneToOne_Optional_PK_Inverse3Id0], [l3].[PeriodEnd] AS [PeriodEnd1], [l3].[PeriodStart] AS [PeriodStart1], [l2].[c] + 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], [l5].[Id] AS [Id0], [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] AS [PeriodEnd0], [l5].[PeriodStart] AS [PeriodStart0], [l3].[Id] AS [Id1], [l3].[Level2_Optional_Id] AS [Level2_Optional_Id0], [l3].[Level2_Required_Id] AS [Level2_Required_Id0], [l3].[Level3_Name] AS [Level3_Name0], [l3].[OneToMany_Optional_Inverse3Id] AS [OneToMany_Optional_Inverse3Id0], [l3].[OneToMany_Required_Inverse3Id] AS [OneToMany_Required_Inverse3Id0], [l3].[OneToOne_Optional_PK_Inverse3Id] AS [OneToOne_Optional_PK_Inverse3Id0], [l3].[PeriodEnd] AS [PeriodEnd1], [l3].[PeriodStart] AS [PeriodStart1], [l2].[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] @@ -1040,7 +1040,7 @@ WHERE [l4].[Level2_Required_Id] IS NOT NULL AND [l4].[OneToMany_Required_Inverse 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 = [l5].[OneToMany_Optional_Inverse3Id] ) AS [s] -ORDER BY [l].[Id], [s].[c], [s].[Id], [s].[Id0] +ORDER BY [l].[Id], [s].[c], [s].[Id] """); } @@ -1077,7 +1077,7 @@ WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse 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 = [l3].[Level2_Optional_Id] ) AS [s] -ORDER BY [l4].[Id] DESC, [s].[Level2_Name] DESC, [s].[Id] +ORDER BY [l4].[Id] DESC, [s].[Level2_Name] DESC """); } @@ -1125,7 +1125,7 @@ WHEN [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] END = [l2].[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 ) AS [s] ON [l].[Id] = [s].[OneToMany_Optional_Inverse2Id] -ORDER BY [l].[Id], [s].[Id] +ORDER BY [l].[Id] """); } @@ -1173,7 +1173,7 @@ WHEN [l2].[Level2_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse3 END = [l4].[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 ) AS [s] ON [l].[Id] = [s].[OneToMany_Optional_Inverse2Id] -ORDER BY [l].[Id], [s].[Id], [s].[Id0] +ORDER BY [l].[Id] """); } @@ -1218,7 +1218,7 @@ WHEN [l6].[Level2_Required_Id] IS NOT NULL AND [l6].[OneToMany_Required_Inverse3 END = [l8].[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 ) AS [s] ON [l].[Id] = [s].[OneToMany_Optional_Inverse2Id] -ORDER BY [l].[Id], [s].[Id], [s].[Id0], [s].[Id1], [s].[Id2] +ORDER BY [l].[Id], [s].[Id] """); } @@ -1242,7 +1242,7 @@ WHEN [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] END = [l2].[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 ) AS [s] ON [l].[Id] = [s].[OneToMany_Optional_Inverse2Id] -ORDER BY [l].[Id], [s].[Id] +ORDER BY [l].[Id] """); } @@ -1304,7 +1304,7 @@ WHEN [l6].[Level2_Required_Id] IS NOT NULL AND [l6].[OneToMany_Required_Inverse3 END = [l8].[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 ) AS [s] ON [l].[Id] = [s].[OneToMany_Optional_Inverse2Id] -ORDER BY [l].[Id], [s].[Id], [s].[Id0], [s].[Id1], [s].[Id2] +ORDER BY [l].[Id], [s].[Id] """); } @@ -1346,7 +1346,7 @@ WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse WHEN [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [l0].[Id] END = [l2].[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 ([l2].[Level3_Name] <> N'Foo' OR [l2].[Level3_Name] IS NULL)) > 0 -ORDER BY [l].[Id], [s].[Id], [s].[Id0] +ORDER BY [l].[Id] """); } @@ -1382,7 +1382,7 @@ WHEN [l3].[OneToOne_Required_PK_Date] IS NOT NULL AND [l3].[Level1_Required_Id] END = [l5].[OneToOne_Optional_PK_Inverse3Id] WHERE [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 [s0] ON [l].[Id] = [s0].[OneToMany_Optional_Inverse2Id] -ORDER BY [l].[Id], [s].[Id], [s].[Id0], [s0].[Id] +ORDER BY [l].[Id], [s].[Id] """); } @@ -1413,7 +1413,7 @@ WHEN [l2].[Level2_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse3 END = [l4].[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 ) AS [s] ON [l].[Id] = [s].[OneToMany_Optional_Inverse2Id] -ORDER BY [l].[Id], [s].[Id], [s].[Id0] +ORDER BY [l].[Id] """); } @@ -1437,7 +1437,7 @@ WHEN [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] END = [l2].[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 ) AS [s] ON [l].[Id] = [s].[OneToMany_Optional_Inverse2Id] -ORDER BY [l].[Id], [s].[Id] +ORDER BY [l].[Id] """); } @@ -1486,7 +1486,7 @@ LEFT JOIN ( 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 ) AS [l5] ON [l4].[Id] = [l5].[OneToMany_Optional_Inverse2Id] -ORDER BY [l2].[Name], [l4].[Id] +ORDER BY [l2].[Name] """); } @@ -1516,7 +1516,7 @@ LEFT JOIN ( 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 ) AS [l5] ON [l4].[Id] = [l5].[OneToMany_Optional_Inverse2Id] -ORDER BY [l2].[Name], [l4].[Id] +ORDER BY [l2].[Name] """); } @@ -1547,7 +1547,7 @@ LEFT JOIN ( 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 ) AS [l5] ON [l4].[Id] = [l5].[OneToMany_Optional_Inverse2Id] -ORDER BY [l2].[Name], [l4].[Id] +ORDER BY [l2].[Name] """); } @@ -1579,7 +1579,7 @@ WHERE [l2].[Level2_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse 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 AND [l1].[PeriodEnd] IS NOT NULL AND [l1].[PeriodStart] IS NOT NULL THEN [l1].[Id] END = [s].[OneToMany_Required_Inverse3Id] WHERE [l1].[Level2_Name] <> N'L2 09' OR [l1].[Level2_Name] IS NULL -ORDER BY [l].[Id], [l1].[Id], [s].[Id] +ORDER BY [l].[Id] """); } @@ -1589,7 +1589,7 @@ public override async Task Include_partially_added_before_Where_and_then_build_u AssertSql( """ -SELECT [l].[Id], [l].[Date], [l].[Name], [l].[PeriodEnd], [l].[PeriodStart], [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], [l1].[Id], [s].[Id], [s].[Level2_Optional_Id], [s].[Level2_Required_Id], [s].[Level3_Name], [s].[OneToMany_Optional_Inverse3Id], [s].[OneToMany_Required_Inverse3Id], [s].[OneToOne_Optional_PK_Inverse3Id], [s].[PeriodEnd], [s].[PeriodStart], [s].[Id0], [s].[Level3_Optional_Id], [s].[Level3_Required_Id], [s].[Level4_Name], [s].[OneToMany_Optional_Inverse4Id], [s].[OneToMany_Required_Inverse4Id], [s].[OneToOne_Optional_PK_Inverse4Id], [s].[PeriodEnd0], [s].[PeriodStart0] +SELECT [l].[Id], [l].[Date], [l].[Name], [l].[PeriodEnd], [l].[PeriodStart], [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], [s].[Id], [s].[Level2_Optional_Id], [s].[Level2_Required_Id], [s].[Level3_Name], [s].[OneToMany_Optional_Inverse3Id], [s].[OneToMany_Required_Inverse3Id], [s].[OneToOne_Optional_PK_Inverse3Id], [s].[PeriodEnd], [s].[PeriodStart], [s].[Id0], [s].[Level3_Optional_Id], [s].[Level3_Required_Id], [s].[Level4_Name], [s].[OneToMany_Optional_Inverse4Id], [s].[OneToMany_Required_Inverse4Id], [s].[OneToOne_Optional_PK_Inverse4Id], [s].[PeriodEnd0], [s].[PeriodStart0] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' 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], [l0].[PeriodEnd], [l0].[PeriodStart] @@ -1620,7 +1620,7 @@ WHEN [l1].[OneToOne_Required_PK_Date] IS NOT NULL AND [l1].[Level1_Required_Id] END < 3 OR CASE WHEN [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 [l3].[PeriodEnd] IS NOT NULL AND [l3].[PeriodStart] IS NOT NULL THEN [l3].[Id] END > 8 -ORDER BY [l].[Id], [l1].[Id], [l3].[Id], [s].[Id] +ORDER BY [l].[Id] """); } @@ -1630,7 +1630,7 @@ public override async Task Include_partially_added_before_Where_and_then_build_u AssertSql( """ -SELECT [l].[Id], [l].[Date], [l].[Name], [l].[PeriodEnd], [l].[PeriodStart], [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], [l1].[Id], [l9].[Id], [l9].[Level2_Optional_Id], [l9].[Level2_Required_Id], [l9].[Level3_Name], [l9].[OneToMany_Optional_Inverse3Id], [l9].[OneToMany_Required_Inverse3Id], [l9].[OneToOne_Optional_PK_Inverse3Id], [l9].[PeriodEnd], [l9].[PeriodStart], [s].[Id], [s].[Level2_Optional_Id], [s].[Level2_Required_Id], [s].[Level3_Name], [s].[OneToMany_Optional_Inverse3Id], [s].[OneToMany_Required_Inverse3Id], [s].[OneToOne_Optional_PK_Inverse3Id], [s].[PeriodEnd], [s].[PeriodStart], [s].[Id0], [s].[Level3_Optional_Id], [s].[Level3_Required_Id], [s].[Level4_Name], [s].[OneToMany_Optional_Inverse4Id], [s].[OneToMany_Required_Inverse4Id], [s].[OneToOne_Optional_PK_Inverse4Id], [s].[PeriodEnd0], [s].[PeriodStart0] +SELECT [l].[Id], [l].[Date], [l].[Name], [l].[PeriodEnd], [l].[PeriodStart], [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], [l9].[Id], [l9].[Level2_Optional_Id], [l9].[Level2_Required_Id], [l9].[Level3_Name], [l9].[OneToMany_Optional_Inverse3Id], [l9].[OneToMany_Required_Inverse3Id], [l9].[OneToOne_Optional_PK_Inverse3Id], [l9].[PeriodEnd], [l9].[PeriodStart], [s].[Id], [s].[Level2_Optional_Id], [s].[Level2_Required_Id], [s].[Level3_Name], [s].[OneToMany_Optional_Inverse3Id], [s].[OneToMany_Required_Inverse3Id], [s].[OneToOne_Optional_PK_Inverse3Id], [s].[PeriodEnd], [s].[PeriodStart], [s].[Id0], [s].[Level3_Optional_Id], [s].[Level3_Required_Id], [s].[Level4_Name], [s].[OneToMany_Optional_Inverse4Id], [s].[OneToMany_Required_Inverse4Id], [s].[OneToOne_Optional_PK_Inverse4Id], [s].[PeriodEnd0], [s].[PeriodStart0] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' 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], [l0].[PeriodEnd], [l0].[PeriodStart] @@ -1676,7 +1676,7 @@ WHEN [l1].[OneToOne_Required_PK_Date] IS NOT NULL AND [l1].[Level1_Required_Id] END < 3 OR CASE WHEN [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 [l3].[PeriodEnd] IS NOT NULL AND [l3].[PeriodStart] IS NOT NULL THEN [l3].[Id] END > 8 -ORDER BY [l].[Id], [l1].[Id], [l3].[Id], [l9].[OneToMany_Optional_Inverse3Id], [l9].[c], [l9].[Id], [s].[Id] +ORDER BY [l].[Id], [l9].[OneToMany_Optional_Inverse3Id], [l9].[c], [l9].[Id] """); } @@ -1700,7 +1700,7 @@ WHERE [l2].[Level2_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse ) AS [l3] ON 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 AND [l1].[PeriodEnd] IS NOT NULL AND [l1].[PeriodStart] IS NOT NULL THEN [l1].[Id] END = [l3].[OneToMany_Optional_Inverse3Id] -ORDER BY [l].[Name], [l].[Id], [l1].[Id] +ORDER BY [l].[Name], [l].[Id] """); } @@ -1726,7 +1726,7 @@ WHEN [l1].[OneToOne_Required_PK_Date] IS NOT NULL AND [l1].[Level1_Required_Id] END = [l3].[OneToMany_Optional_Inverse3Id] 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 AND [l1].[PeriodEnd] IS NOT NULL AND [l1].[PeriodStart] IS NOT NULL THEN [l1].[Id] -END, [l].[Id], [l1].[Id] +END, [l].[Id] """); } @@ -1750,7 +1750,7 @@ WHERE [l2].[Level2_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse ) AS [l3] ON 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 AND [l1].[PeriodEnd] IS NOT NULL AND [l1].[PeriodStart] IS NOT NULL THEN [l1].[Id] END = [l3].[OneToMany_Optional_Inverse3Id] -ORDER BY [l].[Id], [l1].[Id] +ORDER BY [l].[Id] """); } @@ -1774,7 +1774,7 @@ WHERE [l2].[Level2_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse ) AS [l3] ON 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 AND [l1].[PeriodEnd] IS NOT NULL AND [l1].[PeriodStart] IS NOT NULL THEN [l1].[Id] END = [l3].[OneToMany_Optional_Inverse3Id] -ORDER BY [l].[Name], [l].[Id], [l1].[Id] +ORDER BY [l].[Name], [l].[Id] """); } @@ -1805,7 +1805,7 @@ WHEN [l2].[Level2_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse3 END = [l4].[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 ) AS [s] ON [l].[Id] = [s].[OneToMany_Optional_Inverse2Id] -ORDER BY [l].[Id], [s].[Id1], [s].[Id] +ORDER BY [l].[Id] """); } @@ -1834,7 +1834,7 @@ LEFT JOIN ( FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' 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 ) AS [l5] ON [l].[Id] = [l5].[OneToMany_Required_Inverse2Id] -ORDER BY [l].[Id], [l1].[Id], [l3].[Id] +ORDER BY [l].[Id] """); } @@ -1854,7 +1854,7 @@ END IS NULL OR CASE WHEN [s].[PeriodEnd0] IS NOT NULL AND [s].[PeriodStart0] IS NOT NULL THEN [s].[PeriodStart0] END IS NULL THEN 0 WHEN [s].[OneToOne_Required_PK_Date] IS NOT NULL AND [s].[Level1_Required_Id] IS NOT NULL AND [s].[OneToMany_Required_Inverse2Id] IS NOT NULL AND [s].[PeriodEnd0] IS NOT NULL AND [s].[PeriodStart0] IS NOT NULL THEN [s].[Id0] -END, [l].[Id], [s].[Id], [s].[Id0], [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] +END, [l].[Id], [s].[Id], [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 [l] LEFT JOIN ( SELECT [l0].[Id], [l2].[Id] AS [Id0], [l2].[OneToOne_Required_PK_Date], [l2].[Level1_Required_Id], [l2].[OneToMany_Required_Inverse2Id], [l2].[PeriodEnd] AS [PeriodEnd0], [l2].[PeriodStart] AS [PeriodStart0] @@ -1880,7 +1880,7 @@ WHERE [l3].[Level2_Required_Id] IS NOT NULL AND [l3].[OneToMany_Required_Inverse WHEN [s].[OneToOne_Required_PK_Date] IS NOT NULL AND [s].[Level1_Required_Id] IS NOT NULL AND [s].[OneToMany_Required_Inverse2Id] IS NOT NULL AND [s].[PeriodEnd0] IS NOT NULL AND [s].[PeriodStart0] IS NOT NULL THEN [s].[Id0] END = [l4].[OneToMany_Required_Inverse3Id] WHERE [l].[Name] IN (@validIds1, @validIds2) -ORDER BY [l].[Id], [s].[Id], [s].[Id0] +ORDER BY [l].[Id], [s].[Id] """); } @@ -1892,17 +1892,17 @@ public override async Task Lift_projection_mapping_when_pushing_down_subquery(bo """ @p='25' -SELECT [l2].[Id], [l4].[Id0], [l5].[Id], [l5].[Id0], [l4].[Id], [l4].[c] +SELECT [l2].[Id], [l5].[Id], [l5].[Id0], [l4].[Id], [l4].[c] FROM ( SELECT TOP(@p) [l].[Id] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l] ) AS [l2] LEFT JOIN ( - SELECT [l3].[Id], [l3].[c], [l3].[Id0], [l3].[OneToMany_Required_Inverse2Id] + SELECT [l3].[Id], [l3].[c], [l3].[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] - 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] + END AS [Id], 1 AS [c], [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 ) AS [l3] @@ -1915,7 +1915,7 @@ WHEN [l1].[OneToOne_Required_PK_Date] IS NOT NULL AND [l1].[Level1_Required_Id] 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 ) AS [l5] ON [l2].[Id] = [l5].[OneToMany_Required_Inverse2Id] -ORDER BY [l2].[Id], [l4].[Id0] +ORDER BY [l2].[Id] """); } @@ -1951,7 +1951,7 @@ WHEN [l3].[OneToOne_Required_PK_Date] IS NOT NULL AND [l3].[Level1_Required_Id] END = [l5].[Level2_Optional_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 ) AS [s] ON [l].[Id] = [s].[OneToMany_Optional_Inverse2Id] -ORDER BY [l].[Id], [l1].[Id], [l6].[Id], [s].[Id] +ORDER BY [l].[Id], [l6].[Id] """); } @@ -1987,7 +1987,7 @@ WHEN [l3].[OneToOne_Required_PK_Date] IS NOT NULL AND [l3].[Level1_Required_Id] END = [l5].[Level2_Optional_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 ) AS [s] ON [l].[Id] = [s].[OneToMany_Optional_Inverse2Id] -ORDER BY [l].[Id], [l1].[Id], [l6].[Id], [s].[Id] +ORDER BY [l].[Id], [l6].[Id] """); } @@ -1997,7 +1997,7 @@ public override async Task Multiple_include_with_multiple_optional_navigations(b AssertSql( """ -SELECT [l].[Id], [l].[Date], [l].[Name], [l].[PeriodEnd], [l].[PeriodStart], [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], [l3].[Id], [l5].[Id], [l7].[Id], [l9].[Id], [l11].[Id], [l11].[Level2_Optional_Id], [l11].[Level2_Required_Id], [l11].[Level3_Name], [l11].[OneToMany_Optional_Inverse3Id], [l11].[OneToMany_Required_Inverse3Id], [l11].[OneToOne_Optional_PK_Inverse3Id], [l11].[PeriodEnd], [l11].[PeriodStart], [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], [l7].[OneToOne_Required_PK_Date], [l7].[Level1_Optional_Id], [l7].[Level1_Required_Id], [l7].[Level2_Name], [l7].[OneToMany_Optional_Inverse2Id], [l7].[OneToMany_Required_Inverse2Id], [l7].[OneToOne_Optional_PK_Inverse2Id], [l7].[PeriodEnd], [l7].[PeriodStart], [l9].[Level2_Optional_Id], [l9].[Level2_Required_Id], [l9].[Level3_Name], [l9].[OneToMany_Optional_Inverse3Id], [l9].[OneToMany_Required_Inverse3Id], [l9].[OneToOne_Optional_PK_Inverse3Id], [l9].[PeriodEnd], [l9].[PeriodStart] +SELECT [l].[Id], [l].[Date], [l].[Name], [l].[PeriodEnd], [l].[PeriodStart], [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], [l11].[Id], [l11].[Level2_Optional_Id], [l11].[Level2_Required_Id], [l11].[Level3_Name], [l11].[OneToMany_Optional_Inverse3Id], [l11].[OneToMany_Required_Inverse3Id], [l11].[OneToOne_Optional_PK_Inverse3Id], [l11].[PeriodEnd], [l11].[PeriodStart], [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], [l7].[Id], [l7].[OneToOne_Required_PK_Date], [l7].[Level1_Optional_Id], [l7].[Level1_Required_Id], [l7].[Level2_Name], [l7].[OneToMany_Optional_Inverse2Id], [l7].[OneToMany_Required_Inverse2Id], [l7].[OneToOne_Optional_PK_Inverse2Id], [l7].[PeriodEnd], [l7].[PeriodStart], [l9].[Id], [l9].[Level2_Optional_Id], [l9].[Level2_Required_Id], [l9].[Level3_Name], [l9].[OneToMany_Optional_Inverse3Id], [l9].[OneToMany_Required_Inverse3Id], [l9].[OneToOne_Optional_PK_Inverse3Id], [l9].[PeriodEnd], [l9].[PeriodStart] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' 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], [l0].[PeriodEnd], [l0].[PeriodStart] @@ -2005,7 +2005,7 @@ LEFT JOIN ( WHERE [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] IS NOT NULL AND [l0].[OneToMany_Required_Inverse2Id] IS NOT NULL ) AS [l1] ON [l].[Id] = [l1].[Level1_Required_Id] LEFT JOIN ( - SELECT [l2].[Id], [l2].[Level3_Name], [l2].[OneToOne_Optional_PK_Inverse3Id] + SELECT [l2].[Level3_Name], [l2].[OneToOne_Optional_PK_Inverse3Id] 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 ) AS [l3] ON CASE @@ -2038,7 +2038,7 @@ WHERE [l10].[Level2_Required_Id] IS NOT NULL AND [l10].[OneToMany_Required_Inver 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 AND [l1].[PeriodEnd] IS NOT NULL AND [l1].[PeriodStart] IS NOT NULL THEN [l1].[Id] END = [l11].[OneToMany_Optional_Inverse3Id] WHERE [l3].[Level3_Name] <> N'Foo' OR [l3].[Level3_Name] IS NULL -ORDER BY [l].[Id], [l1].[Id], [l3].[Id], [l5].[Id], [l7].[Id], [l9].[Id] +ORDER BY [l].[Id] """); } @@ -2048,7 +2048,7 @@ public override async Task Multiple_optional_navigation_with_Include(bool async) AssertSql( """ -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], [l].[Id], [l1].[Id], [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], [l5].[PeriodEnd], [l5].[PeriodStart] +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], [l].[Id], [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], [l5].[PeriodEnd], [l5].[PeriodStart] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l] 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] @@ -2069,7 +2069,7 @@ WHERE [l4].[Level3_Required_Id] IS NOT NULL AND [l4].[OneToMany_Required_Inverse ) AS [l5] ON CASE WHEN [l3].[Level2_Required_Id] IS NOT NULL AND [l3].[OneToMany_Required_Inverse3Id] IS NOT NULL AND [l3].[PeriodEnd] IS NOT NULL AND [l3].[PeriodStart] IS NOT NULL THEN [l3].[Id] END = [l5].[OneToMany_Optional_Inverse4Id] -ORDER BY [l].[Id], [l1].[Id], [l3].[Id] +ORDER BY [l].[Id] """); } @@ -2079,7 +2079,7 @@ public override async Task Multiple_optional_navigation_with_string_based_Includ AssertSql( """ -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], [l].[Id], [l1].[Id], [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], [l5].[PeriodEnd], [l5].[PeriodStart] +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], [l].[Id], [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], [l5].[PeriodEnd], [l5].[PeriodStart] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l] 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] @@ -2100,7 +2100,7 @@ WHERE [l4].[Level3_Required_Id] IS NOT NULL AND [l4].[OneToMany_Required_Inverse ) AS [l5] ON CASE WHEN [l3].[Level2_Required_Id] IS NOT NULL AND [l3].[OneToMany_Required_Inverse3Id] IS NOT NULL AND [l3].[PeriodEnd] IS NOT NULL AND [l3].[PeriodStart] IS NOT NULL THEN [l3].[Id] END = [l5].[OneToMany_Optional_Inverse4Id] -ORDER BY [l].[Id], [l1].[Id], [l3].[Id] +ORDER BY [l].[Id] """); } @@ -2171,7 +2171,7 @@ WHERE [l6].[Level3_Required_Id] IS NOT NULL AND [l6].[OneToMany_Required_Inverse ) AS [l7] ON CASE WHEN [l3].[Level2_Required_Id] IS NOT NULL AND [l3].[OneToMany_Required_Inverse3Id] IS NOT NULL THEN [l3].[Id] END = [l7].[OneToMany_Optional_Inverse4Id] -ORDER BY [l].[Id], [l1].[Id], [l3].[Id], [l5].[Id] +ORDER BY [l].[Id], [l1].[Id], [l3].[Id] """); } @@ -2210,7 +2210,7 @@ WHEN [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] END = [s].[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 ) AS [s0] ON [l].[Id] = [s0].[OneToMany_Optional_Inverse2Id] -ORDER BY [l].[Id], [s0].[Id], [s0].[Id0], [s0].[Id00] +ORDER BY [l].[Id], [s0].[Id], [s0].[Id0] """); } @@ -2244,7 +2244,7 @@ public override async Task Null_check_in_anonymous_type_projection_should_not_be AssertSql( """ -SELECT [l].[Id], [s].[c], [s].[Level3_Name], [s].[Id], [s].[Id0] +SELECT [l].[Id], [s].[c], [s].[Level3_Name], [s].[Id] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l] LEFT JOIN ( SELECT CASE @@ -2254,10 +2254,10 @@ END IS NULL OR CASE WHEN [l2].[PeriodEnd] IS NOT NULL AND [l2].[PeriodStart] IS NOT NULL THEN [l2].[PeriodStart] END IS NULL THEN CAST(1 AS bit) ELSE CAST(0 AS bit) - END AS [c], [l2].[Level3_Name], [l0].[Id], [l2].[Id] AS [Id0], [l0].[OneToMany_Optional_Inverse2Id] + END AS [c], [l2].[Level3_Name], [l0].[Id], [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] + SELECT [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 ) AS [l2] ON CASE @@ -2265,7 +2265,7 @@ WHEN [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] END = [l2].[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 ) AS [s] ON [l].[Id] = [s].[OneToMany_Optional_Inverse2Id] -ORDER BY [l].[Id], [s].[Id] +ORDER BY [l].[Id] """); } @@ -2275,7 +2275,7 @@ public override async Task Null_check_in_Dto_projection_should_not_be_removed(bo AssertSql( """ -SELECT [l].[Id], [s].[c], [s].[Level3_Name], [s].[Id], [s].[Id0] +SELECT [l].[Id], [s].[c], [s].[Level3_Name], [s].[Id] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l] LEFT JOIN ( SELECT CASE @@ -2285,10 +2285,10 @@ END IS NULL OR CASE WHEN [l2].[PeriodEnd] IS NOT NULL AND [l2].[PeriodStart] IS NOT NULL THEN [l2].[PeriodStart] END IS NULL THEN CAST(1 AS bit) ELSE CAST(0 AS bit) - END AS [c], [l2].[Level3_Name], [l0].[Id], [l2].[Id] AS [Id0], [l0].[OneToMany_Optional_Inverse2Id] + END AS [c], [l2].[Level3_Name], [l0].[Id], [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] + SELECT [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 ) AS [l2] ON CASE @@ -2296,7 +2296,7 @@ WHEN [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] END = [l2].[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 ) AS [s] ON [l].[Id] = [s].[OneToMany_Optional_Inverse2Id] -ORDER BY [l].[Id], [s].[Id] +ORDER BY [l].[Id] """); } @@ -2320,7 +2320,7 @@ WHERE [l2].[Level2_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse ) AS [l3] ON 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 AND [l1].[PeriodEnd] IS NOT NULL AND [l1].[PeriodStart] IS NOT NULL THEN [l1].[Id] END = [l3].[OneToMany_Optional_Inverse3Id] -ORDER BY [l1].[Level2_Name], [l].[Id], [l1].[Id] +ORDER BY [l1].[Level2_Name], [l].[Id] """); } @@ -2351,7 +2351,7 @@ WHERE [l2].[Level2_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse ) AS [s] ON 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 AND [l1].[PeriodEnd] IS NOT NULL AND [l1].[PeriodStart] IS NOT NULL THEN [l1].[Id] END = [s].[OneToMany_Optional_Inverse3Id] -ORDER BY [l].[Id], [l1].[Id], [s].[Id] +ORDER BY [l].[Id] """); } @@ -2375,7 +2375,7 @@ WHERE [l2].[Level2_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse ) AS [l3] ON 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 AND [l1].[PeriodEnd] IS NOT NULL AND [l1].[PeriodStart] IS NOT NULL THEN [l1].[Id] END = [l3].[OneToMany_Optional_Inverse3Id] -ORDER BY [l1].[Level2_Name], [l].[Id], [l1].[Id] +ORDER BY [l1].[Level2_Name], [l].[Id] """); } @@ -2504,7 +2504,7 @@ public override async Task Project_collection_navigation_nested(bool async) AssertSql( """ -SELECT [l].[Id], [l1].[Id], [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] +SELECT [l].[Id], [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 [l] 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] @@ -2518,7 +2518,7 @@ WHERE [l2].[Level2_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse ) AS [l3] ON 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 AND [l1].[PeriodEnd] IS NOT NULL AND [l1].[PeriodStart] IS NOT NULL THEN [l1].[Id] END = [l3].[OneToMany_Optional_Inverse3Id] -ORDER BY [l].[Id], [l1].[Id] +ORDER BY [l].[Id] """); } @@ -2528,7 +2528,7 @@ public override async Task Project_collection_navigation_nested_anonymous(bool a AssertSql( """ -SELECT [l].[Id], [l1].[Id], [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] +SELECT [l].[Id], [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 [l] 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] @@ -2542,7 +2542,7 @@ WHERE [l2].[Level2_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse ) AS [l3] ON 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 AND [l1].[PeriodEnd] IS NOT NULL AND [l1].[PeriodStart] IS NOT NULL THEN [l1].[Id] END = [l3].[OneToMany_Optional_Inverse3Id] -ORDER BY [l].[Id], [l1].[Id] +ORDER BY [l].[Id] """); } @@ -2552,7 +2552,7 @@ public override async Task Project_collection_navigation_nested_with_take(bool a AssertSql( """ -SELECT [l].[Id], [l1].[Id], [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] +SELECT [l].[Id], [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 [l] 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] @@ -2570,7 +2570,7 @@ WHERE [l2].[Level2_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse ) AS [l4] ON 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 AND [l1].[PeriodEnd] IS NOT NULL AND [l1].[PeriodStart] IS NOT NULL THEN [l1].[Id] END = [l4].[OneToMany_Optional_Inverse3Id] -ORDER BY [l].[Id], [l1].[Id] +ORDER BY [l].[Id] """); } @@ -2580,7 +2580,7 @@ public override async Task Project_collection_navigation_using_ef_property(bool AssertSql( """ -SELECT [l].[Id], [l1].[Id], [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] +SELECT [l].[Id], [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 [l] 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] @@ -2594,7 +2594,7 @@ WHERE [l2].[Level2_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse ) AS [l3] ON 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 AND [l1].[PeriodEnd] IS NOT NULL AND [l1].[PeriodStart] IS NOT NULL THEN [l1].[Id] END = [l3].[OneToMany_Optional_Inverse3Id] -ORDER BY [l].[Id], [l1].[Id] +ORDER BY [l].[Id] """); } @@ -2618,7 +2618,7 @@ WHERE [l2].[Level2_Required_Id] IS NOT NULL AND [l2].[OneToMany_Required_Inverse ) AS [l3] ON 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 AND [l1].[PeriodEnd] IS NOT NULL AND [l1].[PeriodStart] IS NOT NULL THEN [l1].[Id] END = [l3].[OneToMany_Optional_Inverse3Id] -ORDER BY [l].[Id], [l1].[Id] +ORDER BY [l].[Id] """); } @@ -2777,7 +2777,7 @@ WHERE [l4].[Level3_Required_Id] IS NOT NULL AND [l4].[OneToMany_Required_Inverse ) AS [l5] ON CASE WHEN [l3].[Level2_Required_Id] IS NOT NULL AND [l3].[OneToMany_Required_Inverse3Id] IS NOT NULL AND [l3].[PeriodEnd] IS NOT NULL AND [l3].[PeriodStart] IS NOT NULL THEN [l3].[Id] END = [l5].[OneToMany_Optional_Inverse4Id] -ORDER BY [l].[Id], [l1].[Id], [l3].[Id] +ORDER BY [l].[Id], [l1].[Id] """); } @@ -2853,7 +2853,7 @@ public override async Task Select_subquery_single_nested_subquery(bool async) AssertSql( """ -SELECT [l].[Id], [l3].[Id], [l4].[Id], [l4].[Id0], [l3].[c] +SELECT [l].[Id], [l4].[Id], [l4].[Id0], [l3].[c] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l] LEFT JOIN ( SELECT [l2].[c], [l2].[Id], [l2].[OneToOne_Required_PK_Date], [l2].[Level1_Required_Id], [l2].[OneToMany_Required_Inverse2Id], [l2].[PeriodEnd], [l2].[PeriodStart], [l2].[OneToMany_Optional_Inverse2Id] @@ -2875,7 +2875,7 @@ WHERE [l1].[Level2_Required_Id] IS NOT NULL AND [l1].[OneToMany_Required_Inverse ) AS [l4] ON CASE WHEN [l3].[OneToOne_Required_PK_Date] IS NOT NULL AND [l3].[Level1_Required_Id] IS NOT NULL AND [l3].[OneToMany_Required_Inverse2Id] IS NOT NULL THEN [l3].[Id] END = [l4].[OneToMany_Optional_Inverse3Id] -ORDER BY [l].[Id], [l3].[Id], [l4].[Id] +ORDER BY [l].[Id], [l4].[Id] """); } @@ -2885,10 +2885,10 @@ public override async Task Select_subquery_single_nested_subquery2(bool async) AssertSql( """ -SELECT [l].[Id], [s].[Id], [s].[Id0], [s].[Id1], [s].[Id00], [s].[c] +SELECT [l].[Id], [s].[Id], [s].[Id0], [s].[Id00], [s].[c] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l] LEFT JOIN ( - SELECT [l0].[Id], [l4].[Id] AS [Id0], [l5].[Id] AS [Id1], [l5].[Id0] AS [Id00], [l4].[c], CASE + SELECT [l0].[Id], [l5].[Id] AS [Id0], [l5].[Id0] AS [Id00], [l4].[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] END AS [c0], [l0].[OneToMany_Optional_Inverse2Id] FROM [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l0] @@ -2916,7 +2916,7 @@ WHEN [l4].[Level2_Required_Id] IS NOT NULL AND [l4].[OneToMany_Required_Inverse3 END = [l5].[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 ) AS [s] ON [l].[Id] = [s].[OneToMany_Optional_Inverse2Id] -ORDER BY [l].[Id], [s].[c0], [s].[Id], [s].[Id0], [s].[Id1] +ORDER BY [l].[Id], [s].[c0], [s].[Id], [s].[Id0] """); } @@ -3131,7 +3131,7 @@ LEFT JOIN ( WHERE [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 [l3] ON [l2].[Id] = [l3].[Level1_Optional_Id] ) AS [s] -ORDER BY [l4].[Date], [s].[Name], [s].[Id] +ORDER BY [l4].[Date], [s].[Name] """); } @@ -3167,7 +3167,7 @@ OFFSET 1 ROWS FETCH NEXT 3 ROWS ONLY ) AS [l2] INNER JOIN [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l1] ON [l2].[Level1_Required_Id] = [l1].[Id] ) AS [s] -ORDER BY [l3].[Id], [s].[c], [s].[Id1] +ORDER BY [l3].[Id], [s].[c] """); } @@ -3270,7 +3270,7 @@ WHEN [l0].[OneToOne_Required_PK_Date] IS NOT NULL AND [l0].[Level1_Required_Id] ) AS [l2] INNER JOIN [Level1] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l1] ON [l2].[Level1_Required_Id] = [l1].[Id] ) AS [s] -ORDER BY [l3].[Id], [s].[c], [s].[Id1] +ORDER BY [l3].[Id], [s].[c] """); } diff --git a/test/EFCore.SqlServer.FunctionalTests/Query/TemporalGearsOfWarQuerySqlServerTest.cs b/test/EFCore.SqlServer.FunctionalTests/Query/TemporalGearsOfWarQuerySqlServerTest.cs index b2135e79e33..50c6926534d 100644 --- a/test/EFCore.SqlServer.FunctionalTests/Query/TemporalGearsOfWarQuerySqlServerTest.cs +++ b/test/EFCore.SqlServer.FunctionalTests/Query/TemporalGearsOfWarQuerySqlServerTest.cs @@ -240,15 +240,15 @@ public override async Task Accessing_property_of_optional_navigation_in_child_pr SELECT CASE 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], [s].[Nickname], [s].[Id], [s].[SquadId] +END, [t].[Id], [s].[Nickname], [s].[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] LEFT JOIN ( - SELECT [g0].[Nickname], [w].[Id], [g0].[SquadId], [w].[OwnerFullName] + SELECT [g0].[Nickname], [w].[Id], [w].[OwnerFullName] 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 [g0] ON [w].[OwnerFullName] = [g0].[FullName] ) AS [s] ON [g].[FullName] = [s].[OwnerFullName] -ORDER BY [t].[Note], [t].[Id], [g].[Nickname], [g].[SquadId], [s].[Id], [s].[Nickname] +ORDER BY [t].[Note], [t].[Id] """); } @@ -258,14 +258,14 @@ public override async Task Accessing_reference_navigation_collection_composition AssertSql( """ -SELECT [g].[Nickname], [g].[SquadId], [s].[Id], [s].[IsAutomatic], [s].[Name], [s].[Id0] +SELECT [g].[Nickname], [g].[SquadId], [s].[Id], [s].[IsAutomatic], [s].[Name] FROM [Gears] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [g] LEFT JOIN ( - SELECT [w].[Id], [w].[IsAutomatic], [w0].[Name], [w0].[Id] AS [Id0], [w].[OwnerFullName] + SELECT [w].[Id], [w].[IsAutomatic], [w0].[Name], [w].[OwnerFullName] 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 [s] ON [g].[FullName] = [s].[OwnerFullName] -ORDER BY [g].[Nickname], [g].[SquadId], [s].[Id] +ORDER BY [g].[Nickname], [g].[SquadId] """); } @@ -576,11 +576,6 @@ public override async Task Where_subquery_left_join_firstordefault_boolean(bool WHERE [g].[HasSoulPatch] = CAST(1 AS bit) AND ( SELECT TOP(1) [w].[IsAutomatic] FROM [Weapons] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [w] - LEFT JOIN ( - SELECT [w0].[Id] - FROM [Weapons] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [w0] - WHERE [g].[FullName] = [w0].[OwnerFullName] - ) AS [w1] ON [w].[Id] = [w1].[Id] WHERE [g].[FullName] = [w].[OwnerFullName] ORDER BY [w].[Id]) = CAST(1 AS bit) """); @@ -940,13 +935,13 @@ public override async Task Correlated_collections_with_funky_orderby_complex_sce AssertSql( """ -SELECT [g].[FullName], [g].[Nickname], [g].[SquadId], [s1].[FullName], [s1].[Nickname], [s1].[SquadId], [s1].[Id], [s1].[Nickname0], [s1].[SquadId0], [s1].[Id0], [s1].[Nickname00], [s1].[HasSoulPatch], [s1].[SquadId00] +SELECT [g].[FullName], [g].[Nickname], [g].[SquadId], [s1].[FullName], [s1].[Nickname], [s1].[SquadId], [s1].[Id], [s1].[Nickname0], [s1].[HasSoulPatch], [s1].[SquadId0] FROM [Gears] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [g] LEFT JOIN ( - SELECT [g0].[FullName], [g0].[Nickname], [g0].[SquadId], [s0].[Id], [s0].[Nickname] AS [Nickname0], [s0].[SquadId] AS [SquadId0], [s0].[Id0], [s0].[Nickname0] AS [Nickname00], [s0].[HasSoulPatch], [s0].[SquadId0] AS [SquadId00], [g0].[HasSoulPatch] AS [HasSoulPatch0], [s0].[IsAutomatic], [s0].[Name], [g0].[LeaderNickname], [g0].[LeaderSquadId] + SELECT [g0].[FullName], [g0].[Nickname], [g0].[SquadId], [s0].[Id], [s0].[Nickname] AS [Nickname0], [s0].[HasSoulPatch], [s0].[SquadId] AS [SquadId0], [g0].[HasSoulPatch] AS [HasSoulPatch0], [s0].[IsAutomatic], [s0].[Name], [g0].[LeaderNickname], [g0].[LeaderSquadId] FROM [Gears] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [g0] LEFT JOIN ( - SELECT [w].[Id], [g1].[Nickname], [g1].[SquadId], [s].[Id] AS [Id0], [g2].[Nickname] AS [Nickname0], [g2].[HasSoulPatch], [g2].[SquadId] AS [SquadId0], [w].[IsAutomatic], [w].[Name], [w].[OwnerFullName] + SELECT [w].[Id], [g2].[Nickname], [g2].[HasSoulPatch], [g2].[SquadId], [w].[IsAutomatic], [w].[Name], [w].[OwnerFullName] 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 [g1] ON [w].[OwnerFullName] = [g1].[FullName] LEFT JOIN [Squads] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [s] ON [g1].[SquadId] = [s].[Id] @@ -954,7 +949,7 @@ LEFT JOIN ( ) AS [s0] ON [g0].[FullName] = [s0].[OwnerFullName] ) AS [s1] ON [g].[Nickname] = [s1].[LeaderNickname] AND [g].[SquadId] = [s1].[LeaderSquadId] WHERE [g].[Discriminator] = N'Officer' -ORDER BY [g].[HasSoulPatch], [g].[LeaderNickname], [g].[FullName], [g].[Nickname], [g].[SquadId], [s1].[FullName], [s1].[HasSoulPatch0] DESC, [s1].[Nickname], [s1].[SquadId], [s1].[IsAutomatic], [s1].[Name] DESC, [s1].[Id], [s1].[Nickname0], [s1].[SquadId0], [s1].[Id0], [s1].[Nickname00] +ORDER BY [g].[HasSoulPatch], [g].[LeaderNickname], [g].[FullName], [g].[Nickname], [g].[SquadId], [s1].[FullName], [s1].[HasSoulPatch0] DESC, [s1].[Nickname], [s1].[SquadId], [s1].[IsAutomatic], [s1].[Name] DESC, [s1].[Id], [s1].[Nickname0] """); } @@ -986,13 +981,13 @@ public override async Task Correlated_collections_complex_scenario2(bool async) AssertSql( """ -SELECT [g].[FullName], [g].[Nickname], [g].[SquadId], [s1].[FullName], [s1].[Nickname], [s1].[SquadId], [s1].[Id], [s1].[Nickname0], [s1].[SquadId0], [s1].[Id0], [s1].[Nickname00], [s1].[HasSoulPatch], [s1].[SquadId00] +SELECT [g].[FullName], [g].[Nickname], [g].[SquadId], [s1].[FullName], [s1].[Nickname], [s1].[SquadId], [s1].[Id], [s1].[Nickname0], [s1].[HasSoulPatch], [s1].[SquadId0] FROM [Gears] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [g] LEFT JOIN ( - SELECT [g0].[FullName], [g0].[Nickname], [g0].[SquadId], [s0].[Id], [s0].[Nickname] AS [Nickname0], [s0].[SquadId] AS [SquadId0], [s0].[Id0], [s0].[Nickname0] AS [Nickname00], [s0].[HasSoulPatch], [s0].[SquadId0] AS [SquadId00], [g0].[LeaderNickname], [g0].[LeaderSquadId] + SELECT [g0].[FullName], [g0].[Nickname], [g0].[SquadId], [s0].[Id], [s0].[Nickname] AS [Nickname0], [s0].[HasSoulPatch], [s0].[SquadId] AS [SquadId0], [g0].[LeaderNickname], [g0].[LeaderSquadId] FROM [Gears] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [g0] LEFT JOIN ( - SELECT [w].[Id], [g1].[Nickname], [g1].[SquadId], [s].[Id] AS [Id0], [g2].[Nickname] AS [Nickname0], [g2].[HasSoulPatch], [g2].[SquadId] AS [SquadId0], [w].[OwnerFullName] + SELECT [w].[Id], [g2].[Nickname], [g2].[HasSoulPatch], [g2].[SquadId], [w].[OwnerFullName] 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 [g1] ON [w].[OwnerFullName] = [g1].[FullName] LEFT JOIN [Squads] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [s] ON [g1].[SquadId] = [s].[Id] @@ -1000,7 +995,7 @@ LEFT JOIN ( ) AS [s0] ON [g0].[FullName] = [s0].[OwnerFullName] ) AS [s1] ON [g].[Nickname] = [s1].[LeaderNickname] AND [g].[SquadId] = [s1].[LeaderSquadId] WHERE [g].[Discriminator] = N'Officer' -ORDER BY [g].[Nickname], [g].[SquadId], [s1].[Nickname], [s1].[SquadId], [s1].[Id], [s1].[Nickname0], [s1].[SquadId0], [s1].[Id0], [s1].[Nickname00] +ORDER BY [g].[Nickname], [g].[SquadId], [s1].[Nickname], [s1].[SquadId], [s1].[Id], [s1].[Nickname0] """); } @@ -1086,15 +1081,15 @@ public override async Task Outer_parameter_in_join_key(bool async) AssertSql( """ -SELECT [g].[Nickname], [g].[SquadId], [s].[Note], [s].[Id], [s].[Nickname], [s].[SquadId] +SELECT [g].[Nickname], [g].[SquadId], [s].[Note], [s].[Id] FROM [Gears] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [g] OUTER APPLY ( - SELECT [t].[Note], [t].[Id], [g0].[Nickname], [g0].[SquadId] + SELECT [t].[Note], [t].[Id] FROM [Tags] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [t] INNER JOIN [Gears] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [g0] ON [g].[FullName] = [g0].[FullName] ) AS [s] WHERE [g].[Discriminator] = N'Officer' -ORDER BY [g].[Nickname], [g].[SquadId], [s].[Id], [s].[Nickname] +ORDER BY [g].[Nickname], [g].[SquadId] """); } @@ -1320,7 +1315,7 @@ GROUP BY [g].[Rank] LEFT JOIN ( SELECT [s].[Nickname], [s].[SquadId], [s].[AssignedCityName], [s].[CityOfBirthName], [s].[Discriminator], [s].[FullName], [s].[HasSoulPatch], [s].[LeaderNickname], [s].[LeaderSquadId], [s].[PeriodEnd], [s].[PeriodStart], [s].[Rank], [s].[Name], [s].[Location], [s].[Nation], [s].[PeriodEnd0], [s].[PeriodStart0] FROM ( - 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], ROW_NUMBER() OVER(PARTITION BY [g0].[Rank] ORDER BY [g0].[Nickname], [g0].[SquadId], [c].[Name]) AS [row] + 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], ROW_NUMBER() OVER(PARTITION BY [g0].[Rank] ORDER BY [g0].[Nickname], [g0].[SquadId]) AS [row] 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] WHERE [g0].[HasSoulPatch] = CAST(1 AS bit) @@ -1790,7 +1785,7 @@ public override async Task Include_base_navigation_on_derived_entity(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 [Weapons] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [w] ON [g].[FullName] = [w].[OwnerFullName] -ORDER BY [g].[Nickname], [g].[SquadId], [t].[Id] +ORDER BY [g].[Nickname], [g].[SquadId] """); } @@ -1940,12 +1935,12 @@ public override async Task Project_collection_navigation_nested_composite_key(bo AssertSql( """ -SELECT [t].[Id], [g].[Nickname], [g].[SquadId], [g0].[Nickname], [g0].[SquadId], [g0].[AssignedCityName], [g0].[CityOfBirthName], [g0].[Discriminator], [g0].[FullName], [g0].[HasSoulPatch], [g0].[LeaderNickname], [g0].[LeaderSquadId], [g0].[PeriodEnd], [g0].[PeriodStart], [g0].[Rank] +SELECT [t].[Id], [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] WHERE [g].[Discriminator] = N'Officer' -ORDER BY [t].[Id], [g].[Nickname], [g].[SquadId], [g0].[Nickname] +ORDER BY [t].[Id], [g0].[Nickname] """); } @@ -1960,7 +1955,7 @@ public override async Task Cast_to_derived_followed_by_multiple_includes(bool as 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 [Weapons] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [w] ON [g].[FullName] = [w].[OwnerFullName] WHERE [l].[Name] LIKE N'%Queen%' -ORDER BY [l].[Name], [g].[Nickname], [g].[SquadId] +ORDER BY [l].[Name] """); } @@ -2264,10 +2259,10 @@ public override async Task Correlated_collections_nested(bool async) AssertSql( """ -SELECT [s].[Id], [s3].[SquadId], [s3].[MissionId], [s3].[Id], [s3].[SquadId0], [s3].[MissionId0], [s3].[PeriodEnd], [s3].[PeriodStart] +SELECT [s].[Id], [s3].[SquadId], [s3].[MissionId], [s3].[SquadId0], [s3].[MissionId0], [s3].[PeriodEnd], [s3].[PeriodStart] FROM [Squads] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [s] LEFT JOIN ( - SELECT [s0].[SquadId], [s0].[MissionId], [m].[Id], [s2].[SquadId] AS [SquadId0], [s2].[MissionId] AS [MissionId0], [s2].[PeriodEnd], [s2].[PeriodStart] + SELECT [s0].[SquadId], [s0].[MissionId], [s2].[SquadId] AS [SquadId0], [s2].[MissionId] AS [MissionId0], [s2].[PeriodEnd], [s2].[PeriodStart] FROM [SquadMissions] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [s0] INNER JOIN [Missions] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [m] ON [s0].[MissionId] = [m].[Id] LEFT JOIN ( @@ -2277,7 +2272,7 @@ WHERE [s1].[SquadId] < 7 ) AS [s2] ON [m].[Id] = [s2].[MissionId] WHERE [s0].[MissionId] < 42 ) AS [s3] ON [s].[Id] = [s3].[SquadId] -ORDER BY [s].[Id], [s3].[SquadId], [s3].[MissionId], [s3].[Id], [s3].[SquadId0] +ORDER BY [s].[Id], [s3].[SquadId], [s3].[MissionId], [s3].[SquadId0] """); } @@ -2505,7 +2500,7 @@ LEFT JOIN ( WHERE [l].[Discriminator] = N'LocustCommander' ) AS [l0] ON [f].[CommanderName] = [l0].[Name] LEFT JOIN [LocustLeaders] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l1] ON [f].[Id] = [l1].[LocustHordeId] -ORDER BY [f].[Name], [f].[Id], [l0].[Name] +ORDER BY [f].[Name], [f].[Id] """); } @@ -2941,7 +2936,6 @@ public override async Task Left_join_with_GroupBy_with_composite_group_key(bool """ SELECT [g].[CityOfBirthName], [g].[HasSoulPatch] FROM [Gears] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [g] -INNER JOIN [Squads] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [s] ON [g].[SquadId] = [s].[Id] LEFT JOIN [Tags] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [t] ON [g].[Nickname] = [t].[GearNickName] GROUP BY [g].[CityOfBirthName], [g].[HasSoulPatch] """); @@ -3012,15 +3006,15 @@ public override async Task Correlated_collections_multiple_nested_complex_collec AssertSql( """ -SELECT [g].[FullName], [g].[Nickname], [g].[SquadId], [t].[Id], [g1].[Nickname], [g1].[SquadId], [s1].[FullName], [s1].[Nickname], [s1].[SquadId], [s1].[Id], [s1].[Nickname0], [s1].[SquadId0], [s1].[Id0], [s1].[Name], [s1].[IsAutomatic], [s1].[Id1], [s1].[Nickname00], [s1].[HasSoulPatch], [s1].[SquadId00], [s2].[Id], [s2].[AmmunitionType], [s2].[IsAutomatic], [s2].[Name], [s2].[OwnerFullName], [s2].[PeriodEnd], [s2].[PeriodStart], [s2].[SynergyWithId], [s2].[Nickname], [s2].[SquadId] +SELECT [g].[FullName], [g].[Nickname], [g].[SquadId], [s1].[FullName], [s1].[Nickname], [s1].[SquadId], [s1].[Id], [s1].[Name], [s1].[IsAutomatic], [s1].[Id0], [s1].[Nickname0], [s1].[HasSoulPatch], [s1].[SquadId0], [s2].[Id], [s2].[AmmunitionType], [s2].[IsAutomatic], [s2].[Name], [s2].[OwnerFullName], [s2].[PeriodEnd], [s2].[PeriodStart], [s2].[SynergyWithId] 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 [Gears] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [g1] ON [t].[GearNickName] = [g1].[Nickname] AND [t].[GearSquadId] = [g1].[SquadId] LEFT JOIN ( - SELECT [g2].[FullName], [g2].[Nickname], [g2].[SquadId], [s0].[Id], [s0].[Nickname] AS [Nickname0], [s0].[SquadId] AS [SquadId0], [s0].[Id0], [s0].[Name], [s0].[IsAutomatic], [s0].[Id1], [s0].[Nickname0] AS [Nickname00], [s0].[HasSoulPatch], [s0].[SquadId0] AS [SquadId00], [g2].[Rank], [s0].[IsAutomatic0], [g2].[LeaderNickname], [g2].[LeaderSquadId] + SELECT [g2].[FullName], [g2].[Nickname], [g2].[SquadId], [s0].[Id], [s0].[Name], [s0].[IsAutomatic], [s0].[Id0], [s0].[Nickname] AS [Nickname0], [s0].[HasSoulPatch], [s0].[SquadId] AS [SquadId0], [g2].[Rank], [s0].[IsAutomatic0], [g2].[LeaderNickname], [g2].[LeaderSquadId] FROM [Gears] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [g2] LEFT JOIN ( - SELECT [w].[Id], [g3].[Nickname], [g3].[SquadId], [s].[Id] AS [Id0], [w0].[Name], [w0].[IsAutomatic], [w0].[Id] AS [Id1], [g4].[Nickname] AS [Nickname0], [g4].[HasSoulPatch], [g4].[SquadId] AS [SquadId0], [w].[IsAutomatic] AS [IsAutomatic0], [w].[OwnerFullName] + SELECT [w].[Id], [w0].[Name], [w0].[IsAutomatic], [w0].[Id] AS [Id0], [g4].[Nickname], [g4].[HasSoulPatch], [g4].[SquadId], [w].[IsAutomatic] AS [IsAutomatic0], [w].[OwnerFullName] 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 [g3] ON [w].[OwnerFullName] = [g3].[FullName] LEFT JOIN [Squads] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [s] ON [g3].[SquadId] = [s].[Id] @@ -3031,7 +3025,7 @@ WHERE [w].[Name] <> N'Bar' OR [w].[Name] IS NULL WHERE [g2].[FullName] <> N'Foo' ) AS [s1] ON [g].[Nickname] = [s1].[LeaderNickname] AND [g].[SquadId] = [s1].[LeaderSquadId] LEFT JOIN ( - SELECT [w1].[Id], [w1].[AmmunitionType], [w1].[IsAutomatic], [w1].[Name], [w1].[OwnerFullName], [w1].[PeriodEnd], [w1].[PeriodStart], [w1].[SynergyWithId], [g5].[Nickname], [g5].[SquadId] + SELECT [w1].[Id], [w1].[AmmunitionType], [w1].[IsAutomatic], [w1].[Name], [w1].[OwnerFullName], [w1].[PeriodEnd], [w1].[PeriodStart], [w1].[SynergyWithId], [g5].[Nickname] FROM [Weapons] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [w1] LEFT JOIN [Gears] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [g5] ON [w1].[OwnerFullName] = [g5].[FullName] ) AS [s2] ON [g1].[FullName] = [s2].[OwnerFullName] @@ -3039,7 +3033,7 @@ LEFT JOIN ( SELECT 1 FROM [Gears] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [g0] WHERE [g].[Nickname] = [g0].[LeaderNickname] AND [g].[SquadId] = [g0].[LeaderSquadId]) -ORDER BY [g].[HasSoulPatch] DESC, [t].[Note], [g].[Nickname], [g].[SquadId], [t].[Id], [g1].[Nickname], [g1].[SquadId], [s1].[Rank], [s1].[Nickname], [s1].[SquadId], [s1].[IsAutomatic0], [s1].[Id], [s1].[Nickname0], [s1].[SquadId0], [s1].[Id0], [s1].[Id1], [s1].[Nickname00], [s1].[SquadId00], [s2].[IsAutomatic], [s2].[Nickname] DESC, [s2].[Id] +ORDER BY [g].[HasSoulPatch] DESC, [t].[Note], [g].[Nickname], [g].[SquadId], [s1].[Rank], [s1].[Nickname], [s1].[SquadId], [s1].[IsAutomatic0], [s1].[Id], [s1].[Id0], [s1].[Nickname0], [s1].[SquadId0], [s2].[IsAutomatic], [s2].[Nickname] DESC """); } @@ -3372,7 +3366,7 @@ public override async Task Project_collection_navigation_nested_with_take_compos AssertSql( """ -SELECT [t].[Id], [g].[Nickname], [g].[SquadId], [g2].[Nickname], [g2].[SquadId], [g2].[AssignedCityName], [g2].[CityOfBirthName], [g2].[Discriminator], [g2].[FullName], [g2].[HasSoulPatch], [g2].[LeaderNickname], [g2].[LeaderSquadId], [g2].[PeriodEnd], [g2].[PeriodStart], [g2].[Rank] +SELECT [t].[Id], [g2].[Nickname], [g2].[SquadId], [g2].[AssignedCityName], [g2].[CityOfBirthName], [g2].[Discriminator], [g2].[FullName], [g2].[HasSoulPatch], [g2].[LeaderNickname], [g2].[LeaderSquadId], [g2].[PeriodEnd], [g2].[PeriodStart], [g2].[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 ( @@ -3384,7 +3378,7 @@ LEFT JOIN ( WHERE [g1].[row] <= 50 ) AS [g2] ON ([g].[Nickname] = [g2].[LeaderNickname] OR ([g].[Nickname] IS NULL AND [g2].[LeaderNickname] IS NULL)) AND [g].[SquadId] = [g2].[LeaderSquadId] WHERE [g].[Discriminator] = N'Officer' -ORDER BY [t].[Id], [g].[Nickname], [g].[SquadId], [g2].[Nickname] +ORDER BY [t].[Id], [g2].[Nickname] """); } @@ -3688,16 +3682,16 @@ public override async Task Correlated_collections_with_funky_orderby_complex_sce AssertSql( """ -SELECT [g].[FullName], [g].[Nickname], [g].[SquadId], [s0].[Id], [s0].[Nickname], [s0].[SquadId], [s0].[Id0], [s0].[Nickname0], [s0].[HasSoulPatch], [s0].[SquadId0] +SELECT [g].[FullName], [g].[Nickname], [g].[SquadId], [s0].[Id], [s0].[Nickname], [s0].[HasSoulPatch], [s0].[SquadId] FROM [Gears] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [g] LEFT JOIN ( - SELECT [w].[Id], [g0].[Nickname], [g0].[SquadId], [s].[Id] AS [Id0], [g1].[Nickname] AS [Nickname0], [g1].[HasSoulPatch], [g1].[SquadId] AS [SquadId0], [w].[OwnerFullName] + SELECT [w].[Id], [g1].[Nickname], [g1].[HasSoulPatch], [g1].[SquadId], [w].[OwnerFullName] 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 [g0] ON [w].[OwnerFullName] = [g0].[FullName] LEFT JOIN [Squads] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [s] ON [g0].[SquadId] = [s].[Id] LEFT JOIN [Gears] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [g1] ON [s].[Id] = [g1].[SquadId] ) AS [s0] ON [g].[FullName] = [s0].[OwnerFullName] -ORDER BY [g].[FullName], [g].[Nickname] DESC, [g].[SquadId], [s0].[Id], [s0].[Nickname], [s0].[SquadId], [s0].[Id0], [s0].[Nickname0] +ORDER BY [g].[FullName], [g].[Nickname] DESC, [g].[SquadId], [s0].[Id], [s0].[Nickname] """); } @@ -3785,12 +3779,12 @@ public override async Task Multiple_orderby_with_navigation_expansion_on_one_of_ AssertSql( """ -SELECT [g].[FullName], [g].[Nickname], [g].[SquadId], [t].[Id], [g1].[Nickname], [g1].[SquadId], [s].[Id], [s].[AmmunitionType], [s].[IsAutomatic], [s].[Name], [s].[OwnerFullName], [s].[PeriodEnd], [s].[PeriodStart], [s].[SynergyWithId], [s].[Nickname], [s].[SquadId] +SELECT [g].[FullName], [g].[Nickname], [g].[SquadId], [s].[Id], [s].[AmmunitionType], [s].[IsAutomatic], [s].[Name], [s].[OwnerFullName], [s].[PeriodEnd], [s].[PeriodStart], [s].[SynergyWithId] 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 [Gears] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [g1] ON [t].[GearNickName] = [g1].[Nickname] AND [t].[GearSquadId] = [g1].[SquadId] LEFT JOIN ( - SELECT [w].[Id], [w].[AmmunitionType], [w].[IsAutomatic], [w].[Name], [w].[OwnerFullName], [w].[PeriodEnd], [w].[PeriodStart], [w].[SynergyWithId], [g2].[Nickname], [g2].[SquadId] + SELECT [w].[Id], [w].[AmmunitionType], [w].[IsAutomatic], [w].[Name], [w].[OwnerFullName], [w].[PeriodEnd], [w].[PeriodStart], [w].[SynergyWithId], [g2].[Nickname] 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 [s] ON [g1].[FullName] = [s].[OwnerFullName] @@ -3798,7 +3792,7 @@ LEFT JOIN ( SELECT 1 FROM [Gears] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [g0] WHERE [g].[Nickname] = [g0].[LeaderNickname] AND [g].[SquadId] = [g0].[LeaderSquadId]) -ORDER BY [g].[HasSoulPatch] DESC, [t].[Note], [g].[Nickname], [g].[SquadId], [t].[Id], [g1].[Nickname], [g1].[SquadId], [s].[IsAutomatic], [s].[Nickname] DESC, [s].[Id] +ORDER BY [g].[HasSoulPatch] DESC, [t].[Note], [g].[Nickname], [g].[SquadId], [s].[IsAutomatic], [s].[Nickname] DESC """); } @@ -3871,7 +3865,7 @@ public override async Task Correlated_collection_take(bool async) AssertSql( """ -SELECT [g].[Nickname], [g].[SquadId], [c].[Name], [w1].[Id], [w1].[AmmunitionType], [w1].[IsAutomatic], [w1].[Name], [w1].[OwnerFullName], [w1].[PeriodEnd], [w1].[PeriodStart], [w1].[SynergyWithId], [c].[Location], [c].[Nation], [c].[PeriodEnd], [c].[PeriodStart] +SELECT [g].[Nickname], [g].[SquadId], [w1].[Id], [w1].[AmmunitionType], [w1].[IsAutomatic], [w1].[Name], [w1].[OwnerFullName], [w1].[PeriodEnd], [w1].[PeriodStart], [w1].[SynergyWithId], [c].[Name], [c].[Location], [c].[Nation], [c].[PeriodEnd], [c].[PeriodStart] 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 [c] ON [g].[CityOfBirthName] = [c].[Name] LEFT JOIN ( @@ -3882,7 +3876,7 @@ LEFT JOIN ( ) AS [w0] WHERE [w0].[row] <= 10 ) AS [w1] ON [g].[FullName] = [w1].[OwnerFullName] -ORDER BY [g].[Nickname], [g].[SquadId], [c].[Name] +ORDER BY [g].[Nickname], [g].[SquadId] """); } @@ -3923,12 +3917,12 @@ public override async Task Multiple_orderby_with_navigation_expansion_on_one_of_ AssertSql( """ -SELECT [g].[FullName], [g].[Nickname], [g].[SquadId], [t].[Id], [g1].[Nickname], [g1].[SquadId], [s].[Id], [s].[AmmunitionType], [s].[IsAutomatic], [s].[Name], [s].[OwnerFullName], [s].[PeriodEnd], [s].[PeriodStart], [s].[SynergyWithId], [s].[Nickname], [s].[SquadId] +SELECT [g].[FullName], [g].[Nickname], [g].[SquadId], [s].[Id], [s].[AmmunitionType], [s].[IsAutomatic], [s].[Name], [s].[OwnerFullName], [s].[PeriodEnd], [s].[PeriodStart], [s].[SynergyWithId] 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 [Gears] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [g1] ON [t].[GearNickName] = [g1].[Nickname] AND [t].[GearSquadId] = [g1].[SquadId] LEFT JOIN ( - SELECT [w].[Id], [w].[AmmunitionType], [w].[IsAutomatic], [w].[Name], [w].[OwnerFullName], [w].[PeriodEnd], [w].[PeriodStart], [w].[SynergyWithId], [g2].[Nickname], [g2].[SquadId], ( + SELECT [w].[Id], [w].[AmmunitionType], [w].[IsAutomatic], [w].[Name], [w].[OwnerFullName], [w].[PeriodEnd], [w].[PeriodStart], [w].[SynergyWithId], ( 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] @@ -3939,7 +3933,7 @@ SELECT COUNT(*) SELECT 1 FROM [Gears] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [g0] WHERE [g].[Nickname] = [g0].[LeaderNickname] AND [g].[SquadId] = [g0].[LeaderSquadId]) -ORDER BY [g].[HasSoulPatch] DESC, [t].[Note], [g].[Nickname], [g].[SquadId], [t].[Id], [g1].[Nickname], [g1].[SquadId], [s].[Id] DESC, [s].[c], [s].[Nickname] +ORDER BY [g].[HasSoulPatch] DESC, [t].[Note], [g].[Nickname], [g].[SquadId], [s].[Id] DESC, [s].[c] """); } @@ -3957,7 +3951,7 @@ LEFT JOIN ( 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 [s] ON ([g].[Nickname] = [s].[LeaderNickname] OR ([g].[Nickname] IS NULL AND [s].[LeaderNickname] IS NULL)) AND [g].[SquadId] = [s].[LeaderSquadId] -ORDER BY [l].[Name], [g].[Nickname], [g].[SquadId], [s].[Nickname], [s].[SquadId] +ORDER BY [l].[Name], [s].[Nickname] """); } @@ -4707,16 +4701,16 @@ public override async Task Correlated_collections_complex_scenario1(bool async) AssertSql( """ -SELECT [g].[FullName], [g].[Nickname], [g].[SquadId], [s0].[Id], [s0].[Nickname], [s0].[SquadId], [s0].[Id0], [s0].[Nickname0], [s0].[HasSoulPatch], [s0].[SquadId0] +SELECT [g].[FullName], [g].[Nickname], [g].[SquadId], [s0].[Id], [s0].[Nickname], [s0].[HasSoulPatch], [s0].[SquadId] FROM [Gears] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [g] LEFT JOIN ( - SELECT [w].[Id], [g0].[Nickname], [g0].[SquadId], [s].[Id] AS [Id0], [g1].[Nickname] AS [Nickname0], [g1].[HasSoulPatch], [g1].[SquadId] AS [SquadId0], [w].[OwnerFullName] + SELECT [w].[Id], [g1].[Nickname], [g1].[HasSoulPatch], [g1].[SquadId], [w].[OwnerFullName] 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 [g0] ON [w].[OwnerFullName] = [g0].[FullName] LEFT JOIN [Squads] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [s] ON [g0].[SquadId] = [s].[Id] LEFT JOIN [Gears] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [g1] ON [s].[Id] = [g1].[SquadId] ) AS [s0] ON [g].[FullName] = [s0].[OwnerFullName] -ORDER BY [g].[Nickname], [g].[SquadId], [s0].[Id], [s0].[Nickname], [s0].[SquadId], [s0].[Id0], [s0].[Nickname0] +ORDER BY [g].[Nickname], [g].[SquadId], [s0].[Id], [s0].[Nickname] """); } @@ -4832,7 +4826,7 @@ LEFT JOIN ( ) AS [l0] ON [f].[CommanderName] = [l0].[Name] LEFT JOIN [Gears] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [g] ON [l0].[DefeatedByNickname] = [g].[Nickname] AND [l0].[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] -ORDER BY [f].[Id], [l0].[Name], [g].[Nickname], [g].[SquadId], [g0].[Nickname] +ORDER BY [f].[Id], [g0].[Nickname] """); } @@ -4843,12 +4837,12 @@ public override async Task Multiple_orderby_with_navigation_expansion_on_one_of_ AssertSql( """ -SELECT [g].[FullName], [g].[Nickname], [g].[SquadId], [t].[Id], [g1].[Nickname], [g1].[SquadId], [s].[Id], [s].[AmmunitionType], [s].[IsAutomatic], [s].[Name], [s].[OwnerFullName], [s].[PeriodEnd], [s].[PeriodStart], [s].[SynergyWithId], [s].[Nickname], [s].[SquadId] +SELECT [g].[FullName], [g].[Nickname], [g].[SquadId], [s].[Id], [s].[AmmunitionType], [s].[IsAutomatic], [s].[Name], [s].[OwnerFullName], [s].[PeriodEnd], [s].[PeriodStart], [s].[SynergyWithId] 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 [Gears] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [g1] ON [t].[GearNickName] = [g1].[Nickname] AND [t].[GearSquadId] = [g1].[SquadId] LEFT JOIN ( - SELECT [w].[Id], [w].[AmmunitionType], [w].[IsAutomatic], [w].[Name], [w].[OwnerFullName], [w].[PeriodEnd], [w].[PeriodStart], [w].[SynergyWithId], [g2].[Nickname], [g2].[SquadId] + SELECT [w].[Id], [w].[AmmunitionType], [w].[IsAutomatic], [w].[Name], [w].[OwnerFullName], [w].[PeriodEnd], [w].[PeriodStart], [w].[SynergyWithId], [g2].[Nickname] 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 [s] ON [g1].[FullName] = [s].[OwnerFullName] @@ -4856,7 +4850,7 @@ LEFT JOIN ( SELECT 1 FROM [Gears] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [g0] WHERE [g].[Nickname] = [g0].[LeaderNickname] AND [g].[SquadId] = [g0].[LeaderSquadId]) -ORDER BY [g].[HasSoulPatch] DESC, [t].[Note], [g].[Nickname], [g].[SquadId], [t].[Id], [g1].[Nickname], [g1].[SquadId], [s].[IsAutomatic], [s].[Nickname] DESC, [s].[Id] +ORDER BY [g].[HasSoulPatch] DESC, [t].[Note], [g].[Nickname], [g].[SquadId], [s].[IsAutomatic], [s].[Nickname] DESC """); } @@ -5074,7 +5068,7 @@ LEFT JOIN ( ) AS [l0] ON [f].[CommanderName] = [l0].[Name] LEFT JOIN [Gears] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [g] ON [l0].[DefeatedByNickname] = [g].[Nickname] AND [l0].[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] -ORDER BY [f].[Id], [l0].[Name], [g].[Nickname], [g].[SquadId], [g0].[Nickname] +ORDER BY [f].[Id], [g0].[Nickname] """); } @@ -5245,7 +5239,7 @@ LEFT JOIN ( ) AS [w1] WHERE [w1].[row] <= 1 ) AS [w2] ON [g].[FullName] = [w2].[OwnerFullName] -ORDER BY [g].[Nickname], [g].[SquadId], [s].[Id] +ORDER BY [g].[Nickname], [g].[SquadId] """); } @@ -5465,10 +5459,10 @@ public override async Task Correlated_collections_nested_mixed_streaming_with_bu AssertSql( """ -SELECT [s].[Id], [s3].[SquadId], [s3].[MissionId], [s3].[Id], [s3].[SquadId0], [s3].[MissionId0], [s3].[PeriodEnd], [s3].[PeriodStart] +SELECT [s].[Id], [s3].[SquadId], [s3].[MissionId], [s3].[SquadId0], [s3].[MissionId0], [s3].[PeriodEnd], [s3].[PeriodStart] FROM [Squads] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [s] LEFT JOIN ( - SELECT [s0].[SquadId], [s0].[MissionId], [m].[Id], [s2].[SquadId] AS [SquadId0], [s2].[MissionId] AS [MissionId0], [s2].[PeriodEnd], [s2].[PeriodStart] + SELECT [s0].[SquadId], [s0].[MissionId], [s2].[SquadId] AS [SquadId0], [s2].[MissionId] AS [MissionId0], [s2].[PeriodEnd], [s2].[PeriodStart] FROM [SquadMissions] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [s0] INNER JOIN [Missions] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [m] ON [s0].[MissionId] = [m].[Id] LEFT JOIN ( @@ -5478,7 +5472,7 @@ WHERE [s1].[SquadId] < 2 ) AS [s2] ON [m].[Id] = [s2].[MissionId] WHERE [s0].[MissionId] < 3 ) AS [s3] ON [s].[Id] = [s3].[SquadId] -ORDER BY [s].[Id], [s3].[SquadId], [s3].[MissionId], [s3].[Id], [s3].[SquadId0] +ORDER BY [s].[Id], [s3].[SquadId], [s3].[MissionId], [s3].[SquadId0] """); } @@ -5557,10 +5551,10 @@ public override async Task Correlated_collections_nested_mixed_streaming_with_bu AssertSql( """ -SELECT [s].[Id], [s3].[SquadId], [s3].[MissionId], [s3].[Id], [s3].[SquadId0], [s3].[MissionId0], [s3].[PeriodEnd], [s3].[PeriodStart] +SELECT [s].[Id], [s3].[SquadId], [s3].[MissionId], [s3].[SquadId0], [s3].[MissionId0], [s3].[PeriodEnd], [s3].[PeriodStart] FROM [Squads] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [s] LEFT JOIN ( - SELECT [s0].[SquadId], [s0].[MissionId], [m].[Id], [s2].[SquadId] AS [SquadId0], [s2].[MissionId] AS [MissionId0], [s2].[PeriodEnd], [s2].[PeriodStart] + SELECT [s0].[SquadId], [s0].[MissionId], [s2].[SquadId] AS [SquadId0], [s2].[MissionId] AS [MissionId0], [s2].[PeriodEnd], [s2].[PeriodStart] FROM [SquadMissions] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [s0] INNER JOIN [Missions] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [m] ON [s0].[MissionId] = [m].[Id] LEFT JOIN ( @@ -5570,7 +5564,7 @@ WHERE [s1].[SquadId] < 7 ) AS [s2] ON [m].[Id] = [s2].[MissionId] WHERE [s0].[MissionId] < 42 ) AS [s3] ON [s].[Id] = [s3].[SquadId] -ORDER BY [s].[Id], [s3].[SquadId], [s3].[MissionId], [s3].[Id], [s3].[SquadId0] +ORDER BY [s].[Id], [s3].[SquadId], [s3].[MissionId], [s3].[SquadId0] """); } @@ -5987,16 +5981,16 @@ public override async Task Include_on_derived_type_with_order_by_and_paging(bool """ @p='10' -SELECT [s].[Name], [s].[Discriminator], [s].[LocustHordeId], [s].[PeriodEnd], [s].[PeriodStart], [s].[ThreatLevel], [s].[ThreatLevelByte], [s].[ThreatLevelNullableByte], [s].[DefeatedByNickname], [s].[DefeatedBySquadId], [s].[HighCommandId], [s].[Nickname], [s].[SquadId], [s].[AssignedCityName], [s].[CityOfBirthName], [s].[Discriminator0], [s].[FullName], [s].[HasSoulPatch], [s].[LeaderNickname], [s].[LeaderSquadId], [s].[PeriodEnd0], [s].[PeriodStart0], [s].[Rank], [s].[Id], [w].[Id], [w].[AmmunitionType], [w].[IsAutomatic], [w].[Name], [w].[OwnerFullName], [w].[PeriodEnd], [w].[PeriodStart], [w].[SynergyWithId] +SELECT [s].[Name], [s].[Discriminator], [s].[LocustHordeId], [s].[PeriodEnd], [s].[PeriodStart], [s].[ThreatLevel], [s].[ThreatLevelByte], [s].[ThreatLevelNullableByte], [s].[DefeatedByNickname], [s].[DefeatedBySquadId], [s].[HighCommandId], [s].[Nickname], [s].[SquadId], [s].[AssignedCityName], [s].[CityOfBirthName], [s].[Discriminator0], [s].[FullName], [s].[HasSoulPatch], [s].[LeaderNickname], [s].[LeaderSquadId], [s].[PeriodEnd0], [s].[PeriodStart0], [s].[Rank], [w].[Id], [w].[AmmunitionType], [w].[IsAutomatic], [w].[Name], [w].[OwnerFullName], [w].[PeriodEnd], [w].[PeriodStart], [w].[SynergyWithId] FROM ( - SELECT TOP(@p) [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] + SELECT TOP(@p) [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].[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)) ORDER BY [t].[Note] ) AS [s] LEFT JOIN [Weapons] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [w] ON [s].[FullName] = [w].[OwnerFullName] -ORDER BY [s].[Note], [s].[Name], [s].[Nickname], [s].[SquadId], [s].[Id] +ORDER BY [s].[Note], [s].[Name] """); } @@ -6124,7 +6118,7 @@ public override async Task Correlated_collections_deeply_nested_left_join(bool a AssertSql( """ -SELECT [t].[Id], [g].[Nickname], [g].[SquadId], [s].[Id], [s0].[Nickname], [s0].[SquadId], [s0].[Id], [s0].[AmmunitionType], [s0].[IsAutomatic], [s0].[Name], [s0].[OwnerFullName], [s0].[PeriodEnd], [s0].[PeriodStart], [s0].[SynergyWithId] +SELECT [t].[Id], [g].[Nickname], [g].[SquadId], [s0].[Nickname], [s0].[SquadId], [s0].[Id], [s0].[AmmunitionType], [s0].[IsAutomatic], [s0].[Name], [s0].[OwnerFullName], [s0].[PeriodEnd], [s0].[PeriodStart], [s0].[SynergyWithId] 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] LEFT JOIN [Squads] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [s] ON [g].[SquadId] = [s].[Id] @@ -6138,7 +6132,7 @@ LEFT JOIN ( ) AS [w0] ON [g0].[FullName] = [w0].[OwnerFullName] WHERE [g0].[HasSoulPatch] = CAST(1 AS bit) ) AS [s0] ON [s].[Id] = [s0].[SquadId] -ORDER BY [t].[Note], [g].[Nickname] DESC, [t].[Id], [g].[SquadId], [s].[Id], [s0].[Nickname], [s0].[SquadId] +ORDER BY [t].[Note], [g].[Nickname] DESC, [t].[Id], [g].[SquadId], [s0].[Nickname], [s0].[SquadId] """); } @@ -6329,7 +6323,7 @@ public override async Task ThenInclude_collection_on_derived_after_base_referenc 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 [Weapons] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [w] ON [g].[FullName] = [w].[OwnerFullName] -ORDER BY [t].[Id], [g].[Nickname], [g].[SquadId] +ORDER BY [t].[Id] """); } @@ -6415,7 +6409,7 @@ LEFT JOIN ( 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] ) AS [s] ON [f].[Id] = [s].[LocustHordeId] -ORDER BY [f].[Id], [s].[Name], [s].[Nickname] +ORDER BY [f].[Id] """); } @@ -6595,15 +6589,14 @@ public override async Task Outer_parameter_in_group_join_with_DefaultIfEmpty(boo AssertSql( """ -SELECT [g].[Nickname], [g].[SquadId], [s].[Note], [s].[Id], [s].[Nickname], [s].[SquadId] +SELECT [g].[Nickname], [g].[SquadId], [s].[Note], [s].[Id] FROM [Gears] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [g] OUTER APPLY ( - SELECT [t].[Note], [t].[Id], [g0].[Nickname], [g0].[SquadId] + SELECT [t].[Note], [t].[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 [g0] ON [g].[FullName] = [g0].[FullName] ) AS [s] WHERE [g].[Discriminator] = N'Officer' -ORDER BY [g].[Nickname], [g].[SquadId], [s].[Id], [s].[Nickname] +ORDER BY [g].[Nickname], [g].[SquadId] """); } @@ -6613,7 +6606,7 @@ public override async Task Project_collection_navigation_with_inheritance2(bool AssertSql( """ -SELECT [f].[Id], [l0].[Name], [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] +SELECT [f].[Id], [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 [Factions] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [f] LEFT JOIN ( SELECT [l].[Name], [l].[DefeatedByNickname], [l].[DefeatedBySquadId] @@ -6622,7 +6615,7 @@ LEFT JOIN ( ) AS [l0] ON [f].[CommanderName] = [l0].[Name] LEFT JOIN [Gears] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [g] ON [l0].[DefeatedByNickname] = [g].[Nickname] AND [l0].[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] -ORDER BY [f].[Id], [l0].[Name], [g].[Nickname], [g].[SquadId], [g0].[Nickname] +ORDER BY [f].[Id], [g0].[Nickname] """); } @@ -6842,7 +6835,7 @@ public override async Task Correlated_collections_from_left_join_with_additional AssertSql( """ -SELECT [w].[Id], [g].[Nickname], [g].[SquadId], [s].[Id], [s0].[Nickname], [s0].[SquadId], [s0].[Id], [s0].[AmmunitionType], [s0].[IsAutomatic], [s0].[Name], [s0].[OwnerFullName], [s0].[PeriodEnd], [s0].[PeriodStart], [s0].[SynergyWithId], [s0].[Rank] +SELECT [w].[Id], [s0].[Nickname], [s0].[SquadId], [s0].[Id], [s0].[AmmunitionType], [s0].[IsAutomatic], [s0].[Name], [s0].[OwnerFullName], [s0].[PeriodEnd], [s0].[PeriodStart], [s0].[SynergyWithId], [s0].[Rank] 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 [Squads] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [s] ON [g].[SquadId] = [s].[Id] @@ -6855,7 +6848,7 @@ LEFT JOIN ( WHERE [w0].[IsAutomatic] = CAST(0 AS bit) ) AS [w1] ON [g0].[FullName] = [w1].[OwnerFullName] ) AS [s0] ON [s].[Id] = [s0].[SquadId] -ORDER BY [w].[Name], [w].[Id], [g].[Nickname], [g].[SquadId], [s].[Id], [s0].[FullName] DESC, [s0].[Nickname], [s0].[SquadId], [s0].[Id] +ORDER BY [w].[Name], [w].[Id], [s0].[FullName] DESC, [s0].[Nickname], [s0].[SquadId], [s0].[Id] """); } @@ -6865,7 +6858,7 @@ public override async Task Project_collection_navigation_with_inheritance3(bool AssertSql( """ -SELECT [f].[Id], [l0].[Name], [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] +SELECT [f].[Id], [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 [Factions] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [f] LEFT JOIN ( SELECT [l].[Name], [l].[DefeatedByNickname], [l].[DefeatedBySquadId] @@ -6874,7 +6867,7 @@ LEFT JOIN ( ) AS [l0] ON [f].[CommanderName] = [l0].[Name] LEFT JOIN [Gears] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [g] ON [l0].[DefeatedByNickname] = [g].[Nickname] AND [l0].[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] -ORDER BY [f].[Id], [l0].[Name], [g].[Nickname], [g].[SquadId], [g0].[Nickname] +ORDER BY [f].[Id], [g0].[Nickname] """); } @@ -6928,7 +6921,7 @@ LEFT JOIN ( INNER JOIN [Squads] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [s] ON [g0].[SquadId] = [s].[Id] LEFT JOIN [SquadMissions] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [s0] ON [s].[Id] = [s0].[SquadId] ) AS [s1] ON [g].[Nickname] = [s1].[LeaderNickname] AND [g].[SquadId] = [s1].[LeaderSquadId] -ORDER BY [g].[Nickname], [g].[SquadId], [s1].[Nickname], [s1].[SquadId], [s1].[Id], [s1].[SquadId0] +ORDER BY [g].[Nickname], [g].[SquadId], [s1].[Nickname], [s1].[SquadId], [s1].[SquadId0] """); } @@ -7230,7 +7223,7 @@ public override async Task Include_multiple_circular_with_filter(bool async) INNER JOIN [Cities] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [c] ON [g].[CityOfBirthName] = [c].[Name] LEFT JOIN [Gears] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [g0] ON [c].[Name] = [g0].[AssignedCityName] WHERE [g].[Nickname] = N'Marcus' -ORDER BY [g].[Nickname], [g].[SquadId], [c].[Name], [g0].[Nickname] +ORDER BY [g].[Nickname], [g].[SquadId], [g0].[Nickname] """); } @@ -7587,7 +7580,7 @@ public override async Task Correlated_collections_projection_of_collection_thru_ AssertSql( """ -SELECT [g].[Nickname], [g].[SquadId], [s].[Id], [s1].[SquadId], [s1].[MissionId], [s1].[PeriodEnd], [s1].[PeriodStart] +SELECT [g].[Nickname], [g].[SquadId], [s1].[SquadId], [s1].[MissionId], [s1].[PeriodEnd], [s1].[PeriodStart] FROM [Gears] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [g] INNER JOIN [Squads] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [s] ON [g].[SquadId] = [s].[Id] LEFT JOIN ( @@ -7596,7 +7589,7 @@ LEFT JOIN ( WHERE [s0].[MissionId] <> 17 ) AS [s1] ON [s].[Id] = [s1].[SquadId] WHERE [g].[Nickname] <> N'Marcus' -ORDER BY [g].[FullName], [g].[Nickname], [g].[SquadId], [s].[Id], [s1].[SquadId] +ORDER BY [g].[FullName], [g].[Nickname], [g].[SquadId], [s1].[SquadId] """); } @@ -7672,7 +7665,7 @@ public override async Task Include_with_join_multi_level(bool async) INNER JOIN [Tags] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [t] ON [g].[SquadId] = [t].[GearSquadId] AND [g].[Nickname] = [t].[GearNickName] INNER JOIN [Cities] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [c] ON [g].[CityOfBirthName] = [c].[Name] LEFT JOIN [Gears] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [g0] ON [c].[Name] = [g0].[AssignedCityName] -ORDER BY [g].[Nickname], [g].[SquadId], [t].[Id], [c].[Name], [g0].[Nickname] +ORDER BY [g].[Nickname], [g].[SquadId], [t].[Id], [g0].[Nickname] """); } @@ -7897,7 +7890,7 @@ public override async Task Include_multiple_circular(bool async) 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 [c] ON [g].[CityOfBirthName] = [c].[Name] LEFT JOIN [Gears] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [g0] ON [c].[Name] = [g0].[AssignedCityName] -ORDER BY [g].[Nickname], [g].[SquadId], [c].[Name], [g0].[Nickname] +ORDER BY [g].[Nickname], [g].[SquadId], [g0].[Nickname] """); } @@ -7907,7 +7900,7 @@ public override async Task Select_correlated_filtered_collection(bool async) AssertSql( """ -SELECT [g].[Nickname], [g].[SquadId], [c].[Name], [w0].[Id], [w0].[AmmunitionType], [w0].[IsAutomatic], [w0].[Name], [w0].[OwnerFullName], [w0].[PeriodEnd], [w0].[PeriodStart], [w0].[SynergyWithId] +SELECT [g].[Nickname], [g].[SquadId], [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] INNER JOIN [Cities] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [c] ON [g].[CityOfBirthName] = [c].[Name] LEFT JOIN ( @@ -7916,7 +7909,7 @@ LEFT JOIN ( WHERE [w].[Name] <> N'Lancer' OR [w].[Name] IS NULL ) AS [w0] ON [g].[FullName] = [w0].[OwnerFullName] WHERE [c].[Name] IN (N'Ephyra', N'Hanover') -ORDER BY [g].[Nickname], [g].[SquadId], [c].[Name] +ORDER BY [g].[Nickname], [g].[SquadId] """); } @@ -8013,7 +8006,7 @@ public override async Task Project_collection_navigation_with_inheritance1(bool AssertSql( """ -SELECT [f].[Id], [l0].[Name], [f0].[Id], [l1].[Name], [l1].[Discriminator], [l1].[LocustHordeId], [l1].[PeriodEnd], [l1].[PeriodStart], [l1].[ThreatLevel], [l1].[ThreatLevelByte], [l1].[ThreatLevelNullableByte], [l1].[DefeatedByNickname], [l1].[DefeatedBySquadId], [l1].[HighCommandId] +SELECT [f].[Id], [l1].[Name], [l1].[Discriminator], [l1].[LocustHordeId], [l1].[PeriodEnd], [l1].[PeriodStart], [l1].[ThreatLevel], [l1].[ThreatLevelByte], [l1].[ThreatLevelNullableByte], [l1].[DefeatedByNickname], [l1].[DefeatedBySquadId], [l1].[HighCommandId] FROM [Factions] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [f] LEFT JOIN ( SELECT [l].[Name] @@ -8022,7 +8015,7 @@ SELECT [l].[Name] ) AS [l0] ON [f].[CommanderName] = [l0].[Name] LEFT JOIN [Factions] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [f0] ON [l0].[Name] = [f0].[CommanderName] LEFT JOIN [LocustLeaders] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [l1] ON [f0].[Id] = [l1].[LocustHordeId] -ORDER BY [f].[Id], [l0].[Name], [f0].[Id] +ORDER BY [f].[Id] """); } @@ -8051,7 +8044,7 @@ public override async Task Include_multiple_one_to_one_and_one_to_many(bool asyn 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 [Weapons] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [w] ON [g].[FullName] = [w].[OwnerFullName] -ORDER BY [t].[Id], [g].[Nickname], [g].[SquadId] +ORDER BY [t].[Id] """); } diff --git a/test/EFCore.SqlServer.FunctionalTests/Query/TemporalManyToManyQuerySqlServerTest.cs b/test/EFCore.SqlServer.FunctionalTests/Query/TemporalManyToManyQuerySqlServerTest.cs index 5b0a7279b80..d562b80a953 100644 --- a/test/EFCore.SqlServer.FunctionalTests/Query/TemporalManyToManyQuerySqlServerTest.cs +++ b/test/EFCore.SqlServer.FunctionalTests/Query/TemporalManyToManyQuerySqlServerTest.cs @@ -123,7 +123,6 @@ public override async Task Skip_navigation_count_without_predicate(bool async) WHERE EXISTS ( SELECT 1 FROM [JoinOneSelfPayload] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [j] - INNER JOIN [EntityOnes] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [e0] ON [j].[LeftId] = [e0].[Id] WHERE [e].[Id] = [j].[RightId]) """); } @@ -159,7 +158,6 @@ public override async Task Skip_navigation_long_count_without_predicate(bool asy WHERE ( SELECT COUNT_BIG(*) FROM [JoinTwoToThree] 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].[TwoId]) > CAST(0 AS bigint) """); } @@ -403,7 +401,7 @@ INNER JOIN ( WHERE [e0].[Discriminator] = N'EntityLeaf' ) AS [e1] ON [j].[LeafId] = [e1].[Id] ) AS [s] ON [e].[Key1] = [s].[CompositeId1] AND [e].[Key2] = [s].[CompositeId2] AND [e].[Key3] = [s].[CompositeId3] -ORDER BY [e].[Key1], [e].[Key2], [e].[Key3], [s].[LeafId], [s].[CompositeId1], [s].[CompositeId2], [s].[CompositeId3] +ORDER BY [e].[Key1], [e].[Key2], [e].[Key3], [s].[LeafId], [s].[CompositeId1], [s].[CompositeId2] """); } @@ -421,7 +419,7 @@ LEFT JOIN ( INNER JOIN [EntityRoots] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [e1] ON [e0].[RootSkipSharedId] = [e1].[Id] WHERE [e1].[Discriminator] = N'EntityLeaf' ) AS [s] ON [e].[Key1] = [s].[CompositeKeySkipSharedKey1] AND [e].[Key2] = [s].[CompositeKeySkipSharedKey2] AND [e].[Key3] = [s].[CompositeKeySkipSharedKey3] -ORDER BY [e].[Key1], [e].[Key2], [e].[Key3], [s].[RootSkipSharedId], [s].[CompositeKeySkipSharedKey1], [s].[CompositeKeySkipSharedKey2], [s].[CompositeKeySkipSharedKey3] +ORDER BY [e].[Key1], [e].[Key2], [e].[Key3], [s].[RootSkipSharedId], [s].[CompositeKeySkipSharedKey1], [s].[CompositeKeySkipSharedKey2] """); } @@ -607,7 +605,7 @@ LEFT JOIN ( FROM [JoinOneSelfPayload] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [j] INNER JOIN [EntityOnes] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [e0] ON [j].[LeftId] = [e0].[Id] ) AS [s] ON [e].[Id] = [s].[RightId] -ORDER BY [e].[Id], [s].[LeftId], [s].[RightId] +ORDER BY [e].[Id], [s].[LeftId] """); } @@ -634,7 +632,7 @@ LEFT JOIN ( FROM [EntityCompositeKeyEntityTwo] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [e3] INNER JOIN [EntityCompositeKeys] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [e4] ON [e3].[CompositeKeySkipSharedKey1] = [e4].[Key1] AND [e3].[CompositeKeySkipSharedKey2] = [e4].[Key2] AND [e3].[CompositeKeySkipSharedKey3] = [e4].[Key3] ) AS [s1] ON [e].[Id] = [s1].[TwoSkipSharedId] -ORDER BY [e].[Id], [s].[ThreeId], [s].[TwoId], [s].[Id], [s0].[SelfSkipSharedLeftId], [s0].[SelfSkipSharedRightId], [s0].[Id], [s1].[TwoSkipSharedId], [s1].[CompositeKeySkipSharedKey1], [s1].[CompositeKeySkipSharedKey2], [s1].[CompositeKeySkipSharedKey3], [s1].[Key1], [s1].[Key2] +ORDER BY [e].[Id], [s].[ThreeId], [s].[TwoId], [s0].[SelfSkipSharedLeftId], [s0].[SelfSkipSharedRightId], [s1].[TwoSkipSharedId], [s1].[CompositeKeySkipSharedKey1], [s1].[CompositeKeySkipSharedKey2] """); } @@ -672,7 +670,7 @@ LEFT JOIN ( FROM [EntityCompositeKeyEntityRoot] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [e0] INNER JOIN [EntityRoots] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [e1] ON [e0].[RootSkipSharedId] = [e1].[Id] ) AS [s] ON [e].[Key1] = [s].[CompositeKeySkipSharedKey1] AND [e].[Key2] = [s].[CompositeKeySkipSharedKey2] AND [e].[Key3] = [s].[CompositeKeySkipSharedKey3] -ORDER BY [e].[Key1], [e].[Key2], [e].[Key3], [s].[RootSkipSharedId], [s].[CompositeKeySkipSharedKey1], [s].[CompositeKeySkipSharedKey2], [s].[CompositeKeySkipSharedKey3] +ORDER BY [e].[Key1], [e].[Key2], [e].[Key3], [s].[RootSkipSharedId], [s].[CompositeKeySkipSharedKey1], [s].[CompositeKeySkipSharedKey2] """); } @@ -690,7 +688,7 @@ LEFT JOIN ( INNER JOIN [EntityOnes] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [e0] ON [j].[OneId] = [e0].[Id] LEFT JOIN [EntityTwos] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [e1] ON [e0].[Id] = [e1].[ReferenceInverseId] ) AS [s] ON [e].[Id] = [s].[TwoId] -ORDER BY [e].[Id], [s].[OneId], [s].[TwoId], [s].[Id] +ORDER BY [e].[Id], [s].[OneId] """); } @@ -716,7 +714,7 @@ LEFT JOIN ( INNER JOIN [EntityOnes] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [e2] ON [j0].[EntityOneId] = [e2].[Id] ) AS [s] ON [e1].[Id] = [s].[EntityBranchId] ) AS [s0] ON [e].[Key1] = [s0].[CompositeId1] AND [e].[Key2] = [s0].[CompositeId2] AND [e].[Key3] = [s0].[CompositeId3] -ORDER BY [e].[Key1], [e].[Key2], [e].[Key3], [s0].[LeafId], [s0].[CompositeId1], [s0].[CompositeId2], [s0].[CompositeId3], [s0].[Id], [s0].[EntityBranchId], [s0].[EntityOneId] +ORDER BY [e].[Key1], [e].[Key2], [e].[Key3], [s0].[LeafId], [s0].[CompositeId1], [s0].[CompositeId2], [s0].[CompositeId3], [s0].[EntityBranchId] """); } @@ -739,7 +737,7 @@ LEFT JOIN ( INNER JOIN [EntityOnes] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [e2] ON [j0].[RightId] = [e2].[Id] ) AS [s] ON [e0].[Id] = [s].[LeftId] ) AS [s0] ON [e].[Id] = [s0].[ThreeId] -ORDER BY [e].[Id], [s0].[OneId], [s0].[ThreeId], [s0].[Id], [s0].[Id0], [s0].[LeftId], [s0].[RightId] +ORDER BY [e].[Id], [s0].[OneId], [s0].[ThreeId], [s0].[LeftId] """); } @@ -749,7 +747,7 @@ public override async Task Include_skip_navigation_and_reference(bool async) AssertSql( """ -SELECT [e].[Id], [e].[CollectionInverseId], [e].[ExtraId], [e].[Name], [e].[PeriodEnd], [e].[PeriodStart], [e].[ReferenceInverseId], [e0].[Id], [s].[OneSkipSharedId], [s].[TwoSkipSharedId], [s].[PeriodEnd], [s].[PeriodStart], [s].[Id], [s].[Name], [s].[PeriodEnd0], [s].[PeriodStart0], [e0].[CollectionInverseId], [e0].[Name], [e0].[PeriodEnd], [e0].[PeriodStart], [e0].[ReferenceInverseId] +SELECT [e].[Id], [e].[CollectionInverseId], [e].[ExtraId], [e].[Name], [e].[PeriodEnd], [e].[PeriodStart], [e].[ReferenceInverseId], [s].[OneSkipSharedId], [s].[TwoSkipSharedId], [s].[PeriodEnd], [s].[PeriodStart], [s].[Id], [s].[Name], [s].[PeriodEnd0], [s].[PeriodStart0], [e0].[Id], [e0].[CollectionInverseId], [e0].[Name], [e0].[PeriodEnd], [e0].[PeriodStart], [e0].[ReferenceInverseId] FROM [EntityTwos] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [e] LEFT JOIN [EntityThrees] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [e0] ON [e].[Id] = [e0].[ReferenceInverseId] LEFT JOIN ( @@ -757,7 +755,7 @@ LEFT JOIN ( FROM [EntityOneEntityTwo] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [e1] INNER JOIN [EntityOnes] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [e2] ON [e1].[OneSkipSharedId] = [e2].[Id] ) AS [s] ON [e].[Id] = [s].[TwoSkipSharedId] -ORDER BY [e].[Id], [e0].[Id], [s].[OneSkipSharedId], [s].[TwoSkipSharedId] +ORDER BY [e].[Id], [s].[OneSkipSharedId] """); } @@ -779,7 +777,7 @@ LEFT JOIN ( INNER JOIN [EntityThrees] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [e1] ON [j0].[ThreeId] = [e1].[Id] ) AS [s] ON [e0].[Id] = [s].[OneId] ) AS [s0] ON [e].[Id] = [s0].[ThreeId] -ORDER BY [e].[Id], [s0].[OneId], [s0].[ThreeId], [s0].[Id], [s0].[OneId0], [s0].[ThreeId0] +ORDER BY [e].[Id], [s0].[OneId], [s0].[ThreeId], [s0].[OneId0] """); } @@ -797,7 +795,7 @@ LEFT JOIN ( INNER JOIN [EntityOnes] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [e0] ON [j].[OneId] = [e0].[Id] WHERE [e0].[Id] < 10 ) AS [s] ON [e].[Id] = [s].[ThreeId] -ORDER BY [e].[Id], [s].[OneId], [s].[ThreeId] +ORDER BY [e].[Id], [s].[OneId] """); } @@ -900,7 +898,7 @@ LEFT JOIN ( WHERE [e2].[Id] < 10 ) AS [s] ON [e1].[Id] = [s].[ThreeId] ) AS [s0] ON [e].[Id] = [s0].[RootSkipSharedId] -ORDER BY [e].[Id], [s0].[RootSkipSharedId], [s0].[ThreeSkipSharedId], [s0].[Id], [s0].[OneId], [s0].[ThreeId] +ORDER BY [e].[Id], [s0].[RootSkipSharedId], [s0].[ThreeSkipSharedId], [s0].[OneId] """); } @@ -926,7 +924,7 @@ LEFT JOIN ( WHERE 1 < [s].[row] AND [s].[row] <= 3 ) AS [s0] ON [e1].[Key1] = [s0].[CompositeId1] AND [e1].[Key2] = [s0].[CompositeId2] AND [e1].[Key3] = [s0].[CompositeId3] ) AS [s1] ON [e].[Id] = [s1].[RootSkipSharedId] -ORDER BY [e].[Id], [s1].[RootSkipSharedId], [s1].[CompositeKeySkipSharedKey1], [s1].[CompositeKeySkipSharedKey2], [s1].[CompositeKeySkipSharedKey3], [s1].[Key1], [s1].[Key2], [s1].[Key3], [s1].[CompositeId1], [s1].[CompositeId2], [s1].[CompositeId3], [s1].[Id0] +ORDER BY [e].[Id], [s1].[RootSkipSharedId], [s1].[CompositeKeySkipSharedKey1], [s1].[CompositeKeySkipSharedKey2], [s1].[CompositeKeySkipSharedKey3], [s1].[CompositeId1], [s1].[CompositeId2], [s1].[CompositeId3], [s1].[Id0] """); } @@ -950,7 +948,7 @@ LEFT JOIN ( WHERE [e0].[Key1] < 5 ) AS [s0] ON [e].[Id] = [s0].[LeafId] WHERE [e].[Discriminator] = N'EntityLeaf' -ORDER BY [e].[Id], [s0].[LeafId], [s0].[CompositeId1], [s0].[CompositeId2], [s0].[CompositeId3], [s0].[Key1], [s0].[Key2], [s0].[Key3], [s0].[TwoSkipSharedId], [s0].[CompositeKeySkipSharedKey1], [s0].[CompositeKeySkipSharedKey2], [s0].[CompositeKeySkipSharedKey3] +ORDER BY [e].[Id], [s0].[LeafId], [s0].[CompositeId1], [s0].[CompositeId2], [s0].[CompositeId3], [s0].[TwoSkipSharedId], [s0].[CompositeKeySkipSharedKey1], [s0].[CompositeKeySkipSharedKey2] """); } @@ -979,7 +977,7 @@ LEFT JOIN ( WHERE [e1].[Id] < 10 ) AS [s0] ON [s].[Id] = [s0].[TwoId] ) AS [s1] -ORDER BY [e].[Id], [s1].[Id], [s1].[OneId], [s1].[TwoId], [s1].[ThreeId], [s1].[TwoId0] +ORDER BY [e].[Id], [s1].[Id], [s1].[OneId], [s1].[TwoId], [s1].[ThreeId] """); } @@ -1006,7 +1004,7 @@ LEFT JOIN ( ) AS [s0] ON [e0].[Id] = [s0].[TwoId] WHERE [e0].[Id] < 10 ) AS [s1] ON [e].[Id] = [s1].[OneId] -ORDER BY [e].[Id], [s1].[OneId], [s1].[TwoId], [s1].[Id], [s1].[TwoId0], [s1].[Id0] +ORDER BY [e].[Id], [s1].[OneId], [s1].[TwoId], [s1].[TwoId0], [s1].[Id0] """); } @@ -1026,7 +1024,7 @@ LEFT JOIN ( LEFT JOIN [EntityTwos] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [e2] ON [e0].[Id] = [e2].[CollectionInverseId] WHERE [e0].[Id] < 10 ) AS [s] ON [e].[Id] = [s].[TwoId] -ORDER BY [e].[Id], [s].[OneId], [s].[TwoId], [s].[Id], [s].[Id0] +ORDER BY [e].[Id], [s].[OneId], [s].[TwoId] """); } @@ -1063,7 +1061,7 @@ WHERE [e3].[Id] < 20 ) AS [s1] ON [e0].[Id] = [s1].[EntityOneId] WHERE [e0].[Id] < 10 ) AS [s2] ON [e].[Id] = [s2].[ThreeId] -ORDER BY [e].[Id], [s2].[OneId], [s2].[ThreeId], [s2].[Id], [s2].[OneId0], [s2].[Id0], [s2].[TwoId], [s2].[EntityBranchId], [s2].[EntityOneId] +ORDER BY [e].[Id], [s2].[OneId], [s2].[ThreeId], [s2].[OneId0], [s2].[Id0], [s2].[TwoId], [s2].[EntityBranchId] """); } @@ -1086,7 +1084,7 @@ WHERE [e1].[Id] < 5 ) AS [e2] ON [e0].[Id] = [e2].[CollectionInverseId] WHERE [e0].[Id] > 15 ) AS [s] ON [e].[Id] = [s].[ThreeId] -ORDER BY [e].[Id], [s].[OneId], [s].[ThreeId], [s].[Id] +ORDER BY [e].[Id], [s].[OneId], [s].[ThreeId] """); } @@ -1109,7 +1107,7 @@ WHERE [e1].[Id] < 5 ) AS [s] ON [e0].[Id] = [s].[TwoId] WHERE [e0].[Id] > 15 ) AS [s0] ON [e].[Id] = [s0].[CollectionInverseId] -ORDER BY [e].[Id], [s0].[Id], [s0].[ThreeId], [s0].[TwoId] +ORDER BY [e].[Id], [s0].[Id], [s0].[ThreeId] """); } diff --git a/test/EFCore.SqlServer.FunctionalTests/Query/TemporalOwnedQuerySqlServerTest.cs b/test/EFCore.SqlServer.FunctionalTests/Query/TemporalOwnedQuerySqlServerTest.cs index 120b0ecd277..b91e5797b0d 100644 --- a/test/EFCore.SqlServer.FunctionalTests/Query/TemporalOwnedQuerySqlServerTest.cs +++ b/test/EFCore.SqlServer.FunctionalTests/Query/TemporalOwnedQuerySqlServerTest.cs @@ -343,7 +343,7 @@ public override async Task Filter_owned_entity_chained_with_regular_entity_follo AssertSql( """ -SELECT [o].[Id], [p].[Id], [s].[ClientId], [s].[Id], [s].[OrderDate], [s].[PeriodEnd], [s].[PeriodStart], [s].[OrderClientId], [s].[OrderId], [s].[Id0], [s].[Detail], [s].[PeriodEnd0], [s].[PeriodStart0] +SELECT [o].[Id], [s].[ClientId], [s].[Id], [s].[OrderDate], [s].[PeriodEnd], [s].[PeriodStart], [s].[OrderClientId], [s].[OrderId], [s].[Id0], [s].[Detail], [s].[PeriodEnd0], [s].[PeriodStart0] 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] LEFT JOIN ( @@ -352,7 +352,7 @@ LEFT JOIN ( 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 [s] ON [o].[Id] = [s].[ClientId] WHERE [p].[Id] <> 42 OR [p].[Id] IS NULL -ORDER BY [o].[Id], [p].[Id], [s].[ClientId], [s].[Id], [s].[OrderClientId], [s].[OrderId] +ORDER BY [o].[Id], [s].[ClientId], [s].[Id], [s].[OrderClientId], [s].[OrderId] """); } @@ -362,7 +362,7 @@ public override async Task Project_multiple_owned_navigations(bool async) AssertSql( """ -SELECT [o].[Id], [p].[Id], [s].[ClientId], [s].[Id], [s].[OrderDate], [s].[PeriodEnd], [s].[PeriodStart], [s].[OrderClientId], [s].[OrderId], [s].[Id0], [s].[Detail], [s].[PeriodEnd0], [s].[PeriodStart0], [o].[PersonAddress_AddressLine], [o].[PeriodEnd], [o].[PeriodStart], [o].[PersonAddress_PlaceType], [o].[PersonAddress_ZipCode], [o].[PersonAddress_Country_Name], [o].[PersonAddress_Country_PlanetId], [p].[Name], [p].[PeriodEnd], [p].[PeriodStart], [p].[StarId] +SELECT [o].[Id], [s].[ClientId], [s].[Id], [s].[OrderDate], [s].[PeriodEnd], [s].[PeriodStart], [s].[OrderClientId], [s].[OrderId], [s].[Id0], [s].[Detail], [s].[PeriodEnd0], [s].[PeriodStart0], [o].[PersonAddress_AddressLine], [o].[PeriodEnd], [o].[PeriodStart], [o].[PersonAddress_PlaceType], [o].[PersonAddress_ZipCode], [o].[PersonAddress_Country_Name], [o].[PersonAddress_Country_PlanetId], [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] LEFT JOIN ( @@ -370,7 +370,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 [s] ON [o].[Id] = [s].[ClientId] -ORDER BY [o].[Id], [p].[Id], [s].[ClientId], [s].[Id], [s].[OrderClientId], [s].[OrderId] +ORDER BY [o].[Id], [s].[ClientId], [s].[Id], [s].[OrderClientId], [s].[OrderId] """); } @@ -399,7 +399,7 @@ public override async Task Navigation_rewrite_on_owned_reference_followed_by_reg AssertSql( """ -SELECT [o].[Id], [o].[Discriminator], [o].[Name], [o].[PeriodEnd], [o].[PeriodStart], [p].[Id], [s].[ClientId], [s].[Id], [s].[OrderDate], [s].[PeriodEnd], [s].[PeriodStart], [s].[OrderClientId], [s].[OrderId], [s].[Id0], [s].[Detail], [s].[PeriodEnd0], [s].[PeriodStart0], [o].[PersonAddress_AddressLine], [o].[PeriodEnd], [o].[PeriodStart], [o].[PersonAddress_PlaceType], [o].[PersonAddress_ZipCode], [o].[PersonAddress_Country_Name], [o].[PersonAddress_Country_PlanetId], [o].[BranchAddress_BranchName], [o].[BranchAddress_PlaceType], [o].[BranchAddress_Country_Name], [o].[BranchAddress_Country_PlanetId], [o].[LeafBAddress_LeafBType], [o].[LeafBAddress_PlaceType], [o].[LeafBAddress_Country_Name], [o].[LeafBAddress_Country_PlanetId], [o].[LeafAAddress_LeafType], [o].[LeafAAddress_PlaceType], [o].[LeafAAddress_Country_Name], [o].[LeafAAddress_Country_PlanetId] +SELECT [o].[Id], [o].[Discriminator], [o].[Name], [o].[PeriodEnd], [o].[PeriodStart], [s].[ClientId], [s].[Id], [s].[OrderDate], [s].[PeriodEnd], [s].[PeriodStart], [s].[OrderClientId], [s].[OrderId], [s].[Id0], [s].[Detail], [s].[PeriodEnd0], [s].[PeriodStart0], [o].[PersonAddress_AddressLine], [o].[PeriodEnd], [o].[PeriodStart], [o].[PersonAddress_PlaceType], [o].[PersonAddress_ZipCode], [o].[PersonAddress_Country_Name], [o].[PersonAddress_Country_PlanetId], [o].[BranchAddress_BranchName], [o].[BranchAddress_PlaceType], [o].[BranchAddress_Country_Name], [o].[BranchAddress_Country_PlanetId], [o].[LeafBAddress_LeafBType], [o].[LeafBAddress_PlaceType], [o].[LeafBAddress_Country_Name], [o].[LeafBAddress_Country_PlanetId], [o].[LeafAAddress_LeafType], [o].[LeafAAddress_PlaceType], [o].[LeafAAddress_Country_Name], [o].[LeafAAddress_Country_PlanetId] 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] LEFT JOIN ( @@ -408,7 +408,7 @@ LEFT JOIN ( 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 [s] ON [o].[Id] = [s].[ClientId] WHERE [p].[Id] <> 7 OR [p].[Id] IS NULL -ORDER BY [o].[Id], [p].[Id], [s].[ClientId], [s].[Id], [s].[OrderClientId], [s].[OrderId] +ORDER BY [o].[Id], [s].[ClientId], [s].[Id], [s].[OrderClientId], [s].[OrderId] """); } @@ -430,11 +430,11 @@ public override async Task Navigation_rewrite_on_owned_reference_followed_by_reg AssertSql( """ -SELECT [o].[Id], [p].[Id], [m].[Id], [m].[Diameter], [m].[PeriodEnd], [m].[PeriodStart], [m].[PlanetId] +SELECT [o].[Id], [m].[Id], [m].[Diameter], [m].[PeriodEnd], [m].[PeriodStart], [m].[PlanetId] 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] LEFT JOIN [Moon] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [m] ON [p].[Id] = [m].[PlanetId] -ORDER BY [o].[Id], [p].[Id] +ORDER BY [o].[Id] """); } @@ -471,12 +471,12 @@ public override async Task Navigation_rewrite_on_owned_reference_followed_by_reg AssertSql( """ -SELECT [s].[Id], [s].[Name], [s].[PeriodEnd], [s].[PeriodStart], [o].[Id], [p].[Id], [e].[Id], [e].[Name], [e].[PeriodEnd], [e].[PeriodStart], [e].[StarId] +SELECT [s].[Id], [s].[Name], [s].[PeriodEnd], [s].[PeriodStart], [o].[Id], [e].[Id], [e].[Name], [e].[PeriodEnd], [e].[PeriodStart], [e].[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] LEFT JOIN [Star] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [s] ON [p].[StarId] = [s].[Id] LEFT JOIN [Element] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [e] ON [s].[Id] = [e].[StarId] -ORDER BY [o].[Id], [p].[Id], [s].[Id] +ORDER BY [o].[Id] """); } @@ -502,13 +502,13 @@ await base.Navigation_rewrite_on_owned_reference_followed_by_regular_entity_and_ AssertSql( """ -SELECT [s].[Id], [s].[Name], [s].[PeriodEnd], [s].[PeriodStart], [o].[Id], [p].[Id], [e].[Id], [e].[Name], [e].[PeriodEnd], [e].[PeriodStart], [e].[StarId] +SELECT [s].[Id], [s].[Name], [s].[PeriodEnd], [s].[PeriodStart], [o].[Id], [e].[Id], [e].[Name], [e].[PeriodEnd], [e].[PeriodStart], [e].[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] LEFT JOIN [Star] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [s] ON [p].[StarId] = [s].[Id] LEFT JOIN [Element] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [e] ON [s].[Id] = [e].[StarId] WHERE [s].[Name] = N'Sol' -ORDER BY [o].[Id], [p].[Id], [s].[Id] +ORDER BY [o].[Id] """); } @@ -1146,27 +1146,25 @@ public override async Task Project_multiple_owned_navigations_split(bool async) AssertSql( """ -SELECT [o].[Id], [p].[Id], [o].[PersonAddress_AddressLine], [o].[PeriodEnd], [o].[PeriodStart], [o].[PersonAddress_PlaceType], [o].[PersonAddress_ZipCode], [o].[PersonAddress_Country_Name], [o].[PersonAddress_Country_PlanetId], [p].[Name], [p].[PeriodEnd], [p].[PeriodStart], [p].[StarId] +SELECT [o].[Id], [o].[PersonAddress_AddressLine], [o].[PeriodEnd], [o].[PeriodStart], [o].[PersonAddress_PlaceType], [o].[PersonAddress_ZipCode], [o].[PersonAddress_Country_Name], [o].[PersonAddress_Country_PlanetId], [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], [p].[Id] +ORDER BY [o].[Id] """, // """ -SELECT [o1].[ClientId], [o1].[Id], [o1].[OrderDate], [o1].[PeriodEnd], [o1].[PeriodStart], [o].[Id], [p].[Id] +SELECT [o1].[ClientId], [o1].[Id], [o1].[OrderDate], [o1].[PeriodEnd], [o1].[PeriodStart], [o].[Id] 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] INNER JOIN [Order] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [o1] ON [o].[Id] = [o1].[ClientId] -ORDER BY [o].[Id], [p].[Id], [o1].[ClientId], [o1].[Id] +ORDER BY [o].[Id], [o1].[ClientId], [o1].[Id] """, // """ -SELECT [o3].[OrderClientId], [o3].[OrderId], [o3].[Id], [o3].[Detail], [o3].[PeriodEnd], [o3].[PeriodStart], [o].[Id], [p].[Id], [o1].[ClientId], [o1].[Id] +SELECT [o3].[OrderClientId], [o3].[OrderId], [o3].[Id], [o3].[Detail], [o3].[PeriodEnd], [o3].[PeriodStart], [o].[Id], [o1].[ClientId], [o1].[Id] 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] INNER JOIN [Order] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [o1] ON [o].[Id] = [o1].[ClientId] INNER JOIN [OrderDetail] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [o3] ON [o1].[ClientId] = [o3].[OrderClientId] AND [o1].[Id] = [o3].[OrderId] -ORDER BY [o].[Id], [p].[Id], [o1].[ClientId], [o1].[Id] +ORDER BY [o].[Id], [o1].[ClientId], [o1].[Id] """); } @@ -1176,18 +1174,17 @@ public override async Task Navigation_rewrite_on_owned_reference_followed_by_reg AssertSql( """ -SELECT [o].[Id], [p].[Id] +SELECT [o].[Id] 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], [p].[Id] +ORDER BY [o].[Id] """, // """ -SELECT [m].[Id], [m].[Diameter], [m].[PeriodEnd], [m].[PeriodStart], [m].[PlanetId], [o].[Id], [p].[Id] +SELECT [m].[Id], [m].[Diameter], [m].[PeriodEnd], [m].[PeriodStart], [m].[PlanetId], [o].[Id] 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] INNER JOIN [Moon] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [m] ON [p].[Id] = [m].[PlanetId] -ORDER BY [o].[Id], [p].[Id] +ORDER BY [o].[Id] """); } @@ -1367,11 +1364,11 @@ public override async Task Projecting_collection_correlated_with_keyless_entity_ AssertSql( """ -SELECT [b].[Throned_Value], [f].[Id], [b].[Id], [p].[Id], [p].[Name], [p].[PeriodEnd], [p].[PeriodStart], [p].[StarId] +SELECT [b].[Throned_Value], [f].[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 -ORDER BY [f].[Id], [b].[Id] +ORDER BY [f].[Id] """); } @@ -1437,7 +1434,7 @@ LEFT JOIN ( FROM [Order] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [o2] LEFT JOIN [OrderDetail] FOR SYSTEM_TIME AS OF '2010-01-01T00:00:00.0000000' AS [o3] ON [o2].[ClientId] = [o3].[OrderClientId] AND [o2].[Id] = [o3].[OrderId] ) AS [s0] ON [o].[Id] = [s0].[ClientId] -ORDER BY [p].[Id], [o].[Id], [s].[ClientId], [s].[Id], [s].[OrderClientId], [s].[OrderId], [s].[Id0], [s0].[ClientId], [s0].[Id], [s0].[OrderClientId], [s0].[OrderId] +ORDER BY [p].[Id], [s].[ClientId], [s].[Id], [s].[OrderClientId], [s].[OrderId], [s].[Id0], [s0].[ClientId], [s0].[Id], [s0].[OrderClientId], [s0].[OrderId] """); } @@ -1459,7 +1456,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 [s0] ON [s].[Id0] = [s0].[ClientId] -ORDER BY [p].[Id], [s].[Id], [s].[Id0], [s0].[ClientId], [s0].[Id], [s0].[OrderClientId], [s0].[OrderId] +ORDER BY [p].[Id], [s].[Id], [s0].[ClientId], [s0].[Id], [s0].[OrderClientId], [s0].[OrderId] """); } diff --git a/test/EFCore.SqlServer.FunctionalTests/Query/UdfDbFunctionSqlServerTests.cs b/test/EFCore.SqlServer.FunctionalTests/Query/UdfDbFunctionSqlServerTests.cs index 591fdc855db..449bc445e10 100644 --- a/test/EFCore.SqlServer.FunctionalTests/Query/UdfDbFunctionSqlServerTests.cs +++ b/test/EFCore.SqlServer.FunctionalTests/Query/UdfDbFunctionSqlServerTests.cs @@ -878,14 +878,14 @@ public override void QF_Correlated_Func_Call_With_Navigation() AssertSql( """ -SELECT [c].[Id], [s].[CustomerName], [s].[OrderId], [s].[Id] +SELECT [c].[Id], [s].[CustomerName], [s].[OrderId] FROM [Customers] AS [c] OUTER APPLY ( - SELECT [c0].[LastName] AS [CustomerName], [g].[OrderId], [c0].[Id] + SELECT [c0].[LastName] AS [CustomerName], [g].[OrderId] FROM [dbo].[GetOrdersWithMultipleProducts]([c].[Id]) AS [g] INNER JOIN [Customers] AS [c0] ON [g].[CustomerId] = [c0].[Id] ) AS [s] -ORDER BY [c].[Id], [s].[OrderId] +ORDER BY [c].[Id] """); } diff --git a/test/EFCore.Sqlite.FunctionalTests/BulkUpdates/NonSharedModelBulkUpdatesSqliteTest.cs b/test/EFCore.Sqlite.FunctionalTests/BulkUpdates/NonSharedModelBulkUpdatesSqliteTest.cs index a14ae68b938..d3c2d8e9b60 100644 --- a/test/EFCore.Sqlite.FunctionalTests/BulkUpdates/NonSharedModelBulkUpdatesSqliteTest.cs +++ b/test/EFCore.Sqlite.FunctionalTests/BulkUpdates/NonSharedModelBulkUpdatesSqliteTest.cs @@ -160,7 +160,6 @@ DELETE FROM "Context30572_Principal" AS "c" WHERE "c"."Id" IN ( SELECT "c0"."Id" FROM "Context30572_Principal" AS "c0" - LEFT JOIN "Context30572_Dependent" AS "c1" ON "c0"."DependentId" = "c1"."Id" ) """); } diff --git a/test/EFCore.Sqlite.FunctionalTests/BulkUpdates/NorthwindBulkUpdatesSqliteTest.cs b/test/EFCore.Sqlite.FunctionalTests/BulkUpdates/NorthwindBulkUpdatesSqliteTest.cs index 0c582d696af..c5754a9de44 100644 --- a/test/EFCore.Sqlite.FunctionalTests/BulkUpdates/NorthwindBulkUpdatesSqliteTest.cs +++ b/test/EFCore.Sqlite.FunctionalTests/BulkUpdates/NorthwindBulkUpdatesSqliteTest.cs @@ -535,20 +535,10 @@ public override async Task Delete_with_LeftJoin(bool async) AssertSql( """ -@p1='100' -@p='0' - DELETE FROM "Order Details" AS "o" WHERE EXISTS ( SELECT 1 FROM "Order Details" AS "o0" - LEFT JOIN ( - SELECT "o2"."OrderID" - FROM "Orders" AS "o2" - WHERE "o2"."OrderID" < 10300 - ORDER BY "o2"."OrderID" - LIMIT @p1 OFFSET @p - ) AS "o1" ON "o0"."OrderID" = "o1"."OrderID" WHERE "o0"."OrderID" < 10276 AND "o0"."OrderID" = "o"."OrderID" AND "o0"."ProductID" = "o"."ProductID") """); } @@ -559,20 +549,10 @@ public override async Task Delete_with_LeftJoin_via_flattened_GroupJoin(bool asy AssertSql( """ -@p1='100' -@p='0' - DELETE FROM "Order Details" AS "o" WHERE EXISTS ( SELECT 1 FROM "Order Details" AS "o0" - LEFT JOIN ( - SELECT "o2"."OrderID" - FROM "Orders" AS "o2" - WHERE "o2"."OrderID" < 10300 - ORDER BY "o2"."OrderID" - LIMIT @p1 OFFSET @p - ) AS "o1" ON "o0"."OrderID" = "o1"."OrderID" WHERE "o0"."OrderID" < 10276 AND "o0"."OrderID" = "o"."OrderID" AND "o0"."ProductID" = "o"."ProductID") """); } diff --git a/test/EFCore.Sqlite.FunctionalTests/Query/GearsOfWarQuerySqliteTest.cs b/test/EFCore.Sqlite.FunctionalTests/Query/GearsOfWarQuerySqliteTest.cs index a0d39d7b99d..c5651d6ab88 100644 --- a/test/EFCore.Sqlite.FunctionalTests/Query/GearsOfWarQuerySqliteTest.cs +++ b/test/EFCore.Sqlite.FunctionalTests/Query/GearsOfWarQuerySqliteTest.cs @@ -441,7 +441,7 @@ LEFT JOIN ( WHERE "l"."Discriminator" = 'LocustCommander' ) AS "l0" ON "f"."CommanderName" = "l0"."Name" LEFT JOIN "LocustLeaders" AS "l1" ON "f"."Id" = "l1"."LocustHordeId" -ORDER BY "f"."Name", "f"."Id", "l0"."Name" +ORDER BY "f"."Name", "f"."Id" """); } @@ -469,7 +469,7 @@ public override async Task Correlated_collections_deeply_nested_left_join(bool a AssertSql( """ -SELECT "t"."Id", "g"."Nickname", "g"."SquadId", "s"."Id", "s0"."Nickname", "s0"."SquadId", "s0"."Id", "s0"."AmmunitionType", "s0"."IsAutomatic", "s0"."Name", "s0"."OwnerFullName", "s0"."SynergyWithId" +SELECT "t"."Id", "g"."Nickname", "g"."SquadId", "s0"."Nickname", "s0"."SquadId", "s0"."Id", "s0"."AmmunitionType", "s0"."IsAutomatic", "s0"."Name", "s0"."OwnerFullName", "s0"."SynergyWithId" FROM "Tags" AS "t" LEFT JOIN "Gears" AS "g" ON "t"."GearNickName" = "g"."Nickname" LEFT JOIN "Squads" AS "s" ON "g"."SquadId" = "s"."Id" @@ -483,7 +483,7 @@ LEFT JOIN ( ) AS "w0" ON "g0"."FullName" = "w0"."OwnerFullName" WHERE "g0"."HasSoulPatch" ) AS "s0" ON "s"."Id" = "s0"."SquadId" -ORDER BY "t"."Note", "g"."Nickname" DESC, "t"."Id", "g"."SquadId", "s"."Id", "s0"."Nickname", "s0"."SquadId" +ORDER BY "t"."Note", "g"."Nickname" DESC, "t"."Id", "g"."SquadId", "s0"."Nickname", "s0"."SquadId" """); } @@ -714,10 +714,10 @@ public override async Task Correlated_collections_nested_mixed_streaming_with_bu AssertSql( """ -SELECT "s"."Id", "s3"."SquadId", "s3"."MissionId", "s3"."Id", "s3"."SquadId0", "s3"."MissionId0" +SELECT "s"."Id", "s3"."SquadId", "s3"."MissionId", "s3"."SquadId0", "s3"."MissionId0" FROM "Squads" AS "s" LEFT JOIN ( - SELECT "s0"."SquadId", "s0"."MissionId", "m"."Id", "s2"."SquadId" AS "SquadId0", "s2"."MissionId" AS "MissionId0" + SELECT "s0"."SquadId", "s0"."MissionId", "s2"."SquadId" AS "SquadId0", "s2"."MissionId" AS "MissionId0" FROM "SquadMissions" AS "s0" INNER JOIN "Missions" AS "m" ON "s0"."MissionId" = "m"."Id" LEFT JOIN ( @@ -727,7 +727,7 @@ LEFT JOIN ( ) AS "s2" ON "m"."Id" = "s2"."MissionId" WHERE "s0"."MissionId" < 3 ) AS "s3" ON "s"."Id" = "s3"."SquadId" -ORDER BY "s"."Id", "s3"."SquadId", "s3"."MissionId", "s3"."Id", "s3"."SquadId0" +ORDER BY "s"."Id", "s3"."SquadId", "s3"."MissionId", "s3"."SquadId0" """); } @@ -823,7 +823,6 @@ public override async Task Left_join_with_GroupBy_with_composite_group_key(bool """ SELECT "g"."CityOfBirthName", "g"."HasSoulPatch" FROM "Gears" AS "g" -INNER JOIN "Squads" AS "s" ON "g"."SquadId" = "s"."Id" LEFT JOIN "Tags" AS "t" ON "g"."Nickname" = "t"."GearNickName" GROUP BY "g"."CityOfBirthName", "g"."HasSoulPatch" """); @@ -1114,12 +1113,12 @@ public override async Task Multiple_orderby_with_navigation_expansion_on_one_of_ AssertSql( """ -SELECT "g"."FullName", "g"."Nickname", "g"."SquadId", "t"."Id", "g1"."Nickname", "g1"."SquadId", "s"."Id", "s"."AmmunitionType", "s"."IsAutomatic", "s"."Name", "s"."OwnerFullName", "s"."SynergyWithId", "s"."Nickname", "s"."SquadId" +SELECT "g"."FullName", "g"."Nickname", "g"."SquadId", "s"."Id", "s"."AmmunitionType", "s"."IsAutomatic", "s"."Name", "s"."OwnerFullName", "s"."SynergyWithId" FROM "Gears" AS "g" LEFT JOIN "Tags" AS "t" ON "g"."Nickname" = "t"."GearNickName" AND "g"."SquadId" = "t"."GearSquadId" LEFT JOIN "Gears" AS "g1" ON "t"."GearNickName" = "g1"."Nickname" AND "t"."GearSquadId" = "g1"."SquadId" LEFT JOIN ( - SELECT "w"."Id", "w"."AmmunitionType", "w"."IsAutomatic", "w"."Name", "w"."OwnerFullName", "w"."SynergyWithId", "g2"."Nickname", "g2"."SquadId" + SELECT "w"."Id", "w"."AmmunitionType", "w"."IsAutomatic", "w"."Name", "w"."OwnerFullName", "w"."SynergyWithId", "g2"."Nickname" FROM "Weapons" AS "w" LEFT JOIN "Gears" AS "g2" ON "w"."OwnerFullName" = "g2"."FullName" ) AS "s" ON "g1"."FullName" = "s"."OwnerFullName" @@ -1127,7 +1126,7 @@ LEFT JOIN ( SELECT 1 FROM "Gears" AS "g0" WHERE "g"."Nickname" = "g0"."LeaderNickname" AND "g"."SquadId" = "g0"."LeaderSquadId") -ORDER BY "g"."HasSoulPatch" DESC, "t"."Note", "g"."Nickname", "g"."SquadId", "t"."Id", "g1"."Nickname", "g1"."SquadId", "s"."IsAutomatic", "s"."Nickname" DESC, "s"."Id" +ORDER BY "g"."HasSoulPatch" DESC, "t"."Note", "g"."Nickname", "g"."SquadId", "s"."IsAutomatic", "s"."Nickname" DESC """); } @@ -1303,7 +1302,7 @@ public override async Task Correlated_collections_from_left_join_with_additional AssertSql( """ -SELECT "w"."Id", "g"."Nickname", "g"."SquadId", "s"."Id", "s0"."Nickname", "s0"."SquadId", "s0"."Id", "s0"."AmmunitionType", "s0"."IsAutomatic", "s0"."Name", "s0"."OwnerFullName", "s0"."SynergyWithId", "s0"."Rank" +SELECT "w"."Id", "s0"."Nickname", "s0"."SquadId", "s0"."Id", "s0"."AmmunitionType", "s0"."IsAutomatic", "s0"."Name", "s0"."OwnerFullName", "s0"."SynergyWithId", "s0"."Rank" FROM "Weapons" AS "w" LEFT JOIN "Gears" AS "g" ON "w"."OwnerFullName" = "g"."FullName" LEFT JOIN "Squads" AS "s" ON "g"."SquadId" = "s"."Id" @@ -1316,7 +1315,7 @@ LEFT JOIN ( WHERE NOT ("w0"."IsAutomatic") ) AS "w1" ON "g0"."FullName" = "w1"."OwnerFullName" ) AS "s0" ON "s"."Id" = "s0"."SquadId" -ORDER BY "w"."Name", "w"."Id", "g"."Nickname", "g"."SquadId", "s"."Id", "s0"."FullName" DESC, "s0"."Nickname", "s0"."SquadId", "s0"."Id" +ORDER BY "w"."Name", "w"."Id", "s0"."FullName" DESC, "s0"."Nickname", "s0"."SquadId", "s0"."Id" """); } @@ -1400,7 +1399,7 @@ public override async Task Correlated_collection_take(bool async) AssertSql( """ -SELECT "g"."Nickname", "g"."SquadId", "c"."Name", "w1"."Id", "w1"."AmmunitionType", "w1"."IsAutomatic", "w1"."Name", "w1"."OwnerFullName", "w1"."SynergyWithId", "c"."Location", "c"."Nation" +SELECT "g"."Nickname", "g"."SquadId", "w1"."Id", "w1"."AmmunitionType", "w1"."IsAutomatic", "w1"."Name", "w1"."OwnerFullName", "w1"."SynergyWithId", "c"."Name", "c"."Location", "c"."Nation" FROM "Gears" AS "g" INNER JOIN "Cities" AS "c" ON "g"."CityOfBirthName" = "c"."Name" LEFT JOIN ( @@ -1411,7 +1410,7 @@ LEFT JOIN ( ) AS "w0" WHERE "w0"."row" <= 10 ) AS "w1" ON "g"."FullName" = "w1"."OwnerFullName" -ORDER BY "g"."Nickname", "g"."SquadId", "c"."Name" +ORDER BY "g"."Nickname", "g"."SquadId" """); } @@ -1485,14 +1484,14 @@ public override async Task Accessing_reference_navigation_collection_composition AssertSql( """ -SELECT "g"."Nickname", "g"."SquadId", "s"."Id", "s"."IsAutomatic", "s"."Name", "s"."Id0" +SELECT "g"."Nickname", "g"."SquadId", "s"."Id", "s"."IsAutomatic", "s"."Name" FROM "Gears" AS "g" LEFT JOIN ( - SELECT "w"."Id", "w"."IsAutomatic", "w0"."Name", "w0"."Id" AS "Id0", "w"."OwnerFullName" + SELECT "w"."Id", "w"."IsAutomatic", "w0"."Name", "w"."OwnerFullName" FROM "Weapons" AS "w" LEFT JOIN "Weapons" AS "w0" ON "w"."SynergyWithId" = "w0"."Id" ) AS "s" ON "g"."FullName" = "s"."OwnerFullName" -ORDER BY "g"."Nickname", "g"."SquadId", "s"."Id" +ORDER BY "g"."Nickname", "g"."SquadId" """); } @@ -1638,7 +1637,7 @@ public override async Task Project_collection_navigation_with_inheritance1(bool AssertSql( """ -SELECT "f"."Id", "l0"."Name", "f0"."Id", "l1"."Name", "l1"."Discriminator", "l1"."LocustHordeId", "l1"."ThreatLevel", "l1"."ThreatLevelByte", "l1"."ThreatLevelNullableByte", "l1"."DefeatedByNickname", "l1"."DefeatedBySquadId", "l1"."HighCommandId" +SELECT "f"."Id", "l1"."Name", "l1"."Discriminator", "l1"."LocustHordeId", "l1"."ThreatLevel", "l1"."ThreatLevelByte", "l1"."ThreatLevelNullableByte", "l1"."DefeatedByNickname", "l1"."DefeatedBySquadId", "l1"."HighCommandId" FROM "Factions" AS "f" LEFT JOIN ( SELECT "l"."Name" @@ -1647,7 +1646,7 @@ LEFT JOIN ( ) AS "l0" ON "f"."CommanderName" = "l0"."Name" LEFT JOIN "Factions" AS "f0" ON "l0"."Name" = "f0"."CommanderName" LEFT JOIN "LocustLeaders" AS "l1" ON "f0"."Id" = "l1"."LocustHordeId" -ORDER BY "f"."Id", "l0"."Name", "f0"."Id" +ORDER BY "f"."Id" """); } @@ -1969,7 +1968,7 @@ public override async Task Cast_to_derived_followed_by_multiple_includes(bool as LEFT JOIN "Gears" AS "g" ON "l"."DefeatedByNickname" = "g"."Nickname" AND "l"."DefeatedBySquadId" = "g"."SquadId" LEFT JOIN "Weapons" AS "w" ON "g"."FullName" = "w"."OwnerFullName" WHERE instr("l"."Name", 'Queen') > 0 -ORDER BY "l"."Name", "g"."Nickname", "g"."SquadId" +ORDER BY "l"."Name" """); } @@ -2033,7 +2032,7 @@ LEFT JOIN ( ) AS "w1" WHERE "w1"."row" <= 1 ) AS "w2" ON "g"."FullName" = "w2"."OwnerFullName" -ORDER BY "g"."Nickname", "g"."SquadId", "s"."Id" +ORDER BY "g"."Nickname", "g"."SquadId" """); } @@ -2118,12 +2117,12 @@ public override async Task Multiple_orderby_with_navigation_expansion_on_one_of_ AssertSql( """ -SELECT "g"."FullName", "g"."Nickname", "g"."SquadId", "t"."Id", "g1"."Nickname", "g1"."SquadId", "s"."Id", "s"."AmmunitionType", "s"."IsAutomatic", "s"."Name", "s"."OwnerFullName", "s"."SynergyWithId", "s"."Nickname", "s"."SquadId" +SELECT "g"."FullName", "g"."Nickname", "g"."SquadId", "s"."Id", "s"."AmmunitionType", "s"."IsAutomatic", "s"."Name", "s"."OwnerFullName", "s"."SynergyWithId" FROM "Gears" AS "g" LEFT JOIN "Tags" AS "t" ON "g"."Nickname" = "t"."GearNickName" AND "g"."SquadId" = "t"."GearSquadId" LEFT JOIN "Gears" AS "g1" ON "t"."GearNickName" = "g1"."Nickname" AND "t"."GearSquadId" = "g1"."SquadId" LEFT JOIN ( - SELECT "w"."Id", "w"."AmmunitionType", "w"."IsAutomatic", "w"."Name", "w"."OwnerFullName", "w"."SynergyWithId", "g2"."Nickname", "g2"."SquadId" + SELECT "w"."Id", "w"."AmmunitionType", "w"."IsAutomatic", "w"."Name", "w"."OwnerFullName", "w"."SynergyWithId", "g2"."Nickname" FROM "Weapons" AS "w" LEFT JOIN "Gears" AS "g2" ON "w"."OwnerFullName" = "g2"."FullName" ) AS "s" ON "g1"."FullName" = "s"."OwnerFullName" @@ -2131,7 +2130,7 @@ LEFT JOIN ( SELECT 1 FROM "Gears" AS "g0" WHERE "g"."Nickname" = "g0"."LeaderNickname" AND "g"."SquadId" = "g0"."LeaderSquadId") -ORDER BY "g"."HasSoulPatch" DESC, "t"."Note", "g"."Nickname", "g"."SquadId", "t"."Id", "g1"."Nickname", "g1"."SquadId", "s"."IsAutomatic", "s"."Nickname" DESC, "s"."Id" +ORDER BY "g"."HasSoulPatch" DESC, "t"."Note", "g"."Nickname", "g"."SquadId", "s"."IsAutomatic", "s"."Nickname" DESC """); } @@ -2700,7 +2699,7 @@ public override async Task Project_collection_navigation_nested_with_take_compos AssertSql( """ -SELECT "t"."Id", "g"."Nickname", "g"."SquadId", "g2"."Nickname", "g2"."SquadId", "g2"."AssignedCityName", "g2"."CityOfBirthName", "g2"."Discriminator", "g2"."FullName", "g2"."HasSoulPatch", "g2"."LeaderNickname", "g2"."LeaderSquadId", "g2"."Rank" +SELECT "t"."Id", "g2"."Nickname", "g2"."SquadId", "g2"."AssignedCityName", "g2"."CityOfBirthName", "g2"."Discriminator", "g2"."FullName", "g2"."HasSoulPatch", "g2"."LeaderNickname", "g2"."LeaderSquadId", "g2"."Rank" FROM "Tags" AS "t" LEFT JOIN "Gears" AS "g" ON "t"."GearNickName" = "g"."Nickname" AND "t"."GearSquadId" = "g"."SquadId" LEFT JOIN ( @@ -2712,7 +2711,7 @@ LEFT JOIN ( WHERE "g1"."row" <= 50 ) AS "g2" ON ("g"."Nickname" = "g2"."LeaderNickname" OR ("g"."Nickname" IS NULL AND "g2"."LeaderNickname" IS NULL)) AND "g"."SquadId" = "g2"."LeaderSquadId" WHERE "g"."Discriminator" = 'Officer' -ORDER BY "t"."Id", "g"."Nickname", "g"."SquadId", "g2"."Nickname" +ORDER BY "t"."Id", "g2"."Nickname" """); } @@ -3101,7 +3100,7 @@ public override async Task Include_multiple_one_to_one_and_one_to_many(bool asyn FROM "Tags" AS "t" LEFT JOIN "Gears" AS "g" ON "t"."GearNickName" = "g"."Nickname" AND "t"."GearSquadId" = "g"."SquadId" LEFT JOIN "Weapons" AS "w" ON "g"."FullName" = "w"."OwnerFullName" -ORDER BY "t"."Id", "g"."Nickname", "g"."SquadId" +ORDER BY "t"."Id" """); } @@ -3387,16 +3386,16 @@ public override async Task Correlated_collections_with_funky_orderby_complex_sce AssertSql( """ -SELECT "g"."FullName", "g"."Nickname", "g"."SquadId", "s0"."Id", "s0"."Nickname", "s0"."SquadId", "s0"."Id0", "s0"."Nickname0", "s0"."HasSoulPatch", "s0"."SquadId0" +SELECT "g"."FullName", "g"."Nickname", "g"."SquadId", "s0"."Id", "s0"."Nickname", "s0"."HasSoulPatch", "s0"."SquadId" FROM "Gears" AS "g" LEFT JOIN ( - SELECT "w"."Id", "g0"."Nickname", "g0"."SquadId", "s"."Id" AS "Id0", "g1"."Nickname" AS "Nickname0", "g1"."HasSoulPatch", "g1"."SquadId" AS "SquadId0", "w"."OwnerFullName" + SELECT "w"."Id", "g1"."Nickname", "g1"."HasSoulPatch", "g1"."SquadId", "w"."OwnerFullName" FROM "Weapons" AS "w" LEFT JOIN "Gears" AS "g0" ON "w"."OwnerFullName" = "g0"."FullName" LEFT JOIN "Squads" AS "s" ON "g0"."SquadId" = "s"."Id" LEFT JOIN "Gears" AS "g1" ON "s"."Id" = "g1"."SquadId" ) AS "s0" ON "g"."FullName" = "s0"."OwnerFullName" -ORDER BY "g"."FullName", "g"."Nickname" DESC, "g"."SquadId", "s0"."Id", "s0"."Nickname", "s0"."SquadId", "s0"."Id0", "s0"."Nickname0" +ORDER BY "g"."FullName", "g"."Nickname" DESC, "g"."SquadId", "s0"."Id", "s0"."Nickname" """); } @@ -3929,7 +3928,7 @@ LEFT JOIN ( FROM "Gears" AS "g0" INNER JOIN "Cities" AS "c" ON "g0"."CityOfBirthName" = "c"."Name" ) AS "s" ON ("g"."Nickname" = "s"."LeaderNickname" OR ("g"."Nickname" IS NULL AND "s"."LeaderNickname" IS NULL)) AND "g"."SquadId" = "s"."LeaderSquadId" -ORDER BY "l"."Name", "g"."Nickname", "g"."SquadId", "s"."Nickname", "s"."SquadId" +ORDER BY "l"."Name", "s"."Nickname" """); } @@ -3965,16 +3964,16 @@ public override async Task Correlated_collections_complex_scenario1(bool async) AssertSql( """ -SELECT "g"."FullName", "g"."Nickname", "g"."SquadId", "s0"."Id", "s0"."Nickname", "s0"."SquadId", "s0"."Id0", "s0"."Nickname0", "s0"."HasSoulPatch", "s0"."SquadId0" +SELECT "g"."FullName", "g"."Nickname", "g"."SquadId", "s0"."Id", "s0"."Nickname", "s0"."HasSoulPatch", "s0"."SquadId" FROM "Gears" AS "g" LEFT JOIN ( - SELECT "w"."Id", "g0"."Nickname", "g0"."SquadId", "s"."Id" AS "Id0", "g1"."Nickname" AS "Nickname0", "g1"."HasSoulPatch", "g1"."SquadId" AS "SquadId0", "w"."OwnerFullName" + SELECT "w"."Id", "g1"."Nickname", "g1"."HasSoulPatch", "g1"."SquadId", "w"."OwnerFullName" FROM "Weapons" AS "w" LEFT JOIN "Gears" AS "g0" ON "w"."OwnerFullName" = "g0"."FullName" LEFT JOIN "Squads" AS "s" ON "g0"."SquadId" = "s"."Id" LEFT JOIN "Gears" AS "g1" ON "s"."Id" = "g1"."SquadId" ) AS "s0" ON "g"."FullName" = "s0"."OwnerFullName" -ORDER BY "g"."Nickname", "g"."SquadId", "s0"."Id", "s0"."Nickname", "s0"."SquadId", "s0"."Id0", "s0"."Nickname0" +ORDER BY "g"."Nickname", "g"."SquadId", "s0"."Id", "s0"."Nickname" """); } @@ -4456,10 +4455,10 @@ public override async Task Correlated_collections_nested_mixed_streaming_with_bu AssertSql( """ -SELECT "s"."Id", "s3"."SquadId", "s3"."MissionId", "s3"."Id", "s3"."SquadId0", "s3"."MissionId0" +SELECT "s"."Id", "s3"."SquadId", "s3"."MissionId", "s3"."SquadId0", "s3"."MissionId0" FROM "Squads" AS "s" LEFT JOIN ( - SELECT "s0"."SquadId", "s0"."MissionId", "m"."Id", "s2"."SquadId" AS "SquadId0", "s2"."MissionId" AS "MissionId0" + SELECT "s0"."SquadId", "s0"."MissionId", "s2"."SquadId" AS "SquadId0", "s2"."MissionId" AS "MissionId0" FROM "SquadMissions" AS "s0" INNER JOIN "Missions" AS "m" ON "s0"."MissionId" = "m"."Id" LEFT JOIN ( @@ -4469,7 +4468,7 @@ LEFT JOIN ( ) AS "s2" ON "m"."Id" = "s2"."MissionId" WHERE "s0"."MissionId" < 42 ) AS "s3" ON "s"."Id" = "s3"."SquadId" -ORDER BY "s"."Id", "s3"."SquadId", "s3"."MissionId", "s3"."Id", "s3"."SquadId0" +ORDER BY "s"."Id", "s3"."SquadId", "s3"."MissionId", "s3"."SquadId0" """); } @@ -4826,12 +4825,12 @@ public override async Task Project_collection_navigation_nested_composite_key(bo AssertSql( """ -SELECT "t"."Id", "g"."Nickname", "g"."SquadId", "g0"."Nickname", "g0"."SquadId", "g0"."AssignedCityName", "g0"."CityOfBirthName", "g0"."Discriminator", "g0"."FullName", "g0"."HasSoulPatch", "g0"."LeaderNickname", "g0"."LeaderSquadId", "g0"."Rank" +SELECT "t"."Id", "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" WHERE "g"."Discriminator" = 'Officer' -ORDER BY "t"."Id", "g"."Nickname", "g"."SquadId", "g0"."Nickname" +ORDER BY "t"."Id", "g0"."Nickname" """); } @@ -4975,7 +4974,7 @@ public override async Task Include_multiple_circular_with_filter(bool async) INNER JOIN "Cities" AS "c" ON "g"."CityOfBirthName" = "c"."Name" LEFT JOIN "Gears" AS "g0" ON "c"."Name" = "g0"."AssignedCityName" WHERE "g"."Nickname" = 'Marcus' -ORDER BY "g"."Nickname", "g"."SquadId", "c"."Name", "g0"."Nickname" +ORDER BY "g"."Nickname", "g"."SquadId", "g0"."Nickname" """); } @@ -5092,11 +5091,6 @@ public override async Task Where_subquery_left_join_firstordefault_boolean(bool WHERE "g"."HasSoulPatch" AND ( SELECT "w"."IsAutomatic" FROM "Weapons" AS "w" - LEFT JOIN ( - SELECT "w0"."Id" - FROM "Weapons" AS "w0" - WHERE "g"."FullName" = "w0"."OwnerFullName" - ) AS "w1" ON "w"."Id" = "w1"."Id" WHERE "g"."FullName" = "w"."OwnerFullName" ORDER BY "w"."Id" LIMIT 1) @@ -5337,7 +5331,7 @@ LEFT JOIN ( INNER JOIN "Squads" AS "s" ON "g0"."SquadId" = "s"."Id" LEFT JOIN "SquadMissions" AS "s0" ON "s"."Id" = "s0"."SquadId" ) AS "s1" ON "g"."Nickname" = "s1"."LeaderNickname" AND "g"."SquadId" = "s1"."LeaderSquadId" -ORDER BY "g"."Nickname", "g"."SquadId", "s1"."Nickname", "s1"."SquadId", "s1"."Id", "s1"."SquadId0" +ORDER BY "g"."Nickname", "g"."SquadId", "s1"."Nickname", "s1"."SquadId", "s1"."SquadId0" """); } @@ -5664,7 +5658,7 @@ public override async Task Include_multiple_circular(bool async) FROM "Gears" AS "g" INNER JOIN "Cities" AS "c" ON "g"."CityOfBirthName" = "c"."Name" LEFT JOIN "Gears" AS "g0" ON "c"."Name" = "g0"."AssignedCityName" -ORDER BY "g"."Nickname", "g"."SquadId", "c"."Name", "g0"."Nickname" +ORDER BY "g"."Nickname", "g"."SquadId", "g0"."Nickname" """); } @@ -5764,7 +5758,7 @@ public override async Task Include_base_navigation_on_derived_entity(bool async) FROM "Gears" AS "g" LEFT JOIN "Tags" AS "t" ON "g"."Nickname" = "t"."GearNickName" AND "g"."SquadId" = "t"."GearSquadId" LEFT JOIN "Weapons" AS "w" ON "g"."FullName" = "w"."OwnerFullName" -ORDER BY "g"."Nickname", "g"."SquadId", "t"."Id" +ORDER BY "g"."Nickname", "g"."SquadId" """); } @@ -5887,7 +5881,7 @@ public override async Task Select_correlated_filtered_collection(bool async) AssertSql( """ -SELECT "g"."Nickname", "g"."SquadId", "c"."Name", "w0"."Id", "w0"."AmmunitionType", "w0"."IsAutomatic", "w0"."Name", "w0"."OwnerFullName", "w0"."SynergyWithId" +SELECT "g"."Nickname", "g"."SquadId", "w0"."Id", "w0"."AmmunitionType", "w0"."IsAutomatic", "w0"."Name", "w0"."OwnerFullName", "w0"."SynergyWithId" FROM "Gears" AS "g" INNER JOIN "Cities" AS "c" ON "g"."CityOfBirthName" = "c"."Name" LEFT JOIN ( @@ -5896,7 +5890,7 @@ LEFT JOIN ( WHERE "w"."Name" <> 'Lancer' OR "w"."Name" IS NULL ) AS "w0" ON "g"."FullName" = "w0"."OwnerFullName" WHERE "c"."Name" IN ('Ephyra', 'Hanover') -ORDER BY "g"."Nickname", "g"."SquadId", "c"."Name" +ORDER BY "g"."Nickname", "g"."SquadId" """); } @@ -5907,12 +5901,12 @@ public override async Task Multiple_orderby_with_navigation_expansion_on_one_of_ AssertSql( """ -SELECT "g"."FullName", "g"."Nickname", "g"."SquadId", "t"."Id", "g1"."Nickname", "g1"."SquadId", "s"."Id", "s"."AmmunitionType", "s"."IsAutomatic", "s"."Name", "s"."OwnerFullName", "s"."SynergyWithId", "s"."Nickname", "s"."SquadId" +SELECT "g"."FullName", "g"."Nickname", "g"."SquadId", "s"."Id", "s"."AmmunitionType", "s"."IsAutomatic", "s"."Name", "s"."OwnerFullName", "s"."SynergyWithId" FROM "Gears" AS "g" LEFT JOIN "Tags" AS "t" ON "g"."Nickname" = "t"."GearNickName" AND "g"."SquadId" = "t"."GearSquadId" LEFT JOIN "Gears" AS "g1" ON "t"."GearNickName" = "g1"."Nickname" AND "t"."GearSquadId" = "g1"."SquadId" LEFT JOIN ( - SELECT "w"."Id", "w"."AmmunitionType", "w"."IsAutomatic", "w"."Name", "w"."OwnerFullName", "w"."SynergyWithId", "g2"."Nickname", "g2"."SquadId", ( + SELECT "w"."Id", "w"."AmmunitionType", "w"."IsAutomatic", "w"."Name", "w"."OwnerFullName", "w"."SynergyWithId", ( SELECT COUNT(*) FROM "Weapons" AS "w0" WHERE "g2"."FullName" IS NOT NULL AND "g2"."FullName" = "w0"."OwnerFullName") AS "c" @@ -5923,7 +5917,7 @@ SELECT COUNT(*) SELECT 1 FROM "Gears" AS "g0" WHERE "g"."Nickname" = "g0"."LeaderNickname" AND "g"."SquadId" = "g0"."LeaderSquadId") -ORDER BY "g"."HasSoulPatch" DESC, "t"."Note", "g"."Nickname", "g"."SquadId", "t"."Id", "g1"."Nickname", "g1"."SquadId", "s"."Id" DESC, "s"."c", "s"."Nickname" +ORDER BY "g"."HasSoulPatch" DESC, "t"."Note", "g"."Nickname", "g"."SquadId", "s"."Id" DESC, "s"."c" """); } @@ -5945,10 +5939,10 @@ public override async Task Correlated_collections_nested(bool async) AssertSql( """ -SELECT "s"."Id", "s3"."SquadId", "s3"."MissionId", "s3"."Id", "s3"."SquadId0", "s3"."MissionId0" +SELECT "s"."Id", "s3"."SquadId", "s3"."MissionId", "s3"."SquadId0", "s3"."MissionId0" FROM "Squads" AS "s" LEFT JOIN ( - SELECT "s0"."SquadId", "s0"."MissionId", "m"."Id", "s2"."SquadId" AS "SquadId0", "s2"."MissionId" AS "MissionId0" + SELECT "s0"."SquadId", "s0"."MissionId", "s2"."SquadId" AS "SquadId0", "s2"."MissionId" AS "MissionId0" FROM "SquadMissions" AS "s0" INNER JOIN "Missions" AS "m" ON "s0"."MissionId" = "m"."Id" LEFT JOIN ( @@ -5958,7 +5952,7 @@ LEFT JOIN ( ) AS "s2" ON "m"."Id" = "s2"."MissionId" WHERE "s0"."MissionId" < 42 ) AS "s3" ON "s"."Id" = "s3"."SquadId" -ORDER BY "s"."Id", "s3"."SquadId", "s3"."MissionId", "s3"."Id", "s3"."SquadId0" +ORDER BY "s"."Id", "s3"."SquadId", "s3"."MissionId", "s3"."SquadId0" """); } @@ -6008,7 +6002,7 @@ LEFT JOIN ( FROM "LocustLeaders" AS "l" LEFT JOIN "Gears" AS "g" ON "l"."DefeatedByNickname" = "g"."Nickname" AND "l"."DefeatedBySquadId" = "g"."SquadId" ) AS "s" ON "f"."Id" = "s"."LocustHordeId" -ORDER BY "f"."Id", "s"."Name", "s"."Nickname" +ORDER BY "f"."Id" """); } @@ -6018,15 +6012,15 @@ public override async Task Accessing_property_of_optional_navigation_in_child_pr AssertSql( """ -SELECT "g"."Nickname" IS NOT NULL AND "g"."SquadId" IS NOT NULL, "t"."Id", "g"."Nickname", "g"."SquadId", "s"."Nickname", "s"."Id", "s"."SquadId" +SELECT "g"."Nickname" IS NOT NULL AND "g"."SquadId" IS NOT NULL, "t"."Id", "s"."Nickname", "s"."Id" FROM "Tags" AS "t" LEFT JOIN "Gears" AS "g" ON "t"."GearNickName" = "g"."Nickname" AND "t"."GearSquadId" = "g"."SquadId" LEFT JOIN ( - SELECT "g0"."Nickname", "w"."Id", "g0"."SquadId", "w"."OwnerFullName" + SELECT "g0"."Nickname", "w"."Id", "w"."OwnerFullName" FROM "Weapons" AS "w" LEFT JOIN "Gears" AS "g0" ON "w"."OwnerFullName" = "g0"."FullName" ) AS "s" ON "g"."FullName" = "s"."OwnerFullName" -ORDER BY "t"."Note", "t"."Id", "g"."Nickname", "g"."SquadId", "s"."Id", "s"."Nickname" +ORDER BY "t"."Note", "t"."Id" """); } @@ -6045,7 +6039,7 @@ LEFT JOIN ( ) AS "l0" ON "f"."CommanderName" = "l0"."Name" LEFT JOIN "Gears" AS "g" ON "l0"."DefeatedByNickname" = "g"."Nickname" AND "l0"."DefeatedBySquadId" = "g"."SquadId" LEFT JOIN "Gears" AS "g0" ON ("g"."Nickname" = "g0"."LeaderNickname" OR ("g"."Nickname" IS NULL AND "g0"."LeaderNickname" IS NULL)) AND "g"."SquadId" = "g0"."LeaderSquadId" -ORDER BY "f"."Id", "l0"."Name", "g"."Nickname", "g"."SquadId", "g0"."Nickname" +ORDER BY "f"."Id", "g0"."Nickname" """); } @@ -6104,15 +6098,15 @@ public override async Task Correlated_collections_multiple_nested_complex_collec AssertSql( """ -SELECT "g"."FullName", "g"."Nickname", "g"."SquadId", "t"."Id", "g1"."Nickname", "g1"."SquadId", "s1"."FullName", "s1"."Nickname", "s1"."SquadId", "s1"."Id", "s1"."Nickname0", "s1"."SquadId0", "s1"."Id0", "s1"."Name", "s1"."IsAutomatic", "s1"."Id1", "s1"."Nickname00", "s1"."HasSoulPatch", "s1"."SquadId00", "s2"."Id", "s2"."AmmunitionType", "s2"."IsAutomatic", "s2"."Name", "s2"."OwnerFullName", "s2"."SynergyWithId", "s2"."Nickname", "s2"."SquadId" +SELECT "g"."FullName", "g"."Nickname", "g"."SquadId", "s1"."FullName", "s1"."Nickname", "s1"."SquadId", "s1"."Id", "s1"."Name", "s1"."IsAutomatic", "s1"."Id0", "s1"."Nickname0", "s1"."HasSoulPatch", "s1"."SquadId0", "s2"."Id", "s2"."AmmunitionType", "s2"."IsAutomatic", "s2"."Name", "s2"."OwnerFullName", "s2"."SynergyWithId" FROM "Gears" AS "g" LEFT JOIN "Tags" AS "t" ON "g"."Nickname" = "t"."GearNickName" AND "g"."SquadId" = "t"."GearSquadId" LEFT JOIN "Gears" AS "g1" ON "t"."GearNickName" = "g1"."Nickname" AND "t"."GearSquadId" = "g1"."SquadId" LEFT JOIN ( - SELECT "g2"."FullName", "g2"."Nickname", "g2"."SquadId", "s0"."Id", "s0"."Nickname" AS "Nickname0", "s0"."SquadId" AS "SquadId0", "s0"."Id0", "s0"."Name", "s0"."IsAutomatic", "s0"."Id1", "s0"."Nickname0" AS "Nickname00", "s0"."HasSoulPatch", "s0"."SquadId0" AS "SquadId00", "g2"."Rank", "s0"."IsAutomatic0", "g2"."LeaderNickname", "g2"."LeaderSquadId" + SELECT "g2"."FullName", "g2"."Nickname", "g2"."SquadId", "s0"."Id", "s0"."Name", "s0"."IsAutomatic", "s0"."Id0", "s0"."Nickname" AS "Nickname0", "s0"."HasSoulPatch", "s0"."SquadId" AS "SquadId0", "g2"."Rank", "s0"."IsAutomatic0", "g2"."LeaderNickname", "g2"."LeaderSquadId" FROM "Gears" AS "g2" LEFT JOIN ( - SELECT "w"."Id", "g3"."Nickname", "g3"."SquadId", "s"."Id" AS "Id0", "w0"."Name", "w0"."IsAutomatic", "w0"."Id" AS "Id1", "g4"."Nickname" AS "Nickname0", "g4"."HasSoulPatch", "g4"."SquadId" AS "SquadId0", "w"."IsAutomatic" AS "IsAutomatic0", "w"."OwnerFullName" + SELECT "w"."Id", "w0"."Name", "w0"."IsAutomatic", "w0"."Id" AS "Id0", "g4"."Nickname", "g4"."HasSoulPatch", "g4"."SquadId", "w"."IsAutomatic" AS "IsAutomatic0", "w"."OwnerFullName" FROM "Weapons" AS "w" LEFT JOIN "Gears" AS "g3" ON "w"."OwnerFullName" = "g3"."FullName" LEFT JOIN "Squads" AS "s" ON "g3"."SquadId" = "s"."Id" @@ -6123,7 +6117,7 @@ LEFT JOIN ( WHERE "g2"."FullName" <> 'Foo' ) AS "s1" ON "g"."Nickname" = "s1"."LeaderNickname" AND "g"."SquadId" = "s1"."LeaderSquadId" LEFT JOIN ( - SELECT "w1"."Id", "w1"."AmmunitionType", "w1"."IsAutomatic", "w1"."Name", "w1"."OwnerFullName", "w1"."SynergyWithId", "g5"."Nickname", "g5"."SquadId" + SELECT "w1"."Id", "w1"."AmmunitionType", "w1"."IsAutomatic", "w1"."Name", "w1"."OwnerFullName", "w1"."SynergyWithId", "g5"."Nickname" FROM "Weapons" AS "w1" LEFT JOIN "Gears" AS "g5" ON "w1"."OwnerFullName" = "g5"."FullName" ) AS "s2" ON "g1"."FullName" = "s2"."OwnerFullName" @@ -6131,7 +6125,7 @@ LEFT JOIN ( SELECT 1 FROM "Gears" AS "g0" WHERE "g"."Nickname" = "g0"."LeaderNickname" AND "g"."SquadId" = "g0"."LeaderSquadId") -ORDER BY "g"."HasSoulPatch" DESC, "t"."Note", "g"."Nickname", "g"."SquadId", "t"."Id", "g1"."Nickname", "g1"."SquadId", "s1"."Rank", "s1"."Nickname", "s1"."SquadId", "s1"."IsAutomatic0", "s1"."Id", "s1"."Nickname0", "s1"."SquadId0", "s1"."Id0", "s1"."Id1", "s1"."Nickname00", "s1"."SquadId00", "s2"."IsAutomatic", "s2"."Nickname" DESC, "s2"."Id" +ORDER BY "g"."HasSoulPatch" DESC, "t"."Note", "g"."Nickname", "g"."SquadId", "s1"."Rank", "s1"."Nickname", "s1"."SquadId", "s1"."IsAutomatic0", "s1"."Id", "s1"."Id0", "s1"."Nickname0", "s1"."SquadId0", "s2"."IsAutomatic", "s2"."Nickname" DESC """); } @@ -6229,9 +6223,9 @@ public override async Task Include_on_derived_type_with_order_by_and_paging(bool """ @p='10' -SELECT "s"."Name", "s"."Discriminator", "s"."LocustHordeId", "s"."ThreatLevel", "s"."ThreatLevelByte", "s"."ThreatLevelNullableByte", "s"."DefeatedByNickname", "s"."DefeatedBySquadId", "s"."HighCommandId", "s"."Nickname", "s"."SquadId", "s"."AssignedCityName", "s"."CityOfBirthName", "s"."Discriminator0", "s"."FullName", "s"."HasSoulPatch", "s"."LeaderNickname", "s"."LeaderSquadId", "s"."Rank", "s"."Id", "w"."Id", "w"."AmmunitionType", "w"."IsAutomatic", "w"."Name", "w"."OwnerFullName", "w"."SynergyWithId" +SELECT "s"."Name", "s"."Discriminator", "s"."LocustHordeId", "s"."ThreatLevel", "s"."ThreatLevelByte", "s"."ThreatLevelNullableByte", "s"."DefeatedByNickname", "s"."DefeatedBySquadId", "s"."HighCommandId", "s"."Nickname", "s"."SquadId", "s"."AssignedCityName", "s"."CityOfBirthName", "s"."Discriminator0", "s"."FullName", "s"."HasSoulPatch", "s"."LeaderNickname", "s"."LeaderSquadId", "s"."Rank", "w"."Id", "w"."AmmunitionType", "w"."IsAutomatic", "w"."Name", "w"."OwnerFullName", "w"."SynergyWithId" FROM ( - SELECT "l"."Name", "l"."Discriminator", "l"."LocustHordeId", "l"."ThreatLevel", "l"."ThreatLevelByte", "l"."ThreatLevelNullableByte", "l"."DefeatedByNickname", "l"."DefeatedBySquadId", "l"."HighCommandId", "g"."Nickname", "g"."SquadId", "g"."AssignedCityName", "g"."CityOfBirthName", "g"."Discriminator" AS "Discriminator0", "g"."FullName", "g"."HasSoulPatch", "g"."LeaderNickname", "g"."LeaderSquadId", "g"."Rank", "t"."Id", "t"."Note" + SELECT "l"."Name", "l"."Discriminator", "l"."LocustHordeId", "l"."ThreatLevel", "l"."ThreatLevelByte", "l"."ThreatLevelNullableByte", "l"."DefeatedByNickname", "l"."DefeatedBySquadId", "l"."HighCommandId", "g"."Nickname", "g"."SquadId", "g"."AssignedCityName", "g"."CityOfBirthName", "g"."Discriminator" AS "Discriminator0", "g"."FullName", "g"."HasSoulPatch", "g"."LeaderNickname", "g"."LeaderSquadId", "g"."Rank", "t"."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)) @@ -6239,7 +6233,7 @@ ORDER BY "t"."Note" LIMIT @p ) AS "s" LEFT JOIN "Weapons" AS "w" ON "s"."FullName" = "w"."OwnerFullName" -ORDER BY "s"."Note", "s"."Name", "s"."Nickname", "s"."SquadId", "s"."Id" +ORDER BY "s"."Note", "s"."Name" """); } @@ -6571,13 +6565,13 @@ public override async Task Correlated_collections_complex_scenario2(bool async) AssertSql( """ -SELECT "g"."FullName", "g"."Nickname", "g"."SquadId", "s1"."FullName", "s1"."Nickname", "s1"."SquadId", "s1"."Id", "s1"."Nickname0", "s1"."SquadId0", "s1"."Id0", "s1"."Nickname00", "s1"."HasSoulPatch", "s1"."SquadId00" +SELECT "g"."FullName", "g"."Nickname", "g"."SquadId", "s1"."FullName", "s1"."Nickname", "s1"."SquadId", "s1"."Id", "s1"."Nickname0", "s1"."HasSoulPatch", "s1"."SquadId0" FROM "Gears" AS "g" LEFT JOIN ( - SELECT "g0"."FullName", "g0"."Nickname", "g0"."SquadId", "s0"."Id", "s0"."Nickname" AS "Nickname0", "s0"."SquadId" AS "SquadId0", "s0"."Id0", "s0"."Nickname0" AS "Nickname00", "s0"."HasSoulPatch", "s0"."SquadId0" AS "SquadId00", "g0"."LeaderNickname", "g0"."LeaderSquadId" + SELECT "g0"."FullName", "g0"."Nickname", "g0"."SquadId", "s0"."Id", "s0"."Nickname" AS "Nickname0", "s0"."HasSoulPatch", "s0"."SquadId" AS "SquadId0", "g0"."LeaderNickname", "g0"."LeaderSquadId" FROM "Gears" AS "g0" LEFT JOIN ( - SELECT "w"."Id", "g1"."Nickname", "g1"."SquadId", "s"."Id" AS "Id0", "g2"."Nickname" AS "Nickname0", "g2"."HasSoulPatch", "g2"."SquadId" AS "SquadId0", "w"."OwnerFullName" + SELECT "w"."Id", "g2"."Nickname", "g2"."HasSoulPatch", "g2"."SquadId", "w"."OwnerFullName" FROM "Weapons" AS "w" LEFT JOIN "Gears" AS "g1" ON "w"."OwnerFullName" = "g1"."FullName" LEFT JOIN "Squads" AS "s" ON "g1"."SquadId" = "s"."Id" @@ -6585,7 +6579,7 @@ LEFT JOIN ( ) AS "s0" ON "g0"."FullName" = "s0"."OwnerFullName" ) AS "s1" ON "g"."Nickname" = "s1"."LeaderNickname" AND "g"."SquadId" = "s1"."LeaderSquadId" WHERE "g"."Discriminator" = 'Officer' -ORDER BY "g"."Nickname", "g"."SquadId", "s1"."Nickname", "s1"."SquadId", "s1"."Id", "s1"."Nickname0", "s1"."SquadId0", "s1"."Id0", "s1"."Nickname00" +ORDER BY "g"."Nickname", "g"."SquadId", "s1"."Nickname", "s1"."SquadId", "s1"."Id", "s1"."Nickname0" """); } @@ -6666,7 +6660,7 @@ public override async Task Include_with_join_multi_level(bool async) INNER JOIN "Tags" AS "t" ON "g"."SquadId" = "t"."GearSquadId" AND "g"."Nickname" = "t"."GearNickName" INNER JOIN "Cities" AS "c" ON "g"."CityOfBirthName" = "c"."Name" LEFT JOIN "Gears" AS "g0" ON "c"."Name" = "g0"."AssignedCityName" -ORDER BY "g"."Nickname", "g"."SquadId", "t"."Id", "c"."Name", "g0"."Nickname" +ORDER BY "g"."Nickname", "g"."SquadId", "t"."Id", "g0"."Nickname" """); } @@ -6746,7 +6740,7 @@ LEFT JOIN ( ) AS "l0" ON "f"."CommanderName" = "l0"."Name" LEFT JOIN "Gears" AS "g" ON "l0"."DefeatedByNickname" = "g"."Nickname" AND "l0"."DefeatedBySquadId" = "g"."SquadId" LEFT JOIN "Gears" AS "g0" ON ("g"."Nickname" = "g0"."LeaderNickname" OR ("g"."Nickname" IS NULL AND "g0"."LeaderNickname" IS NULL)) AND "g"."SquadId" = "g0"."LeaderSquadId" -ORDER BY "f"."Id", "l0"."Name", "g"."Nickname", "g"."SquadId", "g0"."Nickname" +ORDER BY "f"."Id", "g0"."Nickname" """); } @@ -6874,7 +6868,7 @@ GROUP BY "g"."Rank" LEFT JOIN ( SELECT "s"."Nickname", "s"."SquadId", "s"."AssignedCityName", "s"."CityOfBirthName", "s"."Discriminator", "s"."FullName", "s"."HasSoulPatch", "s"."LeaderNickname", "s"."LeaderSquadId", "s"."Rank", "s"."Name", "s"."Location", "s"."Nation" FROM ( - 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", ROW_NUMBER() OVER(PARTITION BY "g0"."Rank" ORDER BY "g0"."Nickname", "g0"."SquadId", "c"."Name") AS "row" + 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", ROW_NUMBER() OVER(PARTITION BY "g0"."Rank" ORDER BY "g0"."Nickname", "g0"."SquadId") AS "row" FROM "Gears" AS "g0" INNER JOIN "Cities" AS "c" ON "g0"."CityOfBirthName" = "c"."Name" WHERE "g0"."HasSoulPatch" @@ -7075,13 +7069,13 @@ public override async Task Correlated_collections_with_funky_orderby_complex_sce AssertSql( """ -SELECT "g"."FullName", "g"."Nickname", "g"."SquadId", "s1"."FullName", "s1"."Nickname", "s1"."SquadId", "s1"."Id", "s1"."Nickname0", "s1"."SquadId0", "s1"."Id0", "s1"."Nickname00", "s1"."HasSoulPatch", "s1"."SquadId00" +SELECT "g"."FullName", "g"."Nickname", "g"."SquadId", "s1"."FullName", "s1"."Nickname", "s1"."SquadId", "s1"."Id", "s1"."Nickname0", "s1"."HasSoulPatch", "s1"."SquadId0" FROM "Gears" AS "g" LEFT JOIN ( - SELECT "g0"."FullName", "g0"."Nickname", "g0"."SquadId", "s0"."Id", "s0"."Nickname" AS "Nickname0", "s0"."SquadId" AS "SquadId0", "s0"."Id0", "s0"."Nickname0" AS "Nickname00", "s0"."HasSoulPatch", "s0"."SquadId0" AS "SquadId00", "g0"."HasSoulPatch" AS "HasSoulPatch0", "s0"."IsAutomatic", "s0"."Name", "g0"."LeaderNickname", "g0"."LeaderSquadId" + SELECT "g0"."FullName", "g0"."Nickname", "g0"."SquadId", "s0"."Id", "s0"."Nickname" AS "Nickname0", "s0"."HasSoulPatch", "s0"."SquadId" AS "SquadId0", "g0"."HasSoulPatch" AS "HasSoulPatch0", "s0"."IsAutomatic", "s0"."Name", "g0"."LeaderNickname", "g0"."LeaderSquadId" FROM "Gears" AS "g0" LEFT JOIN ( - SELECT "w"."Id", "g1"."Nickname", "g1"."SquadId", "s"."Id" AS "Id0", "g2"."Nickname" AS "Nickname0", "g2"."HasSoulPatch", "g2"."SquadId" AS "SquadId0", "w"."IsAutomatic", "w"."Name", "w"."OwnerFullName" + SELECT "w"."Id", "g2"."Nickname", "g2"."HasSoulPatch", "g2"."SquadId", "w"."IsAutomatic", "w"."Name", "w"."OwnerFullName" FROM "Weapons" AS "w" LEFT JOIN "Gears" AS "g1" ON "w"."OwnerFullName" = "g1"."FullName" LEFT JOIN "Squads" AS "s" ON "g1"."SquadId" = "s"."Id" @@ -7089,7 +7083,7 @@ LEFT JOIN ( ) AS "s0" ON "g0"."FullName" = "s0"."OwnerFullName" ) AS "s1" ON "g"."Nickname" = "s1"."LeaderNickname" AND "g"."SquadId" = "s1"."LeaderSquadId" WHERE "g"."Discriminator" = 'Officer' -ORDER BY "g"."HasSoulPatch", "g"."LeaderNickname", "g"."FullName", "g"."Nickname", "g"."SquadId", "s1"."FullName", "s1"."HasSoulPatch0" DESC, "s1"."Nickname", "s1"."SquadId", "s1"."IsAutomatic", "s1"."Name" DESC, "s1"."Id", "s1"."Nickname0", "s1"."SquadId0", "s1"."Id0", "s1"."Nickname00" +ORDER BY "g"."HasSoulPatch", "g"."LeaderNickname", "g"."FullName", "g"."Nickname", "g"."SquadId", "s1"."FullName", "s1"."HasSoulPatch0" DESC, "s1"."Nickname", "s1"."SquadId", "s1"."IsAutomatic", "s1"."Name" DESC, "s1"."Id", "s1"."Nickname0" """); } @@ -7209,7 +7203,7 @@ public override async Task Correlated_collections_projection_of_collection_thru_ AssertSql( """ -SELECT "g"."Nickname", "g"."SquadId", "s"."Id", "s1"."SquadId", "s1"."MissionId" +SELECT "g"."Nickname", "g"."SquadId", "s1"."SquadId", "s1"."MissionId" FROM "Gears" AS "g" INNER JOIN "Squads" AS "s" ON "g"."SquadId" = "s"."Id" LEFT JOIN ( @@ -7218,7 +7212,7 @@ LEFT JOIN ( WHERE "s0"."MissionId" <> 17 ) AS "s1" ON "s"."Id" = "s1"."SquadId" WHERE "g"."Nickname" <> 'Marcus' -ORDER BY "g"."FullName", "g"."Nickname", "g"."SquadId", "s"."Id", "s1"."SquadId" +ORDER BY "g"."FullName", "g"."Nickname", "g"."SquadId", "s1"."SquadId" """); } @@ -7456,7 +7450,7 @@ public override async Task ThenInclude_collection_on_derived_after_base_referenc FROM "Tags" AS "t" LEFT JOIN "Gears" AS "g" ON "t"."GearNickName" = "g"."Nickname" AND "t"."GearSquadId" = "g"."SquadId" LEFT JOIN "Weapons" AS "w" ON "g"."FullName" = "w"."OwnerFullName" -ORDER BY "t"."Id", "g"."Nickname", "g"."SquadId" +ORDER BY "t"."Id" """); } @@ -7466,7 +7460,7 @@ public override async Task Project_collection_navigation_with_inheritance2(bool AssertSql( """ -SELECT "f"."Id", "l0"."Name", "g"."Nickname", "g"."SquadId", "g0"."Nickname", "g0"."SquadId", "g0"."AssignedCityName", "g0"."CityOfBirthName", "g0"."Discriminator", "g0"."FullName", "g0"."HasSoulPatch", "g0"."LeaderNickname", "g0"."LeaderSquadId", "g0"."Rank" +SELECT "f"."Id", "g0"."Nickname", "g0"."SquadId", "g0"."AssignedCityName", "g0"."CityOfBirthName", "g0"."Discriminator", "g0"."FullName", "g0"."HasSoulPatch", "g0"."LeaderNickname", "g0"."LeaderSquadId", "g0"."Rank" FROM "Factions" AS "f" LEFT JOIN ( SELECT "l"."Name", "l"."DefeatedByNickname", "l"."DefeatedBySquadId" @@ -7475,7 +7469,7 @@ LEFT JOIN ( ) AS "l0" ON "f"."CommanderName" = "l0"."Name" LEFT JOIN "Gears" AS "g" ON "l0"."DefeatedByNickname" = "g"."Nickname" AND "l0"."DefeatedBySquadId" = "g"."SquadId" LEFT JOIN "Gears" AS "g0" ON ("g"."Nickname" = "g0"."LeaderNickname" OR ("g"."Nickname" IS NULL AND "g0"."LeaderNickname" IS NULL)) AND "g"."SquadId" = "g0"."LeaderSquadId" -ORDER BY "f"."Id", "l0"."Name", "g"."Nickname", "g"."SquadId", "g0"."Nickname" +ORDER BY "f"."Id", "g0"."Nickname" """); } @@ -7587,7 +7581,7 @@ public override async Task Project_collection_navigation_with_inheritance3(bool AssertSql( """ -SELECT "f"."Id", "l0"."Name", "g"."Nickname", "g"."SquadId", "g0"."Nickname", "g0"."SquadId", "g0"."AssignedCityName", "g0"."CityOfBirthName", "g0"."Discriminator", "g0"."FullName", "g0"."HasSoulPatch", "g0"."LeaderNickname", "g0"."LeaderSquadId", "g0"."Rank" +SELECT "f"."Id", "g0"."Nickname", "g0"."SquadId", "g0"."AssignedCityName", "g0"."CityOfBirthName", "g0"."Discriminator", "g0"."FullName", "g0"."HasSoulPatch", "g0"."LeaderNickname", "g0"."LeaderSquadId", "g0"."Rank" FROM "Factions" AS "f" LEFT JOIN ( SELECT "l"."Name", "l"."DefeatedByNickname", "l"."DefeatedBySquadId" @@ -7596,7 +7590,7 @@ LEFT JOIN ( ) AS "l0" ON "f"."CommanderName" = "l0"."Name" LEFT JOIN "Gears" AS "g" ON "l0"."DefeatedByNickname" = "g"."Nickname" AND "l0"."DefeatedBySquadId" = "g"."SquadId" LEFT JOIN "Gears" AS "g0" ON ("g"."Nickname" = "g0"."LeaderNickname" OR ("g"."Nickname" IS NULL AND "g0"."LeaderNickname" IS NULL)) AND "g"."SquadId" = "g0"."LeaderSquadId" -ORDER BY "f"."Id", "l0"."Name", "g"."Nickname", "g"."SquadId", "g0"."Nickname" +ORDER BY "f"."Id", "g0"."Nickname" """); }